@cnrai/pave 0.11.108 → 0.11.109

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/package.json +1 -1
  2. package/pave.js +2 -2
  3. package/web/assets/{abnfDiagram-VCTEODGH-C7FOL3-u.js → abnfDiagram-VCTEODGH-CC-xFYNg.js} +1 -1
  4. package/web/assets/{arc-BRc5A1yw.js → arc-BcCUbsSP.js} +1 -1
  5. package/web/assets/{architectureDiagram-5GKGNRK7-D3BcYg2r.js → architectureDiagram-5GKGNRK7-CyQSqHig.js} +1 -1
  6. package/web/assets/{blockDiagram-I7D4REHJ-CF_-iaun.js → blockDiagram-I7D4REHJ-CJ91dcD6.js} +1 -1
  7. package/web/assets/{c4Diagram-7LVT6UL2-zhW2gHSL.js → c4Diagram-7LVT6UL2-D_-X7Yjr.js} +1 -1
  8. package/web/assets/channel-CEjU4fDa.js +1 -0
  9. package/web/assets/{chunk-2Q5K7J3B-DY7QZMMo.js → chunk-2Q5K7J3B-C6gOro1m.js} +1 -1
  10. package/web/assets/{chunk-5VM5RSS4-3I_pofP_.js → chunk-5VM5RSS4-CGRJglaM.js} +1 -1
  11. package/web/assets/{chunk-F27PBJKO-D5u5N7KW.js → chunk-F27PBJKO-UOTghLZP.js} +1 -1
  12. package/web/assets/{chunk-IMKFNOWR-BfbbGVlB.js → chunk-IMKFNOWR-C0b-G0_V.js} +1 -1
  13. package/web/assets/{chunk-JWPE2WC7-io3vEm5B.js → chunk-JWPE2WC7-Di_kgSVz.js} +1 -1
  14. package/web/assets/{chunk-POPQ4Y6H-Bf6OrRZ9.js → chunk-POPQ4Y6H-C4nqNNN7.js} +1 -1
  15. package/web/assets/{chunk-SVP7TREG-BOXaKiCJ.js → chunk-SVP7TREG-DU6uDevm.js} +1 -1
  16. package/web/assets/{chunk-TICWLB2K-B60vk_SL.js → chunk-TICWLB2K-4vOTFWBb.js} +1 -1
  17. package/web/assets/{chunk-XXDRQBXY-DQB-D5Kw.js → chunk-XXDRQBXY-DTOcYtq8.js} +1 -1
  18. package/web/assets/classDiagram-ZZMXUADV-E-NgWlu-.js +1 -0
  19. package/web/assets/classDiagram-v2-VYDZK3BY-E-NgWlu-.js +1 -0
  20. package/web/assets/{cose-bilkent-JH36ORCC-bfMKYaaU.js → cose-bilkent-JH36ORCC-CdWw2GLP.js} +1 -1
  21. package/web/assets/{cynefin-OW5HDTMX-CzRtRY7-.js → cynefin-OW5HDTMX-Blt6fqKS.js} +1 -1
  22. package/web/assets/{cynefinDiagram-5FMLGOSQ-CUMCB_Zy.js → cynefinDiagram-5FMLGOSQ-D9qoRKTN.js} +1 -1
  23. package/web/assets/{dagre-GXQ25YYZ-BvEOwwtY.js → dagre-GXQ25YYZ-CC-1na9O.js} +1 -1
  24. package/web/assets/{diagram-S7CK7UJ4-DQemhM43.js → diagram-S7CK7UJ4-Df-CWY8A.js} +1 -1
  25. package/web/assets/{diagram-UQ7AKVKN-sc4h0Qsv.js → diagram-UQ7AKVKN-aW8Ek_JV.js} +1 -1
  26. package/web/assets/{diagram-VSXAHHWV-BBwa4wEL.js → diagram-VSXAHHWV-B6xr9JII.js} +1 -1
  27. package/web/assets/{diagram-VX7I27RA-UuCdZHOf.js → diagram-VX7I27RA-DWIu_d6p.js} +1 -1
  28. package/web/assets/{diagram-Z3DM3KII-BktpqFre.js → diagram-Z3DM3KII-EXgUmMTe.js} +1 -1
  29. package/web/assets/{ebnfDiagram-PWID7BFC-CacOYoaf.js → ebnfDiagram-PWID7BFC-CBOMqJHL.js} +1 -1
  30. package/web/assets/{erDiagram-RLTQ6QDP-CmmKnMIP.js → erDiagram-RLTQ6QDP-BF3gbnFL.js} +1 -1
  31. package/web/assets/{flowDiagram-HODETNUW-evvyUXb_.js → flowDiagram-HODETNUW-7J0X-4Nv.js} +1 -1
  32. package/web/assets/{ganttDiagram-EL5Y4UJY-dWUFeIWw.js → ganttDiagram-EL5Y4UJY-BpmyN_um.js} +1 -1
  33. package/web/assets/{gitGraphDiagram-WWUBYQGX-By-K_SPc.js → gitGraphDiagram-WWUBYQGX-DIRj87w-.js} +1 -1
  34. package/web/assets/index-CXCEwDUr.js +130 -0
  35. package/web/assets/index-Dnk1ymJh.css +10 -0
  36. package/web/assets/{infoDiagram-27XIBGKW-BP3Wh-VS.js → infoDiagram-27XIBGKW-DtRkk-vx.js} +1 -1
  37. package/web/assets/{ishikawaDiagram-5VMMS53U-DGuSWCyR.js → ishikawaDiagram-5VMMS53U-BIgfj1dB.js} +1 -1
  38. package/web/assets/{journeyDiagram-3NMN7TZE-DNp0ft2I.js → journeyDiagram-3NMN7TZE-DMq06vMx.js} +1 -1
  39. package/web/assets/{kanban-definition-UXKFOSKX-CzCZvBfP.js → kanban-definition-UXKFOSKX-BkqsW8j9.js} +1 -1
  40. package/web/assets/{layout-9WDlxMrA.js → layout-981Tzerw.js} +1 -1
  41. package/web/assets/{linear-CZP__jeZ.js → linear-4S4e-iAF.js} +1 -1
  42. package/web/assets/{mermaid.core-Cx9gMKa8.js → mermaid.core-DMFcbM4K.js} +5 -5
  43. package/web/assets/{mindmap-definition-YA3MSWOX-BtEk9JE9.js → mindmap-definition-YA3MSWOX-D8ZZIE_M.js} +1 -1
  44. package/web/assets/{pegDiagram-XKGWAZYB-BJP2ukXu.js → pegDiagram-XKGWAZYB-B8laLHQf.js} +1 -1
  45. package/web/assets/{pieDiagram-E7YTZNPT-Dn4m8Ddk.js → pieDiagram-E7YTZNPT-BRvCWlLN.js} +1 -1
  46. package/web/assets/{quadrantDiagram-AXDQQJYC-DT1B_hW-.js → quadrantDiagram-AXDQQJYC-CN57k84W.js} +1 -1
  47. package/web/assets/{railroadDiagram-O6MQD6OU-_onKS9cV.js → railroadDiagram-O6MQD6OU-DlW8247Y.js} +1 -1
  48. package/web/assets/{requirementDiagram-BXWQKSXE-nm1t_F4E.js → requirementDiagram-BXWQKSXE-lt5wlCYl.js} +1 -1
  49. package/web/assets/{sankeyDiagram-P5KCCOFB-CVEAGkS-.js → sankeyDiagram-P5KCCOFB-C_RfLG0h.js} +1 -1
  50. package/web/assets/{sequenceDiagram-WJ2MYXX4-ZfkSEG_C.js → sequenceDiagram-WJ2MYXX4-xYFGXmlV.js} +1 -1
  51. package/web/assets/{sizeCapture-INFHLROL-BHhMi6Lx.js → sizeCapture-INFHLROL-ClbfSNGT.js} +1 -1
  52. package/web/assets/{stateDiagram-D77RDMKH-BmkZMrir.js → stateDiagram-D77RDMKH-D-js6COB.js} +1 -1
  53. package/web/assets/stateDiagram-v2-MP3YSRHH-DGfvbiyu.js +1 -0
  54. package/web/assets/{swimlanes-42K2YHIH-Dl_7Ltat.js → swimlanes-42K2YHIH-DFWAuiLv.js} +1 -1
  55. package/web/assets/swimlanesDiagram-VR7AAH4N-B0BGIkSi.js +8 -0
  56. package/web/assets/{timeline-definition-24CTP7MA-C7dD_6nn.js → timeline-definition-24CTP7MA-BxiETTFR.js} +1 -1
  57. package/web/assets/{vennDiagram-4TSXK5OY-D0DPqLIf.js → vennDiagram-4TSXK5OY-DH4jDRVe.js} +1 -1
  58. package/web/assets/{wardleyDiagram-VM6X3IG4-Bq7v6XT1.js → wardleyDiagram-VM6X3IG4-Dnf37haz.js} +1 -1
  59. package/web/assets/{xychartDiagram-S5SC5T6Z-By7o4pD7.js → xychartDiagram-S5SC5T6Z-JHevdcLS.js} +1 -1
  60. package/web/assets/{zh-TW-CoR3jQfM.js → zh-TW-BuoM8LhP.js} +1 -1
  61. package/web/fonts/OFL.txt +92 -0
  62. package/web/fonts/inter-var-latin.woff2 +0 -0
  63. package/web/index.html +2 -2
  64. package/web/assets/channel-B9jLDYtV.js +0 -1
  65. package/web/assets/classDiagram-ZZMXUADV-DEWInF6E.js +0 -1
  66. package/web/assets/classDiagram-v2-VYDZK3BY-DEWInF6E.js +0 -1
  67. package/web/assets/index-B87hi2au.js +0 -130
  68. package/web/assets/index-X3umQNqs.css +0 -10
  69. package/web/assets/stateDiagram-v2-MP3YSRHH-BgI6gtUp.js +0 -1
  70. package/web/assets/swimlanesDiagram-VR7AAH4N-CCIza_Fw.js +0 -8
@@ -0,0 +1,130 @@
1
+ (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))a(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const l of o.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&a(l)}).observe(document,{childList:!0,subtree:!0});function r(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function a(i){if(i.ep)return;i.ep=!0;const o=r(i);fetch(i.href,o)}})();var kd=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function jo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var gg={exports:{}},Sc={},hg={exports:{}},pr={};/**
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 o_;function kI(){if(o_)return pr;o_=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),l=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),h=Symbol.iterator;function m(U){return U===null||typeof U!="object"?null:(U=h&&U[h]||U["@@iterator"],typeof U=="function"?U:null)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},v=Object.assign,k={};function _(U,X,F){this.props=U,this.context=X,this.refs=k,this.updater=F||y}_.prototype.isReactComponent={},_.prototype.setState=function(U,X){if(typeof U!="object"&&typeof U!="function"&&U!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,U,X,"setState")},_.prototype.forceUpdate=function(U){this.updater.enqueueForceUpdate(this,U,"forceUpdate")};function w(){}w.prototype=_.prototype;function N(U,X,F){this.props=U,this.context=X,this.refs=k,this.updater=F||y}var E=N.prototype=new w;E.constructor=N,v(E,_.prototype),E.isPureReactComponent=!0;var A=Array.isArray,T=Object.prototype.hasOwnProperty,C={current:null},j={key:!0,ref:!0,__self:!0,__source:!0};function M(U,X,F){var Z,W={},G=null,oe=null;if(X!=null)for(Z in X.ref!==void 0&&(oe=X.ref),X.key!==void 0&&(G=""+X.key),X)T.call(X,Z)&&!j.hasOwnProperty(Z)&&(W[Z]=X[Z]);var Q=arguments.length-2;if(Q===1)W.children=F;else if(1<Q){for(var fe=Array(Q),ke=0;ke<Q;ke++)fe[ke]=arguments[ke+2];W.children=fe}if(U&&U.defaultProps)for(Z in Q=U.defaultProps,Q)W[Z]===void 0&&(W[Z]=Q[Z]);return{$$typeof:e,type:U,key:G,ref:oe,props:W,_owner:C.current}}function L(U,X){return{$$typeof:e,type:U.type,key:X,ref:U.ref,props:U.props,_owner:U._owner}}function I(U){return typeof U=="object"&&U!==null&&U.$$typeof===e}function B(U){var X={"=":"=0",":":"=2"};return"$"+U.replace(/[=:]/g,function(F){return X[F]})}var z=/\/+/g;function ee(U,X){return typeof U=="object"&&U!==null&&U.key!=null?B(""+U.key):X.toString(36)}function V(U,X,F,Z,W){var G=typeof U;(G==="undefined"||G==="boolean")&&(U=null);var oe=!1;if(U===null)oe=!0;else switch(G){case"string":case"number":oe=!0;break;case"object":switch(U.$$typeof){case e:case t:oe=!0}}if(oe)return oe=U,W=W(oe),U=Z===""?"."+ee(oe,0):Z,A(W)?(F="",U!=null&&(F=U.replace(z,"$&/")+"/"),V(W,X,F,"",function(ke){return ke})):W!=null&&(I(W)&&(W=L(W,F+(!W.key||oe&&oe.key===W.key?"":(""+W.key).replace(z,"$&/")+"/")+U)),X.push(W)),1;if(oe=0,Z=Z===""?".":Z+":",A(U))for(var Q=0;Q<U.length;Q++){G=U[Q];var fe=Z+ee(G,Q);oe+=V(G,X,F,fe,W)}else if(fe=m(U),typeof fe=="function")for(U=fe.call(U),Q=0;!(G=U.next()).done;)G=G.value,fe=Z+ee(G,Q++),oe+=V(G,X,F,fe,W);else if(G==="object")throw X=String(U),Error("Objects are not valid as a React child (found: "+(X==="[object Object]"?"object with keys {"+Object.keys(U).join(", ")+"}":X)+"). If you meant to render a collection of children, use an array instead.");return oe}function D(U,X,F){if(U==null)return U;var Z=[],W=0;return V(U,Z,"","",function(G){return X.call(F,G,W++)}),Z}function K(U){if(U._status===-1){var X=U._result;X=X(),X.then(function(F){(U._status===0||U._status===-1)&&(U._status=1,U._result=F)},function(F){(U._status===0||U._status===-1)&&(U._status=2,U._result=F)}),U._status===-1&&(U._status=0,U._result=X)}if(U._status===1)return U._result.default;throw U._result}var H={current:null},J={transition:null},ne={ReactCurrentDispatcher:H,ReactCurrentBatchConfig:J,ReactCurrentOwner:C};function P(){throw Error("act(...) is not supported in production builds of React.")}return pr.Children={map:D,forEach:function(U,X,F){D(U,function(){X.apply(this,arguments)},F)},count:function(U){var X=0;return D(U,function(){X++}),X},toArray:function(U){return D(U,function(X){return X})||[]},only:function(U){if(!I(U))throw Error("React.Children.only expected to receive a single React element child.");return U}},pr.Component=_,pr.Fragment=r,pr.Profiler=i,pr.PureComponent=N,pr.StrictMode=a,pr.Suspense=d,pr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ne,pr.act=P,pr.cloneElement=function(U,X,F){if(U==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+U+".");var Z=v({},U.props),W=U.key,G=U.ref,oe=U._owner;if(X!=null){if(X.ref!==void 0&&(G=X.ref,oe=C.current),X.key!==void 0&&(W=""+X.key),U.type&&U.type.defaultProps)var Q=U.type.defaultProps;for(fe in X)T.call(X,fe)&&!j.hasOwnProperty(fe)&&(Z[fe]=X[fe]===void 0&&Q!==void 0?Q[fe]:X[fe])}var fe=arguments.length-2;if(fe===1)Z.children=F;else if(1<fe){Q=Array(fe);for(var ke=0;ke<fe;ke++)Q[ke]=arguments[ke+2];Z.children=Q}return{$$typeof:e,type:U.type,key:W,ref:G,props:Z,_owner:oe}},pr.createContext=function(U){return U={$$typeof:l,_currentValue:U,_currentValue2:U,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},U.Provider={$$typeof:o,_context:U},U.Consumer=U},pr.createElement=M,pr.createFactory=function(U){var X=M.bind(null,U);return X.type=U,X},pr.createRef=function(){return{current:null}},pr.forwardRef=function(U){return{$$typeof:u,render:U}},pr.isValidElement=I,pr.lazy=function(U){return{$$typeof:p,_payload:{_status:-1,_result:U},_init:K}},pr.memo=function(U,X){return{$$typeof:f,type:U,compare:X===void 0?null:X}},pr.startTransition=function(U){var X=J.transition;J.transition={};try{U()}finally{J.transition=X}},pr.unstable_act=P,pr.useCallback=function(U,X){return H.current.useCallback(U,X)},pr.useContext=function(U){return H.current.useContext(U)},pr.useDebugValue=function(){},pr.useDeferredValue=function(U){return H.current.useDeferredValue(U)},pr.useEffect=function(U,X){return H.current.useEffect(U,X)},pr.useId=function(){return H.current.useId()},pr.useImperativeHandle=function(U,X,F){return H.current.useImperativeHandle(U,X,F)},pr.useInsertionEffect=function(U,X){return H.current.useInsertionEffect(U,X)},pr.useLayoutEffect=function(U,X){return H.current.useLayoutEffect(U,X)},pr.useMemo=function(U,X){return H.current.useMemo(U,X)},pr.useReducer=function(U,X,F){return H.current.useReducer(U,X,F)},pr.useRef=function(U){return H.current.useRef(U)},pr.useState=function(U){return H.current.useState(U)},pr.useSyncExternalStore=function(U,X,F){return H.current.useSyncExternalStore(U,X,F)},pr.useTransition=function(){return H.current.useTransition()},pr.version="18.3.1",pr}var l_;function Nv(){return l_||(l_=1,hg.exports=kI()),hg.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 c_;function _I(){if(c_)return Sc;c_=1;var e=Nv(),t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function l(u,d,f){var p,h={},m=null,y=null;f!==void 0&&(m=""+f),d.key!==void 0&&(m=""+d.key),d.ref!==void 0&&(y=d.ref);for(p in d)a.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:y,props:h,_owner:i.current}}return Sc.Fragment=r,Sc.jsx=l,Sc.jsxs=l,Sc}var u_;function wI(){return u_||(u_=1,gg.exports=_I()),gg.exports}var n=wI(),x=Nv();const Ft=jo(x);var _d={},mg={exports:{}},xa={},xg={exports:{}},yg={};/**
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 d_;function SI(){return d_||(d_=1,(function(e){function t(J,ne){var P=J.length;J.push(ne);e:for(;0<P;){var U=P-1>>>1,X=J[U];if(0<i(X,ne))J[U]=ne,J[P]=X,P=U;else break e}}function r(J){return J.length===0?null:J[0]}function a(J){if(J.length===0)return null;var ne=J[0],P=J.pop();if(P!==ne){J[0]=P;e:for(var U=0,X=J.length,F=X>>>1;U<F;){var Z=2*(U+1)-1,W=J[Z],G=Z+1,oe=J[G];if(0>i(W,P))G<X&&0>i(oe,W)?(J[U]=oe,J[G]=P,U=G):(J[U]=W,J[Z]=P,U=Z);else if(G<X&&0>i(oe,P))J[U]=oe,J[G]=P,U=G;else break e}}return ne}function i(J,ne){var P=J.sortIndex-ne.sortIndex;return P!==0?P:J.id-ne.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,y=!1,v=!1,k=!1,_=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function E(J){for(var ne=r(f);ne!==null;){if(ne.callback===null)a(f);else if(ne.startTime<=J)a(f),ne.sortIndex=ne.expirationTime,t(d,ne);else break;ne=r(f)}}function A(J){if(k=!1,E(J),!v)if(r(d)!==null)v=!0,K(T);else{var ne=r(f);ne!==null&&H(A,ne.startTime-J)}}function T(J,ne){v=!1,k&&(k=!1,w(M),M=-1),y=!0;var P=m;try{for(E(ne),h=r(d);h!==null&&(!(h.expirationTime>ne)||J&&!B());){var U=h.callback;if(typeof U=="function"){h.callback=null,m=h.priorityLevel;var X=U(h.expirationTime<=ne);ne=e.unstable_now(),typeof X=="function"?h.callback=X:h===r(d)&&a(d),E(ne)}else a(d);h=r(d)}if(h!==null)var F=!0;else{var Z=r(f);Z!==null&&H(A,Z.startTime-ne),F=!1}return F}finally{h=null,m=P,y=!1}}var C=!1,j=null,M=-1,L=5,I=-1;function B(){return!(e.unstable_now()-I<L)}function z(){if(j!==null){var J=e.unstable_now();I=J;var ne=!0;try{ne=j(!0,J)}finally{ne?ee():(C=!1,j=null)}}else C=!1}var ee;if(typeof N=="function")ee=function(){N(z)};else if(typeof MessageChannel<"u"){var V=new MessageChannel,D=V.port2;V.port1.onmessage=z,ee=function(){D.postMessage(null)}}else ee=function(){_(z,0)};function K(J){j=J,C||(C=!0,ee())}function H(J,ne){M=_(function(){J(e.unstable_now())},ne)}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(J){J.callback=null},e.unstable_continueExecution=function(){v||y||(v=!0,K(T))},e.unstable_forceFrameRate=function(J){0>J||125<J?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):L=0<J?Math.floor(1e3/J):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_getFirstCallbackNode=function(){return r(d)},e.unstable_next=function(J){switch(m){case 1:case 2:case 3:var ne=3;break;default:ne=m}var P=m;m=ne;try{return J()}finally{m=P}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(J,ne){switch(J){case 1:case 2:case 3:case 4:case 5:break;default:J=3}var P=m;m=J;try{return ne()}finally{m=P}},e.unstable_scheduleCallback=function(J,ne,P){var U=e.unstable_now();switch(typeof P=="object"&&P!==null?(P=P.delay,P=typeof P=="number"&&0<P?U+P:U):P=U,J){case 1:var X=-1;break;case 2:X=250;break;case 5:X=1073741823;break;case 4:X=1e4;break;default:X=5e3}return X=P+X,J={id:p++,callback:ne,priorityLevel:J,startTime:P,expirationTime:X,sortIndex:-1},P>U?(J.sortIndex=P,t(f,J),r(d)===null&&J===r(f)&&(k?(w(M),M=-1):k=!0,H(A,P-U))):(J.sortIndex=X,t(d,J),v||y||(v=!0,K(T))),J},e.unstable_shouldYield=B,e.unstable_wrapCallback=function(J){var ne=m;return function(){var P=m;m=ne;try{return J.apply(this,arguments)}finally{m=P}}}})(yg)),yg}var f_;function NI(){return f_||(f_=1,xg.exports=SI()),xg.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 p_;function EI(){if(p_)return xa;p_=1;var e=Nv(),t=NI();function r(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 a=new Set,i={};function o(s,c){l(s,c),l(s+"Capture",c)}function l(s,c){for(i[s]=c,s=0;s<c.length;s++)a.add(c[s])}var u=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),d=Object.prototype.hasOwnProperty,f=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,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 y(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"||y(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,S,R,q){this.acceptsBooleans=c===2||c===3||c===4,this.attributeName=b,this.attributeNamespace=S,this.mustUseProperty=g,this.propertyName=s,this.type=c,this.sanitizeURL=R,this.removeEmptyString=q}var _={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(s){_[s]=new k(s,0,!1,s,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(s){var c=s[0];_[c]=new k(c,1,!1,s[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(s){_[s]=new k(s,2,!1,s.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(s){_[s]=new k(s,2,!1,s,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(s){_[s]=new k(s,3,!1,s.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(s){_[s]=new k(s,3,!0,s,null,!1,!1)}),["capture","download"].forEach(function(s){_[s]=new k(s,4,!1,s,null,!1,!1)}),["cols","rows","size","span"].forEach(function(s){_[s]=new k(s,6,!1,s,null,!1,!1)}),["rowSpan","start"].forEach(function(s){_[s]=new k(s,5,!1,s.toLowerCase(),null,!1,!1)});var w=/[\-:]([a-z])/g;function N(s){return s[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(s){var c=s.replace(w,N);_[c]=new k(c,1,!1,s,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(s){var c=s.replace(w,N);_[c]=new k(c,1,!1,s,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(s){var c=s.replace(w,N);_[c]=new k(c,1,!1,s,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(s){_[s]=new k(s,1,!1,s.toLowerCase(),null,!1,!1)}),_.xlinkHref=new k("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(s){_[s]=new k(s,1,!1,s.toLowerCase(),null,!0,!0)});function E(s,c,g,b){var S=_.hasOwnProperty(c)?_[c]:null;(S!==null?S.type!==0:b||!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(v(c,g,S,b)&&(g=null),b||S===null?m(c)&&(g===null?s.removeAttribute(c):s.setAttribute(c,""+g)):S.mustUseProperty?s[S.propertyName]=g===null?S.type===3?!1:"":g:(c=S.attributeName,b=S.attributeNamespace,g===null?s.removeAttribute(c):(S=S.type,g=S===3||S===4&&g===!0?"":""+g,b?s.setAttributeNS(b,c,g):s.setAttribute(c,g))))}var A=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,T=Symbol.for("react.element"),C=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),L=Symbol.for("react.profiler"),I=Symbol.for("react.provider"),B=Symbol.for("react.context"),z=Symbol.for("react.forward_ref"),ee=Symbol.for("react.suspense"),V=Symbol.for("react.suspense_list"),D=Symbol.for("react.memo"),K=Symbol.for("react.lazy"),H=Symbol.for("react.offscreen"),J=Symbol.iterator;function ne(s){return s===null||typeof s!="object"?null:(s=J&&s[J]||s["@@iterator"],typeof s=="function"?s:null)}var P=Object.assign,U;function X(s){if(U===void 0)try{throw Error()}catch(g){var c=g.stack.trim().match(/\n( *(at )?)/);U=c&&c[1]||""}return`
34
+ `+U+s}var F=!1;function Z(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(Te){var b=Te}Reflect.construct(s,[],c)}else{try{c.call()}catch(Te){b=Te}s.call(c.prototype)}else{try{throw Error()}catch(Te){b=Te}s()}}catch(Te){if(Te&&b&&typeof Te.stack=="string"){for(var S=Te.stack.split(`
35
+ `),R=b.stack.split(`
36
+ `),q=S.length-1,le=R.length-1;1<=q&&0<=le&&S[q]!==R[le];)le--;for(;1<=q&&0<=le;q--,le--)if(S[q]!==R[le]){if(q!==1||le!==1)do if(q--,le--,0>le||S[q]!==R[le]){var pe=`
37
+ `+S[q].replace(" at new "," at ");return s.displayName&&pe.includes("<anonymous>")&&(pe=pe.replace("<anonymous>",s.displayName)),pe}while(1<=q&&0<=le);break}}}finally{F=!1,Error.prepareStackTrace=g}return(s=s?s.displayName||s.name:"")?X(s):""}function W(s){switch(s.tag){case 5:return X(s.type);case 16:return X("Lazy");case 13:return X("Suspense");case 19:return X("SuspenseList");case 0:case 2:case 15:return s=Z(s.type,!1),s;case 11:return s=Z(s.type.render,!1),s;case 1:return s=Z(s.type,!0),s;default:return""}}function G(s){if(s==null)return null;if(typeof s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case j:return"Fragment";case C:return"Portal";case L:return"Profiler";case M:return"StrictMode";case ee:return"Suspense";case V:return"SuspenseList"}if(typeof s=="object")switch(s.$$typeof){case B:return(s.displayName||"Context")+".Consumer";case I:return(s._context.displayName||"Context")+".Provider";case z:var c=s.render;return s=s.displayName,s||(s=c.displayName||c.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case D:return c=s.displayName||null,c!==null?c:G(s.type)||"Memo";case K:c=s._payload,s=s._init;try{return G(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 G(c);case 8:return c===M?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof c=="function")return c.displayName||c.name||null;if(typeof c=="string")return c}return null}function Q(s){switch(typeof s){case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function fe(s){var c=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(c==="checkbox"||c==="radio")}function ke(s){var c=fe(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 S=g.get,R=g.set;return Object.defineProperty(s,c,{configurable:!0,get:function(){return S.call(this)},set:function(q){b=""+q,R.call(this,q)}}),Object.defineProperty(s,c,{enumerable:g.enumerable}),{getValue:function(){return b},setValue:function(q){b=""+q},stopTracking:function(){s._valueTracker=null,delete s[c]}}}}function Fe(s){s._valueTracker||(s._valueTracker=ke(s))}function Ve(s){if(!s)return!1;var c=s._valueTracker;if(!c)return!0;var g=c.getValue(),b="";return s&&(b=fe(s)?s.checked?"true":"false":s.value),s=b,s!==g?(c.setValue(s),!0):!1}function Ge(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 qe(s,c){var g=c.checked;return P({},c,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:g??s._wrapperState.initialChecked})}function Ce(s,c){var g=c.defaultValue==null?"":c.defaultValue,b=c.checked!=null?c.checked:c.defaultChecked;g=Q(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 He(s,c){c=c.checked,c!=null&&E(s,"checked",c,!1)}function ze(s,c){He(s,c);var g=Q(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")?mt(s,c.type,g):c.hasOwnProperty("defaultValue")&&mt(s,c.type,Q(c.defaultValue)),c.checked==null&&c.defaultChecked!=null&&(s.defaultChecked=!!c.defaultChecked)}function gt(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 mt(s,c,g){(c!=="number"||Ge(s.ownerDocument)!==s)&&(g==null?s.defaultValue=""+s._wrapperState.initialValue:s.defaultValue!==""+g&&(s.defaultValue=""+g))}var wt=Array.isArray;function $e(s,c,g,b){if(s=s.options,c){c={};for(var S=0;S<g.length;S++)c["$"+g[S]]=!0;for(g=0;g<s.length;g++)S=c.hasOwnProperty("$"+s[g].value),s[g].selected!==S&&(s[g].selected=S),S&&b&&(s[g].defaultSelected=!0)}else{for(g=""+Q(g),c=null,S=0;S<s.length;S++){if(s[S].value===g){s[S].selected=!0,b&&(s[S].defaultSelected=!0);return}c!==null||s[S].disabled||(c=s[S])}c!==null&&(c.selected=!0)}}function Et(s,c){if(c.dangerouslySetInnerHTML!=null)throw Error(r(91));return P({},c,{value:void 0,defaultValue:void 0,children:""+s._wrapperState.initialValue})}function Ze(s,c){var g=c.value;if(g==null){if(g=c.children,c=c.defaultValue,g!=null){if(c!=null)throw Error(r(92));if(wt(g)){if(1<g.length)throw Error(r(93));g=g[0]}c=g}c==null&&(c=""),g=c}s._wrapperState={initialValue:Q(g)}}function Oe(s,c){var g=Q(c.value),b=Q(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 it(s){var c=s.textContent;c===s._wrapperState.initialValue&&c!==""&&c!==null&&(s.value=c)}function me(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 Ee(s,c){return s==null||s==="http://www.w3.org/1999/xhtml"?me(c):s==="http://www.w3.org/2000/svg"&&c==="foreignObject"?"http://www.w3.org/1999/xhtml":s}var ge,je=(function(s){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(c,g,b,S){MSApp.execUnsafeLocalFunction(function(){return s(c,g,b,S)})}:s})(function(s,c){if(s.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in s)s.innerHTML=c;else{for(ge=ge||document.createElement("div"),ge.innerHTML="<svg>"+c.valueOf().toString()+"</svg>",c=ge.firstChild;s.firstChild;)s.removeChild(s.firstChild);for(;c.firstChild;)s.appendChild(c.firstChild)}});function se(s,c){if(c){var g=s.firstChild;if(g&&g===s.lastChild&&g.nodeType===3){g.nodeValue=c;return}}s.textContent=c}var De={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},rt=["Webkit","ms","Moz","O"];Object.keys(De).forEach(function(s){rt.forEach(function(c){c=c+s.charAt(0).toUpperCase()+s.substring(1),De[c]=De[s]})});function dt(s,c,g){return c==null||typeof c=="boolean"||c===""?"":g||typeof c!="number"||c===0||De.hasOwnProperty(s)&&De[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,S=dt(g,c[g],b);g==="float"&&(g="cssFloat"),b?s.setProperty(g,S):s[g]=S}}var Lt=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 ot(s,c){if(c){if(Lt[s]&&(c.children!=null||c.dangerouslySetInnerHTML!=null))throw Error(r(137,s));if(c.dangerouslySetInnerHTML!=null){if(c.children!=null)throw Error(r(60));if(typeof c.dangerouslySetInnerHTML!="object"||!("__html"in c.dangerouslySetInnerHTML))throw Error(r(61))}if(c.style!=null&&typeof c.style!="object")throw Error(r(62))}}function et(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 Ot=null;function gr(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var dr=null,or=null,Qt=null;function $r(s){if(s=jt(s)){if(typeof dr!="function")throw Error(r(280));var c=s.stateNode;c&&(c=Er(c),dr(s.stateNode,s.type,c))}}function ue(s){or?Qt?Qt.push(s):Qt=[s]:or=s}function Le(){if(or){var s=or,c=Qt;if(Qt=or=null,$r(s),c)for(s=0;s<c.length;s++)$r(c[s])}}function ct(s,c){return s(c)}function Be(){}var nt=!1;function kt(s,c,g){if(nt)return s(c,g);nt=!0;try{return ct(s,c,g)}finally{nt=!1,(or!==null||Qt!==null)&&(Be(),Le())}}function at(s,c){var g=s.stateNode;if(g===null)return null;var b=Er(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(r(231,c,typeof g));return g}var re=!1;if(u)try{var ve={};Object.defineProperty(ve,"passive",{get:function(){re=!0}}),window.addEventListener("test",ve,ve),window.removeEventListener("test",ve,ve)}catch{re=!1}function Re(s,c,g,b,S,R,q,le,pe){var Te=Array.prototype.slice.call(arguments,3);try{c.apply(g,Te)}catch(Xe){this.onError(Xe)}}var ie=!1,Rt=null,ft=!1,Ut=null,Me={onError:function(s){ie=!0,Rt=s}};function Tt(s,c,g,b,S,R,q,le,pe){ie=!1,Rt=null,Re.apply(Me,arguments)}function tr(s,c,g,b,S,R,q,le,pe){if(Tt.apply(this,arguments),ie){if(ie){var Te=Rt;ie=!1,Rt=null}else throw Error(r(198));ft||(ft=!0,Ut=Te)}}function rn(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 hn(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 mn(s){if(rn(s)!==s)throw Error(r(188))}function yr(s){var c=s.alternate;if(!c){if(c=rn(s),c===null)throw Error(r(188));return c!==s?null:s}for(var g=s,b=c;;){var S=g.return;if(S===null)break;var R=S.alternate;if(R===null){if(b=S.return,b!==null){g=b;continue}break}if(S.child===R.child){for(R=S.child;R;){if(R===g)return mn(S),s;if(R===b)return mn(S),c;R=R.sibling}throw Error(r(188))}if(g.return!==b.return)g=S,b=R;else{for(var q=!1,le=S.child;le;){if(le===g){q=!0,g=S,b=R;break}if(le===b){q=!0,b=S,g=R;break}le=le.sibling}if(!q){for(le=R.child;le;){if(le===g){q=!0,g=R,b=S;break}if(le===b){q=!0,b=R,g=S;break}le=le.sibling}if(!q)throw Error(r(189))}}if(g.alternate!==b)throw Error(r(190))}if(g.tag!==3)throw Error(r(188));return g.stateNode.current===g?s:c}function oa(s){return s=yr(s),s!==null?ri(s):null}function ri(s){if(s.tag===5||s.tag===6)return s;for(s=s.child;s!==null;){var c=ri(s);if(c!==null)return c;s=s.sibling}return null}var _a=t.unstable_scheduleCallback,un=t.unstable_cancelCallback,wa=t.unstable_shouldYield,la=t.unstable_requestPaint,Lr=t.unstable_now,ki=t.unstable_getCurrentPriorityLevel,ni=t.unstable_ImmediatePriority,ca=t.unstable_UserBlockingPriority,jn=t.unstable_NormalPriority,Je=t.unstable_LowPriority,_t=t.unstable_IdlePriority,qt=null,Gt=null;function Or(s){if(Gt&&typeof Gt.onCommitFiberRoot=="function")try{Gt.onCommitFiberRoot(qt,s,void 0,(s.current.flags&128)===128)}catch{}}var vr=Math.clz32?Math.clz32:fn,Pn=Math.log,Ua=Math.LN2;function fn(s){return s>>>=0,s===0?32:31-(Pn(s)/Ua|0)|0}var Wr=64,Zr=4194304;function Tr(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 Fn(s,c){var g=s.pendingLanes;if(g===0)return 0;var b=0,S=s.suspendedLanes,R=s.pingedLanes,q=g&268435455;if(q!==0){var le=q&~S;le!==0?b=Tr(le):(R&=q,R!==0&&(b=Tr(R)))}else q=g&~S,q!==0?b=Tr(q):R!==0&&(b=Tr(R));if(b===0)return 0;if(c!==0&&c!==b&&(c&S)===0&&(S=b&-b,R=c&-c,S>=R||S===16&&(R&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-vr(c),S=1<<g,b|=s[g],c&=~S;return b}function ai(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 nn(s,c){for(var g=s.suspendedLanes,b=s.pingedLanes,S=s.expirationTimes,R=s.pendingLanes;0<R;){var q=31-vr(R),le=1<<q,pe=S[q];pe===-1?((le&g)===0||(le&b)!==0)&&(S[q]=ai(le,c)):pe<=c&&(s.expiredLanes|=le),R&=~le}}function ua(s){return s=s.pendingLanes&-1073741825,s!==0?s:s&1073741824?1073741824:0}function Cn(){var s=Wr;return Wr<<=1,(Wr&4194240)===0&&(Wr=64),s}function qa(s){for(var c=[],g=0;31>g;g++)c.push(s);return c}function Jn(s,c,g){s.pendingLanes|=c,c!==536870912&&(s.suspendedLanes=0,s.pingedLanes=0),s=s.eventTimes,c=31-vr(c),s[c]=g}function Bn(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 S=31-vr(g),R=1<<S;c[S]=0,b[S]=-1,s[S]=-1,g&=~R}}function Sa(s,c){var g=s.entangledLanes|=c;for(s=s.entanglements;g;){var b=31-vr(g),S=1<<b;S&c|s[b]&c&&(s[b]|=c),g&=~S}}var fr=0;function Kt(s){return s&=-s,1<s?4<s?(s&268435455)!==0?16:536870912:4:1}var da,zr,kr,zn,Tn,bt=!1,Ye=[],$=null,ce=null,Se=null,We=new Map,ht=new Map,St=[],Sr="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 Nr(s,c){switch(s){case"focusin":case"focusout":$=null;break;case"dragenter":case"dragleave":ce=null;break;case"mouseover":case"mouseout":Se=null;break;case"pointerover":case"pointerout":We.delete(c.pointerId);break;case"gotpointercapture":case"lostpointercapture":ht.delete(c.pointerId)}}function Hr(s,c,g,b,S,R){return s===null||s.nativeEvent!==R?(s={blockedOn:c,domEventName:g,eventSystemFlags:b,nativeEvent:R,targetContainers:[S]},c!==null&&(c=jt(c),c!==null&&zr(c)),s):(s.eventSystemFlags|=b,c=s.targetContainers,S!==null&&c.indexOf(S)===-1&&c.push(S),s)}function Rn(s,c,g,b,S){switch(c){case"focusin":return $=Hr($,s,c,g,b,S),!0;case"dragenter":return ce=Hr(ce,s,c,g,b,S),!0;case"mouseover":return Se=Hr(Se,s,c,g,b,S),!0;case"pointerover":var R=S.pointerId;return We.set(R,Hr(We.get(R)||null,s,c,g,b,S)),!0;case"gotpointercapture":return R=S.pointerId,ht.set(R,Hr(ht.get(R)||null,s,c,g,b,S)),!0}return!1}function _i(s){var c=Ie(s.target);if(c!==null){var g=rn(c);if(g!==null){if(c=g.tag,c===13){if(c=hn(g),c!==null){s.blockedOn=c,Tn(s.priority,function(){kr(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 an(s){if(s.blockedOn!==null)return!1;for(var c=s.targetContainers;0<c.length;){var g=ns(s.domEventName,s.eventSystemFlags,c[0],s.nativeEvent);if(g===null){g=s.nativeEvent;var b=new g.constructor(g.type,g);Ot=b,g.target.dispatchEvent(b),Ot=null}else return c=jt(g),c!==null&&zr(c),s.blockedOn=g,!1;c.shift()}return!0}function Fs(s,c,g){an(s)&&g.delete(c)}function Do(){bt=!1,$!==null&&an($)&&($=null),ce!==null&&an(ce)&&(ce=null),Se!==null&&an(Se)&&(Se=null),We.forEach(Fs),ht.forEach(Fs)}function Bs(s,c){s.blockedOn===c&&(s.blockedOn=null,bt||(bt=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Do)))}function zs(s){function c(S){return Bs(S,s)}if(0<Ye.length){Bs(Ye[0],s);for(var g=1;g<Ye.length;g++){var b=Ye[g];b.blockedOn===s&&(b.blockedOn=null)}}for($!==null&&Bs($,s),ce!==null&&Bs(ce,s),Se!==null&&Bs(Se,s),We.forEach(c),ht.forEach(c),g=0;g<St.length;g++)b=St[g],b.blockedOn===s&&(b.blockedOn=null);for(;0<St.length&&(g=St[0],g.blockedOn===null);)_i(g),g.blockedOn===null&&St.shift()}var Ha=A.ReactCurrentBatchConfig,Po=!0;function Fo(s,c,g,b){var S=fr,R=Ha.transition;Ha.transition=null;try{fr=1,Us(s,c,g,b)}finally{fr=S,Ha.transition=R}}function ql(s,c,g,b){var S=fr,R=Ha.transition;Ha.transition=null;try{fr=4,Us(s,c,g,b)}finally{fr=S,Ha.transition=R}}function Us(s,c,g,b){if(Po){var S=ns(s,c,g,b);if(S===null)ja(s,c,b,Fi,g),Nr(s,b);else if(Rn(S,s,c,g,b))b.stopPropagation();else if(Nr(s,b),c&4&&-1<Sr.indexOf(s)){for(;S!==null;){var R=jt(S);if(R!==null&&da(R),R=ns(s,c,g,b),R===null&&ja(s,c,b,Fi,g),R===S)break;S=R}S!==null&&b.stopPropagation()}else ja(s,c,b,null,g)}}var Fi=null;function ns(s,c,g,b){if(Fi=null,s=gr(b),s=Ie(s),s!==null)if(c=rn(s),c===null)s=null;else if(g=c.tag,g===13){if(s=hn(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 Fi=s,null}function as(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(ki()){case ni:return 1;case ca:return 4;case jn:case Je:return 16;case _t:return 536870912;default:return 16}default:return 16}}var Un=null,ea=null,Bi=null;function zi(){if(Bi)return Bi;var s,c=ea,g=c.length,b,S="value"in Un?Un.value:Un.textContent,R=S.length;for(s=0;s<g&&c[s]===S[s];s++);var q=g-s;for(b=1;b<=q&&c[g-b]===S[R-b];b++);return Bi=S.slice(s,1<b?1-b:void 0)}function ii(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 is(){return!0}function Hl(){return!1}function Vr(s){function c(g,b,S,R,q){this._reactName=g,this._targetInst=S,this.type=b,this.nativeEvent=R,this.target=q,this.currentTarget=null;for(var le in s)s.hasOwnProperty(le)&&(g=s[le],this[le]=g?g(R):R[le]);return this.isDefaultPrevented=(R.defaultPrevented!=null?R.defaultPrevented:R.returnValue===!1)?is:Hl,this.isPropagationStopped=Hl,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=is)},stopPropagation:function(){var g=this.nativeEvent;g&&(g.stopPropagation?g.stopPropagation():typeof g.cancelBubble!="unknown"&&(g.cancelBubble=!0),this.isPropagationStopped=is)},persist:function(){},isPersistent:is}),c}var Ui={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Na=Vr(Ui),qs=P({},Ui,{view:0,detail:0}),Kf=Vr(qs),Hs,$l,$s,Bo=P({},qs,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:wi,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!==$s&&($s&&s.type==="mousemove"?(Hs=s.screenX-$s.screenX,$l=s.screenY-$s.screenY):$l=Hs=0,$s=s),Hs)},movementY:function(s){return"movementY"in s?s.movementY:$l}}),Wl=Vr(Bo),zo=P({},Bo,{dataTransfer:0}),vu=Vr(zo),Yf=P({},qs,{relatedTarget:0}),ss=Vr(Yf),Vl=P({},Ui,{animationName:0,elapsedTime:0,pseudoElement:0}),ku=Vr(Vl),Gl=P({},Ui,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),Kl=Vr(Gl),_u=P({},Ui,{data:0}),Uo=Vr(_u),Xf={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Qf={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"},wu={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function qo(s){var c=this.nativeEvent;return c.getModifierState?c.getModifierState(s):(s=wu[s])?!!c[s]:!1}function wi(){return qo}var Su=P({},qs,{key:function(s){if(s.key){var c=Xf[s.key]||s.key;if(c!=="Unidentified")return c}return s.type==="keypress"?(s=ii(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?Qf[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:wi,charCode:function(s){return s.type==="keypress"?ii(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?ii(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),Zf=Vr(Su),Nu=P({},Bo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),os=Vr(Nu),Yl=P({},qs,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:wi}),Ws=Vr(Yl),Jf=P({},Ui,{propertyName:0,elapsedTime:0,pseudoElement:0}),Xl=Vr(Jf),ep=P({},Bo,{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}),Ql=Vr(ep),tp=[9,13,27,32],ls=u&&"CompositionEvent"in window,Vs=null;u&&"documentMode"in document&&(Vs=document.documentMode);var Gs=u&&"TextEvent"in window&&!Vs,Eu=u&&(!ls||Vs&&8<Vs&&11>=Vs),Ks=" ",si=!1;function ju(s,c){switch(s){case"keyup":return tp.indexOf(c.keyCode)!==-1;case"keydown":return c.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Zl(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var qi=!1;function Ho(s,c){switch(s){case"compositionend":return Zl(c);case"keypress":return c.which!==32?null:(si=!0,Ks);case"textInput":return s=c.data,s===Ks&&si?null:s;default:return null}}function rp(s,c){if(qi)return s==="compositionend"||!ls&&ju(s,c)?(s=zi(),Bi=ea=Un=null,qi=!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 Eu&&c.locale!=="ko"?null:c.data;default:return null}}var Jl={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 ec(s){var c=s&&s.nodeName&&s.nodeName.toLowerCase();return c==="input"?!!Jl[s.type]:c==="textarea"}function Dt(s,c,g,b){ue(b),c=tl(c,"onChange"),0<c.length&&(g=new Na("onChange","change",null,g,b),s.push({event:g,listeners:c}))}var cs=null,kn=null;function np(s){Pu(s,0)}function us(s){var c=lr(s);if(Ve(c))return s}function tc(s,c){if(s==="change")return c}var Hi=!1;if(u){var rc;if(u){var $a="oninput"in document;if(!$a){var $o=document.createElement("div");$o.setAttribute("oninput","return;"),$a=typeof $o.oninput=="function"}rc=$a}else rc=!1;Hi=rc&&(!document.documentMode||9<document.documentMode)}function fa(){cs&&(cs.detachEvent("onpropertychange",Ys),kn=cs=null)}function Ys(s){if(s.propertyName==="value"&&us(kn)){var c=[];Dt(c,kn,s,gr(s)),kt(np,c)}}function Wo(s,c,g){s==="focusin"?(fa(),cs=c,kn=g,cs.attachEvent("onpropertychange",Ys)):s==="focusout"&&fa()}function Vo(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return us(kn)}function ap(s,c){if(s==="click")return us(c)}function Cu(s,c){if(s==="input"||s==="change")return us(c)}function Go(s,c){return s===c&&(s!==0||1/s===1/c)||s!==s&&c!==c}var An=typeof Object.is=="function"?Object.is:Go;function Xs(s,c){if(An(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 S=g[b];if(!d.call(c,S)||!An(s[S],c[S]))return!1}return!0}function Ko(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function ds(s,c){var g=Ko(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=Ko(g)}}function Tu(s,c){return s&&c?s===c?!0:s&&s.nodeType===3?!1:c&&c.nodeType===3?Tu(s,c.parentNode):"contains"in s?s.contains(c):s.compareDocumentPosition?!!(s.compareDocumentPosition(c)&16):!1:!1}function Yo(){for(var s=window,c=Ge();c instanceof s.HTMLIFrameElement;){try{var g=typeof c.contentWindow.location.href=="string"}catch{g=!1}if(g)s=c.contentWindow;else break;c=Ge(s.document)}return c}function Ea(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 ip(s){var c=Yo(),g=s.focusedElem,b=s.selectionRange;if(c!==g&&g&&g.ownerDocument&&Tu(g.ownerDocument.documentElement,g)){if(b!==null&&Ea(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 S=g.textContent.length,R=Math.min(b.start,S);b=b.end===void 0?R:Math.min(b.end,S),!s.extend&&R>b&&(S=b,b=R,R=S),S=ds(g,R);var q=ds(g,b);S&&q&&(s.rangeCount!==1||s.anchorNode!==S.node||s.anchorOffset!==S.offset||s.focusNode!==q.node||s.focusOffset!==q.offset)&&(c=c.createRange(),c.setStart(S.node,S.offset),s.removeAllRanges(),R>b?(s.addRange(c),s.extend(q.node,q.offset)):(c.setEnd(q.node,q.offset),s.addRange(c)))}}for(c=[],s=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 sp=u&&"documentMode"in document&&11>=document.documentMode,In=null,nc=null,Qs=null,fs=!1;function Xo(s,c,g){var b=g.window===g?g.document:g.nodeType===9?g:g.ownerDocument;fs||In==null||In!==Ge(b)||(b=In,"selectionStart"in b&&Ea(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}),Qs&&Xs(Qs,b)||(Qs=b,b=tl(nc,"onSelect"),0<b.length&&(c=new Na("onSelect","select",null,c,g),s.push({event:c,listeners:b}),c.target=In)))}function qn(s,c){var g={};return g[s.toLowerCase()]=c.toLowerCase(),g["Webkit"+s]="webkit"+c,g["Moz"+s]="moz"+c,g}var ps={animationend:qn("Animation","AnimationEnd"),animationiteration:qn("Animation","AnimationIteration"),animationstart:qn("Animation","AnimationStart"),transitionend:qn("Transition","TransitionEnd")},ac={},Ru={};u&&(Ru=document.createElement("div").style,"AnimationEvent"in window||(delete ps.animationend.animation,delete ps.animationiteration.animation,delete ps.animationstart.animation),"TransitionEvent"in window||delete ps.transitionend.transition);function Qo(s){if(ac[s])return ac[s];if(!ps[s])return s;var c=ps[s],g;for(g in c)if(c.hasOwnProperty(g)&&g in Ru)return ac[s]=c[g];return s}var ic=Qo("animationend"),sc=Qo("animationiteration"),Au=Qo("animationstart"),Iu=Qo("transitionend"),Mu=new Map,Lu="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 Si(s,c){Mu.set(s,c),o(c,[s])}for(var Zo=0;Zo<Lu.length;Zo++){var Zs=Lu[Zo],Ou=Zs.toLowerCase(),op=Zs[0].toUpperCase()+Zs.slice(1);Si(Ou,"on"+op)}Si(ic,"onAnimationEnd"),Si(sc,"onAnimationIteration"),Si(Au,"onAnimationStart"),Si("dblclick","onDoubleClick"),Si("focusin","onFocus"),Si("focusout","onBlur"),Si(Iu,"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 Js="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(" "),lp=new Set("cancel close invalid load scroll toggle".split(" ").concat(Js));function Du(s,c,g){var b=s.type||"unknown-event";s.currentTarget=g,tr(b,c,void 0,s),s.currentTarget=null}function Pu(s,c){c=(c&4)!==0;for(var g=0;g<s.length;g++){var b=s[g],S=b.event;b=b.listeners;e:{var R=void 0;if(c)for(var q=b.length-1;0<=q;q--){var le=b[q],pe=le.instance,Te=le.currentTarget;if(le=le.listener,pe!==R&&S.isPropagationStopped())break e;Du(S,le,Te),R=pe}else for(q=0;q<b.length;q++){if(le=b[q],pe=le.instance,Te=le.currentTarget,le=le.listener,pe!==R&&S.isPropagationStopped())break e;Du(S,le,Te),R=pe}}}if(ft)throw s=Ut,ft=!1,Ut=null,s}function Rr(s,c){var g=c[he];g===void 0&&(g=c[he]=new Set);var b=s+"__bubble";g.has(b)||(el(c,s,2,!1),g.add(b))}function oc(s,c,g){var b=0;c&&(b|=4),el(g,s,b,c)}var Jo="_reactListening"+Math.random().toString(36).slice(2);function oi(s){if(!s[Jo]){s[Jo]=!0,a.forEach(function(g){g!=="selectionchange"&&(lp.has(g)||oc(g,!1,s),oc(g,!0,s))});var c=s.nodeType===9?s:s.ownerDocument;c===null||c[Jo]||(c[Jo]=!0,oc("selectionchange",!1,c))}}function el(s,c,g,b){switch(as(c)){case 1:var S=Fo;break;case 4:S=ql;break;default:S=Us}g=S.bind(null,c,g,s),S=void 0,!re||c!=="touchstart"&&c!=="touchmove"&&c!=="wheel"||(S=!0),b?S!==void 0?s.addEventListener(c,g,{capture:!0,passive:S}):s.addEventListener(c,g,!0):S!==void 0?s.addEventListener(c,g,{passive:S}):s.addEventListener(c,g,!1)}function ja(s,c,g,b,S){var R=b;if((c&1)===0&&(c&2)===0&&b!==null)e:for(;;){if(b===null)return;var q=b.tag;if(q===3||q===4){var le=b.stateNode.containerInfo;if(le===S||le.nodeType===8&&le.parentNode===S)break;if(q===4)for(q=b.return;q!==null;){var pe=q.tag;if((pe===3||pe===4)&&(pe=q.stateNode.containerInfo,pe===S||pe.nodeType===8&&pe.parentNode===S))return;q=q.return}for(;le!==null;){if(q=Ie(le),q===null)return;if(pe=q.tag,pe===5||pe===6){b=R=q;continue e}le=le.parentNode}}b=b.return}kt(function(){var Te=R,Xe=gr(g),tt=[];e:{var Ke=Mu.get(s);if(Ke!==void 0){var Nt=Na,Mt=s;switch(s){case"keypress":if(ii(g)===0)break e;case"keydown":case"keyup":Nt=Zf;break;case"focusin":Mt="focus",Nt=ss;break;case"focusout":Mt="blur",Nt=ss;break;case"beforeblur":case"afterblur":Nt=ss;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":Nt=Wl;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Nt=vu;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Nt=Ws;break;case ic:case sc:case Au:Nt=ku;break;case Iu:Nt=Xl;break;case"scroll":Nt=Kf;break;case"wheel":Nt=Ql;break;case"copy":case"cut":case"paste":Nt=Kl;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Nt=os}var Pt=(c&4)!==0,pn=!Pt&&s==="scroll",_e=Pt?Ke!==null?Ke+"Capture":null:Ke;Pt=[];for(var xe=Te,Ne;xe!==null;){Ne=xe;var pt=Ne.stateNode;if(Ne.tag===5&&pt!==null&&(Ne=pt,_e!==null&&(pt=at(xe,_e),pt!=null&&Pt.push(eo(xe,pt,Ne)))),pn)break;xe=xe.return}0<Pt.length&&(Ke=new Nt(Ke,Mt,null,g,Xe),tt.push({event:Ke,listeners:Pt}))}}if((c&7)===0){e:{if(Ke=s==="mouseover"||s==="pointerover",Nt=s==="mouseout"||s==="pointerout",Ke&&g!==Ot&&(Mt=g.relatedTarget||g.fromElement)&&(Ie(Mt)||Mt[ae]))break e;if((Nt||Ke)&&(Ke=Xe.window===Xe?Xe:(Ke=Xe.ownerDocument)?Ke.defaultView||Ke.parentWindow:window,Nt?(Mt=g.relatedTarget||g.toElement,Nt=Te,Mt=Mt?Ie(Mt):null,Mt!==null&&(pn=rn(Mt),Mt!==pn||Mt.tag!==5&&Mt.tag!==6)&&(Mt=null)):(Nt=null,Mt=Te),Nt!==Mt)){if(Pt=Wl,pt="onMouseLeave",_e="onMouseEnter",xe="mouse",(s==="pointerout"||s==="pointerover")&&(Pt=os,pt="onPointerLeave",_e="onPointerEnter",xe="pointer"),pn=Nt==null?Ke:lr(Nt),Ne=Mt==null?Ke:lr(Mt),Ke=new Pt(pt,xe+"leave",Nt,g,Xe),Ke.target=pn,Ke.relatedTarget=Ne,pt=null,Ie(Xe)===Te&&(Pt=new Pt(_e,xe+"enter",Mt,g,Xe),Pt.target=Ne,Pt.relatedTarget=pn,pt=Pt),pn=pt,Nt&&Mt)t:{for(Pt=Nt,_e=Mt,xe=0,Ne=Pt;Ne;Ne=gs(Ne))xe++;for(Ne=0,pt=_e;pt;pt=gs(pt))Ne++;for(;0<xe-Ne;)Pt=gs(Pt),xe--;for(;0<Ne-xe;)_e=gs(_e),Ne--;for(;xe--;){if(Pt===_e||_e!==null&&Pt===_e.alternate)break t;Pt=gs(Pt),_e=gs(_e)}Pt=null}else Pt=null;Nt!==null&&Fu(tt,Ke,Nt,Pt,!1),Mt!==null&&pn!==null&&Fu(tt,pn,Mt,Pt,!0)}}e:{if(Ke=Te?lr(Te):window,Nt=Ke.nodeName&&Ke.nodeName.toLowerCase(),Nt==="select"||Nt==="input"&&Ke.type==="file")var Bt=tc;else if(ec(Ke))if(Hi)Bt=Cu;else{Bt=Vo;var $t=Wo}else(Nt=Ke.nodeName)&&Nt.toLowerCase()==="input"&&(Ke.type==="checkbox"||Ke.type==="radio")&&(Bt=ap);if(Bt&&(Bt=Bt(s,Te))){Dt(tt,Bt,g,Xe);break e}$t&&$t(s,Ke,Te),s==="focusout"&&($t=Ke._wrapperState)&&$t.controlled&&Ke.type==="number"&&mt(Ke,"number",Ke.value)}switch($t=Te?lr(Te):window,s){case"focusin":(ec($t)||$t.contentEditable==="true")&&(In=$t,nc=Te,Qs=null);break;case"focusout":Qs=nc=In=null;break;case"mousedown":fs=!0;break;case"contextmenu":case"mouseup":case"dragend":fs=!1,Xo(tt,g,Xe);break;case"selectionchange":if(sp)break;case"keydown":case"keyup":Xo(tt,g,Xe)}var Wt;if(ls)e:{switch(s){case"compositionstart":var Zt="onCompositionStart";break e;case"compositionend":Zt="onCompositionEnd";break e;case"compositionupdate":Zt="onCompositionUpdate";break e}Zt=void 0}else qi?ju(s,g)&&(Zt="onCompositionEnd"):s==="keydown"&&g.keyCode===229&&(Zt="onCompositionStart");Zt&&(Eu&&g.locale!=="ko"&&(qi||Zt!=="onCompositionStart"?Zt==="onCompositionEnd"&&qi&&(Wt=zi()):(Un=Xe,ea="value"in Un?Un.value:Un.textContent,qi=!0)),$t=tl(Te,Zt),0<$t.length&&(Zt=new Uo(Zt,s,null,g,Xe),tt.push({event:Zt,listeners:$t}),Wt?Zt.data=Wt:(Wt=Zl(g),Wt!==null&&(Zt.data=Wt)))),(Wt=Gs?Ho(s,g):rp(s,g))&&(Te=tl(Te,"onBeforeInput"),0<Te.length&&(Xe=new Uo("onBeforeInput","beforeinput",null,g,Xe),tt.push({event:Xe,listeners:Te}),Xe.data=Wt))}Pu(tt,c)})}function eo(s,c,g){return{instance:s,listener:c,currentTarget:g}}function tl(s,c){for(var g=c+"Capture",b=[];s!==null;){var S=s,R=S.stateNode;S.tag===5&&R!==null&&(S=R,R=at(s,g),R!=null&&b.unshift(eo(s,R,S)),R=at(s,c),R!=null&&b.push(eo(s,R,S))),s=s.return}return b}function gs(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5);return s||null}function Fu(s,c,g,b,S){for(var R=c._reactName,q=[];g!==null&&g!==b;){var le=g,pe=le.alternate,Te=le.stateNode;if(pe!==null&&pe===b)break;le.tag===5&&Te!==null&&(le=Te,S?(pe=at(g,R),pe!=null&&q.unshift(eo(g,pe,le))):S||(pe=at(g,R),pe!=null&&q.push(eo(g,pe,le)))),g=g.return}q.length!==0&&s.push({event:c,listeners:q})}var cp=/\r\n?/g,Ca=/\u0000|\uFFFD/g;function rl(s){return(typeof s=="string"?s:""+s).replace(cp,`
38
+ `).replace(Ca,"")}function hs(s,c,g){if(c=rl(c),rl(s)!==c&&g)throw Error(r(425))}function nl(){}var lc=null,Ni=null;function cc(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 to=typeof setTimeout=="function"?setTimeout:void 0,up=typeof clearTimeout=="function"?clearTimeout:void 0,Bu=typeof Promise=="function"?Promise:void 0,dp=typeof queueMicrotask=="function"?queueMicrotask:typeof Bu<"u"?function(s){return Bu.resolve(null).then(s).catch(fp)}:to;function fp(s){setTimeout(function(){throw s})}function al(s,c){var g=c,b=0;do{var S=g.nextSibling;if(s.removeChild(g),S&&S.nodeType===8)if(g=S.data,g==="/$"){if(b===0){s.removeChild(S),zs(c);return}b--}else g!=="$"&&g!=="$?"&&g!=="$!"||b++;g=S}while(g);zs(c)}function Ta(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 ms(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 $i=Math.random().toString(36).slice(2),O="__reactFiber$"+$i,te="__reactProps$"+$i,ae="__reactContainer$"+$i,he="__reactEvents$"+$i,ye="__reactListeners$"+$i,Pe="__reactHandles$"+$i;function Ie(s){var c=s[O];if(c)return c;for(var g=s.parentNode;g;){if(c=g[ae]||g[O]){if(g=c.alternate,c.child!==null||g!==null&&g.child!==null)for(s=ms(s);s!==null;){if(g=s[O])return g;s=ms(s)}return c}s=g,g=s.parentNode}return null}function jt(s){return s=s[O]||s[ae],!s||s.tag!==5&&s.tag!==6&&s.tag!==13&&s.tag!==3?null:s}function lr(s){if(s.tag===5||s.tag===6)return s.stateNode;throw Error(r(33))}function Er(s){return s[te]||null}var Ir=[],sr=-1;function be(s){return{current:s}}function Y(s){0>sr||(s.current=Ir[sr],Ir[sr]=null,sr--)}function de(s,c){sr++,Ir[sr]=s.current,s.current=c}var we={},Ae=be(we),Ue=be(!1),yt=we;function At(s,c){var g=s.type.contextTypes;if(!g)return we;var b=s.stateNode;if(b&&b.__reactInternalMemoizedUnmaskedChildContext===c)return b.__reactInternalMemoizedMaskedChildContext;var S={},R;for(R in g)S[R]=c[R];return b&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=c,s.__reactInternalMemoizedMaskedChildContext=S),S}function vt(s){return s=s.childContextTypes,s!=null}function Ht(){Y(Ue),Y(Ae)}function Mr(s,c,g){if(Ae.current!==we)throw Error(r(168));de(Ae,c),de(Ue,g)}function pa(s,c,g){var b=s.stateNode;if(c=c.childContextTypes,typeof b.getChildContext!="function")return g;b=b.getChildContext();for(var S in b)if(!(S in c))throw Error(r(108,oe(s)||"Unknown",S));return P({},g,b)}function Ei(s){return s=(s=s.stateNode)&&s.__reactInternalMemoizedMergedChildContext||we,yt=Ae.current,de(Ae,s),de(Ue,Ue.current),!0}function ta(s,c,g){var b=s.stateNode;if(!b)throw Error(r(169));g?(s=pa(s,c,yt),b.__reactInternalMemoizedMergedChildContext=s,Y(Ue),Y(Ae),de(Ae,s)):Y(Ue),de(Ue,g)}var Ra=null,Wi=!1,Vi=!1;function zu(s){Ra===null?Ra=[s]:Ra.push(s)}function Uu(s){Wi=!0,zu(s)}function li(){if(!Vi&&Ra!==null){Vi=!0;var s=0,c=fr;try{var g=Ra;for(fr=1;s<g.length;s++){var b=g[s];do b=b(!0);while(b!==null)}Ra=null,Wi=!1}catch(S){throw Ra!==null&&(Ra=Ra.slice(s+1)),_a(ni,li),S}finally{fr=c,Vi=!1}}return null}var ji=[],Gi=0,ro=null,no=0,ur=[],sn=0,Jr=null,Gr=1,ci="";function ao(s,c){ji[Gi++]=no,ji[Gi++]=ro,ro=s,no=c}function Mk(s,c,g){ur[sn++]=Gr,ur[sn++]=ci,ur[sn++]=Jr,Jr=s;var b=Gr;s=ci;var S=32-vr(b)-1;b&=~(1<<S),g+=1;var R=32-vr(c)+S;if(30<R){var q=S-S%5;R=(b&(1<<q)-1).toString(32),b>>=q,S-=q,Gr=1<<32-vr(c)+S|g<<S|b,ci=R+s}else Gr=1<<R|g<<S|b,ci=s}function pp(s){s.return!==null&&(ao(s,1),Mk(s,1,0))}function gp(s){for(;s===ro;)ro=ji[--Gi],ji[Gi]=null,no=ji[--Gi],ji[Gi]=null;for(;s===Jr;)Jr=ur[--sn],ur[sn]=null,ci=ur[--sn],ur[sn]=null,Gr=ur[--sn],ur[sn]=null}var Aa=null,Ia=null,en=!1,ui=null;function Lk(s,c){var g=Ka(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 Ok(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,Aa=s,Ia=Ta(c.firstChild),!0):!1;case 6:return c=s.pendingProps===""||c.nodeType!==3?null:c,c!==null?(s.stateNode=c,Aa=s,Ia=null,!0):!1;case 13:return c=c.nodeType!==8?null:c,c!==null?(g=Jr!==null?{id:Gr,overflow:ci}:null,s.memoizedState={dehydrated:c,treeContext:g,retryLane:1073741824},g=Ka(18,null,null,0),g.stateNode=c,g.return=s,s.child=g,Aa=s,Ia=null,!0):!1;default:return!1}}function hp(s){return(s.mode&1)!==0&&(s.flags&128)===0}function mp(s){if(en){var c=Ia;if(c){var g=c;if(!Ok(s,c)){if(hp(s))throw Error(r(418));c=Ta(g.nextSibling);var b=Aa;c&&Ok(s,c)?Lk(b,g):(s.flags=s.flags&-4097|2,en=!1,Aa=s)}}else{if(hp(s))throw Error(r(418));s.flags=s.flags&-4097|2,en=!1,Aa=s}}}function Dk(s){for(s=s.return;s!==null&&s.tag!==5&&s.tag!==3&&s.tag!==13;)s=s.return;Aa=s}function qu(s){if(s!==Aa)return!1;if(!en)return Dk(s),en=!0,!1;var c;if((c=s.tag!==3)&&!(c=s.tag!==5)&&(c=s.type,c=c!=="head"&&c!=="body"&&!cc(s.type,s.memoizedProps)),c&&(c=Ia)){if(hp(s))throw Pk(),Error(r(418));for(;c;)Lk(s,c),c=Ta(c.nextSibling)}if(Dk(s),s.tag===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));e:{for(s=s.nextSibling,c=0;s;){if(s.nodeType===8){var g=s.data;if(g==="/$"){if(c===0){Ia=Ta(s.nextSibling);break e}c--}else g!=="$"&&g!=="$!"&&g!=="$?"||c++}s=s.nextSibling}Ia=null}}else Ia=Aa?Ta(s.stateNode.nextSibling):null;return!0}function Pk(){for(var s=Ia;s;)s=Ta(s.nextSibling)}function il(){Ia=Aa=null,en=!1}function xp(s){ui===null?ui=[s]:ui.push(s)}var UA=A.ReactCurrentBatchConfig;function uc(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(r(309));var b=g.stateNode}if(!b)throw Error(r(147,s));var S=b,R=""+s;return c!==null&&c.ref!==null&&typeof c.ref=="function"&&c.ref._stringRef===R?c.ref:(c=function(q){var le=S.refs;q===null?delete le[R]:le[R]=q},c._stringRef=R,c)}if(typeof s!="string")throw Error(r(284));if(!g._owner)throw Error(r(290,s))}return s}function Hu(s,c){throw s=Object.prototype.toString.call(c),Error(r(31,s==="[object Object]"?"object with keys {"+Object.keys(c).join(", ")+"}":s))}function Fk(s){var c=s._init;return c(s._payload)}function Bk(s){function c(_e,xe){if(s){var Ne=_e.deletions;Ne===null?(_e.deletions=[xe],_e.flags|=16):Ne.push(xe)}}function g(_e,xe){if(!s)return null;for(;xe!==null;)c(_e,xe),xe=xe.sibling;return null}function b(_e,xe){for(_e=new Map;xe!==null;)xe.key!==null?_e.set(xe.key,xe):_e.set(xe.index,xe),xe=xe.sibling;return _e}function S(_e,xe){return _e=Ss(_e,xe),_e.index=0,_e.sibling=null,_e}function R(_e,xe,Ne){return _e.index=Ne,s?(Ne=_e.alternate,Ne!==null?(Ne=Ne.index,Ne<xe?(_e.flags|=2,xe):Ne):(_e.flags|=2,xe)):(_e.flags|=1048576,xe)}function q(_e){return s&&_e.alternate===null&&(_e.flags|=2),_e}function le(_e,xe,Ne,pt){return xe===null||xe.tag!==6?(xe=lg(Ne,_e.mode,pt),xe.return=_e,xe):(xe=S(xe,Ne),xe.return=_e,xe)}function pe(_e,xe,Ne,pt){var Bt=Ne.type;return Bt===j?Xe(_e,xe,Ne.props.children,pt,Ne.key):xe!==null&&(xe.elementType===Bt||typeof Bt=="object"&&Bt!==null&&Bt.$$typeof===K&&Fk(Bt)===xe.type)?(pt=S(xe,Ne.props),pt.ref=uc(_e,xe,Ne),pt.return=_e,pt):(pt=pd(Ne.type,Ne.key,Ne.props,null,_e.mode,pt),pt.ref=uc(_e,xe,Ne),pt.return=_e,pt)}function Te(_e,xe,Ne,pt){return xe===null||xe.tag!==4||xe.stateNode.containerInfo!==Ne.containerInfo||xe.stateNode.implementation!==Ne.implementation?(xe=cg(Ne,_e.mode,pt),xe.return=_e,xe):(xe=S(xe,Ne.children||[]),xe.return=_e,xe)}function Xe(_e,xe,Ne,pt,Bt){return xe===null||xe.tag!==7?(xe=po(Ne,_e.mode,pt,Bt),xe.return=_e,xe):(xe=S(xe,Ne),xe.return=_e,xe)}function tt(_e,xe,Ne){if(typeof xe=="string"&&xe!==""||typeof xe=="number")return xe=lg(""+xe,_e.mode,Ne),xe.return=_e,xe;if(typeof xe=="object"&&xe!==null){switch(xe.$$typeof){case T:return Ne=pd(xe.type,xe.key,xe.props,null,_e.mode,Ne),Ne.ref=uc(_e,null,xe),Ne.return=_e,Ne;case C:return xe=cg(xe,_e.mode,Ne),xe.return=_e,xe;case K:var pt=xe._init;return tt(_e,pt(xe._payload),Ne)}if(wt(xe)||ne(xe))return xe=po(xe,_e.mode,Ne,null),xe.return=_e,xe;Hu(_e,xe)}return null}function Ke(_e,xe,Ne,pt){var Bt=xe!==null?xe.key:null;if(typeof Ne=="string"&&Ne!==""||typeof Ne=="number")return Bt!==null?null:le(_e,xe,""+Ne,pt);if(typeof Ne=="object"&&Ne!==null){switch(Ne.$$typeof){case T:return Ne.key===Bt?pe(_e,xe,Ne,pt):null;case C:return Ne.key===Bt?Te(_e,xe,Ne,pt):null;case K:return Bt=Ne._init,Ke(_e,xe,Bt(Ne._payload),pt)}if(wt(Ne)||ne(Ne))return Bt!==null?null:Xe(_e,xe,Ne,pt,null);Hu(_e,Ne)}return null}function Nt(_e,xe,Ne,pt,Bt){if(typeof pt=="string"&&pt!==""||typeof pt=="number")return _e=_e.get(Ne)||null,le(xe,_e,""+pt,Bt);if(typeof pt=="object"&&pt!==null){switch(pt.$$typeof){case T:return _e=_e.get(pt.key===null?Ne:pt.key)||null,pe(xe,_e,pt,Bt);case C:return _e=_e.get(pt.key===null?Ne:pt.key)||null,Te(xe,_e,pt,Bt);case K:var $t=pt._init;return Nt(_e,xe,Ne,$t(pt._payload),Bt)}if(wt(pt)||ne(pt))return _e=_e.get(Ne)||null,Xe(xe,_e,pt,Bt,null);Hu(xe,pt)}return null}function Mt(_e,xe,Ne,pt){for(var Bt=null,$t=null,Wt=xe,Zt=xe=0,On=null;Wt!==null&&Zt<Ne.length;Zt++){Wt.index>Zt?(On=Wt,Wt=null):On=Wt.sibling;var jr=Ke(_e,Wt,Ne[Zt],pt);if(jr===null){Wt===null&&(Wt=On);break}s&&Wt&&jr.alternate===null&&c(_e,Wt),xe=R(jr,xe,Zt),$t===null?Bt=jr:$t.sibling=jr,$t=jr,Wt=On}if(Zt===Ne.length)return g(_e,Wt),en&&ao(_e,Zt),Bt;if(Wt===null){for(;Zt<Ne.length;Zt++)Wt=tt(_e,Ne[Zt],pt),Wt!==null&&(xe=R(Wt,xe,Zt),$t===null?Bt=Wt:$t.sibling=Wt,$t=Wt);return en&&ao(_e,Zt),Bt}for(Wt=b(_e,Wt);Zt<Ne.length;Zt++)On=Nt(Wt,_e,Zt,Ne[Zt],pt),On!==null&&(s&&On.alternate!==null&&Wt.delete(On.key===null?Zt:On.key),xe=R(On,xe,Zt),$t===null?Bt=On:$t.sibling=On,$t=On);return s&&Wt.forEach(function(Ns){return c(_e,Ns)}),en&&ao(_e,Zt),Bt}function Pt(_e,xe,Ne,pt){var Bt=ne(Ne);if(typeof Bt!="function")throw Error(r(150));if(Ne=Bt.call(Ne),Ne==null)throw Error(r(151));for(var $t=Bt=null,Wt=xe,Zt=xe=0,On=null,jr=Ne.next();Wt!==null&&!jr.done;Zt++,jr=Ne.next()){Wt.index>Zt?(On=Wt,Wt=null):On=Wt.sibling;var Ns=Ke(_e,Wt,jr.value,pt);if(Ns===null){Wt===null&&(Wt=On);break}s&&Wt&&Ns.alternate===null&&c(_e,Wt),xe=R(Ns,xe,Zt),$t===null?Bt=Ns:$t.sibling=Ns,$t=Ns,Wt=On}if(jr.done)return g(_e,Wt),en&&ao(_e,Zt),Bt;if(Wt===null){for(;!jr.done;Zt++,jr=Ne.next())jr=tt(_e,jr.value,pt),jr!==null&&(xe=R(jr,xe,Zt),$t===null?Bt=jr:$t.sibling=jr,$t=jr);return en&&ao(_e,Zt),Bt}for(Wt=b(_e,Wt);!jr.done;Zt++,jr=Ne.next())jr=Nt(Wt,_e,Zt,jr.value,pt),jr!==null&&(s&&jr.alternate!==null&&Wt.delete(jr.key===null?Zt:jr.key),xe=R(jr,xe,Zt),$t===null?Bt=jr:$t.sibling=jr,$t=jr);return s&&Wt.forEach(function(vI){return c(_e,vI)}),en&&ao(_e,Zt),Bt}function pn(_e,xe,Ne,pt){if(typeof Ne=="object"&&Ne!==null&&Ne.type===j&&Ne.key===null&&(Ne=Ne.props.children),typeof Ne=="object"&&Ne!==null){switch(Ne.$$typeof){case T:e:{for(var Bt=Ne.key,$t=xe;$t!==null;){if($t.key===Bt){if(Bt=Ne.type,Bt===j){if($t.tag===7){g(_e,$t.sibling),xe=S($t,Ne.props.children),xe.return=_e,_e=xe;break e}}else if($t.elementType===Bt||typeof Bt=="object"&&Bt!==null&&Bt.$$typeof===K&&Fk(Bt)===$t.type){g(_e,$t.sibling),xe=S($t,Ne.props),xe.ref=uc(_e,$t,Ne),xe.return=_e,_e=xe;break e}g(_e,$t);break}else c(_e,$t);$t=$t.sibling}Ne.type===j?(xe=po(Ne.props.children,_e.mode,pt,Ne.key),xe.return=_e,_e=xe):(pt=pd(Ne.type,Ne.key,Ne.props,null,_e.mode,pt),pt.ref=uc(_e,xe,Ne),pt.return=_e,_e=pt)}return q(_e);case C:e:{for($t=Ne.key;xe!==null;){if(xe.key===$t)if(xe.tag===4&&xe.stateNode.containerInfo===Ne.containerInfo&&xe.stateNode.implementation===Ne.implementation){g(_e,xe.sibling),xe=S(xe,Ne.children||[]),xe.return=_e,_e=xe;break e}else{g(_e,xe);break}else c(_e,xe);xe=xe.sibling}xe=cg(Ne,_e.mode,pt),xe.return=_e,_e=xe}return q(_e);case K:return $t=Ne._init,pn(_e,xe,$t(Ne._payload),pt)}if(wt(Ne))return Mt(_e,xe,Ne,pt);if(ne(Ne))return Pt(_e,xe,Ne,pt);Hu(_e,Ne)}return typeof Ne=="string"&&Ne!==""||typeof Ne=="number"?(Ne=""+Ne,xe!==null&&xe.tag===6?(g(_e,xe.sibling),xe=S(xe,Ne),xe.return=_e,_e=xe):(g(_e,xe),xe=lg(Ne,_e.mode,pt),xe.return=_e,_e=xe),q(_e)):g(_e,xe)}return pn}var sl=Bk(!0),zk=Bk(!1),$u=be(null),Wu=null,ol=null,yp=null;function bp(){yp=ol=Wu=null}function vp(s){var c=$u.current;Y($u),s._currentValue=c}function kp(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 ll(s,c){Wu=s,yp=ol=null,s=s.dependencies,s!==null&&s.firstContext!==null&&((s.lanes&c)!==0&&(ga=!0),s.firstContext=null)}function Wa(s){var c=s._currentValue;if(yp!==s)if(s={context:s,memoizedValue:c,next:null},ol===null){if(Wu===null)throw Error(r(308));ol=s,Wu.dependencies={lanes:0,firstContext:s}}else ol=ol.next=s;return c}var io=null;function _p(s){io===null?io=[s]:io.push(s)}function Uk(s,c,g,b){var S=c.interleaved;return S===null?(g.next=g,_p(c)):(g.next=S.next,S.next=g),c.interleaved=g,Ki(s,b)}function Ki(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 xs=!1;function wp(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function qk(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 Yi(s,c){return{eventTime:s,lane:c,tag:0,payload:null,callback:null,next:null}}function ys(s,c,g){var b=s.updateQueue;if(b===null)return null;if(b=b.shared,(_r&2)!==0){var S=b.pending;return S===null?c.next=c:(c.next=S.next,S.next=c),b.pending=c,Ki(s,g)}return S=b.interleaved,S===null?(c.next=c,_p(b)):(c.next=S.next,S.next=c),b.interleaved=c,Ki(s,g)}function Vu(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 Hk(s,c){var g=s.updateQueue,b=s.alternate;if(b!==null&&(b=b.updateQueue,g===b)){var S=null,R=null;if(g=g.firstBaseUpdate,g!==null){do{var q={eventTime:g.eventTime,lane:g.lane,tag:g.tag,payload:g.payload,callback:g.callback,next:null};R===null?S=R=q:R=R.next=q,g=g.next}while(g!==null);R===null?S=R=c:R=R.next=c}else S=R=c;g={baseState:b.baseState,firstBaseUpdate:S,lastBaseUpdate:R,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 Gu(s,c,g,b){var S=s.updateQueue;xs=!1;var R=S.firstBaseUpdate,q=S.lastBaseUpdate,le=S.shared.pending;if(le!==null){S.shared.pending=null;var pe=le,Te=pe.next;pe.next=null,q===null?R=Te:q.next=Te,q=pe;var Xe=s.alternate;Xe!==null&&(Xe=Xe.updateQueue,le=Xe.lastBaseUpdate,le!==q&&(le===null?Xe.firstBaseUpdate=Te:le.next=Te,Xe.lastBaseUpdate=pe))}if(R!==null){var tt=S.baseState;q=0,Xe=Te=pe=null,le=R;do{var Ke=le.lane,Nt=le.eventTime;if((b&Ke)===Ke){Xe!==null&&(Xe=Xe.next={eventTime:Nt,lane:0,tag:le.tag,payload:le.payload,callback:le.callback,next:null});e:{var Mt=s,Pt=le;switch(Ke=c,Nt=g,Pt.tag){case 1:if(Mt=Pt.payload,typeof Mt=="function"){tt=Mt.call(Nt,tt,Ke);break e}tt=Mt;break e;case 3:Mt.flags=Mt.flags&-65537|128;case 0:if(Mt=Pt.payload,Ke=typeof Mt=="function"?Mt.call(Nt,tt,Ke):Mt,Ke==null)break e;tt=P({},tt,Ke);break e;case 2:xs=!0}}le.callback!==null&&le.lane!==0&&(s.flags|=64,Ke=S.effects,Ke===null?S.effects=[le]:Ke.push(le))}else Nt={eventTime:Nt,lane:Ke,tag:le.tag,payload:le.payload,callback:le.callback,next:null},Xe===null?(Te=Xe=Nt,pe=tt):Xe=Xe.next=Nt,q|=Ke;if(le=le.next,le===null){if(le=S.shared.pending,le===null)break;Ke=le,le=Ke.next,Ke.next=null,S.lastBaseUpdate=Ke,S.shared.pending=null}}while(!0);if(Xe===null&&(pe=tt),S.baseState=pe,S.firstBaseUpdate=Te,S.lastBaseUpdate=Xe,c=S.shared.interleaved,c!==null){S=c;do q|=S.lane,S=S.next;while(S!==c)}else R===null&&(S.shared.lanes=0);lo|=q,s.lanes=q,s.memoizedState=tt}}function $k(s,c,g){if(s=c.effects,c.effects=null,s!==null)for(c=0;c<s.length;c++){var b=s[c],S=b.callback;if(S!==null){if(b.callback=null,b=g,typeof S!="function")throw Error(r(191,S));S.call(b)}}}var dc={},Ci=be(dc),fc=be(dc),pc=be(dc);function so(s){if(s===dc)throw Error(r(174));return s}function Sp(s,c){switch(de(pc,c),de(fc,s),de(Ci,dc),s=c.nodeType,s){case 9:case 11:c=(c=c.documentElement)?c.namespaceURI:Ee(null,"");break;default:s=s===8?c.parentNode:c,c=s.namespaceURI||null,s=s.tagName,c=Ee(c,s)}Y(Ci),de(Ci,c)}function cl(){Y(Ci),Y(fc),Y(pc)}function Wk(s){so(pc.current);var c=so(Ci.current),g=Ee(c,s.type);c!==g&&(de(fc,s),de(Ci,g))}function Np(s){fc.current===s&&(Y(Ci),Y(fc))}var on=be(0);function Ku(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 Ep=[];function jp(){for(var s=0;s<Ep.length;s++)Ep[s]._workInProgressVersionPrimary=null;Ep.length=0}var Yu=A.ReactCurrentDispatcher,Cp=A.ReactCurrentBatchConfig,oo=0,ln=null,_n=null,Mn=null,Xu=!1,gc=!1,hc=0,qA=0;function Wn(){throw Error(r(321))}function Tp(s,c){if(c===null)return!1;for(var g=0;g<c.length&&g<s.length;g++)if(!An(s[g],c[g]))return!1;return!0}function Rp(s,c,g,b,S,R){if(oo=R,ln=c,c.memoizedState=null,c.updateQueue=null,c.lanes=0,Yu.current=s===null||s.memoizedState===null?VA:GA,s=g(b,S),gc){R=0;do{if(gc=!1,hc=0,25<=R)throw Error(r(301));R+=1,Mn=_n=null,c.updateQueue=null,Yu.current=KA,s=g(b,S)}while(gc)}if(Yu.current=Ju,c=_n!==null&&_n.next!==null,oo=0,Mn=_n=ln=null,Xu=!1,c)throw Error(r(300));return s}function Ap(){var s=hc!==0;return hc=0,s}function Ti(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Mn===null?ln.memoizedState=Mn=s:Mn=Mn.next=s,Mn}function Va(){if(_n===null){var s=ln.alternate;s=s!==null?s.memoizedState:null}else s=_n.next;var c=Mn===null?ln.memoizedState:Mn.next;if(c!==null)Mn=c,_n=s;else{if(s===null)throw Error(r(310));_n=s,s={memoizedState:_n.memoizedState,baseState:_n.baseState,baseQueue:_n.baseQueue,queue:_n.queue,next:null},Mn===null?ln.memoizedState=Mn=s:Mn=Mn.next=s}return Mn}function mc(s,c){return typeof c=="function"?c(s):c}function Ip(s){var c=Va(),g=c.queue;if(g===null)throw Error(r(311));g.lastRenderedReducer=s;var b=_n,S=b.baseQueue,R=g.pending;if(R!==null){if(S!==null){var q=S.next;S.next=R.next,R.next=q}b.baseQueue=S=R,g.pending=null}if(S!==null){R=S.next,b=b.baseState;var le=q=null,pe=null,Te=R;do{var Xe=Te.lane;if((oo&Xe)===Xe)pe!==null&&(pe=pe.next={lane:0,action:Te.action,hasEagerState:Te.hasEagerState,eagerState:Te.eagerState,next:null}),b=Te.hasEagerState?Te.eagerState:s(b,Te.action);else{var tt={lane:Xe,action:Te.action,hasEagerState:Te.hasEagerState,eagerState:Te.eagerState,next:null};pe===null?(le=pe=tt,q=b):pe=pe.next=tt,ln.lanes|=Xe,lo|=Xe}Te=Te.next}while(Te!==null&&Te!==R);pe===null?q=b:pe.next=le,An(b,c.memoizedState)||(ga=!0),c.memoizedState=b,c.baseState=q,c.baseQueue=pe,g.lastRenderedState=b}if(s=g.interleaved,s!==null){S=s;do R=S.lane,ln.lanes|=R,lo|=R,S=S.next;while(S!==s)}else S===null&&(g.lanes=0);return[c.memoizedState,g.dispatch]}function Mp(s){var c=Va(),g=c.queue;if(g===null)throw Error(r(311));g.lastRenderedReducer=s;var b=g.dispatch,S=g.pending,R=c.memoizedState;if(S!==null){g.pending=null;var q=S=S.next;do R=s(R,q.action),q=q.next;while(q!==S);An(R,c.memoizedState)||(ga=!0),c.memoizedState=R,c.baseQueue===null&&(c.baseState=R),g.lastRenderedState=R}return[R,b]}function Vk(){}function Gk(s,c){var g=ln,b=Va(),S=c(),R=!An(b.memoizedState,S);if(R&&(b.memoizedState=S,ga=!0),b=b.queue,Lp(Xk.bind(null,g,b,s),[s]),b.getSnapshot!==c||R||Mn!==null&&Mn.memoizedState.tag&1){if(g.flags|=2048,xc(9,Yk.bind(null,g,b,S,c),void 0,null),Ln===null)throw Error(r(349));(oo&30)!==0||Kk(g,c,S)}return S}function Kk(s,c,g){s.flags|=16384,s={getSnapshot:c,value:g},c=ln.updateQueue,c===null?(c={lastEffect:null,stores:null},ln.updateQueue=c,c.stores=[s]):(g=c.stores,g===null?c.stores=[s]:g.push(s))}function Yk(s,c,g,b){c.value=g,c.getSnapshot=b,Qk(c)&&Zk(s)}function Xk(s,c,g){return g(function(){Qk(c)&&Zk(s)})}function Qk(s){var c=s.getSnapshot;s=s.value;try{var g=c();return!An(s,g)}catch{return!0}}function Zk(s){var c=Ki(s,1);c!==null&&gi(c,s,1,-1)}function Jk(s){var c=Ti();return typeof s=="function"&&(s=s()),c.memoizedState=c.baseState=s,s={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:mc,lastRenderedState:s},c.queue=s,s=s.dispatch=WA.bind(null,ln,s),[c.memoizedState,s]}function xc(s,c,g,b){return s={tag:s,create:c,destroy:g,deps:b,next:null},c=ln.updateQueue,c===null?(c={lastEffect:null,stores:null},ln.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 e1(){return Va().memoizedState}function Qu(s,c,g,b){var S=Ti();ln.flags|=s,S.memoizedState=xc(1|c,g,void 0,b===void 0?null:b)}function Zu(s,c,g,b){var S=Va();b=b===void 0?null:b;var R=void 0;if(_n!==null){var q=_n.memoizedState;if(R=q.destroy,b!==null&&Tp(b,q.deps)){S.memoizedState=xc(c,g,R,b);return}}ln.flags|=s,S.memoizedState=xc(1|c,g,R,b)}function t1(s,c){return Qu(8390656,8,s,c)}function Lp(s,c){return Zu(2048,8,s,c)}function r1(s,c){return Zu(4,2,s,c)}function n1(s,c){return Zu(4,4,s,c)}function a1(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 i1(s,c,g){return g=g!=null?g.concat([s]):null,Zu(4,4,a1.bind(null,c,s),g)}function Op(){}function s1(s,c){var g=Va();c=c===void 0?null:c;var b=g.memoizedState;return b!==null&&c!==null&&Tp(c,b[1])?b[0]:(g.memoizedState=[s,c],s)}function o1(s,c){var g=Va();c=c===void 0?null:c;var b=g.memoizedState;return b!==null&&c!==null&&Tp(c,b[1])?b[0]:(s=s(),g.memoizedState=[s,c],s)}function l1(s,c,g){return(oo&21)===0?(s.baseState&&(s.baseState=!1,ga=!0),s.memoizedState=g):(An(g,c)||(g=Cn(),ln.lanes|=g,lo|=g,s.baseState=!0),c)}function HA(s,c){var g=fr;fr=g!==0&&4>g?g:4,s(!0);var b=Cp.transition;Cp.transition={};try{s(!1),c()}finally{fr=g,Cp.transition=b}}function c1(){return Va().memoizedState}function $A(s,c,g){var b=_s(s);if(g={lane:b,action:g,hasEagerState:!1,eagerState:null,next:null},u1(s))d1(c,g);else if(g=Uk(s,c,g,b),g!==null){var S=na();gi(g,s,b,S),f1(g,c,b)}}function WA(s,c,g){var b=_s(s),S={lane:b,action:g,hasEagerState:!1,eagerState:null,next:null};if(u1(s))d1(c,S);else{var R=s.alternate;if(s.lanes===0&&(R===null||R.lanes===0)&&(R=c.lastRenderedReducer,R!==null))try{var q=c.lastRenderedState,le=R(q,g);if(S.hasEagerState=!0,S.eagerState=le,An(le,q)){var pe=c.interleaved;pe===null?(S.next=S,_p(c)):(S.next=pe.next,pe.next=S),c.interleaved=S;return}}catch{}finally{}g=Uk(s,c,S,b),g!==null&&(S=na(),gi(g,s,b,S),f1(g,c,b))}}function u1(s){var c=s.alternate;return s===ln||c!==null&&c===ln}function d1(s,c){gc=Xu=!0;var g=s.pending;g===null?c.next=c:(c.next=g.next,g.next=c),s.pending=c}function f1(s,c,g){if((g&4194240)!==0){var b=c.lanes;b&=s.pendingLanes,g|=b,c.lanes=g,Sa(s,g)}}var Ju={readContext:Wa,useCallback:Wn,useContext:Wn,useEffect:Wn,useImperativeHandle:Wn,useInsertionEffect:Wn,useLayoutEffect:Wn,useMemo:Wn,useReducer:Wn,useRef:Wn,useState:Wn,useDebugValue:Wn,useDeferredValue:Wn,useTransition:Wn,useMutableSource:Wn,useSyncExternalStore:Wn,useId:Wn,unstable_isNewReconciler:!1},VA={readContext:Wa,useCallback:function(s,c){return Ti().memoizedState=[s,c===void 0?null:c],s},useContext:Wa,useEffect:t1,useImperativeHandle:function(s,c,g){return g=g!=null?g.concat([s]):null,Qu(4194308,4,a1.bind(null,c,s),g)},useLayoutEffect:function(s,c){return Qu(4194308,4,s,c)},useInsertionEffect:function(s,c){return Qu(4,2,s,c)},useMemo:function(s,c){var g=Ti();return c=c===void 0?null:c,s=s(),g.memoizedState=[s,c],s},useReducer:function(s,c,g){var b=Ti();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=$A.bind(null,ln,s),[b.memoizedState,s]},useRef:function(s){var c=Ti();return s={current:s},c.memoizedState=s},useState:Jk,useDebugValue:Op,useDeferredValue:function(s){return Ti().memoizedState=s},useTransition:function(){var s=Jk(!1),c=s[0];return s=HA.bind(null,s[1]),Ti().memoizedState=s,[c,s]},useMutableSource:function(){},useSyncExternalStore:function(s,c,g){var b=ln,S=Ti();if(en){if(g===void 0)throw Error(r(407));g=g()}else{if(g=c(),Ln===null)throw Error(r(349));(oo&30)!==0||Kk(b,c,g)}S.memoizedState=g;var R={value:g,getSnapshot:c};return S.queue=R,t1(Xk.bind(null,b,R,s),[s]),b.flags|=2048,xc(9,Yk.bind(null,b,R,g,c),void 0,null),g},useId:function(){var s=Ti(),c=Ln.identifierPrefix;if(en){var g=ci,b=Gr;g=(b&~(1<<32-vr(b)-1)).toString(32)+g,c=":"+c+"R"+g,g=hc++,0<g&&(c+="H"+g.toString(32)),c+=":"}else g=qA++,c=":"+c+"r"+g.toString(32)+":";return s.memoizedState=c},unstable_isNewReconciler:!1},GA={readContext:Wa,useCallback:s1,useContext:Wa,useEffect:Lp,useImperativeHandle:i1,useInsertionEffect:r1,useLayoutEffect:n1,useMemo:o1,useReducer:Ip,useRef:e1,useState:function(){return Ip(mc)},useDebugValue:Op,useDeferredValue:function(s){var c=Va();return l1(c,_n.memoizedState,s)},useTransition:function(){var s=Ip(mc)[0],c=Va().memoizedState;return[s,c]},useMutableSource:Vk,useSyncExternalStore:Gk,useId:c1,unstable_isNewReconciler:!1},KA={readContext:Wa,useCallback:s1,useContext:Wa,useEffect:Lp,useImperativeHandle:i1,useInsertionEffect:r1,useLayoutEffect:n1,useMemo:o1,useReducer:Mp,useRef:e1,useState:function(){return Mp(mc)},useDebugValue:Op,useDeferredValue:function(s){var c=Va();return _n===null?c.memoizedState=s:l1(c,_n.memoizedState,s)},useTransition:function(){var s=Mp(mc)[0],c=Va().memoizedState;return[s,c]},useMutableSource:Vk,useSyncExternalStore:Gk,useId:c1,unstable_isNewReconciler:!1};function di(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 Dp(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 ed={isMounted:function(s){return(s=s._reactInternals)?rn(s)===s:!1},enqueueSetState:function(s,c,g){s=s._reactInternals;var b=na(),S=_s(s),R=Yi(b,S);R.payload=c,g!=null&&(R.callback=g),c=ys(s,R,S),c!==null&&(gi(c,s,S,b),Vu(c,s,S))},enqueueReplaceState:function(s,c,g){s=s._reactInternals;var b=na(),S=_s(s),R=Yi(b,S);R.tag=1,R.payload=c,g!=null&&(R.callback=g),c=ys(s,R,S),c!==null&&(gi(c,s,S,b),Vu(c,s,S))},enqueueForceUpdate:function(s,c){s=s._reactInternals;var g=na(),b=_s(s),S=Yi(g,b);S.tag=2,c!=null&&(S.callback=c),c=ys(s,S,b),c!==null&&(gi(c,s,b,g),Vu(c,s,b))}};function p1(s,c,g,b,S,R,q){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(b,R,q):c.prototype&&c.prototype.isPureReactComponent?!Xs(g,b)||!Xs(S,R):!0}function g1(s,c,g){var b=!1,S=we,R=c.contextType;return typeof R=="object"&&R!==null?R=Wa(R):(S=vt(c)?yt:Ae.current,b=c.contextTypes,R=(b=b!=null)?At(s,S):we),c=new c(g,R),s.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,c.updater=ed,s.stateNode=c,c._reactInternals=s,b&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=S,s.__reactInternalMemoizedMaskedChildContext=R),c}function h1(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&&ed.enqueueReplaceState(c,c.state,null)}function Pp(s,c,g,b){var S=s.stateNode;S.props=g,S.state=s.memoizedState,S.refs={},wp(s);var R=c.contextType;typeof R=="object"&&R!==null?S.context=Wa(R):(R=vt(c)?yt:Ae.current,S.context=At(s,R)),S.state=s.memoizedState,R=c.getDerivedStateFromProps,typeof R=="function"&&(Dp(s,c,R,g),S.state=s.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof S.getSnapshotBeforeUpdate=="function"||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(c=S.state,typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount(),c!==S.state&&ed.enqueueReplaceState(S,S.state,null),Gu(s,g,S,b),S.state=s.memoizedState),typeof S.componentDidMount=="function"&&(s.flags|=4194308)}function ul(s,c){try{var g="",b=c;do g+=W(b),b=b.return;while(b);var S=g}catch(R){S=`
39
+ Error generating stack: `+R.message+`
40
+ `+R.stack}return{value:s,source:c,stack:S,digest:null}}function Fp(s,c,g){return{value:s,source:null,stack:g??null,digest:c??null}}function Bp(s,c){try{console.error(c.value)}catch(g){setTimeout(function(){throw g})}}var YA=typeof WeakMap=="function"?WeakMap:Map;function m1(s,c,g){g=Yi(-1,g),g.tag=3,g.payload={element:null};var b=c.value;return g.callback=function(){od||(od=!0,eg=b),Bp(s,c)},g}function x1(s,c,g){g=Yi(-1,g),g.tag=3;var b=s.type.getDerivedStateFromError;if(typeof b=="function"){var S=c.value;g.payload=function(){return b(S)},g.callback=function(){Bp(s,c)}}var R=s.stateNode;return R!==null&&typeof R.componentDidCatch=="function"&&(g.callback=function(){Bp(s,c),typeof b!="function"&&(vs===null?vs=new Set([this]):vs.add(this));var q=c.stack;this.componentDidCatch(c.value,{componentStack:q!==null?q:""})}),g}function y1(s,c,g){var b=s.pingCache;if(b===null){b=s.pingCache=new YA;var S=new Set;b.set(c,S)}else S=b.get(c),S===void 0&&(S=new Set,b.set(c,S));S.has(g)||(S.add(g),s=cI.bind(null,s,c,g),c.then(s,s))}function b1(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 v1(s,c,g,b,S){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=Yi(-1,1),c.tag=2,ys(g,c,1))),g.lanes|=1),s):(s.flags|=65536,s.lanes=S,s)}var XA=A.ReactCurrentOwner,ga=!1;function ra(s,c,g,b){c.child=s===null?zk(c,null,g,b):sl(c,s.child,g,b)}function k1(s,c,g,b,S){g=g.render;var R=c.ref;return ll(c,S),b=Rp(s,c,g,b,R,S),g=Ap(),s!==null&&!ga?(c.updateQueue=s.updateQueue,c.flags&=-2053,s.lanes&=~S,Xi(s,c,S)):(en&&g&&pp(c),c.flags|=1,ra(s,c,b,S),c.child)}function _1(s,c,g,b,S){if(s===null){var R=g.type;return typeof R=="function"&&!og(R)&&R.defaultProps===void 0&&g.compare===null&&g.defaultProps===void 0?(c.tag=15,c.type=R,w1(s,c,R,b,S)):(s=pd(g.type,null,b,c,c.mode,S),s.ref=c.ref,s.return=c,c.child=s)}if(R=s.child,(s.lanes&S)===0){var q=R.memoizedProps;if(g=g.compare,g=g!==null?g:Xs,g(q,b)&&s.ref===c.ref)return Xi(s,c,S)}return c.flags|=1,s=Ss(R,b),s.ref=c.ref,s.return=c,c.child=s}function w1(s,c,g,b,S){if(s!==null){var R=s.memoizedProps;if(Xs(R,b)&&s.ref===c.ref)if(ga=!1,c.pendingProps=b=R,(s.lanes&S)!==0)(s.flags&131072)!==0&&(ga=!0);else return c.lanes=s.lanes,Xi(s,c,S)}return zp(s,c,g,b,S)}function S1(s,c,g){var b=c.pendingProps,S=b.children,R=s!==null?s.memoizedState:null;if(b.mode==="hidden")if((c.mode&1)===0)c.memoizedState={baseLanes:0,cachePool:null,transitions:null},de(fl,Ma),Ma|=g;else{if((g&1073741824)===0)return s=R!==null?R.baseLanes|g:g,c.lanes=c.childLanes=1073741824,c.memoizedState={baseLanes:s,cachePool:null,transitions:null},c.updateQueue=null,de(fl,Ma),Ma|=s,null;c.memoizedState={baseLanes:0,cachePool:null,transitions:null},b=R!==null?R.baseLanes:g,de(fl,Ma),Ma|=b}else R!==null?(b=R.baseLanes|g,c.memoizedState=null):b=g,de(fl,Ma),Ma|=b;return ra(s,c,S,g),c.child}function N1(s,c){var g=c.ref;(s===null&&g!==null||s!==null&&s.ref!==g)&&(c.flags|=512,c.flags|=2097152)}function zp(s,c,g,b,S){var R=vt(g)?yt:Ae.current;return R=At(c,R),ll(c,S),g=Rp(s,c,g,b,R,S),b=Ap(),s!==null&&!ga?(c.updateQueue=s.updateQueue,c.flags&=-2053,s.lanes&=~S,Xi(s,c,S)):(en&&b&&pp(c),c.flags|=1,ra(s,c,g,S),c.child)}function E1(s,c,g,b,S){if(vt(g)){var R=!0;Ei(c)}else R=!1;if(ll(c,S),c.stateNode===null)rd(s,c),g1(c,g,b),Pp(c,g,b,S),b=!0;else if(s===null){var q=c.stateNode,le=c.memoizedProps;q.props=le;var pe=q.context,Te=g.contextType;typeof Te=="object"&&Te!==null?Te=Wa(Te):(Te=vt(g)?yt:Ae.current,Te=At(c,Te));var Xe=g.getDerivedStateFromProps,tt=typeof Xe=="function"||typeof q.getSnapshotBeforeUpdate=="function";tt||typeof q.UNSAFE_componentWillReceiveProps!="function"&&typeof q.componentWillReceiveProps!="function"||(le!==b||pe!==Te)&&h1(c,q,b,Te),xs=!1;var Ke=c.memoizedState;q.state=Ke,Gu(c,b,q,S),pe=c.memoizedState,le!==b||Ke!==pe||Ue.current||xs?(typeof Xe=="function"&&(Dp(c,g,Xe,b),pe=c.memoizedState),(le=xs||p1(c,g,le,b,Ke,pe,Te))?(tt||typeof q.UNSAFE_componentWillMount!="function"&&typeof q.componentWillMount!="function"||(typeof q.componentWillMount=="function"&&q.componentWillMount(),typeof q.UNSAFE_componentWillMount=="function"&&q.UNSAFE_componentWillMount()),typeof q.componentDidMount=="function"&&(c.flags|=4194308)):(typeof q.componentDidMount=="function"&&(c.flags|=4194308),c.memoizedProps=b,c.memoizedState=pe),q.props=b,q.state=pe,q.context=Te,b=le):(typeof q.componentDidMount=="function"&&(c.flags|=4194308),b=!1)}else{q=c.stateNode,qk(s,c),le=c.memoizedProps,Te=c.type===c.elementType?le:di(c.type,le),q.props=Te,tt=c.pendingProps,Ke=q.context,pe=g.contextType,typeof pe=="object"&&pe!==null?pe=Wa(pe):(pe=vt(g)?yt:Ae.current,pe=At(c,pe));var Nt=g.getDerivedStateFromProps;(Xe=typeof Nt=="function"||typeof q.getSnapshotBeforeUpdate=="function")||typeof q.UNSAFE_componentWillReceiveProps!="function"&&typeof q.componentWillReceiveProps!="function"||(le!==tt||Ke!==pe)&&h1(c,q,b,pe),xs=!1,Ke=c.memoizedState,q.state=Ke,Gu(c,b,q,S);var Mt=c.memoizedState;le!==tt||Ke!==Mt||Ue.current||xs?(typeof Nt=="function"&&(Dp(c,g,Nt,b),Mt=c.memoizedState),(Te=xs||p1(c,g,Te,b,Ke,Mt,pe)||!1)?(Xe||typeof q.UNSAFE_componentWillUpdate!="function"&&typeof q.componentWillUpdate!="function"||(typeof q.componentWillUpdate=="function"&&q.componentWillUpdate(b,Mt,pe),typeof q.UNSAFE_componentWillUpdate=="function"&&q.UNSAFE_componentWillUpdate(b,Mt,pe)),typeof q.componentDidUpdate=="function"&&(c.flags|=4),typeof q.getSnapshotBeforeUpdate=="function"&&(c.flags|=1024)):(typeof q.componentDidUpdate!="function"||le===s.memoizedProps&&Ke===s.memoizedState||(c.flags|=4),typeof q.getSnapshotBeforeUpdate!="function"||le===s.memoizedProps&&Ke===s.memoizedState||(c.flags|=1024),c.memoizedProps=b,c.memoizedState=Mt),q.props=b,q.state=Mt,q.context=pe,b=Te):(typeof q.componentDidUpdate!="function"||le===s.memoizedProps&&Ke===s.memoizedState||(c.flags|=4),typeof q.getSnapshotBeforeUpdate!="function"||le===s.memoizedProps&&Ke===s.memoizedState||(c.flags|=1024),b=!1)}return Up(s,c,g,b,R,S)}function Up(s,c,g,b,S,R){N1(s,c);var q=(c.flags&128)!==0;if(!b&&!q)return S&&ta(c,g,!1),Xi(s,c,R);b=c.stateNode,XA.current=c;var le=q&&typeof g.getDerivedStateFromError!="function"?null:b.render();return c.flags|=1,s!==null&&q?(c.child=sl(c,s.child,null,R),c.child=sl(c,null,le,R)):ra(s,c,le,R),c.memoizedState=b.state,S&&ta(c,g,!0),c.child}function j1(s){var c=s.stateNode;c.pendingContext?Mr(s,c.pendingContext,c.pendingContext!==c.context):c.context&&Mr(s,c.context,!1),Sp(s,c.containerInfo)}function C1(s,c,g,b,S){return il(),xp(S),c.flags|=256,ra(s,c,g,b),c.child}var qp={dehydrated:null,treeContext:null,retryLane:0};function Hp(s){return{baseLanes:s,cachePool:null,transitions:null}}function T1(s,c,g){var b=c.pendingProps,S=on.current,R=!1,q=(c.flags&128)!==0,le;if((le=q)||(le=s!==null&&s.memoizedState===null?!1:(S&2)!==0),le?(R=!0,c.flags&=-129):(s===null||s.memoizedState!==null)&&(S|=1),de(on,S&1),s===null)return mp(c),s=c.memoizedState,s!==null&&(s=s.dehydrated,s!==null)?((c.mode&1)===0?c.lanes=1:s.data==="$!"?c.lanes=8:c.lanes=1073741824,null):(q=b.children,s=b.fallback,R?(b=c.mode,R=c.child,q={mode:"hidden",children:q},(b&1)===0&&R!==null?(R.childLanes=0,R.pendingProps=q):R=gd(q,b,0,null),s=po(s,b,g,null),R.return=c,s.return=c,R.sibling=s,c.child=R,c.child.memoizedState=Hp(g),c.memoizedState=qp,s):$p(c,q));if(S=s.memoizedState,S!==null&&(le=S.dehydrated,le!==null))return QA(s,c,q,b,le,S,g);if(R){R=b.fallback,q=c.mode,S=s.child,le=S.sibling;var pe={mode:"hidden",children:b.children};return(q&1)===0&&c.child!==S?(b=c.child,b.childLanes=0,b.pendingProps=pe,c.deletions=null):(b=Ss(S,pe),b.subtreeFlags=S.subtreeFlags&14680064),le!==null?R=Ss(le,R):(R=po(R,q,g,null),R.flags|=2),R.return=c,b.return=c,b.sibling=R,c.child=b,b=R,R=c.child,q=s.child.memoizedState,q=q===null?Hp(g):{baseLanes:q.baseLanes|g,cachePool:null,transitions:q.transitions},R.memoizedState=q,R.childLanes=s.childLanes&~g,c.memoizedState=qp,b}return R=s.child,s=R.sibling,b=Ss(R,{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 $p(s,c){return c=gd({mode:"visible",children:c},s.mode,0,null),c.return=s,s.child=c}function td(s,c,g,b){return b!==null&&xp(b),sl(c,s.child,null,g),s=$p(c,c.pendingProps.children),s.flags|=2,c.memoizedState=null,s}function QA(s,c,g,b,S,R,q){if(g)return c.flags&256?(c.flags&=-257,b=Fp(Error(r(422))),td(s,c,q,b)):c.memoizedState!==null?(c.child=s.child,c.flags|=128,null):(R=b.fallback,S=c.mode,b=gd({mode:"visible",children:b.children},S,0,null),R=po(R,S,q,null),R.flags|=2,b.return=c,R.return=c,b.sibling=R,c.child=b,(c.mode&1)!==0&&sl(c,s.child,null,q),c.child.memoizedState=Hp(q),c.memoizedState=qp,R);if((c.mode&1)===0)return td(s,c,q,null);if(S.data==="$!"){if(b=S.nextSibling&&S.nextSibling.dataset,b)var le=b.dgst;return b=le,R=Error(r(419)),b=Fp(R,b,void 0),td(s,c,q,b)}if(le=(q&s.childLanes)!==0,ga||le){if(b=Ln,b!==null){switch(q&-q){case 4:S=2;break;case 16:S=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:S=32;break;case 536870912:S=268435456;break;default:S=0}S=(S&(b.suspendedLanes|q))!==0?0:S,S!==0&&S!==R.retryLane&&(R.retryLane=S,Ki(s,S),gi(b,s,S,-1))}return sg(),b=Fp(Error(r(421))),td(s,c,q,b)}return S.data==="$?"?(c.flags|=128,c.child=s.child,c=uI.bind(null,s),S._reactRetry=c,null):(s=R.treeContext,Ia=Ta(S.nextSibling),Aa=c,en=!0,ui=null,s!==null&&(ur[sn++]=Gr,ur[sn++]=ci,ur[sn++]=Jr,Gr=s.id,ci=s.overflow,Jr=c),c=$p(c,b.children),c.flags|=4096,c)}function R1(s,c,g){s.lanes|=c;var b=s.alternate;b!==null&&(b.lanes|=c),kp(s.return,c,g)}function Wp(s,c,g,b,S){var R=s.memoizedState;R===null?s.memoizedState={isBackwards:c,rendering:null,renderingStartTime:0,last:b,tail:g,tailMode:S}:(R.isBackwards=c,R.rendering=null,R.renderingStartTime=0,R.last=b,R.tail=g,R.tailMode=S)}function A1(s,c,g){var b=c.pendingProps,S=b.revealOrder,R=b.tail;if(ra(s,c,b.children,g),b=on.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&&R1(s,g,c);else if(s.tag===19)R1(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(de(on,b),(c.mode&1)===0)c.memoizedState=null;else switch(S){case"forwards":for(g=c.child,S=null;g!==null;)s=g.alternate,s!==null&&Ku(s)===null&&(S=g),g=g.sibling;g=S,g===null?(S=c.child,c.child=null):(S=g.sibling,g.sibling=null),Wp(c,!1,S,g,R);break;case"backwards":for(g=null,S=c.child,c.child=null;S!==null;){if(s=S.alternate,s!==null&&Ku(s)===null){c.child=S;break}s=S.sibling,S.sibling=g,g=S,S=s}Wp(c,!0,g,null,R);break;case"together":Wp(c,!1,null,null,void 0);break;default:c.memoizedState=null}return c.child}function rd(s,c){(c.mode&1)===0&&s!==null&&(s.alternate=null,c.alternate=null,c.flags|=2)}function Xi(s,c,g){if(s!==null&&(c.dependencies=s.dependencies),lo|=c.lanes,(g&c.childLanes)===0)return null;if(s!==null&&c.child!==s.child)throw Error(r(153));if(c.child!==null){for(s=c.child,g=Ss(s,s.pendingProps),c.child=g,g.return=c;s.sibling!==null;)s=s.sibling,g=g.sibling=Ss(s,s.pendingProps),g.return=c;g.sibling=null}return c.child}function ZA(s,c,g){switch(c.tag){case 3:j1(c),il();break;case 5:Wk(c);break;case 1:vt(c.type)&&Ei(c);break;case 4:Sp(c,c.stateNode.containerInfo);break;case 10:var b=c.type._context,S=c.memoizedProps.value;de($u,b._currentValue),b._currentValue=S;break;case 13:if(b=c.memoizedState,b!==null)return b.dehydrated!==null?(de(on,on.current&1),c.flags|=128,null):(g&c.child.childLanes)!==0?T1(s,c,g):(de(on,on.current&1),s=Xi(s,c,g),s!==null?s.sibling:null);de(on,on.current&1);break;case 19:if(b=(g&c.childLanes)!==0,(s.flags&128)!==0){if(b)return A1(s,c,g);c.flags|=128}if(S=c.memoizedState,S!==null&&(S.rendering=null,S.tail=null,S.lastEffect=null),de(on,on.current),b)break;return null;case 22:case 23:return c.lanes=0,S1(s,c,g)}return Xi(s,c,g)}var I1,Vp,M1,L1;I1=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}},Vp=function(){},M1=function(s,c,g,b){var S=s.memoizedProps;if(S!==b){s=c.stateNode,so(Ci.current);var R=null;switch(g){case"input":S=qe(s,S),b=qe(s,b),R=[];break;case"select":S=P({},S,{value:void 0}),b=P({},b,{value:void 0}),R=[];break;case"textarea":S=Et(s,S),b=Et(s,b),R=[];break;default:typeof S.onClick!="function"&&typeof b.onClick=="function"&&(s.onclick=nl)}ot(g,b);var q;g=null;for(Te in S)if(!b.hasOwnProperty(Te)&&S.hasOwnProperty(Te)&&S[Te]!=null)if(Te==="style"){var le=S[Te];for(q in le)le.hasOwnProperty(q)&&(g||(g={}),g[q]="")}else Te!=="dangerouslySetInnerHTML"&&Te!=="children"&&Te!=="suppressContentEditableWarning"&&Te!=="suppressHydrationWarning"&&Te!=="autoFocus"&&(i.hasOwnProperty(Te)?R||(R=[]):(R=R||[]).push(Te,null));for(Te in b){var pe=b[Te];if(le=S!=null?S[Te]:void 0,b.hasOwnProperty(Te)&&pe!==le&&(pe!=null||le!=null))if(Te==="style")if(le){for(q in le)!le.hasOwnProperty(q)||pe&&pe.hasOwnProperty(q)||(g||(g={}),g[q]="");for(q in pe)pe.hasOwnProperty(q)&&le[q]!==pe[q]&&(g||(g={}),g[q]=pe[q])}else g||(R||(R=[]),R.push(Te,g)),g=pe;else Te==="dangerouslySetInnerHTML"?(pe=pe?pe.__html:void 0,le=le?le.__html:void 0,pe!=null&&le!==pe&&(R=R||[]).push(Te,pe)):Te==="children"?typeof pe!="string"&&typeof pe!="number"||(R=R||[]).push(Te,""+pe):Te!=="suppressContentEditableWarning"&&Te!=="suppressHydrationWarning"&&(i.hasOwnProperty(Te)?(pe!=null&&Te==="onScroll"&&Rr("scroll",s),R||le===pe||(R=[])):(R=R||[]).push(Te,pe))}g&&(R=R||[]).push("style",g);var Te=R;(c.updateQueue=Te)&&(c.flags|=4)}},L1=function(s,c,g,b){g!==b&&(c.flags|=4)};function yc(s,c){if(!en)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 Vn(s){var c=s.alternate!==null&&s.alternate.child===s.child,g=0,b=0;if(c)for(var S=s.child;S!==null;)g|=S.lanes|S.childLanes,b|=S.subtreeFlags&14680064,b|=S.flags&14680064,S.return=s,S=S.sibling;else for(S=s.child;S!==null;)g|=S.lanes|S.childLanes,b|=S.subtreeFlags,b|=S.flags,S.return=s,S=S.sibling;return s.subtreeFlags|=b,s.childLanes=g,c}function JA(s,c,g){var b=c.pendingProps;switch(gp(c),c.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Vn(c),null;case 1:return vt(c.type)&&Ht(),Vn(c),null;case 3:return b=c.stateNode,cl(),Y(Ue),Y(Ae),jp(),b.pendingContext&&(b.context=b.pendingContext,b.pendingContext=null),(s===null||s.child===null)&&(qu(c)?c.flags|=4:s===null||s.memoizedState.isDehydrated&&(c.flags&256)===0||(c.flags|=1024,ui!==null&&(ng(ui),ui=null))),Vp(s,c),Vn(c),null;case 5:Np(c);var S=so(pc.current);if(g=c.type,s!==null&&c.stateNode!=null)M1(s,c,g,b,S),s.ref!==c.ref&&(c.flags|=512,c.flags|=2097152);else{if(!b){if(c.stateNode===null)throw Error(r(166));return Vn(c),null}if(s=so(Ci.current),qu(c)){b=c.stateNode,g=c.type;var R=c.memoizedProps;switch(b[O]=c,b[te]=R,s=(c.mode&1)!==0,g){case"dialog":Rr("cancel",b),Rr("close",b);break;case"iframe":case"object":case"embed":Rr("load",b);break;case"video":case"audio":for(S=0;S<Js.length;S++)Rr(Js[S],b);break;case"source":Rr("error",b);break;case"img":case"image":case"link":Rr("error",b),Rr("load",b);break;case"details":Rr("toggle",b);break;case"input":Ce(b,R),Rr("invalid",b);break;case"select":b._wrapperState={wasMultiple:!!R.multiple},Rr("invalid",b);break;case"textarea":Ze(b,R),Rr("invalid",b)}ot(g,R),S=null;for(var q in R)if(R.hasOwnProperty(q)){var le=R[q];q==="children"?typeof le=="string"?b.textContent!==le&&(R.suppressHydrationWarning!==!0&&hs(b.textContent,le,s),S=["children",le]):typeof le=="number"&&b.textContent!==""+le&&(R.suppressHydrationWarning!==!0&&hs(b.textContent,le,s),S=["children",""+le]):i.hasOwnProperty(q)&&le!=null&&q==="onScroll"&&Rr("scroll",b)}switch(g){case"input":Fe(b),gt(b,R,!0);break;case"textarea":Fe(b),it(b);break;case"select":case"option":break;default:typeof R.onClick=="function"&&(b.onclick=nl)}b=S,c.updateQueue=b,b!==null&&(c.flags|=4)}else{q=S.nodeType===9?S:S.ownerDocument,s==="http://www.w3.org/1999/xhtml"&&(s=me(g)),s==="http://www.w3.org/1999/xhtml"?g==="script"?(s=q.createElement("div"),s.innerHTML="<script><\/script>",s=s.removeChild(s.firstChild)):typeof b.is=="string"?s=q.createElement(g,{is:b.is}):(s=q.createElement(g),g==="select"&&(q=s,b.multiple?q.multiple=!0:b.size&&(q.size=b.size))):s=q.createElementNS(s,g),s[O]=c,s[te]=b,I1(s,c,!1,!1),c.stateNode=s;e:{switch(q=et(g,b),g){case"dialog":Rr("cancel",s),Rr("close",s),S=b;break;case"iframe":case"object":case"embed":Rr("load",s),S=b;break;case"video":case"audio":for(S=0;S<Js.length;S++)Rr(Js[S],s);S=b;break;case"source":Rr("error",s),S=b;break;case"img":case"image":case"link":Rr("error",s),Rr("load",s),S=b;break;case"details":Rr("toggle",s),S=b;break;case"input":Ce(s,b),S=qe(s,b),Rr("invalid",s);break;case"option":S=b;break;case"select":s._wrapperState={wasMultiple:!!b.multiple},S=P({},b,{value:void 0}),Rr("invalid",s);break;case"textarea":Ze(s,b),S=Et(s,b),Rr("invalid",s);break;default:S=b}ot(g,S),le=S;for(R in le)if(le.hasOwnProperty(R)){var pe=le[R];R==="style"?lt(s,pe):R==="dangerouslySetInnerHTML"?(pe=pe?pe.__html:void 0,pe!=null&&je(s,pe)):R==="children"?typeof pe=="string"?(g!=="textarea"||pe!=="")&&se(s,pe):typeof pe=="number"&&se(s,""+pe):R!=="suppressContentEditableWarning"&&R!=="suppressHydrationWarning"&&R!=="autoFocus"&&(i.hasOwnProperty(R)?pe!=null&&R==="onScroll"&&Rr("scroll",s):pe!=null&&E(s,R,pe,q))}switch(g){case"input":Fe(s),gt(s,b,!1);break;case"textarea":Fe(s),it(s);break;case"option":b.value!=null&&s.setAttribute("value",""+Q(b.value));break;case"select":s.multiple=!!b.multiple,R=b.value,R!=null?$e(s,!!b.multiple,R,!1):b.defaultValue!=null&&$e(s,!!b.multiple,b.defaultValue,!0);break;default:typeof S.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 Vn(c),null;case 6:if(s&&c.stateNode!=null)L1(s,c,s.memoizedProps,b);else{if(typeof b!="string"&&c.stateNode===null)throw Error(r(166));if(g=so(pc.current),so(Ci.current),qu(c)){if(b=c.stateNode,g=c.memoizedProps,b[O]=c,(R=b.nodeValue!==g)&&(s=Aa,s!==null))switch(s.tag){case 3:hs(b.nodeValue,g,(s.mode&1)!==0);break;case 5:s.memoizedProps.suppressHydrationWarning!==!0&&hs(b.nodeValue,g,(s.mode&1)!==0)}R&&(c.flags|=4)}else b=(g.nodeType===9?g:g.ownerDocument).createTextNode(b),b[O]=c,c.stateNode=b}return Vn(c),null;case 13:if(Y(on),b=c.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(en&&Ia!==null&&(c.mode&1)!==0&&(c.flags&128)===0)Pk(),il(),c.flags|=98560,R=!1;else if(R=qu(c),b!==null&&b.dehydrated!==null){if(s===null){if(!R)throw Error(r(318));if(R=c.memoizedState,R=R!==null?R.dehydrated:null,!R)throw Error(r(317));R[O]=c}else il(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;Vn(c),R=!1}else ui!==null&&(ng(ui),ui=null),R=!0;if(!R)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||(on.current&1)!==0?wn===0&&(wn=3):sg())),c.updateQueue!==null&&(c.flags|=4),Vn(c),null);case 4:return cl(),Vp(s,c),s===null&&oi(c.stateNode.containerInfo),Vn(c),null;case 10:return vp(c.type._context),Vn(c),null;case 17:return vt(c.type)&&Ht(),Vn(c),null;case 19:if(Y(on),R=c.memoizedState,R===null)return Vn(c),null;if(b=(c.flags&128)!==0,q=R.rendering,q===null)if(b)yc(R,!1);else{if(wn!==0||s!==null&&(s.flags&128)!==0)for(s=c.child;s!==null;){if(q=Ku(s),q!==null){for(c.flags|=128,yc(R,!1),b=q.updateQueue,b!==null&&(c.updateQueue=b,c.flags|=4),c.subtreeFlags=0,b=g,g=c.child;g!==null;)R=g,s=b,R.flags&=14680066,q=R.alternate,q===null?(R.childLanes=0,R.lanes=s,R.child=null,R.subtreeFlags=0,R.memoizedProps=null,R.memoizedState=null,R.updateQueue=null,R.dependencies=null,R.stateNode=null):(R.childLanes=q.childLanes,R.lanes=q.lanes,R.child=q.child,R.subtreeFlags=0,R.deletions=null,R.memoizedProps=q.memoizedProps,R.memoizedState=q.memoizedState,R.updateQueue=q.updateQueue,R.type=q.type,s=q.dependencies,R.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),g=g.sibling;return de(on,on.current&1|2),c.child}s=s.sibling}R.tail!==null&&Lr()>pl&&(c.flags|=128,b=!0,yc(R,!1),c.lanes=4194304)}else{if(!b)if(s=Ku(q),s!==null){if(c.flags|=128,b=!0,g=s.updateQueue,g!==null&&(c.updateQueue=g,c.flags|=4),yc(R,!0),R.tail===null&&R.tailMode==="hidden"&&!q.alternate&&!en)return Vn(c),null}else 2*Lr()-R.renderingStartTime>pl&&g!==1073741824&&(c.flags|=128,b=!0,yc(R,!1),c.lanes=4194304);R.isBackwards?(q.sibling=c.child,c.child=q):(g=R.last,g!==null?g.sibling=q:c.child=q,R.last=q)}return R.tail!==null?(c=R.tail,R.rendering=c,R.tail=c.sibling,R.renderingStartTime=Lr(),c.sibling=null,g=on.current,de(on,b?g&1|2:g&1),c):(Vn(c),null);case 22:case 23:return ig(),b=c.memoizedState!==null,s!==null&&s.memoizedState!==null!==b&&(c.flags|=8192),b&&(c.mode&1)!==0?(Ma&1073741824)!==0&&(Vn(c),c.subtreeFlags&6&&(c.flags|=8192)):Vn(c),null;case 24:return null;case 25:return null}throw Error(r(156,c.tag))}function eI(s,c){switch(gp(c),c.tag){case 1:return vt(c.type)&&Ht(),s=c.flags,s&65536?(c.flags=s&-65537|128,c):null;case 3:return cl(),Y(Ue),Y(Ae),jp(),s=c.flags,(s&65536)!==0&&(s&128)===0?(c.flags=s&-65537|128,c):null;case 5:return Np(c),null;case 13:if(Y(on),s=c.memoizedState,s!==null&&s.dehydrated!==null){if(c.alternate===null)throw Error(r(340));il()}return s=c.flags,s&65536?(c.flags=s&-65537|128,c):null;case 19:return Y(on),null;case 4:return cl(),null;case 10:return vp(c.type._context),null;case 22:case 23:return ig(),null;case 24:return null;default:return null}}var nd=!1,Gn=!1,tI=typeof WeakSet=="function"?WeakSet:Set,It=null;function dl(s,c){var g=s.ref;if(g!==null)if(typeof g=="function")try{g(null)}catch(b){dn(s,c,b)}else g.current=null}function Gp(s,c,g){try{g()}catch(b){dn(s,c,b)}}var O1=!1;function rI(s,c){if(lc=Po,s=Yo(),Ea(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 S=b.anchorOffset,R=b.focusNode;b=b.focusOffset;try{g.nodeType,R.nodeType}catch{g=null;break e}var q=0,le=-1,pe=-1,Te=0,Xe=0,tt=s,Ke=null;t:for(;;){for(var Nt;tt!==g||S!==0&&tt.nodeType!==3||(le=q+S),tt!==R||b!==0&&tt.nodeType!==3||(pe=q+b),tt.nodeType===3&&(q+=tt.nodeValue.length),(Nt=tt.firstChild)!==null;)Ke=tt,tt=Nt;for(;;){if(tt===s)break t;if(Ke===g&&++Te===S&&(le=q),Ke===R&&++Xe===b&&(pe=q),(Nt=tt.nextSibling)!==null)break;tt=Ke,Ke=tt.parentNode}tt=Nt}g=le===-1||pe===-1?null:{start:le,end:pe}}else g=null}g=g||{start:0,end:0}}else g=null;for(Ni={focusedElem:s,selectionRange:g},Po=!1,It=c;It!==null;)if(c=It,s=c.child,(c.subtreeFlags&1028)!==0&&s!==null)s.return=c,It=s;else for(;It!==null;){c=It;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 Pt=Mt.memoizedProps,pn=Mt.memoizedState,_e=c.stateNode,xe=_e.getSnapshotBeforeUpdate(c.elementType===c.type?Pt:di(c.type,Pt),pn);_e.__reactInternalSnapshotBeforeUpdate=xe}break;case 3:var Ne=c.stateNode.containerInfo;Ne.nodeType===1?Ne.textContent="":Ne.nodeType===9&&Ne.documentElement&&Ne.removeChild(Ne.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(pt){dn(c,c.return,pt)}if(s=c.sibling,s!==null){s.return=c.return,It=s;break}It=c.return}return Mt=O1,O1=!1,Mt}function bc(s,c,g){var b=c.updateQueue;if(b=b!==null?b.lastEffect:null,b!==null){var S=b=b.next;do{if((S.tag&s)===s){var R=S.destroy;S.destroy=void 0,R!==void 0&&Gp(c,g,R)}S=S.next}while(S!==b)}}function ad(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 Kp(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 D1(s){var c=s.alternate;c!==null&&(s.alternate=null,D1(c)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(c=s.stateNode,c!==null&&(delete c[O],delete c[te],delete c[he],delete c[ye],delete c[Pe])),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 P1(s){return s.tag===5||s.tag===3||s.tag===4}function F1(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||P1(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 Yp(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(Yp(s,c,g),s=s.sibling;s!==null;)Yp(s,c,g),s=s.sibling}function Xp(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(Xp(s,c,g),s=s.sibling;s!==null;)Xp(s,c,g),s=s.sibling}var Hn=null,fi=!1;function bs(s,c,g){for(g=g.child;g!==null;)B1(s,c,g),g=g.sibling}function B1(s,c,g){if(Gt&&typeof Gt.onCommitFiberUnmount=="function")try{Gt.onCommitFiberUnmount(qt,g)}catch{}switch(g.tag){case 5:Gn||dl(g,c);case 6:var b=Hn,S=fi;Hn=null,bs(s,c,g),Hn=b,fi=S,Hn!==null&&(fi?(s=Hn,g=g.stateNode,s.nodeType===8?s.parentNode.removeChild(g):s.removeChild(g)):Hn.removeChild(g.stateNode));break;case 18:Hn!==null&&(fi?(s=Hn,g=g.stateNode,s.nodeType===8?al(s.parentNode,g):s.nodeType===1&&al(s,g),zs(s)):al(Hn,g.stateNode));break;case 4:b=Hn,S=fi,Hn=g.stateNode.containerInfo,fi=!0,bs(s,c,g),Hn=b,fi=S;break;case 0:case 11:case 14:case 15:if(!Gn&&(b=g.updateQueue,b!==null&&(b=b.lastEffect,b!==null))){S=b=b.next;do{var R=S,q=R.destroy;R=R.tag,q!==void 0&&((R&2)!==0||(R&4)!==0)&&Gp(g,c,q),S=S.next}while(S!==b)}bs(s,c,g);break;case 1:if(!Gn&&(dl(g,c),b=g.stateNode,typeof b.componentWillUnmount=="function"))try{b.props=g.memoizedProps,b.state=g.memoizedState,b.componentWillUnmount()}catch(le){dn(g,c,le)}bs(s,c,g);break;case 21:bs(s,c,g);break;case 22:g.mode&1?(Gn=(b=Gn)||g.memoizedState!==null,bs(s,c,g),Gn=b):bs(s,c,g);break;default:bs(s,c,g)}}function z1(s){var c=s.updateQueue;if(c!==null){s.updateQueue=null;var g=s.stateNode;g===null&&(g=s.stateNode=new tI),c.forEach(function(b){var S=dI.bind(null,s,b);g.has(b)||(g.add(b),b.then(S,S))})}}function pi(s,c){var g=c.deletions;if(g!==null)for(var b=0;b<g.length;b++){var S=g[b];try{var R=s,q=c,le=q;e:for(;le!==null;){switch(le.tag){case 5:Hn=le.stateNode,fi=!1;break e;case 3:Hn=le.stateNode.containerInfo,fi=!0;break e;case 4:Hn=le.stateNode.containerInfo,fi=!0;break e}le=le.return}if(Hn===null)throw Error(r(160));B1(R,q,S),Hn=null,fi=!1;var pe=S.alternate;pe!==null&&(pe.return=null),S.return=null}catch(Te){dn(S,c,Te)}}if(c.subtreeFlags&12854)for(c=c.child;c!==null;)U1(c,s),c=c.sibling}function U1(s,c){var g=s.alternate,b=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:if(pi(c,s),Ri(s),b&4){try{bc(3,s,s.return),ad(3,s)}catch(Pt){dn(s,s.return,Pt)}try{bc(5,s,s.return)}catch(Pt){dn(s,s.return,Pt)}}break;case 1:pi(c,s),Ri(s),b&512&&g!==null&&dl(g,g.return);break;case 5:if(pi(c,s),Ri(s),b&512&&g!==null&&dl(g,g.return),s.flags&32){var S=s.stateNode;try{se(S,"")}catch(Pt){dn(s,s.return,Pt)}}if(b&4&&(S=s.stateNode,S!=null)){var R=s.memoizedProps,q=g!==null?g.memoizedProps:R,le=s.type,pe=s.updateQueue;if(s.updateQueue=null,pe!==null)try{le==="input"&&R.type==="radio"&&R.name!=null&&He(S,R),et(le,q);var Te=et(le,R);for(q=0;q<pe.length;q+=2){var Xe=pe[q],tt=pe[q+1];Xe==="style"?lt(S,tt):Xe==="dangerouslySetInnerHTML"?je(S,tt):Xe==="children"?se(S,tt):E(S,Xe,tt,Te)}switch(le){case"input":ze(S,R);break;case"textarea":Oe(S,R);break;case"select":var Ke=S._wrapperState.wasMultiple;S._wrapperState.wasMultiple=!!R.multiple;var Nt=R.value;Nt!=null?$e(S,!!R.multiple,Nt,!1):Ke!==!!R.multiple&&(R.defaultValue!=null?$e(S,!!R.multiple,R.defaultValue,!0):$e(S,!!R.multiple,R.multiple?[]:"",!1))}S[te]=R}catch(Pt){dn(s,s.return,Pt)}}break;case 6:if(pi(c,s),Ri(s),b&4){if(s.stateNode===null)throw Error(r(162));S=s.stateNode,R=s.memoizedProps;try{S.nodeValue=R}catch(Pt){dn(s,s.return,Pt)}}break;case 3:if(pi(c,s),Ri(s),b&4&&g!==null&&g.memoizedState.isDehydrated)try{zs(c.containerInfo)}catch(Pt){dn(s,s.return,Pt)}break;case 4:pi(c,s),Ri(s);break;case 13:pi(c,s),Ri(s),S=s.child,S.flags&8192&&(R=S.memoizedState!==null,S.stateNode.isHidden=R,!R||S.alternate!==null&&S.alternate.memoizedState!==null||(Jp=Lr())),b&4&&z1(s);break;case 22:if(Xe=g!==null&&g.memoizedState!==null,s.mode&1?(Gn=(Te=Gn)||Xe,pi(c,s),Gn=Te):pi(c,s),Ri(s),b&8192){if(Te=s.memoizedState!==null,(s.stateNode.isHidden=Te)&&!Xe&&(s.mode&1)!==0)for(It=s,Xe=s.child;Xe!==null;){for(tt=It=Xe;It!==null;){switch(Ke=It,Nt=Ke.child,Ke.tag){case 0:case 11:case 14:case 15:bc(4,Ke,Ke.return);break;case 1:dl(Ke,Ke.return);var Mt=Ke.stateNode;if(typeof Mt.componentWillUnmount=="function"){b=Ke,g=Ke.return;try{c=b,Mt.props=c.memoizedProps,Mt.state=c.memoizedState,Mt.componentWillUnmount()}catch(Pt){dn(b,g,Pt)}}break;case 5:dl(Ke,Ke.return);break;case 22:if(Ke.memoizedState!==null){$1(tt);continue}}Nt!==null?(Nt.return=Ke,It=Nt):$1(tt)}Xe=Xe.sibling}e:for(Xe=null,tt=s;;){if(tt.tag===5){if(Xe===null){Xe=tt;try{S=tt.stateNode,Te?(R=S.style,typeof R.setProperty=="function"?R.setProperty("display","none","important"):R.display="none"):(le=tt.stateNode,pe=tt.memoizedProps.style,q=pe!=null&&pe.hasOwnProperty("display")?pe.display:null,le.style.display=dt("display",q))}catch(Pt){dn(s,s.return,Pt)}}}else if(tt.tag===6){if(Xe===null)try{tt.stateNode.nodeValue=Te?"":tt.memoizedProps}catch(Pt){dn(s,s.return,Pt)}}else if((tt.tag!==22&&tt.tag!==23||tt.memoizedState===null||tt===s)&&tt.child!==null){tt.child.return=tt,tt=tt.child;continue}if(tt===s)break e;for(;tt.sibling===null;){if(tt.return===null||tt.return===s)break e;Xe===tt&&(Xe=null),tt=tt.return}Xe===tt&&(Xe=null),tt.sibling.return=tt.return,tt=tt.sibling}}break;case 19:pi(c,s),Ri(s),b&4&&z1(s);break;case 21:break;default:pi(c,s),Ri(s)}}function Ri(s){var c=s.flags;if(c&2){try{e:{for(var g=s.return;g!==null;){if(P1(g)){var b=g;break e}g=g.return}throw Error(r(160))}switch(b.tag){case 5:var S=b.stateNode;b.flags&32&&(se(S,""),b.flags&=-33);var R=F1(s);Xp(s,R,S);break;case 3:case 4:var q=b.stateNode.containerInfo,le=F1(s);Yp(s,le,q);break;default:throw Error(r(161))}}catch(pe){dn(s,s.return,pe)}s.flags&=-3}c&4096&&(s.flags&=-4097)}function nI(s,c,g){It=s,q1(s)}function q1(s,c,g){for(var b=(s.mode&1)!==0;It!==null;){var S=It,R=S.child;if(S.tag===22&&b){var q=S.memoizedState!==null||nd;if(!q){var le=S.alternate,pe=le!==null&&le.memoizedState!==null||Gn;le=nd;var Te=Gn;if(nd=q,(Gn=pe)&&!Te)for(It=S;It!==null;)q=It,pe=q.child,q.tag===22&&q.memoizedState!==null?W1(S):pe!==null?(pe.return=q,It=pe):W1(S);for(;R!==null;)It=R,q1(R),R=R.sibling;It=S,nd=le,Gn=Te}H1(s)}else(S.subtreeFlags&8772)!==0&&R!==null?(R.return=S,It=R):H1(s)}}function H1(s){for(;It!==null;){var c=It;if((c.flags&8772)!==0){var g=c.alternate;try{if((c.flags&8772)!==0)switch(c.tag){case 0:case 11:case 15:Gn||ad(5,c);break;case 1:var b=c.stateNode;if(c.flags&4&&!Gn)if(g===null)b.componentDidMount();else{var S=c.elementType===c.type?g.memoizedProps:di(c.type,g.memoizedProps);b.componentDidUpdate(S,g.memoizedState,b.__reactInternalSnapshotBeforeUpdate)}var R=c.updateQueue;R!==null&&$k(c,R,b);break;case 3:var q=c.updateQueue;if(q!==null){if(g=null,c.child!==null)switch(c.child.tag){case 5:g=c.child.stateNode;break;case 1:g=c.child.stateNode}$k(c,q,g)}break;case 5:var le=c.stateNode;if(g===null&&c.flags&4){g=le;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 Te=c.alternate;if(Te!==null){var Xe=Te.memoizedState;if(Xe!==null){var tt=Xe.dehydrated;tt!==null&&zs(tt)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}Gn||c.flags&512&&Kp(c)}catch(Ke){dn(c,c.return,Ke)}}if(c===s){It=null;break}if(g=c.sibling,g!==null){g.return=c.return,It=g;break}It=c.return}}function $1(s){for(;It!==null;){var c=It;if(c===s){It=null;break}var g=c.sibling;if(g!==null){g.return=c.return,It=g;break}It=c.return}}function W1(s){for(;It!==null;){var c=It;try{switch(c.tag){case 0:case 11:case 15:var g=c.return;try{ad(4,c)}catch(pe){dn(c,g,pe)}break;case 1:var b=c.stateNode;if(typeof b.componentDidMount=="function"){var S=c.return;try{b.componentDidMount()}catch(pe){dn(c,S,pe)}}var R=c.return;try{Kp(c)}catch(pe){dn(c,R,pe)}break;case 5:var q=c.return;try{Kp(c)}catch(pe){dn(c,q,pe)}}}catch(pe){dn(c,c.return,pe)}if(c===s){It=null;break}var le=c.sibling;if(le!==null){le.return=c.return,It=le;break}It=c.return}}var aI=Math.ceil,id=A.ReactCurrentDispatcher,Qp=A.ReactCurrentOwner,Ga=A.ReactCurrentBatchConfig,_r=0,Ln=null,xn=null,$n=0,Ma=0,fl=be(0),wn=0,vc=null,lo=0,sd=0,Zp=0,kc=null,ha=null,Jp=0,pl=1/0,Qi=null,od=!1,eg=null,vs=null,ld=!1,ks=null,cd=0,_c=0,tg=null,ud=-1,dd=0;function na(){return(_r&6)!==0?Lr():ud!==-1?ud:ud=Lr()}function _s(s){return(s.mode&1)===0?1:(_r&2)!==0&&$n!==0?$n&-$n:UA.transition!==null?(dd===0&&(dd=Cn()),dd):(s=fr,s!==0||(s=window.event,s=s===void 0?16:as(s.type)),s)}function gi(s,c,g,b){if(50<_c)throw _c=0,tg=null,Error(r(185));Jn(s,g,b),((_r&2)===0||s!==Ln)&&(s===Ln&&((_r&2)===0&&(sd|=g),wn===4&&ws(s,$n)),ma(s,b),g===1&&_r===0&&(c.mode&1)===0&&(pl=Lr()+500,Wi&&li()))}function ma(s,c){var g=s.callbackNode;nn(s,c);var b=Fn(s,s===Ln?$n:0);if(b===0)g!==null&&un(g),s.callbackNode=null,s.callbackPriority=0;else if(c=b&-b,s.callbackPriority!==c){if(g!=null&&un(g),c===1)s.tag===0?Uu(G1.bind(null,s)):zu(G1.bind(null,s)),dp(function(){(_r&6)===0&&li()}),g=null;else{switch(Kt(b)){case 1:g=ni;break;case 4:g=ca;break;case 16:g=jn;break;case 536870912:g=_t;break;default:g=jn}g=t_(g,V1.bind(null,s))}s.callbackPriority=c,s.callbackNode=g}}function V1(s,c){if(ud=-1,dd=0,(_r&6)!==0)throw Error(r(327));var g=s.callbackNode;if(gl()&&s.callbackNode!==g)return null;var b=Fn(s,s===Ln?$n:0);if(b===0)return null;if((b&30)!==0||(b&s.expiredLanes)!==0||c)c=fd(s,b);else{c=b;var S=_r;_r|=2;var R=Y1();(Ln!==s||$n!==c)&&(Qi=null,pl=Lr()+500,uo(s,c));do try{oI();break}catch(le){K1(s,le)}while(!0);bp(),id.current=R,_r=S,xn!==null?c=0:(Ln=null,$n=0,c=wn)}if(c!==0){if(c===2&&(S=ua(s),S!==0&&(b=S,c=rg(s,S))),c===1)throw g=vc,uo(s,0),ws(s,b),ma(s,Lr()),g;if(c===6)ws(s,b);else{if(S=s.current.alternate,(b&30)===0&&!iI(S)&&(c=fd(s,b),c===2&&(R=ua(s),R!==0&&(b=R,c=rg(s,R))),c===1))throw g=vc,uo(s,0),ws(s,b),ma(s,Lr()),g;switch(s.finishedWork=S,s.finishedLanes=b,c){case 0:case 1:throw Error(r(345));case 2:fo(s,ha,Qi);break;case 3:if(ws(s,b),(b&130023424)===b&&(c=Jp+500-Lr(),10<c)){if(Fn(s,0)!==0)break;if(S=s.suspendedLanes,(S&b)!==b){na(),s.pingedLanes|=s.suspendedLanes&S;break}s.timeoutHandle=to(fo.bind(null,s,ha,Qi),c);break}fo(s,ha,Qi);break;case 4:if(ws(s,b),(b&4194240)===b)break;for(c=s.eventTimes,S=-1;0<b;){var q=31-vr(b);R=1<<q,q=c[q],q>S&&(S=q),b&=~R}if(b=S,b=Lr()-b,b=(120>b?120:480>b?480:1080>b?1080:1920>b?1920:3e3>b?3e3:4320>b?4320:1960*aI(b/1960))-b,10<b){s.timeoutHandle=to(fo.bind(null,s,ha,Qi),b);break}fo(s,ha,Qi);break;case 5:fo(s,ha,Qi);break;default:throw Error(r(329))}}}return ma(s,Lr()),s.callbackNode===g?V1.bind(null,s):null}function rg(s,c){var g=kc;return s.current.memoizedState.isDehydrated&&(uo(s,c).flags|=256),s=fd(s,c),s!==2&&(c=ha,ha=g,c!==null&&ng(c)),s}function ng(s){ha===null?ha=s:ha.push.apply(ha,s)}function iI(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 S=g[b],R=S.getSnapshot;S=S.value;try{if(!An(R(),S))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 ws(s,c){for(c&=~Zp,c&=~sd,s.suspendedLanes|=c,s.pingedLanes&=~c,s=s.expirationTimes;0<c;){var g=31-vr(c),b=1<<g;s[g]=-1,c&=~b}}function G1(s){if((_r&6)!==0)throw Error(r(327));gl();var c=Fn(s,0);if((c&1)===0)return ma(s,Lr()),null;var g=fd(s,c);if(s.tag!==0&&g===2){var b=ua(s);b!==0&&(c=b,g=rg(s,b))}if(g===1)throw g=vc,uo(s,0),ws(s,c),ma(s,Lr()),g;if(g===6)throw Error(r(345));return s.finishedWork=s.current.alternate,s.finishedLanes=c,fo(s,ha,Qi),ma(s,Lr()),null}function ag(s,c){var g=_r;_r|=1;try{return s(c)}finally{_r=g,_r===0&&(pl=Lr()+500,Wi&&li())}}function co(s){ks!==null&&ks.tag===0&&(_r&6)===0&&gl();var c=_r;_r|=1;var g=Ga.transition,b=fr;try{if(Ga.transition=null,fr=1,s)return s()}finally{fr=b,Ga.transition=g,_r=c,(_r&6)===0&&li()}}function ig(){Ma=fl.current,Y(fl)}function uo(s,c){s.finishedWork=null,s.finishedLanes=0;var g=s.timeoutHandle;if(g!==-1&&(s.timeoutHandle=-1,up(g)),xn!==null)for(g=xn.return;g!==null;){var b=g;switch(gp(b),b.tag){case 1:b=b.type.childContextTypes,b!=null&&Ht();break;case 3:cl(),Y(Ue),Y(Ae),jp();break;case 5:Np(b);break;case 4:cl();break;case 13:Y(on);break;case 19:Y(on);break;case 10:vp(b.type._context);break;case 22:case 23:ig()}g=g.return}if(Ln=s,xn=s=Ss(s.current,null),$n=Ma=c,wn=0,vc=null,Zp=sd=lo=0,ha=kc=null,io!==null){for(c=0;c<io.length;c++)if(g=io[c],b=g.interleaved,b!==null){g.interleaved=null;var S=b.next,R=g.pending;if(R!==null){var q=R.next;R.next=S,b.next=q}g.pending=b}io=null}return s}function K1(s,c){do{var g=xn;try{if(bp(),Yu.current=Ju,Xu){for(var b=ln.memoizedState;b!==null;){var S=b.queue;S!==null&&(S.pending=null),b=b.next}Xu=!1}if(oo=0,Mn=_n=ln=null,gc=!1,hc=0,Qp.current=null,g===null||g.return===null){wn=1,vc=c,xn=null;break}e:{var R=s,q=g.return,le=g,pe=c;if(c=$n,le.flags|=32768,pe!==null&&typeof pe=="object"&&typeof pe.then=="function"){var Te=pe,Xe=le,tt=Xe.tag;if((Xe.mode&1)===0&&(tt===0||tt===11||tt===15)){var Ke=Xe.alternate;Ke?(Xe.updateQueue=Ke.updateQueue,Xe.memoizedState=Ke.memoizedState,Xe.lanes=Ke.lanes):(Xe.updateQueue=null,Xe.memoizedState=null)}var Nt=b1(q);if(Nt!==null){Nt.flags&=-257,v1(Nt,q,le,R,c),Nt.mode&1&&y1(R,Te,c),c=Nt,pe=Te;var Mt=c.updateQueue;if(Mt===null){var Pt=new Set;Pt.add(pe),c.updateQueue=Pt}else Mt.add(pe);break e}else{if((c&1)===0){y1(R,Te,c),sg();break e}pe=Error(r(426))}}else if(en&&le.mode&1){var pn=b1(q);if(pn!==null){(pn.flags&65536)===0&&(pn.flags|=256),v1(pn,q,le,R,c),xp(ul(pe,le));break e}}R=pe=ul(pe,le),wn!==4&&(wn=2),kc===null?kc=[R]:kc.push(R),R=q;do{switch(R.tag){case 3:R.flags|=65536,c&=-c,R.lanes|=c;var _e=m1(R,pe,c);Hk(R,_e);break e;case 1:le=pe;var xe=R.type,Ne=R.stateNode;if((R.flags&128)===0&&(typeof xe.getDerivedStateFromError=="function"||Ne!==null&&typeof Ne.componentDidCatch=="function"&&(vs===null||!vs.has(Ne)))){R.flags|=65536,c&=-c,R.lanes|=c;var pt=x1(R,le,c);Hk(R,pt);break e}}R=R.return}while(R!==null)}Q1(g)}catch(Bt){c=Bt,xn===g&&g!==null&&(xn=g=g.return);continue}break}while(!0)}function Y1(){var s=id.current;return id.current=Ju,s===null?Ju:s}function sg(){(wn===0||wn===3||wn===2)&&(wn=4),Ln===null||(lo&268435455)===0&&(sd&268435455)===0||ws(Ln,$n)}function fd(s,c){var g=_r;_r|=2;var b=Y1();(Ln!==s||$n!==c)&&(Qi=null,uo(s,c));do try{sI();break}catch(S){K1(s,S)}while(!0);if(bp(),_r=g,id.current=b,xn!==null)throw Error(r(261));return Ln=null,$n=0,wn}function sI(){for(;xn!==null;)X1(xn)}function oI(){for(;xn!==null&&!wa();)X1(xn)}function X1(s){var c=e_(s.alternate,s,Ma);s.memoizedProps=s.pendingProps,c===null?Q1(s):xn=c,Qp.current=null}function Q1(s){var c=s;do{var g=c.alternate;if(s=c.return,(c.flags&32768)===0){if(g=JA(g,c,Ma),g!==null){xn=g;return}}else{if(g=eI(g,c),g!==null){g.flags&=32767,xn=g;return}if(s!==null)s.flags|=32768,s.subtreeFlags=0,s.deletions=null;else{wn=6,xn=null;return}}if(c=c.sibling,c!==null){xn=c;return}xn=c=s}while(c!==null);wn===0&&(wn=5)}function fo(s,c,g){var b=fr,S=Ga.transition;try{Ga.transition=null,fr=1,lI(s,c,g,b)}finally{Ga.transition=S,fr=b}return null}function lI(s,c,g,b){do gl();while(ks!==null);if((_r&6)!==0)throw Error(r(327));g=s.finishedWork;var S=s.finishedLanes;if(g===null)return null;if(s.finishedWork=null,s.finishedLanes=0,g===s.current)throw Error(r(177));s.callbackNode=null,s.callbackPriority=0;var R=g.lanes|g.childLanes;if(Bn(s,R),s===Ln&&(xn=Ln=null,$n=0),(g.subtreeFlags&2064)===0&&(g.flags&2064)===0||ld||(ld=!0,t_(jn,function(){return gl(),null})),R=(g.flags&15990)!==0,(g.subtreeFlags&15990)!==0||R){R=Ga.transition,Ga.transition=null;var q=fr;fr=1;var le=_r;_r|=4,Qp.current=null,rI(s,g),U1(g,s),ip(Ni),Po=!!lc,Ni=lc=null,s.current=g,nI(g),la(),_r=le,fr=q,Ga.transition=R}else s.current=g;if(ld&&(ld=!1,ks=s,cd=S),R=s.pendingLanes,R===0&&(vs=null),Or(g.stateNode),ma(s,Lr()),c!==null)for(b=s.onRecoverableError,g=0;g<c.length;g++)S=c[g],b(S.value,{componentStack:S.stack,digest:S.digest});if(od)throw od=!1,s=eg,eg=null,s;return(cd&1)!==0&&s.tag!==0&&gl(),R=s.pendingLanes,(R&1)!==0?s===tg?_c++:(_c=0,tg=s):_c=0,li(),null}function gl(){if(ks!==null){var s=Kt(cd),c=Ga.transition,g=fr;try{if(Ga.transition=null,fr=16>s?16:s,ks===null)var b=!1;else{if(s=ks,ks=null,cd=0,(_r&6)!==0)throw Error(r(331));var S=_r;for(_r|=4,It=s.current;It!==null;){var R=It,q=R.child;if((It.flags&16)!==0){var le=R.deletions;if(le!==null){for(var pe=0;pe<le.length;pe++){var Te=le[pe];for(It=Te;It!==null;){var Xe=It;switch(Xe.tag){case 0:case 11:case 15:bc(8,Xe,R)}var tt=Xe.child;if(tt!==null)tt.return=Xe,It=tt;else for(;It!==null;){Xe=It;var Ke=Xe.sibling,Nt=Xe.return;if(D1(Xe),Xe===Te){It=null;break}if(Ke!==null){Ke.return=Nt,It=Ke;break}It=Nt}}}var Mt=R.alternate;if(Mt!==null){var Pt=Mt.child;if(Pt!==null){Mt.child=null;do{var pn=Pt.sibling;Pt.sibling=null,Pt=pn}while(Pt!==null)}}It=R}}if((R.subtreeFlags&2064)!==0&&q!==null)q.return=R,It=q;else e:for(;It!==null;){if(R=It,(R.flags&2048)!==0)switch(R.tag){case 0:case 11:case 15:bc(9,R,R.return)}var _e=R.sibling;if(_e!==null){_e.return=R.return,It=_e;break e}It=R.return}}var xe=s.current;for(It=xe;It!==null;){q=It;var Ne=q.child;if((q.subtreeFlags&2064)!==0&&Ne!==null)Ne.return=q,It=Ne;else e:for(q=xe;It!==null;){if(le=It,(le.flags&2048)!==0)try{switch(le.tag){case 0:case 11:case 15:ad(9,le)}}catch(Bt){dn(le,le.return,Bt)}if(le===q){It=null;break e}var pt=le.sibling;if(pt!==null){pt.return=le.return,It=pt;break e}It=le.return}}if(_r=S,li(),Gt&&typeof Gt.onPostCommitFiberRoot=="function")try{Gt.onPostCommitFiberRoot(qt,s)}catch{}b=!0}return b}finally{fr=g,Ga.transition=c}}return!1}function Z1(s,c,g){c=ul(g,c),c=m1(s,c,1),s=ys(s,c,1),c=na(),s!==null&&(Jn(s,1,c),ma(s,c))}function dn(s,c,g){if(s.tag===3)Z1(s,s,g);else for(;c!==null;){if(c.tag===3){Z1(c,s,g);break}else if(c.tag===1){var b=c.stateNode;if(typeof c.type.getDerivedStateFromError=="function"||typeof b.componentDidCatch=="function"&&(vs===null||!vs.has(b))){s=ul(g,s),s=x1(c,s,1),c=ys(c,s,1),s=na(),c!==null&&(Jn(c,1,s),ma(c,s));break}}c=c.return}}function cI(s,c,g){var b=s.pingCache;b!==null&&b.delete(c),c=na(),s.pingedLanes|=s.suspendedLanes&g,Ln===s&&($n&g)===g&&(wn===4||wn===3&&($n&130023424)===$n&&500>Lr()-Jp?uo(s,0):Zp|=g),ma(s,c)}function J1(s,c){c===0&&((s.mode&1)===0?c=1:(c=Zr,Zr<<=1,(Zr&130023424)===0&&(Zr=4194304)));var g=na();s=Ki(s,c),s!==null&&(Jn(s,c,g),ma(s,g))}function uI(s){var c=s.memoizedState,g=0;c!==null&&(g=c.retryLane),J1(s,g)}function dI(s,c){var g=0;switch(s.tag){case 13:var b=s.stateNode,S=s.memoizedState;S!==null&&(g=S.retryLane);break;case 19:b=s.stateNode;break;default:throw Error(r(314))}b!==null&&b.delete(c),J1(s,g)}var e_;e_=function(s,c,g){if(s!==null)if(s.memoizedProps!==c.pendingProps||Ue.current)ga=!0;else{if((s.lanes&g)===0&&(c.flags&128)===0)return ga=!1,ZA(s,c,g);ga=(s.flags&131072)!==0}else ga=!1,en&&(c.flags&1048576)!==0&&Mk(c,no,c.index);switch(c.lanes=0,c.tag){case 2:var b=c.type;rd(s,c),s=c.pendingProps;var S=At(c,Ae.current);ll(c,g),S=Rp(null,c,b,s,S,g);var R=Ap();return c.flags|=1,typeof S=="object"&&S!==null&&typeof S.render=="function"&&S.$$typeof===void 0?(c.tag=1,c.memoizedState=null,c.updateQueue=null,vt(b)?(R=!0,Ei(c)):R=!1,c.memoizedState=S.state!==null&&S.state!==void 0?S.state:null,wp(c),S.updater=ed,c.stateNode=S,S._reactInternals=c,Pp(c,b,s,g),c=Up(null,c,b,!0,R,g)):(c.tag=0,en&&R&&pp(c),ra(null,c,S,g),c=c.child),c;case 16:b=c.elementType;e:{switch(rd(s,c),s=c.pendingProps,S=b._init,b=S(b._payload),c.type=b,S=c.tag=pI(b),s=di(b,s),S){case 0:c=zp(null,c,b,s,g);break e;case 1:c=E1(null,c,b,s,g);break e;case 11:c=k1(null,c,b,s,g);break e;case 14:c=_1(null,c,b,di(b.type,s),g);break e}throw Error(r(306,b,""))}return c;case 0:return b=c.type,S=c.pendingProps,S=c.elementType===b?S:di(b,S),zp(s,c,b,S,g);case 1:return b=c.type,S=c.pendingProps,S=c.elementType===b?S:di(b,S),E1(s,c,b,S,g);case 3:e:{if(j1(c),s===null)throw Error(r(387));b=c.pendingProps,R=c.memoizedState,S=R.element,qk(s,c),Gu(c,b,null,g);var q=c.memoizedState;if(b=q.element,R.isDehydrated)if(R={element:b,isDehydrated:!1,cache:q.cache,pendingSuspenseBoundaries:q.pendingSuspenseBoundaries,transitions:q.transitions},c.updateQueue.baseState=R,c.memoizedState=R,c.flags&256){S=ul(Error(r(423)),c),c=C1(s,c,b,g,S);break e}else if(b!==S){S=ul(Error(r(424)),c),c=C1(s,c,b,g,S);break e}else for(Ia=Ta(c.stateNode.containerInfo.firstChild),Aa=c,en=!0,ui=null,g=zk(c,null,b,g),c.child=g;g;)g.flags=g.flags&-3|4096,g=g.sibling;else{if(il(),b===S){c=Xi(s,c,g);break e}ra(s,c,b,g)}c=c.child}return c;case 5:return Wk(c),s===null&&mp(c),b=c.type,S=c.pendingProps,R=s!==null?s.memoizedProps:null,q=S.children,cc(b,S)?q=null:R!==null&&cc(b,R)&&(c.flags|=32),N1(s,c),ra(s,c,q,g),c.child;case 6:return s===null&&mp(c),null;case 13:return T1(s,c,g);case 4:return Sp(c,c.stateNode.containerInfo),b=c.pendingProps,s===null?c.child=sl(c,null,b,g):ra(s,c,b,g),c.child;case 11:return b=c.type,S=c.pendingProps,S=c.elementType===b?S:di(b,S),k1(s,c,b,S,g);case 7:return ra(s,c,c.pendingProps,g),c.child;case 8:return ra(s,c,c.pendingProps.children,g),c.child;case 12:return ra(s,c,c.pendingProps.children,g),c.child;case 10:e:{if(b=c.type._context,S=c.pendingProps,R=c.memoizedProps,q=S.value,de($u,b._currentValue),b._currentValue=q,R!==null)if(An(R.value,q)){if(R.children===S.children&&!Ue.current){c=Xi(s,c,g);break e}}else for(R=c.child,R!==null&&(R.return=c);R!==null;){var le=R.dependencies;if(le!==null){q=R.child;for(var pe=le.firstContext;pe!==null;){if(pe.context===b){if(R.tag===1){pe=Yi(-1,g&-g),pe.tag=2;var Te=R.updateQueue;if(Te!==null){Te=Te.shared;var Xe=Te.pending;Xe===null?pe.next=pe:(pe.next=Xe.next,Xe.next=pe),Te.pending=pe}}R.lanes|=g,pe=R.alternate,pe!==null&&(pe.lanes|=g),kp(R.return,g,c),le.lanes|=g;break}pe=pe.next}}else if(R.tag===10)q=R.type===c.type?null:R.child;else if(R.tag===18){if(q=R.return,q===null)throw Error(r(341));q.lanes|=g,le=q.alternate,le!==null&&(le.lanes|=g),kp(q,g,c),q=R.sibling}else q=R.child;if(q!==null)q.return=R;else for(q=R;q!==null;){if(q===c){q=null;break}if(R=q.sibling,R!==null){R.return=q.return,q=R;break}q=q.return}R=q}ra(s,c,S.children,g),c=c.child}return c;case 9:return S=c.type,b=c.pendingProps.children,ll(c,g),S=Wa(S),b=b(S),c.flags|=1,ra(s,c,b,g),c.child;case 14:return b=c.type,S=di(b,c.pendingProps),S=di(b.type,S),_1(s,c,b,S,g);case 15:return w1(s,c,c.type,c.pendingProps,g);case 17:return b=c.type,S=c.pendingProps,S=c.elementType===b?S:di(b,S),rd(s,c),c.tag=1,vt(b)?(s=!0,Ei(c)):s=!1,ll(c,g),g1(c,b,S),Pp(c,b,S,g),Up(null,c,b,!0,s,g);case 19:return A1(s,c,g);case 22:return S1(s,c,g)}throw Error(r(156,c.tag))};function t_(s,c){return _a(s,c)}function fI(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 Ka(s,c,g,b){return new fI(s,c,g,b)}function og(s){return s=s.prototype,!(!s||!s.isReactComponent)}function pI(s){if(typeof s=="function")return og(s)?1:0;if(s!=null){if(s=s.$$typeof,s===z)return 11;if(s===D)return 14}return 2}function Ss(s,c){var g=s.alternate;return g===null?(g=Ka(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 pd(s,c,g,b,S,R){var q=2;if(b=s,typeof s=="function")og(s)&&(q=1);else if(typeof s=="string")q=5;else e:switch(s){case j:return po(g.children,S,R,c);case M:q=8,S|=8;break;case L:return s=Ka(12,g,c,S|2),s.elementType=L,s.lanes=R,s;case ee:return s=Ka(13,g,c,S),s.elementType=ee,s.lanes=R,s;case V:return s=Ka(19,g,c,S),s.elementType=V,s.lanes=R,s;case H:return gd(g,S,R,c);default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case I:q=10;break e;case B:q=9;break e;case z:q=11;break e;case D:q=14;break e;case K:q=16,b=null;break e}throw Error(r(130,s==null?s:typeof s,""))}return c=Ka(q,g,c,S),c.elementType=s,c.type=b,c.lanes=R,c}function po(s,c,g,b){return s=Ka(7,s,b,c),s.lanes=g,s}function gd(s,c,g,b){return s=Ka(22,s,b,c),s.elementType=H,s.lanes=g,s.stateNode={isHidden:!1},s}function lg(s,c,g){return s=Ka(6,s,null,c),s.lanes=g,s}function cg(s,c,g){return c=Ka(4,s.children!==null?s.children:[],s.key,c),c.lanes=g,c.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},c}function gI(s,c,g,b,S){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=qa(0),this.expirationTimes=qa(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=qa(0),this.identifierPrefix=b,this.onRecoverableError=S,this.mutableSourceEagerHydrationData=null}function ug(s,c,g,b,S,R,q,le,pe){return s=new gI(s,c,g,le,pe),c===1?(c=1,R===!0&&(c|=8)):c=0,R=Ka(3,null,null,c),s.current=R,R.stateNode=s,R.memoizedState={element:b,isDehydrated:g,cache:null,transitions:null,pendingSuspenseBoundaries:null},wp(R),s}function hI(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 r_(s){if(!s)return we;s=s._reactInternals;e:{if(rn(s)!==s||s.tag!==1)throw Error(r(170));var c=s;do{switch(c.tag){case 3:c=c.stateNode.context;break e;case 1:if(vt(c.type)){c=c.stateNode.__reactInternalMemoizedMergedChildContext;break e}}c=c.return}while(c!==null);throw Error(r(171))}if(s.tag===1){var g=s.type;if(vt(g))return pa(s,g,c)}return c}function n_(s,c,g,b,S,R,q,le,pe){return s=ug(g,b,!0,s,S,R,q,le,pe),s.context=r_(null),g=s.current,b=na(),S=_s(g),R=Yi(b,S),R.callback=c??null,ys(g,R,S),s.current.lanes=S,Jn(s,S,b),ma(s,b),s}function hd(s,c,g,b){var S=c.current,R=na(),q=_s(S);return g=r_(g),c.context===null?c.context=g:c.pendingContext=g,c=Yi(R,q),c.payload={element:s},b=b===void 0?null:b,b!==null&&(c.callback=b),s=ys(S,c,q),s!==null&&(gi(s,S,q,R),Vu(s,S,q)),q}function md(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 a_(s,c){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var g=s.retryLane;s.retryLane=g!==0&&g<c?g:c}}function dg(s,c){a_(s,c),(s=s.alternate)&&a_(s,c)}function mI(){return null}var i_=typeof reportError=="function"?reportError:function(s){console.error(s)};function fg(s){this._internalRoot=s}xd.prototype.render=fg.prototype.render=function(s){var c=this._internalRoot;if(c===null)throw Error(r(409));hd(s,c,null,null)},xd.prototype.unmount=fg.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var c=s.containerInfo;co(function(){hd(null,s,null,null)}),c[ae]=null}};function xd(s){this._internalRoot=s}xd.prototype.unstable_scheduleHydration=function(s){if(s){var c=zn();s={blockedOn:null,target:s,priority:c};for(var g=0;g<St.length&&c!==0&&c<St[g].priority;g++);St.splice(g,0,s),g===0&&_i(s)}};function pg(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function yd(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11&&(s.nodeType!==8||s.nodeValue!==" react-mount-point-unstable "))}function s_(){}function xI(s,c,g,b,S){if(S){if(typeof b=="function"){var R=b;b=function(){var Te=md(q);R.call(Te)}}var q=n_(c,b,s,0,null,!1,!1,"",s_);return s._reactRootContainer=q,s[ae]=q.current,oi(s.nodeType===8?s.parentNode:s),co(),q}for(;S=s.lastChild;)s.removeChild(S);if(typeof b=="function"){var le=b;b=function(){var Te=md(pe);le.call(Te)}}var pe=ug(s,0,!1,null,null,!1,!1,"",s_);return s._reactRootContainer=pe,s[ae]=pe.current,oi(s.nodeType===8?s.parentNode:s),co(function(){hd(c,pe,g,b)}),pe}function bd(s,c,g,b,S){var R=g._reactRootContainer;if(R){var q=R;if(typeof S=="function"){var le=S;S=function(){var pe=md(q);le.call(pe)}}hd(c,q,s,S)}else q=xI(g,c,s,S,b);return md(q)}da=function(s){switch(s.tag){case 3:var c=s.stateNode;if(c.current.memoizedState.isDehydrated){var g=Tr(c.pendingLanes);g!==0&&(Sa(c,g|1),ma(c,Lr()),(_r&6)===0&&(pl=Lr()+500,li()))}break;case 13:co(function(){var b=Ki(s,1);if(b!==null){var S=na();gi(b,s,1,S)}}),dg(s,1)}},zr=function(s){if(s.tag===13){var c=Ki(s,134217728);if(c!==null){var g=na();gi(c,s,134217728,g)}dg(s,134217728)}},kr=function(s){if(s.tag===13){var c=_s(s),g=Ki(s,c);if(g!==null){var b=na();gi(g,s,c,b)}dg(s,c)}},zn=function(){return fr},Tn=function(s,c){var g=fr;try{return fr=s,c()}finally{fr=g}},dr=function(s,c,g){switch(c){case"input":if(ze(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 S=Er(b);if(!S)throw Error(r(90));Ve(b),ze(b,S)}}}break;case"textarea":Oe(s,g);break;case"select":c=g.value,c!=null&&$e(s,!!g.multiple,c,!1)}},ct=ag,Be=co;var yI={usingClientEntryPoint:!1,Events:[jt,lr,Er,ue,Le,ag]},wc={findFiberByHostInstance:Ie,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},bI={bundleType:wc.bundleType,version:wc.version,rendererPackageName:wc.rendererPackageName,rendererConfig:wc.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:A.ReactCurrentDispatcher,findHostInstanceByFiber:function(s){return s=oa(s),s===null?null:s.stateNode},findFiberByHostInstance:wc.findFiberByHostInstance||mI,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 vd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!vd.isDisabled&&vd.supportsFiber)try{qt=vd.inject(bI),Gt=vd}catch{}}return xa.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=yI,xa.createPortal=function(s,c){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!pg(c))throw Error(r(200));return hI(s,c,null,g)},xa.createRoot=function(s,c){if(!pg(s))throw Error(r(299));var g=!1,b="",S=i_;return c!=null&&(c.unstable_strictMode===!0&&(g=!0),c.identifierPrefix!==void 0&&(b=c.identifierPrefix),c.onRecoverableError!==void 0&&(S=c.onRecoverableError)),c=ug(s,1,!1,null,null,g,!1,b,S),s[ae]=c.current,oi(s.nodeType===8?s.parentNode:s),new fg(c)},xa.findDOMNode=function(s){if(s==null)return null;if(s.nodeType===1)return s;var c=s._reactInternals;if(c===void 0)throw typeof s.render=="function"?Error(r(188)):(s=Object.keys(s).join(","),Error(r(268,s)));return s=oa(c),s=s===null?null:s.stateNode,s},xa.flushSync=function(s){return co(s)},xa.hydrate=function(s,c,g){if(!yd(c))throw Error(r(200));return bd(null,s,c,!0,g)},xa.hydrateRoot=function(s,c,g){if(!pg(s))throw Error(r(405));var b=g!=null&&g.hydratedSources||null,S=!1,R="",q=i_;if(g!=null&&(g.unstable_strictMode===!0&&(S=!0),g.identifierPrefix!==void 0&&(R=g.identifierPrefix),g.onRecoverableError!==void 0&&(q=g.onRecoverableError)),c=n_(c,null,s,1,g??null,S,!1,R,q),s[ae]=c.current,oi(s),b)for(s=0;s<b.length;s++)g=b[s],S=g._getVersion,S=S(g._source),c.mutableSourceEagerHydrationData==null?c.mutableSourceEagerHydrationData=[g,S]:c.mutableSourceEagerHydrationData.push(g,S);return new xd(c)},xa.render=function(s,c,g){if(!yd(c))throw Error(r(200));return bd(null,s,c,!1,g)},xa.unmountComponentAtNode=function(s){if(!yd(s))throw Error(r(40));return s._reactRootContainer?(co(function(){bd(null,null,s,!1,function(){s._reactRootContainer=null,s[ae]=null})}),!0):!1},xa.unstable_batchedUpdates=ag,xa.unstable_renderSubtreeIntoContainer=function(s,c,g,b){if(!yd(g))throw Error(r(200));if(s==null||s._reactInternals===void 0)throw Error(r(38));return bd(s,c,g,!1,b)},xa.version="18.3.1-next-f1338f8080-20240426",xa}var g_;function $4(){if(g_)return mg.exports;g_=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(),mg.exports=EI(),mg.exports}var h_;function jI(){if(h_)return _d;h_=1;var e=$4();return _d.createRoot=e.createRoot,_d.hydrateRoot=e.hydrateRoot,_d}var CI=jI();const TI=jo(CI),RI="modulepreload",AI=function(e){return"/"+e},m_={},W4=function(t,r,a){let i=Promise.resolve();if(r&&r.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(r.map(f=>{if(f=AI(f),f in m_)return;m_[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":RI,p||(m.as="script"),m.crossOrigin="",m.href=f,d&&m.setAttribute("nonce",d),document.head.appendChild(m),p)return new Promise((y,v)=>{m.addEventListener("load",y),m.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${f}`)))})}))}function o(l){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=l,window.dispatchEvent(u),!u.defaultPrevented)throw l}return i.then(l=>{for(const u of l||[])u.status==="rejected"&&o(u.reason);return t().catch(o)})},Ji={"planCard.heading":"Plan ready — what next?","planCard.showPlan":"Show the plan","planCard.execute":"Switch to build & execute","planCard.keepPlanning":"Keep planning","planCard.executedStatus":"Switched to build mode — executing the plan.","planCard.dismissedStatus":"Staying in plan mode.","planCard.close":"Close","planCard.loading":"Loading…","planCard.loadError":"Couldn't load the plan.","planCard.executePrompt":"Implement the plan in PLAN.md. Follow it step by step.","agent_conversation.back":"Back","agent_conversation.message_count":"{name} - {count} messages","agent_conversation.message_queued":"Message queued for agent","agent_conversation.no_messages":"No messages yet","agent_conversation.no_messages_hint":"Use the Send Message button to contact the agent","agent_conversation.compose_button":"Send Message","agent_conversation.modal_title":"Send Message to {name}","agent_conversation.reply_to_inbox":"Notify me when complete","agent_conversation.urgent_interrupt_button":"Send Urgent Interrupt","agent_conversation.urgent_warning":"This will interrupt the agent’s current work immediately. Click again to confirm.","agent_conversation.confirm_interrupt":"Confirm Interrupt","agent_conversation.priority":"Priority:","agent_conversation.priority_high":"High","agent_conversation.priority_normal":"Normal","agent_conversation.priority_urgent":"Urgent","agent_conversation.priority_urgent_confirm":"This will send an urgent interrupt that aborts the agent's current work. Continue?","agent_conversation.priority_urgent_title":"Send Urgent Interrupt","agent_conversation.priority_urgent_hint":"Urgent: This will interrupt the agent’s current work immediately","agent_conversation.interrupt_button":"Interrupt","agent_conversation.interrupt_sent":"Urgent interrupt sent to agent","agent_conversation.queue_hint":"Messages are queued in the agent's inbox and processed on next wake","agent_conversation.refresh":"Refresh","agent_conversation.send_button":"Send","agent_conversation.send_placeholder":"Send a message to the agent's inbox...","agent_conversation.sending":"Sending","agent_conversation.title":"Conversation","confirm_dialog.cancel":"Cancel","confirm_dialog.confirm":"Confirm","agent_create.cancel":"Cancel","agent_create.configure_subtitle":"Configure your autonomous agent","agent_create.custom_model":"Custom model...","agent_create.custom_model_hint":"Enter any model identifier (e.g., github-copilot/claude-opus-4.6, openai/gpt-4o)","agent_create.custom_model_placeholder":"Enter custom model identifier (e.g., provider/model-name)","agent_create.deselect_all":"Deselect All","agent_create.display_name_hint":"Human-friendly name shown in the UI","agent_create.display_name_label":"Display Name (optional)","agent_create.display_name_placeholder":"e.g., My Development Agent","agent_create.dormant_mode":"Start in dormant mode","agent_create.dormant_mode_desc":"Agent will not process AGENTS.md on startup. It waits until it receives an inbox message.","agent_create.instructions_label":"Agent Instructions (AGENTS.md)","agent_create.instructions_optional":"(optional)","agent_create.instructions_hint":"Instructions and context for the agent. Written to workspace/AGENTS.md if workspace is set.","agent_create.loading_models":"Loading models...","agent_create.loading_skills":"Loading skills...","agent_create.model_hint":'Select a model from the list or choose "Custom model..." for other options',"agent_create.model_label":"Model *","agent_create.model_placeholder":"github-copilot/claude-opus-4.6","agent_create.name_generate":"Generate random name","agent_create.name_hint":"Lowercase letters, numbers, hyphens, and underscores only","agent_create.name_label":"Agent Name *","agent_create.name_placeholder":"e.g., swift-falcon","agent_create.no_skills":"No skills installed","agent_create.random":"Random","agent_create.reset_default":"Reset to Default","agent_create.select_all":"Select All","agent_create.skills_label":"Skills","agent_create.skills_selected":"Skills selected: {count}","agent_create.soul_label":"Soul / Instructions (AGENTS.md)","agent_create.soul_placeholder":"# AGENTS.md content...","agent_create.spawn":"Spawn Agent","agent_create.spawning":"Spawning...","agent_create.start_mode":"Start Mode","agent_create.title":"Spawn New Agent","agent_create.validate_model":"Please select a model","agent_create.validate_workspace":"Workspace directory is required","agent_create.working_dir_hint":"The agent's working directory for file operations","agent_create.working_dir_label":"Workspace Directory *","agent_create.working_dir_placeholder":"/path/to/project","agent_detail.action_deleted":"Agent deleted","agent_detail.action_updated":"Settings updated successfully","agent_detail.agent_info":"Agent Info","agent_detail.back":"Back to agents list","agent_detail.edit_settings":"Edit Settings","agent_detail.failed_to_load":"Failed to load agent:","agent_detail.iteration":"Iteration","agent_detail.model":"Model","agent_detail.pid":"PID","agent_detail.port":"Port","agent_detail.session_id":"Session ID","agent_detail.soul_file":"Soul File","agent_detail.start_mode":"Start mode","agent_detail.start_mode_dormant":"Dormant","agent_detail.start_mode_normal":"Normal","agent_detail.started":"Started","agent_detail.status":"Status","agent_detail.stopped":"stopped","agent_detail.token_cached":"Cached","agent_detail.token_input":"Input","agent_detail.token_output":"Output","agent_detail.token_usage":"Token Usage","agent_detail.total_cost":"Total Cost","agent_detail.unknown_agent":"Unknown Agent","agent_detail.uptime":"Uptime","agent_detail.view_conversation":"View Conversation","agent_detail.working_dir":"Working Dir","agent_detail.working_dir_label":"Working Dir:","agent_edit.cannot_change":"(cannot be changed)","agent_edit.custom_model":"Custom model...","agent_edit.custom_model_hint":"Enter any model identifier (e.g., github-copilot/claude-opus-4.6, openai/gpt-4o)","agent_edit.custom_model_placeholder":"Enter custom model identifier (e.g., provider/model-name)","agent_edit.deselect_all":"Deselect All","agent_edit.display_name_label":"Display Name","agent_edit.display_name_placeholder":"Human-friendly name","agent_edit.dormant_mode":"Start in dormant mode","agent_edit.dormant_mode_desc":"Agent will not process AGENTS.md on startup. Takes effect on next start.","agent_edit.instructions_label":"Agent Instructions (AGENTS.md)","agent_edit.instructions_hint":"Instructions and context for the agent. This file is re-read when the agent starts or when hot-reloaded.","agent_edit.loading_models":"Loading models...","agent_edit.loading_skills":"Loading skills...","agent_edit.model_hint":'Select a model from the list or choose "Custom model..." for other options',"agent_edit.model_label":"Model","agent_edit.model_placeholder":"e.g., github-copilot/claude-opus-4.6","agent_edit.name_label":"Agent Name","agent_edit.no_skills":"No skills installed","agent_edit.no_workspace_warning":"No workspace configured. AGENTS.md cannot be edited without a workspace directory.","agent_edit.not_set":"Not set","agent_edit.running_warning":"Running - restart required for changes","agent_edit.save":"Save Changes","agent_edit.saved":"Settings saved successfully","agent_edit.saving":"Saving...","agent_edit.select_all":"Select All","agent_edit.skills_label":"Skills","agent_edit.skills_selected":"Skills selected: {count}","agent_edit.soul_placeholder":"# AGENTS.md content...","agent_edit.start_mode":"Start Mode","agent_edit.stop_to_change":"Stop the agent to change workspace","agent_edit.tab_general":"General","agent_edit.tab_soul":"AGENTS.md","agent_edit.title":"Edit Agent Settings","agent_edit.will_be_created":"(will be created)","agent_edit.working_dir_hint":"The agent's working directory for file operations","agent_edit.working_dir_label":"Workspace Directory *","agent_edit.working_dir_placeholder":"/path/to/project","agent_edit.workspace_changed_warning":"Workspace has changed. AGENTS.md editing is disabled to prevent overwriting files in the new workspace. Save your changes, then re-open settings to edit AGENTS.md in the new workspace.","agent_edit.workspace_move_warning":"Changing workspace will not move existing AGENTS.md. You may need to re-configure the agent's instructions.","agents.back_to_chat":"Back to Chat","agents.collapse_panel":"Collapse panel","agents.expand_panel":"Expand panel","agents.no_agents_desc":"Spawn your first autonomous agent to get started","agents.no_agents_title":"No agents yet","agents.model_label":"Model: {model}","agents.resize_terminal":"Resize terminal panel","agents.back":"Back","agents.iteration":"Iter","agents.pid":"PID","agents.port":"Port","agents.refresh":"Refresh","agents.restart":"Restart","agents.restarting":"Restarting...","agents.clean_restart":"Clean Restart","agents.clean_restart_tooltip":"Restart with a new session (starts a fresh conversation)","agents.spawn_button":"Spawn Agent","agents.start":"Start","agents.starting":"Starting...","agents.stop":"Stop","agents.stopping":"Stopping...","agents.subtitle":"Manage autonomous agents","agents.title":"Agents","agents.uptime":"Uptime","agents.drop_to_import":"Drop YAML file to import agent","agents.export":"Export","agents.export_error":"Failed to export agent","agents.import":"Import","agents.import_button":"Import Agent","agents.import_error":"Failed to import agent","agents.import_invalid_file":"Invalid file type. Please select a .yaml or .yml file.","agents.import_file_too_large":"File too large (max 10MB)","agents.import_read_error":"Failed to read file","agents.import_success":"Agent imported successfully","agents.view_details":"Agent details","agents.pause":"Pause","agents.pausing":"Pausing...","agents.unpause":"Unpause","agents.resume":"Resume","agents.resuming":"Resuming...","agents.paused":"Paused","agents.select":"Select","agents.selected":"{count} selected","agents.selectAll":"Select All","agents.deselectAll":"Deselect All","agents.pauseAll":"Pause All","agents.unpauseAll":"Unpause All","agents.stopAll":"Stop All","agents.restartAll":"Restart All","agents.startAll":"Start All","app.agents_tab":"Agents","app.chat_tab":"Chat","app.close_search":"Close search","app.activities_panel":"Activities","app.close_activities":"Close activities panel","app.dismiss_error":"Dismiss error","app.hacker_mode_enter":"Enter hacker mode (Ctrl+H or Ctrl+Shift+M)","app.hacker_mode_exit":"Exit hacker mode (Ctrl+H or Ctrl+Shift+M)","app.match_count":"{current} of {total}","app.new_chat":"New Chat","app.next_match":"Next match","app.no_matches":"No matches","app.previous_match":"Previous match","app.reconnecting":"Reconnecting to server...","app.resize_terminal":"Resize terminal panel","app.right_pane_hidden":"Activities panel hidden","app.right_pane_shown":"Activities panel shown","app.search_messages":"Search messages","app.search_placeholder":"Search in conversation...","app.settings_tab":"Settings","app.skills_tab":"Skills","app.toggle_right_pane":"Toggle activities panel ({shortcut})","app.version":"PAVE version","app.welcome_start":"Start a conversation to get going.","app.welcome_subtitle":"Your AI-powered development assistant","app.welcome_title":"Welcome to PAVE","chat.attach_image":"Attach image","chat.attach_file":"Attach file (image, docx, pdf, text)","chat.attachment":"Attachment","chat.attachment_with_index":"Attachment {index}","chat.copied":"Copied!","chat.copy":"Copy","chat.copy_message":"Copy message","chat.cancel_queued":"Remove from queue","chat.queued":"Queued","chat.edit_queued":"Edit queued message","chat.edit_resend":"Edit and resend","chat.read_only":"Read-only","chat.read_only_desc":"This is a read-only session from the TUI. Messages cannot be sent.","chat.regenerate":"Regenerate response","chat.scroll_to_bottom":"Scroll to bottom","chat.send_button":"Send message","chat.send_hint":"Press Enter to send, Shift+Enter for new line. Type / for commands","chat.send_placeholder":"Send a message...","chat.stop_generating":"Stop generating","chat.tool_bash":"Running command","chat.tool_edit":"Editing file","chat.tool_glob":"Searching files","chat.tool_grep":"Searching code","chat.tool_preparing":"Preparing tool call","chat.tool_preparing_name":"Preparing {name}","chat.tool_read":"Reading file","chat.tool_write":"Writing file","chat.viewing_terminal":"Viewing Terminal session (read-only)","chat.yesterday":"Yesterday","chat.yesterday_time":"Yesterday {time}","chat.viewing_archive":"Viewing archived session (read-only)","chat.compacting_context":"Compacting context","chat.compacted_switch_to_new":"Compacted — switch to new session","chat.unpin_compacted":"Unpin — go back to original","chat.show_thinking":"Show thinking","chat.hide_thinking":"Hide thinking","chat.thinking":"Thinking","chat.error_badge":"Error","chat.assistant_typing":"Assistant is typing","chat.whatsapp_enabled":"WhatsApp mode enabled - assistant replies will be sent to WhatsApp","chat.whatsapp_disabled":"Enable WhatsApp two-way mode","chat.whatsapp_no_chatid":"Set PAVE_WHATSAPP_CHAT_ID in Settings before enabling WhatsApp routing","chat.working_directory":"Working Directory","chat.working_directory_current":"Current:","chat.working_directory_recent":"Recent:","chat.working_directory_change":"Change","chat.working_directory_cancel":"Cancel","chat.working_directory_create":"Create Directory","chat.working_directory_not_found":"Directory does not exist","chat.working_directory_invalid":"Invalid path","chat.working_directory_checking":"Checking path...","chat.working_directory_changed":"Working directory changed to {path}","chat.working_directory_created":"Directory created: {path}","chat.working_directory_create_failed":"Failed to create directory: {error}","chat.working_directory_remove_recent":"Remove from recent","chat.working_directory_has_agents_md":"Contains AGENTS.md","chat.working_directory_no_agents_md":"No AGENTS.md in this directory","chat.working_directory_new_path":"New path","chat.working_directory_placeholder":"/path/to/directory or ~/projects/...","chat.working_directory_not_set":"(not set)","chat.idle_injection_title":"Idle Injection","chat.idle_injection_toggle":"Enable idle injection","chat.idle_injection_message":"Injection message","chat.idle_injection_message_placeholder":"Message to inject when idle","chat.idle_injection_interval":"Idle interval (seconds)","chat.idle_injection_interval_desc":"How long to wait after the LLM finishes responding before injecting.","chat.idle_injection_max":"Max injections (0 = unlimited)","chat.idle_injection_max_desc":"Stops injecting after this many times. 0 means no limit.","chat.idle_injection_timeout_toggle":"Enable LLM timeout detection","chat.idle_injection_timeout_toggle_desc":"Detect when the LLM is stuck (no response) and re-inject.","chat.idle_injection_timeout_threshold":"Timeout threshold (seconds)","chat.idle_injection_timeout_threshold_desc":"How long to wait for the first token before considering the LLM hung.","chat.idle_injection_timeout_cooldown":"Timeout cooldown (seconds)","chat.idle_injection_timeout_cooldown_desc":"How long to wait after a timeout before re-injecting.","chat.idle_injection_save":"Save","chat.idle_injection_disable":"Disable","chat.idle_injection_saving":"Saving...","chat.idle_injection_disabling":"Disabling...","chat.idle_injection_saved":"Settings saved","chat.idle_injection_disabled_toast":"Idle injection disabled","chat.idle_injection_enabled_toast":"Idle injection enabled","chat.idle_injection_fired_toast":"Idle injection fired","chat.idle_injection_timeout_toast":"LLM timeout detected — retrying","chat.idle_injection_auto_badge":"auto","scheduled_injection.title":"Scheduled Injections","scheduled_injection.subtitle":"Automatically inject messages at scheduled times","scheduled_injection.add":"Add Schedule","scheduled_injection.empty":"No schedules configured. Add one above.","scheduled_injection.time":"Time","scheduled_injection.repeat":"Repeat","scheduled_injection.repeat_every_day":"Every day","scheduled_injection.repeat_weekdays":"Weekdays","scheduled_injection.repeat_weekends":"Weekends","scheduled_injection.repeat_custom":"Custom","scheduled_injection.timezone":"Timezone","scheduled_injection.message":"Message (optional)","scheduled_injection.message_placeholder":"Leave empty for default check-in message","scheduled_injection.enabled":"Enabled","scheduled_injection.save":"Save Schedule","scheduled_injection.saving":"Saving...","scheduled_injection.delete":"Delete","scheduled_injection.day_sun":"Sun","scheduled_injection.day_mon":"Mon","scheduled_injection.day_tue":"Tue","scheduled_injection.day_wed":"Wed","scheduled_injection.day_thu":"Thu","scheduled_injection.day_fri":"Fri","scheduled_injection.day_sat":"Sat","scheduled_injection.fired_toast":"Scheduled injection fired","scheduled_injection.error_generic":"Failed to save schedule","chat.interrupted_badge":"Interrupted","chat.stopped_badge":"Stopped","chat.moe_auto":"Auto","chat.moe_fast":"Fast","chat.moe_fastest":"Fastest","chat.moe_tooltip":"Expert count — lower is faster but less accurate","chat.reasoning_max":"Max","chat.reasoning_high":"High","chat.reasoning_off":"Off","chat.reasoning_tooltip":"Reasoning effort — higher is smarter but slower","chat.idle_injection_mode":"Dispatch mode","chat.idle_injection_mode_desc":"How the injected message is queued.","chat.idle_injection_mode_urgent":"Urgent (between tool calls)","chat.idle_injection_mode_normal":"Normal (after turn)","chat.idle_injection_mode_idle":"Idle (after turn + delay)","chat.idle_injection_wait_ms":"Idle wait delay (seconds)","chat.idle_injection_wait_ms_desc":"Extra delay before dispatching when in Idle mode.","common.back":"Back","common.cancel":"Cancel","common.close":"Close","common.confirm":"Confirm","common.delete":"Delete","common.deleting":"Deleting...","common.edit":"Edit","common.error":"Error","common.loading":"Loading...","common.no":"No","common.optional":"(optional)","common.retry":"Retry","common.save":"Save","common.unknown_error":"Unknown error","common.success":"Success","common.yes":"Yes","login.email_placeholder":"Email","login.or":"or","login.password_placeholder":"Password","login.pave_subtitle":"Personal AI Virtual Environment","login.powered_by":"Powered by PAVE","login.sign_in":"Sign in to continue","login.sign_in_locally":"Sign in locally","login.signing_in":"Signing in...","login.terms":"By signing in, you agree to the terms of service.","permission.allow":"Allow","permission.allowing":"Allowing...","permission.action_clear_all":"Clear All","permission.action_grant":"Grant","permission.action_revoke":"Revoke","permission.clear_all":"Clear ALL permissions (lock down sandbox)","permission.deny":"Deny","permission.denying":"Denying...","permission.expired":"Request expired","permission.no_reason":"No reason provided","permission.reason_prefix":"Reason:","permission.request_desc":"{action} {type} permission for: {target}","permission.title":"Permission Request","permission.type_file_read":"File Read","permission.type_file_write":"File Write","permission.type_module":"Module","permission.type_network":"Network","permission.type_system":"System Command","question.already_answered":"Question already answered","question.custom_placeholder":"Or type a custom answer...","question.dismiss":"Dismiss","question.dismissing":"Dismissing...","question.error":"Question failed","question.expired":"Question expired","question.input_placeholder":"Type your answer...","question.select_all":"Select all that apply","question.submit":"Submit","question.submit_n":"Submit {count} answers","question.submitting":"Submitting...","question.reconnecting":"Reconnecting…","question.title":"Question from AI","pricing.add":"Add","pricing.add_model":"Add Model","pricing.add_model_placeholder":"Model name (e.g., gpt-4)","pricing.add_new_model":"Add New Model","pricing.cached_tokens":"Cached tokens (per 1M)","pricing.close":"Close pricing settings","pricing.configured_count":"Configured models: {count}","pricing.fallback_badge":"fallback","pricing.default_exists":'Cannot add "default" - it already exists as fallback',"pricing.discard_confirm":"Discard unsaved changes?","pricing.discard_title":"Discard Changes","pricing.heading":"Token Pricing","pricing.input_tokens":"Input tokens (per 1M)","pricing.label_cache":"Cache:","pricing.label_input":"In:","pricing.label_output":"Out:","pricing.model_column":"Model","pricing.model_exists":"Model already exists","pricing.model_required":"Model name is required","pricing.output_tokens":"Output tokens (per 1M)","pricing.rates_column":"Input / Output / Cached","pricing.rates_subtitle":"Prices in USD per 1M tokens","pricing.remove_model":"Remove model","pricing.remove_model_aria":"Remove {modelName}","pricing.remove_confirm":'Remove pricing for "{model}"?',"pricing.remove_title":"Remove Model Pricing","pricing.reset":"Reset to Defaults","pricing.reset_confirm":"Reset all pricing to default values? This cannot be undone.","pricing.reset_title":"Reset Pricing","pricing.save":"Save","pricing.save_changes":"Save Changes","pricing.subtitle":"Configure cost per 1 million tokens (USD)","pricing.title":"Token Pricing Settings","settings.back":"Back to chat","settings.category.display":"Display","settings.appearance":"Appearance","settings.mobile_frameless":"Frameless assistant messages","settings.mobile_frameless_label":"Mobile UX enhancement (experimental)","settings.mobile_frameless_desc":"Removes avatar and bubble background from assistant messages for a cleaner, full-width reading experience","settings.category.language":"Language","settings.category.marketplace":"Marketplace","settings.category.model":"AI Model & Provider","settings.category.prefillFallback":"Prefill Fallback","settings.category.models":"Models","settings.category.rate":"Rate Limiting","settings.category.systemPrompts":"System Prompts","settings.category.tools":"Tool Execution","settings.category.whatsapp":"WhatsApp","settings.category.compaction":"Compaction","settings.category.sessionBanner":"Session Banner","settings.category.sessionBehavior":"Session Behavior","settings.currently_set_to":"Currently set to: {path}","settings.default_prefix":"Default: {value}","settings.default_empty":"(empty)","settings.description":"Configure PAVE runtime settings. Most changes apply on save; some (e.g. timeouts) may require restarting PAVE.","settings.env_badge":"env","settings.env_override":"This value is currently overridden by the {envVar} environment variable.","settings.failed_to_load":"Failed to load settings: {error}","settings.language":"Language","settings.language_description":"Select your preferred language for the interface","settings.language_auto_applied":"✓ Language applied automatically","settings.no_changes":"No changes to save.","settings.not_set":"Not set","settings.enabled":"Enabled","settings.disabled":"Disabled","settings.notification_sound":"Notification Sound","settings.notification_sound_desc":"Play a sound when new inbox messages arrive","settings.native_notifications":"Native Notifications","settings.native_notifications_desc":"Show browser notifications for new inbox messages","settings.native_notifications_blocked":"Notifications blocked by browser — enable in browser settings","settings.native_notifications_permission":"Click to enable — permission will be requested","settings.native_notifications_unsupported":"Not supported in this browser","settings.auto_saved":"Changes apply immediately","settings.notifications":"Notifications","settings.partial_save":"Some settings could not be saved. See errors below.","settings.requires_restart":"(requires restart)","settings.reset":"Reset","settings.save":"Save","settings.save_failed":"Failed to save: {error}","settings.saved":"Settings saved successfully.","settings.saving":"Saving...","settings.source_default":"Default","settings.source_env":"ENV","settings.source_saved":"Saved","settings.title":"Settings","settings.category.experimental":"Experimental Features","settings.category.developer":"Developer","settings.v2.badge":"Settings","settings.v2.search_placeholder":"Search settings…","settings.v2.search_clear":"Clear search","settings.v2.no_matches":"No settings match your search.","settings.v2.search_results":"{count} matching settings","settings.v2.open":"Open","settings.v2.unsaved":"{count} unsaved","settings.v2.groups_aria":"Setting groups","settings.validating":"Validating...","settings.apply":"Apply","settings.workspace":"Workspace","settings.working_dir":"Working Directory","settings.working_dir_desc":"Set a custom working directory for file operations and tool execution. Leave empty to use the server default.","settings.working_dir_reset":"Working directory reset to server default","settings.working_dir_updated":"Working directory updated to: {path}","settings.working_dir_invalid":"Invalid directory path: {error}","settings.version_title":"Version","settings.current_version":"Current version","settings.latest_version":"Latest version","settings.update_available":"Update available","settings.update_button":"Update","settings.no_updates":"No updates available","settings.check_updates":"Check for Updates","settings.checking_updates":"Checking for updates…","settings.update_in_progress":"Update in progress…","settings.update_success":"Update successful","settings.update_failed":"Update failed","settings.check_updates_failed":"Check for updates failed","settings.model_registry.title":"Model Registry","settings.model_registry.builtin":"Built-in Models","settings.model_registry.user":"User Models","settings.model_registry.add_model":"+ Add Model","settings.model_registry.no_user_models":'No user-defined models. Click "+ Add Model" to add one.',"settings.model_registry.name":"Model Name","settings.model_registry.name_placeholder":"Model name (e.g. my-custom-model)","settings.model_registry.provider":"Provider","settings.model_registry.provider_placeholder":"e.g. openai","settings.model_registry.displayName":"Display Name","settings.model_registry.displayName_placeholder":"My Model","settings.model_registry.url":"Endpoint URL","settings.model_registry.url_placeholder":"http(s)://… or pave(s)://…","settings.model_registry.tier":"Tier","settings.model_registry.tier_placeholder":"e.g. fast, premium","settings.model_registry.limit_context":"Context Limit","settings.model_registry.limit_output":"Output Limit","settings.model_registry.cost_input":"Input Cost ($/1M tokens)","settings.model_registry.cost_output":"Output Cost ($/1M tokens)","settings.model_registry.save":"Save","settings.model_registry.saving":"Saving...","settings.model_registry.cancel":"Cancel","settings.model_registry.add":"Add","settings.model_registry.adding":"Adding...","settings.model_registry.edit":"Edit model","settings.model_registry.delete":"Delete model","settings.model_registry.delete_confirm":'Remove model "{name}" from the registry?',"settings.model_registry.loading":"Loading model registry...","settings.model_registry.load_error":"Failed to load registry: {error}","settings.model_registry.context_k":"{value}K ctx","settings.model_registry.target":"Alias Target (optional)","settings.model_registry.target_placeholder":"e.g. github-copilot/claude-opus-4.7","settings.model_registry.target_hint":"If set, this entry is an alias — selections route to the target model. Leave empty for a self-contained model with its own endpoint URL.","settings.model_registry.spec":"Model Spec","settings.model_registry.spec_placeholder":"e.g. github-copilot/claude-opus-4.7 or pave://host/path?model=…","settings.model_registry.spec_hint":"Enter a provider/model alias (e.g. github-copilot/claude-opus-4.7) or a full pave://, paves://, http://, or https:// URL. URLs are detected automatically.","settings.model_registry.kind_alias":"Alias","settings.model_registry.advanced":"Advanced (limits & cost)","settings.model_registry.error_name_required":"Model name is required","settings.model_registry.error_name_reserved":'Model name "{name}" is reserved',"settings.model_registry.error_name_exists":'A model named "{name}" already exists',"settings.model_registry.error_rename_cleanup":"Renamed, but failed to remove old entry: {error}","settings.custom_model":"Custom model...","settings.custom_model_placeholder":"Enter custom model identifier (e.g., provider/model-name)","sidebar.conversations":"Conversations","sidebar.delete":"Delete","sidebar.delete_all":"Delete All Conversations","sidebar.delete_all_confirm":"Delete the conversations listed here? Sessions belonging to other apps are left alone. This cannot be undone.","sidebar.delete_all_title":"Delete All Sessions","sidebar.delete_confirm":"Delete this conversation?","sidebar.delete_title":"Delete Session","sidebar.hide":"Hide sidebar","sidebar.load_more":"Load more conversations","sidebar.load_more_count":"Load more — showing {loaded} of {total}","sidebar.all_loaded_count":"All {total} conversations shown","sidebar.search_result_count":"{total} matching conversations","sidebar.show_other_apps":"Show other apps","sidebar.hide_other_apps":"Hide other apps","sidebar.no_conversations":"No conversations yet","sidebar.no_matches":"No matches","sidebar.rename":"Rename","sidebar.resize":"Resize sidebar","sidebar.regenerate_title":"Regenerate Title","sidebar.send_to_session":"Send to another session","send_to_session.title":"Send to another session","send_to_session.target_label":"Send to","send_to_session.message_label":"Message","send_to_session.delivery_note":"Delivered by the app that has that session open, usually within a couple of seconds. It may be a different app than this one.","send_to_session.queued":"Queued. It will be picked up by whichever app has that session open.","send_to_session.no_targets":"No other sessions to send to.","send_to_session.send":"Send","send_to_session.sending":"Sending...","send_to_session.cancel":"Cancel","send_to_session.close":"Close","sidebar.search_placeholder":"Search conversations...","sidebar.show":"Show conversations","sidebar.untitled":"Untitled","sidebar.pin":"Pin","sidebar.unpin":"Unpin","sidebar.archive":"Archive","sidebar.unarchive":"Unarchive","sidebar.confirmArchive":"Archive this session? It will be hidden from the sidebar.","sidebar.show_archived":"Show archived","sidebar.hide_archived":"Hide archived","sidebar.pinned":"Pinned","sidebar.today":"Today","sidebar.yesterday":"Yesterday","sidebar.this_week":"This Week","sidebar.this_month":"This Month","sidebar.older":"Older","sidebar.archived":"Archived","sidebar.export":"Export as YAML","sidebar.import":"Import session","sidebar.drop_to_import":"Drop session file to import","sidebar.session_processing":"Session is processing","sidebar.icon_pinned":"Pinned — kept at the top and exempt from cleanup","sidebar.icon_archive":"Archive copy — a read-only snapshot of an earlier conversation","sidebar.icon_compacted":"Compacted — older messages were summarized to free context","sidebar.more_actions":"More actions","sidebar.age_now":"now","sidebar.age_minutes":"{n}m","sidebar.age_hours":"{n}h","sidebar.age_days":"{n}d","sidebar.age_weeks":"{n}w","import.invalid_file_type":"Only .yaml or .yml session files can be imported","import.file_too_large":"Import file too large (max 10MB)","import.read_error":"Failed to read file. Please try again.","skills.back_to_chat":"Back to chat","skills.cancel":"Cancel","skills.clear_all":"Clear all","skills.clear_confirm":"Clear all credentials for {skill}?","skills.clear_title":"Clear Credentials","skills.close":"Close","skills.close_credential_editor":"Close credential editor","skills.configure":"Configure","skills.configure_skill":"Configure {skill}","skills.configured":"Configured","skills.current_value":"(current: {value})","skills.enter_token":"Enter at least one token value","skills.enter_value":"Enter value...","skills.install":"Install","skills.installed":"Installed","skills.installed_count":"{installed} installed, {available} available","skills.installing":"Installing...","skills.install_failed":"Install failed: {error}","skills.leave_blank":"Leave blank to keep current","skills.load_installed_failed":"Failed to load installed skills: {error}","skills.load_marketplace_failed":"Failed to load marketplace: {error}","skills.needs_setup":"Needs setup","skills.no_credentials_needed":"This skill does not require any credentials.","skills.no_description":"No description","skills.no_match":"No skills match your search.","skills.no_skills":"No skills found.","skills.not_installed":"Not installed","skills.oauth_connect":"Connect with {provider}","skills.oauth_connect_hint":"Use OAuth to authenticate with {provider}. Click the button below to open the authorization page.","skills.oauth_connected":"Connected to {provider}","skills.oauth_disconnect":"Disconnect from {provider}","skills.oauth_connecting":"Connecting...","skills.oauth_needs_credentials":"Enter Client ID and Client Secret above first, then you can connect to {provider}.","skills.save":"Save","skills.saving":"Saving...","skills.search_placeholder":"Search skills...","skills.skill_management":"Skill Management","skills.subtitle":"Manage AI tool capabilities","skills.tab_all":"All","skills.tab_available":"Available","skills.tab_installed":"Installed","skills.tab_marketplace":"Marketplace","skills.title":"Skills","skills.check_updates":"Check for Updates","skills.checking_updates":"Checking...","skills.update":"Update","skills.updating":"Updating...","skills.update_available":"Update available: v{version}","skills.update_success":"Updated to v{version}","skills.update_failed":"Update failed","skills.update_check_failed":"Check failed","skills.update_check_failures":"{count} check failed","skills.update_unsupported":"Manual install","skills.update_unsupported_count":"{count} not checked","skills.up_to_date":"Up to date","skills.updates_available":"{count} update(s) available","skills.no_updates":"All skills are up to date","skills.uninstall":"Uninstall","skills.uninstall_title":"Uninstall Skill","skills.uninstall_confirm":"Uninstall {skill}? Your saved credentials will be preserved.","skills.uninstalling":"Uninstalling...","skills.uninstall_failed":"Uninstall failed: {error}","skills.toggle_title":"Manage skills for this session","skills.toggle_header":"Session Skills","skills.toggle_hint":"Toggle skills on/off for this chat only","skills.builtin_tools":"Built-in Tools","skills.agent_comm":"Agent Communication","skills.default":"Default","skills.default_for_new_sessions":"Enable by default for new sessions","skills.reset_to_defaults":"Reset to defaults","auth.device_code_title":"GitHub Copilot Authentication","auth.device_code_instructions":"Open {url} and enter code: {code}","auth.device_code_waiting":"Waiting for authorization...","task.activity":"Activity","task.awaiting":"Awaiting approval","task.completed":"Completed","task.error":"Error","task.no_active":"No active tasks. Send a message to get started.","task.processing":"Processing...","task.tool_bash":"Bash","task.tool_edit":"Edit","task.tool_editing":"Editing {target}","task.tool_glob":"Glob","task.tool_glob_desc":"Searching for files","task.tool_grep":"Grep","task.tool_grep_desc":"Searching code","task.tool_read":"Read","task.tool_reading":"Reading {target}","task.tool_write":"Write","task.tool_writing":"Writing {target}","task.working":"Working on it...","terminal.decrease_font":"Decrease font size","terminal.increase_font":"Increase font size","terminal.matrix_mode":"Matrix","terminal.no_output":"No terminal output yet","terminal.prompt":"$","theme.dark":"Switch to dark mode","theme.light":"Switch to light mode","time.days":"{count}d ","time.hours":"{count}h ","time.just_now":"just now","time.milliseconds":"{count}ms","time.minutes":"{count}m ","time.seconds":"{count}s","token.cache_read":"Cache Read","token.cache_write":"Cache Write","token.generating":"Generating...","token.idle":"Idle","token.input":"Input","token.model":"Model","token.output":"Output","token.session_cost":"Session","token.tokens":"tokens","token.total_cost":"Total Cost","token_usage.compacting":"Compacting...","token_usage.generating":"Generating...","token_usage.idle":"Idle","token_usage.messages":"Messages","token_usage.model":"Model","token_usage.originally":"Originally","token_usage.session_info":"Session Info","token_usage.status":"Status","tool.completed":"Done","tool.error":"Error","tool.running":"Running...","tool.tool":"Tool","user_menu.agents":"Agent Management","user_menu.pricing":"Token Pricing","user_menu.settings":"Settings","user_menu.sign_out":"Sign Out","user_menu.skills":"Skill Management","user_menu.title":"User menu","user_inbox.clear_all":"Clear all","user_inbox.delete":"Delete","user_inbox.empty":"No notifications","user_inbox.high_priority":"urgent","user_inbox.mark_all_read":"Mark all read","user_inbox.mark_unread":"Mark as unread","user_inbox.next_message":"Next message","user_inbox.prev_message":"Previous message","user_inbox.title":"Notifications","user_inbox.unread":"Unread","user_inbox.view_agent":"View agent","user_inbox.view_message":"View message","user_inbox.close":"Close","user_inbox.mark_read":"Mark as read","voice.dismiss_error":"Dismiss voice error","voice.downloading_model":"Downloading speech model...","voice.loading_model":"Loading speech model...","voice.processing":"Transcribing audio...","voice.processing_backend":"Transcribing via cloud...","voice.processing_local":"Transcribing locally...","voice.processing_local_server":"Transcribing via local server...","voice.source_backend":"Transcribed via cloud","voice.source_local":"Transcribed locally","voice.source_local_server":"Transcribed via local server","voice.start_recording":"Start voice recording","voice.stop_recording":"Stop recording","voice.pause_recording":"Pause recording","voice.resume_recording":"Resume recording","voice.select_asr_model":"Select speech recognition model","model_selector.title":"Session model","model_selector.list_label":"Available models","model_selector.use_default":"Use default model","model_selector.no_models":"No models available","model_selector.default_label":"Default","spotlight.title":"Search Sessions","spotlight.new_chat":"New Chat","spotlight.placeholder":"Search sessions by title...","spotlight.results":"Session results","spotlight.recent_sessions":"Recent Sessions","spotlight.no_results":"No sessions found","spotlight.searching":"Searching...","spotlight.untitled":"Untitled Session","spotlight.current":"current","spotlight.navigate":"navigate","spotlight.select":"select","spotlight.close":"close","slashCommand.title":"Skills","slashCommand.skills":"Skills","slashCommand.commands":"commands","slashCommand.command":"command","slashCommand.noResults":"No matching commands","slashCommand.notConfigured":"not configured","slashCommand.back":"Back to skills","slashCommand.navigate":"navigate","slashCommand.select":"select","slashCommand.close":"close","slashCommand.hint":"Type / to see available commands","archiveViewer.title":"Original Conversation History","archiveViewer.messages":"messages","archiveViewer.loading":"Loading archived messages...","archiveViewer.noArchive":"No archived history available for this session.","archiveViewer.readOnly":"Read-only archive","archiveViewer.archivedAt":"Archived","archiveViewer.close":"Close","archiveViewer.loadError":"Failed to load archive","archiveViewer.you":"You","archiveViewer.assistant":"Assistant","compaction.title":"Conversation compacted","compaction.showSummary":"Show summary","compaction.viewOriginal":"View original history","compaction.viewInHistory":"View in History","compaction.server.title":"Server auto-compact","compaction.server.status":"Context auto-compacted by server","compaction.mode.client":"Client (PAVE summarizes)","compaction.mode.server":"Server (vllm-mlx auto-compact)","compaction.mode.auto":"Auto (detect from provider)","compaction.banner_title":"This session was compacted from a previous conversation.","compaction.view_original":"View original","compaction.dismiss":"Dismiss","compaction.user_message_label":"Summarizing our conversation to keep things efficient.","compaction.continuation_message_label":"Compaction done. Please continue.","compaction.boundary":"Context compacted — messages above are no longer in the model’s context","compaction.show_history":"Conversation summarized — {count} earlier messages collapsed; summary below","messages.load_earlier":"Load earlier messages","messages.loading_earlier":"Loading earlier messages...","compaction.hide_history":"Hide messages before compaction","compaction.empty_title":"This conversation was summarized","compaction.empty_body":"Earlier messages are collapsed to save context. Show them to see the full history.","compaction.empty_action":"Show {count} earlier messages","credits.limit_reached":"Credit Limit Reached","credits.limit_message":"You've used all your available credits. Add more to continue using the service.","credits.add_credits":"Add Credits","credits.dismiss":"Dismiss","dlp.heading":"Privacy & DLP Settings","dlp.subtitle":"Configure data loss prevention patterns and privacy mode","dlp.title":"DLP Settings","dlp.close":"Close DLP settings","dlp.cancel":"Cancel","dlp.save":"Save","dlp.saving":"Saving...","dlp.discard_title":"Discard Changes","dlp.discard_confirm":"Discard unsaved changes to DLP settings?","dlp.enable_label":"Enable Data Loss Prevention","dlp.enable_desc":"When enabled, outgoing messages are scanned for sensitive data before sending to the AI model.","dlp.default_action_label":"Default action on detection","dlp.default_action_desc":"What happens when a pattern matches. 'Ask' shows a modal, 'Always reroute' sends to the private model, 'Warn only' logs and proceeds.","dlp.reroute_model_label":"Private model (reroute target)","dlp.reroute_model_desc":"The model/provider used for private mode. Format: provider/modelID","dlp.builtin_patterns":"Built-in patterns","dlp.builtin_desc":"Always-available detection patterns. Toggle individual patterns on or off.","dlp.user_patterns":"Custom patterns","dlp.user_patterns_desc":"Patterns you define. These are saved to your policy file and persist across restarts.","dlp.no_user_patterns":"No custom patterns yet. Add one below.","dlp.add_pattern":"Add a pattern","dlp.pattern_name":"Name","dlp.regex_pattern":"Regex","dlp.severity":"Severity","dlp.add":"Add","dlp.remove_pattern":"Remove pattern","dlp.remove_pattern_aria":"Remove pattern {name}","dlp.pattern_exists":"Pattern '{name}' already exists","dlp.name_required":"Pattern name is required","dlp.regex_required":"Regex pattern is required","dlp.invalid_regex":"Invalid regex syntax","user_menu.privacy_dlp":"Privacy & DLP","user_menu.board":"Agent Board","board.title":"Agent Board","board.back_to_chat":"Back to chat","board.back_to_topics":"Back to topics","board.read_only_hint":"Agents post here via tools — this page is read-only","board.post_count":"{count} posts","board.search_placeholder":"Search the board…","board.search":"Search","board.clear_search":"Clear","board.search_results":"{count} matches","board.no_matches":"No matches","board.no_topics":"No topics yet — agents create them with the board tools","board.no_posts":"No posts","board.post_deleted":"[deleted]","board.delete_post":"Delete post","board.delete_topic":"Delete topic","board.prev_page":"Previous","board.next_page":"Next","board.page_info":"{from}–{to} of {total}"},As={en:Ji},II={"zh-TW":()=>W4(()=>import("./zh-TW-BuoM8LhP.js"),[])},Sl=[{code:"en",name:"English",nativeName:"English"},{code:"zh-TW",name:"Traditional Chinese",nativeName:"繁體中文"}];async function x_(e){if(As[e])return As[e];const t=II[e];if(!t)return console.warn(`No locale importer for "${e}", falling back to English`),Ji;try{const r=await t();return As[e]=r.default||r,As[e]}catch(r){return console.warn(`Failed to load locale "${e}", falling back to English:`,r),Ji}}function V4(e,t,r){let a=e[t];return a===void 0&&e!==Ji&&(a=Ji[t]),a===void 0?t:r&&typeof r=="object"?a.replace(/\{(\w+)\}/g,(i,o)=>{const l=r[o];return l!==void 0?String(l):i}):a}const G4=x.createContext(null);function MI({initialLocale:e="en",children:t}){const a=Sl.map(m=>m.code).includes(e)?e:"en",[i,o]=x.useState(a),[l,u]=x.useState(As[a]||Ji),d=x.useRef(0);x.useEffect(()=>{let m=!1;if(a!=="en"&&!As[a]){const y=++d.current;x_(a).then(v=>{if(m||d.current!==y)return;const k=v===Ji&&a!=="en"?"en":a;As[k]=v,u(v),k!==a&&o(k)})}return()=>{m=!0,d.current+=1}},[]);const f=x.useCallback(async m=>{const y=++d.current,v=await x_(m);if(d.current!==y)return;const k=v===Ji&&m!=="en"?"en":m;As[k]=v,u(v),o(k);try{localStorage.setItem("pave-locale",k)}catch{}},[]),p=x.useCallback((m,y)=>V4(l,m,y),[l]),h=x.useMemo(()=>({t:p,locale:i,setLocale:f,availableLocales:Sl}),[p,i,f]);return n.jsx(G4.Provider,{value:h,children:t})}function Jt(){const e=x.useContext(G4);return e||{t:(t,r)=>V4(Ji,t,r),locale:"en",setLocale:()=>{},availableLocales:Sl}}function LI(){try{let e=localStorage.getItem("pave-locale");if(e==="zh"&&(e="zh-TW",localStorage.setItem("pave-locale",e)),e&&Sl.some(t=>t.code===e))return e}catch{}if(typeof navigator<"u"&&navigator.language){const e=navigator.language.toLowerCase(),t=Sl.find(i=>i.code.toLowerCase()===e);if(t)return t.code;const r=e.split("-")[0],a=Sl.find(i=>i.code.toLowerCase().startsWith(r));if(a)return a.code}return"en"}function OI({darkMode:e,onToggle:t}){const{t:r}=Jt();return n.jsx("button",{onClick:t,className:"p-2 rounded-lg text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors",title:r(e?"theme.light":"theme.dark"),"aria-label":r(e?"theme.light":"theme.dark"),"aria-pressed":e,children:e?n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"})}):n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"})})})}var K4=$4();const DI=jo(K4);function PI({open:e,onClose:t,onConfirm:r,title:a,message:i,confirmLabel:o,cancelLabel:l,destructive:u}){var{t:d}=Jt(),f=x.useRef(null),p=x.useRef(null);if(x.useEffect(function(){e&&p.current&&p.current.focus()},[e]),x.useEffect(function(){if(!e)return;function v(k){k.key==="Escape"&&(typeof k.preventDefault=="function"&&k.preventDefault(),typeof k.stopImmediatePropagation=="function"?k.stopImmediatePropagation():typeof k.stopPropagation=="function"&&k.stopPropagation(),t())}return document.addEventListener("keydown",v,!0),function(){document.removeEventListener("keydown",v,!0)}},[e,t]),x.useEffect(function(){if(!e||!f.current)return;function v(k){if(k.key==="Tab"){var _=f.current.querySelectorAll("button:not([disabled])");if(_.length!==0){var w=_[0],N=_[_.length-1];k.shiftKey?document.activeElement===w&&(k.preventDefault(),N.focus()):document.activeElement===N&&(k.preventDefault(),w.focus())}}}return document.addEventListener("keydown",v),function(){document.removeEventListener("keydown",v)}},[e]),!e)return null;var h=o||d("confirm_dialog.confirm"),m=l||d("confirm_dialog.cancel"),y=u?"bg-red-600 hover:bg-red-700 focus:ring-red-500 text-white":"bg-primary-600 hover:bg-primary-700 focus:ring-primary-500 text-white";return n.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/40 backdrop-blur-sm transition-opacity duration-150",onClick:function(v){v.target===v.currentTarget&&t()},children:n.jsxs("div",{ref:f,role:"dialog","aria-modal":"true","aria-label":a,className:"bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-700 shadow-xl w-full max-w-md mx-4 outline-none transition-all duration-150",children:[n.jsx("div",{className:"px-5 py-4 border-b border-gray-100 dark:border-gray-800",children:n.jsx("h3",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:a})}),n.jsx("div",{className:"px-5 py-4",children:n.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:i})}),n.jsxs("div",{className:"px-5 py-3 border-t border-gray-100 dark:border-gray-800 flex justify-end gap-3",children:[n.jsx("button",{ref: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-none focus:ring-2 focus:ring-gray-400 focus:ring-offset-2",children:m}),n.jsx("button",{type:"button",onClick:r,className:"px-4 py-2 text-sm font-medium rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 "+y,children:h})]})]})})}const Y4=x.createContext(null);function FI({children:e}){var{t}=Jt(),r=x.useRef(null),a={open:!1,title:"",message:"",confirmLabel:"",cancelLabel:"",destructive:!1},i=x.useState(a),o=i[0],l=i[1],u=x.useCallback(function(p){r.current&&(r.current(!1),r.current=null);var h=p||{};return new Promise(function(m){r.current=m,l({open:!0,title:h.title||t("confirm_dialog.confirm"),message:h.message||"",confirmLabel:h.confirmLabel||"",cancelLabel:h.cancelLabel||"",destructive:h.destructive||!1})})},[t]),d=x.useCallback(function(){l(a),r.current&&(r.current(!1),r.current=null)},[]),f=x.useCallback(function(){l(a),r.current&&(r.current(!0),r.current=null)},[]);return n.jsxs(Y4.Provider,{value:u,children:[e,n.jsx(PI,{open:o.open,onClose:d,onConfirm:f,title:o.title,message:o.message,confirmLabel:o.confirmLabel,cancelLabel:o.cancelLabel,destructive:o.destructive})]})}function iu(){var e=x.useContext(Y4);if(!e)throw new Error("useConfirmDialog must be used within a ConfirmDialogProvider");return e}const yf=180,Gc=256,X4=480,BI=360;function Q4(e){const r=(Number.isFinite(e)?e:1280)-BI;return Math.min(X4,Math.max(yf,r))}function Bb(e,t){const r=Q4(t),a=Number.isFinite(e)?e:Gc;return Math.min(r,Math.max(yf,Math.round(a)))}function zI(e){if(e==null||e==="")return Gc;const t=parseInt(e,10);return!Number.isFinite(t)||t<yf||t>X4?Gc:t}function y_(e,t,r){const a=Number.isFinite(e)?e:t;return Math.min(r,Math.max(t,Math.round(a)))}const UI=8,qI=32;function HI({effectiveWidth:e,effectiveMaxWidth:t,minWidth:r=yf,onCommit:a,getPaneEl:i}){const{t:o}=Jt(),l=x.useRef(null),u=x.useRef(null),d=x.useRef(null),f=x.useRef(e);f.current=e,x.useEffect(()=>()=>{d.current&&d.current()},[]);const p=m=>{if(m.pointerType==="mouse"&&m.button!==0)return;m.preventDefault();const y=m.currentTarget,v=i?i():null,k=m.clientX,_=f.current;try{y.setPointerCapture(m.pointerId)}catch{}l.current=m.pointerId;const w=document.body.style.cursor,N=document.body.style.userSelect;document.body.style.cursor="ew-resize",document.body.style.userSelect="none";let E=!1;const A=M=>{if(l.current!==null&&M.pointerId!==l.current)return;const L=Bb(_+(M.clientX-k),window.innerWidth);v&&v.style.setProperty("--pave-sidebar-w",L+"px"),u.current=L},T=M=>{if(E)return;E=!0,window.removeEventListener("pointermove",A),window.removeEventListener("pointerup",j),window.removeEventListener("pointercancel",C),window.removeEventListener("lostpointercapture",C),document.body.style.cursor=w,document.body.style.userSelect=N;const L=l.current;if(l.current=null,L!==null)try{y.releasePointerCapture(L)}catch{}M&&u.current!==null?a(u.current):v&&v.style.setProperty("--pave-sidebar-w",f.current+"px"),u.current=null,d.current=null},C=()=>T(!1),j=()=>T(!0);window.addEventListener("pointermove",A),window.addEventListener("pointerup",j),window.addEventListener("pointercancel",C),window.addEventListener("lostpointercapture",C),d.current=()=>T(!1)},h=m=>{const y=m.shiftKey?qI:UI;let v=null;m.key==="ArrowLeft"?v=e-y:m.key==="ArrowRight"?v=e+y:m.key==="Home"?v=r:m.key==="End"&&(v=t),v!==null&&(m.preventDefault(),a(Bb(v,window.innerWidth)))};return n.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":o("sidebar.resize"),"aria-valuemin":r,"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:n.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 $I(e){const t=new Date,r=new Date(e),a=new Date(t.getFullYear(),t.getMonth(),t.getDate());if(r>=a)return"today";const i=new Date(a);if(i.setDate(i.getDate()-1),r>=i)return"yesterday";const o=new Date(a);if(o.setDate(o.getDate()-o.getDay()),r>=o)return"thisWeek";const l=new Date(t.getFullYear(),t.getMonth(),1);return r>=l?"thisMonth":"older"}function WI(e,t){const r={today:[],yesterday:[],thisWeek:[],thisMonth:[],older:[]},a={today:t("sidebar.today"),yesterday:t("sidebar.yesterday"),thisWeek:t("sidebar.this_week"),thisMonth:t("sidebar.this_month"),older:t("sidebar.older")};for(let l=0;l<e.length;l++){const u=e[l],d=$I(u.time&&u.time.updated?u.time.updated:0);r[d].push(u)}const i=["today","yesterday","thisWeek","thisMonth","older"],o=[];for(let l=0;l<i.length;l++){const u=i[l];r[u].length>0&&o.push({key:u,label:a[u],sessions:r[u]})}return o}function VI(e,t){if(!e)return"";const r=Date.now()-e;if(r<60*1e3)return t("sidebar.age_now");const a=Math.floor(r/(60*1e3));if(a<60)return t("sidebar.age_minutes",{n:a});const i=Math.floor(a/60);if(i<24)return t("sidebar.age_hours",{n:i});const o=Math.floor(i/24);return o<7?t("sidebar.age_days",{n:o}):t("sidebar.age_weeks",{n:Math.floor(o/7)})}function b_(e){return e.source==="archive"||e._readOnly}const GI={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 go({name:e,className:t}){return n.jsx("svg",{className:t,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:GI[e]})})}function v_({className:e,filled:t}){return n.jsx("svg",{className:e,fill:t?"currentColor":"none",viewBox:"0 0 20 20",stroke:"currentColor",strokeWidth:t?0:1.5,"aria-hidden":"true",children:n.jsx("path",{d:"M10 2a.75.75 0 01.67.41l1.37 2.78 3.07.45a.75.75 0 01.41 1.28l-2.22 2.16.52 3.05a.75.75 0 01-1.09.79L10 11.35l-2.73 1.43a.75.75 0 01-1.09-.79l.52-3.05-2.22-2.16a.75.75 0 01.42-1.28l3.07-.45 1.37-2.78A.75.75 0 0110 2z"})})}const bg=216,wd=8;function KI({anchor:e,items:t,label:r,onClose:a}){const i=x.useRef(null),[o,l]=x.useState(null);x.useEffect(()=>{const d=i.current;if(!d)return;const f=d.offsetHeight;let p=e.align==="right"?e.x-bg:e.x;p=Math.max(wd,Math.min(p,window.innerWidth-bg-wd));let h=e.y;h+f>window.innerHeight-wd&&(h=Math.max(wd,e.flipY-f)),l({left:p,top:h})},[e]),x.useEffect(()=>{if(!o||!i.current)return;const d=i.current.querySelector("[data-menuitem]");d&&d.focus()},[o]),x.useEffect(()=>{function d(p){i.current&&!i.current.contains(p.target)&&a()}function f(p){p.key==="Escape"&&(p.stopPropagation(),a())}return document.addEventListener("mousedown",d),document.addEventListener("keydown",f,!0),window.addEventListener("resize",a),window.addEventListener("scroll",a,!0),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",f,!0),window.removeEventListener("resize",a),window.removeEventListener("scroll",a,!0)}},[a]);const u=d=>{if(d.key!=="ArrowDown"&&d.key!=="ArrowUp")return;d.preventDefault();const f=Array.from(i.current.querySelectorAll("[data-menuitem]"));if(f.length===0)return;const p=f.indexOf(document.activeElement),h=d.key==="ArrowDown"?(p+1)%f.length:(p-1+f.length)%f.length;f[h].focus()};return K4.createPortal(n.jsx("div",{ref:i,role:"menu","aria-label":r,onKeyDown:u,className:"fixed z-50 py-1 rounded-lg bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 shadow-lg",style:{width:bg,left:o?o.left:0,top:o?o.top:0,visibility:o?"visible":"hidden"},children:t.map(d=>d.separator?n.jsx("div",{className:"my-1 h-px bg-gray-100 dark:bg-gray-800"},d.key):n.jsxs("button",{"data-menuitem":"",role:"menuitem",onClick:()=>{a(),d.onSelect()},className:`w-full flex items-center gap-2.5 px-3 py-1.5 text-left text-sm rounded-md ${d.danger?"text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20":"text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-800"}`,children:[n.jsx("span",{className:"flex-shrink-0 opacity-70",children:d.icon}),n.jsx("span",{className:"flex-1 truncate",children:d.label}),d.hint&&n.jsx("span",{className:"flex-shrink-0 text-[11px] text-gray-400 dark:text-gray-500",children:d.hint})]},d.key))}),document.body)}function YI({sessions:e,activeSessionId:t,busySessions:r={},onSelectSession:a,onNewChat:i,onDeleteSession:o,onDeleteAllSessions:l,onRenameSession:u,onRegenerateTitle:d,onPinSession:f,onArchiveSession:p,onExportSession:h,onSendToSession:m,onImportSession:y,onImportError:v,showArchived:k,onToggleShowArchived:_,isOpen:w,onClose:N,onToggle:E,hasMoreSessions:A,onLoadMoreSessions:T,showOtherApps:C,onToggleShowOtherApps:j,hasMoreOtherApps:M,onLoadMoreOtherApps:L,otherAppsCount:I,search:B,onSearchChange:z,loadedCount:ee,totalCount:V,sidebarWidth:D=Gc,onSidebarWidthChange:K}){const{t:H}=Jt(),J=iu(),[ne,P]=x.useState(B||"");x.useEffect(()=>{typeof B=="string"&&B!==ne&&P(B)},[B]);const U=se=>{P(se),z&&z(se)},[X,F]=x.useState(null),[Z,W]=x.useState(""),[G,oe]=x.useState(null),Q=x.useRef(null),fe=x.useRef(null),[ke,Fe]=x.useState(()=>typeof window<"u"?window.innerWidth:1280);x.useEffect(()=>{let se=0;const De=()=>{se||(se=requestAnimationFrame(()=>{se=0,Fe(window.innerWidth)}))};return window.addEventListener("resize",De),()=>{window.removeEventListener("resize",De),se&&cancelAnimationFrame(se)}},[]);const Ve=Bb(D,ke),Ge=Q4(ke);x.useLayoutEffect(()=>{fe.current&&fe.current.style.setProperty("--pave-sidebar-w",Ve+"px")},[Ve]);const qe=x.useCallback(()=>fe.current,[]),Ce=x.useCallback(()=>{const se=Q.current;Q.current=null,oe(null),se&&se.isConnected&&se.focus()},[]),He=(se,De,rt)=>{Q.current=rt||null,oe({id:se.id,anchor:De})},ze=ne?e.filter(function(se){return(se.title||H("sidebar.untitled")).toLowerCase().includes(ne.toLowerCase())}):e,{pinnedSessions:gt,regularSessions:mt,archivedSessions:wt}=x.useMemo(()=>{const se=[],De=[],rt=[];for(let dt=0;dt<ze.length;dt++){const lt=ze[dt];lt.archived?rt.push(lt):lt.pinned?se.push(lt):De.push(lt)}return{pinnedSessions:se,regularSessions:De,archivedSessions:rt}},[ze]),$e=x.useMemo(()=>WI(mt,H),[mt,H]),Et=se=>{F(se.id),W(se.title||"")},Ze=se=>{Z.trim()&&u(se,Z.trim()),F(null),W("")},Oe=async se=>{!se.archived&&!await J({title:H("sidebar.archive"),message:H("sidebar.confirmArchive"),confirmLabel:H("sidebar.archive")})||p(se.id,!se.archived)},it=async se=>{await J({title:H("sidebar.delete_title"),message:H("sidebar.delete_confirm"),destructive:!0,confirmLabel:H("sidebar.delete")})&&o(se.id)},me=se=>{if(b_(se))return[];const De=[{key:"rename",label:H("sidebar.rename"),hint:"F2",icon:n.jsx(go,{name:"rename",className:"w-4 h-4"}),onSelect:()=>Et(se)}];d&&De.push({key:"regenerate",label:H("sidebar.regenerate_title"),icon:n.jsx(go,{name:"regenerate",className:"w-4 h-4"}),onSelect:()=>d(se.id)}),h&&De.push({key:"export",label:H("sidebar.export"),icon:n.jsx(go,{name:"export",className:"w-4 h-4"}),onSelect:()=>h(se.id)}),m&&De.push({key:"send-to-session",label:H("sidebar.send_to_session"),icon:n.jsx(go,{name:"send",className:"w-4 h-4"}),onSelect:()=>m(se.id)});const rt=[];return f&&(!se.archived||se.pinned)&&rt.push({key:"pin",label:se.pinned?H("sidebar.unpin"):H("sidebar.pin"),icon:n.jsx(v_,{className:"w-4 h-4",filled:se.pinned}),onSelect:()=>f(se.id,!se.pinned)}),p&&rt.push({key:"archive",label:se.archived?H("sidebar.unarchive"):H("sidebar.archive"),icon:n.jsx(go,{name:se.archived?"unarchive":"archive",className:"w-4 h-4"}),onSelect:()=>Oe(se)}),rt.length>0&&(De.push({key:"sep-state",separator:!0}),De.push(...rt)),De.push({key:"sep-danger",separator:!0}),De.push({key:"delete",label:H("sidebar.delete"),hint:"Del",danger:!0,icon:n.jsx(go,{name:"delete",className:"w-4 h-4"}),onSelect:()=>it(se)}),De},Ee=x.useMemo(()=>G&&e.find(se=>se.id===G.id)||null,[G,e]);x.useEffect(()=>{G&&!Ee&&Ce()},[G,Ee,Ce]);const ge=(se,De)=>{const rt=De&&De.dimmed,dt=b_(se),lt=!!(G&&G.id===se.id),Lt=!dt,ot=(et,Ot)=>He(se,et,Ot);return n.jsx("div",{role:"button",tabIndex:0,className:`group relative flex items-center gap-1 px-2 py-2 rounded-lg cursor-pointer text-sm mb-0.5 transition-colors ${se.id===t?"bg-primary-50 dark:bg-primary-900/30 text-primary-600 dark:text-primary-300":rt?"text-gray-400 dark:text-gray-500 hover:bg-gray-200 dark:hover:bg-gray-800":"text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-800"}`,onClick:()=>a(se.id),onContextMenu:et=>{!Lt||X===se.id||(et.preventDefault(),ot({x:et.clientX,y:et.clientY,flipY:et.clientY,align:"left"},et.currentTarget))},onKeyDown:et=>{if(et.currentTarget===et.target){if(et.key==="Enter"||et.key===" "){et.preventDefault(),a(se.id);return}if(Lt){if(et.key==="F2")et.preventDefault(),Et(se);else if(et.key==="Delete")et.preventDefault(),it(se);else if(et.key==="ContextMenu"){et.preventDefault();const Ot=et.currentTarget.getBoundingClientRect();ot({x:Ot.right,y:Ot.bottom,flipY:Ot.top,align:"right"},et.currentTarget)}}}},children:X===se.id?n.jsx("input",{autoFocus:!0,value:Z,onChange:et=>W(et.target.value),onBlur:()=>Ze(se.id),onKeyDown:et=>{et.key==="Enter"?(et.preventDefault(),et.stopPropagation(),et.currentTarget.blur()):et.key==="Escape"?(et.stopPropagation(),F(null)):et.key===" "&&et.stopPropagation()},onClick:et=>et.stopPropagation(),className:"flex-1 bg-white dark:bg-gray-700 rounded px-1.5 py-0.5 text-sm outline-none"}):n.jsxs(n.Fragment,{children:[se.pinned&&n.jsx("svg",{className:"w-3 h-3 flex-shrink-0 text-amber-500",fill:"currentColor",viewBox:"0 0 20 20",role:"img",title:H("sidebar.icon_pinned"),"aria-label":H("sidebar.icon_pinned"),children:n.jsx("path",{d:"M10 2a.75.75 0 01.67.41l1.37 2.78 3.07.45a.75.75 0 01.41 1.28l-2.22 2.16.52 3.05a.75.75 0 01-1.09.79L10 11.35l-2.73 1.43a.75.75 0 01-1.09-.79l.52-3.05-2.22-2.16a.75.75 0 01.42-1.28l3.07-.45 1.37-2.78A.75.75 0 0110 2z"})}),se.source==="archive"&&n.jsx("svg",{className:"w-3 h-3 flex-shrink-0 text-blue-400 dark:text-blue-500 opacity-70",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,role:"img",title:H("sidebar.icon_archive"),"aria-label":H("sidebar.icon_archive"),children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8"})}),se.compactedAt&&se.source!=="archive"&&n.jsx("svg",{className:"w-3 h-3 flex-shrink-0 text-gray-400 dark:text-gray-500 opacity-60",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,role:"img",title:H("sidebar.icon_compacted"),"aria-label":H("sidebar.icon_compacted"),children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"})}),r[se.id]&&n.jsx("div",{className:"w-2 h-2 rounded-full bg-accent-400 animate-pulse flex-shrink-0",role:"status",title:H("sidebar.session_processing"),"aria-label":H("sidebar.session_processing")}),n.jsxs("span",{className:`session-row-title flex-1 flex items-center min-w-0 ${rt?"italic":""}`,"data-menu-open":lt?"true":"false",children:[n.jsx("span",{className:"truncate min-w-0",children:se.title||H("sidebar.untitled")}),se.archived&&n.jsxs("span",{className:"ml-1 text-xs text-gray-400 dark:text-gray-500 flex-shrink-0",children:["(",H("sidebar.archived"),")"]})]}),n.jsxs("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-0.5",children:[n.jsx("span",{className:`text-[11px] tabular-nums text-gray-400 dark:text-gray-500 ${lt?"hidden":"group-hover:hidden group-focus-within:hidden"}`,children:VI(se.time&&se.time.updated,H)}),n.jsxs("div",{className:`items-center gap-0.5 ${lt?"flex":"hidden group-hover:flex group-focus-within:flex"}`,children:[f&&(!se.archived||se.pinned)&&n.jsx("button",{onClick:et=>{et.stopPropagation(),f(se.id,!se.pinned)},className:"p-1.5 rounded hover:bg-gray-300 dark:hover:bg-gray-700",title:se.pinned?H("sidebar.unpin"):H("sidebar.pin"),"aria-label":se.pinned?H("sidebar.unpin"):H("sidebar.pin"),children:n.jsx(v_,{className:`w-4 h-4 ${se.pinned?"text-amber-500":""}`,filled:se.pinned})}),Lt&&n.jsx("button",{onClick:et=>{et.stopPropagation();const Ot=et.currentTarget.getBoundingClientRect();ot({x:Ot.right,y:Ot.bottom+4,flipY:Ot.top-4,align:"right"},et.currentTarget)},className:`p-1.5 rounded hover:bg-gray-300 dark:hover:bg-gray-700 ${lt?"bg-gray-300 dark:bg-gray-700":""}`,"aria-label":H("sidebar.more_actions"),"aria-haspopup":"menu","aria-expanded":lt,children:n.jsx(go,{name:"more",className:"w-4 h-4"})})]})]})]})},se.id)},je=se=>n.jsx("div",{className:"px-2 pt-3 pb-1",children:n.jsx("span",{className:"text-[10px] text-gray-400 dark:text-gray-500 uppercase tracking-wider font-semibold",children:se})});return n.jsxs(n.Fragment,{children:[w&&n.jsx("div",{className:"fixed inset-0 top-14 bg-black/30 z-20 md:hidden",onClick:N}),!w&&n.jsx("div",{className:"flex-shrink-0 w-10 flex flex-col items-center pt-3 border-r border-gray-200 dark:border-gray-800",children:n.jsx("button",{onClick:E,className:"p-1.5 rounded-lg bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 dark:text-gray-400 transition-colors",title:H("sidebar.show"),"aria-label":H("sidebar.show"),children:n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h16M4 18h16"})})})}),n.jsxs("aside",{ref:fe,className:`
41
+ ${w?"translate-x-0":"-translate-x-full"}
42
+ transition-transform duration-200 ease-in-out
43
+ fixed md:relative z-30 md:z-auto
44
+ top-14 md:top-0 bottom-0 left-0
45
+ w-64 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
+ ${w?"md:flex":"md:hidden"}
48
+ `,children:[n.jsxs("div",{className:"flex items-center justify-between px-3 pt-3 pb-1",children:[n.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 uppercase tracking-wide font-medium",children:H("sidebar.conversations")}),n.jsx("button",{onClick:E,className:"p-1.5 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 dark:text-gray-400 transition-colors",title:H("sidebar.hide"),"aria-label":H("sidebar.hide"),children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 19l-7-7 7-7m8 14l-7-7 7-7"})})})]}),n.jsxs("div",{className:"px-3 py-2 flex gap-2",children:[n.jsx("button",{onClick:i,className:"flex-1 py-2 px-4 rounded-lg bg-accent-400 hover:bg-accent-500 text-gray-900 font-medium text-sm transition-colors",children:H("app.new_chat")}),y&&n.jsx("button",{onClick:()=>{const se=document.createElement("input");se.type="file",se.accept=".yaml,.yml",se.onchange=De=>{const rt=De&&De.target&&De.target.files,dt=rt&&rt[0];if(dt){const lt=dt.name.toLowerCase();if(!lt.endsWith(".yaml")&&!lt.endsWith(".yml")){v&&v(H("import.invalid_file_type"));return}const Lt=10*1024*1024;if(dt.size>Lt){v&&v(H("import.file_too_large"));return}const ot=new FileReader;ot.onload=et=>{const Ot=et&&et.target?et.target.result:null;if(typeof Ot!="string"){v&&v(H("import.read_error"));return}y(Ot)},ot.onerror=()=>{v&&v(H("import.read_error"))},ot.readAsText(dt)}},se.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:H("sidebar.import"),"aria-label":H("sidebar.import"),children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"})})})]}),n.jsx("div",{className:"px-3 pb-2",children:n.jsx("input",{type:"text",placeholder:H("sidebar.search_placeholder"),value:ne,onChange:se=>U(se.target.value),className:"w-full px-3 py-1.5 rounded-lg bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-sm text-gray-900 dark:text-gray-100 placeholder-gray-400 dark:placeholder-gray-500 outline-none focus:ring-2 focus:ring-primary-500/30"})}),n.jsxs("div",{className:"flex-1 overflow-y-auto px-2",children:[gt.length===0&&$e.every(se=>se.sessions.length===0)&&(!k||wt.length===0)&&n.jsx("p",{className:"px-2 py-4 text-xs text-gray-400 dark:text-gray-500 text-center",children:H(ne?"sidebar.no_matches":"sidebar.no_conversations")}),gt.length>0&&n.jsxs(n.Fragment,{children:[je(H("sidebar.pinned")),gt.map(se=>ge(se))]}),$e.map(se=>n.jsxs("div",{children:[(gt.length>0||$e.length>1)&&je(se.label),se.sessions.map(De=>ge(De))]},se.key)),k&&wt.length>0&&n.jsxs(n.Fragment,{children:[je(H("sidebar.archived")),wt.map(se=>ge(se,{dimmed:!0}))]}),(A||M)&&(T||L)&&n.jsx("div",{className:"pt-2 pb-1 px-1",children:n.jsxs("button",{onClick:()=>{A&&T&&T(),M&&L&&L()},className:"w-full flex items-center justify-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium text-primary-600 dark:text-primary-400 hover:bg-primary-50 dark:hover:bg-primary-900/20 transition-colors",children:[n.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})}),typeof V=="number"&&V>0&&typeof ee=="number"?H("sidebar.load_more_count",{loaded:ee+(I||0),total:V+(I||0)}):H("sidebar.load_more")]})}),!A&&!M&&typeof V=="number"&&V>0&&n.jsx("div",{className:"pt-2 pb-1 px-1 text-center text-[11px] text-gray-400 dark:text-gray-500 tabular-nums",children:ne?H("sidebar.search_result_count",{total:V+(I||0)}):H("sidebar.all_loaded_count",{total:V+(I||0)})}),j&&n.jsx("div",{className:"pt-2 pb-1 px-1",children:n.jsxs("button",{onClick:j,className:"w-full flex items-center justify-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium text-gray-500 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-800 transition-colors",children:[n.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 9l3 3-3 3m5 0h3M4 5h16a1 1 0 011 1v12a1 1 0 01-1 1H4a1 1 0 01-1-1V6a1 1 0 011-1z"})}),H(C?"sidebar.hide_other_apps":"sidebar.show_other_apps")]})}),_&&n.jsx("div",{className:"pt-2 pb-1 px-1",children:n.jsxs("button",{onClick:_,className:"w-full flex items-center justify-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium text-gray-500 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-800 transition-colors",children:[n.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:k?n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.878 9.878L3 3m6.878 6.878L21 21"}):n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})}),H(k?"sidebar.hide_archived":"sidebar.show_archived")]})}),ze.some(function(se){return se.source!=="legacy"&&!se._readOnly})&&l&&n.jsx("div",{className:"pt-3 pb-2 px-1",children:n.jsxs("button",{onClick:async()=>{await J({title:H("sidebar.delete_all_title"),message:H("sidebar.delete_all_confirm"),destructive:!0,confirmLabel:H("sidebar.delete_all")})&&l()},className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg border border-red-300 dark:border-red-800 text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 text-xs font-medium transition-colors",children:[n.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),H("sidebar.delete_all")]})})]}),K&&n.jsx(HI,{effectiveWidth:Ve,effectiveMaxWidth:Ge,onCommit:K,getPaneEl:qe})]}),G&&Ee&&n.jsx(KI,{anchor:G.anchor,items:me(Ee),label:H("sidebar.more_actions"),onClose:Ce})]})}const Rs="pave-draft-";function XI(e){return Rs+e}function QI(e){if(e)try{localStorage.removeItem(XI(e))}catch{}}const Ja="",zb="pave-working-directory";function Nl(){if(typeof window>"u")return null;try{return localStorage.getItem(zb)||null}catch{return null}}function vg(e){if(!(typeof window>"u"))try{e===null||e===""?localStorage.removeItem(zb):localStorage.setItem(zb,e)}catch{}}const Z4="web";let Ub=null;function k_(e){Ub=e}let Nc=null,__=0;function J4(){return Nc||(Date.now()<__?Promise.resolve(!1):(Nc=(async()=>{let e=!1,t=null;try{const r=await fetch(`${Ja}/auth/membership/restore`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}});if(r.ok){const a=await r.json().catch(()=>({}));e=!!a.authenticated,t=a.user||null}}catch{e=!1}finally{__=Date.now()+5e3,Nc=null}try{Ub&&Ub({recovered:e,user:t})}catch{}return e})(),Nc))}function ZI(e){return typeof e=="string"&&e.indexOf("/auth/")===0}async function xt(e,t={}){const r=Nl(),a={"Content-Type":"application/json","X-PAVE-Client":Z4,...t.headers};r&&(a["x-opencode-directory"]=r);const{headers:i,...o}=t,l=await fetch(`${Ja}${e}`,{...o,headers:a});if(!l.ok){l.status===401&&!ZI(e)&&J4();let u=null;try{const f=await l.text();try{u=JSON.parse(f)}catch{u=null}if(!u){const p=new Error(`${l.status}: ${f||l.statusText}`);throw p.status=l.status,p}}catch(f){if(f.message)throw f.status===void 0&&(f.status=l.status),f;const p=new Error(`${l.status}: ${l.statusText}`);throw p.status=l.status,p}const d=new Error(`${l.status}: ${u.error||u.message||JSON.stringify(u)}`);throw d.status=l.status,d.body=u,u.reauthRequired&&(d.reauthRequired=!0),d}return l.json()}function 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 r=t.toString(),a=r?`/session?${r}`:"/session";return xt(a)}function w_(e){return xt("/session",{method:"POST",body:JSON.stringify({title:void 0})})}function kg(e){return xt(`/session/${e}`)}function Xa(e,t){return xt(`/session/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function JI(e){return xt(`/session/${e}/regenerate-title`,{method:"POST"})}function e3(e,{senderSessionID:t,text:r}){return xt(`/session/${e}/mailbox`,{method:"POST",body:JSON.stringify({senderSessionID:t,text:r})})}function t3(e){return xt(`/session/${e}/fork`,{method:"POST"})}function r3(e){return xt(`/session/${e}`,{method:"DELETE"})}function n3(e){return xt(`/session/${e}/archive/session`,{method:"POST"})}function a3(){return xt("/session",{method:"DELETE"})}function S_(e,t,r){const a=new URLSearchParams;t&&a.set("fresh","1"),r&&r.limit!=null&&a.set("limit",String(r.limit)),r&&r.before&&a.set("before",r.before);const i=a.toString();return xt(`/session/${e}/message${i?"?"+i:""}`)}function Sd(e,t,r,a,i,o){const l={content:t,async:!0};return r&&r.length>0&&(l.parts=r),a&&(l.model=a),i&&(l.agent=i),o&&o.enqueue&&(l.enqueue=!0,o.priority&&(l.priority=o.priority),o.displayContent&&(l.displayContent=o.displayContent)),o&&o.moeTopK&&(l.moe_top_k=o.moeTopK),o&&o.reasoningEffort&&(l.reasoning_effort=o.reasoningEffort),o&&o.adaptiveQuality&&(l.adaptive_quality=!0),xt(`/session/${e}/message`,{method:"POST",body:JSON.stringify(l)})}function _g(e){return xt(`/session/${e}/queue`)}function N_(e,t,r){const a={content:t};return r&&r.parts&&(a.parts=r.parts),r&&r.model&&(a.model=r.model),r&&r.agent&&(a.agent=r.agent),r&&r.priority&&(a.priority=r.priority),r&&r.displayContent&&(a.displayContent=r.displayContent),r&&r.moeTopK&&(a.moe_top_k=r.moeTopK),r&&r.reasoningEffort&&(a.reasoning_effort=r.reasoningEffort),r&&r.adaptiveQuality&&(a.adaptive_quality=!0),xt(`/session/${e}/queue`,{method:"POST",body:JSON.stringify(a)})}function E_(e,t){return xt(`/session/${e}/queue/${t}`,{method:"DELETE"})}function i3(e,t){return xt(`/session/${e}/queue/reorder`,{method:"PATCH",body:JSON.stringify({itemIds:t})})}function s3(e){return xt(`/api/sessions/${e}/compaction/compact`,{method:"POST",body:JSON.stringify({auto:!1,force:!1})})}function o3(e){return xt(`/session/${e}`,{method:"PATCH",body:JSON.stringify({compactionPinned:!1})})}function l3(e){return xt(`/session/${e}/abort`,{method:"POST"})}function eT(e){return xt(`/session/${e}/idle-injection`)}function c3(e,t){return xt(`/session/${e}/idle-injection`,{method:"PUT",body:JSON.stringify(t)})}function u3(e){return xt(`/session/${e}/idle-injection`,{method:"DELETE"})}function d3(e){return xt(`/session/${e}/scheduled-injections`)}function f3(e,t){return xt(`/session/${e}/scheduled-injections`,{method:"POST",body:JSON.stringify(t)})}function p3(e,t,r){return xt(`/session/${e}/scheduled-injections/${t}`,{method:"PATCH",body:JSON.stringify(r)})}function g3(e,t){return xt(`/session/${e}/scheduled-injections/${t}`,{method:"DELETE"})}function h3(){return xt("/config/providers")}function m3(){return xt("/api/models/registry")}function x3(){return xt("/auth/status")}function y3(){return xt("/auth/logout",{method:"POST"})}function b3(){return xt("/api/permissions/pending")}function v3(e){return xt(`/api/permissions/confirm/${e}`,{method:"POST"})}function k3(e){return xt(`/api/permissions/deny/${e}`,{method:"POST"})}function _3(){return xt("/api/questions/pending")}function w3(e,t){return xt(`/api/questions/${e}/reply`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({answer:t})})}function S3(e){return xt(`/api/questions/${e}/reject`,{method:"POST"})}function Ev(){return xt("/skills")}function N3(){return xt("/skills/commands")}function E3(){return xt("/skills/registry")}function j3(e){return xt(`/skills/${encodeURIComponent(e)}`)}function C3(e){return xt(`/skills/${encodeURIComponent(e)}/install`,{method:"POST"})}function T3(e){return xt(`/skills/${encodeURIComponent(e)}/update`,{method:"POST"})}function R3(){return xt("/skills/check-updates")}function A3(e,t){return xt(`/skills/${encodeURIComponent(e)}/tokens`,{method:"PUT",body:JSON.stringify(t)})}function I3(e){return xt(`/skills/${encodeURIComponent(e)}/tokens`,{method:"DELETE"})}function M3(e){return xt(`/skills/${encodeURIComponent(e)}`,{method:"DELETE"})}function tT(){return xt("/api/skill-defaults")}function L3(e){return xt("/api/skill-defaults",{method:"PUT",body:JSON.stringify(e)})}function O3(e){return xt(`/skills/${encodeURIComponent(e)}/oauth/start`,{method:"POST"})}function D3(e){return xt(`/skills/${encodeURIComponent(e)}/oauth/broker/start`,{method:"POST"})}function P3(e,t){return xt(`/skills/${encodeURIComponent(e)}/oauth/broker/result?flow_id=${encodeURIComponent(t)}`)}function j_(){return xt("/config")}function F3(){return xt("/inspector/sessions")}async function B3(e){const t=Nl(),r={"X-PAVE-Client":Z4};t&&(r["x-opencode-directory"]=t);const a=await fetch(`${Ja}/inspector/session/${encodeURIComponent(e)}/events`,{headers:r});if(!a.ok){const i=new Error(`${a.status}: ${a.statusText}`);throw i.status=a.status,i}return a.text()}function C_(e,t){return xt(`/inspector/session/${encodeURIComponent(e)}/body/${encodeURIComponent(t)}`)}function z3(e){return xt(`/inspector/session/${encodeURIComponent(e)}`,{method:"DELETE"})}function U3(e){const t=e?"?model="+encodeURIComponent(e):"";return xt("/config/adaptive-quality"+t)}function qb(){return xt("/path")}function T_(e){return xt("/api/directory/validate",{method:"POST",body:JSON.stringify({path:e})})}function q3(e){return xt("/api/directory/create",{method:"POST",body:JSON.stringify({path:e})})}function Hb(){return xt("/settings")}function H3(e){return xt("/settings",{method:"PUT",body:JSON.stringify(e)})}function R_(e){const t=new URLSearchParams;e&&(e.unreadOnly&&t.set("unreadOnly","true"),typeof e.limit=="number"&&t.set("limit",String(e.limit)),typeof e.offset=="number"&&t.set("offset",String(e.offset)));const r=t.toString();return xt("/api/user/inbox"+(r?"?"+r:""))}function $3(e){return xt("/api/user/inbox/"+encodeURIComponent(e)+"/read",{method:"POST"})}function W3(e){return xt("/api/user/inbox/"+encodeURIComponent(e)+"/unread",{method:"POST"})}function V3(e){return xt("/api/user/inbox/"+encodeURIComponent(e),{method:"DELETE"})}function G3(){return xt("/api/user/inbox/read-all",{method:"POST"})}function K3(){return xt("/api/user/inbox",{method:"DELETE"})}async function Y3(e){const t=await fetch(Ja+"/session/"+e+"/export",{credentials:"include"});if(!t.ok){const l=await t.json().catch(()=>({}));throw new Error(l.error||"Export failed")}const r=await t.blob(),a=t.headers.get("X-Filename")||"session.yaml",i=URL.createObjectURL(r),o=document.createElement("a");o.href=i,o.download=a,document.body.appendChild(o),o.click(),setTimeout(()=>{URL.revokeObjectURL(i),o.parentNode&&o.parentNode.removeChild(o)},0)}function X3(e){return xt("/session/import",{method:"POST",headers:{"Content-Type":"text/yaml"},body:e})}async function Q3(e,t,r,a){const i=Nl(),o={};i&&(o["x-opencode-directory"]=i),e.type?o["Content-Type"]=e.type:o["Content-Type"]="audio/webm";let l=Ja+"/api/transcribe";const u=[];t&&u.push("language="+encodeURIComponent(t)),r&&u.push("model="+encodeURIComponent(r));const d=a&&a.initialPrompt;d&&u.push("initial_prompt="+encodeURIComponent(d)),u.length>0&&(l+="?"+u.join("&"));const f=await fetch(l,{method:"POST",credentials:"include",headers:o,body:e}),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 yl=null,Lc=0;function $b(){const e=Date.now();return yl&&e<Lc||(yl=xt("/api/transcribe/config").then(t=>(Lc=Date.now()+5e3,t)).catch(t=>{throw yl=null,Lc=0,t}),Lc=1/0),yl}function Z3(e){return yl=null,Lc=0,xt("/api/asr/engine",{method:"POST",body:JSON.stringify({engine:e})})}function A_(){return xt("/session/status")}function J3(e){return xt(`/session/${encodeURIComponent(e)}/dlp/status`)}function eM(){return xt("/api/dlp/policy")}function tM(e){return xt("/api/dlp/policy",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function rM(e){return(await fetch(`${Ja}/api/whatsapp/routing`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json()}async function nM(e){return(await fetch(`${Ja}/api/whatsapp/queue/${e}/pop`,{method:"POST"})).json()}async function I_(e){const t=await fetch(`${Ja}/session/${e}/banners`,{credentials:"include"});return t.ok?t.json():{banners:[]}}async function aM(e){return(await fetch(`${Ja}/session/${e}/banner/regenerate`,{method:"POST"})).json()}async function wg(e){try{const t=await fetch(`${Ja}/session/${e}/todos`,{credentials:"include"});return t.ok?t.json():{todos:[]}}catch{return{todos:[]}}}async function iM(e){const t=await fetch(`${Ja}/session/${e}/plan`,{credentials:"include"});if(!t.ok){const r=new Error(t.status===404?"PLAN.md not found":`${t.status}: ${t.statusText}`);throw r.status=t.status,r}return t.json()}async function M_(e){try{const t=await fetch(`${Ja}/session/${e}/tool-graph`,{credentials:"include"});return t.ok?t.json():{nodes:[],edges:[]}}catch{return{nodes:[],edges:[]}}}function sM(e){const t=new URLSearchParams;e&&(e.category&&t.set("category",e.category),t.set("limit",String(e.limit)),typeof e.offset=="number"&&t.set("offset",String(e.offset)));const r=t.toString();return xt(`/api/board/topics${r?`?${r}`:""}`)}function L_(e){return xt(`/api/board/topic/${encodeURIComponent(e)}`)}function oM(e){return xt(`/api/board/search?q=${encodeURIComponent(e)}`)}function lM(e){return xt(`/api/board/topic/${encodeURIComponent(e)}`,{method:"DELETE"})}function cM(e,t){return xt(`/api/board/topic/${encodeURIComponent(e)}/post/${encodeURIComponent(t)}`,{method:"DELETE"})}function uM(e){var t=e&&(e.client||e.source)||"";return t==="web"?"Web":t==="agent"?"Agent":t==="tui"?"TUI":t==="acp"?"Studio":t||"Unknown"}function dM({open:e,onClose:t,senderSessionID:r}){var{t:a}=Jt(),i=x.useRef(null),o=x.useRef(null),l=x.useState([]),u=l[0],d=l[1],f=x.useState(""),p=f[0],h=f[1],m=x.useState(""),y=m[0],v=m[1],k=x.useState(!1),_=k[0],w=k[1],N=x.useState(""),E=N[0],A=N[1],T=x.useState(!1),C=T[0],j=T[1];x.useEffect(function(){if(e){var I=!1;return A(""),j(!1),v(""),wl({includeOtherApps:!0,limit:100}).then(function(B){if(!I){var z=Array.isArray(B)?B:B&&B.sessions||[],ee=z.filter(function(V){return V&&V.id!==r});d(ee),h(ee.length?ee[0].id:"")}}).catch(function(B){I||A(B&&B.message?B.message:String(B))}),function(){I=!0}}},[e,r]),x.useEffect(function(){e&&o.current&&o.current.focus()},[e]),x.useEffect(function(){if(!e)return;function I(B){B.key==="Escape"&&(typeof B.preventDefault=="function"&&B.preventDefault(),typeof B.stopImmediatePropagation=="function"?B.stopImmediatePropagation():typeof B.stopPropagation=="function"&&B.stopPropagation(),t())}return document.addEventListener("keydown",I,!0),function(){document.removeEventListener("keydown",I,!0)}},[e,t]);var M=x.useCallback(function(){!p||!y.trim()||_||(w(!0),A(""),e3(p,{senderSessionID:r,text:y}).then(function(){w(!1),j(!0)}).catch(function(I){w(!1),A(I&&I.message?I.message:String(I))}))},[p,y,_,r]);if(!e)return null;var L=!!p&&!!y.trim()&&!_;return n.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/40 backdrop-blur-sm transition-opacity duration-150",onClick:function(I){I.target===I.currentTarget&&t()},children:n.jsxs("div",{ref:i,role:"dialog","aria-modal":"true","aria-label":a("send_to_session.title"),className:"bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-700 shadow-xl w-full max-w-lg mx-4 outline-none transition-all duration-150",children:[n.jsx("div",{className:"px-5 py-4 border-b border-gray-100 dark:border-gray-800",children:n.jsx("h3",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:a("send_to_session.title")})}),n.jsxs("div",{className:"px-5 py-4 space-y-3",children:[C?n.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:a("send_to_session.queued")}):n.jsxs(n.Fragment,{children:[n.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:[a("send_to_session.target_label"),n.jsx("select",{value:p,onChange:function(I){h(I.target.value)},className:"mt-1 block w-full rounded-md border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 text-sm px-3 py-2",children:u.map(function(I){return n.jsx("option",{value:I.id,children:(I.title||I.id)+" — "+uM(I)},I.id)})})]}),u.length===0?n.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:a("send_to_session.no_targets")}):null,n.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:[a("send_to_session.message_label"),n.jsx("textarea",{ref:o,value:y,onChange:function(I){v(I.target.value)},rows:4,className:"mt-1 block w-full rounded-md border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 text-sm px-3 py-2"})]}),n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:a("send_to_session.delivery_note")})]}),E?n.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",role:"alert",children:E}):null]}),n.jsxs("div",{className:"px-5 py-3 border-t border-gray-100 dark:border-gray-800 flex justify-end gap-3",children:[n.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm font-medium rounded-md bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-gray-400 focus:ring-offset-2",children:a(C?"send_to_session.close":"send_to_session.cancel")}),C?null:n.jsx("button",{type:"button",onClick:M,disabled:!L,className:"px-4 py-2 text-sm font-medium rounded-md bg-primary-600 hover:bg-primary-700 focus:ring-primary-500 text-white disabled:opacity-50 disabled:cursor-not-allowed focus:outline-none focus:ring-2 focus:ring-offset-2",children:a(_?"send_to_session.sending":"send_to_session.send")})]})]})})}const bf=0,Ms=1,Ml=2,rT=4;function O_(e){return()=>e}function fM(e){e()}function nT(e,t){return r=>e(t(r))}function D_(e,t){return()=>e(t)}function pM(e,t){return r=>e(t,r)}function jv(e){return e!==void 0}function gM(...e){return()=>{e.map(fM)}}function Ll(){}function vf(e,t){return t(e),e}function hM(e,t){return t(e)}function Qr(...e){return e}function Ar(e,t){return e(Ms,t)}function nr(e,t){e(bf,t)}function Cv(e){e(Ml)}function Yr(e){return e(rT)}function zt(e,t){return Ar(e,pM(t,bf))}function mi(e,t){const r=e(Ms,a=>{r(),t(a)});return r}function P_(e){let t,r;return a=>i=>{t=i,r&&clearTimeout(r),r=setTimeout(()=>{a(t)},e)}}function aT(e,t){return e===t}function Xr(e=aT){let t;return r=>a=>{e(t,a)||(t=a,r(a))}}function Xt(e){return t=>r=>{e(r)&&t(r)}}function Ct(e){return t=>nT(t,e)}function Mi(e){return t=>()=>{t(e)}}function Qe(e,...t){const r=mM(...t);return((a,i)=>{switch(a){case Ml:Cv(e);return;case Ms:return Ar(e,r(i))}})}function Li(e,t){return r=>a=>{r(t=e(t,a))}}function No(e){return t=>r=>{e>0?e--:t(r)}}function Zi(e){let t=null,r;return a=>i=>{t=i,!r&&(r=setTimeout(()=>{r=void 0,a(t)},e))}}function cr(...e){const t=Array.from({length:e.length});let r=0,a=null;const i=2**e.length-1;return e.forEach((o,l)=>{const u=2**l;Ar(o,d=>{const f=r;r|=u,t[l]=d,f!==i&&r===i&&a&&(a(),a=null)})}),o=>l=>{const u=()=>{o([l].concat(t))};r===i?u():a=u}}function mM(...e){return t=>e.reduceRight(hM,t)}function xM(e){let t,r;const a=()=>t==null?void 0:t();return function(i,o){switch(i){case Ms:return o?r===o?void 0:(a(),r=o,t=Ar(e,o),t):(a(),Ll);case Ml:a(),r=null;return}}}function ut(e){let t=e;const r=xr();return((a,i)=>{switch(a){case bf:t=i;break;case Ms:{i(t);break}case rT:return t}return r(a,i)})}function Xn(e,t){return vf(ut(t),r=>zt(e,r))}function xr(){const e=[];return((t,r)=>{switch(t){case bf:e.slice().forEach(a=>{a(r)});return;case Ml:e.splice(0);return;case Ms:return e.push(r),()=>{const a=e.indexOf(r);a>-1&&e.splice(a,1)}}})}function Ba(e){return vf(xr(),t=>zt(e,t))}const yM={singleton:!0};function Cr(e,t=[],r=yM){const{singleton:a}=r;return{constructor:e,dependencies:t,id:bM(),singleton:a}}const bM=()=>Symbol("id");function vM(e){const t=new Map,r=({constructor:a,dependencies:i,id:o,singleton:l})=>{if(l&&t.has(o))return t.get(o);const u=a(i.map(d=>r(d)));return l&&t.set(o,u),u};return r(e)}function gn(...e){const t=xr(),r=Array.from({length:e.length});let a=0;const i=2**e.length-1;return e.forEach((o,l)=>{const u=2**l;Ar(o,d=>{r[l]=d,a|=u,a===i&&nr(t,r)})}),function(o,l){switch(o){case Ml:{Cv(t);return}case Ms:return a===i&&l(r),Ar(t,l)}}}function Yt(e,t=aT){return Qe(e,Xr(t))}function Wb(...e){return function(t,r){switch(t){case Ml:return;case Ms:return gM(...e.map(a=>Ar(a,r)))}}}const Nn={DEBUG:0,INFO:1,WARN:2,ERROR:3},kM={[Nn.DEBUG]:"debug",[Nn.ERROR]:"error",[Nn.INFO]:"log",[Nn.WARN]:"warn"},_M=()=>typeof globalThis>"u"?window:globalThis,Ls=Cr(()=>{const e=ut(Nn.ERROR);return{log:ut((t,r,a=Nn.INFO)=>{const i=_M().VIRTUOSO_LOG_LEVEL??Yr(e);a>=i&&console[kM[a]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,r)}),logLevel:e}},[],{singleton:!0});function wM(e){return"self"in e?e.document.documentElement:e}function iT(e){const t=wM(e);return t.ownerDocument.defaultView.getComputedStyle(t).direction==="rtl"}function ko(e,t){return iT(e)?-t:t}function F_(e,t){return iT(e)?-t:t}function Co(e,t,r){return Tv(e,t,r).callbackRef}function Tv(e,t,r){const a=Ft.useRef(null);let i=l=>{};const o=Ft.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(l=>{const u=()=>{const d=l[0].target;d.offsetParent!==null&&e(d)};r?u():requestAnimationFrame(u)}):null,[e,r]);return i=l=>{l&&t?(o==null||o.observe(l),a.current=l):(a.current&&(o==null||o.unobserve(a.current)),a.current=null)},{callbackRef:i,ref:a}}function SM(e,t,r,a,i,o,l,u,d){const f=Ft.useCallback(p=>{var N;const h=NM(p.children,t,u?"offsetWidth":"offsetHeight",i);let m=p.parentElement;for(;m.dataset.virtuosoScroller===void 0;)m=m.parentElement;const y=((N=m.lastElementChild)==null?void 0:N.dataset.viewportType)==="window";let v;y&&(v=m.ownerDocument.defaultView);const k=l?u?l.scrollWidth:l.scrollHeight:y?u?v.document.documentElement.scrollWidth:v.document.documentElement.scrollHeight:u?m.scrollWidth:m.scrollHeight,_=l?u?l.offsetWidth:l.offsetHeight:y?u?v.innerWidth:v.innerHeight:u?m.offsetWidth:m.offsetHeight,w=l?u?ko(l,l.scrollLeft):l.scrollTop:y?u?ko(v,v.scrollX||v.document.documentElement.scrollLeft):v.scrollY||v.document.documentElement.scrollTop:u?ko(m,m.scrollLeft):m.scrollTop;a({scrollHeight:k,scrollTop:Math.max(w,0),viewportHeight:_}),o==null||o(u?B_("column-gap",getComputedStyle(p).columnGap,i):B_("row-gap",getComputedStyle(p).rowGap,i)),h!==null&&e(h)},[e,t,i,o,l,a,u]);return Tv(f,r,d)}function NM(e,t,r,a){const i=e.length;if(i===0)return null;const o=[];for(let l=0;l<i;l++){const u=e.item(l);if(u.dataset.index===void 0)continue;const d=parseInt(u.dataset.index,10),f=parseFloat(u.dataset.knownSize),p=t(u,r);if(p===0&&a("Zero-sized element, this should not happen",{child:u},Nn.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 B_(e,t,r){return t!=="normal"&&(t==null?void 0:t.endsWith("px"))!==!0&&r(`${e} was not resolved to pixel value correctly`,t,Nn.WARN),t==="normal"?0:parseInt(t??"0",10)}const Rv=typeof document>"u"?Ft.useEffect:Ft.useLayoutEffect;function sT(e,t,r){const a=Ft.useRef(null),i=Ft.useCallback(d=>{if(!(d!=null&&d.offsetParent))return;const f=d.getBoundingClientRect(),p=f.width;let h,m;if(t){const y=t.getBoundingClientRect(),v=f.top-y.top;m=y.height-Math.max(0,v),h=v+t.scrollTop}else{const y=l.current.ownerDocument.defaultView;m=y.innerHeight-Math.max(0,f.top),h=f.top+y.scrollY}a.current={listHeight:f.height,offsetTop:h,visibleHeight:m,visibleWidth:p},e(a.current)},[e,t]),{callbackRef:o,ref:l}=Tv(i,!0,r),u=Ft.useCallback(()=>{i(l.current)},[i,l]);return Ft.useEffect(()=>{var f;if(t){t.addEventListener("scroll",u);const p=new ResizeObserver(()=>{requestAnimationFrame(u)});return p.observe(t),()=>{t.removeEventListener("scroll",u),p.unobserve(t)}}const d=(f=l.current)==null?void 0:f.ownerDocument.defaultView;return d==null||d.addEventListener("scroll",u),d==null||d.addEventListener("resize",u),()=>{d==null||d.removeEventListener("scroll",u),d==null||d.removeEventListener("resize",u)}},[u,t,l]),o}const sa=Cr(()=>{const e=xr(),t=xr(),r=ut(0),a=xr(),i=xr(),o=ut(0),l=xr(),u=xr(),d=ut(0),f=ut(0),p=ut(0),h=ut(0),m=xr(),y=xr(),v=ut(!1),k=ut(!1),_=ut(!1);return zt(Qe(e,Ct(({scrollTop:w})=>w)),t),zt(Qe(e,Ct(({scrollHeight:w})=>w)),u),zt(t,o),{deviation:r,deviationCommitted:a,fixedFooterHeight:p,fixedHeaderHeight:f,footerHeight:h,headerHeight:d,horizontalDirection:k,scrollBy:y,scrollContainerState:e,scrollHeight:u,scrollingInProgress:v,scrollTo:m,scrollTop:t,skipAnimationFrameInResizeObserver:_,smoothScrollTargetReached:i,statefulScrollTop:o,viewportHeight:l}},[],{singleton:!0}),Kc={lvl:0};function oT(e,t){const r=e.length;if(r===0)return[];let{index:a,value:i}=t(e[0]);const o=[];for(let l=1;l<r;l++){const{index:u,value:d}=t(e[l]);o.push({end:u-1,start:a,value:i}),a=u,i=d}return o.push({end:1/0,start:a,value:i}),o}function Pr(e){return e===Kc}function Yc(e,t){if(!Pr(e))return t===e.k?e.v:t<e.k?Yc(e.l,t):Yc(e.r,t)}function yi(e,t,r="k"){if(Pr(e))return[-1/0,void 0];if(Number(e[r])===t)return[e.k,e.v];if(Number(e[r])<t){const a=yi(e.r,t,r);return a[0]===-1/0?[e.k,e.v]:a}return yi(e.l,t,r)}function Pa(e,t,r){return Pr(e)?uT(t,r,1):t===e.k?Sn(e,{k:t,v:r}):t<e.k?z_(Sn(e,{l:Pa(e.l,t,r)})):z_(Sn(e,{r:Pa(e.r,t,r)}))}function El(){return Kc}function jl(e,t,r){if(Pr(e))return[];const a=yi(e,t)[0];return EM(Gb(e,a,r))}function Vb(e,t){if(Pr(e))return Kc;const{k:r,l:a,r:i}=e;if(t===r){if(Pr(a))return i;if(Pr(i))return a;const[o,l]=cT(a);return Kd(Sn(e,{k:o,l:lT(a),v:l}))}return t<r?Kd(Sn(e,{l:Vb(a,t)})):Kd(Sn(e,{r:Vb(i,t)}))}function _o(e){return Pr(e)?[]:[..._o(e.l),{k:e.k,v:e.v},..._o(e.r)]}function Gb(e,t,r){if(Pr(e))return[];const{k:a,l:i,r:o,v:l}=e;let u=[];return a>t&&(u=u.concat(Gb(i,t,r))),a>=t&&a<=r&&u.push({k:a,v:l}),a<=r&&(u=u.concat(Gb(o,t,r))),u}function Kd(e){const{l:t,lvl:r,r:a}=e;if(a.lvl>=r-1&&t.lvl>=r-1)return e;if(r>a.lvl+1){if(Sg(t))return dT(Sn(e,{lvl:r-1}));if(!Pr(t)&&!Pr(t.r))return Sn(t.r,{l:Sn(t,{r:t.r.l}),lvl:r,r:Sn(e,{l:t.r.r,lvl:r-1})});throw new Error("Unexpected empty nodes")}if(Sg(e))return Kb(Sn(e,{lvl:r-1}));if(!Pr(a)&&!Pr(a.l)){const i=a.l,o=Sg(i)?a.lvl-1:a.lvl;return Sn(i,{l:Sn(e,{lvl:r-1,r:i.l}),lvl:i.lvl+1,r:Kb(Sn(a,{l:i.r,lvl:o}))})}throw new Error("Unexpected empty nodes")}function Sn(e,t){return uT(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 lT(e){return Pr(e.r)?e.l:Kd(Sn(e,{r:lT(e.r)}))}function Sg(e){return Pr(e)||e.lvl>e.r.lvl}function cT(e){return Pr(e.r)?[e.k,e.v]:cT(e.r)}function uT(e,t,r,a=Kc,i=Kc){return{k:e,l:a,lvl:r,r:i,v:t}}function z_(e){return Kb(dT(e))}function dT(e){const{l:t}=e;return!Pr(t)&&t.lvl===e.lvl?Sn(t,{r:Sn(e,{l:t.r})}):e}function Kb(e){const{lvl:t,r}=e;return!Pr(r)&&!Pr(r.r)&&r.lvl===t&&r.r.lvl===t?Sn(r,{l:Sn(e,{r:r.l}),lvl:t+1}):e}function EM(e){return oT(e,({k:t,v:r})=>({index:t,value:r}))}function fT(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function Xc(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}const Av=Cr(()=>({recalcInProgress:ut(!1)}),[],{singleton:!0});function pT(e,t,r){return e[tf(e,t,r)]}function tf(e,t,r,a=0){let i=e.length-1;for(;a<=i;){const o=Math.floor((a+i)/2),l=e[o],u=r(l,t);if(u===0)return o;if(u===-1){if(i-a<2)return o-1;i=o-1}else{if(i===a)return o;a=o+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function jM(e,t,r,a){const i=tf(e,t,a),o=tf(e,r,a,i);return e.slice(i,o+1)}function Is(e,t){return Math.round(e.getBoundingClientRect()[t])}function kf(e){return!Pr(e.groupOffsetTree)}function Iv({index:e},t){return t===e?0:t<e?-1:1}function CM(){return{groupIndices:[],groupOffsetTree:El(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:El()}}function TM(e,t){let r=Pr(e)?0:1/0;for(const a of t){const{endIndex:i,size:o,startIndex:l}=a;if(r=Math.min(r,l),Pr(e)){e=Pa(e,0,o);continue}const u=jl(e,l-1,i+1);if(u.some(DM(a)))continue;let d=!1,f=!1;for(const{end:p,start:h,value:m}of u)d?(i>=h||o===m)&&(e=Vb(e,h)):(f=m!==o,d=!0),p>i&&i>=h&&m!==o&&(e=Pa(e,i+1,m));f&&(e=Pa(e,l,o))}return[e,r]}function RM(e){return e.groupIndex!==void 0}function AM({offset:e},t){return t===e?0:t<e?-1:1}function Qc(e,t,r){if(t.length===0)return 0;const{index:a,offset:i,size:o}=pT(t,e,Iv),l=e-a,u=o*l+(l-1)*r+i;return u>0?u+r:u}function gT(e,t){if(!kf(t))return e;let r=0;for(;t.groupIndices[r]<=e+r;)r++;return e+r}function hT(e,t,r){if(RM(e))return t.groupIndices[e.groupIndex]+1;const a=e.index==="LAST"?r:e.index;let i=gT(a,t);return i=Math.max(0,Math.min(r,i)),i}function IM(e,t,r,a=0){return a>0&&(t=Math.max(t,pT(e,a,Iv).offset)),oT(jM(e,t,r,AM),OM)}function MM(e,[t,r,a,i]){t.length>0&&a("received item sizes",t,Nn.DEBUG);const o=e.sizeTree;let l=o,u=0;if(r.length>0&&Pr(o)&&t.length===2){const m=t[0].size,y=t[1].size;l=r.reduce((v,k)=>Pa(Pa(v,k,m),k+1,y),l)}else[l,u]=TM(l,t);if(l===o)return e;const{lastIndex:d,lastOffset:f,lastSize:p,offsetTree:h}=Yb(e.offsetTree,u,l,i);return{groupIndices:r,groupOffsetTree:r.reduce((m,y)=>Pa(m,y,Qc(y,h,i)),El()),lastIndex:d,lastOffset:f,lastSize:p,offsetTree:h,sizeTree:l}}function LM(e){return _o(e).map(({k:t,v:r},a,i)=>{const o=i[a+1];return{endIndex:o===void 0?1/0:o.k-1,size:r,startIndex:t}})}function U_(e,t){let r=0,a=0;for(;r<e;)r+=t[a+1]-t[a]-1,a++;return a-(r===e?0:1)}function Yb(e,t,r,a){let i=e,o=0,l=0,u=0,d=0;if(t===0)i=[];else{d=tf(i,t-1,Iv),u=i[d].offset;const f=yi(r,t-1);o=f[0],l=f[1],i.length&&i[d].size===yi(r,t)[1]&&(d-=1),i=i.slice(0,d+1)}for(const{start:f,value:p}of jl(r,t,1/0)){const h=f-o,m=h*l+u+h*a;i.push({index:f,offset:m,size:p}),o=f,u=m,l=p}return{lastIndex:o,lastOffset:u,lastSize:l,offsetTree:i}}function OM(e){return{index:e.index,value:e}}function DM(e){const{endIndex:t,size:r,startIndex:a}=e;return i=>i.start===a&&(i.end===t||i.end===1/0)&&i.value===r}const PM={offsetHeight:"height",offsetWidth:"width"},Oi=Cr(([{log:e},{recalcInProgress:t}])=>{const r=xr(),a=xr(),i=Xn(a,0),o=xr(),l=xr(),u=ut(0),d=ut([]),f=ut(void 0),p=ut(void 0),h=ut(void 0),m=ut(void 0),y=ut((j,M)=>Is(j,PM[M])),v=ut(void 0),k=ut(0),_=CM(),w=Xn(Qe(r,cr(d,e,k),Li(MM,_),Xr()),_),N=Xn(Qe(d,Xr(),Li((j,M)=>({current:M,prev:j.current}),{current:[],prev:[]}),Ct(({prev:j})=>j)),[]);zt(Qe(d,Xt(j=>j.length>0),cr(w,k),Ct(([j,M,L])=>{const I=j.reduce((B,z,ee)=>Pa(B,z,Qc(z,M.offsetTree,L)||ee),El());return{...M,groupIndices:j,groupOffsetTree:I}})),w),zt(Qe(a,cr(w),Xt(([j,{lastIndex:M}])=>j<M),Ct(([j,{lastIndex:M,lastSize:L}])=>[{endIndex:M,size:L,startIndex:j}])),r),zt(f,p);const E=Xn(Qe(f,Ct(j=>j===void 0)),!0);zt(Qe(p,Xt(j=>j!==void 0&&Pr(Yr(w).sizeTree)),Ct(j=>{const M=Yr(h),L=Yr(d).length>0;return M!==void 0&&M!==0?L?[{endIndex:0,size:M,startIndex:0},{endIndex:1,size:j,startIndex:1}]:[]:[{endIndex:0,size:j,startIndex:0}]})),r),zt(Qe(m,Xt(j=>j!==void 0&&j.length>0&&Pr(Yr(w).sizeTree)),Ct(j=>{const M=[];let L=j[0],I=0;for(let B=1;B<j.length;B++){const z=j[B];z!==L&&(M.push({endIndex:B-1,size:L,startIndex:I}),L=z,I=B)}return M.push({endIndex:j.length-1,size:L,startIndex:I}),M})),r),zt(Qe(d,cr(h,p),Xt(([,j,M])=>j!==void 0&&M!==void 0),Ct(([j,M,L])=>{const I=[];for(let B=0;B<j.length;B++){const z=j[B],ee=j[B+1];I.push({startIndex:z,endIndex:z,size:M}),ee!==void 0&&I.push({startIndex:z+1,endIndex:ee-1,size:L})}return I})),r);const A=Ba(Qe(r,cr(w),Li(({sizes:j},[M,L])=>({changed:L!==j,sizes:L}),{changed:!1,sizes:_}),Ct(j=>j.changed)));Ar(Qe(u,Li((j,M)=>({diff:j.prev-M,prev:M}),{diff:0,prev:0}),Ct(j=>j.diff)),j=>{const{groupIndices:M}=Yr(w);if(j>0)nr(t,!0),nr(o,j+U_(j,M));else if(j<0){const L=Yr(N);L.length>0&&(j-=U_(-j,L)),nr(l,j)}}),Ar(Qe(u,cr(e)),([j,M])=>{j<0&&M("`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},Nn.ERROR)});const T=Ba(o);zt(Qe(o,cr(w),Ct(([j,M])=>{const L=M.groupIndices.length>0,I=[],B=M.lastSize;if(L){const z=Yc(M.sizeTree,0);let ee=0,V=0;for(;ee<j;){const K=M.groupIndices[V],H=M.groupIndices.length===V+1?1/0:M.groupIndices[V+1]-K-1;I.push({endIndex:K,size:z,startIndex:K}),I.push({endIndex:K+1+H-1,size:B,startIndex:K+1}),V++,ee+=H+1}const D=_o(M.sizeTree);return ee!==j&&D.shift(),D.reduce((K,{k:H,v:J})=>{let ne=K.ranges;return K.prevSize!==0&&(ne=[...K.ranges,{endIndex:H+j-1,size:K.prevSize,startIndex:K.prevIndex}]),{prevIndex:H+j,prevSize:J,ranges:ne}},{prevIndex:j,prevSize:0,ranges:I}).ranges}return _o(M.sizeTree).reduce((z,{k:ee,v:V})=>({prevIndex:ee+j,prevSize:V,ranges:[...z.ranges,{endIndex:ee+j-1,size:z.prevSize,startIndex:z.prevIndex}]}),{prevIndex:0,prevSize:B,ranges:[]}).ranges})),r);const C=Ba(Qe(l,cr(w,k),Ct(([j,{offsetTree:M},L])=>{const I=-j;return Qc(I,M,L)})));return zt(Qe(l,cr(w,k),Ct(([j,M,L])=>{if(M.groupIndices.length>0){if(Pr(M.sizeTree))return M;let B=El();const z=Yr(N);let ee=0,V=0,D=0;for(;ee<-j;){D=z[V];const K=z[V+1]-D-1;V++,ee+=K+1}if(B=_o(M.sizeTree).reduce((K,{k:H,v:J})=>Pa(K,Math.max(0,H+j),J),B),ee!==-j){const K=Yc(M.sizeTree,D);B=Pa(B,0,K);const H=yi(M.sizeTree,-j+1)[1];B=Pa(B,1,H)}return{...M,sizeTree:B,...Yb(M.offsetTree,0,B,L)}}const I=_o(M.sizeTree).reduce((B,{k:z,v:ee})=>Pa(B,Math.max(0,z+j),ee),El());return{...M,sizeTree:I,...Yb(M.offsetTree,0,I,L)}})),w),{beforeUnshiftWith:T,data:v,defaultItemSize:p,firstItemIndex:u,fixedItemSize:f,fixedGroupSize:h,gap:k,groupIndices:d,heightEstimates:m,itemSize:y,listRefresh:A,shiftWith:l,shiftWithOffset:C,sizeRanges:r,sizes:w,statefulTotalCount:i,totalCount:a,trackItemSizes:E,unshiftWith:o}},Qr(Ls,Av),{singleton:!0});function FM(e){return e.reduce((t,r)=>(t.groupIndices.push(t.totalCount),t.totalCount+=r+1,t),{groupIndices:[],totalCount:0})}const mT=Cr(([{groupIndices:e,sizes:t,totalCount:r},{headerHeight:a,scrollTop:i}])=>{const o=xr(),l=xr(),u=Ba(Qe(o,Ct(FM)));return zt(Qe(u,Ct(d=>d.totalCount)),r),zt(Qe(u,Ct(d=>d.groupIndices)),e),zt(Qe(gn(i,t,a),Xt(([d,f])=>kf(f)),Ct(([d,f,p])=>yi(f.groupOffsetTree,Math.max(d-p,0),"v")[0]),Xr(),Ct(d=>[d])),l),{groupCounts:o,topItemsIndexes:l}},Qr(Oi,sa)),Os=Cr(([{log:e}])=>{const t=ut(!1),r=Ba(Qe(t,Xt(a=>a),Xr()));return Ar(t,a=>{a&&Yr(e)("props updated",{},Nn.DEBUG)}),{didMount:r,propsReady:t}},Qr(Ls),{singleton:!0}),BM=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function xT(e){const t=typeof e=="number"?{index:e}:{...e};return t.align||(t.align="start"),(!t.behavior||!BM)&&(t.behavior="auto"),t.offset===void 0&&(t.offset=0),t}const su=Cr(([{gap:e,listRefresh:t,sizes:r,totalCount:a},{fixedFooterHeight:i,fixedHeaderHeight:o,footerHeight:l,headerHeight:u,scrollingInProgress:d,scrollTo:f,smoothScrollTargetReached:p,viewportHeight:h},{log:m}])=>{const y=xr(),v=xr(),k=ut(0);let _=null,w=null,N=null;function E(){_!==null&&(_(),_=null),N!==null&&(N(),N=null),w&&(clearTimeout(w),w=null),nr(d,!1)}return zt(Qe(y,cr(r,h,a,k,u,l,m),cr(e,o,i),Ct(([[A,T,C,j,M,L,I,B],z,ee,V])=>{const D=xT(A),{align:K,behavior:H,offset:J}=D,ne=j-1,P=hT(D,T,ne);let U=Qc(P,T.offsetTree,z)+L;K==="end"?(U+=ee+yi(T.sizeTree,P)[1]-C+V,P===ne&&(U+=I)):K==="center"?U+=(ee+yi(T.sizeTree,P)[1]-C+V)/2:U-=M,J!==void 0&&J!==0&&(U+=J);const X=F=>{E(),F?(B("retrying to scroll to",{location:A},Nn.DEBUG),nr(y,A)):(nr(v,!0),B("list did not change, scroll successful",{},Nn.DEBUG))};if(E(),H==="smooth"){let F=!1;N=Ar(t,Z=>{F=F||Z}),_=mi(p,()=>{X(F)})}else _=mi(Qe(t,zM(150)),X);return w=setTimeout(()=>{E()},1200),nr(d,!0),B("scrolling from index to",{behavior:H,index:P,top:U},Nn.DEBUG),{behavior:H,top:U}})),f),{scrollTargetReached:v,scrollToIndex:y,topListHeight:k}},Qr(Oi,sa,Ls),{singleton:!0});function zM(e){return t=>{const r=setTimeout(()=>{t(!1)},e);return a=>{a&&(t(!0),clearTimeout(r))}}}function Mv(e,t){e===0?t():requestAnimationFrame(()=>{Mv(e-1,t)})}function Lv(e,t){if(e===void 0)return 0;const r=t-1,a=typeof e=="number"?e:e.index==="LAST"?r:e.index;return Math.max(0,Math.min(a,r))}function Xb(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 ou=Cr(([{defaultItemSize:e,listRefresh:t,sizes:r},{scrollTop:a},{scrollTargetReached:i,scrollToIndex:o},{didMount:l}])=>{const u=ut(!0),d=ut(0),f=ut(!0);return zt(Qe(l,cr(d),Xt(([p,h])=>!Xb(h)),Mi(!1)),u),zt(Qe(l,cr(d),Xt(([p,h])=>!Xb(h)),Mi(!1)),f),Ar(Qe(gn(t,l),cr(u,r,e,f),Xt(([[,p],h,{sizeTree:m},y,v])=>p&&(!Pr(m)||jv(y))&&!h&&!v),cr(d)),([,p])=>{if(p===void 0){nr(u,!0),nr(f,!0);return}mi(i,()=>{nr(f,!0)}),Mv(4,()=>{mi(a,()=>{nr(u,!0)}),nr(o,p)})}),{initialItemFinalLocationReached:f,initialTopMostItemIndex:d,scrolledToInitialItem:u}},Qr(Oi,sa,su,Os),{singleton:!0});function yT(e,t){return Math.abs(e-t)<1.01}const Zc="up",Bc="down",UM="none",qM={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},HM=0,lu=Cr(([{footerHeight:e,headerHeight:t,scrollBy:r,scrollContainerState:a,scrollTop:i,viewportHeight:o}])=>{const l=ut(!1),u=ut(!0),d=xr(),f=xr(),p=ut(4),h=ut(HM),m=Xn(Qe(Wb(Qe(Yt(i),No(1),Mi(!0)),Qe(Yt(i),No(1),Mi(!1),P_(100))),Xr()),!1),y=Xn(Qe(Wb(Qe(r,Mi(!0)),Qe(r,Mi(!1),P_(200))),Xr()),!1);zt(Qe(gn(Yt(i),Yt(h)),Ct(([N,E])=>N<=E),Xr()),u),zt(Qe(u,Zi(50)),f);const v=Ba(Qe(gn(a,Yt(o),Yt(t),Yt(e),Yt(p)),Li((N,[{scrollHeight:E,scrollTop:A},T,C,j,M])=>{const L=A+T-E>-M,I={scrollHeight:E,scrollTop:A,viewportHeight:T};if(L){let z,ee;return A>N.state.scrollTop?(z="SCROLLED_DOWN",ee=N.state.scrollTop-A):(z="SIZE_DECREASED",ee=N.state.scrollTop-A||N.scrollTopDelta),{atBottom:!0,atBottomBecause:z,scrollTopDelta:ee,state:I}}let B;return I.scrollHeight>N.state.scrollHeight?B="SIZE_INCREASED":T<N.state.viewportHeight?B="VIEWPORT_HEIGHT_DECREASING":A<N.state.scrollTop?B="SCROLLING_UPWARDS":B="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:B,state:I}},qM),Xr((N,E)=>N!==void 0&&N.atBottom===E.atBottom))),k=Xn(Qe(a,Li((N,{scrollHeight:E,scrollTop:A,viewportHeight:T})=>{if(!yT(N.scrollHeight,E)){const C=E-(A+T)<1;return N.scrollTop!==A&&C?{changed:!0,jump:N.scrollTop-A,scrollHeight:E,scrollTop:A}:{changed:!0,jump:0,scrollHeight:E,scrollTop:A}}return{changed:!1,jump:0,scrollHeight:E,scrollTop:A}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),Xt(N=>N.changed),Ct(N=>N.jump)),0);zt(Qe(v,Ct(N=>N.atBottom)),l),zt(Qe(l,Zi(50)),d);const _=ut(Bc);zt(Qe(a,Ct(({scrollTop:N})=>N),Xr(),Li((N,E)=>Yr(y)?{direction:N.direction,prevScrollTop:E}:{direction:E<N.prevScrollTop?Zc:Bc,prevScrollTop:E},{direction:Bc,prevScrollTop:0}),Ct(N=>N.direction)),_),zt(Qe(a,Zi(50),Mi(UM)),_);const w=ut(0);return zt(Qe(m,Xt(N=>!N),Mi(0)),w),zt(Qe(i,Zi(100),cr(m),Xt(([N,E])=>E),Li(([N,E],[A])=>[E,A],[0,0]),Ct(([N,E])=>E-N)),w),{atBottomState:v,atBottomStateChange:d,atBottomThreshold:p,atTopStateChange:f,atTopThreshold:h,isAtBottom:l,isAtTop:u,isScrolling:m,lastJumpDueToItemResize:k,scrollDirection:_,scrollVelocity:w}},Qr(sa)),Jc="top",eu="bottom",q_="none";function H_(e,t,r){return typeof e=="number"?r===Zc&&t===Jc||r===Bc&&t===eu?e:0:r===Zc?t===Jc?e.main:e.reverse:t===eu?e.main:e.reverse}function $_(e,t){return typeof e=="number"?e:e[t]??0}const Ov=Cr(([{deviation:e,fixedHeaderHeight:t,headerHeight:r,scrollTop:a,viewportHeight:i}])=>{const o=xr(),l=ut(0),u=ut(0),d=ut(0),f=Xn(Qe(gn(Yt(a),Yt(i),Yt(r),Yt(o,Xc),Yt(d),Yt(l),Yt(t),Yt(e),Yt(u)),Ct(([p,h,m,[y,v],k,_,w,N,E])=>{const A=p-N,T=_+w,C=Math.max(m-A,0);let j=q_;const M=$_(E,Jc),L=$_(E,eu);return y-=N,y+=m+w,v+=m+w,v-=N,y>p+T-M&&(j=Zc),v<p-C+h+L&&(j=Bc),j!==q_?[Math.max(A-m-H_(k,Jc,j)-M,0),A-C-w+h+H_(k,eu,j)+L]:null}),Xt(p=>p!==null),Xr(Xc)),[0,0]);return{increaseViewportBy:u,listBoundary:o,overscan:d,topListHeight:l,visibleRange:f}},Qr(sa),{singleton:!0});function $M(e,t,r){if(kf(t)){const a=gT(e,t);return[{index:yi(t.groupOffsetTree,a)[0],offset:0,size:0},{data:r==null?void 0:r[0],index:a,offset:0,size:0}]}return[{data:r==null?void 0:r[0],index:e,offset:0,size:0}]}const Ng={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function Yd(e,t,r,a,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=r-l,m=u+h*d+(h-1)*a,y=f,v=m-p;return{bottom:p,firstItemIndex:o,items:W_(e,i,o),offsetBottom:v,offsetTop:f,top:y,topItems:W_(t,i,o),topListHeight:t.reduce((k,_)=>_.size+k,0),totalCount:r}}function bT(e,t,r,a,i,o){let l=0;if(r.groupIndices.length>0)for(const p of r.groupIndices){if(p-l>=e)break;l++}const u=e+l,d=Lv(t,u),f=Array.from({length:u}).map((p,h)=>({data:o[h+d],index:h+d,offset:0,size:0}));return Yd(f,[],u,i,r,a)}function W_(e,t,r){if(e.length===0)return[];if(!kf(t))return e.map(f=>({...f,index:f.index+r,originalIndex:f.index}));const a=e[0].index,i=e[e.length-1].index,o=[],l=jl(t.groupOffsetTree,a,i);let u,d=0;for(const f of e){(!u||u.end<f.index)&&(u=l.shift(),d=t.groupIndices.indexOf(u.start));let p;f.index===u.start?p={index:d,type:"group"}:p={groupIndex:d,index:f.index-(d+1)+r},o.push({...p,data:f.data,offset:f.offset,originalIndex:f.index,size:f.size})}return o}function V_(e,t){return e===void 0?0:typeof e=="number"?e:e[t]??0}const To=Cr(([{data:e,firstItemIndex:t,gap:r,sizes:a,totalCount:i},o,{listBoundary:l,topListHeight:u,visibleRange:d},{initialTopMostItemIndex:f,scrolledToInitialItem:p},{topListHeight:h},m,{didMount:y},{recalcInProgress:v}])=>{const k=ut([]),_=ut(0),w=xr(),N=ut(0);zt(o.topItemsIndexes,k);const E=Xn(Qe(gn(y,v,Yt(d,Xc),Yt(i),Yt(a),Yt(f),p,Yt(k),Yt(t),Yt(r),Yt(N),e),Xt(([j,M,,L,,,,,,,,I])=>{const B=I!==void 0&&I.length!==L;return j&&!M&&!B}),Ct(([,,[j,M],L,I,B,z,ee,V,D,K,H])=>{var fe,ke;const J=I,{offsetTree:ne,sizeTree:P}=J,U=Yr(_);if(L===0)return{...Ng,totalCount:L};if(j===0&&M===0)return U===0?{...Ng,totalCount:L}:bT(U,B,I,V,D,H||[]);if(Pr(P))return U>0?null:Yd($M(Lv(B,L),J,H),[],L,D,J,V);const X=[];if(ee.length>0){const Fe=ee[0],Ve=ee[ee.length-1];let Ge=0;for(const qe of jl(P,Fe,Ve)){const Ce=qe.value,He=Math.max(qe.start,Fe),ze=Math.min(qe.end,Ve);for(let gt=He;gt<=ze;gt++)X.push({data:H==null?void 0:H[gt],index:gt,offset:Ge,size:Ce}),Ge+=Ce}}if(!z)return Yd([],X,L,D,J,V);const F=ee.length>0?ee[ee.length-1]+1:0,Z=IM(ne,j,M,F);if(Z.length===0)return null;const W=L-1,G=vf([],Fe=>{for(const Ve of Z){const Ge=Ve.value;let qe=Ge.offset,Ce=Ve.start;const He=Ge.size;if(Ge.offset<j){Ce+=Math.floor((j-Ge.offset+D)/(He+D));const gt=Ce-Ve.start;qe+=gt*He+gt*D}Ce<F&&(qe+=(F-Ce)*He,Ce=F);const ze=Math.min(Ve.end,W);for(let gt=Ce;gt<=ze&&!(qe>=M);gt++)Fe.push({data:H==null?void 0:H[gt],index:gt,offset:qe,size:He}),qe+=He+D}}),oe=V_(K,Jc),Q=V_(K,eu);if(G.length>0&&(oe>0||Q>0)){const Fe=G[0],Ve=G[G.length-1];if(oe>0&&Fe.index>F){const Ge=Math.min(oe,Fe.index-F),qe=[];let Ce=Fe.offset;for(let He=Fe.index-1;He>=Fe.index-Ge;He--){const ze=((fe=jl(P,He,He)[0])==null?void 0:fe.value)??Fe.size;Ce-=ze+D,qe.unshift({data:H==null?void 0:H[He],index:He,offset:Ce,size:ze})}G.unshift(...qe)}if(Q>0&&Ve.index<W){const Ge=Math.min(Q,W-Ve.index);let qe=Ve.offset+Ve.size+D;for(let Ce=Ve.index+1;Ce<=Ve.index+Ge;Ce++){const He=((ke=jl(P,Ce,Ce)[0])==null?void 0:ke.value)??Ve.size;G.push({data:H==null?void 0:H[Ce],index:Ce,offset:qe,size:He}),qe+=He+D}}}return Yd(G,X,L,D,J,V)}),Xt(j=>j!==null),Xr()),Ng);zt(Qe(e,Xt(jv),Ct(j=>j==null?void 0:j.length)),i),zt(Qe(E,Ct(j=>j.topListHeight)),h),zt(h,u),zt(Qe(E,Ct(j=>[j.top,j.bottom])),l),zt(Qe(E,Ct(j=>j.items)),w);const A=Ba(Qe(E,Xt(({items:j})=>j.length>0),cr(i,e),Xt(([{items:j},M])=>j[j.length-1].originalIndex===M-1),Ct(([,j,M])=>[j-1,M]),Xr(Xc),Ct(([j])=>j))),T=Ba(Qe(E,Zi(200),Xt(({items:j,topItems:M})=>j.length>0&&j[0].originalIndex===M.length),Ct(({items:j})=>j[0].index),Xr())),C=Ba(Qe(E,Xt(({items:j})=>j.length>0),Ct(({items:j})=>{let M=0,L=j.length-1;for(;j[M].type==="group"&&M<L;)M++;for(;j[L].type==="group"&&L>M;)L--;return{endIndex:j[L].index,startIndex:j[M].index}}),Xr(fT)));return{endReached:A,initialItemCount:_,itemsRendered:w,listState:E,minOverscanItemCount:N,rangeChanged:C,startReached:T,topItemsIndexes:k,...m}},Qr(Oi,mT,Ov,ou,su,lu,Os,Av),{singleton:!0}),vT=Cr(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:r,headerHeight:a},{listState:i}])=>{const o=xr(),l=Xn(Qe(gn(r,e,a,t,i),Ct(([u,d,f,p,h])=>u+d+f+p+h.offsetBottom+h.bottom)),0);return zt(Yt(l),o),{totalListHeight:l,totalListHeightChanged:o}},Qr(sa,To),{singleton:!0}),WM=Cr(([{viewportHeight:e},{totalListHeight:t}])=>{const r=ut(!1),a=Xn(Qe(gn(r,e,t),Xt(([i])=>i),Ct(([,i,o])=>Math.max(0,i-o)),Zi(0),Xr()),0);return{alignToBottom:r,paddingTopAddition:a}},Qr(sa,vT),{singleton:!0}),kT=Cr(()=>({context:ut(null)})),VM=({itemBottom:e,itemTop:t,locationParams:{align:r,behavior:a,...i},viewportBottom:o,viewportTop:l})=>t<l?{...i,align:r??"start",...a===void 0?{}:{behavior:a}}:e>o?{...i,align:r??"end",...a===void 0?{}:{behavior:a}}:null,_T=Cr(([{gap:e,sizes:t,totalCount:r},{fixedFooterHeight:a,fixedHeaderHeight:i,headerHeight:o,scrollingInProgress:l,scrollTop:u,viewportHeight:d},{scrollToIndex:f}])=>{const p=xr();return zt(Qe(p,cr(t,d,r,o,i,a,u),cr(e),Ct(([[h,m,y,v,k,_,w,N],E])=>{const{calculateViewLocation:A=VM,done:T,...C}=h,j=hT(h,m,v-1),M=Qc(j,m.offsetTree,E)+k+_,L=M+yi(m.sizeTree,j)[1],I=N+_,B=N+y-w,z=A({itemBottom:L,itemTop:M,locationParams:C,viewportBottom:B,viewportTop:I});return z===null?T==null||T():T&&mi(Qe(l,Xt(ee=>!ee),No(Yr(l)?1:2)),T),z}),Xt(h=>h!==null)),f),{scrollIntoView:p}},Qr(Oi,sa,su,To,Ls),{singleton:!0});function G_(e){return e===!1?!1:e==="smooth"?"smooth":"auto"}const GM=(e,t)=>typeof e=="function"?G_(e(t)):t&&G_(e),KM=Cr(([{listRefresh:e,totalCount:t,fixedItemSize:r,data:a},{atBottomState:i,isAtBottom:o},{scrollToIndex:l},{scrolledToInitialItem:u},{didMount:d,propsReady:f},{log:p},{scrollingInProgress:h},{context:m},{scrollIntoView:y}])=>{const v=ut(!1),k=xr();let _=null;function w(T){nr(l,{align:"end",behavior:T,index:"LAST"})}Ar(Qe(gn(Qe(Yt(t),No(1)),d),cr(Yt(v),o,u,h),Ct(([[T,C],j,M,L,I])=>{let B=C&&L,z="auto";return B&&(z=GM(j,M||I),B=B&&z!==!1),{followOutputBehavior:z,shouldFollow:B,totalCount:T}}),Xt(({shouldFollow:T})=>T)),({followOutputBehavior:T,totalCount:C})=>{_!==null&&(_(),_=null),Yr(r)===void 0?_=mi(e,()=>{Yr(p)("following output to ",{totalCount:C},Nn.DEBUG),w(T),_=null}):requestAnimationFrame(()=>{Yr(p)("following output to ",{totalCount:C},Nn.DEBUG),w(T)})});function N(T){const C=mi(i,j=>{T&&!j.atBottom&&j.notAtBottomBecause==="SIZE_INCREASED"&&_===null&&(Yr(p)("scrolling to bottom due to increased size",{},Nn.DEBUG),w("auto"))});setTimeout(C,100)}Ar(Qe(gn(Yt(v),t,f),Xt(([T,,C])=>T!==!1&&C),Li(({value:T},[,C])=>({refreshed:T===C,value:C}),{refreshed:!1,value:0}),Xt(({refreshed:T})=>T),cr(v,t)),([,T])=>{Yr(u)&&N(T!==!1)}),Ar(k,()=>{N(Yr(v)!==!1)}),Ar(gn(Yt(v),i),([T,C])=>{T!==!1&&!C.atBottom&&C.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&w("auto")});const E=ut(null),A=xr();return zt(Wb(Qe(Yt(a),Ct(T=>(T==null?void 0:T.length)??0)),Qe(Yt(t))),A),Ar(Qe(gn(Qe(A,No(1)),d),cr(Yt(E),u,h,m),Ct(([[T,C],j,M,L,I])=>C&&M&&(j==null?void 0:j({context:I,totalCount:T,scrollingInProgress:L}))),Xt(T=>!!T),Zi(0)),T=>{_!==null&&(_(),_=null),Yr(r)===void 0?_=mi(e,()=>{Yr(p)("scrolling into view",{}),nr(y,T),_=null}):requestAnimationFrame(()=>{Yr(p)("scrolling into view",{}),nr(y,T)})}),{autoscrollToBottom:k,followOutput:v,scrollIntoViewOnChange:E}},Qr(Oi,lu,su,ou,Os,Ls,sa,kT,_T)),YM=Cr(([{data:e,firstItemIndex:t,gap:r,sizes:a},{initialTopMostItemIndex:i},{initialItemCount:o,listState:l},{didMount:u}])=>(zt(Qe(u,cr(o),Xt(([,d])=>d!==0),cr(i,a,t,r,e),Ct(([[,d],f,p,h,m,y=[]])=>bT(d,f,p,h,m,y))),l),{}),Qr(Oi,ou,To,Os),{singleton:!0}),XM=Cr(([{didMount:e},{scrollTo:t},{listState:r}])=>{const a=ut(0);return Ar(Qe(e,cr(a),Xt(([,i])=>i!==0),Ct(([,i])=>({top:i}))),i=>{mi(Qe(r,No(1),Xt(o=>o.items.length>1)),()=>{requestAnimationFrame(()=>{nr(t,i)})})}),{initialScrollTop:a}},Qr(Os,sa,To),{singleton:!0}),wT=Cr(([{scrollVelocity:e}])=>{const t=ut(!1),r=xr(),a=ut(!1);return zt(Qe(e,cr(a,t,r),Xt(([i,o])=>o!==!1&&o!==void 0),Ct(([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}),Xr()),t),Ar(Qe(gn(t,e,r),cr(a)),([[i,o,l],u])=>{i&&u!==!1&&u!==void 0&&u.change&&u.change(o,l)}),{isSeeking:t,scrollSeekConfiguration:a,scrollSeekRangeChanged:r,scrollVelocity:e}},Qr(lu),{singleton:!0}),Dv=Cr(([{scrollContainerState:e,scrollTo:t}])=>{const r=xr(),a=xr(),i=xr(),o=ut(!1),l=ut(void 0);return zt(Qe(gn(r,a),Ct(([{scrollTop:u,viewportHeight:d},{offsetTop:f,listHeight:p}])=>({scrollHeight:p,scrollTop:Math.max(0,u-f),viewportHeight:d}))),e),zt(Qe(t,cr(a),Ct(([u,{offsetTop:d}])=>({...u,top:u.top+d}))),i),{customScrollParent:l,useWindowScroll:o,windowScrollContainerState:r,windowScrollTo:i,windowViewportRect:a}},Qr(sa)),QM=Cr(([{sizeRanges:e,sizes:t},{headerHeight:r,scrollTop:a},{initialTopMostItemIndex:i},{didMount:o},{useWindowScroll:l,windowScrollContainerState:u,windowViewportRect:d}])=>{const f=xr(),p=ut(void 0),h=ut(null),m=ut(null);return zt(u,h),zt(d,m),Ar(Qe(f,cr(t,a,l,h,m,r)),([y,v,k,_,w,N,E])=>{const A=LM(v.sizeTree);_&&w!==null&&N!==null&&(k=w.scrollTop-N.offsetTop),k-=E,y({ranges:A,scrollTop:k})}),zt(Qe(p,Xt(jv),Ct(ZM)),i),zt(Qe(o,cr(p),Xt(([,y])=>y!==void 0),Xr(),Ct(([,y])=>y.ranges)),e),{getState:f,restoreStateFrom:p}},Qr(Oi,sa,ou,Os,Dv));function ZM(e){return{align:"start",index:0,offset:e.scrollTop}}const JM=Cr(([{topItemsIndexes:e}])=>{const t=ut(0);return zt(Qe(t,Xt(r=>r>=0),Ct(r=>Array.from({length:r}).map((a,i)=>i))),e),{topItemCount:t}},Qr(To));function ST(e){let t=!1,r;return(()=>(t||(t=!0,r=e()),r))}const eL=ST(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),tL=Cr(([{deviation:e,deviationCommitted:t,scrollBy:r,scrollingInProgress:a,scrollTop:i},{isAtBottom:o,isScrolling:l,lastJumpDueToItemResize:u,scrollDirection:d},{listState:f},{beforeUnshiftWith:p,gap:h,shiftWithOffset:m,sizes:y},{log:v},{recalcInProgress:k}])=>{const _=Ba(Qe(f,cr(u),Li(([,A,T,C],[{bottom:j,items:M,offsetBottom:L,totalCount:I},B])=>{const z=j+L;let ee=0;return T===I&&A.length>0&&M.length>0&&(M[0].originalIndex===0&&A[0].originalIndex===0||(ee=z-C,ee!==0&&(ee+=B))),[ee,M,I,z]},[0,[],0,0]),Xt(([A])=>A!==0),cr(i,d,a,o,v,k),Xt(([,A,T,C,,,j])=>!j&&!C&&A!==0&&T===Zc),Ct(([[A],,,,,T])=>(T("Upward scrolling compensation",{amount:A},Nn.DEBUG),A))));function w(A){A>0?(nr(r,{behavior:"auto",top:-A}),nr(e,0)):(nr(e,0),nr(r,{behavior:"auto",top:-A}))}Ar(Qe(_,cr(e,l)),([A,T,C])=>{C&&eL()?nr(e,T-A):w(-A)}),Ar(Qe(gn(Xn(l,!1),e,k),Xt(([A,T,C])=>!A&&!C&&T!==0),Ct(([A,T])=>T),Zi(1)),w),zt(Qe(m,Ct(A=>({top:-A}))),r);let N=null;function E(){if(N===null)return;const{offset:A}=N;N=null,nr(r,{top:A}),requestAnimationFrame(()=>{nr(e,0),nr(k,!1)})}return Ar(t,A=>{N===null||!N.acknowledgeable||A===N.offset&&E()}),Ar(Qe(p,cr(y,h),Ct(([A,{groupIndices:T,lastSize:C,sizeTree:j},M])=>{function L(V){return V*(C+M)}if(T.length===0)return L(A);let I=0;const B=Yc(j,0);let z=0,ee=0;for(;z<A;){z++,I+=B;let V=T.length===ee+1?1/0:T[ee+1]-T[ee]-1;z+V>A&&(I-=B,V=A-z+1),z+=V,I+=L(V),ee++}return I})),A=>{N={acknowledgeable:Yr(e)!==A,offset:A},nr(e,A),requestAnimationFrame(E)}),{deviation:e}},Qr(sa,lu,To,Oi,Ls,Av)),rL=Cr(([e,t,r,a,i,o,l,u,d,f,p])=>({...e,...t,...r,...a,...i,...o,...l,...u,...d,...f,...p}),Qr(Ov,YM,Os,wT,vT,XM,WM,Dv,_T,Ls,kT)),NT=Cr(([{data:e,defaultItemSize:t,firstItemIndex:r,fixedItemSize:a,fixedGroupSize:i,gap:o,groupIndices:l,heightEstimates:u,itemSize:d,sizeRanges:f,sizes:p,statefulTotalCount:h,totalCount:m,trackItemSizes:y},{initialItemFinalLocationReached:v,initialTopMostItemIndex:k,scrolledToInitialItem:_},w,N,E,A,{scrollToIndex:T},C,{topItemCount:j},{groupCounts:M},L])=>{const{listState:I,minOverscanItemCount:B,topItemsIndexes:z,rangeChanged:ee,...V}=A;return zt(ee,L.scrollSeekRangeChanged),zt(Qe(gn(L.windowViewportRect,w.headerHeight,w.fixedHeaderHeight),Ct(([D,K,H])=>Math.max(K+H+1,D.visibleHeight))),w.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:r,fixedItemHeight:a,fixedGroupHeight:i,gap:o,groupCounts:M,heightEstimates:u,initialItemFinalLocationReached:v,initialTopMostItemIndex:k,scrolledToInitialItem:_,sizeRanges:f,topItemCount:j,topItemsIndexes:z,totalCount:m,...E,groupIndices:l,itemSize:d,listState:I,minOverscanItemCount:B,scrollToIndex:T,statefulTotalCount:h,trackItemSizes:y,rangeChanged:ee,...V,...L,...w,sizes:p,...N}},Qr(Oi,ou,sa,QM,KM,To,su,tL,JM,mT,rL));function nL(e,t){const r={},a={};let i=0;const o=e.length;for(;i<o;)a[e[i]]=1,i+=1;for(const l in t)Object.hasOwn(a,l)||(r[l]=t[l]);return r}const Nd=typeof document>"u"?Ft.useEffect:Ft.useLayoutEffect;function ET(e,t,r){const a=Object.keys(t.required||{}),i=Object.keys(t.optional||{}),o=Object.keys(t.methods||{}),l=Object.keys(t.events||{}),u=Ft.createContext({});function d(_,w){_.propsReady!==void 0&&nr(_.propsReady,!1);for(const N of a){const E=_[t.required[N]];nr(E,w[N])}for(const N of i)if(N in w){const E=_[t.optional[N]];nr(E,w[N])}_.propsReady!==void 0&&nr(_.propsReady,!0)}function f(_){return o.reduce((w,N)=>(w[N]=E=>{const A=_[t.methods[N]];nr(A,E)},w),{})}function p(_){return l.reduce((w,N)=>(w[N]=xM(_[t.events[N]]),w),{})}const h=Ft.forwardRef(function(_,w){const{children:N,...E}=_,[A]=Ft.useState(()=>vf(vM(e),j=>{d(j,E)})),[T]=Ft.useState(D_(p,A));Nd(()=>{for(const j of l)j in E&&Ar(T[j],E[j]);return()=>{Object.values(T).map(Cv)}},[E,T,A]),Nd(()=>{d(A,E)}),Ft.useImperativeHandle(w,O_(f(A)));const C=r;return n.jsx(u.Provider,{value:A,children:r===void 0?N:n.jsx(C,{...nL([...a,...i,...l],E),children:N})})}),m=_=>{const w=Ft.useContext(u);return Ft.useCallback(N=>{nr(w[_],N)},[w,_])},y=_=>{const w=Ft.useContext(u)[_],N=Ft.useCallback(E=>Ar(w,E),[w]);return Ft.useSyncExternalStore(N,()=>Yr(w),()=>Yr(w))},v=_=>{const w=Ft.useContext(u)[_],[N,E]=Ft.useState(D_(Yr,w));return Nd(()=>Ar(w,A=>{A!==N&&E(O_(A))}),[w,N]),N},k=parseInt(Ft.version,10)>=18?y:v;return{Component:h,useEmitter:(_,w)=>{const N=Ft.useContext(u)[_];Nd(()=>Ar(N,w),[w,N])},useEmitterValue:k,usePublisher:m}}const jT=Ft.createContext(void 0),CT=Ft.createContext(void 0),Eg="-webkit-sticky",K_="sticky",Pv=ST(()=>{if(typeof document>"u")return K_;const e=document.createElement("div");return e.style.position=Eg,e.style.position===Eg?Eg:K_});function jg(e){return"self"in e}function aL(e){return"body"in e}function TT(e,t,r,a=Ll,i,o){const l=Ft.useRef(null),u=Ft.useRef(null),d=Ft.useRef(null),f=Ft.useCallback(h=>{let m,y,v;const k=h.target;if(aL(k)||jg(k)){const w=jg(k)?k:k.defaultView;v=o===!0?ko(w,w.scrollX):w.scrollY,m=o===!0?w.document.documentElement.scrollWidth:w.document.documentElement.scrollHeight,y=o===!0?w.innerWidth:w.innerHeight}else v=o===!0?ko(k,k.scrollLeft):k.scrollTop,m=o===!0?k.scrollWidth:k.scrollHeight,y=o===!0?k.offsetWidth:k.offsetHeight;const _=()=>{e({scrollHeight:m,scrollTop:Math.max(v,0),viewportHeight:y})};h.suppressFlushSync===!0?_():DI.flushSync(_),u.current!==null&&(v===u.current||v<=0||v===m-y)&&(u.current=null,t(!0),d.current&&(clearTimeout(d.current),d.current=null))},[e,t,o]);Ft.useEffect(()=>{const h=i??l.current;return a(i??l.current),f({suppressFlushSync:!0,target:h}),h.addEventListener("scroll",f,{passive:!0}),()=>{a(null),h.removeEventListener("scroll",f)}},[l,f,r,a,i]);function p(h){const m=l.current;if(!m||(o===!0?"offsetWidth"in m&&m.offsetWidth===0:"offsetHeight"in m&&m.offsetHeight===0))return;const y=h.behavior==="smooth";let v,k,_;jg(m)?(k=Math.max(Is(m.document.documentElement,o===!0?"width":"height"),o===!0?m.document.documentElement.scrollWidth:m.document.documentElement.scrollHeight),v=o===!0?m.innerWidth:m.innerHeight,_=o===!0?ko(m,m.scrollX):m.scrollY):(k=m[o===!0?"scrollWidth":"scrollHeight"],v=Is(m,o===!0?"width":"height"),_=o===!0?ko(m,m.scrollLeft):m.scrollTop);const w=k-v;if(h.top===void 0){m.scrollTo(h);return}const N=Math.ceil(Math.max(Math.min(w,h.top),0));if(h.top=N,yT(v,k)||N===_){e({scrollHeight:k,scrollTop:_,viewportHeight:v}),y&&t(!0);return}y?(u.current=N,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:F_(m,N)}),m.scrollTo(h)}return{scrollByCallback:Ft.useCallback(h=>{o===!0&&(h={...h.behavior===void 0?{}:{behavior:h.behavior},...h.top===void 0?{}:{left:F_(l.current,h.top)}}),l.current.scrollBy(h)},[o]),scrollerRef:l,scrollToCallback:p}}function Fv(e){return e}const iL=Cr(()=>{const e=ut(u=>`Item ${u}`),t=ut(u=>`Group ${u}`),r=ut({}),a=ut(Fv),i=ut("div"),o=ut(Ll),l=(u,d=null)=>Xn(Qe(r,Ct(f=>f[u]),Xr()),d);return{components:r,computeItemKey:a,EmptyPlaceholder:l("EmptyPlaceholder"),FooterComponent:l("Footer"),GroupComponent:l("Group","div"),groupContent:t,HeaderComponent:l("Header"),HeaderFooterTag:i,ItemComponent:l("Item","div"),itemContent:e,ListComponent:l("List","div"),ScrollerComponent:l("Scroller","div"),scrollerRef:o,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder"),TopItemListComponent:l("TopItemList")}}),sL=Cr(([e,t])=>({...e,...t}),Qr(NT,iL)),oL=({height:e})=>n.jsx("div",{style:{height:e}}),lL={overflowAnchor:"none",position:Pv(),zIndex:1},RT={overflowAnchor:"none"},cL={...RT,display:"inline-block",height:"100%"},Y_=Ft.memo(function({showTopList:e=!1}){const t=er("listState"),r=Fa("sizeRanges"),a=er("useWindowScroll"),i=er("customScrollParent"),o=Fa("windowScrollContainerState"),l=Fa("scrollContainerState"),u=i||a?o:l,d=er("itemContent"),f=er("context"),p=er("groupContent"),h=er("trackItemSizes"),m=er("itemSize"),y=er("log"),v=Fa("gap"),k=er("horizontalDirection"),{callbackRef:_}=SM(r,m,h,e?Ll:u,y,v,i,k,er("skipAnimationFrameInResizeObserver")),[w,N]=Ft.useState(0);zv("deviation",D=>{w!==D&&N(D)});const E=Fa("deviationCommitted");Rv(()=>{E(w)},[w,E]);const A=er("EmptyPlaceholder"),T=er("ScrollSeekPlaceholder")??oL,C=er("ListComponent"),j=er("ItemComponent"),M=er("GroupComponent"),L=er("computeItemKey"),I=er("isSeeking"),B=er("groupIndices").length>0,z=er("alignToBottom"),ee=er("initialItemFinalLocationReached"),V=e?{}:{boxSizing:"border-box",...k?{display:"inline-block",height:"100%",marginInlineStart:w===0?z?"auto":0:w,paddingInlineEnd:t.offsetBottom,paddingInlineStart:t.offsetTop,whiteSpace:"nowrap"}:{marginTop:w===0?z?"auto":0:w,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},...ee?{}:{visibility:"hidden"}};return!e&&t.totalCount===0&&A!==null&&A!==void 0?n.jsx(A,{...Yn(A,f)}):n.jsx(C,{...Yn(C,f),"data-testid":e?"virtuoso-top-item-list":"virtuoso-item-list",ref:_,style:V,children:(e?t.topItems:t.items).map(D=>{const K=D.originalIndex,H=L(K+t.firstItemIndex,D.data,f);return I?x.createElement(T,{...Yn(T,f),height:D.size,index:D.index,key:H,type:D.type||"item",...D.type==="group"?{}:{groupIndex:D.groupIndex}}):D.type==="group"?x.createElement(M,{...Yn(M,f),"data-index":K,"data-item-index":D.index,"data-known-size":D.size,key:H,style:lL},p(D.index,f)):x.createElement(j,{...Yn(j,f),...pL(j,D.data),"data-index":K,"data-item-group-index":D.groupIndex,"data-item-index":D.index,"data-known-size":D.size,key:H,style:k?cL:RT},B?d(D.index,D.groupIndex,D.data,f):d(D.index,D.data,f))})})}),uL={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},dL={outline:"none",overflowX:"auto",position:"relative"},Bv=e=>({height:"100%",position:"absolute",top:0,width:"100%",...e?{display:"flex",flexDirection:"column"}:void 0}),AT=(e,t,r=0)=>({...Bv(e),position:t?"relative":"absolute",top:t?-r:0}),fL={position:Pv(),top:0,width:"100%",zIndex:1};function Yn(e,t){if(typeof e!="string")return{context:t}}function pL(e,t){return{item:typeof e=="string"?void 0:t}}const gL=Ft.memo(function(){const e=er("HeaderComponent"),t=Fa("headerHeight"),r=er("HeaderFooterTag"),a=Co(Ft.useMemo(()=>o=>{t(Is(o,"height"))},[t]),!0,er("skipAnimationFrameInResizeObserver")),i=er("context");return e!=null?n.jsx(r,{ref:a,children:n.jsx(e,{...Yn(e,i)})}):null}),hL=Ft.memo(function(){const e=er("FooterComponent"),t=Fa("footerHeight"),r=er("HeaderFooterTag"),a=Co(Ft.useMemo(()=>o=>{t(Is(o,"height"))},[t]),!0,er("skipAnimationFrameInResizeObserver")),i=er("context");return e!=null?n.jsx(r,{ref:a,children:n.jsx(e,{...Yn(e,i)})}):null});function IT({useEmitter:e,useEmitterValue:t,usePublisher:r}){return Ft.memo(function({children:a,style:i,context:o,...l}){const u=r("scrollContainerState"),d=t("ScrollerComponent"),f=r("smoothScrollTargetReached"),p=t("scrollerRef"),h=t("horizontalDirection")||!1,{scrollByCallback:m,scrollerRef:y,scrollToCallback:v}=TT(u,f,d,p,void 0,h);return e("scrollTo",v),e("scrollBy",m),n.jsx(d,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:y,style:{...h?dL:uL,...i},tabIndex:0,...l,...Yn(d,o),children:a})})}function MT({useEmitter:e,useEmitterValue:t,usePublisher:r}){return Ft.memo(function({children:a,style:i,context:o,...l}){const u=r("windowScrollContainerState"),d=t("ScrollerComponent"),f=r("smoothScrollTargetReached"),p=t("totalListHeight"),h=t("deviation"),m=t("customScrollParent"),y=Ft.useRef(null),v=t("scrollerRef"),{scrollByCallback:k,scrollerRef:_,scrollToCallback:w}=TT(u,f,d,v,m);return Rv(()=>{var N;return _.current=m??((N=y.current)==null?void 0:N.ownerDocument.defaultView),()=>{_.current=null}},[_,m]),e("windowScrollTo",w),e("scrollBy",k),n.jsx(d,{ref:y,"data-virtuoso-scroller":!0,style:{position:"relative",...i,...p===0?void 0:{height:p+h}},...l,...Yn(d,o),children:a})})}const mL=({children:e})=>{const t=Ft.useContext(jT),r=Fa("viewportHeight"),a=Fa("fixedItemHeight"),i=er("alignToBottom"),o=er("horizontalDirection"),l=Ft.useMemo(()=>nT(r,d=>Is(d,o?"width":"height")),[r,o]),u=Co(l,!0,er("skipAnimationFrameInResizeObserver"));return Ft.useEffect(()=>{t&&(r(t.viewportHeight),a(t.itemHeight))},[t,r,a]),n.jsx("div",{"data-viewport-type":"element",ref:u,style:Bv(i),children:e})},xL=({children:e})=>{const t=Ft.useContext(jT),r=Fa("windowViewportRect"),a=Fa("fixedItemHeight"),i=er("customScrollParent"),o=er("useWindowScroll"),l=er("topListHeight"),u=sT(r,i,er("skipAnimationFrameInResizeObserver")),d=er("alignToBottom");return Ft.useEffect(()=>{t&&(a(t.itemHeight),r({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,r,a]),n.jsx("div",{"data-viewport-type":"window",ref:u,style:AT(d,o,l),children:e})},yL=({children:e})=>{const t=er("TopItemListComponent")??"div",r=er("headerHeight"),a={...fL,marginTop:`${r}px`},i=er("context");return n.jsx(t,{style:a,...Yn(t,i),children:e})},bL=Ft.memo(function(e){const t=er("useWindowScroll"),r=er("topItemsIndexes").length>0,a=er("customScrollParent"),i=er("context");return n.jsxs(a||t?_L:kL,{...e,context:i,children:[r&&n.jsx(yL,{children:n.jsx(Y_,{showTopList:!0})}),n.jsxs(a||t?xL:mL,{children:[n.jsx(gL,{}),n.jsx(Y_,{}),n.jsx(hL,{})]})]})}),{Component:vL,useEmitter:zv,useEmitterValue:er,usePublisher:Fa}=ET(sL,{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"}},bL),kL=IT({useEmitter:zv,useEmitterValue:er,usePublisher:Fa}),_L=MT({useEmitter:zv,useEmitterValue:er,usePublisher:Fa}),LT=vL,wL=Cr(()=>{const e=ut(f=>n.jsxs("td",{children:["Item $",f]})),t=ut(null),r=ut(f=>n.jsxs("td",{colSpan:1e3,children:["Group ",f]})),a=ut(null),i=ut(null),o=ut({}),l=ut(Fv),u=ut(Ll),d=(f,p=null)=>Xn(Qe(o,Ct(h=>h[f]),Xr()),p);return{components:o,computeItemKey:l,context:t,EmptyPlaceholder:d("EmptyPlaceholder"),FillerRow:d("FillerRow"),fixedFooterContent:i,fixedHeaderContent:a,itemContent:e,groupContent:r,ScrollerComponent:d("Scroller","div"),scrollerRef:u,ScrollSeekPlaceholder:d("ScrollSeekPlaceholder"),TableBodyComponent:d("TableBody","tbody"),TableComponent:d("Table","table"),TableFooterComponent:d("TableFoot","tfoot"),TableHeadComponent:d("TableHead","thead"),TableRowComponent:d("TableRow","tr"),GroupComponent:d("Group","tr")}});Qr(NT,wL);Pv();const X_={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},SL={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:Q_,floor:rf,max:zc,min:Cg,round:Z_}=Math;function J_(e,t,r){return Array.from({length:t-e+1}).map((a,i)=>({data:r===null?null:r[i+e],index:i+e}))}function NL(e){return{...SL,items:e}}function Ed(e,t){return e!==void 0&&e.width===t.width&&e.height===t.height}function EL(e,t){return e!==void 0&&e.column===t.column&&e.row===t.row}const jL=Cr(([{increaseViewportBy:e,listBoundary:t,overscan:r,visibleRange:a},{footerHeight:i,headerHeight:o,scrollBy:l,scrollContainerState:u,scrollTo:d,scrollTop:f,smoothScrollTargetReached:p,viewportHeight:h},m,y,{didMount:v,propsReady:k},{customScrollParent:_,useWindowScroll:w,windowScrollContainerState:N,windowScrollTo:E,windowViewportRect:A},T])=>{const C=ut(0),j=ut(0),M=ut(X_),L=ut({height:0,width:0}),I=ut({height:0,width:0}),B=xr(),z=xr(),ee=ut(0),V=ut(null),D=ut({column:0,row:0}),K=xr(),H=xr(),J=ut(!1),ne=ut(0),P=ut(!0),U=ut(!1),X=ut(!1);Ar(Qe(v,cr(ne),Xt(([Q,fe])=>!Xb(fe))),()=>{nr(P,!1)}),Ar(Qe(gn(v,P,I,L,ne,U),Xt(([Q,fe,ke,Fe,,Ve])=>Q&&!fe&&ke.height!==0&&Fe.height!==0&&!Ve)),([,,,,Q])=>{if(Q===void 0){nr(P,!0);return}nr(U,!0),Mv(1,()=>{nr(B,Q)}),mi(Qe(f),()=>{nr(t,[0,0]),nr(P,!0)})}),zt(Qe(H,Xt(Q=>Q!=null&&Q.scrollTop>0),Mi(0)),j),Ar(Qe(v,cr(H),Xt(([,Q])=>Q!=null)),([,Q])=>{Q&&(nr(L,Q.viewport),nr(I,Q.item),nr(D,Q.gap),Q.scrollTop>0&&(nr(J,!0),mi(Qe(f,No(1)),fe=>{nr(J,!1)}),nr(d,{top:Q.scrollTop})))}),zt(Qe(L,Ct(({height:Q})=>Q)),h),zt(Qe(gn(Yt(L,Ed),Yt(I,Ed),Yt(D,(Q,fe)=>Q!==void 0&&Q.column===fe.column&&Q.row===fe.row),Yt(f)),Ct(([Q,fe,ke,Fe])=>({gap:ke,item:fe,scrollTop:Fe,viewport:Q}))),K),zt(Qe(gn(Yt(C),a,Yt(D,EL),Yt(I,Ed),Yt(L,Ed),Yt(V),Yt(j),Yt(J),Yt(P),Yt(ne)),Xt(([,,,,,,,Q])=>!Q),Ct(([Q,[fe,ke],Fe,Ve,Ge,qe,Ce,,He,ze])=>{const{column:gt,row:mt}=Fe,{height:wt,width:$e}=Ve,{width:Et}=Ge;if(Ce===0&&(Q===0||Et===0))return X_;if($e===0){const De=Lv(ze,Q),rt=De+Math.max(Ce-1,0);return NL(J_(De,rt,qe))}const Ze=OT(Et,$e,gt);let Oe,it;He?fe===0&&ke===0&&Ce>0?(Oe=0,it=Ce-1):(Oe=Ze*rf((fe+mt)/(wt+mt)),it=Ze*Q_((ke+mt)/(wt+mt))-1,it=Cg(Q-1,zc(it,Ze-1)),Oe=Cg(it,zc(0,Oe))):(Oe=0,it=-1);const me=J_(Oe,it,qe),{bottom:Ee,top:ge}=ew(Ge,Fe,Ve,me),je=Q_(Q/Ze),se=je*wt+(je-1)*mt-Ee;return{bottom:Ee,itemHeight:wt,items:me,itemWidth:$e,offsetBottom:se,offsetTop:ge,top:ge}})),M),zt(Qe(V,Xt(Q=>Q!==null),Ct(Q=>Q.length)),C),zt(Qe(gn(L,I,M,D),Xt(([Q,fe,{items:ke}])=>ke.length>0&&fe.height!==0&&Q.height!==0),Ct(([Q,fe,{items:ke},Fe])=>{const{bottom:Ve,top:Ge}=ew(Q,Fe,fe,ke);return[Ge,Ve]}),Xr(Xc)),t);const F=ut(!1);zt(Qe(f,cr(F),Ct(([Q,fe])=>fe||Q!==0)),F);const Z=Ba(Qe(gn(M,C),Xt(([{items:Q}])=>Q.length>0),cr(F),Xt(([[Q,fe],ke])=>{const Fe=Q.items[Q.items.length-1].index===fe-1;return(ke||Q.bottom>0&&Q.itemHeight>0&&Q.offsetBottom===0&&Q.items.length===fe)&&Fe}),Ct(([[,Q]])=>Q-1),Xr())),W=Ba(Qe(Yt(M),Xt(({items:Q})=>Q.length>0&&Q[0].index===0),Mi(0),Xr())),G=Ba(Qe(Yt(M),cr(J),Xt(([{items:Q},fe])=>Q.length>0&&!fe),Ct(([{items:Q}])=>({endIndex:Q[Q.length-1].index,startIndex:Q[0].index})),Xr(fT),Zi(0)));zt(G,y.scrollSeekRangeChanged),zt(Qe(B,cr(L,I,C,D),Ct(([Q,fe,ke,Fe,Ve])=>{const Ge=xT(Q),{align:qe,behavior:Ce,offset:He}=Ge;let ze=Ge.index;ze==="LAST"&&(ze=Fe-1),ze=zc(0,ze,Cg(Fe-1,ze));let gt=Qb(fe,Ve,ke,ze);return qe==="end"?gt=Z_(gt-fe.height+ke.height):qe==="center"&&(gt=Z_(gt-fe.height/2+ke.height/2)),He!==void 0&&He!==0&&(gt+=He),{behavior:Ce,top:gt}})),d);const oe=Xn(Qe(M,Ct(Q=>Q.offsetBottom+Q.bottom)),0);return zt(Qe(A,Ct(Q=>({height:Q.visibleHeight,width:Q.visibleWidth}))),L),{customScrollParent:_,data:V,deviation:ee,footerHeight:i,gap:D,headerHeight:o,increaseViewportBy:e,initialItemCount:j,itemDimensions:I,overscan:r,restoreStateFrom:H,scrollBy:l,scrollContainerState:u,scrollHeight:z,scrollTo:d,scrollToIndex:B,scrollTop:f,smoothScrollTargetReached:p,totalCount:C,useWindowScroll:w,viewportDimensions:L,windowScrollContainerState:N,windowScrollTo:E,windowViewportRect:A,...y,gridState:M,horizontalDirection:X,initialTopMostItemIndex:ne,totalListHeight:oe,...m,endReached:Z,propsReady:k,rangeChanged:G,startReached:W,stateChanged:K,stateRestoreInProgress:J,...T}},Qr(Ov,sa,lu,wT,Os,Dv,Ls));function OT(e,t,r){return zc(1,rf((e+r)/(rf(t)+r)))}function ew(e,t,r,a){const{height:i}=r;if(i===void 0||a.length===0)return{bottom:0,top:0};const o=Qb(e,t,r,a[0].index);return{bottom:Qb(e,t,r,a[a.length-1].index)+i,top:o}}function Qb(e,t,r,a){const i=OT(e.width,r.width,t.column),o=rf(a/i),l=o*r.height+zc(0,o-1)*t.row;return l>0?l+t.row:l}const CL=Cr(()=>{const e=ut(h=>`Item ${h}`),t=ut({}),r=ut(null),a=ut("virtuoso-grid-item"),i=ut("virtuoso-grid-list"),o=ut(Fv),l=ut("div"),u=ut(Ll),d=(h,m=null)=>Xn(Qe(t,Ct(y=>y[h]),Xr()),m),f=ut(!1),p=ut(!1);return zt(Yt(p),f),{components:t,computeItemKey:o,context:r,FooterComponent:d("Footer"),HeaderComponent:d("Header"),headerFooterTag:l,itemClassName:a,ItemComponent:d("Item","div"),itemContent:e,listClassName:i,ListComponent:d("List","div"),readyStateChanged:f,reportReadyState:p,ScrollerComponent:d("Scroller","div"),scrollerRef:u,ScrollSeekPlaceholder:d("ScrollSeekPlaceholder","div")}}),TL=Cr(([e,t])=>({...e,...t}),Qr(jL,CL)),RL=Ft.memo(function(){const e=Kr("gridState"),t=Kr("listClassName"),r=Kr("itemClassName"),a=Kr("itemContent"),i=Kr("computeItemKey"),o=Kr("isSeeking"),l=Za("scrollHeight"),u=Kr("ItemComponent"),d=Kr("ListComponent"),f=Kr("ScrollSeekPlaceholder"),p=Kr("context"),h=Za("itemDimensions"),m=Za("gap"),y=Kr("log"),v=Kr("stateRestoreInProgress"),k=Za("reportReadyState"),_=Co(Ft.useMemo(()=>w=>{const N=w.parentElement.parentElement.scrollHeight;l(N);const E=w.firstChild;if(E!==null){const{height:A,width:T}=E.getBoundingClientRect();h({height:A,width:T})}m({column:tw("column-gap",getComputedStyle(w).columnGap,y),row:tw("row-gap",getComputedStyle(w).rowGap,y)})},[l,h,m,y]),!0,!1);return Rv(()=>{e.itemHeight>0&&e.itemWidth>0&&k(!0)},[e]),v?null:n.jsx(d,{className:t,ref:_,...Yn(d,p),"data-testid":"virtuoso-item-list",style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(w=>{const N=i(w.index,w.data,p);return o?n.jsx(f,{...Yn(f,p),height:e.itemHeight,index:w.index,width:e.itemWidth},N):x.createElement(u,{...Yn(u,p),className:r,"data-index":w.index,key:N},a(w.index,w.data,p))})})}),AL=Ft.memo(function(){const e=Kr("HeaderComponent"),t=Za("headerHeight"),r=Kr("headerFooterTag"),a=Co(Ft.useMemo(()=>o=>{t(Is(o,"height"))},[t]),!0,!1),i=Kr("context");return e!=null?n.jsx(r,{ref:a,children:n.jsx(e,{...Yn(e,i)})}):null}),IL=Ft.memo(function(){const e=Kr("FooterComponent"),t=Za("footerHeight"),r=Kr("headerFooterTag"),a=Co(Ft.useMemo(()=>o=>{t(Is(o,"height"))},[t]),!0,!1),i=Kr("context");return e!=null?n.jsx(r,{ref:a,children:n.jsx(e,{...Yn(e,i)})}):null}),ML=({children:e})=>{const t=Ft.useContext(CT),r=Za("itemDimensions"),a=Za("viewportDimensions"),i=Co(Ft.useMemo(()=>o=>{a(o.getBoundingClientRect())},[a]),!0,!1);return Ft.useEffect(()=>{t&&(a({height:t.viewportHeight,width:t.viewportWidth}),r({height:t.itemHeight,width:t.itemWidth}))},[t,a,r]),n.jsx("div",{ref:i,style:Bv(!1),children:e})},LL=({children:e})=>{const t=Ft.useContext(CT),r=Za("windowViewportRect"),a=Za("itemDimensions"),i=Kr("customScrollParent"),o=Kr("useWindowScroll"),l=sT(r,i,!1);return Ft.useEffect(()=>{t&&(a({height:t.itemHeight,width:t.itemWidth}),r({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,r,a]),n.jsx("div",{ref:l,style:AT(!1,o),children:e})},OL=Ft.memo(function({...e}){const t=Kr("useWindowScroll"),r=Kr("customScrollParent"),a=r||t?PL:DL,i=r||t?LL:ML,o=Kr("context");return n.jsx(a,{...e,...Yn(a,o),children:n.jsxs(i,{children:[n.jsx(AL,{}),n.jsx(RL,{}),n.jsx(IL,{})]})})}),{useEmitter:DT,useEmitterValue:Kr,usePublisher:Za}=ET(TL,{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"}},OL),DL=IT({useEmitter:DT,useEmitterValue:Kr,usePublisher:Za}),PL=MT({useEmitter:DT,useEmitterValue:Kr,usePublisher:Za});function tw(e,t,r){return t!=="normal"&&(t==null?void 0:t.endsWith("px"))!==!0&&r(`${e} was not resolved to pixel value correctly`,t,Nn.WARN),t==="normal"?0:parseInt(t??"0",10)}function FL(e,t){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const BL=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,zL=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,UL={};function rw(e,t){return(UL.jsx?zL:BL).test(e)}const qL=/[ \t\n\f\r]/g;function HL(e){return typeof e=="object"?e.type==="text"?nw(e.value):!1:nw(e)}function nw(e){return e.replace(qL,"")===""}class cu{constructor(t,r,a){this.normal=r,this.property=t,a&&(this.space=a)}}cu.prototype.normal={};cu.prototype.property={};cu.prototype.space=void 0;function PT(e,t){const r={},a={};for(const i of e)Object.assign(r,i.property),Object.assign(a,i.normal);return new cu(r,a,t)}function Zb(e){return e.toLowerCase()}class ka{constructor(t,r){this.attribute=r,this.property=t}}ka.prototype.attribute="";ka.prototype.booleanish=!1;ka.prototype.boolean=!1;ka.prototype.commaOrSpaceSeparated=!1;ka.prototype.commaSeparated=!1;ka.prototype.defined=!1;ka.prototype.mustUseProperty=!1;ka.prototype.number=!1;ka.prototype.overloadedBoolean=!1;ka.prototype.property="";ka.prototype.spaceSeparated=!1;ka.prototype.space=void 0;let $L=0;const rr=Ro(),yn=Ro(),Jb=Ro(),st=Ro(),Ur=Ro(),wo=Ro(),Oa=Ro();function Ro(){return 2**++$L}const ev=Object.freeze(Object.defineProperty({__proto__:null,boolean:rr,booleanish:yn,commaOrSpaceSeparated:Oa,commaSeparated:wo,number:st,overloadedBoolean:Jb,spaceSeparated:Ur},Symbol.toStringTag,{value:"Module"})),Tg=Object.keys(ev);class Uv extends ka{constructor(t,r,a,i){let o=-1;if(super(t,r),aw(this,"space",i),typeof a=="number")for(;++o<Tg.length;){const l=Tg[o];aw(this,Tg[o],(a&ev[l])===ev[l])}}}Uv.prototype.defined=!0;function aw(e,t,r){r&&(e[t]=r)}function Ol(e){const t={},r={};for(const[a,i]of Object.entries(e.properties)){const o=new Uv(a,e.transform(e.attributes||{},a),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(a)&&(o.mustUseProperty=!0),t[a]=o,r[Zb(a)]=a,r[Zb(o.attribute)]=a}return new cu(t,r,e.space)}const FT=Ol({properties:{ariaActiveDescendant:null,ariaAtomic:yn,ariaAutoComplete:null,ariaBusy:yn,ariaChecked:yn,ariaColCount:st,ariaColIndex:st,ariaColSpan:st,ariaControls:Ur,ariaCurrent:null,ariaDescribedBy:Ur,ariaDetails:null,ariaDisabled:yn,ariaDropEffect:Ur,ariaErrorMessage:null,ariaExpanded:yn,ariaFlowTo:Ur,ariaGrabbed:yn,ariaHasPopup:null,ariaHidden:yn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ur,ariaLevel:st,ariaLive:null,ariaModal:yn,ariaMultiLine:yn,ariaMultiSelectable:yn,ariaOrientation:null,ariaOwns:Ur,ariaPlaceholder:null,ariaPosInSet:st,ariaPressed:yn,ariaReadOnly:yn,ariaRelevant:null,ariaRequired:yn,ariaRoleDescription:Ur,ariaRowCount:st,ariaRowIndex:st,ariaRowSpan:st,ariaSelected:yn,ariaSetSize:st,ariaSort:null,ariaValueMax:st,ariaValueMin:st,ariaValueNow:st,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function BT(e,t){return t in e?e[t]:t}function zT(e,t){return BT(e,t.toLowerCase())}const WL=Ol({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:wo,acceptCharset:Ur,accessKey:Ur,action:null,allow:null,allowFullScreen:rr,allowPaymentRequest:rr,allowUserMedia:rr,alpha:rr,alt:null,as:null,async:rr,autoCapitalize:null,autoComplete:Ur,autoFocus:rr,autoPlay:rr,blocking:Ur,capture:null,charSet:null,checked:rr,cite:null,className:Ur,closedBy:null,colorSpace:null,cols:st,colSpan:st,command:null,commandFor:null,content:null,contentEditable:yn,controls:rr,controlsList:Ur,coords:st|wo,crossOrigin:null,data:null,dateTime:null,decoding:null,default:rr,defer:rr,dir:null,dirName:null,disabled:rr,download:Jb,draggable:yn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:rr,formTarget:null,headers:Ur,height:st,hidden:Jb,high:st,href:null,hrefLang:null,htmlFor:Ur,httpEquiv:Ur,id:null,imageSizes:null,imageSrcSet:null,inert:rr,inputMode:null,integrity:null,is:null,isMap:rr,itemId:null,itemProp:Ur,itemRef:Ur,itemScope:rr,itemType:Ur,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:rr,low:st,manifest:null,max:null,maxLength:st,media:null,method:null,min:null,minLength:st,multiple:rr,muted:rr,name:null,nonce:null,noModule:rr,noValidate:rr,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:rr,optimum:st,pattern:null,ping:Ur,placeholder:null,playsInline:rr,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:rr,referrerPolicy:null,rel:Ur,required:rr,reversed:rr,rows:st,rowSpan:st,sandbox:Ur,scope:null,scoped:rr,seamless:rr,selected:rr,shadowRootClonable:rr,shadowRootCustomElementRegistry:rr,shadowRootDelegatesFocus:rr,shadowRootMode:null,shadowRootSerializable:rr,shape:null,size:st,sizes:null,slot:null,span:st,spellCheck:yn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:st,step:null,style:null,tabIndex:st,target:null,title:null,translate:null,type:null,typeMustMatch:rr,useMap:null,value:yn,width:st,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ur,axis:null,background:null,bgColor:null,border:st,borderColor:null,bottomMargin:st,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:rr,declare:rr,event:null,face:null,frame:null,frameBorder:null,hSpace:st,leftMargin:st,link:null,longDesc:null,lowSrc:null,marginHeight:st,marginWidth:st,noResize:rr,noHref:rr,noShade:rr,noWrap:rr,object:null,profile:null,prompt:null,rev:null,rightMargin:st,rules:null,scheme:null,scrolling:yn,standby:null,summary:null,text:null,topMargin:st,valueType:null,version:null,vAlign:null,vLink:null,vSpace:st,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:rr,disablePictureInPicture:rr,disableRemotePlayback:rr,exportParts:wo,part:Ur,prefix:null,property:null,results:st,security:null,unselectable:null},space:"html",transform:zT}),VL=Ol({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:Oa,accentHeight:st,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:st,amplitude:st,arabicForm:null,ascent:st,attributeName:null,attributeType:null,azimuth:st,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:st,by:null,calcMode:null,capHeight:st,className:Ur,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:st,diffuseConstant:st,direction:null,display:null,dur:null,divisor:st,dominantBaseline:null,download:rr,dx:null,dy:null,edgeMode:null,editable:null,elevation:st,enableBackground:null,end:null,event:null,exponent:st,externalResourcesRequired:null,fill:null,fillOpacity:st,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:wo,g2:wo,glyphName:wo,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:st,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:st,horizOriginX:st,horizOriginY:st,id:null,ideographic:st,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:st,k:st,k1:st,k2:st,k3:st,k4:st,kernelMatrix:Oa,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:st,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:st,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:st,overlineThickness:st,paintOrder:null,panose1:null,path:null,pathLength:st,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ur,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:st,pointsAtY:st,pointsAtZ:st,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Oa,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Oa,rev:Oa,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Oa,requiredFeatures:Oa,requiredFonts:Oa,requiredFormats:Oa,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:st,specularExponent:st,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:st,strikethroughThickness:st,string:null,stroke:null,strokeDashArray:Oa,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:st,strokeOpacity:st,strokeWidth:null,style:null,surfaceScale:st,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Oa,tabIndex:st,tableValues:null,target:null,targetX:st,targetY:st,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Oa,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:st,underlineThickness:st,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:st,values:null,vAlphabetic:st,vMathematical:st,vectorEffect:null,vHanging:st,vIdeographic:st,version:null,vertAdvY:st,vertOriginX:st,vertOriginY:st,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:st,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:BT}),UT=Ol({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()}}),qT=Ol({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:zT}),HT=Ol({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),GL={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"},KL=/[A-Z]/g,iw=/-[a-z]/g,YL=/^data[-\w.:]+$/i;function XL(e,t){const r=Zb(t);let a=t,i=ka;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&YL.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(iw,ZL);a="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!iw.test(o)){let l=o.replace(KL,QL);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}i=Uv}return new i(a,t)}function QL(e){return"-"+e.toLowerCase()}function ZL(e){return e.charAt(1).toUpperCase()}const JL=PT([FT,WL,UT,qT,HT],"html"),qv=PT([FT,VL,UT,qT,HT],"svg");function eO(e){return e.join(" ").trim()}var hl={},Rg,sw;function tO(){if(sw)return Rg;sw=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,r=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,u=/^\s+|\s+$/g,d=`
49
+ `,f="/",p="*",h="",m="comment",y="declaration";function v(_,w){if(typeof _!="string")throw new TypeError("First argument must be a string");if(!_)return[];w=w||{};var N=1,E=1;function A(V){var D=V.match(t);D&&(N+=D.length);var K=V.lastIndexOf(d);E=~K?V.length-K:E+V.length}function T(){var V={line:N,column:E};return function(D){return D.position=new C(V),L(),D}}function C(V){this.start=V,this.end={line:N,column:E},this.source=w.source}C.prototype.content=_;function j(V){var D=new Error(w.source+":"+N+":"+E+": "+V);if(D.reason=V,D.filename=w.source,D.line=N,D.column=E,D.source=_,!w.silent)throw D}function M(V){var D=V.exec(_);if(D){var K=D[0];return A(K),_=_.slice(K.length),D}}function L(){M(r)}function I(V){var D;for(V=V||[];D=B();)D!==!1&&V.push(D);return V}function B(){var V=T();if(!(f!=_.charAt(0)||p!=_.charAt(1))){for(var D=2;h!=_.charAt(D)&&(p!=_.charAt(D)||f!=_.charAt(D+1));)++D;if(D+=2,h===_.charAt(D-1))return j("End of comment missing");var K=_.slice(2,D-2);return E+=2,A(K),_=_.slice(D),E+=2,V({type:m,comment:K})}}function z(){var V=T(),D=M(a);if(D){if(B(),!M(i))return j("property missing ':'");var K=M(o),H=V({type:y,property:k(D[0].replace(e,h)),value:K?k(K[0].replace(e,h)):h});return M(l),H}}function ee(){var V=[];I(V);for(var D;D=z();)D!==!1&&(V.push(D),I(V));return V}return L(),ee()}function k(_){return _?_.replace(u,h):h}return Rg=v,Rg}var ow;function rO(){if(ow)return hl;ow=1;var e=hl&&hl.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(hl,"__esModule",{value:!0}),hl.default=r;const t=e(tO());function r(a,i){let o=null;if(!a||typeof a!="string")return o;const l=(0,t.default)(a),u=typeof i=="function";return l.forEach(d=>{if(d.type!=="declaration")return;const{property:f,value:p}=d;u?i(f,p,d):p&&(o=o||{},o[f]=p)}),o}return hl}var Ec={},lw;function nO(){if(lw)return Ec;lw=1,Object.defineProperty(Ec,"__esModule",{value:!0}),Ec.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,r=/^[^-]+$/,a=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,o=function(f){return!f||r.test(f)||e.test(f)},l=function(f,p){return p.toUpperCase()},u=function(f,p){return"".concat(p,"-")},d=function(f,p){return p===void 0&&(p={}),o(f)?f:(f=f.toLowerCase(),p.reactCompat?f=f.replace(i,u):f=f.replace(a,u),f.replace(t,l))};return Ec.camelCase=d,Ec}var jc,cw;function aO(){if(cw)return jc;cw=1;var e=jc&&jc.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(rO()),r=nO();function a(i,o){var l={};return!i||typeof i!="string"||(0,t.default)(i,function(u,d){u&&d&&(l[(0,r.camelCase)(u,o)]=d)}),l}return a.default=a,jc=a,jc}var iO=aO();const sO=jo(iO),$T=WT("end"),Hv=WT("start");function WT(e){return t;function t(r){const a=r&&r.position&&r.position[e]||{};if(typeof a.line=="number"&&a.line>0&&typeof a.column=="number"&&a.column>0)return{line:a.line,column:a.column,offset:typeof a.offset=="number"&&a.offset>-1?a.offset:void 0}}}function oO(e){const t=Hv(e),r=$T(e);if(t&&r)return{start:t,end:r}}function Uc(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?uw(e.position):"start"in e||"end"in e?uw(e):"line"in e||"column"in e?tv(e):""}function tv(e){return dw(e&&e.line)+":"+dw(e&&e.column)}function uw(e){return tv(e&&e.start)+"-"+tv(e&&e.end)}function dw(e){return e&&typeof e=="number"?e:1}class Zn extends Error{constructor(t,r,a){super(),typeof r=="string"&&(a=r,r=void 0);let i="",o={},l=!1;if(r&&("line"in r&&"column"in r?o={place:r}:"start"in r&&"end"in r?o={place:r}:"type"in r?o={ancestors:[r],place:r.position}:o={...r}),typeof t=="string"?i=t:!o.cause&&t&&(l=!0,i=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof a=="string"){const d=a.indexOf(":");d===-1?o.ruleId=a:(o.source=a.slice(0,d),o.ruleId=a.slice(d+1))}if(!o.place&&o.ancestors&&o.ancestors){const d=o.ancestors[o.ancestors.length-1];d&&(o.place=d.position)}const u=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=u?u.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=u?u.line:void 0,this.name=Uc(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}}Zn.prototype.file="";Zn.prototype.name="";Zn.prototype.reason="";Zn.prototype.message="";Zn.prototype.stack="";Zn.prototype.column=void 0;Zn.prototype.line=void 0;Zn.prototype.ancestors=void 0;Zn.prototype.cause=void 0;Zn.prototype.fatal=void 0;Zn.prototype.place=void 0;Zn.prototype.ruleId=void 0;Zn.prototype.source=void 0;const $v={}.hasOwnProperty,lO=new Map,cO=/[A-Z]/g,uO=new Set(["table","tbody","thead","tfoot","tr"]),dO=new Set(["td","th"]),VT="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function fO(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=t.filePath||void 0;let a;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");a=vO(r,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");a=bO(r,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:a,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?qv:JL,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=GT(i,e,void 0);return o&&typeof o!="string"?o:i.create(e,i.Fragment,{children:o||void 0},void 0)}function GT(e,t,r){if(t.type==="element")return pO(e,t,r);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return gO(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return mO(e,t,r);if(t.type==="mdxjsEsm")return hO(e,t);if(t.type==="root")return xO(e,t,r);if(t.type==="text")return yO(e,t)}function pO(e,t,r){const a=e.schema;let i=a;t.tagName.toLowerCase()==="svg"&&a.space==="html"&&(i=qv,e.schema=i),e.ancestors.push(t);const o=YT(e,t.tagName,!1),l=kO(e,t);let u=Vv(e,t);return uO.has(t.tagName)&&(u=u.filter(function(d){return typeof d=="string"?!HL(d):!0})),KT(e,l,o,t),Wv(l,u),e.ancestors.pop(),e.schema=a,e.create(t,o,l,r)}function gO(e,t){if(t.data&&t.data.estree&&e.evaluater){const a=t.data.estree.body[0];return a.type,e.evaluater.evaluateExpression(a.expression)}tu(e,t.position)}function hO(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);tu(e,t.position)}function mO(e,t,r){const a=e.schema;let i=a;t.name==="svg"&&a.space==="html"&&(i=qv,e.schema=i),e.ancestors.push(t);const o=t.name===null?e.Fragment:YT(e,t.name,!0),l=_O(e,t),u=Vv(e,t);return KT(e,l,o,t),Wv(l,u),e.ancestors.pop(),e.schema=a,e.create(t,o,l,r)}function xO(e,t,r){const a={};return Wv(a,Vv(e,t)),e.create(t,e.Fragment,a,r)}function yO(e,t){return t.value}function KT(e,t,r,a){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(t.node=a)}function Wv(e,t){if(t.length>0){const r=t.length>1?t:t[0];r&&(e.children=r)}}function bO(e,t,r){return a;function a(i,o,l,u){const f=Array.isArray(l.children)?r:t;return u?f(o,l,u):f(o,l)}}function vO(e,t){return r;function r(a,i,o,l){const u=Array.isArray(o.children),d=Hv(a);return t(i,o,l,u,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function kO(e,t){const r={};let a,i;for(i in t.properties)if(i!=="children"&&$v.call(t.properties,i)){const o=wO(e,i,t.properties[i]);if(o){const[l,u]=o;e.tableCellAlignToStyle&&l==="align"&&typeof u=="string"&&dO.has(t.tagName)?a=u:r[l]=u}}if(a){const o=r.style||(r.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=a}return r}function _O(e,t){const r={};for(const a of t.attributes)if(a.type==="mdxJsxExpressionAttribute")if(a.data&&a.data.estree&&e.evaluater){const o=a.data.estree.body[0];o.type;const l=o.expression;l.type;const u=l.properties[0];u.type,Object.assign(r,e.evaluater.evaluateExpression(u.argument))}else tu(e,t.position);else{const i=a.name;let o;if(a.value&&typeof a.value=="object")if(a.value.data&&a.value.data.estree&&e.evaluater){const u=a.value.data.estree.body[0];u.type,o=e.evaluater.evaluateExpression(u.expression)}else tu(e,t.position);else o=a.value===null?!0:a.value;r[i]=o}return r}function Vv(e,t){const r=[];let a=-1;const i=e.passKeys?new Map:lO;for(;++a<t.children.length;){const o=t.children[a];let l;if(e.passKeys){const d=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(d){const f=i.get(d)||0;l=d+"-"+f,i.set(d,f+1)}}const u=GT(e,o,l);u!==void 0&&r.push(u)}return r}function wO(e,t,r){const a=XL(e.schema,t);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=a.commaSeparated?FL(r):eO(r)),a.property==="style"){let i=typeof r=="object"?r:SO(e,String(r));return e.stylePropertyNameCase==="css"&&(i=NO(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&a.space?GL[a.property]||a.property:a.attribute,r]}}function SO(e,t){try{return sO(t,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const a=r,i=new Zn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:a,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=VT+"#cannot-parse-style-attribute",i}}function YT(e,t,r){let a;if(!r)a={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let o=-1,l;for(;++o<i.length;){const u=rw(i[o])?{type:"Identifier",name:i[o]}:{type:"Literal",value:i[o]};l=l?{type:"MemberExpression",object:l,property:u,computed:!!(o&&u.type==="Literal"),optional:!1}:u}a=l}else a=rw(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(a.type==="Literal"){const i=a.value;return $v.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(a);tu(e)}function tu(e,t){const r=new Zn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=VT+"#cannot-handle-mdx-estrees-without-createevaluater",r}function NO(e){const t={};let r;for(r in e)$v.call(e,r)&&(t[EO(r)]=e[r]);return t}function EO(e){let t=e.replace(cO,jO);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function jO(e){return"-"+e.toLowerCase()}const Ag={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"]},CO={};function Gv(e,t){const r=CO,a=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,i=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return XT(e,a,i)}function XT(e,t,r){if(TO(e)){if("value"in e)return e.type==="html"&&!r?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return fw(e.children,t,r)}return Array.isArray(e)?fw(e,t,r):""}function fw(e,t,r){const a=[];let i=-1;for(;++i<e.length;)a[i]=XT(e[i],t,r);return a.join("")}function TO(e){return!!(e&&typeof e=="object")}const pw=document.createElement("i");function Kv(e){const t="&"+e+";";pw.innerHTML=t;const r=pw.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===t?!1:r}function za(e,t,r,a){const i=e.length;let o=0,l;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,r=r>0?r:0,a.length<1e4)l=Array.from(a),l.unshift(t,r),e.splice(...l);else for(r&&e.splice(t,r);o<a.length;)l=a.slice(o,o+1e4),l.unshift(t,0),e.splice(...l),o+=1e4,t+=1e4}function Qa(e,t){return e.length>0?(za(e,e.length,0,t),e):t}const gw={}.hasOwnProperty;function QT(e){const t={};let r=-1;for(;++r<e.length;)RO(t,e[r]);return t}function RO(e,t){let r;for(r in t){const i=(gw.call(e,r)?e[r]:void 0)||(e[r]={}),o=t[r];let l;if(o)for(l in o){gw.call(i,l)||(i[l]=[]);const u=o[l];AO(i[l],Array.isArray(u)?u:u?[u]:[])}}}function AO(e,t){let r=-1;const a=[];for(;++r<t.length;)(t[r].add==="after"?e:a).push(t[r]);za(e,0,0,a)}function ZT(e,t){const r=Number.parseInt(e,t);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function xi(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ia=Ds(/[A-Za-z]/),Qn=Ds(/[\dA-Za-z]/),IO=Ds(/[#-'*+\--9=?A-Z^-~]/);function nf(e){return e!==null&&(e<32||e===127)}const rv=Ds(/\d/),MO=Ds(/[\dA-Fa-f]/),LO=Ds(/[!-/:-@[-`{-~]/);function Vt(e){return e!==null&&e<-2}function qr(e){return e!==null&&(e<0||e===32)}function hr(e){return e===-2||e===-1||e===32}const _f=Ds(new RegExp("\\p{P}|\\p{S}","u")),Eo=Ds(/\s/);function Ds(e){return t;function t(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function Dl(e){const t=[];let r=-1,a=0,i=0;for(;++r<e.length;){const o=e.charCodeAt(r);let l="";if(o===37&&Qn(e.charCodeAt(r+1))&&Qn(e.charCodeAt(r+2)))i=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(l=String.fromCharCode(o));else if(o>55295&&o<57344){const u=e.charCodeAt(r+1);o<56320&&u>56319&&u<57344?(l=String.fromCharCode(o,u),i=1):l="�"}else l=String.fromCharCode(o);l&&(t.push(e.slice(a,r),encodeURIComponent(l)),a=r+i+1,l=""),i&&(r+=i,i=0)}return t.join("")+e.slice(a)}function br(e,t,r,a){const i=a?a-1:Number.POSITIVE_INFINITY;let o=0;return l;function l(d){return hr(d)?(e.enter(r),u(d)):t(d)}function u(d){return hr(d)&&o++<i?(e.consume(d),u):(e.exit(r),t(d))}}const OO={tokenize:DO};function DO(e){const t=e.attempt(this.parser.constructs.contentInitial,a,i);let r;return t;function a(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),br(e,t,"linePrefix")}function i(u){return e.enter("paragraph"),o(u)}function o(u){const d=e.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=d),r=d,l(u)}function l(u){if(u===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(u);return}return Vt(u)?(e.consume(u),e.exit("chunkText"),o):(e.consume(u),l)}}const PO={tokenize:FO},hw={tokenize:BO};function FO(e){const t=this,r=[];let a=0,i,o,l;return u;function u(E){if(a<r.length){const A=r[a];return t.containerState=A[1],e.attempt(A[0].continuation,d,f)(E)}return f(E)}function d(E){if(a++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&N();const A=t.events.length;let T=A,C;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){C=t.events[T][1].end;break}w(a);let j=A;for(;j<t.events.length;)t.events[j][1].end={...C},j++;return za(t.events,T+1,0,t.events.slice(A)),t.events.length=j,f(E)}return u(E)}function f(E){if(a===r.length){if(!i)return m(E);if(i.currentConstruct&&i.currentConstruct.concrete)return v(E);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(hw,p,h)(E)}function p(E){return i&&N(),w(a),m(E)}function h(E){return t.parser.lazy[t.now().line]=a!==r.length,l=t.now().offset,v(E)}function m(E){return t.containerState={},e.attempt(hw,y,v)(E)}function y(E){return a++,r.push([t.currentConstruct,t.containerState]),m(E)}function v(E){if(E===null){i&&N(),w(0),e.consume(E);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:o}),k(E)}function k(E){if(E===null){_(e.exit("chunkFlow"),!0),w(0),e.consume(E);return}return Vt(E)?(e.consume(E),_(e.exit("chunkFlow")),a=0,t.interrupt=void 0,u):(e.consume(E),k)}function _(E,A){const T=t.sliceStream(E);if(A&&T.push(null),E.previous=o,o&&(o.next=E),o=E,i.defineSkip(E.start),i.write(T),t.parser.lazy[E.start.line]){let C=i.events.length;for(;C--;)if(i.events[C][1].start.offset<l&&(!i.events[C][1].end||i.events[C][1].end.offset>l))return;const j=t.events.length;let M=j,L,I;for(;M--;)if(t.events[M][0]==="exit"&&t.events[M][1].type==="chunkFlow"){if(L){I=t.events[M][1].end;break}L=!0}for(w(a),C=j;C<t.events.length;)t.events[C][1].end={...I},C++;za(t.events,M+1,0,t.events.slice(j)),t.events.length=C}}function w(E){let A=r.length;for(;A-- >E;){const T=r[A];t.containerState=T[1],T[0].exit.call(t,e)}r.length=E}function N(){i.write([null]),o=void 0,i=void 0,t.containerState._closeFlow=void 0}}function BO(e,t,r){return br(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Al(e){if(e===null||qr(e)||Eo(e))return 1;if(_f(e))return 2}function wf(e,t,r){const a=[];let i=-1;for(;++i<e.length;){const o=e[i].resolveAll;o&&!a.includes(o)&&(t=o(t,r),a.push(o))}return t}const nv={name:"attention",resolveAll:zO,tokenize:UO};function zO(e,t){let r=-1,a,i,o,l,u,d,f,p;for(;++r<e.length;)if(e[r][0]==="enter"&&e[r][1].type==="attentionSequence"&&e[r][1]._close){for(a=r;a--;)if(e[a][0]==="exit"&&e[a][1].type==="attentionSequence"&&e[a][1]._open&&t.sliceSerialize(e[a][1]).charCodeAt(0)===t.sliceSerialize(e[r][1]).charCodeAt(0)){if((e[a][1]._close||e[r][1]._open)&&(e[r][1].end.offset-e[r][1].start.offset)%3&&!((e[a][1].end.offset-e[a][1].start.offset+e[r][1].end.offset-e[r][1].start.offset)%3))continue;d=e[a][1].end.offset-e[a][1].start.offset>1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const h={...e[a][1].end},m={...e[r][1].start};mw(h,-d),mw(m,d),l={type:d>1?"strongSequence":"emphasisSequence",start:h,end:{...e[a][1].end}},u={type:d>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:m},o={type:d>1?"strongText":"emphasisText",start:{...e[a][1].end},end:{...e[r][1].start}},i={type:d>1?"strong":"emphasis",start:{...l.start},end:{...u.end}},e[a][1].end={...l.start},e[r][1].start={...u.end},f=[],e[a][1].end.offset-e[a][1].start.offset&&(f=Qa(f,[["enter",e[a][1],t],["exit",e[a][1],t]])),f=Qa(f,[["enter",i,t],["enter",l,t],["exit",l,t],["enter",o,t]]),f=Qa(f,wf(t.parser.constructs.insideSpan.null,e.slice(a+1,r),t)),f=Qa(f,[["exit",o,t],["enter",u,t],["exit",u,t],["exit",i,t]]),e[r][1].end.offset-e[r][1].start.offset?(p=2,f=Qa(f,[["enter",e[r][1],t],["exit",e[r][1],t]])):p=0,za(e,a-1,r-a+3,f),r=a+f.length-p-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function UO(e,t){const r=this.parser.constructs.attentionMarkers.null,a=this.previous,i=Al(a);let o;return l;function l(d){return o=d,e.enter("attentionSequence"),u(d)}function u(d){if(d===o)return e.consume(d),u;const f=e.exit("attentionSequence"),p=Al(d),h=!p||p===2&&i||r.includes(d),m=!i||i===2&&p||r.includes(a);return f._open=!!(o===42?h:h&&(i||!m)),f._close=!!(o===42?m:m&&(p||!h)),t(d)}}function mw(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const qO={name:"autolink",tokenize:HO};function HO(e,t,r){let a=0;return i;function i(y){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(y){return ia(y)?(e.consume(y),l):y===64?r(y):f(y)}function l(y){return y===43||y===45||y===46||Qn(y)?(a=1,u(y)):f(y)}function u(y){return y===58?(e.consume(y),a=0,d):(y===43||y===45||y===46||Qn(y))&&a++<32?(e.consume(y),u):(a=0,f(y))}function d(y){return y===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):y===null||y===32||y===60||nf(y)?r(y):(e.consume(y),d)}function f(y){return y===64?(e.consume(y),p):IO(y)?(e.consume(y),f):r(y)}function p(y){return Qn(y)?h(y):r(y)}function h(y){return y===46?(e.consume(y),a=0,p):y===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):m(y)}function m(y){if((y===45||Qn(y))&&a++<63){const v=y===45?m:h;return e.consume(y),v}return r(y)}}const uu={partial:!0,tokenize:$O};function $O(e,t,r){return a;function a(o){return hr(o)?br(e,i,"linePrefix")(o):i(o)}function i(o){return o===null||Vt(o)?t(o):r(o)}}const JT={continuation:{tokenize:VO},exit:GO,name:"blockQuote",tokenize:WO};function WO(e,t,r){const a=this;return i;function i(l){if(l===62){const u=a.containerState;return u.open||(e.enter("blockQuote",{_container:!0}),u.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(l),e.exit("blockQuoteMarker"),o}return r(l)}function o(l){return hr(l)?(e.enter("blockQuotePrefixWhitespace"),e.consume(l),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(l))}}function VO(e,t,r){const a=this;return i;function i(l){return hr(l)?br(e,o,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):o(l)}function o(l){return e.attempt(JT,t,r)(l)}}function GO(e){e.exit("blockQuote")}const e5={name:"characterEscape",tokenize:KO};function KO(e,t,r){return a;function a(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),i}function i(o){return LO(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):r(o)}}const t5={name:"characterReference",tokenize:YO};function YO(e,t,r){const a=this;let i=0,o,l;return u;function u(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),d}function d(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),f):(e.enter("characterReferenceValue"),o=31,l=Qn,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=MO,p):(e.enter("characterReferenceValue"),o=7,l=rv,p(h))}function p(h){if(h===59&&i){const m=e.exit("characterReferenceValue");return l===Qn&&!Kv(a.sliceSerialize(m))?r(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return l(h)&&i++<o?(e.consume(h),p):r(h)}}const xw={partial:!0,tokenize:QO},yw={concrete:!0,name:"codeFenced",tokenize:XO};function XO(e,t,r){const a=this,i={partial:!0,tokenize:T};let o=0,l=0,u;return d;function d(C){return f(C)}function f(C){const j=a.events[a.events.length-1];return o=j&&j[1].type==="linePrefix"?j[2].sliceSerialize(j[1],!0).length:0,u=C,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),p(C)}function p(C){return C===u?(l++,e.consume(C),p):l<3?r(C):(e.exit("codeFencedFenceSequence"),hr(C)?br(e,h,"whitespace")(C):h(C))}function h(C){return C===null||Vt(C)?(e.exit("codeFencedFence"),a.interrupt?t(C):e.check(xw,k,A)(C)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),m(C))}function m(C){return C===null||Vt(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(C)):hr(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),br(e,y,"whitespace")(C)):C===96&&C===u?r(C):(e.consume(C),m)}function y(C){return C===null||Vt(C)?h(C):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),v(C))}function v(C){return C===null||Vt(C)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(C)):C===96&&C===u?r(C):(e.consume(C),v)}function k(C){return e.attempt(i,A,_)(C)}function _(C){return e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),w}function w(C){return o>0&&hr(C)?br(e,N,"linePrefix",o+1)(C):N(C)}function N(C){return C===null||Vt(C)?e.check(xw,k,A)(C):(e.enter("codeFlowValue"),E(C))}function E(C){return C===null||Vt(C)?(e.exit("codeFlowValue"),N(C)):(e.consume(C),E)}function A(C){return e.exit("codeFenced"),t(C)}function T(C,j,M){let L=0;return I;function I(D){return C.enter("lineEnding"),C.consume(D),C.exit("lineEnding"),B}function B(D){return C.enter("codeFencedFence"),hr(D)?br(C,z,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):z(D)}function z(D){return D===u?(C.enter("codeFencedFenceSequence"),ee(D)):M(D)}function ee(D){return D===u?(L++,C.consume(D),ee):L>=l?(C.exit("codeFencedFenceSequence"),hr(D)?br(C,V,"whitespace")(D):V(D)):M(D)}function V(D){return D===null||Vt(D)?(C.exit("codeFencedFence"),j(D)):M(D)}}}function QO(e,t,r){const a=this;return i;function i(l){return l===null?r(l):(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o)}function o(l){return a.parser.lazy[a.now().line]?r(l):t(l)}}const Ig={name:"codeIndented",tokenize:JO},ZO={partial:!0,tokenize:eD};function JO(e,t,r){const a=this;return i;function i(f){return e.enter("codeIndented"),br(e,o,"linePrefix",5)(f)}function o(f){const p=a.events[a.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?l(f):r(f)}function l(f){return f===null?d(f):Vt(f)?e.attempt(ZO,l,d)(f):(e.enter("codeFlowValue"),u(f))}function u(f){return f===null||Vt(f)?(e.exit("codeFlowValue"),l(f)):(e.consume(f),u)}function d(f){return e.exit("codeIndented"),t(f)}}function eD(e,t,r){const a=this;return i;function i(l){return a.parser.lazy[a.now().line]?r(l):Vt(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),i):br(e,o,"linePrefix",5)(l)}function o(l){const u=a.events[a.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?t(l):Vt(l)?i(l):r(l)}}const tD={name:"codeText",previous:nD,resolve:rD,tokenize:aD};function rD(e){let t=e.length-4,r=3,a,i;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(a=r;++a<t;)if(e[a][1].type==="codeTextData"){e[r][1].type="codeTextPadding",e[t][1].type="codeTextPadding",r+=2,t-=2;break}}for(a=r-1,t++;++a<=t;)i===void 0?a!==t&&e[a][1].type!=="lineEnding"&&(i=a):(a===t||e[a][1].type==="lineEnding")&&(e[i][1].type="codeTextData",a!==i+2&&(e[i][1].end=e[a-1][1].end,e.splice(i+2,a-i-2),t-=a-i-2,a=i+2),i=void 0);return e}function nD(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function aD(e,t,r){let a=0,i,o;return l;function l(h){return e.enter("codeText"),e.enter("codeTextSequence"),u(h)}function u(h){return h===96?(e.consume(h),a++,u):(e.exit("codeTextSequence"),d(h))}function d(h){return h===null?r(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),d):h===96?(o=e.enter("codeTextSequence"),i=0,p(h)):Vt(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||Vt(h)?(e.exit("codeTextData"),d(h)):(e.consume(h),f)}function p(h){return h===96?(e.consume(h),i++,p):i===a?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(o.type="codeTextData",f(h))}}class iD{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,r){const a=r??Number.POSITIVE_INFINITY;return a<this.left.length?this.left.slice(t,a):t>this.left.length?this.right.slice(this.right.length-a+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-a+this.left.length).reverse())}splice(t,r,a){const i=r||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return a&&Cc(this.left,a),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Cc(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Cc(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const r=this.left.splice(t,Number.POSITIVE_INFINITY);Cc(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Cc(this.left,r.reverse())}}}function Cc(e,t){let r=0;if(t.length<1e4)e.push(...t);else for(;r<t.length;)e.push(...t.slice(r,r+1e4)),r+=1e4}function r5(e){const t={};let r=-1,a,i,o,l,u,d,f;const p=new iD(e);for(;++r<p.length;){for(;r in t;)r=t[r];if(a=p.get(r),r&&a[1].type==="chunkFlow"&&p.get(r-1)[1].type==="listItemPrefix"&&(d=a[1]._tokenizer.events,o=0,o<d.length&&d[o][1].type==="lineEndingBlank"&&(o+=2),o<d.length&&d[o][1].type==="content"))for(;++o<d.length&&d[o][1].type!=="content";)d[o][1].type==="chunkText"&&(d[o][1]._isInFirstContentOfListItem=!0,o++);if(a[0]==="enter")a[1].contentType&&(Object.assign(t,sD(p,r)),r=t[r],f=!0);else if(a[1]._container){for(o=r,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&&(a[1].end={...p.get(i)[1].start},u=p.slice(i,r),u.unshift(a),p.splice(i,r-i+1,u))}}return za(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!f}function sD(e,t){const r=e.get(t)[1],a=e.get(t)[2];let i=t-1;const o=[];let l=r._tokenizer;l||(l=a.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));const u=l.events,d=[],f={};let p,h,m=-1,y=r,v=0,k=0;const _=[k];for(;y;){for(;e.get(++i)[1]!==y;);o.push(i),y._tokenizer||(p=a.sliceStream(y),y.next||p.push(null),h&&l.defineSkip(y.start),y._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(p),y._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),h=y,y=y.next}for(y=r;++m<u.length;)u[m][0]==="exit"&&u[m-1][0]==="enter"&&u[m][1].type===u[m-1][1].type&&u[m][1].start.line!==u[m][1].end.line&&(k=m+1,_.push(k),y._tokenizer=void 0,y.previous=void 0,y=y.next);for(l.events=[],y?(y._tokenizer=void 0,y.previous=void 0):_.pop(),m=_.length;m--;){const w=u.slice(_[m],_[m+1]),N=o.pop();d.push([N,N+w.length-1]),e.splice(N,2,w)}for(d.reverse(),m=-1;++m<d.length;)f[v+d[m][0]]=v+d[m][1],v+=d[m][1]-d[m][0]-1;return f}const oD={resolve:cD,tokenize:uD},lD={partial:!0,tokenize:dD};function cD(e){return r5(e),e}function uD(e,t){let r;return a;function a(u){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),i(u)}function i(u){return u===null?o(u):Vt(u)?e.check(lD,l,o)(u):(e.consume(u),i)}function o(u){return e.exit("chunkContent"),e.exit("content"),t(u)}function l(u){return e.consume(u),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,i}}function dD(e,t,r){const a=this;return i;function i(l){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),br(e,o,"linePrefix")}function o(l){if(l===null||Vt(l))return r(l);const u=a.events[a.events.length-1];return!a.parser.constructs.disable.null.includes("codeIndented")&&u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?t(l):e.interrupt(a.parser.constructs.flow,r,t)(l)}}function n5(e,t,r,a,i,o,l,u,d){const f=d||Number.POSITIVE_INFINITY;let p=0;return h;function h(w){return w===60?(e.enter(a),e.enter(i),e.enter(o),e.consume(w),e.exit(o),m):w===null||w===32||w===41||nf(w)?r(w):(e.enter(a),e.enter(l),e.enter(u),e.enter("chunkString",{contentType:"string"}),k(w))}function m(w){return w===62?(e.enter(o),e.consume(w),e.exit(o),e.exit(i),e.exit(a),t):(e.enter(u),e.enter("chunkString",{contentType:"string"}),y(w))}function y(w){return w===62?(e.exit("chunkString"),e.exit(u),m(w)):w===null||w===60||Vt(w)?r(w):(e.consume(w),w===92?v:y)}function v(w){return w===60||w===62||w===92?(e.consume(w),y):y(w)}function k(w){return!p&&(w===null||w===41||qr(w))?(e.exit("chunkString"),e.exit(u),e.exit(l),e.exit(a),t(w)):p<f&&w===40?(e.consume(w),p++,k):w===41?(e.consume(w),p--,k):w===null||w===32||w===40||nf(w)?r(w):(e.consume(w),w===92?_:k)}function _(w){return w===40||w===41||w===92?(e.consume(w),k):k(w)}}function a5(e,t,r,a,i,o){const l=this;let u=0,d;return f;function f(y){return e.enter(a),e.enter(i),e.consume(y),e.exit(i),e.enter(o),p}function p(y){return u>999||y===null||y===91||y===93&&!d||y===94&&!u&&"_hiddenFootnoteSupport"in l.parser.constructs?r(y):y===93?(e.exit(o),e.enter(i),e.consume(y),e.exit(i),e.exit(a),t):Vt(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),h(y))}function h(y){return y===null||y===91||y===93||Vt(y)||u++>999?(e.exit("chunkString"),p(y)):(e.consume(y),d||(d=!hr(y)),y===92?m:h)}function m(y){return y===91||y===92||y===93?(e.consume(y),u++,h):h(y)}}function i5(e,t,r,a,i,o){let l;return u;function u(m){return m===34||m===39||m===40?(e.enter(a),e.enter(i),e.consume(m),e.exit(i),l=m===40?41:m,d):r(m)}function d(m){return m===l?(e.enter(i),e.consume(m),e.exit(i),e.exit(a),t):(e.enter(o),f(m))}function f(m){return m===l?(e.exit(o),d(l)):m===null?r(m):Vt(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),br(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(m))}function p(m){return m===l||m===null||Vt(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 qc(e,t){let r;return a;function a(i){return Vt(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),r=!0,a):hr(i)?br(e,a,r?"linePrefix":"lineSuffix")(i):t(i)}}const fD={name:"definition",tokenize:gD},pD={partial:!0,tokenize:hD};function gD(e,t,r){const a=this;let i;return o;function o(y){return e.enter("definition"),l(y)}function l(y){return a5.call(a,e,u,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function u(y){return i=xi(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)),y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),d):r(y)}function d(y){return qr(y)?qc(e,f)(y):f(y)}function f(y){return n5(e,p,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function p(y){return e.attempt(pD,h,h)(y)}function h(y){return hr(y)?br(e,m,"whitespace")(y):m(y)}function m(y){return y===null||Vt(y)?(e.exit("definition"),a.parser.defined.push(i),t(y)):r(y)}}function hD(e,t,r){return a;function a(u){return qr(u)?qc(e,i)(u):r(u)}function i(u){return i5(e,o,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(u)}function o(u){return hr(u)?br(e,l,"whitespace")(u):l(u)}function l(u){return u===null||Vt(u)?t(u):r(u)}}const mD={name:"hardBreakEscape",tokenize:xD};function xD(e,t,r){return a;function a(o){return e.enter("hardBreakEscape"),e.consume(o),i}function i(o){return Vt(o)?(e.exit("hardBreakEscape"),t(o)):r(o)}}const yD={name:"headingAtx",resolve:bD,tokenize:vD};function bD(e,t){let r=e.length-2,a=3,i,o;return e[a][1].type==="whitespace"&&(a+=2),r-2>a&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(a===r-1||r-4>a&&e[r-2][1].type==="whitespace")&&(r-=a+1===r?2:4),r>a&&(i={type:"atxHeadingText",start:e[a][1].start,end:e[r][1].end},o={type:"chunkText",start:e[a][1].start,end:e[r][1].end,contentType:"text"},za(e,a,r-a+1,[["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t]])),e}function vD(e,t,r){let a=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&&a++<6?(e.consume(p),l):p===null||qr(p)?(e.exit("atxHeadingSequence"),u(p)):r(p)}function u(p){return p===35?(e.enter("atxHeadingSequence"),d(p)):p===null||Vt(p)?(e.exit("atxHeading"),t(p)):hr(p)?br(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||qr(p)?(e.exit("atxHeadingText"),u(p)):(e.consume(p),f)}}const kD=["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"],bw=["pre","script","style","textarea"],_D={concrete:!0,name:"htmlFlow",resolveTo:ND,tokenize:ED},wD={partial:!0,tokenize:CD},SD={partial:!0,tokenize:jD};function ND(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 ED(e,t,r){const a=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,a.interrupt?t:P):ia(F)?(e.consume(F),l=String.fromCharCode(F),_):r(F)}function m(F){return F===45?(e.consume(F),i=2,y):F===91?(e.consume(F),i=5,u=0,v):ia(F)?(e.consume(F),i=4,a.interrupt?t:P):r(F)}function y(F){return F===45?(e.consume(F),a.interrupt?t:P):r(F)}function v(F){const Z="CDATA[";return F===Z.charCodeAt(u++)?(e.consume(F),u===Z.length?a.interrupt?t:z:v):r(F)}function k(F){return ia(F)?(e.consume(F),l=String.fromCharCode(F),_):r(F)}function _(F){if(F===null||F===47||F===62||qr(F)){const Z=F===47,W=l.toLowerCase();return!Z&&!o&&bw.includes(W)?(i=1,a.interrupt?t(F):z(F)):kD.includes(l.toLowerCase())?(i=6,Z?(e.consume(F),w):a.interrupt?t(F):z(F)):(i=7,a.interrupt&&!a.parser.lazy[a.now().line]?r(F):o?N(F):E(F))}return F===45||Qn(F)?(e.consume(F),l+=String.fromCharCode(F),_):r(F)}function w(F){return F===62?(e.consume(F),a.interrupt?t:z):r(F)}function N(F){return hr(F)?(e.consume(F),N):I(F)}function E(F){return F===47?(e.consume(F),I):F===58||F===95||ia(F)?(e.consume(F),A):hr(F)?(e.consume(F),E):I(F)}function A(F){return F===45||F===46||F===58||F===95||Qn(F)?(e.consume(F),A):T(F)}function T(F){return F===61?(e.consume(F),C):hr(F)?(e.consume(F),T):E(F)}function C(F){return F===null||F===60||F===61||F===62||F===96?r(F):F===34||F===39?(e.consume(F),d=F,j):hr(F)?(e.consume(F),C):M(F)}function j(F){return F===d?(e.consume(F),d=null,L):F===null||Vt(F)?r(F):(e.consume(F),j)}function M(F){return F===null||F===34||F===39||F===47||F===60||F===61||F===62||F===96||qr(F)?T(F):(e.consume(F),M)}function L(F){return F===47||F===62||hr(F)?E(F):r(F)}function I(F){return F===62?(e.consume(F),B):r(F)}function B(F){return F===null||Vt(F)?z(F):hr(F)?(e.consume(F),B):r(F)}function z(F){return F===45&&i===2?(e.consume(F),K):F===60&&i===1?(e.consume(F),H):F===62&&i===4?(e.consume(F),U):F===63&&i===3?(e.consume(F),P):F===93&&i===5?(e.consume(F),ne):Vt(F)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(wD,X,ee)(F)):F===null||Vt(F)?(e.exit("htmlFlowData"),ee(F)):(e.consume(F),z)}function ee(F){return e.check(SD,V,X)(F)}function V(F){return e.enter("lineEnding"),e.consume(F),e.exit("lineEnding"),D}function D(F){return F===null||Vt(F)?ee(F):(e.enter("htmlFlowData"),z(F))}function K(F){return F===45?(e.consume(F),P):z(F)}function H(F){return F===47?(e.consume(F),l="",J):z(F)}function J(F){if(F===62){const Z=l.toLowerCase();return bw.includes(Z)?(e.consume(F),U):z(F)}return ia(F)&&l.length<8?(e.consume(F),l+=String.fromCharCode(F),J):z(F)}function ne(F){return F===93?(e.consume(F),P):z(F)}function P(F){return F===62?(e.consume(F),U):F===45&&i===2?(e.consume(F),P):z(F)}function U(F){return F===null||Vt(F)?(e.exit("htmlFlowData"),X(F)):(e.consume(F),U)}function X(F){return e.exit("htmlFlow"),t(F)}}function jD(e,t,r){const a=this;return i;function i(l){return Vt(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o):r(l)}function o(l){return a.parser.lazy[a.now().line]?r(l):t(l)}}function CD(e,t,r){return a;function a(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(uu,t,r)}}const TD={name:"htmlText",tokenize:RD};function RD(e,t,r){const a=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),E):ia(P)?(e.consume(P),M):r(P)}function f(P){return P===45?(e.consume(P),p):P===91?(e.consume(P),o=0,v):ia(P)?(e.consume(P),N):r(P)}function p(P){return P===45?(e.consume(P),y):r(P)}function h(P){return P===null?r(P):P===45?(e.consume(P),m):Vt(P)?(l=h,H(P)):(e.consume(P),h)}function m(P){return P===45?(e.consume(P),y):h(P)}function y(P){return P===62?K(P):P===45?m(P):h(P)}function v(P){const U="CDATA[";return P===U.charCodeAt(o++)?(e.consume(P),o===U.length?k:v):r(P)}function k(P){return P===null?r(P):P===93?(e.consume(P),_):Vt(P)?(l=k,H(P)):(e.consume(P),k)}function _(P){return P===93?(e.consume(P),w):k(P)}function w(P){return P===62?K(P):P===93?(e.consume(P),w):k(P)}function N(P){return P===null||P===62?K(P):Vt(P)?(l=N,H(P)):(e.consume(P),N)}function E(P){return P===null?r(P):P===63?(e.consume(P),A):Vt(P)?(l=E,H(P)):(e.consume(P),E)}function A(P){return P===62?K(P):E(P)}function T(P){return ia(P)?(e.consume(P),C):r(P)}function C(P){return P===45||Qn(P)?(e.consume(P),C):j(P)}function j(P){return Vt(P)?(l=j,H(P)):hr(P)?(e.consume(P),j):K(P)}function M(P){return P===45||Qn(P)?(e.consume(P),M):P===47||P===62||qr(P)?L(P):r(P)}function L(P){return P===47?(e.consume(P),K):P===58||P===95||ia(P)?(e.consume(P),I):Vt(P)?(l=L,H(P)):hr(P)?(e.consume(P),L):K(P)}function I(P){return P===45||P===46||P===58||P===95||Qn(P)?(e.consume(P),I):B(P)}function B(P){return P===61?(e.consume(P),z):Vt(P)?(l=B,H(P)):hr(P)?(e.consume(P),B):L(P)}function z(P){return P===null||P===60||P===61||P===62||P===96?r(P):P===34||P===39?(e.consume(P),i=P,ee):Vt(P)?(l=z,H(P)):hr(P)?(e.consume(P),z):(e.consume(P),V)}function ee(P){return P===i?(e.consume(P),i=void 0,D):P===null?r(P):Vt(P)?(l=ee,H(P)):(e.consume(P),ee)}function V(P){return P===null||P===34||P===39||P===60||P===61||P===96?r(P):P===47||P===62||qr(P)?L(P):(e.consume(P),V)}function D(P){return P===47||P===62||qr(P)?L(P):r(P)}function K(P){return P===62?(e.consume(P),e.exit("htmlTextData"),e.exit("htmlText"),t):r(P)}function H(P){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),J}function J(P){return hr(P)?br(e,ne,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):ne(P)}function ne(P){return e.enter("htmlTextData"),l(P)}}const Yv={name:"labelEnd",resolveAll:LD,resolveTo:OD,tokenize:DD},AD={tokenize:PD},ID={tokenize:FD},MD={tokenize:BD};function LD(e){let t=-1;const r=[];for(;++t<e.length;){const a=e[t][1];if(r.push(e[t]),a.type==="labelImage"||a.type==="labelLink"||a.type==="labelEnd"){const i=a.type==="labelImage"?4:2;a.type="data",t+=i}}return e.length!==r.length&&za(e,0,e.length,r),e}function OD(e,t){let r=e.length,a=0,i,o,l,u;for(;r--;)if(i=e[r][1],o){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[r][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(l){if(e[r][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(o=r,i.type!=="labelLink")){a=2;break}}else i.type==="labelEnd"&&(l=r);const d={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},f={type:"label",start:{...e[o][1].start},end:{...e[l][1].end}},p={type:"labelText",start:{...e[o+a+2][1].end},end:{...e[l-2][1].start}};return u=[["enter",d,t],["enter",f,t]],u=Qa(u,e.slice(o+1,o+a+3)),u=Qa(u,[["enter",p,t]]),u=Qa(u,wf(t.parser.constructs.insideSpan.null,e.slice(o+a+4,l-3),t)),u=Qa(u,[["exit",p,t],e[l-2],e[l-1],["exit",f,t]]),u=Qa(u,e.slice(l+1)),u=Qa(u,[["exit",d,t]]),za(e,o,e.length,u),e}function DD(e,t,r){const a=this;let i=a.events.length,o,l;for(;i--;)if((a.events[i][1].type==="labelImage"||a.events[i][1].type==="labelLink")&&!a.events[i][1]._balanced){o=a.events[i][1];break}return u;function u(m){return o?o._inactive?h(m):(l=a.parser.defined.includes(xi(a.sliceSerialize({start:o.end,end:a.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(m),e.exit("labelMarker"),e.exit("labelEnd"),d):r(m)}function d(m){return m===40?e.attempt(AD,p,l?p:h)(m):m===91?e.attempt(ID,p,l?f:h)(m):l?p(m):h(m)}function f(m){return e.attempt(MD,p,h)(m)}function p(m){return t(m)}function h(m){return o._balanced=!0,r(m)}}function PD(e,t,r){return a;function a(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),i}function i(h){return qr(h)?qc(e,o)(h):o(h)}function o(h){return h===41?p(h):n5(e,l,u,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function l(h){return qr(h)?qc(e,d)(h):p(h)}function u(h){return r(h)}function d(h){return h===34||h===39||h===40?i5(e,f,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):p(h)}function f(h){return qr(h)?qc(e,p)(h):p(h)}function p(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),t):r(h)}}function FD(e,t,r){const a=this;return i;function i(u){return a5.call(a,e,o,l,"reference","referenceMarker","referenceString")(u)}function o(u){return a.parser.defined.includes(xi(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)))?t(u):r(u)}function l(u){return r(u)}}function BD(e,t,r){return a;function a(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),i}function i(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):r(o)}}const zD={name:"labelStartImage",resolveAll:Yv.resolveAll,tokenize:UD};function UD(e,t,r){const a=this;return i;function i(u){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(u),e.exit("labelImageMarker"),o}function o(u){return u===91?(e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),e.exit("labelImage"),l):r(u)}function l(u){return u===94&&"_hiddenFootnoteSupport"in a.parser.constructs?r(u):t(u)}}const qD={name:"labelStartLink",resolveAll:Yv.resolveAll,tokenize:HD};function HD(e,t,r){const a=this;return i;function i(l){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelLink"),o}function o(l){return l===94&&"_hiddenFootnoteSupport"in a.parser.constructs?r(l):t(l)}}const Mg={name:"lineEnding",tokenize:$D};function $D(e,t){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),br(e,t,"linePrefix")}}const Xd={name:"thematicBreak",tokenize:WD};function WD(e,t,r){let a=0,i;return o;function o(f){return e.enter("thematicBreak"),l(f)}function l(f){return i=f,u(f)}function u(f){return f===i?(e.enter("thematicBreakSequence"),d(f)):a>=3&&(f===null||Vt(f))?(e.exit("thematicBreak"),t(f)):r(f)}function d(f){return f===i?(e.consume(f),a++,d):(e.exit("thematicBreakSequence"),hr(f)?br(e,u,"whitespace")(f):u(f))}}const ya={continuation:{tokenize:YD},exit:QD,name:"list",tokenize:KD},VD={partial:!0,tokenize:ZD},GD={partial:!0,tokenize:XD};function KD(e,t,r){const a=this,i=a.events[a.events.length-1];let o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,l=0;return u;function u(y){const v=a.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(v==="listUnordered"?!a.containerState.marker||y===a.containerState.marker:rv(y)){if(a.containerState.type||(a.containerState.type=v,e.enter(v,{_container:!0})),v==="listUnordered")return e.enter("listItemPrefix"),y===42||y===45?e.check(Xd,r,f)(y):f(y);if(!a.interrupt||y===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),d(y)}return r(y)}function d(y){return rv(y)&&++l<10?(e.consume(y),d):(!a.interrupt||l<2)&&(a.containerState.marker?y===a.containerState.marker:y===41||y===46)?(e.exit("listItemValue"),f(y)):r(y)}function f(y){return e.enter("listItemMarker"),e.consume(y),e.exit("listItemMarker"),a.containerState.marker=a.containerState.marker||y,e.check(uu,a.interrupt?r:p,e.attempt(VD,m,h))}function p(y){return a.containerState.initialBlankLine=!0,o++,m(y)}function h(y){return hr(y)?(e.enter("listItemPrefixWhitespace"),e.consume(y),e.exit("listItemPrefixWhitespace"),m):r(y)}function m(y){return a.containerState.size=o+a.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(y)}}function YD(e,t,r){const a=this;return a.containerState._closeFlow=void 0,e.check(uu,i,o);function i(u){return a.containerState.furtherBlankLines=a.containerState.furtherBlankLines||a.containerState.initialBlankLine,br(e,t,"listItemIndent",a.containerState.size+1)(u)}function o(u){return a.containerState.furtherBlankLines||!hr(u)?(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,l(u)):(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,e.attempt(GD,t,l)(u))}function l(u){return a.containerState._closeFlow=!0,a.interrupt=void 0,br(e,e.attempt(ya,t,r),"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u)}}function XD(e,t,r){const a=this;return br(e,i,"listItemIndent",a.containerState.size+1);function i(o){const l=a.events[a.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===a.containerState.size?t(o):r(o)}}function QD(e){e.exit(this.containerState.type)}function ZD(e,t,r){const a=this;return br(e,i,"listItemPrefixWhitespace",a.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(o){const l=a.events[a.events.length-1];return!hr(o)&&l&&l[1].type==="listItemPrefixWhitespace"?t(o):r(o)}}const vw={name:"setextUnderline",resolveTo:JD,tokenize:eP};function JD(e,t){let r=e.length,a,i,o;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){a=r;break}e[r][1].type==="paragraph"&&(i=r)}else e[r][1].type==="content"&&e.splice(r,1),!o&&e[r][1].type==="definition"&&(o=r);const l={type:"setextHeading",start:{...e[a][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",o?(e.splice(i,0,["enter",l,t]),e.splice(o+1,0,["exit",e[a][1],t]),e[a][1].end={...e[o][1].end}):e[a][1]=l,e.push(["exit",l,t]),e}function eP(e,t,r){const a=this;let i;return o;function o(f){let p=a.events.length,h;for(;p--;)if(a.events[p][1].type!=="lineEnding"&&a.events[p][1].type!=="linePrefix"&&a.events[p][1].type!=="content"){h=a.events[p][1].type==="paragraph";break}return!a.parser.lazy[a.now().line]&&(a.interrupt||h)?(e.enter("setextHeadingLine"),i=f,l(f)):r(f)}function l(f){return e.enter("setextHeadingLineSequence"),u(f)}function u(f){return f===i?(e.consume(f),u):(e.exit("setextHeadingLineSequence"),hr(f)?br(e,d,"lineSuffix")(f):d(f))}function d(f){return f===null||Vt(f)?(e.exit("setextHeadingLine"),t(f)):r(f)}}const tP={tokenize:rP};function rP(e){const t=this,r=e.attempt(uu,a,e.attempt(this.parser.constructs.flowInitial,i,br(e,e.attempt(this.parser.constructs.flow,i,e.attempt(oD,i)),"linePrefix")));return r;function a(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,r}function i(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,r}}const nP={resolveAll:o5()},aP=s5("string"),iP=s5("text");function s5(e){return{resolveAll:o5(e==="text"?sP:void 0),tokenize:t};function t(r){const a=this,i=this.parser.constructs[e],o=r.attempt(i,l,u);return l;function l(p){return f(p)?o(p):u(p)}function u(p){if(p===null){r.consume(p);return}return r.enter("data"),r.consume(p),d}function d(p){return f(p)?(r.exit("data"),o(p)):(r.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 y=h[m];if(!y.previous||y.previous.call(a,a.previous))return!0}return!1}}}function o5(e){return t;function t(r,a){let i=-1,o;for(;++i<=r.length;)o===void 0?r[i]&&r[i][1].type==="data"&&(o=i,i++):(!r[i]||r[i][1].type!=="data")&&(i!==o+2&&(r[o][1].end=r[i-1][1].end,r.splice(o+2,i-o-2),i=o+2),o=void 0);return e?e(r,a):r}}function sP(e,t){let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const a=e[r-1][1],i=t.sliceStream(a);let o=i.length,l=-1,u=0,d;for(;o--;){const f=i[o];if(typeof f=="string"){for(l=f.length;f.charCodeAt(l-1)===32;)u++,l--;if(l)break;l=-1}else if(f===-2)d=!0,u++;else if(f!==-1){o++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(u=0),u){const f={type:r===e.length||d||u<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?l:a.start._bufferIndex+l,_index:a.start._index+o,line:a.end.line,column:a.end.column-u,offset:a.end.offset-u},end:{...a.end}};a.end={...f.start},a.start.offset===a.end.offset?Object.assign(a,f):(e.splice(r,0,["enter",f,t],["exit",f,t]),r+=2)}r++}return e}const oP={42:ya,43:ya,45:ya,48:ya,49:ya,50:ya,51:ya,52:ya,53:ya,54:ya,55:ya,56:ya,57:ya,62:JT},lP={91:fD},cP={[-2]:Ig,[-1]:Ig,32:Ig},uP={35:yD,42:Xd,45:[vw,Xd],60:_D,61:vw,95:Xd,96:yw,126:yw},dP={38:t5,92:e5},fP={[-5]:Mg,[-4]:Mg,[-3]:Mg,33:zD,38:t5,42:nv,60:[qO,TD],91:qD,92:[mD,e5],93:Yv,95:nv,96:tD},pP={null:[nv,nP]},gP={null:[42,95]},hP={null:[]},mP=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:gP,contentInitial:lP,disable:hP,document:oP,flow:uP,flowInitial:cP,insideSpan:pP,string:dP,text:fP},Symbol.toStringTag,{value:"Module"}));function xP(e,t,r){let a={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const i={},o=[];let l=[],u=[];const d={attempt:j(T),check:j(C),consume:N,enter:E,exit:A,interrupt:j(C,{interrupt:!0})},f={code:null,containerState:{},defineSkip:k,events:[],now:v,parser:e,previous:null,sliceSerialize:m,sliceStream:y,write:h};let p=t.tokenize.call(f,d);return t.resolveAll&&o.push(t),f;function h(B){return l=Qa(l,B),_(),l[l.length-1]!==null?[]:(M(t,0),f.events=wf(o,f.events,f),f.events)}function m(B,z){return bP(y(B),z)}function y(B){return yP(l,B)}function v(){const{_bufferIndex:B,_index:z,line:ee,column:V,offset:D}=a;return{_bufferIndex:B,_index:z,line:ee,column:V,offset:D}}function k(B){i[B.line]=B.column,I()}function _(){let B;for(;a._index<l.length;){const z=l[a._index];if(typeof z=="string")for(B=a._index,a._bufferIndex<0&&(a._bufferIndex=0);a._index===B&&a._bufferIndex<z.length;)w(z.charCodeAt(a._bufferIndex));else w(z)}}function w(B){p=p(B)}function N(B){Vt(B)?(a.line++,a.column=1,a.offset+=B===-3?2:1,I()):B!==-1&&(a.column++,a.offset++),a._bufferIndex<0?a._index++:(a._bufferIndex++,a._bufferIndex===l[a._index].length&&(a._bufferIndex=-1,a._index++)),f.previous=B}function E(B,z){const ee=z||{};return ee.type=B,ee.start=v(),f.events.push(["enter",ee,f]),u.push(ee),ee}function A(B){const z=u.pop();return z.end=v(),f.events.push(["exit",z,f]),z}function T(B,z){M(B,z.from)}function C(B,z){z.restore()}function j(B,z){return ee;function ee(V,D,K){let H,J,ne,P;return Array.isArray(V)?X(V):"tokenize"in V?X([V]):U(V);function U(G){return oe;function oe(Q){const fe=Q!==null&&G[Q],ke=Q!==null&&G.null,Fe=[...Array.isArray(fe)?fe:fe?[fe]:[],...Array.isArray(ke)?ke:ke?[ke]:[]];return X(Fe)(Q)}}function X(G){return H=G,J=0,G.length===0?K:F(G[J])}function F(G){return oe;function oe(Q){return P=L(),ne=G,G.partial||(f.currentConstruct=G),G.name&&f.parser.constructs.disable.null.includes(G.name)?W():G.tokenize.call(z?Object.assign(Object.create(f),z):f,d,Z,W)(Q)}}function Z(G){return B(ne,P),D}function W(G){return P.restore(),++J<H.length?F(H[J]):K}}}function M(B,z){B.resolveAll&&!o.includes(B)&&o.push(B),B.resolve&&za(f.events,z,f.events.length-z,B.resolve(f.events.slice(z),f)),B.resolveTo&&(f.events=B.resolveTo(f.events,f))}function L(){const B=v(),z=f.previous,ee=f.currentConstruct,V=f.events.length,D=Array.from(u);return{from:V,restore:K};function K(){a=B,f.previous=z,f.currentConstruct=ee,f.events.length=V,u=D,I()}}function I(){a.line in i&&a.column<2&&(a.column=i[a.line],a.offset+=i[a.line]-1)}}function yP(e,t){const r=t.start._index,a=t.start._bufferIndex,i=t.end._index,o=t.end._bufferIndex;let l;if(r===i)l=[e[r].slice(a,o)];else{if(l=e.slice(r,i),a>-1){const u=l[0];typeof u=="string"?l[0]=u.slice(a):l.shift()}o>0&&l.push(e[i].slice(0,o))}return l}function bP(e,t){let r=-1;const a=[];let i;for(;++r<e.length;){const o=e[r];let l;if(typeof o=="string")l=o;else switch(o){case-5:{l="\r";break}case-4:{l=`
50
+ `;break}case-3:{l=`\r
51
+ `;break}case-2:{l=t?" ":" ";break}case-1:{if(!t&&i)continue;l=" ";break}default:l=String.fromCharCode(o)}i=o===-2,a.push(l)}return a.join("")}function vP(e){const a={constructs:QT([mP,...(e||{}).extensions||[]]),content:i(OO),defined:[],document:i(PO),flow:i(tP),lazy:{},string:i(aP),text:i(iP)};return a;function i(o){return l;function l(u){return xP(a,o,u)}}}function kP(e){for(;!r5(e););return e}const kw=/[\0\t\n\r]/g;function _P(){let e=1,t="",r=!0,a;return i;function i(o,l,u){const d=[];let f,p,h,m,y;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(l||void 0).decode(o)),h=0,t="",r&&(o.charCodeAt(0)===65279&&h++,r=void 0);h<o.length;){if(kw.lastIndex=h,f=kw.exec(o),m=f&&f.index!==void 0?f.index:o.length,y=o.charCodeAt(m),!f){t=o.slice(h);break}if(y===10&&h===m&&a)d.push(-3),a=void 0;else switch(a&&(d.push(-5),a=void 0),h<m&&(d.push(o.slice(h,m)),e+=m-h),y){case 0:{d.push(65533),e++;break}case 9:{for(p=Math.ceil(e/4)*4,d.push(-2);e++<p;)d.push(-1);break}case 10:{d.push(-4),e=1;break}default:a=!0,e=1}h=m+1}return u&&(a&&d.push(-5),t&&d.push(t),d.push(null)),d}}const wP=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function SP(e){return e.replace(wP,NP)}function NP(e,t,r){if(t)return t;if(r.charCodeAt(0)===35){const i=r.charCodeAt(1),o=i===120||i===88;return ZT(r.slice(o?2:1),o?16:10)}return Kv(r)||e}const l5={}.hasOwnProperty;function EP(e,t,r){return t&&typeof t=="object"&&(r=t,t=void 0),jP(r)(kP(vP(r).document().write(_P()(e,t,!0))))}function jP(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(mt),autolinkProtocol:L,autolinkEmail:L,atxHeading:o(Ce),blockQuote:o(ke),characterEscape:L,characterReference:L,codeFenced:o(Fe),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:o(Fe,l),codeText:o(Ve,l),codeTextData:L,data:L,codeFlowValue:L,definition:o(Ge),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:o(qe),hardBreakEscape:o(He),hardBreakTrailing:o(He),htmlFlow:o(ze,l),htmlFlowData:L,htmlText:o(ze,l),htmlTextData:L,image:o(gt),label:l,link:o(mt),listItem:o($e),listItemValue:m,listOrdered:o(wt,h),listUnordered:o(wt),paragraph:o(Et),reference:F,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:o(Ce),strong:o(Ze),thematicBreak:o(it)},exit:{atxHeading:d(),atxHeadingSequence:T,autolink:d(),autolinkEmail:fe,autolinkProtocol:Q,blockQuote:d(),characterEscapeValue:I,characterReferenceMarkerHexadecimal:W,characterReferenceMarkerNumeric:W,characterReferenceValue:G,characterReference:oe,codeFenced:d(_),codeFencedFence:k,codeFencedFenceInfo:y,codeFencedFenceMeta:v,codeFlowValue:I,codeIndented:d(w),codeText:d(D),codeTextData:I,data:I,definition:d(),definitionDestinationString:A,definitionLabelString:N,definitionTitleString:E,emphasis:d(),hardBreakEscape:d(z),hardBreakTrailing:d(z),htmlFlow:d(ee),htmlFlowData:I,htmlText:d(V),htmlTextData:I,image:d(H),label:ne,labelText:J,lineEnding:B,link:d(K),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:Z,resourceDestinationString:P,resourceTitleString:U,resource:X,setextHeading:d(M),setextHeadingLineSequence:j,setextHeadingText:C,strong:d(),thematicBreak:d()}};c5(t,(e||{}).mdastExtensions||[]);const r={};return a;function a(me){let Ee={type:"root",children:[]};const ge={stack:[Ee],tokenStack:[],config:t,enter:u,exit:f,buffer:l,resume:p,data:r},je=[];let se=-1;for(;++se<me.length;)if(me[se][1].type==="listOrdered"||me[se][1].type==="listUnordered")if(me[se][0]==="enter")je.push(se);else{const De=je.pop();se=i(me,De,se)}for(se=-1;++se<me.length;){const De=t[me[se][0]];l5.call(De,me[se][1].type)&&De[me[se][1].type].call(Object.assign({sliceSerialize:me[se][2].sliceSerialize},ge),me[se][1])}if(ge.tokenStack.length>0){const De=ge.tokenStack[ge.tokenStack.length-1];(De[1]||_w).call(ge,void 0,De[0])}for(Ee.position={start:Es(me.length>0?me[0][1].start:{line:1,column:1,offset:0}),end:Es(me.length>0?me[me.length-2][1].end:{line:1,column:1,offset:0})},se=-1;++se<t.transforms.length;)Ee=t.transforms[se](Ee)||Ee;return Ee}function i(me,Ee,ge){let je=Ee-1,se=-1,De=!1,rt,dt,lt,Lt;for(;++je<=ge;){const ot=me[je];switch(ot[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ot[0]==="enter"?se++:se--,Lt=void 0;break}case"lineEndingBlank":{ot[0]==="enter"&&(rt&&!Lt&&!se&&!lt&&(lt=je),Lt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Lt=void 0}if(!se&&ot[0]==="enter"&&ot[1].type==="listItemPrefix"||se===-1&&ot[0]==="exit"&&(ot[1].type==="listUnordered"||ot[1].type==="listOrdered")){if(rt){let et=je;for(dt=void 0;et--;){const Ot=me[et];if(Ot[1].type==="lineEnding"||Ot[1].type==="lineEndingBlank"){if(Ot[0]==="exit")continue;dt&&(me[dt][1].type="lineEndingBlank",De=!0),Ot[1].type="lineEnding",dt=et}else if(!(Ot[1].type==="linePrefix"||Ot[1].type==="blockQuotePrefix"||Ot[1].type==="blockQuotePrefixWhitespace"||Ot[1].type==="blockQuoteMarker"||Ot[1].type==="listItemIndent"))break}lt&&(!dt||lt<dt)&&(rt._spread=!0),rt.end=Object.assign({},dt?me[dt][1].start:ot[1].end),me.splice(dt||je,0,["exit",rt,ot[2]]),je++,ge++}if(ot[1].type==="listItemPrefix"){const et={type:"listItem",_spread:!1,start:Object.assign({},ot[1].start),end:void 0};rt=et,me.splice(je,0,["enter",et,ot[2]]),je++,ge++,lt=void 0,Lt=!0}}}return me[Ee][1]._spread=De,ge}function o(me,Ee){return ge;function ge(je){u.call(this,me(je),je),Ee&&Ee.call(this,je)}}function l(){this.stack.push({type:"fragment",children:[]})}function u(me,Ee,ge){this.stack[this.stack.length-1].children.push(me),this.stack.push(me),this.tokenStack.push([Ee,ge||void 0]),me.position={start:Es(Ee.start),end:void 0}}function d(me){return Ee;function Ee(ge){me&&me.call(this,ge),f.call(this,ge)}}function f(me,Ee){const ge=this.stack.pop(),je=this.tokenStack.pop();if(je)je[0].type!==me.type&&(Ee?Ee.call(this,me,je[0]):(je[1]||_w).call(this,me,je[0]));else throw new Error("Cannot close `"+me.type+"` ("+Uc({start:me.start,end:me.end})+"): it’s not open");ge.position.end=Es(me.end)}function p(){return Gv(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function m(me){if(this.data.expectingFirstListItemValue){const Ee=this.stack[this.stack.length-2];Ee.start=Number.parseInt(this.sliceSerialize(me),10),this.data.expectingFirstListItemValue=void 0}}function y(){const me=this.resume(),Ee=this.stack[this.stack.length-1];Ee.lang=me}function v(){const me=this.resume(),Ee=this.stack[this.stack.length-1];Ee.meta=me}function k(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function _(){const me=this.resume(),Ee=this.stack[this.stack.length-1];Ee.value=me.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function w(){const me=this.resume(),Ee=this.stack[this.stack.length-1];Ee.value=me.replace(/(\r?\n|\r)$/g,"")}function N(me){const Ee=this.resume(),ge=this.stack[this.stack.length-1];ge.label=Ee,ge.identifier=xi(this.sliceSerialize(me)).toLowerCase()}function E(){const me=this.resume(),Ee=this.stack[this.stack.length-1];Ee.title=me}function A(){const me=this.resume(),Ee=this.stack[this.stack.length-1];Ee.url=me}function T(me){const Ee=this.stack[this.stack.length-1];if(!Ee.depth){const ge=this.sliceSerialize(me).length;Ee.depth=ge}}function C(){this.data.setextHeadingSlurpLineEnding=!0}function j(me){const Ee=this.stack[this.stack.length-1];Ee.depth=this.sliceSerialize(me).codePointAt(0)===61?1:2}function M(){this.data.setextHeadingSlurpLineEnding=void 0}function L(me){const ge=this.stack[this.stack.length-1].children;let je=ge[ge.length-1];(!je||je.type!=="text")&&(je=Oe(),je.position={start:Es(me.start),end:void 0},ge.push(je)),this.stack.push(je)}function I(me){const Ee=this.stack.pop();Ee.value+=this.sliceSerialize(me),Ee.position.end=Es(me.end)}function B(me){const Ee=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ge=Ee.children[Ee.children.length-1];ge.position.end=Es(me.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Ee.type)&&(L.call(this,me),I.call(this,me))}function z(){this.data.atHardBreak=!0}function ee(){const me=this.resume(),Ee=this.stack[this.stack.length-1];Ee.value=me}function V(){const me=this.resume(),Ee=this.stack[this.stack.length-1];Ee.value=me}function D(){const me=this.resume(),Ee=this.stack[this.stack.length-1];Ee.value=me}function K(){const me=this.stack[this.stack.length-1];if(this.data.inReference){const Ee=this.data.referenceType||"shortcut";me.type+="Reference",me.referenceType=Ee,delete me.url,delete me.title}else delete me.identifier,delete me.label;this.data.referenceType=void 0}function H(){const me=this.stack[this.stack.length-1];if(this.data.inReference){const Ee=this.data.referenceType||"shortcut";me.type+="Reference",me.referenceType=Ee,delete me.url,delete me.title}else delete me.identifier,delete me.label;this.data.referenceType=void 0}function J(me){const Ee=this.sliceSerialize(me),ge=this.stack[this.stack.length-2];ge.label=SP(Ee),ge.identifier=xi(Ee).toLowerCase()}function ne(){const me=this.stack[this.stack.length-1],Ee=this.resume(),ge=this.stack[this.stack.length-1];if(this.data.inReference=!0,ge.type==="link"){const je=me.children;ge.children=je}else ge.alt=Ee}function P(){const me=this.resume(),Ee=this.stack[this.stack.length-1];Ee.url=me}function U(){const me=this.resume(),Ee=this.stack[this.stack.length-1];Ee.title=me}function X(){this.data.inReference=void 0}function F(){this.data.referenceType="collapsed"}function Z(me){const Ee=this.resume(),ge=this.stack[this.stack.length-1];ge.label=Ee,ge.identifier=xi(this.sliceSerialize(me)).toLowerCase(),this.data.referenceType="full"}function W(me){this.data.characterReferenceType=me.type}function G(me){const Ee=this.sliceSerialize(me),ge=this.data.characterReferenceType;let je;ge?(je=ZT(Ee,ge==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):je=Kv(Ee);const se=this.stack[this.stack.length-1];se.value+=je}function oe(me){const Ee=this.stack.pop();Ee.position.end=Es(me.end)}function Q(me){I.call(this,me);const Ee=this.stack[this.stack.length-1];Ee.url=this.sliceSerialize(me)}function fe(me){I.call(this,me);const Ee=this.stack[this.stack.length-1];Ee.url="mailto:"+this.sliceSerialize(me)}function ke(){return{type:"blockquote",children:[]}}function Fe(){return{type:"code",lang:null,meta:null,value:""}}function Ve(){return{type:"inlineCode",value:""}}function Ge(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function qe(){return{type:"emphasis",children:[]}}function Ce(){return{type:"heading",depth:0,children:[]}}function He(){return{type:"break"}}function ze(){return{type:"html",value:""}}function gt(){return{type:"image",title:null,url:"",alt:null}}function mt(){return{type:"link",title:null,url:"",children:[]}}function wt(me){return{type:"list",ordered:me.type==="listOrdered",start:null,spread:me._spread,children:[]}}function $e(me){return{type:"listItem",spread:me._spread,checked:null,children:[]}}function Et(){return{type:"paragraph",children:[]}}function Ze(){return{type:"strong",children:[]}}function Oe(){return{type:"text",value:""}}function it(){return{type:"thematicBreak"}}}function Es(e){return{line:e.line,column:e.column,offset:e.offset}}function c5(e,t){let r=-1;for(;++r<t.length;){const a=t[r];Array.isArray(a)?c5(e,a):CP(e,a)}}function CP(e,t){let r;for(r in t)if(l5.call(t,r))switch(r){case"canContainEols":{const a=t[r];a&&e[r].push(...a);break}case"transforms":{const a=t[r];a&&e[r].push(...a);break}case"enter":case"exit":{const a=t[r];a&&Object.assign(e[r],a);break}}}function _w(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Uc({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Uc({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Uc({start:t.start,end:t.end})+") is still open")}function TP(e){const t=this;t.parser=r;function r(a){return EP(a,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function RP(e,t){const r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,r),e.applyData(t,r)}function AP(e,t){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,r),[e.applyData(t,r),{type:"text",value:`
52
+ `}]}function IP(e,t){const r=t.value?t.value+`
53
+ `:"",a={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(a.className=["language-"+i[0]]);let o={type:"element",tagName:"code",properties:a,children:[{type:"text",value:r}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function MP(e,t){const r={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function LP(e,t){const r={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function OP(e,t){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",a=String(t.identifier).toUpperCase(),i=Dl(a.toLowerCase()),o=e.footnoteOrder.indexOf(a);let l,u=e.footnoteCounts.get(a);u===void 0?(u=0,e.footnoteOrder.push(a),l=e.footnoteOrder.length):l=o+1,u+=1,e.footnoteCounts.set(a,u);const d={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+i,id:r+"fnref-"+i+(u>1?"-"+u:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(l)}]};e.patch(t,d);const f={type:"element",tagName:"sup",properties:{},children:[d]};return e.patch(t,f),e.applyData(t,f)}function DP(e,t){const r={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function PP(e,t){if(e.options.allowDangerousHtml){const r={type:"raw",value:t.value};return e.patch(t,r),e.applyData(t,r)}}function u5(e,t){const r=t.referenceType;let a="]";if(r==="collapsed"?a+="[]":r==="full"&&(a+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+a}];const i=e.all(t),o=i[0];o&&o.type==="text"?o.value="["+o.value:i.unshift({type:"text",value:"["});const l=i[i.length-1];return l&&l.type==="text"?l.value+=a:i.push({type:"text",value:a}),i}function FP(e,t){const r=String(t.identifier).toUpperCase(),a=e.definitionById.get(r);if(!a)return u5(e,t);const i={src:Dl(a.url||""),alt:t.alt};a.title!==null&&a.title!==void 0&&(i.title=a.title);const o={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,o),e.applyData(t,o)}function BP(e,t){const r={src:Dl(t.url)};t.alt!==null&&t.alt!==void 0&&(r.alt=t.alt),t.title!==null&&t.title!==void 0&&(r.title=t.title);const a={type:"element",tagName:"img",properties:r,children:[]};return e.patch(t,a),e.applyData(t,a)}function zP(e,t){const r={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,r);const a={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(t,a),e.applyData(t,a)}function UP(e,t){const r=String(t.identifier).toUpperCase(),a=e.definitionById.get(r);if(!a)return u5(e,t);const i={href:Dl(a.url||"")};a.title!==null&&a.title!==void 0&&(i.title=a.title);const o={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function qP(e,t){const r={href:Dl(t.url)};t.title!==null&&t.title!==void 0&&(r.title=t.title);const a={type:"element",tagName:"a",properties:r,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function HP(e,t,r){const a=e.all(t),i=r?$P(r):d5(t),o={},l=[];if(typeof t.checked=="boolean"){const p=a[0];let h;p&&p.type==="element"&&p.tagName==="p"?h=p:(h={type:"element",tagName:"p",properties:{},children:[]},a.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let u=-1;for(;++u<a.length;){const p=a[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=a[a.length-1];d&&(i||d.type!=="element"||d.tagName!=="p")&&l.push({type:"text",value:`
55
+ `});const f={type:"element",tagName:"li",properties:o,children:l};return e.patch(t,f),e.applyData(t,f)}function $P(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const r=e.children;let a=-1;for(;!t&&++a<r.length;)t=d5(r[a])}return t}function d5(e){const t=e.spread;return t??e.children.length>1}function WP(e,t){const r={},a=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(r.start=t.start);++i<a.length;){const l=a[i];if(l.type==="element"&&l.tagName==="li"&&l.properties&&Array.isArray(l.properties.className)&&l.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:r,children:e.wrap(a,!0)};return e.patch(t,o),e.applyData(t,o)}function VP(e,t){const r={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function GP(e,t){const r={type:"root",children:e.wrap(e.all(t))};return e.patch(t,r),e.applyData(t,r)}function KP(e,t){const r={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function YP(e,t){const r=e.all(t),a=r.shift(),i=[];if(a){const l={type:"element",tagName:"thead",properties:{},children:e.wrap([a],!0)};e.patch(t.children[0],l),i.push(l)}if(r.length>0){const l={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},u=Hv(t.children[1]),d=$T(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 XP(e,t,r){const a=r?r.children:void 0,o=(a?a.indexOf(t):1)===0?"th":"td",l=r&&r.type==="table"?r.align:void 0,u=l?l.length:t.children.length;let d=-1;const f=[];for(;++d<u;){const h=t.children[d],m={},y=l?l[d]:void 0;y&&(m.align=y);let v={type:"element",tagName:o,properties:m,children:[]};h&&(v.children=e.all(h),e.patch(h,v),v=e.applyData(h,v)),f.push(v)}const p={type:"element",tagName:"tr",properties:{},children:e.wrap(f,!0)};return e.patch(t,p),e.applyData(t,p)}function QP(e,t){const r={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}const ww=9,Sw=32;function ZP(e){const t=String(e),r=/\r?\n|\r/g;let a=r.exec(t),i=0;const o=[];for(;a;)o.push(Nw(t.slice(i,a.index),i>0,!0),a[0]),i=a.index+a[0].length,a=r.exec(t);return o.push(Nw(t.slice(i),i>0,!1)),o.join("")}function Nw(e,t,r){let a=0,i=e.length;if(t){let o=e.codePointAt(a);for(;o===ww||o===Sw;)a++,o=e.codePointAt(a)}if(r){let o=e.codePointAt(i-1);for(;o===ww||o===Sw;)i--,o=e.codePointAt(i-1)}return i>a?e.slice(a,i):""}function JP(e,t){const r={type:"text",value:ZP(String(t.value))};return e.patch(t,r),e.applyData(t,r)}function e6(e,t){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,r),e.applyData(t,r)}const t6={blockquote:RP,break:AP,code:IP,delete:MP,emphasis:LP,footnoteReference:OP,heading:DP,html:PP,imageReference:FP,image:BP,inlineCode:zP,linkReference:UP,link:qP,listItem:HP,list:WP,paragraph:VP,root:GP,strong:KP,table:YP,tableCell:QP,tableRow:XP,text:JP,thematicBreak:e6,toml:jd,yaml:jd,definition:jd,footnoteDefinition:jd};function jd(){}const f5=-1,Sf=0,Hc=1,af=2,Xv=3,Qv=4,Zv=5,Jv=6,p5=7,g5=8,{defineProperty:r6}=Object,h5=typeof self=="object"?self:globalThis,Ew=(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 h5[e](t)},n6=(e,t)=>{const r=(i,o)=>(e.set(o,i),i),a=i=>{if(e.has(i))return e.get(i);const[o,l]=t[i];switch(o){case Sf:case f5:return r(l,i);case Hc:{const u=r([],i);for(const d of l)u.push(a(d));return u}case af:{const u=r({},i);for(const[d,f]of l){const p=a(d),h=a(f);p==="__proto__"?r6(u,p,{value:h,configurable:!0,enumerable:!0,writable:!0}):u[p]=h}return u}case Xv:return r(new Date(l),i);case Qv:{const{source:u,flags:d}=l;return r(new RegExp(u,d),i)}case Zv:{const u=r(new Map,i);for(const[d,f]of l)u.set(a(d),a(f));return u}case Jv:{const u=r(new Set,i);for(const d of l)u.add(a(d));return u}case p5:{const{name:u,message:d}=l;return r(typeof h5[u]=="function"?Ew(u,d):new Error(d),i)}case g5:return r(BigInt(l),i);case"BigInt":return r(Object(BigInt(l)),i);case"ArrayBuffer":return r(new Uint8Array(l).buffer,l);case"DataView":{const{buffer:u}=new Uint8Array(l);return r(new DataView(u),l)}case"-0":return-0}return r(Ew(o,l),i)};return a},jw=e=>n6(new Map,e)(0),yo="",{toString:a6}={},{keys:i6,is:s6}=Object,Tc=e=>{const t=typeof e;if(t!=="object"||!e)return[Sf,t];const r=a6.call(e).slice(8,-1);switch(r){case"Array":return[Hc,yo];case"Object":return[af,yo];case"Date":return[Xv,yo];case"RegExp":return[Qv,yo];case"Map":return[Zv,yo];case"Set":return[Jv,yo];case"DataView":return[Hc,r]}return r.includes("Array")?[Hc,r]:e instanceof Error?[p5,e.name||"Error"]:[af,r]},Cd=([e,t])=>e===Sf&&(t==="function"||t==="symbol"),o6=(e,t,r,a)=>{const i=(l,u)=>{const d=a.push(l)-1;return r.set(u,d),d},o=l=>{if(r.has(l))return r.get(l);let[u,d]=Tc(l);switch(u){case Sf:{let p=l;switch(d){case"bigint":u=g5,p=l.toString();break;case"number":if(!l&&s6(l,-0))return a.push(["-0"])-1;break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);p=null;break;case"undefined":return i([f5],l)}return i([u,p],l)}case Hc:{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 af:{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 i6(l))(e||!Cd(Tc(l[m])))&&p.push([o(m),o(l[m])]);return h}case Xv:return i([u,isNaN(l.getTime())?yo:l.toISOString()],l);case Qv:{const{source:p,flags:h}=l;return i([u,{source:p,flags:h}],l)}case Zv:{const p=[],h=i([u,p],l);for(const[m,y]of l)(e||!(Cd(Tc(m))||Cd(Tc(y))))&&p.push([o(m),o(y)]);return h}case Jv:{const p=[],h=i([u,p],l);for(const m of l)(e||!Cd(Tc(m)))&&p.push(o(m));return h}}const{message:f}=l;return i([u,{name:d,message:f}],l)};return o},Cw=(e,{json:t,lossy:r}={})=>{const a=[];return o6(!(t||r),!!t,new Map,a)(e),a},sf=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?jw(Cw(e,t)):structuredClone(e):(e,t)=>jw(Cw(e,t));function l6(e,t){const r=[{type:"text",value:"↩"}];return t>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),r}function c6(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function u6(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||l6,a=e.options.footnoteBackLabel||c6,i=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",l=e.options.footnoteLabelProperties||{className:["sr-only"]},u=[];let d=-1;for(;++d<e.footnoteOrder.length;){const f=e.footnoteById.get(e.footnoteOrder[d]);if(!f)continue;const p=e.all(f),h=String(f.identifier).toUpperCase(),m=Dl(h.toLowerCase());let y=0;const v=[],k=e.footnoteCounts.get(h);for(;k!==void 0&&++y<=k;){v.length>0&&v.push({type:"text",value:" "});let N=typeof r=="string"?r:r(d,y);typeof N=="string"&&(N={type:"text",value:N}),v.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+m+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof a=="string"?a:a(d,y),className:["data-footnote-backref"]},children:Array.isArray(N)?N:[N]})}const _=p[p.length-1];if(_&&_.type==="element"&&_.tagName==="p"){const N=_.children[_.children.length-1];N&&N.type==="text"?N.value+=" ":_.children.push({type:"text",value:" "}),_.children.push(...v)}else p.push(...v);const w={type:"element",tagName:"li",properties:{id:t+"fn-"+m},children:e.wrap(p,!0)};e.patch(f,w),u.push(w)}if(u.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...sf(l),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
56
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(u,!0)},{type:"text",value:`
57
+ `}]}}const du=(function(e){if(e==null)return g6;if(typeof e=="function")return Nf(e);if(typeof e=="object")return Array.isArray(e)?d6(e):f6(e);if(typeof e=="string")return p6(e);throw new Error("Expected function, string, or object as test")});function d6(e){const t=[];let r=-1;for(;++r<e.length;)t[r]=du(e[r]);return Nf(a);function a(...i){let o=-1;for(;++o<t.length;)if(t[o].apply(this,i))return!0;return!1}}function f6(e){const t=e;return Nf(r);function r(a){const i=a;let o;for(o in e)if(i[o]!==t[o])return!1;return!0}}function p6(e){return Nf(t);function t(r){return r&&r.type===e}}function Nf(e){return t;function t(r,a,i){return!!(h6(r)&&e.call(this,r,typeof a=="number"?a:void 0,i||void 0))}}function g6(){return!0}function h6(e){return e!==null&&typeof e=="object"&&"type"in e}const m5=[],m6=!0,av=!1,x6="skip";function x5(e,t,r,a){let i;typeof t=="function"&&typeof r!="function"?(a=r,r=t):i=t;const o=du(i),l=a?-1:1;u(e,void 0,[])();function u(d,f,p){const h=d&&typeof d=="object"?d:{};if(typeof h.type=="string"){const y=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(m,"name",{value:"node ("+(d.type+(y?"<"+y+">":""))+")"})}return m;function m(){let y=m5,v,k,_;if((!t||o(d,f,p[p.length-1]||void 0))&&(y=y6(r(d,p)),y[0]===av))return y;if("children"in d&&d.children){const w=d;if(w.children&&y[0]!==x6)for(k=(a?w.children.length:-1)+l,_=p.concat(w);k>-1&&k<w.children.length;){const N=w.children[k];if(v=u(N,k,_)(),v[0]===av)return v;k=typeof v[1]=="number"?v[1]:k+l}}return y}}}function y6(e){return Array.isArray(e)?e:typeof e=="number"?[m6,e]:e==null?m5:[e]}function Ef(e,t,r,a){let i,o,l;typeof t=="function"&&typeof r!="function"?(o=void 0,l=t,i=r):(o=t,l=r,i=a),x5(e,o,u,i);function u(d,f){const p=f[f.length-1],h=p?p.children.indexOf(d):void 0;return l(d,h,p)}}const iv={}.hasOwnProperty,b6={};function v6(e,t){const r=t||b6,a=new Map,i=new Map,o=new Map,l={...t6,...r.handlers},u={all:f,applyData:_6,definitionById:a,footnoteById:i,footnoteCounts:o,footnoteOrder:[],handlers:l,one:d,options:r,patch:k6,wrap:S6};return Ef(e,function(p){if(p.type==="definition"||p.type==="footnoteDefinition"){const h=p.type==="definition"?a:i,m=String(p.identifier).toUpperCase();h.has(m)||h.set(m,p)}}),u;function d(p,h){const m=p.type,y=u.handlers[m];if(iv.call(u.handlers,m)&&y)return y(u,p,h);if(u.options.passThrough&&u.options.passThrough.includes(m)){if("children"in p){const{children:k,..._}=p,w=sf(_);return w.children=u.all(p),w}return sf(p)}return(u.options.unknownHandler||w6)(u,p,h)}function f(p){const h=[];if("children"in p){const m=p.children;let y=-1;for(;++y<m.length;){const v=u.one(m[y],p);if(v){if(y&&m[y-1].type==="break"&&(!Array.isArray(v)&&v.type==="text"&&(v.value=Tw(v.value)),!Array.isArray(v)&&v.type==="element")){const k=v.children[0];k&&k.type==="text"&&(k.value=Tw(k.value))}Array.isArray(v)?h.push(...v):h.push(v)}}}return h}}function k6(e,t){e.position&&(t.position=oO(e))}function _6(e,t){let r=t;if(e&&e.data){const a=e.data.hName,i=e.data.hChildren,o=e.data.hProperties;if(typeof a=="string")if(r.type==="element")r.tagName=a;else{const l="children"in r?r.children:[r];r={type:"element",tagName:a,properties:{},children:l}}r.type==="element"&&o&&Object.assign(r.properties,sf(o)),"children"in r&&r.children&&i!==null&&i!==void 0&&(r.children=i)}return r}function w6(e,t){const r=t.data||{},a="value"in t&&!(iv.call(r,"hProperties")||iv.call(r,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function S6(e,t){const r=[];let a=-1;for(t&&r.push({type:"text",value:`
58
+ `});++a<e.length;)a&&r.push({type:"text",value:`
59
+ `}),r.push(e[a]);return t&&e.length>0&&r.push({type:"text",value:`
60
+ `}),r}function Tw(e){let t=0,r=e.charCodeAt(t);for(;r===9||r===32;)t++,r=e.charCodeAt(t);return e.slice(t)}function Rw(e,t){const r=v6(e,t),a=r.one(e,void 0),i=u6(r),o=Array.isArray(a)?{type:"root",children:a}:a||{type:"root",children:[]};return i&&o.children.push({type:"text",value:`
61
+ `},i),o}function N6(e,t){return e&&"run"in e?async function(r,a){const i=Rw(r,{file:a,...t});await e.run(i,a)}:function(r,a){return Rw(r,{file:a,...e||t})}}function Aw(e){if(e)throw e}var Lg,Iw;function E6(){if(Iw)return Lg;Iw=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,r=Object.defineProperty,a=Object.getOwnPropertyDescriptor,i=function(f){return typeof Array.isArray=="function"?Array.isArray(f):t.call(f)==="[object Array]"},o=function(f){if(!f||t.call(f)!=="[object Object]")return!1;var 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){r&&p.name==="__proto__"?r(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(a)return a(f,p).value}else return;return f[p]};return Lg=function d(){var f,p,h,m,y,v,k=arguments[0],_=1,w=arguments.length,N=!1;for(typeof k=="boolean"&&(N=k,k=arguments[1]||{},_=2),(k==null||typeof k!="object"&&typeof k!="function")&&(k={});_<w;++_)if(f=arguments[_],f!=null)for(p in f)h=u(k,p),m=u(f,p),k!==m&&(N&&m&&(o(m)||(y=i(m)))?(y?(y=!1,v=h&&i(h)?h:[]):v=h&&o(h)?h:{},l(k,{name:p,newValue:d(N,v,m)})):typeof m<"u"&&l(k,{name:p,newValue:m}));return k},Lg}var j6=E6();const Og=jo(j6);function sv(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 C6(){const e=[],t={run:r,use:a};return t;function r(...i){let o=-1;const l=i.pop();if(typeof l!="function")throw new TypeError("Expected function as last argument, not "+l);u(null,...i);function u(d,...f){const 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?T6(p,u)(...f):l(null,...f)}}function a(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function T6(e,t){let r;return a;function a(...l){const u=e.length>l.length;let d;u&&l.push(i);try{d=e.apply(this,l)}catch(f){const p=f;if(u&&r)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){r||(r=!0,t(l,...u))}function o(l){i(null,l)}}const Ii={basename:R6,dirname:A6,extname:I6,join:M6,sep:"/"};function R6(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');fu(e);let r=0,a=-1,i=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(o){r=i+1;break}}else a<0&&(o=!0,a=i+1);return a<0?"":e.slice(r,a)}if(t===e)return"";let l=-1,u=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(o){r=i+1;break}}else l<0&&(o=!0,l=i+1),u>-1&&(e.codePointAt(i)===t.codePointAt(u--)?u<0&&(a=i):(u=-1,a=l));return r===a?a=l:a<0&&(a=e.length),e.slice(r,a)}function A6(e){if(fu(e),e.length===0)return".";let t=-1,r=e.length,a;for(;--r;)if(e.codePointAt(r)===47){if(a){t=r;break}}else a||(a=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function I6(e){fu(e);let t=e.length,r=-1,a=0,i=-1,o=0,l;for(;t--;){const u=e.codePointAt(t);if(u===47){if(l){a=t+1;break}continue}r<0&&(l=!0,r=t+1),u===46?i<0?i=t:o!==1&&(o=1):i>-1&&(o=-1)}return i<0||r<0||o===0||o===1&&i===r-1&&i===a+1?"":e.slice(i,r)}function M6(...e){let t=-1,r;for(;++t<e.length;)fu(e[t]),e[t]&&(r=r===void 0?e[t]:r+"/"+e[t]);return r===void 0?".":L6(r)}function L6(e){fu(e);const t=e.codePointAt(0)===47;let r=O6(e,!t);return r.length===0&&!t&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),t?"/"+r:r}function O6(e,t){let r="",a=0,i=-1,o=0,l=-1,u,d;for(;++l<=e.length;){if(l<e.length)u=e.codePointAt(l);else{if(u===47)break;u=47}if(u===47){if(!(i===l-1||o===1))if(i!==l-1&&o===2){if(r.length<2||a!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(d=r.lastIndexOf("/"),d!==r.length-1){d<0?(r="",a=0):(r=r.slice(0,d),a=r.length-1-r.lastIndexOf("/")),i=l,o=0;continue}}else if(r.length>0){r="",a=0,i=l,o=0;continue}}t&&(r=r.length>0?r+"/..":"..",a=2)}else r.length>0?r+="/"+e.slice(i+1,l):r=e.slice(i+1,l),a=l-i-1;i=l,o=0}else u===46&&o>-1?o++:o=-1}return r}function fu(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const D6={cwd:P6};function P6(){return"/"}function ov(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function F6(e){if(typeof e=="string")e=new URL(e);else if(!ov(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 B6(e)}function B6(e){if(e.hostname!==""){const a=new TypeError('File URL host must be "localhost" or empty on darwin');throw a.code="ERR_INVALID_FILE_URL_HOST",a}const t=e.pathname;let r=-1;for(;++r<t.length;)if(t.codePointAt(r)===37&&t.codePointAt(r+1)===50){const a=t.codePointAt(r+2);if(a===70||a===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const Dg=["history","path","basename","stem","extname","dirname"];class y5{constructor(t){let r;t?ov(t)?r={path:t}:typeof t=="string"||z6(t)?r={value:t}:r=t:r={},this.cwd="cwd"in r?"":D6.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let a=-1;for(;++a<Dg.length;){const o=Dg[a];o in r&&r[o]!==void 0&&r[o]!==null&&(this[o]=o==="history"?[...r[o]]:r[o])}let i;for(i in r)Dg.includes(i)||(this[i]=r[i])}get basename(){return typeof this.path=="string"?Ii.basename(this.path):void 0}set basename(t){Fg(t,"basename"),Pg(t,"basename"),this.path=Ii.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Ii.dirname(this.path):void 0}set dirname(t){Mw(this.basename,"dirname"),this.path=Ii.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Ii.extname(this.path):void 0}set extname(t){if(Pg(t,"extname"),Mw(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=Ii.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){ov(t)&&(t=F6(t)),Fg(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Ii.basename(this.path,this.extname):void 0}set stem(t){Fg(t,"stem"),Pg(t,"stem"),this.path=Ii.join(this.dirname||"",t+(this.extname||""))}fail(t,r,a){const i=this.message(t,r,a);throw i.fatal=!0,i}info(t,r,a){const i=this.message(t,r,a);return i.fatal=void 0,i}message(t,r,a){const i=new Zn(t,r,a);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Pg(e,t){if(e&&e.includes(Ii.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ii.sep+"`")}function Fg(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Mw(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function z6(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const U6=(function(e){const a=this.constructor.prototype,i=a[e],o=function(){return i.apply(o,arguments)};return Object.setPrototypeOf(o,a),o}),q6={}.hasOwnProperty;class ek extends U6{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=C6()}copy(){const t=new ek;let r=-1;for(;++r<this.attachers.length;){const a=this.attachers[r];t.use(...a)}return t.data(Og(!0,{},this.namespace)),t}data(t,r){return typeof t=="string"?arguments.length===2?(Ug("data",this.frozen),this.namespace[t]=r,this):q6.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Ug("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...a]=this.attachers[this.freezeIndex];if(a[0]===!1)continue;a[0]===!0&&(a[0]=void 0);const i=r.call(t,...a);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const r=Td(t),a=this.parser||this.Parser;return Bg("parse",a),a(String(r),r)}process(t,r){const a=this;return this.freeze(),Bg("process",this.parser||this.Parser),zg("process",this.compiler||this.Compiler),r?i(void 0,r):new Promise(i);function i(o,l){const u=Td(t),d=a.parse(u);a.run(d,u,function(p,h,m){if(p||!h||!m)return f(p);const y=h,v=a.stringify(y,m);W6(v)?m.value=v:m.result=v,f(p,m)});function f(p,h){p||!h?l(p):o?o(h):r(void 0,h)}}}processSync(t){let r=!1,a;return this.freeze(),Bg("processSync",this.parser||this.Parser),zg("processSync",this.compiler||this.Compiler),this.process(t,i),Ow("processSync","process",r),a;function i(o,l){r=!0,Aw(o),a=l}}run(t,r,a){Lw(t),this.freeze();const i=this.transformers;return!a&&typeof r=="function"&&(a=r,r=void 0),a?o(void 0,a):new Promise(o);function o(l,u){const d=Td(r);i.run(t,d,f);function f(p,h,m){const y=h||t;p?u(p):l?l(y):a(void 0,y,m)}}}runSync(t,r){let a=!1,i;return this.run(t,r,o),Ow("runSync","run",a),i;function o(l,u){Aw(l),i=u,a=!0}}stringify(t,r){this.freeze();const a=Td(r),i=this.compiler||this.Compiler;return zg("stringify",i),Lw(t),i(t,a)}use(t,...r){const a=this.attachers,i=this.namespace;if(Ug("use",this.frozen),t!=null)if(typeof t=="function")d(t,r);else if(typeof t=="object")Array.isArray(t)?u(t):l(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(f){if(typeof f=="function")d(f,[]);else if(typeof f=="object")if(Array.isArray(f)){const[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=Og(!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<a.length;)if(a[h][0]===f){m=h;break}if(m===-1)a.push([f,...p]);else if(p.length>0){let[y,...v]=p;const k=a[m][1];sv(k)&&sv(y)&&(y=Og(!0,k,y)),a[m]=[f,y,...v]}}}}const H6=new ek().freeze();function Bg(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function zg(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Ug(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 Lw(e){if(!sv(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Ow(e,t,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Td(e){return $6(e)?e:new y5(e)}function $6(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function W6(e){return typeof e=="string"||V6(e)}function V6(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const G6="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Dw=[],Pw={allowDangerousHtml:!0},K6=/^(https?|ircs?|mailto|xmpp)$/i,Y6=[{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 Cl(e){const t=X6(e),r=Q6(e);return Z6(t.runSync(t.parse(r),r),e)}function X6(e){const t=e.rehypePlugins||Dw,r=e.remarkPlugins||Dw,a=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Pw}:Pw;return H6().use(TP).use(r).use(N6,a).use(t)}function Q6(e){const t=e.children||"",r=new y5;return typeof t=="string"&&(r.value=t),r}function Z6(e,t){const r=t.allowedElements,a=t.allowElement,i=t.components,o=t.disallowedElements,l=t.skipHtml,u=t.unwrapDisallowed,d=t.urlTransform||J6;for(const p of Y6)Object.hasOwn(t,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+G6+p.id,void 0);return Ef(e,f),fO(e,{Fragment:n.Fragment,components:i,ignoreInvalidStyle:!0,jsx:n.jsx,jsxs:n.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 y;for(y in Ag)if(Object.hasOwn(Ag,y)&&Object.hasOwn(p.properties,y)){const v=p.properties[y],k=Ag[y];(k===null||k.includes(p.tagName))&&(p.properties[y]=d(String(v||""),y,p))}}if(p.type==="element"){let y=r?!r.includes(p.tagName):o?o.includes(p.tagName):!1;if(!y&&a&&typeof h=="number"&&(y=!a(p,h,m)),y&&m&&typeof h=="number")return u&&p.children?m.children.splice(h,1,...p.children):m.children.splice(h,1),h}}}function J6(e){const t=e.indexOf(":"),r=e.indexOf("?"),a=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||r!==-1&&t>r||a!==-1&&t>a||K6.test(e.slice(0,t))?e:""}function Fw(e,t){const r=String(e);if(typeof t!="string")throw new TypeError("Expected character");let a=0,i=r.indexOf(t);for(;i!==-1;)a++,i=r.indexOf(t,i+t.length);return a}function e8(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function t8(e,t,r){const i=du((r||{}).ignore||[]),o=r8(t);let l=-1;for(;++l<o.length;)x5(e,"text",u);function u(f,p){let h=-1,m;for(;++h<p.length;){const y=p[h],v=m?m.children:void 0;if(i(y,v?v.indexOf(y):void 0,m))return;m=y}if(m)return d(f,p)}function d(f,p){const h=p[p.length-1],m=o[l][0],y=o[l][1];let v=0;const _=h.children.indexOf(f);let w=!1,N=[];m.lastIndex=0;let E=m.exec(f.value);for(;E;){const A=E.index,T={index:E.index,input:E.input,stack:[...p,f]};let C=y(...E,T);if(typeof C=="string"&&(C=C.length>0?{type:"text",value:C}:void 0),C===!1?m.lastIndex=A+1:(v!==A&&N.push({type:"text",value:f.value.slice(v,A)}),Array.isArray(C)?N.push(...C):C&&N.push(C),v=A+E[0].length,w=!0),!m.global)break;E=m.exec(f.value)}return w?(v<f.value.length&&N.push({type:"text",value:f.value.slice(v)}),h.children.splice(_,1,...N)):N=[f],_+N.length}}function r8(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const r=!e[0]||Array.isArray(e[0])?e:[e];let a=-1;for(;++a<r.length;){const i=r[a];t.push([n8(i[0]),a8(i[1])])}return t}function n8(e){return typeof e=="string"?new RegExp(e8(e),"g"):e}function a8(e){return typeof e=="function"?e:function(){return e}}const qg="phrasing",Hg=["autolink","link","image","label"];function i8(){return{transforms:[f8],enter:{literalAutolink:o8,literalAutolinkEmail:$g,literalAutolinkHttp:$g,literalAutolinkWww:$g},exit:{literalAutolink:d8,literalAutolinkEmail:u8,literalAutolinkHttp:l8,literalAutolinkWww:c8}}}function s8(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:qg,notInConstruct:Hg},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:qg,notInConstruct:Hg},{character:":",before:"[ps]",after:"\\/",inConstruct:qg,notInConstruct:Hg}]}}function o8(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function $g(e){this.config.enter.autolinkProtocol.call(this,e)}function l8(e){this.config.exit.autolinkProtocol.call(this,e)}function c8(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 u8(e){this.config.exit.autolinkEmail.call(this,e)}function d8(e){this.exit(e)}function f8(e){t8(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,p8],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),g8]],{ignore:["link","linkReference"]})}function p8(e,t,r,a,i){let o="";if(!b5(i)||(/^w/i.test(t)&&(r=t+r,t="",o="http://"),!h8(r)))return!1;const l=m8(r+a);if(!l[0])return!1;const u={type:"link",title:null,url:o+t+l[0],children:[{type:"text",value:t+l[0]}]};return l[1]?[u,{type:"text",value:l[1]}]:u}function g8(e,t,r,a){return!b5(a,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+r,children:[{type:"text",value:t+"@"+r}]}}function h8(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function m8(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let r=t[0],a=r.indexOf(")");const i=Fw(e,"(");let o=Fw(e,")");for(;a!==-1&&i>o;)e+=r.slice(0,a+1),r=r.slice(a+1),a=r.indexOf(")"),o++;return[e,r]}function b5(e,t){const r=e.input.charCodeAt(e.index-1);return(e.index===0||Eo(r)||_f(r))&&(!t||r!==47)}v5.peek=N8;function x8(){this.buffer()}function y8(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function b8(){this.buffer()}function v8(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function k8(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=xi(this.sliceSerialize(e)).toLowerCase(),r.label=t}function _8(e){this.exit(e)}function w8(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=xi(this.sliceSerialize(e)).toLowerCase(),r.label=t}function S8(e){this.exit(e)}function N8(){return"["}function v5(e,t,r,a){const i=r.createTracker(a);let o=i.move("[^");const l=r.enter("footnoteReference"),u=r.enter("reference");return o+=i.move(r.safe(r.associationId(e),{after:"]",before:o})),u(),l(),o+=i.move("]"),o}function E8(){return{enter:{gfmFootnoteCallString:x8,gfmFootnoteCall:y8,gfmFootnoteDefinitionLabelString:b8,gfmFootnoteDefinition:v8},exit:{gfmFootnoteCallString:k8,gfmFootnoteCall:_8,gfmFootnoteDefinitionLabelString:w8,gfmFootnoteDefinition:S8}}}function j8(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:r,footnoteReference:v5},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(a,i,o,l){const u=o.createTracker(l);let d=u.move("[^");const f=o.enter("footnoteDefinition"),p=o.enter("label");return d+=u.move(o.safe(o.associationId(a),{before:d,after:"]"})),p(),d+=u.move("]:"),a.children&&a.children.length>0&&(u.shift(4),d+=u.move((t?`
62
+ `:" ")+o.indentLines(o.containerFlow(a,u.current()),t?k5:C8))),f(),d}}function C8(e,t,r){return t===0?e:k5(e,t,r)}function k5(e,t,r){return(r?"":" ")+e}const T8=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];_5.peek=L8;function R8(){return{canContainEols:["delete"],enter:{strikethrough:I8},exit:{strikethrough:M8}}}function A8(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:T8}],handlers:{delete:_5}}}function I8(e){this.enter({type:"delete",children:[]},e)}function M8(e){this.exit(e)}function _5(e,t,r,a){const i=r.createTracker(a),o=r.enter("strikethrough");let l=i.move("~~");return l+=r.containerPhrasing(e,{...i.current(),before:l,after:"~"}),l+=i.move("~~"),o(),l}function L8(){return"~"}function O8(e){return e.length}function D8(e,t){const r=t||{},a=(r.align||[]).concat(),i=r.stringLength||O8,o=[],l=[],u=[],d=[];let f=0,p=-1;for(;++p<e.length;){const k=[],_=[];let w=-1;for(e[p].length>f&&(f=e[p].length);++w<e[p].length;){const N=P8(e[p][w]);if(r.alignDelimiters!==!1){const E=i(N);_[w]=E,(d[w]===void 0||E>d[w])&&(d[w]=E)}k.push(N)}l[p]=k,u[p]=_}let h=-1;if(typeof a=="object"&&"length"in a)for(;++h<f;)o[h]=Bw(a[h]);else{const k=Bw(a);for(;++h<f;)o[h]=k}h=-1;const m=[],y=[];for(;++h<f;){const k=o[h];let _="",w="";k===99?(_=":",w=":"):k===108?_=":":k===114&&(w=":");let N=r.alignDelimiters===!1?1:Math.max(1,d[h]-_.length-w.length);const E=_+"-".repeat(N)+w;r.alignDelimiters!==!1&&(N=_.length+N+w.length,N>d[h]&&(d[h]=N),y[h]=N),m[h]=E}l.splice(1,0,m),u.splice(1,0,y),p=-1;const v=[];for(;++p<l.length;){const k=l[p],_=u[p];h=-1;const w=[];for(;++h<f;){const N=k[h]||"";let E="",A="";if(r.alignDelimiters!==!1){const T=d[h]-(_[h]||0),C=o[h];C===114?E=" ".repeat(T):C===99?T%2?(E=" ".repeat(T/2+.5),A=" ".repeat(T/2-.5)):(E=" ".repeat(T/2),A=E):A=" ".repeat(T)}r.delimiterStart!==!1&&!h&&w.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&N==="")&&(r.delimiterStart!==!1||h)&&w.push(" "),r.alignDelimiters!==!1&&w.push(E),w.push(N),r.alignDelimiters!==!1&&w.push(A),r.padding!==!1&&w.push(" "),(r.delimiterEnd!==!1||h!==f-1)&&w.push("|")}v.push(r.delimiterEnd===!1?w.join("").replace(/ +$/,""):w.join(""))}return v.join(`
63
+ `)}function P8(e){return e==null?"":String(e)}function Bw(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function F8(e,t,r,a){const i=r.enter("blockquote"),o=r.createTracker(a);o.move("> "),o.shift(2);const l=r.indentLines(r.containerFlow(e,o.current()),B8);return i(),l}function B8(e,t,r){return">"+(r?"":" ")+e}function z8(e,t){return zw(e,t.inConstruct,!0)&&!zw(e,t.notInConstruct,!1)}function zw(e,t,r){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return r;let a=-1;for(;++a<t.length;)if(e.includes(t[a]))return!0;return!1}function Uw(e,t,r,a){let i=-1;for(;++i<r.unsafe.length;)if(r.unsafe[i].character===`
64
+ `&&z8(r.stack,r.unsafe[i]))return/[ \t]/.test(a.before)?"":" ";return`\\
65
+ `}function U8(e,t){const r=String(e);let a=r.indexOf(t),i=a,o=0,l=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;a!==-1;)a===i?++o>l&&(l=o):o=1,i=a+t.length,a=r.indexOf(t,i);return l}function q8(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function H8(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 $8(e,t,r,a){const i=H8(r),o=e.value||"",l=i==="`"?"GraveAccent":"Tilde";if(q8(e,r)){const h=r.enter("codeIndented"),m=r.indentLines(o,W8);return h(),m}const u=r.createTracker(a),d=i.repeat(Math.max(U8(o,i)+1,3)),f=r.enter("codeFenced");let p=u.move(d);if(e.lang){const h=r.enter(`codeFencedLang${l}`);p+=u.move(r.safe(e.lang,{before:p,after:" ",encode:["`"],...u.current()})),h()}if(e.lang&&e.meta){const h=r.enter(`codeFencedMeta${l}`);p+=u.move(" "),p+=u.move(r.safe(e.meta,{before:p,after:`
66
+ `,encode:["`"],...u.current()})),h()}return p+=u.move(`
67
+ `),o&&(p+=u.move(o+`
68
+ `)),p+=u.move(d),f(),p}function W8(e,t,r){return(r?"":" ")+e}function tk(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 V8(e,t,r,a){const i=tk(r),o=i==='"'?"Quote":"Apostrophe",l=r.enter("definition");let u=r.enter("label");const d=r.createTracker(a);let f=d.move("[");return f+=d.move(r.safe(r.associationId(e),{before:f,after:"]",...d.current()})),f+=d.move("]: "),u(),!e.url||/[\0- \u007F]/.test(e.url)?(u=r.enter("destinationLiteral"),f+=d.move("<"),f+=d.move(r.safe(e.url,{before:f,after:">",...d.current()})),f+=d.move(">")):(u=r.enter("destinationRaw"),f+=d.move(r.safe(e.url,{before:f,after:e.title?" ":`
69
+ `,...d.current()}))),u(),e.title&&(u=r.enter(`title${o}`),f+=d.move(" "+i),f+=d.move(r.safe(e.title,{before:f,after:i,...d.current()})),f+=d.move(i),u()),l(),f}function G8(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 ru(e){return"&#x"+e.toString(16).toUpperCase()+";"}function of(e,t,r){const a=Al(e),i=Al(t);return a===void 0?i===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:a===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}w5.peek=K8;function w5(e,t,r,a){const i=G8(r),o=r.enter("emphasis"),l=r.createTracker(a),u=l.move(i);let d=l.move(r.containerPhrasing(e,{after:i,before:u,...l.current()}));const f=d.charCodeAt(0),p=of(a.before.charCodeAt(a.before.length-1),f,i);p.inside&&(d=ru(f)+d.slice(1));const h=d.charCodeAt(d.length-1),m=of(a.after.charCodeAt(0),h,i);m.inside&&(d=d.slice(0,-1)+ru(h));const y=l.move(i);return o(),r.attentionEncodeSurroundingInfo={after:m.outside,before:p.outside},u+d+y}function K8(e,t,r){return r.options.emphasis||"*"}function Y8(e,t){let r=!1;return Ef(e,function(a){if("value"in a&&/\r?\n|\r/.test(a.value)||a.type==="break")return r=!0,av}),!!((!e.depth||e.depth<3)&&Gv(e)&&(t.options.setext||r))}function X8(e,t,r,a){const i=Math.max(Math.min(6,e.depth||1),1),o=r.createTracker(a);if(Y8(e,r)){const p=r.enter("headingSetext"),h=r.enter("phrasing"),m=r.containerPhrasing(e,{...o.current(),before:`
70
+ `,after:`
71
+ `});return h(),p(),m+`
72
+ `+(i===1?"=":"-").repeat(m.length-(Math.max(m.lastIndexOf("\r"),m.lastIndexOf(`
73
+ `))+1))}const l="#".repeat(i),u=r.enter("headingAtx"),d=r.enter("phrasing");o.move(l+" ");let f=r.containerPhrasing(e,{before:"# ",after:`
74
+ `,...o.current()});return/^[\t ]/.test(f)&&(f=ru(f.charCodeAt(0))+f.slice(1)),f=f?l+" "+f:l,r.options.closeAtx&&(f+=" "+l),d(),u(),f}S5.peek=Q8;function S5(e){return e.value||""}function Q8(){return"<"}N5.peek=Z8;function N5(e,t,r,a){const i=tk(r),o=i==='"'?"Quote":"Apostrophe",l=r.enter("image");let u=r.enter("label");const d=r.createTracker(a);let f=d.move("![");return f+=d.move(r.safe(e.alt,{before:f,after:"]",...d.current()})),f+=d.move("]("),u(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(u=r.enter("destinationLiteral"),f+=d.move("<"),f+=d.move(r.safe(e.url,{before:f,after:">",...d.current()})),f+=d.move(">")):(u=r.enter("destinationRaw"),f+=d.move(r.safe(e.url,{before:f,after:e.title?" ":")",...d.current()}))),u(),e.title&&(u=r.enter(`title${o}`),f+=d.move(" "+i),f+=d.move(r.safe(e.title,{before:f,after:i,...d.current()})),f+=d.move(i),u()),f+=d.move(")"),l(),f}function Z8(){return"!"}E5.peek=J8;function E5(e,t,r,a){const i=e.referenceType,o=r.enter("imageReference");let l=r.enter("label");const u=r.createTracker(a);let d=u.move("![");const f=r.safe(e.alt,{before:d,after:"]",...u.current()});d+=u.move(f+"]["),l();const p=r.stack;r.stack=[],l=r.enter("reference");const h=r.safe(r.associationId(e),{before:d,after:"]",...u.current()});return l(),r.stack=p,o(),i==="full"||!f||f!==h?d+=u.move(h+"]"):i==="shortcut"?d=d.slice(0,-1):d+=u.move("]"),d}function J8(){return"!"}j5.peek=e7;function j5(e,t,r){let a=e.value||"",i="`",o=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(a);)i+="`";for(/[^ \r\n]/.test(a)&&(/^[ \r\n]/.test(a)&&/[ \r\n]$/.test(a)||/^`|`$/.test(a))&&(a=" "+a+" ");++o<r.unsafe.length;){const l=r.unsafe[o],u=r.compilePattern(l);let d;if(l.atBreak)for(;d=u.exec(a);){let f=d.index;a.charCodeAt(f)===10&&a.charCodeAt(f-1)===13&&f--,a=a.slice(0,f)+" "+a.slice(d.index+1)}}return i+a+i}function e7(){return"`"}function C5(e,t){const r=Gv(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(r===e.url||"mailto:"+r===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}T5.peek=t7;function T5(e,t,r,a){const i=tk(r),o=i==='"'?"Quote":"Apostrophe",l=r.createTracker(a);let u,d;if(C5(e,r)){const p=r.stack;r.stack=[],u=r.enter("autolink");let h=l.move("<");return h+=l.move(r.containerPhrasing(e,{before:h,after:">",...l.current()})),h+=l.move(">"),u(),r.stack=p,h}u=r.enter("link"),d=r.enter("label");let f=l.move("[");return f+=l.move(r.containerPhrasing(e,{before:f,after:"](",...l.current()})),f+=l.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=r.enter("destinationLiteral"),f+=l.move("<"),f+=l.move(r.safe(e.url,{before:f,after:">",...l.current()})),f+=l.move(">")):(d=r.enter("destinationRaw"),f+=l.move(r.safe(e.url,{before:f,after:e.title?" ":")",...l.current()}))),d(),e.title&&(d=r.enter(`title${o}`),f+=l.move(" "+i),f+=l.move(r.safe(e.title,{before:f,after:i,...l.current()})),f+=l.move(i),d()),f+=l.move(")"),u(),f}function t7(e,t,r){return C5(e,r)?"<":"["}R5.peek=r7;function R5(e,t,r,a){const i=e.referenceType,o=r.enter("linkReference");let l=r.enter("label");const u=r.createTracker(a);let d=u.move("[");const f=r.containerPhrasing(e,{before:d,after:"]",...u.current()});d+=u.move(f+"]["),l();const p=r.stack;r.stack=[],l=r.enter("reference");const h=r.safe(r.associationId(e),{before:d,after:"]",...u.current()});return l(),r.stack=p,o(),i==="full"||!f||f!==h?d+=u.move(h+"]"):i==="shortcut"?d=d.slice(0,-1):d+=u.move("]"),d}function r7(){return"["}function rk(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 n7(e){const t=rk(e),r=e.options.bulletOther;if(!r)return t==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+r+"`) to be different");return r}function a7(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 A5(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 i7(e,t,r,a){const i=r.enter("list"),o=r.bulletCurrent;let l=e.ordered?a7(r):rk(r);const u=e.ordered?l==="."?")":".":n7(r);let d=t&&r.bulletLastUsed?l===r.bulletLastUsed:!1;if(!e.ordered){const p=e.children?e.children[0]:void 0;if((l==="*"||l==="-")&&p&&(!p.children||!p.children[0])&&r.stack[r.stack.length-1]==="list"&&r.stack[r.stack.length-2]==="listItem"&&r.stack[r.stack.length-3]==="list"&&r.stack[r.stack.length-4]==="listItem"&&r.indexStack[r.indexStack.length-1]===0&&r.indexStack[r.indexStack.length-2]===0&&r.indexStack[r.indexStack.length-3]===0&&(d=!0),A5(r)===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),r.bulletCurrent=l;const f=r.containerFlow(e,a);return r.bulletLastUsed=l,r.bulletCurrent=o,i(),f}function s7(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 o7(e,t,r,a){const i=s7(r);let o=r.bulletCurrent||rk(r);t&&t.type==="list"&&t.ordered&&(o=(typeof t.start=="number"&&t.start>-1?t.start:1)+(r.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let l=o.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(l=Math.ceil(l/4)*4);const u=r.createTracker(a);u.move(o+" ".repeat(l-o.length)),u.shift(l);const d=r.enter("listItem"),f=r.indentLines(r.containerFlow(e,u.current()),p);return d(),f;function p(h,m,y){return m?(y?"":" ".repeat(l))+h:(y?o:o+" ".repeat(l-o.length))+h}}function l7(e,t,r,a){const i=r.enter("paragraph"),o=r.enter("phrasing"),l=r.containerPhrasing(e,a);return o(),i(),l}const c7=du(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function u7(e,t,r,a){return(e.children.some(function(l){return c7(l)})?r.containerPhrasing:r.containerFlow).call(r,e,a)}function d7(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}I5.peek=f7;function I5(e,t,r,a){const i=d7(r),o=r.enter("strong"),l=r.createTracker(a),u=l.move(i+i);let d=l.move(r.containerPhrasing(e,{after:i,before:u,...l.current()}));const f=d.charCodeAt(0),p=of(a.before.charCodeAt(a.before.length-1),f,i);p.inside&&(d=ru(f)+d.slice(1));const h=d.charCodeAt(d.length-1),m=of(a.after.charCodeAt(0),h,i);m.inside&&(d=d.slice(0,-1)+ru(h));const y=l.move(i+i);return o(),r.attentionEncodeSurroundingInfo={after:m.outside,before:p.outside},u+d+y}function f7(e,t,r){return r.options.strong||"*"}function p7(e,t,r,a){return r.safe(e.value,a)}function g7(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 h7(e,t,r){const a=(A5(r)+(r.options.ruleSpaces?" ":"")).repeat(g7(r));return r.options.ruleSpaces?a.slice(0,-1):a}const M5={blockquote:F8,break:Uw,code:$8,definition:V8,emphasis:w5,hardBreak:Uw,heading:X8,html:S5,image:N5,imageReference:E5,inlineCode:j5,link:T5,linkReference:R5,list:i7,listItem:o7,paragraph:l7,root:u7,strong:I5,text:p7,thematicBreak:h7};function m7(){return{enter:{table:x7,tableData:qw,tableHeader:qw,tableRow:b7},exit:{codeText:v7,table:y7,tableData:Wg,tableHeader:Wg,tableRow:Wg}}}function x7(e){const t=e._align;this.enter({type:"table",align:t.map(function(r){return r==="none"?null:r}),children:[]},e),this.data.inTable=!0}function y7(e){this.exit(e),this.data.inTable=void 0}function b7(e){this.enter({type:"tableRow",children:[]},e)}function Wg(e){this.exit(e)}function qw(e){this.enter({type:"tableCell",children:[]},e)}function v7(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,k7));const r=this.stack[this.stack.length-1];r.type,r.value=t,this.exit(e)}function k7(e,t){return t==="|"?t:e}function _7(e){const t=e||{},r=t.tableCellPadding,a=t.tablePipeAlign,i=t.stringLength,o=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
75
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:m,table:l,tableCell:d,tableRow:u}};function l(y,v,k,_){return f(p(y,k,_),y.align)}function u(y,v,k,_){const w=h(y,k,_),N=f([w]);return N.slice(0,N.indexOf(`
76
+ `))}function d(y,v,k,_){const w=k.enter("tableCell"),N=k.enter("phrasing"),E=k.containerPhrasing(y,{..._,before:o,after:o});return N(),w(),E}function f(y,v){return D8(y,{align:v,alignDelimiters:a,padding:r,stringLength:i})}function p(y,v,k){const _=y.children;let w=-1;const N=[],E=v.enter("table");for(;++w<_.length;)N[w]=h(_[w],v,k);return E(),N}function h(y,v,k){const _=y.children;let w=-1;const N=[],E=v.enter("tableRow");for(;++w<_.length;)N[w]=d(_[w],y,v,k);return E(),N}function m(y,v,k){let _=M5.inlineCode(y,v,k);return k.stack.includes("tableCell")&&(_=_.replace(/\|/g,"\\$&")),_}}function w7(){return{exit:{taskListCheckValueChecked:Hw,taskListCheckValueUnchecked:Hw,paragraph:N7}}}function S7(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:E7}}}function Hw(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function N7(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const a=r.children[0];if(a&&a.type==="text"){const i=t.children;let o=-1,l;for(;++o<i.length;){const u=i[o];if(u.type==="paragraph"){l=u;break}}l===r&&(a.value=a.value.slice(1),a.value.length===0?r.children.shift():r.position&&a.position&&typeof a.position.start.offset=="number"&&(a.position.start.column++,a.position.start.offset++,r.position.start=Object.assign({},a.position.start)))}}this.exit(e)}function E7(e,t,r,a){const i=e.children[0],o=typeof e.checked=="boolean"&&i&&i.type==="paragraph",l="["+(e.checked?"x":" ")+"] ",u=r.createTracker(a);o&&u.move(l);let d=M5.listItem(e,t,r,{...a,...u.current()});return o&&(d=d.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,f)),d;function f(p){return p+l}}function j7(){return[i8(),E8(),R8(),m7(),w7()]}function C7(e){return{extensions:[s8(),j8(e),A8(),_7(e),S7()]}}const T7={tokenize:O7,partial:!0},L5={tokenize:D7,partial:!0},O5={tokenize:P7,partial:!0},D5={tokenize:F7,partial:!0},R7={tokenize:B7,partial:!0},P5={name:"wwwAutolink",tokenize:M7,previous:B5},F5={name:"protocolAutolink",tokenize:L7,previous:z5},es={name:"emailAutolink",tokenize:I7,previous:U5},Di={};function A7(){return{text:Di}}let ho=48;for(;ho<123;)Di[ho]=es,ho++,ho===58?ho=65:ho===91&&(ho=97);Di[43]=es;Di[45]=es;Di[46]=es;Di[95]=es;Di[72]=[es,F5];Di[104]=[es,F5];Di[87]=[es,P5];Di[119]=[es,P5];function I7(e,t,r){const a=this;let i,o;return l;function l(h){return!lv(h)||!U5.call(a,a.previous)||nk(a.events)?r(h):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),u(h))}function u(h){return lv(h)?(e.consume(h),u):h===64?(e.consume(h),d):r(h)}function d(h){return h===46?e.check(R7,p,f)(h):h===45||h===95||Qn(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&&ia(a.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(h)):r(h)}}function M7(e,t,r){const a=this;return i;function i(l){return l!==87&&l!==119||!B5.call(a,a.previous)||nk(a.events)?r(l):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(T7,e.attempt(L5,e.attempt(O5,o),r),r)(l))}function o(l){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(l)}}function L7(e,t,r){const a=this;let i="",o=!1;return l;function l(h){return(h===72||h===104)&&z5.call(a,a.previous)&&!nk(a.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(h),e.consume(h),u):r(h)}function u(h){if(ia(h)&&i.length<5)return i+=String.fromCodePoint(h),e.consume(h),u;if(h===58){const m=i.toLowerCase();if(m==="http"||m==="https")return e.consume(h),d}return r(h)}function d(h){return h===47?(e.consume(h),o?f:(o=!0,d)):r(h)}function f(h){return h===null||nf(h)||qr(h)||Eo(h)||_f(h)?r(h):e.attempt(L5,e.attempt(O5,p),r)(h)}function p(h){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(h)}}function O7(e,t,r){let a=0;return i;function i(l){return(l===87||l===119)&&a<3?(a++,e.consume(l),i):l===46&&a===3?(e.consume(l),o):r(l)}function o(l){return l===null?r(l):t(l)}}function D7(e,t,r){let a,i,o;return l;function l(f){return f===46||f===95?e.check(D5,d,u)(f):f===null||qr(f)||Eo(f)||f!==45&&_f(f)?d(f):(o=!0,e.consume(f),l)}function u(f){return f===95?a=!0:(i=a,a=void 0),e.consume(f),l}function d(f){return i||a||!o?r(f):t(f)}}function P7(e,t){let r=0,a=0;return i;function i(l){return l===40?(r++,e.consume(l),i):l===41&&a<r?o(l):l===33||l===34||l===38||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===60||l===63||l===93||l===95||l===126?e.check(D5,t,o)(l):l===null||qr(l)||Eo(l)?t(l):(e.consume(l),i)}function o(l){return l===41&&a++,e.consume(l),i}}function F7(e,t,r){return a;function a(u){return u===33||u===34||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===63||u===95||u===126?(e.consume(u),a):u===38?(e.consume(u),o):u===93?(e.consume(u),i):u===60||u===null||qr(u)||Eo(u)?t(u):r(u)}function i(u){return u===null||u===40||u===91||qr(u)||Eo(u)?t(u):a(u)}function o(u){return ia(u)?l(u):r(u)}function l(u){return u===59?(e.consume(u),a):ia(u)?(e.consume(u),l):r(u)}}function B7(e,t,r){return a;function a(o){return e.consume(o),i}function i(o){return Qn(o)?r(o):t(o)}}function B5(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||qr(e)}function z5(e){return!ia(e)}function U5(e){return!(e===47||lv(e))}function lv(e){return e===43||e===45||e===46||e===95||Qn(e)}function nk(e){let t=e.length,r=!1;for(;t--;){const a=e[t][1];if((a.type==="labelLink"||a.type==="labelImage")&&!a._balanced){r=!0;break}if(a._gfmAutolinkLiteralWalkedInto){r=!1;break}}return e.length>0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const z7={tokenize:K7,partial:!0};function U7(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:W7,continuation:{tokenize:V7},exit:G7}},text:{91:{name:"gfmFootnoteCall",tokenize:$7},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:q7,resolveTo:H7}}}}function q7(e,t,r){const a=this;let i=a.events.length;const o=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let l;for(;i--;){const d=a.events[i][1];if(d.type==="labelImage"){l=d;break}if(d.type==="gfmFootnoteCall"||d.type==="labelLink"||d.type==="label"||d.type==="image"||d.type==="link")break}return u;function u(d){if(!l||!l._balanced)return r(d);const f=xi(a.sliceSerialize({start:l.end,end:a.now()}));return f.codePointAt(0)!==94||!o.includes(f.slice(1))?r(d):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),t(d))}}function H7(e,t){let r=e.length;for(;r--;)if(e[r][1].type==="labelImage"&&e[r][0]==="enter"){e[r][1];break}e[r+1][1].type="data",e[r+3][1].type="gfmFootnoteCallLabelMarker";const a={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[r+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},u=[e[r+1],e[r+2],["enter",a,t],e[r+3],e[r+4],["enter",i,t],["exit",i,t],["enter",o,t],["enter",l,t],["exit",l,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",a,t]];return e.splice(r,e.length-r+1,...u),e}function $7(e,t,r){const a=this,i=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let o=0,l;return u;function u(h){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),d}function d(h){return h!==94?r(h):(e.enter("gfmFootnoteCallMarker"),e.consume(h),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",f)}function f(h){if(o>999||h===93&&!l||h===null||h===91||qr(h))return r(h);if(h===93){e.exit("chunkString");const m=e.exit("gfmFootnoteCallString");return i.includes(xi(a.sliceSerialize(m)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):r(h)}return qr(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 W7(e,t,r){const a=this,i=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let o,l=0,u;return d;function d(v){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(v),e.exit("gfmFootnoteDefinitionLabelMarker"),f}function f(v){return v===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(v),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",p):r(v)}function p(v){if(l>999||v===93&&!u||v===null||v===91||qr(v))return r(v);if(v===93){e.exit("chunkString");const k=e.exit("gfmFootnoteDefinitionLabelString");return o=xi(a.sliceSerialize(k)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(v),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),m}return qr(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),br(e,y,"gfmFootnoteDefinitionWhitespace")):r(v)}function y(v){return t(v)}}function V7(e,t,r){return e.check(uu,t,e.attempt(z7,t,r))}function G7(e){e.exit("gfmFootnoteDefinition")}function K7(e,t,r){const a=this;return br(e,i,"gfmFootnoteDefinitionIndent",5);function i(o){const l=a.events[a.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?t(o):r(o)}}function Y7(e){let r=(e||{}).singleTilde;const a={name:"strikethrough",tokenize:o,resolveAll:i};return r==null&&(r=!0),{text:{126:a},insideSpan:{null:[a]},attentionMarkers:{null:[126]}};function i(l,u){let d=-1;for(;++d<l.length;)if(l[d][0]==="enter"&&l[d][1].type==="strikethroughSequenceTemporary"&&l[d][1]._close){let f=d;for(;f--;)if(l[f][0]==="exit"&&l[f][1].type==="strikethroughSequenceTemporary"&&l[f][1]._open&&l[d][1].end.offset-l[d][1].start.offset===l[f][1].end.offset-l[f][1].start.offset){l[d][1].type="strikethroughSequence",l[f][1].type="strikethroughSequence";const 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]],y=u.parser.constructs.insideSpan.null;y&&za(m,m.length,0,wf(y,l.slice(f+1,d),u)),za(m,m.length,0,[["exit",h,u],["enter",l[d][1],u],["exit",l[d][1],u],["exit",p,u]]),za(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"),y(v))}function y(v){const k=Al(f);if(v===126)return h>1?d(v):(l.consume(v),h++,y);if(h<2&&!r)return d(v);const _=l.exit("strikethroughSequenceTemporary"),w=Al(v);return _._open=!w||w===2&&!!k,_._close=!k||k===2&&!!w,u(v)}}}class X7{constructor(){this.map=[],this.index=new Map}add(t,r,a){Q7(this,t,r,a)}consume(t){if(this.map.sort(function(o,l){return o[0]-l[0]}),this.map.length===0)return;let r=this.map.length;const a=[];for(;r>0;)r-=1,a.push(t.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),t.length=this.map[r][0];a.push(t.slice()),t.length=0;let i=a.pop();for(;i;){for(const o of i)t.push(o);i=a.pop()}this.map.length=0,this.index.clear()}}function Q7(e,t,r,a){if(r===0&&a.length===0)return;const i=e.index.get(t);if(i){i[1]+=r,i[2].push(...a);return}const o=[t,r,a];e.map.push(o),e.index.set(t,o)}function Z7(e,t){let r=!1;const a=[];for(;t<e.length;){const i=e[t];if(r){if(i[0]==="enter")i[1].type==="tableContent"&&a.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=a.length-1;a[o]=a[o]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(r=!0);t+=1}return a}function J7(){return{flow:{null:{name:"table",tokenize:e9,resolveAll:t9}}}}function e9(e,t,r){const a=this;let i=0,o=0,l;return u;function u(I){let B=a.events.length-1;for(;B>-1;){const{type:V}=a.events[B][1];if(V==="lineEnding"||V==="linePrefix")B--;else break}const z=B>-1?a.events[B][1].type:null,ee=z==="tableHead"||z==="tableRow"?C:d;return ee===C&&a.parser.lazy[a.now().line]?r(I):ee(I)}function d(I){return e.enter("tableHead"),e.enter("tableRow"),f(I)}function f(I){return I===124||(l=!0,o+=1),p(I)}function p(I){return I===null?r(I):Vt(I)?o>1?(o=0,a.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),y):r(I):hr(I)?br(e,p,"whitespace")(I):(o+=1,l&&(l=!1,i+=1),I===124?(e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),l=!0,p):(e.enter("data"),h(I)))}function h(I){return I===null||I===124||qr(I)?(e.exit("data"),p(I)):(e.consume(I),I===92?m:h)}function m(I){return I===92||I===124?(e.consume(I),h):h(I)}function y(I){return a.interrupt=!1,a.parser.lazy[a.now().line]?r(I):(e.enter("tableDelimiterRow"),l=!1,hr(I)?br(e,v,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):v(I))}function v(I){return I===45||I===58?_(I):I===124?(l=!0,e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),k):T(I)}function k(I){return hr(I)?br(e,_,"whitespace")(I):_(I)}function _(I){return I===58?(o+=1,l=!0,e.enter("tableDelimiterMarker"),e.consume(I),e.exit("tableDelimiterMarker"),w):I===45?(o+=1,w(I)):I===null||Vt(I)?A(I):T(I)}function w(I){return I===45?(e.enter("tableDelimiterFiller"),N(I)):T(I)}function N(I){return I===45?(e.consume(I),N):I===58?(l=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(I),e.exit("tableDelimiterMarker"),E):(e.exit("tableDelimiterFiller"),E(I))}function E(I){return hr(I)?br(e,A,"whitespace")(I):A(I)}function A(I){return I===124?v(I):I===null||Vt(I)?!l||i!==o?T(I):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(I)):T(I)}function T(I){return r(I)}function C(I){return e.enter("tableRow"),j(I)}function j(I){return I===124?(e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),j):I===null||Vt(I)?(e.exit("tableRow"),t(I)):hr(I)?br(e,j,"whitespace")(I):(e.enter("data"),M(I))}function M(I){return I===null||I===124||qr(I)?(e.exit("data"),j(I)):(e.consume(I),I===92?L:M)}function L(I){return I===92||I===124?(e.consume(I),M):M(I)}}function t9(e,t){let r=-1,a=!0,i=0,o=[0,0,0,0],l=[0,0,0,0],u=!1,d=0,f,p,h;const m=new X7;for(;++r<e.length;){const y=e[r],v=y[1];y[0]==="enter"?v.type==="tableHead"?(u=!1,d!==0&&($w(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(r,0,[["enter",f,t]])):v.type==="tableRow"||v.type==="tableDelimiterRow"?(a=!0,h=void 0,o=[0,0,0,0],l=[0,r+1,0,0],u&&(u=!1,p={type:"tableBody",start:Object.assign({},v.start),end:Object.assign({},v.end)},m.add(r,0,[["enter",p,t]])),i=v.type==="tableDelimiterRow"?2:p?3:1):i&&(v.type==="data"||v.type==="tableDelimiterMarker"||v.type==="tableDelimiterFiller")?(a=!1,l[2]===0&&(o[1]!==0&&(l[0]=l[1],h=Rd(m,t,o,i,void 0,h),o=[0,0,0,0]),l[2]=r)):v.type==="tableCellDivider"&&(a?a=!1:(o[1]!==0&&(l[0]=l[1],h=Rd(m,t,o,i,void 0,h)),o=l,l=[o[1],r,0,0])):v.type==="tableHead"?(u=!0,d=r):v.type==="tableRow"||v.type==="tableDelimiterRow"?(d=r,o[1]!==0?(l[0]=l[1],h=Rd(m,t,o,i,r,h)):l[1]!==0&&(h=Rd(m,t,l,i,r,h)),i=0):i&&(v.type==="data"||v.type==="tableDelimiterMarker"||v.type==="tableDelimiterFiller")&&(l[3]=r)}for(d!==0&&$w(m,t,d,f,p),m.consume(t.events),r=-1;++r<t.events.length;){const y=t.events[r];y[0]==="enter"&&y[1].type==="table"&&(y[1]._align=Z7(t.events,r))}return e}function Rd(e,t,r,a,i,o){const l=a===1?"tableHeader":a===2?"tableDelimiter":"tableData",u="tableContent";r[0]!==0&&(o.end=Object.assign({},bl(t.events,r[0])),e.add(r[0],0,[["exit",o,t]]));const d=bl(t.events,r[1]);if(o={type:l,start:Object.assign({},d),end:Object.assign({},d)},e.add(r[1],0,[["enter",o,t]]),r[2]!==0){const f=bl(t.events,r[2]),p=bl(t.events,r[3]),h={type:u,start:Object.assign({},f),end:Object.assign({},p)};if(e.add(r[2],0,[["enter",h,t]]),a!==2){const m=t.events[r[2]],y=t.events[r[3]];if(m[1].end=Object.assign({},y[1].end),m[1].type="chunkText",m[1].contentType="text",r[3]>r[2]+1){const v=r[2]+1,k=r[3]-r[2]-1;e.add(v,k,[])}}e.add(r[3]+1,0,[["exit",h,t]])}return i!==void 0&&(o.end=Object.assign({},bl(t.events,i)),e.add(i,0,[["exit",o,t]]),o=void 0),o}function $w(e,t,r,a,i){const o=[],l=bl(t.events,r);i&&(i.end=Object.assign({},l),o.push(["exit",i,t])),a.end=Object.assign({},l),o.push(["exit",a,t]),e.add(r+1,0,o)}function bl(e,t){const r=e[t],a=r[0]==="enter"?"start":"end";return r[1][a]}const r9={name:"tasklistCheck",tokenize:a9};function n9(){return{text:{91:r9}}}function a9(e,t,r){const a=this;return i;function i(d){return a.previous!==null||!a._gfmTasklistFirstContentOfListItem?r(d):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),o)}function o(d){return qr(d)?(e.enter("taskListCheckValueUnchecked"),e.consume(d),e.exit("taskListCheckValueUnchecked"),l):d===88||d===120?(e.enter("taskListCheckValueChecked"),e.consume(d),e.exit("taskListCheckValueChecked"),l):r(d)}function l(d){return d===93?(e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),u):r(d)}function u(d){return Vt(d)?t(d):hr(d)?e.check({tokenize:i9},t,r)(d):r(d)}}function i9(e,t,r){return br(e,a,"whitespace");function a(i){return i===null?r(i):t(i)}}function s9(e){return QT([A7(),U7(),Y7(e),J7(),n9()])}const o9={};function Tl(e){const t=this,r=e||o9,a=t.data(),i=a.micromarkExtensions||(a.micromarkExtensions=[]),o=a.fromMarkdownExtensions||(a.fromMarkdownExtensions=[]),l=a.toMarkdownExtensions||(a.toMarkdownExtensions=[]);i.push(s9(r)),o.push(j7()),l.push(C7(r))}const Ww=(function(e,t,r){const a=du(r);if(!e||!e.type||!e.children)throw new Error("Expected parent node");if(typeof t=="number"){if(t<0||t===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if(t=e.children.indexOf(t),t<0)throw new Error("Expected child node or index");for(;++t<e.children.length;)if(a(e.children[t],t,e))return e.children[t]}),Ao=(function(e){if(e==null)return u9;if(typeof e=="string")return c9(e);if(typeof e=="object")return l9(e);if(typeof e=="function")return ak(e);throw new Error("Expected function, string, or array as `test`")});function l9(e){const t=[];let r=-1;for(;++r<e.length;)t[r]=Ao(e[r]);return ak(a);function a(...i){let o=-1;for(;++o<t.length;)if(t[o].apply(this,i))return!0;return!1}}function c9(e){return ak(t);function t(r){return r.tagName===e}}function ak(e){return t;function t(r,a,i){return!!(d9(r)&&e.call(this,r,typeof a=="number"?a:void 0,i||void 0))}}function u9(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function d9(e){return e!==null&&typeof e=="object"&&"type"in e&&"tagName"in e}const Vw=/\n/g,Gw=/[\t ]+/g,cv=Ao("br"),Kw=Ao(b9),f9=Ao("p"),Yw=Ao("tr"),p9=Ao(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",y9,v9]),q5=Ao(["address","article","aside","blockquote","body","caption","center","dd","dialog","dir","dl","dt","div","figure","figcaption","footer","form,","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","legend","li","listing","main","menu","nav","ol","p","plaintext","pre","section","ul","xmp"]);function g9(e,t){const r=t||{},a="children"in e?e.children:[],i=q5(e),o=W5(e,{whitespace:r.whitespace||"normal"}),l=[];(e.type==="text"||e.type==="comment")&&l.push(...$5(e,{breakBefore:!0,breakAfter:!0}));let u=-1;for(;++u<a.length;)l.push(...H5(a[u],e,{whitespace:o,breakBefore:u?void 0:i,breakAfter:u<a.length-1?cv(a[u+1]):i}));const d=[];let f;for(u=-1;++u<l.length;){const p=l[u];typeof p=="number"?f!==void 0&&p>f&&(f=p):p&&(f!==void 0&&f>-1&&d.push(`
77
+ `.repeat(f)||" "),f=-1,d.push(p))}return d.join("")}function H5(e,t,r){return e.type==="element"?h9(e,t,r):e.type==="text"?r.whitespace==="normal"?$5(e,r):m9(e):[]}function h9(e,t,r){const a=W5(e,r),i=e.children||[];let o=-1,l=[];if(p9(e))return l;let u,d;for(cv(e)||Yw(e)&&Ww(t,e,Yw)?d=`
78
+ `:f9(e)?(u=2,d=2):q5(e)&&(u=1,d=1);++o<i.length;)l=l.concat(H5(i[o],e,{whitespace:a,breakBefore:o?void 0:u,breakAfter:o<i.length-1?cv(i[o+1]):d}));return Kw(e)&&Ww(t,e,Kw)&&l.push(" "),u&&l.unshift(u),d&&l.push(d),l}function $5(e,t){const r=String(e.value),a=[],i=[];let o=0;for(;o<=r.length;){Vw.lastIndex=o;const d=Vw.exec(r),f=d&&"index"in d?d.index:r.length;a.push(x9(r.slice(o,f).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),o===0?t.breakBefore:!0,f===r.length?t.breakAfter:!0)),o=f+1}let l=-1,u;for(;++l<a.length;)a[l].charCodeAt(a[l].length-1)===8203||l<a.length-1&&a[l+1].charCodeAt(0)===8203?(i.push(a[l]),u=void 0):a[l]?(typeof u=="number"&&i.push(u),i.push(a[l]),u=0):(l===0||l===a.length-1)&&i.push(0);return i}function m9(e){return[String(e.value)]}function x9(e,t,r){const a=[];let i=0,o;for(;i<e.length;){Gw.lastIndex=i;const l=Gw.exec(e);o=l?l.index:e.length,!i&&!o&&l&&!t&&a.push(""),i!==o&&a.push(e.slice(i,o)),i=l?o+l[0].length:o}return i!==o&&!r&&a.push(""),a.join(" ")}function W5(e,t){if(e.type==="element"){const r=e.properties||{};switch(e.tagName){case"listing":case"plaintext":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return r.wrap?"pre-wrap":"pre";case"td":case"th":return r.noWrap?"nowrap":t.whitespace;case"textarea":return"pre-wrap"}}return t.whitespace}function y9(e){return!!(e.properties||{}).hidden}function b9(e){return e.tagName==="td"||e.tagName==="th"}function v9(e){return e.tagName==="dialog"&&!(e.properties||{}).open}function k9(e){const t=e.regex,r=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),a="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",l="(?!struct)("+a+"|"+t.optional(i)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",u={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},f={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},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:/<.*?>/},r,e.C_BLOCK_COMMENT_MODE]},m={className:"title",begin:t.optional(i)+e.IDENT_RE,relevance:0},y=t.optional(i)+e.IDENT_RE+"\\s*\\(",v=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],k=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],_=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],w=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],A={type:k,keyword:v,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:_},T={className:"function.dispatch",relevance:0,keywords:{_hint:w},begin:t.concat(/\b/,`(?!${v.join("|")})`,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},C=[T,h,u,r,e.C_BLOCK_COMMENT_MODE,p,f],j={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:A,contains:C.concat([{begin:/\(/,end:/\)/,keywords:A,contains:C.concat(["self"]),relevance:0}]),relevance:0},M={className:"function",begin:"("+l+"[\\*&\\s]+)+"+y,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:A,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:a,keywords:A,relevance:0},{begin:y,returnBegin:!0,contains:[m],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[f,p]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:A,relevance:0,contains:[r,e.C_BLOCK_COMMENT_MODE,f,p,u,{begin:/\(/,end:/\)/,keywords:A,relevance:0,contains:["self",r,e.C_BLOCK_COMMENT_MODE,f,p,u]}]},u,r,e.C_BLOCK_COMMENT_MODE,h]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:A,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(j,M,T,C,[h,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:A,contains:["self",u]},{begin:e.IDENT_RE+"::",keywords:A},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function _9(e){const t={type:["boolean","byte","word","String"],built_in:["KeyboardController","MouseController","SoftwareSerial","EthernetServer","EthernetClient","LiquidCrystal","RobotControl","GSMVoiceCall","EthernetUDP","EsploraTFT","HttpClient","RobotMotor","WiFiClient","GSMScanner","FileSystem","Scheduler","GSMServer","YunClient","YunServer","IPAddress","GSMClient","GSMModem","Keyboard","Ethernet","Console","GSMBand","Esplora","Stepper","Process","WiFiUDP","GSM_SMS","Mailbox","USBHost","Firmata","PImage","Client","Server","GSMPIN","FileIO","Bridge","Serial","EEPROM","Stream","Mouse","Audio","Servo","File","Task","GPRS","WiFi","Wire","TFT","GSM","SPI","SD"],_hints:["setup","loop","runShellCommandAsynchronously","analogWriteResolution","retrieveCallingNumber","printFirmwareVersion","analogReadResolution","sendDigitalPortPair","noListenOnLocalhost","readJoystickButton","setFirmwareVersion","readJoystickSwitch","scrollDisplayRight","getVoiceCallStatus","scrollDisplayLeft","writeMicroseconds","delayMicroseconds","beginTransmission","getSignalStrength","runAsynchronously","getAsynchronously","listenOnLocalhost","getCurrentCarrier","readAccelerometer","messageAvailable","sendDigitalPorts","lineFollowConfig","countryNameWrite","runShellCommand","readStringUntil","rewindDirectory","readTemperature","setClockDivider","readLightSensor","endTransmission","analogReference","detachInterrupt","countryNameRead","attachInterrupt","encryptionType","readBytesUntil","robotNameWrite","readMicrophone","robotNameRead","cityNameWrite","userNameWrite","readJoystickY","readJoystickX","mouseReleased","openNextFile","scanNetworks","noInterrupts","digitalWrite","beginSpeaker","mousePressed","isActionDone","mouseDragged","displayLogos","noAutoscroll","addParameter","remoteNumber","getModifiers","keyboardRead","userNameRead","waitContinue","processInput","parseCommand","printVersion","readNetworks","writeMessage","blinkVersion","cityNameRead","readMessage","setDataMode","parsePacket","isListening","setBitOrder","beginPacket","isDirectory","motorsWrite","drawCompass","digitalRead","clearScreen","serialEvent","rightToLeft","setTextSize","leftToRight","requestFrom","keyReleased","compassRead","analogWrite","interrupts","WiFiServer","disconnect","playMelody","parseFloat","autoscroll","getPINUsed","setPINUsed","setTimeout","sendAnalog","readSlider","analogRead","beginWrite","createChar","motorsStop","keyPressed","tempoWrite","readButton","subnetMask","debugPrint","macAddress","writeGreen","randomSeed","attachGPRS","readString","sendString","remotePort","releaseAll","mouseMoved","background","getXChange","getYChange","answerCall","getResult","voiceCall","endPacket","constrain","getSocket","writeJSON","getButton","available","connected","findUntil","readBytes","exitValue","readGreen","writeBlue","startLoop","IPAddress","isPressed","sendSysex","pauseMode","gatewayIP","setCursor","getOemKey","tuneWrite","noDisplay","loadImage","switchPIN","onRequest","onReceive","changePIN","playFile","noBuffer","parseInt","overflow","checkPIN","knobRead","beginTFT","bitClear","updateIR","bitWrite","position","writeRGB","highByte","writeRed","setSpeed","readBlue","noStroke","remoteIP","transfer","shutdown","hangCall","beginSMS","endWrite","attached","maintain","noCursor","checkReg","checkPUK","shiftOut","isValid","shiftIn","pulseIn","connect","println","localIP","pinMode","getIMEI","display","noBlink","process","getBand","running","beginSD","drawBMP","lowByte","setBand","release","bitRead","prepare","pointTo","readRed","setMode","noFill","remove","listen","stroke","detach","attach","noTone","exists","buffer","height","bitSet","circle","config","cursor","random","IRread","setDNS","endSMS","getKey","micros","millis","begin","print","write","ready","flush","width","isPIN","blink","clear","press","mkdir","rmdir","close","point","yield","image","BSSID","click","delay","read","text","move","peek","beep","rect","line","open","seek","fill","size","turn","stop","home","find","step","tone","sqrt","RSSI","SSID","end","bit","tan","cos","sin","pow","map","abs","max","min","get","run","put"],literal:["DIGITAL_MESSAGE","FIRMATA_STRING","ANALOG_MESSAGE","REPORT_DIGITAL","REPORT_ANALOG","INPUT_PULLUP","SET_PIN_MODE","INTERNAL2V56","SYSTEM_RESET","LED_BUILTIN","INTERNAL1V1","SYSEX_START","INTERNAL","EXTERNAL","DEFAULT","OUTPUT","INPUT","HIGH","LOW"]},r=k9(e),a=r.keywords;return a.type=[...a.type,...t.type],a.literal=[...a.literal,...t.literal],a.built_in=[...a.built_in,...t.built_in],a._hints=t._hints,r.name="Arduino",r.aliases=["ino"],r.supersetOf="cpp",r}function w9(e){const t=e.regex,r={},a={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[r]}]};Object.assign(r,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},a]});const i={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},o=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),l={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},u={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,r,i]};i.contains.push(u);const d={match:/\\"/},f={className:"string",begin:/'/,end:/'/},p={match:/\\'/},h={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,r]},m=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],y=e.SHEBANG({binary:`(${m.join("|")})`,relevance:10}),v={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},k=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],_=["true","false"],w={match:/(\/[a-z._-]+)+/},N=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],E=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],A=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],T=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:k,literal:_,built_in:[...N,...E,"set","shopt",...A,...T]},contains:[y,e.SHEBANG(),v,h,o,l,w,u,d,f,p,r]}}function S9(e){const t=e.regex,r=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),a="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",l="("+a+"|"+t.optional(i)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",u={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},f={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},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:/<.*?>/},r,e.C_BLOCK_COMMENT_MODE]},m={className:"title",begin:t.optional(i)+e.IDENT_RE,relevance:0},y=t.optional(i)+e.IDENT_RE+"\\s*\\(",_={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},w=[h,u,r,e.C_BLOCK_COMMENT_MODE,p,f],N={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:_,contains:w.concat([{begin:/\(/,end:/\)/,keywords:_,contains:w.concat(["self"]),relevance:0}]),relevance:0},E={begin:"("+l+"[\\*&\\s]+)+"+y,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:_,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:a,keywords:_,relevance:0},{begin:y,returnBegin:!0,contains:[e.inherit(m,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:_,relevance:0,contains:[r,e.C_BLOCK_COMMENT_MODE,f,p,u,{begin:/\(/,end:/\)/,keywords:_,relevance:0,contains:["self",r,e.C_BLOCK_COMMENT_MODE,f,p,u]}]},u,r,e.C_BLOCK_COMMENT_MODE,h]};return{name:"C",aliases:["h"],keywords:_,disableAutodetect:!0,illegal:"</",contains:[].concat(N,E,w,[h,{begin:e.IDENT_RE+"::",keywords:_},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:h,strings:f,keywords:_}}}function N9(e){const t=e.regex,r=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),a="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",l="(?!struct)("+a+"|"+t.optional(i)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",u={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},f={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},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:/<.*?>/},r,e.C_BLOCK_COMMENT_MODE]},m={className:"title",begin:t.optional(i)+e.IDENT_RE,relevance:0},y=t.optional(i)+e.IDENT_RE+"\\s*\\(",v=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],k=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],_=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],w=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],A={type:k,keyword:v,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:_},T={className:"function.dispatch",relevance:0,keywords:{_hint:w},begin:t.concat(/\b/,`(?!${v.join("|")})`,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},C=[T,h,u,r,e.C_BLOCK_COMMENT_MODE,p,f],j={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:A,contains:C.concat([{begin:/\(/,end:/\)/,keywords:A,contains:C.concat(["self"]),relevance:0}]),relevance:0},M={className:"function",begin:"("+l+"[\\*&\\s]+)+"+y,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:A,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:a,keywords:A,relevance:0},{begin:y,returnBegin:!0,contains:[m],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[f,p]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:A,relevance:0,contains:[r,e.C_BLOCK_COMMENT_MODE,f,p,u,{begin:/\(/,end:/\)/,keywords:A,relevance:0,contains:["self",r,e.C_BLOCK_COMMENT_MODE,f,p,u]}]},u,r,e.C_BLOCK_COMMENT_MODE,h]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:A,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(j,M,T,C,[h,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:A,contains:["self",u]},{begin:e.IDENT_RE+"::",keywords:A},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function E9(e){const t=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],r=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],a=["default","false","null","true"],i=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],o=["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"],l={keyword:i.concat(o),built_in:t,literal:a},u=e.inherit(e.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),d={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9'_]+|(\\b[\\d'_]+(\\.[\\d'_]*)?|\\.[\\d'_]+)([eE][-+]?[\\d'_]+)?)"}],relevance:0},f={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},p={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},h=e.inherit(p,{illegal:/\n/}),m={className:"subst",begin:/\{/,end:/\}/,keywords:l},y=e.inherit(m,{illegal:/\n/}),v={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,y]},k={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},m]},_=e.inherit(k,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},y]});m.contains=[k,v,p,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,d,e.C_BLOCK_COMMENT_MODE],y.contains=[_,v,h,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,d,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const w={variants:[f,k,v,p,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},N={begin:"<",end:">",contains:[{beginKeywords:"in out"},u]},E=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",A={begin:"@"+e.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:l,illegal:/::/,contains:[e.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:"<!--|-->"},{begin:"</?",end:">"}]}]}),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},w,d,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},u,N,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,N,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+E+"\\s+)+"+e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:l,contains:[{beginKeywords:r.join(" "),relevance:0},{begin:e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[e.TITLE_MODE,N],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,relevance:0,contains:[w,d,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},A]}}const j9=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_-]*/}}),C9=["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"],T9=["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"],R9=[...C9,...T9],A9=["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(),I9=["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(),M9=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),L9=["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 O9(e){const t=e.regex,r=j9(e),a={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},i="and or not only",o=/@-?\w[\w]*(-\w+)*/,l="[a-zA-Z-][a-zA-Z0-9_-]*",u=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[r.BLOCK_COMMENT,a,r.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+l,relevance:0},r.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+I9.join("|")+")"},{begin:":(:)?("+M9.join("|")+")"}]},r.CSS_VARIABLE,{className:"attribute",begin:"\\b("+L9.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[r.BLOCK_COMMENT,r.HEXCOLOR,r.IMPORTANT,r.CSS_NUMBER_MODE,r.UNICODE_RANGE,...u,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...u,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},r.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:o},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:A9.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...u,r.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+R9.join("|")+")\\b"}]}}function D9(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 P9(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 F9(e){const t=e.regex,r=/[_A-Za-z][_0-9A-Za-z]*/;return{name:"GraphQL",aliases:["gql"],case_insensitive:!0,disableAutodetect:!1,keywords:{keyword:["query","mutation","subscription","type","input","schema","directive","interface","union","scalar","fragment","enum","on"],literal:["true","false","null"]},contains:[e.HASH_COMMENT_MODE,e.QUOTE_STRING_MODE,e.NUMBER_MODE,{scope:"punctuation",match:/[.]{3}/,relevance:0},{scope:"punctuation",begin:/[\!\(\)\:\=\[\]\{\|\}]{1}/,relevance:0},{scope:"variable",begin:/\$/,end:/\W/,excludeEnd:!0,relevance:0},{scope:"meta",match:/@\w+/,excludeEnd:!0},{scope:"symbol",begin:t.concat(r,t.lookahead(/\s*:/)),relevance:0}],illegal:[/[;<']/,/BEGIN/]}}function B9(e){const t=e.regex,r={className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:e.NUMBER_RE}]},a=e.COMMENT();a.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];const i={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},o={className:"literal",begin:/\bon|off|true|false|yes|no\b/},l={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}]},u={begin:/\[/,end:/\]/,contains:[a,o,i,l,r,"self"],relevance:0},d=/[A-Za-z0-9_-]+/,f=/"(\\"|[^"])*"/,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:[a,{className:"section",begin:/\[+/,end:/\]+/},{begin:m,className:"attr",starts:{end:/$/,contains:[a,u,o,i,l,r]}}]}}var vl="[0-9](_*[0-9])*",Ad=`\\.(${vl})`,Id="[0-9a-fA-F](_*[0-9a-fA-F])*",Xw={className:"number",variants:[{begin:`(\\b(${vl})((${Ad})|\\.)?|(${Ad}))[eE][+-]?(${vl})[fFdD]?\\b`},{begin:`\\b(${vl})((${Ad})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Ad})[fFdD]?\\b`},{begin:`\\b(${vl})[fFdD]\\b`},{begin:`\\b0[xX]((${Id})\\.?|(${Id})?\\.(${Id}))[pP][+-]?(${vl})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${Id})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function V5(e,t,r){return r===-1?"":e.replace(t,a=>V5(e,t,r-1))}function z9(e){const t=e.regex,r="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",a=r+V5("(?:<"+r+"~~~(?:\\s*,\\s*"+r+"~~~)*>)?",/~~~/g,2),d={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},f={className:"meta",begin:"@"+r,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},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+/,r],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[t.concat(/(?!else)/,r),/\s+/,r,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,r],className:{1:"keyword",3:"title.class"},contains:[p,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+a+"\\s+)",e.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:d,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:d,relevance:0,contains:[f,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,Xw,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},Xw,f]}}const Qw="[A-Za-z$_][0-9A-Za-z$_]*",U9=["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"],q9=["true","false","null","undefined","NaN","Infinity"],G5=["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"],K5=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Y5=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],H9=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],$9=[].concat(Y5,G5,K5);function W9(e){const t=e.regex,r=(J,{after:ne})=>{const P="</"+J[0].slice(1);return J.input.indexOf(P,ne)!==-1},a=Qw,i={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,l={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(J,ne)=>{const P=J[0].length+J.index,U=J.input[P];if(U==="<"||U===","){ne.ignoreMatch();return}U===">"&&(r(J,{after:P})||ne.ignoreMatch());let X;const F=J.input.substring(P);if(X=F.match(/^\s*=/)){ne.ignoreMatch();return}if((X=F.match(/^\s+extends\s+/))&&X.index===0){ne.ignoreMatch();return}}},u={$pattern:Qw,keyword:U9,literal:q9,built_in:$9,"variable.language":H9},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:[]},y={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,m],subLanguage:"xml"}},v={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,m],subLanguage:"css"}},k={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,m],subLanguage:"graphql"}},_={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,m]},N={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:a+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},E=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,y,v,k,_,{match:/\$\d+/},h];m.contains=E.concat({begin:/\{/,end:/\}/,keywords:u,contains:["self"].concat(E)});const A=[].concat(N,m.contains),T=A.concat([{begin:/(\s*)\(/,end:/\)/,keywords:u,contains:["self"].concat(A)}]),C={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:u,contains:T},j={variants:[{match:[/class/,/\s+/,a,/\s+/,/extends/,/\s+/,t.concat(a,"(",t.concat(/\./,a),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,a],scope:{1:"keyword",3:"title.class"}}]},M={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:{_:[...G5,...K5]}},L={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},I={variants:[{match:[/function/,/\s+/,a,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[C],illegal:/%/},B={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function z(J){return t.concat("(?!",J.join("|"),")")}const ee={match:t.concat(/\b/,z([...Y5,"super","import","await"].map(J=>`${J}\\s*\\(`)),a,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},V={begin:t.concat(/\./,t.lookahead(t.concat(a,/(?![0-9A-Za-z$_(])/))),end:a,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},D={match:[/get|set/,/\s+/,a,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},C]},K="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",H={match:[/const|var|let/,/\s+/,a,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(K)],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:M},illegal:/#(?![$_A-Za-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),L,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,y,v,k,_,N,{match:/\$\d+/},h,M,{scope:"attr",match:a+t.lookahead(":"),relevance:0},H,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[N,e.REGEXP_MODE,{className:"function",begin:K,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:u,contains:T}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:o},{begin:l.begin,"on:begin":l.isTrulyOpeningTag,end:l.end}],subLanguage:"xml",contains:[{begin:l.begin,end:l.end,skip:!0,contains:["self"]}]}]},I,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[C,e.inherit(e.TITLE_MODE,{begin:a,className:"title.function"})]},{match:/\.\.\./,relevance:0},V,{match:"\\$"+a,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[C]},ee,B,j,D,{match:/\$[(.]/}]}}const V9="([-+]?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)|NaN|[-+]?Infinity",G9={scope:"number",match:V9,relevance:0};function K9(e){const t={className:"attr",begin:/(("(\\.|[^\\"\r\n])*")|('(\\.|[^\\'\r\n])*'))(?=\s*:)/,relevance:1.01},r={match:/[{}[\],:]/,className:"punctuation",relevance:0},a=["true","false","null"],i={scope:"literal",beginKeywords:a.join(" ")};return{name:"JSON",aliases:["jsonc","json5"],keywords:{literal:a},contains:[t,r,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,i,G9,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var kl="[0-9](_*[0-9])*",Md=`\\.(${kl})`,Ld="[0-9a-fA-F](_*[0-9a-fA-F])*",Y9={className:"number",variants:[{begin:`(\\b(${kl})((${Md})|\\.)?|(${Md}))[eE][+-]?(${kl})[fFdD]?\\b`},{begin:`\\b(${kl})((${Md})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Md})[fFdD]?\\b`},{begin:`\\b(${kl})[fFdD]\\b`},{begin:`\\b0[xX]((${Ld})\\.?|(${Ld})?\\.(${Ld}))[pP][+-]?(${kl})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${Ld})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function X9(e){const t={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},r={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},a={className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"@"},i={className:"subst",begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},o={className:"variable",begin:"\\$"+e.UNDERSCORE_IDENT_RE},l={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[o,i]},{begin:"'",end:"'",illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,o,i]}]};i.contains.push(l);const u={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UNDERSCORE_IDENT_RE+")?"},d={className:"meta",begin:"@"+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[e.inherit(l,{className:"string"}),"self"]}]},f=Y9,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,r,a,u,d,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:t,relevance:5,contains:[{begin:e.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[e.UNDERSCORE_TITLE_MODE]},{className:"type",begin:/</,end:/>/,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:t,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[h,e.C_LINE_COMMENT_MODE,p],relevance:0},e.C_LINE_COMMENT_MODE,p,u,d,l,e.C_NUMBER_MODE]},p]},{begin:[/class|interface|trait/,/\s+/,e.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},e.UNDERSCORE_TITLE_MODE,{className:"type",begin:/</,end:/>/,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},u,d]},l,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:`
79
+ `},f]}}const Q9=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_-]*/}}),Z9=["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"],J9=["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"],eF=[...Z9,...J9],tF=["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(),X5=["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(),Q5=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),rF=["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(),nF=X5.concat(Q5).sort().reverse();function aF(e){const t=Q9(e),r=nF,a="and or not only",i="[\\w-]+",o="("+i+"|@\\{"+i+"\\})",l=[],u=[],d=function(E){return{className:"string",begin:"~?"+E+".*?"+E}},f=function(E,A,T){return{className:E,begin:A,relevance:T}},p={$pattern:/[a-z-]+/,keyword:a,attribute:tF.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}),y={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(u)},v={begin:o+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+rF.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}},w={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:o,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,y,f("keyword","all\\b"),f("variable","@\\{"+i+"\\}"),{begin:"\\b("+eF.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:":("+X5.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+Q5.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:m},{begin:"!important"},t.FUNCTION_DISPATCH]},N={begin:i+`:(:)?(${r.join("|")})`,returnBegin:!0,contains:[w]};return l.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,k,_,N,v,w,y,t.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:l}}function iF(e){const t="\\[=*\\[",r="\\]=*\\]",a={begin:t,end:r,contains:["self"]},i=[e.COMMENT("--(?!"+t+")","$"),e.COMMENT("--"+t,r,{contains:[a],relevance:10})];return{name:"Lua",aliases:["pluto"],keywords:{$pattern:e.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:i.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[e.inherit(e.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:i}].concat(i)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string",begin:t,end:r,contains:[a],relevance:5}])}}function sF(e){const t={className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)",contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%<?\^\+\*]/}]},r={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,t]},a={className:"variable",begin:/\$\([\w-]+\s/,end:/\)/,keywords:{built_in:"subst patsubst strip findstring filter filter-out sort word wordlist firstword lastword dir notdir suffix basename addsuffix addprefix join wildcard realpath abspath error warning shell origin flavor foreach if or and call eval file value"},contains:[t,r]},i={begin:"^"+e.UNDERSCORE_IDENT_RE+"\\s*(?=[:+?]?=)"},o={className:"meta",begin:/^\.PHONY:/,end:/$/,keywords:{$pattern:/[\.\w]+/,keyword:".PHONY"}},l={className:"section",begin:/^[^\s]+:/,end:/$/,contains:[t]};return{name:"Makefile",aliases:["mk","mak","make"],keywords:{$pattern:/[\w-]+/,keyword:"define endef undefine ifdef ifndef ifeq ifneq else endif include -include sinclude override export unexport private vpath"},contains:[e.HASH_COMMENT_MODE,t,r,a,i,o,l]}}function oF(e){const t=e.regex,r={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},a={begin:"^[-\\*]{3,}",end:"$"},i={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},o={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},l={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},u=/[A-Za-z][A-Za-z0-9+.-]*/,d={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,u,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},f={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},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 y=[r,d];return[f,p,h,m].forEach(w=>{w.contains=w.contains.concat(y)}),y=y.concat(f,p),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:y},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:y}]}]},r,o,f,p,{className:"quote",begin:"^>\\s+",contains:y,end:"$"},i,a,d,l,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function lF(e){const t={className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},r=/[a-zA-Z@][a-zA-Z0-9_]*/,u={"variable.language":["this","super"],$pattern:r,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},d={$pattern:r,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:u,illegal:"</",contains:[t,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,e.C_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{className:"string",variants:[{begin:'@"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]}]},{className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),{className:"string",begin:/<.*?>/,end:/$/,illegal:"\\n"},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+d.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:d,contains:[e.UNDERSCORE_TITLE_MODE]},{begin:"\\."+e.UNDERSCORE_IDENT_RE,relevance:0}]}}function cF(e){const t=e.regex,r=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","class","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","field","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","method","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],a=/[dualxmsipngr]{0,12}/,i={$pattern:/[\w.]+/,keyword:r.join(" ")},o={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:i},l={begin:/->\{/,end:/\}/},u={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},d={scope:"variable",variants:[{begin:/\$\d/},{begin:t.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[u]},f={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},p=[e.BACKSLASH_ESCAPE,o,d],h=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],m=(k,_,w="\\1")=>{const N=w==="\\1"?w:t.concat(w,_);return t.concat(t.concat("(?:",k,")"),_,/(?:\\.|[^\\\/])*?/,N,/(?:\\.|[^\\\/])*?/,w,a)},y=(k,_,w)=>t.concat(t.concat("(?:",k,")"),_,/(?:\\.|[^\\\/])*?/,w,a),v=[d,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),l,{className:"string",contains: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:y("(?:m|qr)?",/\//,/\//)},{begin:y("m|qr",t.either(...h,{capture:!0}),/\1/)},{begin:y("m|qr",/\(/,/\)/)},{begin:y("m|qr",/\[/,/\]/)},{begin:y("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,u]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,u,f]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return o.contains=v,l.contains=v,{name:"Perl",aliases:["pl","pm"],keywords:i,contains:v}}function uF(e){const t=e.regex,r=/(?![A-Za-z0-9])(?![$])/,a=t.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,r),i=t.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,r),o=t.concat(/[A-Z]+/,r),l={scope:"variable",match:"\\$+"+a},u={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},d={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},f=e.inherit(e.APOS_STRING_MODE,{illegal:null}),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,D)=>{D.data._beginMatch=V[1]||V[2]},"on:end":(V,D)=>{D.data._beginMatch!==V[1]&&D.ignoreMatch()}},m=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),y=`[
80
+ ]`,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"],w=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],N=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],A={keyword:w,literal:(V=>{const D=[];return V.forEach(K=>{D.push(K),K.toLowerCase()===K?D.push(K.toUpperCase()):D.push(K.toLowerCase())}),D})(_),built_in:N},T=V=>V.map(D=>D.replace(/\|\d+$/,"")),C={variants:[{match:[/new/,t.concat(y,"+"),t.concat("(?!",T(N).join("\\b|"),"\\b)"),i],scope:{1:"keyword",4:"title.class"}}]},j=t.concat(a,"\\b(?!\\()"),M={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),j],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[i,t.concat(/::/,t.lookahead(/(?!class\b)/)),j],scope:{1:"title.class",3:"variable.constant"}},{match:[i,t.concat("::",t.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[i,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},L={scope:"attr",match:t.concat(a,t.lookahead(":"),t.lookahead(/(?!::)/))},I={relevance:0,begin:/\(/,end:/\)/,keywords:A,contains:[L,l,M,e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE,e.HASH_COMMENT_MODE,v,k,C]},B={relevance:0,match:[/\b/,t.concat("(?!fn\\b|function\\b|",T(w).join("\\b|"),"|",T(N).join("\\b|"),"\\b)"),a,t.concat(y,"*"),t.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[I]};I.contains.push(B);const z=[L,M,e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE,e.HASH_COMMENT_MODE,v,k,C],ee={begin:t.concat(/#\[\s*\\?/,t.either(i,o)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:_,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:_,keyword:["new","array"]},contains:["self",...z]},...z,{scope:"meta",variants:[{match:i},{match:o}]}]};return{case_insensitive:!1,keywords:A,contains:[ee,e.HASH_COMMENT_MODE,e.COMMENT("//","$"),e.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:e.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},u,{scope:"variable.language",match:/\$this\b/},l,B,M,{match:[/const/,/\s/,a],scope:{1:"keyword",3:"variable.constant"}},C,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},e.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:A,contains:["self",ee,l,M,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 dF(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 fF(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function pF(e){const t=e.regex,r=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),a=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],u={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:a,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},d={className:"meta",begin:/^(>>>|\.\.\.) /},f={className:"subst",begin:/\{/,end:/\}/,keywords:u,illegal:/#/},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])*",y=`(\\b(${m}))?\\.(${m})|\\b(${m})\\.`,v=`\\b|${a.join("|")}`,k={className:"number",relevance:0,variants:[{begin:`(\\b(${m})|(${y}))[eE][+-]?(${m})[jJ]?(?=${v})`},{begin:`(${y})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${v})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${v})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${v})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${v})`},{begin:`\\b(${m})[jJ](?=${v})`}]},_={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:u,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},w={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:u,contains:["self",d,k,h,e.HASH_COMMENT_MODE]}]};return f.contains=[h,k,d],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:u,illegal:/(<\/|\?)|=>/,contains:[d,k,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},h,_,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,r],scope:{1:"keyword",3:"title.function"},contains:[w]},{variants:[{match:[/\bclass/,/\s+/,r,/\s*/,/\(\s*/,r,/\s*\)/]},{match:[/\bclass/,/\s+/,r]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[k,w,h]}]}}function gF(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function hF(e){const t=e.regex,r=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,a=t.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),i=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,o=t.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:r,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[e.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:t.lookahead(t.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:r},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),e.HASH_COMMENT_MODE,{scope:"string",contains:[e.BACKSLASH_ESCAPE],variants:[e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[i,a]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,a]},{scope:{1:"punctuation",2:"number"},match:[o,a]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,a]}]},{scope:{3:"operator"},match:[r,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:i},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:o},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function mF(e){const t=e.regex,r="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",a=t.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),i=t.concat(a,/(::\w+)*/),l={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},u={className:"doctag",begin:"@[A-Za-z]+"},d={begin:"#<",end:">"},f=[e.COMMENT("#","$",{contains:[u]}),e.COMMENT("^=begin","^=end",{contains:[u],relevance:10}),e.COMMENT("^__END__",e.MATCH_NOTHING_RE)],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",y="[0-9](_?[0-9])*",v={className:"number",relevance:0,variants:[{begin:`\\b(${m})(\\.(${y}))?([eE][+-]?(${y})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},k={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:l}]},C=[h,{variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{match:[/\b(class|module)\s+/,i]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:l},{match:[/(include|extend)\s+/,i],scope:{2:"title.class"},keywords:l},{relevance:0,match:[i,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:a,scope:"title.class"},{match:[/def/,/\s+/,r],scope:{1:"keyword",3:"title.function"},contains:[k]},{begin:e.IDENT_RE+"::"},{className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[h,{begin:r}],relevance:0},v,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:l},{begin:"("+e.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[e.BACKSLASH_ESCAPE,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 I=[{begin:/^\s*=>/,starts:{end:"$",contains:C}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:l,contains:C}}];return f.unshift(d),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:l,illegal:/\/\*/,contains:[e.SHEBANG({binary:"ruby"})].concat(I).concat(f).concat(C)}}function xF(e){const t=e.regex,r=/(r#)?/,a=t.concat(r,e.UNDERSCORE_IDENT_RE),i=t.concat(r,e.IDENT_RE),o={className:"title.function.invoke",relevance:0,begin:t.concat(/\b/,/(?!let|for|while|if|else|match\b)/,i,t.lookahead(/\s*\(/))},l="([ui](8|16|32|64|128|size)|f(32|64))?",u=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],d=["true","false","Some","None","Ok","Err"],f=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],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+/,a],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,a],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,a,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,a],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,a],className:{1:"keyword",3:"title.class"}},{begin:e.IDENT_RE+"::",keywords:{keyword:"Self",built_in:f,type:p}},{className:"punctuation",begin:"->"},o]}}const yF=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_-]*/}}),bF=["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"],vF=["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"],kF=[...bF,...vF],_F=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),wF=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),SF=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),NF=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","unicode-range","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function EF(e){const t=yF(e),r=SF,a=wF,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("+kF.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+a.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+r.join("|")+")"},u,{begin:/\(/,end:/\)/,contains:[t.CSS_NUMBER_MODE]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+NF.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:_F.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 jF(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function CF(e){const t=e.regex,r=e.COMMENT("--","$"),a={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},i={begin:/"/,end:/"/,contains:[{match:/""/}]},o=["true","false","unknown"],l=["double precision","large object","with timezone","without timezone"],u=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],d=["add","asc","collation","desc","final","first","last","view"],f=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],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"],y=p,v=[...f,...d].filter(T=>!p.includes(T)),k={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},_={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},w={match:t.concat(/\b/,t.either(...y),/\s*\(/),relevance:0,keywords:{built_in:y}};function N(T){return t.concat(/\b/,t.either(...T.map(C=>C.replace(/\s+/,"\\s+"))),/\b/)}const E={scope:"keyword",match:N(m),relevance:0};function A(T,{exceptions:C,when:j}={}){const M=j;return C=C||[],T.map(L=>L.match(/\|\d+$/)||C.includes(L)?L:M(L)?`${L}|0`:L)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:A(v,{when:T=>T.length<3}),literal:o,type:u,built_in:h},contains:[{scope:"type",match:N(l)},E,w,k,a,i,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,r,_]}}function Z5(e){return e?typeof e=="string"?e:e.source:null}function Rc(e){return Dr("(?=",e,")")}function Dr(...e){return e.map(r=>Z5(r)).join("")}function TF(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function aa(...e){return"("+(TF(e).capture?"":"?:")+e.map(a=>Z5(a)).join("|")+")"}const ik=e=>Dr(/\b/,e,/\w$/.test(e)?/\b/:/\B/),RF=["Protocol","Type"].map(ik),Zw=["init","self"].map(ik),AF=["Any","Self"],Vg=["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"],Jw=["false","nil","true"],IF=["assignment","associativity","higherThan","left","lowerThan","none","right"],MF=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],e2=["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"],J5=aa(/[/=\-+!*%<>&|^~?]/,/[\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]/),eR=aa(J5,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),Gg=Dr(J5,eR,"*"),tR=aa(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),lf=aa(tR,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),Ai=Dr(tR,lf,"*"),Od=Dr(/[A-Z]/,lf,"*"),LF=["attached","autoclosure",Dr(/convention\(/,aa("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",Dr(/objc\(/,Ai,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],OF=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function DF(e){const t={match:/\s+/,relevance:0},r=e.COMMENT("/\\*","\\*/",{contains:["self"]}),a=[e.C_LINE_COMMENT_MODE,r],i={match:[/\./,aa(...RF,...Zw)],className:{2:"keyword"}},o={match:Dr(/\./,aa(...Vg)),relevance:0},l=Vg.filter(He=>typeof He=="string").concat(["_|0"]),u=Vg.filter(He=>typeof He!="string").concat(AF).map(ik),d={variants:[{className:"keyword",match:aa(...u,...Zw)}]},f={$pattern:aa(/\b\w+/,/#\w+/),keyword:l.concat(MF),literal:Jw},p=[i,o,d],h={match:Dr(/\./,aa(...e2)),relevance:0},m={className:"built_in",match:Dr(/\b/,aa(...e2),/(?=\()/)},y=[h,m],v={match:/->/,relevance:0},k={className:"operator",relevance:0,variants:[{match:Gg},{match:`\\.(\\.|${eR})+`}]},_=[v,k],w="([0-9]_*)+",N="([0-9a-fA-F]_*)+",E={className:"number",relevance:0,variants:[{match:`\\b(${w})(\\.(${w}))?([eE][+-]?(${w}))?\\b`},{match:`\\b0x(${N})(\\.(${N}))?([pP][+-]?(${w}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},A=(He="")=>({className:"subst",variants:[{match:Dr(/\\/,He,/[0\\tnr"']/)},{match:Dr(/\\/,He,/u\{[0-9a-fA-F]{1,8}\}/)}]}),T=(He="")=>({className:"subst",match:Dr(/\\/,He,/[\t ]*(?:[\r\n]|\r\n)/)}),C=(He="")=>({className:"subst",label:"interpol",begin:Dr(/\\/,He,/\(/),end:/\)/}),j=(He="")=>({begin:Dr(He,/"""/),end:Dr(/"""/,He),contains:[A(He),T(He),C(He)]}),M=(He="")=>({begin:Dr(He,/"/),end:Dr(/"/,He),contains:[A(He),C(He)]}),L={className:"string",variants:[j(),j("#"),j("##"),j("###"),M(),M("#"),M("##"),M("###")]},I=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],B={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:I},z=He=>{const ze=Dr(He,/\//),gt=Dr(/\//,He);return{begin:ze,end:gt,contains:[...I,{scope:"comment",begin:`#(?!.*${gt})`,end:/$/}]}},ee={scope:"regexp",variants:[z("###"),z("##"),z("#"),B]},V={match:Dr(/`/,Ai,/`/)},D={className:"variable",match:/\$\d+/},K={className:"variable",match:`\\$${lf}+`},H=[V,D,K],J={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:OF,contains:[..._,E,L]}]}},ne={scope:"keyword",match:Dr(/@/,aa(...LF),Rc(aa(/\(/,/\s+/)))},P={scope:"meta",match:Dr(/@/,Ai)},U=[J,ne,P],X={match:Rc(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:Dr(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,lf,"+")},{className:"type",match:Od,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:Dr(/\s+&\s+/,Rc(Od)),relevance:0}]},F={begin:/</,end:/>/,keywords:f,contains:[...a,...p,...U,v,X]};X.contains.push(F);const Z={match:Dr(Ai,/\s*:/),keywords:"_|0",relevance:0},W={begin:/\(/,end:/\)/,relevance:0,keywords:f,contains:["self",Z,...a,ee,...p,...y,..._,E,L,...H,...U,X]},G={begin:/</,end:/>/,keywords:"repeat each",contains:[...a,X]},oe={begin:aa(Rc(Dr(Ai,/\s*:/)),Rc(Dr(Ai,/\s+/,Ai,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:Ai}]},Q={begin:/\(/,end:/\)/,keywords:f,contains:[oe,...a,...p,..._,E,L,...U,X,W],endsParent:!0,illegal:/["']/},fe={match:[/(func|macro)/,/\s+/,aa(V.match,Ai,Gg)],className:{1:"keyword",3:"title.function"},contains:[G,Q,t],illegal:[/\[/,/%/]},ke={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[G,Q,t],illegal:/\[|%/},Fe={match:[/operator/,/\s+/,Gg],className:{1:"keyword",3:"title"}},Ve={begin:[/precedencegroup/,/\s+/,Od],className:{1:"keyword",3:"title"},contains:[X],keywords:[...IF,...Jw],end:/}/},Ge={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},qe={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},Ce={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,Ai,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:f,contains:[G,...p,{begin:/:/,end:/\{/,keywords:f,contains:[{scope:"title.class.inherited",match:Od},...p],relevance:0}]};for(const He of L.variants){const ze=He.contains.find(mt=>mt.label==="interpol");ze.keywords=f;const gt=[...p,...y,..._,E,L,...H];ze.contains=[...gt,{begin:/\(/,end:/\)/,contains:["self",...gt]}]}return{name:"Swift",keywords:f,contains:[...a,fe,ke,Ge,qe,Ce,Fe,Ve,{beginKeywords:"import",end:/$/,contains:[...a],relevance:0},ee,...p,...y,..._,E,L,...H,...U,X,W]}}const cf="[A-Za-z$_][0-9A-Za-z$_]*",rR=["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"],nR=["true","false","null","undefined","NaN","Infinity"],aR=["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"],iR=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],sR=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],oR=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],lR=[].concat(sR,aR,iR);function PF(e){const t=e.regex,r=(J,{after:ne})=>{const P="</"+J[0].slice(1);return J.input.indexOf(P,ne)!==-1},a=cf,i={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,l={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(J,ne)=>{const P=J[0].length+J.index,U=J.input[P];if(U==="<"||U===","){ne.ignoreMatch();return}U===">"&&(r(J,{after:P})||ne.ignoreMatch());let X;const F=J.input.substring(P);if(X=F.match(/^\s*=/)){ne.ignoreMatch();return}if((X=F.match(/^\s+extends\s+/))&&X.index===0){ne.ignoreMatch();return}}},u={$pattern:cf,keyword:rR,literal:nR,built_in:lR,"variable.language":oR},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:[]},y={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,m],subLanguage:"xml"}},v={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,m],subLanguage:"css"}},k={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,m],subLanguage:"graphql"}},_={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,m]},N={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:a+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},E=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,y,v,k,_,{match:/\$\d+/},h];m.contains=E.concat({begin:/\{/,end:/\}/,keywords:u,contains:["self"].concat(E)});const A=[].concat(N,m.contains),T=A.concat([{begin:/(\s*)\(/,end:/\)/,keywords:u,contains:["self"].concat(A)}]),C={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:u,contains:T},j={variants:[{match:[/class/,/\s+/,a,/\s+/,/extends/,/\s+/,t.concat(a,"(",t.concat(/\./,a),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,a],scope:{1:"keyword",3:"title.class"}}]},M={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:{_:[...aR,...iR]}},L={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},I={variants:[{match:[/function/,/\s+/,a,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[C],illegal:/%/},B={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function z(J){return t.concat("(?!",J.join("|"),")")}const ee={match:t.concat(/\b/,z([...sR,"super","import","await"].map(J=>`${J}\\s*\\(`)),a,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},V={begin:t.concat(/\./,t.lookahead(t.concat(a,/(?![0-9A-Za-z$_(])/))),end:a,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},D={match:[/get|set/,/\s+/,a,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},C]},K="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",H={match:[/const|var|let/,/\s+/,a,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(K)],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:M},illegal:/#(?![$_A-Za-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),L,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,y,v,k,_,N,{match:/\$\d+/},h,M,{scope:"attr",match:a+t.lookahead(":"),relevance:0},H,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[N,e.REGEXP_MODE,{className:"function",begin:K,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:u,contains:T}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:o},{begin:l.begin,"on:begin":l.isTrulyOpeningTag,end:l.end}],subLanguage:"xml",contains:[{begin:l.begin,end:l.end,skip:!0,contains:["self"]}]}]},I,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[C,e.inherit(e.TITLE_MODE,{begin:a,className:"title.function"})]},{match:/\.\.\./,relevance:0},V,{match:"\\$"+a,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[C]},ee,B,j,D,{match:/\$[(.]/}]}}function FF(e){const t=e.regex,r=PF(e),a=cf,i=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],o={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},l={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:i},contains:[r.exports.CLASS_REFERENCE]},u={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},d=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],f={$pattern:cf,keyword:rR.concat(d),literal:nR,built_in:lR.concat(i),"variable.language":oR},p={className:"meta",begin:"@"+a},h=(k,_,w)=>{const N=k.contains.findIndex(E=>E.label===_);if(N===-1)throw new Error("can not find mode to replace");k.contains.splice(N,1,w)};Object.assign(r.keywords,f),r.exports.PARAMS_CONTAINS.push(p);const m=r.contains.find(k=>k.scope==="attr"),y=Object.assign({},m,{match:t.concat(a,t.lookahead(/\s*\?:/))});r.exports.PARAMS_CONTAINS.push([r.exports.CLASS_REFERENCE,m,y]),r.contains=r.contains.concat([p,o,l,y]),h(r,"shebang",e.SHEBANG()),h(r,"use_strict",u);const v=r.contains.find(k=>k.label==="func.def");return v.relevance=0,Object.assign(r,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),r}function BF(e){const t=e.regex,r={className:"string",begin:/"(""|[^/n])"C\b/},a={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},i=/\d{1,2}\/\d{1,2}\/\d{4}/,o=/\d{4}-\d{1,2}-\d{1,2}/,l=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,u=/\d{1,2}(:\d{1,2}){1,2}/,d={className:"literal",variants:[{begin:t.concat(/# */,t.either(o,i),/ *#/)},{begin:t.concat(/# */,u,/ *#/)},{begin:t.concat(/# */,l,/ *#/)},{begin:t.concat(/# */,t.either(o,i),/ +/,t.either(l,u),/ *#/)}]},f={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},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:[r,a,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 zF(e){e.regex;const t=e.COMMENT(/\(;/,/;\)/);t.contains.push("self");const r=e.COMMENT(/;;/,/$/),a=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],i={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},o={className:"variable",begin:/\$[\w_]+/},l={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},u={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},d={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},f={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:a},contains:[r,t,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},o,l,i,e.QUOTE_STRING_MODE,d,f,u]}}function UF(e){const t=e.regex,r=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),a=/[\p{L}0-9._:-]+/u,i={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},o={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},l=e.inherit(o,{begin:/\(/,end:/\)/}),u=e.inherit(e.APOS_STRING_MODE,{className:"string"}),d=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),f={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:a,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[i]},{begin:/'/,end:/'/,contains:[i]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[o,d,u,l,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[o,l,d,u]}]}]},e.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},i,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[d]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[f],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[f],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:t.concat(/</,t.lookahead(t.concat(r,t.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:r,relevance:0,starts:f}]},{className:"tag",begin:t.concat(/<\//,t.lookahead(t.concat(r,/>/))),contains:[{className:"name",begin:r,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function qF(e){const t="true false yes no null",r="[\\w#;/?:@&=+$,.~*'()[\\]]+",a={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},i={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},o={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},l={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,i]},u=e.inherit(l,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),m={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},y={end:",",endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},v={begin:/\{/,end:/\}/,contains:[y],illegal:"\\n",relevance:0},k={begin:"\\[",end:"\\]",contains:[y],illegal:"\\n",relevance:0},_=[a,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+r},{className:"type",begin:"!<"+r+">"},{className:"type",begin:"!"+r},{className:"type",begin:"!!"+r},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},m,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},v,k,o,l],w=[..._];return w.pop(),w.push(u),y.contains=w,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:_}}const HF={arduino:_9,bash:w9,c:S9,cpp:N9,csharp:E9,css:O9,diff:D9,go:P9,graphql:F9,ini:B9,java:z9,javascript:W9,json:K9,kotlin:X9,less:aF,lua:iF,makefile:sF,markdown:oF,objectivec:lF,perl:cF,php:uF,"php-template":dF,plaintext:fF,python:pF,"python-repl":gF,r:hF,ruby:mF,rust:xF,scss:EF,shell:jF,sql:CF,swift:DF,typescript:FF,vbnet:BF,wasm:zF,xml:UF,yaml:qF};var Kg,t2;function $F(){if(t2)return Kg;t2=1;function e(ue){return ue instanceof Map?ue.clear=ue.delete=ue.set=function(){throw new Error("map is read-only")}:ue instanceof Set&&(ue.add=ue.clear=ue.delete=function(){throw new Error("set is read-only")}),Object.freeze(ue),Object.getOwnPropertyNames(ue).forEach(Le=>{const ct=ue[Le],Be=typeof ct;(Be==="object"||Be==="function")&&!Object.isFrozen(ct)&&e(ct)}),ue}class t{constructor(Le){Le.data===void 0&&(Le.data={}),this.data=Le.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function r(ue){return ue.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function a(ue,...Le){const ct=Object.create(null);for(const Be in ue)ct[Be]=ue[Be];return Le.forEach(function(Be){for(const nt in Be)ct[nt]=Be[nt]}),ct}const i="</span>",o=ue=>!!ue.scope,l=(ue,{prefix:Le})=>{if(ue.startsWith("language:"))return ue.replace("language:","language-");if(ue.includes(".")){const ct=ue.split(".");return[`${Le}${ct.shift()}`,...ct.map((Be,nt)=>`${Be}${"_".repeat(nt+1)}`)].join(" ")}return`${Le}${ue}`};class u{constructor(Le,ct){this.buffer="",this.classPrefix=ct.classPrefix,Le.walk(this)}addText(Le){this.buffer+=r(Le)}openNode(Le){if(!o(Le))return;const ct=l(Le.scope,{prefix:this.classPrefix});this.span(ct)}closeNode(Le){o(Le)&&(this.buffer+=i)}value(){return this.buffer}span(Le){this.buffer+=`<span class="${Le}">`}}const d=(ue={})=>{const Le={children:[]};return Object.assign(Le,ue),Le};class f{constructor(){this.rootNode=d(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(Le){this.top.children.push(Le)}openNode(Le){const ct=d({scope:Le});this.add(ct),this.stack.push(ct)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(Le){return this.constructor._walk(Le,this.rootNode)}static _walk(Le,ct){return typeof ct=="string"?Le.addText(ct):ct.children&&(Le.openNode(ct),ct.children.forEach(Be=>this._walk(Le,Be)),Le.closeNode(ct)),Le}static _collapse(Le){typeof Le!="string"&&Le.children&&(Le.children.every(ct=>typeof ct=="string")?Le.children=[Le.children.join("")]:Le.children.forEach(ct=>{f._collapse(ct)}))}}class p extends f{constructor(Le){super(),this.options=Le}addText(Le){Le!==""&&this.add(Le)}startScope(Le){this.openNode(Le)}endScope(){this.closeNode()}__addSublanguage(Le,ct){const Be=Le.root;ct&&(Be.scope=`language:${ct}`),this.add(Be)}toHTML(){return new u(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function h(ue){return ue?typeof ue=="string"?ue:ue.source:null}function m(ue){return k("(?=",ue,")")}function y(ue){return k("(?:",ue,")*")}function v(ue){return k("(?:",ue,")?")}function k(...ue){return ue.map(ct=>h(ct)).join("")}function _(ue){const Le=ue[ue.length-1];return typeof Le=="object"&&Le.constructor===Object?(ue.splice(ue.length-1,1),Le):{}}function w(...ue){return"("+(_(ue).capture?"":"?:")+ue.map(Be=>h(Be)).join("|")+")"}function N(ue){return new RegExp(ue.toString()+"|").exec("").length-1}function E(ue,Le){const ct=ue&&ue.exec(Le);return ct&&ct.index===0}const A=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function T(ue,{joinWith:Le}){let ct=0;return ue.map(Be=>{ct+=1;const nt=ct;let kt=h(Be),at="";for(;kt.length>0;){const re=A.exec(kt);if(!re){at+=kt;break}at+=kt.substring(0,re.index),kt=kt.substring(re.index+re[0].length),re[0][0]==="\\"&&re[1]?at+="\\"+String(Number(re[1])+nt):(at+=re[0],re[0]==="("&&ct++)}return at}).map(Be=>`(${Be})`).join(Le)}const C=/\b\B/,j="[a-zA-Z]\\w*",M="[a-zA-Z_]\\w*",L="\\b\\d+(\\.\\d+)?",I="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",B="\\b(0b[01]+)",z="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",ee=(ue={})=>{const Le=/^#![ ]*\//;return ue.binary&&(ue.begin=k(Le,/.*\b/,ue.binary,/\b.*/)),a({scope:"meta",begin:Le,end:/$/,relevance:0,"on:begin":(ct,Be)=>{ct.index!==0&&Be.ignoreMatch()}},ue)},V={begin:"\\\\[\\s\\S]",relevance:0},D={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[V]},K={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[V]},H={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/},J=function(ue,Le,ct={}){const Be=a({scope:"comment",begin:ue,end:Le,contains:[]},ct);Be.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 nt=w("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return Be.contains.push({begin:k(/[ ]+/,"(",nt,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),Be},ne=J("//","$"),P=J("/\\*","\\*/"),U=J("#","$"),X={scope:"number",begin:L,relevance:0},F={scope:"number",begin:I,relevance:0},Z={scope:"number",begin:B,relevance:0},W={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[V,{begin:/\[/,end:/\]/,relevance:0,contains:[V]}]},G={scope:"title",begin:j,relevance:0},oe={scope:"title",begin:M,relevance:0},Q={begin:"\\.\\s*"+M,relevance:0};var ke=Object.freeze({__proto__:null,APOS_STRING_MODE:D,BACKSLASH_ESCAPE:V,BINARY_NUMBER_MODE:Z,BINARY_NUMBER_RE:B,COMMENT:J,C_BLOCK_COMMENT_MODE:P,C_LINE_COMMENT_MODE:ne,C_NUMBER_MODE:F,C_NUMBER_RE:I,END_SAME_AS_BEGIN:function(ue){return Object.assign(ue,{"on:begin":(Le,ct)=>{ct.data._beginMatch=Le[1]},"on:end":(Le,ct)=>{ct.data._beginMatch!==Le[1]&&ct.ignoreMatch()}})},HASH_COMMENT_MODE:U,IDENT_RE:j,MATCH_NOTHING_RE:C,METHOD_GUARD:Q,NUMBER_MODE:X,NUMBER_RE:L,PHRASAL_WORDS_MODE:H,QUOTE_STRING_MODE:K,REGEXP_MODE:W,RE_STARTERS_RE:z,SHEBANG:ee,TITLE_MODE:G,UNDERSCORE_IDENT_RE:M,UNDERSCORE_TITLE_MODE:oe});function Fe(ue,Le){ue.input[ue.index-1]==="."&&Le.ignoreMatch()}function Ve(ue,Le){ue.className!==void 0&&(ue.scope=ue.className,delete ue.className)}function Ge(ue,Le){Le&&ue.beginKeywords&&(ue.begin="\\b("+ue.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",ue.__beforeBegin=Fe,ue.keywords=ue.keywords||ue.beginKeywords,delete ue.beginKeywords,ue.relevance===void 0&&(ue.relevance=0))}function qe(ue,Le){Array.isArray(ue.illegal)&&(ue.illegal=w(...ue.illegal))}function Ce(ue,Le){if(ue.match){if(ue.begin||ue.end)throw new Error("begin & end are not supported with match");ue.begin=ue.match,delete ue.match}}function He(ue,Le){ue.relevance===void 0&&(ue.relevance=1)}const ze=(ue,Le)=>{if(!ue.beforeMatch)return;if(ue.starts)throw new Error("beforeMatch cannot be used with starts");const ct=Object.assign({},ue);Object.keys(ue).forEach(Be=>{delete ue[Be]}),ue.keywords=ct.keywords,ue.begin=k(ct.beforeMatch,m(ct.begin)),ue.starts={relevance:0,contains:[Object.assign(ct,{endsParent:!0})]},ue.relevance=0,delete ct.beforeMatch},gt=["of","and","for","in","not","or","if","then","parent","list","value"],mt="keyword";function wt(ue,Le,ct=mt){const Be=Object.create(null);return typeof ue=="string"?nt(ct,ue.split(" ")):Array.isArray(ue)?nt(ct,ue):Object.keys(ue).forEach(function(kt){Object.assign(Be,wt(ue[kt],Le,kt))}),Be;function nt(kt,at){Le&&(at=at.map(re=>re.toLowerCase())),at.forEach(function(re){const ve=re.split("|");Be[ve[0]]=[kt,$e(ve[0],ve[1])]})}}function $e(ue,Le){return Le?Number(Le):Et(ue)?0:1}function Et(ue){return gt.includes(ue.toLowerCase())}const Ze={},Oe=ue=>{console.error(ue)},it=(ue,...Le)=>{console.log(`WARN: ${ue}`,...Le)},me=(ue,Le)=>{Ze[`${ue}/${Le}`]||(console.log(`Deprecated as of ${ue}. ${Le}`),Ze[`${ue}/${Le}`]=!0)},Ee=new Error;function ge(ue,Le,{key:ct}){let Be=0;const nt=ue[ct],kt={},at={};for(let re=1;re<=Le.length;re++)at[re+Be]=nt[re],kt[re+Be]=!0,Be+=N(Le[re-1]);ue[ct]=at,ue[ct]._emit=kt,ue[ct]._multi=!0}function je(ue){if(Array.isArray(ue.begin)){if(ue.skip||ue.excludeBegin||ue.returnBegin)throw Oe("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Ee;if(typeof ue.beginScope!="object"||ue.beginScope===null)throw Oe("beginScope must be object"),Ee;ge(ue,ue.begin,{key:"beginScope"}),ue.begin=T(ue.begin,{joinWith:""})}}function se(ue){if(Array.isArray(ue.end)){if(ue.skip||ue.excludeEnd||ue.returnEnd)throw Oe("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Ee;if(typeof ue.endScope!="object"||ue.endScope===null)throw Oe("endScope must be object"),Ee;ge(ue,ue.end,{key:"endScope"}),ue.end=T(ue.end,{joinWith:""})}}function De(ue){ue.scope&&typeof ue.scope=="object"&&ue.scope!==null&&(ue.beginScope=ue.scope,delete ue.scope)}function rt(ue){De(ue),typeof ue.beginScope=="string"&&(ue.beginScope={_wrap:ue.beginScope}),typeof ue.endScope=="string"&&(ue.endScope={_wrap:ue.endScope}),je(ue),se(ue)}function dt(ue){function Le(at,re){return new RegExp(h(at),"m"+(ue.case_insensitive?"i":"")+(ue.unicodeRegex?"u":"")+(re?"g":""))}class ct{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(re,ve){ve.position=this.position++,this.matchIndexes[this.matchAt]=ve,this.regexes.push([ve,re]),this.matchAt+=N(re)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const re=this.regexes.map(ve=>ve[1]);this.matcherRe=Le(T(re,{joinWith:"|"}),!0),this.lastIndex=0}exec(re){this.matcherRe.lastIndex=this.lastIndex;const ve=this.matcherRe.exec(re);if(!ve)return null;const Re=ve.findIndex((Rt,ft)=>ft>0&&Rt!==void 0),ie=this.matchIndexes[Re];return ve.splice(0,Re),Object.assign(ve,ie)}}class Be{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(re){if(this.multiRegexes[re])return this.multiRegexes[re];const ve=new ct;return this.rules.slice(re).forEach(([Re,ie])=>ve.addRule(Re,ie)),ve.compile(),this.multiRegexes[re]=ve,ve}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(re,ve){this.rules.push([re,ve]),ve.type==="begin"&&this.count++}exec(re){const ve=this.getMatcher(this.regexIndex);ve.lastIndex=this.lastIndex;let Re=ve.exec(re);if(this.resumingScanAtSamePosition()&&!(Re&&Re.index===this.lastIndex)){const ie=this.getMatcher(0);ie.lastIndex=this.lastIndex+1,Re=ie.exec(re)}return Re&&(this.regexIndex+=Re.position+1,this.regexIndex===this.count&&this.considerAll()),Re}}function nt(at){const re=new Be;return at.contains.forEach(ve=>re.addRule(ve.begin,{rule:ve,type:"begin"})),at.terminatorEnd&&re.addRule(at.terminatorEnd,{type:"end"}),at.illegal&&re.addRule(at.illegal,{type:"illegal"}),re}function kt(at,re){const ve=at;if(at.isCompiled)return ve;[Ve,Ce,rt,ze].forEach(ie=>ie(at,re)),ue.compilerExtensions.forEach(ie=>ie(at,re)),at.__beforeBegin=null,[Ge,qe,He].forEach(ie=>ie(at,re)),at.isCompiled=!0;let Re=null;return typeof at.keywords=="object"&&at.keywords.$pattern&&(at.keywords=Object.assign({},at.keywords),Re=at.keywords.$pattern,delete at.keywords.$pattern),Re=Re||/\w+/,at.keywords&&(at.keywords=wt(at.keywords,ue.case_insensitive)),ve.keywordPatternRe=Le(Re,!0),re&&(at.begin||(at.begin=/\B|\b/),ve.beginRe=Le(ve.begin),!at.end&&!at.endsWithParent&&(at.end=/\B|\b/),at.end&&(ve.endRe=Le(ve.end)),ve.terminatorEnd=h(ve.end)||"",at.endsWithParent&&re.terminatorEnd&&(ve.terminatorEnd+=(at.end?"|":"")+re.terminatorEnd)),at.illegal&&(ve.illegalRe=Le(at.illegal)),at.contains||(at.contains=[]),at.contains=[].concat(...at.contains.map(function(ie){return Lt(ie==="self"?at:ie)})),at.contains.forEach(function(ie){kt(ie,ve)}),at.starts&&kt(at.starts,re),ve.matcher=nt(ve),ve}if(ue.compilerExtensions||(ue.compilerExtensions=[]),ue.contains&&ue.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return ue.classNameAliases=a(ue.classNameAliases||{}),kt(ue)}function lt(ue){return ue?ue.endsWithParent||lt(ue.starts):!1}function Lt(ue){return ue.variants&&!ue.cachedVariants&&(ue.cachedVariants=ue.variants.map(function(Le){return a(ue,{variants:null},Le)})),ue.cachedVariants?ue.cachedVariants:lt(ue)?a(ue,{starts:ue.starts?a(ue.starts):null}):Object.isFrozen(ue)?a(ue):ue}var ot="11.11.2";class et extends Error{constructor(Le,ct){super(Le),this.name="HTMLInjectionError",this.html=ct}}const Ot=r,gr=a,dr=Symbol("nomatch"),or=7,Qt=function(ue){const Le=Object.create(null),ct=Object.create(null),Be=[];let nt=!0;const kt="Could not find the language '{}', did you forget to load/include a language module?",at={disableAutodetect:!0,name:"Plain text",contains:[]};let re={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:p};function ve(Je){return re.noHighlightRe.test(Je)}function Re(Je){let _t=Je.className+" ";_t+=Je.parentNode?Je.parentNode.className:"";const qt=re.languageDetectRe.exec(_t);if(qt){const Gt=un(qt[1]);return Gt||(it(kt.replace("{}",qt[1])),it("Falling back to no-highlight mode for this block.",Je)),Gt?qt[1]:"no-highlight"}return _t.split(/\s+/).find(Gt=>ve(Gt)||un(Gt))}function ie(Je,_t,qt){let Gt="",Or="";typeof _t=="object"?(Gt=Je,qt=_t.ignoreIllegals,Or=_t.language):(me("10.7.0","highlight(lang, code, ...args) has been deprecated."),me("10.7.0",`Please use highlight(code, options) instead.
81
+ https://github.com/highlightjs/highlight.js/issues/2277`),Or=Je,Gt=_t),qt===void 0&&(qt=!0);const vr={code:Gt,language:Or};ca("before:highlight",vr);const Pn=vr.result?vr.result:Rt(vr.language,vr.code,qt);return Pn.code=vr.code,ca("after:highlight",Pn),Pn}function Rt(Je,_t,qt,Gt){const Or=Object.create(null);function vr($,ce){return $.keywords[ce]}function Pn(){if(!Kt.keywords){zr.addText(kr);return}let $=0;Kt.keywordPatternRe.lastIndex=0;let ce=Kt.keywordPatternRe.exec(kr),Se="";for(;ce;){Se+=kr.substring($,ce.index);const We=Bn.case_insensitive?ce[0].toLowerCase():ce[0],ht=vr(Kt,We);if(ht){const[St,Sr]=ht;if(zr.addText(Se),Se="",Or[We]=(Or[We]||0)+1,Or[We]<=or&&(zn+=Sr),St.startsWith("_"))Se+=ce[0];else{const Nr=Bn.classNameAliases[St]||St;Wr(ce[0],Nr)}}else Se+=ce[0];$=Kt.keywordPatternRe.lastIndex,ce=Kt.keywordPatternRe.exec(kr)}Se+=kr.substring($),zr.addText(Se)}function Ua(){if(kr==="")return;let $=null;if(typeof Kt.subLanguage=="string"){if(!Le[Kt.subLanguage]){zr.addText(kr);return}$=Rt(Kt.subLanguage,kr,!0,da[Kt.subLanguage]),da[Kt.subLanguage]=$._top}else $=Ut(kr,Kt.subLanguage.length?Kt.subLanguage:null);Kt.relevance>0&&(zn+=$.relevance),zr.__addSublanguage($._emitter,$.language)}function fn(){Kt.subLanguage!=null?Ua():Pn(),kr=""}function Wr($,ce){$!==""&&(zr.startScope(ce),zr.addText($),zr.endScope())}function Zr($,ce){let Se=1;const We=ce.length-1;for(;Se<=We;){if(!$._emit[Se]){Se++;continue}const ht=Bn.classNameAliases[$[Se]]||$[Se],St=ce[Se];ht?Wr(St,ht):(kr=St,Pn(),kr=""),Se++}}function Tr($,ce){return $.scope&&typeof $.scope=="string"&&zr.openNode(Bn.classNameAliases[$.scope]||$.scope),$.beginScope&&($.beginScope._wrap?(Wr(kr,Bn.classNameAliases[$.beginScope._wrap]||$.beginScope._wrap),kr=""):$.beginScope._multi&&(Zr($.beginScope,ce),kr="")),Kt=Object.create($,{parent:{value:Kt}}),Kt}function Fn($,ce,Se){let We=E($.endRe,Se);if(We){if($["on:end"]){const ht=new t($);$["on:end"](ce,ht),ht.isMatchIgnored&&(We=!1)}if(We){for(;$.endsParent&&$.parent;)$=$.parent;return $}}if($.endsWithParent)return Fn($.parent,ce,Se)}function ai($){return Kt.matcher.regexIndex===0?(kr+=$[0],1):(Ye=!0,0)}function nn($){const ce=$[0],Se=$.rule,We=new t(Se),ht=[Se.__beforeBegin,Se["on:begin"]];for(const St of ht)if(St&&(St($,We),We.isMatchIgnored))return ai(ce);return Se.skip?kr+=ce:(Se.excludeBegin&&(kr+=ce),fn(),!Se.returnBegin&&!Se.excludeBegin&&(kr=ce)),Tr(Se,$),Se.returnBegin?0:ce.length}function ua($){const ce=$[0],Se=_t.substring($.index),We=Fn(Kt,$,Se);if(!We)return dr;const ht=Kt;Kt.endScope&&Kt.endScope._wrap?(fn(),Wr(ce,Kt.endScope._wrap)):Kt.endScope&&Kt.endScope._multi?(fn(),Zr(Kt.endScope,$)):ht.skip?kr+=ce:(ht.returnEnd||ht.excludeEnd||(kr+=ce),fn(),ht.excludeEnd&&(kr=ce));do Kt.scope&&zr.closeNode(),!Kt.skip&&!Kt.subLanguage&&(zn+=Kt.relevance),Kt=Kt.parent;while(Kt!==We.parent);return We.starts&&Tr(We.starts,$),ht.returnEnd?0:ce.length}function Cn(){const $=[];for(let ce=Kt;ce!==Bn;ce=ce.parent)ce.scope&&$.unshift(ce.scope);$.forEach(ce=>zr.openNode(ce))}let qa={};function Jn($,ce){const Se=ce&&ce[0];if(kr+=$,Se==null)return fn(),0;if(qa.type==="begin"&&ce.type==="end"&&qa.index===ce.index&&Se===""){if(kr+=_t.slice(ce.index,ce.index+1),!nt){const We=new Error(`0 width match regex (${Je})`);throw We.languageName=Je,We.badRule=qa.rule,We}return 1}if(qa=ce,ce.type==="begin")return nn(ce);if(ce.type==="illegal"&&!qt){const We=new Error('Illegal lexeme "'+Se+'" for mode "'+(Kt.scope||"<unnamed>")+'"');throw We.mode=Kt,We}else if(ce.type==="end"){const We=ua(ce);if(We!==dr)return We}if(ce.type==="illegal"&&Se==="")return ce.index===_t.length||(kr+=`
82
+ `),1;if(bt>1e5&&bt>ce.index*3)throw new Error("potential infinite loop, way more iterations than matches");return kr+=Se,Se.length}const Bn=un(Je);if(!Bn)throw Oe(kt.replace("{}",Je)),new Error('Unknown language: "'+Je+'"');const Sa=dt(Bn);let fr="",Kt=Gt||Sa;const da={},zr=new re.__emitter(re);Cn();let kr="",zn=0,Tn=0,bt=0,Ye=!1;try{if(Bn.__emitTokens)Bn.__emitTokens(_t,zr);else{for(Kt.matcher.considerAll();;){bt++,Ye?Ye=!1:Kt.matcher.considerAll(),Kt.matcher.lastIndex=Tn;const $=Kt.matcher.exec(_t);if(!$)break;const ce=_t.substring(Tn,$.index),Se=Jn(ce,$);Tn=$.index+Se}Jn(_t.substring(Tn))}return zr.finalize(),fr=zr.toHTML(),{language:Je,value:fr,relevance:zn,illegal:!1,_emitter:zr,_top:Kt}}catch($){if($.message&&$.message.includes("Illegal"))return{language:Je,value:Ot(_t),illegal:!0,relevance:0,_illegalBy:{message:$.message,index:Tn,context:_t.slice(Tn-100,Tn+100),mode:$.mode,resultSoFar:fr},_emitter:zr};if(nt)return{language:Je,value:Ot(_t),illegal:!1,relevance:0,errorRaised:$,_emitter:zr,_top:Kt};throw $}}function ft(Je){const _t={value:Ot(Je),illegal:!1,relevance:0,_top:at,_emitter:new re.__emitter(re)};return _t._emitter.addText(Je),_t}function Ut(Je,_t){_t=_t||re.languages||Object.keys(Le);const qt=ft(Je),Gt=_t.filter(un).filter(la).map(fn=>Rt(fn,Je,!1));Gt.unshift(qt);const Or=Gt.sort((fn,Wr)=>{if(fn.relevance!==Wr.relevance)return Wr.relevance-fn.relevance;if(fn.language&&Wr.language){if(un(fn.language).supersetOf===Wr.language)return 1;if(un(Wr.language).supersetOf===fn.language)return-1}return 0}),[vr,Pn]=Or,Ua=vr;return Ua.secondBest=Pn,Ua}function Me(Je,_t,qt){const Gt=_t&&ct[_t]||qt;Je.classList.add("hljs"),Je.classList.add(`language-${Gt}`)}function Tt(Je){let _t=null;const qt=Re(Je);if(ve(qt))return;if(ca("before:highlightElement",{el:Je,language:qt}),Je.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",Je);return}if(Je.children.length>0&&(re.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(Je)),re.throwUnescapedHTML))throw new et("One of your code blocks includes unescaped HTML.",Je.innerHTML);_t=Je;const Gt=_t.textContent,Or=qt?ie(Gt,{language:qt,ignoreIllegals:!0}):Ut(Gt);Je.innerHTML=Or.value,Je.dataset.highlighted="yes",Me(Je,qt,Or.language),Je.result={language:Or.language,re:Or.relevance,relevance:Or.relevance},Or.secondBest&&(Je.secondBest={language:Or.secondBest.language,relevance:Or.secondBest.relevance}),ca("after:highlightElement",{el:Je,result:Or,text:Gt})}function tr(Je){re=gr(re,Je)}const rn=()=>{yr(),me("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function hn(){yr(),me("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let mn=!1;function yr(){function Je(){yr()}if(document.readyState==="loading"){mn||window.addEventListener("DOMContentLoaded",Je,!1),mn=!0;return}document.querySelectorAll(re.cssSelector).forEach(Tt)}function oa(Je,_t){let qt=null;try{qt=_t(ue)}catch(Gt){if(Oe("Language definition for '{}' could not be registered.".replace("{}",Je)),nt)Oe(Gt);else throw Gt;qt=at}qt.name||(qt.name=Je),Le[Je]=qt,qt.rawDefinition=_t.bind(null,ue),qt.aliases&&wa(qt.aliases,{languageName:Je})}function ri(Je){delete Le[Je];for(const _t of Object.keys(ct))ct[_t]===Je&&delete ct[_t]}function _a(){return Object.keys(Le)}function un(Je){return Je=(Je||"").toLowerCase(),Le[Je]||Le[ct[Je]]}function wa(Je,{languageName:_t}){typeof Je=="string"&&(Je=[Je]),Je.forEach(qt=>{ct[qt.toLowerCase()]=_t})}function la(Je){const _t=un(Je);return _t&&!_t.disableAutodetect}function Lr(Je){Je["before:highlightBlock"]&&!Je["before:highlightElement"]&&(Je["before:highlightElement"]=_t=>{Je["before:highlightBlock"](Object.assign({block:_t.el},_t))}),Je["after:highlightBlock"]&&!Je["after:highlightElement"]&&(Je["after:highlightElement"]=_t=>{Je["after:highlightBlock"](Object.assign({block:_t.el},_t))})}function ki(Je){Lr(Je),Be.push(Je)}function ni(Je){const _t=Be.indexOf(Je);_t!==-1&&Be.splice(_t,1)}function ca(Je,_t){const qt=Je;Be.forEach(function(Gt){Gt[qt]&&Gt[qt](_t)})}function jn(Je){return me("10.7.0","highlightBlock will be removed entirely in v12.0"),me("10.7.0","Please use highlightElement now."),Tt(Je)}Object.assign(ue,{highlight:ie,highlightAuto:Ut,highlightAll:yr,highlightElement:Tt,highlightBlock:jn,configure:tr,initHighlighting:rn,initHighlightingOnLoad:hn,registerLanguage:oa,unregisterLanguage:ri,listLanguages:_a,getLanguage:un,registerAliases:wa,autoDetection:la,inherit:gr,addPlugin:ki,removePlugin:ni}),ue.debugMode=function(){nt=!1},ue.safeMode=function(){nt=!0},ue.versionString=ot,ue.regex={concat:k,lookahead:m,either:w,optional:v,anyNumberOfTimes:y};for(const Je in ke)typeof ke[Je]=="object"&&e(ke[Je]);return Object.assign(ue,ke),ue},$r=Qt({});return $r.newInstance=()=>Qt({}),Kg=$r,$r.HighlightJS=$r,$r.default=$r,Kg}var WF=$F();const VF=jo(WF),r2={},GF="hljs-";function KF(e){const t=VF.newInstance();return e&&o(e),{highlight:r,highlightAuto:a,listLanguages:i,register:o,registerAlias:l,registered:u};function r(d,f,p){const h=p||r2,m=typeof h.prefix=="string"?h.prefix:GF;if(!t.getLanguage(d))throw new Error("Unknown language: `"+d+"` is not registered");t.configure({__emitter:YF,classPrefix:m});const y=t.highlight(f,{ignoreIllegals:!0,language:d});if(y.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:y.errorRaised});const v=y._emitter.root,k=v.data;return k.language=y.language,k.relevance=y.relevance,v}function a(d,f){const h=(f||r2).subset||i();let m=-1,y=0,v;for(;++m<h.length;){const k=h[m];if(!t.getLanguage(k))continue;const _=r(k,d,f);_.data&&_.data.relevance!==void 0&&_.data.relevance>y&&(y=_.data.relevance,v=_)}return v||{type:"root",children:[],data:{language:void 0,relevance:y}}}function i(){return t.listLanguages()}function o(d,f){if(typeof d=="string")t.registerLanguage(d,f);else{let 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 YF{constructor(t){this.options=t,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(t){if(t==="")return;const r=this.stack[this.stack.length-1],a=r.children[r.children.length-1];a&&a.type==="text"?a.value+=t:r.children.push({type:"text",value:t})}startScope(t){this.openNode(String(t))}endScope(){this.closeNode()}__addSublanguage(t,r){const a=this.stack[this.stack.length-1],i=t.root.children;r?a.children.push({type:"element",tagName:"span",properties:{className:[r]},children:i}):a.children.push(...i)}openNode(t){const r=this,a=t.split(".").map(function(l,u){return u?l+"_".repeat(u):r.options.classPrefix+l}),i=this.stack[this.stack.length-1],o={type:"element",tagName:"span",properties:{className:a},children:[]};i.children.push(o),this.stack.push(o)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const XF={};function Yg(e){const t=e||XF,r=t.aliases,a=t.detect||!1,i=t.languages||HF,o=t.plainText,l=t.prefix,u=t.subset;let d="hljs";const f=KF(i);if(r&&f.registerAlias(r),l){const p=l.indexOf("-");d=p===-1?l:l.slice(0,p)}return function(p,h){Ef(p,"element",function(m,y,v){if(m.tagName!=="code"||!v||v.type!=="element"||v.tagName!=="pre")return;const k=QF(m);if(k===!1||!k&&!a||k&&o&&o.includes(k))return;Array.isArray(m.properties.className)||(m.properties.className=[]),m.properties.className.includes(d)||m.properties.className.unshift(d);const _=g9(m,{whitespace:"pre"});let w;try{w=k?f.highlight(k,_,{prefix:l}):f.highlightAuto(_,{prefix:l,subset:u})}catch(N){const E=N;if(k&&/Unknown language/.test(E.message)){h.message("Cannot highlight as `"+k+"`, it’s not registered",{ancestors:[v,m],cause:E,place:m.position,ruleId:"missing-language",source:"rehype-highlight"});return}throw E}!k&&w.data&&w.data.language&&m.properties.className.push("language-"+w.data.language),w.children.length>0&&(m.children=w.children)})}}function QF(e){const t=e.properties.className;let r=-1;if(!Array.isArray(t))return;let a;for(;++r<t.length;){const i=String(t[r]);if(i==="no-highlight"||i==="nohighlight")return!1;!a&&i.slice(0,5)==="lang-"&&(a=i.slice(5)),!a&&i.slice(0,9)==="language-"&&(a=i.slice(9))}return a}function Qd(){function e(t){const r=new Set(["strong","emphasis","delete"]);function a(i){if(i.children)for(let o=0;o<i.children.length;o++){const l=i.children[o];if(r.has(l.type)){if(o>0){const f=i.children[o-1];f.type==="text"?f.value&&/[a-zA-Z0-9]$/.test(f.value)&&!f.value.endsWith(" ")&&!f.value.endsWith(`
83
+ `)&&(f.value+=" "):(i.children.splice(o,0,{type:"text",value:" "}),o++)}const u=o+1,d=u<i.children.length?i.children[u]:null;d&&(d.type==="text"?d.value&&/^[a-zA-Z0-9]/.test(d.value)&&!d.value.startsWith(" ")&&!d.value.startsWith(`
84
+ `)&&(d.value=" "+d.value):r.has(d.type)&&i.children.splice(u,0,{type:"text",value:" "}))}a(l)}}return a(t),t}return e}function Zd({children:e,language:t,className:r,frameless:a,...i}){const[o,l]=x.useState(!1),u=String(e).replace(/\n$/,""),d=r||(t?"language-"+t:""),f=async()=>{try{await navigator.clipboard.writeText(u),l(!0),setTimeout(()=>l(!1),2e3)}catch{const 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 a?n.jsxs("div",{className:"relative group rounded-lg overflow-hidden bg-gray-100 dark:bg-gray-800/50 my-3",children:[n.jsx("button",{onClick:f,className:"absolute top-2 right-2 z-10 p-1.5 rounded-md bg-gray-200/80 dark:bg-gray-700/80 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 hover:bg-gray-300 dark:hover:bg-gray-600 transition-colors backdrop-blur-sm",title:"Copy","aria-label":"Copy code",children:o?n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}):n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}),n.jsx("pre",{className:"p-4 overflow-x-auto text-sm",...i,children:n.jsx("code",{className:d||void 0,children:e})})]}):n.jsxs("div",{className:"relative group rounded-lg overflow-hidden bg-gray-900 dark:bg-gray-950 my-3 px-1.5 py-0.5",children:[n.jsxs("div",{className:"flex items-center justify-between px-4 py-1.5 bg-gray-800 dark:bg-gray-900 text-xs text-gray-400",children:[n.jsx("span",{children:t||"code"}),n.jsx("button",{onClick:f,className:"flex items-center gap-1 hover:text-gray-200 transition-colors",children:o?n.jsxs(n.Fragment,{children:[n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),"Copied"]}):n.jsxs(n.Fragment,{children:[n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})}),"Copy"]})})]}),n.jsx("pre",{className:"p-4 overflow-x-auto text-sm",...i,children:n.jsx("code",{className:d||void 0,children:e})})]})}function jf(e,t){if(!t)return"";try{const r=typeof t=="string"?JSON.parse(t):t;if(r.command)return r.command;if(r.filePath&&e==="read")return`read ${r.filePath}`;if(r.pattern&&e==="grep"){const a=r.path||r.include||".";return`grep "${r.pattern}" ${a}`}if(r.pattern&&e==="glob")return`glob "${r.pattern}"`;if(r.filePath&&e==="edit")return`edit ${r.filePath}`;if(r.filePath&&e==="write")return`write ${r.filePath}`;if(r._purpose&&e==="task")return`task "${r._purpose}"`;if(r.url&&(e==="webfetch"||e==="fetch"))return`fetch ${r.url}`;if(r.action&&e==="todo"){let a=`todo ${r.action}`;return r.text&&(a+=` "${r.text}"`),r.id&&(a+=` #${r.id}`),a}if(r.action&&e==="permission"){let a=`permission ${r.action}`;return r.type&&(a+=` ${r.type}`),r.target&&(a+=` ${r.target}`),a}{const a=[];for(const[i,o]of Object.entries(r))if(!(o==null||o===""))if(typeof o=="boolean")o&&a.push(`--${i}`);else if(Array.isArray(o)){const u=o.some(f=>typeof f=="object"&&f!==null)?JSON.stringify(o):o.map(f=>String(f)).join(", "),d=u.length>60?u.slice(0,60)+"...":u;a.push(`--${i} "${d}"`)}else{const l=typeof o=="object"&&o!==null?JSON.stringify(o):String(o),u=l.length>60?l.slice(0,60)+"...":l;a.push(`--${i} "${u}"`)}return a.length>0?`${e} ${a.join(" ")}`:e||""}}catch{return""}}function So(e){return typeof e!="string"?e:e.replace(/\x1b\[[0-9;]*[@-~]|\x1b\].*?(?:\x07|\x1b\\)|\x1b[()][AB012]|\x1b[=>]/g,"")}function ZF(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 JF({part:e}){const{t}=Jt(),{tool:r,state:a}=e,[i,o]=x.useState(!1);if(!a)return null;const l=a.status||"running",u=a.title||r||t("tool.tool"),d=jf(r||u,a.input),f=a.input&&a.input._purpose?a.input._purpose:null,p=l==="completed"?ZF(a.output):null,h=!f||i,m={running:"border-yellow-400 bg-yellow-50 dark:bg-yellow-900/20",completed:"border-green-400 bg-green-50 dark:bg-green-900/20",error:"border-red-400 bg-red-50 dark:bg-red-900/20",pending_confirmation:"border-blue-400 bg-blue-50 dark:bg-blue-900/20"},y={running:n.jsxs("svg",{className:"w-4 h-4 text-yellow-500 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[n.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),n.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),completed:n.jsx("svg",{className:"w-4 h-4 text-green-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),error:n.jsx("svg",{className:"w-4 h-4 text-red-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),pending_confirmation:n.jsx("svg",{className:"w-4 h-4 text-blue-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})};return n.jsxs("div",{className:`rounded-lg border-l-4 p-2 xs:p-3 text-xs sm:text-sm ${m[l]||m.running}`,children:[n.jsxs("div",{className:`flex items-center gap-2 ${f?"cursor-pointer select-none":""}`,onClick:f?()=>o(!i):void 0,children:[y[l]||y.running,f?n.jsx("span",{className:"font-medium text-gray-800 dark:text-gray-200 flex-1",children:f}):n.jsx("span",{className:"font-medium text-gray-800 dark:text-gray-200",children:u}),f&&n.jsx("svg",{className:`w-4 h-4 text-gray-400 flex-shrink-0 transition-transform ${i?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),h&&d&&!p&&n.jsxs("div",{className:"mt-2 font-mono text-xs bg-gray-900 dark:bg-gray-950 text-gray-100 rounded px-2 py-1.5 overflow-x-auto",children:[n.jsx("span",{className:"text-green-400 select-none",children:"$ "}),n.jsx("span",{className:"text-gray-100",children:d})]}),p?n.jsxs("div",{className:"mt-2 text-xs text-blue-700 dark:text-blue-300 flex items-center gap-1.5",children:[n.jsxs("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 5a1 1 0 011-1h14a1 1 0 011 1v14a1 1 0 01-1 1H5a1 1 0 01-1-1V5z"}),n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12l3 3 5-6"})]}),n.jsxs("span",{children:[p.type==="mermaid"?"Mermaid diagram":p.type==="svg"?"SVG illustration":"Math",p.title?n.jsxs(n.Fragment,{children:[": ",n.jsx("span",{className:"font-medium",children:p.title})]}):null," rendered → see ",n.jsx("span",{className:"font-medium",children:"canvas"})," pane"]})]}):a.output&&l==="completed"&&h&&n.jsx("pre",{className:"mt-2 text-xs text-gray-600 dark:text-gray-400 overflow-x-auto max-h-32 overflow-y-auto whitespace-pre-wrap break-all max-w-full",children:So((typeof a.output=="string"?a.output:JSON.stringify(a.output,null,2)).slice(0,600)).slice(0,500)}),a.error&&h&&n.jsx("pre",{className:"mt-2 text-xs text-red-600 dark:text-red-400 whitespace-pre-wrap break-all overflow-x-auto max-w-full",children:So(typeof a.error=="string"?a.error:a.error.message||"Error")})]})}function eB({part:e}){const{tool:t,state:r}=e,[a,i]=x.useState(!1);if(!r)return null;const o=r.status||"running",l=r.title||t||"Tool",u=jf(t||l,r.input),d=r.input&&r.input._purpose?r.input._purpose:null,f=!d||a;return n.jsxs("div",{className:"py-1",children:[n.jsxs("div",{className:`flex items-center gap-2 text-xs text-gray-500 dark:text-gray-400 ${d?"cursor-pointer select-none":""}`,onClick:d?()=>i(!a):void 0,children:[o==="running"&&n.jsxs("svg",{className:"w-3 h-3 text-gray-400 animate-spin flex-shrink-0",fill:"none",viewBox:"0 0 24 24",children:[n.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),n.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),o==="completed"&&n.jsx("svg",{className:"w-3 h-3 text-green-500 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),o==="error"&&n.jsx("svg",{className:"w-3 h-3 text-red-500 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),o==="pending_confirmation"&&n.jsx("svg",{className:"w-3 h-3 text-blue-500 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),d?n.jsx("span",{className:"font-medium truncate flex-1",children:d}):n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"font-medium truncate",children:l}),u&&n.jsx("span",{className:"font-mono text-[11px] text-gray-400 dark:text-gray-500 truncate",children:u})]}),d&&n.jsx("svg",{className:`w-3 h-3 text-gray-400 flex-shrink-0 transition-transform ${a?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),f&&u&&n.jsx("div",{className:"mt-1 font-mono text-[11px] text-gray-400 dark:text-gray-500 truncate",children:u}),r.output&&o==="completed"&&f&&n.jsx("div",{className:"mt-1 font-mono text-[11px] text-gray-500 dark:text-gray-400 break-all whitespace-pre-wrap truncate",children:So(typeof r.output=="string"?r.output:JSON.stringify(r.output,null,2)).slice(0,500)}),r.error&&f&&n.jsx("div",{className:"mt-1 text-[11px] text-red-500 dark:text-red-400 truncate",children:So(typeof r.error=="string"?r.error:r.error.message||"Error").slice(0,120)}),r.error&&!f&&n.jsx("div",{className:"mt-1 text-[11px] text-red-500 dark:text-red-400 truncate",children:So(typeof r.error=="string"?r.error:r.error.message||"Error").slice(0,120)})]})}function tB({text:e,isStreaming:t}){const{t:r}=Jt(),[a,i]=x.useState(!1),o=e&&e.trim().length>0,l=t&&!a?(e||"").slice(-400).replace(/\s+/g," ").trim():"";return n.jsxs("div",{className:"py-1",children:[n.jsxs("div",{className:`flex items-center gap-2 text-xs text-gray-500 dark:text-gray-400 ${o?"cursor-pointer select-none":""}`,onClick:o?()=>i(!a):void 0,children:[t?n.jsxs("svg",{className:"w-3 h-3 text-gray-400 dark:text-gray-500 animate-spin flex-shrink-0",fill:"none",viewBox:"0 0 24 24",children:[n.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),n.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):n.jsx("svg",{className:"w-3 h-3 text-green-500 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),n.jsx("span",{className:`font-medium flex-shrink-0 ${l?"":"flex-1"}`,children:r("chat.thinking")}),l&&n.jsx("span",{className:"flex-1 min-w-0 font-medium italic opacity-80 whitespace-nowrap overflow-hidden flex justify-end",style:{maskImage:"linear-gradient(to right, transparent, black 24px)",WebkitMaskImage:"linear-gradient(to right, transparent, black 24px)"},children:l}),o&&n.jsx("svg",{className:`w-3 h-3 text-gray-400 flex-shrink-0 transition-transform ${a?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),a&&o&&n.jsx("div",{className:"mt-1 prose prose-sm dark:prose-invert max-w-none break-words text-gray-600 dark:text-gray-300 italic opacity-80",children:n.jsx(Cl,{remarkPlugins:[Tl,Qd],children:e})})]})}function rB(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 Xg=2500,n2=5;function nB(e){return typeof e=="string"?e:e&&typeof e=="object"&&(e.text||e.label)||String(e)}function aB({part:e,questionId:t}){const{t:r}=Jt(),{state:a}=e,i=a&&a.status||"running",o=a&&a.input||{},l=Array.isArray(o.questions)&&o.questions.length>0?o.questions:[{text:"(no question)",options:void 0}],u=i==="completed",d=i==="error",f=(a&&a.error||"").replace(/^Error:\s*/,""),p=a&&a.output||"",[h,m]=x.useState({}),[y,v]=x.useState({}),[k,_]=x.useState(null),[w,N]=x.useState(null),[E,A]=x.useState(t),T=x.useRef(!0),C=x.useRef(null),j=x.useRef(0),M=x.useRef(0),L=x.useRef(null);x.useEffect(()=>{t&&A(t)},[t]);const I=e.callID||e.id||null;x.useEffect(()=>{if(!a||u||d||E||!I)return;L.current!==I&&(L.current=I,j.current=0,M.current=0);let J=!1,ne=null;const P=()=>{J||!T.current||j.current>=n2||(ne=setTimeout(U,Xg))},U=()=>{J||!T.current||(j.current+=1,M.current=Date.now(),_3().then(X=>{if(J||!T.current)return;const F=Array.isArray(X&&X.pending)?X.pending:[];for(var Z=0;Z<F.length;Z++){var W=F[Z],G=W.tool&&W.tool.callID?W.tool.callID:null;if(G===I&&W.id){A(W.id);return}}P()}).catch(()=>{P()}))};if(j.current<n2){const X=Date.now()-M.current;j.current===0||X>=Xg?U():ne=setTimeout(U,Xg-X)}return()=>{J=!0,ne&&clearTimeout(ne)}},[a,u,d,E,I]),x.useEffect(()=>()=>{T.current=!1},[]),x.useEffect(()=>{!u&&C.current&&(C.current.focus(),C.current.scrollIntoView({behavior:"smooth",block:"center"}))},[u]);const B=J=>{var ne,P;return(((ne=h[J])==null?void 0:ne.length)??0)>0||(((P=y[J])==null?void 0:P.trim().length)??0)>0},z=l.every((J,ne)=>B(ne)),ee=(J,ne,P)=>{m(U=>{const X=U[J]??[];return P?{...U,[J]:X.includes(ne)?X.filter(F=>F!==ne):[...X,ne]}:{...U,[J]:X.includes(ne)?[]:[ne]}})},V=x.useCallback(async()=>{if(!z||!E)return;const J=l.map((ne,P)=>{var F;const U=h[P]??[],X=(F=y[P])==null?void 0:F.trim();return X?[...U,X]:U});_("reply"),N(null);try{const ne=await w3(E,J);if(!T.current)return;ne&&ne.success===!1&&(N(ne.error||"Failed to reply"),_(null))}catch(ne){if(!T.current)return;N(ne.message||"Failed to reply"),_(null)}},[E,l,h,y,z]),D=x.useCallback(async()=>{if(E){_("reject"),N(null);try{const J=await S3(E);if(!T.current)return;J&&J.success===!1&&(N(J.error||"Failed to dismiss"),_(null))}catch(J){if(!T.current)return;N(J.message||"Failed to dismiss"),_(null)}}},[E]);if(!a)return null;const K=J=>{J.key==="Enter"&&!J.shiftKey&&(J.preventDefault(),V())};if(u)return n.jsxs("div",{className:"my-2 rounded-lg border-l-4 border-primary-500 bg-primary-50/50 dark:bg-primary-900/10 p-3",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx("svg",{className:"w-4 h-4 text-primary-600 dark:text-primary-400 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),n.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-primary-600 dark:text-primary-400",children:r("question.title")}),n.jsx("svg",{className:"w-3.5 h-3.5 text-green-500 flex-shrink-0 ml-auto",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})]}),l.map((J,ne)=>n.jsxs("div",{className:ne>0?"pt-2 mt-2 border-t border-gray-200 dark:border-gray-700":"",children:[n.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-1 whitespace-pre-wrap",children:J.text}),p&&n.jsx("p",{className:"text-sm font-medium text-primary-700 dark:text-primary-300",children:iB(p,ne,l.length)})]},ne))]});if(d)return n.jsxs("div",{className:"my-2 rounded-lg border-l-4 border-red-400 bg-red-50/30 dark:bg-red-900/10 p-3",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx("svg",{className:"w-4 h-4 text-red-500 dark:text-red-400 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),n.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-red-600 dark:text-red-400",children:r("question.title")}),n.jsx("svg",{className:"w-3.5 h-3.5 text-red-500 flex-shrink-0 ml-auto",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})]}),n.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-red-500 dark:text-red-400 mb-1",children:r("question.error")}),f&&n.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 whitespace-pre-wrap",children:f})]});let H=!1;return n.jsxs("div",{className:"my-2 rounded-lg border-l-4 border-primary-500 bg-primary-50/30 dark:bg-primary-900/10 p-3",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsx("svg",{className:"w-4 h-4 text-primary-600 dark:text-primary-400 flex-shrink-0 animate-pulse",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),n.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-primary-600 dark:text-primary-400",children:r("question.title")})]}),l.map((J,ne)=>{const P=Array.isArray(J.options)?J.options:[],U=P.length>0,X=J.multiple===!0,F=J.custom!==!1,Z=h[ne]??[],W=F&&!H;return W&&(H=!0),n.jsxs("div",{className:ne>0?"pt-3 mt-3 border-t border-gray-200 dark:border-gray-700":"",children:[(J.header||X)&&n.jsxs("div",{className:"flex items-center gap-2 mb-1.5 flex-wrap",children:[J.header&&n.jsx("span",{className:"text-[10px] uppercase tracking-wider font-semibold text-primary-600 dark:text-primary-400 bg-primary-100 dark:bg-primary-900/30 rounded px-1.5 py-0.5",children:J.header}),X&&n.jsx("span",{className:"text-[10px] uppercase tracking-wider font-semibold text-gray-400 dark:text-gray-500",children:r("question.select_all")})]}),n.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-2 whitespace-pre-wrap",children:J.text}),U&&n.jsx("div",{className:"flex flex-col gap-1.5 mb-2",children:P.map((G,oe)=>{const Q=nB(G),fe=Z.includes(Q);return n.jsx("button",{onClick:()=>ee(ne,Q,X),disabled:k!==null,className:`text-left px-3 py-2 text-sm rounded-md border transition-colors ${fe?"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":fe,children:Q},oe)})}),F&&n.jsx("input",{ref:W?C:void 0,type:"text",value:y[ne]??"",onChange:G=>v(oe=>({...oe,[ne]:G.target.value})),onKeyDown:K,disabled:k!==null,placeholder:r(U?"question.custom_placeholder":"question.input_placeholder"),className:"w-full px-3 py-2 text-sm rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-400 dark:placeholder-gray-500 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent disabled:opacity-50 disabled:cursor-not-allowed"})]},ne)}),w&&n.jsx("p",{className:"text-xs text-red-600 dark:text-red-400 mt-3 mb-2",children:w}),!E&&!u&&n.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-2",children:r("question.reconnecting")||"Reconnecting…"}),n.jsxs("div",{className:"flex items-center justify-end gap-2 mt-3",children:[n.jsx("button",{onClick:D,disabled:k!==null||!E,className:"px-3 py-1.5 text-sm font-medium rounded-md border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:r(k==="reject"?"question.dismissing":"question.dismiss")}),n.jsx("button",{onClick:V,disabled:k!==null||!z||!E,className:"px-3 py-1.5 text-sm font-medium rounded-md text-white bg-primary-600 hover:bg-primary-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:k==="reply"?r("question.submitting"):l.length>1?r("question.submit_n",{count:l.length}):r("question.submit")})]})]})}function iB(e,t,r){if(r===1){const o="User's answer: ";return e.startsWith(o)?e.slice(o.length):e}const a=e.split(`
85
+ `),i=`[${t+1}] `;for(const o of a)if(o.startsWith(i))return o.slice(i.length);return e}function sB({sessionId:e}){const{t}=Jt(),[r,a]=x.useState(null),[i,o]=x.useState(!1),[l,u]=x.useState(null),[d,f]=x.useState(!1),[p,h]=x.useState(null),m=x.useRef(null),y=r!==null;x.useEffect(()=>{if(!i)return;const N=E=>{E.key==="Escape"&&(E.stopPropagation(),o(!1))};return window.addEventListener("keydown",N),m.current&&m.current.focus(),()=>window.removeEventListener("keydown",N)},[i]);const v=async()=>{if(!(y||!e)){o(!0),f(!0),h(null);try{const{content:N}=await iM(e);u(typeof N=="string"?N:"")}catch(N){console.error("Failed to load PLAN.md:",N),h(t("planCard.loadError"))}finally{f(!1)}}},k=()=>{y||(a("executed"),window.dispatchEvent(new CustomEvent("pave:plan-execute")))},_=()=>{y||a("dismissed")},w="inline-flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-xs font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed";return n.jsxs("div",{className:"mt-2 flex flex-col gap-2 rounded-xl border border-amber-300 dark:border-amber-700 bg-amber-50 dark:bg-amber-900/20 px-3 py-2.5 transition-opacity "+(y?"opacity-50":""),children:[n.jsx("div",{className:"text-xs font-medium text-amber-800 dark:text-amber-200",children:t("planCard.heading")}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx("button",{type:"button",onClick:v,disabled:y||d||!e,className:w+" border-sky-300 dark:border-sky-700 text-sky-700 dark:text-sky-300 hover:bg-sky-100 dark:hover:bg-sky-900/40",children:t("planCard.showPlan")}),n.jsx("button",{type:"button",onClick:k,disabled:y,className:w+" border-emerald-300 dark:border-emerald-700 text-emerald-700 dark:text-emerald-300 hover:bg-emerald-100 dark:hover:bg-emerald-900/40",children:t("planCard.execute")}),n.jsx("button",{type:"button",onClick:_,disabled:y,className:w+" border-amber-300 dark:border-amber-700 text-amber-700 dark:text-amber-300 hover:bg-amber-100 dark:hover:bg-amber-900/40",children:t("planCard.keepPlanning")})]}),y&&n.jsx("div",{className:"text-[11px] text-gray-500 dark:text-gray-400","aria-live":"polite",children:t(r==="executed"?"planCard.executedStatus":"planCard.dismissedStatus")}),i&&n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",onClick:()=>o(!1),children:n.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":t("planCard.heading"),className:"flex max-h-[80vh] w-full max-w-2xl flex-col rounded-lg bg-white dark:bg-gray-800 shadow-xl",onClick:N=>N.stopPropagation(),children:[n.jsxs("div",{className:"flex items-center justify-between border-b border-gray-200 dark:border-gray-700 px-4 py-2.5",children:[n.jsx("span",{className:"text-sm font-medium text-gray-800 dark:text-gray-100",children:"PLAN.md"}),n.jsx("button",{ref:m,type:"button",onClick:()=>o(!1),className:"rounded p-1 text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 hover:text-gray-600 dark:hover:text-gray-200","aria-label":t("planCard.close"),children:"✕"})]}),d?n.jsx("div",{className:"px-4 py-6 text-xs text-gray-500 dark:text-gray-400",children:t("planCard.loading")}):p?n.jsx("div",{className:"px-4 py-6 text-xs text-red-600 dark:text-red-400",children:p}):n.jsx("pre",{className:"overflow-auto whitespace-pre-wrap break-words px-4 py-3 text-xs text-gray-800 dark:text-gray-200",children:l})]})})]})}const oB="plan.md";function lB(e){const t=String(e).split(/[\\/]/);return t[t.length-1]||""}function cB(e){return typeof e!="string"||!e?!1:lB(e).toLowerCase()===oB}function uB(e){if(!Array.isArray(e))return null;let t=null;for(const r of e){if(!r||r.type!=="tool"||r.tool!=="write"&&r.tool!=="edit")continue;const a=r.state&&r.state.input||{};cB(a.filePath)&&(t={content:typeof a.content=="string"?a.content:null})}return t}function sk(e,t,r=!1){if(t){const a=Object.values(t).filter(i=>i.type==="reasoning"&&r?!1:i.type==="text"||i.type==="reasoning"||i.type==="error").map(i=>i.text||i.delta||"").join(`
86
+
87
+ `);if(a)return a}return!e||e.length===0?"":e.filter(a=>a.type==="reasoning"&&r?!1:a.type==="text"||a.type==="reasoning"||a.type==="error").map(a=>a.text||"").join(`
88
+
89
+ `)}function dB(e,t,r){const a=sk(e,t,r);if(!e||e.length===0)return a;const i=[];for(let o=0;o<e.length;o++){const l=e[o];if(l.type!=="tool")continue;const u=l.tool||l.state&&l.state.title||"",d=l.state||{},f=d.input||{},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 y=0;y<h.length;y++)m[h[y]]=f[h[y]];try{p.push(JSON.stringify(m))}catch{}}if(d.output){let m=typeof d.output=="string"?d.output:(function(){try{return JSON.stringify(d.output,null,2)}catch{return String(d.output)}})();m=m.replace(/\x1b\[[0-9;]*m/g,""),m.length>500&&(m=m.slice(0,500)),p.push(m)}if(d.error){const m=typeof d.error=="string"?d.error:d.error.message||String(d.error);p.push(m)}p.length>0&&i.push(p.join(`
90
+ `))}return i.length===0?a:a+`
91
+
92
+ `+i.join(`
93
+
94
+ `)}function fB(e){let t=e;return t=t.replace(/```[\s\S]*?```/g,`
95
+ `),t=t.replace(/(^|\n)\n((?:(?: {4}|\t).+\n?)+)/g,`$1
96
+ `),t=t.replace(/^((?:(?: {4}|\t).+\n?)+)/,`
97
+ `),t=t.replace(/`[^`\n]+`/g," "),t=t.replace(/!\[[^\]]*\]\([^)]*\)/g," "),t=t.replace(/\[([^\]]*)\]\([^)]*\)/g,"$1"),t=t.replace(/^\[[^\]]+\]:\s.*$/gm," "),t=t.replace(/<(https?:\/\/[^>]+)>/g,"$1"),t=t.replace(/<\/?[a-zA-Z][^>]*>/g," "),t}const pB="bg-primary-500 text-white rounded-2xl rounded-br-md px-4 py-2.5";function cR({message:e,parts:t,streamingParts:r,user:a,searchQuery:i,matchOffset:o,matchCount:l,activeMatchIndex:u,registerMatchRef:d,onRetry:f,onEditAndResend:p,onCancelQueued:h,hackerMode:m,mobileFrameless:y,hideThinking:v,isPrivate:k,isLast:_,isBusy:w,sessionID:N,questionIdMap:E,isCompactedOut:A}){var{t:T}=Jt(),C=e.role==="user",j=!C&&_&&!w?uB(t)!==null:!1,M=C&&e._queued===!0,L=a!=null&&a.name?a.name.charAt(0).toUpperCase():"U",[I,B]=x.useState(!1),[z,ee]=x.useState(!1),[V,D]=x.useState(""),K=x.useRef(null),H=x.useRef(!0),J=x.useRef(null);x.useEffect(function(){var se=J.current;!se||!z||(se.style.height="auto",se.style.height=Math.min(se.scrollHeight,300)+"px")},[V,z]),x.useEffect(function(){return H.current=!0,function(){H.current=!1,K.current&&clearTimeout(K.current)}},[]);var ne=sk(t,r,v),P=(t||[]).filter(function(se){return se.type==="tool"}),U=(t||[]).filter(function(se){return se.type==="file"&&se.filename}),X=(t||[]).filter(function(se){if(se.type!=="image_url"||!se.image_url)return!1;var De=se.image_url.url||se.image_url;if(typeof De!="string")return!1;if(De.startsWith("data:image/")){var rt=De.indexOf(";"),dt=rt>5?De.substring(5,rt).toLowerCase():"",lt=["image/png","image/jpeg","image/jpg","image/gif","image/webp"];return lt.indexOf(dt)!==-1}if(De.startsWith("https://"))try{var Lt=new URL(De),ot=Lt.pathname.toLowerCase();return!ot.endsWith(".svg")&&!ot.endsWith(".svgz")}catch{return!1}return!1});if(!C){var F=!!ne,Z=X.length>0,W=P.length>0,G=P.some(function(se){return(se.tool||se.state&&se.state.title||"")==="question"}),oe=!m||G,Q=(t||[]).some(function(se){return se.type==="reasoning"&&se.text}),fe=!1;if(r)for(var ke=Object.keys(r),Fe=0;Fe<ke.length;Fe++){var Ve=r[ke[Fe]];if(Ve&&Ve.type==="reasoning"&&(Ve.text||Ve.delta)){fe=!0;break}}var Ge=Q||fe,qe=(t||[]).some(function(se){return se.type==="error"&&se.text});if(!rB({hasText:F,hasImages:Z,hasTools:W,toolsVisibleHere:oe,hasReasoning:Ge,hasError:qe,isFrameless:y,hideThinking:v,finish:e.finish}))return null}var Ce=hB(e.time,T),He=e.isAutoInjected===!0,ze=e.isCompaction===!0,gt=e.isContinuation===!0,mt=ze&&!gt,wt=function(){var se=ne||"";navigator.clipboard&&navigator.clipboard.writeText?navigator.clipboard.writeText(se).then(function(){H.current&&(B(!0),K.current&&clearTimeout(K.current),K.current=setTimeout(function(){H.current&&B(!1)},2e3))}).catch(function(){H.current&&$e(se)}):$e(se)},$e=function(se){var De=document.createElement("textarea");De.value=se,De.style.position="fixed",De.style.opacity="0",document.body.appendChild(De),De.select();try{document.execCommand("copy")}catch{}finally{document.body.removeChild(De)}H.current&&(B(!0),K.current&&clearTimeout(K.current),K.current=setTimeout(function(){H.current&&B(!1)},2e3))},Et=function(){D(ne||""),ee(!0)},Ze=function(){ee(!1),D("")},Oe=function(){V.trim()&&(M&&h&&h(e.id),p&&p(V.trim())),ee(!1),D("")},it=null;if(C){var me=gt?T("compaction.continuation_message_label")||"Compaction done. Please continue.":ze?T("compaction.user_message_label")||"Summarizing our conversation to keep things efficient.":ne;i&&l>0&&!ze&&!gt?it=mB(ne||"",i,o,u,d):it=n.jsx("p",{className:"text-sm whitespace-pre-wrap break-words",children:me})}var Ee={pre:function({node:se,children:De,...rt}){if(x.isValidElement(De)){var dt=De.type;if(dt==="code"||typeof dt=="string"&&dt.toLowerCase()==="code"){var lt=De.props||{},Lt=lt.className||"",ot=Lt.match(/language-(\S+)/),et=ot?ot[1]:"",Ot=$c(lt.children);return n.jsx(Zd,{language:et,className:Lt,frameless:je,children:Ot})}}var gr=$c(De);return gr?n.jsx(Zd,{language:"",className:"",frameless:je,children:gr}):n.jsx("pre",{...rt,children:De})},code:function({node:se,className:De,children:rt,...dt}){if(se&&se.position&&dt["data-sourcepos"],De&&De.indexOf("language-")!==-1){var lt=De.match(/language-(\S+)/),Lt=lt?lt[1]:"";return n.jsx(Zd,{language:Lt,className:De,frameless:je,children:$c(rt)})}return n.jsx("code",{className:je?"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",...dt,children:rt})},a:function({node:se,children:De,href:rt,...dt}){return n.jsx("a",{href:rt,...dt,target:"_blank",rel:"noopener noreferrer",children:De})},table:function({node:se,children:De,...rt}){return n.jsx("div",{className:je?"overflow-x-auto my-3":"overflow-x-auto",children:n.jsx("table",{className:je?"w-full text-sm border-collapse [&>tbody>tr:nth-child(odd)]:bg-gray-50 dark:[&>tbody>tr:nth-child(odd)]:bg-gray-800/30":"",...rt,children:De})})},th:function({node:se,children:De,...rt}){return n.jsx("th",{className:je?"px-3 py-1.5 text-left font-medium border-b border-gray-200 dark:border-gray-700":"",...rt,children:De})},td:function({node:se,children:De,...rt}){return n.jsx("td",{className:je?"px-3 py-1.5 border-b border-gray-100 dark:border-gray-800":"",...rt,children:De})}},ge={current:0},je=y&&!C;return n.jsxs("div",{className:`group flex gap-3 ${C?"justify-end":"justify-start"} ${M?"opacity-60 italic":""}${A&&!mt?" opacity-60":""}`,"data-compacted-out":A?"true":void 0,children:[!C&&!je&&n.jsx("div",{className:`flex-shrink-0 w-7 h-7 rounded-lg flex items-center justify-center mt-1 ${k?"bg-emerald-600":"bg-primary-500"}`,title:k?"Private model (DLP)":void 0,children:k?n.jsx("svg",{className:"w-3.5 h-3.5 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 15v2m-6 4h12a2 2 0 002-2v-7a2 2 0 00-2-2H6a2 2 0 00-2 2v7a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"})}):n.jsx("span",{className:"text-white font-bold text-xs",children:"P"})}),n.jsxs("div",{className:`flex flex-col min-w-0 ${je?"w-full":"max-w-[70%] 3xs:max-w-[75%] xs:max-w-[80%] sm:max-w-[85%]"}`,children:[n.jsx("div",{className:`min-w-0 overflow-hidden ${C?`${pB}${M&&!z?" cursor-pointer ring-2 ring-dashed ring-white/30 hover:ring-white/50 transition-shadow":""}`:je?"":`${k?"bg-emerald-50 dark:bg-emerald-950/40 ring-1 ring-emerald-500/30":"bg-gray-100 dark:bg-gray-800"} text-gray-900 dark:text-gray-100 rounded-2xl rounded-bl-md px-4 py-2.5`}`,...M&&!z&&p&&h?{onClick:Et,title:T("chat.edit_resend"),role:"button",tabIndex:0,onKeyDown:function(se){(se.key==="Enter"||se.key===" ")&&(se.preventDefault(),Et())}}:{},children:C?z?n.jsxs("div",{className:"space-y-2",children:[n.jsx("textarea",{ref:J,value:V,onChange:function(se){D(se.target.value)},className:"w-full bg-white/20 text-white placeholder-white/50 text-sm rounded-lg px-3 py-2 outline-none resize-none min-h-[60px] max-h-[300px] overflow-y-auto",rows:1,autoFocus:!0}),n.jsxs("div",{className:"flex gap-2 justify-end",children:[n.jsx("button",{onClick:Ze,className:"px-3 py-1 text-xs rounded-lg bg-white/20 hover:bg-white/30 transition-colors",children:"Cancel"}),n.jsx("button",{onClick:Oe,className:"px-3 py-1 text-xs rounded-lg bg-white/30 hover:bg-white/40 font-medium transition-colors",children:"Send"})]})]}):n.jsxs("div",{className:"text-sm whitespace-pre-wrap break-words",children:[it,U.length>0&&n.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:U.map(function(se,De){return n.jsxs("div",{className:"inline-flex items-center gap-2 bg-white/15 border border-white/30 rounded-lg px-2 py-1 text-xs max-w-xs",title:se.mime||"",children:[n.jsx("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":"true",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})}),n.jsx("span",{className:"truncate",children:se.filename})]},se.id||"file-"+De)})}),X.length>0&&n.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:X.map(function(se,De){var rt=se.image_url.url||se.image_url;return n.jsx("a",{href:rt,target:"_blank",rel:"noopener noreferrer",children:n.jsx("img",{src:rt,alt:T("chat.attachment_with_index",{index:De+1}),className:"max-w-[200px] max-h-[200px] rounded-lg object-cover cursor-pointer hover:opacity-90 transition-opacity"})},se.id||"img-"+De)})})]}):gB(t,r,X,U,Ee,ge,i,o,l,u,d,m,v,T,je,E,_,w)}),j&&n.jsx(sB,{sessionId:N}),n.jsxs("div",{className:`flex items-center gap-1.5 mt-1 px-1 ${C?"justify-end":"justify-start"}`,children:[Ce&&n.jsx("span",{className:"text-[10px] text-gray-400 dark:text-gray-500",children:Ce}),He&&n.jsx("span",{className:"text-[9px] font-medium px-1.5 py-0.5 rounded-full bg-blue-100 dark:bg-blue-900/40 text-blue-600 dark:text-blue-400 leading-none",children:T("chat.idle_injection_auto_badge")}),(e.finish==="aborted"||e.finish==="interrupted")&&n.jsx("span",{className:"text-[9px] font-medium px-1.5 py-0.5 rounded-full bg-orange-100 dark:bg-orange-900/40 text-orange-600 dark:text-orange-400 leading-none",children:e.finish==="aborted"?T("chat.stopped_badge")||"Stopped":T("chat.interrupted_badge")||"Interrupted"}),e.finish==="error"&&n.jsx("span",{className:"text-[9px] font-medium px-1.5 py-0.5 rounded-full bg-red-100 dark:bg-red-900/40 text-red-600 dark:text-red-400 leading-none",children:T("chat.error_badge")||"Error"}),e.moeTopK&&e.moeTopK>0&&n.jsx("span",{className:`text-[9px] font-medium px-1.5 py-0.5 rounded-full leading-none ${e.moeTopK<=4?"bg-orange-100 dark:bg-orange-900/40 text-orange-600 dark:text-orange-400":e.moeTopK<=6?"bg-amber-100 dark:bg-amber-900/40 text-amber-600 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/40 text-blue-600 dark:text-blue-400"}`,children:e.moeTopK<=4?"Fast":e.moeTopK<=6?"Balanced":"Quality"}),n.jsxs("div",{className:"flex items-center gap-0.5 opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto focus-within:opacity-100 focus-within:pointer-events-auto transition-opacity",children:[ne&&n.jsx("button",{onClick:wt,className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 transition-colors focus:outline-none focus:ring-1 focus:ring-primary-500","aria-label":T(I?"chat.copied":"chat.copy_message"),title:T(I?"chat.copied":"chat.copy_message"),children:I?n.jsx("svg",{className:"w-3.5 h-3.5 text-green-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}):n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}),C&&!M&&!z&&p&&n.jsx("button",{onClick:Et,className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 transition-colors focus:outline-none focus:ring-1 focus:ring-primary-500","aria-label":T("chat.edit_resend"),title:T("chat.edit_resend"),children:n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),C&&M&&!z&&p&&h&&n.jsx("button",{onClick:Et,className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 transition-colors focus:outline-none focus:ring-1 focus:ring-primary-500","aria-label":T("chat.edit_resend"),title:T("chat.edit_resend"),children:n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),C&&M&&h&&n.jsx("button",{onClick:function(){h(e.id)},className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-400 dark:text-gray-500 hover:text-red-500 dark:hover:text-red-400 transition-colors focus:outline-none focus:ring-1 focus:ring-primary-500","aria-label":T("chat.cancel_queued"),title:T("chat.cancel_queued"),children:n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6M1 7h22M9 7V4a1 1 0 011-1h4a1 1 0 011 1v3"})})}),!C&&f&&n.jsx("button",{onClick:f,className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 transition-colors focus:outline-none focus:ring-1 focus:ring-primary-500","aria-label":T("chat.regenerate"),title:T("chat.regenerate"),children:n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})})]})]})]}),C&&n.jsx("div",{className:"flex-shrink-0 w-7 h-7 rounded-full bg-gray-300 dark:bg-gray-600 flex items-center justify-center mt-1",children:n.jsx("span",{className:"text-gray-700 dark:text-gray-200 font-bold text-xs",children:L})})]})}function gB(e,t,r,a,i,o,l,u,d,f,p,h,m,y,v,k,_,w){var N=(e||[]).slice();if(t){for(var E={},A=0;A<N.length;A++)E[N[A].id]=!0;for(var T=Object.keys(t),C=0;C<T.length;C++){var j=t[T[C]];(j.type==="text"||j.type==="reasoning")&&!E[j.id]&&N.push({id:j.id,type:j.type,text:j.text||j.delta||"",live:!0})}}var M=[],L="",I="",B="",z="",ee=!1;function V(){L&&(M.push({type:"text",text:L,key:I}),L="",I="")}function D(){B&&(M.push({type:"reasoning",text:B,key:z,live:ee}),B="",z="",ee=!1)}for(var K=0;K<N.length;K++){var H=N[K];if(H.type==="text"){D(),I||(I="text-"+(H.id||K));var J=H.text||"";L&&J&&!L.endsWith(`
98
+ `)&&(L+=`
99
+ `),L+=J}else if(H.type==="reasoning"){V(),z||(z="reasoning-"+(H.id||K)),H.live&&(ee=!0);var ne=H.text||"";B&&ne&&!B.endsWith(`
100
+ `)&&(B+=`
101
+ `),B+=ne}else H.type==="error"?(D(),V(),M.push({type:"error",text:H.text||"",key:"error-"+(H.id||K)})):H.type==="tool"&&(D(),V(),M.push({type:"tool",part:H,key:"tool-"+(H.id||K)}))}if(D(),V(),a.length>0&&M.push({type:"files",parts:a,key:"files"}),r.length>0&&M.push({type:"images",parts:r,key:"images"}),M.length===0)return null;var P=[],U=[],X="";function F(){U.length>0&&(P.push(n.jsx("div",{className:"mb-2 pl-2 border-l-2 border-gray-200 dark:border-gray-700",children:U},"accent-"+X)),U=[])}for(var Z=-1,W=M.length-1;W>=0;W--)if(M[W].type==="reasoning"){Z=W;break}for(var G=0;G<M.length;G++){var oe=M[G];if(oe.type==="text"){F();var Q=Object.assign({},i);if(l&&d>0){var fe=function(qe,Ce){return function({children:He,node:ze,...gt}){return n.jsx(qe,{...gt,children:uv(He,l,u,Ce,f,p)})}};Q.p=fe("p",o),Q.li=fe("li",o),Q.td=fe("td",o),Q.th=fe("th",o),Q.h1=fe("h1",o),Q.h2=fe("h2",o),Q.h3=fe("h3",o),Q.h4=fe("h4",o),Q.h5=fe("h5",o),Q.h6=fe("h6",o),Q.blockquote=fe("blockquote",o)}P.push(n.jsx("div",{className:"mb-2 prose prose-sm dark:prose-invert max-w-none break-words",children:n.jsx(Cl,{remarkPlugins:[Tl,Qd],rehypePlugins:[Yg],components:Q,children:oe.text})},oe.key))}else if(oe.type==="reasoning")if(v){if(F(),m)continue;U.length===0&&(X=oe.key),U.push(n.jsx(tB,{text:oe.text,isStreaming:oe.live&&G===Z&&_&&w},oe.key))}else{if(F(),m)continue;P.push(n.jsxs("div",{className:"my-2 p-3 rounded-lg bg-gray-100 dark:bg-gray-800 border-l-4 border-amber-500 dark:border-amber-400",children:[n.jsxs("div",{className:"flex items-center gap-2 text-amber-600 dark:text-amber-400 text-xs font-medium uppercase tracking-wide",children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"})}),y("chat.thinking")]}),n.jsx("div",{className:"mt-2 prose prose-sm dark:prose-invert max-w-none break-words text-gray-600 dark:text-gray-300 italic opacity-80",children:n.jsx(Cl,{remarkPlugins:[Tl,Qd],rehypePlugins:[Yg],components:i,children:oe.text})})]},oe.key))}else if(oe.type==="error")F(),P.push(n.jsxs("div",{className:"my-2 p-3 rounded-lg bg-red-50 dark:bg-red-900/20 border-l-4 border-red-500 dark:border-red-400",children:[n.jsxs("div",{className:"flex items-center gap-2 text-red-600 dark:text-red-400 text-xs font-medium uppercase tracking-wide",children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),y("chat.error_badge")||"Error"]}),n.jsx("div",{className:"mt-2 prose prose-sm dark:prose-invert max-w-none break-words text-red-600 dark:text-red-300",children:n.jsx(Cl,{remarkPlugins:[Tl,Qd],rehypePlugins:[Yg],components:i,children:oe.text})})]},oe.key));else if(oe.type==="tool"){var ke=oe.part.tool||oe.part.state&&oe.part.state.title||"",Fe=ke==="question";if(Fe){F();var Ve=oe.part.callID||oe.part.id||"",Ge=k&&k[Ve]?k[Ve]:null;P.push(n.jsx("div",{className:"my-2",children:n.jsx(aB,{part:oe.part,questionId:Ge})},oe.key))}else v&&!h?(U.length===0&&(X=oe.key),U.push(n.jsx(eB,{part:oe.part},oe.key))):(F(),P.push(n.jsx("div",{className:`my-2 ${h?"hidden":""}`,children:n.jsx(JF,{part:oe.part})},oe.key)))}else oe.type==="files"?(F(),P.push(n.jsx("div",{className:P.length>0?"mt-2":"",children:n.jsx("div",{className:"flex flex-wrap gap-2",children:oe.parts.map(function(qe,Ce){return n.jsxs("div",{className:"inline-flex items-center gap-2 bg-gray-100 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg px-3 py-2 text-sm max-w-xs",title:qe.mime||"",children:[n.jsx("svg",{className:"w-5 h-5 text-gray-500 dark:text-gray-400 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":"true",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})}),n.jsx("span",{className:"truncate text-xs text-gray-700 dark:text-gray-300",children:qe.filename})]},qe.id||"file-"+Ce)})})},oe.key))):oe.type==="images"&&P.push(n.jsx("div",{className:P.length>0?"mt-2":"",children:n.jsx("div",{className:"flex flex-wrap gap-2",children:oe.parts.map(function(qe,Ce){var He=qe.image_url.url||qe.image_url;return n.jsx("a",{href:He,target:"_blank",rel:"noopener noreferrer",children:n.jsx("img",{src:He,alt:y("chat.attachment_with_index",{index:Ce+1}),className:"max-w-[200px] max-h-[200px] rounded-lg object-cover cursor-pointer hover:opacity-90 transition-opacity"})},qe.id||"img-"+Ce)})})},oe.key))}return F(),P}function $c(e){return e==null?"":typeof e=="string"?e:typeof e=="number"?String(e):Array.isArray(e)?e.map($c).join(""):x.isValidElement(e)?$c(e.props.children):""}function hB(e,t){if(!e)return"";var r=e.created||e.updated;if(!r)return"";var a=new Date(r);if(isNaN(a.getTime()))return"";var i=new Date,o=a.toDateString()===i.toDateString(),l=new Date(i);l.setDate(l.getDate()-1);var u=a.toDateString()===l.toDateString(),d=a.getHours(),f=a.getMinutes(),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=a.getMonth()+1,y=a.getDate();return m+"/"+y+" "+h}function mB(e,t,r,a,i){if(!t||!e)return n.jsx("p",{className:"text-sm whitespace-pre-wrap break-words",children:e});for(var o=e.toLowerCase(),l=t.toLowerCase(),u=[],d=0,f=0;;){var p=o.indexOf(l,d);if(p===-1)break;p>d&&u.push(e.substring(d,p));var h=r+f,m=h===a;u.push(n.jsx("mark",{ref:function(y){i(h,y)},className:m?"bg-accent-400 text-gray-900 rounded-sm px-0.5":"bg-yellow-200 dark:bg-yellow-700 text-gray-900 dark:text-gray-100 rounded-sm px-0.5",children:e.substring(p,p+t.length)},"m-"+f)),f++,d=p+t.length}return d<e.length&&u.push(e.substring(d)),n.jsx("p",{className:"text-sm whitespace-pre-wrap break-words",children:u})}function uv(e,t,r,a,i,o){if(!e)return e;if(Array.isArray(e))return e.map(function(k,_){return n.jsx(x.Fragment,{children:uv(k,t,r,a,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=r+a.current,y=m===i;f.push(n.jsx("mark",{ref:function(k){o(m,k)},className:y?"bg-accent-400 text-gray-900 rounded-sm px-0.5":"bg-yellow-200 dark:bg-yellow-700 text-gray-900 dark:text-gray-100 rounded-sm px-0.5",children:l.substring(h,h+t.length)},"m-"+a.current)),a.current++,p=h+t.length}return p<l.length&&f.push(l.substring(p)),f.length>0?f:l}if(x.isValidElement(e)){if(e.type==="code"||e.type===Zd)return e;if(e.props&&e.props.children!==void 0){var v=uv(e.props.children,t,r,a,i,o);return x.cloneElement(e,void 0,v)}}return e}function xB({sessionID:e,banners:t,hidden:r,onToggle:a}){var[i,o]=x.useState(0),[l,u]=x.useState(!1);if(x.useRef(null),x.useEffect(function(){o(0)},[e,t&&t.length,t&&t[0]&&t[0].timestamp]),!e||!t||t.length===0)return null;if(r)return n.jsx("button",{type:"button",onClick:a,className:"w-full text-center text-xs text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 py-1 border-b border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900/50 transition-colors","aria-label":"Show banner",children:"▾ Show banner"});var d=t[i]||t[0],f=function(){o(function(h){return Math.min(t.length-1,h+1)})},p=function(){o(function(h){return Math.max(0,h-1)})};return n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"sticky top-0 z-10 bg-white dark:bg-gray-900 group border-b border-gray-200 dark:border-gray-800",children:n.jsxs("div",{className:"relative w-full overflow-hidden cursor-zoom-in",style:{aspectRatio:"16 / 9",maxHeight:"20vh"},onClick:function(){u(!0)},title:d.prompt||"Session banner",children:[n.jsx("img",{src:d.url,alt:d.prompt||"Session banner",className:"w-full h-full object-cover",loading:"lazy",draggable:!1}),d.prompt?n.jsx("div",{className:"absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/70 to-transparent text-white text-xs px-3 py-2 opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",children:n.jsx("div",{className:"line-clamp-2",children:d.prompt})}):null,t.length>1?n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",onClick:function(h){h.stopPropagation(),f()},disabled:i>=t.length-1,className:"absolute left-1 top-1/2 -translate-y-1/2 bg-black/40 hover:bg-black/60 text-white rounded-full w-7 h-7 flex items-center justify-center disabled:opacity-30 opacity-0 group-hover:opacity-100 transition-opacity","aria-label":"Older banner",children:"‹"}),n.jsx("button",{type:"button",onClick:function(h){h.stopPropagation(),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:"›"}),n.jsx("div",{className:"absolute top-1 right-2 bg-black/40 text-white text-[10px] px-1.5 py-0.5 rounded opacity-0 group-hover:opacity-100 transition-opacity",children:i+1+" / "+t.length})]}):null]})}),l?n.jsxs("div",{className:"fixed inset-0 z-50 bg-black/85 flex items-center justify-center p-4 cursor-zoom-out",onClick:function(){u(!1)},children:[n.jsxs("div",{className:"max-w-5xl w-full",onClick:function(h){h.stopPropagation()},children:[n.jsx("img",{src:d.url,alt:d.prompt||"Session banner",className:"w-full h-auto rounded shadow-2xl",style:{aspectRatio:"16 / 9",objectFit:"cover"}}),d.prompt?n.jsx("div",{className:"text-white text-sm mt-3 px-2",children:d.prompt}):null,n.jsxs("div",{className:"text-white/60 text-xs mt-1 px-2",children:[new Date(d.timestamp).toLocaleString(),t.length>1?" · "+(i+1)+" of "+t.length:""]})]}),n.jsx("button",{type:"button",className:"absolute top-4 right-4 text-white text-2xl leading-none w-10 h-10 flex items-center justify-center rounded-full bg-white/10 hover:bg-white/20",onClick:function(){u(!1)},"aria-label":"Close",children:"×"})]}):null]})}const yB=x.forwardRef(function({messages:t,unloadedCompactedCount:r,onExpandCompactedHistory:a,hasOlderMessages:i,loadingOlderMessages:o,onLoadOlderMessages:l,streamingParts:u,streamingProgress:d,isBusy:f,compactingInfo:p,compactionResult:h,onSwitchToCompactedSession:m,onDismissCompactionResult:y,user:v,searchQuery:k,activeMatchIndex:_,onTotalMatchesChange:w,onRetry:N,onEditAndResend:E,onCancelQueued:A,hackerMode:T,mobileFrameless:C,hideThinking:j,sessionID:M,banners:L,bannerHidden:I,onToggleBanner:B,privateMessageIds:z,parentSessionID:ee,onViewParentSession:V,compactionPinned:D,onUnpinCompaction:K,questionIdMap:H},J){const{t:ne}=Jt();var P=x.useRef(null),U=x.useRef(!0),X=x.useRef({}),F=x.useRef(null),Z=x.useRef(null),[W,G]=x.useState(!1),oe=x.useRef(-1),Q=x.useRef(0),fe=x.useRef(null),ke=x.useRef(null),Fe=x.useRef(t.length);Fe.current=t.length;var[Ve,Ge]=x.useState(!1),qe=x.useRef({startIndex:0,endIndex:0}),Ce=x.useRef(null),He=x.useRef(!1),ze=x.useRef(0),gt=x.useRef(null);x.useEffect(function(){Ge(!1),gt.current=null},[M]);var mt=x.useCallback(function(){U.current=!0,Z.current?Z.current.scrollTop=Z.current.scrollHeight:P.current&&P.current.scrollToIndex({index:"LAST",behavior:"smooth",align:"end"})},[]);x.useImperativeHandle(J,function(){return{scrollToBottom:mt,resetAutoScroll:function(){U.current=!0}}},[mt]);var wt=x.useCallback(function(Be,nt){nt?X.current[Be]=nt:delete X.current[Be]},[]),$e=x.useRef({}),Et=x.useMemo(function(){if(!k)return{perMessage:{},total:0,_nextCache:{}};for(var Be=k.toLowerCase(),nt=0,kt={},at={},re=$e.current,ve=0;ve<t.length;ve++){var Re=t[ve],ie=dB(Re.parts,u[Re.info.id],j),Rt=Re.info.role==="assistant",ft=Rt?fB(ie):ie,Ut=ft.toLowerCase(),Me=Re.info.id,Tt=re[Me],tr;Tt&&Tt.text===Ut&&Tt.query===Be?tr=Tt.count:tr=bB(Ut,Be),at[Me]={text:Ut,query:Be,count:tr},tr>0&&(kt[Re.info.id]={offset:nt,count:tr,messageIndex:ve}),nt+=tr}return{perMessage:kt,total:nt,_nextCache:at}},[t,u,k,j]);x.useEffect(function(){$e.current=Et._nextCache},[Et]);var Ze=x.useMemo(function(){return{perMessage:Et.perMessage,total:Et.total}},[Et]);x.useEffect(function(){w&&w(Ze.total)},[Ze.total,w]);var Oe=x.useMemo(function(){for(var Be=0,nt=0;nt<t.length;nt++)t[nt].info.compactedOut===!0&&Be++;return Be},[t]),it=x.useMemo(function(){return Ve||Oe===0?t:t.filter(function(Be){return Be.info.compactedOut!==!0})},[t,Ve,Oe]),me=x.useRef(it.length);me.current=it.length,x.useEffect(function(){if(!(!k||Ze.total===0||Ve||Oe===0)){var Be=Ze.perMessage;for(var nt in Be)if(Be.hasOwnProperty(nt)&&Be[nt].messageIndex<Oe){Ge(!0);break}}},[k,Ze,Ve,Oe]),x.useLayoutEffect(function(){if(Ce.current!=null&&P.current){var Be=Ce.current;if(Ce.current=null,Be<0||Be>=it.length)return;var nt=requestAnimationFrame(function(){P.current&&P.current.scrollToIndex({index:Be,align:"start",behavior:"auto"})});return function(){cancelAnimationFrame(nt)}}},[it]),x.useLayoutEffect(function(){var Be=gt.current;if(!(!Be||it.length<=Be.count||!P.current)){gt.current=null;var nt=Be.index+(it.length-Be.count),kt=requestAnimationFrame(function(){P.current&&P.current.scrollToIndex({index:nt,align:"start",behavior:"auto"})});return function(){cancelAnimationFrame(kt)}}},[it]);var Ee=x.useCallback(function(){!l||o||(He.current=!0,gt.current={index:qe.current.startIndex,count:it.length},Promise.resolve(l()).then(function(Be){setTimeout(function(){var nt=gt.current;(!Be||Be.length===0||nt&&me.current<=nt.count)&&(gt.current=null)},0)},function(){gt.current=null}))},[l,o,it.length]),ge=x.useCallback(function(){if(He.current=!0,Ve){Ce.current=0,Ge(!1);return}Oe>0?(Ce.current=qe.current.startIndex+Oe,Ge(!0)):r>0&&a&&(Ce.current=qe.current.startIndex+r,Ge(!0),a())},[Ve,Oe,r,a]);x.useEffect(function(){var Be=it.length>ze.current;if(ze.current=it.length,!Be||!U.current||He.current){He.current=!1;return}var nt=setTimeout(function(){U.current&&Z.current&&(Z.current.scrollTop=Z.current.scrollHeight)},150);return function(){clearTimeout(nt)}},[it.length]),x.useEffect(function(){!U.current||k||Z.current&&(Z.current.scrollTop=Z.current.scrollHeight)},[u,t,k]),x.useEffect(function(){var Be=fe.current!==M;fe.current=M,Be&&(U.current=!0,oe.current=-1,ze.current=0,Q.current=Date.now()+600,G(!1));function nt(){U.current&&Z.current&&(Z.current.scrollTop=Z.current.scrollHeight)}var kt=requestAnimationFrame(nt),at=setTimeout(nt,150),re=setTimeout(nt,450);return function(){cancelAnimationFrame(kt),clearTimeout(at),clearTimeout(re)}},[M,t]);var je=x.useCallback(function(){var Be=Z.current;if(Be){var nt=Be.scrollTop,kt=nt+Be.clientHeight>=Be.scrollHeight-4;kt?U.current=!0:oe.current>=0&&nt<oe.current-8&&Date.now()>Q.current&&(U.current=!1),oe.current=nt,G(!kt&&!U.current&&Fe.current>0)}},[]),se=x.useCallback(function(Be){!Be||ke.current===Be||(ke.current&&ke.current.removeEventListener("scroll",je),ke.current=Be,Be.addEventListener("scroll",je,{passive:!0}))},[je]);x.useEffect(function(){return function(){ke.current&&ke.current.removeEventListener("scroll",je)}},[je]);var De=x.useMemo(function(){if(!k||Ze.total===0)return[];var Be=[],nt=Ze.perMessage;for(var kt in nt)nt.hasOwnProperty(kt)&&Be.push(nt[kt]);return Be.sort(function(at,re){return at.messageIndex-re.messageIndex}),Be},[k,Ze]);x.useEffect(function(){if(!(!k||Ze.total===0||_<0)){for(var Be=-1,nt=0;nt<De.length;nt++){var kt=De[nt];if(_>=kt.offset&&_<kt.offset+kt.count){Be=kt.messageIndex;break}}if(!(Be<0)){var at=Ve||Oe===0?0:Oe,re=Be-at;if(!(re<0)){P.current&&P.current.scrollToIndex({index:re,align:"center",behavior:"smooth"});var ve=requestAnimationFrame(function(){var Re=setTimeout(function(){var ie=X.current[_];ie&&ie.scrollIntoView&&ie.scrollIntoView({behavior:"smooth",block:"center"})},200);F.current=Re});return function(){cancelAnimationFrame(ve),F.current&&(clearTimeout(F.current),F.current=null)}}}}},[_,k,Ze.total,De,Ve,Oe]),x.useEffect(function(){X.current={}},[k]);for(var rt=-1,dt=it.length-1;dt>=0;dt--)if(it[dt].info.role==="assistant"){rt=dt;break}var lt=x.useCallback(function(Be){return k?!1:Be?f?"auto":"smooth":!1},[k,f]),Lt=x.useCallback(function(Be){Be&&(U.current=!0),G(!Be&&!U.current&&Fe.current>0)},[]),ot=x.useMemo(function(){return Ve&&Oe>0?{top:3e3,bottom:600}:{top:600,bottom:600}},[Ve,Oe]),et=x.useCallback(function(Be,nt){var kt=Ze.perMessage[nt.info.id]||null,at=Be===rt,re=nt.info.role==="user",ve=nt.info.compactedOut===!0,Re=Ve&&Be>0&&t[Be-1].info.compactedOut===!0,ie=Re&&!ve;return n.jsxs("div",{className:"px-2 sm:px-4 py-3 max-w-full sm:max-w-3xl mx-auto",children:[ie?n.jsxs("div",{"data-testid":"compaction-boundary",className:"flex items-center gap-3 select-none mb-6",children:[n.jsx("div",{className:"flex-1 border-t border-dashed border-gray-300 dark:border-gray-700"}),n.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 whitespace-nowrap",children:ne&&ne("compaction.boundary")||"Context compacted — messages above are no longer in the model’s context"}),n.jsx("div",{className:"flex-1 border-t border-dashed border-gray-300 dark:border-gray-700"})]}):null,n.jsx(cR,{isCompactedOut:ve,message:nt.info,parts:nt.parts,streamingParts:u[nt.info.id],user:v,searchQuery:k,matchOffset:kt?kt.offset:-1,matchCount:kt?kt.count:0,activeMatchIndex:_,registerMatchRef:wt,isLast:at,isBusy:f,sessionID:M,onRetry:at&&!f&&!ve?N:void 0,onEditAndResend:re&&!f&&!ve&&!kB(nt.parts)?E:void 0,onCancelQueued:ve?void 0:A,hackerMode:T,mobileFrameless:C,hideThinking:j,isPrivate:z&&z.has(nt.info.id),questionIdMap:H})]})},[Ze,rt,t,u,v,k,_,wt,f,M,N,E,A,T,C,j,z,H,Ve,ne]),Ot=x.useMemo(function(){return n.jsxs(n.Fragment,{children:[f&&(C?!0:!vB(t,u,T,j))&&(C?n.jsx("div",{className:"flex justify-start py-2 px-2 sm:px-4 max-w-full sm:max-w-3xl mx-auto",children:n.jsx("svg",{className:"w-4 h-4 text-indigo-400 dark:text-indigo-300 flex-shrink-0 animate-pulse",viewBox:"0 0 24 24",fill:"currentColor",role:"img","aria-label":ne("chat.assistant_typing")||"Assistant is typing",children:n.jsx("path",{d:"M12 2l2.4 7.6L22 12l-7.6 2.4L12 22l-2.4-7.6L2 12l7.6-2.4L12 2z"})})}):n.jsxs("div",{className:"flex gap-3 justify-start px-2 sm:px-4 py-3 max-w-full sm:max-w-3xl mx-auto",children:[n.jsx("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-primary-500 flex items-center justify-center mt-1",children:n.jsx("span",{className:"text-white font-bold text-xs",children:"P"})}),n.jsx("div",{className:"bg-gray-100 dark:bg-gray-800 rounded-2xl rounded-bl-md px-4 py-3",children:n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("span",{className:"w-2 h-2 rounded-full bg-gray-400 dark:bg-gray-500 animate-bounce",style:{animationDelay:"0ms"}}),n.jsx("span",{className:"w-2 h-2 rounded-full bg-gray-400 dark:bg-gray-500 animate-bounce",style:{animationDelay:"150ms"}}),n.jsx("span",{className:"w-2 h-2 rounded-full bg-gray-400 dark:bg-gray-500 animate-bounce",style:{animationDelay:"300ms"}})]})})]})),f&&!C&&d&&d.toolCalls>0&&n.jsxs("div",{className:"flex gap-3 justify-start px-2 sm:px-4 py-3 max-w-full sm:max-w-3xl mx-auto",children:[n.jsx("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-accent-500 flex items-center justify-center mt-1",children:n.jsxs("svg",{className:"w-4 h-4 text-white animate-spin",fill:"none",viewBox:"0 0 24 24",children:[n.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),n.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}),n.jsxs("div",{className:"bg-gray-100 dark:bg-gray-800 rounded-2xl rounded-bl-md px-2 sm:px-4 py-3 min-w-0 max-w-[75%] sm:max-w-[320px]",children:[n.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[n.jsx("span",{className:"text-xs font-medium text-gray-600 dark:text-gray-300",children:_B(d.toolNames,ne)}),n.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 ml-2 tabular-nums",children:wB(d.toolArgBytes)})]}),n.jsx("div",{className:"h-1 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:n.jsx("div",{className:"h-full bg-accent-500 rounded-full animate-progress-indeterminate",style:{width:"40%",animation:"progress-indeterminate 1.5s ease-in-out infinite"}})})]})]})]})},[f,C,t,u,d,T,j,ne]),gr=x.useMemo(function(){return function(){return n.jsxs(n.Fragment,{children:[n.jsx(xB,{sessionID:M,banners:L,hidden:I,onToggle:B}),n.jsx(NB,{sessionID:M,parentSessionID:ee,onViewParentSession:V,compactionPinned:D,onUnpinCompaction:K,t:ne}),i?n.jsx("div",{className:"flex justify-center py-1.5",children:n.jsx("button",{type:"button",onClick:Ee,disabled:o,"data-testid":"load-older-messages",className:"px-3 py-1 rounded-full text-xs font-medium bg-gray-100 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 disabled:opacity-50 transition-colors shadow-sm",children:o?ne&&ne("messages.loading_earlier")||"Loading earlier messages...":ne&&ne("messages.load_earlier")||"Load earlier messages"})}):null,Oe>0||r>0?n.jsx("div",{className:"sticky top-0 z-10 flex justify-center py-1.5 pointer-events-none",children:n.jsx("button",{type:"button",onClick:ge,"data-testid":"compaction-collapse-toggle",className:"pointer-events-auto px-3 py-1 rounded-full text-xs font-medium bg-gray-100 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 hover:text-gray-800 dark:hover:text-gray-200 transition-colors shadow-sm",children:Ve&&Oe>0?ne&&ne("compaction.hide_history")||"Hide messages before compaction":ne&&ne("compaction.show_history",{count:Oe>0?Oe:r})||"Conversation summarized — "+(Oe>0?Oe:r)+" earlier messages collapsed; summary below"})}):null]})}},[M,L,I,B,ee,V,D,K,ne,i,o,Ee,Oe,r,Ve,ge]),dr=x.useRef(Ot);dr.current=Ot;var or=x.useRef(null);or.current||(or.current={version:0,listeners:new Set});var Qt=or.current;x.useEffect(function(){Qt.version+=1,Qt.listeners.forEach(function(Be){Be()})},[Ot,Qt]);var $r=x.useMemo(function(){return function(){return x.useSyncExternalStore(function(nt){return Qt.listeners.add(nt),function(){Qt.listeners.delete(nt)}},function(){return Qt.version}),dr.current}},[]),ue=x.useMemo(function(){return{Header:gr,Footer:$r}},[gr,$r]),Le=it.length===0&&(Oe>0||r>0),ct=Oe>0?Oe:r;return Le?n.jsx("div",{className:"flex-1 relative overflow-hidden",children:n.jsx(SB,{count:ct,onExpand:ge,t:ne})}):n.jsxs("div",{className:"flex-1 relative overflow-hidden",children:[n.jsx(LT,{ref:P,scrollerRef:function(Be){Z.current=Be,Be&&se(Be)},data:it,itemContent:et,followOutput:lt,atBottomStateChange:Lt,rangeChanged:function(Be){qe.current=Be},increaseViewportBy:ot,defaultItemHeight:120,computeItemKey:function(Be,nt){return nt.info.id},components:ue,className:"h-full",style:{overflowY:"auto",overflowX:"hidden"}}),W&&n.jsx("button",{onClick:mt,"aria-label":ne("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-none focus:ring-2 focus:ring-primary-500 transition-all",title:ne("chat.scroll_to_bottom"),children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 14l-7 7m0 0l-7-7m7 7V3"})})})]})});function bB(e,t){if(!t)return 0;for(var r=0,a=0;a=e.indexOf(t,a),a!==-1;)r++,a+=t.length;return r}function vB(e,t,r,a){var i=!r;for(var o of Object.keys(t)){var l=t[o];if(l){var u=Object.values(l).some(function(m){return m.type==="reasoning"&&a?!1:(m.type==="text"||m.type==="reasoning")&&(m.text||m.delta)});if(u)return!0}}for(var d=e.length-1;d>=0;d--){var f=e[d];if(f.info.role==="assistant"){var p=(f.parts||[]).some(function(m){return m.type==="reasoning"&&a?!1:(m.type==="text"||m.type==="reasoning")&&m.text}),h=(f.parts||[]).some(function(m){return m.type==="tool"});return p||i&&h}if(f.info.role==="user")break}return!1}function kB(e){return!e||!Array.isArray(e)?!1:e.some(function(t){return t.type==="image_url"||t.type==="file"})}function _B(e,t){if(!e||e.length===0)return t?t("chat.tool_preparing"):"Preparing tool call";var r={write:t?t("chat.tool_write"):"Writing file",edit:t?t("chat.tool_edit"):"Editing file",read:t?t("chat.tool_read"):"Reading file",bash:t?t("chat.tool_bash"):"Running command",glob:t?t("chat.tool_glob"):"Searching files",grep:t?t("chat.tool_grep"):"Searching code"},a=e[0],i=r[a]||(t?t("chat.tool_preparing_name",{name:a}):"Preparing "+a);return e.length>1&&(i+=" +"+(e.length-1)),i}function wB(e){return e<1024?e+" B":e<1024*1024?(e/1024).toFixed(1)+" KB":(e/1024/1024).toFixed(1)+" MB"}function SB({count:e,onExpand:t,t:r}){return n.jsx("div",{"data-testid":"compaction-empty-state",className:"h-full flex flex-col items-center justify-center text-center px-6 py-10",children:n.jsxs("div",{className:"max-w-sm mx-auto flex flex-col items-center",children:[n.jsx("div",{className:"w-12 h-12 rounded-full bg-blue-50 dark:bg-blue-900/30 flex items-center justify-center mb-4",children:n.jsx("svg",{className:"w-6 h-6 text-blue-500 dark:text-blue-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})}),n.jsx("h2",{className:"text-sm font-semibold text-gray-700 dark:text-gray-200 mb-2",children:r&&r("compaction.empty_title")||"This conversation was summarized"}),n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-5 leading-relaxed",children:r&&r("compaction.empty_body")||"Earlier messages are collapsed to save context. Show them to see the full history."}),n.jsx("button",{type:"button",onClick:t,"data-testid":"compaction-empty-expand",className:"px-4 py-2 rounded-lg text-xs font-medium bg-blue-500 text-white hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900 transition-colors shadow-sm",children:r&&r("compaction.empty_action",{count:e})||"Show "+e+" earlier messages"})]})})}function NB({sessionID:e,parentSessionID:t,onViewParentSession:r,compactionPinned:a,onUnpinCompaction:i,t:o}){var l="pave:compactionBannerDismissed:"+e,u=function(){try{return localStorage.getItem(l)==="1"}catch{return!1}},d=function(){try{localStorage.setItem(l,"1")}catch{}y(!0)},f=function(){r&&t&&r(t)},p=u(),h=x.useState(!p),m=h[0],y=h[1];return!t||m?null:n.jsx("div",{className:"px-2 sm:px-4 py-2 bg-blue-50 dark:bg-blue-900/20 border-b border-blue-200 dark:border-blue-800/50",children:n.jsxs("div",{className:"max-w-full sm:max-w-3xl mx-auto flex items-center gap-2",children:[n.jsx("svg",{className:"w-4 h-4 text-blue-500 dark:text-blue-400 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2H7a2 2 0 00-2 2v2M9 11V7a3 3 0 016 0v4"})}),n.jsx("span",{className:"text-xs text-blue-700 dark:text-blue-300 flex-1 min-w-0",children:o&&o("compaction.banner_title")||"This session was compacted from a previous conversation."}),n.jsx("button",{type:"button",onClick:f,className:"text-xs font-medium text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-200 hover:underline focus:outline-none focus:underline transition-colors whitespace-nowrap flex-shrink-0",children:o&&o("compaction.view_original")||"View original"}),a?n.jsx("button",{type:"button",onClick:function(){i&&i(e)},className:"text-xs font-medium text-amber-600 dark:text-amber-400 hover:text-amber-800 dark:hover:text-amber-200 hover:underline focus:outline-none focus:underline transition-colors whitespace-nowrap flex-shrink-0",children:o&&o("chat.unpin_compacted")||"Unpin — go back to original"}):null,n.jsx("button",{type:"button",onClick:d,"aria-label":o&&o("compaction.dismiss")||"Dismiss",className:"text-blue-400 dark:text-blue-500 hover:text-blue-600 dark:hover:text-blue-300 flex-shrink-0 ml-1",children:n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})})}const Cf=["image/png","image/jpeg","image/jpg","image/gif","image/webp"],uR=["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"],dR=[...Cf,...uR],uf=5,a2=Math.floor(4*1024*1024/1.34),i2=5*1024*1024,s2=6*1024*1024,o2=Math.floor(4*1024*1024/1.34),EB=dR.join(",");function Qg(e){return e?Cf.indexOf(e.toLowerCase())!==-1:!1}var Zg,l2;function jB(){if(l2)return Zg;l2=1;class e{constructor(r){r||(r={}),this._sampleRate=r.sampleRate||16e3,this._capacity=Math.max(1,Math.round((r.maxDuration||30)*this._sampleRate)),this._buffer=new Float32Array(this._capacity),this._start=0,this._length=0,this._totalAppended=0}get capacity(){return this._capacity}get length(){return this._length}get totalAppended(){return this._totalAppended}get sampleRate(){return this._sampleRate}append(r){if(!r||!(r instanceof Float32Array))throw new TypeError("append() requires a Float32Array argument");const a=r.length;if(a===0)return;if(this._totalAppended+=a,a>=this._capacity){const u=a-this._capacity;this._buffer.set(r.subarray(u,a)),this._start=0,this._length=this._capacity;return}const i=(this._start+this._length)%this._capacity,o=Math.min(a,this._capacity-i);this._buffer.set(r.subarray(0,o),i),o<a&&this._buffer.set(r.subarray(o,a),0);const l=this._length+a;if(l<=this._capacity)this._length=l;else{const u=l-this._capacity;this._start=(this._start+u)%this._capacity,this._length=this._capacity}}read(r,a){if(typeof r!="number"||r<0)throw new RangeError("read() offset must be >= 0, got "+r);if(typeof a!="number"||a<0)throw new RangeError("read() count must be >= 0, got "+a);if(r>=this._length||a===0)return new Float32Array(0);const i=Math.min(a,this._length-r),o=new Float32Array(i),l=(this._start+r)%this._capacity,u=Math.min(i,this._capacity-l);return o.set(this._buffer.subarray(l,l+u),0),u<i&&o.set(this._buffer.subarray(0,i-u),u),o}trimBefore(r){(typeof r!="number"||r<0)&&(r=0),r>this._length&&(r=this._length),this._start=(this._start+r)%this._capacity,this._length-=r}clear(){this._start=0,this._length=0,this._totalAppended=0}}return Zg={AudioRingBuffer:e},Zg}var CB=jB(),Jg,c2;function TB(){if(c2)return Jg;c2=1;class e{constructor(r){r||(r={}),this._sampleRate=r.sampleRate||16e3,this._chunkSamples=Math.round((r.chunkDuration||10)*this._sampleRate),this._overlapSamples=Math.round((r.overlapDuration||3)*this._sampleRate),this._minChunkSamples=Math.round((r.minChunkDuration||3)*this._sampleRate),this._maxInitialPrompt=r.maxInitialPrompt||200,this.reset()}get slotIndex(){return this._slotIndex}get pendingNewSamples(){return this._pendingNewSamples}get inflight(){return this._inflight}appendAndSchedule(r){if(this._inflight)return null;const a=r.totalAppended-this._lastSlotEndTotalAppended;this._pendingNewSamples=Math.max(0,a);const i=this._slotIndex===0?this._minChunkSamples:this._chunkSamples;return this._pendingNewSamples<i?null:this._cutSlot(r)}reportResult(r){this._inflight&&(this._inflight=!1,this._prevText=r||"")}drain(r){if(this._inflight)return null;const a=r.totalAppended-this._lastSlotEndTotalAppended;return a<=0?null:this._cutSlot(r,a)}reset(){this._slotIndex=0,this._inflight=!1,this._pendingNewSamples=0,this._lastSlotEndTotalAppended=0,this._prevText="",this._drained=!1}clearPrevText(){this._prevText=""}_cutSlot(r,a){const i=this._slotIndex===0,o=r.totalAppended-r.length,l=i?0:Math.min(this._overlapSamples,Math.max(0,this._lastSlotEndTotalAppended-o)),u=a!=null?Math.min(a,r.totalAppended-this._lastSlotEndTotalAppended):Math.min(this._pendingNewSamples,r.totalAppended-this._lastSlotEndTotalAppended),d=l+u,f=Math.max(0,this._lastSlotEndTotalAppended-o-l),p=r.read(f,d);let h="";this._prevText.length>0&&(h=this._prevText.length>this._maxInitialPrompt?this._prevText.slice(-this._maxInitialPrompt):this._prevText);const m={audio: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 Jg={TranscriptionScheduler:e},Jg}var RB=TB(),eh,u2;function AB(){if(u2)return eh;u2=1;function e(r,a){const i=r.length,o=a.length;if(i===0)return o;if(o===0)return i;let l=new Array(o+1),u=new Array(o+1);for(let d=0;d<=o;d++)l[d]=d;for(let d=1;d<=i;d++){u[0]=d;for(let p=1;p<=o;p++){const h=r[d-1]===a[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(r,a,i){if(!r)return a||"";if(!a)return"";const o=i&&i.maxOverlapChars||50,l=i&&typeof i.maxEditRatio=="number"?i.maxEditRatio:.2,u=Math.min(o,r.length,a.length);for(let d=u;d>=1;d--){const f=r.slice(-d),p=a.slice(0,d);if(e(f,p)/d<=l)return a.slice(d)}return a}return eh={dedupOverlap:t,levenshtein:e},eh}var IB=AB();const ml=16e3;function Dd(e,t,r,a){try{const i=localStorage.getItem(e);if(i==null||i==="")return t;const o=Number(i);return Number.isFinite(o)?Math.min(a,Math.max(r,o)):t}catch{return t}}const MB=2,LB=.6,OB=1,DB=200,d2=3,th=2,PB=1e3,f2=.01,p2=800;function g2(e){if(!e||e.length===0)return 0;let t=0;for(let r=0;r<e.length;r++){const a=e[r];t+=a*a}return Math.sqrt(t/e.length)}function FB(e,t){const r=e.sampleRate,a=e.getChannelData(0);if(r===t)return new Float32Array(a);const i=r/t,o=Math.round(a.length/i),l=new Float32Array(o);for(let u=0;u<o;u+=1){const d=u*i,f=Math.floor(d),p=Math.min(f+1,a.length-1),h=d-f;l[u]=a[f]*(1-h)+a[p]*h}return l}function BB(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 zB({onTranscript:e,onError:t,onAutoSubmit:r,language:a,model:i}){const[o,l]=x.useState("idle"),[u,d]=x.useState(0),[f,p]=x.useState(null),[h,m]=x.useState(null),[y,v]=x.useState(""),k=x.useRef(null),_=x.useRef(null),w=x.useRef(null),N=x.useRef(null),E=x.useRef(!1),A=x.useRef(null),T=x.useRef(null),C=x.useRef(null),j=x.useRef(null),M=x.useRef(null),L=x.useRef(null),I=x.useRef(0),B=x.useRef(!1),z=x.useRef(""),ee=x.useRef(!1),V=x.useRef(null),D=x.useRef(p2),K=x.useRef(null),H=x.useRef(!1),J=x.useRef(""),ne=x.useRef(""),P=x.useRef("idle"),U=x.useCallback(Ze=>{P.current=Ze,l(Ze)},[]),X=x.useRef(e),F=x.useRef(t),Z=x.useRef(r),W=x.useRef(a),G=x.useRef(i);x.useEffect(()=>{X.current=e},[e]),x.useEffect(()=>{F.current=t},[t]),x.useEffect(()=>{Z.current=r},[r]),x.useEffect(()=>{W.current=a},[a]),x.useEffect(()=>{G.current=i},[i]),x.useEffect(()=>{j.current&&(P.current==="recording"||P.current==="paused")&&j.current.clearPrevText()},[a]);const oe=x.useCallback(()=>M.current?Promise.resolve(M.current):(L.current||(L.current=$b().then(Ze=>(M.current=Ze,Ze)).catch(()=>{const Ze={mode:"auto",backendAvailable:!1};return M.current=Ze,Ze})),L.current),[]);x.useEffect(()=>{oe()},[oe]);const Q=x.useCallback(()=>{if(A.current&&(A.current.getTracks().forEach(Ze=>Ze.stop()),A.current=null),K.current){try{K.current.readyState===WebSocket.OPEN&&K.current.send("Done"),K.current.close()}catch{}K.current=null}H.current=!1},[]),fe=x.useCallback(()=>{k.current&&(k.current.terminate(),k.current=null)},[]),ke=x.useCallback(()=>{const Ze=w.current,Oe=_.current,it=N.current;if(Ze){try{Ze.disconnect()}catch{}Ze.onaudioprocess=null,w.current=null}if(Oe){try{Oe.disconnect()}catch{}_.current=null}if(it){try{it.disconnect()}catch{}N.current=null}E.current=!1,Q(),T.current&&T.current.state!=="closed"&&(T.current.close().catch(()=>{}),T.current=null),fe(),C.current&&C.current.clear(),j.current&&j.current.reset(),I.current=0},[Q,fe]),Fe=x.useRef(null),Ve=x.useRef(null),Ge=x.useRef(null),qe=x.useRef(null),Ce=x.useRef(null),He=x.useRef(null);Fe.current=function(Oe){const it=Oe&&Oe.text||"";Oe&&Oe.chunkId;const me=j.current,Ee=Oe&&Oe._silent;me&&me.reportResult(it);const ge=IB.dedupOverlap(z.current,it);if(ge){const je=z.current+ge;z.current=je,v(je),X.current&&X.current(ge)}if(I.current=0,(Ee||it.trim()==="")&&z.current.trim()&&Z.current&&Z.current(),P.current==="draining"&&me&&!me.inflight){const je=C.current,se=me.drain(je);se?qe.current(se):He.current();return}Ge.current()},Ve.current=function(Oe){const it=j.current;if(it&&it.reportResult(""),I.current+=1,console.warn("[useContinuousVoiceInput] Chunk transcription error:",Oe,"("+I.current+"/"+d2+")"),I.current>=d2){ke(),U("idle"),F.current&&F.current("Voice transcription failed repeatedly. Please try again.");return}if(P.current==="draining"&&it&&!it.inflight){He.current();return}Ge.current()},Ge.current=function(){const Oe=j.current,it=C.current;if(!Oe||!it)return;const me=P.current;if(me!=="recording"&&me!=="paused"&&me!=="draining")return;const Ee=Oe.appendAndSchedule(it);if(Ee){qe.current(Ee);return}if((me==="paused"||me==="draining")&&!Oe.inflight){const ge=Oe.drain(it);ge?qe.current(ge):me==="draining"&&He.current()}},qe.current=async function(Oe){const it=g2(Oe.audio);if(it<f2){console.debug("[useContinuousVoiceInput] Skipping silent chunk (RMS="+it.toFixed(6)+")"),Fe.current({text:"",chunkId:Oe.chunkId,_silent:!0});return}const me=M.current||{mode:"auto",backendAvailable:!1},Ee=me.backendAvailable&&me.mode!=="local-only",ge=me.mode!=="backend-only",je=W.current,se=G.current;if(Ee&&!B.current){const dt=BB(Oe.audio,ml),lt={};Oe.initialPrompt&&(lt.initialPrompt=Oe.initialPrompt);let Lt=null;for(let ot=0;ot<=th;ot++)try{const et=await Q3(dt,je,se,lt);if(typeof et.text=="string"){m("backend"),Fe.current({text:et.text,chunkId:Oe.chunkId});return}}catch(et){Lt=et;const Ot=et.status;if((Ot===429||Ot===503)&&ot<th){const gr=PB*2**ot;console.warn("[useContinuousVoiceInput] Backend "+Ot+", retrying in "+gr+"ms (attempt "+(ot+1)+"/"+th+")"),await new Promise(dr=>{setTimeout(dr,gr)});continue}(Ot===429||Ot===503)&&(B.current=!0,console.warn("[useContinuousVoiceInput] Backend throttled (429/503), falling back to local for rest of recording"));break}if(!ge){Ve.current(Lt?Lt.message:"Backend transcription failed");return}console.warn("[useContinuousVoiceInput] Backend chunk failed, trying local:",Lt?Lt.message:"unknown")}if(!ge){Ve.current("Backend transcription is not available and local mode is disabled.");return}const De=Ce.current();m("local");const rt={type:"transcribe",audio:Oe.audio};je&&(rt.language=je),Oe.initialPrompt&&(rt.initialPrompt=Oe.initialPrompt),Oe.chunkId&&(rt.chunkId=Oe.chunkId),De.postMessage(rt,[Oe.audio.buffer])},Ce.current=function(){if(k.current)return k.current;const Oe=new Worker(new URL("/assets/whisper-worker-g42TWo_4.js",import.meta.url),{type:"module"});return Oe.onmessage=it=>{const me=it.data;if(me)switch(me.type){case"loading":d(me.progress||0),p(me.file?me.file.split("/").pop():null);break;case"ready":P.current==="loading"&&U("recording"),d(100),p(null);break;case"result":Fe.current(me);break;case"error":Ve.current(me.error||"Transcription failed");break}},Oe.onerror=()=>{const it=j.current;it&&it.reportResult(""),I.current+=1,fe();const me=new Worker(new URL("/assets/whisper-worker-g42TWo_4.js",import.meta.url),{type:"module"});me.onmessage=Ee=>{const ge=Ee.data;if(ge)switch(ge.type){case"loading":d(ge.progress||0),p(ge.file?ge.file.split("/").pop():null);break;case"ready":P.current==="loading"&&U("recording"),d(100),p(null),Ge.current();break;case"result":Fe.current(ge);break;case"error":Ve.current(ge.error||"Transcription failed");break}},me.onerror=()=>{me.terminate(),k.current=null,ke(),U("idle"),z.current="",v(""),F.current&&F.current("Voice transcription worker crashed.")},k.current=me},k.current=Oe,Oe},He.current=function(){const Oe=k.current;Oe&&Oe.postMessage({type:"unload"}),T.current&&T.current.state!=="closed"&&(T.current.close().catch(()=>{}),T.current=null),j.current&&j.current.reset(),C.current&&C.current.clear(),U("idle")};const ze=x.useCallback(async()=>{if(P.current==="idle"){if(!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 Ze=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,sampleRate:ml,echoCancellation:!0,noiseSuppression:!0}});A.current=Ze,M.current=null,L.current=null;const Oe=await oe(),it=!!(Oe.streaming&&Oe.streaming.wsUrl),me=!it&&(Oe.mode==="local-only"||!Oe.backendAvailable&&Oe.mode!=="backend-only"),Ee=window.AudioContext||window.webkitAudioContext;(!T.current||T.current.state==="closed")&&(T.current=new Ee);const ge=T.current;if(C.current=new CB.AudioRingBuffer({maxDuration:30,sampleRate:ml}),j.current=new RB.TranscriptionScheduler({chunkDuration:Dd("pave.asr.chunkDuration",MB,.5,30),overlapDuration:Dd("pave.asr.overlapDuration",LB,0,10),minChunkDuration:Dd("pave.asr.minChunkDuration",OB,.3,15),sampleRate:ml,maxInitialPrompt:DB}),z.current="",v(""),I.current=0,B.current=!1,ee.current=!1,V.current=null,D.current=Dd("pave.asr.vadSilenceMs",p2,200,5e3),J.current="",ne.current="",H.current=it,it){const dt=(lt,Lt)=>{if(!lt)return Lt;if(!Lt)return lt;const ot=/^[\u3000-\u303F\u4E00-\u9FFF\uFF00-\uFFEF]/.test(Lt),et=/\s$/.test(lt)||ot?"":" ";return lt+et+Lt};try{const lt=new WebSocket(Oe.streaming.wsUrl);lt.binaryType="arraybuffer",K.current=lt,lt.onmessage=Lt=>{let ot="";try{ot=typeof Lt.data=="string"?Lt.data:new TextDecoder().decode(Lt.data)}catch{return}if(ot==="Done!")return;let et="",Ot=!1;try{const dr=JSON.parse(ot);et=dr&&typeof dr.text=="string"?dr.text:"",Ot=!!(dr&&dr.is_final)}catch{et=ot}et=(et||"").trim();const gr=dt(J.current,et);gr&&gr!==ne.current&&(ne.current=gr,z.current=gr,v(gr),m("streaming"),X.current&&X.current(gr,{mode:"snapshot",engine:Oe.streaming&&Oe.streaming.engine||"paraformer"})),Ot&&et&&(Z.current?(J.current="",ne.current="",z.current="",v(""),Z.current()):J.current=dt(J.current,et))},lt.onerror=()=>{console.warn("[useContinuousVoiceInput] streaming WS error — falling back unavailable mid-session")}}catch(lt){console.warn("[useContinuousVoiceInput] streaming connect failed:",lt),H.current=!1}}const je=ge.createMediaStreamSource(Ze),De=ge.createScriptProcessor(4096,1,1),rt=ge.createGain();rt.gain.value=0,je.connect(De),De.connect(rt),rt.connect(ge.destination),_.current=je,w.current=De,N.current=rt,E.current=!1,De.onaudioprocess=dt=>{if(E.current)return;const lt=dt.inputBuffer,Lt=lt.sampleRate,ot=lt.getChannelData(0);let et;if(Lt===ml?et=new Float32Array(ot):et=FB({sampleRate:Lt,getChannelData:()=>ot},ml),et.length===0)return;if(H.current&&K.current&&K.current.readyState===WebSocket.OPEN){const or=new Float32Array(et.length);or.set(et),K.current.send(or.buffer);return}const Ot=C.current;Ot&&Ot.append(et);const gr=g2(et),dr=performance.now();if(gr>=f2)ee.current=!0,V.current=null;else if(ee.current){if(!V.current)V.current=dr;else if(dr-V.current>=D.current){ee.current=!1,V.current=null;const or=j.current;if(or&&!or.inflight&&Ot){const Qt=or.drain(Ot);Qt&&qe.current(Qt)}}}Ge.current()},me?(U("loading"),d(0),Ce.current().postMessage({type:"load"})):(U("recording"),d(100))}catch(Ze){Q(),U("idle");const Oe=Ze.name==="NotAllowedError"?"Microphone permission was denied. Please allow microphone access.":"Could not access microphone: "+(Ze.message||String(Ze));F.current&&F.current(Oe)}}},[oe,Q]),gt=x.useCallback(()=>{const Ze=P.current;if(Ze==="loading"){ke(),fe(),U("idle");return}if(Ze!=="recording"&&Ze!=="paused")return;const Oe=w.current,it=_.current,me=N.current;if(Oe){try{Oe.disconnect()}catch{}Oe.onaudioprocess=null,w.current=null}if(it){try{it.disconnect()}catch{}_.current=null}if(me){try{me.disconnect()}catch{}N.current=null}Q(),U("draining"),setTimeout(()=>{const Ee=j.current,ge=C.current;if(!Ee||!ge){He.current();return}if(!Ee.inflight){const je=Ee.drain(ge);je?qe.current(je):He.current()}},0)},[Q,ke,fe]),mt=x.useCallback(()=>{P.current==="recording"&&(E.current=!0,U("paused"),Ge.current())},[]),wt=x.useCallback(()=>{P.current==="paused"&&(E.current=!1,U("recording"))},[]),$e=x.useCallback(()=>{P.current!=="idle"&&(ke(),fe(),z.current="",v(""),U("idle"))},[ke,fe]),Et=x.useCallback(()=>{if(P.current!=="idle"){F.current&&F.current("Cannot clear cache while recording.");return}U("loading"),d(0),fe(),Ce.current().postMessage({type:"clearCache"})},[fe]);return x.useEffect(()=>()=>{ke(),fe()},[ke,fe]),{state:o,progress:u,downloadingFile:f,transcriptionSource:h,transcriptText:y,startRecording:ze,stopRecording:gt,pauseRecording:mt,resumeRecording:wt,cancelRecording:$e,clearModelCache:Et}}function UB({skills:e,builtins:t,filter:r,onSelect:a,visible:i,selectedIndex:o,activeSkill:l,onBack:u}){const{t:d}=Jt(),f=x.useRef(null),p=x.useRef(null);if(x.useEffect(()=>{f.current&&f.current.scrollIntoView({block:"nearest"})},[o,l,r,e.length]),!i)return null;const h=(r||"").trim().toLowerCase();let m=[],y=!1;if(l){y=!0;const v=e.find(_=>_.skill===l);m=(v&&v.commands||[]).filter(_=>h?(_.name||"").toLowerCase().includes(h)||(_.description||"").toLowerCase().includes(h):!0).map(_=>({type:"command",skill:l,name:_.name,description:_.description}))}else{const v=(t||[]).filter(_=>h?(_.name||"").toLowerCase().includes(h)||(_.description||"").toLowerCase().includes(h):!0).map(_=>({type:"builtin",name:_.name,description:_.description})),k=e.filter(_=>h?(_.skill||"").toLowerCase().includes(h)||(_.description||"").toLowerCase().includes(h)||(_.commands||[]).some(w=>(w.name||"").toLowerCase().includes(h)||(w.description||"").toLowerCase().includes(h)):!0).map(_=>({type:"skill",skill:_.skill,description:_.description,commandCount:(_.commands||[]).length,configured:_.configured}));m=v.concat(k)}return n.jsxs("div",{className:"absolute bottom-full left-0 right-0 mb-1 bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg overflow-hidden z-50 flex flex-col",style:{maxHeight:"40vh"},children:[n.jsxs("div",{className:"flex-shrink-0 flex items-center gap-2 px-3 py-2 border-b border-gray-100 dark:border-gray-800 text-xs text-gray-500 dark:text-gray-400",role:"presentation",children:[y&&n.jsxs("button",{type:"button",onClick:u,className:"flex items-center gap-1 hover:text-gray-700 dark:hover:text-gray-200 transition-colors","aria-label":d("slashCommand.back"),children:[n.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})}),d("slashCommand.skills")]}),n.jsx("span",{className:"flex-1 text-right",children:y?l+" "+d("slashCommand.commands"):d("slashCommand.title")})]}),n.jsx("div",{ref: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?n.jsx("div",{className:"px-3 py-4 text-sm text-gray-400 dark:text-gray-500 text-center",children:d("slashCommand.noResults")}):m.map((v,k)=>{const _=k===o,w="slash-item-"+k;return n.jsx("div",{id:w,ref:_?f:null,role:"option","aria-selected":_,onClick:()=>{v.type==="skill"?a(v.skill,null):v.type==="builtin"?a("__builtin__",v.name):a(v.skill,v.name)},className:"flex items-center gap-3 px-3 py-2 cursor-pointer text-sm transition-colors "+(_?"bg-accent-50 dark:bg-accent-900/30 text-accent-700 dark:text-accent-300":"hover:bg-gray-50 dark:hover:bg-gray-800 text-gray-700 dark:text-gray-300"),children:v.type==="builtin"?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"flex-shrink-0 w-6 h-6 rounded bg-accent-100 dark:bg-accent-900/40 flex items-center justify-center",children:n.jsx("svg",{className:"w-3.5 h-3.5 text-accent-600 dark:text-accent-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("span",{className:"font-medium",children:["/",v.name]}),n.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:"built-in"})]}),v.description&&n.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 truncate",children:v.description})]})]}):v.type==="skill"?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"flex-shrink-0 w-6 h-6 rounded bg-gray-100 dark:bg-gray-800 flex items-center justify-center text-xs font-medium text-gray-500 dark:text-gray-400",children:(v.skill||"?")[0].toUpperCase()}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"font-medium truncate",children:v.skill}),!v.configured&&n.jsx("span",{className:"text-xs text-yellow-600 dark:text-yellow-400",children:d("slashCommand.notConfigured")})]}),v.description&&n.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 truncate",children:v.description})]}),n.jsxs("div",{className:"flex-shrink-0 text-xs text-gray-400 dark:text-gray-500",children:[v.commandCount," ",v.commandCount===1?d("slashCommand.command"):d("slashCommand.commands")]}),n.jsx("svg",{className:"w-4 h-4 text-gray-400 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"flex-shrink-0 w-6 h-6 rounded bg-accent-100 dark:bg-accent-900/40 flex items-center justify-center",children:n.jsx("svg",{className:"w-3.5 h-3.5 text-accent-600 dark:text-accent-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("span",{className:"font-medium",children:["/",l," ",v.name]}),v.description&&n.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 truncate",children:v.description})]})]})},v.type+"-"+(v.skill||"_")+"-"+(v.name||""))})}),n.jsxs("div",{className:"flex-shrink-0 px-3 py-1.5 border-t border-gray-100 dark:border-gray-800 text-xs text-gray-400 dark:text-gray-500 flex gap-3",role:"presentation",children:[n.jsxs("span",{children:[n.jsx("kbd",{className:"px-1 py-0.5 bg-gray-100 dark:bg-gray-800 rounded text-xs",children:"↑↓"})," ",d("slashCommand.navigate")]}),n.jsxs("span",{children:[n.jsx("kbd",{className:"px-1 py-0.5 bg-gray-100 dark:bg-gray-800 rounded text-xs",children:"Enter"})," ",d("slashCommand.select")]}),n.jsxs("span",{children:[n.jsx("kbd",{className:"px-1 py-0.5 bg-gray-100 dark:bg-gray-800 rounded text-xs",children:"Esc"})," ",d("slashCommand.close")]})]})]})}const Jd=[{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 qB(){return Jd.slice()}function HB(e){if(!e)return null;const t=String(e).toLowerCase();for(let r=0;r<Jd.length;r++)if(Jd[r].name===t)return Jd[r];return null}function $B(e){if(typeof e!="string")return null;const t=e.trim();if(!t.startsWith("/"))return null;const r=t.match(/^\/([a-zA-Z0-9_-]+)(?:\s+([\s\S]*))?$/);if(!r)return null;const a=r[1].toLowerCase(),i=HB(a);if(!i)return null;const o=(r[2]||"").trim();return{name:a,args:o,builtin:i}}const WB=x.forwardRef(function({onSend:t,onAbort:r,isBusy:a,disabled:i,sessionId:o,queuedCount:l=0,onBuiltinCommand:u},d){const{t:f}=Jt(),[p,h]=x.useState(""),[m,y]=x.useState([]),[v,k]=x.useState(!1);x.useEffect(()=>{const re=()=>k(!1);return window.addEventListener("pave:plan-execute",re),()=>window.removeEventListener("pave:plan-execute",re)},[]);const[_,w]=x.useState(null),[N,E]=x.useState([]),[A,T]=x.useState(""),[C,j]=x.useState(!1),M=x.useRef(null),L=x.useRef([]),[I,B]=x.useState(-1),z="pave-asr-language",ee=[{code:"auto",label:"Auto"},{code:"en",label:"English"},{code:"yue",label:"粵語"},{code:"zh",label:"普通話"},{code:"ja",label:"日本語"},{code:"ko",label:"한국어"},{code:"es",label:"Español"},{code:"fr",label:"Français"},{code:"de",label:"Deutsch"},{code:"fi",label:"Suomi"}],[V,D]=x.useState(()=>{try{return localStorage.getItem(z)||"auto"}catch{return"auto"}}),[K,H]=x.useState(!1),J=x.useRef(null),ne=[{code:"whisper",label:"Whisper"},{code:"paraformer",label:"Paraformer"}],[P,U]=x.useState("whisper"),[X,F]=x.useState(!1),Z=x.useRef(null),W=x.useRef(m),G=x.useRef(null),oe=x.useRef(null),Q=x.useRef(null),fe=x.useRef(o),ke=x.useRef(p),Fe=x.useRef(null),[Ve,Ge]=x.useState(!1),[qe,Ce]=x.useState(""),[He,ze]=x.useState([]),[gt,mt]=x.useState(0),[wt,$e]=x.useState(null),Et=x.useRef({data:null,time:0}),Ze=6e4,Oe=x.useCallback(re=>{w(re),Fe.current&&clearTimeout(Fe.current),Fe.current=setTimeout(()=>w(null),5e3)},[]);x.useEffect(()=>()=>{Fe.current&&clearTimeout(Fe.current)},[]),x.useLayoutEffect(()=>{ke.current=p},[p]),x.useLayoutEffect(()=>{fe.current=o,Q.current&&(clearTimeout(Q.current),Q.current=null);let re="";if(o)try{re=localStorage.getItem(Rs+o)||""}catch{}return h(re),ke.current=re,y(ve=>(ve.forEach(Re=>{Re.preview&&URL.revokeObjectURL(Re.preview)}),[])),()=>{Q.current&&(clearTimeout(Q.current),Q.current=null);const ve=fe.current;if(ve)try{ke.current?localStorage.setItem(Rs+ve,ke.current):localStorage.removeItem(Rs+ve)}catch{}}},[o]),x.useEffect(()=>{fe.current&&(Q.current&&clearTimeout(Q.current),Q.current=setTimeout(()=>{try{p?localStorage.setItem(Rs+fe.current,p):localStorage.removeItem(Rs+fe.current)}catch{}},300))},[p]);const it=x.useCallback(async()=>{const re=Et.current;if(re.data&&Date.now()-re.time<Ze){ze(re.data);return}try{const ve=await N3(),Re=Array.isArray(ve)?ve:[];Et.current={data:Re,time:Date.now()},ze(Re)}catch{ze([])}},[]),me=x.useMemo(()=>qB(),[]),Ee=x.useMemo(()=>{const re=(qe||"").trim().toLowerCase();if(wt){const ie=He.find(ft=>ft.skill===wt);return(ie&&ie.commands||[]).filter(ft=>re?(ft.name||"").toLowerCase().includes(re)||(ft.description||"").toLowerCase().includes(re):!0).map(ft=>({type:"command",skill:wt,name:ft.name}))}const ve=me.filter(ie=>re?(ie.name||"").toLowerCase().includes(re)||(ie.description||"").toLowerCase().includes(re):!0).map(ie=>({type:"builtin",name:ie.name})),Re=He.filter(ie=>re?(ie.skill||"").toLowerCase().includes(re)||(ie.description||"").toLowerCase().includes(re)||(ie.commands||[]).some(Rt=>(Rt.name||"").toLowerCase().includes(re)||(Rt.description||"").toLowerCase().includes(re)):!0).map(ie=>({type:"skill",skill:ie.skill}));return ve.concat(Re)},[qe,wt,He,me]),ge=x.useCallback(()=>Ee.length,[Ee]),je=x.useCallback(re=>{if(h(re),ke.current=re,re.startsWith("/")){const ve=re.slice(1),Re=ve.split(/\s/)[0]||"";if(!Re.includes("/")&&!Re.includes(".")){if(wt){const ie=wt+" ";ve.startsWith(ie)?(Ce(ve.slice(ie.length)),mt(0)):($e(null),Ce(ve),mt(0))}else Ce(ve),mt(0);Ve||(it(),Ge(!0),mt(0))}else Ge(!1),Ce(""),$e(null),mt(0)}else Ge(!1),Ce(""),$e(null),mt(0)},[Ve,wt,it]),se=x.useCallback((re,ve)=>{var Re,ie,Rt;if(re==="__builtin__"&&ve){h("/"+ve+" "),Ge(!1),Ce(""),$e(null),mt(0),(Re=G.current)==null||Re.focus();return}if(!ve)$e(re),Ce(""),mt(0),h("/"+re+" "),(ie=G.current)==null||ie.focus();else{const ft="/"+re+" "+ve+" ";h(ft),Ge(!1),Ce(""),$e(null),mt(0),(Rt=G.current)==null||Rt.focus()}},[]),De=x.useCallback(()=>{var re;$e(null),Ce(""),mt(0),h("/"),(re=G.current)==null||re.focus()},[]),rt=x.useRef(""),dt=x.useCallback((re,ve)=>{if(ve&&ve.mode==="snapshot"){const Re=rt.current||"",ie=Re&&!Re.endsWith(" ")&&!Re.endsWith(`
102
+ `)?" ":"";h(Re+ie+(re||""));return}h(Re=>{const ie=Re&&!Re.endsWith(" ")&&!Re.endsWith(`
103
+ `)?" ":"";return Re+ie+re})},[]),lt=x.useRef(null),Lt=x.useCallback(()=>{rt.current="",setTimeout(()=>{lt.current&&lt.current()},50)},[]),{state:ot,progress:et,downloadingFile:Ot,startRecording:gr,stopRecording:dr,resumeRecording:or,cancelRecording:Qt}=zB({onTranscript:dt,onError:Oe,onAutoSubmit:Lt,model:A||void 0,language:V&&V!=="auto"?V:void 0}),$r=x.useCallback(()=>(h(re=>(rt.current=re||"",re)),gr()),[gr]);x.useEffect(()=>{try{V&&localStorage.setItem(z,V)}catch{}},[V]),x.useEffect(()=>{if(!K)return;const re=ve=>{J.current&&!J.current.contains(ve.target)&&H(!1)};return document.addEventListener("mousedown",re),()=>document.removeEventListener("mousedown",re)},[K]),x.useEffect(()=>{let re=!1;return $b().then(ve=>{re||(ve&&Array.isArray(ve.models)&&ve.models.length>0&&(E(ve.models),T(Re=>Re||ve.models[0].name)),ve&&(ve.preferredEngine==="whisper"||ve.preferredEngine==="paraformer")&&U(ve.preferredEngine))}).catch(()=>{}),()=>{re=!0}},[$b]),x.useEffect(()=>{if(!X)return;const re=ve=>{Z.current&&!Z.current.contains(ve.target)&&F(!1)};return document.addEventListener("mousedown",re),()=>document.removeEventListener("mousedown",re)},[X]);const ue=x.useCallback(re=>{F(!1),U(ve=>ve===re?ve:(Z3(re).then(()=>{re==="paraformer"&&Oe("Paraformer selected — the streaming engine is starting (first use downloads ~1 GB).")}).catch(()=>{U(ve),Oe("Could not switch the speech engine — is the server reachable?")}),re))},[Oe]);x.useEffect(()=>{if(!C){B(-1);return}L.current.length=N.length;function re(Re){M.current&&!M.current.contains(Re.target)&&j(!1)}function ve(Re){if(Re.key==="Escape"){j(!1);return}Re.key!=="ArrowDown"&&Re.key!=="ArrowUp"&&Re.key!=="Home"&&Re.key!=="End"||(Re.preventDefault(),B(ie=>{const Rt=L.current.length;if(!Rt)return ie;const ft=typeof ie=="number"?ie:-1;let Ut=ft;return Re.key==="ArrowDown"?Ut=ft<Rt-1?ft+1:0:Re.key==="ArrowUp"?Ut=ft>0?ft-1:Rt-1:Re.key==="Home"?Ut=0:Re.key==="End"&&(Ut=Rt-1),L.current[Ut]&&L.current[Ut].focus(),Ut}))}return document.addEventListener("mousedown",re),document.addEventListener("keydown",ve),()=>{document.removeEventListener("mousedown",re),document.removeEventListener("keydown",ve)}},[C,N.length]),x.useEffect(()=>{const re=G.current;re&&(re.style.height="auto",re.style.height=Math.min(re.scrollHeight,200)+"px")},[p]),x.useEffect(()=>{W.current=m},[m]),x.useEffect(()=>{var re;(re=G.current)==null||re.focus()},[]),x.useImperativeHandle(d,()=>({focus:()=>{var re;(re=G.current)==null||re.focus()},setText:re=>{h(typeof re=="string"?re:""),requestAnimationFrame(()=>{var ve;return(ve=G.current)==null?void 0:ve.focus()})}}),[]);const Le=async()=>{const re=p.trim();var ve=m.filter(function(ft){return Qg(ft.type)}),Re=m.filter(function(ft){return!Qg(ft.type)});const ie=$B(re);if(ie&&typeof u=="function"){const ft=fe.current;try{await u(ie.name,ie.args,{imageAttachments:ve.length>0?ve:void 0,fileAttachments:Re.length>0?Re:void 0})}catch{return}if(h(""),Ge(!1),Ce(""),$e(null),mt(0),ft)try{localStorage.removeItem(Rs+ft)}catch{}m.forEach(function(Ut){Ut.preview&&URL.revokeObjectURL(Ut.preview)}),y([]),G.current&&(G.current.style.height="auto");return}if(!re&&ve.length===0&&Re.length===0)return;const Rt=fe.current;try{await t(re,ve.length>0?ve:void 0,v?"plan":void 0,Re.length>0?Re:void 0)}catch{return}if(h(""),Ge(!1),Ce(""),$e(null),mt(0),Rt)try{localStorage.removeItem(Rs+Rt)}catch{}m.forEach(function(ft){ft.preview&&URL.revokeObjectURL(ft.preview)}),y([]),G.current&&(G.current.style.height="auto")};lt.current=Le;const ct=re=>{if(Ve){const ve=ge();if(re.key==="ArrowDown"){ve>0&&(re.preventDefault(),mt(Re=>(Re+1)%ve));return}if(re.key==="ArrowUp"){ve>0&&(re.preventDefault(),mt(Re=>(Re-1+ve)%ve));return}if(re.key==="Enter"||re.key==="Tab"){if(ve>0){re.preventDefault();const Re=Ee[gt];Re&&(Re.type==="command"?se(Re.skill,Re.name):Re.type==="builtin"?se("__builtin__",Re.name):se(Re.skill,null));return}if(re.key==="Tab"){Ge(!1),Ce(""),$e(null),mt(0);return}}if(re.key==="Escape"){re.preventDefault(),Ge(!1),Ce(""),$e(null),mt(0);return}if(re.key==="Backspace"&&wt){const Re=p.slice(1),ie=wt+" ";if(Re===ie||Re===wt){re.preventDefault(),De();return}}}re.key==="Enter"&&!re.shiftKey&&(re.preventDefault(),Le())},Be=re=>{if(!i){var ve=re.clipboardData&&re.clipboardData.items;if(ve){for(var Re=[],ie=0;ie<ve.length;ie++){var Rt=(ve[ie].type||"").toLowerCase();if(Cf.indexOf(Rt)!==-1){var ft=ve[ie].getAsFile();ft&&Re.push(ft)}}if(Re.length!==0){for(var Ut=!1,Me=0;Me<ve.length;Me++)if(ve[Me].type&&ve[Me].type.startsWith("text/")){Ut=!0;break}Ut||re.preventDefault();var Tt=Re.map(function(tr){return{id:Date.now()+"-"+Math.random().toString(36).slice(2,8),file:tr,name:tr.name||"pasted-image.png",size:tr.size,type:tr.type,preview:null}});y(function(tr){var rn=uf-tr.length;if(rn<=0)return tr;for(var hn=Tt.slice(0,rn),mn=0;mn<hn.length;mn++)hn[mn].preview=URL.createObjectURL(hn[mn].file);return tr.concat(hn)})}}}},nt=re=>{const ve=Array.from(re.target.files||[]);if(ve.length===0)return;const Re=ve.filter(Rt=>dR.indexOf(Rt.type)!==-1);if(Re.length===0){re.target.value="";return}const ie=Re.map(Rt=>({id:Date.now()+"-"+Math.random().toString(36).slice(2,8),file:Rt,name:Rt.name,size:Rt.size,type:Rt.type,preview:null}));y(Rt=>{var ft=uf-Rt.length;if(ft<=0)return Rt;for(var Ut=ie.slice(0,ft),Me=0;Me<Ut.length;Me++)Ut[Me].preview=Qg(Ut[Me].file.type)?URL.createObjectURL(Ut[Me].file):null;return[...Rt,...Ut]}),re.target.value=""},kt=re=>{y(ve=>{const Re=ve.find(ie=>ie.id===re);return Re!=null&&Re.preview&&URL.revokeObjectURL(Re.preview),ve.filter(ie=>ie.id!==re)})},at=re=>re<1024?re+" B":re<1024*1024?(re/1024).toFixed(1)+" KB":(re/(1024*1024)).toFixed(1)+" MB";return x.useEffect(()=>()=>{W.current.forEach(re=>{re.preview&&URL.revokeObjectURL(re.preview)})},[]),n.jsx("div",{className:"border-t border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-950 px-2 sm:px-4 py-3",children:n.jsxs("div",{className:"max-w-full sm:max-w-3xl mx-auto",children:[v&&n.jsxs("div",{className:"flex items-center gap-2 mb-2 px-3 py-1.5 bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-lg text-xs text-amber-700 dark:text-amber-300",children:[n.jsx("svg",{className:"w-3.5 h-3.5 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"})}),n.jsx("span",{children:"Plan mode -- read-only. The agent will analyze and plan without making changes."})]}),m.length>0&&n.jsx("div",{className:"flex flex-wrap gap-2 mb-2 overflow-hidden",children:m.map(re=>n.jsxs("div",{className:"relative group flex items-center gap-2 bg-gray-100 dark:bg-gray-800 rounded-lg px-3 py-2 text-sm",children:[re.preview?n.jsx("img",{src:re.preview,alt:re.name,className:"w-10 h-10 rounded object-cover"}):n.jsx("svg",{className:"w-5 h-5 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})}),n.jsxs("div",{className:"min-w-0",children:[n.jsx("p",{className:"text-xs text-gray-700 dark:text-gray-300 truncate max-w-[120px]",children:re.name}),n.jsx("p",{className:"text-xs text-gray-400",children:at(re.size)})]}),n.jsx("button",{onClick:()=>kt(re.id),"aria-label":`Remove attachment ${re.name||""}`,className:"absolute -top-1.5 -right-1.5 w-5 h-5 rounded-full bg-gray-500 hover:bg-red-500 text-white flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:n.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]},re.id))}),n.jsxs("div",{className:"relative flex flex-col sm:flex-row sm:items-end gap-1 sm:gap-2 bg-gray-100 dark:bg-gray-800 rounded-2xl px-3 py-2",children:[n.jsx(UB,{skills:He,builtins:me,filter:qe,onSelect:se,visible:Ve,selectedIndex:gt,activeSkill:wt,onBack:De}),n.jsxs("div",{className:"order-2 sm:order-none flex items-center gap-1 flex-wrap sm:flex-nowrap relative",children:[n.jsx("button",{onClick:()=>{var re;return(re=oe.current)==null?void 0:re.click()},disabled:i||a,className:"flex-shrink-0 w-8 h-8 rounded-full hover:bg-gray-200 dark:hover:bg-gray-700 disabled:opacity-40 flex items-center justify-center transition-colors text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200",title:f("chat.attach_file"),"aria-label":f("chat.attach_file"),children:n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M18.375 12.739l-7.693 7.693a4.5 4.5 0 01-6.364-6.364l10.94-10.94A3 3 0 1119.5 7.372L8.552 18.32m.009-.01l-.01.01m5.699-9.941l-7.81 7.81a1.5 1.5 0 002.112 2.13"})})}),n.jsx("input",{ref:oe,type:"file",multiple:!0,accept:EB,onChange:nt,className:"hidden"}),n.jsx("button",{onClick:ot==="recording"?dr:ot==="paused"?or:ot==="loading"?Qt:$r,disabled:ot==="draining"||(i||a)&&ot!=="recording"&&ot!=="loading"&&ot!=="paused",className:"flex-shrink-0 w-8 h-8 rounded-full flex items-center justify-center transition-colors "+(ot==="recording"?"bg-red-500 hover:bg-red-600 text-white animate-pulse":ot==="paused"?"bg-yellow-500 hover:bg-yellow-600 text-white":ot==="loading"||ot==="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:ot==="recording"?f("voice.stop_recording")||"Stop recording":ot==="paused"?f("voice.resume_recording")||"Resume recording":ot==="loading"?f("voice.loading_model"):ot==="draining"?f("voice.processing")||"Processing remaining audio":f("voice.start_recording"),"aria-label":ot==="recording"?f("voice.stop_recording")||"Stop recording":ot==="paused"?f("voice.resume_recording")||"Resume recording":ot==="loading"?f("voice.loading_model"):ot==="draining"?f("voice.processing")||"Processing remaining audio":f("voice.start_recording"),children:ot==="draining"?n.jsxs("svg",{className:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[n.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),n.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):ot==="loading"?n.jsxs("svg",{className:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[n.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),n.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):ot==="recording"?n.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24",children:n.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})}):ot==="paused"?n.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24",children:n.jsx("circle",{cx:"12",cy:"12",r:"6"})}):n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 18.75a6 6 0 006-6v-1.5m-6 7.5a6 6 0 01-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 01-3-3V4.5a3 3 0 116 0v8.25a3 3 0 01-3 3z"})})}),ot==="loading"&&n.jsxs("div",{className:"absolute -top-6 left-1/2 -translate-x-1/2 bg-gray-800 dark:bg-gray-700 text-white text-xs px-2 py-1 rounded shadow whitespace-nowrap flex items-center gap-2",children:[n.jsx("div",{className:"w-16 h-1.5 bg-gray-600 rounded-full overflow-hidden",children:n.jsx("div",{className:"h-full bg-primary-400 transition-all duration-300",style:{width:`${et}%`}})}),n.jsx("span",{children:Ot?`${Ot} ${et}%`:`${et}%`})]}),P==="whisper"&&n.jsxs("div",{className:"relative flex-shrink-0",ref:J,children:[n.jsxs("button",{onClick:()=>H(re=>!re),disabled:ot==="recording"||ot==="draining",className:"h-8 px-2 rounded-full flex items-center justify-center gap-1 transition-colors text-xs font-medium hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 disabled:opacity-40 disabled:cursor-not-allowed",title:"Speech recognition language","aria-label":"Select speech recognition language","aria-haspopup":"menu","aria-expanded":K,children:[n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 21l5.25-11.25L21 21m-9-3h7.5M3 5.621a48.474 48.474 0 016-.371m0 0c1.12 0 2.233.038 3.334.114M9 5.25V3m3.334 2.364C11.176 10.658 7.69 15.08 3 17.502m9.334-12.138c.896.061 1.785.147 2.666.257m-4.589 8.495a18.023 18.023 0 01-3.827-5.802"})}),n.jsx("span",{className:"max-w-[80px] truncate",children:(ee.find(re=>re.code===V)||ee[0]).label}),n.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 8.25l-7.5 7.5-7.5-7.5"})})]}),K&&n.jsx("div",{className:"absolute bottom-full mb-1 left-0 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg py-1 min-w-[180px] max-h-64 overflow-y-auto z-50",role:"menu","aria-label":"Speech recognition language",children:ee.map(re=>n.jsx("button",{role:"menuitemradio","aria-checked":re.code===V,onClick:()=>{D(re.code),H(!1),re.code==="yue"&&Oe("Cantonese requires whisper-small or larger. If transcription is poor, this device may be using the tiny model (Safari, or older cached version).")},className:"w-full text-left px-3 py-1.5 text-xs transition-colors "+(re.code===V?"bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 font-medium":"text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"),children:re.label},re.code))})]}),n.jsxs("div",{className:"relative flex-shrink-0",ref:Z,children:[n.jsxs("button",{onClick:()=>F(re=>!re),disabled:ot==="recording"||ot==="draining",className:"h-8 px-2 rounded-full flex items-center justify-center gap-1 transition-colors text-xs font-medium hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 disabled:opacity-40 disabled:cursor-not-allowed",title:"Speech recognition engine","aria-label":"Select speech recognition engine","aria-haspopup":"menu","aria-expanded":X,children:[n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.348 14.652a3.75 3.75 0 010-5.304m5.304 0a3.75 3.75 0 010 5.304m-7.425 2.121a6.75 6.75 0 010-9.546m9.546 0a6.75 6.75 0 010 9.546M5.106 18.894c-3.808-3.807-3.808-9.98 0-13.788m13.788 0c3.808 3.807 3.808 9.98 0 13.788M12 12h.008v.008H12V12zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z"})}),n.jsx("span",{className:"max-w-[90px] truncate",children:(ne.find(re=>re.code===P)||ne[0]).label}),n.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 8.25l-7.5 7.5-7.5-7.5"})})]}),X&&n.jsx("div",{className:"absolute bottom-full mb-1 left-0 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg py-1 min-w-[200px] z-50",role:"menu","aria-label":"Speech recognition engine",children:ne.map(re=>n.jsxs("button",{role:"menuitemradio","aria-checked":re.code===P,onClick:()=>ue(re.code),className:"w-full text-left px-3 py-1.5 text-xs transition-colors "+(re.code===P?"bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 font-medium":"text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"),children:[n.jsx("div",{children:re.label}),n.jsx("div",{className:"text-[10px] text-gray-400 dark:text-gray-500",children:re.code==="whisper"?"Batch · all languages (default)":"Live streaming · 中文/粵語/English"})]},re.code))})]}),P==="whisper"&&N.length>1&&n.jsxs("div",{className:"relative flex-shrink-0",ref:M,children:[n.jsxs("button",{onClick:()=>j(re=>!re),disabled:ot==="recording"||ot==="draining",className:"h-8 px-2 rounded-full flex items-center justify-center gap-1 transition-colors text-xs font-medium hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 disabled:opacity-40 disabled:cursor-not-allowed",title:f("voice.select_asr_model"),"aria-label":f("voice.select_asr_model"),"aria-haspopup":"menu","aria-expanded":C,children:[n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09z"})}),n.jsx("span",{className:"max-w-[80px] truncate",children:(N.find(re=>re.name===A)||N[0]).label}),n.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 8.25l-7.5 7.5-7.5-7.5"})})]}),C&&n.jsx("div",{className:"absolute bottom-full mb-1 left-0 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg py-1 min-w-[160px] z-50",role:"menu","aria-label":f("voice.select_asr_model"),children:N.map((re,ve)=>n.jsxs("button",{ref:Re=>{L.current[ve]=Re},role:"menuitemradio","aria-checked":re.name===A,tabIndex:I===ve?0:-1,onClick:()=>{T(re.name),j(!1)},className:"w-full text-left px-3 py-1.5 text-xs transition-colors "+(re.name===A?"bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 font-medium":"text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"),children:[re.label,re.type!=="openai"&&n.jsxs("span",{className:"ml-1 text-gray-400 dark:text-gray-500",children:["(",re.type,")"]})]},`${re.name}-${ve}`))})]}),n.jsxs("button",{onClick:()=>k(re=>!re),disabled:i||a,className:"flex-shrink-0 h-8 px-2 rounded-full flex items-center justify-center gap-1 transition-colors text-xs font-medium "+(v?"bg-amber-100 dark:bg-amber-900/40 text-amber-700 dark:text-amber-300 ring-1 ring-amber-300 dark:ring-amber-700":"hover:bg-gray-200 dark:hover:bg-gray-700 disabled:opacity-40 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200"),title:v?"Plan mode active (read-only) — click to switch to build":"Switch to plan mode (read-only)","aria-label":v?"Disable plan mode":"Enable plan mode","aria-pressed":v,children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12h3.75M9 15h3.75M9 18h3.75m3 .75H18a2.25 2.25 0 002.25-2.25V6.108c0-1.135-.845-2.098-1.976-2.192a48.424 48.424 0 00-1.123-.08m-5.801 0c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 00.75-.75 2.25 2.25 0 00-.1-.664m-5.8 0A2.251 2.251 0 0113.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m0 0H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V9.375c0-.621-.504-1.125-1.125-1.125H8.25zM6.75 12h.008v.008H6.75V12zm0 3h.008v.008H6.75V15zm0 3h.008v.008H6.75V18z"})}),v?"Plan":""]})]}),n.jsxs("div",{className:"order-1 sm:order-none flex items-end gap-2 flex-1 min-w-0",children:[n.jsx("textarea",{ref:G,value:p,onChange:re=>je(re.target.value),onKeyDown:ct,onPaste:Be,placeholder:f("chat.send_placeholder"),disabled:i,rows:1,role:Ve?"combobox":void 0,"aria-controls":Ve?"slash-command-listbox":void 0,"aria-activedescendant":Ve&&ge()>0?"slash-item-"+gt:void 0,"aria-expanded":Ve||void 0,className:"flex-1 bg-transparent resize-none outline-none text-sm py-1.5 min-h-[32px] text-gray-900 dark:text-gray-100 placeholder-gray-400 dark:placeholder-gray-500 max-h-[200px]"}),a&&n.jsx("button",{onClick:r,className:"flex-shrink-0 w-8 h-8 rounded-full bg-red-500 hover:bg-red-600 flex items-center justify-center transition-colors",title:f("chat.stop_generating"),"aria-label":f("chat.stop_generating"),children:n.jsx("svg",{className:"w-3.5 h-3.5 text-white",fill:"currentColor",viewBox:"0 0 24 24",children:n.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})}),n.jsxs("button",{onClick:Le,disabled:!p.trim()&&m.length===0||i,className:"relative flex-shrink-0 w-8 h-8 rounded-full bg-accent-400 hover:bg-accent-500 disabled:bg-gray-300 dark:disabled:bg-gray-600 flex items-center justify-center transition-colors",title:a?"Queue message (will send when current finishes)":f("chat.send_button"),"aria-label":a?"Queue message":f("chat.send_button"),"aria-disabled":!p.trim()&&m.length===0||i?"true":void 0,children:[n.jsx("svg",{className:"w-4 h-4 text-gray-900",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 12h14M12 5l7 7-7 7"})}),l>0&&n.jsx("span",{className:"absolute -top-1 -right-1 min-w-[16px] h-4 px-1 rounded-full bg-amber-500 text-white text-[10px] font-bold flex items-center justify-center ring-2 ring-white dark:ring-gray-800","aria-label":`${l} message${l===1?"":"s"} queued`,children:l})]})]})]}),n.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-1.5 text-center",children:f("chat.send_hint")}),_&&n.jsxs("div",{role:"alert",className:"mt-2 px-3 py-2 bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-300 text-sm rounded-lg flex items-center gap-2",children:[n.jsx("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z"})}),n.jsx("span",{children:_}),n.jsx("button",{onClick:()=>w(null),className:"ml-auto text-red-500 hover:text-red-700 dark:hover:text-red-200","aria-label":f("voice.dismiss_error"),children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})]})})});function VB({darkMode:e,onToggleTheme:t}){const{t:r}=Jt(),a=(_,w)=>{const N=r(_);return N===_?w:N},[i,o]=x.useState(""),[l,u]=x.useState(""),[d,f]=x.useState(!1),[p,h]=x.useState(null),[m,y]=x.useState(!1);x.useEffect(()=>{fetch("/auth/membership/available").then(_=>_.json()).then(_=>y(_.available===!0)).catch(()=>{})},[]);const v=async _=>{_.preventDefault(),h(null),f(!0);try{const w=await fetch("/auth/membership/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:i,password:l})}),N=await w.json().catch(()=>({}));if(!w.ok){h(N.error||"Login failed"),f(!1);return}window.location.reload()}catch(w){h("Connection error: "+w.message),f(!1)}},k=async()=>{h(null),f(!0);try{const _=await fetch("/auth/local/login",{method:"POST",credentials:"include"}),w=await _.json().catch(()=>({}));if(!_.ok){h(w.error||"Local login failed"),f(!1);return}window.location.href="/"}catch(_){h("Connection error: "+_.message),f(!1)}};return n.jsxs("div",{className:"min-h-screen flex flex-col bg-gray-50 dark:bg-gray-950",children:[n.jsx("div",{className:"flex justify-end p-4",children:n.jsx("button",{onClick:t,className:"p-2 rounded-lg bg-gray-200 dark:bg-gray-800 text-gray-600 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700 transition-colors",title:r(e?"theme.light":"theme.dark"),"aria-label":r(e?"theme.light":"theme.dark"),children:e?n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"})}):n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"})})})}),n.jsx("div",{className:"flex-1 flex items-center justify-center px-4",children:n.jsxs("div",{className:"w-full max-w-sm",children:[n.jsxs("div",{className:"text-center mb-8",children:[n.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-2xl bg-primary-500 mb-4",children:n.jsx("span",{className:"text-white font-bold text-2xl",children:"P"})}),n.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100",children:"PAVE"}),n.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:r("login.pave_subtitle")})]}),n.jsxs("div",{className:"bg-white dark:bg-gray-950 rounded-xl border border-gray-200 dark:border-gray-800 p-6 shadow-sm ring-1 ring-accent-400/20",children:[n.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 text-center mb-6",children:r("login.sign_in")}),p&&n.jsx("div",{className:"mb-4 px-3 py-2 rounded-lg bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 text-sm border border-red-200 dark:border-red-800",children:p}),m&&n.jsxs("form",{onSubmit:v,className:"space-y-3 mb-4",children:[n.jsx("input",{type:"email",placeholder:a("login.email_placeholder","Email"),value:i,onChange:_=>o(_.target.value),required:!0,className:"w-full px-3 py-2.5 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 text-sm focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent"}),n.jsx("input",{type:"password",placeholder:a("login.password_placeholder","Password"),value:l,onChange:_=>u(_.target.value),required:!0,className:"w-full px-3 py-2.5 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 text-sm focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent"}),n.jsx("button",{type:"submit",disabled:d,className:"w-full py-2.5 px-4 rounded-lg bg-primary-500 hover:bg-primary-600 text-white font-medium text-sm transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:d?a("login.signing_in","Signing in..."):r("login.sign_in")})]}),m&&n.jsxs("div",{className:"flex items-center gap-3 my-4",children:[n.jsx("div",{className:"flex-1 border-t border-gray-200 dark:border-gray-700"}),n.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:a("login.or","or")}),n.jsx("div",{className:"flex-1 border-t border-gray-200 dark:border-gray-700"})]}),n.jsxs("button",{type:"button",onClick:k,disabled:d,className:"flex items-center justify-center gap-3 w-full py-2.5 px-4 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-200 font-medium text-sm transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})}),a("login.sign_in_locally","Sign in locally")]}),n.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 text-center mt-4",children:r("login.terms")})]})]})})]})}function GB({user:e,onLogout:t,onSkillManagement:r,onAgentManagement:a,onPricingSettings:i,onDlpSettings:o,onSettings:l,onBoard:u}){const{t:d}=Jt(),[f,p]=x.useState(!1),h=x.useRef(null);if(x.useEffect(()=>{if(!f)return;function y(v){h.current&&!h.current.contains(v.target)&&p(!1)}return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[f]),!e)return null;const m=(e.name||e.email||"?").split(" ").map(y=>y[0]).join("").slice(0,2).toUpperCase();return n.jsxs("div",{className:"relative",ref:h,children:[n.jsxs("button",{onClick:()=>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?n.jsx("img",{src:e.picture,alt:"","aria-hidden":"true",className:"w-7 h-7 rounded-full",referrerPolicy:"no-referrer"}):n.jsx("div",{className:"w-7 h-7 rounded-full bg-primary-500 flex items-center justify-center",children:n.jsx("span",{className:"text-white text-xs font-semibold",children:m})}),n.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300 hidden sm:inline max-w-[120px] truncate",children:e.name||e.email}),n.jsx("svg",{className:"w-3 h-3 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),f&&n.jsxs("div",{className:"absolute right-0 top-full mt-1 w-56 bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-700 shadow-lg z-50 py-1",children:[n.jsxs("div",{className:"px-3 py-2 border-b border-gray-100 dark:border-gray-800",children:[n.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:e.name}),n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:e.email})]}),r&&n.jsxs("button",{type:"button",onClick:()=>{p(!1),r()},className:"w-full text-left px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors flex items-center gap-2",children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 4a2 2 0 114 0v1a1 1 0 001 1h3a1 1 0 011 1v3a1 1 0 01-1 1h-1a2 2 0 100 4h1a1 1 0 011 1v3a1 1 0 01-1 1h-3a1 1 0 01-1-1v-1a2 2 0 10-4 0v1a1 1 0 01-1 1H7a1 1 0 01-1-1v-3a1 1 0 00-1-1H4a2 2 0 110-4h1a1 1 0 001-1V7a1 1 0 011-1h3a1 1 0 001-1V4z"})}),d("user_menu.skills")]}),a&&n.jsxs("button",{onClick:()=>{p(!1),a()},className:"w-full text-left px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors flex items-center gap-2",children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})}),d("user_menu.agents")]}),i&&n.jsxs("button",{onClick:()=>{p(!1),i()},className:"w-full text-left px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors flex items-center gap-2",children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),d("user_menu.pricing")]}),o&&n.jsxs("button",{onClick:()=>{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:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"})}),d("user_menu.privacy_dlp")]}),u&&n.jsxs("button",{type:"button",onClick:()=>{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:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"})}),d("user_menu.board")]}),l&&n.jsxs("button",{onClick:()=>{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:[n.jsxs("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.066 2.573c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.573 1.066c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.066-2.573c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),d("user_menu.settings")]}),t&&n.jsx("button",{onClick:()=>{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 fR({toolParts:e}){const{t}=Jt();return!e||e.length===0?n.jsxs("div",{className:"p-4",children:[n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 uppercase tracking-wide font-medium mb-3",children:t("task.activity")}),n.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:t("task.no_active")})]}):n.jsxs("div",{className:"p-4",children:[n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 uppercase tracking-wide font-medium mb-3",children:t("task.working")}),n.jsx("div",{className:"space-y-1 max-h-[calc(100vh-300px)] overflow-y-auto",children:e.map(r=>n.jsx(KB,{part:r},r.id))})]})}function KB({part:e}){var i,o;const t=((i=e.state)==null?void 0:i.status)||"running",r=((o=e.state)==null?void 0:o.input)||{},a=YB(e.tool,r);return n.jsxs("div",{className:"flex items-center gap-2 py-1",children:[n.jsxs("div",{className:"flex-shrink-0",children:[t==="running"&&n.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-primary-400 border-t-transparent animate-spin"}),t==="completed"&&n.jsx("svg",{className:"w-3.5 h-3.5 text-green-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),t==="error"&&n.jsx("svg",{className:"w-3.5 h-3.5 text-red-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),t==="pending_confirmation"&&n.jsx("svg",{className:"w-3.5 h-3.5 text-amber-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01"})})]}),n.jsx("span",{className:`text-xs truncate ${t==="running"?"text-gray-800 dark:text-gray-200":t==="error"?"text-red-500 dark:text-red-400":"text-gray-500 dark:text-gray-400"}`,children:a})]})}function YB(e,t){if(!e)return"Processing...";switch(e){case"Read":return"Reading "+Pd(t.filePath);case"Write":return"Writing "+Pd(t.filePath);case"Edit":return"Editing "+Pd(t.filePath);case"Bash":{const r=t.command||"";return h2(r)}case"Glob":return"Searching for files"+(t.pattern?": "+t.pattern:"");case"Grep":return"Searching code"+(t.pattern?' for "'+dv(t.pattern,30)+'"':"");case"Fetch":case"WebFetch":return"Fetching web page"+(t.url?": "+dv(t.url,40):"");case"Skill":{const r=t.name||t.skill||"";return XB(r)}case"Todo":case"TodoWrite":return"Updating plan";case"Task":return t._purpose||"Running sub-task";default:return t.filePath?"Processing "+Pd(t.filePath):t.command?h2(t.command):"Running "+e.toLowerCase()}}function Pd(e){if(!e)return"file";const t=e.split("/"),r=t[t.length-1]||"file";return t.length<=2?r:t[t.length-2]+"/"+r}function h2(e){if(!e)return"Running command";const t=e.trim();if(/^(ls|dir)\b/i.test(t))return"Listing files";if(/^(cat|less|more)\b/i.test(t))return"Reading file contents";if(/^(mkdir)\b/i.test(t))return"Creating directory";if(/^(rm|del)\b/i.test(t))return"Removing files";if(/^(cp|copy)\b/i.test(t))return"Copying files";if(/^(mv|move|rename)\b/i.test(t))return"Moving files";if(/^(git\s+status)\b/i.test(t))return"Checking git status";if(/^(git\s+log)\b/i.test(t))return"Viewing git history";if(/^(git\s+diff)\b/i.test(t))return"Comparing changes";if(/^(git\s+add)\b/i.test(t))return"Staging changes";if(/^(git\s+commit)\b/i.test(t))return"Committing changes";if(/^(git\s+push)\b/i.test(t))return"Pushing to remote";if(/^(git\s+pull)\b/i.test(t))return"Pulling from remote";if(/^(git\s+clone)\b/i.test(t))return"Cloning repository";if(/^(git\s+checkout|git\s+switch)\b/i.test(t))return"Switching branches";if(/^(git\s+branch)\b/i.test(t))return"Managing branches";if(/^git\b/i.test(t))return"Running git command";if(/^(npm\s+install|npm\s+i|yarn\s+install|yarn\s+add|pnpm\s+install)\b/i.test(t))return"Installing dependencies";if(/^(npm\s+run\s+build|yarn\s+build|pnpm\s+build)\b/i.test(t))return"Building project";if(/^(npm\s+run\s+test|npm\s+test|yarn\s+test|jest|pytest|mocha)\b/i.test(t))return"Running tests";if(/^(npm\s+run\s+dev|npm\s+start|yarn\s+dev|yarn\s+start)\b/i.test(t))return"Starting dev server";if(/^(npm|yarn|pnpm)\b/i.test(t))return"Running package manager";if(/^(node|python|ruby|php|java)\b/i.test(t))return"Running script";if(/^(docker)\b/i.test(t))return"Running Docker command";if(/^(curl|wget)\b/i.test(t))return"Fetching URL";if(/^(chmod|chown)\b/i.test(t))return"Changing permissions";if(/^(find|locate)\b/i.test(t))return"Finding files";if(/^(grep|rg|ag)\b/i.test(t))return"Searching file contents";if(/^(sed|awk)\b/i.test(t))return"Processing text";if(/^(echo|printf)\b/i.test(t))return"Running command";if(/^(ssh|scp)\b/i.test(t))return"Connecting remotely";if(/^(ping|traceroute|nslookup|dig)\b/i.test(t))return"Checking network";if(/^(tar|zip|unzip|gzip)\b/i.test(t))return"Compressing/extracting files";const r=t.split(/\s+/)[0];return"Running "+dv(r,20)}function XB(e,t){const r=(e||"").toLowerCase();return r.includes("gmail")||r.includes("email")?"Checking email":r.includes("gdrive")||r.includes("drive")?"Accessing Google Drive":r.includes("gcal")||r.includes("calendar")?"Checking calendar":r.includes("gtasks")||r.includes("tasks")?"Managing tasks":r.includes("discord")?"Using Discord":r.includes("whatsapp")?"Using WhatsApp":r.includes("wrike")?"Checking Wrike":r.includes("dropbox")?"Accessing Dropbox":r.includes("pandadoc")?"Working with PandaDoc":r.includes("freshbooks")?"Checking FreshBooks":r.includes("mailchimp")?"Using Mailchimp":r.includes("bamboohr")?"Checking BambooHR":e?"Using "+e:"Running skill"}function dv(e,t){return e?e.length<=t?e:e.slice(0,t)+"...":""}const fv=10,pv=24,m2=2,QB=14,pR="pave-terminal-font-size";function ZB(){try{const e=localStorage.getItem(pR);if(e!==null){const t=parseInt(e,10);if(!Number.isNaN(t)&&t>=fv&&t<=pv)return t}}catch{}return QB}function gR({toolParts:e,matrixMode:t,onToggleMatrix:r,darkMode:a=!0}){var{t:i}=Jt();const o=x.useRef(null),l=x.useRef(null),u=x.useRef(null),[d,f]=x.useState(ZB),p=x.useCallback(()=>{f(k=>Math.max(fv,k-m2))},[]),h=x.useCallback(()=>{f(k=>Math.min(pv,k+m2))},[]);x.useEffect(()=>{try{localStorage.setItem(pR,String(d))}catch{}},[d]);const m=a?{bg:"bg-gray-950",headerBg:"bg-gray-900",headerBorder:"border-gray-800",titleText:"text-gray-400",promptColor:"text-green-400",commandColor:"text-gray-200",outputColor:"text-green-300/70",waitingText:"text-gray-500",runningColor:"text-yellow-400",doneColor:"text-green-500",errorColor:"text-red-400",pendingColor:"text-blue-400"}:{bg:"bg-gray-100",headerBg:"bg-gray-200",headerBorder:"border-gray-300",titleText:"text-gray-600",promptColor:"text-green-600",commandColor:"text-gray-800",outputColor:"text-green-700/80",waitingText:"text-gray-500",runningColor:"text-yellow-600",doneColor:"text-green-600",errorColor:"text-red-600",pendingColor:"text-blue-600"},y=`px-1.5 py-0.5 text-xs font-mono rounded ${a?"bg-gray-600 text-gray-300 hover:bg-gray-500":"bg-gray-300 text-gray-700 hover:bg-gray-200"} disabled:opacity-40 disabled:cursor-default`;x.useEffect(()=>{o.current&&!t&&(o.current.scrollTop=o.current.scrollHeight)},[e,t]);const v=x.useCallback(()=>{const k=l.current;if(!k)return;const _=k.getContext("2d");if(!_)return;const w=()=>{const M=k.parentElement;if(M&&M.clientWidth>0&&M.clientHeight>0){k.width=M.clientWidth,k.height=M.clientHeight;return}const L=k.getBoundingClientRect();if(L.width>0&&L.height>0){k.width=L.width,k.height=L.height;return}k.width=0,k.height=0};w();const N=d;let E=Math.floor(k.width/N),A=new Array(E).fill(1);const T="アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヲンABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",C=()=>{_.fillStyle="rgba(0, 0, 0, 0.05)",_.fillRect(0,0,k.width,k.height),_.fillStyle="#0F0",_.font=N+"px monospace";for(let M=0;M<A.length;M++){const L=T.charAt(Math.floor(Math.random()*T.length));_.fillText(L,M*N,A[M]*N),A[M]*N>k.height&&Math.random()>.975&&(A[M]=0),A[M]++}u.current=requestAnimationFrame(C)},j=()=>{w(),E=Math.floor(k.width/N);const M=new Array(E).fill(0);for(let L=0;L<Math.min(A.length,M.length);L++)M[L]=A[L];A=M};return window.addEventListener("resize",j),u.current=requestAnimationFrame(C),()=>{window.removeEventListener("resize",j),u.current&&cancelAnimationFrame(u.current)}},[d]);return x.useEffect(()=>{let k;return t?k=v():u.current&&(cancelAnimationFrame(u.current),u.current=null),()=>{k&&k(),u.current&&(cancelAnimationFrame(u.current),u.current=null)}},[t,v]),e&&e.some(k=>{var _;return(((_=k.state)==null?void 0:_.status)||"running")==="running"}),n.jsxs("div",{className:`flex flex-col h-full ${m.bg} font-mono`,style:{fontSize:d+"px"},children:[n.jsxs("div",{className:`flex items-center justify-between px-3 py-2 ${m.headerBg} border-b ${m.headerBorder} flex-shrink-0`,children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("div",{className:"flex gap-1.5",children:[n.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-red-500 cursor-pointer",onDoubleClick:r,title:""}),n.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-yellow-500"}),n.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-green-500"})]}),n.jsx("span",{className:`${m.titleText} text-xs ml-2`,children:"PAVE Terminal"})]}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("button",{type:"button",onClick:p,disabled:d<=fv,className:y,"aria-label":i("terminal.decrease_font"),title:i("terminal.decrease_font"),children:"A-"}),n.jsx("button",{type:"button",onClick:h,disabled:d>=pv,className:y,"aria-label":i("terminal.increase_font"),title:i("terminal.increase_font"),children:"A+"})]})]}),n.jsx("div",{className:"flex-1 relative overflow-hidden",children:t?n.jsxs(n.Fragment,{children:[n.jsx("canvas",{ref:l,className:"absolute inset-0 w-full h-full"}),e&&e.length>0&&n.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-black/60 px-3 py-2 max-h-32 overflow-y-auto",children:e.slice(-3).map(k=>n.jsx(ez,{part:k},k.id))})]}):n.jsx("div",{ref:o,className:"h-full overflow-y-auto px-3 py-2 space-y-1",children:!e||e.length===0?n.jsxs("div",{children:[n.jsxs("div",{className:m.promptColor,children:["$ ",n.jsx("span",{className:"terminal-cursor",children:"█"})]}),n.jsx("p",{className:`${m.waitingText} mt-2`,children:"Awaiting commands..."})]}):n.jsxs(n.Fragment,{children:[e.map(k=>n.jsx(JB,{part:k,theme:m},k.id)),n.jsxs("div",{className:m.promptColor,children:["$ ",n.jsx("span",{className:"terminal-cursor",children:"█"})]})]})})})]})}function JB({part:e,theme:t}){var{t:r}=Jt();const{tool:a,state:i}=e;if(!i)return null;const o=i.status||"running",u=jf(a||i.title,i.input)||a||i.title||"unknown",d=i.output?So(typeof i.output=="string"?i.output:JSON.stringify(i.output,null,2)):null;return n.jsxs("div",{className:"mb-2",children:[n.jsxs("div",{className:`${t.commandColor} break-all`,children:[n.jsx("span",{className:`${t.promptColor} select-none`,children:"$ "}),u]}),o==="running"&&n.jsx("div",{className:`${t.runningColor} mt-0.5`,children:"[running...]"}),o==="completed"&&d&&n.jsx("pre",{className:`${t.outputColor} mt-0.5 whitespace-pre-wrap break-all`,children:d}),o==="completed"&&!d&&n.jsx("div",{className:`${t.doneColor} mt-0.5`,children:"[done]"}),o==="error"&&n.jsxs("pre",{className:`${t.errorColor} mt-0.5 whitespace-pre-wrap break-all`,children:["[error] ",i.error?So(typeof i.error=="string"?i.error:i.error.message||r("common.error")):r("common.unknown_error")]}),o==="pending_confirmation"&&n.jsx("div",{className:`${t.pendingColor} mt-0.5`,children:"[awaiting confirmation...]"})]})}function ez({part:e}){const{tool:t,state:r}=e;if(!r)return null;const a=r.status||"running",o=jf(t||r.title,r.input)||t||r.title||"unknown",l={running:"text-yellow-400",completed:"text-green-400",error:"text-red-400",pending_confirmation:"text-blue-400"},u={running:"RUN",completed:"OK",error:"ERR",pending_confirmation:"WAIT"};return n.jsxs("div",{className:"text-xs font-mono truncate",children:[n.jsxs("span",{className:l[a]||"text-gray-400",children:["[",u[a]||a,"]"]}),n.jsxs("span",{className:"text-green-300 ml-1",children:["$ ",o]})]})}function ok(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 rh,x2;function tz(){if(x2)return rh;x2=1;function e(){this.__data__=[],this.size=0}return rh=e,rh}var nh,y2;function Pl(){if(y2)return nh;y2=1;function e(t,r){return t===r||t!==t&&r!==r}return nh=e,nh}var ah,b2;function Tf(){if(b2)return ah;b2=1;var e=Pl();function t(r,a){for(var i=r.length;i--;)if(e(r[i][0],a))return i;return-1}return ah=t,ah}var ih,v2;function rz(){if(v2)return ih;v2=1;var e=Tf(),t=Array.prototype,r=t.splice;function a(i){var o=this.__data__,l=e(o,i);if(l<0)return!1;var u=o.length-1;return l==u?o.pop():r.call(o,l,1),--this.size,!0}return ih=a,ih}var sh,k2;function nz(){if(k2)return sh;k2=1;var e=Tf();function t(r){var a=this.__data__,i=e(a,r);return i<0?void 0:a[i][1]}return sh=t,sh}var oh,_2;function az(){if(_2)return oh;_2=1;var e=Tf();function t(r){return e(this.__data__,r)>-1}return oh=t,oh}var lh,w2;function iz(){if(w2)return lh;w2=1;var e=Tf();function t(r,a){var i=this.__data__,o=e(i,r);return o<0?(++this.size,i.push([r,a])):i[o][1]=a,this}return lh=t,lh}var ch,S2;function Rf(){if(S2)return ch;S2=1;var e=tz(),t=rz(),r=nz(),a=az(),i=iz();function o(l){var u=-1,d=l==null?0:l.length;for(this.clear();++u<d;){var f=l[u];this.set(f[0],f[1])}}return o.prototype.clear=e,o.prototype.delete=t,o.prototype.get=r,o.prototype.has=a,o.prototype.set=i,ch=o,ch}var uh,N2;function sz(){if(N2)return uh;N2=1;var e=Rf();function t(){this.__data__=new e,this.size=0}return uh=t,uh}var dh,E2;function oz(){if(E2)return dh;E2=1;function e(t){var r=this.__data__,a=r.delete(t);return this.size=r.size,a}return dh=e,dh}var fh,j2;function lz(){if(j2)return fh;j2=1;function e(t){return this.__data__.get(t)}return fh=e,fh}var ph,C2;function cz(){if(C2)return ph;C2=1;function e(t){return this.__data__.has(t)}return ph=e,ph}var gh,T2;function hR(){if(T2)return gh;T2=1;var e=typeof kd=="object"&&kd&&kd.Object===Object&&kd;return gh=e,gh}var hh,R2;function vi(){if(R2)return hh;R2=1;var e=hR(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return hh=r,hh}var mh,A2;function Fl(){if(A2)return mh;A2=1;var e=vi(),t=e.Symbol;return mh=t,mh}var xh,I2;function uz(){if(I2)return xh;I2=1;var e=Fl(),t=Object.prototype,r=t.hasOwnProperty,a=t.toString,i=e?e.toStringTag:void 0;function o(l){var u=r.call(l,i),d=l[i];try{l[i]=void 0;var f=!0}catch{}var p=a.call(l);return f&&(u?l[i]=d:delete l[i]),p}return xh=o,xh}var yh,M2;function dz(){if(M2)return yh;M2=1;var e=Object.prototype,t=e.toString;function r(a){return t.call(a)}return yh=r,yh}var bh,L2;function Io(){if(L2)return bh;L2=1;var e=Fl(),t=uz(),r=dz(),a="[object Null]",i="[object Undefined]",o=e?e.toStringTag:void 0;function l(u){return u==null?u===void 0?i:a:o&&o in Object(u)?t(u):r(u)}return bh=l,bh}var vh,O2;function ei(){if(O2)return vh;O2=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return vh=e,vh}var kh,D2;function pu(){if(D2)return kh;D2=1;var e=Io(),t=ei(),r="[object AsyncFunction]",a="[object Function]",i="[object GeneratorFunction]",o="[object Proxy]";function l(u){if(!t(u))return!1;var d=e(u);return d==a||d==i||d==r||d==o}return kh=l,kh}var _h,P2;function fz(){if(P2)return _h;P2=1;var e=vi(),t=e["__core-js_shared__"];return _h=t,_h}var wh,F2;function pz(){if(F2)return wh;F2=1;var e=fz(),t=(function(){var a=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return a?"Symbol(src)_1."+a:""})();function r(a){return!!t&&t in a}return wh=r,wh}var Sh,B2;function mR(){if(B2)return Sh;B2=1;var e=Function.prototype,t=e.toString;function r(a){if(a!=null){try{return t.call(a)}catch{}try{return a+""}catch{}}return""}return Sh=r,Sh}var Nh,z2;function gz(){if(z2)return Nh;z2=1;var e=pu(),t=pz(),r=ei(),a=mR(),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(!r(m)||t(m))return!1;var y=e(m)?p:o;return y.test(a(m))}return Nh=h,Nh}var Eh,U2;function hz(){if(U2)return Eh;U2=1;function e(t,r){return t==null?void 0:t[r]}return Eh=e,Eh}var jh,q2;function Mo(){if(q2)return jh;q2=1;var e=gz(),t=hz();function r(a,i){var o=t(a,i);return e(o)?o:void 0}return jh=r,jh}var Ch,H2;function lk(){if(H2)return Ch;H2=1;var e=Mo(),t=vi(),r=e(t,"Map");return Ch=r,Ch}var Th,$2;function Af(){if($2)return Th;$2=1;var e=Mo(),t=e(Object,"create");return Th=t,Th}var Rh,W2;function mz(){if(W2)return Rh;W2=1;var e=Af();function t(){this.__data__=e?e(null):{},this.size=0}return Rh=t,Rh}var Ah,V2;function xz(){if(V2)return Ah;V2=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return Ah=e,Ah}var Ih,G2;function yz(){if(G2)return Ih;G2=1;var e=Af(),t="__lodash_hash_undefined__",r=Object.prototype,a=r.hasOwnProperty;function i(o){var l=this.__data__;if(e){var u=l[o];return u===t?void 0:u}return a.call(l,o)?l[o]:void 0}return Ih=i,Ih}var Mh,K2;function bz(){if(K2)return Mh;K2=1;var e=Af(),t=Object.prototype,r=t.hasOwnProperty;function a(i){var o=this.__data__;return e?o[i]!==void 0:r.call(o,i)}return Mh=a,Mh}var Lh,Y2;function vz(){if(Y2)return Lh;Y2=1;var e=Af(),t="__lodash_hash_undefined__";function r(a,i){var o=this.__data__;return this.size+=this.has(a)?0:1,o[a]=e&&i===void 0?t:i,this}return Lh=r,Lh}var Oh,X2;function kz(){if(X2)return Oh;X2=1;var e=mz(),t=xz(),r=yz(),a=bz(),i=vz();function o(l){var u=-1,d=l==null?0:l.length;for(this.clear();++u<d;){var f=l[u];this.set(f[0],f[1])}}return o.prototype.clear=e,o.prototype.delete=t,o.prototype.get=r,o.prototype.has=a,o.prototype.set=i,Oh=o,Oh}var Dh,Q2;function _z(){if(Q2)return Dh;Q2=1;var e=kz(),t=Rf(),r=lk();function a(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}return Dh=a,Dh}var Ph,Z2;function wz(){if(Z2)return Ph;Z2=1;function e(t){var r=typeof t;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?t!=="__proto__":t===null}return Ph=e,Ph}var Fh,J2;function If(){if(J2)return Fh;J2=1;var e=wz();function t(r,a){var i=r.__data__;return e(a)?i[typeof a=="string"?"string":"hash"]:i.map}return Fh=t,Fh}var Bh,eS;function Sz(){if(eS)return Bh;eS=1;var e=If();function t(r){var a=e(this,r).delete(r);return this.size-=a?1:0,a}return Bh=t,Bh}var zh,tS;function Nz(){if(tS)return zh;tS=1;var e=If();function t(r){return e(this,r).get(r)}return zh=t,zh}var Uh,rS;function Ez(){if(rS)return Uh;rS=1;var e=If();function t(r){return e(this,r).has(r)}return Uh=t,Uh}var qh,nS;function jz(){if(nS)return qh;nS=1;var e=If();function t(r,a){var i=e(this,r),o=i.size;return i.set(r,a),this.size+=i.size==o?0:1,this}return qh=t,qh}var Hh,aS;function ck(){if(aS)return Hh;aS=1;var e=_z(),t=Sz(),r=Nz(),a=Ez(),i=jz();function o(l){var u=-1,d=l==null?0:l.length;for(this.clear();++u<d;){var f=l[u];this.set(f[0],f[1])}}return o.prototype.clear=e,o.prototype.delete=t,o.prototype.get=r,o.prototype.has=a,o.prototype.set=i,Hh=o,Hh}var $h,iS;function Cz(){if(iS)return $h;iS=1;var e=Rf(),t=lk(),r=ck(),a=200;function i(o,l){var u=this.__data__;if(u instanceof e){var d=u.__data__;if(!t||d.length<a-1)return d.push([o,l]),this.size=++u.size,this;u=this.__data__=new r(d)}return u.set(o,l),this.size=u.size,this}return $h=i,$h}var Wh,sS;function Mf(){if(sS)return Wh;sS=1;var e=Rf(),t=sz(),r=oz(),a=lz(),i=cz(),o=Cz();function l(u){var d=this.__data__=new e(u);this.size=d.size}return l.prototype.clear=t,l.prototype.delete=r,l.prototype.get=a,l.prototype.has=i,l.prototype.set=o,Wh=l,Wh}var Vh,oS;function uk(){if(oS)return Vh;oS=1;function e(t,r){for(var a=-1,i=t==null?0:t.length;++a<i&&r(t[a],a,t)!==!1;);return t}return Vh=e,Vh}var Gh,lS;function xR(){if(lS)return Gh;lS=1;var e=Mo(),t=(function(){try{var r=e(Object,"defineProperty");return r({},"",{}),r}catch{}})();return Gh=t,Gh}var Kh,cS;function Lf(){if(cS)return Kh;cS=1;var e=xR();function t(r,a,i){a=="__proto__"&&e?e(r,a,{configurable:!0,enumerable:!0,value:i,writable:!0}):r[a]=i}return Kh=t,Kh}var Yh,uS;function Of(){if(uS)return Yh;uS=1;var e=Lf(),t=Pl(),r=Object.prototype,a=r.hasOwnProperty;function i(o,l,u){var d=o[l];(!(a.call(o,l)&&t(d,u))||u===void 0&&!(l in o))&&e(o,l,u)}return Yh=i,Yh}var Xh,dS;function gu(){if(dS)return Xh;dS=1;var e=Of(),t=Lf();function r(a,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],a[p],p,o,a):void 0;h===void 0&&(h=a[p]),u?t(o,p,h):e(o,p,h)}return o}return Xh=r,Xh}var Qh,fS;function Tz(){if(fS)return Qh;fS=1;function e(t,r){for(var a=-1,i=Array(t);++a<t;)i[a]=r(a);return i}return Qh=e,Qh}var Zh,pS;function Pi(){if(pS)return Zh;pS=1;function e(t){return t!=null&&typeof t=="object"}return Zh=e,Zh}var Jh,gS;function Rz(){if(gS)return Jh;gS=1;var e=Io(),t=Pi(),r="[object Arguments]";function a(i){return t(i)&&e(i)==r}return Jh=a,Jh}var e0,hS;function hu(){if(hS)return e0;hS=1;var e=Rz(),t=Pi(),r=Object.prototype,a=r.hasOwnProperty,i=r.propertyIsEnumerable,o=e((function(){return arguments})())?e:function(l){return t(l)&&a.call(l,"callee")&&!i.call(l,"callee")};return e0=o,e0}var t0,mS;function vn(){if(mS)return t0;mS=1;var e=Array.isArray;return t0=e,t0}var Oc={exports:{}},r0,xS;function Az(){if(xS)return r0;xS=1;function e(){return!1}return r0=e,r0}Oc.exports;var yS;function Bl(){return yS||(yS=1,(function(e,t){var r=vi(),a=Az(),i=t&&!t.nodeType&&t,o=i&&!0&&e&&!e.nodeType&&e,l=o&&o.exports===i,u=l?r.Buffer:void 0,d=u?u.isBuffer:void 0,f=d||a;e.exports=f})(Oc,Oc.exports)),Oc.exports}var n0,bS;function Df(){if(bS)return n0;bS=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function r(a,i){var o=typeof a;return i=i??e,!!i&&(o=="number"||o!="symbol"&&t.test(a))&&a>-1&&a%1==0&&a<i}return n0=r,n0}var a0,vS;function dk(){if(vS)return a0;vS=1;var e=9007199254740991;function t(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=e}return a0=t,a0}var i0,kS;function Iz(){if(kS)return i0;kS=1;var e=Io(),t=dk(),r=Pi(),a="[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]",y="[object Set]",v="[object String]",k="[object WeakMap]",_="[object ArrayBuffer]",w="[object DataView]",N="[object Float32Array]",E="[object Float64Array]",A="[object Int8Array]",T="[object Int16Array]",C="[object Int32Array]",j="[object Uint8Array]",M="[object Uint8ClampedArray]",L="[object Uint16Array]",I="[object Uint32Array]",B={};B[N]=B[E]=B[A]=B[T]=B[C]=B[j]=B[M]=B[L]=B[I]=!0,B[a]=B[i]=B[_]=B[o]=B[w]=B[l]=B[u]=B[d]=B[f]=B[p]=B[h]=B[m]=B[y]=B[v]=B[k]=!1;function z(ee){return r(ee)&&t(ee.length)&&!!B[e(ee)]}return i0=z,i0}var s0,_S;function Pf(){if(_S)return s0;_S=1;function e(t){return function(r){return t(r)}}return s0=e,s0}var Dc={exports:{}};Dc.exports;var wS;function fk(){return wS||(wS=1,(function(e,t){var r=hR(),a=t&&!t.nodeType&&t,i=a&&!0&&e&&!e.nodeType&&e,o=i&&i.exports===a,l=o&&r.process,u=(function(){try{var d=i&&i.require&&i.require("util").types;return d||l&&l.binding&&l.binding("util")}catch{}})();e.exports=u})(Dc,Dc.exports)),Dc.exports}var o0,SS;function mu(){if(SS)return o0;SS=1;var e=Iz(),t=Pf(),r=fk(),a=r&&r.isTypedArray,i=a?t(a):e;return o0=i,o0}var l0,NS;function yR(){if(NS)return l0;NS=1;var e=Tz(),t=hu(),r=vn(),a=Bl(),i=Df(),o=mu(),l=Object.prototype,u=l.hasOwnProperty;function d(f,p){var h=r(f),m=!h&&t(f),y=!h&&!m&&a(f),v=!h&&!m&&!y&&o(f),k=h||m||y||v,_=k?e(f.length,String):[],w=_.length;for(var N in f)(p||u.call(f,N))&&!(k&&(N=="length"||y&&(N=="offset"||N=="parent")||v&&(N=="buffer"||N=="byteLength"||N=="byteOffset")||i(N,w)))&&_.push(N);return _}return l0=d,l0}var c0,ES;function Ff(){if(ES)return c0;ES=1;var e=Object.prototype;function t(r){var a=r&&r.constructor,i=typeof a=="function"&&a.prototype||e;return r===i}return c0=t,c0}var u0,jS;function bR(){if(jS)return u0;jS=1;function e(t,r){return function(a){return t(r(a))}}return u0=e,u0}var d0,CS;function Mz(){if(CS)return d0;CS=1;var e=bR(),t=e(Object.keys,Object);return d0=t,d0}var f0,TS;function pk(){if(TS)return f0;TS=1;var e=Ff(),t=Mz(),r=Object.prototype,a=r.hasOwnProperty;function i(o){if(!e(o))return t(o);var l=[];for(var u in Object(o))a.call(o,u)&&u!="constructor"&&l.push(u);return l}return f0=i,f0}var p0,RS;function ts(){if(RS)return p0;RS=1;var e=pu(),t=dk();function r(a){return a!=null&&t(a.length)&&!e(a)}return p0=r,p0}var g0,AS;function Ps(){if(AS)return g0;AS=1;var e=yR(),t=pk(),r=ts();function a(i){return r(i)?e(i):t(i)}return g0=a,g0}var h0,IS;function Lz(){if(IS)return h0;IS=1;var e=gu(),t=Ps();function r(a,i){return a&&e(i,t(i),a)}return h0=r,h0}var m0,MS;function Oz(){if(MS)return m0;MS=1;function e(t){var r=[];if(t!=null)for(var a in Object(t))r.push(a);return r}return m0=e,m0}var x0,LS;function Dz(){if(LS)return x0;LS=1;var e=ei(),t=Ff(),r=Oz(),a=Object.prototype,i=a.hasOwnProperty;function o(l){if(!e(l))return r(l);var u=t(l),d=[];for(var f in l)f=="constructor"&&(u||!i.call(l,f))||d.push(f);return d}return x0=o,x0}var y0,OS;function Lo(){if(OS)return y0;OS=1;var e=yR(),t=Dz(),r=ts();function a(i){return r(i)?e(i,!0):t(i)}return y0=a,y0}var b0,DS;function Pz(){if(DS)return b0;DS=1;var e=gu(),t=Lo();function r(a,i){return a&&e(i,t(i),a)}return b0=r,b0}var Pc={exports:{}};Pc.exports;var PS;function vR(){return PS||(PS=1,(function(e,t){var r=vi(),a=t&&!t.nodeType&&t,i=a&&!0&&e&&!e.nodeType&&e,o=i&&i.exports===a,l=o?r.Buffer:void 0,u=l?l.allocUnsafe:void 0;function d(f,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})(Pc,Pc.exports)),Pc.exports}var v0,FS;function kR(){if(FS)return v0;FS=1;function e(t,r){var a=-1,i=t.length;for(r||(r=Array(i));++a<i;)r[a]=t[a];return r}return v0=e,v0}var k0,BS;function _R(){if(BS)return k0;BS=1;function e(t,r){for(var a=-1,i=t==null?0:t.length,o=0,l=[];++a<i;){var u=t[a];r(u,a,t)&&(l[o++]=u)}return l}return k0=e,k0}var _0,zS;function wR(){if(zS)return _0;zS=1;function e(){return[]}return _0=e,_0}var w0,US;function gk(){if(US)return w0;US=1;var e=_R(),t=wR(),r=Object.prototype,a=r.propertyIsEnumerable,i=Object.getOwnPropertySymbols,o=i?function(l){return l==null?[]:(l=Object(l),e(i(l),function(u){return a.call(l,u)}))}:t;return w0=o,w0}var S0,qS;function Fz(){if(qS)return S0;qS=1;var e=gu(),t=gk();function r(a,i){return e(a,t(a),i)}return S0=r,S0}var N0,HS;function hk(){if(HS)return N0;HS=1;function e(t,r){for(var a=-1,i=r.length,o=t.length;++a<i;)t[o+a]=r[a];return t}return N0=e,N0}var E0,$S;function Bf(){if($S)return E0;$S=1;var e=bR(),t=e(Object.getPrototypeOf,Object);return E0=t,E0}var j0,WS;function SR(){if(WS)return j0;WS=1;var e=hk(),t=Bf(),r=gk(),a=wR(),i=Object.getOwnPropertySymbols,o=i?function(l){for(var u=[];l;)e(u,r(l)),l=t(l);return u}:a;return j0=o,j0}var C0,VS;function Bz(){if(VS)return C0;VS=1;var e=gu(),t=SR();function r(a,i){return e(a,t(a),i)}return C0=r,C0}var T0,GS;function NR(){if(GS)return T0;GS=1;var e=hk(),t=vn();function r(a,i,o){var l=i(a);return t(a)?l:e(l,o(a))}return T0=r,T0}var R0,KS;function ER(){if(KS)return R0;KS=1;var e=NR(),t=gk(),r=Ps();function a(i){return e(i,r,t)}return R0=a,R0}var A0,YS;function zz(){if(YS)return A0;YS=1;var e=NR(),t=SR(),r=Lo();function a(i){return e(i,r,t)}return A0=a,A0}var I0,XS;function Uz(){if(XS)return I0;XS=1;var e=Mo(),t=vi(),r=e(t,"DataView");return I0=r,I0}var M0,QS;function qz(){if(QS)return M0;QS=1;var e=Mo(),t=vi(),r=e(t,"Promise");return M0=r,M0}var L0,ZS;function jR(){if(ZS)return L0;ZS=1;var e=Mo(),t=vi(),r=e(t,"Set");return L0=r,L0}var O0,JS;function Hz(){if(JS)return O0;JS=1;var e=Mo(),t=vi(),r=e(t,"WeakMap");return O0=r,O0}var D0,eN;function zl(){if(eN)return D0;eN=1;var e=Uz(),t=lk(),r=qz(),a=jR(),i=Hz(),o=Io(),l=mR(),u="[object Map]",d="[object Object]",f="[object Promise]",p="[object Set]",h="[object WeakMap]",m="[object DataView]",y=l(e),v=l(t),k=l(r),_=l(a),w=l(i),N=o;return(e&&N(new e(new ArrayBuffer(1)))!=m||t&&N(new t)!=u||r&&N(r.resolve())!=f||a&&N(new a)!=p||i&&N(new i)!=h)&&(N=function(E){var A=o(E),T=A==d?E.constructor:void 0,C=T?l(T):"";if(C)switch(C){case y:return m;case v:return u;case k:return f;case _:return p;case w:return h}return A}),D0=N,D0}var P0,tN;function $z(){if(tN)return P0;tN=1;var e=Object.prototype,t=e.hasOwnProperty;function r(a){var i=a.length,o=new a.constructor(i);return i&&typeof a[0]=="string"&&t.call(a,"index")&&(o.index=a.index,o.input=a.input),o}return P0=r,P0}var F0,rN;function CR(){if(rN)return F0;rN=1;var e=vi(),t=e.Uint8Array;return F0=t,F0}var B0,nN;function mk(){if(nN)return B0;nN=1;var e=CR();function t(r){var a=new r.constructor(r.byteLength);return new e(a).set(new e(r)),a}return B0=t,B0}var z0,aN;function Wz(){if(aN)return z0;aN=1;var e=mk();function t(r,a){var i=a?e(r.buffer):r.buffer;return new r.constructor(i,r.byteOffset,r.byteLength)}return z0=t,z0}var U0,iN;function Vz(){if(iN)return U0;iN=1;var e=/\w*$/;function t(r){var a=new r.constructor(r.source,e.exec(r));return a.lastIndex=r.lastIndex,a}return U0=t,U0}var q0,sN;function Gz(){if(sN)return q0;sN=1;var e=Fl(),t=e?e.prototype:void 0,r=t?t.valueOf:void 0;function a(i){return r?Object(r.call(i)):{}}return q0=a,q0}var H0,oN;function TR(){if(oN)return H0;oN=1;var e=mk();function t(r,a){var i=a?e(r.buffer):r.buffer;return new r.constructor(i,r.byteOffset,r.length)}return H0=t,H0}var $0,lN;function Kz(){if(lN)return $0;lN=1;var e=mk(),t=Wz(),r=Vz(),a=Gz(),i=TR(),o="[object Boolean]",l="[object Date]",u="[object Map]",d="[object Number]",f="[object RegExp]",p="[object Set]",h="[object String]",m="[object Symbol]",y="[object ArrayBuffer]",v="[object DataView]",k="[object Float32Array]",_="[object Float64Array]",w="[object Int8Array]",N="[object Int16Array]",E="[object Int32Array]",A="[object Uint8Array]",T="[object Uint8ClampedArray]",C="[object Uint16Array]",j="[object Uint32Array]";function M(L,I,B){var z=L.constructor;switch(I){case y:return e(L);case o:case l:return new z(+L);case v:return t(L,B);case k:case _:case w:case N:case E:case A:case T:case C:case j:return i(L,B);case u:return new z;case d:case h:return new z(L);case f:return r(L);case p:return new z;case m:return a(L)}}return $0=M,$0}var W0,cN;function RR(){if(cN)return W0;cN=1;var e=ei(),t=Object.create,r=(function(){function a(){}return function(i){if(!e(i))return{};if(t)return t(i);a.prototype=i;var o=new a;return a.prototype=void 0,o}})();return W0=r,W0}var V0,uN;function AR(){if(uN)return V0;uN=1;var e=RR(),t=Bf(),r=Ff();function a(i){return typeof i.constructor=="function"&&!r(i)?e(t(i)):{}}return V0=a,V0}var G0,dN;function Yz(){if(dN)return G0;dN=1;var e=zl(),t=Pi(),r="[object Map]";function a(i){return t(i)&&e(i)==r}return G0=a,G0}var K0,fN;function Xz(){if(fN)return K0;fN=1;var e=Yz(),t=Pf(),r=fk(),a=r&&r.isMap,i=a?t(a):e;return K0=i,K0}var Y0,pN;function Qz(){if(pN)return Y0;pN=1;var e=zl(),t=Pi(),r="[object Set]";function a(i){return t(i)&&e(i)==r}return Y0=a,Y0}var X0,gN;function Zz(){if(gN)return X0;gN=1;var e=Qz(),t=Pf(),r=fk(),a=r&&r.isSet,i=a?t(a):e;return X0=i,X0}var Q0,hN;function IR(){if(hN)return Q0;hN=1;var e=Mf(),t=uk(),r=Of(),a=Lz(),i=Pz(),o=vR(),l=kR(),u=Fz(),d=Bz(),f=ER(),p=zz(),h=zl(),m=$z(),y=Kz(),v=AR(),k=vn(),_=Bl(),w=Xz(),N=ei(),E=Zz(),A=Ps(),T=Lo(),C=1,j=2,M=4,L="[object Arguments]",I="[object Array]",B="[object Boolean]",z="[object Date]",ee="[object Error]",V="[object Function]",D="[object GeneratorFunction]",K="[object Map]",H="[object Number]",J="[object Object]",ne="[object RegExp]",P="[object Set]",U="[object String]",X="[object Symbol]",F="[object WeakMap]",Z="[object ArrayBuffer]",W="[object DataView]",G="[object Float32Array]",oe="[object Float64Array]",Q="[object Int8Array]",fe="[object Int16Array]",ke="[object Int32Array]",Fe="[object Uint8Array]",Ve="[object Uint8ClampedArray]",Ge="[object Uint16Array]",qe="[object Uint32Array]",Ce={};Ce[L]=Ce[I]=Ce[Z]=Ce[W]=Ce[B]=Ce[z]=Ce[G]=Ce[oe]=Ce[Q]=Ce[fe]=Ce[ke]=Ce[K]=Ce[H]=Ce[J]=Ce[ne]=Ce[P]=Ce[U]=Ce[X]=Ce[Fe]=Ce[Ve]=Ce[Ge]=Ce[qe]=!0,Ce[ee]=Ce[V]=Ce[F]=!1;function He(ze,gt,mt,wt,$e,Et){var Ze,Oe=gt&C,it=gt&j,me=gt&M;if(mt&&(Ze=$e?mt(ze,wt,$e,Et):mt(ze)),Ze!==void 0)return Ze;if(!N(ze))return ze;var Ee=k(ze);if(Ee){if(Ze=m(ze),!Oe)return l(ze,Ze)}else{var ge=h(ze),je=ge==V||ge==D;if(_(ze))return o(ze,Oe);if(ge==J||ge==L||je&&!$e){if(Ze=it||je?{}:v(ze),!Oe)return it?d(ze,i(Ze,ze)):u(ze,a(Ze,ze))}else{if(!Ce[ge])return $e?ze:{};Ze=y(ze,ge,Oe)}}Et||(Et=new e);var se=Et.get(ze);if(se)return se;Et.set(ze,Ze),E(ze)?ze.forEach(function(dt){Ze.add(He(dt,gt,mt,dt,ze,Et))}):w(ze)&&ze.forEach(function(dt,lt){Ze.set(lt,He(dt,gt,mt,lt,ze,Et))});var De=me?it?p:f:it?T:A,rt=Ee?void 0:De(ze);return t(rt||ze,function(dt,lt){rt&&(lt=dt,dt=ze[lt]),r(Ze,lt,He(dt,gt,mt,lt,ze,Et))}),Ze}return Q0=He,Q0}var Z0,mN;function Jz(){if(mN)return Z0;mN=1;var e=IR(),t=4;function r(a){return e(a,t)}return Z0=r,Z0}var J0,xN;function xk(){if(xN)return J0;xN=1;function e(t){return function(){return t}}return J0=e,J0}var em,yN;function eU(){if(yN)return em;yN=1;function e(t){return function(r,a,i){for(var o=-1,l=Object(r),u=i(r),d=u.length;d--;){var f=u[t?d:++o];if(a(l[f],f,l)===!1)break}return r}}return em=e,em}var tm,bN;function yk(){if(bN)return tm;bN=1;var e=eU(),t=e();return tm=t,tm}var rm,vN;function bk(){if(vN)return rm;vN=1;var e=yk(),t=Ps();function r(a,i){return a&&e(a,i,t)}return rm=r,rm}var nm,kN;function tU(){if(kN)return nm;kN=1;var e=ts();function t(r,a){return function(i,o){if(i==null)return i;if(!e(i))return r(i,o);for(var l=i.length,u=a?l:-1,d=Object(i);(a?u--:++u<l)&&o(d[u],u,d)!==!1;);return i}}return nm=t,nm}var am,_N;function zf(){if(_N)return am;_N=1;var e=bk(),t=tU(),r=t(e);return am=r,am}var im,wN;function Oo(){if(wN)return im;wN=1;function e(t){return t}return im=e,im}var sm,SN;function MR(){if(SN)return sm;SN=1;var e=Oo();function t(r){return typeof r=="function"?r:e}return sm=t,sm}var om,NN;function LR(){if(NN)return om;NN=1;var e=uk(),t=zf(),r=MR(),a=vn();function i(o,l){var u=a(o)?e:t;return u(o,r(l))}return om=i,om}var lm,EN;function OR(){return EN||(EN=1,lm=LR()),lm}var cm,jN;function rU(){if(jN)return cm;jN=1;var e=zf();function t(r,a){var i=[];return e(r,function(o,l,u){a(o,l,u)&&i.push(o)}),i}return cm=t,cm}var um,CN;function nU(){if(CN)return um;CN=1;var e="__lodash_hash_undefined__";function t(r){return this.__data__.set(r,e),this}return um=t,um}var dm,TN;function aU(){if(TN)return dm;TN=1;function e(t){return this.__data__.has(t)}return dm=e,dm}var fm,RN;function DR(){if(RN)return fm;RN=1;var e=ck(),t=nU(),r=aU();function a(i){var o=-1,l=i==null?0:i.length;for(this.__data__=new e;++o<l;)this.add(i[o])}return a.prototype.add=a.prototype.push=t,a.prototype.has=r,fm=a,fm}var pm,AN;function iU(){if(AN)return pm;AN=1;function e(t,r){for(var a=-1,i=t==null?0:t.length;++a<i;)if(r(t[a],a,t))return!0;return!1}return pm=e,pm}var gm,IN;function PR(){if(IN)return gm;IN=1;function e(t,r){return t.has(r)}return gm=e,gm}var hm,MN;function FR(){if(MN)return hm;MN=1;var e=DR(),t=iU(),r=PR(),a=1,i=2;function o(l,u,d,f,p,h){var m=d&a,y=l.length,v=u.length;if(y!=v&&!(m&&v>y))return!1;var k=h.get(l),_=h.get(u);if(k&&_)return k==u&&_==l;var w=-1,N=!0,E=d&i?new e:void 0;for(h.set(l,u),h.set(u,l);++w<y;){var A=l[w],T=u[w];if(f)var C=m?f(T,A,w,u,l,h):f(A,T,w,l,u,h);if(C!==void 0){if(C)continue;N=!1;break}if(E){if(!t(u,function(j,M){if(!r(E,M)&&(A===j||p(A,j,d,f,h)))return E.push(M)})){N=!1;break}}else if(!(A===T||p(A,T,d,f,h))){N=!1;break}}return h.delete(l),h.delete(u),N}return hm=o,hm}var mm,LN;function sU(){if(LN)return mm;LN=1;function e(t){var r=-1,a=Array(t.size);return t.forEach(function(i,o){a[++r]=[o,i]}),a}return mm=e,mm}var xm,ON;function vk(){if(ON)return xm;ON=1;function e(t){var r=-1,a=Array(t.size);return t.forEach(function(i){a[++r]=i}),a}return xm=e,xm}var ym,DN;function oU(){if(DN)return ym;DN=1;var e=Fl(),t=CR(),r=Pl(),a=FR(),i=sU(),o=vk(),l=1,u=2,d="[object Boolean]",f="[object Date]",p="[object Error]",h="[object Map]",m="[object Number]",y="[object RegExp]",v="[object Set]",k="[object String]",_="[object Symbol]",w="[object ArrayBuffer]",N="[object DataView]",E=e?e.prototype:void 0,A=E?E.valueOf:void 0;function T(C,j,M,L,I,B,z){switch(M){case N:if(C.byteLength!=j.byteLength||C.byteOffset!=j.byteOffset)return!1;C=C.buffer,j=j.buffer;case w:return!(C.byteLength!=j.byteLength||!B(new t(C),new t(j)));case d:case f:case m:return r(+C,+j);case p:return C.name==j.name&&C.message==j.message;case y:case k:return C==j+"";case h:var ee=i;case v:var V=L&l;if(ee||(ee=o),C.size!=j.size&&!V)return!1;var D=z.get(C);if(D)return D==j;L|=u,z.set(C,j);var K=a(ee(C),ee(j),L,I,B,z);return z.delete(C),K;case _:if(A)return A.call(C)==A.call(j)}return!1}return ym=T,ym}var bm,PN;function lU(){if(PN)return bm;PN=1;var e=ER(),t=1,r=Object.prototype,a=r.hasOwnProperty;function i(o,l,u,d,f,p){var h=u&t,m=e(o),y=m.length,v=e(l),k=v.length;if(y!=k&&!h)return!1;for(var _=y;_--;){var w=m[_];if(!(h?w in l:a.call(l,w)))return!1}var N=p.get(o),E=p.get(l);if(N&&E)return N==l&&E==o;var A=!0;p.set(o,l),p.set(l,o);for(var T=h;++_<y;){w=m[_];var C=o[w],j=l[w];if(d)var M=h?d(j,C,w,l,o,p):d(C,j,w,o,l,p);if(!(M===void 0?C===j||f(C,j,u,d,p):M)){A=!1;break}T||(T=w=="constructor")}if(A&&!T){var L=o.constructor,I=l.constructor;L!=I&&"constructor"in o&&"constructor"in l&&!(typeof L=="function"&&L instanceof L&&typeof I=="function"&&I instanceof I)&&(A=!1)}return p.delete(o),p.delete(l),A}return bm=i,bm}var vm,FN;function cU(){if(FN)return vm;FN=1;var e=Mf(),t=FR(),r=oU(),a=lU(),i=zl(),o=vn(),l=Bl(),u=mu(),d=1,f="[object Arguments]",p="[object Array]",h="[object Object]",m=Object.prototype,y=m.hasOwnProperty;function v(k,_,w,N,E,A){var T=o(k),C=o(_),j=T?p:i(k),M=C?p:i(_);j=j==f?h:j,M=M==f?h:M;var L=j==h,I=M==h,B=j==M;if(B&&l(k)){if(!l(_))return!1;T=!0,L=!1}if(B&&!L)return A||(A=new e),T||u(k)?t(k,_,w,N,E,A):r(k,_,j,w,N,E,A);if(!(w&d)){var z=L&&y.call(k,"__wrapped__"),ee=I&&y.call(_,"__wrapped__");if(z||ee){var V=z?k.value():k,D=ee?_.value():_;return A||(A=new e),E(V,D,w,N,A)}}return B?(A||(A=new e),a(k,_,w,N,E,A)):!1}return vm=v,vm}var km,BN;function BR(){if(BN)return km;BN=1;var e=cU(),t=Pi();function r(a,i,o,l,u){return a===i?!0:a==null||i==null||!t(a)&&!t(i)?a!==a&&i!==i:e(a,i,o,l,r,u)}return km=r,km}var _m,zN;function uU(){if(zN)return _m;zN=1;var e=Mf(),t=BR(),r=1,a=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 y=m[0],v=o[y],k=m[1];if(h&&m[2]){if(v===void 0&&!(y in o))return!1}else{var _=new e;if(d)var w=d(v,k,y,o,l,_);if(!(w===void 0?t(k,v,r|a,d,_):w))return!1}}return!0}return _m=i,_m}var wm,UN;function zR(){if(UN)return wm;UN=1;var e=ei();function t(r){return r===r&&!e(r)}return wm=t,wm}var Sm,qN;function dU(){if(qN)return Sm;qN=1;var e=zR(),t=Ps();function r(a){for(var i=t(a),o=i.length;o--;){var l=i[o],u=a[l];i[o]=[l,u,e(u)]}return i}return Sm=r,Sm}var Nm,HN;function UR(){if(HN)return Nm;HN=1;function e(t,r){return function(a){return a==null?!1:a[t]===r&&(r!==void 0||t in Object(a))}}return Nm=e,Nm}var Em,$N;function fU(){if($N)return Em;$N=1;var e=uU(),t=dU(),r=UR();function a(i){var o=t(i);return o.length==1&&o[0][2]?r(o[0][0],o[0][1]):function(l){return l===i||e(l,i,o)}}return Em=a,Em}var jm,WN;function Ul(){if(WN)return jm;WN=1;var e=Io(),t=Pi(),r="[object Symbol]";function a(i){return typeof i=="symbol"||t(i)&&e(i)==r}return jm=a,jm}var Cm,VN;function kk(){if(VN)return Cm;VN=1;var e=vn(),t=Ul(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;function i(o,l){if(e(o))return!1;var u=typeof o;return u=="number"||u=="symbol"||u=="boolean"||o==null||t(o)?!0:a.test(o)||!r.test(o)||l!=null&&o in Object(l)}return Cm=i,Cm}var Tm,GN;function pU(){if(GN)return Tm;GN=1;var e=ck(),t="Expected a function";function r(a,i){if(typeof a!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var o=function(){var l=arguments,u=i?i.apply(this,l):l[0],d=o.cache;if(d.has(u))return d.get(u);var f=a.apply(this,l);return o.cache=d.set(u,f)||d,f};return o.cache=new(r.Cache||e),o}return r.Cache=e,Tm=r,Tm}var Rm,KN;function gU(){if(KN)return Rm;KN=1;var e=pU(),t=500;function r(a){var i=e(a,function(l){return o.size===t&&o.clear(),l}),o=i.cache;return i}return Rm=r,Rm}var Am,YN;function hU(){if(YN)return Am;YN=1;var e=gU(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,a=e(function(i){var o=[];return i.charCodeAt(0)===46&&o.push(""),i.replace(t,function(l,u,d,f){o.push(d?f.replace(r,"$1"):u||l)}),o});return Am=a,Am}var Im,XN;function Uf(){if(XN)return Im;XN=1;function e(t,r){for(var a=-1,i=t==null?0:t.length,o=Array(i);++a<i;)o[a]=r(t[a],a,t);return o}return Im=e,Im}var Mm,QN;function mU(){if(QN)return Mm;QN=1;var e=Fl(),t=Uf(),r=vn(),a=Ul(),i=e?e.prototype:void 0,o=i?i.toString:void 0;function l(u){if(typeof u=="string")return u;if(r(u))return t(u,l)+"";if(a(u))return o?o.call(u):"";var d=u+"";return d=="0"&&1/u==-1/0?"-0":d}return Mm=l,Mm}var Lm,ZN;function qR(){if(ZN)return Lm;ZN=1;var e=mU();function t(r){return r==null?"":e(r)}return Lm=t,Lm}var Om,JN;function qf(){if(JN)return Om;JN=1;var e=vn(),t=kk(),r=hU(),a=qR();function i(o,l){return e(o)?o:t(o,l)?[o]:r(a(o))}return Om=i,Om}var Dm,eE;function xu(){if(eE)return Dm;eE=1;var e=Ul();function t(r){if(typeof r=="string"||e(r))return r;var a=r+"";return a=="0"&&1/r==-1/0?"-0":a}return Dm=t,Dm}var Pm,tE;function Hf(){if(tE)return Pm;tE=1;var e=qf(),t=xu();function r(a,i){i=e(i,a);for(var o=0,l=i.length;a!=null&&o<l;)a=a[t(i[o++])];return o&&o==l?a:void 0}return Pm=r,Pm}var Fm,rE;function xU(){if(rE)return Fm;rE=1;var e=Hf();function t(r,a,i){var o=r==null?void 0:e(r,a);return o===void 0?i:o}return Fm=t,Fm}var Bm,nE;function yU(){if(nE)return Bm;nE=1;function e(t,r){return t!=null&&r in Object(t)}return Bm=e,Bm}var zm,aE;function HR(){if(aE)return zm;aE=1;var e=qf(),t=hu(),r=vn(),a=Df(),i=dk(),o=xu();function l(u,d,f){d=e(d,u);for(var p=-1,h=d.length,m=!1;++p<h;){var y=o(d[p]);if(!(m=u!=null&&f(u,y)))break;u=u[y]}return m||++p!=h?m:(h=u==null?0:u.length,!!h&&i(h)&&a(y,h)&&(r(u)||t(u)))}return zm=l,zm}var Um,iE;function $R(){if(iE)return Um;iE=1;var e=yU(),t=HR();function r(a,i){return a!=null&&t(a,i,e)}return Um=r,Um}var qm,sE;function bU(){if(sE)return qm;sE=1;var e=BR(),t=xU(),r=$R(),a=kk(),i=zR(),o=UR(),l=xu(),u=1,d=2;function f(p,h){return a(p)&&i(h)?o(l(p),h):function(m){var y=t(m,p);return y===void 0&&y===h?r(m,p):e(h,y,u|d)}}return qm=f,qm}var Hm,oE;function WR(){if(oE)return Hm;oE=1;function e(t){return function(r){return r==null?void 0:r[t]}}return Hm=e,Hm}var $m,lE;function vU(){if(lE)return $m;lE=1;var e=Hf();function t(r){return function(a){return e(a,r)}}return $m=t,$m}var Wm,cE;function kU(){if(cE)return Wm;cE=1;var e=WR(),t=vU(),r=kk(),a=xu();function i(o){return r(o)?e(a(o)):t(o)}return Wm=i,Wm}var Vm,uE;function rs(){if(uE)return Vm;uE=1;var e=fU(),t=bU(),r=Oo(),a=vn(),i=kU();function o(l){return typeof l=="function"?l:l==null?r:typeof l=="object"?a(l)?t(l[0],l[1]):e(l):i(l)}return Vm=o,Vm}var Gm,dE;function VR(){if(dE)return Gm;dE=1;var e=_R(),t=rU(),r=rs(),a=vn();function i(o,l){var u=a(o)?e:t;return u(o,r(l,3))}return Gm=i,Gm}var Km,fE;function _U(){if(fE)return Km;fE=1;var e=Object.prototype,t=e.hasOwnProperty;function r(a,i){return a!=null&&t.call(a,i)}return Km=r,Km}var Ym,pE;function GR(){if(pE)return Ym;pE=1;var e=_U(),t=HR();function r(a,i){return a!=null&&t(a,i,e)}return Ym=r,Ym}var Xm,gE;function wU(){if(gE)return Xm;gE=1;var e=pk(),t=zl(),r=hu(),a=vn(),i=ts(),o=Bl(),l=Ff(),u=mu(),d="[object Map]",f="[object Set]",p=Object.prototype,h=p.hasOwnProperty;function m(y){if(y==null)return!0;if(i(y)&&(a(y)||typeof y=="string"||typeof y.splice=="function"||o(y)||u(y)||r(y)))return!y.length;var v=t(y);if(v==d||v==f)return!y.size;if(l(y))return!e(y).length;for(var k in y)if(h.call(y,k))return!1;return!0}return Xm=m,Xm}var Qm,hE;function KR(){if(hE)return Qm;hE=1;function e(t){return t===void 0}return Qm=e,Qm}var Zm,mE;function YR(){if(mE)return Zm;mE=1;var e=zf(),t=ts();function r(a,i){var o=-1,l=t(a)?Array(a.length):[];return e(a,function(u,d,f){l[++o]=i(u,d,f)}),l}return Zm=r,Zm}var Jm,xE;function XR(){if(xE)return Jm;xE=1;var e=Uf(),t=rs(),r=YR(),a=vn();function i(o,l){var u=a(o)?e:r;return u(o,t(l,3))}return Jm=i,Jm}var ex,yE;function SU(){if(yE)return ex;yE=1;function e(t,r,a,i){var o=-1,l=t==null?0:t.length;for(i&&l&&(a=t[++o]);++o<l;)a=r(a,t[o],o,t);return a}return ex=e,ex}var tx,bE;function NU(){if(bE)return tx;bE=1;function e(t,r,a,i,o){return o(t,function(l,u,d){a=i?(i=!1,l):r(a,l,u,d)}),a}return tx=e,tx}var rx,vE;function QR(){if(vE)return rx;vE=1;var e=SU(),t=zf(),r=rs(),a=NU(),i=vn();function o(l,u,d){var f=i(l)?e:a,p=arguments.length<3;return f(l,r(u,4),d,p,t)}return rx=o,rx}var nx,kE;function EU(){if(kE)return nx;kE=1;var e=Io(),t=vn(),r=Pi(),a="[object String]";function i(o){return typeof o=="string"||!t(o)&&r(o)&&e(o)==a}return nx=i,nx}var ax,_E;function jU(){if(_E)return ax;_E=1;var e=WR(),t=e("length");return ax=t,ax}var ix,wE;function CU(){if(wE)return ix;wE=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",a="\\u20d0-\\u20ff",i=t+r+a,o="\\ufe0e\\ufe0f",l="\\u200d",u=RegExp("["+l+e+i+o+"]");function d(f){return u.test(f)}return ix=d,ix}var sx,SE;function TU(){if(SE)return sx;SE=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",a="\\u20d0-\\u20ff",i=t+r+a,o="\\ufe0e\\ufe0f",l="["+e+"]",u="["+i+"]",d="\\ud83c[\\udffb-\\udfff]",f="(?:"+u+"|"+d+")",p="[^"+e+"]",h="(?:\\ud83c[\\udde6-\\uddff]){2}",m="[\\ud800-\\udbff][\\udc00-\\udfff]",y="\\u200d",v=f+"?",k="["+o+"]?",_="(?:"+y+"(?:"+[p,h,m].join("|")+")"+k+v+")*",w=k+v+_,N="(?:"+[p+u+"?",u,h,m,l].join("|")+")",E=RegExp(d+"(?="+d+")|"+N+w,"g");function A(T){for(var C=E.lastIndex=0;E.test(T);)++C;return C}return sx=A,sx}var ox,NE;function RU(){if(NE)return ox;NE=1;var e=jU(),t=CU(),r=TU();function a(i){return t(i)?r(i):e(i)}return ox=a,ox}var lx,EE;function AU(){if(EE)return lx;EE=1;var e=pk(),t=zl(),r=ts(),a=EU(),i=RU(),o="[object Map]",l="[object Set]";function u(d){if(d==null)return 0;if(r(d))return a(d)?i(d):d.length;var f=t(d);return f==o||f==l?d.size:e(d).length}return lx=u,lx}var cx,jE;function IU(){if(jE)return cx;jE=1;var e=uk(),t=RR(),r=bk(),a=rs(),i=Bf(),o=vn(),l=Bl(),u=pu(),d=ei(),f=mu();function p(h,m,y){var v=o(h),k=v||l(h)||f(h);if(m=a(m,4),y==null){var _=h&&h.constructor;k?y=v?new _:[]:d(h)?y=u(_)?t(i(h)):{}:y={}}return(k?e:r)(h,function(w,N,E){return m(y,w,N,E)}),y}return cx=p,cx}var ux,CE;function MU(){if(CE)return ux;CE=1;var e=Fl(),t=hu(),r=vn(),a=e?e.isConcatSpreadable:void 0;function i(o){return r(o)||t(o)||!!(a&&o&&o[a])}return ux=i,ux}var dx,TE;function _k(){if(TE)return dx;TE=1;var e=hk(),t=MU();function r(a,i,o,l,u){var d=-1,f=a.length;for(o||(o=t),u||(u=[]);++d<f;){var p=a[d];i>0&&o(p)?i>1?r(p,i-1,o,l,u):e(u,p):l||(u[u.length]=p)}return u}return dx=r,dx}var fx,RE;function LU(){if(RE)return fx;RE=1;function e(t,r,a){switch(a.length){case 0:return t.call(r);case 1:return t.call(r,a[0]);case 2:return t.call(r,a[0],a[1]);case 3:return t.call(r,a[0],a[1],a[2])}return t.apply(r,a)}return fx=e,fx}var px,AE;function ZR(){if(AE)return px;AE=1;var e=LU(),t=Math.max;function r(a,i,o){return i=t(i===void 0?a.length-1:i,0),function(){for(var l=arguments,u=-1,d=t(l.length-i,0),f=Array(d);++u<d;)f[u]=l[i+u];u=-1;for(var p=Array(i+1);++u<i;)p[u]=l[u];return p[i]=o(f),e(a,this,p)}}return px=r,px}var gx,IE;function OU(){if(IE)return gx;IE=1;var e=xk(),t=xR(),r=Oo(),a=t?function(i,o){return t(i,"toString",{configurable:!0,enumerable:!1,value:e(o),writable:!0})}:r;return gx=a,gx}var hx,ME;function DU(){if(ME)return hx;ME=1;var e=800,t=16,r=Date.now;function a(i){var o=0,l=0;return function(){var u=r(),d=t-(u-l);if(l=u,d>0){if(++o>=e)return arguments[0]}else o=0;return i.apply(void 0,arguments)}}return hx=a,hx}var mx,LE;function JR(){if(LE)return mx;LE=1;var e=OU(),t=DU(),r=t(e);return mx=r,mx}var xx,OE;function $f(){if(OE)return xx;OE=1;var e=Oo(),t=ZR(),r=JR();function a(i,o){return r(t(i,o,e),i+"")}return xx=a,xx}var yx,DE;function eA(){if(DE)return yx;DE=1;function e(t,r,a,i){for(var o=t.length,l=a+(i?1:-1);i?l--:++l<o;)if(r(t[l],l,t))return l;return-1}return yx=e,yx}var bx,PE;function PU(){if(PE)return bx;PE=1;function e(t){return t!==t}return bx=e,bx}var vx,FE;function FU(){if(FE)return vx;FE=1;function e(t,r,a){for(var i=a-1,o=t.length;++i<o;)if(t[i]===r)return i;return-1}return vx=e,vx}var kx,BE;function BU(){if(BE)return kx;BE=1;var e=eA(),t=PU(),r=FU();function a(i,o,l){return o===o?r(i,o,l):e(i,t,l)}return kx=a,kx}var _x,zE;function zU(){if(zE)return _x;zE=1;var e=BU();function t(r,a){var i=r==null?0:r.length;return!!i&&e(r,a,0)>-1}return _x=t,_x}var wx,UE;function UU(){if(UE)return wx;UE=1;function e(t,r,a){for(var i=-1,o=t==null?0:t.length;++i<o;)if(a(r,t[i]))return!0;return!1}return wx=e,wx}var Sx,qE;function qU(){if(qE)return Sx;qE=1;function e(){}return Sx=e,Sx}var Nx,HE;function HU(){if(HE)return Nx;HE=1;var e=jR(),t=qU(),r=vk(),a=1/0,i=e&&1/r(new e([,-0]))[1]==a?function(o){return new e(o)}:t;return Nx=i,Nx}var Ex,$E;function $U(){if($E)return Ex;$E=1;var e=DR(),t=zU(),r=UU(),a=PR(),i=HU(),o=vk(),l=200;function u(d,f,p){var h=-1,m=t,y=d.length,v=!0,k=[],_=k;if(p)v=!1,m=r;else if(y>=l){var w=f?null:i(d);if(w)return o(w);v=!1,m=a,_=new e}else _=f?[]:k;e:for(;++h<y;){var N=d[h],E=f?f(N):N;if(N=p||N!==0?N:0,v&&E===E){for(var A=_.length;A--;)if(_[A]===E)continue e;f&&_.push(E),k.push(N)}else m(_,E,p)||(_!==k&&_.push(E),k.push(N))}return k}return Ex=u,Ex}var jx,WE;function tA(){if(WE)return jx;WE=1;var e=ts(),t=Pi();function r(a){return t(a)&&e(a)}return jx=r,jx}var Cx,VE;function WU(){if(VE)return Cx;VE=1;var e=_k(),t=$f(),r=$U(),a=tA(),i=t(function(o){return r(e(o,1,a,!0))});return Cx=i,Cx}var Tx,GE;function VU(){if(GE)return Tx;GE=1;var e=Uf();function t(r,a){return e(a,function(i){return r[i]})}return Tx=t,Tx}var Rx,KE;function rA(){if(KE)return Rx;KE=1;var e=VU(),t=Ps();function r(a){return a==null?[]:e(a,t(a))}return Rx=r,Rx}var Ax,YE;function ti(){if(YE)return Ax;YE=1;var e;if(typeof ok=="function")try{e={clone:Jz(),constant:xk(),each:OR(),filter:VR(),has:GR(),isArray:vn(),isEmpty:wU(),isFunction:pu(),isUndefined:KR(),keys:Ps(),map:XR(),reduce:QR(),size:AU(),transform:IU(),union:WU(),values:rA()}}catch{}return e||(e=window._),Ax=e,Ax}var Ix,XE;function wk(){if(XE)return Ix;XE=1;var e=ti();Ix=i;var t="\0",r="\0",a="";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[r]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}i.prototype._nodeCount=0,i.prototype._edgeCount=0,i.prototype.isDirected=function(){return this._isDirected},i.prototype.isMultigraph=function(){return this._isMultigraph},i.prototype.isCompound=function(){return this._isCompound},i.prototype.setGraph=function(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,y=this;return e.each(p,function(v){m.length>1?y.setNode(v,h):y.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]=r,this._children[p]={},this._children[r][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(y){h.removeEdge(h._edgeObjs[y])};delete this._nodes[p],this._isCompound&&(this._removeFromParentsChildList(p),delete this._parent[p],e.each(this.children(p),function(y){h.setParent(y)}),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=r;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!==r)return h}},i.prototype.children=function(p){if(e.isUndefined(p)&&(p=r),this._isCompound){var h=this._children[p];if(h)return e.keys(h)}else{if(p===r)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 y={};function v(k){var _=m.parent(k);return _===void 0||h.hasNode(_)?(y[k]=_,_):_ in y?y[_]:v(_)}return this._isCompound&&e.each(h.nodes(),function(k){h.setParent(k,v(k))}),h},i.prototype.setDefaultEdgeLabel=function(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,y=arguments;return e.reduce(p,function(v,k){return y.length>1?m.setEdge(v,k,h):m.setEdge(v,k),k}),this},i.prototype.setEdge=function(){var p,h,m,y,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&&(y=arguments[1],v=!0)):(p=k,h=arguments[1],m=arguments[3],arguments.length>2&&(y=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[_]=y),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?y:this._defaultEdgeLabelFn(p,h,m);var w=d(this._isDirected,p,h,m);return p=w.v,h=w.w,Object.freeze(w),this._edgeObjs[_]=w,o(this._preds[h],p),o(this._sucs[p],h),this._in[h][_]=w,this._out[p][_]=w,this._edgeCount++,this},i.prototype.edge=function(p,h,m){var y=arguments.length===1?f(this._isDirected,arguments[0]):u(this._isDirected,p,h,m);return this._edgeLabels[y]},i.prototype.hasEdge=function(p,h,m){var y=arguments.length===1?f(this._isDirected,arguments[0]):u(this._isDirected,p,h,m);return e.has(this._edgeLabels,y)},i.prototype.removeEdge=function(p,h,m){var y=arguments.length===1?f(this._isDirected,arguments[0]):u(this._isDirected,p,h,m),v=this._edgeObjs[y];return v&&(p=v.v,h=v.w,delete this._edgeLabels[y],delete this._edgeObjs[y],l(this._preds[h],p),l(this._sucs[p],h),delete this._in[h][y],delete this._out[p][y],this._edgeCount--),this},i.prototype.inEdges=function(p,h){var m=this._in[p];if(m){var y=e.values(m);return h?e.filter(y,function(v){return v.v===h}):y}},i.prototype.outEdges=function(p,h){var m=this._out[p];if(m){var y=e.values(m);return h?e.filter(y,function(v){return v.w===h}):y}},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,y){var v=""+h,k=""+m;if(!p&&v>k){var _=v;v=k,k=_}return v+a+k+a+(e.isUndefined(y)?t:y)}function d(p,h,m,y){var v=""+h,k=""+m;if(!p&&v>k){var _=v;v=k,k=_}var w={v,w:k};return y&&(w.name=y),w}function f(p,h){return u(p,h.v,h.w,h.name)}return Ix}var Mx,QE;function GU(){return QE||(QE=1,Mx="2.1.8"),Mx}var Lx,ZE;function KU(){return ZE||(ZE=1,Lx={Graph:wk(),version:GU()}),Lx}var Ox,JE;function YU(){if(JE)return Ox;JE=1;var e=ti(),t=wk();Ox={write:r,read:o};function r(l){var u={options:{directed:l.isDirected(),multigraph:l.isMultigraph(),compound:l.isCompound()},nodes:a(l),edges:i(l)};return e.isUndefined(l.graph())||(u.value=e.clone(l.graph())),u}function a(l){return e.map(l.nodes(),function(u){var d=l.node(u),f=l.parent(u),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 Ox}var Dx,ej;function XU(){if(ej)return Dx;ej=1;var e=ti();Dx=t;function t(r){var a={},i=[],o;function l(u){e.has(a,u)||(a[u]=!0,o.push(u),e.each(r.successors(u),l),e.each(r.predecessors(u),l))}return e.each(r.nodes(),function(u){o=[],l(u),o.length&&i.push(o)}),i}return Dx}var Px,tj;function nA(){if(tj)return Px;tj=1;var e=ti();Px=t;function t(){this._arr=[],this._keyIndices={}}return t.prototype.size=function(){return this._arr.length},t.prototype.keys=function(){return this._arr.map(function(r){return r.key})},t.prototype.has=function(r){return e.has(this._keyIndices,r)},t.prototype.priority=function(r){var a=this._keyIndices[r];if(a!==void 0)return this._arr[a].priority},t.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},t.prototype.add=function(r,a){var i=this._keyIndices;if(r=String(r),!e.has(i,r)){var o=this._arr,l=o.length;return i[r]=l,o.push({key:r,priority:a}),this._decrease(l),!0}return!1},t.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var r=this._arr.pop();return delete this._keyIndices[r.key],this._heapify(0),r.key},t.prototype.decrease=function(r,a){var i=this._keyIndices[r];if(a>this._arr[i].priority)throw new Error("New priority is greater than current priority. Key: "+r+" Old: "+this._arr[i].priority+" New: "+a);this._arr[i].priority=a,this._decrease(i)},t.prototype._heapify=function(r){var a=this._arr,i=2*r,o=i+1,l=r;i<a.length&&(l=a[i].priority<a[l].priority?i:l,o<a.length&&(l=a[o].priority<a[l].priority?o:l),l!==r&&(this._swap(r,l),this._heapify(l)))},t.prototype._decrease=function(r){for(var a=this._arr,i=a[r].priority,o;r!==0&&(o=r>>1,!(a[o].priority<i));)this._swap(r,o),r=o},t.prototype._swap=function(r,a){var i=this._arr,o=this._keyIndices,l=i[r],u=i[a];i[r]=u,i[a]=l,o[u.key]=r,o[l.key]=a},Px}var Fx,rj;function aA(){if(rj)return Fx;rj=1;var e=ti(),t=nA();Fx=a;var r=e.constant(1);function a(o,l,u,d){return i(o,String(l),u||r,d||function(f){return o.outEdges(f)})}function i(o,l,u,d){var f={},p=new t,h,m,y=function(v){var k=v.v!==h?v.v:v.w,_=f[k],w=u(v),N=m.distance+w;if(w<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+v+" Weight: "+w);N<_.distance&&(_.distance=N,_.predecessor=h,p.decrease(k,N))};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(y);return f}return Fx}var Bx,nj;function QU(){if(nj)return Bx;nj=1;var e=aA(),t=ti();Bx=r;function r(a,i,o){return t.transform(a.nodes(),function(l,u){l[u]=e(a,u,i,o)},{})}return Bx}var zx,aj;function iA(){if(aj)return zx;aj=1;var e=ti();zx=t;function t(r){var a=0,i=[],o={},l=[];function u(d){var f=o[d]={onStack:!0,lowlink:a,index:a++};if(i.push(d),r.successors(d).forEach(function(m){e.has(o,m)?o[m].onStack&&(f.lowlink=Math.min(f.lowlink,o[m].index)):(u(m),f.lowlink=Math.min(f.lowlink,o[m].lowlink))}),f.lowlink===f.index){var p=[],h;do h=i.pop(),o[h].onStack=!1,p.push(h);while(d!==h);l.push(p)}}return r.nodes().forEach(function(d){e.has(o,d)||u(d)}),l}return zx}var Ux,ij;function ZU(){if(ij)return Ux;ij=1;var e=ti(),t=iA();Ux=r;function r(a){return e.filter(t(a),function(i){return i.length>1||i.length===1&&a.hasEdge(i[0],i[0])})}return Ux}var qx,sj;function JU(){if(sj)return qx;sj=1;var e=ti();qx=r;var t=e.constant(1);function r(i,o,l){return a(i,o||t,l||function(u){return i.outEdges(u)})}function a(i,o,l){var u={},d=i.nodes();return d.forEach(function(f){u[f]={},u[f][f]={distance:0},d.forEach(function(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(y){var v=m[f],k=p[y],_=m[y],w=v.distance+k.distance;w<_.distance&&(_.distance=w,_.predecessor=k.predecessor)})})}),u}return qx}var Hx,oj;function sA(){if(oj)return Hx;oj=1;var e=ti();Hx=t,t.CycleException=r;function t(a){var i={},o={},l=[];function u(d){if(e.has(o,d))throw new r;e.has(i,d)||(o[d]=!0,i[d]=!0,e.each(a.predecessors(d),u),delete o[d],l.push(d))}if(e.each(a.sinks(),u),e.size(i)!==a.nodeCount())throw new r;return l}function r(){}return r.prototype=new Error,Hx}var $x,lj;function eq(){if(lj)return $x;lj=1;var e=sA();$x=t;function t(r){try{e(r)}catch(a){if(a instanceof e.CycleException)return!1;throw a}return!0}return $x}var Wx,cj;function oA(){if(cj)return Wx;cj=1;var e=ti();Wx=t;function t(a,i,o){e.isArray(i)||(i=[i]);var l=(a.isDirected()?a.successors:a.neighbors).bind(a),u=[],d={};return e.each(i,function(f){if(!a.hasNode(f))throw new Error("Graph does not have node: "+f);r(a,f,o==="post",d,l,u)}),u}function r(a,i,o,l,u,d){e.has(l,i)||(l[i]=!0,o||d.push(i),e.each(u(i),function(f){r(a,f,o,l,u,d)}),o&&d.push(i))}return Wx}var Vx,uj;function tq(){if(uj)return Vx;uj=1;var e=oA();Vx=t;function t(r,a){return e(r,a,"post")}return Vx}var Gx,dj;function rq(){if(dj)return Gx;dj=1;var e=oA();Gx=t;function t(r,a){return e(r,a,"pre")}return Gx}var Kx,fj;function nq(){if(fj)return Kx;fj=1;var e=ti(),t=wk(),r=nA();Kx=a;function a(i,o){var l=new t,u={},d=new r,f;function p(m){var y=m.v===f?m.w:m.v,v=d.priority(y);if(v!==void 0){var k=o(m);k<v&&(u[y]=f,d.decrease(y,k))}}if(i.nodeCount()===0)return l;e.each(i.nodes(),function(m){d.add(m,Number.POSITIVE_INFINITY),l.setNode(m)}),d.decrease(i.nodes()[0],0);for(var h=!1;d.size()>0;){if(f=d.removeMin(),e.has(u,f))l.setEdge(f,u[f]);else{if(h)throw new Error("Input graph is not connected: "+i);h=!0}i.nodeEdges(f).forEach(p)}return l}return Kx}var Yx,pj;function aq(){return pj||(pj=1,Yx={components:XU(),dijkstra:aA(),dijkstraAll:QU(),findCycles:ZU(),floydWarshall:JU(),isAcyclic:eq(),postorder:tq(),preorder:rq(),prim:nq(),tarjan:iA(),topsort:sA()}),Yx}var Xx,gj;function iq(){if(gj)return Xx;gj=1;var e=KU();return Xx={Graph:e.Graph,json:YU(),alg:aq(),version:e.version},Xx}var Qx,hj;function bi(){if(hj)return Qx;hj=1;var e;if(typeof ok=="function")try{e=iq()}catch{}return e||(e=window.graphlib),Qx=e,Qx}var Zx,mj;function sq(){if(mj)return Zx;mj=1;var e=IR(),t=1,r=4;function a(i){return e(i,t|r)}return Zx=a,Zx}var Jx,xj;function Wf(){if(xj)return Jx;xj=1;var e=Pl(),t=ts(),r=Df(),a=ei();function i(o,l,u){if(!a(u))return!1;var d=typeof l;return(d=="number"?t(u)&&r(l,u.length):d=="string"&&l in u)?e(u[l],o):!1}return Jx=i,Jx}var ey,yj;function oq(){if(yj)return ey;yj=1;var e=$f(),t=Pl(),r=Wf(),a=Lo(),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&&r(d[0],d[1],h)&&(p=1);++f<p;)for(var m=d[f],y=a(m),v=-1,k=y.length;++v<k;){var _=y[v],w=u[_];(w===void 0||t(w,i[_])&&!o.call(u,_))&&(u[_]=m[_])}return u});return ey=l,ey}var ty,bj;function lq(){if(bj)return ty;bj=1;var e=rs(),t=ts(),r=Ps();function a(i){return function(o,l,u){var d=Object(o);if(!t(o)){var f=e(l,3);o=r(o),l=function(h){return f(d[h],h,d)}}var p=i(o,l,u);return p>-1?d[f?o[p]:p]:void 0}}return ty=a,ty}var ry,vj;function cq(){if(vj)return ry;vj=1;var e=/\s/;function t(r){for(var a=r.length;a--&&e.test(r.charAt(a)););return a}return ry=t,ry}var ny,kj;function uq(){if(kj)return ny;kj=1;var e=cq(),t=/^\s+/;function r(a){return a&&a.slice(0,e(a)+1).replace(t,"")}return ny=r,ny}var ay,_j;function dq(){if(_j)return ay;_j=1;var e=uq(),t=ei(),r=Ul(),a=NaN,i=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,l=/^0o[0-7]+$/i,u=parseInt;function d(f){if(typeof f=="number")return f;if(r(f))return a;if(t(f)){var 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)?a:+f}return ay=d,ay}var iy,wj;function lA(){if(wj)return iy;wj=1;var e=dq(),t=1/0,r=17976931348623157e292;function a(i){if(!i)return i===0?i:0;if(i=e(i),i===t||i===-t){var o=i<0?-1:1;return o*r}return i===i?i:0}return iy=a,iy}var sy,Sj;function fq(){if(Sj)return sy;Sj=1;var e=lA();function t(r){var a=e(r),i=a%1;return a===a?i?a-i:a:0}return sy=t,sy}var oy,Nj;function pq(){if(Nj)return oy;Nj=1;var e=eA(),t=rs(),r=fq(),a=Math.max;function i(o,l,u){var d=o==null?0:o.length;if(!d)return-1;var f=u==null?0:r(u);return f<0&&(f=a(d+f,0)),e(o,t(l,3),f)}return oy=i,oy}var ly,Ej;function gq(){if(Ej)return ly;Ej=1;var e=lq(),t=pq(),r=e(t);return ly=r,ly}var cy,jj;function cA(){if(jj)return cy;jj=1;var e=_k();function t(r){var a=r==null?0:r.length;return a?e(r,1):[]}return cy=t,cy}var uy,Cj;function hq(){if(Cj)return uy;Cj=1;var e=yk(),t=MR(),r=Lo();function a(i,o){return i==null?i:e(i,t(o),r)}return uy=a,uy}var dy,Tj;function mq(){if(Tj)return dy;Tj=1;function e(t){var r=t==null?0:t.length;return r?t[r-1]:void 0}return dy=e,dy}var fy,Rj;function xq(){if(Rj)return fy;Rj=1;var e=Lf(),t=bk(),r=rs();function a(i,o){var l={};return o=r(o,3),t(i,function(u,d,f){e(l,d,o(u,d,f))}),l}return fy=a,fy}var py,Aj;function Sk(){if(Aj)return py;Aj=1;var e=Ul();function t(r,a,i){for(var o=-1,l=r.length;++o<l;){var u=r[o],d=a(u);if(d!=null&&(f===void 0?d===d&&!e(d):i(d,f)))var f=d,p=u}return p}return py=t,py}var gy,Ij;function yq(){if(Ij)return gy;Ij=1;function e(t,r){return t>r}return gy=e,gy}var hy,Mj;function bq(){if(Mj)return hy;Mj=1;var e=Sk(),t=yq(),r=Oo();function a(i){return i&&i.length?e(i,r,t):void 0}return hy=a,hy}var my,Lj;function uA(){if(Lj)return my;Lj=1;var e=Lf(),t=Pl();function r(a,i,o){(o!==void 0&&!t(a[i],o)||o===void 0&&!(i in a))&&e(a,i,o)}return my=r,my}var xy,Oj;function vq(){if(Oj)return xy;Oj=1;var e=Io(),t=Bf(),r=Pi(),a="[object Object]",i=Function.prototype,o=Object.prototype,l=i.toString,u=o.hasOwnProperty,d=l.call(Object);function f(p){if(!r(p)||e(p)!=a)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 xy=f,xy}var yy,Dj;function dA(){if(Dj)return yy;Dj=1;function e(t,r){if(!(r==="constructor"&&typeof t[r]=="function")&&r!="__proto__")return t[r]}return yy=e,yy}var by,Pj;function kq(){if(Pj)return by;Pj=1;var e=gu(),t=Lo();function r(a){return e(a,t(a))}return by=r,by}var vy,Fj;function _q(){if(Fj)return vy;Fj=1;var e=uA(),t=vR(),r=TR(),a=kR(),i=AR(),o=hu(),l=vn(),u=tA(),d=Bl(),f=pu(),p=ei(),h=vq(),m=mu(),y=dA(),v=kq();function k(_,w,N,E,A,T,C){var j=y(_,N),M=y(w,N),L=C.get(M);if(L){e(_,N,L);return}var I=T?T(j,M,N+"",_,w,C):void 0,B=I===void 0;if(B){var z=l(M),ee=!z&&d(M),V=!z&&!ee&&m(M);I=M,z||ee||V?l(j)?I=j:u(j)?I=a(j):ee?(B=!1,I=t(M,!0)):V?(B=!1,I=r(M,!0)):I=[]:h(M)||o(M)?(I=j,o(j)?I=v(j):(!p(j)||f(j))&&(I=i(M))):B=!1}B&&(C.set(M,I),A(I,M,E,T,C),C.delete(M)),e(_,N,I)}return vy=k,vy}var ky,Bj;function wq(){if(Bj)return ky;Bj=1;var e=Mf(),t=uA(),r=yk(),a=_q(),i=ei(),o=Lo(),l=dA();function u(d,f,p,h,m){d!==f&&r(f,function(y,v){if(m||(m=new e),i(y))a(d,f,v,p,u,h,m);else{var k=h?h(l(d,v),y,v+"",d,f,m):void 0;k===void 0&&(k=y),t(d,v,k)}},o)}return ky=u,ky}var _y,zj;function Sq(){if(zj)return _y;zj=1;var e=$f(),t=Wf();function r(a){return e(function(i,o){var l=-1,u=o.length,d=u>1?o[u-1]:void 0,f=u>2?o[2]:void 0;for(d=a.length>3&&typeof d=="function"?(u--,d):void 0,f&&t(o[0],o[1],f)&&(d=u<3?void 0:d,u=1),i=Object(i);++l<u;){var p=o[l];p&&a(i,p,l,d)}return i})}return _y=r,_y}var wy,Uj;function Nq(){if(Uj)return wy;Uj=1;var e=wq(),t=Sq(),r=t(function(a,i,o){e(a,i,o)});return wy=r,wy}var Sy,qj;function fA(){if(qj)return Sy;qj=1;function e(t,r){return t<r}return Sy=e,Sy}var Ny,Hj;function Eq(){if(Hj)return Ny;Hj=1;var e=Sk(),t=fA(),r=Oo();function a(i){return i&&i.length?e(i,r,t):void 0}return Ny=a,Ny}var Ey,$j;function jq(){if($j)return Ey;$j=1;var e=Sk(),t=rs(),r=fA();function a(i,o){return i&&i.length?e(i,t(o,2),r):void 0}return Ey=a,Ey}var jy,Wj;function Cq(){if(Wj)return jy;Wj=1;var e=vi(),t=function(){return e.Date.now()};return jy=t,jy}var Cy,Vj;function Tq(){if(Vj)return Cy;Vj=1;var e=Of(),t=qf(),r=Df(),a=ei(),i=xu();function o(l,u,d,f){if(!a(l))return l;u=t(u,l);for(var p=-1,h=u.length,m=h-1,y=l;y!=null&&++p<h;){var v=i(u[p]),k=d;if(v==="__proto__"||v==="constructor"||v==="prototype")return l;if(p!=m){var _=y[v];k=f?f(_,v,y):void 0,k===void 0&&(k=a(_)?_:r(u[p+1])?[]:{})}e(y,v,k),y=y[v]}return l}return Cy=o,Cy}var Ty,Gj;function Rq(){if(Gj)return Ty;Gj=1;var e=Hf(),t=Tq(),r=qf();function a(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,r(p,i),h)}return f}return Ty=a,Ty}var Ry,Kj;function Aq(){if(Kj)return Ry;Kj=1;var e=Rq(),t=$R();function r(a,i){return e(a,i,function(o,l){return t(a,l)})}return Ry=r,Ry}var Ay,Yj;function Iq(){if(Yj)return Ay;Yj=1;var e=cA(),t=ZR(),r=JR();function a(i){return r(t(i,void 0,e),i+"")}return Ay=a,Ay}var Iy,Xj;function Mq(){if(Xj)return Iy;Xj=1;var e=Aq(),t=Iq(),r=t(function(a,i){return a==null?{}:e(a,i)});return Iy=r,Iy}var My,Qj;function Lq(){if(Qj)return My;Qj=1;var e=Math.ceil,t=Math.max;function r(a,i,o,l){for(var u=-1,d=t(e((i-a)/(o||1)),0),f=Array(d);d--;)f[l?d:++u]=a,a+=o;return f}return My=r,My}var Ly,Zj;function Oq(){if(Zj)return Ly;Zj=1;var e=Lq(),t=Wf(),r=lA();function a(i){return function(o,l,u){return u&&typeof u!="number"&&t(o,l,u)&&(l=u=void 0),o=r(o),l===void 0?(l=o,o=0):l=r(l),u=u===void 0?o<l?1:-1:r(u),e(o,l,u,i)}}return Ly=a,Ly}var Oy,Jj;function Dq(){if(Jj)return Oy;Jj=1;var e=Oq(),t=e();return Oy=t,Oy}var Dy,eC;function Pq(){if(eC)return Dy;eC=1;function e(t,r){var a=t.length;for(t.sort(r);a--;)t[a]=t[a].value;return t}return Dy=e,Dy}var Py,tC;function Fq(){if(tC)return Py;tC=1;var e=Ul();function t(r,a){if(r!==a){var i=r!==void 0,o=r===null,l=r===r,u=e(r),d=a!==void 0,f=a===null,p=a===a,h=e(a);if(!f&&!h&&!u&&r>a||u&&d&&p&&!f&&!h||o&&d&&p||!i&&p||!l)return 1;if(!o&&!u&&!h&&r<a||h&&i&&l&&!o&&!u||f&&i&&l||!d&&l||!p)return-1}return 0}return Py=t,Py}var Fy,rC;function Bq(){if(rC)return Fy;rC=1;var e=Fq();function t(r,a,i){for(var o=-1,l=r.criteria,u=a.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 r.index-a.index}return Fy=t,Fy}var By,nC;function zq(){if(nC)return By;nC=1;var e=Uf(),t=Hf(),r=rs(),a=YR(),i=Pq(),o=Pf(),l=Bq(),u=Oo(),d=vn();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 y=-1;h=e(h,o(r));var v=a(p,function(k,_,w){var N=e(h,function(E){return E(k)});return{criteria:N,index:++y,value:k}});return i(v,function(k,_){return l(k,_,m)})}return By=f,By}var zy,aC;function Uq(){if(aC)return zy;aC=1;var e=_k(),t=zq(),r=$f(),a=Wf(),i=r(function(o,l){if(o==null)return[];var u=l.length;return u>1&&a(o,l[0],l[1])?l=[]:u>2&&a(l[0],l[1],l[2])&&(l=[l[0]]),t(o,e(l,1),[])});return zy=i,zy}var Uy,iC;function qq(){if(iC)return Uy;iC=1;var e=qR(),t=0;function r(a){var i=++t;return e(a)+i}return Uy=r,Uy}var qy,sC;function Hq(){if(sC)return qy;sC=1;function e(t,r,a){for(var i=-1,o=t.length,l=r.length,u={};++i<o;){var d=i<l?r[i]:void 0;a(u,t[i],d)}return u}return qy=e,qy}var Hy,oC;function $q(){if(oC)return Hy;oC=1;var e=Of(),t=Hq();function r(a,i){return t(a||[],i||[],e)}return Hy=r,Hy}var $y,lC;function tn(){if(lC)return $y;lC=1;var e;if(typeof ok=="function")try{e={cloneDeep:sq(),constant:xk(),defaults:oq(),each:OR(),filter:VR(),find:gq(),flatten:cA(),forEach:LR(),forIn:hq(),has:GR(),isUndefined:KR(),last:mq(),map:XR(),mapValues:xq(),max:bq(),merge:Nq(),min:Eq(),minBy:jq(),now:Cq(),pick:Mq(),range:Dq(),reduce:QR(),sortBy:Uq(),uniqueId:qq(),values:rA(),zipObject:$q()}}catch{}return e||(e=window._),$y=e,$y}var Wy,cC;function Wq(){if(cC)return Wy;cC=1,Wy=e;function e(){var a={};a._next=a._prev=a,this._sentinel=a}e.prototype.dequeue=function(){var a=this._sentinel,i=a._prev;if(i!==a)return t(i),i},e.prototype.enqueue=function(a){var i=this._sentinel;a._prev&&a._next&&t(a),a._next=i._next,i._next._prev=a,i._next=a,a._prev=i},e.prototype.toString=function(){for(var a=[],i=this._sentinel,o=i._prev;o!==i;)a.push(JSON.stringify(o,r)),o=o._prev;return"["+a.join(", ")+"]"};function t(a){a._prev._next=a._next,a._next._prev=a._prev,delete a._next,delete a._prev}function r(a,i){if(a!=="_next"&&a!=="_prev")return i}return Wy}var Vy,uC;function Vq(){if(uC)return Vy;uC=1;var e=tn(),t=bi().Graph,r=Wq();Vy=i;var a=e.constant(1);function i(f,p){if(f.nodeCount()<=1)return[];var h=u(f,p||a),m=o(h.graph,h.buckets,h.zeroIdx);return e.flatten(e.map(m,function(y){return f.outEdges(y.v,y.w)}),!0)}function o(f,p,h){for(var m=[],y=p[p.length-1],v=p[0],k;f.nodeCount();){for(;k=v.dequeue();)l(f,p,h,k);for(;k=y.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,y){var v=y?[]:void 0;return e.forEach(f.inEdges(m.v),function(k){var _=f.edge(k),w=f.node(k.v);y&&v.push({v:k.v,w:k.w}),w.out-=_,d(p,h,w)}),e.forEach(f.outEdges(m.v),function(k){var _=f.edge(k),w=k.w,N=f.node(w);N.in-=_,d(p,h,N)}),f.removeNode(m.v),v}function u(f,p){var h=new t,m=0,y=0;e.forEach(f.nodes(),function(_){h.setNode(_,{v:_,in:0,out:0})}),e.forEach(f.edges(),function(_){var w=h.edge(_.v,_.w)||0,N=p(_),E=w+N;h.setEdge(_.v,_.w,E),y=Math.max(y,h.node(_.v).out+=N),m=Math.max(m,h.node(_.w).in+=N)});var v=e.range(y+m+3).map(function(){return new r}),k=m+1;return e.forEach(h.nodes(),function(_){d(v,k,h.node(_))}),{graph:h,buckets:v,zeroIdx:k}}function d(f,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 Vy}var Gy,dC;function Gq(){if(dC)return Gy;dC=1;var e=tn(),t=Vq();Gy={run:r,undo:i};function r(o){var l=o.graph().acyclicer==="greedy"?t(o,u(o)):a(o);e.forEach(l,function(d){var f=o.edge(d);o.removeEdge(d),f.forwardName=d.name,f.reversed=!0,o.setEdge(d.w,d.v,f,e.uniqueId("rev"))});function u(d){return function(f){return d.edge(f).weight}}}function a(o){var l=[],u={},d={};function f(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 Gy}var Ky,fC;function va(){if(fC)return Ky;fC=1;var e=tn(),t=bi().Graph;Ky={addDummyNode:r,simplify:a,asNonCompoundGraph:i,successorWeights:o,predecessorWeights:l,intersectRect:u,buildLayerMatrix:d,normalizeRanks:f,removeEmptyRanks:p,addBorderNode:h,maxRank:m,partition:y,time:v,notime:k};function r(_,w,N,E){var A;do A=e.uniqueId(E);while(_.hasNode(A));return N.dummy=w,_.setNode(A,N),A}function a(_){var w=new t().setGraph(_.graph());return e.forEach(_.nodes(),function(N){w.setNode(N,_.node(N))}),e.forEach(_.edges(),function(N){var E=w.edge(N.v,N.w)||{weight:0,minlen:1},A=_.edge(N);w.setEdge(N.v,N.w,{weight:E.weight+A.weight,minlen:Math.max(E.minlen,A.minlen)})}),w}function i(_){var w=new t({multigraph:_.isMultigraph()}).setGraph(_.graph());return e.forEach(_.nodes(),function(N){_.children(N).length||w.setNode(N,_.node(N))}),e.forEach(_.edges(),function(N){w.setEdge(N,_.edge(N))}),w}function o(_){var w=e.map(_.nodes(),function(N){var E={};return e.forEach(_.outEdges(N),function(A){E[A.w]=(E[A.w]||0)+_.edge(A).weight}),E});return e.zipObject(_.nodes(),w)}function l(_){var w=e.map(_.nodes(),function(N){var E={};return e.forEach(_.inEdges(N),function(A){E[A.v]=(E[A.v]||0)+_.edge(A).weight}),E});return e.zipObject(_.nodes(),w)}function u(_,w){var N=_.x,E=_.y,A=w.x-N,T=w.y-E,C=_.width/2,j=_.height/2;if(!A&&!T)throw new Error("Not possible to find intersection inside of the rectangle");var M,L;return Math.abs(T)*C>Math.abs(A)*j?(T<0&&(j=-j),M=j*A/T,L=j):(A<0&&(C=-C),M=C,L=C*T/A),{x:N+M,y:E+L}}function d(_){var w=e.map(e.range(m(_)+1),function(){return[]});return e.forEach(_.nodes(),function(N){var E=_.node(N),A=E.rank;e.isUndefined(A)||(w[A][E.order]=N)}),w}function f(_){var w=e.min(e.map(_.nodes(),function(N){return _.node(N).rank}));e.forEach(_.nodes(),function(N){var E=_.node(N);e.has(E,"rank")&&(E.rank-=w)})}function p(_){var w=e.min(e.map(_.nodes(),function(T){return _.node(T).rank})),N=[];e.forEach(_.nodes(),function(T){var C=_.node(T).rank-w;N[C]||(N[C]=[]),N[C].push(T)});var E=0,A=_.graph().nodeRankFactor;e.forEach(N,function(T,C){e.isUndefined(T)&&C%A!==0?--E:E&&e.forEach(T,function(j){_.node(j).rank+=E})})}function h(_,w,N,E){var A={width:0,height:0};return arguments.length>=4&&(A.rank=N,A.order=E),r(_,"border",A,w)}function m(_){return e.max(e.map(_.nodes(),function(w){var N=_.node(w).rank;if(!e.isUndefined(N))return N}))}function y(_,w){var N={lhs:[],rhs:[]};return e.forEach(_,function(E){w(E)?N.lhs.push(E):N.rhs.push(E)}),N}function v(_,w){var N=e.now();try{return w()}finally{console.log(_+" time: "+(e.now()-N)+"ms")}}function k(_,w){return w()}return Ky}var Yy,pC;function Kq(){if(pC)return Yy;pC=1;var e=tn(),t=va();Yy={run:r,undo:i};function r(o){o.graph().dummyChains=[],e.forEach(o.edges(),function(l){a(o,l)})}function a(o,l){var u=l.v,d=o.node(u).rank,f=l.w,p=o.node(f).rank,h=l.name,m=o.edge(l),y=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===y&&(k.width=m.width,k.height=m.height,k.dummy="edge-label",k.labelpos=m.labelpos),o.setEdge(u,v,{weight:m.weight},h),_===0&&o.graph().dummyChains.push(v),u=v;o.setEdge(u,f,{weight:m.weight},h)}}function i(o){e.forEach(o.graph().dummyChains,function(l){var u=o.node(l),d=u.edgeLabel,f;for(o.setEdge(u.edgeObj,d);u.dummy;)f=o.successors(l)[0],o.removeNode(l),d.points.push({x:u.x,y:u.y}),u.dummy==="edge-label"&&(d.x=u.x,d.y=u.y,d.width=u.width,d.height=u.height),l=f,u=o.node(l)})}return Yy}var Xy,gC;function df(){if(gC)return Xy;gC=1;var e=tn();Xy={longestPath:t,slack:r};function t(a){var i={};function o(l){var u=a.node(l);if(e.has(i,l))return u.rank;i[l]=!0;var d=e.min(e.map(a.outEdges(l),function(f){return o(f.w)-a.edge(f).minlen}));return(d===Number.POSITIVE_INFINITY||d===void 0||d===null)&&(d=0),u.rank=d}e.forEach(a.sources(),o)}function r(a,i){return a.node(i.w).rank-a.node(i.v).rank-a.edge(i).minlen}return Xy}var Qy,hC;function pA(){if(hC)return Qy;hC=1;var e=tn(),t=bi().Graph,r=df().slack;Qy=a;function a(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)?r(u,h):-r(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,y=p===m?h.w:m;!u.hasNode(y)&&!r(d,h)&&(u.setNode(y,{}),u.setEdge(p,y,{}),f(y))})}return e.forEach(u.nodes(),f),u.nodeCount()}function o(u,d){return e.minBy(d.edges(),function(f){if(u.hasNode(f.v)!==u.hasNode(f.w))return r(d,f)})}function l(u,d,f){e.forEach(u.nodes(),function(p){d.node(p).rank+=f})}return Qy}var Zy,mC;function Yq(){if(mC)return Zy;mC=1;var e=tn(),t=pA(),r=df().slack,a=df().longestPath,i=bi().alg.preorder,o=bi().alg.postorder,l=va().simplify;Zy=u,u.initLowLimValues=h,u.initCutValues=d,u.calcCutValue=p,u.leaveEdge=y,u.enterEdge=v,u.exchangeEdges=k;function u(E){E=l(E),a(E);var A=t(E);h(A),d(A,E);for(var T,C;T=y(A);)C=v(A,E,T),k(A,E,T,C)}function d(E,A){var T=o(E,E.nodes());T=T.slice(0,T.length-1),e.forEach(T,function(C){f(E,A,C)})}function f(E,A,T){var C=E.node(T),j=C.parent;E.edge(T,j).cutvalue=p(E,A,T)}function p(E,A,T){var C=E.node(T),j=C.parent,M=!0,L=A.edge(T,j),I=0;return L||(M=!1,L=A.edge(j,T)),I=L.weight,e.forEach(A.nodeEdges(T),function(B){var z=B.v===T,ee=z?B.w:B.v;if(ee!==j){var V=z===M,D=A.edge(B).weight;if(I+=V?D:-D,w(E,T,ee)){var K=E.edge(T,ee).cutvalue;I+=V?-K:K}}}),I}function h(E,A){arguments.length<2&&(A=E.nodes()[0]),m(E,{},1,A)}function m(E,A,T,C,j){var M=T,L=E.node(C);return A[C]=!0,e.forEach(E.neighbors(C),function(I){e.has(A,I)||(T=m(E,A,T,I,C))}),L.low=M,L.lim=T++,j?L.parent=j:delete L.parent,T}function y(E){return e.find(E.edges(),function(A){return E.edge(A).cutvalue<0})}function v(E,A,T){var C=T.v,j=T.w;A.hasEdge(C,j)||(C=T.w,j=T.v);var M=E.node(C),L=E.node(j),I=M,B=!1;M.lim>L.lim&&(I=L,B=!0);var z=e.filter(A.edges(),function(ee){return B===N(E,E.node(ee.v),I)&&B!==N(E,E.node(ee.w),I)});return e.minBy(z,function(ee){return r(A,ee)})}function k(E,A,T,C){var j=T.v,M=T.w;E.removeEdge(j,M),E.setEdge(C.v,C.w,{}),h(E),d(E,A),_(E,A)}function _(E,A){var T=e.find(E.nodes(),function(j){return!A.node(j).parent}),C=i(E,T);C=C.slice(1),e.forEach(C,function(j){var M=E.node(j).parent,L=A.edge(j,M),I=!1;L||(L=A.edge(M,j),I=!0),A.node(j).rank=A.node(M).rank+(I?L.minlen:-L.minlen)})}function w(E,A,T){return E.hasEdge(A,T)}function N(E,A,T){return T.low<=A.lim&&A.lim<=T.lim}return Zy}var Jy,xC;function Xq(){if(xC)return Jy;xC=1;var e=df(),t=e.longestPath,r=pA(),a=Yq();Jy=i;function i(d){switch(d.graph().ranker){case"network-simplex":u(d);break;case"tight-tree":l(d);break;case"longest-path":o(d);break;default:u(d)}}var o=t;function l(d){t(d),r(d)}function u(d){a(d)}return Jy}var eb,yC;function Qq(){if(yC)return eb;yC=1;var e=tn();eb=t;function t(i){var o=a(i);e.forEach(i.graph().dummyChains,function(l){for(var u=i.node(l),d=u.edgeObj,f=r(i,o,d.v,d.w),p=f.path,h=f.lca,m=0,y=p[m],v=!0;l!==d.w;){if(u=i.node(l),v){for(;(y=p[m])!==h&&i.node(y).maxRank<u.rank;)m++;y===h&&(v=!1)}if(!v){for(;m<p.length-1&&i.node(y=p[m+1]).minRank<=u.rank;)m++;y=p[m]}i.setParent(l,y),l=i.successors(l)[0]}})}function r(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,y;m=l;do m=i.parent(m),d.push(m);while(m&&(o[m].low>p||h>o[m].lim));for(y=m,m=u;(m=i.parent(m))!==y;)f.push(m);return{path:d.concat(f.reverse()),lca:y}}function a(i){var o={},l=0;function u(d){var f=l;e.forEach(i.children(d),u),o[d]={low:f,lim:l++}}return e.forEach(i.children(),u),o}return eb}var tb,bC;function Zq(){if(bC)return tb;bC=1;var e=tn(),t=va();tb={run:r,cleanup:l};function r(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(y){u.edge(y).minlen*=h});var m=o(u)+1;e.forEach(u.children(),function(y){a(u,d,h,m,p,f,y)}),u.graph().nodeRankFactor=h}function a(u,d,f,p,h,m,y){var v=u.children(y);if(!v.length){y!==d&&u.setEdge(d,y,{weight:0,minlen:f});return}var k=t.addBorderNode(u,"_bt"),_=t.addBorderNode(u,"_bb"),w=u.node(y);u.setParent(k,y),w.borderTop=k,u.setParent(_,y),w.borderBottom=_,e.forEach(v,function(N){a(u,d,f,p,h,m,N);var E=u.node(N),A=E.borderTop?E.borderTop:N,T=E.borderBottom?E.borderBottom:N,C=E.borderTop?p:2*p,j=A!==T?1:h-m[y]+1;u.setEdge(k,A,{weight:C,minlen:j,nestingEdge:!0}),u.setEdge(T,_,{weight:C,minlen:j,nestingEdge:!0})}),u.parent(y)||u.setEdge(d,k,{weight:0,minlen:h+m[y]})}function i(u){var d={};function f(p,h){var m=u.children(p);m&&m.length&&e.forEach(m,function(y){f(y,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 tb}var rb,vC;function Jq(){if(vC)return rb;vC=1;var e=tn(),t=va();rb=r;function r(i){function o(l){var u=i.children(l),d=i.node(l);if(u.length&&e.forEach(u,o),e.has(d,"minRank")){d.borderLeft=[],d.borderRight=[];for(var f=d.minRank,p=d.maxRank+1;f<p;++f)a(i,"borderLeft","_bl",l,d,f),a(i,"borderRight","_br",l,d,f)}}e.forEach(i.children(),o)}function a(i,o,l,u,d,f){var 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 rb}var nb,kC;function eH(){if(kC)return nb;kC=1;var e=tn();nb={adjust:t,undo:r};function t(f){var p=f.graph().rankdir.toLowerCase();(p==="lr"||p==="rl")&&a(f)}function r(f){var p=f.graph().rankdir.toLowerCase();(p==="bt"||p==="rl")&&o(f),(p==="lr"||p==="rl")&&(u(f),a(f))}function a(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 nb}var ab,_C;function tH(){if(_C)return ab;_C=1;var e=tn();ab=t;function t(r){var a={},i=e.filter(r.nodes(),function(f){return!r.children(f).length}),o=e.max(e.map(i,function(f){return r.node(f).rank})),l=e.map(e.range(o+1),function(){return[]});function u(f){if(!e.has(a,f)){a[f]=!0;var p=r.node(f);l[p.rank].push(f),e.forEach(r.successors(f),u)}}var d=e.sortBy(i,function(f){return r.node(f).rank});return e.forEach(d,u),l}return ab}var ib,wC;function rH(){if(wC)return ib;wC=1;var e=tn();ib=t;function t(a,i){for(var o=0,l=1;l<i.length;++l)o+=r(a,i[l-1],i[l]);return o}function r(a,i,o){for(var l=e.zipObject(o,e.map(o,function(m,y){return y})),u=e.flatten(e.map(i,function(m){return e.sortBy(e.map(a.outEdges(m),function(y){return{pos:l[y.w],weight:a.edge(y).weight}}),"pos")}),!0),d=1;d<o.length;)d<<=1;var f=2*d-1;d-=1;var p=e.map(new Array(f),function(){return 0}),h=0;return e.forEach(u.forEach(function(m){var y=m.pos+d;p[y]+=m.weight;for(var v=0;y>0;)y%2&&(v+=p[y+1]),y=y-1>>1,p[y]+=m.weight;h+=m.weight*v})),h}return ib}var sb,SC;function nH(){if(SC)return sb;SC=1;var e=tn();sb=t;function t(r,a){return e.map(a,function(i){var o=r.inEdges(i);if(o.length){var l=e.reduce(o,function(u,d){var f=r.edge(d),p=r.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 sb}var ob,NC;function aH(){if(NC)return ob;NC=1;var e=tn();ob=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 r(u)}function r(i){var o=[];function l(f){return function(p){p.merged||(e.isUndefined(p.barycenter)||e.isUndefined(f.barycenter)||p.barycenter>=f.barycenter)&&a(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 a(i,o){var l=0,u=0;i.weight&&(l+=i.barycenter*i.weight,u+=i.weight),o.weight&&(l+=o.barycenter*o.weight,u+=o.weight),i.vs=o.vs.concat(i.vs),i.barycenter=l/u,i.weight=u,i.i=Math.min(o.i,i.i),o.merged=!0}return ob}var lb,EC;function iH(){if(EC)return lb;EC=1;var e=tn(),t=va();lb=r;function r(o,l){var u=t.partition(o,function(k){return e.has(k,"barycenter")}),d=u.lhs,f=e.sortBy(u.rhs,function(k){return-k.i}),p=[],h=0,m=0,y=0;d.sort(i(!!l)),y=a(p,f,y),e.forEach(d,function(k){y+=k.vs.length,p.push(k.vs),h+=k.barycenter*k.weight,m+=k.weight,y=a(p,f,y)});var v={vs:e.flatten(p,!0)};return m&&(v.barycenter=h/m,v.weight=m),v}function a(o,l,u){for(var d;l.length&&(d=e.last(l)).i<=u;)l.pop(),o.push(d.vs),u++;return u}function i(o){return function(l,u){return l.barycenter<u.barycenter?-1:l.barycenter>u.barycenter?1:o?u.i-l.i:l.i-u.i}}return lb}var cb,jC;function sH(){if(jC)return cb;jC=1;var e=tn(),t=nH(),r=aH(),a=iH();cb=i;function i(u,d,f,p){var h=u.children(d),m=u.node(d),y=m?m.borderLeft:void 0,v=m?m.borderRight:void 0,k={};y&&(h=e.filter(h,function(T){return T!==y&&T!==v}));var _=t(u,h);e.forEach(_,function(T){if(u.children(T.v).length){var C=i(u,T.v,f,p);k[T.v]=C,e.has(C,"barycenter")&&l(T,C)}});var w=r(_,f);o(w,k);var N=a(w,p);if(y&&(N.vs=e.flatten([y,N.vs,v],!0),u.predecessors(y).length)){var E=u.node(u.predecessors(y)[0]),A=u.node(u.predecessors(v)[0]);e.has(N,"barycenter")||(N.barycenter=0,N.weight=0),N.barycenter=(N.barycenter*N.weight+E.order+A.order)/(N.weight+2),N.weight+=2}return N}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 cb}var ub,CC;function oH(){if(CC)return ub;CC=1;var e=tn(),t=bi().Graph;ub=r;function r(i,o,l){var u=a(i),d=new t({compound:!0}).setGraph({root:u}).setDefaultNodeLabel(function(f){return i.node(f)});return e.forEach(i.nodes(),function(f){var 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 y=m.v===f?m.w:m.v,v=d.edge(y,f),k=e.isUndefined(v)?0:v.weight;d.setEdge(y,f,{weight:i.edge(m).weight+k})}),e.has(p,"minRank")&&d.setNode(f,{borderLeft:p.borderLeft[o],borderRight:p.borderRight[o]}))}),d}function a(i){for(var o;i.hasNode(o=e.uniqueId("_root")););return o}return ub}var db,TC;function lH(){if(TC)return db;TC=1;var e=tn();db=t;function t(r,a,i){var o={},l;e.forEach(i,function(u){for(var d=r.parent(u),f,p;d;){if(f=r.parent(d),f?(p=o[f],o[f]=d):(p=l,l=d),p&&p!==d){a.setEdge(p,d);return}d=f}})}return db}var fb,RC;function cH(){if(RC)return fb;RC=1;var e=tn(),t=tH(),r=rH(),a=sH(),i=oH(),o=lH(),l=bi().Graph,u=va();fb=d;function d(m){var y=u.maxRank(m),v=f(m,e.range(1,y+1),"inEdges"),k=f(m,e.range(y-1,-1,-1),"outEdges"),_=t(m);h(m,_);for(var w=Number.POSITIVE_INFINITY,N,E=0,A=0;A<4;++E,++A){p(E%2?v:k,E%4>=2),_=u.buildLayerMatrix(m);var T=r(m,_);T<w&&(A=0,N=e.cloneDeep(_),w=T)}h(m,N)}function f(m,y,v){return e.map(y,function(k){return i(m,k,v)})}function p(m,y){var v=new l;e.forEach(m,function(k){var _=k.graph().root,w=a(k,_,v,y);e.forEach(w.vs,function(N,E){k.node(N).order=E}),o(k,v,w.vs)})}function h(m,y){e.forEach(y,function(v){e.forEach(v,function(k,_){m.node(k).order=_})})}return fb}var pb,AC;function uH(){if(AC)return pb;AC=1;var e=tn(),t=bi().Graph,r=va();pb={positionX:v,findType1Conflicts:a,findType2Conflicts:i,addConflict:l,hasConflict:u,verticalAlignment:d,horizontalCompaction:f,alignCoordinates:m,findSmallestWidthAlignment:h,balance:y};function a(w,N){var E={};function A(T,C){var j=0,M=0,L=T.length,I=e.last(C);return e.forEach(C,function(B,z){var ee=o(w,B),V=ee?w.node(ee).order:L;(ee||B===I)&&(e.forEach(C.slice(M,z+1),function(D){e.forEach(w.predecessors(D),function(K){var H=w.node(K),J=H.order;(J<j||V<J)&&!(H.dummy&&w.node(D).dummy)&&l(E,K,D)})}),M=z+1,j=V)}),C}return e.reduce(N,A),E}function i(w,N){var E={};function A(C,j,M,L,I){var B;e.forEach(e.range(j,M),function(z){B=C[z],w.node(B).dummy&&e.forEach(w.predecessors(B),function(ee){var V=w.node(ee);V.dummy&&(V.order<L||V.order>I)&&l(E,ee,B)})})}function T(C,j){var M=-1,L,I=0;return e.forEach(j,function(B,z){if(w.node(B).dummy==="border"){var ee=w.predecessors(B);ee.length&&(L=w.node(ee[0]).order,A(j,I,z,M,L),I=z,M=L)}A(j,I,j.length,L,C.length)}),j}return e.reduce(N,T),E}function o(w,N){if(w.node(N).dummy)return e.find(w.predecessors(N),function(E){return w.node(E).dummy})}function l(w,N,E){if(N>E){var A=N;N=E,E=A}var T=w[N];T||(w[N]=T={}),T[E]=!0}function u(w,N,E){if(N>E){var A=N;N=E,E=A}return e.has(w[N],E)}function d(w,N,E,A){var T={},C={},j={};return e.forEach(N,function(M){e.forEach(M,function(L,I){T[L]=L,C[L]=L,j[L]=I})}),e.forEach(N,function(M){var L=-1;e.forEach(M,function(I){var B=A(I);if(B.length){B=e.sortBy(B,function(K){return j[K]});for(var z=(B.length-1)/2,ee=Math.floor(z),V=Math.ceil(z);ee<=V;++ee){var D=B[ee];C[I]===I&&L<j[D]&&!u(E,I,D)&&(C[D]=I,C[I]=T[I]=T[D],L=j[D])}}})}),{root:T,align:C}}function f(w,N,E,A,T){var C={},j=p(w,N,E,T),M=T?"borderLeft":"borderRight";function L(z,ee){for(var V=j.nodes(),D=V.pop(),K={};D;)K[D]?z(D):(K[D]=!0,V.push(D),V=V.concat(ee(D))),D=V.pop()}function I(z){C[z]=j.inEdges(z).reduce(function(ee,V){return Math.max(ee,C[V.v]+j.edge(V))},0)}function B(z){var ee=j.outEdges(z).reduce(function(D,K){return Math.min(D,C[K.w]-j.edge(K))},Number.POSITIVE_INFINITY),V=w.node(z);ee!==Number.POSITIVE_INFINITY&&V.borderType!==M&&(C[z]=Math.max(C[z],ee))}return L(I,j.predecessors.bind(j)),L(B,j.successors.bind(j)),e.forEach(A,function(z){C[z]=C[E[z]]}),C}function p(w,N,E,A){var T=new t,C=w.graph(),j=k(C.nodesep,C.edgesep,A);return e.forEach(N,function(M){var L;e.forEach(M,function(I){var B=E[I];if(T.setNode(B),L){var z=E[L],ee=T.edge(z,B);T.setEdge(z,B,Math.max(j(w,I,L),ee||0))}L=I})}),T}function h(w,N){return e.minBy(e.values(N),function(E){var A=Number.NEGATIVE_INFINITY,T=Number.POSITIVE_INFINITY;return e.forIn(E,function(C,j){var M=_(w,j)/2;A=Math.max(C+M,A),T=Math.min(C-M,T)}),A-T})}function m(w,N){var E=e.values(N),A=e.min(E),T=e.max(E);e.forEach(["u","d"],function(C){e.forEach(["l","r"],function(j){var M=C+j,L=w[M],I;if(L!==N){var B=e.values(L);I=j==="l"?A-e.min(B):T-e.max(B),I&&(w[M]=e.mapValues(L,function(z){return z+I}))}})})}function y(w,N){return e.mapValues(w.ul,function(E,A){if(N)return w[N.toLowerCase()][A];var T=e.sortBy(e.map(w,A));return(T[1]+T[2])/2})}function v(w){var N=r.buildLayerMatrix(w),E=e.merge(a(w,N),i(w,N)),A={},T;e.forEach(["u","d"],function(j){T=j==="u"?N:e.values(N).reverse(),e.forEach(["l","r"],function(M){M==="r"&&(T=e.map(T,function(z){return e.values(z).reverse()}));var L=(j==="u"?w.predecessors:w.successors).bind(w),I=d(w,T,E,L),B=f(w,T,I.root,I.align,M==="r");M==="r"&&(B=e.mapValues(B,function(z){return-z})),A[j+M]=B})});var C=h(w,A);return m(A,C),y(A,w.graph().align)}function k(w,N,E){return function(A,T,C){var j=A.node(T),M=A.node(C),L=0,I;if(L+=j.width/2,e.has(j,"labelpos"))switch(j.labelpos.toLowerCase()){case"l":I=-j.width/2;break;case"r":I=j.width/2;break}if(I&&(L+=E?I:-I),I=0,L+=(j.dummy?N:w)/2,L+=(M.dummy?N:w)/2,L+=M.width/2,e.has(M,"labelpos"))switch(M.labelpos.toLowerCase()){case"l":I=M.width/2;break;case"r":I=-M.width/2;break}return I&&(L+=E?I:-I),I=0,L}}function _(w,N){return w.node(N).width}return pb}var gb,IC;function dH(){if(IC)return gb;IC=1;var e=tn(),t=va(),r=uH().positionX;gb=a;function a(o){o=t.asNonCompoundGraph(o),i(o),e.forEach(r(o),function(l,u){o.node(u).x=l})}function i(o){var l=t.buildLayerMatrix(o),u=o.graph().ranksep,d=0;e.forEach(l,function(f){var 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 gb}var hb,MC;function fH(){if(MC)return hb;MC=1;var e=tn(),t=Gq(),r=Kq(),a=Xq(),i=va().normalizeRanks,o=Qq(),l=va().removeEmptyRanks,u=Zq(),d=Jq(),f=eH(),p=cH(),h=dH(),m=va(),y=bi().Graph;hb=v;function v(Z,W){var G=W&&W.debugTiming?m.time:m.notime;G("layout",function(){var oe=G(" buildLayoutGraph",function(){return L(Z)});G(" runLayout",function(){k(oe,G)}),G(" updateInputGraph",function(){_(Z,oe)})})}function k(Z,W){W(" makeSpaceForEdgeLabels",function(){I(Z)}),W(" removeSelfEdges",function(){ne(Z)}),W(" acyclic",function(){t.run(Z)}),W(" nestingGraph.run",function(){u.run(Z)}),W(" rank",function(){a(m.asNonCompoundGraph(Z))}),W(" injectEdgeLabelProxies",function(){B(Z)}),W(" removeEmptyRanks",function(){l(Z)}),W(" nestingGraph.cleanup",function(){u.cleanup(Z)}),W(" normalizeRanks",function(){i(Z)}),W(" assignRankMinMax",function(){z(Z)}),W(" removeEdgeLabelProxies",function(){ee(Z)}),W(" normalize.run",function(){r.run(Z)}),W(" parentDummyChains",function(){o(Z)}),W(" addBorderSegments",function(){d(Z)}),W(" order",function(){p(Z)}),W(" insertSelfEdges",function(){P(Z)}),W(" adjustCoordinateSystem",function(){f.adjust(Z)}),W(" position",function(){h(Z)}),W(" positionSelfEdges",function(){U(Z)}),W(" removeBorderNodes",function(){J(Z)}),W(" normalize.undo",function(){r.undo(Z)}),W(" fixupEdgeLabelCoords",function(){K(Z)}),W(" undoCoordinateSystem",function(){f.undo(Z)}),W(" translateGraph",function(){V(Z)}),W(" assignNodeIntersects",function(){D(Z)}),W(" reversePoints",function(){H(Z)}),W(" acyclic.undo",function(){t.undo(Z)})}function _(Z,W){e.forEach(Z.nodes(),function(G){var oe=Z.node(G),Q=W.node(G);oe&&(oe.x=Q.x,oe.y=Q.y,W.children(G).length&&(oe.width=Q.width,oe.height=Q.height))}),e.forEach(Z.edges(),function(G){var oe=Z.edge(G),Q=W.edge(G);oe.points=Q.points,e.has(Q,"x")&&(oe.x=Q.x,oe.y=Q.y)}),Z.graph().width=W.graph().width,Z.graph().height=W.graph().height}var w=["nodesep","edgesep","ranksep","marginx","marginy"],N={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},E=["acyclicer","ranker","rankdir","align"],A=["width","height"],T={width:0,height:0},C=["minlen","weight","width","height","labeloffset"],j={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},M=["labelpos"];function L(Z){var W=new y({multigraph:!0,compound:!0}),G=F(Z.graph());return W.setGraph(e.merge({},N,X(G,w),e.pick(G,E))),e.forEach(Z.nodes(),function(oe){var Q=F(Z.node(oe));W.setNode(oe,e.defaults(X(Q,A),T)),W.setParent(oe,Z.parent(oe))}),e.forEach(Z.edges(),function(oe){var Q=F(Z.edge(oe));W.setEdge(oe,e.merge({},j,X(Q,C),e.pick(Q,M)))}),W}function I(Z){var W=Z.graph();W.ranksep/=2,e.forEach(Z.edges(),function(G){var oe=Z.edge(G);oe.minlen*=2,oe.labelpos.toLowerCase()!=="c"&&(W.rankdir==="TB"||W.rankdir==="BT"?oe.width+=oe.labeloffset:oe.height+=oe.labeloffset)})}function B(Z){e.forEach(Z.edges(),function(W){var G=Z.edge(W);if(G.width&&G.height){var oe=Z.node(W.v),Q=Z.node(W.w),fe={rank:(Q.rank-oe.rank)/2+oe.rank,e:W};m.addDummyNode(Z,"edge-proxy",fe,"_ep")}})}function z(Z){var W=0;e.forEach(Z.nodes(),function(G){var oe=Z.node(G);oe.borderTop&&(oe.minRank=Z.node(oe.borderTop).rank,oe.maxRank=Z.node(oe.borderBottom).rank,W=e.max(W,oe.maxRank))}),Z.graph().maxRank=W}function ee(Z){e.forEach(Z.nodes(),function(W){var G=Z.node(W);G.dummy==="edge-proxy"&&(Z.edge(G.e).labelRank=G.rank,Z.removeNode(W))})}function V(Z){var W=Number.POSITIVE_INFINITY,G=0,oe=Number.POSITIVE_INFINITY,Q=0,fe=Z.graph(),ke=fe.marginx||0,Fe=fe.marginy||0;function Ve(Ge){var qe=Ge.x,Ce=Ge.y,He=Ge.width,ze=Ge.height;W=Math.min(W,qe-He/2),G=Math.max(G,qe+He/2),oe=Math.min(oe,Ce-ze/2),Q=Math.max(Q,Ce+ze/2)}e.forEach(Z.nodes(),function(Ge){Ve(Z.node(Ge))}),e.forEach(Z.edges(),function(Ge){var qe=Z.edge(Ge);e.has(qe,"x")&&Ve(qe)}),W-=ke,oe-=Fe,e.forEach(Z.nodes(),function(Ge){var qe=Z.node(Ge);qe.x-=W,qe.y-=oe}),e.forEach(Z.edges(),function(Ge){var qe=Z.edge(Ge);e.forEach(qe.points,function(Ce){Ce.x-=W,Ce.y-=oe}),e.has(qe,"x")&&(qe.x-=W),e.has(qe,"y")&&(qe.y-=oe)}),fe.width=G-W+ke,fe.height=Q-oe+Fe}function D(Z){e.forEach(Z.edges(),function(W){var G=Z.edge(W),oe=Z.node(W.v),Q=Z.node(W.w),fe,ke;G.points?(fe=G.points[0],ke=G.points[G.points.length-1]):(G.points=[],fe=Q,ke=oe),G.points.unshift(m.intersectRect(oe,fe)),G.points.push(m.intersectRect(Q,ke))})}function K(Z){e.forEach(Z.edges(),function(W){var G=Z.edge(W);if(e.has(G,"x"))switch((G.labelpos==="l"||G.labelpos==="r")&&(G.width-=G.labeloffset),G.labelpos){case"l":G.x-=G.width/2+G.labeloffset;break;case"r":G.x+=G.width/2+G.labeloffset;break}})}function H(Z){e.forEach(Z.edges(),function(W){var G=Z.edge(W);G.reversed&&G.points.reverse()})}function J(Z){e.forEach(Z.nodes(),function(W){if(Z.children(W).length){var G=Z.node(W),oe=Z.node(G.borderTop),Q=Z.node(G.borderBottom),fe=Z.node(e.last(G.borderLeft)),ke=Z.node(e.last(G.borderRight));G.width=Math.abs(ke.x-fe.x),G.height=Math.abs(Q.y-oe.y),G.x=fe.x+G.width/2,G.y=oe.y+G.height/2}}),e.forEach(Z.nodes(),function(W){Z.node(W).dummy==="border"&&Z.removeNode(W)})}function ne(Z){e.forEach(Z.edges(),function(W){if(W.v===W.w){var G=Z.node(W.v);G.selfEdges||(G.selfEdges=[]),G.selfEdges.push({e:W,label:Z.edge(W)}),Z.removeEdge(W)}})}function P(Z){var W=m.buildLayerMatrix(Z);e.forEach(W,function(G){var oe=0;e.forEach(G,function(Q,fe){var ke=Z.node(Q);ke.order=fe+oe,e.forEach(ke.selfEdges,function(Fe){m.addDummyNode(Z,"selfedge",{width:Fe.label.width,height:Fe.label.height,rank:ke.rank,order:fe+ ++oe,e:Fe.e,label:Fe.label},"_se")}),delete ke.selfEdges})})}function U(Z){e.forEach(Z.nodes(),function(W){var G=Z.node(W);if(G.dummy==="selfedge"){var oe=Z.node(G.e.v),Q=oe.x+oe.width/2,fe=oe.y,ke=G.x-Q,Fe=oe.height/2;Z.setEdge(G.e,G.label),Z.removeNode(W),G.label.points=[{x:Q+2*ke/3,y:fe-Fe},{x:Q+5*ke/6,y:fe-Fe},{x:Q+ke,y:fe},{x:Q+5*ke/6,y:fe+Fe},{x:Q+2*ke/3,y:fe+Fe}],G.label.x=G.x,G.label.y=G.y}})}function X(Z,W){return e.mapValues(e.pick(Z,W),Number)}function F(Z){var W={};return e.forEach(Z,function(G,oe){W[oe.toLowerCase()]=G}),W}return hb}var mb,LC;function pH(){if(LC)return mb;LC=1;var e=tn(),t=va(),r=bi().Graph;mb={debugOrdering:a};function a(i){var o=t.buildLayerMatrix(i),l=new r({compound:!0,multigraph:!0}).setGraph({});return e.forEach(i.nodes(),function(u){l.setNode(u,{label:u}),l.setParent(u,"layer"+i.node(u).rank)}),e.forEach(i.edges(),function(u){l.setEdge(u.v,u.w,{},u.name)}),e.forEach(o,function(u,d){var f="layer"+d;l.setNode(f,{rank:"same"}),e.reduce(u,function(p,h){return l.setEdge(p,h,{style:"invis"}),h})}),l}return mb}var xb,OC;function gH(){return OC||(OC=1,xb="0.8.5"),xb}var yb,DC;function hH(){return DC||(DC=1,yb={graphlib:bi(),layout:fH(),debug:pH(),util:{time:va().time,notime:va().notime},version:gH()}),yb}var mH=hH();const ff=jo(mH),xH={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"}},yH={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 bH(e,t){return e?e.length<=t?e:e.slice(0,t-1)+"…":""}function PC(e){return e.status==="completed"?"completed":e.status==="in_progress"?"in_progress":e.blockedBy&&e.blockedBy.length>0&&e.isBlocked?"blocked":"open"}function vH({todos:e,darkMode:t}){const r=Array.isArray(e)?e:[],[a,i]=x.useState(null),o=x.useRef(null),l=x.useRef(null),[u,d]=x.useState(400),[f,p]=x.useState(function(){if(typeof window<"u"){const z=parseFloat(localStorage.getItem("pave-map-zoom")||"");if(Number.isFinite(z)&&z>.1)return z}return 1});x.useEffect(function(){typeof window<"u"&&localStorage.setItem("pave-map-zoom",String(f))},[f]);const[h,m]=x.useState(function(){return typeof window<"u"?localStorage.getItem("pave-map-show-completed")!=="false":!0});x.useEffect(function(){typeof window<"u"&&localStorage.setItem("pave-map-show-completed",h?"true":"false")},[h]);const[y,v]=x.useState(function(){if(typeof window<"u"){const z=localStorage.getItem("pave-map-rankdir");if(z==="LR"||z==="TB")return z}return"TB"});x.useEffect(function(){typeof window<"u"&&localStorage.setItem("pave-map-rankdir",y)},[y]);const k=x.useMemo(function(){if(h)return r;const z=r.filter(function(V){return V.status!=="completed"}),ee={};return z.forEach(function(V){ee[V.id]=!0}),z.map(function(V){if(!V.blockedBy||!V.blockedBy.length)return V;const D=V.blockedBy.filter(function(K){return ee[K]});return D.length===V.blockedBy.length?V:Object.assign({},V,{blockedBy:D})})},[r,h]);x.useEffect(function(){if(!o.current)return;function z(){o.current&&d(o.current.clientWidth||400)}z();const ee=new ResizeObserver(z);return ee.observe(o.current),function(){ee.disconnect()}},[]);const _=x.useMemo(function(){if(!k.length)return{nodes:[],edges:[],width:0,height:0};const z=new ff.graphlib.Graph;z.setGraph({rankdir:y,nodesep:24,ranksep:36,marginx:16,marginy:16}),z.setDefaultEdgeLabel(function(){return{}});const ee=180,V=56;k.forEach(function(H){z.setNode(String(H.id),{width:ee,height:V,todo:H})}),k.forEach(function(H){(H.blockedBy||[]).forEach(function(ne){z.hasNode(String(ne))&&z.setEdge(String(ne),String(H.id))})}),ff.layout(z);const D=z.nodes().map(function(H){const J=z.node(H);return{id:H,x:J.x-ee/2,y:J.y-V/2,w:ee,h:V,todo:J.todo}}),K=z.edges().map(function(H){const J=z.edge(H);return{from:H.v,to:H.w,points:J.points}});return{nodes:D,edges:K,width:z.graph().width||ee+32,height:z.graph().height||V+32}},[k,y]),w=t?yH:xH;if(!k.length){const z=r.length-k.length;return n.jsxs("div",{ref:o,className:"flex flex-col items-center justify-center h-full text-center px-6",children:[n.jsx("div",{className:"text-gray-400 dark:text-gray-500 mb-2",children:n.jsx("svg",{className:"w-12 h-12 mx-auto opacity-50",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"})})}),z>0?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:"All work complete"}),n.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1 max-w-xs",children:[z," completed ",z===1?"todo is":"todos are"," hidden."]}),n.jsx("button",{type:"button",onClick:function(){m(!0)},className:"mt-3 text-xs px-3 py-1 rounded border border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800",children:"Show completed"})]}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:"Strategy map is empty"}),n.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1 max-w-xs",children:["Ask the agent to plan the work — todos created with the ",n.jsx("code",{className:"px-1 bg-gray-200 dark:bg-gray-700 rounded",children:"todo"})," tool will appear here as a live DAG."]})]})]})}function N(z){if(!z||z.length<2)return"";let ee="M "+z[0].x+" "+z[0].y;for(let V=1;V<z.length;V++)ee+=" L "+z[V].x+" "+z[V].y;return ee}const E=r.reduce(function(z,ee){const V=PC(ee);return z[V]=(z[V]||0)+1,z},{}),A=E.completed||0,T=Math.max(_.width,100),C=Math.max(_.height,100),M=(T>u-24?1:(u-24)/T)*f,L=T*M,I=C*M;function B(z){(z.ctrlKey||z.metaKey)&&(z.preventDefault(),p(function(ee){const V=z.deltaY<0?ee*1.1:ee/1.1;return Math.max(.25,Math.min(4,V))}))}return n.jsxs("div",{ref:o,className:"h-full flex flex-col bg-white dark:bg-gray-900",children:[n.jsxs("div",{className:"flex items-center justify-between px-3 pt-3 pb-2 text-xs flex-shrink-0",children:[n.jsx("div",{className:"font-semibold text-gray-700 dark:text-gray-200",children:"Strategy Map"}),n.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[n.jsxs("span",{children:[r.length," total"]}),E.in_progress?n.jsxs("span",{className:"text-blue-600 dark:text-blue-400",children:[E.in_progress," active"]}):null,A?n.jsxs("span",{className:"text-green-600 dark:text-green-400",children:[A," done"]}):null,E.blocked?n.jsxs("span",{className:"text-amber-600 dark:text-amber-400",children:[E.blocked," blocked"]}):null,n.jsxs("div",{className:"flex items-center gap-0.5 ml-1 border-l border-gray-200 dark:border-gray-700 pl-2",children:[n.jsx("button",{type:"button",onClick:function(){v(function(z){return z==="TB"?"LR":"TB"})},className:"px-1.5 py-0.5 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 text-[10px]",title:y==="TB"?"Switch to horizontal layout":"Switch to vertical layout","aria-label":"Toggle layout direction",children:y==="TB"?"↓":"→"}),n.jsx("button",{type:"button",onClick:function(){p(function(z){return Math.max(.25,z/1.25)})},className:"px-1.5 py-0.5 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800",title:"Zoom out","aria-label":"Zoom out",children:"−"}),n.jsxs("button",{type:"button",onClick:function(){p(1)},className:"px-1.5 py-0.5 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 text-[10px] tabular-nums min-w-[3em]",title:"Reset zoom","aria-label":"Reset zoom",children:[Math.round(f*100),"%"]}),n.jsx("button",{type:"button",onClick:function(){p(function(z){return Math.min(4,z*1.25)})},className:"px-1.5 py-0.5 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800",title:"Zoom in","aria-label":"Zoom in",children:"+"})]}),A>0?n.jsx("button",{type:"button",onClick:function(){m(function(z){return!z})},className:"ml-1 px-2 py-0.5 rounded border text-[10px] "+(h?"border-blue-400 text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/30":"border-gray-300 dark:border-gray-600 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800"),title:h?"Hide completed todos":"Show completed todos",children:h?"hide done":"show done"}):null]})]}),n.jsx("div",{ref:l,className:"flex-1 min-h-0 overflow-auto px-3 pb-3",onWheel:B,children:n.jsxs("svg",{viewBox:"0 0 "+T+" "+C,width:L,height:I,style:{display:"block"},children:[n.jsx("defs",{children:n.jsx("marker",{id:"sm-arrow",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"5",markerHeight:"5",orient:"auto",children:n.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:t?"#64748b":"#94a3b8"})})}),_.edges.map(function(z,ee){return n.jsx("path",{d:N(z.points),fill:"none",stroke:t?"#475569":"#cbd5e1",strokeWidth:1.5,markerEnd:"url(#sm-arrow)"},"e"+ee)}),_.nodes.map(function(z){const ee=PC(z.todo),V=w[ee],D=ee==="in_progress",K=a===z.id;return n.jsxs("g",{transform:"translate("+z.x+","+z.y+")",onMouseEnter:function(){i(z.id)},onMouseLeave:function(){i(null)},style:{cursor:"pointer"},children:[n.jsx("rect",{width:z.w,height:z.h,rx:6,ry:6,fill:V.fill,stroke:V.stroke,strokeWidth:D||K?2:1.25,children:D?n.jsx("animate",{attributeName:"stroke-width",values:"1.5;2.5;1.5",dur:"1.6s",repeatCount:"indefinite"}):null}),D?n.jsx("circle",{cx:10,cy:10,r:3.5,fill:V.stroke,children:n.jsx("animate",{attributeName:"r",values:"3;5;3",dur:"1.4s",repeatCount:"indefinite"})}):null,n.jsx("text",{x:z.w/2,y:z.h/2-6,textAnchor:"middle",fontSize:11,fontWeight:600,fill:V.label,children:"#"+z.todo.id}),n.jsx("text",{x:z.w/2,y:z.h/2+12,textAnchor:"middle",fontSize:11,fill:t?"#e2e8f0":"#0f172a",children:bH(z.todo.text,26)}),K&&z.todo.text&&z.todo.text.length>26?n.jsx("title",{children:z.todo.text}):null]},z.id)})]})})]})}const kH={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"}},_H={fill:"#f1f5f9",stroke:"#94a3b8",label:"#475569"},wH={fill:"#fee2e2",stroke:"#dc2626",label:"#991b1b"},SH={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"}},NH={fill:"#1e293b",stroke:"#64748b",label:"#cbd5e1"},EH={fill:"#7f1d1d",stroke:"#f87171",label:"#fecaca"},jH={fill:"#fef9c3",stroke:"#ca8a04",label:"#713f12"},CH={fill:"#3f2d0a",stroke:"#facc15",label:"#fde68a"},js={data:{light:"#0ea5e9",dark:"#38bdf8"},file:{light:"#94a3b8",dark:"#64748b"},seq:{light:"#cbd5e1",dark:"#475569"}};function TH(e,t){return e?e.length<=t?e:e.slice(0,t-1)+"…":""}function RH(e,t){return e.kind==="thought"?t?CH:jH:e.status==="error"?t?EH:wH:(t?SH:kH)[e.tool]||(t?NH:_H)}function AH({graph:e,darkMode:t,onNodeClick:r}){const a=e&&Array.isArray(e.nodes)?e.nodes:[],i=e&&Array.isArray(e.edges)?e.edges:[],o=x.useRef(null),l=x.useRef(null),[u,d]=x.useState(null),[f,p]=x.useState(400),[h,m]=x.useState(function(){if(typeof window<"u"){const D=parseFloat(localStorage.getItem("pave-toolmap-zoom")||"");if(Number.isFinite(D)&&D>.1)return D}return 1});x.useEffect(function(){typeof window<"u"&&localStorage.setItem("pave-toolmap-zoom",String(h))},[h]);const[y,v]=x.useState(function(){if(typeof window<"u"){const D=localStorage.getItem("pave-toolmap-rankdir");if(D==="LR"||D==="TB")return D}return"TB"});x.useEffect(function(){typeof window<"u"&&localStorage.setItem("pave-toolmap-rankdir",y)},[y]);const[k,_]=x.useState(function(){return typeof window<"u"?localStorage.getItem("pave-toolmap-show-hidden")==="true":!1});x.useEffect(function(){typeof window<"u"&&localStorage.setItem("pave-toolmap-show-hidden",k?"true":"false")},[k]);const[w,N]=x.useState(function(){return!(typeof window<"u"&&localStorage.getItem("pave-toolmap-show-thoughts")==="false")});x.useEffect(function(){typeof window<"u"&&localStorage.setItem("pave-toolmap-show-thoughts",w?"true":"false")},[w]);const E=x.useMemo(function(){let D=a;return k||(D=D.filter(function(K){return!K.hidden})),w||(D=D.filter(function(K){return K.kind!=="thought"})),D},[a,k,w]),A=x.useMemo(function(){const D={};return E.forEach(function(K){D[K.id]=!0}),i.filter(function(K){return D[K.from]&&D[K.to]})},[i,E]),T=x.useMemo(function(){if(!E.length)return{nodes:[],edges:[],width:0,height:0};const D=new ff.graphlib.Graph;D.setGraph({rankdir:y,nodesep:18,ranksep:32,marginx:14,marginy:14}),D.setDefaultEdgeLabel(function(){return{}});const K=168,H=44,J=240,ne=60;E.forEach(function(X){X.kind==="thought"?D.setNode(X.id,{width:J,height:ne,node:X}):D.setNode(X.id,{width:K,height:H,node:X})}),A.forEach(function(X){D.hasNode(X.from)&&D.hasNode(X.to)&&D.setEdge(X.from,X.to,{kind:X.kind})}),ff.layout(D);const P=D.nodes().map(function(X){const F=D.node(X);return{id:X,x:F.x-F.width/2,y:F.y-F.height/2,w:F.width,h:F.height,node:F.node}}),U=D.edges().map(function(X){const F=D.edge(X);return{from:X.v,to:X.w,points:F.points||[],kind:F.kind||"seq"}});return{nodes:P,edges:U,width:D.graph().width||K+28,height:D.graph().height||H+28}},[E,A,y]);x.useEffect(function(){if(!o.current)return;function D(){o.current&&p(o.current.clientWidth||400)}D();const K=new ResizeObserver(D);return K.observe(o.current),function(){K.disconnect()}},[]);const C=x.useMemo(function(){const D={total:0,ok:0,error:0,running:0,hidden:0,thoughts:0};return a.forEach(function(K){if(K.kind==="thought"){D.thoughts++;return}D.total++,K.hidden&&D.hidden++,K.status==="error"?D.error++:K.status==="running"?D.running++:D.ok++}),D},[a]);if(!E.length)return n.jsxs("div",{ref:o,className:"flex flex-col items-center justify-center h-full text-center px-6",children:[n.jsx("div",{className:"text-gray-400 dark:text-gray-500 mb-2",children:n.jsx("svg",{className:"w-12 h-12 mx-auto opacity-50",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})})}),n.jsx("div",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:"No tool calls yet"}),n.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1 max-w-xs",children:"Tool invocations will appear here as a DAG showing data flow and file dependencies."}),C.hidden>0&&!k?n.jsxs("button",{type:"button",onClick:function(){_(!0)},className:"mt-3 text-xs px-3 py-1 rounded border border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800",children:["Show ",C.hidden," hidden"]}):null]});function j(D){if(!D||D.length<2)return"";let K="M "+D[0].x+" "+D[0].y;for(let H=1;H<D.length;H++)K+=" L "+D[H].x+" "+D[H].y;return K}const M=Math.max(T.width,100),L=Math.max(T.height,100),B=(M>f-24?1:(f-24)/M)*h,z=M*B,ee=L*B;function V(D){(D.ctrlKey||D.metaKey)&&(D.preventDefault(),m(function(K){const H=D.deltaY<0?K*1.1:K/1.1;return Math.max(.25,Math.min(4,H))}))}return n.jsxs("div",{ref:o,className:"h-full flex flex-col bg-white dark:bg-gray-900",children:[n.jsxs("div",{className:"flex items-center justify-between px-3 pt-3 pb-2 text-xs flex-shrink-0",children:[n.jsx("div",{className:"font-semibold text-gray-700 dark:text-gray-200",children:"Tool Calls"}),n.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[n.jsxs("span",{children:[C.total," tools"]}),C.running?n.jsxs("span",{className:"text-blue-600 dark:text-blue-400",children:[C.running," live"]}):null,C.error?n.jsxs("span",{className:"text-red-600 dark:text-red-400",children:[C.error," err"]}):null,n.jsxs("div",{className:"flex items-center gap-0.5 ml-1 border-l border-gray-200 dark:border-gray-700 pl-2",children:[n.jsx("button",{type:"button",onClick:function(){v(function(D){return D==="TB"?"LR":"TB"})},className:"px-1.5 py-0.5 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 text-[10px]",title:y==="TB"?"Switch to horizontal layout":"Switch to vertical layout","aria-label":"Toggle layout direction",children:y==="TB"?"↓":"→"}),n.jsx("button",{type:"button",onClick:function(){m(function(D){return Math.max(.25,D/1.25)})},className:"px-1.5 py-0.5 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800",title:"Zoom out","aria-label":"Zoom out",children:"−"}),n.jsxs("button",{type:"button",onClick:function(){m(1)},className:"px-1.5 py-0.5 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 text-[10px] tabular-nums min-w-[3em]",title:"Reset zoom","aria-label":"Reset zoom",children:[Math.round(h*100),"%"]}),n.jsx("button",{type:"button",onClick:function(){m(function(D){return Math.min(4,D*1.25)})},className:"px-1.5 py-0.5 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800",title:"Zoom in","aria-label":"Zoom in",children:"+"})]}),C.hidden>0?n.jsx("button",{type:"button",onClick:function(){_(function(D){return!D})},className:"ml-1 px-2 py-0.5 rounded border text-[10px] "+(k?"border-blue-400 text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/30":"border-gray-300 dark:border-gray-600 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800"),title:k?"Hide bookkeeping tools":"Show bookkeeping tools (todo, permission, etc.)",children:k?"hide bk":"show bk"}):null,C.thoughts>0?n.jsx("button",{type:"button",onClick:function(){N(function(D){return!D})},className:"ml-1 px-2 py-0.5 rounded border text-[10px] "+(w?"border-yellow-500 text-yellow-700 dark:text-yellow-300 bg-yellow-50 dark:bg-yellow-900/30":"border-gray-300 dark:border-gray-600 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800"),title:w?"Hide reasoning bubbles":"Show reasoning bubbles ("+C.thoughts+" thoughts)",children:w?"💭 "+C.thoughts:"💭 off"}):null]})]}),n.jsx("div",{ref:l,className:"flex-1 min-h-0 overflow-auto px-3 pb-3",onWheel:V,children:n.jsxs("svg",{viewBox:"0 0 "+M+" "+L,width:z,height:ee,style:{display:"block"},children:[n.jsxs("defs",{children:[n.jsx("marker",{id:"tcm-arrow-data",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"5",markerHeight:"5",orient:"auto",children:n.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:t?js.data.dark:js.data.light})}),n.jsx("marker",{id:"tcm-arrow-file",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"5",markerHeight:"5",orient:"auto",children:n.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:t?js.file.dark:js.file.light})}),n.jsx("marker",{id:"tcm-arrow-seq",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"5",markerHeight:"5",orient:"auto",children:n.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:t?js.seq.dark:js.seq.light})})]}),T.edges.map(function(D,K){const H=t?js[D.kind].dark:js[D.kind].light;return n.jsx("path",{d:j(D.points),fill:"none",stroke:H,strokeWidth:D.kind==="data"?1.75:D.kind==="file"?1.25:1,strokeDasharray:D.kind==="seq"?"3,3":void 0,markerEnd:"url(#tcm-arrow-"+D.kind+")"},"e"+K)}),T.nodes.map(function(D){const K=D.node,H=RH(K,t),J=K.status==="running",ne=u===D.id;if(K.kind==="thought"){const U=K.label||"",X=32,F=3,Z=U.split(/\s+/),W=[];let G="";for(const oe of Z){if(W.length===F-1&&(G+" "+oe).length>X){W.push(G);const Q=Z.slice(Z.indexOf(oe)).join(" ");W.push(Q.length>X?Q.slice(0,X-1)+"…":Q),G="";break}if(!G){G=oe;continue}if((G+" "+oe).length<=X?G=G+" "+oe:(W.push(G),G=oe),W.length>=F)break}return G&&W.length<F&&W.push(G),n.jsxs("g",{transform:"translate("+D.x+","+D.y+")",onMouseEnter:function(){d(D.id)},onMouseLeave:function(){d(null)},onClick:function(){r&&r(K)},style:{cursor:r?"pointer":"default"},children:[n.jsx("rect",{width:D.w,height:D.h,rx:D.h/2,ry:D.h/2,fill:H.fill,stroke:H.stroke,strokeWidth:ne?1.75:1,strokeDasharray:K.source==="reasoning"?void 0:"4,2"}),n.jsx("text",{x:14,y:2,fontSize:9,fontStyle:"italic",fill:H.label,children:W.map(function(oe,Q){return n.jsx("tspan",{x:14,dy:Q===0?14:11,children:(Q===0?"💭 ":"")+oe},"ln"+Q)})}),n.jsx("title",{children:(K.source==="reasoning"?"[reasoning] ":"[thought] ")+(K.fullText||K.label)})]},D.id)}return n.jsxs("g",{transform:"translate("+D.x+","+D.y+")",onMouseEnter:function(){d(D.id)},onMouseLeave:function(){d(null)},onClick:function(){r&&r(K)},style:{cursor:r?"pointer":"default"},children:[n.jsx("rect",{width:D.w,height:D.h,rx:5,ry:5,fill:H.fill,stroke:H.stroke,strokeWidth:J||ne?2:1.25,opacity:K.hidden?.55:1,children:J?n.jsx("animate",{attributeName:"stroke-width",values:"1.5;2.5;1.5",dur:"1.6s",repeatCount:"indefinite"}):null}),n.jsx("text",{x:8,y:16,fontSize:10,fontWeight:600,fill:H.label,children:K.tool}),n.jsx("text",{x:8,y:32,fontSize:10,fill:t?"#cbd5e1":"#475569",fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",children:TH(K.label,22)}),n.jsx("title",{children:K.tool+" · "+K.label+(K.status==="error"?" · ERROR":K.status==="running"?" · RUNNING":"")}),J?n.jsxs("g",{transform:"translate("+(D.w-9)+",9)",children:[n.jsx("circle",{r:4.5,fill:t?"#1e293b":"#ffffff",stroke:H.stroke,strokeWidth:.75}),n.jsxs("circle",{r:3,fill:t?"#38bdf8":"#0ea5e9",children:[n.jsx("animate",{attributeName:"opacity",values:"1;0.25;1",dur:"1.1s",repeatCount:"indefinite"}),n.jsx("animate",{attributeName:"r",values:"2.4;3.4;2.4",dur:"1.1s",repeatCount:"indefinite"})]})]}):null]},D.id)})]})})]})}/*! @license DOMPurify 3.4.15 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.15/LICENSE */function FC(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,a=Array(t);r<t;r++)a[r]=e[r];return a}function IH(e){if(Array.isArray(e))return e}function MH(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var a,i,o,l,u=[],d=!0,f=!1;try{if(o=(r=r.call(e)).next,t!==0)for(;!(d=(a=o.call(r)).done)&&(u.push(a.value),u.length!==t);d=!0);}catch(p){f=!0,i=p}finally{try{if(!d&&r.return!=null&&(l=r.return(),Object(l)!==l))return}finally{if(f)throw i}}return u}}function LH(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
104
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function OH(e,t){return IH(e)||MH(e,t)||DH(e,t)||LH()}function DH(e,t){if(e){if(typeof e=="string")return FC(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?FC(e,t):void 0}}const gA=Object.entries,BC=Object.setPrototypeOf,PH=Object.isFrozen,FH=Object.getPrototypeOf,BH=Object.getOwnPropertyDescriptor;let En=Object.freeze,Dn=Object.seal,_l=Object.create,hA=typeof Reflect<"u"&&Reflect,gv=hA.apply,hv=hA.construct;En||(En=function(t){return t});Dn||(Dn=function(t){return t});gv||(gv=function(t,r){for(var a=arguments.length,i=new Array(a>2?a-2:0),o=2;o<a;o++)i[o-2]=arguments[o];return t.apply(r,i)});hv||(hv=function(t){for(var r=arguments.length,a=new Array(r>1?r-1:0),i=1;i<r;i++)a[i-1]=arguments[i];return new t(...a)});const bo=bn(Array.prototype.forEach),zH=bn(Array.prototype.lastIndexOf),zC=bn(Array.prototype.pop),Ac=bn(Array.prototype.push),UH=bn(Array.prototype.splice),Rl=Array.isArray,Fc=bn(String.prototype.toLowerCase),bb=bn(String.prototype.toString),UC=bn(String.prototype.match),Ic=bn(String.prototype.replace),qC=bn(String.prototype.indexOf),qH=bn(String.prototype.trim),HH=bn(Number.prototype.toString),$H=bn(Boolean.prototype.toString),HC=typeof BigInt>"u"?null:bn(BigInt.prototype.toString),$C=typeof Symbol>"u"?null:bn(Symbol.prototype.toString),ba=bn(Object.prototype.hasOwnProperty),Mc=bn(Object.prototype.toString),Kn=bn(RegExp.prototype.test),mo=WH(TypeError);function bn(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var r=arguments.length,a=new Array(r>1?r-1:0),i=1;i<r;i++)a[i-1]=arguments[i];return gv(e,t,a)}}function WH(e){return function(){for(var t=arguments.length,r=new Array(t),a=0;a<t;a++)r[a]=arguments[a];return hv(e,r)}}function wr(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Fc;if(BC&&BC(e,null),!Rl(t))return e;let a=t.length;for(;a--;){let i=t[a];if(typeof i=="string"){const o=r(i);o!==i&&(PH(t)||(t[a]=o),i=o)}e[i]=!0}return e}function VH(e){for(let t=0;t<e.length;t++)ba(e,t)||(e[t]=null);return e}function Da(e){const t=_l(null);for(const a of gA(e)){var r=OH(a,2);const i=r[0],o=r[1];ba(e,i)&&(Rl(o)?t[i]=VH(o):o&&typeof o=="object"&&o.constructor===Object?t[i]=Da(o):t[i]=o)}return t}function GH(e){switch(typeof e){case"string":return e;case"number":return HH(e);case"boolean":return $H(e);case"bigint":return HC?HC(e):"0";case"symbol":return $C?$C(e):"Symbol()";case"undefined":return Mc(e);case"function":case"object":{if(e===null)return Mc(e);const t=e,r=Ya(t,"toString");if(typeof r=="function"){const a=r(t);return typeof a=="string"?a:Mc(a)}return Mc(e)}default:return Mc(e)}}function Ya(e,t){for(;e!==null;){const a=BH(e,t);if(a){if(a.get)return bn(a.get);if(typeof a.value=="function")return bn(a.value)}e=FH(e)}function r(){return null}return r}function KH(e){try{return Kn(e,""),!0}catch{return!1}}const WC=En(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),vb=En(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),kb=En(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),YH=En(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),_b=En(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),XH=En(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),VC=En(["#text"]),GC=En(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),wb=En(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),KC=En(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Fd=En(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),QH=Dn(/{{[\w\W]*|^[\w\W]*}}/g),ZH=Dn(/<%[\w\W]*|^[\w\W]*%>/g),JH=Dn(/\${[\w\W]*/g),e$=Dn(/^data-[\-\w.\u00B7-\uFFFF]+$/),t$=Dn(/^aria-[\-\w]+$/),YC=Dn(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),r$=Dn(/^(?:\w+script|data):/i),n$=Dn(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),a$=Dn(/^html$/i),i$=Dn(/^[a-z][.\w]*(-[.\w]+)+$/i),XC=Dn(/<[/\w!]/g),QC=Dn(/<[/\w]/g),s$=Dn(/<\/no(script|embed|frames)/i),o$=Dn(/\/>/i),La={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},mA=["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"],l$=En(wr({},mA)),c$=(function(){const e={};return bo(mA,t=>{e[t]=Dn(new RegExp("</"+t+"(?=[\\t\\n\\f\\r />])","i"))}),En(e)})(),u$=function(){return typeof window>"u"?null:window},d$=function(t,r){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let a=null;const i="data-tt-policy-suffix";r&&r.hasAttribute(i)&&(a=r.getAttribute(i));const o="dompurify"+(a?"#"+a:"");try{return t.createPolicy(o,{createHTML(l){return l},createScriptURL(l){return l}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},ZC=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Cs=function(t,r,a,i){return ba(t,r)&&Rl(t[r])?wr(i.base?Da(i.base):{},t[r],i.transform):a},Sb=function(t,r,a){const i=ba(t,r)?t[r]:void 0;return i&&typeof i=="object"?Da(i):a()};function xA(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:u$();const t=Ye=>xA(Ye);if(t.version="3.4.15",t.removed=[],!e||!e.document||e.document.nodeType!==La.document||!e.Element)return t.isSupported=!1,t;let r=e.document;const a=r,i=a.currentScript;e.DocumentFragment;const o=e.HTMLTemplateElement,l=e.Node,u=e.Element,d=e.NodeFilter,f=e.NamedNodeMap;f===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;const p=e.DOMParser,h=e.trustedTypes,m=u.prototype,y=Ya(m,"cloneNode"),v=Ya(m,"remove"),k=Ya(m,"removeAttributeNode"),_=Ya(m,"nextSibling"),w=Ya(m,"childNodes"),N=Ya(m,"parentNode"),E=Ya(m,"shadowRoot"),A=Ya(m,"attributes"),T=l&&l.prototype?Ya(l.prototype,"nodeType"):null,C=l&&l.prototype?Ya(l.prototype,"nodeName"):null,j=l&&l.prototype?Ya(l.prototype,"ownerDocument"):null,M=function($){return T?T($):$.nodeType},L=function($){return C?C($):$.nodeName};if(typeof o=="function"){const Ye=r.createElement("template");Ye.content&&Ye.content.ownerDocument&&(r=Ye.content.ownerDocument)}let I,B="",z,ee=!1,V=0;const D=function(){if(V>0)throw mo('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},K=function($){D(),V++;try{return I.createHTML($)}finally{V--}},H=function($){D(),V++;try{return I.createScriptURL($)}finally{V--}},J=function(){return ee||(z=d$(h,i),ee=!0),z},ne=r,P=ne.implementation,U=ne.createNodeIterator,X=ne.createDocumentFragment,F=ne.getElementsByTagName,Z=a.importNode;let W=ZC();t.isSupported=typeof gA=="function"&&typeof N=="function"&&P&&P.createHTMLDocument!==void 0;const G=QH,oe=ZH,Q=JH,fe=e$,ke=t$,Fe=r$,Ve=n$,Ge=i$;let qe=YC,Ce=null;const He=wr({},[...WC,...vb,...kb,..._b,...VC]);let ze=null;const gt=wr({},[...GC,...wb,...KC,...Fd]);let mt=Object.seal(_l(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),wt=null,$e=null;const Et=Object.seal(_l(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Ze=!0,Oe=!0,it=!1,me=!0,Ee=!1,ge=!0,je=!1,se=!1,De=null,rt=null,dt=!1,lt=!1,Lt=!1,ot=!1,et=!0,Ot=!1;const gr="user-content-";let dr=!0,or=!1,Qt={},$r=null;const ue=wr({},["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 Le=null;const ct=wr({},["audio","video","img","source","image","track"]);let Be=null;const nt=wr({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),kt="http://www.w3.org/1998/Math/MathML",at="http://www.w3.org/2000/svg",re="http://www.w3.org/1999/xhtml";let ve=re,Re=!1,ie=null;const Rt=wr({},[kt,at,re],bb),ft=En(["mi","mo","mn","ms","mtext"]);let Ut=wr({},ft);const Me=En(["annotation-xml"]);let Tt=wr({},Me);const tr=wr({},["title","style","font","a","script"]);let rn=null;const hn=["application/xhtml+xml","text/html"],mn="text/html";let yr=null,oa=null;const ri=r.createElement("form"),_a=function($){return $ instanceof RegExp||$ instanceof Function},un=function(){let $=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(oa&&oa===$)return;(!$||typeof $!="object")&&($={}),$=Da($),rn=hn.indexOf($.PARSER_MEDIA_TYPE)===-1?mn:$.PARSER_MEDIA_TYPE,yr=rn==="application/xhtml+xml"?bb:Fc,Ce=Cs($,"ALLOWED_TAGS",He,{transform:yr}),ze=Cs($,"ALLOWED_ATTR",gt,{transform:yr}),ie=Cs($,"ALLOWED_NAMESPACES",Rt,{transform:bb}),Be=Cs($,"ADD_URI_SAFE_ATTR",nt,{transform:yr,base:nt}),Le=Cs($,"ADD_DATA_URI_TAGS",ct,{transform:yr,base:ct}),$r=Cs($,"FORBID_CONTENTS",ue,{transform:yr}),wt=Cs($,"FORBID_TAGS",Da({}),{transform:yr}),$e=Cs($,"FORBID_ATTR",Da({}),{transform:yr}),Qt=ba($,"USE_PROFILES")?$.USE_PROFILES&&typeof $.USE_PROFILES=="object"?Da($.USE_PROFILES):$.USE_PROFILES:!1,Ze=$.ALLOW_ARIA_ATTR!==!1,Oe=$.ALLOW_DATA_ATTR!==!1,it=$.ALLOW_UNKNOWN_PROTOCOLS||!1,me=$.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ee=$.SAFE_FOR_TEMPLATES||!1,ge=$.SAFE_FOR_XML!==!1,je=$.WHOLE_DOCUMENT||!1,lt=$.RETURN_DOM||!1,Lt=$.RETURN_DOM_FRAGMENT||!1,ot=$.RETURN_TRUSTED_TYPE||!1,dt=$.FORCE_BODY||!1,et=$.SANITIZE_DOM!==!1,Ot=$.SANITIZE_NAMED_PROPS||!1,dr=$.KEEP_CONTENT!==!1,or=$.IN_PLACE||!1,qe=KH($.ALLOWED_URI_REGEXP)?$.ALLOWED_URI_REGEXP:YC,ve=typeof $.NAMESPACE=="string"?$.NAMESPACE:re,Ut=Sb($,"MATHML_TEXT_INTEGRATION_POINTS",()=>wr({},ft)),Tt=Sb($,"HTML_INTEGRATION_POINTS",()=>wr({},Me));const ce=Sb($,"CUSTOM_ELEMENT_HANDLING",()=>_l(null));if(mt=_l(null),ba(ce,"tagNameCheck")&&_a(ce.tagNameCheck)&&(mt.tagNameCheck=ce.tagNameCheck),ba(ce,"attributeNameCheck")&&_a(ce.attributeNameCheck)&&(mt.attributeNameCheck=ce.attributeNameCheck),ba(ce,"allowCustomizedBuiltInElements")&&typeof ce.allowCustomizedBuiltInElements=="boolean"&&(mt.allowCustomizedBuiltInElements=ce.allowCustomizedBuiltInElements),Dn(mt),Ee&&(Oe=!1),Lt&&(lt=!0),Qt&&(Ce=wr({},VC),ze=_l(null),Qt.html===!0&&(wr(Ce,WC),wr(ze,GC)),Qt.svg===!0&&(wr(Ce,vb),wr(ze,wb),wr(ze,Fd)),Qt.svgFilters===!0&&(wr(Ce,kb),wr(ze,wb),wr(ze,Fd)),Qt.mathMl===!0&&(wr(Ce,_b),wr(ze,KC),wr(ze,Fd))),Et.tagCheck=null,Et.attributeCheck=null,ba($,"ADD_TAGS")&&(typeof $.ADD_TAGS=="function"?Et.tagCheck=$.ADD_TAGS:Rl($.ADD_TAGS)&&(Ce===He&&(Ce=Da(Ce)),wr(Ce,$.ADD_TAGS,yr))),ba($,"ADD_ATTR")&&(typeof $.ADD_ATTR=="function"?Et.attributeCheck=$.ADD_ATTR:Rl($.ADD_ATTR)&&(ze===gt&&(ze=Da(ze)),wr(ze,$.ADD_ATTR,yr))),ba($,"ADD_FORBID_CONTENTS")&&Rl($.ADD_FORBID_CONTENTS)&&($r===ue&&($r=Da($r)),wr($r,$.ADD_FORBID_CONTENTS,yr)),dr&&(Ce["#text"]=!0),je&&wr(Ce,["html","head","body"]),Ce.table&&(wr(Ce,["tbody"]),delete wt.tbody),$.TRUSTED_TYPES_POLICY){if(typeof $.TRUSTED_TYPES_POLICY.createHTML!="function")throw mo('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof $.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw mo('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const Se=I;I=$.TRUSTED_TYPES_POLICY;try{B=K("")}catch(We){throw I=Se,We}}else $.TRUSTED_TYPES_POLICY===null?(I=void 0,B=""):(I===void 0&&(I=J()),I&&typeof B=="string"&&(B=K("")));En&&En($),oa=$},wa=wr({},[...vb,...kb,...YH]),la=wr({},[..._b,...XH]),Lr=function($,ce,Se){return ce.namespaceURI===re?$==="svg":ce.namespaceURI===kt?$==="svg"&&(Se==="annotation-xml"||Ut[Se]):!!wa[$]},ki=function($,ce,Se){return ce.namespaceURI===re?$==="math":ce.namespaceURI===at?$==="math"&&Tt[Se]:!!la[$]},ni=function($,ce,Se){return ce.namespaceURI===at&&!Tt[Se]||ce.namespaceURI===kt&&!Ut[Se]?!1:!la[$]&&(tr[$]||!wa[$])},ca=function($){let ce=N($);(!ce||!ce.tagName)&&(ce={namespaceURI:ve,tagName:"template"});const Se=Fc($.tagName),We=Fc(ce.tagName);return ie[$.namespaceURI]?$.namespaceURI===at?Lr(Se,ce,We):$.namespaceURI===kt?ki(Se,ce,We):$.namespaceURI===re?ni(Se,ce,We):!!(rn==="application/xhtml+xml"&&ie[$.namespaceURI]):!1},jn=function($){Ac(t.removed,{element:$});try{N($).removeChild($)}catch{if(v($),!N($))throw mo("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Je=function($,ce,Se){try{k($,ce)}catch{try{$.removeAttribute(Se)}catch{}}},_t=function($){Or($);const ce=w($);if(ce){const We=[];bo(ce,ht=>{Ac(We,ht)}),bo(We,ht=>{try{v(ht)}catch{}})}const Se=A($);if(Se)for(let We=Se.length-1;We>=0;--We){const ht=Se[We],St=ht&&ht.name;typeof St=="string"&&Je($,ht,St)}},qt=function($,ce,Se){if(!Se)try{Se=ce.getAttributeNode($)}catch{Se=null}Ac(t.removed,{attribute:Se||null,from:ce});try{Se?k(ce,Se):ce.removeAttribute($)}catch{try{ce.removeAttribute($)}catch{}}if($==="is")if(lt||Lt)try{jn(ce)}catch{}else try{ce.setAttribute($,"")}catch{}},Gt=function($){const ce=A($);if(ce)for(let Se=ce.length-1;Se>=0;--Se){const We=ce[Se],ht=We&&We.name;typeof ht!="string"||ze[yr(ht)]||Je($,We,ht)}},Or=function($){const ce=[$];for(;ce.length>0;){const Se=ce.pop();M(Se)===La.element&&Gt(Se);const ht=w(Se);if(ht)for(let St=ht.length-1;St>=0;--St)ce.push(ht[St])}},vr=function($,ce){return ge?$==="patchsrc"?!0:$==="for"&&ce!=="label"&&ce!=="output":!1},Pn=function($){if(!ge)return;const ce=[$];for(;ce.length>0;){const Se=ce.pop(),We=M(Se);if(We===La.processingInstruction||We===La.comment&&Kn(QC,Se.data)){try{v(Se)}catch{}continue}if(We===La.element){const St=Se,Sr=yr(L(Se));try{St.hasAttribute&&St.hasAttribute("patchsrc")&&St.removeAttribute("patchsrc"),St.hasAttribute&&St.hasAttribute("for")&&vr("for",Sr)&&St.removeAttribute("for")}catch{}}const ht=w(Se);if(ht)for(let St=ht.length-1;St>=0;--St)ce.push(ht[St])}},Ua=function($){let ce=null,Se=null;if(dt)$="<remove></remove>"+$;else{const St=UC($,/^[\r\n\t ]+/);Se=St&&St[0]}rn==="application/xhtml+xml"&&ve===re&&($='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+$+"</body></html>");const We=I?K($):$;if(ve===re)try{ce=new p().parseFromString(We,rn)}catch{}if(!ce||!ce.documentElement){ce=P.createDocument(ve,"template",null);try{ce.documentElement.innerHTML=Re?B:We}catch{}}const ht=ce.body||ce.documentElement;return $&&Se&&ht.insertBefore(r.createTextNode(Se),ht.childNodes[0]||null),ve===re?F.call(ce,je?"html":"body")[0]:je?ce.documentElement:ht},fn=function($){const ce=j?j($):$.ownerDocument;return U.call(ce||$,$,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},Wr=function($){return $=Ic($,G," "),$=Ic($,oe," "),$=Ic($,Q," "),$},Zr=function($){var ce;$.normalize();const Se=j?j($):$.ownerDocument,We=U.call(Se||$,$,d.SHOW_TEXT|d.SHOW_COMMENT|d.SHOW_CDATA_SECTION|d.SHOW_PROCESSING_INSTRUCTION,null);let ht=We.nextNode();for(;ht;)ht.data=Wr(ht.data),ht=We.nextNode();const St=(ce=$.querySelectorAll)===null||ce===void 0?void 0:ce.call($,"template");St&&bo(St,Sr=>{Fn(Sr.content)&&Zr(Sr.content)})},Tr=function($){const ce=C?C($):null;return typeof ce!="string"||yr(ce)!=="form"?!1:typeof $.nodeName!="string"||typeof $.textContent!="string"||typeof $.removeChild!="function"||$.attributes!==A($)||typeof $.removeAttribute!="function"||typeof $.removeAttributeNode!="function"||typeof $.getAttributeNode!="function"||typeof $.setAttribute!="function"||typeof $.namespaceURI!="string"||typeof $.insertBefore!="function"||typeof $.hasChildNodes!="function"||$.nodeType!==T($)||$.childNodes!==w($)},Fn=function($){if(!T||typeof $!="object"||$===null)return!1;try{return T($)===La.documentFragment}catch{return!1}},ai=function($){if(!T||typeof $!="object"||$===null)return!1;try{return typeof T($)=="number"}catch{return!1}};function nn(Ye,$,ce){Ye.length!==0&&bo(Ye,Se=>{Se.call(t,$,ce,oa)})}const ua=function($,ce){return!!(ge&&$.hasChildNodes()&&!ai($.firstElementChild)&&Kn(XC,$.textContent)&&Kn(XC,$.innerHTML)||ge&&$.namespaceURI===re&&l$[ce]&&(ai($.firstElementChild)||typeof $.textContent=="string"&&Kn(c$[ce],$.textContent))||$.nodeType===La.processingInstruction||ge&&$.nodeType===La.comment&&Kn(QC,$.data))},Cn=function($,ce){if($ instanceof RegExp)return Kn($,ce);if($ instanceof Function){for(var Se=arguments.length,We=new Array(Se>2?Se-2:0),ht=2;ht<Se;ht++)We[ht-2]=arguments[ht];return!!$(ce,...We)}return!1},qa=function($,ce,Se){if(!wt[ce]&&da(ce)&&Cn(mt.tagNameCheck,ce))return!1;if(dr&&!$r[ce]){const We=N($),ht=w($);if(ht&&We){const St=ht.length;for(let Sr=St-1;Sr>=0;--Sr){const Nr=$===Se?y(ht[Sr],!0):ht[Sr];We.insertBefore(Nr,_($))}}}return jn($),!0},Jn=function($,ce,Se,We){return $.length===0?ce:ce===Se||ce===We?Da(ce):ce},Bn=function($,ce){return $===ce||N($)!==null?!1:(or&&Or($),!0)},Sa=function($,ce){if(nn(W.beforeSanitizeElements,$,null),Bn($,ce))return!0;if(Tr($))return jn($),!0;const Se=yr(L($));if(Ce=Jn(W.uponSanitizeElement,Ce,He,De),nn(W.uponSanitizeElement,$,{tagName:Se,allowedTags:Ce}),Bn($,ce))return!0;if(ua($,Se))return jn($),!0;if(wt[Se]||!(Et.tagCheck instanceof Function&&Et.tagCheck(Se))&&!Ce[Se]){const ht=qa($,Se,ce);return ht===!1&&nn(W.afterSanitizeElements,$,null),ht}if(M($)===La.element&&!ca($)||(Se==="noscript"||Se==="noembed"||Se==="noframes")&&Kn(s$,$.innerHTML))return jn($),!0;if(Ee&&$.nodeType===La.text){const ht=Wr($.textContent);$.textContent!==ht&&(Ac(t.removed,{element:$.cloneNode()}),$.textContent=ht)}return nn(W.afterSanitizeElements,$,null),!1},fr=function($,ce,Se){if($e[ce]||vr(ce,$)||et&&(ce==="id"||ce==="name")&&(Se in r||Se in ri))return!1;const We=ze[ce]||Et.attributeCheck instanceof Function&&Et.attributeCheck(ce,$);return Oe&&Kn(fe,ce)||Ze&&Kn(ke,ce)?!0:We?Be[ce]||Kn(qe,Ic(Se,Ve,""))||(ce==="src"||ce==="xlink:href"||ce==="href")&&$!=="script"&&qC(Se,"data:")===0&&Le[$]||it&&!Kn(Fe,Ic(Se,Ve,""))?!0:!Se:da($)&&Cn(mt.tagNameCheck,$)&&Cn(mt.attributeNameCheck,ce,$)||ce==="is"&&mt.allowCustomizedBuiltInElements&&Cn(mt.tagNameCheck,Se)},Kt=wr({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),da=function($){return!Kt[Fc($)]&&Kn(Ge,$)},zr=function($,ce,Se,We){if(I&&typeof h=="object"&&typeof h.getAttributeType=="function"&&!Se)switch(h.getAttributeType($,ce)){case"TrustedHTML":return K(We);case"TrustedScriptURL":return H(We)}return We},kr=function($,ce,Se,We){try{return Se?$.setAttributeNS(Se,ce,We):$.setAttribute(ce,We),Tr($)?(jn($),!1):!0}catch{return qt(ce,$),!1}},zn=function($){nn(W.beforeSanitizeAttributes,$,null);const ce=$.attributes;if(!ce||Tr($))return;ze=Jn(W.uponSanitizeAttribute,ze,gt,rt);const Se={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ze,forceKeepAttr:void 0};let We=ce.length;const ht=yr($.nodeName);for(;We--;){const St=ce[We],Sr=St.name,Nr=St.namespaceURI,Hr=St.value,Rn=yr(Sr),_i=Hr;let an=Sr==="value"?_i:qH(_i),Fs=!1;if(Se.attrName=Rn,Se.attrValue=an,Se.keepAttr=!0,Se.forceKeepAttr=void 0,nn(W.uponSanitizeAttribute,$,Se),an=Se.attrValue,Ot&&(Rn==="id"||Rn==="name")&&qC(an,gr)!==0&&(qt(Sr,$,St),an=gr+an,Fs=!0),ge&&Kn(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,an)){qt(Sr,$,St);continue}if(Rn==="attributename"&&UC(an,"href")){qt(Sr,$,St);continue}if(!Se.forceKeepAttr){if(!Se.keepAttr){qt(Sr,$,St);continue}if(!me&&Kn(o$,an)){qt(Sr,$,St);continue}if(Ee&&(an=Wr(an)),!fr(ht,Rn,an)){qt(Sr,$,St);continue}an=zr(ht,Rn,Nr,an),an!==_i&&kr($,Sr,Nr,an)&&Fs&&zC(t.removed)}}nn(W.afterSanitizeAttributes,$,null)},Tn=function($){let ce=null;const Se=fn($);for(nn(W.beforeSanitizeShadowDOM,$,null);ce=Se.nextNode();)if(nn(W.uponSanitizeShadowNode,ce,null),Sa(ce,$),zn(ce),Fn(ce.content)&&Tn(ce.content),M(ce)===La.element){const We=E(ce);Fn(We)&&(bt(We),Tn(We))}nn(W.afterSanitizeShadowDOM,$,null)},bt=function($){const ce=[{node:$,shadow:null}];for(;ce.length>0;){const Se=ce.pop();if(Se.shadow){Tn(Se.shadow);continue}const We=Se.node,St=M(We)===La.element,Sr=w(We);if(Sr)for(let Nr=Sr.length-1;Nr>=0;--Nr)ce.push({node:Sr[Nr],shadow:null});if(St){const Nr=C?C(We):null;if(typeof Nr=="string"&&yr(Nr)==="template"){const Hr=We.content;Fn(Hr)&&ce.push({node:Hr,shadow:null})}}if(St){const Nr=E(We);Fn(Nr)&&ce.push({node:null,shadow:Nr},{node:Nr,shadow:null})}}};return t.sanitize=function(Ye){let $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ce=null,Se=null,We=null,ht=null;if(Re=!Ye,Re&&(Ye="<!-->"),typeof Ye!="string"&&!ai(Ye)&&(Ye=GH(Ye),typeof Ye!="string"))throw mo("dirty is not a string, aborting");if(!t.isSupported)return Ye;se?(Ce=De,ze=rt):un($),(W.uponSanitizeElement.length>0||W.uponSanitizeAttribute.length>0)&&(Ce=Da(Ce)),W.uponSanitizeAttribute.length>0&&(ze=Da(ze)),t.removed=[];const St=or&&typeof Ye!="string"&&ai(Ye);if(St){Pn(Ye);const Hr=L(Ye);if(typeof Hr=="string"){const Rn=yr(Hr);if(!Ce[Rn]||wt[Rn])throw _t(Ye),mo("root node is forbidden and cannot be sanitized in-place")}if(Tr(Ye))throw _t(Ye),mo("root node is clobbered and cannot be sanitized in-place");try{bt(Ye)}catch(Rn){throw _t(Ye),Rn}}else if(ai(Ye))ce=Ua("<!---->"),Se=ce.ownerDocument.importNode(Ye,!0),Se.nodeType===La.element&&Se.nodeName==="BODY"||Se.nodeName==="HTML"?ce=Se:ce.appendChild(Se),bt(ce);else{if(!lt&&!Ee&&!je&&Ye.indexOf("<")===-1)return I&&ot?K(Ye):Ye;if(ce=Ua(Ye),!ce)return lt?null:ot?B:""}ce&&dt&&jn(ce.firstChild);const Sr=St?Ye:ce;try{const Hr=fn(Sr);for(;We=Hr.nextNode();)Sa(We,Sr),zn(We),Fn(We.content)&&Tn(We.content)}catch(Hr){throw St&&(_t(Ye),bo(t.removed,Rn=>{Rn.element&&Or(Rn.element)})),Hr}if(St)return bo(t.removed,Hr=>{Hr.element&&Or(Hr.element)}),Ee&&Zr(Ye),Ye;if(lt){if(Ee&&Zr(ce),Lt)for(ht=X.call(ce.ownerDocument);ce.firstChild;)ht.appendChild(ce.firstChild);else ht=ce;return(ze.shadowroot||ze.shadowrootmode)&&(ht=Z.call(a,ht,!0)),ht}let Nr=je?ce.outerHTML:ce.innerHTML;return je&&Ce["!doctype"]&&ce.ownerDocument&&ce.ownerDocument.doctype&&ce.ownerDocument.doctype.name&&Kn(a$,ce.ownerDocument.doctype.name)&&(Nr="<!DOCTYPE "+ce.ownerDocument.doctype.name+`>
105
+ `+Nr),Ee&&(Nr=Wr(Nr)),I&&ot?K(Nr):Nr},t.setConfig=function(){let Ye=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};un(Ye),se=!0,De=Ce,rt=ze},t.clearConfig=function(){oa=null,se=!1,De=null,rt=null,I=z,B=""},t.isValidAttribute=function(Ye,$,ce){oa||un({});const Se=yr(Ye),We=yr($);return fr(Se,We,ce)},t.addHook=function(Ye,$){typeof $=="function"&&ba(W,Ye)&&Ac(W[Ye],$)},t.removeHook=function(Ye,$){if(ba(W,Ye)){if($!==void 0){const ce=zH(W[Ye],$);return ce===-1?void 0:UH(W[Ye],ce,1)[0]}return zC(W[Ye])}},t.removeHooks=function(Ye){ba(W,Ye)&&(W[Ye]=[])},t.removeAllHooks=function(){W=ZC()},t}var f$=xA();let Nb=null;function p$(){return Nb||(Nb=W4(()=>import("./mermaid.core-DMFcbM4K.js").then(e=>e.ca),[]).then(function(e){const t=e.default||e;return t.initialize({startOnLoad:!1,securityLevel:"strict",theme:"default",flowchart:{curve:"basis"},suppressErrorRendering:!0}),t})),Nb}function JC(){return typeof document>"u"?!1:document.documentElement.classList.contains("dark")}let e4=0;function g$(){return e4+=1,"pave-canvas-"+e4}function h$({source:e}){const t=x.useRef(null),r=x.useRef(g$()),[a,i]=x.useState(null),[o,l]=x.useState(JC());return x.useEffect(function(){if(typeof window>"u")return;const u=new MutationObserver(function(){const d=JC();l(function(f){return f!==d?d:f})});return u.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),function(){u.disconnect()}},[]),x.useEffect(function(){let u=!1;return i(null),p$().then(function(d){u||(d.initialize({startOnLoad:!1,securityLevel:"strict",theme:o?"dark":"default",flowchart:{curve:"basis"},suppressErrorRendering:!0}),d.render(r.current,e).then(function(f){if(!u&&t.current){let 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]),a?n.jsxs("div",{className:"text-xs text-red-600 dark:text-red-400 p-2",children:[n.jsx("div",{className:"font-semibold mb-1",children:"Mermaid render error:"}),n.jsx("pre",{className:"whitespace-pre-wrap",children:a}),n.jsxs("details",{className:"mt-2",children:[n.jsx("summary",{className:"cursor-pointer text-gray-600 dark:text-gray-400",children:"Source"}),n.jsx("pre",{className:"mt-1 p-2 bg-gray-100 dark:bg-gray-800 rounded overflow-x-auto",children:e})]})]}):n.jsx("div",{ref:t,className:"mermaid-canvas w-full h-full flex items-center justify-center [&>svg]:max-w-full [&>svg]:max-h-full [&>svg]:w-full [&>svg]:h-auto"})}function m$({source:e}){const t=x.useMemo(function(){return f$.sanitize(e,{USE_PROFILES:{svg:!0,svgFilters:!0}})},[e]);return n.jsx("div",{className:"svg-canvas overflow-x-auto",dangerouslySetInnerHTML:{__html:t}})}function x$({source:e}){return n.jsx("pre",{className:"text-sm p-2 bg-gray-100 dark:bg-gray-800 rounded overflow-x-auto",children:e})}function y$({canvas:e}){if(!e||!e.type||!e.source)return null;let t=null;return e.type==="mermaid"?t=n.jsx(h$,{source:e.source}):e.type==="svg"?t=n.jsx(m$,{source:e.source}):e.type==="katex"?t=n.jsx(x$,{source:e.source}):t=n.jsxs("pre",{className:"text-xs text-red-600 dark:text-red-400",children:["Unknown canvas type: ",e.type]}),n.jsx("div",{className:"w-full h-full flex items-center justify-center",children:t})}function t4({canvases:e,onClear:t}){const r=Array.isArray(e)?e:[],[a,i]=x.useState(Math.max(0,r.length-1)),[o,l]=x.useState(1),[u,d]=x.useState(!1);x.useEffect(function(){i(function(_){return _>=r.length-2?Math.max(0,r.length-1):Math.min(_,Math.max(0,r.length-1))})},[r.length]),x.useEffect(function(){l(1)},[a]),x.useEffect(function(){if(!u)return;const _=w=>{w.key==="Escape"&&d(!1)};return window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)},[u]);const f=x.useCallback(()=>l(_=>Math.min(4,+(_+.25).toFixed(2))),[]),p=x.useCallback(()=>l(_=>Math.max(.5,+(_-.25).toFixed(2))),[]),h=x.useCallback(()=>l(1),[]);if(r.length===0)return n.jsxs("div",{className:"h-full flex flex-col items-center justify-center p-6 text-center",children:[n.jsx("svg",{className:"w-12 h-12 text-gray-300 dark:text-gray-600 mb-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17V7m0 10a2 2 0 01-2 2H5a2 2 0 01-2-2V7a2 2 0 012-2h2a2 2 0 012 2m0 10a2 2 0 002 2h2a2 2 0 002-2M9 7a2 2 0 012-2h2a2 2 0 012 2m0 10V7m0 10a2 2 0 002 2h2a2 2 0 002-2V7a2 2 0 00-2-2h-2a2 2 0 00-2 2"})}),n.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400 max-w-xs",children:["Ask the agent to draw something here. It can use the ",n.jsx("code",{className:"px-1 bg-gray-200 dark:bg-gray-700 rounded",children:"canvas"})," tool to render Mermaid diagrams, SVG illustrations, or math."]})]});const m=Math.min(Math.max(0,a),r.length-1),y=r[m],v=n.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-1.5 border-b border-gray-200 dark:border-gray-700 text-xs",children:[r.length>1?n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("button",{type:"button",onClick:()=>i(Math.max(0,m-1)),disabled:m===0,className:"px-2 py-0.5 rounded text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 disabled:opacity-40 disabled:cursor-not-allowed",title:"Previous canvas",children:"←"}),n.jsxs("span",{className:"text-gray-500 dark:text-gray-400 tabular-nums",children:[m+1,"/",r.length]}),n.jsx("button",{type:"button",onClick:()=>i(Math.min(r.length-1,m+1)),disabled:m===r.length-1,className:"px-2 py-0.5 rounded text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 disabled:opacity-40 disabled:cursor-not-allowed",title:"Next canvas",children:"→"})]}):n.jsx("div",{}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("button",{type:"button",onClick: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:"−"}),n.jsxs("button",{type:"button",onClick:h,className:"px-1.5 py-0.5 rounded text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 tabular-nums min-w-[3rem]",title:"Reset zoom",children:[Math.round(o*100),"%"]}),n.jsx("button",{type:"button",onClick:f,disabled:o>=4,className:"px-1.5 py-0.5 rounded text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 disabled:opacity-40",title:"Zoom in",children:"+"}),n.jsx("button",{type:"button",onClick:()=>d(_=>!_),className:"ml-1 px-1.5 py-0.5 rounded text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800",title:u?"Exit fullscreen (Esc)":"Fullscreen",children:u?"⤢":"⛶"}),t?n.jsx("button",{type:"button",onClick:t,className:"ml-1 px-1.5 py-0.5 rounded text-gray-600 dark:text-gray-300 hover:bg-red-50 dark:hover:bg-red-900/30 hover:text-red-600 dark:hover:text-red-400",title:"Clear all canvases (hides them; messages preserved)",children:"✕"}):null]})]}),k=n.jsxs("div",{className:"flex-1 overflow-auto p-3",children:[y.title?n.jsx("div",{className:"text-sm font-semibold text-gray-700 dark:text-gray-200 mb-2",children:y.title}):null,n.jsx("div",{style:{transform:`scale(${o})`,transformOrigin:"top left",width:o===1?"100%":`${100/o}%`},children:n.jsx(y$,{canvas:y})}),y.caption?n.jsx("div",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400 italic",children:y.caption}):null]});return u?n.jsxs("div",{className:"fixed inset-0 z-50 bg-white dark:bg-gray-900 flex flex-col",children:[v,k]}):n.jsxs("div",{className:"h-full flex flex-col",children:[v,k]})}function b$(e){return e?e.includes("/")?e.split("/").slice(1).join("/")||null:e:null}function v$(e,t){const r=b$(e);return{modelID:r||t||null,activeModelID:r,conversationModelID:t}}function k$(e){const{serverContextLimit:t,registryLimitMap:r={},limitModelID:a,effectiveActiveModel:i,modelLimits:o={},defaultLimit:l}=e||{};return t||r[a]||r[i]||o[a]||l}function r4(e,t,r,a){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)(a||!Object.prototype.hasOwnProperty.call(e,o[l]))&&(e[o[l]]=r)}function _$(e){const t={};if(!Array.isArray(e))return t;for(let r=0;r<e.length;r+=1){const a=e[r],i=a&&a.limit?a.limit.context:null;typeof i!="number"||i<=0||(r4(t,a.key,i,!0),r4(t,a.target,i,!1))}return t}const Nk={"github-copilot":"GitHub Copilot",anthropic:"Anthropic",openai:"OpenAI",google:"Google",other:"Other"};function Ek(e){return e==="recommended"?" — Recommended":e==="fast"?" — Fast":e==="premium"?" — Premium":""}function jk(e){const t={};return e.forEach(r=>{const a=r.provider||"other";t[a]||(t[a]=[]),t[a].push(r)}),t}function w$({isBusy:e,isCompacting:t}={}){return e?t?"compacting":"generating":"idle"}const S$={"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},N$=128e3;function Eb(e){const[t,r]=x.useState(e),a=x.useRef(e),i=x.useRef(0),o=x.useRef(0);return x.useEffect(()=>{if(e===a.current)return;i.current=0,a.current=t;const l=400,u=t,d=e,f=p=>{i.current||(i.current=p);const h=p-i.current,m=Math.min(h/l,1),y=1-(1-m)**3;r(Math.round(u+(d-u)*y)),m<1?o.current=requestAnimationFrame(f):r(d)};return o.current=requestAnimationFrame(f),()=>cancelAnimationFrame(o.current)},[e]),t}function E$({messages:e,isBusy:t,isCompacting:r,activeModel:a,sessionModel:i,isPrivateMode:o,registryEntries:l}){var U,X;var{t:u}=Jt();const d=e.filter(F=>{var Z;return((Z=F.info)==null?void 0:Z.role)==="user"}).length,f=e.filter(F=>{var Z;return((Z=F.info)==null?void 0:Z.role)==="assistant"}).length;let p=0,h=0,m=0,y=null,v=null;for(let F=e.length-1;F>=0;F--){const Z=e[F];if(((U=Z.info)==null?void 0:U.role)==="assistant"&&((X=Z.info)==null?void 0:X.mode)!=="compaction"){const W=Z.info.tokens;if(W&&(W.input||W.output)){!y&&Z.info.modelID&&(y=Z.info.modelID),p=W.lastInput??W.input??0,h=W.lastOutput??W.output??0,m=W.lastReasoning??W.reasoning??0,Z.info.contextLimit&&(v=Z.info.contextLimit);break}}}const k=Eb(p),_=Eb(h),w=Eb(m),N=k+_+w,E=p+h+m>0;let A=a;typeof i=="string"&&i?A=i:i&&i.providerID&&i.modelID&&(A=i.providerID+"/"+i.modelID);let{modelID:T,activeModelID:C}=v$(A,y),j=null;if(o){T="privacy",C="privacy";let F=null;typeof i=="string"&&i?F=i.includes("/")?i.split("/").pop():i:i&&i.modelID&&(F=i.modelID),j=F||(a?String(a).split("/").pop():null)}else y&&C&&y!==C&&(j=y);const M=x.useMemo(()=>_$(l),[l]),I=k$({serverContextLimit:v,registryLimitMap:M,limitModelID:y||T,effectiveActiveModel:A,modelLimits:S$,defaultLimit:N$}),B=Math.min(100,Math.round(k/I*100));let z="bg-green-500";B>=90?z="bg-red-500":B>=75?z="bg-orange-500":B>=50&&(z="bg-yellow-500");const ee="border-gray-200 dark:border-gray-800",V="text-gray-500 dark:text-gray-400",D="text-gray-500 dark:text-gray-400",K="text-gray-700 dark:text-gray-300",H="border-gray-100 dark:border-gray-800";return n.jsxs("div",{className:`p-4 border-t ${ee}`,children:[n.jsx("p",{className:`text-xs ${V} uppercase tracking-wide font-medium mb-3`,children:u("token_usage.session_info")}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:`text-xs ${D}`,children:u("token_usage.messages")}),n.jsx("span",{className:`text-xs font-medium ${K}`,children:d+f})]}),T&&n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:`text-xs ${D}`,children:u("token_usage.model")}),n.jsx("span",{className:`text-xs font-medium ${K} truncate ml-2 max-w-[140px]`,children:n4(T)})]}),j&&n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:`text-xs ${D}`,children:u("token_usage.originally")}),n.jsx("span",{className:`text-xs ${D} truncate ml-2 max-w-[140px]`,children:n4(j)})]}),(()=>{const F=w$({isBusy:t,isCompacting:r}),Z=F==="compacting"?"bg-amber-400 animate-pulse":F==="generating"?"bg-accent-400 animate-pulse":"bg-green-500",W=u(F==="compacting"?"token_usage.compacting":F==="generating"?"token_usage.generating":"token_usage.idle");return n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:`text-xs ${D}`,children:u("token_usage.status")}),n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("div",{className:`w-1.5 h-1.5 rounded-full ${Z}`}),n.jsx("span",{className:`text-xs font-medium ${K}`,children:W})]})]})})(),E?n.jsx(n.Fragment,{children:n.jsxs("div",{className:`border-t ${H} pt-2 mt-2`,children:[n.jsxs("div",{className:"mb-2",children:[n.jsxs("div",{className:"flex items-center justify-between mb-1",children:[n.jsx("span",{className:`text-xs ${D}`,children:"Context"}),n.jsxs("span",{className:`text-xs ${D}`,children:[B,"% of ",(I/1e3).toFixed(0),"k"]})]}),n.jsx("div",{className:"h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:n.jsx("div",{className:`h-full ${z} transition-all duration-300`,style:{width:`${B}%`}})})]}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:`text-xs ${D}`,children:"Input"}),n.jsx("span",{className:`text-xs font-medium ${K} tabular-nums`,children:k.toLocaleString()})]}),n.jsxs("div",{className:"flex items-center justify-between mt-1",children:[n.jsx("span",{className:`text-xs ${D}`,children:"Output"}),n.jsx("span",{className:`text-xs font-medium ${K} tabular-nums`,children:_.toLocaleString()})]}),m>0&&n.jsxs("div",{className:"flex items-center justify-between mt-1",children:[n.jsx("span",{className:`text-xs ${D}`,children:"Reasoning"}),n.jsx("span",{className:`text-xs font-medium ${K} tabular-nums`,children:w.toLocaleString()})]}),n.jsxs("div",{className:`flex items-center justify-between mt-1 pt-1 border-t ${H}`,children:[n.jsx("span",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Total"}),n.jsx("span",{className:"text-xs font-semibold text-gray-900 dark:text-gray-100 tabular-nums",children:N.toLocaleString()})]})]})}):n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:`text-xs ${D}`,children:"Tokens"}),n.jsx("span",{className:`text-xs ${D}`,children:"--"})]})]})]})}function n4(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 j$({sessionModel:e,activeModel:t,registryEntries:r,onModelChange:a,disabled:i,lockedReason:o}){const{t:l}=Jt(),[u,d]=x.useState(!1),f=x.useRef(null),[p,h]=x.useState(-1),m=x.useRef([]);x.useEffect(()=>{if(!u)return;function N(E){f.current&&!f.current.contains(E.target)&&d(!1)}return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[u]),x.useEffect(()=>{if(!u)return;function N(E){if(E.key==="Escape"){d(!1);return}E.key!=="ArrowDown"&&E.key!=="ArrowUp"&&E.key!=="Home"&&E.key!=="End"||(E.preventDefault(),h(A=>{const T=m.current.length;if(!T)return A;const C=typeof A=="number"?A:-1;let j=C;return E.key==="ArrowDown"?j=C<T-1?C+1:0:E.key==="ArrowUp"?j=C>0?C-1:T-1:E.key==="Home"?j=0:E.key==="End"&&(j=T-1),m.current[j]&&m.current[j].focus(),j}))}return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[u]);const y=typeof e=="string"&&e.trim()?e.trim():null,v=y!=null,k=Array.isArray(r)?r:[],_=C$(y,t,k,l),w=x.useCallback(N=>{a(N===t||y&&y===N?null:N),d(!1)},[y,t,a]);return m.current.length=k.length,n.jsxs("div",{className:"relative",ref:f,children:[n.jsxs("button",{type:"button",onClick:()=>d(N=>!N),disabled:i,className:"flex items-center gap-1.5 px-2 py-1 text-xs font-medium rounded-md transition-colors "+(v||_?"bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400 hover:bg-primary-200 dark:hover:bg-primary-900/50":"text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800")+(i?" opacity-50 cursor-not-allowed":" cursor-pointer"),title:o||l("model_selector.title"),"aria-label":o||l("model_selector.title"),"aria-haspopup":"menu","aria-expanded":u,children:[o?n.jsxs("svg",{className:"w-3.5 h-3.5 flex-shrink-0 text-emerald-600 dark:text-emerald-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 11c.667 0 2 .4 2 2v3a2 2 0 11-4 0v-3c0-1.6 1.333-2 2-2zM6 11V8a6 6 0 1112 0v3"}),n.jsx("rect",{x:"5",y:"11",width:"14",height:"10",rx:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}):n.jsx("svg",{className:"w-3.5 h-3.5 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})}),n.jsx("span",{className:"max-w-[120px] truncate",children:_}),n.jsx("svg",{className:`w-3 h-3 transition-transform ${u?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),u&&n.jsxs("div",{className:"absolute left-0 sm:left-auto sm:right-0 top-full mt-1 w-64 max-w-[calc(100vw-1.5rem)] max-h-72 overflow-y-auto bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50",role:"menu","aria-label":l("model_selector.list_label"),children:[k.length===0&&n.jsx("div",{className:"px-3 py-2 text-xs text-gray-400 dark:text-gray-500",children:l("model_selector.no_models")}),k.map((N,E)=>{const A=y===N.key,T=!!t&&(N.key===t||N.target===t||N.url===t),C=N.builtin?N.key:N.displayName||N.key;return n.jsxs("button",{type:"button",ref:j=>{m.current[E]=j},tabIndex:p===E?0:-1,role:"menuitemradio","aria-checked":A||!v&&T,onClick:()=>w(N.key),className:"w-full text-left px-3 py-2 text-xs transition-colors "+(A||!v&&T?"bg-primary-50 dark:bg-primary-900/20 text-primary-700 dark:text-primary-400":"text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800"),children:[n.jsx("span",{className:"font-medium",children:C}),T&&n.jsxs("span",{className:"ml-1 text-gray-400 dark:text-gray-500",children:["(",l("model_selector.default_label"),")"]})]},N.key)})]})]})}function C$(e,t,r,a){return e?a4(e,r):t?a4(t,r):a("model_selector.default_label")}function T$(e,t){if(!e||!Array.isArray(t))return null;for(let r=0;r<t.length;r++){const a=t[r];if(a&&(a.key===e||a.target===e||a.url===e))return a}return null}function a4(e,t){if(!e)return"";const r=T$(e,t);return r?r.builtin?r.key:r.displayName||r.key:typeof e=="string"&&e.includes("/")?e.split("/").slice(1).join("/"):e}function R$(e){e.sessionId;var t=e.disabledSkills,r=e.onToggle,a=e.onResetToDefaults,i=e.t,o=e.disabled,l=x.useState(!1),u=l[0],d=l[1],f=x.useState([]),p=f[0],h=f[1],m=x.useState(!1),y=m[0],v=m[1],k=x.useRef(null),_=t instanceof Array?new Set(t):new Set,w=x.useCallback(async function(){v(!0);try{var C=await Ev();h(C||[])}catch{}finally{v(!1)}},[]);x.useEffect(function(){w()},[w]),x.useEffect(function(){if(!u)return;function C(j){k.current&&!k.current.contains(j.target)&&d(!1)}return document.addEventListener("mousedown",C),function(){document.removeEventListener("mousedown",C)}},[u]);var N=_.size,E=_.has("agent"),A=E?N-1:N,T=Math.max(0,p.length-A+(E?0:1));return n.jsxs("div",{className:"relative",ref:k,children:[n.jsxs("button",{onClick:function(){d(!u)},disabled:o,className:"p-1.5 rounded-lg transition-colors "+(N>0?"bg-amber-500/10 text-amber-600 dark:text-amber-400":"text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800")+(o?" opacity-50 cursor-not-allowed":""),title:i("skills.toggle_title"),"aria-label":i("skills.toggle_title"),children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 4a2 2 0 114 0v1a1 1 0 001 1h3a1 1 0 011 1v3a1 1 0 01-1 1h-1a2 2 0 100 4h1a1 1 0 011 1v3a1 1 0 01-1 1h-3a1 1 0 01-1-1v-1a2 2 0 10-4 0v1a1 1 0 01-1 1H7a1 1 0 01-1-1v-3a1 1 0 00-1-1H4a2 2 0 110-4h1a1 1 0 001-1V7a1 1 0 011-1h3a1 1 0 001-1V4z"})}),T>0&&n.jsx("span",{className:"absolute -top-1 -right-1 w-4 h-4 text-[9px] font-bold flex items-center justify-center bg-primary-500 text-white rounded-full",children:T})]}),u&&n.jsxs("div",{className:"absolute left-0 sm:left-auto sm:right-0 top-full mt-1 w-64 max-w-[calc(100vw-1.5rem)] bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50 max-h-80 overflow-y-auto",children:[n.jsxs("div",{className:"px-3 py-2 border-b border-gray-100 dark:border-gray-800",children:[n.jsx("p",{className:"text-xs font-semibold text-gray-700 dark:text-gray-300",children:i("skills.toggle_header")}),n.jsx("p",{className:"text-[10px] text-gray-400 dark:text-gray-500 mt-0.5",children:i("skills.toggle_hint")})]}),y?n.jsx("div",{className:"flex items-center justify-center py-4",children:n.jsx("div",{className:"w-5 h-5 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}):p.length===0?n.jsx("div",{className:"px-3 py-4 text-center",children:n.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:i("skills.no_skills")})}):n.jsx("div",{className:"py-1",children:p.map(function(C){var j=_.has(C.name);return n.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[n.jsx("span",{className:"text-xs text-gray-700 dark:text-gray-300 truncate flex-1 mr-2",children:C.name}),n.jsx("button",{onClick:function(){r(C.name,j)},className:"relative inline-flex h-5 w-9 items-center rounded-full transition-colors flex-shrink-0 "+(j?"bg-gray-300 dark:bg-gray-600":"bg-primary-500"),role:"switch","aria-checked":!j,children:n.jsx("span",{className:"inline-block h-3.5 w-3.5 transform rounded-full bg-white transition-transform "+(j?"translate-x-1":"translate-x-5")})})]},C.name)})}),n.jsx("div",{className:"px-3 py-1.5 border-t border-gray-100 dark:border-gray-800",children:n.jsx("p",{className:"text-[10px] font-semibold text-gray-400 dark:text-gray-500 uppercase tracking-wide",children:i("skills.builtin_tools")})}),n.jsx("div",{className:"py-1",children:n.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[n.jsx("span",{className:"text-xs text-gray-700 dark:text-gray-300 truncate flex-1 mr-2",children:i("skills.agent_comm")}),n.jsx("button",{onClick:function(){r("agent",E)},className:"relative inline-flex h-5 w-9 items-center rounded-full transition-colors flex-shrink-0 "+(E?"bg-gray-300 dark:bg-gray-600":"bg-primary-500"),role:"switch","aria-checked":!E,children:n.jsx("span",{className:"inline-block h-3.5 w-3.5 transform rounded-full bg-white transition-transform "+(E?"translate-x-1":"translate-x-5")})})]})}),a&&n.jsx("div",{className:"px-3 py-1.5 border-t border-gray-100 dark:border-gray-800",children:n.jsx("button",{onClick:a,className:"w-full text-xs font-medium text-gray-500 dark:text-gray-400 hover:text-primary-600 dark:hover:text-primary-400 hover:underline transition-colors text-center",children:i("skills.reset_to_defaults")})})]})]})}function A$({className:e,...t}){return n.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.25 6.087c0-.355.186-.676.401-.959.221-.29.349-.634.349-1.003 0-1.036-1.007-1.875-2.25-1.875S10.5 3.089 10.5 4.125c0 .369.128.713.349 1.003.215.283.401.604.401.959V6a.75.75 0 01-.75.75H7.5a.75.75 0 00-.75.75v2.25c0 .414-.336.75-.75.75S5.25 10.164 5.25 9.75V9A2.25 2.25 0 003 11.25v.75a.75.75 0 00.75.75h2.25c.414 0 .75.336.75.75s-.336.75-.75.75H3.75a.75.75 0 00-.75.75v.75A2.25 2.25 0 005.25 18h1.5a.75.75 0 01.75.75v.75c0 .414.336.75.75.75h6a.75.75 0 00.75-.75v-.75a.75.75 0 01.75-.75h1.5A2.25 2.25 0 0019.5 15.75v-.75a.75.75 0 00-.75-.75h-2.25a.75.75 0 01-.75-.75c0-.414.336-.75.75-.75h2.25a.75.75 0 00.75-.75v-.75A2.25 2.25 0 0017.25 9h-3a.75.75 0 01-.75-.75V6.087z"})})}function I$({className:e,...t}){return n.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:n.jsx("path",{d:"M20 18h-2V9.25L12 13 6 9.25V18H4V6h1.2l6.8 4.25L18.8 6H20m0-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2z"})})}function M$({className:e,...t}){return n.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:n.jsx("path",{d:"M7.71 3.5l-5.71 9.94 3.48 6.06h5.44L4.07 8.56 7.71 3.5zm1.42 0L15.84 15h-6.71L2.42 3.5h6.71zm.71 12h11.46l-3.48 6.06H6.36l3.48-6.06zm.71-1L16.84 3.5l5.71 9.94-3.48.06H10.55z"})})}function L$({className:e,...t}){return n.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:n.jsx("path",{d:"M20.317 4.37a19.791 19.791 0 00-4.885-1.515.074.074 0 00-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 00-5.487 0 12.64 12.64 0 00-.617-1.25.077.077 0 00-.079-.037A19.736 19.736 0 003.677 4.37a.07.07 0 00-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 00.031.057 19.9 19.9 0 005.993 3.03.078.078 0 00.084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 00-.041-.106 13.107 13.107 0 01-1.872-.892.077.077 0 01-.008-.128 10.2 10.2 0 00.372-.292.074.074 0 01.077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 01.078.01c.12.098.246.198.373.292a.077.077 0 01-.006.127 12.299 12.299 0 01-1.873.892.077.077 0 00-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 00.084.028 19.839 19.839 0 006.002-3.03.077.077 0 00.032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 00-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.946 2.418-2.157 2.418z"})})}function O$({className:e,...t}){return n.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:n.jsx("path",{d:"M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z"})})}function D$({className:e,...t}){return n.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:n.jsx("path",{d:"M3 6l3.5 12h2l2.5-8 2.5 8h2L19 6h-2.5l-2.25 8L12 6h-2l-2.25 8L5.5 6H3z"})})}function P$({className:e,...t}){return n.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:n.jsx("path",{d:"M5 3a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2V5a2 2 0 00-2-2H5zm11.293 6.707l-5.5 5.5a1 1 0 01-1.414 0l-2.5-2.5a1 1 0 111.414-1.414L10.086 13.1l4.793-4.793a1 1 0 111.414 1.4z"})})}function F$({className:e,...t}){return n.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:n.jsx("path",{d:"M4 18V6h3.2l2.8 7 2.8-7H16v12h-2.4V9.6L10.6 18H9.4L6.4 9.6V18H4z"})})}function B$({className:e,...t}){return n.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:n.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 15.5v-5l-3 3v-4l3-3v-3l4 4-4 4v4z"})})}function z$({className:e,...t}){return n.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})})}function U$({className:e,...t}){return n.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z"})})}function q$({className:e,...t}){return n.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:n.jsx("path",{d:"M6 2l6 3.75L6 9.5.002 5.75 6 2zm12 0l6 3.75-6 3.75-5.998-3.75L18 2zM.002 13.25L6 9.5l6 3.75L6 17 .002 13.25zm17.998-3.75l6 3.75L18 17l-5.998-3.75L18 9.5zM6 18.25l6-3.75 6 3.75-6 3.75-6-3.75z"})})}function H$({className:e,...t}){return n.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v12m-3-2.818l.879.659c1.171.879 3.07.879 4.242 0 1.172-.879 1.172-2.303 0-3.182C13.536 12.219 12.768 12 12 12c-.725 0-1.45-.22-2.003-.659-1.106-.879-1.106-2.303 0-3.182s2.9-.879 4.006 0l.415.33M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}function $$({className:e,...t}){return n.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 012.25-2.25h13.5A2.25 2.25 0 0121 7.5v11.25m-18 0A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75m-18 0v-7.5A2.25 2.25 0 015.25 9h13.5A2.25 2.25 0 0121 11.25v7.5"})})}function W$({className:e,...t}){return n.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})})}const i4={gmail:I$,gdrive:M$,discord:L$,whatsapp:O$,wrike:D$,gtasks:P$,mailchimp:F$,bamboohr:B$,pandadoc:z$,exa:U$,dropbox:q$,freshbooks:H$,gcal:$$,docx2md:W$};function V$(e){return Object.prototype.hasOwnProperty.call(i4,e)?i4[e]:A$}const s4={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"},G$=new Set(["current","available","error","unsupported"]);function K$(e){const t=e||{},r=G$.has(t.status)?t.status:t.error?"error":t.hasUpdate?"available":"current";return{status:r,hasUpdate:r==="available",latestVersion:t.latestVersion||null,currentVersion:t.currentVersion||null,error:t.error||null,repository:t.repository||null}}function Y$(e){const t=Object.create(null);return(e||[]).forEach(r=>{!r||!r.name||(t[r.name]=K$(r))}),t}function X$(e){const t={available:0,current:0,error:0,unsupported:0};return Object.values(e||{}).forEach(r=>{r&&Object.prototype.hasOwnProperty.call(t,r.status)&&t[r.status]++}),t}function Q$({installed:e,configured:t,t:r}){return e?t?n.jsxs("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400",children:[n.jsx("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:n.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),r("skills.configured")]}):n.jsxs("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-400",children:[n.jsx("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:n.jsx("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),r("skills.needs_setup")]}):n.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-gray-100 dark:bg-gray-800 text-gray-500 dark:text-gray-400",children:r("skills.not_installed")})}function Z$({skill:e,onClose:t,onSaved:r}){var{t:a}=Jt(),i=iu(),[o,l]=x.useState({}),[u,d]=x.useState(!0),[f,p]=x.useState(!1),[h,m]=x.useState(null),[y,v]=x.useState(!1),[k,_]=x.useState(null);x.useEffect(function(){var L=!1;async function I(){try{var B=await j3(e.name);if(L)return;_(B);for(var z=Object.create(null),ee=Object.keys(B.tokens||{}),V=0;V<ee.length;V++){var D=ee[V],K=B.tokens[D]||{},H=K.env||D;z[H]=""}l(z),d(!1)}catch(J){L||(m(J.message),d(!1))}}return I(),function(){L=!0}},[e.name]);var w=x.useMemo(function(){if(!k||!k.tokens)return null;if(k.oauth&&k.oauth.broker){var L=!!k.oauth.connected,I=k.oauth.provider||"";return{provider:I?I.charAt(0).toUpperCase()+I.slice(1):"OAuth",brokered:!0,canConnect:!L,refreshConfigured:L,clientIdConfigured:!0,clientSecretConfigured:!0}}for(var B=Object.keys(k.tokens),z=0;z<B.length;z++){var ee=k.tokens[B[z]]||{};if(ee.description&&ee.description.includes("OAuth")){for(var V=null,D=null,K=null,H=Object.entries(k.tokens),J=0;J<H.length;J++){var ne=H[J][0];ne.includes("REFRESH_TOKEN")&&(V=ne),(ne.includes("CLIENT_ID")||ne.includes("APP_KEY"))&&(D=ne),(ne.includes("CLIENT_SECRET")||ne.includes("APP_SECRET"))&&(K=ne)}if(V&&D){var P=k.tokens[V]&&k.tokens[V].configured,U=k.tokens[D]&&k.tokens[D].configured,X=K&&k.tokens[K]&&k.tokens[K].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:U&&X&&!P,refreshConfigured:P,clientIdConfigured:U,clientSecretConfigured:X}}}}return null},[k,e.name]),N=x.useCallback(async function(){m(null),v(!0);try{if(w&&w.brokered){let W=function(){M.current&&(clearInterval(M.current),M.current=null)};var L=await D3(e.name),I=600,B=700,z=(window.screen.width-I)/2,ee=(window.screen.height-B)/2,V=window.open(L.authorizeUrl,"oauth_popup","width="+I+",height="+B+",left="+z+",top="+ee+",scrollbars=yes");if(!V){m("Popup blocked. Please allow popups or visit: "+L.authorizeUrl),v(!1);return}var D=L.flowId,K=0,H=0;M.current=setInterval(async function(){K+=1500;try{var G=await P3(e.name,D);if(G&&G.connected){W();try{V.close()}catch{}v(!1),r();return}}catch(oe){W(),m(oe.message),v(!1);return}if(V.closed&&(H||(H=K),K-H>9e3)){W(),v(!1),r();return}K>3e5&&(W(),v(!1),m("Connection timed out. Please try again."))},1500);return}var J=await O3(e.name),ne=600,P=700,U=(window.screen.width-ne)/2,X=(window.screen.height-P)/2,F=window.open(J.authorizeUrl,"oauth_popup","width="+ne+",height="+P+",left="+U+",top="+X+",scrollbars=yes");if(F)var Z=setInterval(function(){F.closed&&(clearInterval(Z),v(!1),r())},500);else m("Popup blocked. Please allow popups or visit: "+J.authorizeUrl),v(!1)}catch(W){m(W.message),v(!1)}},[e.name,r,w]),E=x.useCallback(async function(){m(null),p(!0);try{for(var L=Object.create(null),I=Object.keys(o),B=0;B<I.length;B++){var z=I[B];o[z]&&o[z].trim()&&(L[z]=o[z].trim())}if(Object.keys(L).length===0){m(a("skills.enter_token")),p(!1);return}await A3(e.name,L),r()}catch(ee){m(ee.message)}finally{p(!1)}},[o,e.name,r,a]),A=x.useCallback(async function(){if(await i({title:a("skills.clear_title"),message:a("skills.clear_confirm",{skill:e.name}),destructive:!0})){m(null),p(!0);try{await I3(e.name),r()}catch(L){m(L.message)}finally{p(!1)}}},[e.name,r,i,a]),T=x.useCallback(function(L,I){l(function(B){var z=Object.assign(Object.create(null),B);return z[L]=I,z})},[]),C=k&&!(k.oauth&&k.oauth.broker)?Object.entries(k.tokens||{}).map(function(L){var I=L[0],B=L[1],z=B&&B.env||I;return{name:I,env:z,description:B.description,configured:B.configured,maskedValue:B.maskedValue}}):[],j=x.useRef(null);x.useEffect(function(){function L(I){I.key==="Escape"&&t()}return document.addEventListener("keydown",L),j.current&&j.current.focus(),function(){document.removeEventListener("keydown",L)}},[t]);var M=x.useRef(null);return x.useEffect(function(){return function(){M.current&&(clearInterval(M.current),M.current=null)}},[]),n.jsx("div",{ref:j,tabIndex:-1,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:t,role:"dialog","aria-modal":"true","aria-label":a("skills.configure_skill",{skill:e.name}),children:n.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-xl shadow-2xl w-full max-w-lg mx-4 p-6",onClick:function(L){L.stopPropagation()},children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:a("skills.configure_skill",{skill:e.name})}),n.jsx("button",{onClick:t,className:"p-1 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-400","aria-label":a("skills.close_credential_editor"),children:n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),u&&n.jsx("div",{className:"flex items-center justify-center py-8",children:n.jsx("div",{className:"w-6 h-6 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}),!u&&C.length>0&&n.jsx("div",{className:"space-y-3 mb-4",children:C.map(function(L){return n.jsxs("div",{children:[n.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:[L.env,L.configured&&n.jsxs("span",{className:"ml-2 text-xs text-green-600 dark:text-green-400",children:["(",a("skills.current_value",{value:L.maskedValue}),")"]})]}),L.description&&n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:L.description}),n.jsx("input",{type:"password",placeholder:L.configured?a("skills.leave_blank"):a("skills.enter_value"),value:o[L.env]||"",onChange:function(I){T(L.env,I.target.value)},className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 placeholder-gray-400"})]},L.env)})}),!u&&w&&n.jsx("div",{className:"mb-4 p-4 bg-gray-50 dark:bg-gray-800/50 rounded-lg border border-gray-200 dark:border-gray-700",children:w.canConnect?n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:a("skills.oauth_connect_hint",{provider:w.provider})}),n.jsx("button",{onClick:N,disabled:y||f,className:"w-full flex items-center justify-center gap-2 px-4 py-2.5 bg-primary-500 hover:bg-primary-600 text-white font-medium rounded-lg disabled:opacity-50 transition-colors",children:y?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),a("skills.oauth_connecting")]}):n.jsxs(n.Fragment,{children:[n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1"})}),a("skills.oauth_connect",{provider:w.provider})]})})]}):w.refreshConfigured?n.jsxs("div",{className:"space-y-3",children:[n.jsxs("p",{className:"text-sm text-green-600 dark:text-green-400 flex items-center gap-2",children:[n.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:n.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),a("skills.oauth_connected",{provider:w.provider})]}),n.jsx("button",{onClick:A,disabled:f,className:"text-sm text-red-600 dark:text-red-400 hover:text-red-700 dark:hover:text-red-300 disabled:opacity-50",children:a("skills.oauth_disconnect",{provider:w.provider})})]}):n.jsx("p",{className:"text-sm text-amber-600 dark:text-amber-400",children:a("skills.oauth_needs_credentials",{provider:w.provider})})}),!u&&!h&&C.length===0&&!w&&n.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 py-4",children:a("skills.no_credentials_needed")}),h&&n.jsx("p",{className:"text-sm text-red-600 dark:text-red-400 mb-3",children:h}),!u&&C.length>0&&n.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-gray-200 dark:border-gray-700",children:[n.jsx("button",{onClick:A,disabled:f,className:"text-sm text-red-600 dark:text-red-400 hover:text-red-700 dark:hover:text-red-300 disabled:opacity-50",children:a("skills.clear_all")}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("button",{onClick:t,className:"px-3 py-1.5 text-sm text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg",children:a("skills.cancel")}),n.jsx("button",{onClick:E,disabled:f,className:"px-4 py-1.5 text-sm font-medium bg-primary-500 hover:bg-primary-600 text-white rounded-lg disabled:opacity-50 transition-colors",children:a(f?"skills.saving":"skills.save")})]})]})]})})}function J$({skill:e,installed:t,updateInfo:r,updatingSkill:a,onConfigure:i,onInstall:o,onUpdate:l,onUninstall:u,skillDefaultEnabled:d,onToggleDefault:f,t:p}){var h=V$(e.name),m=Object.prototype.hasOwnProperty.call(s4,e.name)?s4[e.name]:"#6B7280",[y,v]=x.useState(!1),k=a===e.name,_=r&&r.status==="available",w=x.useCallback(async function(){v(!0);try{await o(e)}finally{v(!1)}},[e,o]),N=x.useCallback(function(){l&&l(e.name)},[e.name,l]);return n.jsxs("div",{className:"group relative bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-xl p-4 hover:shadow-md dark:hover:shadow-gray-800/50 transition-all flex flex-col",children:[n.jsx("div",{className:"absolute top-0 left-4 right-4 h-0.5 rounded-full",style:{backgroundColor:m}}),n.jsxs("div",{className:"flex items-start gap-3 mt-1 flex-1",children:[n.jsx("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center flex-shrink-0",style:{backgroundColor:m+"15"},children:n.jsx(h,{className:"w-5 h-5",style:{color:m}})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[n.jsx("h3",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100 truncate",children:e.name}),n.jsx(Q$,{installed:t,configured:t&&e.allTokensConfigured,t:p}),t&&_&&n.jsxs("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400",children:[n.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"v",r.latestVersion]}),t&&r&&r.status==="current"&&n.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400",children:p("skills.up_to_date")}),t&&r&&r.status==="error"&&n.jsx("span",{title:r.error||"",className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-400",children:p("skills.update_check_failed")}),t&&r&&r.status==="unsupported"&&n.jsx("span",{title:r.error||"",className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-400",children:p("skills.update_unsupported")})]}),n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 line-clamp-2",children:e.description||p("skills.no_description")}),e.version&&n.jsxs("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:["v",e.version]})]})]}),n.jsx("div",{className:"mt-auto pt-3 flex items-center gap-2",children:t?n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:function(){i(e)},className:"flex-1 px-3 py-1.5 text-xs font-medium text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-lg transition-colors",children:p("skills.configure")}),f&&n.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:[n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:d?n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"}):n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),p("skills.default")]}),_&&n.jsx("button",{onClick:N,disabled:k,className:"px-3 py-1.5 text-xs font-medium text-white bg-primary-500 hover:bg-primary-600 rounded-lg transition-colors disabled:opacity-50",children:k?n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx("svg",{className:"w-3 h-3 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),p("skills.updating")]}):p("skills.update")}),u&&n.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:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]}):n.jsx("button",{onClick:w,disabled:y,className:"flex-1 px-3 py-1.5 text-xs font-medium text-white bg-primary-500 hover:bg-primary-600 rounded-lg transition-colors disabled:opacity-50",children:y?n.jsxs("span",{className:"flex items-center justify-center gap-1",children:[n.jsx("svg",{className:"w-3 h-3 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),p("skills.installing")]}):p("skills.install")})})]})}function eW({onBack:e}){var{t}=Jt(),[r,a]=x.useState([]),[i,o]=x.useState([]),[l,u]=x.useState(!0),[d,f]=x.useState(null),[p,h]=x.useState(null),[m,y]=x.useState("all"),[v,k]=x.useState(""),[_,w]=x.useState(!1),[N,E]=x.useState(Object.create(null)),[A,T]=x.useState(null),[C,j]=x.useState(!1),[M,L]=x.useState(Object.create(null)),I=iu(),B=x.useCallback(async function(){u(!0),f(null),j(!1);try{var W=await Promise.allSettled([Ev(),E3(),tT()]),G=W[0].status==="fulfilled"?W[0].value:[],oe=W[1].status==="fulfilled"?W[1].value:[],Q=W[2].status==="fulfilled"?W[2].value.skillDefaults||{}:{};a(G),o(oe),L(Q);var fe=[];W[0].status==="rejected"&&fe.push(t("skills.load_installed_failed",{error:W[0].reason.message})),W[1].status==="rejected"&&fe.push(t("skills.load_marketplace_failed",{error:W[1].reason.message})),fe.length>0&&f(fe.join("; "))}catch(ke){f(ke.message)}finally{u(!1)}},[t]);x.useEffect(function(){B()},[B]);var z=[],ee=new Set(r.map(function(W){return W.name}));r.forEach(function(W){z.push(Object.assign({},W,{_installed:!0}))}),i.forEach(function(W){ee.has(W.name)||z.push(Object.assign({},W,{_installed:!1,allTokensConfigured:!1}))});var V=z;if(m==="installed"?V=z.filter(function(W){return W._installed}):m==="available"&&(V=z.filter(function(W){return!W._installed})),v){var D=v.toLowerCase();V=V.filter(function(W){return W.name&&W.name.toLowerCase().indexOf(D)!==-1||W.description&&W.description.toLowerCase().indexOf(D)!==-1||W.category&&W.category.toLowerCase().indexOf(D)!==-1})}var K=x.useCallback(async function(W){try{await C3(W.name),B()}catch(G){f(t("skills.install_failed",{error:G.message}))}},[B,t]),H=x.useCallback(function(W){h(W)},[]),J=x.useCallback(async function(W){if(await I({title:t("skills.uninstall_title"),message:t("skills.uninstall_confirm",{skill:W.name}),destructive:!0,confirmLabel:t("skills.uninstall")}))try{await M3(W.name),B()}catch(G){f(t("skills.uninstall_failed",{error:G.message}))}},[B,I,t]),ne=x.useCallback(function(){h(null),B()},[B]),P=x.useCallback(async function(W,G){L(function(Q){var fe=Object.assign({},Q);return G?fe[W]=!0:delete fe[W],fe});try{var oe={};oe[W]=G,await L3(oe)}catch(Q){L(function(fe){var ke=Object.assign({},fe);return G?delete ke[W]:ke[W]=!0,ke}),f(Q.message)}},[]),U=x.useCallback(async function(){w(!0),f(null);try{var W=await R3();E(Y$(W.skills)),j(!0)}catch(G){f(G.message)}finally{w(!1)}},[]),X=x.useCallback(async function(W){T(W),f(null);try{var G=await T3(W);G.updated&&(E(function(oe){var Q=Object.assign(Object.create(null),oe);return Q[W]={status:"current",hasUpdate:!1,latestVersion:oe[W]?oe[W].latestVersion:null,currentVersion:oe[W]?oe[W].latestVersion:null,error:null},Q}),B())}catch(oe){f(t("skills.update_failed")+": "+oe.message)}finally{T(null)}},[B,t]),F=X$(N),Z=F.available;return n.jsxs("div",{className:"h-full flex flex-col bg-white dark:bg-gray-950 min-h-0",children:[n.jsxs("div",{className:"flex-shrink-0 flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-800",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{onClick:e,className:"p-1.5 rounded-lg text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors","aria-label":t("skills.back_to_chat"),children:n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18"})})}),n.jsxs("div",{children:[n.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:t("skills.skill_management")}),n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:t("skills.installed_count",{installed:r.length,available:i.filter(function(W){return!ee.has(W.name)}).length})})]})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{onClick:U,disabled:_||l,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-gray-600 dark:text-gray-300 bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-lg transition-colors disabled:opacity-50",children:_?n.jsxs(n.Fragment,{children:[n.jsx("svg",{className:"w-3.5 h-3.5 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),t("skills.checking_updates")]}):n.jsxs(n.Fragment,{children:[n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),t("skills.check_updates")]})}),Z>0&&n.jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400 rounded-full",children:t("skills.updates_available",{count:Z})}),C&&F.error>0&&!_&&n.jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-400 rounded-full",children:t("skills.update_check_failures",{count:F.error})}),C&&F.unsupported>0&&!_&&n.jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-400 rounded-full",children:t("skills.update_unsupported_count",{count:F.unsupported})}),C&&Z===0&&F.error===0&&F.unsupported===0&&!_&&n.jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 rounded-full",children:t("skills.no_updates")}),n.jsx("div",{className:"flex items-center gap-1 bg-gray-100 dark:bg-gray-800 rounded-lg p-0.5",children:["all","installed","available"].map(function(W){return n.jsx("button",{onClick:function(){y(W)},className:"px-3 py-1 text-xs font-medium rounded-md transition-colors "+(m===W?"bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 shadow-sm":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"),children:t("skills.tab_"+W)},W)})})]})]}),n.jsx("div",{className:"flex-shrink-0 px-6 py-3 border-b border-gray-100 dark:border-gray-800/50",children:n.jsxs("div",{className:"relative",children:[n.jsx("svg",{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),n.jsx("input",{type:"text",placeholder:t("skills.search_placeholder"),value:v,onChange:function(W){k(W.target.value)},className:"w-full pl-10 pr-4 py-2 text-sm bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-lg text-gray-900 dark:text-gray-100 placeholder-gray-400 outline-none focus:ring-2 focus:ring-primary-500/30 focus:border-primary-500"})]})}),n.jsxs("div",{className:"flex-1 overflow-y-auto overflow-x-hidden p-6 min-h-0",children:[l&&n.jsx("div",{className:"flex items-center justify-center py-12",children:n.jsx("div",{className:"w-8 h-8 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}),d&&n.jsx("div",{className:"mb-4 p-3 bg-red-50 dark:bg-red-900/20 rounded-lg border border-red-200 dark:border-red-800",children:n.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:d})}),!l&&V.length===0&&n.jsx("div",{className:"text-center py-12",children:n.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:t(v?"skills.no_match":"skills.no_skills")})}),!l&&V.length>0&&n.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:V.map(function(W){return n.jsx(J$,{skill:W,installed:W._installed,updateInfo:N[W.name],updatingSkill:A,onConfigure:H,onInstall:K,onUpdate:X,onUninstall:W._installed?J:null,skillDefaultEnabled:!!M[W.name],onToggleDefault:W._installed?P:null,t},W.name)})})]}),p&&n.jsx(Z$,{skill:p,onClose:function(){h(null)},onSaved:ne})]})}const Fr="";function Br(e,t={}){return fetch(e,{credentials:"include",...t})}async function tW(){const e=await Br(Fr+"/api/agents");if(!e.ok)throw new Error("Failed to fetch agents: "+e.statusText);return e.json()}async function rW(e){const t=await Br(Fr+"/api/agents/"+encodeURIComponent(e));if(!t.ok)throw new Error("Failed to fetch agent: "+t.statusText);return t.json()}async function mv(e){const t=await Br(Fr+"/api/agents/"+encodeURIComponent(e)+"/start",{method:"POST"});if(!t.ok){const r=await t.json().catch(()=>({}));throw new Error(r.error||"Failed to start agent")}return t.json()}async function xv(e){const t=await Br(Fr+"/api/agents/"+encodeURIComponent(e)+"/stop",{method:"POST"});if(!t.ok){const r=await t.json().catch(()=>({}));throw new Error(r.error||"Failed to stop agent")}return t.json()}async function pf(e,t){const r={};t&&t.clean&&(r.clean=!0);const a=await Br(Fr+"/api/agents/"+encodeURIComponent(e)+"/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!a.ok){const i=await a.json().catch(()=>({}));throw new Error(i.error||"Failed to restart agent")}return a.json()}async function yv(e,t){const r={};t&&t.level&&(r.level=t.level),t&&t.span&&(r.span=t.span);const a=await Br(Fr+"/api/agents/"+encodeURIComponent(e)+"/pause",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!a.ok){const i=await a.json().catch(()=>({}));throw new Error(i.error||"Failed to pause agent")}return a.json()}async function bv(e){const t=await Br(Fr+"/api/agents/"+encodeURIComponent(e)+"/unpause",{method:"POST"});if(!t.ok){const r=await t.json().catch(()=>({}));throw new Error(r.error||"Failed to unpause agent")}return t.json()}async function nW(e,t,r,a){const i={message:t,priority:r};a!=null&&(i.replyToInbox=a);const o=await Br(Fr+"/api/agents/"+encodeURIComponent(e)+"/inbox",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!o.ok){const l=await o.json().catch(()=>({}));throw new Error(l.error||"Failed to send message to agent")}return o.json()}async function aW(e,t,r){const a={message:t};r!=null&&(a.replyToInbox=r);const i=await Br(Fr+"/api/agents/"+encodeURIComponent(e)+"/interrupt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!i.ok){const o=await i.json().catch(()=>({}));throw new Error(o.error||"Failed to send urgent interrupt to agent")}return i.json()}async function iW(e,t){let r=Fr+"/api/agents/"+encodeURIComponent(e)+"/messages";t&&t.refresh&&(r+="?refresh=true");const a=await Br(r);if(!a.ok)throw new Error("Failed to fetch agent messages: "+a.statusText);return a.json()}async function sW(){const e=await Br(Fr+"/api/pricing");if(!e.ok)throw new Error("Failed to fetch pricing: "+e.statusText);return e.json()}async function oW(e){const t=await Br(Fr+"/api/pricing",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const r=await t.json().catch(()=>({}));throw new Error(r.error||"Failed to update pricing")}return t.json()}async function lW(){const e=await Br(Fr+"/api/pricing/reset",{method:"POST"});if(!e.ok){const t=await e.json().catch(()=>({}));throw new Error(t.error||"Failed to reset pricing")}return e.json()}async function cW(e,t=!1){const r=Fr+"/api/agents/"+encodeURIComponent(e)+(t?"?force=true":""),a=await Br(r,{method:"DELETE"});if(!a.ok){const i=await a.json().catch(()=>({}));throw new Error(i.error||"Failed to delete agent")}return a.json()}async function uW(e){const t=await Br(Fr+"/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const r=await t.json().catch(()=>({}));throw new Error(r.error||"Failed to create agent")}return t.json()}async function yA(){const e=await Br(Fr+"/api/skills");if(!e.ok)throw new Error("Failed to fetch skills: "+e.statusText);return e.json()}async function Ck(){const e=await Br(Fr+"/api/models");if(!e.ok)throw new Error("Failed to fetch models: "+e.statusText);return e.json()}async function dW(e,t){const r=await Br(Fr+"/api/agents/"+encodeURIComponent(e),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!r.ok){const a=await r.json().catch(()=>({}));throw new Error(a.error||"Failed to update agent")}return r.json()}async function fW(e){const t=await Br(Fr+"/api/agents/"+encodeURIComponent(e)+"/agents-md");if(!t.ok){const r=await t.json().catch(()=>({}));throw new Error(r.error||"Failed to fetch AGENTS.md")}return t.json()}async function pW(e,t){const r=await Br(Fr+"/api/agents/"+encodeURIComponent(e)+"/agents-md",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:t})});if(!r.ok){const a=await r.json().catch(()=>({}));throw new Error(a.error||"Failed to update AGENTS.md")}return r.json()}async function bA(e){const t=await Br(Fr+"/api/agents/"+encodeURIComponent(e)+"/export");if(!t.ok){const u=await t.json().catch(()=>({}));throw new Error(u.error||"Failed to export agent")}const r=await t.text(),a=new Blob([r],{type:"text/yaml"}),i=URL.createObjectURL(a),o=t.headers.get("X-Filename")||e+".agent.yaml",l=document.createElement("a");l.href=i,l.download=o,document.body.appendChild(l),l.click(),document.body.removeChild(l),setTimeout(()=>URL.revokeObjectURL(i),5e3)}async function gW(e,t){const r=new URLSearchParams,a=r.toString()?"?"+r.toString():"",i=await Br(Fr+"/api/agents/import"+a,{method:"POST",headers:{"Content-Type":"text/yaml"},body:e});if(!i.ok){const o=await i.json().catch(()=>({}));throw new Error(o.error||"Failed to import agent")}return i.json()}async function jb(){const e=await Br(Fr+"/api/system/updates");if(!e.ok){const t="Failed to check for updates",r=await e.json().catch(()=>({})),a=r.error||r.message||r.output||e.statusText;throw a?a.indexOf(t)===0||a===t?new Error(a):new Error(t+": "+a):new Error(t)}return e.json()}async function hW(){const e=await Br(Fr+"/api/system/update-config");if(!e.ok)throw new Error("Failed to get update config");return e.json()}async function mW(){const e=await Br(Fr+"/api/system/update",{method:"POST"});if(!e.ok){const r="Failed to perform update",a=await e.json().catch(()=>({})),i=a.error||a.message||a.output||e.statusText;throw i?i.indexOf(r)===0||i===r?new Error(i):new Error(r+": "+i):new Error(r)}const t=await e.json();if(t.status!=="success"){let r=t.error||t.message||"";throw t.output&&!t.error&&!t.message?r="Update returned status: "+(t.status||"failed")+(t.output?": "+t.output:""):t.output&&(r+=t.output?" ("+t.output+")":""),r||(r="Update returned unexpected status: "+(t.status||"unknown")),new Error(r)}return t}async function o4(){const e=await Br(Fr+"/api/models/registry");if(!e.ok)throw new Error("Failed to fetch model registry: "+e.statusText);return e.json()}async function l4(e,t){const r=await Br(Fr+"/api/models/registry",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...t})});if(!r.ok){const a=await r.json().catch(()=>({}));throw new Error(a.error||"Failed to save model: "+r.statusText)}return r.json()}async function c4(e){const t=await Br(Fr+"/api/models/registry/"+encodeURIComponent(e),{method:"DELETE"});if(!t.ok){const r=await t.json().catch(()=>({}));throw new Error(r.error||"Failed to delete model: "+t.statusText)}return t.json()}function vA(e){const t=typeof e=="string"?e.split("-"):null;if(t&&t.length===3){const r=Number(t[0]),a=Number(t[1]),i=Number(t[2]);if(!Number.isNaN(r)&&!Number.isNaN(a)&&!Number.isNaN(i))return new Date(r,a-1,i)}return new Date(e)}function xW(e){const t=vA(e),r=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],a=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return r[t.getDay()]+", "+a[t.getMonth()]+" "+t.getDate()}function Bd(e){return e>=1e6?(e/1e6).toFixed(1)+"M":e>=1e3?(e/1e3).toFixed(1)+"K":e.toString()}function yW({data:e}){if(!e||e.length===0)return n.jsx("div",{className:"h-32 flex items-center justify-center text-sm text-gray-400 dark:text-gray-500",children:"No usage data available"});const t=280,r=120,a={top:10,right:10,bottom:25,left:40},i=t-a.left-a.right,o=r-a.top-a.bottom,l=Math.max(...e.map(m=>(m.input||0)+(m.output||0)+(m.cached||0)),1),u=i/e.length,d=Math.max(8,u*.6),f=(u-d)/2,p=m=>o-m/l*o,h=[0,.25,.5,.75,1].map(m=>Math.round(l*m));return n.jsxs("div",{className:"relative",children:[n.jsxs("svg",{width:"100%",height:r,viewBox:`0 0 ${t} ${r}`,className:"overflow-visible",children:[h.map((m,y)=>{const v=a.top+p(m);return n.jsxs("g",{children:[n.jsx("line",{x1:a.left,y1:v,x2:t-a.right,y2:v,stroke:"currentColor",strokeOpacity:.1,className:"text-gray-400 dark:text-gray-600"}),n.jsx("text",{x:a.left-5,y:v,textAnchor:"end",dominantBaseline:"middle",className:"text-[9px] fill-gray-400 dark:fill-gray-500",children:Bd(m)})]},y)}),e.map((m,y)=>{const v=a.left+y*u+f,k=m.input||0,_=m.output||0,w=m.cached||0,N=k/l*o,E=_/l*o,A=w/l*o,T=a.top+o-N,C=T-E,j=C-A,M=vA(m.date),L=["S","M","T","W","T","F","S"][M.getDay()];return n.jsxs("g",{className:"group",children:[n.jsx("rect",{x:v-f,y:a.top,width:u,height:o,fill:"transparent",className:"cursor-pointer"}),k>0&&n.jsx("rect",{x:v,y:T,width:d,height:N,rx:2,className:"fill-blue-500 dark:fill-blue-400 transition-opacity group-hover:opacity-80"}),_>0&&n.jsx("rect",{x:v,y:C,width:d,height:E,rx:2,className:"fill-green-500 dark:fill-green-400 transition-opacity group-hover:opacity-80"}),w>0&&n.jsx("rect",{x:v,y:j,width:d,height:A,rx:2,className:"fill-purple-500 dark:fill-purple-400 transition-opacity group-hover:opacity-80"}),n.jsx("text",{x:v+d/2,y:r-5,textAnchor:"middle",className:"text-[9px] fill-gray-400 dark:fill-gray-500",children:L}),n.jsxs("g",{className:"opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",children:[n.jsx("rect",{x:v+d/2-45,y:Math.min(j,C,T)-50,width:90,height:45,rx:4,className:"fill-gray-900 dark:fill-gray-100"}),n.jsx("text",{x:v+d/2,y:Math.min(j,C,T)-38,textAnchor:"middle",className:"text-[9px] fill-white dark:fill-gray-900 font-medium",children:xW(m.date)}),n.jsxs("text",{x:v+d/2,y:Math.min(j,C,T)-26,textAnchor:"middle",className:"text-[8px] fill-blue-300 dark:fill-blue-600",children:["In: ",Bd(k)]}),n.jsxs("text",{x:v+d/2,y:Math.min(j,C,T)-16,textAnchor:"middle",className:"text-[8px] fill-green-300 dark:fill-green-600",children:["Out: ",Bd(_)]}),n.jsxs("text",{x:v+d/2,y:Math.min(j,C,T)-6,textAnchor:"middle",className:"text-[8px] fill-purple-300 dark:fill-purple-600",children:["Cache: ",Bd(w)]})]})]},y)})]}),n.jsxs("div",{className:"flex items-center justify-center gap-4 mt-2 text-xs",children:[n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("div",{className:"w-2 h-2 rounded-sm bg-blue-500 dark:bg-blue-400"}),n.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Input"})]}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("div",{className:"w-2 h-2 rounded-sm bg-green-500 dark:bg-green-400"}),n.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Output"})]}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("div",{className:"w-2 h-2 rounded-sm bg-purple-500 dark:bg-purple-400"}),n.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Cached"})]})]})]})}function bW({agentName:e,onClose:t,onToolPartsChange:r,hackerMode:a}){var{t:i}=Jt(),[o,l]=x.useState([]),[u,d]=x.useState(!0),[f,p]=x.useState(null),[h,m]=x.useState(!1),[y,v]=x.useState(""),[k,_]=x.useState(!0),[w,N]=x.useState(!1),[E,A]=x.useState(!1),[T,C]=x.useState(!1),[j,M]=x.useState(!1),L=x.useRef(null),I=x.useRef(null),B=x.useRef(!0),z=x.useRef([]),ee=x.useRef(null),V=x.useRef(null),D=x.useRef(null),K=x.useRef(null);x.useEffect(function(){z.current=o},[o]);var H=x.useCallback(async function(G,oe){if(e){oe!==!1&&d(!0);try{var Q=await iW(e,{refresh:!!G}),fe=Q.messages||[],ke=z.current,Fe=fe.length!==ke.length;if(!Fe&&fe.length>0&&ke.length>0){var Ve=fe[fe.length-1],Ge=ke[ke.length-1];if(Ve.info.id!==Ge.info.id&&(Fe=!0),!Fe){var qe=Ve.parts||[],Ce=Ge.parts||[];if(qe.length!==Ce.length)Fe=!0;else for(var He=0;He<qe.length&&!Fe;He++){var ze=qe[He]||{},gt=Ce[He]||{},mt=ze.state?ze.state.status:ze.status,wt=gt.state?gt.state.status:gt.status;(ze.id!==gt.id||mt!==wt)&&(Fe=!0)}}}Fe&&l(fe.slice()),p(null)}catch($e){console.error("Failed to load messages:",$e),p($e.message)}finally{oe!==!1&&d(!1)}}},[e]);x.useEffect(function(){H(!0);var G=setInterval(function(){H(!0,!1)},5e3);return function(){clearInterval(G),V.current&&clearTimeout(V.current),K.current&&clearTimeout(K.current)}},[H]),x.useEffect(function(){B.current&&L.current&&L.current.scrollIntoView({behavior:"smooth"})},[o]);var J=x.useCallback(function(){var G=I.current;G&&(B.current=G.scrollHeight-G.scrollTop-G.clientHeight<50)},[]),ne=x.useMemo(function(){for(var G=null,oe=o.length-1;oe>=0;oe--)if(o[oe].info&&o[oe].info.role==="assistant"){G=o[oe];break}return G?(G.parts||[]).filter(function(Q){return Q.type==="tool"}):[]},[o]);x.useEffect(function(){r&&r(ne)},[ne,r]);var P=x.useCallback(async function(){if(!(!y.trim()||w)){N(!0),A(!1),C(!1),M(!1),p(null);try{await nW(e,y.trim(),"normal",k),v(""),A(!0),V.current&&clearTimeout(V.current),V.current=setTimeout(function(){A(!1),m(!1),V.current=null},1500),K.current&&clearTimeout(K.current),K.current=setTimeout(function(){H(!0,!1),K.current=null},500)}catch(G){p(G.message)}finally{N(!1)}}},[e,y,k,w,H]),U=x.useCallback(async function(){if(!(!y.trim()||w)){if(!j){M(!0);return}N(!0),A(!1),C(!0),M(!1),p(null);try{await aW(e,y.trim(),k),v(""),A(!0),V.current&&clearTimeout(V.current),V.current=setTimeout(function(){A(!1),m(!1),V.current=null},1500),K.current&&clearTimeout(K.current),K.current=setTimeout(function(){H(!0,!1),K.current=null},500)}catch(G){p(G.message)}finally{N(!1)}}},[e,y,w,j,k,H]),X=x.useCallback(function(){m(!1),M(!1),p(null),V.current&&(clearTimeout(V.current),V.current=null),K.current&&(clearTimeout(K.current),K.current=null),A(!1)},[]);x.useEffect(function(){if(!h)return;function G(oe){oe.key==="Escape"&&!w&&X()}return document.addEventListener("keydown",G),function(){document.removeEventListener("keydown",G)}},[h,X,w]),x.useEffect(function(){if(!(!h||!D.current)){var G=D.current;G.contains(document.activeElement)||G.focus()}},[h]);var F=x.useCallback(function(G){G.target===G.currentTarget&&!w&&X()},[X,w]),Z=x.useCallback(function(G){G.key==="Enter"&&!G.shiftKey&&!j&&(G.preventDefault(),P())},[P,j]),W=x.useCallback(function(){},[]);return n.jsxs("div",{className:"h-full flex flex-col bg-white dark:bg-gray-900 relative",children:[n.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-800",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{onClick:t,className:"p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500 dark:text-gray-400 transition-colors",title:i("agents.back"),children:n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})})}),n.jsxs("div",{children:[n.jsx("h2",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:"Conversation"}),n.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:[e," - ",o.length," messages"]})]})]}),n.jsx("button",{onClick:function(){B.current=!0,H(!0),L.current&&L.current.scrollIntoView({behavior:"smooth"})},disabled:u,className:"p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-400 transition-colors disabled:opacity-50",title:i("agents.refresh"),children:n.jsx("svg",{className:`w-4 h-4 ${u?"animate-spin":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})})]}),f&&n.jsxs("div",{className:"mx-4 mt-3 px-4 py-2 bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 text-sm rounded-lg flex items-center justify-between",children:[n.jsx("span",{children:f}),n.jsx("button",{onClick:function(){p(null)},className:"ml-2 text-red-400 hover:text-red-600",children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),E&&n.jsxs("div",{className:`mx-4 mt-3 px-4 py-2 text-sm rounded-lg flex items-center gap-2 ${T?"bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400":"bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400"}`,children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:T?n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"}):n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),i(T?"agent_conversation.interrupt_sent":"agent_conversation.message_queued")]}),n.jsx("div",{ref:I,onScroll:J,className:"flex-1 overflow-y-auto px-4 py-4",children:u&&o.length===0?n.jsx("div",{className:"flex items-center justify-center h-32",children:n.jsx("div",{className:"w-6 h-6 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}):o.length===0?n.jsxs("div",{className:"flex flex-col items-center justify-center h-32 text-center",children:[n.jsx("div",{className:"w-12 h-12 rounded-xl bg-gray-100 dark:bg-gray-800 flex items-center justify-center mb-3",children:n.jsx("svg",{className:"w-6 h-6 text-gray-400 dark:text-gray-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})})}),n.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:i("agent_conversation.no_messages")}),n.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-1",children:i("agent_conversation.no_messages_hint")})]}):n.jsxs("div",{className:"max-w-3xl mx-auto space-y-6",children:[o.map(function(G){return n.jsx(cR,{message:G.info,parts:G.parts,streamingParts:null,searchQuery:null,matchOffset:-1,matchCount:0,activeMatchIndex:-1,registerMatchRef:W,hackerMode:a,hideThinking:!1},G.info.id)}),n.jsx("div",{ref:L})]})}),n.jsx("div",{className:"absolute bottom-6 right-6",children:n.jsxs("button",{onClick:function(){m(!0),M(!1),p(null)},className:"px-4 py-2.5 bg-primary-500 hover:bg-primary-600 text-white rounded-full shadow-lg font-medium text-sm transition-colors flex items-center gap-2","aria-label":i("agent_conversation.compose_button"),children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})}),i("agent_conversation.compose_button")]})}),h&&n.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/40 backdrop-blur-sm",onClick:F,children:n.jsxs("div",{ref:D,tabIndex:-1,role:"dialog","aria-modal":"true","aria-labelledby":"compose-modal-title",className:"bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-700 shadow-xl w-full max-w-lg mx-4 max-h-[80vh] flex flex-col",children:[n.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-gray-200 dark:border-gray-700 flex-shrink-0",children:[n.jsx("h3",{id:"compose-modal-title",className:"text-base font-semibold text-gray-900 dark:text-white",children:i("agent_conversation.modal_title",{name:e})}),n.jsx("button",{onClick:X,disabled:w,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors"+(w?" opacity-50 cursor-not-allowed":""),"aria-label":i("common.close"),children:n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),n.jsxs("div",{className:"px-5 py-4 space-y-4 overflow-y-auto flex-1 min-h-0",children:[n.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[n.jsx("input",{type:"checkbox",checked:k,onChange:function(G){_(G.target.checked)},className:"w-4 h-4 rounded border-gray-300 dark:border-gray-600 text-primary-600 focus:ring-primary-500"}),n.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:i("agent_conversation.reply_to_inbox")})]}),n.jsx("textarea",{ref:ee,value:y,onChange:function(G){v(G.target.value)},onKeyDown:Z,placeholder:i("agent_conversation.send_placeholder"),className:"w-full px-4 py-3 bg-gray-50 dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 outline-none resize-none text-sm text-gray-900 dark:text-gray-100 placeholder-gray-400 dark:placeholder-gray-500 focus:ring-2 focus:ring-primary-500 dark:focus:ring-primary-400 focus:border-transparent",rows:4,disabled:w,autoFocus:!0}),E&&n.jsx("p",{className:"text-sm text-green-600 dark:text-green-400 font-medium",children:i(T?"agent_conversation.interrupt_sent":"agent_conversation.message_queued")}),f&&n.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:f})]}),n.jsx("div",{className:"px-5 py-4 border-t border-gray-200 dark:border-gray-700 flex-shrink-0",children:j?n.jsxs("div",{className:"space-y-2",children:[n.jsx("p",{className:"text-xs text-red-500 dark:text-red-400 font-medium",children:i("agent_conversation.urgent_warning")}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("button",{onClick:function(){M(!1)},className:"px-3 py-1.5 text-xs text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 transition-colors",children:i("common.cancel")}),n.jsxs("button",{onClick:U,disabled:!y.trim()||w,className:"px-3 py-1.5 bg-red-500 hover:bg-red-600 text-white rounded-lg disabled:opacity-50 disabled:cursor-not-allowed text-xs font-medium transition-colors flex items-center gap-1.5",children:[w&&T?n.jsx("div",{className:"w-3 h-3 border-2 border-white border-t-transparent rounded-full animate-spin"}):n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})}),i("agent_conversation.confirm_interrupt")]})]})]}):n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("button",{onClick:U,disabled:!y.trim()||w,className:"px-3 py-1.5 text-xs text-red-500 dark:text-red-400 hover:text-red-600 dark:hover:text-red-300 disabled:opacity-50 disabled:cursor-not-allowed transition-colors flex items-center gap-1.5",children:[n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})}),i("agent_conversation.urgent_interrupt_button")]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{onClick:X,disabled:w,className:"px-4 py-2 text-sm transition-colors"+(w?" text-gray-400 dark:text-gray-600 cursor-not-allowed":" text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200"),children:i("common.cancel")}),n.jsxs("button",{onClick:P,disabled:!y.trim()||w,className:"px-4 py-2 bg-primary-500 hover:bg-primary-600 text-white rounded-lg disabled:opacity-50 disabled:cursor-not-allowed font-medium text-sm transition-colors flex items-center gap-2",children:[w&&!T?n.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}):n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 19l9 2-9-18-9 18 9-2zm0 0v-8"})}),i("agent_conversation.send_button")]})]})]})})]})})]})}function vW({isOpen:e,agent:t,onClose:r,onUpdated:a,onDeleted:i}){const{t:o}=Jt(),[l,u]=x.useState(""),[d,f]=x.useState(""),[p,h]=x.useState(""),[m,y]=x.useState(""),[v,k]=x.useState(!1),[_,w]=x.useState([]),[N,E]=x.useState(!1),[A,T]=x.useState(""),[C,j]=x.useState(null),[M,L]=x.useState(!1),[I,B]=x.useState([]),[z,ee]=x.useState([]),[V,D]=x.useState(!1),[K,H]=x.useState(!0),[J,ne]=x.useState(!1),[P,U]=x.useState(!1),[X,F]=x.useState(null),[Z,W]=x.useState(!1),[G,oe]=x.useState(!1),[Q,fe]=x.useState("general"),[ke,Fe]=x.useState(!1);x.useEffect(()=>{const $e={cancelled:!1};if(e&&t&&!ke){Ve();const Et=(typeof t.model=="string"?t.model.trim():t.model)||"github-copilot/claude-opus-4.6";Ge($e,Et),Fe(!0)}return e||(Fe(!1),k(!1),y(""),H(!0),ee([])),()=>{$e.cancelled=!0}},[e,t==null?void 0:t.name]);const Ve=()=>{if(!t)return;u(t.displayName||t.name||""),f(t.cwd||"");const $e=(typeof t.model=="string"?t.model.trim():t.model)||"github-copilot/claude-opus-4.6";h($e),k(!1),y(""),w(Array.isArray(t.skills)?t.skills:[]),E(!!t.skipInitialPrompt)},Ge=async($e,Et)=>{D(!0),H(!0),t!=null&&t.name&&ne(!0);const Ze=[yA(),Ck()];t!=null&&t.name&&Ze.push(fW(t.name));const Oe=await Promise.allSettled(Ze);if($e.cancelled)return;const[it,me,Ee]=Oe;if(it.status==="fulfilled"?B(it.value):(console.error("Failed to load skills:",it.reason),B([])),D(!1),me.status==="fulfilled"){const ge=me.value;ee(ge);const je=Et;ge.find(se=>se.id===je)||(k(!0),y(je),h(je))}else console.error("Failed to load models:",me.reason),ee([]);if(H(!1),t!=null&&t.name&&Ee){if(Ee.status==="fulfilled"){const ge=Ee.value;T(ge.content||""),j(ge.path||null),L(ge.exists||!1)}else console.error("Failed to load AGENTS.md:",Ee.reason),T(""),j(null),L(!1);ne(!1)}},qe=$e=>{w(Et=>Et.includes($e)?Et.filter(Ze=>Ze!==$e):[...Et,$e])},Ce=()=>{_.length===I.length?w([]):w(I.map($e=>$e.name))},He=async $e=>{if($e&&$e.preventDefault(),!!(t!=null&&t.name)){F(null),U(!0);try{await dW(t.name,{displayName:l.trim()||t.name,workspace:d.trim(),model:p,skipInitialPrompt:N,skills:_}),C&&A!==null&&!wt&&await pW(t.name,A),a&&a(t.name),r()}catch(Et){F(Et.message)}finally{U(!1)}}},ze=async()=>{if(t!=null&&t.name){oe(!0),F(null);try{await cW(t.name,!0),i&&i(t.name),r()}catch($e){F($e.message),W(!1)}finally{oe(!1)}}},gt=()=>{!P&&!G&&(F(null),W(!1),fe("general"),r())};if(!e||!t)return null;const mt=t.state==="working"||t.state==="idle"||t.state==="starting",wt=d.trim()!==(t.cwd||"");return n.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[n.jsx("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:gt}),Z&&n.jsxs("div",{className:"fixed inset-0 z-[60] flex items-center justify-center p-4",children:[n.jsx("div",{className:"absolute inset-0 bg-black/30",onClick:()=>W(!1)}),n.jsxs("div",{className:"relative bg-white dark:bg-gray-900 rounded-xl shadow-2xl max-w-md w-full p-6",children:[n.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 mb-2",children:"Delete Agent?"}),n.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-4",children:["Are you sure you want to delete ",n.jsx("strong",{children:t.displayName||t.name}),"?",mt&&n.jsx("span",{className:"block mt-2 text-yellow-600 dark:text-yellow-400",children:"Warning: This agent is currently running and will be stopped."})]}),n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-500 mb-4",children:"This will remove the agent registration. The workspace directory will not be deleted."}),n.jsxs("div",{className:"flex justify-end gap-3",children:[n.jsx("button",{onClick:()=>W(!1),disabled:G,className:"px-4 py-2 rounded-lg text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors disabled:opacity-50",children:o("common.cancel")}),n.jsx("button",{onClick:ze,disabled:G,className:"px-4 py-2 rounded-lg bg-red-600 hover:bg-red-700 text-white font-medium transition-colors disabled:opacity-50 flex items-center gap-2",children:G?n.jsxs(n.Fragment,{children:[n.jsxs("svg",{className:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[n.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),n.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),o("common.deleting")]}):o("common.delete")})]})]})]}),n.jsxs("div",{className:"relative bg-white dark:bg-gray-900 rounded-2xl shadow-2xl max-w-2xl w-full max-h-[90vh] overflow-hidden flex flex-col",children:[n.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-800",children:[n.jsxs("div",{children:[n.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:o("agent_edit.title")}),n.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:[t.name,mt&&n.jsxs("span",{className:"ml-2 text-yellow-600 dark:text-yellow-400",children:["(",o("agent_edit.running_warning"),")"]})]})]}),n.jsx("button",{onClick:gt,disabled:P||G,className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-400 transition-colors disabled:opacity-50",children:n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),n.jsxs("div",{className:"flex border-b border-gray-200 dark:border-gray-800 px-6",children:[n.jsx("button",{onClick:()=>fe("general"),className:`px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors ${Q==="general"?"border-primary-500 text-primary-600 dark:text-primary-400":"border-transparent text-gray-500 hover:text-gray-700 dark:hover:text-gray-300"}`,children:o("agent_edit.tab_general")}),n.jsx("button",{onClick:()=>fe("soul"),className:`px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors ${Q==="soul"?"border-primary-500 text-primary-600 dark:text-primary-400":"border-transparent text-gray-500 hover:text-gray-700 dark:hover:text-gray-300"}`,children:o("agent_edit.tab_soul")})]}),n.jsxs("form",{onSubmit:$e=>$e.preventDefault(),className:"flex-1 overflow-y-auto p-6 space-y-6",children:[X&&n.jsxs("div",{className:"px-4 py-3 bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 text-sm rounded-lg flex items-center justify-between",children:[n.jsx("span",{children:X}),n.jsx("button",{type:"button",onClick:()=>F(null),className:"ml-2 text-red-400 hover:text-red-600",children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),Q==="general"&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{children:[n.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[o("agent_edit.name_label"),n.jsx("span",{className:"text-gray-400 font-normal ml-1",children:o("agent_edit.cannot_change")})]}),n.jsx("input",{type:"text",value:t.name,disabled:!0,className:"w-full px-4 py-2 rounded-lg bg-gray-100 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-500 dark:text-gray-400 cursor-not-allowed font-mono"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:o("agent_edit.display_name_label")}),n.jsx("input",{type:"text",value:l,onChange:$e=>u($e.target.value),placeholder:o("agent_edit.display_name_placeholder"),className:"w-full px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:o("agent_edit.working_dir_label")}),mt?n.jsx("div",{className:"px-4 py-2 rounded-lg bg-gray-100 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-500 dark:text-gray-400 font-mono text-sm break-all",children:d||o("agent_edit.not_set")}):n.jsx("input",{type:"text",value:d,onChange:$e=>f($e.target.value),placeholder:o("agent_edit.working_dir_placeholder"),disabled:P||G,className:"w-full px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500 font-mono text-sm disabled:opacity-50"}),mt?n.jsx("p",{className:"mt-1 text-xs text-gray-400",children:o("agent_edit.stop_to_change")}):d.trim()!==(t.cwd||"")?n.jsx("p",{className:"mt-1 text-xs text-amber-500 dark:text-amber-400",children:o("agent_edit.workspace_move_warning")}):n.jsx("p",{className:"mt-1 text-xs text-gray-400",children:o("agent_edit.working_dir_hint")})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:o("agent_edit.model_label")}),K?n.jsx("div",{className:"w-full px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-400 text-sm",children:o("agent_edit.loading_models")}):z.length===0?n.jsx("input",{type:"text",value:p,onChange:$e=>h($e.target.value),placeholder:o("agent_edit.model_placeholder"),className:"w-full px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500 font-mono text-sm"}):n.jsxs(n.Fragment,{children:[n.jsxs("select",{value:v?"__custom__":p,onChange:$e=>{$e.target.value==="__custom__"?(k(!0),p&&p!=="__custom__"&&y(p)):(k(!1),h($e.target.value))},className:"w-full px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-primary-500",children:[(()=>{const $e=jk(z);return Object.entries($e).map(([Et,Ze])=>n.jsx("optgroup",{label:Nk[Et]||Et,children:Ze.map(Oe=>n.jsxs("option",{value:Oe.id,children:[Oe.name,Ek(Oe.tier)]},Oe.id))},Et))})(),n.jsx("option",{value:"__custom__",children:o("agent_edit.custom_model")})]}),v&&n.jsx("input",{type:"text",value:m,onChange:$e=>{y($e.target.value),h($e.target.value)},placeholder:o("agent_edit.custom_model_placeholder"),className:"w-full mt-2 px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500 font-mono text-sm"})]}),n.jsx("p",{className:"mt-1 text-xs text-gray-400",children:o(v?"agent_edit.custom_model_hint":"agent_edit.model_hint")})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:o("agent_edit.start_mode")}),n.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[n.jsx("input",{type:"checkbox",checked:N,onChange:$e=>E($e.target.checked),className:"mt-0.5 rounded border-gray-300 dark:border-gray-600 text-primary-600 focus:ring-primary-500"}),n.jsxs("div",{children:[n.jsx("span",{className:"text-sm text-gray-900 dark:text-gray-100",children:o("agent_edit.dormant_mode")}),n.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:o("agent_edit.dormant_mode_desc")})]})]})]}),n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:o("agent_edit.skills_label")}),n.jsx("button",{type:"button",onClick:Ce,className:"text-xs text-primary-600 dark:text-primary-400 hover:underline",children:_.length===I.length?o("agent_edit.deselect_all"):o("agent_edit.select_all")})]}),n.jsx("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-3 max-h-48 overflow-y-auto bg-gray-50 dark:bg-gray-800",children:V?n.jsx("div",{className:"text-center py-4 text-gray-500",children:o("agent_edit.loading_skills")}):I.length===0?n.jsx("div",{className:"text-center py-4 text-gray-500",children:o("agent_edit.no_skills")}):n.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-2",children:I.map($e=>n.jsxs("label",{className:`flex items-center gap-2 px-3 py-2 rounded-lg cursor-pointer transition-colors ${_.includes($e.name)?"bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-300":"hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300"}`,children:[n.jsx("input",{type:"checkbox",checked:_.includes($e.name),onChange:()=>qe($e.name),className:"rounded border-gray-300 text-primary-600 focus:ring-primary-500"}),n.jsxs("span",{className:"text-sm truncate",title:$e.description,children:[$e.icon&&n.jsx("span",{className:"mr-1",children:$e.icon}),$e.name]})]},$e.name))})}),n.jsx("p",{className:"mt-1 text-xs text-gray-400",children:o("agent_edit.skills_selected",{count:_.length})})]})]}),Q==="soul"&&n.jsxs("div",{className:"space-y-4",children:[C&&n.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 font-mono bg-gray-50 dark:bg-gray-800 rounded px-3 py-2",children:[C,!M&&n.jsx("span",{className:"ml-2 text-yellow-600 dark:text-yellow-400",children:o("agent_edit.will_be_created")})]}),!C&&!d.trim()&&n.jsx("div",{className:"px-4 py-3 bg-yellow-50 dark:bg-yellow-900/20 text-yellow-700 dark:text-yellow-400 text-sm rounded-lg",children:o("agent_edit.no_workspace_warning")}),wt&&n.jsx("div",{className:"px-4 py-3 bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-400 text-sm rounded-lg",children:o("agent_edit.workspace_changed_warning")}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:o("agent_edit.instructions_label")}),n.jsx("textarea",{value:A,onChange:$e=>T($e.target.value),disabled:!C||wt,rows:16,placeholder:o(J?"common.loading":"agent_edit.soul_placeholder"),className:"w-full px-4 py-3 rounded-lg bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500 font-mono text-sm resize-none disabled:cursor-not-allowed disabled:opacity-50"}),n.jsx("p",{className:"mt-1 text-xs text-gray-400",children:o("agent_edit.instructions_hint")})]})]})]}),n.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-t border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900",children:[n.jsxs("button",{type:"button",onClick:()=>W(!0),disabled:P||G,className:"px-4 py-2 rounded-lg text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 transition-colors disabled:opacity-50 flex items-center gap-2",children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),o("common.delete")]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{type:"button",onClick:gt,disabled:P||G,className:"px-4 py-2 rounded-lg text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors disabled:opacity-50",children:o("common.cancel")}),n.jsx("button",{type:"button",onClick:He,disabled:P||G,className:"px-6 py-2 rounded-lg bg-primary-600 hover:bg-primary-700 text-white font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:P?n.jsxs(n.Fragment,{children:[n.jsxs("svg",{className:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[n.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),n.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),o("agent_edit.saving")]}):n.jsxs(n.Fragment,{children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),o("agent_edit.save")]})})]})]})]})]})}const u4={working:"bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400",idle:"bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-400",paused:"bg-orange-100 dark:bg-orange-900/30 text-orange-700 dark:text-orange-400",stopped:"bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400",crashed:"bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-400",error:"bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-400",starting:"bg-yellow-100 dark:bg-yellow-900/30 text-yellow-700 dark:text-yellow-400"},d4={working:n.jsx("svg",{className:"w-4 h-4 mr-1.5",fill:"currentColor",viewBox:"0 0 20 20",children:n.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})}),idle:n.jsx("svg",{className:"w-4 h-4 mr-1.5",fill:"currentColor",viewBox:"0 0 20 20",children:n.jsx("path",{d:"M17.293 13.293A8 8 0 016.707 2.707a8.001 8.001 0 1010.586 10.586z"})}),paused:n.jsx("svg",{className:"w-4 h-4 mr-1.5",fill:"currentColor",viewBox:"0 0 20 20",children:n.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zM7 8a1 1 0 012 0v4a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v4a1 1 0 102 0V8a1 1 0 00-1-1z",clipRule:"evenodd"})}),stopped:n.jsx("svg",{className:"w-4 h-4 mr-1.5",fill:"currentColor",viewBox:"0 0 20 20",children:n.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8 7a1 1 0 00-1 1v4a1 1 0 001 1h4a1 1 0 001-1V8a1 1 0 00-1-1H8z",clipRule:"evenodd"})}),crashed:n.jsx("svg",{className:"w-4 h-4 mr-1.5",fill:"currentColor",viewBox:"0 0 20 20",children:n.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),error:n.jsx("svg",{className:"w-4 h-4 mr-1.5",fill:"currentColor",viewBox:"0 0 20 20",children:n.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),starting:n.jsx("svg",{className:"w-4 h-4 mr-1.5 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})};function kW({state:e}){const t=u4[e]||u4.stopped,r=d4[e]||d4.stopped;return n.jsxs("span",{className:`inline-flex items-center px-3 py-1 rounded-full text-sm font-medium ${t}`,children:[r,e]})}function _W(e){if(!e)return"-";const t=Date.now()-e,r=Math.floor(t/1e3);if(r<60)return r+"s";const a=Math.floor(r/60);if(a<60)return a+"m";const i=Math.floor(a/60),o=a%60;if(i<24)return i+"h "+o+"m";const l=Math.floor(i/24),u=i%24;return l+"d "+u+"h"}function Cb({label:e,value:t,max:r,color:a}){const i=r>0?Math.min(100,Math.round(t/r*100)):0;return n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"flex items-center justify-between text-xs",children:[n.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:e}),n.jsx("span",{className:"text-gray-700 dark:text-gray-300 font-medium",children:t.toLocaleString()})]}),n.jsx("div",{className:"h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:n.jsx("div",{className:`h-full ${a} transition-all duration-300`,style:{width:i+"%"}})})]})}function xo({label:e,value:t,mono:r}){return n.jsxs("div",{className:"flex items-center justify-between py-2 border-b border-gray-100 dark:border-gray-800 last:border-0",children:[n.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:e}),n.jsx("span",{className:`text-sm text-gray-900 dark:text-gray-100 ${r?"font-mono":""}`,children:t||"-"})]})}function wW({agent:e,onClose:t,onAction:r,onToolPartsChange:a,hackerMode:i}){const{t:o}=Jt(),[l,u]=x.useState(e),[d,f]=x.useState(null),[p,h]=x.useState(null),[m,y]=x.useState(!1),[v,k]=x.useState(!1),_=x.useCallback(async()=>{if(e!=null&&e.name)try{const M=await rW(e.name);u(M),f(null)}catch(M){console.error("Failed to load agent:",M),f(M.message)}},[e==null?void 0:e.name]);x.useEffect(()=>{_();const M=setInterval(_,5e3);return()=>clearInterval(M)},[_]);const w=x.useCallback(async M=>{h(M),f(null);try{M==="start"?await mv(l.name):M==="stop"?await xv(l.name):M==="restart"?await pf(l.name):M==="cleanRestart"?await pf(l.name,{clean:!0}):M==="pause"?await yv(l.name,{level:"tools"}):M==="unpause"&&await bv(l.name),await _(),r&&r(l.name,M)}catch(L){f(L.message)}finally{h(null)}},[l==null?void 0:l.name,_,r]),N=(l==null?void 0:l.state)==="working"||(l==null?void 0:l.state)==="idle"||(l==null?void 0:l.state)==="starting"||(l==null?void 0:l.state)==="paused",E=(l==null?void 0:l.state)==="paused"||(l==null?void 0:l.paused),A=(l==null?void 0:l.displayName)||(l==null?void 0:l.name)||"Unknown Agent",T=(l==null?void 0:l.tokens)||{input:0,output:0,cached:0,total:0},C=Math.max(T.input,T.output,T.cached,1),j=(l==null?void 0:l.cost)||{input:0,output:0,cached:0,total:0};return m?n.jsx(bW,{agentName:l==null?void 0:l.name,onClose:()=>{y(!1),a&&a(null)},onToolPartsChange:a,hackerMode:i}):n.jsxs("div",{className:"h-full flex flex-col bg-white dark:bg-gray-900 border-l border-gray-200 dark:border-gray-800",children:[n.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-800",children:[n.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[n.jsx("button",{onClick:t,className:"p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500 dark:text-gray-400 transition-colors flex-shrink-0",title:o("agent_detail.back"),"aria-label":o("agent_detail.back"),children:n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})})}),n.jsxs("div",{className:"min-w-0",children:[n.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 truncate",title:A,children:A}),(l==null?void 0:l.displayName)&&l.displayName!==l.name&&n.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 truncate",title:l.name,children:l.name})]})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{onClick:()=>k(!0),className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500 dark:text-gray-400 transition-colors",title:o("agent_detail.edit_settings"),"aria-label":o("agent_detail.edit_settings"),children:n.jsxs("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}),n.jsx(kW,{state:(l==null?void 0:l.state)||"stopped"})]})]}),n.jsx(vW,{isOpen:v,agent:l,onClose:()=>k(!1),onUpdated:M=>{_(),r&&r(M,"updated")},onDeleted:M=>{r&&r(M,"deleted"),t()}}),d&&n.jsxs("div",{className:"mx-6 mt-4 px-4 py-2 bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 text-sm rounded-lg flex items-center justify-between",children:[n.jsx("span",{children:d}),n.jsx("button",{onClick:()=>f(null),className:"ml-2 text-red-400 hover:text-red-600",children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),n.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[n.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:N?n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:()=>w("stop"),disabled:p,className:"flex-1 px-4 py-2 text-sm font-medium rounded-lg bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 disabled:opacity-50 transition-colors",children:o(p==="stop"?"agents.stopping":"agents.stop")}),E?n.jsx("button",{onClick:()=>w("unpause"),disabled:p,className:"flex-1 px-4 py-2 text-sm font-medium rounded-lg bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 hover:bg-green-200 dark:hover:bg-green-800/40 disabled:opacity-50 transition-colors",children:o(p==="unpause"?"agents.resuming":"agents.resume")}):n.jsx("button",{onClick:()=>w("pause"),disabled:p,className:"flex-1 px-4 py-2 text-sm font-medium rounded-lg bg-orange-100 dark:bg-orange-900/30 text-orange-700 dark:text-orange-400 hover:bg-orange-200 dark:hover:bg-orange-800/40 disabled:opacity-50 transition-colors",children:o(p==="pause"?"agents.pausing":"agents.pause")}),n.jsx("button",{onClick:()=>w("restart"),disabled:p,className:"flex-1 px-4 py-2 text-sm font-medium rounded-lg bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400 hover:bg-primary-200 dark:hover:bg-primary-800/40 disabled:opacity-50 transition-colors",children:o(p==="restart"?"agents.restarting":"agents.restart")}),n.jsx("button",{onClick:()=>w("cleanRestart"),disabled:p,className:"flex-1 px-4 py-2 text-sm font-medium rounded-lg bg-orange-100 dark:bg-orange-900/30 text-orange-700 dark:text-orange-400 hover:bg-orange-200 dark:hover:bg-orange-800/40 disabled:opacity-50 transition-colors",title:o("agents.clean_restart_tooltip"),children:o(p==="cleanRestart"?"agents.restarting":"agents.clean_restart")})]}):n.jsx("button",{onClick:()=>w("start"),disabled:p,className:"flex-1 px-4 py-2 text-sm font-medium rounded-lg bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 hover:bg-green-200 dark:hover:bg-green-800/40 disabled:opacity-50 transition-colors",children:o(p==="start"?"agents.starting":"agents.start")})}),n.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800/50 rounded-xl p-4",children:[n.jsx("h3",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-3",children:o("agent_detail.agent_info")}),n.jsxs("div",{className:"space-y-0",children:[n.jsx(xo,{label:o("agent_detail.model"),value:l==null?void 0:l.model,mono:!0}),n.jsx(xo,{label:o("agent_detail.port"),value:l==null?void 0:l.port,mono:!0}),n.jsx(xo,{label:o("agent_detail.pid"),value:l==null?void 0:l.pid,mono:!0}),n.jsx(xo,{label:o("agent_detail.session_id"),value:l!=null&&l.sessionId?l.sessionId.slice(0,12)+"...":null,mono:!0}),n.jsx(xo,{label:o("agent_detail.uptime"),value:_W(l==null?void 0:l.startedAt)}),n.jsx(xo,{label:o("agent_detail.iteration"),value:l==null?void 0:l.iteration}),n.jsx(xo,{label:o("agent_detail.start_mode"),value:l!=null&&l.skipInitialPrompt?o("agent_detail.start_mode_dormant"):o("agent_detail.start_mode_normal")})]})]}),n.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800/50 rounded-xl p-4",children:[n.jsx("h3",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-3",children:o("agent_detail.token_usage")}),n.jsxs("div",{className:"space-y-3",children:[n.jsx(Cb,{label:o("agent_detail.token_input"),value:T.input,max:C,color:"bg-blue-500"}),n.jsx(Cb,{label:o("agent_detail.token_output"),value:T.output,max:C,color:"bg-green-500"}),n.jsx(Cb,{label:o("agent_detail.token_cached"),value:T.cached,max:C,color:"bg-purple-500"}),n.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-gray-200 dark:border-gray-700",children:[n.jsx("span",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:"Total"}),n.jsx("span",{className:"text-sm font-bold text-gray-900 dark:text-gray-100",children:T.total.toLocaleString()})]})]})]}),n.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800/50 rounded-xl p-4",children:[n.jsx("h3",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-3",children:"Estimated Cost"}),n.jsxs("div",{className:"grid grid-cols-3 gap-4 mb-3",children:[n.jsxs("div",{className:"text-center",children:[n.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Input"}),n.jsxs("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:["$",j.input.toFixed(4)]})]}),n.jsxs("div",{className:"text-center",children:[n.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Output"}),n.jsxs("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:["$",j.output.toFixed(4)]})]}),n.jsxs("div",{className:"text-center",children:[n.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Cached"}),n.jsxs("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:["$",j.cached.toFixed(4)]})]})]}),n.jsxs("div",{className:"flex items-center justify-between pt-3 border-t border-gray-200 dark:border-gray-700",children:[n.jsx("span",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:o("agent_detail.total_cost")}),n.jsxs("span",{className:"text-lg font-bold text-gray-900 dark:text-gray-100",children:["$",j.total.toFixed(4)]})]})]}),(l==null?void 0:l.dailyUsage)&&l.dailyUsage.length>0&&n.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800/50 rounded-xl p-4",children:[n.jsx("h3",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-3",children:"Daily Usage (Last 7 Days)"}),n.jsx(yW,{data:l.dailyUsage})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("button",{className:"w-full px-4 py-2.5 text-sm font-medium rounded-lg border border-gray-200 dark:border-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors flex items-center justify-center gap-2",onClick:()=>y(!0),children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),o("agent_detail.view_conversation")]}),n.jsxs("button",{className:"w-full px-4 py-2.5 text-sm font-medium rounded-lg border border-gray-200 dark:border-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors flex items-center justify-center gap-2",onClick:()=>k(!0),children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})}),o("agent_detail.edit_settings")]}),n.jsxs("button",{className:"w-full px-4 py-2.5 text-sm font-medium rounded-lg border border-gray-200 dark:border-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors flex items-center justify-center gap-2",onClick:async()=>{try{await bA(l.name)}catch(M){f(o("agents.export_error")+": "+M.message)}},children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),o("agents.export")]})]}),(l==null?void 0:l.cwd)&&n.jsxs("div",{className:"text-xs text-gray-400 dark:text-gray-500 break-all",children:[n.jsx("span",{className:"font-medium",children:o("agent_detail.working_dir_label")}),n.jsx("br",{}),n.jsx("span",{className:"font-mono",children:l.cwd})]})]})]})}const zd=["swift","quick","rapid","agile","nimble","clever","smart","wise","bright","keen","bold","brave","calm","steady","noble","silent","shadow","storm","iron","steel","amber","azure","cobalt","crimson","golden","cosmic","cyber","digital","quantum","prime"],Ud=["falcon","hawk","eagle","raven","phoenix","wolf","fox","hound","coyote","tiger","panther","lynx","leopard","bear","orca","shark","viper","cobra","dragon","griffin","sentinel","guardian","titan","node","nexus","core","spark","pulse"];function f4(e=[],t=100){const r=new Set(e.map(l=>l.toLowerCase()));for(let l=0;l<t;l++){const u=zd[Math.floor(Math.random()*zd.length)],d=Ud[Math.floor(Math.random()*Ud.length)],f=`${u}-${d}`;if(!r.has(f))return f}const a=zd[Math.floor(Math.random()*zd.length)],i=Ud[Math.floor(Math.random()*Ud.length)],o=Math.floor(Math.random()*1e3);return`${a}-${i}-${o}`}function p4(e,t=[]){if(!e||typeof e!="string")return{valid:!1,error:"Name is required"};const r=e.trim().toLowerCase();return r.length===0?{valid:!1,error:"Name cannot be empty"}:r.length<2?{valid:!1,error:"Name must be at least 2 characters"}:r.length>50?{valid:!1,error:"Name must be 50 characters or less"}:/^[a-z0-9_-]+$/.test(r)?new Set(t.map(i=>i.toLowerCase())).has(r)?{valid:!1,error:"An agent with this name already exists"}:{valid:!0,error:null}:{valid:!1,error:"Name can only contain lowercase letters, numbers, hyphens, and underscores"}}function SW(e){return e?e.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9_-]/g,"").replace(/-+/g,"-").replace(/^-|-$/g,""):""}const qd=`# AGENTS.md - AI Agent Instructions
106
+
107
+ ## Overview
108
+ You are an autonomous AI agent. Your goal is to help users accomplish tasks efficiently.
109
+
110
+ ## Guidelines
111
+ - Be helpful and accurate
112
+ - Ask for clarification when needed
113
+ - Use available tools appropriately
114
+ - Report progress on long-running tasks
115
+
116
+ ## Constraints
117
+ - Do not make changes without user approval for destructive operations
118
+ - Follow security best practices
119
+ - Respect rate limits and resource constraints
120
+ `;function NW({isOpen:e,onClose:t,existingAgentNames:r=[],onCreated:a}){const{t:i}=Jt(),[o,l]=x.useState(""),[u,d]=x.useState(""),[f,p]=x.useState(""),[h,m]=x.useState("github-copilot/claude-opus-4.6"),[y,v]=x.useState(""),[k,_]=x.useState(!1),[w,N]=x.useState(qd),[E,A]=x.useState([]),[T,C]=x.useState(!1),[j,M]=x.useState([]),[L,I]=x.useState([]),[B,z]=x.useState(!1),[ee,V]=x.useState(!0),[D,K]=x.useState({}),[H,J]=x.useState(!1),[ne,P]=x.useState(null);x.useEffect(()=>{const Q={cancelled:!1};return e?(l(f4(r)),d(""),p(""),m("github-copilot/claude-opus-4.6"),v(""),_(!1),N(qd),A([]),C(!1),K({}),J(!1),P(null),U(Q,"github-copilot/claude-opus-4.6")):(V(!0),I([])),()=>{Q.cancelled=!0}},[e]);const U=async(Q,fe)=>{z(!0),V(!0);const[ke,Fe]=await Promise.allSettled([yA(),Ck()]);if(!Q.cancelled){if(ke.status==="fulfilled"?M(ke.value):(console.error("Failed to load skills:",ke.reason),M([])),z(!1),Fe.status==="fulfilled"){const Ve=Fe.value;I(Ve),Ve.find(Ge=>Ge.id===fe)||(_(!0),v(fe))}else console.error("Failed to load models:",Fe.reason),I([]);V(!1)}},X=()=>{const Q=f4(r);l(Q),K(fe=>({...fe,name:null}))},F=Q=>{const fe=Q.target.value;l(fe);const ke=p4(fe,r);ke.valid?K(Fe=>({...Fe,name:null})):K(Fe=>({...Fe,name:ke.error}))},Z=Q=>{A(fe=>fe.includes(Q)?fe.filter(ke=>ke!==Q):[...fe,Q])},W=()=>{E.length===j.length?A([]):A(j.map(Q=>Q.name))},G=async Q=>{Q&&Q.preventDefault(),P(null);const fe={},ke=p4(o,r);if(ke.valid||(fe.name=ke.error),f.trim()||(fe.workspace=i("agent_create.validate_workspace")),h||(fe.model=i("agent_create.validate_model")),Object.keys(fe).length>0){K(fe);return}J(!0);try{const Fe={name:SW(o),displayName:u.trim()||null,workspace:f.trim(),model:h,soul:w.trim()||null,skills:E,skipInitialPrompt:T},Ve=await uW(Fe);l(""),d(""),p(""),m("github-copilot/claude-opus-4.6"),N(qd),A([]),C(!1),K({}),a&&a(Ve.agent),t()}catch(Fe){P(Fe.message)}finally{J(!1)}},oe=()=>{H||(K({}),P(null),t())};return e?n.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[n.jsx("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:oe}),n.jsxs("div",{className:"relative bg-white dark:bg-gray-900 rounded-2xl shadow-2xl max-w-2xl w-full max-h-[90vh] overflow-hidden flex flex-col",children:[n.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-800",children:[n.jsxs("div",{children:[n.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:i("agent_create.title")}),n.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:i("agent_create.configure_subtitle")})]}),n.jsx("button",{onClick:oe,disabled:H,className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-400 transition-colors disabled:opacity-50",children:n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),n.jsxs("form",{onSubmit:Q=>Q.preventDefault(),className:"flex-1 overflow-y-auto p-6 space-y-6",children:[ne&&n.jsx("div",{className:"px-4 py-3 bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 text-sm rounded-lg",children:ne}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:i("agent_create.name_label")}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("input",{type:"text",value:o,onChange:F,placeholder:i("agent_create.name_placeholder"),className:`flex-1 px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500 ${D.name?"border-red-500":"border-gray-200 dark:border-gray-700"}`}),n.jsxs("button",{type:"button",onClick:X,className:"px-4 py-2 rounded-lg bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors flex items-center gap-2",title:i("agent_create.name_generate"),"aria-label":i("agent_create.name_generate"),children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),i("agent_create.random")]})]}),D.name&&n.jsx("p",{className:"mt-1 text-sm text-red-500",children:D.name}),n.jsx("p",{className:"mt-1 text-xs text-gray-400",children:i("agent_create.name_hint")})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:i("agent_create.display_name_label")}),n.jsx("input",{type:"text",value:u,onChange:Q=>d(Q.target.value),placeholder:i("agent_create.display_name_placeholder"),className:"w-full px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500"}),n.jsx("p",{className:"mt-1 text-xs text-gray-400",children:i("agent_create.display_name_hint")})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:i("agent_create.working_dir_label")}),n.jsx("input",{type:"text",value:f,onChange:Q=>p(Q.target.value),placeholder:i("agent_create.working_dir_placeholder"),className:`w-full px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border ${D.workspace?"border-red-500":"border-gray-200 dark:border-gray-700"} text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500 font-mono text-sm`}),D.workspace&&n.jsx("p",{className:"mt-1 text-xs text-red-500",children:D.workspace}),n.jsx("p",{className:"mt-1 text-xs text-gray-400",children:i("agent_create.working_dir_hint")})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:i("agent_create.model_label")}),ee?n.jsx("div",{className:"w-full px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-400 text-sm",children:i("agent_create.loading_models")}):L.length===0?n.jsx("input",{type:"text",value:h,onChange:Q=>m(Q.target.value),placeholder:i("agent_create.model_placeholder"),className:`w-full px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500 font-mono text-sm ${D.model?"border-red-500":"border-gray-200 dark:border-gray-700"}`}):n.jsxs(n.Fragment,{children:[n.jsxs("select",{value:k?"__custom__":h,onChange:Q=>{Q.target.value==="__custom__"?(_(!0),h&&h!=="__custom__"&&v(h)):(_(!1),m(Q.target.value))},className:`w-full px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-primary-500 ${D.model?"border-red-500":"border-gray-200 dark:border-gray-700"}`,children:[(()=>{const Q=jk(L);return Object.entries(Q).map(([ke,Fe])=>n.jsx("optgroup",{label:Nk[ke]||ke,children:Fe.map(Ve=>n.jsxs("option",{value:Ve.id,children:[Ve.name,Ek(Ve.tier)]},Ve.id))},ke))})(),n.jsx("option",{value:"__custom__",children:i("agent_create.custom_model")})]}),k&&n.jsx("input",{type:"text",value:y,onChange:Q=>{v(Q.target.value),m(Q.target.value)},placeholder:i("agent_create.custom_model_placeholder"),className:`w-full mt-2 px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500 font-mono text-sm ${D.model?"border-red-500":"border-gray-200 dark:border-gray-700"}`})]}),D.model&&n.jsx("p",{className:"mt-1 text-sm text-red-500",children:D.model}),n.jsx("p",{className:"mt-1 text-xs text-gray-400",children:i(k?"agent_create.custom_model_hint":"agent_create.model_hint")})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:i("agent_create.start_mode")}),n.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[n.jsx("input",{type:"checkbox",checked:T,onChange:Q=>C(Q.target.checked),className:"mt-0.5 rounded border-gray-300 dark:border-gray-600 text-primary-600 focus:ring-primary-500"}),n.jsxs("div",{children:[n.jsx("span",{className:"text-sm text-gray-900 dark:text-gray-100",children:i("agent_create.dormant_mode")}),n.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:i("agent_create.dormant_mode_desc")})]})]})]}),n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:i("agent_create.skills_label")}),n.jsx("button",{type:"button",onClick:W,className:"text-xs text-primary-600 dark:text-primary-400 hover:underline",children:E.length===j.length?i("agent_create.deselect_all"):i("agent_create.select_all")})]}),n.jsx("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-3 max-h-48 overflow-y-auto bg-gray-50 dark:bg-gray-800",children:B?n.jsx("div",{className:"text-center py-4 text-gray-500",children:i("agent_create.loading_skills")}):j.length===0?n.jsx("div",{className:"text-center py-4 text-gray-500",children:i("agent_create.no_skills")}):n.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-2",children:j.map(Q=>n.jsxs("label",{className:`flex items-center gap-2 px-3 py-2 rounded-lg cursor-pointer transition-colors ${E.includes(Q.name)?"bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-300":"hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300"}`,children:[n.jsx("input",{type:"checkbox",checked:E.includes(Q.name),onChange:()=>Z(Q.name),className:"rounded border-gray-300 text-primary-600 focus:ring-primary-500"}),n.jsxs("span",{className:"text-sm truncate",title:Q.description,children:[Q.icon&&n.jsx("span",{className:"mr-1",children:Q.icon}),Q.name]})]},Q.name))})}),n.jsx("p",{className:"mt-1 text-xs text-gray-400",children:i("agent_create.skills_selected",{count:E.length})})]}),n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:[i("agent_create.instructions_label"),n.jsx("span",{className:"text-gray-400 font-normal ml-1",children:i("agent_create.instructions_optional")})]}),n.jsx("button",{type:"button",onClick:()=>N(qd),className:"text-xs text-primary-600 dark:text-primary-400 hover:underline",children:i("agent_create.reset_default")})]}),n.jsx("textarea",{value:w,onChange:Q=>N(Q.target.value),rows:8,placeholder:i("agent_create.soul_placeholder"),className:"w-full px-4 py-3 rounded-lg bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500 font-mono text-sm resize-none"}),n.jsx("p",{className:"mt-1 text-xs text-gray-400",children:i("agent_create.instructions_hint")})]})]}),n.jsxs("div",{className:"flex items-center justify-end gap-3 px-6 py-4 border-t border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900",children:[n.jsx("button",{type:"button",onClick:oe,disabled:H,className:"px-4 py-2 rounded-lg text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors disabled:opacity-50",children:i("agent_create.cancel")}),n.jsx("button",{type:"button",onClick:G,disabled:H||!!D.name,className:"px-6 py-2 rounded-lg bg-primary-600 hover:bg-primary-700 text-white font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:H?n.jsxs(n.Fragment,{children:[n.jsxs("svg",{className:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[n.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),n.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),i("agent_create.spawning")]}):n.jsxs(n.Fragment,{children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"})}),i("agent_create.spawn")]})})]})]})]}):null}const EW=8,jW=32;function kA({width:e,min:t,max:r,edge:a,onCommit:i,getPaneEl:o,ariaLabel:l,className:u}){const d=x.useRef(null),f=x.useRef(null),p=x.useRef(null),h=x.useRef(e);h.current=e,x.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,w=v.clientX,N=h.current;try{k.setPointerCapture(v.pointerId)}catch{}d.current=v.pointerId;const E=document.body.style.cursor,A=document.body.style.userSelect;document.body.style.cursor="ew-resize",document.body.style.userSelect="none";let T=!1;const C=I=>{if(d.current!==null&&I.pointerId!==d.current)return;const B=a==="left"?w-I.clientX:I.clientX-w,z=y_(N+B,t,r);_&&(_.style.width=z+"px"),f.current=z},j=I=>{if(T)return;T=!0,window.removeEventListener("pointermove",C),window.removeEventListener("pointerup",L),window.removeEventListener("pointercancel",M),window.removeEventListener("lostpointercapture",M),document.body.style.cursor=E,document.body.style.userSelect=A;const B=d.current;if(d.current=null,B!==null)try{k.releasePointerCapture(B)}catch{}I&&f.current!==null?i(f.current):_&&(_.style.width=h.current+"px"),f.current=null,p.current=null},M=()=>j(!1),L=()=>j(!0);window.addEventListener("pointermove",C),window.addEventListener("pointerup",L),window.addEventListener("pointercancel",M),window.addEventListener("lostpointercapture",M),p.current=()=>j(!1)},y=v=>{const k=v.shiftKey?jW:EW;let _=null;v.key==="ArrowLeft"?_=e+(a==="left"?k:-k):v.key==="ArrowRight"?_=e+(a==="right"?k:-k):v.key==="Home"?_=t:v.key==="End"&&(_=r),_!==null&&(v.preventDefault(),i(y_(_,t,r)))};return n.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":l,"aria-valuemin":t,"aria-valuemax":r,"aria-valuenow":e,tabIndex:0,onPointerDown:m,onKeyDown:y,className:`absolute top-0 bottom-0 w-1 cursor-ew-resize z-10 touch-none ${a==="left"?"left-0":"right-0"}${u?" "+u:""}`})}const g4="pave-agents-panel-collapsed",h4={working:"bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400",idle:"bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-400",paused:"bg-orange-100 dark:bg-orange-900/30 text-orange-700 dark:text-orange-400",stopped:"bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400",crashed:"bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-400",error:"bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-400",starting:"bg-yellow-100 dark:bg-yellow-900/30 text-yellow-700 dark:text-yellow-400"},m4={working:n.jsx("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:n.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})}),idle:n.jsx("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:n.jsx("path",{d:"M17.293 13.293A8 8 0 016.707 2.707a8.001 8.001 0 1010.586 10.586z"})}),paused:n.jsx("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:n.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8 7a1 1 0 00-1 1v4a1 1 0 102 0V8a1 1 0 00-1-1zm4 0a1 1 0 00-1 1v4a1 1 0 102 0V8a1 1 0 00-1-1z",clipRule:"evenodd"})}),stopped:n.jsx("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:n.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8 7a1 1 0 00-1 1v4a1 1 0 001 1h4a1 1 0 001-1V8a1 1 0 00-1-1H8z",clipRule:"evenodd"})}),crashed:n.jsx("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:n.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),error:n.jsx("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:n.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),starting:n.jsx("svg",{className:"w-3 h-3 mr-1 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})},CW="M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.325.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 0 1 1.37.49l1.296 2.247a1.125 1.125 0 0 1-.26 1.431l-1.003.827c-.293.241-.438.613-.43.992a7.723 7.723 0 0 1 0 .255c-.008.378.137.75.43.991l1.004.827c.424.35.534.955.26 1.43l-1.298 2.247a1.125 1.125 0 0 1-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.47 6.47 0 0 1-.22.128c-.331.183-.581.495-.644.869l-.213 1.281c-.09.543-.56.94-1.11.94h-2.594c-.55 0-1.019-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 0 1-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 0 1-1.369-.49l-1.297-2.247a1.125 1.125 0 0 1 .26-1.431l1.004-.827c.292-.24.437-.613.43-.991a6.932 6.932 0 0 1 0-.255c.007-.38-.138-.751-.43-.992l-1.004-.827a1.125 1.125 0 0 1-.26-1.43l1.297-2.247a1.125 1.125 0 0 1 1.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.086.22-.128.332-.183.582-.495.644-.869l.214-1.28Z",TW="M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z";function RW({state:e}){const t=h4[e]||h4.stopped,r=m4[e]||m4.stopped;return n.jsxs("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${t}`,children:[r,e]})}function AW(e){if(!e)return"-";const t=Date.now()-e,r=Math.floor(t/1e3);if(r<60)return r+"s";const a=Math.floor(r/60);if(a<60)return a+"m";const i=Math.floor(a/60),o=a%60;if(i<24)return i+"h "+o+"m";const l=Math.floor(i/24),u=i%24;return l+"d "+u+"h"}function IW({agent:e,onAction:t,onSelect:r,onExport:a,actionLoading:i,isSelected:o,onToggleSelect:l}){const{t:u}=Jt(),d=e.state==="working"||e.state==="idle"||e.state==="starting"||e.state==="paused",f=e.state==="paused"||e.paused,p=f?"paused":e.state,h=e.displayName||e.name;return n.jsxs("div",{className:"bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-800 rounded-xl p-4 hover:border-primary-300 dark:hover:border-primary-700 hover:shadow-md transition-all duration-150 cursor-pointer flex flex-col",onClick:()=>r(e),children:[n.jsxs("div",{className:"flex items-start justify-between mb-3",children:[n.jsx("input",{type:"checkbox",checked:o||!1,onChange:m=>{m.stopPropagation(),l&&l(e.name)},onClick:m=>m.stopPropagation(),className:"mt-1 mr-2 h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-primary-600 focus:ring-primary-500 flex-shrink-0","aria-label":u("agents.select")+" "+(e.displayName||e.name)}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("h3",{className:"font-medium text-gray-900 dark:text-gray-100 truncate",title:h,children:h}),e.displayName&&e.displayName!==e.name&&n.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 truncate",title:e.name,children:e.name})]}),n.jsx(RW,{state:p})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs text-gray-500 dark:text-gray-400 mb-4",children:[n.jsxs("div",{children:[n.jsxs("span",{className:"text-gray-400 dark:text-gray-500",children:[u("agents.uptime"),":"]})," ",n.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:AW(e.startedAt)})]}),n.jsxs("div",{children:[n.jsxs("span",{className:"text-gray-400 dark:text-gray-500",children:[u("agents.iteration"),":"]})," ",n.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:e.iteration||0})]}),n.jsxs("div",{children:[n.jsxs("span",{className:"text-gray-400 dark:text-gray-500",children:[u("agents.port"),":"]})," ",n.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:e.port||"-"})]}),n.jsxs("div",{children:[n.jsxs("span",{className:"text-gray-400 dark:text-gray-500",children:[u("agents.pid"),":"]})," ",n.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:e.pid||"-"})]})]}),n.jsx("div",{className:"text-xs text-gray-400 dark:text-gray-500 mb-3 truncate",title:e.model||"",children:e.model?u("agents.model_label",{model:e.model}):" "}),n.jsxs("div",{className:"flex items-center gap-2 pt-3 border-t border-gray-100 dark:border-gray-800 mt-auto flex-wrap",children:[d?n.jsxs(n.Fragment,{children:[f?n.jsx("button",{onClick:m=>{m.stopPropagation(),t(e.name,"unpause")},disabled:(i==null?void 0:i.name)===e.name,className:"min-w-[80px] px-3 py-1.5 text-xs font-medium rounded-lg bg-orange-100 dark:bg-orange-900/30 text-orange-700 dark:text-orange-400 hover:bg-orange-200 dark:hover:bg-orange-800/40 disabled:opacity-50 transition-colors",children:(i==null?void 0:i.name)===e.name&&(i==null?void 0:i.action)==="unpause"?u("agents.resuming"):u("agents.resume")}):n.jsx("button",{onClick:m=>{m.stopPropagation(),t(e.name,"pause")},disabled:(i==null?void 0:i.name)===e.name,className:"min-w-[80px] px-3 py-1.5 text-xs font-medium rounded-lg bg-orange-100 dark:bg-orange-900/30 text-orange-700 dark:text-orange-400 hover:bg-orange-200 dark:hover:bg-orange-800/40 disabled:opacity-50 transition-colors",children:(i==null?void 0:i.name)===e.name&&(i==null?void 0:i.action)==="pause"?u("agents.pausing"):u("agents.pause")}),n.jsx("button",{onClick:m=>{m.stopPropagation(),t(e.name,"stop")},disabled:(i==null?void 0:i.name)===e.name,className:"min-w-[80px] px-3 py-1.5 text-xs font-medium rounded-lg bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 disabled:opacity-50 transition-colors",children:(i==null?void 0:i.name)===e.name&&(i==null?void 0:i.action)==="stop"?u("agents.stopping"):u("agents.stop")}),n.jsx("button",{onClick:m=>{m.stopPropagation(),t(e.name,"restart")},disabled:(i==null?void 0:i.name)===e.name,className:"min-w-[80px] px-3 py-1.5 text-xs font-medium rounded-lg bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400 hover:bg-primary-200 dark:hover:bg-primary-800/40 disabled:opacity-50 transition-colors",children:(i==null?void 0:i.name)===e.name&&(i==null?void 0:i.action)==="restart"?u("agents.restarting"):u("agents.restart")})]}):n.jsx("button",{onClick:m=>{m.stopPropagation(),t(e.name,"start")},disabled:(i==null?void 0:i.name)===e.name,className:"min-w-[80px] px-3 py-1.5 text-xs font-medium rounded-lg bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 hover:bg-green-200 dark:hover:bg-green-800/40 disabled:opacity-50 transition-colors",children:(i==null?void 0:i.name)===e.name&&(i==null?void 0:i.action)==="start"?u("agents.starting"):u("agents.start")}),n.jsx("button",{onClick:m=>{m.stopPropagation(),a(e.name)},className:"px-3 py-1.5 text-xs font-medium rounded-lg bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors",title:u("agents.export"),"aria-label":u("agents.export"),children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})})}),n.jsx("button",{type:"button",onClick:m=>{m.stopPropagation(),r(e)},className:"px-3 py-1.5 text-xs font-medium rounded-lg bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors",title:u("agents.view_details"),"aria-label":u("agents.view_details"),children:n.jsxs("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:CW}),n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:TW})]})})]})]})}function MW({agents:e,totalCost:t}){const r=e.filter(i=>i.state==="working"||i.state==="idle").length,a=e.reduce((i,o)=>{var l;return i+(((l=o.tokens)==null?void 0:l.total)||0)},0);return n.jsx("div",{className:"bg-gray-50 dark:bg-gray-900 border-b border-gray-200 dark:border-gray-800 px-6 py-3",children:n.jsxs("div",{className:"flex items-center justify-between text-sm",children:[n.jsxs("div",{className:"flex items-center gap-6",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:"w-2 h-2 rounded-full bg-green-500"}),n.jsxs("span",{className:"text-gray-600 dark:text-gray-400",children:["Active: ",n.jsxs("span",{className:"font-medium text-gray-900 dark:text-gray-100",children:[r,"/",e.length]})]})]}),n.jsxs("div",{className:"text-gray-600 dark:text-gray-400",children:["Total Tokens: ",n.jsx("span",{className:"font-medium text-gray-900 dark:text-gray-100",children:a.toLocaleString()})]})]}),n.jsxs("div",{className:"text-gray-600 dark:text-gray-400",children:["Est. Cost: ",n.jsxs("span",{className:"font-medium text-gray-900 dark:text-gray-100",children:["$",t.toFixed(4)]})]})]})})}function LW({onBack:e,onSelectAgent:t,initialAgentName:r,onInitialAgentConsumed:a,hackerMode:i,matrixMode:o,darkMode:l,onToggleMatrix:u,terminalWidth:d,onTerminalWidthChange:f,terminalMinWidth:p,terminalMaxWidth:h}){const{t:m}=Jt(),[y,v]=x.useState([]),[k,_]=x.useState(!0),[w,N]=x.useState(!1),[E,A]=x.useState(null),[T,C]=x.useState(null),[j,M]=x.useState(null),[L,I]=x.useState(null),[B,z]=x.useState(!1),[ee,V]=x.useState(new Set),[D,K]=x.useState(null),[H,J]=x.useState(()=>{if(typeof window>"u")return!1;try{return localStorage.getItem(g4)==="true"}catch{return!1}}),ne=x.useMemo(()=>Array.isArray(D)?D.length===0?D:!i&&D.every(je=>je.state&&je.state.status==="completed"||je.state&&je.state.status==="error")?[]:D:null,[D,i]),P=x.useRef(null),U=x.useRef(!0);x.useEffect(()=>()=>{U.current=!1,F.current&&clearTimeout(F.current)},[]),x.useEffect(()=>{if(!(typeof window>"u"))try{localStorage.setItem(g4,H?"true":"false")}catch{}},[H]);const X=x.useRef(!1),F=x.useRef(null),Z=x.useRef(null),W=x.useCallback(async ge=>{if(P.current)return ge?(X.current=!0,P.current.then(()=>P.current||Promise.resolve())):P.current;const je=(async()=>{let se=!1;try{const De=await tW();if(!U.current)return se;const rt=Array.isArray(De)?De:[];v(rt),I(dt=>dt&&(rt.find(Lt=>Lt.name===dt.name)||null)),C(null),se=!0}catch(De){if(!U.current)return se;console.error("Failed to load agents:",De),C(De.message)}finally{U.current&&_(!1),P.current=null,X.current&&U.current&&(X.current=!1,W())}return se})();return P.current=je,je},[]),G=x.useCallback(async()=>{if(!U.current)return;N(!0),A(null),F.current&&(clearTimeout(F.current),F.current=null);let ge=!1;try{const[je]=await Promise.all([W(!0),new Promise(se=>{setTimeout(se,400)})]);ge=je===!0}catch{ge=!1}finally{U.current&&(N(!1),A(ge?"success":"error"),F.current=setTimeout(()=>{U.current&&A(null),F.current=null},1e3))}},[W]);x.useEffect(()=>{W();const ge=setInterval(W,5e3);return()=>clearInterval(ge)},[W]),x.useEffect(()=>{if(!r||y.length===0)return;const ge=y.find(je=>je.name===r);ge&&(I(ge),K(null),t&&t(ge),a&&a())},[r,y,t,a]);const oe=x.useCallback(async(ge,je)=>{M({name:ge,action:je}),C(null);try{je==="start"?await mv(ge):je==="stop"?await xv(ge):je==="restart"?await pf(ge):je==="pause"?await yv(ge,{level:"iterations"}):je==="unpause"&&await bv(ge),await W(!0)}catch(se){C(se.message)}finally{M(null)}},[W]),Q=y.reduce((ge,je)=>{var se;return ge+(((se=je.cost)==null?void 0:se.total)||0)},0),fe=x.useCallback(ge=>{I(ge),K(null),t&&t(ge)},[t]),ke=x.useCallback(()=>{I(null),K(null)},[]),Fe=x.useCallback(ge=>{V(je=>{const se=new Set(je);return se.has(ge)?se.delete(ge):se.add(ge),se})},[]),Ve=x.useCallback(()=>{V(new Set(y.map(ge=>ge.name)))},[y]),Ge=x.useCallback(()=>{V(new Set)},[]),qe=x.useCallback(async ge=>{var se;if(ee.size===0)return;C(null);const je=[...ee];try{const rt=(await Promise.allSettled(je.map(async dt=>{ge==="pause"?await yv(dt,{level:"iterations"}):ge==="unpause"?await bv(dt):ge==="stop"?await xv(dt):ge==="restart"?await pf(dt):ge==="start"&&await mv(dt)}))).filter(dt=>dt.status==="rejected");rt.length>0&&C(((se=rt[0].reason)==null?void 0:se.message)||"Some actions failed"),await W(!0)}catch(De){C(De.message)}},[ee,W]),Ce=x.useCallback(()=>{W(!0)},[W]),He=x.useCallback(ge=>{W(!0),ge&&I(ge)},[W]),[ze,gt]=x.useState(!1),[mt,wt]=x.useState(null),$e=x.useRef(null);x.useEffect(()=>()=>{$e.current&&clearTimeout($e.current)},[]);const Et=x.useCallback(async ge=>{try{await bA(ge)}catch(je){C(m("agents.export_error")+": "+je.message)}},[m]),Ze=x.useCallback(async ge=>{try{wt(null),await gW(ge),wt({type:"success",message:m("agents.import_success")}),W(!0),$e.current&&clearTimeout($e.current),$e.current=setTimeout(()=>{wt(je=>je&&je.type==="success"?null:je),$e.current=null},5e3)}catch(je){wt({type:"error",message:m("agents.import_error")+": "+je.message})}},[m,W]),Oe=x.useCallback(()=>{const ge=document.createElement("input");ge.type="file",ge.accept=".yaml,.yml",ge.onchange=je=>{const se=je&&je.target&&je.target.files,De=se&&se[0];if(!De)return;const rt=De.name.toLowerCase();if(!rt.endsWith(".yaml")&&!rt.endsWith(".yml")){wt({type:"error",message:m("agents.import_invalid_file")});return}if(De.size>10*1024*1024){wt({type:"error",message:m("agents.import_file_too_large")});return}const dt=new FileReader;dt.onload=lt=>{const Lt=lt&&lt.target?lt.target.result:null;typeof Lt=="string"&&Ze(Lt)},dt.onerror=()=>{wt({type:"error",message:m("agents.import_read_error")})},dt.readAsText(De)},ge.click()},[m,Ze]),it=x.useCallback(ge=>{ge.preventDefault(),ge.stopPropagation(),gt(!0)},[]),me=x.useCallback(ge=>{ge.preventDefault(),ge.stopPropagation();const je=ge.relatedTarget;(!je||!ge.currentTarget.contains(je))&&gt(!1)},[]),Ee=x.useCallback(ge=>{ge.preventDefault(),ge.stopPropagation(),gt(!1);const je=ge.dataTransfer&&ge.dataTransfer.files,se=je&&je[0];if(!se)return;const De=se.name.toLowerCase();if(!De.endsWith(".yaml")&&!De.endsWith(".yml")){wt({type:"error",message:m("agents.import_invalid_file")});return}if(se.size>10*1024*1024){wt({type:"error",message:m("agents.import_file_too_large")});return}const rt=new FileReader;rt.onload=dt=>{const lt=dt&&dt.target?dt.target.result:null;typeof lt=="string"&&Ze(lt)},rt.onerror=()=>{wt({type:"error",message:m("agents.import_read_error")})},rt.readAsText(se)},[m,Ze]);return L?n.jsxs("div",{className:"h-full flex",children:[n.jsxs("div",{className:`${H?"w-12":"w-80"} transition-all duration-200 border-r border-gray-200 dark:border-gray-800 flex flex-col bg-gray-50 dark:bg-gray-950`,children:[n.jsxs("div",{className:"flex items-center justify-between px-2 py-2 border-b border-gray-200 dark:border-gray-800",children:[H?null:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("button",{onClick:e,className:"p-1 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500 dark:text-gray-400 transition-colors",title:m("agents.back_to_chat"),"aria-label":m("agents.back_to_chat"),children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})})}),n.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:m("agents.title")})]}),n.jsx("button",{onClick:()=>J(ge=>!ge),className:`p-1 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500 dark:text-gray-400 transition-colors ${H?"mx-auto":""}`,title:m(H?"agents.expand_panel":"agents.collapse_panel"),"aria-label":m(H?"agents.expand_panel":"agents.collapse_panel"),"aria-expanded":!H,"aria-controls":"agents-panel-content",children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:H?"M8.25 4.5l7.5 7.5-7.5 7.5":"M15.75 19.5L8.25 12l7.5-7.5"})})}),H?null:n.jsx("button",{onClick:G,disabled:k||w,className:`p-1 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors disabled:opacity-50 ${E==="success"?"text-green-500":E==="error"?"text-red-500":"text-gray-400"}`,title:m("agents.refresh"),"aria-label":m("agents.refresh"),children:n.jsx("svg",{className:`w-4 h-4 ${w?"animate-spin":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})})]}),n.jsx("div",{id:"agents-panel-content",className:"flex-1 overflow-y-auto p-2",children:H?n.jsx("div",{className:"py-2 flex flex-col items-center gap-1.5",children:y.map(ge=>{const je=ge.name===L.name,se=ge.state==="working"||ge.state==="idle";return n.jsx("button",{onClick:()=>fe(ge),className:"p-0.5 rounded-full",title:ge.displayName||ge.name,"aria-label":ge.displayName||ge.name,children:n.jsx("div",{className:`w-3 h-3 rounded-full ${je?"ring-2 ring-primary-500 bg-primary-400":se?"bg-green-500":"bg-gray-400 dark:bg-gray-600"}`})},ge.name)})}):n.jsx("div",{className:"space-y-1",children:y.map(ge=>{const je=ge.name===L.name,se=ge.state==="working"||ge.state==="idle";return n.jsx("button",{onClick:()=>fe(ge),className:`w-full text-left px-3 py-2 rounded-lg transition-colors ${je?"bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-300":"hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-700 dark:text-gray-300"}`,children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:`w-2 h-2 rounded-full flex-shrink-0 ${se?"bg-green-500":"bg-gray-400 dark:bg-gray-600"}`}),n.jsx("span",{className:"text-sm font-medium truncate",children:ge.displayName||ge.name})]})},ge.name)})})})]}),n.jsx("div",{className:"flex-1 overflow-hidden",children:n.jsx(wW,{agent:L,onClose:ke,onAction:Ce,onToolPartsChange:K,hackerMode:i})}),Array.isArray(ne)&&n.jsxs("aside",{ref:Z,style:{width:d},className:`border-l hidden lg:flex flex-col relative bg-gray-50 dark:bg-gray-900 ${i?l?"border-gray-800":"border-gray-300":"border-gray-200 dark:border-gray-800"}`,children:[n.jsx(kA,{width:d,min:p,max:h,edge:"left",onCommit:f||(()=>{}),getPaneEl:()=>Z.current,ariaLabel:m("agents.resize_terminal"),className:i?l?"bg-gray-800 hover:bg-gray-700 active:bg-gray-600":"bg-gray-300 hover:bg-gray-400 active:bg-gray-500":"bg-gray-200 hover:bg-gray-300 active:bg-gray-400 dark:bg-gray-800 dark:hover:bg-gray-700 dark:active:bg-gray-600"}),n.jsx("div",{className:"flex-1 overflow-y-auto",children:i?n.jsx(gR,{toolParts:ne,matrixMode:o,onToggleMatrix:u,darkMode:l}):n.jsx(fR,{toolParts:ne})})]})]}):n.jsxs("div",{className:"h-full flex flex-col relative",onDragOver:it,onDragLeave:me,onDrop:Ee,children:[ze&&n.jsx("div",{className:"absolute inset-0 z-50 bg-primary-500/10 border-2 border-dashed border-primary-500 rounded-xl flex items-center justify-center pointer-events-none",children:n.jsx("div",{className:"bg-white dark:bg-gray-900 px-6 py-4 rounded-lg shadow-lg text-primary-600 dark:text-primary-400 font-medium",children:m("agents.drop_to_import")})}),n.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-800",children:[n.jsxs("div",{className:"flex items-center gap-4",children:[n.jsx("button",{onClick:e,className:"p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500 dark:text-gray-400 transition-colors",title:m("agents.back_to_chat"),"aria-label":m("agents.back_to_chat"),children:n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})})}),n.jsxs("div",{children:[n.jsx("h1",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:m("agents.title")}),n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:m("agents.subtitle")})]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("button",{onClick:G,disabled:k||w,className:`p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors disabled:opacity-50 ${E==="success"?"text-green-500":E==="error"?"text-red-500":"text-gray-500 dark:text-gray-400"}`,title:m("agents.refresh"),"aria-label":m("agents.refresh"),children:n.jsx("svg",{className:`w-4 h-4 ${w?"animate-spin":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})}),n.jsxs("button",{onClick:Oe,className:"px-4 py-2 rounded-lg bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-300 font-medium text-sm transition-colors flex items-center gap-2",title:m("agents.import_button"),"aria-label":m("agents.import_button"),children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"})}),m("agents.import_button")]}),n.jsxs("button",{onClick:()=>z(!0),className:"px-4 py-2 rounded-lg bg-primary-500 hover:bg-primary-600 text-white font-medium text-sm transition-colors flex items-center gap-2",children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"})}),m("agents.spawn_button")]})]})]}),y.length>0&&n.jsx(MW,{agents:y,totalCost:Q}),T&&n.jsxs("div",{className:"mx-6 mt-4 px-4 py-2 bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 text-sm rounded-lg flex items-center justify-between",children:[n.jsx("span",{children:T}),n.jsx("button",{onClick:()=>C(null),className:"ml-2 text-red-400 hover:text-red-600",children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),mt&&n.jsxs("div",{className:`mx-6 mt-4 px-4 py-2 text-sm rounded-lg flex items-center justify-between ${mt.type==="success"?"bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400":"bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400"}`,children:[n.jsx("span",{children:mt.message}),n.jsx("button",{onClick:()=>wt(null),"aria-label":m("common.close")||"Close",title:m("common.close")||"Close",className:`ml-2 ${mt.type==="success"?"text-green-400 hover:text-green-600":"text-red-400 hover:text-red-600"}`,children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),n.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:k&&y.length===0?n.jsx("div",{className:"flex items-center justify-center h-64",children:n.jsx("div",{className:"w-8 h-8 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}):y.length===0?n.jsxs("div",{className:"flex flex-col items-center justify-center h-64 text-center",children:[n.jsx("div",{className:"w-16 h-16 rounded-2xl bg-gray-100 dark:bg-gray-800 flex items-center justify-center mb-4",children:n.jsx("svg",{className:"w-8 h-8 text-gray-400 dark:text-gray-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})})}),n.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-gray-100 mb-1",children:m("agents.no_agents_title")}),n.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mb-4",children:m("agents.no_agents_desc")}),n.jsxs("button",{onClick:()=>z(!0),className:"px-4 py-2 rounded-lg bg-primary-500 hover:bg-primary-600 text-white font-medium text-sm transition-colors flex items-center gap-2",children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"})}),m("agents.spawn_button")]}),n.jsxs("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-4",children:["Or run ",n.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1.5 py-0.5 rounded",children:"pave agent --daemon"})," in a project directory"]})]}):n.jsxs(n.Fragment,{children:[ee.size>0&&n.jsxs("div",{className:"mb-4 px-4 py-2.5 bg-primary-50 dark:bg-primary-900/20 border border-primary-200 dark:border-primary-800 rounded-lg flex items-center gap-3 flex-wrap",children:[n.jsx("span",{className:"text-sm font-medium text-primary-700 dark:text-primary-300",children:m("agents.selected",{count:ee.size})}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("button",{onClick:()=>qe("pause"),className:"px-3 py-1 text-xs font-medium rounded-md bg-orange-100 dark:bg-orange-900/30 text-orange-700 dark:text-orange-400 hover:bg-orange-200 dark:hover:bg-orange-800/40 transition-colors",children:m("agents.pauseAll")}),n.jsx("button",{onClick:()=>qe("unpause"),className:"px-3 py-1 text-xs font-medium rounded-md bg-orange-100 dark:bg-orange-900/30 text-orange-700 dark:text-orange-400 hover:bg-orange-200 dark:hover:bg-orange-800/40 transition-colors",children:m("agents.unpauseAll")}),n.jsx("button",{onClick:()=>qe("stop"),className:"px-3 py-1 text-xs font-medium rounded-md bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-400 hover:bg-red-200 dark:hover:bg-red-800/40 transition-colors",children:m("agents.stopAll")}),n.jsx("button",{onClick:()=>qe("restart"),className:"px-3 py-1 text-xs font-medium rounded-md bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-400 hover:bg-blue-200 dark:hover:bg-blue-800/40 transition-colors",children:m("agents.restartAll")}),n.jsx("button",{onClick:()=>qe("start"),className:"px-3 py-1 text-xs font-medium rounded-md bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 hover:bg-green-200 dark:hover:bg-green-800/40 transition-colors",children:m("agents.startAll")})]}),n.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[n.jsx("button",{onClick:Ve,className:"px-2 py-1 text-xs text-primary-600 dark:text-primary-400 hover:underline",children:m("agents.selectAll")}),n.jsx("button",{onClick:Ge,className:"px-2 py-1 text-xs text-gray-500 dark:text-gray-400 hover:underline",children:m("agents.deselectAll")})]})]}),n.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:y.map(ge=>n.jsx(IW,{agent:ge,onAction:oe,onSelect:fe,onExport:Et,actionLoading:j,isSelected:ee.has(ge.name),onToggleSelect:Fe},ge.name))})]})}),n.jsx(NW,{isOpen:B,onClose:()=>z(!1),existingAgentNames:y.map(ge=>ge.name),onCreated:He})]})}var vv=20;function Tk(e){if(!e)return"";try{var t=new Date(e);return Number.isNaN(t.getTime())?String(e):t.toLocaleString()}catch{return String(e)}}function OW(e){var t={},r=[],a={};return(e||[]).forEach(function(i){i.parentId&&!a[i.parentId]?r.push(i):i.parentId?(t[i.parentId]=t[i.parentId]||[]).push(i):r.push(i),a[i.id]=!0}),{topLevel:r,childrenByParent:t}}function _A({post:e,childrenByParent:t,depth:r,onDelete:a,t:i}){var o=t[e.id]||[];return n.jsxs("div",{className:r>0?"ml-4 pl-3 border-l border-gray-200 dark:border-gray-700":"",children:[n.jsxs("div",{className:"py-2",children:[n.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500 dark:text-gray-400",children:[n.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-300",children:e.author}),n.jsx("span",{children:Tk(e.createdAt)}),!e.deleted&&a&&n.jsx("button",{type:"button",onClick:function(){a(e.id)},className:"ml-auto text-gray-400 hover:text-red-500 transition-colors",title:i("board.delete_post"),"aria-label":i("board.delete_post"),children:n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]}),e.deleted?n.jsx("p",{className:"mt-1 text-sm text-gray-400 dark:text-gray-500 italic",children:i("board.post_deleted")}):n.jsx("p",{className:"mt-1 text-sm text-gray-800 dark:text-gray-200 whitespace-pre-wrap break-words",children:e.content})]}),o.map(function(l){return n.jsx(_A,{post:l,childrenByParent:t,depth:r+1,onDelete:a,t:i},l.id)})]})}function DW({detail:e,searchQuery:t,onSearchQueryChange:r,onSearch:a,onClearSearch:i,hasSearchResults:o,onDeleteTopic:l,onBack:u,onCloseTopic:d,t:f}){return n.jsxs("div",{className:"flex-shrink-0 flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-800",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{onClick:e?d:u,className:"p-1.5 rounded-lg text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors","aria-label":f(e?"board.back_to_topics":"board.back_to_chat"),children:n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18"})})}),n.jsxs("div",{children:[n.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:e?e.topic.title:f("board.title")}),n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:e?f("board.post_count",{count:(e.posts||[]).length}):f("board.read_only_hint")})]})]}),!e&&n.jsxs("form",{onSubmit:a,className:"flex items-center gap-2",children:[n.jsx("input",{type:"text",value:t,onChange:function(p){r(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-none focus:ring-2 focus:ring-primary-500"}),n.jsx("button",{type:"submit",className:"px-3 py-1.5 text-xs font-medium text-gray-600 dark:text-gray-300 bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-lg transition-colors",children:f("board.search")}),o&&n.jsx("button",{type:"button",onClick:i,className:"px-3 py-1.5 text-xs font-medium text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 transition-colors",children:f("board.clear_search")})]}),e&&n.jsxs("button",{type:"button",onClick:function(){l(e.topic.id)},className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg transition-colors",children:[n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),f("board.delete_topic")]})]})}function PW({detail:e,onDeletePost:t,t:r}){var a=OW(e.posts);return n.jsxs("div",{className:"max-w-3xl mx-auto px-6 py-4",children:[n.jsxs("div",{className:"pb-3 mb-2 border-b border-gray-200 dark:border-gray-800 text-xs text-gray-500 dark:text-gray-400 flex items-center gap-2",children:[n.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-300",children:e.topic.author}),n.jsx("span",{children:Tk(e.topic.createdAt)}),e.topic.category&&n.jsx("span",{className:"px-2 py-0.5 rounded-full bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400",children:e.topic.category})]}),a.topLevel.length===0?n.jsx("p",{className:"py-8 text-sm text-gray-400 dark:text-gray-500 text-center",children:r("board.no_posts")}):a.topLevel.map(function(i){return n.jsx(_A,{post:i,childrenByParent:a.childrenByParent,depth:0,onDelete:t,t:r},i.id)})]})}function FW({searchResults:e,onOpenTopic:t,t:r}){return n.jsxs("div",{className:"max-w-3xl mx-auto px-6 py-4",children:[n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-3",children:r("board.search_results",{count:e.total})}),(e.matches||[]).length===0?n.jsx("p",{className:"py-8 text-sm text-gray-400 dark:text-gray-500 text-center",children:r("board.no_matches")}):e.matches.map(function(a,i){return n.jsxs("button",{type:"button",onClick:function(){t(a.topicId)},className:"w-full text-left px-3 py-2 mb-2 rounded-lg border border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-900 transition-colors",children:[n.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:a.topicTitle}),n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 line-clamp-2",children:a.snippet})]},(a.postId||a.topicId)+":"+i)})]})}function BW({topics:e,offset:t,total:r,onOpenTopic:a,onPage:i,t:o}){var l=t-vv,u=t+vv,d=t>0,f=u<r;return n.jsxs("div",{className:"max-w-3xl mx-auto px-6 py-4",children:[e.length===0?n.jsx("p",{className:"py-8 text-sm text-gray-400 dark:text-gray-500 text-center",children:o("board.no_topics")}):e.map(function(p){return n.jsxs("button",{type:"button",onClick:function(){a(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:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:p.title}),p.category&&n.jsx("span",{className:"flex-shrink-0 px-2 py-0.5 rounded-full bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 text-xs",children:p.category})]}),n.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:[p.author," · ",Tk(p.createdAt)," ·"," ",o("board.post_count",{count:p.postCount})]})]},p.id)}),(d||f)&&n.jsxs("div",{className:"flex items-center justify-between mt-4",children:[n.jsx("button",{type:"button",disabled:!d,onClick:function(){i(l)},className:"px-3 py-1.5 text-xs font-medium text-gray-600 dark:text-gray-300 bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-lg transition-colors disabled:opacity-50",children:o("board.prev_page")}),n.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:o("board.page_info",{from:t+1,to:Math.min(u,r),total:r})}),n.jsx("button",{type:"button",disabled:!f,onClick:function(){i(u)},className:"px-3 py-1.5 text-xs font-medium text-gray-600 dark:text-gray-300 bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-lg transition-colors disabled:opacity-50",children:o("board.next_page")})]})]})}function zW({onBack:e}){var{t}=Jt(),[r,a]=x.useState([]),[i,o]=x.useState(0),[l,u]=x.useState(0),[d,f]=x.useState(!0),[p,h]=x.useState(null),[m,y]=x.useState(null),[v,k]=x.useState(""),[_,w]=x.useState(null),N=x.useCallback(async function(I){f(!0),h(null);try{var B=await sM({limit:vv,offset:I});a(B.topics||[]),o(B.total||0)}catch(z){h(z.message)}finally{f(!1)}},[]);x.useEffect(function(){N(0)},[N]);var E=x.useCallback(async function(I){f(!0),h(null),w(null);try{var B=await L_(I);y(B)}catch(z){h(z.message)}finally{f(!1)}},[]),A=x.useCallback(function(){y(null),N(l)},[N,l]),T=x.useCallback(async function(I){h(null);try{await lM(I),y(null),N(l)}catch(B){h(B.message)}},[N,l]),C=x.useCallback(async function(I){if(m){h(null);try{await cM(m.topic.id,I);var B=await L_(m.topic.id);y(B)}catch(z){h(z.message)}}},[m]),j=x.useCallback(async function(I){I.preventDefault();var B=v.trim();if(!B){w(null);return}f(!0),h(null);try{var z=await oM(B);w(z)}catch(ee){h(ee.message)}finally{f(!1)}},[v]),M=x.useCallback(function(){k(""),w(null)},[]),L=x.useCallback(function(I){u(I),N(I)},[N]);return n.jsxs("div",{className:"h-full flex flex-col bg-white dark:bg-gray-950 min-h-0",children:[n.jsx(DW,{detail:m,searchQuery:v,onSearchQueryChange:k,onSearch:j,onClearSearch:M,hasSearchResults:!!_,onDeleteTopic:T,onBack:e,onCloseTopic:A,t}),n.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0",children:[p&&n.jsx("div",{className:"mx-6 mt-4 px-3 py-2 text-sm text-red-700 dark:text-red-400 bg-red-50 dark:bg-red-900/20 rounded-lg",children:p}),d?n.jsx("div",{className:"flex items-center justify-center py-16",children:n.jsx("svg",{className:"w-6 h-6 animate-spin text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})}):m?n.jsx(PW,{detail:m,onDeletePost:C,t}):_?n.jsx(FW,{searchResults:_,onOpenTopic:E,t}):n.jsx(BW,{topics:r,offset:l,total:i,onOpenTopic:E,onPage:L,t})]})]})}var UW=["__proto__","constructor","prototype"];function Tb(){return{displayName:"",spec:"",limit:{context:128e3,output:8192},cost:{input:0,output:0}}}function qW(e){return{displayName:e.displayName||"",spec:e.url||e.target||"",limit:e.limit?{context:e.limit.context||128e3,output:e.limit.output||8192}:{context:128e3,output:8192},cost:e.cost?{input:e.cost.input||0,output:e.cost.output||0}:{input:0,output:0}}}function wA(e){if(!e)return null;var t=String(e).trim();return/^paves?:\/\//i.test(t)||/^https?:\/\//i.test(t)?"url":"target"}function x4(e){var t={limit:e.limit,cost:e.cost};e.displayName&&String(e.displayName).trim()!==""&&(t.displayName=String(e.displayName).trim());var r=e.spec?String(e.spec).trim():"";if(r){var a=wA(r);t[a]=r}return t}function y4(e){var t=e.name,r=e.config,a=e.setName,i=e.setConfig,o=e.onSave,l=e.onCancel,u=e.saving,d=e.isNew,f=e.t;function p(_){i(function(w){return Object.assign({},w,_)})}function h(_){i(function(w){return Object.assign({},w,{limit:Object.assign({},w.limit||{},_)})})}function m(_){i(function(w){return Object.assign({},w,{cost:Object.assign({},w.cost||{},_)})})}var y="w-full px-2 py-1 text-xs border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100",v="text-xs text-gray-500 dark:text-gray-400 block mb-0.5",k=wA(r.spec);return n.jsxs("div",{className:"p-3 rounded border border-primary-300 dark:border-primary-700 bg-primary-50/50 dark:bg-primary-900/20 space-y-2",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[n.jsxs("div",{className:"col-span-2",children:[n.jsx("label",{className:v,children:f("settings.model_registry.name")}),n.jsx("input",{type:"text",value:t,onChange:function(_){a(_.target.value)},className:y+" font-mono",placeholder:f("settings.model_registry.name_placeholder"),autoFocus:d})]}),n.jsxs("div",{className:"col-span-2",children:[n.jsxs("label",{className:v,children:[f("settings.model_registry.spec"),k&&n.jsx("span",{className:"ml-2 text-[10px] px-1.5 py-0.5 rounded bg-gray-200 dark:bg-gray-700 text-gray-600 dark:text-gray-300 uppercase tracking-wide",children:k==="url"?"URL":f("settings.model_registry.kind_alias")})]}),n.jsx("input",{type:"text",value:r.spec||"",onChange:function(_){p({spec:_.target.value})},className:y+" font-mono",placeholder:f("settings.model_registry.spec_placeholder")}),n.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-0.5",children:f("settings.model_registry.spec_hint")})]}),n.jsxs("div",{className:"col-span-2",children:[n.jsx("label",{className:v,children:f("settings.model_registry.displayName")}),n.jsx("input",{type:"text",value:r.displayName||"",onChange:function(_){p({displayName:_.target.value})},className:y,placeholder:f("settings.model_registry.displayName_placeholder")})]}),n.jsxs("details",{className:"col-span-2",children:[n.jsx("summary",{className:"cursor-pointer text-xs font-medium text-gray-600 dark:text-gray-300 select-none",children:f("settings.model_registry.advanced")}),n.jsxs("div",{className:"grid grid-cols-2 gap-3 pt-2",children:[n.jsxs("div",{children:[n.jsx("label",{className:v,children:f("settings.model_registry.limit_context")}),n.jsx("input",{type:"number",value:r.limit?r.limit.context:128e3,onChange:function(_){h({context:parseInt(_.target.value,10)||128e3})},className:y})]}),n.jsxs("div",{children:[n.jsx("label",{className:v,children:f("settings.model_registry.limit_output")}),n.jsx("input",{type:"number",value:r.limit?r.limit.output:8192,onChange:function(_){h({output:parseInt(_.target.value,10)||8192})},className:y})]}),n.jsxs("div",{children:[n.jsx("label",{className:v,children:f("settings.model_registry.cost_input")}),n.jsx("input",{type:"number",step:"0.01",min:"0",value:r.cost?r.cost.input:0,onChange:function(_){m({input:parseFloat(_.target.value)||0})},className:y})]}),n.jsxs("div",{children:[n.jsx("label",{className:v,children:f("settings.model_registry.cost_output")}),n.jsx("input",{type:"number",step:"0.01",min:"0",value:r.cost?r.cost.output:0,onChange:function(_){m({output:parseFloat(_.target.value)||0})},className:y})]})]})]})]}),n.jsxs("div",{className:"flex gap-2 pt-1",children:[n.jsx("button",{type:"button",onClick:o,disabled:u||!t||!t.trim(),className:"px-3 py-1 text-xs font-medium rounded bg-primary-600 text-white hover:bg-primary-700 disabled:opacity-50 transition-colors",children:f(u?d?"settings.model_registry.adding":"settings.model_registry.saving":d?"settings.model_registry.add":"settings.model_registry.save")}),n.jsx("button",{type:"button",onClick:l,disabled:u,className:"px-3 py-1 text-xs font-medium rounded bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600 disabled:opacity-50 transition-colors",children:f("settings.model_registry.cancel")})]})]})}function HW({value:e,onChange:t,t:r}){const[a,i]=x.useState(null),[o,l]=x.useState(!0),[u,d]=x.useState(null),[f,p]=x.useState(!1),[h,m]=x.useState(""),[y,v]=x.useState(Tb()),[k,_]=x.useState(null),[w,N]=x.useState(!1),[E,A]=x.useState(null);x.useEffect(function(){var V=!1;return l(!0),o4().then(function(D){V||(i(D),l(!1))}).catch(function(D){V||(d(D.message),l(!1))}),function(){V=!0}},[]);var T=x.useCallback(function(){l(!0),d(null),o4().then(function(V){i(V),l(!1)}).catch(function(V){d(V.message),l(!1)})},[]);function C(V,D,K){var H=(V||"").trim();return H?UW.indexOf(H)!==-1?r("settings.model_registry.error_name_reserved",{name:H}):H!==K&&D.indexOf(H)!==-1?r("settings.model_registry.error_name_exists",{name:H}):null:r("settings.model_registry.error_name_required")}var j=x.useCallback(async function(){if(a){var V=Object.keys(a.user||{}).concat(Object.keys(a.builtin||{})),D=C(h,V,null);if(D){A(D);return}N(!0),A(null);try{await l4(h.trim(),x4(y)),p(!1),m(""),v(Tb()),T(),t&&t(e)}catch(K){A(K.message)}finally{N(!1)}}},[h,y,a,t,e,T]),M=x.useCallback(async function(V){N(!0),A(null);try{await c4(V),T(),t&&t(e)}catch(D){A(D.message)}finally{N(!1)}},[t,e,T]),L=x.useCallback(async function(){if(!(!k||!a)){var V=Object.keys(a.user||{}).concat(Object.keys(a.builtin||{})),D=C(k.name,V,k.originalName);if(D){A(D);return}N(!0),A(null);try{var K=k.name.trim(),H=x4(k.config);if(await l4(K,H),K!==k.originalName)try{await c4(k.originalName)}catch(J){A(r("settings.model_registry.error_rename_cleanup",{error:J.message}))}_(null),T(),t&&t(e)}catch(J){A(J.message)}finally{N(!1)}}},[k,a,t,e,T]);if(o)return n.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500 dark:text-gray-400 py-2",children:[n.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-primary-600"}),r("settings.model_registry.loading")]});if(u)return n.jsx("div",{className:"text-sm text-red-600 dark:text-red-400 py-2",children:r("settings.model_registry.load_error",{error:u})});var I=a&&a.user?a.user:{},B=a&&a.builtin?a.builtin:{},z=Object.keys(I),ee=Object.keys(B);return n.jsxs("div",{className:"space-y-3",children:[E&&n.jsx("div",{className:"text-xs text-red-600 dark:text-red-400 bg-red-50 dark:bg-red-900/20 rounded px-2 py-1",children:E}),ee.length>0&&n.jsxs("div",{children:[n.jsx("h4",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-2",children:r("settings.model_registry.builtin")}),n.jsx("div",{className:"space-y-1",children:ee.map(function(V){var D=B[V];return n.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded bg-gray-50 dark:bg-gray-800/50 text-sm",children:[n.jsx("span",{className:"font-mono font-medium text-gray-900 dark:text-gray-100",children:V}),D.provider&&n.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:D.provider}),D.limit&&D.limit.context&&n.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:r("settings.model_registry.context_k",{value:D.limit.context/1e3})}),D.tier&&n.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-gray-200 dark:bg-gray-700 text-gray-600 dark:text-gray-300",children:D.tier})]},V)})})]}),n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsx("h4",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:r("settings.model_registry.user")}),!f&&!k&&n.jsx("button",{type:"button",onClick:function(){p(!0),m(""),v(Tb()),A(null)},className:"text-xs px-2 py-1 rounded bg-primary-50 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400 hover:bg-primary-100 dark:hover:bg-primary-900/50 transition-colors",children:r("settings.model_registry.add_model")})]}),z.length===0&&!f&&n.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 italic",children:r("settings.model_registry.no_user_models")}),n.jsxs("div",{className:"space-y-2",children:[z.map(function(V){var D=I[V];return k&&k.originalName===V?n.jsx(y4,{name:k.name,config:k.config,setName:function(K){_(function(H){return H&&Object.assign({},H,{name:K})})},setConfig:function(K){_(function(H){if(!H)return H;var J=typeof K=="function"?K(H.config):K;return Object.assign({},H,{config:J})})},onSave:L,onCancel:function(){_(null),A(null)},saving:w,isNew:!1,t:r},V):n.jsxs("div",{className:"flex items-center justify-between px-2 py-1.5 rounded border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50",children:[n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[n.jsx("span",{className:"font-mono text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:V}),D.displayName&&D.displayName!==V&&n.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:["(",D.displayName,")"]}),D.url&&n.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400 font-mono truncate",children:["→ ",D.url]}),!D.url&&D.target&&n.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400 font-mono",children:["→ ",D.target]}),D.limit&&D.limit.context&&n.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:r("settings.model_registry.context_k",{value:D.limit.context/1e3})})]}),n.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[n.jsx("button",{type:"button",onClick:function(){_({originalName:V,name:V,config:qW(D)}),p(!1),A(null)},className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors",title:r("settings.model_registry.edit"),children:n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),n.jsx("button",{type:"button",onClick:function(){window.confirm(r("settings.model_registry.delete_confirm",{name:V}))&&M(V)},disabled:w,className:"p-1 rounded hover:bg-red-100 dark:hover:bg-red-900/30 text-gray-400 hover:text-red-600 dark:hover:text-red-400 transition-colors",title:r("settings.model_registry.delete"),children:n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]})]},V)}),f&&n.jsx(y4,{name:h,config:y,setName:m,setConfig:function(V){v(function(D){return typeof V=="function"?V(D):V})},onSave:j,onCancel:function(){p(!1),A(null)},saving:w,isNew:!0,t:r})]})]})]})}function $W({setting:e,value:t,onChange:r,error:a,models:i,t:o}){const[l,u]=x.useState(!1),d=e.source==="env",f="block w-full rounded-md border px-3 py-2 text-sm transition-colors bg-white dark:bg-gray-900 "+(a?"border-red-300 dark:border-red-600 focus:ring-red-500 focus:border-red-500":"border-gray-300 dark:border-gray-600 focus:ring-primary-500 focus:border-primary-500")+(d?" opacity-60 cursor-not-allowed":"")+" text-gray-900 dark:text-gray-100",p=e.type==="model-select"&&i&&i.length>0&&t&&!i.find(function(m){return m.id===t});if(x.useEffect(function(){e.type!=="model-select"||!i||i.length===0||t&&i.find(function(m){return m.id===t})&&u(!1)},[t,i,e.type]),e.type==="model-select"){if(!i||i.length===0)return n.jsxs("div",{children:[n.jsx("input",{type:"text",value:t,onChange:function(v){r(v.target.value)},disabled:d,placeholder:e.defaultValue||o("settings.custom_model_placeholder"),className:f}),a&&n.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:a})]});const m=l||p,y=jk(i);return n.jsxs("div",{children:[n.jsxs("select",{value:m?"__custom__":t,onChange:function(v){v.target.value==="__custom__"?u(!0):(u(!1),r(v.target.value))},disabled:d,className:f,children:[Object.entries(y).map(function(v){var k=v[0],_=v[1];return n.jsx("optgroup",{label:Nk[k]||k,children:_.map(function(w){return n.jsxs("option",{value:w.id,children:[w.name,Ek(w.tier)]},w.id)})},k)}),n.jsx("option",{value:"__custom__",children:o("settings.custom_model")})]}),m&&n.jsx("input",{type:"text",value:t,onChange:function(v){r(v.target.value)},disabled:d,placeholder:o("settings.custom_model_placeholder"),className:f+" mt-2 font-mono"}),a&&n.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:a})]})}if(e.type==="boolean"){const m=typeof t=="string"?t.toLowerCase():String(t),y=m==="true"||m==="1";return n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{type:"button",role:"switch","aria-checked":y,"aria-label":e.label,disabled:d,onClick:function(){r(y?"false":"true")},className:"relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 "+(y?"bg-primary-600":"bg-gray-200 dark:bg-gray-600")+(d?" opacity-50 cursor-not-allowed":""),children:n.jsx("span",{"aria-hidden":"true",className:"pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out "+(y?"translate-x-5":"translate-x-0")})}),n.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:o(y?"settings.enabled":"settings.disabled")})]}),a&&n.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:a})]})}if(e.type==="select")return n.jsxs("div",{children:[n.jsx("select",{value:t,onChange:function(m){r(m.target.value)},disabled:d,className:f,children:(e.options||[]).map(function(m){var y=e.optionLabels&&e.optionLabels[m]||m;return n.jsx("option",{value:m,children:y},m)})}),a&&n.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:a})]});if(e.type==="number")return n.jsxs("div",{children:[n.jsx("input",{type:"number",value:t,onChange:function(m){r(m.target.value)},disabled:d,min:e.min,max:e.max,placeholder:e.defaultValue||o("settings.not_set"),className:f}),a&&n.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:a})]});if(e.type==="textarea")return n.jsxs("div",{children:[n.jsx("textarea",{value:t,onChange:function(m){r(m.target.value)},disabled:d,placeholder:e.defaultValue||o("settings.not_set"),className:f+" resize-y min-h-[80px]",rows:4}),a&&n.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:a})]});if(e.type==="object")return n.jsxs("div",{children:[n.jsx(HW,{value:t,onChange:r,t:o}),a&&n.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:a})]});const h=e.type==="password"?"password":"text";return n.jsxs("div",{children:[n.jsx("input",{type:h,value:t,onChange:function(m){r(m.target.value)},disabled:d,placeholder:e.defaultValue||o("settings.not_set"),className:f,autoComplete:e.type==="password"?"off":void 0}),a&&n.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:a})]})}let hi=null;function SA(){if(hi&&hi.state==="closed"&&(hi=null),!hi){const e=window.AudioContext||window.webkitAudioContext;if(!e)return null;try{hi=new e}catch(t){throw hi=null,t}}return hi.state==="suspended"&&hi.resume().catch(()=>{}),hi}if(typeof document<"u"){const e=async()=>{let t;try{t=SA()}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"&&(hi=null)};document.addEventListener("click",e),document.addEventListener("keydown",e)}function NA(){let e;try{e=SA()}catch{return}if(e)try{const t=e.currentTime,r=e.createOscillator(),a=e.createGain();r.type="sine",r.frequency.value=800,a.gain.setValueAtTime(.3,t),a.gain.exponentialRampToValueAtTime(.01,t+.1),r.connect(a),a.connect(e.destination),r.start(t),r.stop(t+.1);const i=e.createOscillator(),o=e.createGain();i.type="sine",i.frequency.value=1e3,o.gain.setValueAtTime(.3,t+.1),o.gain.exponentialRampToValueAtTime(.01,t+.2),i.connect(o),o.connect(e.destination),i.start(t+.1),i.stop(t+.2)}catch{e&&e.state!=="closed"&&e.close().catch(()=>{}),hi=null}}function EA(){try{return localStorage.getItem("pave-notification-sound")!=="false"}catch{return!0}}function WW(e){try{localStorage.setItem("pave-notification-sound",e?"true":"false")}catch{}}const jA="pave-native-notifications";function yu(){return typeof Notification<"u"&&typeof Notification.requestPermission=="function"}function VW(){return yu()?Notification.permission:"unsupported"}function nu(){if(!yu()||Notification.permission!=="granted")return!1;try{return localStorage.getItem(jA)==="true"}catch{return!1}}function GW(e){try{localStorage.setItem(jA,e?"true":"false")}catch{}}async function KW(){if(!yu())return"unsupported";try{return await Notification.requestPermission()}catch{return"denied"}}function CA({title:e,body:t,tag:r,icon:a,onClick:i}){if(!yu()||Notification.permission!=="granted"||!nu())return null;try{const o=new Notification(e,{body:t||"",tag:r||"pave-"+Date.now(),icon:a||"/pave-logo-light.png",silent:!1});return typeof i=="function"&&(o.onclick=function(){i(),o.close()}),setTimeout(()=>{try{o.close()}catch{}},8e3),o}catch{return null}}const TA="pave-push-notifications",YW="/sw.js";function Vf(){return typeof navigator<"u"&&typeof navigator.serviceWorker<"u"&&typeof window<"u"&&typeof PushManager<"u"}function XW(){try{return window.matchMedia("(display-mode: standalone)").matches||typeof navigator.standalone=="boolean"&&navigator.standalone}catch{return!1}}function QW(){try{return localStorage.getItem(TA)==="true"}catch{return!1}}function gf(e){try{localStorage.setItem(TA,e?"true":"false")}catch{}}function Rb(){return typeof Notification>"u"?"unsupported":Notification.permission}async function ZW(){if(!Vf())return null;try{return await navigator.serviceWorker.register(YW,{scope:"/"})}catch(e){return console.error("[web-push] SW registration failed:",e.message),null}}async function JW(){if(!Vf())return console.warn("[web-push] Not supported in this browser"),!1;const e=await ZW();if(!e)return!1;if(Notification.permission!=="granted"&&await Notification.requestPermission()!=="granted")return console.warn("[web-push] Notification permission denied"),!1;let t;try{const a=await fetch("/api/push/vapid-public-key",{credentials:"include"});if(!a.ok)throw new Error("Failed to get VAPID key");const i=await a.json();t=iV(i.publicKey)}catch(a){return console.error("[web-push] Failed to get VAPID key:",a.message),!1}let r=await e.pushManager.getSubscription();if(r){let a=!0;if(r.options&&r.options.applicationServerKey){const i=new Uint8Array(r.options.applicationServerKey);a=aV(i,t)}if(a)return await b4(r),gf(!0),!0;console.log("[web-push] VAPID key changed, re-subscribing...");try{await r.unsubscribe()}catch{}}try{r=await e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:t})}catch(a){return console.error("[web-push] Push subscription failed:",a.message),!1}return await b4(r),gf(!0),console.log("[web-push] Subscribed successfully:",r.endpoint),!0}async function eV(){if(!Vf())return!1;try{const e=await navigator.serviceWorker.getRegistration();if(e){const t=await e.pushManager.getSubscription();t&&(await fetch("/api/push/unsubscribe",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({endpoint:t.endpoint})}).catch(()=>{}),await t.unsubscribe())}return gf(!1),console.log("[web-push] Unsubscribed"),!0}catch(e){return console.error("[web-push] Unsubscribe failed:",e.message),gf(!1),!1}}async function b4(e){let t;typeof e.toJSON=="function"?t=e.toJSON():t={endpoint:e.endpoint,keys:{p256dh:v4(e.getKey("p256dh")),auth:v4(e.getKey("auth"))}},await fetch("/api/push/subscribe",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(t)})}async function tV(){const e=await fetch("/api/push/test",{method:"POST",credentials:"include"});if(!e.ok)throw new Error("Test push failed");return e.json()}function rV(e){if(typeof document>"u"||typeof window>"u")return;function t(r){const a=typeof e=="function"?e():null,i=JSON.stringify({visible:r,activeSessionId:a});try{if(navigator.sendBeacon){const o=new Blob([i],{type:"application/json"});navigator.sendBeacon("/api/visibility",o);return}fetch("/api/visibility",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:i}).catch(()=>{})}catch{}}document.addEventListener("visibilitychange",()=>{t(document.visibilityState==="visible")}),window.addEventListener("blur",()=>{t(!1)}),window.addEventListener("focus",()=>{t(!0)}),t(document.visibilityState==="visible")}function nV(e,t){if(typeof document>"u")return;const r=JSON.stringify({visible:e,activeSessionId:t});try{if(navigator.sendBeacon){const a=new Blob([r],{type:"application/json"});navigator.sendBeacon("/api/visibility",a);return}fetch("/api/visibility",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:r}).catch(()=>{})}catch{}}function aV(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function iV(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4),a=atob(t+r),i=new Uint8Array(a.length);for(let o=0;o<a.length;o++)i[o]=a.charCodeAt(o);return i}function v4(e){if(!e)return"";const t=new Uint8Array(e);let r="";for(let a=0;a<t.length;a++)r+=String.fromCharCode(t[a]);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}const bu="p-4 rounded-lg border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900";function Rk({t:e}){return n.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-0.5",children:e("settings.auto_saved")})}function Gf({id:e,label:t,description:r,hints:a,checked:i,onToggle:o,disabled:l,supported:u=!0,unsupportedText:d="",divided:f=!1}){return n.jsxs("div",{className:"flex items-center justify-between"+(f?" mt-4 pt-4 border-t border-gray-200 dark:border-gray-700":""),children:[n.jsxs("div",{children:[n.jsx("label",{htmlFor:e,className:"text-sm font-medium text-gray-900 dark:text-gray-100 block",children:t}),n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:r}),a]}),u?n.jsx("button",{id:e,type:"button",role:"switch","aria-checked":i,onClick:o,disabled:l,className:"relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 disabled:opacity-50 "+(i?"bg-primary-600":"bg-gray-200 dark:bg-gray-700"),children:n.jsx("span",{className:"pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out "+(i?"translate-x-5":"translate-x-0")})}):n.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 italic",children:d})]})}function sV(){const{t:e,locale:t,setLocale:r,availableLocales:a}=Jt();return n.jsxs("div",{className:bu,children:[n.jsx("label",{htmlFor:"settings-language",className:"text-sm font-medium text-gray-900 dark:text-gray-100 block mb-1",children:e("settings.language")}),n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:e("settings.language_description")}),n.jsx("select",{id:"settings-language",value:t,onChange:function(i){r(i.target.value)},className:"block w-full rounded-md border px-3 py-2 text-sm transition-colors bg-white dark:bg-gray-900 border-gray-300 dark:border-gray-600 focus:ring-primary-500 focus:border-primary-500 text-gray-900 dark:text-gray-100",children:a.map(function(i){return n.jsxs("option",{value:i.code,children:[i.nativeName," (",i.name,")"]},i.code)})}),n.jsx("p",{className:"text-xs text-green-600 dark:text-green-400 mt-1",children:e("settings.language_auto_applied")})]})}function oV(){const{t:e}=Jt(),[t,r]=x.useState(()=>EA()),a=x.useCallback(function(){const i=!t;r(i),WW(i),i&&NA()},[t]);return n.jsxs("div",{className:bu,children:[n.jsx(Gf,{id:"settings-notification-sound",label:e("settings.notification_sound"),description:e("settings.notification_sound_desc"),hints:n.jsx(Rk,{t:e}),checked:t,onToggle:a}),n.jsx(lV,{}),n.jsx(cV,{})]})}function lV(){const{t:e}=Jt(),[t]=x.useState(()=>yu()),[r,a]=x.useState(()=>VW()),[i,o]=x.useState(()=>nu()),l=x.useCallback(async function(){if(!t)return;if(!i&&Notification.permission!=="granted"){const d=await KW();if(a(d),d!=="granted")return}const u=!i;o(u),GW(u)},[i,t]);return n.jsx(Gf,{id:"settings-native-notifications",divided:!0,label:e("settings.native_notifications"),description:e("settings.native_notifications_desc"),hints:n.jsxs(n.Fragment,{children:[r==="denied"&&n.jsx("p",{className:"text-xs text-red-500 dark:text-red-400 mt-0.5",children:e("settings.native_notifications_blocked")}),r==="default"&&n.jsx("p",{className:"text-xs text-amber-500 dark:text-amber-400 mt-0.5",children:e("settings.native_notifications_permission")}),n.jsx(Rk,{t:e})]}),checked:i,onToggle:l,supported:t,unsupportedText:e("settings.native_notifications_unsupported")})}function cV(){const[e]=x.useState(()=>Vf()),[t,r]=x.useState(()=>QW()),[a,i]=x.useState(()=>Rb()),[o,l]=x.useState(!1),u=x.useCallback(async function(){if(!(!e||o)){l(!0);try{t?(await eV(),r(!1)):(await JW()&&r(!0),i(Rb()))}catch(f){console.error("[settings] Web push toggle failed:",f.message)}finally{l(!1)}}},[t,e,o]),d=x.useCallback(async function(){if(!o){l(!0);try{const f=await tV();f.sent>0?alert("Test push sent! Check your device."):f.failed>0?alert("Push delivery failed ("+f.failed+" failed). Check server logs — the subscription may need to be renewed."):alert("No active push subscriptions. Make sure you enabled push and your device is registered.")}catch(f){alert("Test push failed: "+f.message)}finally{l(!1)}}},[o]);return n.jsx(Gf,{id:"settings-web-push",divided:!0,label:"Push Notifications (PWA)",description:"Server-delivered push when you switch away from the app. Works on iOS Safari (installed to Home Screen) and desktop browsers.",hints:n.jsxs(n.Fragment,{children:[e&&!XW()&&n.jsx("p",{className:"text-xs text-amber-500 dark:text-amber-400 mt-0.5",children:"Add to Home Screen / Dock for background push on iOS."}),a==="denied"&&n.jsx("p",{className:"text-xs text-red-500 dark:text-red-400 mt-0.5",children:"Notifications blocked by browser — enable in browser settings."}),t&&n.jsx("button",{type:"button",onClick:d,disabled:o,className:"text-xs text-primary-600 dark:text-primary-400 hover:underline mt-1 disabled:opacity-50",children:o?"Sending...":"Send test notification"})]}),checked:t,onToggle:u,disabled:o,supported:e,unsupportedText:"Not supported in this browser"})}function uV({mobileFrameless:e,onMobileFramelessChange:t}){const{t:r}=Jt();return n.jsx("div",{className:bu,children:n.jsx(Gf,{id:"settings-mobile-frameless",label:r("settings.mobile_frameless"),description:r("settings.mobile_frameless_desc"),hints:n.jsx(Rk,{t:r}),checked:e,onToggle:()=>t(!e)})})}function dV({activeSessionId:e}){const{t}=Jt(),[r,a]=x.useState(()=>Nl()||""),[i,o]=x.useState(()=>Nl()||""),[l,u]=x.useState(""),[d,f]=x.useState(null),[p,h]=x.useState(!1),[m,y]=x.useState(null);x.useEffect(function(){qb().then(function(w){u(w.home||"")}).catch(function(){})},[]);const v=x.useCallback(function(w){a(w),f(null),y(null)},[]),k=x.useCallback(async function(){const w=r.trim();if(!w){if(vg(null),o(""),a(""),f(null),y({type:"success",message:t("settings.working_dir_reset")}),e)try{await Xa(e,{directory:null})}catch(E){console.warn("[settings] failed to clear session directory:",E.message)}return}h(!0),f(null);const N=Nl();try{vg(w);const E=await qb();if(o(w),a(w),y({type:"success",message:t("settings.working_dir_updated",{path:E.cwd})}),e)try{await Xa(e,{directory:w})}catch(A){console.warn("[settings] failed to update session directory:",A.message)}}catch(E){vg(N),a(i),f(t("settings.working_dir_invalid",{error:E.message}))}finally{h(!1)}},[r,i,e,t]),_=r!==i;return n.jsxs("div",{className:bu,children:[n.jsx("label",{htmlFor:"settings-working-dir",className:"text-sm font-medium text-gray-900 dark:text-gray-100 block mb-1",children:t("settings.working_dir")}),n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:t("settings.working_dir_desc")}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("input",{id:"settings-working-dir",type:"text",value:r,onChange:function(w){v(w.target.value)},placeholder:l||"~ (home directory)",className:"flex-1 block rounded-md border px-3 py-2 text-sm transition-colors bg-white dark:bg-gray-900 "+(d?"border-red-300 dark:border-red-600 focus:ring-red-500 focus:border-red-500":"border-gray-300 dark:border-gray-600 focus:ring-primary-500 focus:border-primary-500")+" text-gray-900 dark:text-gray-100"}),n.jsx("button",{onClick:k,disabled: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&&n.jsx("p",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:d}),m&&n.jsx("p",{className:"mt-2 text-xs "+(m.type==="success"?"text-green-600 dark:text-green-400":m.type==="error"?"text-red-600 dark:text-red-400":"text-amber-600 dark:text-amber-400"),children:m.message}),i&&n.jsx("p",{className:"mt-2 text-xs text-gray-400 dark:text-gray-500",children:t("settings.currently_set_to",{path:i})})]})}function fV(){const{t:e}=Jt(),[t,r]=x.useState("checking"),[a,i]=x.useState(null),[o,l]=x.useState(null),[u,d]=x.useState(null),f=x.useCallback(function(m){i(m.currentVersion),l(m.latestVersion),m.error?(d(m.error),r("check-error")):m.updateAvailable?r("update-available"):r("no-updates")},[]),p=x.useCallback(async function(){r("checking"),d(null);try{const m=await jb();f(m)}catch(m){d(m.message),r("check-error")}},[f]),h=x.useCallback(async function(){r("updating"),d(null);try{await mW(),r("success");try{const m=await jb();i(m.currentVersion),l(m.latestVersion)}catch{}}catch(m){d(m.message),r("error")}},[]);return x.useEffect(function(){var m=!1;return r("checking"),(async function(){try{const v=await jb();m||f(v)}catch(v){m||(d(v&&v.message?v.message:String(v)),r("check-error"))}})(),function(){m=!0}},[f]),n.jsx("div",{className:bu,children:n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:e("settings.current_version")}),n.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400 font-mono",children:a||"--"})]}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:e("settings.latest_version")}),n.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400 font-mono",children:t==="checking"?e("settings.checking_updates"):o||"--"})]}),n.jsx(pV,{t:e,updateStatus:t,updateError:u,latestVersion:o}),n.jsx(gV,{t:e,updateStatus:t,onCheckUpdates:p,onPerformUpdate:h})]})})}function pV({t:e,updateStatus:t,updateError:r,latestVersion:a}){return n.jsxs(n.Fragment,{children:[t==="update-available"&&n.jsxs("p",{className:"text-xs text-green-600 dark:text-green-400 font-medium",children:[e("settings.update_available")," (",a,")"]}),t==="no-updates"&&n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:e("settings.no_updates")}),t==="success"&&n.jsx("p",{className:"text-xs text-green-600 dark:text-green-400",children:e("settings.update_success")}),t==="check-error"&&r&&n.jsxs("p",{className:"text-xs text-red-600 dark:text-red-400",children:[e("settings.check_updates_failed"),": ",r]}),t==="error"&&r&&n.jsxs("p",{className:"text-xs text-red-600 dark:text-red-400",children:[e("settings.update_failed"),": ",r]})]})}function gV({t:e,updateStatus:t,onCheckUpdates:r,onPerformUpdate:a}){const i=t==="idle"||t==="no-updates"||t==="error"||t==="check-error"||t==="success";return n.jsxs("div",{className:"flex gap-2 pt-1",children:[i&&n.jsx("button",{onClick:r,className:"px-3 py-1.5 text-sm font-medium rounded-md bg-primary-600 text-white hover:bg-primary-700 transition-colors",children:e("settings.check_updates")}),t==="update-available"&&n.jsx("button",{onClick:a,className:"px-3 py-1.5 text-sm font-medium rounded-md bg-green-600 text-white hover:bg-green-700 transition-colors",children:e("settings.update_button")}),t==="updating"&&n.jsx("button",{disabled:!0,"aria-disabled":"true",className:"px-3 py-1.5 text-sm font-medium rounded-md bg-gray-200 dark:bg-gray-700 text-gray-400 dark:text-gray-500 cursor-not-allowed",children:e("settings.update_in_progress")}),t==="checking"&&n.jsx("button",{disabled:!0,"aria-disabled":"true",className:"px-3 py-1.5 text-sm font-medium rounded-md bg-gray-200 dark:bg-gray-700 text-gray-400 dark:text-gray-500 cursor-not-allowed",children:e("settings.checking_updates")})]})}function kv(e){const t={};for(let r=0;r<e.length;r++)t[e[r].key]=e[r].value;return t}function hV(e,t){const r={};for(let a=0;a<e.length;a++){const i=e[a];i.source!=="env"&&t[i.key]!==i.value&&(r[i.key]=t[i.key])}return r}function mV(e,t,r){const a=kv(e);for(let i=0;i<r.length;i++)t[r[i]]!==void 0&&(a[r[i]]=t[r[i]]);return a}function xV(e){const t={};for(let r=0;r<e.length;r++){const a=e[r].category;t[a]||(t[a]=[]),t[a].push(e[r])}return t}function yV(e,t){const r=[];for(let i=0;i<t.length;i++)e[t[i]]&&r.push(t[i]);const a=Object.keys(e);for(let i=0;i<a.length;i++)r.indexOf(a[i])<0&&r.push(a[i]);return r}const bV=["AI Model & Provider","Prefill Fallback","Models","Compaction","Tool Execution","Rate Limiting","Session Behavior","Display","Session Banner","Marketplace","System Prompts","WhatsApp","Experimental Features","Developer"],hf={"AI Model & Provider":"settings.category.model","Prefill Fallback":"settings.category.prefillFallback",Models:"settings.category.models",Compaction:"settings.category.compaction","Tool Execution":"settings.category.tools","Rate Limiting":"settings.category.rate","Session Behavior":"settings.category.sessionBehavior",Display:"settings.category.display","Session Banner":"settings.category.sessionBanner",Marketplace:"settings.category.marketplace","System Prompts":"settings.category.systemPrompts",WhatsApp:"settings.category.whatsapp","Experimental Features":"settings.category.experimental",Developer:"settings.category.developer"};function vV(){const{t:e}=Jt(),[t,r]=x.useState([]),[a,i]=x.useState({}),[o,l]=x.useState({}),[u,d]=x.useState(!0),[f,p]=x.useState(!1),[h,m]=x.useState(null),[y,v]=x.useState(null),k=x.useCallback(async()=>{try{d(!0),v(null);const C=(await Hb()).settings||[];r(C),i(kv(C)),l({}),m(null)}catch(T){v(T.message)}finally{d(!1)}},[]),_=x.useCallback((T,C)=>{i(j=>{const M={...j};return M[T]=C,M}),l(j=>{if(!j[T])return j;const{[T]:M,...L}=j;return L}),m(null)},[]),w=hV(t,a),N=Object.keys(w).length,E=x.useCallback(async()=>{p(!0),m(null);try{if(N===0){m({type:"info",message:e("settings.no_changes")});return}const T=await H3(w),C=Object.keys(T.errors||{});try{window.dispatchEvent(new CustomEvent("pave:settings-updated",{detail:{keys:Object.keys(w)}}))}catch{}if(C.length>0?(l(T.errors),m({type:"warning",message:e("settings.partial_save")})):(l({}),m({type:"success",message:e("settings.saved")})),T.settings){const j=T.settings;r(j),i(M=>mV(j,M,C))}}catch(T){m({type:"error",message:e("settings.save_failed",{error:T.message})})}finally{p(!1)}},[w,N,e]),A=x.useCallback(()=>{i(kv(t)),l({}),m(null)},[t]);return{settings:t,formValues:a,errors:o,loading:u,saving:f,saveResult:h,setSaveResult:m,loadError:y,updates:w,changedCount:N,loadSettings:k,handleChange:_,handleSave:E,handleReset:A}}function kV(){return n.jsx("div",{className:"flex items-center justify-center h-full",children:n.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary-600"})})}function _V({t:e,loadError:t,onRetry:r}){return n.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4",children:[n.jsx("p",{className:"text-red-600 dark:text-red-400",children:e("settings.failed_to_load",{error:t})}),n.jsx("button",{onClick:r,className:"px-4 py-2 bg-primary-600 text-white rounded-lg hover:bg-primary-700",children:e("common.retry")})]})}const RA="__dlp__",AA="__pricing__",IA="__chat_language__",MA="__chat_notifications__",LA="__chat_appearance__",OA="__chat_workspace__",DA="__chat_version__",k4={[IA]:sV,[MA]:oV,[LA]:uV,[OA]:dV,[DA]:fV};function wV(e,t){return t?e.filter(function(r){return(r.key||"").toLowerCase().indexOf(t)>=0||(r.label||"").toLowerCase().indexOf(t)>=0||(r.description||"").toLowerCase().indexOf(t)>=0}):null}function SV(e){const t={};if(!e)return t;for(let r=0;r<e.length;r++){const a=e[r].category;t[a]=(t[a]||0)+1}return t}function NV({t:e,search:t,onSearchChange:r,onBack:a}){return n.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:[n.jsx("button",{onClick:a,className:"p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500 dark:text-gray-400 transition-colors",title:e("settings.back"),"aria-label":e("settings.back"),children:n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 19l-7-7m0 0l7-7m-7 7h18"})})}),n.jsxs("div",{className:"min-w-0",children:[n.jsx("h1",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:e("settings.title")}),n.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:e("settings.v2.badge")})]}),n.jsxs("div",{className:"flex-1 max-w-md ml-auto relative",children:[n.jsx("svg",{className:"w-4 h-4 absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 dark:text-gray-500 pointer-events-none",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-4.35-4.35M17 10.5a6.5 6.5 0 11-13 0 6.5 6.5 0 0113 0z"})}),n.jsx("input",{id:"settings-v2-search",type:"text",value:t,onChange:function(i){r(i.target.value)},placeholder:e("settings.v2.search_placeholder"),"aria-label":e("settings.v2.search_placeholder"),className:"block w-full rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-900 pl-9 pr-8 py-1.5 text-sm text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500"}),t&&n.jsx("button",{type:"button",onClick:function(){r("")},title:e("settings.v2.search_clear"),"aria-label":e("settings.v2.search_clear"),className:"absolute right-2 top-1/2 -translate-y-1/2 p-0.5 rounded text-gray-400 hover:text-gray-600 dark:hover:text-gray-200",children:n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})]})}function EV({t:e,groups:t,activeGroup:r,matchCounts:a,searching:i,onSelect:o}){return n.jsx("nav",{"aria-label":e("settings.v2.groups_aria"),className:"w-52 flex-shrink-0 border-r border-gray-200 dark:border-gray-700 overflow-y-auto py-2","data-testid":"settings-v2-groups",children:t.map(function(l){const u=!i&&l.id===r,d=i?a[l.id]:l.kind==="registry"?l.count:null,f=!i||a[l.id];return n.jsxs("button",{type:"button",onClick:function(){o(l.id)},"aria-current":u?"page":void 0,className:"w-full flex items-center justify-between gap-2 px-3 py-2 text-left text-sm transition-colors "+(u?"bg-primary-50 dark:bg-primary-900/20 text-primary-700 dark:text-primary-300 font-medium border-r-2 border-primary-600":"text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800/60"),children:[n.jsx("span",{className:"truncate",children:l.label}),f&&d!=null&&n.jsx("span",{className:"text-[10px] text-gray-400 dark:text-gray-500 tabular-nums flex-shrink-0",children:d})]},l.id)})})}function jV({setting:e,formValue:t,error:r,models:a,t:i,onChange:o}){const l=e.source==="env";return n.jsxs("div",{className:"p-4 rounded-lg border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900","data-setting-key":e.key,children:[n.jsxs("div",{className:"flex items-start justify-between gap-3 mb-2",children:[n.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:e.label}),l&&n.jsx("span",{className:"text-[10px] uppercase tracking-wide px-1.5 py-0.5 rounded bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300 whitespace-nowrap",title:i("settings.env_override",{envVar:e.envVar}),children:i("settings.source_env")})]}),n.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2 break-words",children:[e.description,e.requiresRestart&&n.jsx("span",{className:"ml-1 text-amber-600 dark:text-amber-400 font-medium",children:i("settings.requires_restart")}),e.source==="env"&&n.jsx("span",{className:"block mt-1 text-amber-600 dark:text-amber-400",children:i("settings.env_override",{envVar:e.envVar})}),n.jsx("span",{className:"block mt-0.5 font-mono text-[10px] text-gray-400 dark:text-gray-500",children:e.key})]}),n.jsx($W,{setting:e,value:t!==void 0?t:"",onChange:o,error:r,models:a,t:i}),e.source!=="default"&&e.defaultValue!==void 0&&e.type!=="object"&&n.jsx("p",{className:"mt-1 text-xs text-gray-400 dark:text-gray-500",children:i("settings.default_prefix",{value:e.defaultValue===""?i("settings.default_empty"):String(e.defaultValue)})})]})}function _4({title:e,description:t,actionLabel:r,onOpen:a}){return n.jsxs("div",{className:"p-6 rounded-lg border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900",children:[n.jsx("h3",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100 mb-2",children:e}),n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-4",children:t}),n.jsx("button",{type:"button",onClick:a,className:"px-3 py-1.5 text-sm font-medium rounded-md bg-primary-600 text-white hover:bg-primary-700 transition-colors",children:r})]})}function CV({t:e,changedCount:t,saving:r,saveResult:a,onSave:i,onReset:o}){const l=a?a.type==="success"?"text-green-600 dark:text-green-400":a.type==="error"?"text-red-600 dark:text-red-400":"text-amber-600 dark:text-amber-400":"";return n.jsxs("div",{className:"border-t border-gray-200 dark:border-gray-700 px-6 py-3 flex items-center gap-3 bg-gray-50 dark:bg-gray-900/60",children:[n.jsx("span",{className:"text-xs "+(t>0?"text-amber-600 dark:text-amber-400 font-medium":"text-gray-400 dark:text-gray-500"),children:t>0?e("settings.v2.unsaved",{count:t}):""}),a&&n.jsx("span",{className:"text-xs "+l,children:a.message}),n.jsxs("div",{className:"ml-auto flex gap-2",children:[n.jsx("button",{type:"button",onClick:o,disabled:t===0||r,className:"px-3 py-1.5 text-sm font-medium rounded-md border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:e("settings.reset")}),n.jsx("button",{type:"button",onClick:i,disabled:t===0||r,className:"px-4 py-1.5 text-sm font-medium rounded-md bg-primary-600 text-white hover:bg-primary-700 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:e(r?"settings.saving":"settings.save")})]})]})}function TV({t:e}){return n.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-2 text-gray-400 dark:text-gray-500",children:[n.jsx("svg",{className:"w-8 h-8",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-4.35-4.35M17 10.5a6.5 6.5 0 11-13 0 6.5 6.5 0 0113 0z"})}),n.jsx("p",{className:"text-sm",children:e("settings.v2.no_matches")})]})}function RV(e){const{q:t,matches:r,orderedCategories:a,grouped:i,renderRegistryRow:o,activeGroup:l,t:u,onOpenDlpSettings:d,onOpenPricingSettings:f,activeSessionId:p,mobileFrameless:h,onMobileFramelessChange:m}=e;let y;if(t&&(!r||r.length===0))y=n.jsx(TV,{t:u});else if(t)y=n.jsxs("div",{className:"space-y-6",children:[n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:u("settings.v2.search_results",{count:r.length})}),a.map(function(v){const k=r.filter(function(_){return _.category===v});return k.length===0?null:n.jsxs("section",{children:[n.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-gray-400 dark:text-gray-500 mb-2 sticky top-0 bg-gray-50 dark:bg-gray-950 py-1 z-10",children:hf[v]?u(hf[v]):v}),n.jsx("div",{className:"space-y-3",children:k.map(o)})]},"search-"+v)})]});else if(l===RA)y=n.jsx(_4,{title:u("dlp.title"),description:"Configure Data Loss Prevention rules, detectors, and audit policies.",actionLabel:u("settings.v2.open"),onOpen:d});else if(l===AA)y=n.jsx(_4,{title:u("pricing.title"),description:"Configure per-model token pricing used for cost and usage tracking.",actionLabel:u("settings.v2.open"),onOpen:f});else if(k4[l]){const v=k4[l];y=n.jsx("div",{className:"space-y-3",children:n.jsx(v,{activeSessionId:p,mobileFrameless:h,onMobileFramelessChange:m})})}else y=n.jsx("div",{className:"space-y-3",children:(i[l]||[]).map(o)});return y}function AV({onBack:e,onOpenDlpSettings:t,onOpenPricingSettings:r,activeSessionId:a,mobileFrameless:i,onMobileFramelessChange:o}){const{t:l}=Jt(),{settings:u,formValues:d,errors:f,loading:p,saving:h,saveResult:m,loadError:y,changedCount:v,loadSettings:k,handleChange:_,handleSave:w,handleReset:N}=vV(),E=u.filter(function(ne){return!ne.hidden}),[A,T]=x.useState([]),[C,j]=x.useState(""),[M,L]=x.useState(null);x.useEffect(()=>{k()},[k]),x.useEffect(()=>{L(function(ne){return ne||u[0]&&u[0].category||null})},[u]),x.useEffect(()=>{let ne=!1;return Ck().then(function(P){ne||T(Array.isArray(P)?P:P&&P.models||[])}).catch(function(){ne||T([])}),function(){ne=!0}},[]);const I=xV(E),B=yV(I,bV),z=B.map(function(ne){return{id:ne,kind:"registry",label:hf[ne]?l(hf[ne]):ne,count:I[ne].length}}).concat([{id:IA,kind:"chat",label:l("settings.category.language")},{id:MA,kind:"chat",label:l("settings.notifications")},{id:LA,kind:"chat",label:l("settings.appearance")},{id:OA,kind:"chat",label:l("settings.workspace")},{id:DA,kind:"chat",label:l("settings.version_title")},{id:RA,kind:"launcher",label:l("dlp.title")},{id:AA,kind:"launcher",label:l("pricing.title")}]),ee=C.trim().toLowerCase(),V=wV(E,ee),D=SV(V),K=x.useCallback(function(ne){j(""),L(ne)},[]),H=function(ne){return n.jsx(jV,{setting:ne,formValue:d[ne.key],error:f[ne.key],models:A,t:l,onChange:function(P){_(ne.key,P)}},ne.key)};if(p)return n.jsx(kV,{});if(y)return n.jsx(_V,{t:l,loadError:y,onRetry:k});const J=RV({q:ee,matches:V,orderedCategories:B,grouped:I,renderRegistryRow:H,activeGroup:M,t:l,onOpenDlpSettings:t,onOpenPricingSettings:r,activeSessionId:a,mobileFrameless:i,onMobileFramelessChange:o});return n.jsxs("div",{className:"h-full flex flex-col","data-page":"settings-v2",children:[n.jsx(NV,{t:l,search:C,onSearchChange:j,onBack:e}),n.jsxs("div",{className:"flex-1 flex min-h-0",children:[n.jsx(EV,{t:l,groups:z,activeGroup:M,matchCounts:D,searching:!!ee,onSelect:K}),n.jsxs("div",{className:"flex-1 min-w-0 flex flex-col",children:[n.jsx("div",{className:"flex-1 overflow-y-auto px-6 py-4",children:J}),n.jsx(CV,{t:l,changedCount:v,saving:h,saveResult:m,onSave:w,onReset:N})]})]})]})}function IV({modelName:e,rates:t,onChange:r,onDelete:a,isDefault:i,t:o}){return n.jsxs("div",{className:"flex items-center gap-2 py-2 border-b border-gray-100 dark:border-gray-800 last:border-b-0",children:[n.jsx("div",{className:"flex-1 min-w-0",children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:`text-sm font-medium truncate ${i?"text-primary-600 dark:text-primary-400":"text-gray-900 dark:text-gray-100"}`,children:e}),i&&n.jsx("span",{className:"px-1.5 py-0.5 text-xs bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400 rounded",children:o("pricing.fallback_badge")})]})}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:o("pricing.label_input")}),n.jsx("input",{type:"number",step:"0.01",min:"0",value:t.input,onChange:l=>r(e,"input",parseFloat(l.target.value)||0),className:"w-16 px-2 py-1 text-xs border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100",title:o("pricing.input_tokens")})]}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:o("pricing.label_output")}),n.jsx("input",{type:"number",step:"0.01",min:"0",value:t.output,onChange:l=>r(e,"output",parseFloat(l.target.value)||0),className:"w-16 px-2 py-1 text-xs border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100",title:o("pricing.output_tokens")})]}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:o("pricing.label_cache")}),n.jsx("input",{type:"number",step:"0.01",min:"0",value:t.cached,onChange:l=>r(e,"cached",parseFloat(l.target.value)||0),className:"w-16 px-2 py-1 text-xs border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100",title:o("pricing.cached_tokens")})]}),!i&&n.jsx("button",{onClick:()=>a(e),className:"p-1 text-gray-400 hover:text-red-500 dark:hover:text-red-400 transition-colors",title:o("pricing.remove_model"),"aria-label":o("pricing.remove_model_aria",{modelName:e}),children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}),i&&n.jsx("div",{className:"w-6"})]})]})}function MV({onAdd:e,existingModels:t,t:r}){const[a,i]=x.useState(""),[o,l]=x.useState(5),[u,d]=x.useState(15),[f,p]=x.useState(2.5),[h,m]=x.useState(""),y=v=>{v.preventDefault(),m("");const k=a.trim().toLowerCase();if(!k){m(r("pricing.model_required"));return}if(t.includes(k)){m(r("pricing.model_exists"));return}if(k==="default"){m(r("pricing.default_exists"));return}e(k,{input:o,output:u,cached:f}),i(""),l(5),d(15),p(2.5)};return n.jsxs("form",{onSubmit:y,className:"mt-4 p-3 bg-gray-50 dark:bg-gray-800/50 rounded-lg",children:[n.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:r("pricing.add_new_model")}),n.jsxs("div",{className:"flex items-end gap-2 flex-wrap",children:[n.jsx("div",{className:"flex-1 min-w-[120px]",children:n.jsx("input",{type:"text",placeholder:r("pricing.add_model_placeholder"),value:a,onChange:v=>i(v.target.value),className:"w-full px-2 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 placeholder-gray-400"})}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:r("pricing.label_input")}),n.jsx("input",{type:"number",step:"0.01",min:"0",value:o,onChange:v=>l(parseFloat(v.target.value)||0),className:"w-14 px-2 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100"})]}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:r("pricing.label_output")}),n.jsx("input",{type:"number",step:"0.01",min:"0",value:u,onChange:v=>d(parseFloat(v.target.value)||0),className:"w-14 px-2 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100"})]}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:r("pricing.label_cache")}),n.jsx("input",{type:"number",step:"0.01",min:"0",value:f,onChange:v=>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"})]}),n.jsx("button",{type:"submit",className:"px-3 py-1.5 text-sm font-medium bg-primary-500 hover:bg-primary-600 text-white rounded transition-colors",children:r("pricing.add")})]}),h&&n.jsx("p",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:h})]})}function LV({onClose:e}){const{t}=Jt(),r=iu(),[a,i]=x.useState(null),[o,l]=x.useState(!0),[u,d]=x.useState(!1),[f,p]=x.useState(null),[h,m]=x.useState(!1),y=x.useRef(null);x.useEffect(()=>{let T=!1;async function C(){try{const j=await sW();T||(i(j),l(!1))}catch(j){T||(p(j.message),l(!1))}}return C(),()=>{T=!0}},[]),x.useEffect(()=>{async function T(C){C.key==="Escape"&&(h?await r({title:t("pricing.discard_title"),message:t("pricing.discard_confirm"),destructive:!0})&&e():e())}return document.addEventListener("keydown",T),y.current&&y.current.focus(),()=>document.removeEventListener("keydown",T)},[e,h,r,t]);const v=x.useCallback((T,C,j)=>{i(M=>!M||!M.models?M:{...M,models:{...M.models,[T]:{...M.models[T],[C]:j}}}),m(!0)},[]),k=x.useCallback(async T=>{await r({title:t("pricing.remove_title"),message:t("pricing.remove_confirm",{model:T}),destructive:!0,confirmLabel:t("pricing.remove_model")})&&(i(C=>{if(!C||!C.models)return C;const j={...C.models};return delete j[T],{...C,models:j}}),m(!0))},[r,t]),_=x.useCallback((T,C)=>{i(j=>j?{...j,models:{...j.models,[T]:C}}:{models:{[T]:C}}),m(!0)},[]),w=x.useCallback(async()=>{p(null),d(!0);try{await oW(a),m(!1),e()}catch(T){p(T.message)}finally{d(!1)}},[a,e]),N=x.useCallback(async()=>{if(await r({title:t("pricing.reset_title"),message:t("pricing.reset_confirm"),destructive:!0,confirmLabel:t("pricing.reset")})){p(null),d(!0);try{const T=await lW();i(T.pricing),m(!1)}catch(T){p(T.message)}finally{d(!1)}}},[r,t]),E=x.useCallback(async()=>{h?await r({title:t("pricing.discard_title"),message:t("pricing.discard_confirm"),destructive:!0})&&e():e()},[h,e,r,t]),A=a!=null&&a.models?Object.entries(a.models).sort(([T],[C])=>T==="default"?1:C==="default"?-1:T.localeCompare(C)):[];return n.jsx("div",{ref:y,tabIndex:-1,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:E,role:"dialog","aria-modal":"true","aria-label":t("pricing.title"),children:n.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-xl shadow-2xl w-full max-w-2xl mx-4 max-h-[90vh] flex flex-col",onClick:T=>T.stopPropagation(),children:[n.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-800",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:t("pricing.heading")}),n.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:t("pricing.subtitle")})]}),n.jsx("button",{onClick:E,className:"p-1 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-400","aria-label":t("pricing.close"),children:n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),n.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[o&&n.jsx("div",{className:"flex items-center justify-center py-12",children:n.jsx("div",{className:"w-6 h-6 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}),f&&n.jsx("div",{className:"mb-4 p-3 bg-red-50 dark:bg-red-900/20 rounded-lg border border-red-200 dark:border-red-800",children:n.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:f})}),!o&&a&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"mb-2 text-xs text-gray-500 dark:text-gray-400 flex items-center justify-between",children:[n.jsx("span",{children:t("pricing.configured_count",{count:A.length})}),n.jsx("span",{className:"text-gray-400 dark:text-gray-500",children:t("pricing.rates_subtitle")})]}),n.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[n.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800/50 px-3 py-2 text-xs font-medium text-gray-500 dark:text-gray-400 flex items-center gap-2",children:[n.jsx("div",{className:"flex-1",children:t("pricing.model_column")}),n.jsx("div",{className:"w-[280px] text-right",children:t("pricing.rates_column")}),n.jsx("div",{className:"w-6"})]}),n.jsx("div",{className:"divide-y divide-gray-100 dark:divide-gray-800 px-3",children:A.map(([T,C])=>n.jsx(IV,{modelName:T,rates:C,onChange:v,onDelete:k,isDefault:T==="default",t},T))})]}),n.jsx(MV,{onAdd:_,existingModels:A.map(([T])=>T),t})]})]}),n.jsxs("div",{className:"flex items-center justify-between p-4 border-t border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900/50",children:[n.jsx("button",{onClick:N,disabled:u,className:"px-3 py-1.5 text-sm font-medium text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 transition-colors disabled:opacity-50",children:t("pricing.reset")}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("button",{onClick:E,disabled:u,className:"px-4 py-1.5 text-sm font-medium text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 transition-colors disabled:opacity-50",children:t("common.cancel")}),n.jsxs("button",{onClick:w,disabled:u||!h,className:"px-4 py-1.5 text-sm font-medium bg-primary-500 hover:bg-primary-600 disabled:bg-gray-300 dark:disabled:bg-gray-700 text-white rounded-lg transition-colors disabled:cursor-not-allowed flex items-center gap-2",children:[u&&n.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),t("pricing.save_changes")]})]})]})]})})}const OV=[{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"}],DV=["low","medium","high"];function PV({severity:e}){const t={high:"bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-400",medium:"bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-400",low:"bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-400"};return n.jsx("span",{className:`px-1.5 py-0.5 rounded text-xs font-medium ${t[e]||t.medium}`,children:e})}function w4({name:e,regex:t,severity:r,enabled:a,builtin:i,onToggle:o,onRemove:l,t:u}){return n.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5 border-b border-gray-100 dark:border-gray-800 last:border-b-0 group hover:bg-gray-50 dark:hover:bg-gray-800/40 transition-colors",children:[n.jsxs("label",{className:"relative inline-flex items-center cursor-pointer flex-shrink-0",children:[n.jsx("input",{type:"checkbox",checked:a,onChange:()=>o(e),className:"sr-only peer",disabled:!1}),n.jsx("div",{className:"w-8 h-4 bg-gray-200 peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-primary-300 dark:peer-focus:ring-primary-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:rounded-full after:h-3 after:w-3 after:transition-all dark:border-gray-600 peer-checked:bg-primary-600"})]}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:e}),i&&n.jsx("span",{className:"px-1 py-0.5 text-[10px] bg-gray-100 dark:bg-gray-800 text-gray-500 dark:text-gray-400 rounded font-mono",children:"built-in"})]}),n.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 font-mono truncate",title:t,children:t.length>60?t.slice(0,57)+"...":t})]}),n.jsx(PV,{severity:r}),!i&&n.jsx("button",{onClick:()=>l(e),className:"p-1 text-gray-400 hover:text-red-500 dark:hover:text-red-400 opacity-0 group-hover:opacity-100 transition-opacity",title:u("dlp.remove_pattern"),"aria-label":u("dlp.remove_pattern_aria",{name:e}),children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})}function FV({onAdd:e,existingNames:t,t:r}){const[a,i]=x.useState(""),[o,l]=x.useState(""),[u,d]=x.useState("medium"),[f,p]=x.useState(""),h=y=>{if(t.includes(y.name)){p(r("dlp.pattern_exists",{name:y.name}));return}i(y.name),l(y.regex),d(y.severity),p("")},m=y=>{if(y.preventDefault(),p(""),!a.trim()){p(r("dlp.name_required"));return}if(!o.trim()){p(r("dlp.regex_required"));return}if(t.includes(a.trim())){p(r("dlp.pattern_exists",{name:a.trim()}));return}try{new RegExp(o)}catch{p(r("dlp.invalid_regex"));return}e(a.trim(),o.trim(),u),i(""),l(""),d("medium")};return n.jsxs("div",{className:"mt-4 p-3 bg-gray-50 dark:bg-gray-800/50 rounded-lg",children:[n.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:r("dlp.add_pattern")}),n.jsx("div",{className:"flex flex-wrap gap-1.5 mb-3",children:OV.map(y=>n.jsx("button",{onClick:()=>h(y),className:"px-2 py-0.5 text-xs bg-white dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded hover:bg-primary-50 dark:hover:bg-primary-900/30 text-gray-700 dark:text-gray-300 transition-colors",children:y.label},y.id))}),n.jsxs("form",{onSubmit:m,className:"flex items-end gap-2 flex-wrap",children:[n.jsxs("div",{className:"flex-1 min-w-[140px]",children:[n.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400 block mb-0.5",children:r("dlp.pattern_name")}),n.jsx("input",{type:"text",placeholder:"e.g. hk_passport",value:a,onChange:y=>i(y.target.value),className:"w-full px-2 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100"})]}),n.jsxs("div",{className:"flex-[2] min-w-[200px]",children:[n.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400 block mb-0.5",children:r("dlp.regex_pattern")}),n.jsx("input",{type:"text",placeholder:"e.g. \\b[A-Z]\\d{7}\\b",value:o,onChange:y=>l(y.target.value),className:"w-full px-2 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 font-mono"})]}),n.jsxs("div",{className:"w-24",children:[n.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400 block mb-0.5",children:r("dlp.severity")}),n.jsx("select",{value:u,onChange:y=>d(y.target.value),className:"w-full px-2 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100",children:DV.map(y=>n.jsx("option",{value:y,children:y},y))})]}),n.jsx("button",{type:"submit",className:"px-3 py-1.5 text-sm bg-primary-600 hover:bg-primary-700 text-white rounded transition-colors",children:r("dlp.add")})]}),f&&n.jsx("p",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:f})]})}function BV({onClose:e}){const{t}=Jt(),r=iu(),[a,i]=x.useState(null),[o,l]=x.useState([]),[u,d]=x.useState(!0),[f,p]=x.useState(!1),[h,m]=x.useState(null),[y,v]=x.useState(!1),[k,_]=x.useState(!0),[w,N]=x.useState("ask"),[E,A]=x.useState([]),[T,C]=x.useState({}),[j,M]=x.useState("epm/privacy"),L=x.useRef(null);x.useEffect(()=>{let K=!1;async function H(){var J;try{const ne=await eM();K||(l(ne.builtins||[]),_(ne.enabled!==!1),N(ne.defaultAction||"ask"),A(ne.disabledBuiltins||[]),C(ne.patterns||{}),M(((J=ne.privateMode)==null?void 0:J.rerouteModel)||"epm/privacy"),i(ne),d(!1))}catch(ne){K||(m(ne.message),d(!1))}}return H(),()=>{K=!0}},[]),x.useEffect(()=>{async function K(H){H.key==="Escape"&&(y?await r({title:t("dlp.discard_title"),message:t("dlp.discard_confirm"),destructive:!0})&&e():e())}return document.addEventListener("keydown",K),L.current&&L.current.focus(),()=>document.removeEventListener("keydown",K)},[e,y,r,t]);const I=x.useCallback(K=>{A(H=>H.includes(K)?H.filter(J=>J!==K):[...H,K]),v(!0)},[]),B=x.useCallback((K,H,J)=>{C(ne=>({...ne,[K]:{regex:H,severity:J}})),v(!0)},[]),z=x.useCallback(K=>{C(H=>{const J={...H};return delete J[K],J}),v(!0)},[]),ee=x.useCallback(async()=>{m(null),p(!0);try{const H=await tM({enabled:k,defaultAction:w,disabledBuiltins:E,privateMode:{rerouteModel:j},patterns:T});v(!1),i(H.policy),e()}catch(K){m(K.message)}finally{p(!1)}},[k,w,E,T,j,e]),V=x.useCallback(async()=>{y?await r({title:t("dlp.discard_title"),message:t("dlp.discard_confirm"),destructive:!0})&&e():e()},[y,e,r,t]),D=[...o.map(K=>K.name),...Object.keys(T)];return n.jsx("div",{ref:L,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:n.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-xl shadow-2xl w-full max-w-2xl mx-4 max-h-[90vh] flex flex-col",onClick:K=>K.stopPropagation(),children:[n.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-800",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:t("dlp.heading")}),n.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:t("dlp.subtitle")})]}),n.jsx("button",{onClick:V,className:"p-1 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-400","aria-label":t("dlp.close"),children:n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),n.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[u&&n.jsx("div",{className:"flex items-center justify-center py-12",children:n.jsx("div",{className:"w-6 h-6 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}),h&&n.jsx("div",{className:"mb-4 p-3 bg-red-50 dark:bg-red-900/20 rounded-lg border border-red-200 dark:border-red-800",children:n.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:h})}),!u&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center justify-between mb-4 p-3 bg-blue-50 dark:bg-blue-900/20 rounded-lg border border-blue-200 dark:border-blue-800",children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:t("dlp.enable_label")}),n.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:t("dlp.enable_desc")})]}),n.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[n.jsx("input",{type:"checkbox",checked:k,onChange:K=>{_(K.target.checked),v(!0)},className:"sr-only peer"}),n.jsx("div",{className:"w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-primary-300 dark:peer-focus:ring-primary-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-primary-600"})]})]}),n.jsxs("div",{className:"mb-4",children:[n.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 block mb-1",children:t("dlp.default_action_label")}),n.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:t("dlp.default_action_desc")}),n.jsxs("select",{value:w,onChange:K=>{N(K.target.value),v(!0)},className:"w-full max-w-xs px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100",children:[n.jsx("option",{value:"ask",children:"Ask (show modal)"}),n.jsx("option",{value:"reroute",children:"Always reroute to private"}),n.jsx("option",{value:"warn",children:"Warn only (proceed on cloud)"})]})]}),n.jsxs("div",{className:"mb-4",children:[n.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 block mb-1",children:t("dlp.reroute_model_label")}),n.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:t("dlp.reroute_model_desc")}),n.jsx("input",{type:"text",value:j,onChange:K=>{M(K.target.value),v(!0)},className:"w-full max-w-xs px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 font-mono"})]}),n.jsxs("div",{className:"mb-4 mt-6",children:[n.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 mb-1",children:t("dlp.builtin_patterns")}),n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-3",children:t("dlp.builtin_desc")}),n.jsx("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden divide-y divide-gray-100 dark:divide-gray-800",children:o.map(K=>n.jsx(w4,{name:K.name,regex:K.regex,severity:K.severity,enabled:!E.includes(K.name),builtin:!0,onToggle:I,onRemove:()=>{},t},K.name))})]}),n.jsxs("div",{className:"mb-4 mt-4",children:[n.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 mb-1",children:t("dlp.user_patterns")}),n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-3",children:t("dlp.user_patterns_desc")}),Object.keys(T).length===0?n.jsx("div",{className:"text-sm text-gray-400 dark:text-gray-500 py-3 text-center border border-dashed border-gray-200 dark:border-gray-700 rounded-lg",children:t("dlp.no_user_patterns")}):n.jsx("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden divide-y divide-gray-100 dark:divide-gray-800",children:Object.entries(T).map(([K,H])=>n.jsx(w4,{name:K,regex:H.regex,severity:H.severity,enabled:!0,builtin:!1,onToggle:()=>{},onRemove:z,t},K))})]}),n.jsx(FV,{onAdd:B,existingNames:D,t})]})]}),!u&&n.jsxs("div",{className:"flex items-center justify-end gap-3 p-4 border-t border-gray-200 dark:border-gray-800",children:[n.jsx("button",{onClick: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")}),n.jsx("button",{onClick:ee,disabled:f||!y,className:"px-4 py-2 text-sm bg-primary-600 hover:bg-primary-700 disabled:bg-gray-300 dark:disabled:bg-gray-700 disabled:cursor-not-allowed text-white rounded-lg transition-colors",children:t(f?"dlp.saving":"dlp.save")})]})]})})}function zV(e,t){var r={grant:"permission.action_grant",revoke:"permission.action_revoke",clear:"permission.action_clear_all"},a={network:"permission.type_network","fs.read":"permission.type_file_read","fs.write":"permission.type_file_write","filesystem.read":"permission.type_file_read","filesystem.write":"permission.type_file_write",module:"permission.type_module",modules:"permission.type_module",require:"permission.type_module",system:"permission.type_system",command:"permission.type_system"};if(e.action==="clear")return t("permission.clear_all");var i=r[e.action]?t(r[e.action]):e.action,o=a[e.type]?t(a[e.type]):e.type;return t("permission.request_desc",{action:i,type:o,target:e.target||"*"})}function UV({request:e,onDismiss:t}){const{t:r}=Jt(),[a,i]=x.useState(null),[o,l]=x.useState(null),u=x.useRef(!0),d=x.useRef(null);x.useEffect(()=>()=>{u.current=!1,d.current&&clearTimeout(d.current)},[]);const f=x.useCallback(v=>{v.includes("not found")||v.includes("expired")?l("Request expired"):v.includes("already")?l("Request already processed"):l(v),i("dismissing"),d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{u.current&&t(e.id)},2e3)},[e.id,t]),p=x.useCallback(async()=>{i("allow"),l(null);try{const v=await v3(e.id);if(!u.current)return;if(v&&v.success===!1){const k=v.error||v.message||"Failed to confirm";f(k);return}t(e.id)}catch(v){if(!u.current)return;const k=v.message||"Failed to confirm";f(k)}},[e.id,t,f]),h=x.useCallback(async()=>{i("deny"),l(null);try{const v=await k3(e.id);if(!u.current)return;if(v&&v.success===!1){const k=v.error||v.message||"Failed to deny";f(k);return}t(e.id)}catch(v){if(!u.current)return;const k=v.message||"Failed to deny";f(k)}},[e.id,t,f]),m=e.action==="clear",y=e.action==="revoke";return n.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-lg border border-gray-200 dark:border-gray-700 p-4 w-80 animate-slide-in",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0 ${m?"bg-red-100 dark:bg-red-900/30":y?"bg-amber-100 dark:bg-amber-900/30":"bg-blue-100 dark:bg-blue-900/30"}`,children:n.jsx("svg",{className:`w-4 h-4 ${m?"text-red-600 dark:text-red-400":y?"text-amber-600 dark:text-amber-400":"text-blue-600 dark:text-blue-400"}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"})})}),n.jsx("span",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:r("permission.title")})]}),n.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-2",children:zV(e,r)}),n.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-3",children:[r("permission.reason_prefix")," ",typeof e.reason=="string"&&e.reason.trim()?e.reason:r("permission.no_reason")]}),o&&n.jsx("p",{className:"text-xs text-red-600 dark:text-red-400 mb-2",children:o}),n.jsxs("div",{className:"flex items-center justify-end gap-2",children:[n.jsx("button",{onClick:h,disabled:a!==null,className:"px-3 py-1.5 text-sm font-medium rounded-md border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:r(a==="deny"?"permission.denying":"permission.deny")}),n.jsx("button",{onClick:p,disabled:a!==null,className:`px-3 py-1.5 text-sm font-medium rounded-md text-white transition-colors disabled:opacity-50 disabled:cursor-not-allowed ${m?"bg-red-600 hover:bg-red-700":y?"bg-amber-600 hover:bg-amber-700":"bg-blue-600 hover:bg-blue-700"}`,children:r(a==="allow"?"permission.allowing":"permission.allow")})]})]})}function qV({requests:e,onDismiss:t}){return!e||e.length===0?null:n.jsx(n.Fragment,{children:e.map(r=>n.jsx(UV,{request:r,onDismiss:t},r.id))})}var HV="https://account.openpave.ai/dashboard";function $V({open:e,onClose:t,upgradeUrl:r}){var{t:a}=Jt(),i=x.useRef(null),o=x.useRef(null),l=x.useRef(t),u=HV;if(typeof r=="string"&&r.length>0)try{var d=new URL(r),f=["account.openpave.ai"];d.protocol==="https:"&&f.indexOf(d.hostname)!==-1&&(u=d.href)}catch{}return x.useEffect(function(){l.current=t},[t]),x.useEffect(function(){e&&o.current&&o.current.focus()},[e]),x.useEffect(function(){if(!e)return;function 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]),x.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 y=m[0],v=m[m.length-1];h.shiftKey?document.activeElement===y&&(h.preventDefault(),v.focus()):document.activeElement===v&&(h.preventDefault(),y.focus())}}}return document.addEventListener("keydown",p),function(){document.removeEventListener("keydown",p)}},[e]),e?n.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/40 backdrop-blur-sm transition-opacity duration-150",onClick:function(p){p.target===p.currentTarget&&t()},children:n.jsxs("div",{ref:i,role:"dialog","aria-modal":"true","aria-label":a("credits.limit_reached"),className:"bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-700 shadow-xl w-full max-w-md mx-4 outline-none transition-all duration-150",children:[n.jsxs("div",{className:"px-5 py-4 border-b border-gray-100 dark:border-gray-800 flex items-center gap-3",children:[n.jsx("span",{className:"text-2xl",role:"img","aria-hidden":"true",children:"🪙"}),n.jsx("h3",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:a("credits.limit_reached")})]}),n.jsx("div",{className:"px-5 py-4",children:n.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:a("credits.limit_message")})}),n.jsxs("div",{className:"px-5 py-3 border-t border-gray-100 dark:border-gray-800 flex justify-end gap-3",children:[n.jsx("button",{ref:o,type:"button",onClick:t,className:"px-4 py-2 text-sm font-medium rounded-md bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-gray-400 focus:ring-offset-2",children:a("credits.dismiss")}),n.jsxs("a",{href:u,target:"_blank",rel:"noopener noreferrer",className:"px-4 py-2 text-sm font-medium rounded-md bg-primary-600 hover:bg-primary-700 text-white focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 inline-flex items-center gap-1.5",children:[a("credits.add_credits"),n.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",focusable:"false",children:[n.jsx("path",{d:"M11 3a1 1 0 100 2h2.586l-6.293 6.293a1 1 0 101.414 1.414L15 6.414V9a1 1 0 102 0V4a1 1 0 00-1-1h-5z"}),n.jsx("path",{d:"M5 5a2 2 0 00-2 2v8a2 2 0 002 2h8a2 2 0 002-2v-3a1 1 0 10-2 0v3H5V7h3a1 1 0 000-2H5z"})]})]})]})]})}):null}function _v(e){if(e==null)return"";const t=Date.now()-e;if(t<=0)return"just now";const r=Math.floor(t/1e3);if(r<60)return`${r}s ago`;const a=Math.floor(r/60);if(a<60)return`${a}m ago`;const i=Math.floor(a/60);if(i<24)return`${i}h ago`;const o=Math.floor(i/24);return o<30?`${o}d ago`:`${Math.floor(o/30)}mo ago`}const WV=15e3;function VV({onNavigateToAgent:e}){const{t}=Jt(),[r,a]=x.useState(!1),[i,o]=x.useState([]),[l,u]=x.useState(0),[d,f]=x.useState(!1),[p,h]=x.useState(null),m=x.useRef(null),y=x.useRef(null),v=x.useRef(0),k=x.useRef(!1),_=x.useRef(!1),w=x.useRef(0),N=x.useRef(i);N.current=i,x.useEffect(()=>{function U(){document.visibilityState==="visible"&&(_.current=!0)}return document.addEventListener("visibilitychange",U),()=>document.removeEventListener("visibilitychange",U)},[]);const E=x.useCallback(async U=>{const X=++w.current;try{let F,Z=null;if(U){const W=await R_();if(X!==w.current)return;Z=W.messages||[],o(Z),F=W.unread||0,u(F)}else{const W=await R_({unreadOnly:!0,limit:1});if(X!==w.current)return;F=W.unread||0,u(F),nu()&&F>0&&W.messages&&W.messages.length>0&&(Z=W.messages)}if(k.current&&F>v.current&&!_.current&&EA()&&NA(),k.current&&F>v.current&&nu()){const W=F-v.current,G=Z||N.current||[],oe=W===1&&G.length>0?G.find(Ve=>!Ve.read):null,Q=oe&&oe.from?oe.from:"",ke=!Q||Q==="__pave_webui__"||Q==="unknown"?"PAVE":Q,Fe=oe&&oe.message?oe.message.slice(0,120).replace(/\n/g," "):W===1?"New inbox message":W+" new inbox messages";CA({title:ke,body:Fe,tag:"pave-inbox-"+Date.now(),onClick:function(){window.focus()}})}_.current=!1,v.current=F,k.current=!0}catch{}},[]);x.useEffect(()=>{E(r);const U=setInterval(()=>E(r),WV);return()=>clearInterval(U)},[E,r]),x.useEffect(()=>{if(!r)return;function U(X){m.current&&!m.current.contains(X.target)&&a(!1)}return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[r]);const A=x.useRef(new Set),T=x.useCallback(async U=>{if(!(!U.filename||U.read)&&!A.current.has(U.filename)){A.current.add(U.filename);try{await $3(U.filename),o(X=>X.map(F=>F.filename===U.filename?{...F,read:!0}:F)),u(X=>Math.max(0,X-1)),h(X=>X&&X.filename===U.filename?{...X,read:!0}:X)}catch{}finally{A.current.delete(U.filename)}}},[]),C=x.useCallback(async()=>{f(!0);try{await G3(),o(U=>U.map(X=>({...X,read:!0}))),u(0)}catch{}finally{f(!1)}},[]),j=x.useCallback(async()=>{f(!0);try{await K3(),o([]),u(0)}catch{}finally{f(!1)}},[]),M=x.useCallback((U,X)=>{X.read||T(X),a(!1),h(null),e&&e(U)},[e,T]),L=x.useCallback(U=>{h(U),U.read||T(U)},[T]),I=x.useCallback(()=>{h(null)},[]),B=x.useRef(new Set),z=x.useCallback(async U=>{if(!(!U.filename||!U.read)&&!B.current.has(U.filename)){B.current.add(U.filename);try{await W3(U.filename),o(X=>{const F=X.map(W=>W.filename===U.filename?{...W,read:!1}:W),Z=F.reduce((W,G)=>W+(G.read?0:1),0);return u(Z),F}),h(X=>X&&X.filename===U.filename?{...X,read:!1}:X)}catch{}finally{B.current.delete(U.filename)}}},[]),ee=x.useCallback(async U=>{if(U.filename)try{await V3(U.filename),o(X=>{const F=X.filter(W=>W.filename!==U.filename),Z=F.reduce((W,G)=>W+(G.read?0:1),0);return u(Z),F}),h(X=>X&&X.filename===U.filename?null:X)}catch{}},[]),V=x.useMemo(()=>[...i].sort((U,X)=>(X.timestamp||0)-(U.timestamp||0)),[i]),D=x.useCallback(()=>{if(!p)return;const U=V.findIndex(X=>X.filename===p.filename);if(U>0){const X=V[U-1];h(X),X.read||T(X)}},[p,V,T]),K=x.useCallback(()=>{if(!p)return;const U=V.findIndex(X=>X.filename===p.filename);if(U>=0&&U<V.length-1){const X=V[U+1];h(X),X.read||T(X)}},[p,V,T]),H=x.useMemo(()=>p?V.findIndex(U=>U.filename===p.filename):-1,[p,V]),J=H>0,ne=H>=0&&H<V.length-1,P=!!p;return x.useEffect(()=>{if(!P)return;function U(X){X.key==="Escape"&&h(null)}return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[P]),x.useEffect(()=>{P&&y.current&&y.current.focus()},[P]),n.jsxs("div",{className:"relative",ref:m,children:[n.jsxs("button",{onClick:()=>a(!r),className:"relative p-1.5 rounded-lg transition-colors text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800",title:t("user_inbox.title"),"aria-label":t("user_inbox.title"),"aria-expanded":r,"aria-haspopup":"true",children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"})}),l>0&&n.jsx("span",{className:"absolute -top-0.5 -right-0.5 flex items-center justify-center min-w-[16px] h-4 px-1 text-[10px] font-bold text-white bg-red-500 rounded-full leading-none",children:l>99?"99+":l})]}),r&&n.jsxs("div",{className:"absolute right-0 top-full mt-1 w-80 max-w-[calc(100vw-1.5rem)] bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-700 shadow-lg z-50 flex flex-col max-h-[28rem]",children:[n.jsxs("div",{className:"px-3 py-2 border-b border-gray-100 dark:border-gray-800 flex items-center justify-between flex-shrink-0",children:[n.jsx("span",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:t("user_inbox.title")}),n.jsxs("div",{className:"flex items-center gap-1",children:[i.length>0&&l>0&&n.jsx("button",{onClick:C,disabled:d,className:"text-xs text-primary-600 dark:text-primary-400 hover:underline disabled:opacity-50",title:t("user_inbox.mark_all_read"),children:t("user_inbox.mark_all_read")}),i.length>0&&n.jsx("button",{onClick:j,disabled:d,className:"text-xs text-gray-500 dark:text-gray-400 hover:text-red-500 dark:hover:text-red-400 ml-2 disabled:opacity-50",title:t("user_inbox.clear_all"),children:t("user_inbox.clear_all")})]})]}),n.jsx("div",{className:"overflow-y-auto flex-1",children:V.length===0?n.jsx("div",{className:"px-3 py-6 text-center text-sm text-gray-400 dark:text-gray-500",children:t("user_inbox.empty")}):V.map((U,X)=>{const F=U.from||"unknown",Z=F!=="unknown";return n.jsxs("div",{className:"px-3 py-2 border-b border-gray-50 dark:border-gray-800 last:border-b-0 transition-colors "+(U.read?"bg-white dark:bg-gray-900":"bg-primary-50 dark:bg-primary-900/10"),children:[n.jsxs("div",{className:"flex items-center justify-between mb-0.5",children:[n.jsx("button",{onClick:()=>{Z&&M(F,U)},disabled:!Z,className:"text-xs font-semibold truncate max-w-[60%] "+(Z?"text-primary-600 dark:text-primary-400 hover:underline":"text-gray-400 dark:text-gray-500 cursor-default"),title:Z?t("user_inbox.view_agent")+": "+F:F,children:F}),n.jsxs("div",{className:"flex items-center gap-1.5",children:[U.priority==="high"&&n.jsx("span",{className:"text-[10px] font-semibold text-red-500 uppercase",children:t("user_inbox.high_priority")}),n.jsx("span",{className:"text-[10px] text-gray-400 dark:text-gray-500 whitespace-nowrap",children:U.timestamp!=null?_v(U.timestamp):""}),!U.read&&n.jsx("span",{className:"w-2 h-2 rounded-full bg-primary-500 flex-shrink-0",title:t("user_inbox.unread")})]})]}),n.jsx("div",{role:"button",tabIndex:0,onClick:()=>L(U),onKeyDown:W=>{(W.key==="Enter"||W.key===" ")&&(W.preventDefault(),L(U))},className:"text-left w-full text-sm text-gray-700 dark:text-gray-300 break-words line-clamp-3 hover:text-gray-900 dark:hover:text-gray-100 cursor-pointer",title:t("user_inbox.view_message"),children:n.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none [&>*]:m-0 [&>*]:leading-snug",children:n.jsx(Cl,{remarkPlugins:[Tl],disallowedElements:["img"],unwrapDisallowed:!0,components:{a:function({node:W,children:G,href:oe,...Q}){return n.jsx("a",{href:oe,...Q,target:"_blank",rel:"noopener noreferrer",onClick:fe=>fe.stopPropagation(),children:G})},p:function({node:W,children:G,...oe}){return n.jsx("span",{...oe,children:G})}},children:U.message})})})]},U.filename||X)})})]}),p&&n.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/40 backdrop-blur-sm",onClick:U=>{U.target===U.currentTarget&&I()},children:n.jsxs("div",{ref:y,tabIndex:-1,role:"dialog","aria-modal":"true","aria-label":t("user_inbox.view_message"),className:"bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-700 shadow-xl w-full max-w-lg mx-4 max-h-[80vh] flex flex-col outline-none focus-visible:ring-2 focus-visible:ring-primary-500",children:[n.jsxs("div",{className:"px-4 py-3 border-b border-gray-100 dark:border-gray-800 flex items-center justify-between flex-shrink-0",children:[n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[n.jsx("button",{type:"button",onClick:()=>{const U=p.from||"unknown";U!=="unknown"&&M(U,p)},disabled:!p.from||p.from==="unknown",className:"text-sm font-semibold truncate "+(p.from&&p.from!=="unknown"?"text-primary-600 dark:text-primary-400 hover:underline":"text-gray-400 dark:text-gray-500 cursor-default"),children:p.from||"unknown"}),p.priority==="high"&&n.jsx("span",{className:"text-[10px] font-semibold text-red-500 uppercase flex-shrink-0",children:t("user_inbox.high_priority")}),n.jsx("span",{className:"text-[10px] text-gray-400 dark:text-gray-500 whitespace-nowrap flex-shrink-0",children:p.timestamp?_v(p.timestamp):""})]}),n.jsx("button",{type:"button",onClick:I,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500 dark:text-gray-400 flex-shrink-0","aria-label":t("user_inbox.close"),children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),n.jsx("div",{className:"px-4 py-3 overflow-y-auto flex-1",children:n.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none break-words",children:n.jsx(Cl,{remarkPlugins:[Tl],disallowedElements:["img"],unwrapDisallowed:!0,components:{a:function({node:U,children:X,href:F,...Z}){return n.jsx("a",{href:F,...Z,target:"_blank",rel:"noopener noreferrer",children:X})},p:function({node:U,children:X,...F}){return n.jsx("p",{...F,style:{whiteSpace:"pre-wrap"},children:X})}},children:p.message||""})})}),n.jsxs("div",{className:"px-4 py-2 border-t border-gray-100 dark:border-gray-800 flex items-center justify-between flex-shrink-0",children:[n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("button",{type:"button",onClick:D,disabled:!J,className:"p-1.5 rounded hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500 dark:text-gray-400 disabled:opacity-30 disabled:cursor-not-allowed transition-colors",title:t("user_inbox.prev_message"),"aria-label":t("user_inbox.prev_message"),children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})})}),n.jsx("span",{className:"text-[10px] text-gray-400 dark:text-gray-500 tabular-nums min-w-[3rem] text-center",children:H>=0?`${H+1} / ${V.length}`:""}),n.jsx("button",{type:"button",onClick:K,disabled:!ne,className:"p-1.5 rounded hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500 dark:text-gray-400 disabled:opacity-30 disabled:cursor-not-allowed transition-colors",title:t("user_inbox.next_message"),"aria-label":t("user_inbox.next_message"),children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[p.read?n.jsx("button",{type:"button",onClick:()=>z(p),className:"text-xs text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hover:underline",title:t("user_inbox.mark_unread"),children:t("user_inbox.mark_unread")}):n.jsx("button",{type:"button",onClick:()=>T(p),className:"text-xs text-primary-600 dark:text-primary-400 hover:underline",title:t("user_inbox.mark_read"),children:t("user_inbox.mark_read")}),n.jsx("button",{type:"button",onClick:()=>ee(p),className:"text-xs text-red-500 dark:text-red-400 hover:text-red-600 dark:hover:text-red-300 hover:underline",title:t("user_inbox.delete"),children:t("user_inbox.delete")}),n.jsx("button",{type:"button",onClick:I,className:"text-xs px-3 py-1 rounded bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700",children:t("user_inbox.close")})]})]})]})})]})}function Ab(e,t){if(!e||!t)return!e;const r=String(e).toLowerCase(),a=String(t).toLowerCase();let i=0;for(let o=0;o<a.length&&i<r.length;o+=1)a[o]===r[i]&&(i+=1);return i===r.length}function GV(e){return e.source==="tui"?"TUI":e.source==="legacy"?"Legacy":"Web"}function KV({isOpen:e,onClose:t,onSelectSession:r,onNewChat:a,activeSessionId:i,sessions:o,busySessions:l={}}){const{t:u}=Jt(),[d,f]=x.useState(""),[p,h]=x.useState(0),[m,y]=x.useState(null),[v,k]=x.useState(!1),_=x.useRef(null),w=x.useRef(null),N=x.useRef(null),E=d?d.trim():"";x.useEffect(()=>{if(e){f(""),h(0),y(null),k(!1);const L=requestAnimationFrame(()=>{_.current&&_.current.focus()});return()=>cancelAnimationFrame(L)}},[e]),x.useEffect(()=>{let L=!1;const I=d?d.trim():"";if(N.current&&(clearTimeout(N.current),N.current=null),!e){y(null),k(!1);return}if(I.length<2){y(null),k(!1);return}return y(null),k(!0),N.current=setTimeout(()=>{wl({q:I,limit:20}).then(B=>{if(L)return;const z=Array.isArray(B)?B:B.sessions||[];y(z),k(!1)}).catch(()=>{L||k(!1)})},300),()=>{L=!0,N.current&&(clearTimeout(N.current),N.current=null)}},[d,e]);const A=x.useCallback(L=>{if(!i)return L;const I=L.findIndex(ee=>ee.id===i);if(I<=0)return L;const B=L.slice(),[z]=B.splice(I,1);return B.unshift(z),B},[i]),T=x.useMemo(()=>({id:"__new_chat__",isAction:!0,actionType:"new-chat",title:u("spotlight.new_chat")}),[u]),C=x.useMemo(()=>{const L=o||[],I=!E||Ab(E,"new chat")||Ab(E,u("spotlight.new_chat")),B=V=>I&&a?i&&V.length>0&&V[0].id===i?[V[0],T,...V.slice(1)]:[T,...V]:V;if(!E)return B(A(L.slice(0,10)));const z=L.filter(V=>Ab(E,V.title||""));let ee;if(m){const V=new Set(z.map(K=>K.id)),D=m.filter(K=>!V.has(K.id));ee=z.concat(D).slice(0,20)}else ee=z.slice(0,20);return B(A(ee))},[E,o,m,A,T,a,u,i]);x.useEffect(()=>{h(0)},[E]),x.useEffect(()=>{h(L=>C.length===0?0:L>=C.length?C.length-1:L)},[C.length]),x.useEffect(()=>{if(!w.current)return;const L=w.current.querySelectorAll('[role="option"]');L[p]&&L[p].scrollIntoView({block:"nearest"})},[p,C.length]);const j=x.useCallback(L=>{if(L&&L.isAction&&L.actionType==="new-chat"){a&&a(),t();return}const I=typeof L=="string"?L:L==null?void 0:L.id;I&&r(I),t()},[r,a,t]),M=x.useCallback(L=>{L.key==="ArrowDown"?(L.preventDefault(),h(I=>C.length===0?0:(I+1)%C.length)):L.key==="ArrowUp"?(L.preventDefault(),h(I=>C.length===0?0:(I-1+C.length)%C.length)):L.key==="Enter"?(L.preventDefault(),C[p]&&j(C[p])):L.key==="Escape"&&(L.preventDefault(),t())},[C,p,j,t]);return e?n.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[15vh] bg-black/50",onClick:t,role:"presentation",children:n.jsxs("div",{className:"w-full max-w-lg mx-4 bg-white dark:bg-gray-900 rounded-xl shadow-2xl border border-gray-200 dark:border-gray-700 overflow-hidden",onClick:L=>L.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":u("spotlight.title"),children:[n.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:[n.jsx("svg",{className:"w-5 h-5 text-gray-400 dark:text-gray-500 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),n.jsx("input",{ref:_,type:"text",className:"flex-1 bg-transparent text-gray-900 dark:text-white text-sm placeholder-gray-400 dark:placeholder-gray-500 outline-none",placeholder:u("spotlight.placeholder"),value:d,onChange:L=>f(L.target.value),onKeyDown:M,"aria-label":u("spotlight.placeholder"),"aria-controls":"spotlight-results","aria-activedescendant":C[p]?"spotlight-item-"+p:void 0,autoComplete:"off",spellCheck:"false"}),n.jsx("kbd",{className:"hidden sm:inline-block px-1.5 py-0.5 text-xs font-mono text-gray-400 dark:text-gray-500 bg-gray-100 dark:bg-gray-800 rounded border border-gray-200 dark:border-gray-700",children:"Esc"})]}),n.jsxs("div",{id:"spotlight-results",ref:w,role:"listbox","aria-label":u("spotlight.results"),className:"max-h-80 overflow-y-auto",children:[!E&&C.length>0&&n.jsx("div",{className:"px-4 py-2 text-xs font-medium text-gray-400 dark:text-gray-500 uppercase tracking-wider",children:u("spotlight.recent_sessions")}),C.map((L,I)=>{var B;return L.isAction&&L.actionType==="new-chat"?n.jsxs("div",{id:"spotlight-item-"+I,role:"option","aria-selected":I===p,className:`flex items-center gap-3 px-4 py-2.5 cursor-pointer transition-colors border-b border-gray-100 dark:border-gray-800 ${I===p?"bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300":"text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800"}`,onClick:()=>j(L),children:[n.jsx("svg",{className:"w-4 h-4 flex-shrink-0 text-blue-500 dark:text-blue-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"})}),n.jsx("div",{className:"flex-1 min-w-0",children:n.jsx("div",{className:"text-sm font-medium truncate",children:L.title})})]},L.id):n.jsxs("div",{id:"spotlight-item-"+I,role:"option","aria-selected":I===p,className:`flex items-center gap-3 px-4 py-2.5 cursor-pointer transition-colors ${I===p?"bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300":"text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800"}`,onClick:()=>j(L),children:[n.jsx("svg",{className:"w-4 h-4 flex-shrink-0 text-gray-400 dark:text-gray-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"})}),n.jsx("div",{className:"flex-1 min-w-0",children:n.jsx("div",{className:"text-sm font-medium truncate",children:L.title||u("spotlight.untitled")})}),n.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[l[L.id]&&n.jsx("span",{className:"w-2 h-2 rounded-full bg-accent-400 animate-pulse",role:"status",title:u("sidebar.session_processing"),"aria-label":u("sidebar.session_processing")}),L.id===i&&n.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-green-100 dark:bg-green-900/40 text-green-600 dark:text-green-400 font-medium",children:u("spotlight.current")}),n.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-gray-100 dark:bg-gray-800 text-gray-500 dark:text-gray-400",children:GV(L)}),n.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 whitespace-nowrap",children:_v((B=L.time)==null?void 0:B.updated)})]})]},L.id)}),E&&C.length===0&&!v&&n.jsx("div",{className:"px-4 py-8 text-center text-sm text-gray-400 dark:text-gray-500",children:u("spotlight.no_results")}),v&&C.length===0&&n.jsx("div",{className:"px-4 py-8 text-center text-sm text-gray-400 dark:text-gray-500",children:u("spotlight.searching")})]}),n.jsxs("div",{className:"px-4 py-2 border-t border-gray-200 dark:border-gray-700 flex items-center gap-4 text-xs text-gray-400 dark:text-gray-500",children:[n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx("kbd",{className:"px-1 py-0.5 font-mono bg-gray-100 dark:bg-gray-800 rounded border border-gray-200 dark:border-gray-700",children:"↑"}),n.jsx("kbd",{className:"px-1 py-0.5 font-mono bg-gray-100 dark:bg-gray-800 rounded border border-gray-200 dark:border-gray-700",children:"↓"}),u("spotlight.navigate")]}),n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx("kbd",{className:"px-1 py-0.5 font-mono bg-gray-100 dark:bg-gray-800 rounded border border-gray-200 dark:border-gray-700",children:"↵"}),u("spotlight.select")]}),n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx("kbd",{className:"px-1 py-0.5 font-mono bg-gray-100 dark:bg-gray-800 rounded border border-gray-200 dark:border-gray-700",children:"Esc"}),u("spotlight.close")]})]})]})}):null}const Ak="pave_recent_directories",YV=10;function S4(e,t){if(!e)return"";const r=e.replace(/\\/g,"/"),a=t?t.replace(/\\/g,"/"):"";if(a&&r.startsWith(a))return"~"+r.slice(a.length);const i=r.split("/").filter(Boolean);return i.length>4?".../"+i.slice(-2).join("/"):r}function Ik(){try{const e=localStorage.getItem(Ak);return e?JSON.parse(e):[]}catch{return[]}}function XV(e){try{let t=Ik();return t=t.filter(r=>r!==e),t.unshift(e),t=t.slice(0,YV),localStorage.setItem(Ak,JSON.stringify(t)),t}catch{return[e]}}function QV(e){try{let t=Ik();return t=t.filter(r=>r!==e),localStorage.setItem(Ak,JSON.stringify(t)),t}catch{return[]}}function PA({className:e}){return n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,children:n.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})})}function ZV({isOpen:e,onClose:t,sessionId:r,currentDirectory:a,homeDir:i,onDirectoryChange:o}){var{t:l}=Jt(),u=x.useRef(null),d=x.useRef(null),[f,p]=x.useState(a||""),[h,m]=x.useState("idle"),[y,v]=x.useState(null),[k,_]=x.useState([]),[w,N]=x.useState(!1),[E,A]=x.useState(!1),[T,C]=x.useState(null),j=x.useRef(null),M=x.useRef(0);x.useEffect(function(){e&&(_(Ik()),p(a||""),m("idle"),v(null),C(null))},[e,a]),x.useEffect(function(){e&&u.current&&setTimeout(function(){u.current.focus(),u.current.select()},50)},[e]);var L=x.useCallback(function(H){if(!H||H.trim()===""){m("idle"),v(null);return}j.current&&clearTimeout(j.current),m("checking"),M.current+=1;var J=M.current;j.current=setTimeout(async function(){try{const ne=await T_(H.trim());if(J!==M.current)return;v(ne),ne.exists&&ne.isDirectory?m("valid"):ne.exists?(m("error"),v({...ne,error:l("chat.working_directory_invalid")})):m("not_found")}catch(ne){if(J!==M.current)return;m("error"),v({error:ne.message})}},300)},[l]),I=x.useCallback(function(H){var J=H.target.value;p(J),C(null),L(J)},[L]),B=x.useCallback(function(H){p(H),C(null),L(H)},[L]),z=x.useCallback(function(H,J){H.stopPropagation(),_(QV(J))},[]),ee=x.useCallback(async function(){if(f.trim()){N(!0),C(null);try{const H=await q3(f.trim());if(H.success)try{const J=await T_(H.path);m("valid"),v(J)}catch{m("valid"),v({exists:!0,isDirectory:!0,hasAgentsMd:!1,path:H.path})}}catch(H){C(l("chat.working_directory_create_failed",{error:H.message}))}finally{N(!1)}}},[f,l]),V=x.useCallback(async function(){if(!(!f.trim()||h!=="valid")){A(!0),C(null);try{const H=(y==null?void 0:y.path)||f.trim();await Xa(r,{directory:H}),_(XV(H)),o&&o(H),t()}catch(H){C(H.message)}finally{A(!1)}}},[f,h,y,r,o,t]);x.useEffect(function(){if(!e)return;function H(J){J.key==="Escape"&&(J.preventDefault(),J.stopPropagation(),t())}return document.addEventListener("keydown",H,!0),function(){document.removeEventListener("keydown",H,!0)}},[e,t]),x.useEffect(function(){if(!e)return;function H(J){J.key==="Enter"&&h==="valid"&&!E&&(J.preventDefault(),V())}return document.addEventListener("keydown",H),function(){document.removeEventListener("keydown",H)}},[e,h,E,V]),x.useEffect(function(){return function(){j.current&&clearTimeout(j.current)}},[]);var D=x.useMemo(function(){return S4(a,i)},[a,i]);if(!e)return null;var K=null;return h==="checking"?K=n.jsxs("p",{className:"text-xs text-gray-400 mt-1 flex items-center",children:[n.jsx("span",{className:"inline-block w-3 h-3 border-2 border-gray-400 border-t-transparent rounded-full animate-spin mr-2"}),l("chat.working_directory_checking")]}):h==="valid"&&y?K=n.jsx("p",{className:"text-xs text-green-500 mt-1",children:y.hasAgentsMd?"✓ "+l("chat.working_directory_has_agents_md"):"✓ "+l("chat.working_directory_no_agents_md")}):h==="not_found"?K=n.jsxs("p",{className:"text-xs text-yellow-500 mt-1",children:["⚠ ",l("chat.working_directory_not_found")]}):h==="error"&&(y!=null&&y.error)&&(K=n.jsxs("p",{className:"text-xs text-red-500 mt-1",children:["✕ ",y.error]})),n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:function(H){H.target===H.currentTarget&&t()},children:n.jsxs("div",{ref:d,className:"bg-gray-800 rounded-lg shadow-xl w-full max-w-md mx-4 overflow-hidden",role:"dialog","aria-modal":"true","aria-labelledby":"directory-modal-title",children:[n.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-700",children:[n.jsxs("div",{className:"flex items-center space-x-2",children:[n.jsx(PA,{className:"w-5 h-5 text-gray-400"}),n.jsx("h2",{id:"directory-modal-title",className:"text-lg font-semibold text-gray-100",children:l("chat.working_directory")})]}),n.jsx("button",{onClick:t,className:"text-gray-400 hover:text-gray-200 transition-colors","aria-label":l("common.close"),children:n.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),n.jsxs("div",{className:"p-4 space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-1",children:l("chat.working_directory_current")}),n.jsx("p",{className:"text-sm text-gray-200 font-mono bg-gray-900 px-3 py-2 rounded",title:a,children:D||a||l("chat.working_directory_not_set")})]}),n.jsxs("div",{children:[n.jsx("label",{htmlFor:"directory-input",className:"block text-sm font-medium text-gray-400 mb-1",children:l("chat.working_directory_new_path")}),n.jsx("input",{ref:u,id:"directory-input",type:"text",value:f,onChange:I,className:"w-full px-3 py-2 bg-gray-900 border border-gray-600 rounded text-gray-100 font-mono text-sm placeholder-gray-500 focus:outline-none focus:border-blue-500",placeholder:l("chat.working_directory_placeholder"),autoComplete:"off",spellCheck:"false"}),K]}),T&&n.jsx("p",{className:"text-sm text-red-500",children:T}),k.length>0&&n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-2",children:l("chat.working_directory_recent")}),n.jsx("div",{className:"space-y-1 max-h-40 overflow-y-auto",children:k.map(function(H){return n.jsxs("div",{onClick:function(){B(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:[n.jsx("span",{className:"text-sm text-gray-200 font-mono truncate flex-1",title:H,children:S4(H,i)}),n.jsx("button",{onClick:function(J){z(J,H)},className:"text-gray-500 hover:text-red-400 opacity-0 group-hover:opacity-100 transition-opacity ml-2",title:l("chat.working_directory_remove_recent"),children:n.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},H)})})]})]}),n.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-t border-gray-700 bg-gray-800/50",children:[n.jsx("div",{children:h==="not_found"&&n.jsx("button",{onClick:ee,disabled:w,className:"px-3 py-1.5 text-sm font-medium text-yellow-400 border border-yellow-500/50 rounded hover:bg-yellow-500/10 transition-colors disabled:opacity-50",children:w?"...":l("chat.working_directory_create")})}),n.jsxs("div",{className:"flex items-center space-x-2",children:[n.jsx("button",{onClick:t,className:"px-4 py-2 text-sm font-medium text-gray-300 hover:text-gray-100 transition-colors",children:l("chat.working_directory_cancel")}),n.jsx("button",{onClick:V,disabled:h!=="valid"||E,className:"px-4 py-2 text-sm font-medium text-white bg-blue-600 rounded hover:bg-blue-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:E?"...":l("chat.working_directory_change")})]})]})]})})}var cn={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 JV(e){if(e==null||e==="")return"";var t=Number(e);return isNaN(t)?"":String(t)}function Hd(e){if(e==null||e==="")return"";var t=Number(e)/1e3;return isNaN(t)?"":String(t)}function $d(e){var t=parseFloat(e);return isNaN(t)||t<0?0:Math.round(t*1e3)}function xl(e){var t=e.children;return n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1 leading-snug",children:t})}function eG(e){var t=e.isOpen,r=e.onClose,a=e.sessionId,i=Jt().t,o=x.useRef(null),l=x.useState(null);l[0];var u=l[1],d=x.useState(!0),f=d[0],p=d[1],h=x.useState(!1),m=h[0],y=h[1],v=x.useState(null),k=v[0],_=v[1],w=x.useState(null),N=w[0],E=w[1],A=x.useState(cn.enabled),T=A[0],C=A[1],j=x.useState(cn.message),M=j[0],L=j[1],I=x.useState(String(cn.intervalMs)),B=I[0],z=I[1],ee=x.useState(String(cn.maxInjections)),V=ee[0],D=ee[1],K=x.useState(cn.timeout.enabled),H=K[0],J=K[1],ne=x.useState(String(cn.timeout.thresholdMs)),P=ne[0],U=ne[1],X=x.useState(String(cn.timeout.cooldownMs)),F=X[0],Z=X[1],W=x.useState(cn.mode),G=W[0],oe=W[1],Q=x.useState(String(cn.waitMs)),fe=Q[0],ke=Q[1],Fe=x.useRef(null),Ve=x.useState([]),Ge=Ve[0],qe=Ve[1],Ce=x.useState(!1),He=Ce[0],ze=Ce[1],gt=x.useState(!1),mt=gt[0],wt=gt[1],$e=x.useState("9"),Et=$e[0],Ze=$e[1],Oe=x.useState("0"),it=Oe[0],me=Oe[1],Ee=x.useState("AM"),ge=Ee[0],je=Ee[1],se=x.useState("weekdays"),De=se[0],rt=se[1],dt=x.useState([1,2,3,4,5]),lt=dt[0],Lt=dt[1],ot=x.useState(""),et=ot[0],Ot=ot[1],gr="";try{gr=Intl.DateTimeFormat().resolvedOptions().timeZone||""}catch{}x.useEffect(function(){return function(){Fe.current&&clearTimeout(Fe.current)}},[]);var dr=x.useCallback(function(){a&&(p(!0),_(null),eT(a).then(function(Me){var Tt=Me&&Me.config?Me.config:cn;u(Tt),C(Tt.enabled||!1),L(Tt.message||cn.message),z(Hd(Tt.intervalMs!=null?Tt.intervalMs:cn.intervalMs)),D(JV(Tt.maxInjections!=null?Tt.maxInjections:cn.maxInjections)),J(Tt.timeout?Tt.timeout.enabled:cn.timeout.enabled),U(Hd(Tt.timeout&&Tt.timeout.thresholdMs!=null?Tt.timeout.thresholdMs:cn.timeout.thresholdMs)),Z(Hd(Tt.timeout&&Tt.timeout.cooldownMs!=null?Tt.timeout.cooldownMs:cn.timeout.cooldownMs)),oe(Tt.mode||cn.mode),ke(Hd(Tt.waitMs!=null?Tt.waitMs:cn.waitMs))}).catch(function(Me){_(Me.message||"Failed to load config")}).finally(function(){p(!1)}))},[a]);x.useEffect(function(){t&&dr()},[t,dr]);var or=x.useCallback(function(){a&&d3(a).then(function(Me){qe(Me&&Me.schedules?Me.schedules:[])}).catch(function(){qe([])})},[a]);x.useEffect(function(){t&&or()},[t,or]),x.useEffect(function(){if(!t)return;function Me(Tt){Tt.key==="Escape"&&r()}return document.addEventListener("keydown",Me),function(){document.removeEventListener("keydown",Me)}},[t,r]);function Qt(){if(a){y(!0),_(null),E(null);var Me={enabled:T,message:M.trim()||cn.message,intervalMs:$d(B)||cn.intervalMs,maxInjections:parseInt(V,10)||0,mode:G||cn.mode,waitMs:$d(fe),timeout:{enabled:H,thresholdMs:$d(P)||cn.timeout.thresholdMs,cooldownMs:$d(F)||cn.timeout.cooldownMs}};c3(a,Me).then(function(){u(Me),E(i("chat.idle_injection_saved")),Fe.current&&clearTimeout(Fe.current),Fe.current=setTimeout(function(){E(null)},3e3)}).catch(function(Tt){_(Tt.message||"Failed to save")}).finally(function(){y(!1)})}}function $r(){a&&(y(!0),_(null),E(null),u3(a).then(function(){C(!1),u(null)}).catch(function(Me){_(Me.message||"Failed to disable")}).finally(function(){y(!1)}))}function ue(Me,Tt){var tr=parseInt(Me,10);return Tt==="PM"&&tr!==12&&(tr+=12),Tt==="AM"&&tr===12&&(tr=0),tr}function Le(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 ct(Me,Tt){return Me==="every_day"?[0,1,2,3,4,5,6]:Me==="weekdays"?[1,2,3,4,5]:Me==="weekends"?[0,6]:Tt.slice().sort()}function Be(Me){var Tt=Le(Me.hour),tr=String(Me.minute).padStart(2,"0");return Tt.h+":"+tr+" "+Tt.ap}function nt(Me){var Tt=Me.daysOfWeek||[],tr="";if(Tt.length===7)tr=i("scheduled_injection.repeat_every_day");else if(Tt.length===5&&Tt.indexOf(1)!==-1&&Tt.indexOf(5)!==-1)tr=i("scheduled_injection.repeat_weekdays");else if(Tt.length===2&&Tt.indexOf(0)!==-1&&Tt.indexOf(6)!==-1)tr=i("scheduled_injection.repeat_weekends");else{for(var rn=["day_sun","day_mon","day_tue","day_wed","day_thu","day_fri","day_sat"],hn=[],mn=0;mn<7;mn++)Tt.indexOf(mn)!==-1&&hn.push(i("scheduled_injection."+rn[mn]));tr=hn.join(", ")}return Me.timezone&&(tr+=" ("+Me.timezone+")"),tr}function kt(){if(a){wt(!0),_(null);var Me={hour:ue(Et,ge),minute:parseInt(it,10),daysOfWeek:ct(De,lt),timezone:gr||null,message:et.trim(),enabled:!0};f3(a,Me).then(function(){ze(!1),Ot(""),or()}).catch(function(Tt){_(Tt.message||i("scheduled_injection.error_generic"))}).finally(function(){wt(!1)})}}function at(Me,Tt){a&&p3(a,Me,{enabled:!Tt}).then(function(){or()}).catch(function(tr){_(tr.message||"Failed to toggle schedule")})}function re(Me){a&&g3(a,Me).then(function(){or()}).catch(function(Tt){_(Tt.message||"Failed to delete schedule")})}function ve(Me){var Tt=lt.indexOf(Me);Lt(Tt===-1?lt.concat([Me]):lt.filter(function(tr){return tr!==Me}))}if(!t)return null;var Re="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-none focus:ring-2 focus:ring-primary-500 focus:border-transparent",Rt="space-y-3",ft=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")},Ut=function(Me){return"inline-block h-4 w-4 transform rounded-full bg-white transition-transform "+(Me?"translate-x-6":"translate-x-1")};return n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"fixed inset-0 z-40 bg-black/30",onClick:r,"aria-hidden":"true"}),n.jsxs("aside",{ref:o,className:"fixed right-0 top-0 bottom-0 z-50 w-96 max-w-[90vw] bg-white dark:bg-gray-950 shadow-xl border-l border-gray-200 dark:border-gray-800 flex flex-col",role:"dialog","aria-label":i("chat.idle_injection_title"),children:[n.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-800 flex-shrink-0",children:[n.jsx("h2",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:i("chat.idle_injection_title")}),n.jsx("button",{onClick:r,className:"p-1.5 rounded-lg text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors","aria-label":i("common.close"),children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),n.jsx("div",{className:"flex-1 overflow-y-auto px-4 py-4 space-y-5",children:f?n.jsx("div",{className:"flex items-center justify-center py-8",children:n.jsx("div",{className:"animate-spin h-6 w-6 border-2 border-primary-500 border-t-transparent rounded-full"})}):n.jsxs(n.Fragment,{children:[k&&n.jsx("div",{className:"px-3 py-2 rounded-lg bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 text-sm",children:k}),N&&n.jsx("div",{className:"px-3 py-2 rounded-lg bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400 text-sm",children:N}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:i("chat.idle_injection_toggle")}),n.jsx("button",{type:"button",onClick:function(){C(!T)},className:ft(T),"aria-pressed":T,"aria-label":i("chat.idle_injection_toggle"),children:n.jsx("span",{className:Ut(T)})})]}),n.jsxs("div",{className:Rt,children:[n.jsx("label",{className:Re,htmlFor:"ii-message",children:i("chat.idle_injection_message")}),n.jsx("textarea",{id:"ii-message",value:M,onChange:function(Me){L(Me.target.value)},className:ie+" resize-none",rows:3,placeholder:i("chat.idle_injection_message_placeholder"),disabled:!T})]}),n.jsxs("div",{className:Rt,children:[n.jsx("label",{className:Re,htmlFor:"ii-interval",children:i("chat.idle_injection_interval")}),n.jsx("input",{id:"ii-interval",type:"number",value:B,onChange:function(Me){z(Me.target.value)},className:ie,min:.5,step:.5,disabled:!T}),n.jsx(xl,{children:i("chat.idle_injection_interval_desc")})]}),n.jsxs("div",{className:Rt,children:[n.jsx("label",{className:Re,htmlFor:"ii-max",children:i("chat.idle_injection_max")}),n.jsx("input",{id:"ii-max",type:"number",value:V,onChange:function(Me){D(Me.target.value)},className:ie,min:0,disabled:!T}),n.jsx(xl,{children:i("chat.idle_injection_max_desc")})]}),n.jsxs("div",{className:Rt,children:[n.jsx("label",{className:Re,htmlFor:"ii-mode",children:i("chat.idle_injection_mode")}),n.jsxs("select",{id:"ii-mode",value:G,onChange:function(Me){oe(Me.target.value)},className:ie,disabled:!T,children:[n.jsx("option",{value:"urgent",children:i("chat.idle_injection_mode_urgent")}),n.jsx("option",{value:"normal",children:i("chat.idle_injection_mode_normal")}),n.jsx("option",{value:"idle",children:i("chat.idle_injection_mode_idle")})]}),n.jsx(xl,{children:i("chat.idle_injection_mode_desc")})]}),G==="idle"&&n.jsxs("div",{className:Rt,children:[n.jsx("label",{className:Re,htmlFor:"ii-wait",children:i("chat.idle_injection_wait_ms")}),n.jsx("input",{id:"ii-wait",type:"number",value:fe,onChange:function(Me){ke(Me.target.value)},className:ie,min:0,step:.5,disabled:!T}),n.jsx(xl,{children:i("chat.idle_injection_wait_ms_desc")})]}),n.jsx("div",{className:"border-t border-gray-200 dark:border-gray-800 pt-4"}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex flex-col",children:[n.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:i("chat.idle_injection_timeout_toggle")}),n.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:i("chat.idle_injection_timeout_toggle_desc")})]}),n.jsx("button",{type:"button",onClick:function(){J(!H)},className:ft(H),"aria-pressed":H,"aria-label":i("chat.idle_injection_timeout_toggle"),disabled:!T,children:n.jsx("span",{className:Ut(H)})})]}),n.jsxs("div",{className:Rt,children:[n.jsx("label",{className:Re,htmlFor:"ii-threshold",children:i("chat.idle_injection_timeout_threshold")}),n.jsx("input",{id:"ii-threshold",type:"number",value:P,onChange:function(Me){U(Me.target.value)},className:ie,min:1,step:.5,disabled:!T||!H}),n.jsx(xl,{children:i("chat.idle_injection_timeout_threshold_desc")})]}),n.jsxs("div",{className:Rt,children:[n.jsx("label",{className:Re,htmlFor:"ii-cooldown",children:i("chat.idle_injection_timeout_cooldown")}),n.jsx("input",{id:"ii-cooldown",type:"number",value:F,onChange:function(Me){Z(Me.target.value)},className:ie,min:.5,step:.5,disabled:!T||!H}),n.jsx(xl,{children:i("chat.idle_injection_timeout_cooldown_desc")})]}),n.jsx("div",{className:"border-t border-gray-200 dark:border-gray-800 pt-4"}),n.jsxs("div",{className:Rt,children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:i("scheduled_injection.title")}),n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:i("scheduled_injection.subtitle")})]}),Ge.length===0&&!He&&n.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 italic",children:i("scheduled_injection.empty")}),Ge.map(function(Me){return n.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:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex flex-col",children:[n.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:Be(Me)}),n.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:nt(Me)})]}),n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("button",{type:"button",onClick:function(){at(Me.id,Me.enabled)},className:ft(Me.enabled),"aria-pressed":Me.enabled,"aria-label":i("scheduled_injection.enabled"),children:n.jsx("span",{className:Ut(Me.enabled)})}),n.jsx("button",{type:"button",onClick:function(){re(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:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]})]}),Me.message&&n.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 italic truncate",children:['"',Me.message,'"']})]},Me.id)}),He?n.jsxs("div",{className:"rounded-lg border border-gray-200 dark:border-gray-700 p-3 space-y-3 bg-gray-50 dark:bg-gray-900/50",children:[n.jsxs("div",{children:[n.jsx("label",{className:Re,children:i("scheduled_injection.time")}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("select",{value:Et,onChange:function(Me){Ze(Me.target.value)},className:ie+" w-20",children:[1,2,3,4,5,6,7,8,9,10,11,12].map(function(Me){return n.jsx("option",{value:String(Me),children:Me},Me)})}),n.jsx("span",{className:"text-gray-500",children:":"}),n.jsxs("select",{value:it,onChange:function(Me){me(Me.target.value)},className:ie+" w-20",children:[n.jsx("option",{value:"0",children:"00"}),n.jsx("option",{value:"15",children:"15"}),n.jsx("option",{value:"30",children:"30"}),n.jsx("option",{value:"45",children:"45"})]}),n.jsxs("select",{value:ge,onChange:function(Me){je(Me.target.value)},className:ie+" w-20",children:[n.jsx("option",{value:"AM",children:"AM"}),n.jsx("option",{value:"PM",children:"PM"})]})]})]}),n.jsxs("div",{children:[n.jsx("label",{className:Re,children:i("scheduled_injection.repeat")}),n.jsxs("select",{value:De,onChange:function(Me){rt(Me.target.value)},className:ie,children:[n.jsx("option",{value:"every_day",children:i("scheduled_injection.repeat_every_day")}),n.jsx("option",{value:"weekdays",children:i("scheduled_injection.repeat_weekdays")}),n.jsx("option",{value:"weekends",children:i("scheduled_injection.repeat_weekends")}),n.jsx("option",{value:"custom",children:i("scheduled_injection.repeat_custom")})]})]}),De==="custom"&&n.jsx("div",{children:n.jsx("div",{className:"flex flex-wrap gap-1.5",children:[{d:0,k:"day_sun"},{d:1,k:"day_mon"},{d:2,k:"day_tue"},{d:3,k:"day_wed"},{d:4,k:"day_thu"},{d:5,k:"day_fri"},{d:6,k:"day_sat"}].map(function(Me){var Tt=lt.indexOf(Me.d)!==-1;return n.jsx("button",{type:"button",onClick:function(){ve(Me.d)},className:"px-2.5 py-1 rounded-md text-xs font-medium transition-colors "+(Tt?"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)})})}),gr&&n.jsxs("div",{children:[n.jsx("label",{className:Re,children:i("scheduled_injection.timezone")}),n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:gr})]}),n.jsxs("div",{children:[n.jsx("label",{className:Re,children:i("scheduled_injection.message")}),n.jsx("textarea",{value:et,onChange:function(Me){Ot(Me.target.value)},className:ie+" resize-none",rows:2,placeholder:i("scheduled_injection.message_placeholder")})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("button",{type:"button",onClick:kt,disabled:mt||De==="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(mt?"scheduled_injection.saving":"scheduled_injection.save")}),n.jsx("button",{type:"button",onClick:function(){ze(!1)},disabled:mt,className:"px-3 py-1.5 rounded-lg bg-gray-200 dark:bg-gray-800 text-gray-700 dark:text-gray-300 text-sm font-medium hover:bg-gray-300 dark:hover:bg-gray-700 transition-colors",children:i("common.close")})]})]}):n.jsxs("button",{type:"button",onClick:function(){ze(!0)},className:"w-full px-3 py-2 rounded-lg border border-dashed border-gray-300 dark:border-gray-700 text-gray-500 dark:text-gray-400 text-sm hover:border-primary-400 hover:text-primary-600 dark:hover:text-primary-400 transition-colors",children:["+ ",i("scheduled_injection.add")]})]})]})}),!f&&n.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-t border-gray-200 dark:border-gray-800 flex-shrink-0",children:[n.jsx("button",{onClick:Qt,disabled:m,className:"flex-1 px-4 py-2 rounded-lg bg-primary-600 text-white text-sm font-medium hover:bg-primary-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:i(m?"chat.idle_injection_saving":"chat.idle_injection_save")}),n.jsx("button",{onClick:$r,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 tG({items:e,sessionId:t,isReadOnly:r,onReorder:a,onCancelItem:i,onEditItem:o,t:l}){var[u,d]=x.useState(null),[f,p]=x.useState(null),h=x.useRef(0),m=x.useCallback(function(N,E){if(e[E]&&e[E].status==="dispatching"){N.preventDefault();return}d(E),N.dataTransfer.effectAllowed="move";try{N.dataTransfer.setData("text/plain",String(E))}catch{}},[e]),y=x.useCallback(function(N,E){N.preventDefault(),h.current++,e[E]&&e[E].status!=="dispatching"&&p(E)},[e]),v=x.useCallback(function(N,E){N.preventDefault(),N.dataTransfer.dropEffect="move"},[]),k=x.useCallback(function(){h.current--,h.current<=0&&(h.current=0,p(null))},[]),_=x.useCallback(function(N,E){if(N.preventDefault(),h.current=0,p(null),u===null||u===E){d(null);return}var A=e.slice(),T=A.splice(u,1)[0];A.splice(E,0,T),d(null);var C=A.filter(function(j){return j.status!=="dispatching"}).map(function(j){return j.id});a(C)},[u,e,a]),w=x.useCallback(function(){d(null),p(null),h.current=0},[]);return!e||e.length===0?null:n.jsxs("div",{className:"px-4 pt-2 pb-1 border-t border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900 flex flex-col gap-1",children:[n.jsxs("div",{className:"text-xs uppercase tracking-wide text-gray-500 dark:text-gray-400",children:[l("chat.queued")," (",e.length,")"]}),e.map(function(N,E){var A=N.status==="dispatching",T=u===E,C=f===E&&u!==E,j=!A&&!r;return n.jsxs("div",{draggable:j,onDragStart:j?function(M){m(M,E)}:void 0,onDragEnter:j?function(M){y(M,E)}:void 0,onDragOver:j?function(M){v(M,E)}:void 0,onDragLeave:j?k:void 0,onDrop:j?function(M){_(M,E)}:void 0,onDragEnd:j?w:void 0,className:"flex items-center justify-between gap-2 px-2 py-1 rounded border text-sm group transition-colors duration-150 "+(A?"border-gray-200 dark:border-gray-700 bg-gray-100 dark:bg-gray-800 opacity-50 ":"border-dashed border-gray-300 dark:border-gray-700 ")+(T?"opacity-40 bg-gray-200 dark:bg-gray-700 ":"")+(C?"border-solid border-accent-400 dark:border-accent-500 bg-accent-50 dark:bg-accent-900/20 ":"")+(j?"cursor-grab active:cursor-grabbing ":""),children:[j&&n.jsx("svg",{className:"w-3 h-3 flex-shrink-0 text-gray-400 dark:text-gray-500 opacity-0 group-hover:opacity-100 transition-opacity",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 8h16M4 16h16"})}),n.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1 cursor-pointer",role:"button",tabIndex:0,onClick:function(){o(N)},onKeyDown:function(M){(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),o(N))},title:l("chat.edit_queued"),"aria-label":l("chat.edit_queued"),children:[n.jsx("span",{className:"text-[10px] uppercase px-1 rounded bg-gray-200 dark:bg-gray-800 text-gray-600 dark:text-gray-400",children:N.source||"queued"}),N.priority==="urgent"&&n.jsx("span",{className:"text-[10px] uppercase px-1 rounded bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-200",children:"urgent"}),n.jsx("span",{className:"truncate text-gray-700 dark:text-gray-300 group-hover:text-accent-600 dark:group-hover:text-accent-400 transition-colors",children:N.displayContent||N.text||""}),!A&&!r&&n.jsx("svg",{className:"w-3 h-3 flex-shrink-0 text-gray-400 group-hover:text-accent-500 dark:text-gray-500 dark:group-hover:text-accent-400 transition-colors",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})})]}),!A&&!r&&n.jsx("button",{type:"button",onClick:function(M){M.stopPropagation(),i(N.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:"×"})]},N.id)})]})}function rG(e){if(!e||typeof e!="string")return[];const t=[],r=e.split(`
121
+ `);for(let a=0;a<r.length;a++){const i=r[a].trim();if(i)try{t.push(JSON.parse(i))}catch{}}return t.sort((a,i)=>(a.seq||0)-(i.seq||0)),t}function au(e){return!!e&&typeof e=="object"&&typeof e.$ref=="string"}function Il(e){if(!au(e))return null;const t=/(\d+)/.exec(e.$ref);return t?Number(t[1]):null}function nG(e){const t=[],r=new Map;let a=null,i=null;for(const u of e)switch(u.type){case"context":a=u;break;case"store_snapshot":i=u;break;case"request":{const d={seq:u.seq,ts:u.ts,provider:u.provider,model:u.model,url:u.url,headers:u.headers||{},body:u.body,params:u.params||{},sentEstTokens:u.estWireTokens,bodyBytes:u.bodyBytes,shrink:u.shrink||null,fingerprint:u.fingerprint||u.cache&&u.cache.fingerprint||null,cache:u.cache||null,chunks:[],response:null,context:null,store:null,bubbleMessageID:null,compaction:null,messageDrop:null};a&&(a.reqSeq==null||a.reqSeq===u.seq)&&(d.context=a,a=null),i&&(i.reqSeq==null||i.reqSeq===u.seq)&&(d.store=i,i=null),t.push(d),r.set(u.seq,d);break}case"chunk":{const d=r.get(u.reqSeq);d&&d.chunks.push(u);break}case"response_end":{const d=r.get(u.reqSeq);d&&(d.response=u);break}case"bubble_map":{const d=r.get(u.reqSeq);d&&(d.bubbleMessageID=u.messageID);break}case"compaction":{let d=null;for(const f of t)if(f.seq<=u.seq)d=f;else break;d&&(d.compaction=u);break}case"message_drop":{const d=r.get(u.reqSeq);d&&(d.messageDrop=u);break}}let o=null,l=null;for(const u of t){u.context?l=u.seq:u.contextFrom=l,u.chunks.sort((d,f)=>(d.seq||0)-(f.seq||0)),u.chunkCount=u.chunks.length,u.interArrivalGaps=[];for(let d=1;d<u.chunks.length;d++)u.interArrivalGaps.push((u.chunks[d].ts||0)-(u.chunks[d-1].ts||0));u.sentActualTokens=u.response&&u.response.usage?u.response.usage.prompt_tokens:null,u.storeTokens=u.store?u.store.storeTokens:null,u.storeMessages=u.store?u.store.storeMessages:null,u.trimmed=u.storeTokens!=null&&u.sentActualTokens!=null?Math.max(0,u.storeTokens-u.sentActualTokens):null,u.chunks.length>0&&u.ts!=null?u.ttftMs=(u.chunks[0].ts||0)-u.ts:u.response&&u.response.ttftMs!=null?u.ttftMs=u.response.ttftMs:u.ttftMs=null,u.totalMs=u.response?u.response.totalMs:null,u.status=u.response?u.response.status:null,u.finishReason=u.response?u.response.finishReason:null,u.paveContext=u.response&&u.response.paveContext||null,u.sentActualDelta=o!=null&&u.sentActualTokens!=null?u.sentActualTokens-o:null,u.sentActualTokens!=null&&(o=u.sentActualTokens),u.purpose=aG(u)}return t}function aG(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 iG(e){const t=[];let r=null,a=null;for(const i of e)(r===null||a==="stop"||a==="error")&&(r={index:t.length,requests:[]},t.push(r)),r.requests.push(i),a=i.finishReason;return t}function sG(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 oG(e){return e.filter(t=>t.type==="compaction")}function lG(e){return e.filter(t=>t.type==="message_drop")}function cG(e,t){const r=f=>{const p=Array.isArray(f)?f.slice():[];return p.length&&p[0]&&p[0].role==="system"?p.slice(1):p},a=r(e),i=r(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(a),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:a.length,currLen:i.length,roles:d}}function uG(e){const t=e&&e.raw;if(t==="[DONE]")return{parts:[{type:"done",piece:""}]};let r;try{r=JSON.parse(t)}catch{return{parts:[{type:"other",piece:""}]}}const a=[],i=r&&r.choices&&r.choices[0]&&r.choices[0].delta;if(i){const o=i.reasoning_content??i.reasoning??i.thinking;if(o!=null&&o!==""&&a.push({type:"reasoning",piece:o}),i.content!=null&&i.content!==""&&a.push({type:"text",piece:i.content}),i.tool_calls&&i.tool_calls.length){const u=(i.tool_calls[0]||{}).function||{};a.push({type:"tool",piece:(u.name?u.name+" ":"")+(u.arguments!=null?u.arguments:"")})}}return r&&r.usage&&a.push({type:"usage",piece:JSON.stringify(r.usage)}),a.length===0&&a.push({type:"other",piece:""}),{parts:a}}function N4(e){try{return JSON.stringify(e)}catch{return String(e)}}function E4(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 dG(e,t){const r=Array.isArray(e)?e:[],a=Array.isArray(t)?t:[],i=a.length&&a[0]&&a[0].role==="system"?a.slice(1):a.slice(),o=Math.max(r.length,i.length),l=[];let u=-1,d=1;for(let f=0;f<o;f++){const p=f<r.length?r[f]:void 0,h=f<i.length?i[f]:void 0,m=p===void 0?void 0:N4(p),y=h===void 0?void 0:N4(h),v=m===void 0?null:m.length,k=y===void 0?null:y.length;v!=null&&(d=Math.max(d,v)),k!=null&&(d=Math.max(d,k));const _=m!==y;let w="unchanged";if(p===void 0)w="added";else if(h===void 0)w="dropped";else if(_){const N=p.role||h.role;k<v?N==="tool"?w="tool output stubbed":E4(p)&&!E4(h)?w="reasoning stripped":w="text capped":w="changed"}_&&u<0&&(u=f),l.push({i:f,role:(p||h||{}).role||"?",beforeBytes:v,afterBytes:k,changed:_,tag:w})}return{rows:l,firstChanged:u,maxBytes:d}}function fG(e){const t=typeof e=="string"?rG(e):Array.isArray(e)?e:[],r=nG(t),a=iG(r),i=sG(r),o=oG(t),l=lG(t);return{events:t,requests:r,turns:a,timeline:i,compactions:o,messageDrops:l}}function ef(e,t){if(e==null)return"(none)";if(e&&typeof e=="object"&&typeof e.$ref=="string"){const r=Il(e);if(t&&r!=null&&t.has(r)){const a=t.get(r);try{return typeof a=="string"?a:JSON.stringify(a,null,2)}catch{return String(a)}}return`(large — spilled to ${e.$ref}, not fetched)`}try{return typeof e=="string"?e:JSON.stringify(e,null,2)}catch{return String(e)}}function pG(e){return e?Object.keys(e).map(t=>`${t}=${typeof e[t]=="object"?JSON.stringify(e[t]):e[t]}`).join(" "):""}function FA(e,t){const r=[];r.push(`--- Request #${e.seq} [${e.purpose}] ${e.provider||"?"}/${e.model||"?"} ---`),e.url&&r.push(`url: ${e.url}`);const a=pG(e.params);if(a&&r.push(`params: ${a}`),r.push(`sent est: ${e.sentEstTokens??"?"} sent actual (prompt_tokens): ${e.sentActualTokens??"?"} store: ${e.storeTokens??"?"}`),r.push(`status: ${e.status??"?"} finishReason: ${e.finishReason??"?"} ttft: ${e.ttftMs??"?"}ms total: ${e.totalMs??"?"}ms`),e.paveContext&&r.push(`resolvedModel: ${e.paveContext.resolvedModel??"?"} contextFloor: ${e.paveContext.contextFloor??"?"}`),e.bubbleMessageID&&r.push(`bubble messageID: ${e.bubbleMessageID}`),r.push("REQUEST HEADERS (redacted):"),r.push(ef(e.headers,t)),r.push("REQUEST BODY (exact bytes sent):"),r.push(ef(e.body,t)),e.response){const i=e.response.assembled;r.push("RESPONSE (assembled):"),i&&typeof i=="object"&&i.$ref?r.push(ef(i,t)):i&&(i.reasoning&&r.push(`reasoning: ${i.reasoning}`),r.push(`text: ${i.text||""}`),i.tool_calls&&i.tool_calls.length&&r.push(`tool_calls: ${JSON.stringify(i.tool_calls)}`))}if(e.context){const i=e.context;r.push(`CONTEXT: limit=${i.limit} usable=${i.usable} margin=${i.margin} threshold=${i.threshold} tokReal=${i.tokReal} needsCompaction=${i.needsCompaction} source=${i.source??""} windowSource=${i.windowSource??i.epmWindowSignal??""}`)}if(e.compaction){const i=e.compaction,o=[`COMPACTION [${i.trigger}]`];i.deletedMessages!=null&&o.push(`deleted=${i.deletedMessages}`),i.summaryTokens!=null&&o.push(`summaryTok=${i.summaryTokens}`),i.before!=null&&o.push(`before=${i.before}`),i.after!=null&&o.push(`after=${i.after}`),typeof i.handoffFresh=="boolean"&&o.push(`handoffFresh=${i.handoffFresh}`),r.push(o.join(" "))}if(e.messageDrop){const i=e.messageDrop;r.push(`⚠ MESSAGE DROP wire ${i.wireBefore}→${i.wireAfter} (vs req #${i.prevSeq}, no compaction`+(i.storeMessages!=null?`, store intact=${i.storeMessages}`:"")+")")}return r.join(`
122
+ `)}function BA(e){const t=[`--- Chunks for request #${e.seq} (${e.chunkCount}) ---`],r=e.ts;for(let a=0;a<e.chunks.length;a++){const i=e.chunks[a],o=a===0?r!=null?i.ts-r:0:i.ts-e.chunks[a-1].ts;t.push(`[+${o}ms]${i.kind?" ("+i.kind+")":""} ${i.raw}`)}return t.join(`
123
+ `)}function gG(e,t){if(!e.response)return`(no response captured for request #${e.seq})`;const r=e.response.assembled,a=[`--- Response for request #${e.seq} (status ${e.status}, ${e.finishReason}) ---`];return r&&typeof r=="object"&&r.$ref?a.push(ef(r,t)):r&&(r.reasoning&&a.push(`reasoning:
124
+ ${r.reasoning}`),a.push(`text:
125
+ ${r.text||""}`),r.tool_calls&&r.tool_calls.length&&a.push(`tool_calls:
126
+ ${JSON.stringify(r.tool_calls,null,2)}`)),e.response.usage&&a.push(`usage: ${JSON.stringify(e.response.usage)}`),a.join(`
127
+ `)}function j4(e,t,r){const{requests:a,timeline:i,compactions:o,messageDrops:l}=e,u=[];u.push(`=== PAVE Inspector session ${t||""} ===`);const d=(l||[]).length;u.push(`requests: ${a.length} compactions: ${o.length}`+(d?` ⚠ message-drops: ${d}`:""));const f=a.find(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 a)u.push(FA(p,r)),p.chunkCount&&(u.push(`CHUNKS (${p.chunkCount}):`),u.push(BA(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(`
128
+ `)}function hG(e){const t=new Set;for(const r of e.requests||[])for(const a of[r.body,r.response&&r.response.assembled])if(a&&typeof a=="object"&&typeof a.$ref=="string"){const i=Il(a);i!=null&&t.add(i)}return Array.from(t)}function Ts(e){return e==null?"—":e>=1e6?(e/1e6).toFixed(1)+"M":e>=1e3?(e/1e3).toFixed(1)+"k":String(e)}const Wd=[{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."}],C4=[{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 mG({timeline:e,selectedSeq:t,onSelectSeq:r,height:a=240}){const[i,o]=x.useState(null),[l,u]=x.useState("data"),[d,f]=x.useState(!1),p=x.useRef(null),[h,m]=x.useState(720);x.useEffect(()=>{const j=p.current;if(!j||typeof ResizeObserver>"u")return;const M=new ResizeObserver(L=>{const I=L[0]&&L[0].contentRect&&L[0].contentRect.width;I&&I>0&&m(Math.round(I))});return M.observe(j),()=>M.disconnect()},[]);const y={top:16,right:116,bottom:34,left:56},v=Math.max(1,h-y.left-y.right),k=Math.max(1,a-y.top-y.bottom),_=Array.isArray(e)?e:[],w=x.useMemo(()=>{if(_.length===0)return 1;let j=0;for(const M of _){for(const L of Wd)M[L.key]!=null&&(j=Math.max(j,M[L.key]));M.threshold!=null&&(j=Math.max(j,M.threshold)),l==="window"&&(M.usable!=null&&(j=Math.max(j,M.usable)),M.limit!=null&&(j=Math.max(j,M.limit)))}return Math.max(1,Math.ceil(j*1.12))},[_,l]);if(_.length===0)return n.jsx("div",{className:"h-40 flex items-center justify-center text-sm text-gray-400 dark:text-gray-500",children:"No requests captured for this session yet."});const N=j=>y.left+(_.length===1?v/2:j/(_.length-1)*v),E=j=>y.top+k-Math.min(j,w)/w*k,A=j=>{const M=[];let L=!1;return _.forEach((I,B)=>{if(I[j]==null){L=!1;return}M.push(`${L?"L":"M"} ${N(B).toFixed(1)} ${E(I[j]).toFixed(1)}`),L=!0}),M.join(" ")},T=()=>{const j=[];let M=[];const L=()=>{if(M.length){const I=M.map(z=>`${N(z).toFixed(1)} ${E(_[z].storeTokens).toFixed(1)}`),B=M.slice().reverse().map(z=>`${N(z).toFixed(1)} ${E(_[z].sentActual).toFixed(1)}`);j.push("M "+I.join(" L ")+" L "+B.join(" L ")+" Z")}M=[]};return _.forEach((I,B)=>{I.storeTokens!=null&&I.sentActual!=null&&I.storeTokens>I.sentActual?M.push(B):L()}),L(),j.join(" ")},C=[0,.25,.5,.75,1].map(j=>Math.round(w*j));return n.jsxs("div",{ref:p,className:"relative",children:[n.jsxs("div",{className:"flex items-center justify-between mb-1 px-1",children:[n.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Context timeline — store vs sent"}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("button",{type:"button",onClick:()=>f(j=>!j),className:"text-[11px] px-2 py-0.5 rounded transition-colors "+(d?"bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-300":"bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"),title:"Show/hide the legend explaining every label",children:"legend"}),n.jsxs("button",{type:"button",onClick:()=>u(j=>j==="data"?"window":"data"),className:"text-[11px] px-2 py-0.5 rounded bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors",title:"Toggle Y scale between fit-to-data and the full context window",children:["scale: ",l==="data"?"fit data":"full window"]})]})]}),d&&n.jsxs("div",{className:"mb-2 rounded-lg border border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900/60 p-2 text-[11px] space-y-1",children:[n.jsxs("div",{className:"pb-1 mb-1 border-b border-gray-200 dark:border-gray-800 text-gray-600 dark:text-gray-300",children:["The two message arrays: ",n.jsx("b",{children:"store"})," = the full persisted history (grows every response, drops at compaction). ",n.jsx("b",{children:"sent"})," = the per-request wire actually sent, rebuilt and trimmed each request — this is the one that fluctuates. (There is only one store; the fluctuating array is “sent”, not a second store.)"]}),Wd.map(j=>n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx("span",{className:"inline-block w-4 h-0.5 mt-1.5 flex-shrink-0",style:{background:j.stroke}}),n.jsxs("span",{children:[n.jsx("b",{className:"text-gray-700 dark:text-gray-200",children:j.label})," ",n.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["— ",j.desc]})]})]},j.key)),n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx("span",{className:"inline-block w-4 h-2 mt-0.5 rounded-sm flex-shrink-0",style:{background:"#10b981",opacity:.25}}),n.jsxs("span",{children:[n.jsx("b",{className:"text-gray-700 dark:text-gray-200",children:"trimmed"})," ",n.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"— shaded only where store > sent (net trim). sent (prompt_tokens) includes system + tools, so this is a conservative floor on what was trimmed."})]})]}),C4.map(j=>n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx("span",{className:"inline-block w-4 border-t border-dashed mt-1.5 flex-shrink-0",style:{borderColor:j.stroke}}),n.jsxs("span",{children:[n.jsx("b",{className:"text-gray-700 dark:text-gray-200",children:j.label})," ",n.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["— ",j.desc]})]})]},j.key)),n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx("span",{className:"inline-block w-4 border-t border-dashed mt-1.5 flex-shrink-0",style:{borderColor:"#d946ef"}}),n.jsxs("span",{children:[n.jsx("b",{className:"text-gray-700 dark:text-gray-200",children:"compact"})," ",n.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"— a compaction ran at this request (vertical marker)."})]})]})]}),n.jsxs("svg",{width:"100%",height:a,viewBox:`0 0 ${h} ${a}`,preserveAspectRatio:"xMidYMid meet",className:"overflow-visible select-none block",onMouseLeave:()=>o(null),children:[C.map((j,M)=>{const L=E(j);return n.jsxs("g",{children:[n.jsx("line",{x1:y.left,y1:L,x2:h-y.right,y2:L,stroke:"currentColor",strokeOpacity:.08,className:"text-gray-500"}),n.jsx("text",{x:y.left-6,y:L,textAnchor:"end",dominantBaseline:"middle",className:"text-[9px] fill-gray-400 dark:fill-gray-500",children:Ts(j)})]},"yt"+M)}),n.jsx("path",{d:T(),fill:"#10b981",fillOpacity:.1,stroke:"none",pointerEvents:"none"}),C4.map(j=>{const M=_[_.length-1],L=M&&M[j.key];if(L==null||L>w)return null;const I=E(L);return n.jsxs("g",{children:[n.jsx("line",{x1:y.left,y1:I,x2:h-y.right,y2:I,stroke:j.stroke,strokeOpacity:.5,strokeDasharray:"2 4"}),n.jsxs("text",{x:h-y.right+4,y:I,dominantBaseline:"middle",className:"text-[9px]",fill:j.stroke,fillOpacity:.9,children:[j.label," ",Ts(L)]})]},"ref"+j.key)}),_.map((j,M)=>j.compactionMarker?n.jsxs("g",{children:[n.jsx("line",{x1:N(M),y1:y.top,x2:N(M),y2:y.top+k,stroke:"#d946ef",strokeOpacity:.7,strokeDasharray:"3 3",strokeWidth:1.5}),n.jsx("text",{x:N(M),y:y.top-4,textAnchor:"middle",className:"text-[8px] font-semibold",fill:"#d946ef",children:"compact"})]},"cm"+M):null),Wd.map(j=>n.jsx("path",{d:A(j.key),fill:"none",stroke:j.stroke,strokeWidth:2,strokeDasharray:j.dash||void 0,strokeLinejoin:"round",strokeLinecap:"round"},j.key)),_.map((j,M)=>{const L=N(M),I=t!=null&&j.seq===t;return n.jsxs("g",{children:[Wd.map(B=>j[B.key]!=null?n.jsx("circle",{cx:L,cy:E(j[B.key]),r:I?3.5:2.5,fill:B.stroke,stroke:"white",strokeWidth:I?1:.5,className:"dark:stroke-gray-950"},B.key):null),n.jsx("rect",{x:L-Math.max(6,v/_.length/2),y:y.top,width:Math.max(12,v/_.length),height:k,fill:I?"#0ea5e9":"transparent",fillOpacity:I?.06:0,className:"cursor-pointer",onMouseEnter:()=>o(M),onClick:()=>r&&r(j.seq)}),n.jsxs("text",{x:L,y:a-8,textAnchor:"middle",className:"text-[8px] fill-gray-400 dark:fill-gray-500",children:["#",j.seq]})]},"pt"+M)}),i!=null&&_[i]&&(()=>{const j=_[i],M=N(i),L=158,I=106,B=Math.min(Math.max(M-L/2,y.left),h-y.right-L),z=y.top+4;return n.jsxs("g",{className:"pointer-events-none",children:[n.jsx("rect",{x:B,y:z,width:L,height:I,rx:4,className:"fill-gray-900/95 dark:fill-gray-800/95"}),n.jsxs("text",{x:B+8,y:z+14,className:"text-[9px] font-semibold fill-white",children:["request #",j.seq,j.compactionMarker?" · compaction":""]}),n.jsxs("text",{x:B+8,y:z+28,className:"text-[9px] fill-emerald-300",children:["store: ",Ts(j.storeTokens)]}),n.jsxs("text",{x:B+8,y:z+40,className:"text-[9px] fill-amber-300",children:["sent est: ",Ts(j.sentEst)]}),n.jsxs("text",{x:B+8,y:z+52,className:"text-[9px] fill-sky-300",children:["sent actual: ",Ts(j.sentActual)]}),n.jsxs("text",{x:B+8,y:z+64,className:"text-[9px] fill-rose-300",children:["tokReal: ",Ts(j.tokReal)]}),n.jsxs("text",{x:B+8,y:z+76,className:"text-[9px] fill-yellow-300",children:["threshold: ",Ts(j.threshold)]}),n.jsxs("text",{x:B+8,y:z+90,className:"text-[9px] fill-emerald-200/80",children:["trimmed: ",Ts(j.trimmed)]})]})})()]})]})}const T4={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 Ib(e){return e==null?"—":e.toLocaleString()}function xG({turns:e,selectedSeq:t,onSelect:r}){const[a,i]=x.useState(()=>new Set),o=x.useCallback(u=>{i(d=>{const f=new Set(d);return f.has(u)?f.delete(u):f.add(u),f})},[]),l=x.useMemo(()=>{const u=[];return(e||[]).forEach(d=>{u.push({kind:"group",turnIndex:d.index,count:d.requests.length}),a.has(d.index)||d.requests.forEach(f=>u.push({kind:"req",rec:f}))}),u},[e,a]);return!e||e.length===0?n.jsx("div",{className:"p-4 text-xs text-gray-400 dark:text-gray-500 italic",children:"No requests."}):n.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[n.jsxs("div",{className:"flex-shrink-0 px-3 py-1.5 text-[10px] leading-snug text-gray-500 dark:text-gray-400 border-b border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900/40",children:[n.jsx("b",{className:"text-gray-600 dark:text-gray-300",children:"Turn"})," = one user prompt + every EPM request it triggers — the agent loop (assistant → tool call → tool result → next request) until a final answer, plus any retries and compaction injections. So one turn can be several requests."]}),n.jsx("div",{className:"flex-1 min-h-0",children:n.jsx(LT,{style:{height:"100%"},data:l,itemContent:(u,d)=>{if(d.kind==="group"){const h=a.has(d.turnIndex);return n.jsxs("button",{type:"button",onClick:()=>o(d.turnIndex),className:"w-full flex items-center gap-2 px-3 py-1.5 text-[11px] font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400 bg-gray-50 dark:bg-gray-900 border-b border-gray-200 dark:border-gray-800 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors sticky top-0",children:[n.jsx("svg",{className:"w-3 h-3 transition-transform "+(h?"-rotate-90":""),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})}),"Turn ",d.turnIndex+1,n.jsxs("span",{className:"font-normal text-gray-400 dark:text-gray-500",children:["· ",d.count," req"]})]})}const f=d.rec,p=t!=null&&f.seq===t;return n.jsxs("button",{type:"button",onClick:()=>r(f.seq),className:"w-full text-left px-3 py-2 border-b border-gray-100 dark:border-gray-800/60 transition-colors "+(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:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("span",{className:"text-xs font-mono text-gray-400 dark:text-gray-500 w-8 flex-shrink-0",children:["#",f.seq]}),n.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded flex-shrink-0 "+(T4[f.purpose]||T4.assistant),children:f.purpose}),n.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-300 truncate min-w-0 flex-1",children:f.model}),f.compaction&&n.jsx("span",{className:"text-[9px] px-1 rounded bg-fuchsia-100 text-fuchsia-700 dark:bg-fuchsia-900/40 dark:text-fuchsia-300 flex-shrink-0",title:"A compaction followed this request",children:"⤵ compact"}),f.messageDrop&&n.jsx("span",{className:"text-[9px] px-1 rounded bg-red-100 text-red-700 dark:bg-red-900/50 dark:text-red-300 flex-shrink-0 font-semibold",title:"Unexpected wire message drop (#1858 regression canary)",children:"⚠ drop"}),f.status!=null&&n.jsx("span",{className:"text-[10px] font-mono flex-shrink-0 "+(f.status>=400?"text-red-500":"text-green-600 dark:text-green-400"),children:f.status})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-0.5 mt-1 pl-10 text-[10px] text-gray-400 dark:text-gray-500 font-mono",children:[n.jsxs("span",{title:"actual prompt_tokens sent this request",children:["sent ",Ib(f.sentActualTokens)," tokens"]}),n.jsxs("span",{title:"growing part-store size",children:["store ",Ib(f.storeTokens)," tokens"]}),f.sentActualDelta!=null&&n.jsxs("span",{className:f.sentActualDelta>=0?"text-amber-500":"text-emerald-500",title:"Δ sent actual vs previous request",children:[f.sentActualDelta>=0?"+":"",Ib(f.sentActualDelta)," vs prev"]}),f.ttftMs!=null&&n.jsxs("span",{title:"time to first token",children:["ttft ",f.ttftMs," ms"]})]})]})}})})]})}function Wc({text:e,getText:t,label:r="Copy",className:a="",title:i}){const[o,l]=x.useState(!1),[u,d]=x.useState(!1),f=x.useRef(null);x.useEffect(()=>()=>{f.current&&clearTimeout(f.current)},[]);const p=x.useCallback(async h=>{h.stopPropagation();const m=typeof t=="function"?t():e;f.current&&clearTimeout(f.current);try{if(!navigator.clipboard)throw new Error("clipboard unavailable");await navigator.clipboard.writeText(m==null?"":String(m)),d(!1),l(!0),f.current=setTimeout(()=>l(!1),1500)}catch(y){console.error("Copy failed:",y),l(!1),d(!0),f.current=setTimeout(()=>d(!1),1800)}},[e,t]);return n.jsx("button",{type:"button",onClick:p,title:i||r,"aria-label":i||r,className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-medium transition-colors "+(o?"bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-300 ":u?"bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300 ":"bg-gray-100 text-gray-600 hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700 ")+a,children:u?n.jsxs(n.Fragment,{children:[n.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"copy failed"]}):o?n.jsxs(n.Fragment,{children:[n.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),"copied"]}):n.jsxs(n.Fragment,{children:[n.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})}),r]})})}function yG(e,t){return e==="all"?!0:e==="none"?!1:t<1}function R4({name:e}){return e==null?null:typeof e=="number"?n.jsxs("span",{className:"text-gray-400 dark:text-gray-500",children:["[",e,"]"]}):n.jsx("span",{className:"text-sky-700 dark:text-sky-300",children:JSON.stringify(e)})}function bG({value:e}){const[t,r]=x.useState(!1),a=JSON.stringify(e);return a.length<=200?n.jsx("span",{className:"text-emerald-600 dark:text-emerald-400 break-all",children:a}):n.jsxs("span",{className:"text-emerald-600 dark:text-emerald-400 break-all",children:[t?a:a.slice(0,200)+"…",n.jsx("button",{type:"button",onClick:i=>{i.stopPropagation(),r(o=>!o)},className:"ml-1 text-[10px] text-primary-500 dark:text-primary-400 hover:underline align-baseline",children:t?"less":`+${(a.length-200).toLocaleString()} more`})]})}function vG({value:e}){return e===null?n.jsx("span",{className:"text-gray-400 dark:text-gray-500",children:"null"}):typeof e=="string"?n.jsx(bG,{value:e}):typeof e=="number"?n.jsx("span",{className:"text-amber-600 dark:text-amber-400",children:String(e)}):typeof e=="boolean"?n.jsx("span",{className:"text-violet-600 dark:text-violet-400",children:String(e)}):n.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:String(e)})}function zA({data:e,name:t,depth:r=0,openMode:a="auto"}){const i=Array.isArray(e),o=e&&typeof e=="object"&&!i,[l,u]=x.useState(()=>yG(a,r)),d={paddingLeft:r*12+"px"};if(!o&&!i)return n.jsxs("div",{style:d,className:"leading-5 break-all",children:[n.jsx("span",{className:"inline-block w-3"}),n.jsx(R4,{name:t}),t!=null&&n.jsx("span",{className:"text-gray-400",children:": "}),n.jsx(vG,{value:e})]});const f=i?e.map((m,y)=>[y,m]):Object.entries(e),[p,h]=i?["[","]"]:["{","}"];return n.jsxs("div",{children:[n.jsxs("div",{style:d,className:"leading-5 cursor-pointer rounded hover:bg-gray-100/60 dark:hover:bg-gray-800/40",onClick:()=>u(m=>!m),children:[n.jsx("span",{className:"inline-block w-3 text-gray-400 dark:text-gray-500 select-none",children:f.length?l?"▾":"▸":" "}),n.jsx(R4,{name:t}),t!=null&&n.jsx("span",{className:"text-gray-400",children:": "}),n.jsxs("span",{className:"text-gray-400",children:[p,l?"":f.length?` … ${h}`:h]}),!l&&f.length>0&&n.jsxs("span",{className:"ml-1 text-[10px] text-gray-400 dark:text-gray-500",children:[f.length," ",i?"items":"keys"]})]}),l&&f.map(([m,y])=>n.jsx(zA,{data:y,name:m,depth:r+1,openMode:a},m)),l&&f.length>0&&n.jsxs("div",{style:d,className:"leading-5 text-gray-400",children:[n.jsx("span",{className:"inline-block w-3"}),h]})]})}function vo({value:e,bytes:t,onResolveRef:r,label:a="JSON"}){const[i,o]=x.useState(null),[l,u]=x.useState(!1),[d,f]=x.useState(null),[p,h]=x.useState("all"),[m,y]=x.useState(0),[v,k]=x.useState(!1);x.useEffect(()=>{o(null),u(!1),f(null)},[e]);const _=i??e,w=au(_),N=x.useCallback(async()=>{if(r){u(!0),f(null);try{const T=Il(_),C=await r(T);o(C)}catch(T){f(T&&T.message?T.message:"Failed to fetch")}finally{u(!1)}}},[_,r]);if(_==null)return n.jsx("div",{className:"text-xs text-gray-400 dark:text-gray-500 italic",children:"(none)"});if(w)return n.jsxs("div",{className:"text-xs",children:[n.jsx("button",{type:"button",onClick:N,disabled:l,className:"px-2 py-1 rounded border border-dashed border-gray-300 dark:border-gray-600 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors disabled:opacity-50",children:l?"Fetching…":`(large${t?" — "+t.toLocaleString()+" bytes":""}, click to fetch)`}),d&&n.jsx("div",{className:"mt-1 text-red-500 dark:text-red-400",children:d})]});const E=typeof _=="string"?_:JSON.stringify(_,null,2),A=_&&typeof _=="object";return n.jsxs("div",{className:"relative group",children:[n.jsxs("div",{className:"absolute top-1 right-1 opacity-0 group-hover:opacity-100 transition-opacity z-10 flex items-center gap-1",children:[A&&n.jsx("button",{type:"button",onClick:()=>k(T=>!T),className:"text-[10px] px-1.5 py-0.5 rounded "+(v?"bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-300":"bg-gray-100 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700"),title:"Toggle the collapsible tree vs the original flat JSON",children:v?"tree":"raw"}),A&&!v&&n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",onClick:()=>{h("all"),y(T=>T+1)},className:"text-[10px] px-1.5 py-0.5 rounded bg-gray-100 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700",title:"Expand all",children:"expand"}),n.jsx("button",{type:"button",onClick:()=>{h("none"),y(T=>T+1)},className:"text-[10px] px-1.5 py-0.5 rounded bg-gray-100 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700",title:"Collapse all",children:"collapse"})]}),n.jsx(Wc,{getText:()=>E,label:"copy",title:`Copy ${a}`})]}),A&&!v?n.jsx("div",{className:"text-[11px] leading-relaxed font-mono bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-800 rounded p-2 max-h-96 overflow-auto",children:n.jsx(zA,{data:_,openMode:p},`${p}-${m}`)}):n.jsx("pre",{className:"text-[11px] leading-relaxed font-mono whitespace-pre-wrap break-words bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-800 rounded p-2 max-h-96 overflow-auto text-gray-700 dark:text-gray-300",children:E})]})}const A4={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 Vd(e){return e==null?"—":e>=1024?(e/1024).toFixed(1)+"KB":e+"B"}function kG({rec:e,onResolveRef:t}){const[r,a]=x.useState("idle"),[i,o]=x.useState(null),[l,u]=x.useState(null),d=e.store&&e.store.messages,f=e.body,p=d===void 0,h=x.useCallback(async()=>{a("loading"),o(null);try{const E=au(d)?await t(Il(d)):d,A=au(f)?await t(Il(f)):f,T=Array.isArray(E)?E:E&&E.messages||[],C=A&&A.messages||[];u(dG(T,C)),a("ready")}catch(E){o(E&&E.message?E.message:"failed to load"),a("error")}},[d,f,t]);if(p)return n.jsx("div",{className:"text-[11px] text-gray-400 dark:text-gray-500 italic",children:"The store array wasn't captured for this session — relaunch openpave (Inspector Mode is default-on) to record it, then this diff will show which messages trimming rewrote and where the cache prefix breaks."});if(r!=="ready")return n.jsxs("div",{children:[n.jsx("button",{type:"button",onClick:h,disabled:r==="loading",className:"text-[11px] px-2 py-1 rounded bg-gray-100 text-gray-600 hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700 transition-colors disabled:opacity-50",children:r==="loading"?"computing…":"Compute per-message trim diff"}),i&&n.jsx("div",{className:"text-[11px] text-red-500 mt-1",children:i})]});const{rows:m,firstChanged:y,maxBytes:v}=l,k=y>=0,_=k?m[y]:null,w=k?y:m.length,N=k?m.length-y:0;return n.jsxs("div",{className:"space-y-2",children:[n.jsx("div",{className:"rounded-lg border p-2 text-[11px] "+(k?"border-amber-300/60 dark:border-amber-700/50 bg-amber-50 dark:bg-amber-900/20":"border-emerald-300/60 dark:border-emerald-700/50 bg-emerald-50 dark:bg-emerald-900/20"),children:k?n.jsxs(n.Fragment,{children:[n.jsxs("b",{className:"text-amber-700 dark:text-amber-300",children:["Cache prefix breaks at message #",y]})," (",_.role," · ",_.tag,"). The first ",w," message",w===1?"":"s"," are byte-identical to the store (cache-eligible); the ",N," from #",y," on differ, so they're re-prefilled."]}):n.jsxs(n.Fragment,{children:[n.jsx("b",{className:"text-emerald-700 dark:text-emerald-300",children:"No message was trimmed"})," — every message is byte-identical to the store, so nothing here forces a cache miss."]})}),n.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-[10px] text-gray-500 dark:text-gray-400",children:[n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx("span",{className:"inline-block w-3 h-2 rounded-sm bg-gray-300 dark:bg-gray-600"})," store (pre-trim)"]}),n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx("span",{className:"inline-block w-3 h-2 rounded-sm bg-sky-500"})," sent (post-trim)"]}),n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx("span",{className:"inline-block w-3 h-2 rounded-sm bg-fuchsia-400/50"})," trimmed off"]}),n.jsx("span",{className:"ml-auto",children:"oldest → newest (top → bottom)"})]}),n.jsxs("div",{className:"space-y-0.5",children:[m.slice(0,300).map(E=>{const A=k&&E.i===y,T=Math.round((E.beforeBytes||0)/v*100),C=Math.round((E.afterBytes||0)/v*100);return n.jsxs("div",{children:[A&&n.jsxs("div",{className:"flex items-center gap-2 my-1","aria-label":"cache prefix break",children:[n.jsx("div",{className:"flex-1 border-t border-dashed border-amber-500/70"}),n.jsx("span",{className:"text-[9px] font-semibold text-amber-600 dark:text-amber-400 whitespace-nowrap",children:"cache prefix breaks here ↓"}),n.jsx("div",{className:"flex-1 border-t border-dashed border-amber-500/70"})]}),n.jsxs("div",{className:"flex items-center gap-2 rounded pl-1 "+(E.changed?"bg-fuchsia-50/60 dark:bg-fuchsia-900/10":k&&E.i<y?"bg-emerald-50/50 dark:bg-emerald-900/10":""),children:[n.jsxs("span",{className:"w-7 text-right text-[10px] text-gray-400 dark:text-gray-500 flex-shrink-0",children:["#",E.i]}),n.jsx("span",{className:"text-[9px] px-1 rounded flex-shrink-0 w-14 text-center "+(A4[E.role]||A4.system),children:E.role}),n.jsxs("div",{className:"flex-1 min-w-0 h-3 rounded bg-gray-100 dark:bg-gray-800 overflow-hidden relative",title:`store ${Vd(E.beforeBytes)} → sent ${Vd(E.afterBytes)}`,children:[n.jsx("div",{className:"absolute inset-y-0 left-0 bg-gray-300 dark:bg-gray-600",style:{width:T+"%"}}),E.changed&&E.afterBytes!=null&&E.beforeBytes!=null&&E.afterBytes<E.beforeBytes&&n.jsx("div",{className:"absolute inset-y-0 bg-fuchsia-400/50",style:{left:C+"%",width:Math.max(0,T-C)+"%"}}),n.jsx("div",{className:"absolute inset-y-0 left-0 bg-sky-500",style:{width:C+"%"}})]}),n.jsx("span",{className:"w-24 text-right text-[9px] font-mono text-gray-500 dark:text-gray-400 flex-shrink-0",children:E.changed?`${Vd(E.beforeBytes)}→${Vd(E.afterBytes)}`:"cached"}),n.jsx("span",{className:"hidden sm:block w-28 text-[9px] text-gray-400 dark:text-gray-500 flex-shrink-0 truncate",title:E.tag,children:E.changed?E.tag:""})]})]},E.i)}),m.length>300&&n.jsxs("div",{className:"text-[10px] text-gray-400 dark:text-gray-500 pl-1 pt-1",children:["… ",m.length-300," more messages"]})]}),n.jsx("div",{className:"text-[10px] text-gray-400 dark:text-gray-500",children:"Sizes are JSON bytes per message (a proxy for tokens). “store” = the pre-trim rendered history; “sent” = what actually went on the wire this request. The first changed message is where the prompt stops matching the cached prefix."})]})}const I4=4,_G=2.8,Mb=e=>e==null?"—":e.toLocaleString();function Lb({chars:e,ratio:t,ratioNote:r,tokens:a}){if(e==null)return null;const i=Math.ceil(e/t),o=a!=null?a-i:0;return n.jsxs("span",{className:"block text-[10px] font-mono text-gray-400 dark:text-gray-500 leading-tight mt-px",children:["= ⌈",Mb(e)," chars ÷ ",t,"⌉",o?n.jsxs(n.Fragment,{children:[" + ",Mb(o)]}):null," = ",n.jsx("span",{className:"text-amber-600/80 dark:text-amber-400/80",children:Mb(a)})," tok",n.jsxs("span",{className:"text-gray-300 dark:text-gray-600",children:[" · ",r,o?" + structure/attachments":""]})]})}function Ob({label:e,tokens:t,sub:r,calc:a,expanded:i,isOpen:o,onToggle:l}){return n.jsxs("div",{className:"border-t border-gray-100 dark:border-gray-800/60",children:[n.jsxs("button",{type:"button",onClick:l,className:"w-full flex items-start gap-2 py-1 px-1 text-left rounded hover:bg-gray-100/60 dark:hover:bg-gray-800/40",children:[n.jsx("span",{className:"inline-block w-3 text-gray-400 dark:text-gray-500 mt-px",children:o?"▾":"▸"}),n.jsxs("span",{className:"flex-1 min-w-0",children:[n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[11px] font-medium text-gray-700 dark:text-gray-200 flex-1",children:e}),n.jsxs("span",{className:"text-[11px] font-mono text-amber-600 dark:text-amber-400",children:[t==null?"—":t.toLocaleString()," tok"]}),r?n.jsxs("span",{className:"text-[10px] text-gray-400 dark:text-gray-500",children:["· ",r]}):null]}),a]})]}),o&&n.jsx("div",{className:"pb-2 pl-1",children:i})]})}function wG({rec:e,onResolveRef:t,overheadSystem:r,overheadTools:a,toolCount:i,newMessageTokens:o,overheadSystemChars:l,overheadToolsChars:u,newMessageChars:d}){const f=au(e.body),[p,h]=x.useState(()=>f?null:e.body),[m,y]=x.useState(()=>f?"idle":"ready"),[v,k]=x.useState(null),[_,w]=x.useState(null),N=x.useCallback(async()=>{if(!f){h(e.body),y("ready");return}y("loading"),k(null);try{const B=await t(Il(e.body));h(B),y("ready")}catch(B){k(B&&B.message?B.message:"failed to load"),y("error")}},[f,e.body,t]),E=B=>{w(z=>z===B?null:B),m==="idle"&&N()},A=m==="ready",T=A&&p&&Array.isArray(p.messages)?p.messages:[],C=T.find(B=>B&&B.role==="system"),j=C?C.content:null,M=A&&p?p.tools:null,L=T.length?T[T.length-1]:null,I=(B,z)=>m==="loading"?n.jsx("div",{className:"text-[10px] text-gray-400 dark:text-gray-500 italic",children:"loading…"}):m==="error"?n.jsxs("div",{className:"text-[10px] text-red-500",children:[v||"failed to load"," —"," ",n.jsx("button",{type:"button",onClick:N,className:"underline hover:no-underline",children:"retry"})]}):B==null?n.jsx("div",{className:"text-[10px] text-gray-400 dark:text-gray-500 italic",children:"(not present in this request body)"}):n.jsx(vo,{value:B,onResolveRef:t,label:z});return n.jsxs("div",{className:"pt-1",children:[n.jsx("div",{className:"text-[10px] text-gray-400 dark:text-gray-500 mb-0.5",children:"how each figure is estimated (char-count ÷ ratio — no real tokenizer) · click to see the content:"}),n.jsx(Ob,{label:"system prompt",tokens:r,calc:n.jsx(Lb,{chars:l,ratio:I4,ratioNote:"natural language",tokens:r}),expanded:I(j,"system prompt"),isOpen:_==="system",onToggle:()=>E("system")}),n.jsx(Ob,{label:"tool schemas",tokens:a,sub:i?`${i} tools`:"",calc:n.jsx(Lb,{chars:u,ratio:_G,ratioNote:"JSON",tokens:a}),expanded:I(M,"tool schemas"),isOpen:_==="tools",onToggle:()=>E("tools")}),n.jsx(Ob,{label:"new message",tokens:o,calc:n.jsx(Lb,{chars:d,ratio:I4,ratioNote:"natural language",tokens:o}),expanded:I(L,"new message"),isOpen:_==="new",onToggle:()=>E("new")})]})}function SG({rec:e,prevRec:t,onSelectSeq:r}){const a=e&&e.messageDrop;if(!a)return null;const i=t&&t.body&&t.body.messages,o=e.body&&e.body.messages,u=Array.isArray(i)&&Array.isArray(o)?cG(i,o):null,d=t?n.jsxs("button",{type:"button",className:"underline underline-offset-2 hover:text-red-900 dark:hover:text-red-100",onClick:()=>r&&r(a.prevSeq),title:"Jump to the previous request",children:["request #",a.prevSeq]}):n.jsxs("span",{title:"That request is no longer in the capture",children:["request #",a.prevSeq]});return n.jsxs("div",{className:"mx-3 mt-2 rounded border border-red-300 bg-red-50 dark:border-red-800 dark:bg-red-950/40",children:[n.jsxs("div",{className:"px-3 py-2 border-b border-red-200 dark:border-red-900",children:[n.jsxs("div",{className:"text-[12px] font-semibold text-red-700 dark:text-red-300 flex items-center gap-1",children:["⚠ Unexpected message drop",n.jsx("span",{className:"font-normal text-red-500 dark:text-red-400",children:"— possible #1858 regression"})]}),n.jsxs("div",{className:"mt-0.5 text-[11px] text-red-700/90 dark:text-red-300/90",children:["The wire dropped ",n.jsxs("b",{children:[a.wireBefore," → ",a.wireAfter]})," conversation messages between"," ",d," and this one (#",e.seq,") with ",n.jsx("b",{children:"no compaction"}),a.storeMessages!=null&&n.jsxs(n.Fragment,{children:[" — store intact = ",n.jsx("b",{children:a.storeMessages})]}),". Trimming never drops whole messages, so this is a wrongful drop, not a designed trim."]}),n.jsxs("div",{className:"mt-1 text-[10px] text-red-600/80 dark:text-red-400/80",children:["Compare the raw wire arrays:"," ",t?n.jsxs("button",{type:"button",className:"underline underline-offset-2",onClick:()=>r&&r(a.prevSeq),children:["raw request #",a.prevSeq]}):n.jsxs("span",{children:["request #",a.prevSeq," (evicted)"]})," · ",n.jsxs("button",{type:"button",className:"underline underline-offset-2",onClick:()=>r&&r(e.seq),children:["raw request #",e.seq]})]})]}),u&&u.roles.length>0?n.jsxs("div",{className:"px-3 py-1.5",children:[n.jsxs("div",{className:"text-[10px] uppercase tracking-wide text-red-500 dark:text-red-400 mb-1",children:["Messages by role (#",a.prevSeq," → #",e.seq,")"]}),u.roles.map(f=>n.jsxs("div",{className:"text-[11px] font-mono text-red-800 dark:text-red-200 flex items-center gap-2 py-0.5",children:[n.jsxs("span",{className:"inline-block w-20",children:["[",f.role,"]"]}),n.jsxs("span",{children:[f.before," → ",f.after]}),f.delta>0&&n.jsxs("span",{className:"text-red-600 dark:text-red-300 font-semibold",children:["−",f.delta," dropped"]})]},f.role)),n.jsx("div",{className:"mt-1 text-[10px] text-red-500/70 dark:text-red-400/70",children:"Exact messages: open the raw arrays above (the wire carries no ids, so per-message identity can’t be shown here)."})]}):n.jsx("div",{className:"px-3 py-1.5 text-[10px] text-red-500/80 dark:text-red-400/80",children:"Wire bodies are large (spilled) — open the raw requests above to compare the message arrays."})]})}const NG=["Request","Response","Chunks","Context","Lifecycle","Est vs actual"];function ar(e){return e==null?"—":typeof e=="number"?e.toLocaleString():String(e)}function mr({label:e,children:t,highlight:r}){return n.jsxs("div",{className:"flex items-baseline gap-2 py-0.5",children:[n.jsx("span",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 w-36 flex-shrink-0",children:e}),n.jsx("span",{className:"text-xs font-mono "+(r?"text-red-500 dark:text-red-400 font-semibold":"text-gray-700 dark:text-gray-200"),children:t==null||t===""?"—":t})]})}const mf={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"},M4={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 EG({raw:e,parts:t}){const r="break-all whitespace-pre-wrap min-w-0 flex-1",a=[];for(const l of t){let u="";if(l.piece!==""&&(l.type==="text"||l.type==="reasoning")?u=JSON.stringify(l.piece):l.type==="usage"&&l.piece&&(u=l.piece),!u)continue;const d=e.indexOf(u);d>=0&&a.push({start:d,end:d+u.length,type:l.type})}if(!a.length)return n.jsx("span",{className:r+" text-gray-600 dark:text-gray-400",children:e});a.sort((l,u)=>l.start-u.start);const i=[];let o=0;return a.forEach((l,u)=>{l.start<o||(l.start>o&&i.push(n.jsx("span",{className:"text-gray-500 dark:text-gray-500",children:e.slice(o,l.start)},"g"+u)),i.push(n.jsx("span",{className:"font-semibold "+(mf[l.type]||mf.other),children:e.slice(l.start,l.end)},"m"+u)),o=l.end)}),o<e.length&&i.push(n.jsx("span",{className:"text-gray-500 dark:text-gray-500",children:e.slice(o)},"tail")),n.jsx("span",{className:r,children:i})}function Gd({n:e,name:t,sub:r,pct:a,trimmedPct:i,fill:o,dashed:l}){return n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx("span",{className:"w-4 flex-shrink-0 text-[10px] text-gray-400 dark:text-gray-500 text-right leading-4",children:e}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-[11px] text-gray-700 dark:text-gray-200",children:t}),r&&n.jsx("div",{className:"text-[10px] text-gray-400 dark:text-gray-500 mb-0.5",children:r}),a!=null&&n.jsxs("div",{className:"h-2.5 w-full rounded bg-gray-100 dark:bg-gray-800 overflow-hidden relative "+(l?"ring-1 ring-inset ring-emerald-400/50":""),children:[i!=null&&n.jsx("div",{className:"absolute inset-y-0 left-0 bg-fuchsia-400/25",style:{width:Math.min(100,i)+"%"}}),n.jsx("div",{className:"absolute inset-y-0 left-0 "+(o||"bg-gray-400"),style:{width:Math.min(100,a)+"%"}})]})]})]})}function Db({label:e}){return n.jsxs("div",{className:"pl-6 py-0.5 text-[10px] text-gray-400 dark:text-gray-500 flex items-center gap-1",children:[n.jsx("span",{"aria-hidden":!0,children:"↓"}),n.jsx("span",{children:e})]})}function jG({rec:e,prevRec:t,onSelectSeq:r,onResolveRef:a,onJumpToMessage:i,tab:o,onTabChange:l,showRaw:u,onShowRawChange:d}){if(!e)return n.jsx("div",{className:"h-full flex items-center justify-center text-sm text-gray-400 dark:text-gray-500",children:"Select a request to inspect it."});const f=e.response,p=f?f.assembled:null,h=e.context,m=h&&h.limit!=null&&h.usable!=null?h.limit-h.usable:null,y=h&&h.threshold!=null&&h.tokReal!=null?h.threshold-h.tokReal:null,v=h?h.source==="estimate":!1,k=h&&(h.historicalEstimate!=null||h.lastPromptTokens!=null)&&h.newMessageTokens!=null,_=h?h.source==="actual"?h.lastPromptTokens:h.historicalEstimate:null,w=h&&h.historicalEstimate!=null&&h.staticOverhead!=null?h.historicalEstimate-h.staticOverhead:null;return n.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2 border-b border-gray-200 dark:border-gray-800 flex-shrink-0",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsxs("div",{className:"text-sm font-semibold text-gray-800 dark:text-gray-100 truncate",children:["#",e.seq," · ",e.provider,"/",e.model,n.jsx("span",{className:"ml-2 text-xs font-normal px-1.5 py-0.5 rounded bg-gray-100 dark:bg-gray-800 text-gray-500 dark:text-gray-400",children:e.purpose})]}),n.jsx("div",{className:"text-[11px] text-gray-400 dark:text-gray-500 truncate",children:e.url})]}),n.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[n.jsx(Wc,{getText:()=>FA(e),label:"request",title:"Copy this request (body + response + context)"}),f&&n.jsx(Wc,{getText:()=>gG(e),label:"response",title:"Copy the assembled response"}),e.chunkCount>0&&n.jsx(Wc,{getText:()=>BA(e),label:"chunks",title:"Copy all raw chunks"})]})]}),n.jsx(SG,{rec:e,prevRec:t,onSelectSeq:r}),n.jsx("div",{className:"flex items-center gap-1 px-3 pt-2 flex-shrink-0 border-b border-gray-200 dark:border-gray-800",children:NG.map(N=>n.jsx("button",{type:"button",onClick:()=>l(N),className:"px-2.5 py-1 text-xs font-medium rounded-t transition-colors "+(o===N?"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:N},N))}),n.jsxs("div",{className:"flex-1 overflow-auto p-3 min-h-0",children:[o==="Request"&&n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{children:[n.jsx(mr,{label:"fingerprint",children:e.fingerprint}),n.jsx(mr,{label:"bodyBytes",children:e.bodyBytes!=null?e.bodyBytes.toLocaleString():null}),e.shrink&&n.jsxs(mr,{label:"shrink rungs",children:[(e.shrink.rungsFired||[]).join(", ")||"(none)",e.shrink.fitted!=null?` fitted=${e.shrink.fitted}`:""]}),e.bubbleMessageID&&n.jsxs("div",{className:"flex items-baseline gap-2 py-0.5",children:[n.jsx("span",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 w-36 flex-shrink-0",children:"bubble msgID"}),i?n.jsx("button",{type:"button",onClick:()=>i(e.bubbleMessageID),className:"text-xs font-mono text-primary-600 dark:text-primary-400 hover:underline",title:"Jump to this message in the conversation",children:e.bubbleMessageID}):n.jsx("span",{className:"text-xs font-mono text-gray-700 dark:text-gray-200",children:e.bubbleMessageID})]})]}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Params"}),n.jsx(vo,{value:e.params,label:"params"})]}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Headers (redacted)"}),n.jsx(vo,{value:e.headers,label:"headers"})]}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Request body (exact bytes sent)"}),n.jsx(vo,{value:e.body,bytes:e.bodyBytes,onResolveRef:a,label:"body"})]})]}),o==="Response"&&n.jsx("div",{className:"space-y-3",children:f?n.jsxs(n.Fragment,{children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"HTTP response (status line)"}),n.jsx(mr,{label:"HTTP status",highlight:e.status!=null&&e.status>=400,children:e.status})]}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Response headers (from EPM)"}),e.paveContext&&n.jsx(mr,{label:"x-pave-resolved-model",children:e.paveContext.resolvedModel}),e.paveContext&&n.jsx(mr,{label:"x-pave-context-floor",children:e.paveContext.contextFloor}),f.headers?n.jsxs("div",{className:"mt-1",children:[n.jsx("div",{className:"text-[10px] text-gray-400 dark:text-gray-500 mb-0.5",children:"full header set (redacted):"}),n.jsx(vo,{value:f.headers,label:"response headers"})]}):n.jsx("div",{className:"mt-1 text-[10px] text-gray-400 dark:text-gray-500 italic",children:"Full header set is captured on newer sessions — relaunch openpave to record it."})]}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"From the SSE body"}),n.jsx(mr,{label:"finishReason",highlight:e.finishReason==="length",children:e.finishReason}),f.usage&&n.jsx(mr,{label:"prompt_tokens",children:ar(f.usage.prompt_tokens)}),f.usage&&n.jsx(mr,{label:"completion_tokens",children:ar(f.usage.completion_tokens)}),f.usage&&f.usage.total_tokens!=null&&n.jsx(mr,{label:"total_tokens",children:ar(f.usage.total_tokens)})]}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Assembled response (from the SSE body)"}),n.jsx(vo,{value:p,onResolveRef:a,label:"assembled"})]})]}):n.jsx("div",{className:"text-xs text-gray-400 dark:text-gray-500 italic",children:"No response captured (in-flight or aborted)."})}),o==="Chunks"&&n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"sticky top-0 z-10 -mx-3 px-3 py-1.5 bg-white/95 dark:bg-gray-950/95 backdrop-blur border-b border-gray-100 dark:border-gray-800 flex flex-wrap items-center gap-3 text-xs text-gray-500 dark:text-gray-400",children:[n.jsxs("span",{children:["TTFT: ",n.jsx("b",{className:"text-gray-700 dark:text-gray-200",children:e.ttftMs!=null?e.ttftMs+"ms":"—"})]}),n.jsxs("span",{children:["total: ",n.jsx("b",{className:"text-gray-700 dark:text-gray-200",children:e.totalMs!=null?e.totalMs+"ms":"—"})]}),n.jsxs("span",{children:["chunks: ",n.jsx("b",{className:"text-gray-700 dark:text-gray-200",children:e.chunkCount})]}),e.totalMs>0&&e.response&&e.response.usage&&e.response.usage.completion_tokens>0&&n.jsxs("span",{children:["throughput: ",n.jsxs("b",{className:"text-gray-700 dark:text-gray-200",children:[(e.response.usage.completion_tokens/(e.totalMs/1e3)).toFixed(1)," tok/s"]})]}),n.jsxs("label",{className:"ml-auto flex items-center gap-1 cursor-pointer select-none",children:[n.jsx("input",{type:"checkbox",checked:u,onChange:N=>d(N.target.checked),className:"accent-primary-500"}),"raw frames"]})]}),e.chunks.length===0?n.jsx("div",{className:"text-xs text-gray-400 dark:text-gray-500 italic",children:"No chunks captured."}):n.jsx("div",{className:"space-y-1",children:e.chunks.map((N,E)=>{const A=E===0?e.ts!=null?N.ts-e.ts:0:N.ts-e.chunks[E-1].ts,T=uG(N).parts,C=T.filter(j=>j.piece!=="");return n.jsxs("div",{className:"flex items-start gap-2 text-[11px] font-mono",children:[n.jsxs("span",{className:"text-gray-400 dark:text-gray-600 w-12 flex-shrink-0 text-right",children:["+",A,"ms"]}),n.jsx("span",{className:"w-[72px] flex-shrink-0 flex flex-col items-start gap-0.5",children:T.map((j,M)=>n.jsx("span",{className:"px-1 rounded "+(M4[j.type]||M4.other),children:j.type},M))}),u?n.jsx(EG,{raw:N.raw,parts:T}):n.jsx("span",{className:"break-all whitespace-pre-wrap min-w-0 flex-1",title:N.raw,children:C.length?C.map((j,M)=>n.jsx("span",{className:(M?"ml-1 ":"")+(mf[j.type]||mf.other),children:j.piece},M)):n.jsx("span",{className:"italic opacity-60 text-gray-500",children:N.raw})})]},N.seq)})}),!u&&e.chunks.length>0&&n.jsxs("div",{className:"pt-1 text-[10px] text-gray-400 dark:text-gray-500",children:["Coloured by the assembled part each chunk feeds: ",n.jsx("span",{className:"text-amber-600 dark:text-amber-400",children:"reasoning"})," · ",n.jsx("span",{className:"text-sky-700 dark:text-sky-300",children:"text"})," · ",n.jsx("span",{className:"text-violet-600 dark:text-violet-400",children:"tool"})," · ",n.jsx("span",{className:"text-emerald-600 dark:text-emerald-400",children:"usage"}),". Toggle “raw frames” for the exact SSE."]})]}),o==="Context"&&n.jsxs("div",{className:"space-y-3",children:[h?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"rounded-lg border p-2.5 "+(h.needsCompaction?"border-fuchsia-300 dark:border-fuchsia-700 bg-fuchsia-50 dark:bg-fuchsia-900/20":"border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900"),children:[n.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[n.jsx("span",{className:"text-[11px] uppercase tracking-wide font-semibold text-gray-500 dark:text-gray-400",children:"Compaction decision"}),n.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded font-semibold "+(h.needsCompaction?"bg-fuchsia-200 text-fuchsia-800 dark:bg-fuchsia-800/60 dark:text-fuchsia-200":"bg-emerald-100 text-emerald-700 dark:bg-emerald-900/40 dark:text-emerald-300"),children:h.needsCompaction?"TRIGGERED":"not triggered"}),n.jsxs("span",{className:"text-[10px] text-gray-400 dark:text-gray-500",children:["evaluated ",n.jsx("b",{children:"before"})," the request is sent · once per turn"]})]}),n.jsxs("div",{className:"text-xs font-mono text-gray-700 dark:text-gray-200 space-y-0.5",children:[n.jsxs("div",{children:["compact when ",n.jsx("b",{children:"tokReal > threshold"})," →"," ",n.jsxs("span",{className:h.needsCompaction?"text-fuchsia-600 dark:text-fuchsia-400 font-semibold":"text-emerald-600 dark:text-emerald-400 font-semibold",children:[ar(h.tokReal)," ",h.needsCompaction?">":"≤"," ",ar(h.threshold)]})]}),n.jsxs("div",{className:"text-gray-500 dark:text-gray-400",children:["headroom = threshold − tokReal = ",ar(h.threshold)," − ",ar(h.tokReal)," = ",n.jsx("b",{className:y!=null&&y<0?"text-fuchsia-600 dark:text-fuchsia-400":"",children:ar(y)})]}),n.jsxs("div",{className:"pt-1 text-gray-500 dark:text-gray-400",children:["threshold = ⌊usable × margin⌋ = ⌊",ar(h.usable)," × ",h.margin??"?","⌋ = ",ar(h.threshold)]}),n.jsxs("div",{className:"text-gray-500 dark:text-gray-400",children:["usable = limit − reserve = ",ar(h.limit)," − ",ar(m)," = ",ar(h.usable)]})]})]}),k&&n.jsxs("div",{className:"rounded-lg border border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900 p-2.5",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[n.jsx("span",{className:"text-[11px] uppercase tracking-wide font-semibold text-gray-500 dark:text-gray-400",children:"How tokReal is computed"}),n.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded font-semibold "+(v?"bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300":"bg-emerald-100 text-emerald-700 dark:bg-emerald-900/40 dark:text-emerald-300"),children:v?"ESTIMATE":"MEASURED"})]}),n.jsxs("div",{className:"text-xs font-mono text-gray-700 dark:text-gray-200 space-y-0.5",children:[n.jsxs("div",{children:["tokReal = ",v?"historical estimate":"last prompt_tokens"," + new message = ",n.jsx("b",{children:ar(_)})," + ",n.jsx("b",{children:ar(h.newMessageTokens)})," = ",n.jsx("b",{children:ar(h.tokReal)})]}),v?n.jsxs(n.Fragment,{children:[w!=null&&n.jsxs("div",{className:"text-gray-500 dark:text-gray-400",children:["historical estimate = conversation estimate + system+tools overhead = ",ar(w)," + ",ar(h.staticOverhead)," = ",ar(h.historicalEstimate)]}),(h.overheadSystem!=null||h.overheadTools!=null)&&n.jsxs("div",{className:"text-gray-500 dark:text-gray-400",children:["system+tools overhead = system prompt ",ar(h.overheadSystem)," + tool schemas ",ar(h.overheadTools),h.toolCount?` (${h.toolCount} tools)`:""," = ",ar(h.staticOverhead)]}),n.jsxs("div",{className:"text-[10px] text-amber-600 dark:text-amber-400 pt-0.5",children:["ESTIMATE — no measured ",n.jsx("code",{children:"prompt_tokens"})," was available yet, so this is openpave's own estimate. The system prompt + tool schemas (",ar(h.staticOverhead),") dominate, which is why tokReal ≫ the store."]})]}):n.jsxs("div",{className:"text-[10px] text-gray-500 dark:text-gray-400 pt-0.5",children:["MEASURED — the previous response's ",n.jsx("code",{children:"prompt_tokens"})," (",ar(h.lastPromptTokens),"), which already counts system prompt + tools + conversation."]}),n.jsx("div",{className:"font-sans",children:n.jsx(wG,{rec:e,onResolveRef:a,overheadSystem:h.overheadSystem,overheadTools:h.overheadTools,toolCount:h.toolCount,newMessageTokens:h.newMessageTokens,overheadSystemChars:h.overheadSystemChars,overheadToolsChars:h.overheadToolsChars,newMessageChars:h.newMessageChars})})]})]}),n.jsxs("div",{children:[n.jsx(mr,{label:"limit (window)",children:ar(h.limit)}),n.jsx(mr,{label:"reserve (output)",children:ar(m)}),n.jsx(mr,{label:"usable",children:ar(h.usable)}),n.jsx(mr,{label:"margin",children:h.margin}),n.jsx(mr,{label:"threshold",children:ar(h.threshold)}),n.jsx(mr,{label:"tokReal",children:ar(h.tokReal)}),n.jsx(mr,{label:"needsCompaction",highlight:!!h.needsCompaction,children:String(h.needsCompaction)}),n.jsx(mr,{label:"source",children:h.source}),n.jsx(mr,{label:"windowSource",children:h.windowSource||h.epmWindowSignal})]})]}):n.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 rounded-lg border border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900 p-2.5",children:["No compaction decision for this request. The check runs ",n.jsx("b",{children:"once per turn"})," (at the turn's first request); tool-iteration follow-ups and compaction turns reuse it.",e.contextFrom!=null&&n.jsxs(n.Fragment,{children:[" The most recent decision was evaluated at ",n.jsxs("b",{children:["request #",e.contextFrom]}),"."]})]}),e.store&&n.jsxs("div",{className:"pt-3 border-t border-gray-200 dark:border-gray-800",children:[n.jsx(mr,{label:"storeTokens",children:ar(e.storeTokens)}),n.jsx(mr,{label:"storeMessages",children:e.storeMessages}),e.store.messages!==void 0&&n.jsxs("div",{className:"mt-2",children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Persisted history (the store array) — full, pre-shrink · diff vs the Request-tab body (the sent wire) to see what was trimmed"}),n.jsx(vo,{value:e.store.messages,onResolveRef:a,label:"store messages"})]})]}),e.compaction&&n.jsxs("div",{className:"pt-3 border-t border-gray-200 dark:border-gray-800",children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-fuchsia-500 mb-1",children:"Compaction (followed this request)"}),n.jsx(mr,{label:"trigger",children:e.compaction.trigger}),n.jsx(mr,{label:"deleted",children:ar(e.compaction.deletedMessages)}),n.jsx(mr,{label:"summary tok",children:ar(e.compaction.summaryTokens)}),n.jsx(mr,{label:"before",children:ar(e.compaction.before)}),n.jsx(mr,{label:"after",children:ar(e.compaction.after)}),n.jsx(mr,{label:"handoffFresh",highlight:e.compaction.handoffFresh===!1,children:typeof e.compaction.handoffFresh=="boolean"?String(e.compaction.handoffFresh):"—"})]})]}),o==="Est vs actual"&&n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:["Estimator (",n.jsx("code",{children:"estimateWireTokens"}),") vs the provider's actual ",n.jsx("code",{children:"prompt_tokens"})," — exposes tokenizer drift."]}),n.jsxs("div",{className:"text-[11px] text-gray-400 dark:text-gray-500 rounded-lg border border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900 p-2",children:[n.jsx("b",{children:"sent est"})," counts the whole ",n.jsx("b",{children:"messages array"})," — the system prompt included (it's a ",n.jsx("code",{children:'role:"system"'})," message) — with a coarse byte-length ÷ 3 heuristic plus fixed per-message/tool envelopes, but ",n.jsx("b",{children:"excludes the tool schemas"})," (a top-level ",n.jsx("code",{children:"tools"})," body field, not a message). The missing tool schemas plus the byte÷3-vs-real-tokenizer gap are usually why it reads below ",n.jsx("b",{children:"sent actual"}),". ",n.jsx("b",{children:"sent actual"})," (",n.jsx("code",{children:"prompt_tokens"}),") is the provider's real tokenizer over the ",n.jsx("i",{children:"whole"})," request. Different heuristic again from the Context tab's tokReal (system ÷4, tools ÷2.8); the three don't agree by design."]}),n.jsx(mr,{label:"sent est",children:ar(e.sentEstTokens)}),n.jsx(mr,{label:"sent actual",children:ar(e.sentActualTokens)}),e.sentEstTokens!=null&&e.sentActualTokens!=null&&n.jsxs(n.Fragment,{children:[n.jsx(mr,{label:"delta (est−actual)",highlight:Math.abs(e.sentEstTokens-e.sentActualTokens)>e.sentActualTokens*.15,children:(e.sentEstTokens-e.sentActualTokens).toLocaleString()}),n.jsx(mr,{label:"drift %",children:e.sentActualTokens?((e.sentEstTokens-e.sentActualTokens)/e.sentActualTokens*100).toFixed(1)+"%":"—"})]}),n.jsxs("div",{className:"pt-3 border-t border-gray-200 dark:border-gray-800",children:[n.jsx(mr,{label:"store tokens",children:ar(e.storeTokens)}),n.jsx(mr,{label:"Δ vs prev actual",children:e.sentActualDelta!=null?(e.sentActualDelta>=0?"+":"")+e.sentActualDelta.toLocaleString():null}),e.response&&e.response.usage&&n.jsxs(n.Fragment,{children:[n.jsx(mr,{label:"completion_tokens",children:e.response.usage.completion_tokens}),n.jsx(mr,{label:"total_tokens",children:e.response.usage.total_tokens}),e.response.usage.reasoning_tokens!=null&&n.jsx(mr,{label:"reasoning_tokens",children:e.response.usage.reasoning_tokens})]})]})]}),o==="Lifecycle"&&(()=>{const N=e.trimmed,E=N!=null&&N>0,A=e.finishReason==="length",T=h?h.needsCompaction:null,C=e.storeTokens,j=e.sentActualTokens,M=Math.max(C||0,j||0,e.sentEstTokens||0,1),L=I=>Math.round((I||0)/M*100);return n.jsxs("div",{className:"space-y-3 text-xs leading-relaxed text-gray-600 dark:text-gray-300",children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"The four layers a request passes through"}),n.jsxs("div",{className:"rounded-lg border border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900/50 p-2.5 space-y-1",children:[n.jsx(Gd,{n:"1",name:"Durable store — on disk",sub:"every message ever (old ones flagged compactedOut) + the summary. This is what the web UI shows; not measured here (never shrinks)."}),n.jsx(Db,{label:"render — internal parts → API message shape; DROP compactedOut, KEEP summary"}),n.jsx(Gd,{n:"2",name:"LLM context = formattedMessages (the inspector's ‘store’)",sub:`${ar(C)} tok · ${e.storeMessages!=null?e.storeMessages+" msgs":"—"}`,pct:L(C),fill:"bg-emerald-500"}),n.jsx(Db,{label:"slice — shallow copy so trimming can't touch the original render"}),n.jsx(Gd,{n:"3",name:"Wire copy = conversationMessages",sub:"identical to layer 2 until trimmed",pct:L(C),fill:"bg-emerald-500/40",dashed:!0}),n.jsx(Db,{label:E?`trim — fit to budget (−${ar(N)} tok net)`:"trim — nothing net-trimmed this request"}),n.jsx(Gd,{n:"4",name:"Sent = [system] + trimmed wire + tools",sub:`${ar(j)} tok actual · est ${ar(e.sentEstTokens)}`,pct:L(j),trimmedPct:E?L(C):null,fill:"bg-sky-500"})]}),E&&n.jsxs("div",{className:"mt-0.5 pl-6 text-[10px] text-gray-400 dark:text-gray-500",children:[n.jsx("span",{className:"inline-block w-2.5 h-2 rounded-sm bg-fuchsia-400/25 align-middle mr-1"}),"shaded = trimmed off this request (store − sent)",A?" · finishReason=length: model hit the output limit":""]})]}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"…the four steps, in words"}),n.jsxs("ol",{className:"list-decimal list-inside space-y-0.5 text-[11px] text-gray-600 dark:text-gray-300",children:[n.jsxs("li",{children:[n.jsx("b",{children:"Compaction"})," (upstream, only near the limit): summarise old messages in the durable store — flag them ",n.jsx("code",{children:"compactedOut"})," + add a summary."]}),n.jsxs("li",{children:[n.jsx("b",{children:"Render"}),": translate the store’s internal “parts” into the API’s message shape, dropping ",n.jsx("code",{children:"compactedOut"})," and including the summary → layer 2."]}),n.jsxs("li",{children:[n.jsx("b",{children:"Slice"}),": shallow-copy layer 2 → layer 3, so trimming mutates the copy, not the original render."]}),n.jsxs("li",{children:[n.jsx("b",{children:"Trim"}),": shrink the copy to fit the budget (the ladder below), then assemble ",n.jsx("code",{children:"[system + trimmed wire + tools]"})," and send → layer 4."]})]}),n.jsxs("div",{className:"mt-1 text-[10px] text-gray-500 dark:text-gray-400",children:["So compaction is ",n.jsx("b",{children:"pre-emptive"})," — before trimming (step 1). There's also a ",n.jsx("b",{children:"reactive"})," path: if the sent request 413s (our budget was an estimate), it trims ",n.jsx("i",{children:"harder"})," and, only if that still won't fit, compacts and resends. Trimming sits between the two."]})]}),n.jsxs("div",{className:"rounded-lg border border-amber-300/60 dark:border-amber-700/50 bg-amber-50 dark:bg-amber-900/20 p-2.5 text-[11px]",children:[n.jsx("b",{className:"text-amber-700 dark:text-amber-300",children:"Cache impact:"})," prefix / KV caching needs the prompt prefix to be byte-identical across requests. Trimming ",n.jsx("b",{children:"rewrites older messages"})," (stubs tool outputs, strips reasoning, caps old text) — and the recency-weighted ladder trims the ",n.jsx("b",{children:"oldest first"}),", i.e. the cache prefix. So a trimmed request usually ",n.jsx("b",{children:"misses the cache"})," and pays a full prefill. Less trimming + a stable prefix = a higher cache-hit rate. The per-message diff below shows exactly where."]}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Per-message trim diff — where the cache breaks"}),n.jsx(kG,{rec:e,onResolveRef:a})]}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Compaction (this request)"}),e.compaction?n.jsxs("div",{className:"rounded-lg border border-fuchsia-300 dark:border-fuchsia-700 bg-fuchsia-50 dark:bg-fuchsia-900/20 p-2.5 font-mono text-[11px]",children:["A compaction ran here [",e.compaction.trigger,"] — store rewritten ",ar(e.compaction.before)," → ",ar(e.compaction.after)," tok. The on-disk history was permanently summarised."]}):n.jsxs("div",{className:"text-[11px] text-gray-500 dark:text-gray-400",children:["No compaction on this request.",T!=null&&n.jsxs(n.Fragment,{children:[" Decision at build time: ",n.jsx("b",{className:T?"text-fuchsia-600 dark:text-fuchsia-400":"text-emerald-600 dark:text-emerald-400",children:T?"TRIGGERED":"not triggered"})," (see Context tab)."]})]}),n.jsxs("div",{className:"mt-1 text-[10px] text-gray-500 dark:text-gray-400",children:["Compaction drops old messages from the ",n.jsx("b",{children:"LLM context"})," (a summary replaces them) — it does ",n.jsx("b",{children:"not"})," delete them: they stay on disk flagged ",n.jsx("code",{children:"compactedOut"})," and the web UI still shows every bubble. So the inspector's ",n.jsx("b",{children:"store"})," line = the LLM context (it drops at compaction), not the visible conversation."]})]}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Trimming vs compaction"}),n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-[11px] border-collapse",children:[n.jsx("thead",{children:n.jsxs("tr",{className:"text-left text-gray-500 dark:text-gray-400",children:[n.jsx("th",{className:"py-1 pr-2 font-medium",children:" "}),n.jsx("th",{className:"py-1 pr-2 font-semibold text-sky-700 dark:text-sky-300",children:"Trimming"}),n.jsx("th",{className:"py-1 font-semibold text-fuchsia-700 dark:text-fuchsia-300",children:"Compaction"})]})}),n.jsx("tbody",{className:"align-top",children:[["acts on","the disposable wire copy — this one request","the persisted store — permanently"],["(1) the request","shrinks this request so it fits the window","future requests carry a summary instead of raw history"],["(2) the store array","untouched — full history stays on disk","rewritten: old messages → an LLM-written summary"],["on disk?","no — ephemeral","yes"],["lossy?","no — reversible; next request has the full store","yes — the detail is gone for good"],["uses the LLM?","no — mechanical string ops","yes — the model writes the summary"],["cost","~free, every request","a whole extra LLM turn, occasionally"],["when","while building the request — after any pre-emptive compaction, before send","BEFORE the request (pre-emptive, near threshold) or AFTER a 413 (reactive)"],["trigger","budget pressure when building; again, harder, on a 413","pre-emptive: tokReal > threshold at turn start · reactive: a 413 that trimming still can’t fit"]].map(([I,B,z])=>n.jsxs("tr",{className:"border-t border-gray-100 dark:border-gray-800/60",children:[n.jsx("td",{className:"py-1 pr-2 text-gray-500 dark:text-gray-400 whitespace-nowrap",children:I}),n.jsx("td",{className:"py-1 pr-2 text-gray-700 dark:text-gray-200",children:B}),n.jsx("td",{className:"py-1 text-gray-700 dark:text-gray-200",children:z})]},I))})]})})]}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"The trimming ladder (fitWireToBudget)"}),n.jsx("div",{className:"text-[11px] text-gray-500 dark:text-gray-400 mb-1",children:"Applied in order, checking after each rung whether the wire fits — stops as soon as it does. The newest message is always preserved."}),n.jsxs("ol",{className:"list-decimal list-inside space-y-0.5 text-[11px]",children:[n.jsxs("li",{children:[n.jsx("b",{className:"text-amber-600 dark:text-amber-400",children:"Strip historical reasoning_content"})," — blank out old “thinking” blocks."]}),n.jsxs("li",{children:[n.jsx("b",{className:"text-violet-600 dark:text-violet-400",children:"Stub tool outputs"})," — replace big tool results with a size marker."]}),n.jsxs("li",{children:[n.jsx("b",{className:"text-violet-600 dark:text-violet-400",children:"Stub tool-call arguments"})," — replace large args with a shape placeholder."]}),n.jsxs("li",{children:[n.jsx("b",{className:"text-sky-600 dark:text-sky-400",children:"Recency-weighted text caps"})," — cap older text to 8192 / 2048 / 512 / 128 bytes going back; newest turn stays intact."]})]}),n.jsx("div",{className:"mt-1 text-[10px] text-gray-400 dark:text-gray-500",children:"Per-rung detail for this request isn’t captured yet (would need a backend tap); the numbers above are inferred from store vs sent + finishReason + the compaction event."})]})]})})()]})]})}function CG(e){return e==null?"":e>=1048576?(e/1048576).toFixed(1)+" MB":e>=1024?(e/1024).toFixed(1)+" KB":e+" B"}const Vc=(e,t,r)=>Math.min(r,Math.max(t,e)),L4=0,O4=560,D4=220,P4=200,F4=640,B4=300,xf=520;function Pb(e,t,r,a){try{const i=parseInt(window.localStorage.getItem(e),10);if(Number.isFinite(i))return Vc(i,r,a)}catch{}return t}function z4(){try{return Math.max(xf,window.innerWidth)}catch{return 1600}}function U4(){try{return Vc(Math.round(window.innerWidth*.9),xf,1600)}catch{return 1200}}function TG({open:e,onClose:t,activeSessionId:r,activeSessionTitle:a,onJumpToMessage:i}){const[o,l]=x.useState([]),[u,d]=x.useState(null),[f,p]=x.useState(""),[h,m]=x.useState(!1),[y,v]=x.useState(null),[k,_]=x.useState(null),[w,N]=x.useState(()=>Pb("inspectorTimelineHeight",D4,L4,O4)),[E,A]=x.useState(()=>Pb("inspectorLedgerWidth",B4,P4,F4)),[T,C]=x.useState(()=>Pb("inspectorDrawerWidth",U4(),xf,z4())),[j,M]=x.useState(!1),[L,I]=x.useState(0),[B,z]=x.useState("Request"),[ee,V]=x.useState(!1),D=x.useMemo(()=>f?fG(f):null,[f]);x.useEffect(()=>{try{window.localStorage.setItem("inspectorTimelineHeight",String(w))}catch{}},[w]),x.useEffect(()=>{try{window.localStorage.setItem("inspectorLedgerWidth",String(E))}catch{}},[E]),x.useEffect(()=>{try{window.localStorage.setItem("inspectorDrawerWidth",String(T))}catch{}},[T]);const K=x.useCallback(G=>{G.preventDefault();const oe=G.clientY,Q=w,fe=Fe=>N(Vc(Q+(Fe.clientY-oe),L4,O4)),ke=()=>{window.removeEventListener("pointermove",fe),window.removeEventListener("pointerup",ke),window.removeEventListener("pointercancel",ke),document.body.style.userSelect=""};document.body.style.userSelect="none",window.addEventListener("pointermove",fe),window.addEventListener("pointerup",ke),window.addEventListener("pointercancel",ke)},[w]),H=x.useCallback(G=>{G.preventDefault();const oe=G.clientX,Q=E,fe=Fe=>A(Vc(Q+(Fe.clientX-oe),P4,F4)),ke=()=>{window.removeEventListener("pointermove",fe),window.removeEventListener("pointerup",ke),window.removeEventListener("pointercancel",ke),document.body.style.userSelect=""};document.body.style.userSelect="none",window.addEventListener("pointermove",fe),window.addEventListener("pointerup",ke),window.addEventListener("pointercancel",ke)},[E]),J=x.useCallback(G=>{G.preventDefault();const oe=G.clientX,Q=T,fe=Fe=>C(Vc(Q+(oe-Fe.clientX),xf,z4())),ke=()=>{window.removeEventListener("pointermove",fe),window.removeEventListener("pointerup",ke),window.removeEventListener("pointercancel",ke),document.body.style.userSelect=""};document.body.style.userSelect="none",window.addEventListener("pointermove",fe),window.addEventListener("pointerup",ke),window.addEventListener("pointercancel",ke)},[T]),ne=x.useCallback(async()=>{if(D){M(!0);try{const G=new Map;await Promise.all(hG(D).map(async Fe=>{try{G.set(Fe,await C_(u,Fe))}catch{}}));const oe=j4(D,u,G),Q=new Blob([oe],{type:"text/plain;charset=utf-8"}),fe=URL.createObjectURL(Q),ke=document.createElement("a");ke.href=fe,ke.download=`inspector-${u||"session"}.txt`,document.body.appendChild(ke),ke.click(),ke.remove(),setTimeout(()=>URL.revokeObjectURL(fe),2e3)}catch(G){v(G&&G.message?G.message:"Download failed")}finally{M(!1)}}},[D,u]),P=x.useCallback(async()=>{try{const G=await F3();l(Array.isArray(G)?G:[])}catch(G){v(G&&G.message?G.message:"Failed to list sessions")}},[]);x.useEffect(()=>{e&&P()},[e,r,P]),x.useEffect(()=>{e&&d(G=>r||(G&&o.some(oe=>oe.id===G)?G:o.length?o[0].id:null))},[e,r,o]),x.useEffect(()=>{if(!e||!u){p("");return}let G=!1;return m(!0),v(null),_(null),p(""),B3(u).then(oe=>{G||p(oe||"")}).catch(oe=>{G||(oe&&oe.status===404?p(""):v(oe&&oe.message?oe.message:"Failed to load events"))}).finally(()=>{G||m(!1)}),()=>{G=!0}},[e,u,L]);const U=x.useCallback(()=>{P(),I(G=>G+1)},[P]);x.useEffect(()=>{if(D&&D.requests.length&&k==null){const G=D.requests.find(oe=>oe.messageDrop);_((G||D.requests[0]).seq)}},[D,k]),x.useEffect(()=>{if(!e)return;const G=oe=>{oe.key==="Escape"&&t()};return window.addEventListener("keydown",G),()=>window.removeEventListener("keydown",G)},[e,t]);const X=x.useCallback(G=>C_(u,G),[u]),F=x.useCallback(async()=>{if(u&&window.confirm(`Purge inspector capture for session ${u}? This deletes the on-disk NDJSON and cannot be undone.`))try{await z3(u),p(""),d(null),await P()}catch(G){v(G&&G.message?G.message:"Failed to purge")}},[u,r,P]),Z=x.useMemo(()=>D&&D.requests.find(G=>G.seq===k)||null,[D,k]),W=x.useMemo(()=>D&&Z&&Z.messageDrop&&D.requests.find(G=>G.seq===Z.messageDrop.prevSeq)||null,[D,Z]);return e?n.jsxs("div",{className:"fixed inset-0 z-50 flex",children:[n.jsx("div",{className:"absolute inset-0 bg-black/40",onClick:t,"aria-hidden":"true"}),n.jsxs("div",{style:{width:T,maxWidth:"100vw"},className:"relative ml-auto h-full bg-white dark:bg-gray-950 shadow-2xl flex flex-col animate-[slideIn_.15s_ease-out] border-l border-gray-200 dark:border-gray-800",children:[n.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize inspector width",title:"Drag to resize the inspector · double-click to reset",onPointerDown:J,onDoubleClick:()=>C(U4()),className:"group absolute left-0 top-0 h-full w-1.5 -ml-0.5 z-20 cursor-col-resize flex items-center justify-center",children:n.jsx("div",{className:"w-0.5 h-12 rounded-full bg-gray-300 dark:bg-gray-700 group-hover:bg-primary-400 dark:group-hover:bg-primary-500 transition-colors"})}),n.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 h-12 border-b border-gray-200 dark:border-gray-800 flex-shrink-0",children:[n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[n.jsx("span",{className:"text-base flex-shrink-0",children:"🦋"}),n.jsx("h2",{className:"text-sm font-semibold text-gray-800 dark:text-gray-100 flex-shrink-0",children:"Inspector"}),n.jsx("span",{className:"text-[11px] px-1.5 py-0.5 rounded bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300 flex-shrink-0",children:"debug"}),u&&n.jsxs("span",{className:"text-[11px] text-gray-500 dark:text-gray-400 truncate border-l border-gray-200 dark:border-gray-700 pl-2 min-w-0",title:u===r&&a?`${a} · ${u}`:u,children:[u===r&&a?a:u,u===r&&n.jsx("span",{className:"ml-1 text-emerald-500",title:"the chat you're currently in",children:"●"})]})]}),n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[n.jsxs("select",{value:u||"",onChange:G=>d(G.target.value||null),className:"max-w-[280px] text-xs px-2 py-1 rounded border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-900 text-gray-700 dark:text-gray-200",title:"Captured sessions (newest first)",children:[o.length===0&&!r&&n.jsx("option",{value:"",children:"(no captures)"}),r&&!o.some(G=>G.id===r)&&n.jsxs("option",{value:r,children:["● ",r.slice(0,12),"… · (current chat — no capture yet)"]}),o.map(G=>n.jsxs("option",{value:G.id,children:[G.id===r?"● ":"",G.id.slice(0,12),"… · ",G.events," ev · ",CG(G.bytes)]},G.id))]}),n.jsx("button",{type:"button",onClick:U,className:"p-1 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors flex-shrink-0",title:"Reload — capture is replay, so re-fetch after sending a prompt","aria-label":"Reload capture",children:n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h5M20 20v-5h-5M20 9A8 8 0 006 5.3M4 15a8 8 0 0014 3.7"})})}),D&&n.jsx(Wc,{getText:()=>j4(D,u),label:"copy session",title:"Copy the whole replay as one LLM-friendly text blob (spilled bodies shown as refs)"}),D&&n.jsx("button",{type:"button",onClick:ne,disabled:j,className:"text-xs px-2 py-1 rounded bg-gray-100 text-gray-600 hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700 transition-colors disabled:opacity-50",title:"Download the whole session as one file — fetches every spilled body so the exact bytes are included",children:j?"preparing…":"download"}),n.jsx("button",{type:"button",onClick: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"}),n.jsx("button",{type:"button",onClick:t,className:"p-1.5 rounded-lg text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors",title:"Close (Esc)","aria-label":"Close inspector",children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})]}),n.jsxs("div",{className:"px-4 pt-2 border-b border-gray-200 dark:border-gray-800 flex-shrink-0",children:[h?n.jsx("div",{style:{height:w},className:"flex items-center justify-center text-sm text-gray-400 dark:text-gray-500",children:"Loading capture…"}):y?n.jsx("div",{style:{height:w},className:"flex items-center justify-center text-sm text-red-500 dark:text-red-400",children:y}):D?n.jsx(mG,{timeline:D.timeline,selectedSeq:k,onSelectSeq:_,height:w}):n.jsx("div",{style:{height:w},className:"flex items-center justify-center text-center px-4 text-sm text-gray-400 dark:text-gray-500",children:u?u===r?"No capture for this chat yet — send a prompt in it, then hit reload ↻.":"No capture for the selected session.":"No captures yet — send a prompt."}),n.jsx("div",{role:"separator","aria-orientation":"horizontal","aria-label":"Resize timeline",title:"Drag to resize the timeline · double-click to reset",onPointerDown:K,onDoubleClick:()=>N(D4),className:"group h-2.5 flex items-center justify-center cursor-row-resize",children:n.jsx("div",{className:"h-1 w-10 rounded-full bg-gray-300 dark:bg-gray-700 group-hover:bg-primary-400 dark:group-hover:bg-primary-500 transition-colors"})})]}),n.jsxs("div",{className:"flex-1 flex min-h-0",children:[n.jsx("div",{style:{width:E},className:"flex-shrink-0 border-r border-gray-200 dark:border-gray-800 min-h-0 overflow-hidden",children:D?n.jsx(xG,{turns:D.turns,selectedSeq:k,onSelect:_}):n.jsx("div",{className:"p-4 text-xs text-gray-400 dark:text-gray-500 italic",children:"—"})}),n.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize the turn list",title:"Drag to resize the turn list · double-click to reset",onPointerDown:H,onDoubleClick:()=>A(B4),className:"group w-1.5 flex-shrink-0 cursor-col-resize flex items-center justify-center hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors",children:n.jsx("div",{className:"w-0.5 h-10 rounded-full bg-gray-300 dark:bg-gray-700 group-hover:bg-primary-400 dark:group-hover:bg-primary-500 transition-colors"})}),n.jsx("div",{className:"flex-1 min-w-0 min-h-0",children:n.jsx(jG,{rec:Z,prevRec:W,onSelectSeq:_,onResolveRef:X,onJumpToMessage:i,tab:B,onTabChange:z,showRaw:ee,onShowRawChange:V},Z?Z.seq:"none")})]})]}),n.jsx("style",{children:"@keyframes slideIn { from { transform: translateX(24px); opacity: .6 } to { transform: translateX(0); opacity: 1 } }"})]}):null}class RG{constructor(){this.eventSource=null,this.listeners=new Map,this.sessionId=null,this.reconnectTimeout=null,this.reconnectDelay=1e3,this.maxReconnectDelay=3e4,this.lastEventId=null,this.lastActivityAt=0,this.watchdogTimer=null,this.watchdogCheckMs=2e4,this.stalenessThresholdMs=35e3}_markActivity(){this.lastActivityAt=Date.now()}_startWatchdog(){this._stopWatchdog(),this._markActivity(),this.watchdogTimer=setInterval(()=>{if(this.eventSource&&Date.now()-this.lastActivityAt>this.stalenessThresholdMs){const t=this.eventSource;this._emit("error",{});try{t.close()}catch{}this.eventSource===t&&(this.eventSource=null),this._scheduleReconnect()}},this.watchdogCheckMs)}_stopWatchdog(){this.watchdogTimer&&(clearInterval(this.watchdogTimer),this.watchdogTimer=null)}connect(t){this.disconnect(),this.sessionId!==t&&(this.lastEventId=null),this.sessionId=t;const r=[];t&&r.push("sessionID="+encodeURIComponent(t)),this.lastEventId&&r.push("lastEventId="+encodeURIComponent(this.lastEventId));const a="/global/event"+(r.length>0?"?"+r.join("&"):"");this.eventSource=new EventSource(a);const i=this.eventSource;i.onopen=()=>{this.eventSource===i&&(this.reconnectDelay=1e3,this._markActivity(),this._emit("connected",{}))},i.onmessage=o=>{if(this.eventSource===i){this._markActivity(),o.lastEventId&&(this.lastEventId=o.lastEventId);try{const l=JSON.parse(o.data);l.type&&this._emit(l.type,l)}catch{}}},i.onerror=()=>{this.eventSource===i&&(this._emit("error",{}),i.close(),this.eventSource=null,this._scheduleReconnect())},this._startWatchdog()}disconnect(){this._stopWatchdog(),this.reconnectTimeout&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null),this.eventSource&&(this.eventSource.close(),this.eventSource=null)}on(t,r){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(r),()=>this.off(t,r)}off(t,r){const a=this.listeners.get(t);a&&a.delete(r)}_emit(t,r){const a=this.listeners.get(t);if(a)for(const i of a)try{i(r)}catch{}}_scheduleReconnect(){this.reconnectTimeout||(this.reconnectTimeout=setTimeout(()=>{this.reconnectTimeout=null,this.connect(this.sessionId)},this.reconnectDelay),this.reconnectDelay=Math.min(this.reconnectDelay*2,this.maxReconnectDelay))}}const ir=new RG;function AG(){const[e,t]=x.useState(()=>{if(typeof window<"u"){const y=localStorage.getItem("pave-theme");return y?y==="dark":window.matchMedia("(prefers-color-scheme: dark)").matches}return!1}),[r,a]=x.useState(()=>typeof window<"u"?localStorage.getItem("pave-oryzo")==="true":!1),[i,o]=x.useState(()=>{if(typeof window<"u"){const y=localStorage.getItem("pave-apple");return y==="true"||y==="1"}return!1}),l=e||r;x.useEffect(()=>{const y=document.documentElement;y.classList.toggle("dark",l),y.classList.toggle("theme-oryzo",r),y.classList.toggle("theme-apple",i),y.style.colorScheme=l?"dark":"light",localStorage.setItem("pave-theme",e?"dark":"light"),localStorage.setItem("pave-oryzo",r?"true":"false"),localStorage.setItem("pave-apple",i?"true":"false")},[l,e,r,i]);const[u,d]=x.useState(()=>typeof window<"u"?localStorage.getItem("pave-hacker")==="true":!1);x.useEffect(()=>{localStorage.setItem("pave-hacker",u?"true":"false")},[u]);const[f,p]=x.useState(()=>typeof window<"u"?localStorage.getItem("pave-mobile-frameless")!=="false":!1);x.useEffect(()=>{typeof window<"u"&&localStorage.setItem("pave-mobile-frameless",f?"true":"false")},[f]);const[h,m]=x.useState(!1);return{darkMode:l,setDarkMode:t,oryzoMode:r,setOryzoMode:a,appleMode:i,setAppleMode:o,hackerMode:u,setHackerMode:d,matrixMode:h,setMatrixMode:m,mobileFrameless:f,setMobileFrameless:p}}const wv=200,Sv=600,IG=288;function MG(){const[e,t]=x.useState(()=>{if(typeof window<"u"){const a=localStorage.getItem("pave-terminal-width");if(a){const i=parseInt(a,10);if(!isNaN(i)&&i>=wv&&i<=Sv)return i}}return IG}),r=x.useRef(e);return r.current=e,x.useEffect(()=>{const a=setTimeout(()=>{localStorage.setItem("pave-terminal-width",String(e))},200);return()=>clearTimeout(a)},[e]),x.useEffect(()=>{const a=()=>{localStorage.setItem("pave-terminal-width",String(r.current))};return window.addEventListener("beforeunload",a),()=>{a(),window.removeEventListener("beforeunload",a)}},[]),{terminalWidth:e,setTerminalWidth:t}}const Fb="pave-sidebar-width";function LG(){const[e,t]=x.useState(()=>typeof window>"u"?Gc:zI(localStorage.getItem(Fb))),r=x.useRef(e);return r.current=e,x.useEffect(()=>{const a=setTimeout(()=>{localStorage.setItem(Fb,String(e))},200);return()=>clearTimeout(a)},[e]),x.useEffect(()=>{const a=()=>{localStorage.setItem(Fb,String(r.current))};return window.addEventListener("beforeunload",a),()=>{a(),window.removeEventListener("beforeunload",a)}},[]),{sidebarWidth:e,setSidebarWidth:t}}function OG(e){const[t,r]=x.useState(()=>{if(typeof window<"u"){const u=localStorage.getItem("pave-right-pane-visible");return u===null?!0:u==="true"}return!0}),[a,i]=x.useState(""),o=x.useRef(t);o.current=t;const l=x.useCallback(()=>{const u=!o.current;r(u),i(e(u?"app.right_pane_shown":"app.right_pane_hidden"))},[e]);return x.useEffect(()=>{localStorage.setItem("pave-right-pane-visible",t?"true":"false")},[t]),{rightPaneVisible:t,toggleRightPane:l,rightPaneAnnouncement:a}}function DG(){const[e,t]=x.useState(()=>typeof window<"u"?localStorage.getItem("pave-banner-hidden")==="true":!1),r=x.useCallback(()=>{t(a=>{const i=!a;try{localStorage.setItem("pave-banner-hidden",String(i))}catch{}return i})},[]);return{bannerHidden:e,toggleBanner:r}}function PG(){const[e,t]=x.useState(()=>typeof window<"u"&&localStorage.getItem("pave-activity-view")||"map");return x.useEffect(()=>{typeof window<"u"&&localStorage.setItem("pave-activity-view",e)},[e]),{activityView:e,setActivityView:t}}const FG=["web","agent"],BG=["tui","acp"];function q4(e){return e?e.client?FG.indexOf(e.client)!==-1:BG.indexOf(e.source)===-1:!1}const H4=40;function zG(){var $i;const{t:e}=Jt(),{darkMode:t,setDarkMode:r,oryzoMode:a,setOryzoMode:i,appleMode:o,setAppleMode:l,hackerMode:u,setHackerMode:d,matrixMode:f,setMatrixMode:p,mobileFrameless:h,setMobileFrameless:m}=AG(),{activityView:y,setActivityView:v}=PG(),{terminalWidth:k,setTerminalWidth:_}=MG(),{sidebarWidth:w,setSidebarWidth:N}=LG(),{rightPaneVisible:E,toggleRightPane:A,rightPaneAnnouncement:T}=OG(e),{bannerHidden:C,toggleBanner:j}=DG(),M="pave-active-session";function L(){try{return localStorage.getItem(M)||null}catch{return null}}function I(O){try{O?localStorage.setItem(M,O):localStorage.removeItem(M)}catch{}}function B(){try{localStorage.removeItem(M)}catch{}}const[,z]=x.useState(0),[ee,V]=x.useState(!1),D=x.useRef(null),K=x.useRef(new Map),[H,J]=x.useState(()=>new Set),[ne,P]=x.useState(()=>new Set),U=x.useRef(null),X=x.useRef("chat"),F=x.useRef(null),Z=x.useMemo(()=>typeof window>"u"?!1:/mac|iphone|ipad|ipod/i.test(navigator.platform||navigator.userAgent||""),[]);x.useEffect(()=>{const O=ae=>{if(!(ae instanceof HTMLElement))return!1;const he=ae.tagName;return!!(he==="INPUT"||he==="TEXTAREA"||ae.isContentEditable)},te=ae=>{if(ae.repeat)return;const he=typeof ae.key=="string"?ae.key.toLowerCase():"";if((Z?ae.metaKey:ae.ctrlKey)&&!ae.altKey&&!ae.shiftKey&&he==="k"){ae.preventDefault(),V(sr=>!sr);return}if((Z?ae.metaKey:ae.ctrlKey)&&!ae.altKey&&!ae.shiftKey&&he==="b"){ae.preventDefault(),Le(sr=>!sr);return}const Ie=(Z?ae.metaKey:ae.ctrlKey)&&!ae.altKey&&!ae.shiftKey&&he==="j",jt=window.matchMedia("(min-width: 1024px)").matches,lr=X.current==="chat";if(Ie&&U.current&&jt&&lr){ae.preventDefault(),A();return}if(O(ae.target))return;const Er=ae.ctrlKey&&!ae.altKey&&!ae.metaKey&&he==="h",Ir=ae.ctrlKey&&ae.shiftKey&&!ae.altKey&&!ae.metaKey&&he==="m";(Er||Ir)&&(ae.preventDefault(),d(sr=>!sr))};return window.addEventListener("keydown",te),()=>window.removeEventListener("keydown",te)},[e,Z,A,d]);const[W,G]=x.useState(!0),[oe,Q]=x.useState(!1),[fe,ke]=x.useState(null),[Fe,Ve]=x.useState(null),[Ge,qe]=x.useState("chat");X.current=Ge;const[,Ce]=x.useState(null),[He,ze]=x.useState(null),[gt,mt]=x.useState(!1),[wt,$e]=x.useState(!1),[Et,Ze]=x.useState(!1),[Oe,it]=x.useState(!1),[me,Ee]=x.useState([]),[ge,je]=x.useState({}),se=x.useRef(!1);x.useEffect(()=>{x3().then(async O=>{if(Q(O.enabled),O.authenticated&&O.user){se.current=!0;try{sessionStorage.removeItem("pave-restore-reloads")}catch{}ke(O.user)}else O.enabled&&await J4()}).catch(O=>{console.error("Failed to check auth status:",O)}).finally(()=>G(!1))},[]),x.useEffect(()=>(k_(({recovered:O,user:te})=>{if(O){let ae=-1;try{ae=parseInt(sessionStorage.getItem("pave-restore-reloads")||"0",10)}catch{ae=-1}if(ae>=0&&ae<1){let he=!1;try{sessionStorage.setItem("pave-restore-reloads",String(ae+1)),he=!0}catch{he=!1}if(he){window.location.reload();return}}if(te){se.current=!0,ke(te);return}}se.current&&bt("Session expired. Please log in again."),ke(null)}),()=>k_(null)),[]),x.useEffect(()=>{oe&&!fe&&ir.disconnect()},[fe,oe]),x.useEffect(()=>{if(!fe)return;let O=!1;return hW().then(te=>{!O&&te&&te.currentVersion&&Ve(te.currentVersion)}).catch(()=>{}),()=>{O=!0}},[fe]),x.useEffect(()=>{rV(()=>U.current)},[]);const De=x.useCallback(async()=>{try{await y3()}catch(O){console.error("Logout failed:",O);return}ke(null),window.location.reload()},[]),[rt,dt]=x.useState(null),[lt,Lt]=x.useState(!1),[ot,et]=x.useState([]),[Ot,gr]=x.useState([]),[dr,or]=x.useState({}),Qt=x.useRef(dr);x.useEffect(()=>{Qt.current=dr},[dr]);const $r=x.useRef({}),[ue,Le]=x.useState(!0),[ct,Be]=x.useState(!1),nt=x.useRef(!1),kt=x.useRef(null),at=x.useRef(0);x.useEffect(function(){return function(){at.current&&cancelAnimationFrame(at.current)}},[]);const re=x.useCallback(function(){at.current&&cancelAnimationFrame(at.current),at.current=requestAnimationFrame(function(){at.current=0,kt.current&&kt.current.scrollToBottom()})},[]),[ve,Re]=x.useState([]),[ie,Rt]=x.useState(null);U.current=ie,x.useEffect(()=>{I(ie)},[ie]),x.useEffect(()=>{ie&&nV(typeof document<"u"&&document.visibilityState==="visible",ie)},[ie]);const ft=x.useMemo(()=>ie&&ve.find(O=>O.id===ie)||null,[ie,ve]),[Ut,Me]=x.useState([]),[Tt,tr]=x.useState(0),[rn,hn]=x.useState(!1),[mn,yr]=x.useState(null),[oa,ri]=x.useState(!1),_a=x.useRef(!1),[un,wa]=x.useState(!1),[la,Lr]=x.useState({}),ki=x.useRef(la);ki.current=la;const[ni,ca]=x.useState({}),[jn,Je]=x.useState(null),[_t,qt]=x.useState(null),Gt=x.useRef(null);x.useEffect(function(){return function(){Gt.current&&clearTimeout(Gt.current),Zr.current&&clearTimeout(Zr.current)}},[]);const[Or,vr]=x.useState(null),[Pn,Ua]=x.useState(null),[fn,Wr]=x.useState(null),Zr=x.useRef(null),Tr=x.useCallback((O,te)=>{if(O){const ae=!te&&!!ki.current[O];ae&&O===Dt.current&&(qt(null),Gt.current&&(clearTimeout(Gt.current),Gt.current=null)),Lr(he=>{const ye={...he},Pe=!!he[O];if(te?ye[O]=!0:delete ye[O],Pe&&!te&&kn.current&&kn.current[O]&&!tc.current.has(O)){const Ie=kn.current[O];if(Ie.length>0){const jt=Ie.shift();O===Dt.current&&us(Ie.length),Promise.resolve().then(()=>{try{O===Dt.current&&kt.current&&kt.current.resetAutoScroll(),el.current&&el.current(O,jt.content,jt.imageAttachments,jt.agent,jt.displayContent,jt.queuedTempId,jt.fileAttachments),O===Dt.current&&kt.current&&(kt.current.resetAutoScroll(),re())}catch(lr){console.error("[Queue] Drain dispatch failed:",lr)}})}}return ye}),ae&&(tc.current.delete(O),_g(O).then(he=>{const ye=Array.isArray(he&&he.items)?he.items:[];ca(Pe=>{const Ie={...Pe};if(ye.length===0)if(Ie[O])delete Ie[O];else return Pe;else Ie[O]=ye;return Ie})}).catch(()=>{}))}O===Dt.current&&wa(te)},[re]),Fn=x.useCallback(O=>{const te={};Object.keys(O).forEach(he=>{O[he]&&O[he].type==="busy"&&(te[he]=!0)}),Lr(he=>{const ye={...he};return Object.keys(te).forEach(Pe=>{ye[Pe]=!0}),Object.keys(O).forEach(Pe=>{O[Pe]&&O[Pe].type!=="busy"&&delete ye[Pe]}),ye});const ae=O[Dt.current];wa(!!(ae&&ae.type==="busy"))},[]),[ai,nn]=x.useState({}),ua=x.useRef(null),Cn=x.useRef(null),[qa,Jn]=x.useState({}),[Bn,Sa]=x.useState({});x.useEffect(()=>{y==="map"&&ie&&wg(ie).then(O=>{O&&Array.isArray(O.todos)&&Sa(te=>({...te,[ie]:O.todos}))}).catch(()=>{})},[y,ie]);const[fr,Kt]=x.useState({});x.useEffect(()=>{y==="tools"&&ie&&M_(ie).then(O=>{O&&Kt(te=>({...te,[ie]:O}))}).catch(()=>{})},[y,ie]);const[da,zr]=x.useState(null),[kr,zn]=x.useState(null),[Tn,bt]=x.useState(null),[Ye,$]=x.useState(!1),[ce,Se]=x.useState(null),We=50,[ht,St]=x.useState(!1),[Sr,Nr]=x.useState(0),Hr=x.useRef(0),[Rn,_i]=x.useState(0),[an,Fs]=x.useState(()=>{try{return localStorage.getItem("pave-show-other-apps")!=="false"}catch{return!0}}),Do=x.useRef(an),[Bs,zs]=x.useState(""),Ha=x.useRef(""),[Po,Fo]=x.useState(!0),[ql,Us]=x.useState(!1),[Fi,ns]=x.useState(""),[as,Un]=x.useState(0),[ea,Bi]=x.useState(0),[zi,ii]=x.useState(!1),is=x.useRef(null),Hl=x.useRef(null),[Vr,Ui]=x.useState(!1),[Na,qs]=x.useState(""),[Kf,Hs]=x.useState(!1),[$l,$s]=x.useState(""),[Bo,Wl]=x.useState(!1),[zo,vu]=x.useState(null),[Yf,ss]=x.useState(!1),[Vl,ku]=x.useState({}),Gl=x.useRef({}),[Kl,_u]=x.useState({}),Uo=x.useRef({}),[Xf,Qf]=x.useState({}),wu=x.useRef({}),qo=x.useRef(new Set),wi=x.useRef(null);x.useEffect(()=>{Gl.current=Vl},[Vl]),x.useEffect(()=>{Uo.current=Kl},[Kl]),x.useEffect(()=>{if(!ie)return;const O=ve.find(te=>te.id===ie);O&&(O.moe_top_k!=null&&Gl.current[ie]===void 0&&ku(te=>te[ie]===void 0?{...te,[ie]:O.moe_top_k}:te),O.reasoning_effort&&Uo.current[ie]===void 0&&_u(te=>te[ie]===void 0?{...te,[ie]:O.reasoning_effort}:te))},[ie,ve]);const Su=Vl[ie]??null,Zf=Kl[ie]??"max",Nu=Xf[ie]??null,os=x.useCallback((O,te)=>{vu({text:O,type:te||"info"}),wi.current&&clearTimeout(wi.current),wi.current=setTimeout(()=>{vu(null),wi.current=null},3e3)},[]);function Yl(O,te){return(Array.isArray(O==null?void 0:O.settings)?O.settings:[]).find(he=>he&&he.key===te)||null}x.useEffect(()=>{const O=()=>{Hb().then(te=>{const ae=Yl(te,"PAVE_WHATSAPP_CHAT_ID"),he=ae&&ae.value||"";qs(he)}).catch(te=>{console.error("[WhatsApp] Failed to load default chatId from settings:",te.message)})};return O(),window.addEventListener("pave:settings-updated",O),()=>window.removeEventListener("pave:settings-updated",O)},[]);const[Ws,Jf]=x.useState(!1),[Xl,ep]=x.useState(!1),[Ql,tp]=x.useState(!1),[ls,Vs]=x.useState(!1),[Gs,Eu]=x.useState("default"),Ks=Gs==="oryzo",[si,ju]=x.useState(!1);x.useEffect(()=>{const O=()=>{Hb().then(te=>{const ae=Ie=>{const jt=Yl(te,Ie),lr=String(jt&&jt.value||"").toLowerCase();return lr==="true"||lr==="1"};Jf(ae("PAVE_EXPERIMENTAL_WHATSAPP")),ep(ae("PAVE_EXPERIMENTAL_SESSION_BANNER")),tp(ae("PAVE_EXPERIMENTAL_AGENT_BOARD")),Vs(ae("PAVE_EXPERIMENTAL_AGENT_COMM"));const he=Yl(te,"PAVE_EXPERIMENTAL_THEME"),ye=he&&String(he.value||"").toLowerCase(),Pe=ye==="oryzo"||ye==="apple"?ye:ae("PAVE_EXPERIMENTAL_ORYZO_THEME")?"oryzo":"default";Eu(Pe),ju(!0)}).catch(te=>{console.error("[Experimental] Failed to load feature flags:",te.message)})};return O(),window.addEventListener("pave:settings-updated",O),()=>window.removeEventListener("pave:settings-updated",O)},[Ge]),x.useEffect(()=>{!Ql&&Ge==="board"&&qe("chat")},[Ql,Ge]),x.useEffect(()=>{!ls&&Ge==="agents"&&qe("chat")},[ls,Ge]),x.useEffect(()=>{si&&!Ks&&a&&i(!1)},[si,Ks,a]),x.useEffect(()=>{si&&Gs!=="apple"&&o&&l(!1)},[si,Gs,o,l]);const Zl=x.useRef(!1);x.useEffect(()=>{si&&Ks&&!Zl.current&&(Zl.current=!0,i(!0))},[si,Ks]);const qi=x.useRef(!1);x.useEffect(()=>{si&&Gs==="apple"&&!qi.current&&(qi.current=!0,l(!0))},[si,Gs,l]),x.useEffect(()=>{const O=()=>{j_().then(te=>{Ze(!!(te&&te.inspector))}).catch(te=>{console.error("[Inspector] Failed to fetch config:",te.message)})};return window.addEventListener("pave:settings-updated",O),()=>window.removeEventListener("pave:settings-updated",O)},[]);const Ho=x.useRef(Vr),rp=x.useRef(Na);x.useEffect(()=>{Ho.current=Vr,rp.current=Na},[Vr,Na]);const Jl=x.useRef({});x.useEffect(()=>{Ws&&rM({enabled:Vr,sessionId:ie,chatId:Na}).catch(O=>{console.error("[WhatsApp routing] Failed to update:",O.message)})},[Ws,Vr,ie,Na]),x.useEffect(()=>{!Ws&&Vr&&Ui(!1)},[Ws,Vr]),x.useEffect(()=>{zi&&is.current&&is.current.focus()},[zi]),x.useEffect(()=>{const O=window.matchMedia("(min-width: 1024px)"),te=ae=>{ae.matches&&ii(!1)};return O.addEventListener("change",te),()=>O.removeEventListener("change",te)},[]);function ec(){const O=Bn[ie]||[],te=[];for(const Ie of Ut||[])for(const jt of Ie.parts||[]){if(jt.type!=="tool")continue;const lr=jt.state&&jt.state.output;if(!lr)continue;let Er=lr;if(typeof lr=="string")try{Er=JSON.parse(lr)}catch{continue}Er&&Er.canvas&&Er.canvas.type&&Er.canvas.source&&te.push(Er.canvas)}const ae=ie?`pave-canvas-cleared:${ie}`:null;let he=new Set;if(ae&&typeof window<"u")try{const Ie=localStorage.getItem(ae);Ie&&(he=new Set(JSON.parse(Ie)))}catch{}const ye=te.filter(Ie=>!he.has(Ie.type+":"+Ie.source)),Pe=()=>{if(!ae||typeof window>"u")return;const Ie=te.map(jt=>jt.type+":"+jt.source);try{localStorage.setItem(ae,JSON.stringify(Ie))}catch{}z(jt=>jt+1)};return n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"flex-1 overflow-y-auto min-w-0 flex flex-col",children:u?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center justify-end gap-1 px-2 py-1 border-b border-gray-200 dark:border-gray-700 text-xs",children:[n.jsx("button",{type:"button",onClick:()=>v("map"),className:`px-2 py-0.5 rounded ${y==="map"?"bg-blue-500 text-white":"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"}`,title:"Strategy map (todos)","aria-label":"Strategy map view",children:"map"}),n.jsx("button",{type:"button",onClick:()=>v("tools"),className:`px-2 py-0.5 rounded ${y==="tools"?"bg-blue-500 text-white":"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"}`,title:"Tool-call DAG (execution)","aria-label":"Tool-call map view",children:"tools"}),n.jsxs("button",{type:"button",onClick:()=>v("canvas"),className:`px-2 py-0.5 rounded relative ${y==="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",ye.length>0?n.jsxs("span",{className:"ml-1 opacity-70",children:["(",ye.length,")"]}):null]}),n.jsx("button",{type:"button",onClick:()=>v("terminal"),className:`px-2 py-0.5 rounded ${y==="terminal"?"bg-blue-500 text-white":"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"}`,title:"Terminal","aria-label":"Terminal view",children:"terminal"})]}),n.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:y==="map"?n.jsx(vH,{todos:O,darkMode:t}):y==="tools"?n.jsx(AH,{graph:fr[ie]||null,darkMode:t}):y==="canvas"?n.jsx(t4,{canvases:ye,onClear:ye.length?Pe:null}):n.jsx(gR,{toolParts:lc,matrixMode:f,onToggleMatrix:()=>p(Ie=>!Ie),darkMode:t})})]}):ye.length>0?n.jsx(t4,{canvases:ye,onClear:ye.length?Pe:null}):n.jsx(fR,{toolParts:nl})}),n.jsx(E$,{messages:Ut,isBusy:un,isCompacting:jn!=null,activeModel:rt,sessionModel:dr[ie]||null,isPrivateMode:ne.has(ie),registryEntries:Ot})]})}x.useEffect(()=>{Us(!1),ns(""),Un(0),Bi(0),ii(!1)},[ie]),x.useEffect(()=>{if(!ie)return;let O=!1;return J3(ie).then(te=>{if(O||!te)return;const ae=ie;te.privateMode&&P(he=>{if(he.has(ae))return he;const ye=new Set(he);return ye.add(ae),ye}),Array.isArray(te.messageIds)&&te.messageIds.length&&J(he=>{let ye=!1;const Pe=new Set(he);for(const Ie of te.messageIds)Pe.has(Ie)||(Pe.add(Ie),ye=!0);return ye?Pe:he})}).catch(()=>{}),()=>{O=!0}},[ie]),x.useEffect(()=>{if(!ie){ss(!1);return}let O=!1;return eT(ie).then(te=>{if(O)return;const ae=te&&te.config?te.config:{};ss(!!ae.enabled)}).catch(()=>{}),()=>{O=!0}},[ie]),x.useEffect(()=>{if(!ie){Lt(!1);return}const O=Qt.current[ie]||rt;if(!O){Lt(!1);return}let te=!1;return U3(O).then(ae=>{te||Lt(!!(ae&&ae.adaptiveQuality))}).catch(()=>{te||Lt(!1)}),()=>{te=!0}},[ie,rt,dr]),x.useEffect(()=>{ea>0&&as>=ea?Un(ea-1):ea===0&&as!==0&&Un(0)},[ea,as]);const Dt=x.useRef(ie);x.useEffect(()=>{Dt.current=ie;const O=kn.current[ie];us(O?O.length:0)},[ie]),x.useEffect(()=>{if(!ie)return;let O=!1;return _g(ie).then(te=>{if(O)return;const ae=Array.isArray(te&&te.items)?te.items:[],he=ie;ca(ye=>{const Pe={...ye};if(ae.length===0)if(Pe[he])delete Pe[he];else return ye;else Pe[he]=ae;return Pe})}).catch(te=>{console.warn("[queue] hydrate failed for",ie,te&&te.message)}),()=>{O=!0}},[ie]);const cs=x.useRef(y);x.useEffect(()=>{cs.current=y},[y]);const kn=x.useRef({}),[np,us]=x.useState(0),tc=x.useRef(new Set),Hi=x.useCallback(O=>{if(O===Dt.current){const te=kn.current[O];us(te?te.length:0)}},[]),rc=x.useCallback(O=>{if(!O)return;const te=Dt.current;if(!te)return;const ae=kn.current[te];Array.isArray(ae)&&ae.length>0&&(kn.current[te]=ae.filter(he=>he.queuedTempId!==O)),Me(he=>he.filter(ye=>ye.info.id!==O)),Hi(te)},[Hi]),$a=!oe||!!fe;x.useEffect(()=>{!W&&$a&&(fa(),Ea(),A_().then(O=>{Fn(O)}).catch(O=>{console.error("Failed to fetch session status:",O)}))},[W,$a]),x.useEffect(()=>{!W&&$a&&(j_().then(O=>{O&&O.model&&dt(O.model),Ze(!!(O&&O.inspector))}).catch(O=>{console.error("Failed to fetch config:",O)}),h3().then(O=>{O&&Array.isArray(O.providers)&&et(O.providers)}).catch(O=>{console.error("Failed to fetch providers:",O)}),m3().then(O=>{O&&Array.isArray(O.entries)&&gr(O.entries)}).catch(O=>{console.error("Failed to fetch model registry:",O)}),qb().then(O=>{O&&O.home&&$s(O.home)}).catch(O=>{console.error("Failed to fetch path info:",O)}))},[W,$a]);const $o=x.useCallback(()=>{b3().then(O=>{const te=Array.isArray(O&&O.pending)?O.pending:[];Ee(te)}).catch(O=>{console.error("Failed to fetch pending permissions:",O)})},[]);x.useEffect(()=>{!W&&$a&&$o()},[W,$a,$o]),x.useEffect(()=>{const ae=setInterval(()=>{Ee(he=>{const ye=Date.now(),Pe=he.filter(Ie=>ye-(Ie.timestamp||0)<3e5);return Pe.length===he.length?he:Pe})},3e4);return()=>clearInterval(ae)},[]);const fa=x.useCallback(async O=>{try{const te=O&&O.includeArchived||nt.current,ae=Hr.current||0,he=Math.max(We,ae),ye=O&&typeof O.q=="string"?O.q:Ha.current,Pe=!!(ye&&ye.trim()),Ie=await wl({limit:he,offset:0,includeArchived:Pe?!0:te,includeOtherApps:!1,q:ye});if(Ie&&Ie.sessions){const jt=Array.isArray(Ie.sessions)?Ie.sessions:[];Re(jt),St(!!Ie.hasMore),_i(typeof Ie.total=="number"?Ie.total:jt.length),Nr(jt.length),Hr.current=jt.length}else{const jt=Array.isArray(Ie)?Ie:[];Re(jt),St(!1),_i(jt.length),Nr(jt.length),Hr.current=jt.length}}catch(te){return console.error("Failed to load sessions:",te),!1}return!0},[]);function Ys(O,te){var ae=te&&te.time&&te.time.updated||0,he=O&&O.time&&O.time.updated||0;return ae-he}const Wo=200,Vo=x.useRef(Wo),[ap,Cu]=x.useState(!1),[Go,An]=x.useState([]),Xs=200,[Ko,ds]=x.useState([]),Tu=x.useMemo(()=>{if(!(Go.length||Ko.length))return ve;const te=Object.create(null),ae=[],he=ve.concat(Go,Ko);for(let ye=0;ye<he.length;ye++){const Pe=he[ye];!Pe||!Pe.id||te[Pe.id]||(te[Pe.id]=!0,ae.push(Pe))}return ae.sort(Ys)},[ve,Go,Ko]),Yo=x.useCallback(async()=>{const O=Ha.current,te=!!(O&&O.trim());if(!nt.current&&!te){ds([]);return}try{const ae=await wl({limit:Xs,offset:0,onlyArchived:!0,q:O}),he=ae&&ae.sessions?Array.isArray(ae.sessions)?ae.sessions:[]:Array.isArray(ae)?ae:[];ds(he)}catch(ae){console.error("Failed to load archived sessions:",ae)}},[]),Ea=x.useCallback(async()=>{const O=Ha.current,te=!!(O&&O.trim());if(!Do.current&&!te){An([]);return}try{const ae=await wl({limit:Vo.current,offset:0,onlyOtherApps:!0,includeArchived:te?!0:nt.current,q:O}),he=ae&&ae.sessions?Array.isArray(ae.sessions)?ae.sessions:[]:Array.isArray(ae)?ae:[];An(he),Cu(!!(ae&&ae.hasMore))}catch(ae){console.warn("Failed to load other-app sessions:",ae),An([]),Cu(!1)}},[]),ip=x.useCallback(async()=>{Vo.current+=Wo,await Ea()},[Ea]);x.useEffect(()=>{function O(){ie&&n3(ie).then(function(te){te&&te.sessionID&&(Dt.current=te.sessionID,Rt(te.sessionID),fa())}).catch(function(te){console.error("Failed to create archive session:",te);const ae=(()=>{if(!te)return!1;if(te.status===404||te.response&&te.response.status===404)return!0;if(typeof te.message=="string"){const he=te.message.match(/^(\d{3})\s*:/);if(he&&parseInt(he[1],10)===404)return!0}return!1})();bt(e(ae?"archiveViewer.noArchive":"archiveViewer.loadError"))})}return document.addEventListener("navigateToArchiveSession",O),()=>document.removeEventListener("navigateToArchiveSession",O)},[ie,fa,e,bt]);const sp=async()=>{try{const O=Ha.current,te=!!(O&&O.trim()),ae=await wl({limit:We,offset:Sr,includeArchived:te?!0:nt.current,includeOtherApps:!1,q:O});if(ae&&ae.sessions){const he=Array.isArray(ae.sessions)?ae.sessions:[];Re(ye=>{for(var Pe={},Ie=0;Ie<ye.length;Ie++)Pe[ye[Ie].id]=!0;for(var jt=[],lr=0;lr<he.length;lr++)Pe[he[lr].id]||jt.push(he[lr]);return ye.concat(jt)}),St(!!ae.hasMore),typeof ae.total=="number"&&_i(ae.total),Nr(ye=>{var Pe=ye+he.length;return Hr.current=Pe,Pe})}}catch(O){console.error("Failed to load more sessions:",O)}},In=async(O,te)=>{try{const ae=(te?te.fresh!==!1:!0)&&!_a.current,he=await S_(O,ae,ae?{limit:H4}:void 0),ye=he&&!Array.isArray(he)&&Array.isArray(he.messages),Pe=ye?he.messages:he,Ie=ye&&typeof he.compactedOutCount=="number"?he.compactedOutCount:0;return Dt.current!==O?null:Array.isArray(Pe)?(tr(ae?Ie:0),ae&&ye?(hn(he.hasMore===!0),yr(typeof he.nextCursor=="string"?he.nextCursor:null)):(hn(!1),yr(null)),Me(jt=>{const lr=Pe.some(Ae=>Ae.info.mode==="compaction"),Er=Array.isArray(jt)&&jt.some(Ae=>Ae.info&&Ae.info.mode==="compaction");if(lr&&!Er)return Pe;const Ir=new Set(Pe.map(Ae=>Ae.info.id)),sr=Pe.reduce(function(Ae,Ue){return Ue&&Ue.info&&Ue.info.mode==="compaction"&&Ue.info.time&&typeof Ue.info.time.created=="number"?Math.max(Ae,Ue.info.time.created):Ae},-1/0),be=jt.filter(Ae=>Ae.info.sessionID===O&&!Ir.has(Ae.info.id)&&!String(Ae.info.id).startsWith("temp-")&&!(sr!==-1/0&&Ae.info.time&&typeof Ae.info.time.created=="number"&&Ae.info.time.created<sr));if(be.length===0)return Pe;const Y=[];let de=0,we=0;for(;de<Pe.length||we<be.length;){const Ae=Pe[de],Ue=be[we],yt=Ae&&Ae.info.time&&typeof Ae.info.time.created=="number"?Ae.info.time.created:1/0,At=Ue&&Ue.info.time&&typeof Ue.info.time.created=="number"?Ue.info.time.created:1/0;de<Pe.length&&(we>=be.length||yt<=At)?(Y.push(Ae),de++):(Y.push(Ue),we++)}return Y}),Pe):(Me([]),null)}catch(ae){return console.error("Failed to load messages:",ae),Dt.current===O&&((ae&&(ae.status||ae.response&&ae.response.status))===404?(Dt.current=null,Rt(null),Re(ye=>ye.filter(Pe=>Pe.id!==O)),An(ye=>ye.filter(Pe=>Pe.id!==O)),ds(ye=>ye.filter(Pe=>Pe.id!==O))):bt("Failed to load messages: "+(ae&&ae.message?ae.message:String(ae)))),null}},nc=x.useCallback(async O=>Dt.current!==O?null:(_a.current=!0,In(O,{fresh:!1})),[In]),Qs=async O=>{if(oa||!rn||!mn||_a.current||Dt.current!==O)return null;ri(!0);try{const te=await S_(O,!0,{limit:H4,before:mn});if(Dt.current!==O)return null;if(!te||Array.isArray(te)||!Array.isArray(te.messages))throw new Error("Invalid paged message response");return tr(typeof te.compactedOutCount=="number"?te.compactedOutCount:0),hn(te.hasMore===!0),yr(typeof te.nextCursor=="string"?te.nextCursor:null),Me(ae=>{const he=new Map;for(const ye of te.messages.concat(ae))ye&&ye.info&&ye.info.id&&he.set(ye.info.id,ye);return Array.from(he.values()).sort((ye,Pe)=>{const Ie=ye.info.time.created-Pe.info.time.created;return Ie!==0?Ie:ye.info.id<Pe.info.id?-1:ye.info.id>Pe.info.id?1:0})}),te.messages}catch(te){return Dt.current===O&&bt("Failed to load earlier messages: "+(te&&te.message?te.message:String(te))),null}finally{Dt.current===O&&ri(!1)}};x.useEffect(()=>{if(!ie){Me([]),tr(0),hn(!1),yr(null),ri(!1),_a.current=!1,nn({}),zn(null),Fo(!0);return}Me([]),tr(0),hn(!1),yr(null),ri(!1),_a.current=!1,zn(null),Fo(!1),zr(null),ie&&(I_(ie).then(be=>{be&&Array.isArray(be.banners)&&Jn(Y=>({...Y,[ie]:be.banners}))}).catch(()=>{}),wg(ie).then(be=>{be&&Array.isArray(be.todos)&&Sa(Y=>({...Y,[ie]:be.todos}))}).catch(()=>{})),ir.connect(ie);let O=!1,te=!1,ae=!1,he=!1;const ye=ie,Pe=be=>{if(Dt.current!==ye)return;const Y=new Map;if(Array.isArray(be))for(const de of be){if(!de||!de.info||!de.info.id||!Array.isArray(de.parts))continue;const we=new Set;for(const Ae of de.parts)Ae&&(Ae.type==="text"||Ae.type==="reasoning")&&we.add(Ae.type);we.size>0&&Y.set(de.info.id,we)}nn(de=>{const we=de[ye];if(!we||Object.keys(we).length===0)return de;const Ae={};let Ue=!1;for(const yt of Object.keys(we)){const At=we[yt],vt={};let Ht=!1;const Mr=Y.get(yt);for(const pa of Object.keys(At)){const Ei=At[pa];if(Ei._fromSnapshot){vt[pa]=Ei,Ht=!0;continue}const ta=Ei.type;if(Mr&&Mr.has(ta)){Ue=!0;continue}vt[pa]=At[pa],Ht=!0}Ht?Ae[yt]=vt:Ue=!0}if(!Ue)return de;if(Object.keys(Ae).length===0){const yt={...de};return delete yt[ye],yt}return{...de,[ye]:Ae}})},Ie=setTimeout(()=>{!O&&!te&&(te=!0,In(ye).then(be=>{ae=!0,Pe(be),he&&Dt.current===ye&&In(ye).then(Y=>{Pe(Y)})}))},3e3),jt=80;function lr(){Cn.current!=null&&(clearTimeout(Cn.current),Cn.current=null);const be=ua.current;be&&(ua.current=null,nn(Y=>{let de=Y;for(const we of Object.keys(be)){const Ae=be[we],Ue={...de[we]||{}};for(const yt of Object.keys(Ae)){const At=Ae[yt],vt={...Ue[yt]||{}};for(const Ht of Object.keys(At)){const Mr=At[Ht],pa=vt[Ht];Mr.type==="text"||Mr.type==="reasoning"?vt[Ht]={...Mr,text:((pa==null?void 0:pa.text)||"")+(Mr.delta||"")}:vt[Ht]={...pa,...Mr}}Ue[yt]=vt}de={...de,[we]:Ue}}return de}))}function Er(){Cn.current==null&&(Cn.current=setTimeout(lr,jt))}function Ir(be,Y,de){ua.current||(ua.current={});const we=ua.current;we[Y]||(we[Y]={});const Ae=we[Y];Ae[de]||(Ae[de]={});const Ue=Ae[de],yt=Ue[be.id];be.type==="text"||be.type==="reasoning"?Ue[be.id]={...be,delta:(yt&&yt.delta||"")+(be.delta||"")}:Ue[be.id]={...yt,...be}}const sr=[ir.on("connected",()=>{O=!0,clearTimeout(Ie),Fo(!0),$o(),A_().then(be=>{Fn(be)}).catch(()=>{}),_g(ye).then(be=>{const Y=Array.isArray(be&&be.items)?be.items:[];ca(de=>{const we={...de};if(Y.length===0)if(we[ye])delete we[ye];else return de;else we[ye]=Y;return we})}).catch(()=>{}),In(ye).then(be=>{ae=!0,Pe(be),he&&Dt.current===ye&&In(ye).then(Y=>{Pe(Y)})})}),ir.on("error",()=>{Fo(!1),!O&&!te&&(clearTimeout(Ie),te=!0,In(ye).then(be=>{ae=!0,Pe(be),he&&Dt.current===ye&&In(ye).then(Y=>{Pe(Y)})}))}),ir.on("session.status",be=>{var we;const Y=be.properties||be,de=((we=Y.status)==null?void 0:we.type)==="busy";Tr(Y.sessionID,de)}),ir.on("message.part.delta",be=>{const Y=(be.properties||be).part;if(!Y||!Y.sessionID)return;K.current.has(Y.sessionID)&&K.current.delete(Y.sessionID);const{sessionID:de,messageID:we}=Y;if(Ir(Y,de,we),Er(),Y.type==="text"&&Y.delta){const Ae=Jl.current;Ae[de]||(Ae[de]={}),Ae[de][we]=(Ae[de][we]||"")+Y.delta,Ho.current&&console.log("[WhatsApp] Accumulating text delta:",Y.delta.length,"chars, total:",Ae[de][we].length)}}),ir.on("streaming.snapshot",be=>{const Y=be.properties||be,de=Y.sessionID,we=Y.parts;!de||!Array.isArray(we)||nn(Ae=>{const Ue={...Ae[de]||{}};for(const yt of we){const At={...Ue[yt.messageID]||{}};At[yt.id]={id:yt.id,type:yt.type,text:yt.text,sessionID:de,messageID:yt.messageID,_fromSnapshot:!0},Ue[yt.messageID]=At}return{...Ae,[de]:Ue}})}),ir.on("message.progress",be=>{const Y=be.properties||be;Y.sessionID===Dt.current&&zn({chunks:Y.chunks||0,textLength:Y.textLength||0,toolCalls:Y.toolCalls||0,toolArgBytes:Y.toolArgBytes||0,toolNames:Y.toolNames||[]})}),ir.on("message.part.updated",be=>{const Y=(be.properties||be).part;if(Y){if(lr(),Y.type==="text"||Y.type==="reasoning"){const de=Y.sessionID;nn(we=>{const Ae=we[de];if(!Ae)return we;const Ue=Ae[Y.messageID];if(!Ue)return we;const yt={};var At=!1;for(const vt of Object.keys(Ue))Ue[vt].type!==Y.type&&(yt[vt]=Ue[vt],At=!0);if(!At){const vt={...Ae};if(delete vt[Y.messageID],Object.keys(vt).length===0){const Ht={...we};return delete Ht[de],Ht}return{...we,[de]:vt}}return{...we,[de]:{...Ae,[Y.messageID]:yt}}})}if(Y.sessionID===Dt.current){if(!ae){Y.sessionID===ye&&(he=!0);return}(Y.type==="tool"||Y.type==="tool-use")&&cs.current==="tools"&&M_(Y.sessionID).then(de=>{de&&Kt(we=>({...we,[Y.sessionID]:de}))}).catch(()=>{}),Me(de=>de.map(we=>{if(we.info.id!==Y.messageID)return we;const Ae=we.parts.findIndex(At=>At.id===Y.id);if(Ae>=0)return{...we,parts:we.parts.map((At,vt)=>vt===Ae?Y:At)};const Ue=we.parts.slice();let yt=Ue.length;for(let At=Ue.length-1;At>=0;At--){if(Ue[At].id<=Y.id){yt=At+1;break}At===0&&(yt=0)}return Ue.splice(yt,0,Y),{...we,parts:Ue}}))}}}),ir.on("message.updated",be=>{const Y=(be.properties||be).info;if(!(!Y||Y.sessionID!==Dt.current)){if(lr(),!ae){Y.sessionID===ye&&(he=!0);return}if(Me(de=>{const we=de.findIndex(vt=>vt.info.id===Y.id);if(we>=0)return de.map((vt,Ht)=>Ht===we?{...vt,info:Y}:vt);if(Y.role==="user"){const vt=de.findIndex(Ht=>Ht.info.id&&Ht.info.id.startsWith("temp-")&&Ht.info.role==="user");if(vt>=0)return de.map((Ht,Mr)=>Mr===vt?{info:Y,parts:[]}:Ht)}const Ae={info:Y,parts:[]};if(!Y.time||typeof Y.time.created!="number")return[...de,Ae];const Ue=Y.time.created;let yt=de.length;for(let vt=de.length-1;vt>=0;vt--){const Ht=de[vt].info.time;if(Ht&&typeof Ht.created=="number"&&Ht.created<=Ue){yt=vt+1;break}vt===0&&(yt=0)}const At=de.slice();return At.splice(yt,0,Ae),At}),Y.compactedOut!==!0&&Y.finish){const de=Y.sessionID;if(Y.role==="assistant"&&Ho.current&&de===Dt.current){const we=Jl.current[de];we&&we[Y.id]&&(delete we[Y.id],Object.keys(we).length===0&&delete Jl.current[de]),nM(de).then(Ae=>{if(Ae&&Ae.message)return console.log(`[WhatsApp] Processing queued message (${Ae.remaining} remaining)`),Sd(de,Ae.message.text,null,Qt.current[de]||void 0)}).catch(Ae=>{console.error("[WhatsApp] Failed to process queue:",Ae)})}nn(we=>{const Ae=we[de];if(!Ae||!Ae[Y.id])return we;const Ue={...Ae};if(delete Ue[Y.id],Object.keys(Ue).length===0){const yt={...we};return delete yt[de],yt}return{...we,[de]:Ue}}),zn(null),Y.finish!=="compacted"&&Tr(de,!1),In(Dt.current)}}}),ir.on("message.deleted",be=>{const Y=be.properties||be,de=Y.sessionID,we=Y.messageID;!de||!we||de===Dt.current&&(Me(Ae=>Ae.filter(Ue=>Ue.info.id!==we)),nn(Ae=>{if(!Ae[de])return Ae;const Ue=Ae[de];if(!Ue[we])return Ae;const yt={...Ae},At={...Ue};return delete At[we],yt[de]=At,yt}))}),ir.on("session.updated",be=>{const Y=be.properties||be,de=Y.info||Y,we=de&&(de.id||de.sessionID)||Y.sessionID||Y.id;if(!we){fa(),Ea();return}const Ae=de&&de.time&&typeof de.time.updated=="number",Ue=yt=>{Re(At=>{var vt=!1,Ht=At.map(Mr=>Mr.id===we?(vt=!0,{...yt,ui:{...yt.ui,...Mr.ui}}):Mr);return!vt&&q4(yt)&&(Ht=[yt].concat(Ht)),Ht.sort(Ys),Ht}),ds(At=>{var vt=!1,Ht=At.map(Mr=>Mr.id!==we?Mr:(vt=!0,{...yt,ui:{...yt.ui,...Mr.ui}}));return vt?(Ht=Ht.filter(Mr=>Mr.archived),Ht.sort(Ys),Ht):At}),q4(yt)||An(At=>{var vt=!1,Ht=At.map(Mr=>Mr.id!==we?Mr:(vt=!0,{...yt,ui:{...yt.ui,...Mr.ui}}));return vt?(Ht.sort(Ys),Ht):At})};Ae?(Ue(de),or(yt=>{let At=yt;const vt=de.model;return typeof vt=="string"&&vt||vt&&typeof vt=="object"&&vt.providerID&&vt.modelID?At={...yt,[we]:vt}:yt[we]&&(At={...yt},delete At[we]),Qt.current=At,At})):kg(we).then(yt=>{Ue(yt),or(At=>{let vt=At;const Ht=yt&&yt.model;return typeof Ht=="string"&&Ht||Ht&&typeof Ht=="object"&&Ht.providerID&&Ht.modelID?vt={...At,[we]:Ht}:At[we]&&(vt={...At},delete vt[we]),Qt.current=vt,vt})}).catch(yt=>{console.error("Failed to fetch updated session, falling back to full reload:",yt),fa()})}),ir.on("session.deleted",be=>{const Y=be.properties||be,de=Y.info||Y,we=de&&(de.id||de.sessionID)||Y.sessionID||Y.id;we&&(Re(Ae=>Ae.filter(Ue=>Ue.id!==we)),An(Ae=>Ae.filter(Ue=>Ue.id!==we)),ds(Ae=>Ae.filter(Ue=>Ue.id!==we)),Rt(Ae=>Ae===we?null:Ae))}),ir.on("permission.request",be=>{const Y=be.properties||be;Y.requestId&&Ee(de=>de.some(we=>we.id===Y.requestId)?de:[...de,{id:Y.requestId,action:Y.action,type:Y.type,target:Y.target,reason:Y.reason,description:Y.description,timestamp:Date.now()}])}),ir.on("permission.confirmed",be=>{const Y=be.properties||be;Y.requestId&&Ee(de=>de.filter(we=>we.id!==Y.requestId))}),ir.on("permission.denied",be=>{const Y=be.properties||be;Y.requestId&&Ee(de=>de.filter(we=>we.id!==Y.requestId))}),ir.on("question.asked",be=>{const Y=be.properties||be;if(!Y.id)return;const de=Y.tool&&Y.tool.callID?Y.tool.callID:null;if(de&&je(we=>({...we,[de]:Y.id})),nu()){const we=Y.questions&&Y.questions[0],Ae=we?we.text:"A question needs your input.",Ue=Y.sessionID||null;CA({title:"PAVE — Question",body:Ae.length>200?Ae.slice(0,200)+"…":Ae,tag:"pave-question-"+Y.id,onClick:Ue?function(){qn(Ue),window.focus()}:function(){window.focus()}})}}),ir.on("question.replied",be=>{const Y=be.properties||be;Y.requestId&&je(de=>{var we={};for(var Ae in de)de[Ae]!==Y.requestId&&(we[Ae]=de[Ae]);return we})}),ir.on("question.rejected",be=>{const Y=be.properties||be;Y.requestId&&je(de=>{var we={};for(var Ae in de)de[Ae]!==Y.requestId&&(we[Ae]=de[Ae]);return we})}),ir.on("quality.hint",be=>{const Y=be.properties||be;if(!Y.preset)return;const de=Y.sessionID;de&&(Qf(we=>({...we,[de]:Y})),wu.current[de]=Y)}),ir.on("dlp.cancelled",be=>{const de=(be.properties||be).sessionID;if(!de)return;const we=K.current.get(de);we&&(we.tempId&&Me(Ae=>Ae.filter(Ue=>Ue.info.id!==we.tempId)),de===Dt.current&&D.current&&typeof D.current.setText=="function"&&D.current.setText(we.text||""),K.current.delete(de)),Tr(de,!1)}),ir.on("dlp.private_message",be=>{const Y=be.properties||be,de=Y.sessionID,we=Y.messageID;!de||!we||(J(Ae=>{if(Ae.has(we))return Ae;const Ue=new Set(Ae);return Ue.add(we),Ue}),P(Ae=>{if(Ae.has(de))return Ae;const Ue=new Set(Ae);return Ue.add(de),Ue}))}),ir.on("dlp.exited_private",be=>{const de=(be.properties||be).sessionID;de&&P(we=>{if(!we.has(de))return we;const Ae=new Set(we);return Ae.delete(de),Ae})}),ir.on("session.error",be=>{const Y=be.properties||be;if(Y.reauthRequired){console.log("[session.error] Re-authentication required, logging out...",Y.source||""),bt("Session expired. Please log in again."),ke(null),Y.sessionID&&Tr(Y.sessionID,!1);return}Y.sessionID&&Tr(Y.sessionID,!1),Y.sessionID===Dt.current&&(Y.code==="insufficient_credits"?(bt(null),Se(Y.upgradeUrl||null),$(!0)):bt(Y.error||"An error occurred"))}),ir.on("session.retry",be=>{const Y=be.properties||be;Y.reason==="rate_limit"&&Y.sessionID===Dt.current&&(qt({attempt:Y.attempt,maxRetries:Y.maxRetries,delayMs:Y.delayMs,elapsedMs:Y.elapsedMs||0,maxDurationMs:Y.maxDurationMs||0}),Gt.current&&clearTimeout(Gt.current),Gt.current=setTimeout(()=>qt(null),1e4))}),ir.on("session.compacting",be=>{const Y=be.properties||be;Y.sessionID===Dt.current&&Je(de=>({...de,currentTokens:Y.currentTokens??(de==null?void 0:de.currentTokens),threshold:Y.threshold??(de==null?void 0:de.threshold),reason:Y.reason??(de==null?void 0:de.reason),stage:Y.stage??(de==null?void 0:de.stage),elapsedMs:Y.elapsedMs??(de==null?void 0:de.elapsedMs),messageCount:Y.messageCount??(de==null?void 0:de.messageCount),chunks:Y.chunks??(de==null?void 0:de.chunks),textLength:Y.textLength??(de==null?void 0:de.textLength)}))}),ir.on("session.compacted",be=>{const Y=be.properties||be,de=Dt.current;if(Y.sessionID===de){if(Je(null),vr(null),Y.newSessionID&&Y.newSessionID!==de&&!Y.inPlace){if(console.log(`[COMPACTED] Cross-session compaction: ${de} → ${Y.newSessionID}`),Y.newSession){fs(Y.newSession);const Ue=Y.newSession.model;(typeof Ue=="string"&&Ue||Ue&&typeof Ue=="object"&&Ue.providerID&&Ue.modelID)&&or(At=>{const vt={...At,[Y.newSessionID]:Ue};return Qt.current=vt,vt})}Dt.current=Y.newSessionID,Rt(Y.newSessionID),wa(!0);return}if(Y.source==="server"){const Ue=Y.summary?Y.summary.substring(0,200)+(Y.summary.length>200?"...":""):"";console.log(`[SERVER-COMPACT] Server auto-compacted session: ${Y.deletedMessages} messages replaced, ${Y.summaryTokens||"?"} summary tokens`),Ue&&console.log("[SERVER-COMPACT] Summary: "+Ue),vr({source:"server",deletedMessages:Y.deletedMessages||0,summaryTokens:Y.summaryTokens||0,summary:Ue})}const we=Y.inPlace===!0,Ae=!!ki.current[de];we&&Ae?console.log("[COMPACTED] In-place compaction during active turn — skipping message reload"):(Me([]),nn(Ue=>{if(!Ue[de])return Ue;const yt={...Ue};return delete yt[de],yt}),zn(null),In(de).then(()=>{requestAnimationFrame(()=>{kt.current&&Dt.current===de&&kt.current.scrollToBottom()})}))}}),ir.on("banner.updated",be=>{const Y=be.properties||be;!Y||!Y.sessionID||(Jn(de=>{const we=de[Y.sessionID]||[];if(we.some(Ue=>Ue.timestamp===Y.timestamp))return de;const Ae=[{url:Y.url,timestamp:Y.timestamp,prompt:Y.prompt,createdAt:new Date(Y.timestamp).toISOString()},...we];return{...de,[Y.sessionID]:Ae}}),Y.sessionID===Dt.current&&zr(null))}),ir.on("banner.progress",be=>{const Y=be.properties||be;if(!Y||Y.sessionID!==Dt.current)return;const de=Y.stage||"working";let we=de;de==="queued"?we="Banner queued":de==="summarizing"?we="Banner: summarizing…":de==="rendering"?we=Y.line?"Banner: "+Y.line.substring(0,80):"Banner: rendering…":de==="saved"?we="Banner saved":de==="error"?we="Banner error: "+(Y.message||"unknown"):de==="skipped"&&(we="Banner skipped: "+(Y.reason||"")),zr({stage:de,label:we,ts:Date.now()}),de==="saved"&&Y.sessionID&&I_(Y.sessionID).then(Ae=>{Ae&&Array.isArray(Ae.banners)&&Jn(Ue=>({...Ue,[Y.sessionID]:Ae.banners}))}).catch(()=>{})}),ir.on("todo.updated",be=>{const Y=be.properties||be;!Y||!Y.sessionID||(Array.isArray(Y.todos)?Sa(de=>({...de,[Y.sessionID]:Y.todos})):wg(Y.sessionID).then(de=>{de&&Array.isArray(de.todos)&&Sa(we=>({...we,[Y.sessionID]:de.todos}))}).catch(()=>{}))}),ir.on("whatsapp.message",be=>{var de;const Y=be.properties||be;Y.sessionId===Dt.current&&Ho.current&&(console.log("[WhatsApp] Injecting message:",(de=Y.text)==null?void 0:de.substring(0,50)),Sd(Y.sessionId,Y.text,null,Qt.current[Y.sessionId]||void 0).catch(we=>console.error("[WhatsApp] Failed to inject message:",we)))}),ir.on("whatsapp.queued",be=>{const Y=be.properties||be;Y.sessionId===Dt.current&&console.log(`[WhatsApp] Message queued from ${Y.sender} (queue size: ${Y.queueSize})`)}),ir.on("queue.updated",be=>{const Y=be.properties||be;if(!Y||!Y.sessionID)return;const de=Array.isArray(Y.items)?Y.items:[];ca(we=>{const Ae={...we};return de.length===0?delete Ae[Y.sessionID]:Ae[Y.sessionID]=de,Ae}),Y.change&&Y.change.kind==="drain"&&Y.sessionID===Dt.current&&kt.current&&(kt.current.resetAutoScroll(),re())}),ir.on("idle-injection.enabled",be=>{const Y=be.properties||be;!Y||Y.sessionID!==ye||(ss(!0),os(e("chat.idle_injection_enabled_toast"),"success"))}),ir.on("idle-injection.disabled",be=>{const Y=be.properties||be;!Y||Y.sessionID!==ye||(ss(!1),os(e("chat.idle_injection_disabled_toast"),"info"))}),ir.on("idle-injection.fired",be=>{const Y=be.properties||be;!Y||Y.sessionID!==ye||os(e("chat.idle_injection_fired_toast"),"success")}),ir.on("idle-injection.timeout",be=>{const Y=be.properties||be;!Y||Y.sessionID!==ye||os(e("chat.idle_injection_timeout_toast"),"warning")}),ir.on("scheduled-injection.fired",be=>{const Y=be.properties||be;!Y||Y.sessionID!==ye||os(e("scheduled_injection.fired_toast"),"success")}),ir.on("scheduled-injection.added",()=>{}),ir.on("scheduled-injection.removed",()=>{}),ir.on("prefill.fallback",be=>{const Y=be.properties||be;!Y||Y.sessionID!==ye||(Wr({originalModel:Y.originalModel,fallbackModel:Y.fallbackModel,reason:Y.reason||"prefill_too_large"}),Zr.current&&clearTimeout(Zr.current),Zr.current=setTimeout(()=>{Wr(null),Zr.current=null},15e3))}),ir.on("auth.device_code",be=>{const Y=be.properties||be;Y.user_code&&Y.verification_uri&&Ua({verification_uri:Y.verification_uri,user_code:Y.user_code,expires_in:Y.expires_in||300})})];return()=>{clearTimeout(Ie),Cn.current!=null&&(clearTimeout(Cn.current),Cn.current=null),lr(),ua.current=null,wi.current&&clearTimeout(wi.current),Zr.current&&(clearTimeout(Zr.current),Zr.current=null),Wr(null),sr.forEach(be=>be()),ir.disconnect()}},[ie]),x.useEffect(()=>{if(!ie)return;const O=setTimeout(()=>{var te;(te=D.current)==null||te.focus()},50);return()=>{clearTimeout(O)}},[ie]);function fs(O){Re(te=>{for(var ae=0;ae<te.length;ae++)if(te[ae].id===O.id)return te.map(he=>he.id===O.id?O:he);return[O,...te]})}const Xo=x.useCallback(async()=>{try{const O=await w_();fs(O),Dt.current=O.id,Rt(O.id)}catch(O){bt("Failed to create session: "+O.message)}},[]);F.current=Xo;const qn=x.useCallback(async O=>{var te;if(O!==Dt.current){Dt.current=O,Rt(O),bt(null),wa(!!ki.current[O]),Je(null);try{const ae=await kg(O);if(Dt.current!==O)return;((te=ae==null?void 0:ae.status)==null?void 0:te.type)==="busy"&&wa(!0),Re(he=>{var lr;if(!ae)return he;const ye=he.findIndex(Er=>Er.id===O),Pe=((lr=ae.time)==null?void 0:lr.updated)||0;if(ye>=0){const Er=he[ye],Ir=he.filter(Y=>Y.id!==O),sr={...ae,ui:{...ae.ui,...Er.ui}},be=Ir.findIndex(Y=>{var de;return(((de=Y.time)==null?void 0:de.updated)||0)<=Pe});return Ir.splice(be<0?Ir.length:be,0,sr),Ir}const Ie=he.findIndex(Er=>{var Ir;return(((Ir=Er.time)==null?void 0:Ir.updated)||0)<=Pe}),jt=[...he];return jt.splice(Ie<0?jt.length:Ie,0,ae),jt}),or(he=>{if(ae&&ae.model)return{...he,[O]:ae.model};if(he[O]){const ye={...he};return delete ye[O],ye}return he})}catch(ae){console.error("Failed to fetch session status for session",O,ae)}}},[]),ps=x.useCallback(async O=>{try{await r3(O),QI(O),Re(te=>te.filter(ae=>ae.id!==O)),ie===O&&(Dt.current=null,Rt(null))}catch(te){bt("Failed to delete: "+te.message)}},[ie]),ac=x.useCallback(async()=>{try{await a3(),await fa(),await Ea(),Dt.current=null,Rt(O=>O&&null)}catch(O){bt("Failed to delete sessions: "+O.message)}},[fa]),Ru=x.useCallback(async(O,te)=>{try{await Xa(O,{title:te}),Re(ae=>ae.map(he=>he.id===O?{...he,title:te}:he))}catch(ae){bt("Failed to rename: "+ae.message)}},[]),Qo=x.useCallback(async O=>{try{const te=await JI(O);te&&te.title&&Re(ae=>ae.map(he=>he.id===O?{...he,title:te.title}:he))}catch(te){bt("Failed to regenerate title: "+te.message)}},[]),[ic,sc]=x.useState(null),Au=x.useCallback(O=>{sc(O)},[]),Iu=x.useCallback(async(O,te)=>{try{await Xa(O,{pinned:te}),Re(ae=>ae.map(he=>he.id===O?{...he,pinned:te}:he))}catch(ae){bt("Failed to pin: "+ae.message)}},[]),Mu=x.useCallback(async O=>{const te=ve.find(he=>he.id===O);if(!te||!te.parentSessionID)return;const ae=te.parentSessionID;try{await o3(O),Re(he=>he.map(ye=>ye.id===O?{...ye,compactionPinned:!1}:ye)),Dt.current=ae,Rt(ae)}catch(he){bt("Failed to unpin: "+he.message)}},[ve]),Lu=x.useCallback(async(O,te)=>{try{await Xa(O,{archived:te}),!nt.current&&te?(Re(ae=>ae.filter(he=>he.id!==O)),ie===O&&(Dt.current=null,Rt(null))):Re(ae=>ae.map(he=>he.id===O?{...he,archived:te}:he))}catch(ae){bt("Failed to archive: "+ae.message)}},[ie]),Si=x.useCallback(async({readOnly:O=!1}={})=>{if(!ie)return;let te,ae,he;if(Re(ye=>{var Ie;const Pe=ye.find(jt=>jt.id===ie);return te=((Ie=Pe==null?void 0:Pe.ui)==null?void 0:Ie.hideThinking)??!1,ae=!te,he=Pe==null?void 0:Pe.ui,ye.map(jt=>jt.id===ie?{...jt,ui:{...jt.ui,hideThinking:ae}}:jt)}),!O)try{await Xa(ie,{ui:{...he,hideThinking:ae}})}catch(ye){console.error("Failed to persist hideThinking:",ye),Re(Pe=>Pe.map(Ie=>Ie.id===ie?{...Ie,ui:{...Ie.ui,hideThinking:te}}:Ie)),bt("Failed to save thinking visibility preference"+(ye!=null&&ye.message?": "+ye.message:""))}},[ie]),Zo=x.useCallback(async O=>{try{await Y3(O)}catch(te){bt("Export failed: "+te.message)}},[]),Zs=x.useCallback(async O=>{try{const te=await X3(O);te&&te.id&&(await fa(),qn(te.id))}catch(te){bt("Import failed: "+te.message)}},[fa,qn]),Ou=x.useRef(!1);x.useEffect(()=>{if(!Ou.current&&!(!$a||ve.length===0)){Ou.current=!0;var O=null,te=!1;try{var ae=new URLSearchParams(window.location.search);O=ae.get("session"),te=!!O}catch{}if(O||(O=L()),!!O){if(ve.some(function(he){return he.id===O})){qn(O);return}kg(O).then(function(he){he&&he.id?qn(O):te||B()}).catch(function(){te||B()})}}},[$a,ve,qn]),x.useEffect(()=>{function O(te){var ae=te.data;!ae||ae.type!=="navigate-session"||ae.sessionId&&qn(ae.sessionId)}return window.addEventListener("message",O),function(){window.removeEventListener("message",O)}},[qn]),x.useEffect(()=>{function O(){try{var ae=indexedDB.open("pave-sw",1);ae.onupgradeneeded=function(){ae.result.createObjectStore("pave-pending-nav")},ae.onsuccess=function(){var he=ae.result;if(!he.objectStoreNames.contains("pave-pending-nav")){he.close();return}var ye=he.transaction("pave-pending-nav","readwrite"),Pe=ye.objectStore("pave-pending-nav"),Ie=Pe.get("sessionId");Ie.onsuccess=function(){var jt=Ie.result;Pe.delete("sessionId"),jt&&jt!==Dt.current&&qn(jt)},ye.oncomplete=function(){he.close()},ye.onerror=function(){he.close()}},ae.onerror=function(){}}catch{}}function te(){document.visibilityState==="visible"&&(O(),setTimeout(O,500),setTimeout(O,1500))}return document.addEventListener("visibilitychange",te),function(){document.removeEventListener("visibilitychange",te)}},[qn]);const op=x.useCallback(async O=>{if(!ie)return;const te=$r.current,ae=(te[ie]||0)+1;te[ie]=ae;const he=Qt.current[ie];or(ye=>{const Pe={...ye};return O?Pe[ie]=O:delete Pe[ie],Qt.current=Pe,Pe});try{const ye=await Xa(ie,{model:O||null});if(te[ie]!==ae)return;ye&&(typeof ye.model=="string"&&ye.model||ye.model&&typeof ye.model=="object"&&ye.model.providerID&&ye.model.modelID)?or(Pe=>{const Ie={...Pe,[ie]:ye.model};return Qt.current=Ie,Ie}):O||or(Pe=>{const Ie={...Pe};return delete Ie[ie],Qt.current=Ie,Ie})}catch(ye){if(te[ie]!==ae)return;or(Pe=>{const Ie={...Pe};return he!==void 0?Ie[ie]=he:delete Ie[ie],Qt.current=Ie,Ie}),console.error("[ModelChange] PATCH failed for session",ie,ye),bt("Failed to update session model: "+ye.message)}},[ie]),Js=x.useCallback(async function(O,te){if(ie){var ae=ft&&ft.disabledSkills||[],he;te?he=ae.filter(function(ye){return ye!==O}):he=ae.concat([O]),Re(function(ye){return ye.map(function(Pe){return Pe.id===ie?{...Pe,disabledSkills:he}:Pe})});try{await Xa(ie,{disabledSkills:he})}catch(ye){Re(function(Pe){return Pe.map(function(Ie){return Ie.id===ie?{...Ie,disabledSkills:ae}:Ie})}),console.error("[SkillToggle] PATCH failed:",ye)}}},[ie,ft]),lp=x.useCallback(async function(){if(ie)try{var O=await tT(),te=O.skillDefaults||{},ae=await Ev(),he=["agent"];(ae||[]).forEach(function(ye){te[ye.name]||he.push(ye.name)}),Re(function(ye){return ye.map(function(Pe){return Pe.id===ie?{...Pe,disabledSkills:he}:Pe})}),await Xa(ie,{disabledSkills:he})}catch(ye){console.error("[SkillToggle] Reset to defaults failed:",ye)}},[ie]),Du=x.useCallback(O=>{Re(te=>te.map(ae=>ae.id===ie?{...ae,directory:O}:ae)),Hs(!1)},[ie]),Pu=x.useCallback(async()=>{const O=!Do.current;Do.current=O,Vo.current=Wo,Fs(O);try{localStorage.setItem("pave-show-other-apps",O?"true":"false")}catch{}await Ea()},[]),Rr=x.useRef(null),oc=x.useCallback(O=>{const te=typeof O=="string"?O:"";zs(te),Ha.current=te,Rr.current&&clearTimeout(Rr.current),Rr.current=setTimeout(()=>{Hr.current=0,Vo.current=Wo,fa({q:te}),Ea(),Yo()},250)},[]);x.useEffect(()=>()=>{Rr.current&&clearTimeout(Rr.current)},[]);const Jo=x.useCallback(async()=>{const O=!nt.current;nt.current=O,await fa({includeArchived:O})?(Be(O),await Promise.all([Yo(),Ea()])):nt.current=!O},[Yo,Ea]),oi=x.useCallback(async(O,te,ae,he,ye,Pe,Ie)=>{const jt=O===Dt.current;Pe&&jt&&Me(ur=>ur.filter(sn=>sn.info.id!==Pe));var lr=(ae?ae.length:0)+(Ie?Ie.length:0);if(lr>uf)throw bt("Too many attachments. Maximum "+uf+" per message."),new Error("Too many attachments");var Er=[],Ir=0;if(ae&&ae.length>0){for(var sr=0;sr<ae.length;sr++){var be=(ae[sr].file.type||"").toLowerCase();if(Cf.indexOf(be)===-1)throw bt('Unsupported image type: "'+ae[sr].name+'". Only PNG, JPEG, GIF, and WebP are supported.'),new Error("Unsupported image type");if(ae[sr].file.size>a2){var Y=Math.round(ae[sr].file.size/1024/1024*10)/10,de=Math.round(a2/1024/1024*10)/10;throw bt('Image "'+ae[sr].name+'" ('+Y+"MB) exceeds the "+de+"MB size limit."),new Error("Image too large")}Ir+=ae[sr].file.size}if(Ir>o2){var we=Math.round(Ir/1024/1024*10)/10,Ae=Math.round(o2/1024/1024*10)/10;throw bt("Combined image size ("+we+"MB) exceeds the "+Ae+"MB total image limit."),new Error("Combined image size too large")}try{Er=await Promise.all(ae.map(function(ur){return new Promise(function(sn,Jr){var Gr=new FileReader;Gr.onload=function(){if(typeof Gr.result!="string"){Jr(new Error("FileReader did not produce a data URL for: "+ur.name));return}sn({type:"image_url",image_url:{url:Gr.result}})},Gr.onerror=function(){Jr(new Error("Failed to read file: "+ur.name))},Gr.readAsDataURL(ur.file)})}))}catch(ur){throw bt("Failed to read image: "+ur.message),ur}}var Ue=[],yt=0;if(Ie&&Ie.length>0){for(var At=0;At<Ie.length;At++){var vt=(Ie[At].file.type||"").toLowerCase();if(uR.indexOf(vt)===-1)throw bt('Unsupported file type: "'+Ie[At].name+'" ('+(vt||"unknown")+")."),new Error("Unsupported file type");if(Ie[At].file.size>i2){var Ht=Math.round(Ie[At].file.size/1024/1024*10)/10,Mr=Math.round(i2/1024/1024*10)/10;throw bt('File "'+Ie[At].name+'" ('+Ht+"MB) exceeds the "+Mr+"MB size limit."),new Error("File too large")}yt+=Ie[At].file.size}if(Ir+yt>s2){var pa=Math.round((Ir+yt)/1024/1024*10)/10,Ei=Math.round(s2/1024/1024*10)/10;throw bt("Combined attachment size ("+pa+"MB) exceeds the "+Ei+"MB total limit."),new Error("Combined attachment size too large")}try{Ue=await Promise.all(Ie.map(function(ur){return new Promise(function(sn,Jr){var Gr=new FileReader;Gr.onload=function(){if(typeof Gr.result!="string"){Jr(new Error("FileReader did not produce a data URL for: "+ur.name));return}sn({type:"file",mime:ur.file.type,filename:ur.name,url:Gr.result})},Gr.onerror=function(){Jr(new Error("Failed to read file: "+ur.name))},Gr.readAsDataURL(ur.file)})}))}catch(ur){throw bt("Failed to read file: "+ur.message),ur}}const ta="temp-"+Date.now();for(var Ra=[{id:ta+"-text",type:"text",text:ye}],Wi=0;Wi<Er.length;Wi++)Ra.push({id:ta+"-img-"+Wi,type:"image_url",image_url:Er[Wi].image_url});for(var Vi=0;Vi<Ue.length;Vi++)Ra.push({id:ta+"-file-"+Vi,type:"file",mime:Ue[Vi].mime,filename:Ue[Vi].filename});const zu={info:{id:ta,sessionID:O,role:"user",time:{created:Date.now(),updated:Date.now()}},parts:Ra};Me(ur=>jt?[...ur,zu]:ur),jt&&kt.current&&(kt.current.resetAutoScroll(),re()),Tr(O,!0),K.current.set(O,{text:ye,tempId:ta});const Uu=Gl.current[O]??null,li=Uo.current[O]??"max",ji=Uu===null&&!qo.current.has(O),Gi=wu.current[O],ro=ji&&Gi?Gi.moe_topk||null:Uu;try{var no=null;(Er.length>0||Ue.length>0)&&(no=Ue.concat(Er)),await Sd(O,te,no,Qt.current[O]||void 0,he,{moeTopK:ro,reasoningEffort:li,adaptiveQuality:ji})}catch(ur){if(ur.status===409)if(Er.length>0||Ue.length>0){const Jr=ta;kn.current[O]||(kn.current[O]=[]),kn.current[O].push({content:te,imageAttachments:ae,fileAttachments:Ie,agent:he,displayContent:ye,queuedTempId:Jr}),Hi(O),Tr(O,!1);return}else try{await N_(O,te,{displayContent:ye,agent:he||void 0,model:Qt.current[O]||void 0,moeTopK:ro,reasoningEffort:li,adaptiveQuality:ji}),Me(Jr=>Jr.filter(Gr=>Gr.info.id!==ta)),Tr(O,!1);return}catch(Jr){throw bt("Failed to queue message: "+Jr.message),Tr(O,!1),Me(Gr=>Gr.filter(ci=>ci.info.id!==ta)),Jr}if(ur&&ur.reauthRequired){bt("Session expired. Please log in again."),ke(null),Tr(O,!1),Me(sn=>sn.filter(Jr=>Jr.info.id!==ta));return}throw bt("Failed to send: "+ur.message),Tr(O,!1),Me(sn=>sn.filter(Jr=>Jr.info.id!==ta)),ur}},[Hi,re]),el=x.useRef(oi);x.useEffect(()=>{el.current=oi},[oi]);const ja=x.useCallback(async(O,te,ae,he)=>{bt(null);const ye=O,Pe=O.match(/^\/([a-zA-Z0-9_-]+)\s+([a-zA-Z0-9_-]+)(?:\s+(.*))?$/s);if(Pe){const sr=Pe[1],be=Pe[2],Y=Pe[3]||"",de=Y||sr+" "+be,we=(sr+"_"+be).replace(/-/g,"_").slice(0,128);O="[SKILL_HINT: User explicitly requested "+sr+"."+be+(Y?" with args: "+Y:"")+". Call the "+we+` tool with these parameters.]
129
+
130
+ `+de}let Ie=Dt.current;if(!Ie)try{const sr=await w_();fs(sr),Dt.current=sr.id,Rt(sr.id),Ie=sr.id,await new Promise(be=>setTimeout(be,200))}catch(sr){throw bt("Failed to create session: "+sr.message),sr}if(!!la[Ie]){if(!(te&&te.length>0||he&&he.length>0)){try{await N_(Ie,O,{displayContent:ye,agent:ae||void 0,model:Qt.current[Ie]||void 0})}catch(we){bt("Failed to queue message: "+we.message)}return}const be="queued-"+Date.now()+"-"+Math.random().toString(36).slice(2,7),Y=[{id:be+"-text",type:"text",text:ye}];if(te&&te.length>0)for(var lr=0;lr<te.length;lr++){var Er=te[lr].preview||"";Y.push({id:be+"-img-"+lr,type:"image_url",image_url:{url:Er}})}if(he&&he.length>0)for(var Ir=0;Ir<he.length;Ir++)Y.push({id:be+"-file-"+Ir,type:"file",mime:he[Ir].file.type,filename:he[Ir].name});const de={info:{id:be,sessionID:Ie,role:"user",time:{created:Date.now(),updated:Date.now()},_queued:!0},parts:Y};Me(we=>[...we,de]),Ie===Dt.current&&kt.current&&(kt.current.resetAutoScroll(),re()),kn.current[Ie]||(kn.current[Ie]=[]),kn.current[Ie].push({content:O,imageAttachments:te,agent:ae,displayContent:ye,queuedTempId:be,fileAttachments:he}),Hi(Ie);return}await oi(Ie,O,te,ae,ye,null,he)},[la,oi,Hi,re]);x.useEffect(()=>{const O=()=>{ja(e("planCard.executePrompt"),void 0,"build")};return window.addEventListener("pave:plan-execute",O),()=>window.removeEventListener("pave:plan-execute",O)},[ja,e]);const eo=x.useCallback(async()=>{if(ie)try{const O=ie;tc.current.add(O),await l3(O),Tr(O,!1),zn(null)}catch(O){console.error("Abort failed:",O),bt("Failed to stop: "+(O&&O.message?O.message:String(O)))}},[ie,Tr]),tl=x.useCallback(async(O,te,ae)=>{if(bt(null),O==="btw"){const he=Dt.current;if(!he){bt("No active session to fork.");return}let ye;try{ye=await t3(he)}catch(Ie){throw bt("Fork failed: "+(Ie&&Ie.message?Ie.message:String(Ie))),Ie}if(!ye||!ye.id)throw bt("Fork failed: server returned no session id."),new Error("Fork returned no session");fs(ye),Dt.current=ye.id,Rt(ye.id),await new Promise(Ie=>setTimeout(Ie,200));const Pe=(te||"").trim();if(Pe)try{await ja(Pe,ae&&ae.imageAttachments?ae.imageAttachments:void 0,void 0,ae&&ae.fileAttachments?ae.fileAttachments:void 0)}catch{}return}if(O==="compact"){const he=Dt.current;if(!he){bt("No active session to compact.");return}bt(null),Je({reason:"manual",stage:"starting"}),vr(null),s3(he).then(ye=>{if(!ye||!ye.success){Je(null),bt("Compaction failed: "+(ye&&ye.error||"unknown error"));return}In(he),Je(null),vr(null)}).catch(ye=>{Je(null),ye&&ye.status===409?bt("Cannot compact while the session is busy. Wait for the current response to finish."):bt("Compaction failed: "+(ye&&ye.message?ye.message:String(ye)))});return}bt("Unknown built-in command: /"+O)},[ja]),gs=x.useCallback(O=>{Ee(te=>te.filter(ae=>ae.id!==O))},[]),Fu=x.useCallback(async()=>{for(var O=Ut.length-1;O>=0;O--)if(Ut[O].info.role==="user"){var te=Ut[O].parts||[],ae=sk(te,null),he=te.filter(function(Ie){return Ie.type==="image_url"&&Ie.image_url});if(ae.trim()||he.length>0)if(he.length>0){var ye=ie;if(!ye)break;Tr(ye,!0),bt(null);try{var Pe=he.map(function(Ie){return{type:"image_url",image_url:Ie.image_url}});await Sd(ye,ae.trim(),Pe,Qt.current[ye]||void 0)}catch(Ie){bt("Failed to retry: "+Ie.message),Tr(ye,!1)}}else try{await ja(ae.trim())}catch(Ie){bt("Failed to retry: "+Ie.message),Tr(ie,!1)}break}},[Ut,ja,ie]),cp=x.useCallback(async function(O){if(O&&O.trim()){bt(null),kt.current&&kt.current.resetAutoScroll();try{await ja(O.trim()),re()}catch(te){bt("Failed to resend: "+te.message),Tr(ie,!1)}}},[ja,re]),Ca=x.useMemo(()=>ft?ft.source==="archive"||ft._readOnly===!0:!1,[ft]),rl=x.useMemo(()=>ft?ft._readOnly===!0&&ft.source!=="tui"&&ft.source!=="archive":!1,[ft]),hs=x.useMemo(()=>{if(!rl||!ft||!ve)return null;for(const O of ve)if(O.parentSessionID===ft.id)return O.id;return null},[rl,ft,ve]),nl=x.useMemo(()=>{var ae;let O=null;for(let he=Ut.length-1;he>=0;he--)if(((ae=Ut[he].info)==null?void 0:ae.role)==="assistant"){O=Ut[he];break}if(!O)return[];const te=(O.parts||[]).filter(he=>he.type==="tool");return te.length===0?[]:!un&&te.every(ye=>{var Pe,Ie;return((Pe=ye.state)==null?void 0:Pe.status)==="completed"||((Ie=ye.state)==null?void 0:Ie.status)==="error"})?[]:te},[Ut,un]),lc=x.useMemo(()=>{var te;const O=[];for(const ae of Ut)if(((te=ae.info)==null?void 0:te.role)==="assistant"){const he=(ae.parts||[]).filter(ye=>ye.type==="tool");O.push(...he)}return O},[Ut]),Ni=x.useRef(0),[cc,to]=x.useState(!1),up=x.useCallback(O=>{if(O.preventDefault(),O.stopPropagation(),Ni.current++,Ni.current===1){const te=O.dataTransfer;let ae=!1;te&&te.items&&te.items.length>0&&(ae=Array.from(te.items).some(he=>he.kind==="file")),ae&&to(!0)}},[]),Bu=x.useCallback(O=>{O.preventDefault(),O.stopPropagation(),Ni.current=Math.max(0,Ni.current-1),Ni.current===0&&to(!1)},[]),dp=x.useCallback(O=>{O.preventDefault(),O.stopPropagation()},[]),fp=x.useCallback(O=>{O.preventDefault(),O.stopPropagation(),Ni.current=0,to(!1);const te=O.dataTransfer&&O.dataTransfer.files;if(!te||te.length===0)return;const ae=te[0],he=ae.name.toLowerCase();if(!he.endsWith(".yaml")&&!he.endsWith(".yml")){bt(e("import.invalid_file_type"));return}const ye=10*1024*1024;if(ae.size>ye){bt(e("import.file_too_large"));return}const Pe=new FileReader;Pe.onload=Ie=>{const jt=Ie&&Ie.target?Ie.target.result:null;if(typeof jt!="string"){bt(e("import.read_error"));return}Zs(jt)},Pe.onerror=()=>{bt(e("import.read_error"))},Pe.readAsText(ae)},[Zs,bt,e]);if(W)return n.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 dark:bg-gray-950",children:n.jsx("div",{className:"w-8 h-8 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})});if(!fe)return n.jsx(VB,{darkMode:t,onToggleTheme:()=>r(!t)});const al=ft==null?void 0:ft.title,Ta=typeof al=="string"?al.trim():"",ms=(($i=ft==null?void 0:ft.ui)==null?void 0:$i.hideThinking)??!1;return n.jsxs("div",{className:"h-[100dvh] sm:h-screen flex flex-col",onDragEnter:up,onDragLeave:Bu,onDragOver:dp,onDrop:fp,children:[cc&&n.jsx("div",{className:"fixed inset-0 z-50 bg-primary-500/20 dark:bg-primary-400/20 border-4 border-dashed border-primary-500 dark:border-primary-400 flex items-center justify-center pointer-events-none",children:n.jsx("div",{className:"bg-white dark:bg-gray-900 rounded-2xl px-8 py-6 shadow-xl",children:n.jsx("p",{className:"text-lg font-semibold text-primary-600 dark:text-primary-400",children:e("sidebar.drop_to_import")})})}),n.jsxs("header",{className:"flex items-center justify-between px-4 h-14 border-b border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-950 flex-shrink-0",children:[n.jsxs("div",{className:"flex items-center gap-4 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("img",{src:t?"/pave-logo-dark.png":"/pave-logo-light.png",alt:"PAVE",className:"h-8"}),n.jsx("h1",{className:"sr-only",children:"PAVE"}),Fe&&n.jsxs("span",{className:"hidden sm:inline text-xs text-gray-400 dark:text-gray-500 select-none",title:e("app.version"),children:["v",Fe]})]}),Ge==="chat"&&ie&&n.jsx("span",{className:"sm:hidden min-w-0 truncate text-sm font-medium text-gray-600 dark:text-gray-300",title:ft&&ft.title||e("sidebar.untitled"),children:ft&&ft.title||e("sidebar.untitled")}),n.jsxs("nav",{className:"hidden sm:flex items-center gap-1 ml-4",children:[n.jsx("button",{onClick:()=>qe("chat"),className:`px-3 py-1.5 text-sm font-medium rounded-lg transition-colors ${Ge==="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")}),ls&&n.jsx("button",{onClick:()=>qe("agents"),className:`px-3 py-1.5 text-sm font-medium rounded-lg transition-colors ${Ge==="agents"?"bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400":"text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800"}`,children:e("app.agents_tab")}),n.jsx("button",{onClick:()=>qe("skills"),className:`px-3 py-1.5 text-sm font-medium rounded-lg transition-colors ${Ge==="skills"?"bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400":"text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800"}`,children:e("app.skills_tab")}),n.jsx("button",{onClick:()=>qe("settings"),className:`px-3 py-1.5 text-sm font-medium rounded-lg transition-colors ${Ge==="settings"?"bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400":"text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800"}`,children:e("app.settings_tab")})]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(VV,{onNavigateToAgent:O=>{ze(O),qe("agents")}}),Et&&n.jsx("button",{onClick:()=>it(O=>!O),className:`p-1.5 rounded-lg transition-colors ${Oe?"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":Oe,children:n.jsx("span",{className:"text-sm leading-none",children:"🦋"})}),n.jsx("button",{onClick:()=>d(!u),className:`p-1.5 rounded-lg transition-colors ${u?"bg-green-600 text-black":"text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800"}`,title:e(u?"app.hacker_mode_exit":"app.hacker_mode_enter"),"aria-label":e(u?"app.hacker_mode_exit":"app.hacker_mode_enter"),children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})})}),ie&&Ge==="chat"&&n.jsx("button",{onClick:A,className:`hidden lg:block p-1.5 rounded-lg transition-colors ${E?"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:Z?"Cmd+J":"Ctrl+J"}),"aria-label":e("app.toggle_right_pane",{shortcut:Z?"Cmd+J":"Ctrl+J"}),"aria-pressed":E,children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17V7m0 10a2 2 0 01-2 2H5a2 2 0 01-2-2V7a2 2 0 012-2h2a2 2 0 012 2m0 10a2 2 0 002 2h2a2 2 0 002-2M9 7a2 2 0 012-2h2a2 2 0 012 2m0 10V7m0 10a2 2 0 002 2h2a2 2 0 002-2V7a2 2 0 00-2-2h-2a2 2 0 00-2 2"})})}),n.jsx(OI,{darkMode:t,onToggle:()=>r(!t)}),fe&&n.jsx(GB,{user:fe,onLogout:De,onSkillManagement:()=>qe("skills"),onAgentManagement:ls?()=>qe("agents"):void 0,onPricingSettings:()=>mt(!0),onDlpSettings:()=>$e(!0),onSettings:()=>qe("settings"),onBoard:Ql?()=>qe("board"):void 0})]})]}),Ge==="skills"?n.jsx("main",{className:"flex-1 overflow-hidden min-h-0",children:n.jsx(eW,{onBack:()=>qe("chat")})}):Ge==="agents"?n.jsx("main",{className:"flex-1 overflow-hidden min-h-0",children:n.jsx(LW,{onBack:()=>qe("chat"),onSelectAgent:O=>{Ce(O)},initialAgentName:He,onInitialAgentConsumed:()=>ze(null),hackerMode:u,matrixMode:f,darkMode:t,onToggleMatrix:()=>p(O=>!O),terminalWidth:k,onTerminalWidthChange:_,terminalMinWidth:wv,terminalMaxWidth:Sv})}):Ge==="board"?n.jsx("main",{className:"flex-1 overflow-hidden min-h-0",children:n.jsx(zW,{onBack:()=>qe("chat")})}):Ge==="settings"?n.jsx("main",{className:"flex-1 overflow-hidden min-h-0",children:n.jsx(AV,{onBack:()=>qe("chat"),onOpenDlpSettings:()=>$e(!0),onOpenPricingSettings:()=>mt(!0),activeSessionId:ie,mobileFrameless:h,onMobileFramelessChange:m})}):n.jsxs("main",{className:"flex-1 flex overflow-hidden min-w-0",children:[n.jsx(YI,{sessions:Tu,activeSessionId:ie,busySessions:la,onSelectSession:O=>{qn(O),window.innerWidth<768&&Le(!1)},onNewChat:Xo,onDeleteSession:ps,onDeleteAllSessions:ac,onRenameSession:Ru,onRegenerateTitle:Qo,onPinSession:Iu,onArchiveSession:Lu,onExportSession:Zo,onSendToSession:Au,onImportSession:Zs,onImportError:O=>bt(O),showArchived:ct,onToggleShowArchived:Jo,isOpen:ue,onClose:()=>Le(!1),onToggle:()=>Le(O=>!O),hasMoreSessions:ht,onLoadMoreSessions:sp,showOtherApps:an,onToggleShowOtherApps:Pu,hasMoreOtherApps:ap,onLoadMoreOtherApps:ip,otherAppsCount:Go.length,search:Bs,onSearchChange:oc,loadedCount:ve.length,totalCount:Rn,sidebarWidth:w,onSidebarWidthChange:N}),n.jsx("div",{className:"flex-1 flex flex-col bg-white dark:bg-gray-950 min-w-0",children:ie?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-y-1 px-3 py-1.5 border-b border-gray-100 dark:border-gray-800/50 flex-shrink-0",children:[n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[n.jsx(j$,{sessionModel:ne.has(ie)?"epm/privacy":dr[ie]||null,activeModel:rt,registryEntries:Ot,onModelChange:op,disabled:un||ne.has(ie),lockedReason:ne.has(ie)?"Private mode active — model locked to epm/privacy. Click the lock to exit.":null},ie),Ta?n.jsx("span",{className:"hidden sm:inline text-sm text-gray-500 dark:text-gray-400 truncate min-w-0 max-w-[150px]",title:Ta,children:Ta}):null,n.jsx("button",{onClick:()=>Hs(!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:Ca,children:n.jsx(PA,{className:"w-4 h-4"})}),n.jsx(R$,{sessionId:ie,disabledSkills:ft?ft.disabledSkills:[],onToggle:Js,onResetToDefaults:lp,t:e,disabled:Ca}),n.jsx("button",{onClick:()=>Wl(!0),className:`p-1.5 rounded-lg transition-colors ${Yf?"bg-amber-500/10 text-amber-600 dark:text-amber-400":"text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800"}`,title:e("chat.idle_injection_title"),"aria-label":e("chat.idle_injection_title"),children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})})}),lt&&n.jsx("div",{className:"hidden sm:flex items-center rounded-lg bg-gray-100 dark:bg-gray-800 p-0.5",title:e("chat.moe_tooltip"),children:[{val:null,label:"Auto"},{val:8,label:"Quality"},{val:6,label:"Balanced"},{val:4,label:"Fast"}].map(O=>{const te=Su===null&&Nu&&!qo.current.has(ie)&&Nu.moe_topk===O.val,ae=Su===O.val;return n.jsx("button",{onClick:()=>{O.val===null?qo.current.delete(ie):qo.current.add(ie),ku(he=>({...he,[ie]:O.val})),Xa(ie,{moe_top_k:O.val}).catch(()=>{})},disabled:Ca,className:`px-1.5 py-0.5 text-[10px] font-medium rounded-md transition-colors ${ae?"bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 shadow-sm":te?"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)})}),n.jsx("div",{className:"hidden sm:flex items-center rounded-lg bg-gray-100 dark:bg-gray-800 p-0.5",title:e("chat.reasoning_tooltip"),children:[{val:"max",label:e("chat.reasoning_max")},{val:"high",label:e("chat.reasoning_high")},{val:"off",label:e("chat.reasoning_off")}].map(O=>n.jsx("button",{onClick:()=>{_u(te=>({...te,[ie]:O.val})),Xa(ie,{reasoning_effort:O.val}).catch(()=>{})},disabled:Ca,className:`px-1.5 py-0.5 text-[10px] font-medium rounded-md transition-colors ${Zf===O.val?"bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 shadow-sm":"text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300"}`,children:O.label},O.val))})]}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("button",{onClick:()=>Si({readOnly:Ca}),className:`p-1.5 rounded-lg transition-colors ${ms?"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(ms?"chat.show_thinking":"chat.hide_thinking"),"aria-label":e(ms?"chat.show_thinking":"chat.hide_thinking"),"aria-pressed":!ms,children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"})})}),Xl&&n.jsx("button",{onClick:async()=>{if(ie)try{await aM(ie),bt("Banner generation queued (~2 min)"),setTimeout(()=>bt(null),4e3)}catch(O){bt(`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:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})})}),Xl&&n.jsx("button",{onClick:j,className:`p-1.5 rounded-lg transition-colors ${C?"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:C?"Show banner":"Hide banner","aria-label":C?"Show banner":"Hide banner","aria-pressed":!C,children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:C?n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M3 3l18 18"}):n.jsxs(n.Fragment,{children:[n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]})})}),da?n.jsx("span",{className:`hidden md:inline text-[11px] truncate max-w-[260px] px-2 py-0.5 rounded ${da.stage==="error"?"text-red-600 dark:text-red-400 bg-red-500/10":da.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:da.label,children:da.label}):null,Ws&&n.jsx("button",{"data-testid":"whatsapp-toggle",onClick:()=>{if(!Na){alert(e("chat.whatsapp_no_chatid")||"Set PAVE_WHATSAPP_CHAT_ID in Settings first.");return}Ui(O=>!O)},disabled:!Na,className:`p-1.5 rounded-lg transition-colors ${Na?Vr?"bg-green-500/10 text-green-600 dark:text-green-400":"text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800":"text-gray-300 dark:text-gray-600 cursor-not-allowed"}`,title:Na?e(Vr?"chat.whatsapp_enabled":"chat.whatsapp_disabled"):e("chat.whatsapp_no_chatid")||"Set PAVE_WHATSAPP_CHAT_ID in Settings first.","aria-label":e(Vr?"chat.whatsapp_enabled":"chat.whatsapp_disabled"),"aria-pressed":Vr,children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})})}),n.jsx("button",{onClick:()=>ii(O=>!O),className:`p-1.5 rounded-lg transition-colors lg:hidden ${zi?"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":zi,"aria-haspopup":"dialog","aria-controls":"activities-panel-dialog",children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"})})}),n.jsx("button",{onClick:()=>Zo(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:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})})}),n.jsx("button",{onClick:()=>{Us(O=>!O),ql&&(ns(""),Un(0),Bi(0))},className:`p-1.5 rounded-lg transition-colors ${ql?"bg-primary-500/10 text-primary-600 dark:text-primary-400":"text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800"}`,title:e("app.search_messages"),"aria-label":e("app.search_messages"),children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})})]})]}),ql&&n.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900 flex-shrink-0",children:[n.jsx("svg",{className:"w-4 h-4 text-gray-400 dark:text-gray-500 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),n.jsx("input",{type:"text",placeholder:e("app.search_placeholder"),value:Fi,onChange:O=>{ns(O.target.value),Un(0)},autoFocus:!0,className:"flex-1 bg-transparent text-sm text-gray-900 dark:text-gray-100 placeholder-gray-400 dark:placeholder-gray-500 outline-none"}),Fi&&n.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 flex-shrink-0 tabular-nums",children:ea>0?e("app.match_count",{current:as+1,total:ea}):e("app.no_matches")}),Fi&&ea>0&&n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:()=>Un(O=>(O-1+ea)%ea),className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 dark:text-gray-400 transition-colors",title:e("app.previous_match"),"aria-label":e("app.previous_match"),children:n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})})}),n.jsx("button",{onClick:()=>Un(O=>(O+1)%ea),className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 dark:text-gray-400 transition-colors",title:e("app.next_match"),"aria-label":e("app.next_match"),children:n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})})]}),n.jsx("button",{onClick:()=>{Us(!1),ns(""),Un(0),Bi(0)},className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 dark:text-gray-400 transition-colors",title:e("app.close_search"),"aria-label":e("app.close_search"),children:n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),!Po&&n.jsxs("div",{className:"px-4 py-2 bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-400 text-sm border-b border-amber-200 dark:border-amber-800 flex items-center gap-2",children:[n.jsx("svg",{className:"w-4 h-4 flex-shrink-0 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),n.jsx("span",{children:e("app.reconnecting")})]}),Tn&&n.jsxs("div",{className:"px-4 py-2 bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 text-sm border-b border-red-200 dark:border-red-800 flex items-center justify-between",children:[n.jsx("span",{children:Tn}),n.jsx("button",{onClick:()=>bt(null),className:"ml-2 text-red-400 hover:text-red-600","aria-label":e("app.dismiss_error"),title:e("app.dismiss_error"),children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),zo&&n.jsxs("div",{className:`px-4 py-2 text-sm border-b flex items-center gap-2 ${zo.type==="warning"?"bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-400 border-amber-200 dark:border-amber-800":zo.type==="success"?"bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-400 border-green-200 dark:border-green-800":"bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-400 border-blue-200 dark:border-blue-800"}`,children:[n.jsx("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),n.jsx("span",{children:zo.text})]}),Pn&&n.jsx("div",{className:"px-4 py-3 bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-400 text-sm border-b border-blue-200 dark:border-blue-800",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("span",{className:"font-semibold",children:e("auth.device_code_title")}),n.jsxs("div",{className:"mt-1",children:[n.jsx("a",{href:Pn.verification_uri,target:"_blank",rel:"noopener noreferrer",className:"underline font-medium",children:Pn.verification_uri})," ","— ",n.jsx("span",{className:"font-mono font-bold text-base select-all",children:Pn.user_code})]}),n.jsx("div",{className:"mt-1 text-xs opacity-70",children:e("auth.device_code_waiting")})]}),n.jsx("button",{onClick:()=>Ua(null),className:"ml-2 text-blue-400 hover:text-blue-600 flex-shrink-0","aria-label":"Dismiss",title:"Dismiss",children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})}),_t&&n.jsxs("div",{className:"px-4 py-2 bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-400 text-sm border-b border-amber-200 dark:border-amber-800 flex items-center justify-between",children:[n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx("svg",{className:"w-4 h-4 flex-shrink-0 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Server busy (429) — retry ",_t.attempt,"/",_t.maxRetries,_t.maxDurationMs>0&&_t.elapsedMs>0&&n.jsxs(n.Fragment,{children:[" (",Math.round(_t.elapsedMs/1e3),"s / ",Math.round(_t.maxDurationMs/6e4),"m)"]})," ","— next in ",Math.round(_t.delayMs/1e3),"s. Click Stop to cancel."]}),n.jsx("button",{onClick:()=>{qt(null),Gt.current&&(clearTimeout(Gt.current),Gt.current=null)},className:"ml-2 text-amber-400 hover:text-amber-600","aria-label":"Dismiss",title:"Dismiss",children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),fn&&n.jsxs("div",{className:"px-4 py-2 bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-400 text-sm border-b border-amber-200 dark:border-amber-800 flex items-center justify-between",children:[n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01M5 19h14a2 2 0 001.84-2.75L13.74 4a2 2 0 00-3.48 0L3.16 16.25A2 2 0 005 19z"})}),"Model fallback: ",fn.fallbackModel," (local model unavailable)"]}),n.jsx("button",{onClick:()=>{Wr(null),Zr.current&&(clearTimeout(Zr.current),Zr.current=null)},className:"ml-2 text-amber-400 hover:text-amber-600","aria-label":"Dismiss",title:"Dismiss",children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),n.jsx(yB,{ref:kt,messages:Ut,unloadedCompactedCount:Tt,onExpandCompactedHistory:ie?()=>nc(ie):void 0,hasOlderMessages:rn,loadingOlderMessages:oa,onLoadOlderMessages:ie?()=>Qs(ie):void 0,streamingParts:ai[ie]||{},streamingProgress:kr,isBusy:un,compactingInfo:jn,compactionResult:Or,onSwitchToCompactedSession:O=>{Dt.current=O,Rt(O),vr(null)},onDismissCompactionResult:()=>vr(null),parentSessionID:ft&&ft.parentSessionID,compactionPinned:ft&&ft.compactionPinned,onUnpinCompaction:Mu,onViewParentSession:O=>{Dt.current=O,Rt(O),Re(function(te){return te.map(function(ae){return ae.id===O?{...ae,_readOnly:!0}:ae})})},user:fe,searchQuery:Fi,activeMatchIndex:as,onTotalMatchesChange:Bi,onRetry:Ca?void 0:Fu,onEditAndResend:Ca?void 0:cp,onCancelQueued:Ca?void 0:rc,hackerMode:u,mobileFrameless:h,hideThinking:ms,sessionID:ie,banners:(Xl?qa[ie]:null)||[],bannerHidden:C,onToggleBanner:j,privateMessageIds:H,questionIdMap:ge}),(ni[ie]||[]).length>0&&n.jsx(tG,{items:ni[ie]||[],sessionId:ie,isReadOnly:Ca,onReorder:function(O){i3(ie,O).catch(function(te){bt("Failed to reorder: "+te.message)})},onCancelItem:function(O){E_(ie,O).catch(function(te){bt("Failed to cancel: "+te.message)})},onEditItem:function(O){if(!(O.status==="dispatching"||Ca)){E_(ie,O.id).catch(function(){});var te=O.displayContent||O.text||"";te&&D.current&&typeof D.current.setText=="function"&&D.current.setText(te)}},t:e}),Ca?n.jsx("div",{className:"px-4 py-3 border-t border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900 flex items-center justify-center gap-2",children:rl?n.jsxs(n.Fragment,{children:[n.jsx("svg",{className:"w-4 h-4 text-gray-400 dark:text-gray-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4"})}),hs?n.jsx("button",{onClick:()=>{Dt.current=hs,Rt(hs)},className:"text-sm text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-200 hover:underline transition-colors",children:e("chat.compacted_switch_to_new")||"Compacted — switch to new session"}):n.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:e("chat.compacted_switch_to_new")||"Compacted — switch to new session"})]}):n.jsxs(n.Fragment,{children:[n.jsx("svg",{className:"w-4 h-4 text-gray-400 dark:text-gray-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:ft&&ft.source==="archive"?n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8"}):n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})}),n.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:ft&&ft.source==="archive"?e("chat.viewing_archive"):e("chat.viewing_terminal")})]})}):n.jsx(WB,{ref:D,sessionId:ie,onSend:ja,onBuiltinCommand:tl,onAbort:eo,isBusy:un,queuedCount:np+(ni[ie]||[]).length})]}):n.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center",children:[n.jsx("img",{src:t?"/pave-logo-dark.png":"/pave-logo-light.png",alt:"PAVE",className:"h-16 mb-4"}),n.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100 mb-1",children:e("app.welcome_title")}),n.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mb-6",children:e("app.welcome_start")}),n.jsx("button",{onClick:Xo,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&&n.jsxs("aside",{ref:Hl,style:{width:k},className:`border-l hidden ${E?"lg:flex":"lg:hidden"} flex-col relative bg-gray-50 dark:bg-gray-900 ${u?t?"border-gray-800":"border-gray-300":"border-gray-200 dark:border-gray-800"}`,children:[n.jsx(kA,{width:k,min:wv,max:Sv,edge:"left",onCommit:_,getPaneEl:()=>Hl.current,ariaLabel:e("app.resize_terminal"),className:u?t?"bg-gray-800 hover:bg-gray-700 active:bg-gray-600":"bg-gray-300 hover:bg-gray-400 active:bg-gray-500":"bg-gray-200 hover:bg-gray-300 active:bg-gray-400 dark:bg-gray-800 dark:hover:bg-gray-700 dark:active:bg-gray-600"}),!zi&&ec()]}),zi&&ie&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"fixed inset-0 top-14 bg-black/30 z-30 lg:hidden",onClick:()=>ii(!1)}),n.jsxs("div",{id:"activities-panel-dialog",className:"fixed top-14 right-0 bottom-0 w-80 max-w-[85vw] bg-white dark:bg-gray-900 border-l border-gray-200 dark:border-gray-800 z-40 lg:hidden flex flex-col shadow-xl",role:"dialog","aria-modal":"true","aria-labelledby":"activities-panel-heading",tabIndex:-1,onKeyDown:O=>{(O.key==="Escape"||O.key==="Esc")&&(O.stopPropagation(),ii(!1))},ref:is,children:[n.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-800 flex-shrink-0",children:[n.jsx("h2",{id:"activities-panel-heading",className:"text-sm font-semibold text-gray-700 dark:text-gray-200",children:e("app.activities_panel")}),n.jsx("button",{onClick:()=>ii(!1),className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 dark:text-gray-400 transition-colors","aria-label":e("app.close_activities"),children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),ec()]})]})]}),gt&&n.jsx(LV,{onClose:()=>mt(!1)}),wt&&n.jsx(BV,{onClose:()=>$e(!1)}),Et&&n.jsx(TG,{open:Oe,onClose:()=>it(!1),activeSessionId:ie,activeSessionTitle:Ta}),n.jsx("div",{className:"fixed bottom-4 right-4 z-50 flex flex-col gap-3",children:n.jsx(qV,{requests:me,onDismiss:gs})}),n.jsx($V,{open:Ye,onClose:()=>$(!1),upgradeUrl:ce}),n.jsx(dM,{open:ic!==null,onClose:()=>sc(null),senderSessionID:ic}),n.jsx(ZV,{isOpen:Kf,onClose:()=>Hs(!1),sessionId:ie,currentDirectory:(ft==null?void 0:ft.directory)||"",homeDir:$l,onDirectoryChange:Du}),n.jsx(eG,{isOpen:Bo,onClose:()=>Wl(!1),sessionId:ie}),n.jsx(KV,{isOpen:ee,onClose:()=>{V(!1),setTimeout(()=>{var O;return(O=D.current)==null?void 0:O.focus()},0)},onSelectSession:O=>{qn(O)},onNewChat:()=>{typeof F.current=="function"&&F.current()},activeSessionId:ie,sessions:ve,busySessions:la}),n.jsx("div",{"aria-live":"polite","aria-atomic":"true",className:"sr-only",children:T})]})}const UG=LI();TI.createRoot(document.getElementById("root")).render(n.jsx(Ft.StrictMode,{children:n.jsx(MI,{initialLocale:UG,children:n.jsx(FI,{children:n.jsx(zG,{})})})}));export{W4 as _,jo as g,f$ as p};