@setupsworks/office 0.0.0-stage → 0.7.4

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 (122) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +111 -2
  3. package/bin/setups-works-office.mjs +50 -0
  4. package/dist/assets/CanvasPool-D8o5qooo.js +1 -0
  5. package/dist/assets/CanvasRenderer-6iBTvAyb.js +1 -0
  6. package/dist/assets/RenderTargetSystem-R9NN3Lf_.js +184 -0
  7. package/dist/assets/WebGLRenderer-BceHugHE.js +156 -0
  8. package/dist/assets/WebGPURenderer-B-kl5Onz.js +75 -0
  9. package/dist/assets/browserAll-CXCccwgI.js +14 -0
  10. package/dist/assets/canvasUtils-Cbq_vt2i.js +1 -0
  11. package/dist/assets/getTexelRangeRects-DY8vmJhl.js +195 -0
  12. package/dist/assets/index-ByCDDgCj.js +337 -0
  13. package/dist/assets/index-CmC5xWQz.css +1 -0
  14. package/dist/assets/inter-cyrillic-400-normal-HOLc17fK.woff +0 -0
  15. package/dist/assets/inter-cyrillic-400-normal-obahsSVq.woff2 +0 -0
  16. package/dist/assets/inter-cyrillic-500-normal-BasfLYem.woff2 +0 -0
  17. package/dist/assets/inter-cyrillic-500-normal-CxZf_p3X.woff +0 -0
  18. package/dist/assets/inter-cyrillic-600-normal-4D_pXhcN.woff +0 -0
  19. package/dist/assets/inter-cyrillic-600-normal-CWCymEST.woff2 +0 -0
  20. package/dist/assets/inter-cyrillic-700-normal-CjBOestx.woff2 +0 -0
  21. package/dist/assets/inter-cyrillic-700-normal-DrXBdSj3.woff +0 -0
  22. package/dist/assets/inter-cyrillic-ext-400-normal-BQZuk6qB.woff2 +0 -0
  23. package/dist/assets/inter-cyrillic-ext-400-normal-DQukG94-.woff +0 -0
  24. package/dist/assets/inter-cyrillic-ext-500-normal-B0yAr1jD.woff2 +0 -0
  25. package/dist/assets/inter-cyrillic-ext-500-normal-BmqWE9Dz.woff +0 -0
  26. package/dist/assets/inter-cyrillic-ext-600-normal-Bcila6Z-.woff +0 -0
  27. package/dist/assets/inter-cyrillic-ext-600-normal-Dfes3d0z.woff2 +0 -0
  28. package/dist/assets/inter-cyrillic-ext-700-normal-BjwYoWNd.woff2 +0 -0
  29. package/dist/assets/inter-cyrillic-ext-700-normal-LO58E6JB.woff +0 -0
  30. package/dist/assets/inter-greek-400-normal-B4URO6DV.woff2 +0 -0
  31. package/dist/assets/inter-greek-400-normal-q2sYcFCs.woff +0 -0
  32. package/dist/assets/inter-greek-500-normal-BIZE56-Y.woff2 +0 -0
  33. package/dist/assets/inter-greek-500-normal-Xzm54t5V.woff +0 -0
  34. package/dist/assets/inter-greek-600-normal-BZpKdvQh.woff +0 -0
  35. package/dist/assets/inter-greek-600-normal-plRanbMR.woff2 +0 -0
  36. package/dist/assets/inter-greek-700-normal-BUv2fZ6O.woff +0 -0
  37. package/dist/assets/inter-greek-700-normal-C3JjAnD8.woff2 +0 -0
  38. package/dist/assets/inter-greek-ext-400-normal-DGGRlc-M.woff2 +0 -0
  39. package/dist/assets/inter-greek-ext-400-normal-KugGGMne.woff +0 -0
  40. package/dist/assets/inter-greek-ext-500-normal-2j5mBUwD.woff +0 -0
  41. package/dist/assets/inter-greek-ext-500-normal-C4iEst2y.woff2 +0 -0
  42. package/dist/assets/inter-greek-ext-600-normal-B8X0CLgF.woff +0 -0
  43. package/dist/assets/inter-greek-ext-600-normal-DRtmH8MT.woff2 +0 -0
  44. package/dist/assets/inter-greek-ext-700-normal-BoQ6DsYi.woff +0 -0
  45. package/dist/assets/inter-greek-ext-700-normal-qfdV9bQt.woff2 +0 -0
  46. package/dist/assets/inter-latin-400-normal-C38fXH4l.woff2 +0 -0
  47. package/dist/assets/inter-latin-400-normal-CyCys3Eg.woff +0 -0
  48. package/dist/assets/inter-latin-500-normal-BL9OpVg8.woff +0 -0
  49. package/dist/assets/inter-latin-500-normal-Cerq10X2.woff2 +0 -0
  50. package/dist/assets/inter-latin-600-normal-CiBQ2DWP.woff +0 -0
  51. package/dist/assets/inter-latin-600-normal-LgqL8muc.woff2 +0 -0
  52. package/dist/assets/inter-latin-700-normal-BLAVimhd.woff +0 -0
  53. package/dist/assets/inter-latin-700-normal-Yt3aPRUw.woff2 +0 -0
  54. package/dist/assets/inter-latin-ext-400-normal-77YHD8bZ.woff +0 -0
  55. package/dist/assets/inter-latin-ext-400-normal-C1nco2VV.woff2 +0 -0
  56. package/dist/assets/inter-latin-ext-500-normal-BxGbmqWO.woff +0 -0
  57. package/dist/assets/inter-latin-ext-500-normal-CV4jyFjo.woff2 +0 -0
  58. package/dist/assets/inter-latin-ext-600-normal-CIVaiw4L.woff +0 -0
  59. package/dist/assets/inter-latin-ext-600-normal-D2bJ5OIk.woff2 +0 -0
  60. package/dist/assets/inter-latin-ext-700-normal-Ca8adRJv.woff2 +0 -0
  61. package/dist/assets/inter-latin-ext-700-normal-TidjK2hL.woff +0 -0
  62. package/dist/assets/inter-vietnamese-400-normal-Bbgyi5SW.woff +0 -0
  63. package/dist/assets/inter-vietnamese-400-normal-DMkecbls.woff2 +0 -0
  64. package/dist/assets/inter-vietnamese-500-normal-DOriooB6.woff2 +0 -0
  65. package/dist/assets/inter-vietnamese-500-normal-mJboJaSs.woff +0 -0
  66. package/dist/assets/inter-vietnamese-600-normal-BuLX-rYi.woff +0 -0
  67. package/dist/assets/inter-vietnamese-600-normal-Cc8MFFhd.woff2 +0 -0
  68. package/dist/assets/inter-vietnamese-700-normal-BZaoP0fm.woff +0 -0
  69. package/dist/assets/inter-vietnamese-700-normal-DlLaEgI2.woff2 +0 -0
  70. package/dist/assets/jetbrains-mono-cyrillic-400-normal-BEIGL1Tu.woff2 +0 -0
  71. package/dist/assets/jetbrains-mono-cyrillic-400-normal-ugxPyKxw.woff +0 -0
  72. package/dist/assets/jetbrains-mono-cyrillic-500-normal-DJqRU3vO.woff +0 -0
  73. package/dist/assets/jetbrains-mono-cyrillic-500-normal-DmUKJPL_.woff2 +0 -0
  74. package/dist/assets/jetbrains-mono-cyrillic-700-normal-BWTpRfYl.woff2 +0 -0
  75. package/dist/assets/jetbrains-mono-cyrillic-700-normal-CEoEElIJ.woff +0 -0
  76. package/dist/assets/jetbrains-mono-greek-400-normal-B9oWc5Lo.woff +0 -0
  77. package/dist/assets/jetbrains-mono-greek-400-normal-C190GLew.woff2 +0 -0
  78. package/dist/assets/jetbrains-mono-greek-500-normal-D7SFKleX.woff +0 -0
  79. package/dist/assets/jetbrains-mono-greek-500-normal-JpySY46c.woff2 +0 -0
  80. package/dist/assets/jetbrains-mono-greek-700-normal-C6CZE3T8.woff2 +0 -0
  81. package/dist/assets/jetbrains-mono-greek-700-normal-DEigVDxa.woff +0 -0
  82. package/dist/assets/jetbrains-mono-latin-400-normal-6-qcROiO.woff +0 -0
  83. package/dist/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
  84. package/dist/assets/jetbrains-mono-latin-500-normal-BWZEU5yA.woff2 +0 -0
  85. package/dist/assets/jetbrains-mono-latin-500-normal-CJOVTJB7.woff +0 -0
  86. package/dist/assets/jetbrains-mono-latin-700-normal-BYuf6tUa.woff2 +0 -0
  87. package/dist/assets/jetbrains-mono-latin-700-normal-D3wTyLJW.woff +0 -0
  88. package/dist/assets/jetbrains-mono-latin-ext-400-normal-Bc8Ftmh3.woff2 +0 -0
  89. package/dist/assets/jetbrains-mono-latin-ext-400-normal-fXTG6kC5.woff +0 -0
  90. package/dist/assets/jetbrains-mono-latin-ext-500-normal-Cut-4mMH.woff2 +0 -0
  91. package/dist/assets/jetbrains-mono-latin-ext-500-normal-ckzbgY84.woff +0 -0
  92. package/dist/assets/jetbrains-mono-latin-ext-700-normal-CZipNAKV.woff2 +0 -0
  93. package/dist/assets/jetbrains-mono-latin-ext-700-normal-CxPITLHs.woff +0 -0
  94. package/dist/assets/jetbrains-mono-vietnamese-400-normal-CqNFfHCs.woff +0 -0
  95. package/dist/assets/jetbrains-mono-vietnamese-500-normal-DNRqzVM1.woff +0 -0
  96. package/dist/assets/jetbrains-mono-vietnamese-700-normal-BDLVIk2r.woff +0 -0
  97. package/dist/assets/pixelify-sans-cyrillic-400-normal-DfOZNMlW.woff +0 -0
  98. package/dist/assets/pixelify-sans-cyrillic-600-normal-B3EuUOZG.woff +0 -0
  99. package/dist/assets/pixelify-sans-cyrillic-700-normal-BrZTw8tu.woff +0 -0
  100. package/dist/assets/pixelify-sans-latin-400-normal-DLrIX9QE.woff2 +0 -0
  101. package/dist/assets/pixelify-sans-latin-400-normal-JapMNN6Z.woff +0 -0
  102. package/dist/assets/pixelify-sans-latin-600-normal-BNlgYbDL.woff +0 -0
  103. package/dist/assets/pixelify-sans-latin-600-normal-Dd_Dy7u5.woff2 +0 -0
  104. package/dist/assets/pixelify-sans-latin-700-normal-BctWAS0u.woff +0 -0
  105. package/dist/assets/pixelify-sans-latin-700-normal-D3Xxx3QE.woff2 +0 -0
  106. package/dist/assets/pixelify-sans-latin-ext-400-normal-BkfTUL4s.woff +0 -0
  107. package/dist/assets/pixelify-sans-latin-ext-400-normal-DdH6zlBQ.woff2 +0 -0
  108. package/dist/assets/pixelify-sans-latin-ext-600-normal-CDaIumwU.woff +0 -0
  109. package/dist/assets/pixelify-sans-latin-ext-600-normal-Dha6RiOG.woff2 +0 -0
  110. package/dist/assets/pixelify-sans-latin-ext-700-normal-BadXkHzZ.woff +0 -0
  111. package/dist/assets/pixelify-sans-latin-ext-700-normal-ClyJstAh.woff2 +0 -0
  112. package/dist/assets/vt323-latin-400-normal-Dqn9ZSPj.woff +0 -0
  113. package/dist/assets/vt323-latin-400-normal-wDgJuOC9.woff2 +0 -0
  114. package/dist/assets/vt323-latin-ext-400-normal-DqOq58ri.woff +0 -0
  115. package/dist/assets/vt323-latin-ext-400-normal-iUdYUaX4.woff2 +0 -0
  116. package/dist/assets/vt323-vietnamese-400-normal-D0VnvwZ9.woff2 +0 -0
  117. package/dist/assets/vt323-vietnamese-400-normal-D_5Q7Vcv.woff +0 -0
  118. package/dist/assets/webworkerAll-CkYM11AB.js +83 -0
  119. package/dist/index.html +14 -0
  120. package/dist-server/main.mjs +4068 -0
  121. package/package.json +88 -4
  122. package/scripts/fix-node-pty.mjs +17 -0
@@ -0,0 +1,337 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/browserAll-CXCccwgI.js","assets/webworkerAll-CkYM11AB.js","assets/canvasUtils-Cbq_vt2i.js","assets/CanvasPool-D8o5qooo.js","assets/WebGPURenderer-B-kl5Onz.js","assets/getTexelRangeRects-DY8vmJhl.js","assets/RenderTargetSystem-R9NN3Lf_.js","assets/WebGLRenderer-BceHugHE.js","assets/CanvasRenderer-6iBTvAyb.js"])))=>i.map(i=>d[i]);
2
+ var eC=Object.defineProperty;var tC=(t,e,s)=>e in t?eC(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var ge=(t,e,s)=>tC(t,typeof e!="symbol"?e+"":e,s);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const c of a.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&r(c)}).observe(document,{childList:!0,subtree:!0});function s(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(i){if(i.ep)return;i.ep=!0;const a=s(i);fetch(i.href,a)}})();function Ey(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ku={exports:{}},uo={},Eu={exports:{}},Be={};/**
3
+ * @license React
4
+ * react.production.min.js
5
+ *
6
+ * Copyright (c) Facebook, Inc. and its affiliates.
7
+ *
8
+ * This source code is licensed under the MIT license found in the
9
+ * LICENSE file in the root directory of this source tree.
10
+ */var u_;function sC(){if(u_)return Be;u_=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),c=Symbol.for("react.context"),o=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),u=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),d=Symbol.iterator;function g(B){return B===null||typeof B!="object"?null:(B=d&&B[d]||B["@@iterator"],typeof B=="function"?B:null)}var _={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,S={};function m(B,$,Z){this.props=B,this.context=$,this.refs=S,this.updater=Z||_}m.prototype.isReactComponent={},m.prototype.setState=function(B,$){if(typeof B!="object"&&typeof B!="function"&&B!=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,B,$,"setState")},m.prototype.forceUpdate=function(B){this.updater.enqueueForceUpdate(this,B,"forceUpdate")};function x(){}x.prototype=m.prototype;function v(B,$,Z){this.props=B,this.context=$,this.refs=S,this.updater=Z||_}var b=v.prototype=new x;b.constructor=v,k(b,m.prototype),b.isPureReactComponent=!0;var C=Array.isArray,E=Object.prototype.hasOwnProperty,P={current:null},T={key:!0,ref:!0,__self:!0,__source:!0};function A(B,$,Z){var oe,he={},ae=null,V=null;if($!=null)for(oe in $.ref!==void 0&&(V=$.ref),$.key!==void 0&&(ae=""+$.key),$)E.call($,oe)&&!T.hasOwnProperty(oe)&&(he[oe]=$[oe]);var N=arguments.length-2;if(N===1)he.children=Z;else if(1<N){for(var ne=Array(N),se=0;se<N;se++)ne[se]=arguments[se+2];he.children=ne}if(B&&B.defaultProps)for(oe in N=B.defaultProps,N)he[oe]===void 0&&(he[oe]=N[oe]);return{$$typeof:t,type:B,key:ae,ref:V,props:he,_owner:P.current}}function D(B,$){return{$$typeof:t,type:B.type,key:$,ref:B.ref,props:B.props,_owner:B._owner}}function I(B){return typeof B=="object"&&B!==null&&B.$$typeof===t}function O(B){var $={"=":"=0",":":"=2"};return"$"+B.replace(/[=:]/g,function(Z){return $[Z]})}var z=/\/+/g;function U(B,$){return typeof B=="object"&&B!==null&&B.key!=null?O(""+B.key):$.toString(36)}function K(B,$,Z,oe,he){var ae=typeof B;(ae==="undefined"||ae==="boolean")&&(B=null);var V=!1;if(B===null)V=!0;else switch(ae){case"string":case"number":V=!0;break;case"object":switch(B.$$typeof){case t:case e:V=!0}}if(V)return V=B,he=he(V),B=oe===""?"."+U(V,0):oe,C(he)?(Z="",B!=null&&(Z=B.replace(z,"$&/")+"/"),K(he,$,Z,"",function(se){return se})):he!=null&&(I(he)&&(he=D(he,Z+(!he.key||V&&V.key===he.key?"":(""+he.key).replace(z,"$&/")+"/")+B)),$.push(he)),1;if(V=0,oe=oe===""?".":oe+":",C(B))for(var N=0;N<B.length;N++){ae=B[N];var ne=oe+U(ae,N);V+=K(ae,$,Z,ne,he)}else if(ne=g(B),typeof ne=="function")for(B=ne.call(B),N=0;!(ae=B.next()).done;)ae=ae.value,ne=oe+U(ae,N++),V+=K(ae,$,Z,ne,he);else if(ae==="object")throw $=String(B),Error("Objects are not valid as a React child (found: "+($==="[object Object]"?"object with keys {"+Object.keys(B).join(", ")+"}":$)+"). If you meant to render a collection of children, use an array instead.");return V}function ie(B,$,Z){if(B==null)return B;var oe=[],he=0;return K(B,oe,"","",function(ae){return $.call(Z,ae,he++)}),oe}function Q(B){if(B._status===-1){var $=B._result;$=$(),$.then(function(Z){(B._status===0||B._status===-1)&&(B._status=1,B._result=Z)},function(Z){(B._status===0||B._status===-1)&&(B._status=2,B._result=Z)}),B._status===-1&&(B._status=0,B._result=$)}if(B._status===1)return B._result.default;throw B._result}var J={current:null},Y={transition:null},L={ReactCurrentDispatcher:J,ReactCurrentBatchConfig:Y,ReactCurrentOwner:P};function F(){throw Error("act(...) is not supported in production builds of React.")}return Be.Children={map:ie,forEach:function(B,$,Z){ie(B,function(){$.apply(this,arguments)},Z)},count:function(B){var $=0;return ie(B,function(){$++}),$},toArray:function(B){return ie(B,function($){return $})||[]},only:function(B){if(!I(B))throw Error("React.Children.only expected to receive a single React element child.");return B}},Be.Component=m,Be.Fragment=s,Be.Profiler=i,Be.PureComponent=v,Be.StrictMode=r,Be.Suspense=h,Be.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=L,Be.act=F,Be.cloneElement=function(B,$,Z){if(B==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+B+".");var oe=k({},B.props),he=B.key,ae=B.ref,V=B._owner;if($!=null){if($.ref!==void 0&&(ae=$.ref,V=P.current),$.key!==void 0&&(he=""+$.key),B.type&&B.type.defaultProps)var N=B.type.defaultProps;for(ne in $)E.call($,ne)&&!T.hasOwnProperty(ne)&&(oe[ne]=$[ne]===void 0&&N!==void 0?N[ne]:$[ne])}var ne=arguments.length-2;if(ne===1)oe.children=Z;else if(1<ne){N=Array(ne);for(var se=0;se<ne;se++)N[se]=arguments[se+2];oe.children=N}return{$$typeof:t,type:B.type,key:he,ref:ae,props:oe,_owner:V}},Be.createContext=function(B){return B={$$typeof:c,_currentValue:B,_currentValue2:B,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},B.Provider={$$typeof:a,_context:B},B.Consumer=B},Be.createElement=A,Be.createFactory=function(B){var $=A.bind(null,B);return $.type=B,$},Be.createRef=function(){return{current:null}},Be.forwardRef=function(B){return{$$typeof:o,render:B}},Be.isValidElement=I,Be.lazy=function(B){return{$$typeof:f,_payload:{_status:-1,_result:B},_init:Q}},Be.memo=function(B,$){return{$$typeof:u,type:B,compare:$===void 0?null:$}},Be.startTransition=function(B){var $=Y.transition;Y.transition={};try{B()}finally{Y.transition=$}},Be.unstable_act=F,Be.useCallback=function(B,$){return J.current.useCallback(B,$)},Be.useContext=function(B){return J.current.useContext(B)},Be.useDebugValue=function(){},Be.useDeferredValue=function(B){return J.current.useDeferredValue(B)},Be.useEffect=function(B,$){return J.current.useEffect(B,$)},Be.useId=function(){return J.current.useId()},Be.useImperativeHandle=function(B,$,Z){return J.current.useImperativeHandle(B,$,Z)},Be.useInsertionEffect=function(B,$){return J.current.useInsertionEffect(B,$)},Be.useLayoutEffect=function(B,$){return J.current.useLayoutEffect(B,$)},Be.useMemo=function(B,$){return J.current.useMemo(B,$)},Be.useReducer=function(B,$,Z){return J.current.useReducer(B,$,Z)},Be.useRef=function(B){return J.current.useRef(B)},Be.useState=function(B){return J.current.useState(B)},Be.useSyncExternalStore=function(B,$,Z){return J.current.useSyncExternalStore(B,$,Z)},Be.useTransition=function(){return J.current.useTransition()},Be.version="18.3.1",Be}var d_;function yf(){return d_||(d_=1,Eu.exports=sC()),Eu.exports}/**
11
+ * @license React
12
+ * react-jsx-runtime.production.min.js
13
+ *
14
+ * Copyright (c) Facebook, Inc. and its affiliates.
15
+ *
16
+ * This source code is licensed under the MIT license found in the
17
+ * LICENSE file in the root directory of this source tree.
18
+ */var f_;function rC(){if(f_)return uo;f_=1;var t=yf(),e=Symbol.for("react.element"),s=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function c(o,h,u){var f,d={},g=null,_=null;u!==void 0&&(g=""+u),h.key!==void 0&&(g=""+h.key),h.ref!==void 0&&(_=h.ref);for(f in h)r.call(h,f)&&!a.hasOwnProperty(f)&&(d[f]=h[f]);if(o&&o.defaultProps)for(f in h=o.defaultProps,h)d[f]===void 0&&(d[f]=h[f]);return{$$typeof:e,type:o,key:g,ref:_,props:d,_owner:i.current}}return uo.Fragment=s,uo.jsx=c,uo.jsxs=c,uo}var p_;function iC(){return p_||(p_=1,ku.exports=rC()),ku.exports}var y=iC(),re=yf();const ml=Ey(re);var gl={},Pu={exports:{}},Jt={},Mu={exports:{}},Au={};/**
19
+ * @license React
20
+ * scheduler.production.min.js
21
+ *
22
+ * Copyright (c) Facebook, Inc. and its affiliates.
23
+ *
24
+ * This source code is licensed under the MIT license found in the
25
+ * LICENSE file in the root directory of this source tree.
26
+ */var m_;function nC(){return m_||(m_=1,(function(t){function e(Y,L){var F=Y.length;Y.push(L);e:for(;0<F;){var B=F-1>>>1,$=Y[B];if(0<i($,L))Y[B]=L,Y[F]=$,F=B;else break e}}function s(Y){return Y.length===0?null:Y[0]}function r(Y){if(Y.length===0)return null;var L=Y[0],F=Y.pop();if(F!==L){Y[0]=F;e:for(var B=0,$=Y.length,Z=$>>>1;B<Z;){var oe=2*(B+1)-1,he=Y[oe],ae=oe+1,V=Y[ae];if(0>i(he,F))ae<$&&0>i(V,he)?(Y[B]=V,Y[ae]=F,B=ae):(Y[B]=he,Y[oe]=F,B=oe);else if(ae<$&&0>i(V,F))Y[B]=V,Y[ae]=F,B=ae;else break e}}return L}function i(Y,L){var F=Y.sortIndex-L.sortIndex;return F!==0?F:Y.id-L.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;t.unstable_now=function(){return a.now()}}else{var c=Date,o=c.now();t.unstable_now=function(){return c.now()-o}}var h=[],u=[],f=1,d=null,g=3,_=!1,k=!1,S=!1,m=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function b(Y){for(var L=s(u);L!==null;){if(L.callback===null)r(u);else if(L.startTime<=Y)r(u),L.sortIndex=L.expirationTime,e(h,L);else break;L=s(u)}}function C(Y){if(S=!1,b(Y),!k)if(s(h)!==null)k=!0,Q(E);else{var L=s(u);L!==null&&J(C,L.startTime-Y)}}function E(Y,L){k=!1,S&&(S=!1,x(A),A=-1),_=!0;var F=g;try{for(b(L),d=s(h);d!==null&&(!(d.expirationTime>L)||Y&&!O());){var B=d.callback;if(typeof B=="function"){d.callback=null,g=d.priorityLevel;var $=B(d.expirationTime<=L);L=t.unstable_now(),typeof $=="function"?d.callback=$:d===s(h)&&r(h),b(L)}else r(h);d=s(h)}if(d!==null)var Z=!0;else{var oe=s(u);oe!==null&&J(C,oe.startTime-L),Z=!1}return Z}finally{d=null,g=F,_=!1}}var P=!1,T=null,A=-1,D=5,I=-1;function O(){return!(t.unstable_now()-I<D)}function z(){if(T!==null){var Y=t.unstable_now();I=Y;var L=!0;try{L=T(!0,Y)}finally{L?U():(P=!1,T=null)}}else P=!1}var U;if(typeof v=="function")U=function(){v(z)};else if(typeof MessageChannel<"u"){var K=new MessageChannel,ie=K.port2;K.port1.onmessage=z,U=function(){ie.postMessage(null)}}else U=function(){m(z,0)};function Q(Y){T=Y,P||(P=!0,U())}function J(Y,L){A=m(function(){Y(t.unstable_now())},L)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(Y){Y.callback=null},t.unstable_continueExecution=function(){k||_||(k=!0,Q(E))},t.unstable_forceFrameRate=function(Y){0>Y||125<Y?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<Y?Math.floor(1e3/Y):5},t.unstable_getCurrentPriorityLevel=function(){return g},t.unstable_getFirstCallbackNode=function(){return s(h)},t.unstable_next=function(Y){switch(g){case 1:case 2:case 3:var L=3;break;default:L=g}var F=g;g=L;try{return Y()}finally{g=F}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(Y,L){switch(Y){case 1:case 2:case 3:case 4:case 5:break;default:Y=3}var F=g;g=Y;try{return L()}finally{g=F}},t.unstable_scheduleCallback=function(Y,L,F){var B=t.unstable_now();switch(typeof F=="object"&&F!==null?(F=F.delay,F=typeof F=="number"&&0<F?B+F:B):F=B,Y){case 1:var $=-1;break;case 2:$=250;break;case 5:$=1073741823;break;case 4:$=1e4;break;default:$=5e3}return $=F+$,Y={id:f++,callback:L,priorityLevel:Y,startTime:F,expirationTime:$,sortIndex:-1},F>B?(Y.sortIndex=F,e(u,Y),s(h)===null&&Y===s(u)&&(S?(x(A),A=-1):S=!0,J(C,F-B))):(Y.sortIndex=$,e(h,Y),k||_||(k=!0,Q(E))),Y},t.unstable_shouldYield=O,t.unstable_wrapCallback=function(Y){var L=g;return function(){var F=g;g=L;try{return Y.apply(this,arguments)}finally{g=F}}}})(Au)),Au}var g_;function oC(){return g_||(g_=1,Mu.exports=nC()),Mu.exports}/**
27
+ * @license React
28
+ * react-dom.production.min.js
29
+ *
30
+ * Copyright (c) Facebook, Inc. and its affiliates.
31
+ *
32
+ * This source code is licensed under the MIT license found in the
33
+ * LICENSE file in the root directory of this source tree.
34
+ */var __;function aC(){if(__)return Jt;__=1;var t=yf(),e=oC();function s(n){for(var l="https://reactjs.org/docs/error-decoder.html?invariant="+n,p=1;p<arguments.length;p++)l+="&args[]="+encodeURIComponent(arguments[p]);return"Minified React error #"+n+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var r=new Set,i={};function a(n,l){c(n,l),c(n+"Capture",l)}function c(n,l){for(i[n]=l,n=0;n<l.length;n++)r.add(l[n])}var o=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),h=Object.prototype.hasOwnProperty,u=/^[: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]*$/,f={},d={};function g(n){return h.call(d,n)?!0:h.call(f,n)?!1:u.test(n)?d[n]=!0:(f[n]=!0,!1)}function _(n,l,p,w){if(p!==null&&p.type===0)return!1;switch(typeof l){case"function":case"symbol":return!0;case"boolean":return w?!1:p!==null?!p.acceptsBooleans:(n=n.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-");default:return!1}}function k(n,l,p,w){if(l===null||typeof l>"u"||_(n,l,p,w))return!0;if(w)return!1;if(p!==null)switch(p.type){case 3:return!l;case 4:return l===!1;case 5:return isNaN(l);case 6:return isNaN(l)||1>l}return!1}function S(n,l,p,w,M,R,j){this.acceptsBooleans=l===2||l===3||l===4,this.attributeName=w,this.attributeNamespace=M,this.mustUseProperty=p,this.propertyName=n,this.type=l,this.sanitizeURL=R,this.removeEmptyString=j}var m={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){m[n]=new S(n,0,!1,n,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var l=n[0];m[l]=new S(l,1,!1,n[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(n){m[n]=new S(n,2,!1,n.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){m[n]=new S(n,2,!1,n,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(n){m[n]=new S(n,3,!1,n.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(n){m[n]=new S(n,3,!0,n,null,!1,!1)}),["capture","download"].forEach(function(n){m[n]=new S(n,4,!1,n,null,!1,!1)}),["cols","rows","size","span"].forEach(function(n){m[n]=new S(n,6,!1,n,null,!1,!1)}),["rowSpan","start"].forEach(function(n){m[n]=new S(n,5,!1,n.toLowerCase(),null,!1,!1)});var x=/[\-:]([a-z])/g;function v(n){return n[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(n){var l=n.replace(x,v);m[l]=new S(l,1,!1,n,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(n){var l=n.replace(x,v);m[l]=new S(l,1,!1,n,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(n){var l=n.replace(x,v);m[l]=new S(l,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(n){m[n]=new S(n,1,!1,n.toLowerCase(),null,!1,!1)}),m.xlinkHref=new S("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(n){m[n]=new S(n,1,!1,n.toLowerCase(),null,!0,!0)});function b(n,l,p,w){var M=m.hasOwnProperty(l)?m[l]:null;(M!==null?M.type!==0:w||!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(k(l,p,M,w)&&(p=null),w||M===null?g(l)&&(p===null?n.removeAttribute(l):n.setAttribute(l,""+p)):M.mustUseProperty?n[M.propertyName]=p===null?M.type===3?!1:"":p:(l=M.attributeName,w=M.attributeNamespace,p===null?n.removeAttribute(l):(M=M.type,p=M===3||M===4&&p===!0?"":""+p,w?n.setAttributeNS(w,l,p):n.setAttribute(l,p))))}var C=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,E=Symbol.for("react.element"),P=Symbol.for("react.portal"),T=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),I=Symbol.for("react.provider"),O=Symbol.for("react.context"),z=Symbol.for("react.forward_ref"),U=Symbol.for("react.suspense"),K=Symbol.for("react.suspense_list"),ie=Symbol.for("react.memo"),Q=Symbol.for("react.lazy"),J=Symbol.for("react.offscreen"),Y=Symbol.iterator;function L(n){return n===null||typeof n!="object"?null:(n=Y&&n[Y]||n["@@iterator"],typeof n=="function"?n:null)}var F=Object.assign,B;function $(n){if(B===void 0)try{throw Error()}catch(p){var l=p.stack.trim().match(/\n( *(at )?)/);B=l&&l[1]||""}return`
35
+ `+B+n}var Z=!1;function oe(n,l){if(!n||Z)return"";Z=!0;var p=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(l)if(l=function(){throw Error()},Object.defineProperty(l.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(l,[])}catch(te){var w=te}Reflect.construct(n,[],l)}else{try{l.call()}catch(te){w=te}n.call(l.prototype)}else{try{throw Error()}catch(te){w=te}n()}}catch(te){if(te&&w&&typeof te.stack=="string"){for(var M=te.stack.split(`
36
+ `),R=w.stack.split(`
37
+ `),j=M.length-1,W=R.length-1;1<=j&&0<=W&&M[j]!==R[W];)W--;for(;1<=j&&0<=W;j--,W--)if(M[j]!==R[W]){if(j!==1||W!==1)do if(j--,W--,0>W||M[j]!==R[W]){var G=`
38
+ `+M[j].replace(" at new "," at ");return n.displayName&&G.includes("<anonymous>")&&(G=G.replace("<anonymous>",n.displayName)),G}while(1<=j&&0<=W);break}}}finally{Z=!1,Error.prepareStackTrace=p}return(n=n?n.displayName||n.name:"")?$(n):""}function he(n){switch(n.tag){case 5:return $(n.type);case 16:return $("Lazy");case 13:return $("Suspense");case 19:return $("SuspenseList");case 0:case 2:case 15:return n=oe(n.type,!1),n;case 11:return n=oe(n.type.render,!1),n;case 1:return n=oe(n.type,!0),n;default:return""}}function ae(n){if(n==null)return null;if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case T:return"Fragment";case P:return"Portal";case D:return"Profiler";case A:return"StrictMode";case U:return"Suspense";case K:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case O:return(n.displayName||"Context")+".Consumer";case I:return(n._context.displayName||"Context")+".Provider";case z:var l=n.render;return n=n.displayName,n||(n=l.displayName||l.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case ie:return l=n.displayName||null,l!==null?l:ae(n.type)||"Memo";case Q:l=n._payload,n=n._init;try{return ae(n(l))}catch{}}return null}function V(n){var l=n.type;switch(n.tag){case 24:return"Cache";case 9:return(l.displayName||"Context")+".Consumer";case 10:return(l._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return n=l.render,n=n.displayName||n.name||"",l.displayName||(n!==""?"ForwardRef("+n+")":"ForwardRef");case 7:return"Fragment";case 5:return l;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ae(l);case 8:return l===A?"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 l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l}return null}function N(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function ne(n){var l=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function se(n){var l=ne(n)?"checked":"value",p=Object.getOwnPropertyDescriptor(n.constructor.prototype,l),w=""+n[l];if(!n.hasOwnProperty(l)&&typeof p<"u"&&typeof p.get=="function"&&typeof p.set=="function"){var M=p.get,R=p.set;return Object.defineProperty(n,l,{configurable:!0,get:function(){return M.call(this)},set:function(j){w=""+j,R.call(this,j)}}),Object.defineProperty(n,l,{enumerable:p.enumerable}),{getValue:function(){return w},setValue:function(j){w=""+j},stopTracking:function(){n._valueTracker=null,delete n[l]}}}}function pe(n){n._valueTracker||(n._valueTracker=se(n))}function fe(n){if(!n)return!1;var l=n._valueTracker;if(!l)return!0;var p=l.getValue(),w="";return n&&(w=ne(n)?n.checked?"true":"false":n.value),n=w,n!==p?(l.setValue(n),!0):!1}function Ae(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function Oe(n,l){var p=l.checked;return F({},l,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:p??n._wrapperState.initialChecked})}function $e(n,l){var p=l.defaultValue==null?"":l.defaultValue,w=l.checked!=null?l.checked:l.defaultChecked;p=N(l.value!=null?l.value:p),n._wrapperState={initialChecked:w,initialValue:p,controlled:l.type==="checkbox"||l.type==="radio"?l.checked!=null:l.value!=null}}function mt(n,l){l=l.checked,l!=null&&b(n,"checked",l,!1)}function Pe(n,l){mt(n,l);var p=N(l.value),w=l.type;if(p!=null)w==="number"?(p===0&&n.value===""||n.value!=p)&&(n.value=""+p):n.value!==""+p&&(n.value=""+p);else if(w==="submit"||w==="reset"){n.removeAttribute("value");return}l.hasOwnProperty("value")?gr(n,l.type,p):l.hasOwnProperty("defaultValue")&&gr(n,l.type,N(l.defaultValue)),l.checked==null&&l.defaultChecked!=null&&(n.defaultChecked=!!l.defaultChecked)}function Os(n,l,p){if(l.hasOwnProperty("value")||l.hasOwnProperty("defaultValue")){var w=l.type;if(!(w!=="submit"&&w!=="reset"||l.value!==void 0&&l.value!==null))return;l=""+n._wrapperState.initialValue,p||l===n.value||(n.value=l),n.defaultValue=l}p=n.name,p!==""&&(n.name=""),n.defaultChecked=!!n._wrapperState.initialChecked,p!==""&&(n.name=p)}function gr(n,l,p){(l!=="number"||Ae(n.ownerDocument)!==n)&&(p==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+p&&(n.defaultValue=""+p))}var Js=Array.isArray;function Fs(n,l,p,w){if(n=n.options,l){l={};for(var M=0;M<p.length;M++)l["$"+p[M]]=!0;for(p=0;p<n.length;p++)M=l.hasOwnProperty("$"+n[p].value),n[p].selected!==M&&(n[p].selected=M),M&&w&&(n[p].defaultSelected=!0)}else{for(p=""+N(p),l=null,M=0;M<n.length;M++){if(n[M].value===p){n[M].selected=!0,w&&(n[M].defaultSelected=!0);return}l!==null||n[M].disabled||(l=n[M])}l!==null&&(l.selected=!0)}}function _r(n,l){if(l.dangerouslySetInnerHTML!=null)throw Error(s(91));return F({},l,{value:void 0,defaultValue:void 0,children:""+n._wrapperState.initialValue})}function Ut(n,l){var p=l.value;if(p==null){if(p=l.children,l=l.defaultValue,p!=null){if(l!=null)throw Error(s(92));if(Js(p)){if(1<p.length)throw Error(s(93));p=p[0]}l=p}l==null&&(l=""),p=l}n._wrapperState={initialValue:N(p)}}function vr(n,l){var p=N(l.value),w=N(l.defaultValue);p!=null&&(p=""+p,p!==n.value&&(n.value=p),l.defaultValue==null&&n.defaultValue!==p&&(n.defaultValue=p)),w!=null&&(n.defaultValue=""+w)}function ss(n){var l=n.textContent;l===n._wrapperState.initialValue&&l!==""&&l!==null&&(n.value=l)}function xr(n){switch(n){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 Gr(n,l){return n==null||n==="http://www.w3.org/1999/xhtml"?xr(l):n==="http://www.w3.org/2000/svg"&&l==="foreignObject"?"http://www.w3.org/1999/xhtml":n}var rs,qr=(function(n){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(l,p,w,M){MSApp.execUnsafeLocalFunction(function(){return n(l,p,w,M)})}:n})(function(n,l){if(n.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in n)n.innerHTML=l;else{for(rs=rs||document.createElement("div"),rs.innerHTML="<svg>"+l.valueOf().toString()+"</svg>",l=rs.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;l.firstChild;)n.appendChild(l.firstChild)}});function qt(n,l){if(l){var p=n.firstChild;if(p&&p===n.lastChild&&p.nodeType===3){p.nodeValue=l;return}}n.textContent=l}var Cs={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},Ke=["Webkit","ms","Moz","O"];Object.keys(Cs).forEach(function(n){Ke.forEach(function(l){l=l+n.charAt(0).toUpperCase()+n.substring(1),Cs[l]=Cs[n]})});function aa(n,l,p){return l==null||typeof l=="boolean"||l===""?"":p||typeof l!="number"||l===0||Cs.hasOwnProperty(n)&&Cs[n]?(""+l).trim():l+"px"}function Pp(n,l){n=n.style;for(var p in l)if(l.hasOwnProperty(p)){var w=p.indexOf("--")===0,M=aa(p,l[p],w);p==="float"&&(p="cssFloat"),w?n.setProperty(p,M):n[p]=M}}var nw=F({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Nc(n,l){if(l){if(nw[n]&&(l.children!=null||l.dangerouslySetInnerHTML!=null))throw Error(s(137,n));if(l.dangerouslySetInnerHTML!=null){if(l.children!=null)throw Error(s(60));if(typeof l.dangerouslySetInnerHTML!="object"||!("__html"in l.dangerouslySetInnerHTML))throw Error(s(61))}if(l.style!=null&&typeof l.style!="object")throw Error(s(62))}}function Oc(n,l){if(n.indexOf("-")===-1)return typeof l.is=="string";switch(n){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 Fc=null;function $c(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var Hc=null,Li=null,Bi=null;function Mp(n){if(n=Xn(n)){if(typeof Hc!="function")throw Error(s(280));var l=n.stateNode;l&&(l=Ta(l),Hc(n.stateNode,n.type,l))}}function Ap(n){Li?Bi?Bi.push(n):Bi=[n]:Li=n}function Tp(){if(Li){var n=Li,l=Bi;if(Bi=Li=null,Mp(n),l)for(n=0;n<l.length;n++)Mp(l[n])}}function Rp(n,l){return n(l)}function Dp(){}var Uc=!1;function Lp(n,l,p){if(Uc)return n(l,p);Uc=!0;try{return Rp(n,l,p)}finally{Uc=!1,(Li!==null||Bi!==null)&&(Dp(),Tp())}}function An(n,l){var p=n.stateNode;if(p===null)return null;var w=Ta(p);if(w===null)return null;p=w[l];e:switch(l){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(w=!w.disabled)||(n=n.type,w=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!w;break e;default:n=!1}if(n)return null;if(p&&typeof p!="function")throw Error(s(231,l,typeof p));return p}var Wc=!1;if(o)try{var Tn={};Object.defineProperty(Tn,"passive",{get:function(){Wc=!0}}),window.addEventListener("test",Tn,Tn),window.removeEventListener("test",Tn,Tn)}catch{Wc=!1}function ow(n,l,p,w,M,R,j,W,G){var te=Array.prototype.slice.call(arguments,3);try{l.apply(p,te)}catch(ce){this.onError(ce)}}var Rn=!1,la=null,ca=!1,zc=null,aw={onError:function(n){Rn=!0,la=n}};function lw(n,l,p,w,M,R,j,W,G){Rn=!1,la=null,ow.apply(aw,arguments)}function cw(n,l,p,w,M,R,j,W,G){if(lw.apply(this,arguments),Rn){if(Rn){var te=la;Rn=!1,la=null}else throw Error(s(198));ca||(ca=!0,zc=te)}}function Kr(n){var l=n,p=n;if(n.alternate)for(;l.return;)l=l.return;else{n=l;do l=n,(l.flags&4098)!==0&&(p=l.return),n=l.return;while(n)}return l.tag===3?p:null}function Bp(n){if(n.tag===13){var l=n.memoizedState;if(l===null&&(n=n.alternate,n!==null&&(l=n.memoizedState)),l!==null)return l.dehydrated}return null}function jp(n){if(Kr(n)!==n)throw Error(s(188))}function hw(n){var l=n.alternate;if(!l){if(l=Kr(n),l===null)throw Error(s(188));return l!==n?null:n}for(var p=n,w=l;;){var M=p.return;if(M===null)break;var R=M.alternate;if(R===null){if(w=M.return,w!==null){p=w;continue}break}if(M.child===R.child){for(R=M.child;R;){if(R===p)return jp(M),n;if(R===w)return jp(M),l;R=R.sibling}throw Error(s(188))}if(p.return!==w.return)p=M,w=R;else{for(var j=!1,W=M.child;W;){if(W===p){j=!0,p=M,w=R;break}if(W===w){j=!0,w=M,p=R;break}W=W.sibling}if(!j){for(W=R.child;W;){if(W===p){j=!0,p=R,w=M;break}if(W===w){j=!0,w=R,p=M;break}W=W.sibling}if(!j)throw Error(s(189))}}if(p.alternate!==w)throw Error(s(190))}if(p.tag!==3)throw Error(s(188));return p.stateNode.current===p?n:l}function Ip(n){return n=hw(n),n!==null?Np(n):null}function Np(n){if(n.tag===5||n.tag===6)return n;for(n=n.child;n!==null;){var l=Np(n);if(l!==null)return l;n=n.sibling}return null}var Op=e.unstable_scheduleCallback,Fp=e.unstable_cancelCallback,uw=e.unstable_shouldYield,dw=e.unstable_requestPaint,at=e.unstable_now,fw=e.unstable_getCurrentPriorityLevel,Vc=e.unstable_ImmediatePriority,$p=e.unstable_UserBlockingPriority,ha=e.unstable_NormalPriority,pw=e.unstable_LowPriority,Hp=e.unstable_IdlePriority,ua=null,$s=null;function mw(n){if($s&&typeof $s.onCommitFiberRoot=="function")try{$s.onCommitFiberRoot(ua,n,void 0,(n.current.flags&128)===128)}catch{}}var ks=Math.clz32?Math.clz32:vw,gw=Math.log,_w=Math.LN2;function vw(n){return n>>>=0,n===0?32:31-(gw(n)/_w|0)|0}var da=64,fa=4194304;function Dn(n){switch(n&-n){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 n&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return n&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return n}}function pa(n,l){var p=n.pendingLanes;if(p===0)return 0;var w=0,M=n.suspendedLanes,R=n.pingedLanes,j=p&268435455;if(j!==0){var W=j&~M;W!==0?w=Dn(W):(R&=j,R!==0&&(w=Dn(R)))}else j=p&~M,j!==0?w=Dn(j):R!==0&&(w=Dn(R));if(w===0)return 0;if(l!==0&&l!==w&&(l&M)===0&&(M=w&-w,R=l&-l,M>=R||M===16&&(R&4194240)!==0))return l;if((w&4)!==0&&(w|=p&16),l=n.entangledLanes,l!==0)for(n=n.entanglements,l&=w;0<l;)p=31-ks(l),M=1<<p,w|=n[p],l&=~M;return w}function xw(n,l){switch(n){case 1:case 2:case 4:return l+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 l+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 yw(n,l){for(var p=n.suspendedLanes,w=n.pingedLanes,M=n.expirationTimes,R=n.pendingLanes;0<R;){var j=31-ks(R),W=1<<j,G=M[j];G===-1?((W&p)===0||(W&w)!==0)&&(M[j]=xw(W,l)):G<=l&&(n.expiredLanes|=W),R&=~W}}function Gc(n){return n=n.pendingLanes&-1073741825,n!==0?n:n&1073741824?1073741824:0}function Up(){var n=da;return da<<=1,(da&4194240)===0&&(da=64),n}function qc(n){for(var l=[],p=0;31>p;p++)l.push(n);return l}function Ln(n,l,p){n.pendingLanes|=l,l!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,l=31-ks(l),n[l]=p}function bw(n,l){var p=n.pendingLanes&~l;n.pendingLanes=l,n.suspendedLanes=0,n.pingedLanes=0,n.expiredLanes&=l,n.mutableReadLanes&=l,n.entangledLanes&=l,l=n.entanglements;var w=n.eventTimes;for(n=n.expirationTimes;0<p;){var M=31-ks(p),R=1<<M;l[M]=0,w[M]=-1,n[M]=-1,p&=~R}}function Kc(n,l){var p=n.entangledLanes|=l;for(n=n.entanglements;p;){var w=31-ks(p),M=1<<w;M&l|n[w]&l&&(n[w]|=l),p&=~M}}var ze=0;function Wp(n){return n&=-n,1<n?4<n?(n&268435455)!==0?16:536870912:4:1}var zp,Yc,Vp,Gp,qp,Xc=!1,ma=[],yr=null,br=null,wr=null,Bn=new Map,jn=new Map,Sr=[],ww="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 Kp(n,l){switch(n){case"focusin":case"focusout":yr=null;break;case"dragenter":case"dragleave":br=null;break;case"mouseover":case"mouseout":wr=null;break;case"pointerover":case"pointerout":Bn.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":jn.delete(l.pointerId)}}function In(n,l,p,w,M,R){return n===null||n.nativeEvent!==R?(n={blockedOn:l,domEventName:p,eventSystemFlags:w,nativeEvent:R,targetContainers:[M]},l!==null&&(l=Xn(l),l!==null&&Yc(l)),n):(n.eventSystemFlags|=w,l=n.targetContainers,M!==null&&l.indexOf(M)===-1&&l.push(M),n)}function Sw(n,l,p,w,M){switch(l){case"focusin":return yr=In(yr,n,l,p,w,M),!0;case"dragenter":return br=In(br,n,l,p,w,M),!0;case"mouseover":return wr=In(wr,n,l,p,w,M),!0;case"pointerover":var R=M.pointerId;return Bn.set(R,In(Bn.get(R)||null,n,l,p,w,M)),!0;case"gotpointercapture":return R=M.pointerId,jn.set(R,In(jn.get(R)||null,n,l,p,w,M)),!0}return!1}function Yp(n){var l=Yr(n.target);if(l!==null){var p=Kr(l);if(p!==null){if(l=p.tag,l===13){if(l=Bp(p),l!==null){n.blockedOn=l,qp(n.priority,function(){Vp(p)});return}}else if(l===3&&p.stateNode.current.memoizedState.isDehydrated){n.blockedOn=p.tag===3?p.stateNode.containerInfo:null;return}}}n.blockedOn=null}function ga(n){if(n.blockedOn!==null)return!1;for(var l=n.targetContainers;0<l.length;){var p=Zc(n.domEventName,n.eventSystemFlags,l[0],n.nativeEvent);if(p===null){p=n.nativeEvent;var w=new p.constructor(p.type,p);Fc=w,p.target.dispatchEvent(w),Fc=null}else return l=Xn(p),l!==null&&Yc(l),n.blockedOn=p,!1;l.shift()}return!0}function Xp(n,l,p){ga(n)&&p.delete(l)}function Cw(){Xc=!1,yr!==null&&ga(yr)&&(yr=null),br!==null&&ga(br)&&(br=null),wr!==null&&ga(wr)&&(wr=null),Bn.forEach(Xp),jn.forEach(Xp)}function Nn(n,l){n.blockedOn===l&&(n.blockedOn=null,Xc||(Xc=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Cw)))}function On(n){function l(M){return Nn(M,n)}if(0<ma.length){Nn(ma[0],n);for(var p=1;p<ma.length;p++){var w=ma[p];w.blockedOn===n&&(w.blockedOn=null)}}for(yr!==null&&Nn(yr,n),br!==null&&Nn(br,n),wr!==null&&Nn(wr,n),Bn.forEach(l),jn.forEach(l),p=0;p<Sr.length;p++)w=Sr[p],w.blockedOn===n&&(w.blockedOn=null);for(;0<Sr.length&&(p=Sr[0],p.blockedOn===null);)Yp(p),p.blockedOn===null&&Sr.shift()}var ji=C.ReactCurrentBatchConfig,_a=!0;function kw(n,l,p,w){var M=ze,R=ji.transition;ji.transition=null;try{ze=1,Qc(n,l,p,w)}finally{ze=M,ji.transition=R}}function Ew(n,l,p,w){var M=ze,R=ji.transition;ji.transition=null;try{ze=4,Qc(n,l,p,w)}finally{ze=M,ji.transition=R}}function Qc(n,l,p,w){if(_a){var M=Zc(n,l,p,w);if(M===null)mh(n,l,w,va,p),Kp(n,w);else if(Sw(M,n,l,p,w))w.stopPropagation();else if(Kp(n,w),l&4&&-1<ww.indexOf(n)){for(;M!==null;){var R=Xn(M);if(R!==null&&zp(R),R=Zc(n,l,p,w),R===null&&mh(n,l,w,va,p),R===M)break;M=R}M!==null&&w.stopPropagation()}else mh(n,l,w,null,p)}}var va=null;function Zc(n,l,p,w){if(va=null,n=$c(w),n=Yr(n),n!==null)if(l=Kr(n),l===null)n=null;else if(p=l.tag,p===13){if(n=Bp(l),n!==null)return n;n=null}else if(p===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;n=null}else l!==n&&(n=null);return va=n,null}function Qp(n){switch(n){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(fw()){case Vc:return 1;case $p:return 4;case ha:case pw:return 16;case Hp:return 536870912;default:return 16}default:return 16}}var Cr=null,Jc=null,xa=null;function Zp(){if(xa)return xa;var n,l=Jc,p=l.length,w,M="value"in Cr?Cr.value:Cr.textContent,R=M.length;for(n=0;n<p&&l[n]===M[n];n++);var j=p-n;for(w=1;w<=j&&l[p-w]===M[R-w];w++);return xa=M.slice(n,1<w?1-w:void 0)}function ya(n){var l=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&l===13&&(n=13)):n=l,n===10&&(n=13),32<=n||n===13?n:0}function ba(){return!0}function Jp(){return!1}function is(n){function l(p,w,M,R,j){this._reactName=p,this._targetInst=M,this.type=w,this.nativeEvent=R,this.target=j,this.currentTarget=null;for(var W in n)n.hasOwnProperty(W)&&(p=n[W],this[W]=p?p(R):R[W]);return this.isDefaultPrevented=(R.defaultPrevented!=null?R.defaultPrevented:R.returnValue===!1)?ba:Jp,this.isPropagationStopped=Jp,this}return F(l.prototype,{preventDefault:function(){this.defaultPrevented=!0;var p=this.nativeEvent;p&&(p.preventDefault?p.preventDefault():typeof p.returnValue!="unknown"&&(p.returnValue=!1),this.isDefaultPrevented=ba)},stopPropagation:function(){var p=this.nativeEvent;p&&(p.stopPropagation?p.stopPropagation():typeof p.cancelBubble!="unknown"&&(p.cancelBubble=!0),this.isPropagationStopped=ba)},persist:function(){},isPersistent:ba}),l}var Ii={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},eh=is(Ii),Fn=F({},Ii,{view:0,detail:0}),Pw=is(Fn),th,sh,$n,wa=F({},Fn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ih,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==$n&&($n&&n.type==="mousemove"?(th=n.screenX-$n.screenX,sh=n.screenY-$n.screenY):sh=th=0,$n=n),th)},movementY:function(n){return"movementY"in n?n.movementY:sh}}),em=is(wa),Mw=F({},wa,{dataTransfer:0}),Aw=is(Mw),Tw=F({},Fn,{relatedTarget:0}),rh=is(Tw),Rw=F({},Ii,{animationName:0,elapsedTime:0,pseudoElement:0}),Dw=is(Rw),Lw=F({},Ii,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),Bw=is(Lw),jw=F({},Ii,{data:0}),tm=is(jw),Iw={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Nw={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"},Ow={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Fw(n){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(n):(n=Ow[n])?!!l[n]:!1}function ih(){return Fw}var $w=F({},Fn,{key:function(n){if(n.key){var l=Iw[n.key]||n.key;if(l!=="Unidentified")return l}return n.type==="keypress"?(n=ya(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?Nw[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ih,charCode:function(n){return n.type==="keypress"?ya(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?ya(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),Hw=is($w),Uw=F({},wa,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),sm=is(Uw),Ww=F({},Fn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ih}),zw=is(Ww),Vw=F({},Ii,{propertyName:0,elapsedTime:0,pseudoElement:0}),Gw=is(Vw),qw=F({},wa,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),Kw=is(qw),Yw=[9,13,27,32],nh=o&&"CompositionEvent"in window,Hn=null;o&&"documentMode"in document&&(Hn=document.documentMode);var Xw=o&&"TextEvent"in window&&!Hn,rm=o&&(!nh||Hn&&8<Hn&&11>=Hn),im=" ",nm=!1;function om(n,l){switch(n){case"keyup":return Yw.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function am(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Ni=!1;function Qw(n,l){switch(n){case"compositionend":return am(l);case"keypress":return l.which!==32?null:(nm=!0,im);case"textInput":return n=l.data,n===im&&nm?null:n;default:return null}}function Zw(n,l){if(Ni)return n==="compositionend"||!nh&&om(n,l)?(n=Zp(),xa=Jc=Cr=null,Ni=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1<l.char.length)return l.char;if(l.which)return String.fromCharCode(l.which)}return null;case"compositionend":return rm&&l.locale!=="ko"?null:l.data;default:return null}}var Jw={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 lm(n){var l=n&&n.nodeName&&n.nodeName.toLowerCase();return l==="input"?!!Jw[n.type]:l==="textarea"}function cm(n,l,p,w){Ap(w),l=Pa(l,"onChange"),0<l.length&&(p=new eh("onChange","change",null,p,w),n.push({event:p,listeners:l}))}var Un=null,Wn=null;function eS(n){Pm(n,0)}function Sa(n){var l=Ui(n);if(fe(l))return n}function tS(n,l){if(n==="change")return l}var hm=!1;if(o){var oh;if(o){var ah="oninput"in document;if(!ah){var um=document.createElement("div");um.setAttribute("oninput","return;"),ah=typeof um.oninput=="function"}oh=ah}else oh=!1;hm=oh&&(!document.documentMode||9<document.documentMode)}function dm(){Un&&(Un.detachEvent("onpropertychange",fm),Wn=Un=null)}function fm(n){if(n.propertyName==="value"&&Sa(Wn)){var l=[];cm(l,Wn,n,$c(n)),Lp(eS,l)}}function sS(n,l,p){n==="focusin"?(dm(),Un=l,Wn=p,Un.attachEvent("onpropertychange",fm)):n==="focusout"&&dm()}function rS(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return Sa(Wn)}function iS(n,l){if(n==="click")return Sa(l)}function nS(n,l){if(n==="input"||n==="change")return Sa(l)}function oS(n,l){return n===l&&(n!==0||1/n===1/l)||n!==n&&l!==l}var Es=typeof Object.is=="function"?Object.is:oS;function zn(n,l){if(Es(n,l))return!0;if(typeof n!="object"||n===null||typeof l!="object"||l===null)return!1;var p=Object.keys(n),w=Object.keys(l);if(p.length!==w.length)return!1;for(w=0;w<p.length;w++){var M=p[w];if(!h.call(l,M)||!Es(n[M],l[M]))return!1}return!0}function pm(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function mm(n,l){var p=pm(n);n=0;for(var w;p;){if(p.nodeType===3){if(w=n+p.textContent.length,n<=l&&w>=l)return{node:p,offset:l-n};n=w}e:{for(;p;){if(p.nextSibling){p=p.nextSibling;break e}p=p.parentNode}p=void 0}p=pm(p)}}function gm(n,l){return n&&l?n===l?!0:n&&n.nodeType===3?!1:l&&l.nodeType===3?gm(n,l.parentNode):"contains"in n?n.contains(l):n.compareDocumentPosition?!!(n.compareDocumentPosition(l)&16):!1:!1}function _m(){for(var n=window,l=Ae();l instanceof n.HTMLIFrameElement;){try{var p=typeof l.contentWindow.location.href=="string"}catch{p=!1}if(p)n=l.contentWindow;else break;l=Ae(n.document)}return l}function lh(n){var l=n&&n.nodeName&&n.nodeName.toLowerCase();return l&&(l==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||l==="textarea"||n.contentEditable==="true")}function aS(n){var l=_m(),p=n.focusedElem,w=n.selectionRange;if(l!==p&&p&&p.ownerDocument&&gm(p.ownerDocument.documentElement,p)){if(w!==null&&lh(p)){if(l=w.start,n=w.end,n===void 0&&(n=l),"selectionStart"in p)p.selectionStart=l,p.selectionEnd=Math.min(n,p.value.length);else if(n=(l=p.ownerDocument||document)&&l.defaultView||window,n.getSelection){n=n.getSelection();var M=p.textContent.length,R=Math.min(w.start,M);w=w.end===void 0?R:Math.min(w.end,M),!n.extend&&R>w&&(M=w,w=R,R=M),M=mm(p,R);var j=mm(p,w);M&&j&&(n.rangeCount!==1||n.anchorNode!==M.node||n.anchorOffset!==M.offset||n.focusNode!==j.node||n.focusOffset!==j.offset)&&(l=l.createRange(),l.setStart(M.node,M.offset),n.removeAllRanges(),R>w?(n.addRange(l),n.extend(j.node,j.offset)):(l.setEnd(j.node,j.offset),n.addRange(l)))}}for(l=[],n=p;n=n.parentNode;)n.nodeType===1&&l.push({element:n,left:n.scrollLeft,top:n.scrollTop});for(typeof p.focus=="function"&&p.focus(),p=0;p<l.length;p++)n=l[p],n.element.scrollLeft=n.left,n.element.scrollTop=n.top}}var lS=o&&"documentMode"in document&&11>=document.documentMode,Oi=null,ch=null,Vn=null,hh=!1;function vm(n,l,p){var w=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;hh||Oi==null||Oi!==Ae(w)||(w=Oi,"selectionStart"in w&&lh(w)?w={start:w.selectionStart,end:w.selectionEnd}:(w=(w.ownerDocument&&w.ownerDocument.defaultView||window).getSelection(),w={anchorNode:w.anchorNode,anchorOffset:w.anchorOffset,focusNode:w.focusNode,focusOffset:w.focusOffset}),Vn&&zn(Vn,w)||(Vn=w,w=Pa(ch,"onSelect"),0<w.length&&(l=new eh("onSelect","select",null,l,p),n.push({event:l,listeners:w}),l.target=Oi)))}function Ca(n,l){var p={};return p[n.toLowerCase()]=l.toLowerCase(),p["Webkit"+n]="webkit"+l,p["Moz"+n]="moz"+l,p}var Fi={animationend:Ca("Animation","AnimationEnd"),animationiteration:Ca("Animation","AnimationIteration"),animationstart:Ca("Animation","AnimationStart"),transitionend:Ca("Transition","TransitionEnd")},uh={},xm={};o&&(xm=document.createElement("div").style,"AnimationEvent"in window||(delete Fi.animationend.animation,delete Fi.animationiteration.animation,delete Fi.animationstart.animation),"TransitionEvent"in window||delete Fi.transitionend.transition);function ka(n){if(uh[n])return uh[n];if(!Fi[n])return n;var l=Fi[n],p;for(p in l)if(l.hasOwnProperty(p)&&p in xm)return uh[n]=l[p];return n}var ym=ka("animationend"),bm=ka("animationiteration"),wm=ka("animationstart"),Sm=ka("transitionend"),Cm=new Map,km="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 kr(n,l){Cm.set(n,l),a(l,[n])}for(var dh=0;dh<km.length;dh++){var fh=km[dh],cS=fh.toLowerCase(),hS=fh[0].toUpperCase()+fh.slice(1);kr(cS,"on"+hS)}kr(ym,"onAnimationEnd"),kr(bm,"onAnimationIteration"),kr(wm,"onAnimationStart"),kr("dblclick","onDoubleClick"),kr("focusin","onFocus"),kr("focusout","onBlur"),kr(Sm,"onTransitionEnd"),c("onMouseEnter",["mouseout","mouseover"]),c("onMouseLeave",["mouseout","mouseover"]),c("onPointerEnter",["pointerout","pointerover"]),c("onPointerLeave",["pointerout","pointerover"]),a("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),a("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),a("onBeforeInput",["compositionend","keypress","textInput","paste"]),a("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Gn="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(" "),uS=new Set("cancel close invalid load scroll toggle".split(" ").concat(Gn));function Em(n,l,p){var w=n.type||"unknown-event";n.currentTarget=p,cw(w,l,void 0,n),n.currentTarget=null}function Pm(n,l){l=(l&4)!==0;for(var p=0;p<n.length;p++){var w=n[p],M=w.event;w=w.listeners;e:{var R=void 0;if(l)for(var j=w.length-1;0<=j;j--){var W=w[j],G=W.instance,te=W.currentTarget;if(W=W.listener,G!==R&&M.isPropagationStopped())break e;Em(M,W,te),R=G}else for(j=0;j<w.length;j++){if(W=w[j],G=W.instance,te=W.currentTarget,W=W.listener,G!==R&&M.isPropagationStopped())break e;Em(M,W,te),R=G}}}if(ca)throw n=zc,ca=!1,zc=null,n}function Ye(n,l){var p=l[bh];p===void 0&&(p=l[bh]=new Set);var w=n+"__bubble";p.has(w)||(Mm(l,n,2,!1),p.add(w))}function ph(n,l,p){var w=0;l&&(w|=4),Mm(p,n,w,l)}var Ea="_reactListening"+Math.random().toString(36).slice(2);function qn(n){if(!n[Ea]){n[Ea]=!0,r.forEach(function(p){p!=="selectionchange"&&(uS.has(p)||ph(p,!1,n),ph(p,!0,n))});var l=n.nodeType===9?n:n.ownerDocument;l===null||l[Ea]||(l[Ea]=!0,ph("selectionchange",!1,l))}}function Mm(n,l,p,w){switch(Qp(l)){case 1:var M=kw;break;case 4:M=Ew;break;default:M=Qc}p=M.bind(null,l,p,n),M=void 0,!Wc||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(M=!0),w?M!==void 0?n.addEventListener(l,p,{capture:!0,passive:M}):n.addEventListener(l,p,!0):M!==void 0?n.addEventListener(l,p,{passive:M}):n.addEventListener(l,p,!1)}function mh(n,l,p,w,M){var R=w;if((l&1)===0&&(l&2)===0&&w!==null)e:for(;;){if(w===null)return;var j=w.tag;if(j===3||j===4){var W=w.stateNode.containerInfo;if(W===M||W.nodeType===8&&W.parentNode===M)break;if(j===4)for(j=w.return;j!==null;){var G=j.tag;if((G===3||G===4)&&(G=j.stateNode.containerInfo,G===M||G.nodeType===8&&G.parentNode===M))return;j=j.return}for(;W!==null;){if(j=Yr(W),j===null)return;if(G=j.tag,G===5||G===6){w=R=j;continue e}W=W.parentNode}}w=w.return}Lp(function(){var te=R,ce=$c(p),ue=[];e:{var le=Cm.get(n);if(le!==void 0){var _e=eh,xe=n;switch(n){case"keypress":if(ya(p)===0)break e;case"keydown":case"keyup":_e=Hw;break;case"focusin":xe="focus",_e=rh;break;case"focusout":xe="blur",_e=rh;break;case"beforeblur":case"afterblur":_e=rh;break;case"click":if(p.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":_e=em;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":_e=Aw;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":_e=zw;break;case ym:case bm:case wm:_e=Dw;break;case Sm:_e=Gw;break;case"scroll":_e=Pw;break;case"wheel":_e=Kw;break;case"copy":case"cut":case"paste":_e=Bw;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":_e=sm}var ye=(l&4)!==0,lt=!ye&&n==="scroll",X=ye?le!==null?le+"Capture":null:le;ye=[];for(var q=te,ee;q!==null;){ee=q;var de=ee.stateNode;if(ee.tag===5&&de!==null&&(ee=de,X!==null&&(de=An(q,X),de!=null&&ye.push(Kn(q,de,ee)))),lt)break;q=q.return}0<ye.length&&(le=new _e(le,xe,null,p,ce),ue.push({event:le,listeners:ye}))}}if((l&7)===0){e:{if(le=n==="mouseover"||n==="pointerover",_e=n==="mouseout"||n==="pointerout",le&&p!==Fc&&(xe=p.relatedTarget||p.fromElement)&&(Yr(xe)||xe[er]))break e;if((_e||le)&&(le=ce.window===ce?ce:(le=ce.ownerDocument)?le.defaultView||le.parentWindow:window,_e?(xe=p.relatedTarget||p.toElement,_e=te,xe=xe?Yr(xe):null,xe!==null&&(lt=Kr(xe),xe!==lt||xe.tag!==5&&xe.tag!==6)&&(xe=null)):(_e=null,xe=te),_e!==xe)){if(ye=em,de="onMouseLeave",X="onMouseEnter",q="mouse",(n==="pointerout"||n==="pointerover")&&(ye=sm,de="onPointerLeave",X="onPointerEnter",q="pointer"),lt=_e==null?le:Ui(_e),ee=xe==null?le:Ui(xe),le=new ye(de,q+"leave",_e,p,ce),le.target=lt,le.relatedTarget=ee,de=null,Yr(ce)===te&&(ye=new ye(X,q+"enter",xe,p,ce),ye.target=ee,ye.relatedTarget=lt,de=ye),lt=de,_e&&xe)t:{for(ye=_e,X=xe,q=0,ee=ye;ee;ee=$i(ee))q++;for(ee=0,de=X;de;de=$i(de))ee++;for(;0<q-ee;)ye=$i(ye),q--;for(;0<ee-q;)X=$i(X),ee--;for(;q--;){if(ye===X||X!==null&&ye===X.alternate)break t;ye=$i(ye),X=$i(X)}ye=null}else ye=null;_e!==null&&Am(ue,le,_e,ye,!1),xe!==null&&lt!==null&&Am(ue,lt,xe,ye,!0)}}e:{if(le=te?Ui(te):window,_e=le.nodeName&&le.nodeName.toLowerCase(),_e==="select"||_e==="input"&&le.type==="file")var we=tS;else if(lm(le))if(hm)we=nS;else{we=rS;var ke=sS}else(_e=le.nodeName)&&_e.toLowerCase()==="input"&&(le.type==="checkbox"||le.type==="radio")&&(we=iS);if(we&&(we=we(n,te))){cm(ue,we,p,ce);break e}ke&&ke(n,le,te),n==="focusout"&&(ke=le._wrapperState)&&ke.controlled&&le.type==="number"&&gr(le,"number",le.value)}switch(ke=te?Ui(te):window,n){case"focusin":(lm(ke)||ke.contentEditable==="true")&&(Oi=ke,ch=te,Vn=null);break;case"focusout":Vn=ch=Oi=null;break;case"mousedown":hh=!0;break;case"contextmenu":case"mouseup":case"dragend":hh=!1,vm(ue,p,ce);break;case"selectionchange":if(lS)break;case"keydown":case"keyup":vm(ue,p,ce)}var Ee;if(nh)e:{switch(n){case"compositionstart":var Te="onCompositionStart";break e;case"compositionend":Te="onCompositionEnd";break e;case"compositionupdate":Te="onCompositionUpdate";break e}Te=void 0}else Ni?om(n,p)&&(Te="onCompositionEnd"):n==="keydown"&&p.keyCode===229&&(Te="onCompositionStart");Te&&(rm&&p.locale!=="ko"&&(Ni||Te!=="onCompositionStart"?Te==="onCompositionEnd"&&Ni&&(Ee=Zp()):(Cr=ce,Jc="value"in Cr?Cr.value:Cr.textContent,Ni=!0)),ke=Pa(te,Te),0<ke.length&&(Te=new tm(Te,n,null,p,ce),ue.push({event:Te,listeners:ke}),Ee?Te.data=Ee:(Ee=am(p),Ee!==null&&(Te.data=Ee)))),(Ee=Xw?Qw(n,p):Zw(n,p))&&(te=Pa(te,"onBeforeInput"),0<te.length&&(ce=new tm("onBeforeInput","beforeinput",null,p,ce),ue.push({event:ce,listeners:te}),ce.data=Ee))}Pm(ue,l)})}function Kn(n,l,p){return{instance:n,listener:l,currentTarget:p}}function Pa(n,l){for(var p=l+"Capture",w=[];n!==null;){var M=n,R=M.stateNode;M.tag===5&&R!==null&&(M=R,R=An(n,p),R!=null&&w.unshift(Kn(n,R,M)),R=An(n,l),R!=null&&w.push(Kn(n,R,M))),n=n.return}return w}function $i(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5);return n||null}function Am(n,l,p,w,M){for(var R=l._reactName,j=[];p!==null&&p!==w;){var W=p,G=W.alternate,te=W.stateNode;if(G!==null&&G===w)break;W.tag===5&&te!==null&&(W=te,M?(G=An(p,R),G!=null&&j.unshift(Kn(p,G,W))):M||(G=An(p,R),G!=null&&j.push(Kn(p,G,W)))),p=p.return}j.length!==0&&n.push({event:l,listeners:j})}var dS=/\r\n?/g,fS=/\u0000|\uFFFD/g;function Tm(n){return(typeof n=="string"?n:""+n).replace(dS,`
39
+ `).replace(fS,"")}function Ma(n,l,p){if(l=Tm(l),Tm(n)!==l&&p)throw Error(s(425))}function Aa(){}var gh=null,_h=null;function vh(n,l){return n==="textarea"||n==="noscript"||typeof l.children=="string"||typeof l.children=="number"||typeof l.dangerouslySetInnerHTML=="object"&&l.dangerouslySetInnerHTML!==null&&l.dangerouslySetInnerHTML.__html!=null}var xh=typeof setTimeout=="function"?setTimeout:void 0,pS=typeof clearTimeout=="function"?clearTimeout:void 0,Rm=typeof Promise=="function"?Promise:void 0,mS=typeof queueMicrotask=="function"?queueMicrotask:typeof Rm<"u"?function(n){return Rm.resolve(null).then(n).catch(gS)}:xh;function gS(n){setTimeout(function(){throw n})}function yh(n,l){var p=l,w=0;do{var M=p.nextSibling;if(n.removeChild(p),M&&M.nodeType===8)if(p=M.data,p==="/$"){if(w===0){n.removeChild(M),On(l);return}w--}else p!=="$"&&p!=="$?"&&p!=="$!"||w++;p=M}while(p);On(l)}function Er(n){for(;n!=null;n=n.nextSibling){var l=n.nodeType;if(l===1||l===3)break;if(l===8){if(l=n.data,l==="$"||l==="$!"||l==="$?")break;if(l==="/$")return null}}return n}function Dm(n){n=n.previousSibling;for(var l=0;n;){if(n.nodeType===8){var p=n.data;if(p==="$"||p==="$!"||p==="$?"){if(l===0)return n;l--}else p==="/$"&&l++}n=n.previousSibling}return null}var Hi=Math.random().toString(36).slice(2),Hs="__reactFiber$"+Hi,Yn="__reactProps$"+Hi,er="__reactContainer$"+Hi,bh="__reactEvents$"+Hi,_S="__reactListeners$"+Hi,vS="__reactHandles$"+Hi;function Yr(n){var l=n[Hs];if(l)return l;for(var p=n.parentNode;p;){if(l=p[er]||p[Hs]){if(p=l.alternate,l.child!==null||p!==null&&p.child!==null)for(n=Dm(n);n!==null;){if(p=n[Hs])return p;n=Dm(n)}return l}n=p,p=n.parentNode}return null}function Xn(n){return n=n[Hs]||n[er],!n||n.tag!==5&&n.tag!==6&&n.tag!==13&&n.tag!==3?null:n}function Ui(n){if(n.tag===5||n.tag===6)return n.stateNode;throw Error(s(33))}function Ta(n){return n[Yn]||null}var wh=[],Wi=-1;function Pr(n){return{current:n}}function Xe(n){0>Wi||(n.current=wh[Wi],wh[Wi]=null,Wi--)}function qe(n,l){Wi++,wh[Wi]=n.current,n.current=l}var Mr={},Dt=Pr(Mr),Kt=Pr(!1),Xr=Mr;function zi(n,l){var p=n.type.contextTypes;if(!p)return Mr;var w=n.stateNode;if(w&&w.__reactInternalMemoizedUnmaskedChildContext===l)return w.__reactInternalMemoizedMaskedChildContext;var M={},R;for(R in p)M[R]=l[R];return w&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=l,n.__reactInternalMemoizedMaskedChildContext=M),M}function Yt(n){return n=n.childContextTypes,n!=null}function Ra(){Xe(Kt),Xe(Dt)}function Lm(n,l,p){if(Dt.current!==Mr)throw Error(s(168));qe(Dt,l),qe(Kt,p)}function Bm(n,l,p){var w=n.stateNode;if(l=l.childContextTypes,typeof w.getChildContext!="function")return p;w=w.getChildContext();for(var M in w)if(!(M in l))throw Error(s(108,V(n)||"Unknown",M));return F({},p,w)}function Da(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||Mr,Xr=Dt.current,qe(Dt,n),qe(Kt,Kt.current),!0}function jm(n,l,p){var w=n.stateNode;if(!w)throw Error(s(169));p?(n=Bm(n,l,Xr),w.__reactInternalMemoizedMergedChildContext=n,Xe(Kt),Xe(Dt),qe(Dt,n)):Xe(Kt),qe(Kt,p)}var tr=null,La=!1,Sh=!1;function Im(n){tr===null?tr=[n]:tr.push(n)}function xS(n){La=!0,Im(n)}function Ar(){if(!Sh&&tr!==null){Sh=!0;var n=0,l=ze;try{var p=tr;for(ze=1;n<p.length;n++){var w=p[n];do w=w(!0);while(w!==null)}tr=null,La=!1}catch(M){throw tr!==null&&(tr=tr.slice(n+1)),Op(Vc,Ar),M}finally{ze=l,Sh=!1}}return null}var Vi=[],Gi=0,Ba=null,ja=0,fs=[],ps=0,Qr=null,sr=1,rr="";function Zr(n,l){Vi[Gi++]=ja,Vi[Gi++]=Ba,Ba=n,ja=l}function Nm(n,l,p){fs[ps++]=sr,fs[ps++]=rr,fs[ps++]=Qr,Qr=n;var w=sr;n=rr;var M=32-ks(w)-1;w&=~(1<<M),p+=1;var R=32-ks(l)+M;if(30<R){var j=M-M%5;R=(w&(1<<j)-1).toString(32),w>>=j,M-=j,sr=1<<32-ks(l)+M|p<<M|w,rr=R+n}else sr=1<<R|p<<M|w,rr=n}function Ch(n){n.return!==null&&(Zr(n,1),Nm(n,1,0))}function kh(n){for(;n===Ba;)Ba=Vi[--Gi],Vi[Gi]=null,ja=Vi[--Gi],Vi[Gi]=null;for(;n===Qr;)Qr=fs[--ps],fs[ps]=null,rr=fs[--ps],fs[ps]=null,sr=fs[--ps],fs[ps]=null}var ns=null,os=null,Ze=!1,Ps=null;function Om(n,l){var p=vs(5,null,null,0);p.elementType="DELETED",p.stateNode=l,p.return=n,l=n.deletions,l===null?(n.deletions=[p],n.flags|=16):l.push(p)}function Fm(n,l){switch(n.tag){case 5:var p=n.type;return l=l.nodeType!==1||p.toLowerCase()!==l.nodeName.toLowerCase()?null:l,l!==null?(n.stateNode=l,ns=n,os=Er(l.firstChild),!0):!1;case 6:return l=n.pendingProps===""||l.nodeType!==3?null:l,l!==null?(n.stateNode=l,ns=n,os=null,!0):!1;case 13:return l=l.nodeType!==8?null:l,l!==null?(p=Qr!==null?{id:sr,overflow:rr}:null,n.memoizedState={dehydrated:l,treeContext:p,retryLane:1073741824},p=vs(18,null,null,0),p.stateNode=l,p.return=n,n.child=p,ns=n,os=null,!0):!1;default:return!1}}function Eh(n){return(n.mode&1)!==0&&(n.flags&128)===0}function Ph(n){if(Ze){var l=os;if(l){var p=l;if(!Fm(n,l)){if(Eh(n))throw Error(s(418));l=Er(p.nextSibling);var w=ns;l&&Fm(n,l)?Om(w,p):(n.flags=n.flags&-4097|2,Ze=!1,ns=n)}}else{if(Eh(n))throw Error(s(418));n.flags=n.flags&-4097|2,Ze=!1,ns=n}}}function $m(n){for(n=n.return;n!==null&&n.tag!==5&&n.tag!==3&&n.tag!==13;)n=n.return;ns=n}function Ia(n){if(n!==ns)return!1;if(!Ze)return $m(n),Ze=!0,!1;var l;if((l=n.tag!==3)&&!(l=n.tag!==5)&&(l=n.type,l=l!=="head"&&l!=="body"&&!vh(n.type,n.memoizedProps)),l&&(l=os)){if(Eh(n))throw Hm(),Error(s(418));for(;l;)Om(n,l),l=Er(l.nextSibling)}if($m(n),n.tag===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));e:{for(n=n.nextSibling,l=0;n;){if(n.nodeType===8){var p=n.data;if(p==="/$"){if(l===0){os=Er(n.nextSibling);break e}l--}else p!=="$"&&p!=="$!"&&p!=="$?"||l++}n=n.nextSibling}os=null}}else os=ns?Er(n.stateNode.nextSibling):null;return!0}function Hm(){for(var n=os;n;)n=Er(n.nextSibling)}function qi(){os=ns=null,Ze=!1}function Mh(n){Ps===null?Ps=[n]:Ps.push(n)}var yS=C.ReactCurrentBatchConfig;function Qn(n,l,p){if(n=p.ref,n!==null&&typeof n!="function"&&typeof n!="object"){if(p._owner){if(p=p._owner,p){if(p.tag!==1)throw Error(s(309));var w=p.stateNode}if(!w)throw Error(s(147,n));var M=w,R=""+n;return l!==null&&l.ref!==null&&typeof l.ref=="function"&&l.ref._stringRef===R?l.ref:(l=function(j){var W=M.refs;j===null?delete W[R]:W[R]=j},l._stringRef=R,l)}if(typeof n!="string")throw Error(s(284));if(!p._owner)throw Error(s(290,n))}return n}function Na(n,l){throw n=Object.prototype.toString.call(l),Error(s(31,n==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":n))}function Um(n){var l=n._init;return l(n._payload)}function Wm(n){function l(X,q){if(n){var ee=X.deletions;ee===null?(X.deletions=[q],X.flags|=16):ee.push(q)}}function p(X,q){if(!n)return null;for(;q!==null;)l(X,q),q=q.sibling;return null}function w(X,q){for(X=new Map;q!==null;)q.key!==null?X.set(q.key,q):X.set(q.index,q),q=q.sibling;return X}function M(X,q){return X=Nr(X,q),X.index=0,X.sibling=null,X}function R(X,q,ee){return X.index=ee,n?(ee=X.alternate,ee!==null?(ee=ee.index,ee<q?(X.flags|=2,q):ee):(X.flags|=2,q)):(X.flags|=1048576,q)}function j(X){return n&&X.alternate===null&&(X.flags|=2),X}function W(X,q,ee,de){return q===null||q.tag!==6?(q=xu(ee,X.mode,de),q.return=X,q):(q=M(q,ee),q.return=X,q)}function G(X,q,ee,de){var we=ee.type;return we===T?ce(X,q,ee.props.children,de,ee.key):q!==null&&(q.elementType===we||typeof we=="object"&&we!==null&&we.$$typeof===Q&&Um(we)===q.type)?(de=M(q,ee.props),de.ref=Qn(X,q,ee),de.return=X,de):(de=al(ee.type,ee.key,ee.props,null,X.mode,de),de.ref=Qn(X,q,ee),de.return=X,de)}function te(X,q,ee,de){return q===null||q.tag!==4||q.stateNode.containerInfo!==ee.containerInfo||q.stateNode.implementation!==ee.implementation?(q=yu(ee,X.mode,de),q.return=X,q):(q=M(q,ee.children||[]),q.return=X,q)}function ce(X,q,ee,de,we){return q===null||q.tag!==7?(q=oi(ee,X.mode,de,we),q.return=X,q):(q=M(q,ee),q.return=X,q)}function ue(X,q,ee){if(typeof q=="string"&&q!==""||typeof q=="number")return q=xu(""+q,X.mode,ee),q.return=X,q;if(typeof q=="object"&&q!==null){switch(q.$$typeof){case E:return ee=al(q.type,q.key,q.props,null,X.mode,ee),ee.ref=Qn(X,null,q),ee.return=X,ee;case P:return q=yu(q,X.mode,ee),q.return=X,q;case Q:var de=q._init;return ue(X,de(q._payload),ee)}if(Js(q)||L(q))return q=oi(q,X.mode,ee,null),q.return=X,q;Na(X,q)}return null}function le(X,q,ee,de){var we=q!==null?q.key:null;if(typeof ee=="string"&&ee!==""||typeof ee=="number")return we!==null?null:W(X,q,""+ee,de);if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case E:return ee.key===we?G(X,q,ee,de):null;case P:return ee.key===we?te(X,q,ee,de):null;case Q:return we=ee._init,le(X,q,we(ee._payload),de)}if(Js(ee)||L(ee))return we!==null?null:ce(X,q,ee,de,null);Na(X,ee)}return null}function _e(X,q,ee,de,we){if(typeof de=="string"&&de!==""||typeof de=="number")return X=X.get(ee)||null,W(q,X,""+de,we);if(typeof de=="object"&&de!==null){switch(de.$$typeof){case E:return X=X.get(de.key===null?ee:de.key)||null,G(q,X,de,we);case P:return X=X.get(de.key===null?ee:de.key)||null,te(q,X,de,we);case Q:var ke=de._init;return _e(X,q,ee,ke(de._payload),we)}if(Js(de)||L(de))return X=X.get(ee)||null,ce(q,X,de,we,null);Na(q,de)}return null}function xe(X,q,ee,de){for(var we=null,ke=null,Ee=q,Te=q=0,St=null;Ee!==null&&Te<ee.length;Te++){Ee.index>Te?(St=Ee,Ee=null):St=Ee.sibling;var Ue=le(X,Ee,ee[Te],de);if(Ue===null){Ee===null&&(Ee=St);break}n&&Ee&&Ue.alternate===null&&l(X,Ee),q=R(Ue,q,Te),ke===null?we=Ue:ke.sibling=Ue,ke=Ue,Ee=St}if(Te===ee.length)return p(X,Ee),Ze&&Zr(X,Te),we;if(Ee===null){for(;Te<ee.length;Te++)Ee=ue(X,ee[Te],de),Ee!==null&&(q=R(Ee,q,Te),ke===null?we=Ee:ke.sibling=Ee,ke=Ee);return Ze&&Zr(X,Te),we}for(Ee=w(X,Ee);Te<ee.length;Te++)St=_e(Ee,X,Te,ee[Te],de),St!==null&&(n&&St.alternate!==null&&Ee.delete(St.key===null?Te:St.key),q=R(St,q,Te),ke===null?we=St:ke.sibling=St,ke=St);return n&&Ee.forEach(function(Or){return l(X,Or)}),Ze&&Zr(X,Te),we}function ye(X,q,ee,de){var we=L(ee);if(typeof we!="function")throw Error(s(150));if(ee=we.call(ee),ee==null)throw Error(s(151));for(var ke=we=null,Ee=q,Te=q=0,St=null,Ue=ee.next();Ee!==null&&!Ue.done;Te++,Ue=ee.next()){Ee.index>Te?(St=Ee,Ee=null):St=Ee.sibling;var Or=le(X,Ee,Ue.value,de);if(Or===null){Ee===null&&(Ee=St);break}n&&Ee&&Or.alternate===null&&l(X,Ee),q=R(Or,q,Te),ke===null?we=Or:ke.sibling=Or,ke=Or,Ee=St}if(Ue.done)return p(X,Ee),Ze&&Zr(X,Te),we;if(Ee===null){for(;!Ue.done;Te++,Ue=ee.next())Ue=ue(X,Ue.value,de),Ue!==null&&(q=R(Ue,q,Te),ke===null?we=Ue:ke.sibling=Ue,ke=Ue);return Ze&&Zr(X,Te),we}for(Ee=w(X,Ee);!Ue.done;Te++,Ue=ee.next())Ue=_e(Ee,X,Te,Ue.value,de),Ue!==null&&(n&&Ue.alternate!==null&&Ee.delete(Ue.key===null?Te:Ue.key),q=R(Ue,q,Te),ke===null?we=Ue:ke.sibling=Ue,ke=Ue);return n&&Ee.forEach(function(JS){return l(X,JS)}),Ze&&Zr(X,Te),we}function lt(X,q,ee,de){if(typeof ee=="object"&&ee!==null&&ee.type===T&&ee.key===null&&(ee=ee.props.children),typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case E:e:{for(var we=ee.key,ke=q;ke!==null;){if(ke.key===we){if(we=ee.type,we===T){if(ke.tag===7){p(X,ke.sibling),q=M(ke,ee.props.children),q.return=X,X=q;break e}}else if(ke.elementType===we||typeof we=="object"&&we!==null&&we.$$typeof===Q&&Um(we)===ke.type){p(X,ke.sibling),q=M(ke,ee.props),q.ref=Qn(X,ke,ee),q.return=X,X=q;break e}p(X,ke);break}else l(X,ke);ke=ke.sibling}ee.type===T?(q=oi(ee.props.children,X.mode,de,ee.key),q.return=X,X=q):(de=al(ee.type,ee.key,ee.props,null,X.mode,de),de.ref=Qn(X,q,ee),de.return=X,X=de)}return j(X);case P:e:{for(ke=ee.key;q!==null;){if(q.key===ke)if(q.tag===4&&q.stateNode.containerInfo===ee.containerInfo&&q.stateNode.implementation===ee.implementation){p(X,q.sibling),q=M(q,ee.children||[]),q.return=X,X=q;break e}else{p(X,q);break}else l(X,q);q=q.sibling}q=yu(ee,X.mode,de),q.return=X,X=q}return j(X);case Q:return ke=ee._init,lt(X,q,ke(ee._payload),de)}if(Js(ee))return xe(X,q,ee,de);if(L(ee))return ye(X,q,ee,de);Na(X,ee)}return typeof ee=="string"&&ee!==""||typeof ee=="number"?(ee=""+ee,q!==null&&q.tag===6?(p(X,q.sibling),q=M(q,ee),q.return=X,X=q):(p(X,q),q=xu(ee,X.mode,de),q.return=X,X=q),j(X)):p(X,q)}return lt}var Ki=Wm(!0),zm=Wm(!1),Oa=Pr(null),Fa=null,Yi=null,Ah=null;function Th(){Ah=Yi=Fa=null}function Rh(n){var l=Oa.current;Xe(Oa),n._currentValue=l}function Dh(n,l,p){for(;n!==null;){var w=n.alternate;if((n.childLanes&l)!==l?(n.childLanes|=l,w!==null&&(w.childLanes|=l)):w!==null&&(w.childLanes&l)!==l&&(w.childLanes|=l),n===p)break;n=n.return}}function Xi(n,l){Fa=n,Ah=Yi=null,n=n.dependencies,n!==null&&n.firstContext!==null&&((n.lanes&l)!==0&&(Xt=!0),n.firstContext=null)}function ms(n){var l=n._currentValue;if(Ah!==n)if(n={context:n,memoizedValue:l,next:null},Yi===null){if(Fa===null)throw Error(s(308));Yi=n,Fa.dependencies={lanes:0,firstContext:n}}else Yi=Yi.next=n;return l}var Jr=null;function Lh(n){Jr===null?Jr=[n]:Jr.push(n)}function Vm(n,l,p,w){var M=l.interleaved;return M===null?(p.next=p,Lh(l)):(p.next=M.next,M.next=p),l.interleaved=p,ir(n,w)}function ir(n,l){n.lanes|=l;var p=n.alternate;for(p!==null&&(p.lanes|=l),p=n,n=n.return;n!==null;)n.childLanes|=l,p=n.alternate,p!==null&&(p.childLanes|=l),p=n,n=n.return;return p.tag===3?p.stateNode:null}var Tr=!1;function Bh(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Gm(n,l){n=n.updateQueue,l.updateQueue===n&&(l.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,effects:n.effects})}function nr(n,l){return{eventTime:n,lane:l,tag:0,payload:null,callback:null,next:null}}function Rr(n,l,p){var w=n.updateQueue;if(w===null)return null;if(w=w.shared,(He&2)!==0){var M=w.pending;return M===null?l.next=l:(l.next=M.next,M.next=l),w.pending=l,ir(n,p)}return M=w.interleaved,M===null?(l.next=l,Lh(w)):(l.next=M.next,M.next=l),w.interleaved=l,ir(n,p)}function $a(n,l,p){if(l=l.updateQueue,l!==null&&(l=l.shared,(p&4194240)!==0)){var w=l.lanes;w&=n.pendingLanes,p|=w,l.lanes=p,Kc(n,p)}}function qm(n,l){var p=n.updateQueue,w=n.alternate;if(w!==null&&(w=w.updateQueue,p===w)){var M=null,R=null;if(p=p.firstBaseUpdate,p!==null){do{var j={eventTime:p.eventTime,lane:p.lane,tag:p.tag,payload:p.payload,callback:p.callback,next:null};R===null?M=R=j:R=R.next=j,p=p.next}while(p!==null);R===null?M=R=l:R=R.next=l}else M=R=l;p={baseState:w.baseState,firstBaseUpdate:M,lastBaseUpdate:R,shared:w.shared,effects:w.effects},n.updateQueue=p;return}n=p.lastBaseUpdate,n===null?p.firstBaseUpdate=l:n.next=l,p.lastBaseUpdate=l}function Ha(n,l,p,w){var M=n.updateQueue;Tr=!1;var R=M.firstBaseUpdate,j=M.lastBaseUpdate,W=M.shared.pending;if(W!==null){M.shared.pending=null;var G=W,te=G.next;G.next=null,j===null?R=te:j.next=te,j=G;var ce=n.alternate;ce!==null&&(ce=ce.updateQueue,W=ce.lastBaseUpdate,W!==j&&(W===null?ce.firstBaseUpdate=te:W.next=te,ce.lastBaseUpdate=G))}if(R!==null){var ue=M.baseState;j=0,ce=te=G=null,W=R;do{var le=W.lane,_e=W.eventTime;if((w&le)===le){ce!==null&&(ce=ce.next={eventTime:_e,lane:0,tag:W.tag,payload:W.payload,callback:W.callback,next:null});e:{var xe=n,ye=W;switch(le=l,_e=p,ye.tag){case 1:if(xe=ye.payload,typeof xe=="function"){ue=xe.call(_e,ue,le);break e}ue=xe;break e;case 3:xe.flags=xe.flags&-65537|128;case 0:if(xe=ye.payload,le=typeof xe=="function"?xe.call(_e,ue,le):xe,le==null)break e;ue=F({},ue,le);break e;case 2:Tr=!0}}W.callback!==null&&W.lane!==0&&(n.flags|=64,le=M.effects,le===null?M.effects=[W]:le.push(W))}else _e={eventTime:_e,lane:le,tag:W.tag,payload:W.payload,callback:W.callback,next:null},ce===null?(te=ce=_e,G=ue):ce=ce.next=_e,j|=le;if(W=W.next,W===null){if(W=M.shared.pending,W===null)break;le=W,W=le.next,le.next=null,M.lastBaseUpdate=le,M.shared.pending=null}}while(!0);if(ce===null&&(G=ue),M.baseState=G,M.firstBaseUpdate=te,M.lastBaseUpdate=ce,l=M.shared.interleaved,l!==null){M=l;do j|=M.lane,M=M.next;while(M!==l)}else R===null&&(M.shared.lanes=0);si|=j,n.lanes=j,n.memoizedState=ue}}function Km(n,l,p){if(n=l.effects,l.effects=null,n!==null)for(l=0;l<n.length;l++){var w=n[l],M=w.callback;if(M!==null){if(w.callback=null,w=p,typeof M!="function")throw Error(s(191,M));M.call(w)}}}var Zn={},Us=Pr(Zn),Jn=Pr(Zn),eo=Pr(Zn);function ei(n){if(n===Zn)throw Error(s(174));return n}function jh(n,l){switch(qe(eo,l),qe(Jn,n),qe(Us,Zn),n=l.nodeType,n){case 9:case 11:l=(l=l.documentElement)?l.namespaceURI:Gr(null,"");break;default:n=n===8?l.parentNode:l,l=n.namespaceURI||null,n=n.tagName,l=Gr(l,n)}Xe(Us),qe(Us,l)}function Qi(){Xe(Us),Xe(Jn),Xe(eo)}function Ym(n){ei(eo.current);var l=ei(Us.current),p=Gr(l,n.type);l!==p&&(qe(Jn,n),qe(Us,p))}function Ih(n){Jn.current===n&&(Xe(Us),Xe(Jn))}var Je=Pr(0);function Ua(n){for(var l=n;l!==null;){if(l.tag===13){var p=l.memoizedState;if(p!==null&&(p=p.dehydrated,p===null||p.data==="$?"||p.data==="$!"))return l}else if(l.tag===19&&l.memoizedProps.revealOrder!==void 0){if((l.flags&128)!==0)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===n)break;for(;l.sibling===null;){if(l.return===null||l.return===n)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var Nh=[];function Oh(){for(var n=0;n<Nh.length;n++)Nh[n]._workInProgressVersionPrimary=null;Nh.length=0}var Wa=C.ReactCurrentDispatcher,Fh=C.ReactCurrentBatchConfig,ti=0,et=null,gt=null,bt=null,za=!1,to=!1,so=0,bS=0;function Lt(){throw Error(s(321))}function $h(n,l){if(l===null)return!1;for(var p=0;p<l.length&&p<n.length;p++)if(!Es(n[p],l[p]))return!1;return!0}function Hh(n,l,p,w,M,R){if(ti=R,et=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,Wa.current=n===null||n.memoizedState===null?kS:ES,n=p(w,M),to){R=0;do{if(to=!1,so=0,25<=R)throw Error(s(301));R+=1,bt=gt=null,l.updateQueue=null,Wa.current=PS,n=p(w,M)}while(to)}if(Wa.current=qa,l=gt!==null&&gt.next!==null,ti=0,bt=gt=et=null,za=!1,l)throw Error(s(300));return n}function Uh(){var n=so!==0;return so=0,n}function Ws(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return bt===null?et.memoizedState=bt=n:bt=bt.next=n,bt}function gs(){if(gt===null){var n=et.alternate;n=n!==null?n.memoizedState:null}else n=gt.next;var l=bt===null?et.memoizedState:bt.next;if(l!==null)bt=l,gt=n;else{if(n===null)throw Error(s(310));gt=n,n={memoizedState:gt.memoizedState,baseState:gt.baseState,baseQueue:gt.baseQueue,queue:gt.queue,next:null},bt===null?et.memoizedState=bt=n:bt=bt.next=n}return bt}function ro(n,l){return typeof l=="function"?l(n):l}function Wh(n){var l=gs(),p=l.queue;if(p===null)throw Error(s(311));p.lastRenderedReducer=n;var w=gt,M=w.baseQueue,R=p.pending;if(R!==null){if(M!==null){var j=M.next;M.next=R.next,R.next=j}w.baseQueue=M=R,p.pending=null}if(M!==null){R=M.next,w=w.baseState;var W=j=null,G=null,te=R;do{var ce=te.lane;if((ti&ce)===ce)G!==null&&(G=G.next={lane:0,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null}),w=te.hasEagerState?te.eagerState:n(w,te.action);else{var ue={lane:ce,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null};G===null?(W=G=ue,j=w):G=G.next=ue,et.lanes|=ce,si|=ce}te=te.next}while(te!==null&&te!==R);G===null?j=w:G.next=W,Es(w,l.memoizedState)||(Xt=!0),l.memoizedState=w,l.baseState=j,l.baseQueue=G,p.lastRenderedState=w}if(n=p.interleaved,n!==null){M=n;do R=M.lane,et.lanes|=R,si|=R,M=M.next;while(M!==n)}else M===null&&(p.lanes=0);return[l.memoizedState,p.dispatch]}function zh(n){var l=gs(),p=l.queue;if(p===null)throw Error(s(311));p.lastRenderedReducer=n;var w=p.dispatch,M=p.pending,R=l.memoizedState;if(M!==null){p.pending=null;var j=M=M.next;do R=n(R,j.action),j=j.next;while(j!==M);Es(R,l.memoizedState)||(Xt=!0),l.memoizedState=R,l.baseQueue===null&&(l.baseState=R),p.lastRenderedState=R}return[R,w]}function Xm(){}function Qm(n,l){var p=et,w=gs(),M=l(),R=!Es(w.memoizedState,M);if(R&&(w.memoizedState=M,Xt=!0),w=w.queue,Vh(eg.bind(null,p,w,n),[n]),w.getSnapshot!==l||R||bt!==null&&bt.memoizedState.tag&1){if(p.flags|=2048,io(9,Jm.bind(null,p,w,M,l),void 0,null),wt===null)throw Error(s(349));(ti&30)!==0||Zm(p,l,M)}return M}function Zm(n,l,p){n.flags|=16384,n={getSnapshot:l,value:p},l=et.updateQueue,l===null?(l={lastEffect:null,stores:null},et.updateQueue=l,l.stores=[n]):(p=l.stores,p===null?l.stores=[n]:p.push(n))}function Jm(n,l,p,w){l.value=p,l.getSnapshot=w,tg(l)&&sg(n)}function eg(n,l,p){return p(function(){tg(l)&&sg(n)})}function tg(n){var l=n.getSnapshot;n=n.value;try{var p=l();return!Es(n,p)}catch{return!0}}function sg(n){var l=ir(n,1);l!==null&&Rs(l,n,1,-1)}function rg(n){var l=Ws();return typeof n=="function"&&(n=n()),l.memoizedState=l.baseState=n,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ro,lastRenderedState:n},l.queue=n,n=n.dispatch=CS.bind(null,et,n),[l.memoizedState,n]}function io(n,l,p,w){return n={tag:n,create:l,destroy:p,deps:w,next:null},l=et.updateQueue,l===null?(l={lastEffect:null,stores:null},et.updateQueue=l,l.lastEffect=n.next=n):(p=l.lastEffect,p===null?l.lastEffect=n.next=n:(w=p.next,p.next=n,n.next=w,l.lastEffect=n)),n}function ig(){return gs().memoizedState}function Va(n,l,p,w){var M=Ws();et.flags|=n,M.memoizedState=io(1|l,p,void 0,w===void 0?null:w)}function Ga(n,l,p,w){var M=gs();w=w===void 0?null:w;var R=void 0;if(gt!==null){var j=gt.memoizedState;if(R=j.destroy,w!==null&&$h(w,j.deps)){M.memoizedState=io(l,p,R,w);return}}et.flags|=n,M.memoizedState=io(1|l,p,R,w)}function ng(n,l){return Va(8390656,8,n,l)}function Vh(n,l){return Ga(2048,8,n,l)}function og(n,l){return Ga(4,2,n,l)}function ag(n,l){return Ga(4,4,n,l)}function lg(n,l){if(typeof l=="function")return n=n(),l(n),function(){l(null)};if(l!=null)return n=n(),l.current=n,function(){l.current=null}}function cg(n,l,p){return p=p!=null?p.concat([n]):null,Ga(4,4,lg.bind(null,l,n),p)}function Gh(){}function hg(n,l){var p=gs();l=l===void 0?null:l;var w=p.memoizedState;return w!==null&&l!==null&&$h(l,w[1])?w[0]:(p.memoizedState=[n,l],n)}function ug(n,l){var p=gs();l=l===void 0?null:l;var w=p.memoizedState;return w!==null&&l!==null&&$h(l,w[1])?w[0]:(n=n(),p.memoizedState=[n,l],n)}function dg(n,l,p){return(ti&21)===0?(n.baseState&&(n.baseState=!1,Xt=!0),n.memoizedState=p):(Es(p,l)||(p=Up(),et.lanes|=p,si|=p,n.baseState=!0),l)}function wS(n,l){var p=ze;ze=p!==0&&4>p?p:4,n(!0);var w=Fh.transition;Fh.transition={};try{n(!1),l()}finally{ze=p,Fh.transition=w}}function fg(){return gs().memoizedState}function SS(n,l,p){var w=jr(n);if(p={lane:w,action:p,hasEagerState:!1,eagerState:null,next:null},pg(n))mg(l,p);else if(p=Vm(n,l,p,w),p!==null){var M=zt();Rs(p,n,w,M),gg(p,l,w)}}function CS(n,l,p){var w=jr(n),M={lane:w,action:p,hasEagerState:!1,eagerState:null,next:null};if(pg(n))mg(l,M);else{var R=n.alternate;if(n.lanes===0&&(R===null||R.lanes===0)&&(R=l.lastRenderedReducer,R!==null))try{var j=l.lastRenderedState,W=R(j,p);if(M.hasEagerState=!0,M.eagerState=W,Es(W,j)){var G=l.interleaved;G===null?(M.next=M,Lh(l)):(M.next=G.next,G.next=M),l.interleaved=M;return}}catch{}finally{}p=Vm(n,l,M,w),p!==null&&(M=zt(),Rs(p,n,w,M),gg(p,l,w))}}function pg(n){var l=n.alternate;return n===et||l!==null&&l===et}function mg(n,l){to=za=!0;var p=n.pending;p===null?l.next=l:(l.next=p.next,p.next=l),n.pending=l}function gg(n,l,p){if((p&4194240)!==0){var w=l.lanes;w&=n.pendingLanes,p|=w,l.lanes=p,Kc(n,p)}}var qa={readContext:ms,useCallback:Lt,useContext:Lt,useEffect:Lt,useImperativeHandle:Lt,useInsertionEffect:Lt,useLayoutEffect:Lt,useMemo:Lt,useReducer:Lt,useRef:Lt,useState:Lt,useDebugValue:Lt,useDeferredValue:Lt,useTransition:Lt,useMutableSource:Lt,useSyncExternalStore:Lt,useId:Lt,unstable_isNewReconciler:!1},kS={readContext:ms,useCallback:function(n,l){return Ws().memoizedState=[n,l===void 0?null:l],n},useContext:ms,useEffect:ng,useImperativeHandle:function(n,l,p){return p=p!=null?p.concat([n]):null,Va(4194308,4,lg.bind(null,l,n),p)},useLayoutEffect:function(n,l){return Va(4194308,4,n,l)},useInsertionEffect:function(n,l){return Va(4,2,n,l)},useMemo:function(n,l){var p=Ws();return l=l===void 0?null:l,n=n(),p.memoizedState=[n,l],n},useReducer:function(n,l,p){var w=Ws();return l=p!==void 0?p(l):l,w.memoizedState=w.baseState=l,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:l},w.queue=n,n=n.dispatch=SS.bind(null,et,n),[w.memoizedState,n]},useRef:function(n){var l=Ws();return n={current:n},l.memoizedState=n},useState:rg,useDebugValue:Gh,useDeferredValue:function(n){return Ws().memoizedState=n},useTransition:function(){var n=rg(!1),l=n[0];return n=wS.bind(null,n[1]),Ws().memoizedState=n,[l,n]},useMutableSource:function(){},useSyncExternalStore:function(n,l,p){var w=et,M=Ws();if(Ze){if(p===void 0)throw Error(s(407));p=p()}else{if(p=l(),wt===null)throw Error(s(349));(ti&30)!==0||Zm(w,l,p)}M.memoizedState=p;var R={value:p,getSnapshot:l};return M.queue=R,ng(eg.bind(null,w,R,n),[n]),w.flags|=2048,io(9,Jm.bind(null,w,R,p,l),void 0,null),p},useId:function(){var n=Ws(),l=wt.identifierPrefix;if(Ze){var p=rr,w=sr;p=(w&~(1<<32-ks(w)-1)).toString(32)+p,l=":"+l+"R"+p,p=so++,0<p&&(l+="H"+p.toString(32)),l+=":"}else p=bS++,l=":"+l+"r"+p.toString(32)+":";return n.memoizedState=l},unstable_isNewReconciler:!1},ES={readContext:ms,useCallback:hg,useContext:ms,useEffect:Vh,useImperativeHandle:cg,useInsertionEffect:og,useLayoutEffect:ag,useMemo:ug,useReducer:Wh,useRef:ig,useState:function(){return Wh(ro)},useDebugValue:Gh,useDeferredValue:function(n){var l=gs();return dg(l,gt.memoizedState,n)},useTransition:function(){var n=Wh(ro)[0],l=gs().memoizedState;return[n,l]},useMutableSource:Xm,useSyncExternalStore:Qm,useId:fg,unstable_isNewReconciler:!1},PS={readContext:ms,useCallback:hg,useContext:ms,useEffect:Vh,useImperativeHandle:cg,useInsertionEffect:og,useLayoutEffect:ag,useMemo:ug,useReducer:zh,useRef:ig,useState:function(){return zh(ro)},useDebugValue:Gh,useDeferredValue:function(n){var l=gs();return gt===null?l.memoizedState=n:dg(l,gt.memoizedState,n)},useTransition:function(){var n=zh(ro)[0],l=gs().memoizedState;return[n,l]},useMutableSource:Xm,useSyncExternalStore:Qm,useId:fg,unstable_isNewReconciler:!1};function Ms(n,l){if(n&&n.defaultProps){l=F({},l),n=n.defaultProps;for(var p in n)l[p]===void 0&&(l[p]=n[p]);return l}return l}function qh(n,l,p,w){l=n.memoizedState,p=p(w,l),p=p==null?l:F({},l,p),n.memoizedState=p,n.lanes===0&&(n.updateQueue.baseState=p)}var Ka={isMounted:function(n){return(n=n._reactInternals)?Kr(n)===n:!1},enqueueSetState:function(n,l,p){n=n._reactInternals;var w=zt(),M=jr(n),R=nr(w,M);R.payload=l,p!=null&&(R.callback=p),l=Rr(n,R,M),l!==null&&(Rs(l,n,M,w),$a(l,n,M))},enqueueReplaceState:function(n,l,p){n=n._reactInternals;var w=zt(),M=jr(n),R=nr(w,M);R.tag=1,R.payload=l,p!=null&&(R.callback=p),l=Rr(n,R,M),l!==null&&(Rs(l,n,M,w),$a(l,n,M))},enqueueForceUpdate:function(n,l){n=n._reactInternals;var p=zt(),w=jr(n),M=nr(p,w);M.tag=2,l!=null&&(M.callback=l),l=Rr(n,M,w),l!==null&&(Rs(l,n,w,p),$a(l,n,w))}};function _g(n,l,p,w,M,R,j){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(w,R,j):l.prototype&&l.prototype.isPureReactComponent?!zn(p,w)||!zn(M,R):!0}function vg(n,l,p){var w=!1,M=Mr,R=l.contextType;return typeof R=="object"&&R!==null?R=ms(R):(M=Yt(l)?Xr:Dt.current,w=l.contextTypes,R=(w=w!=null)?zi(n,M):Mr),l=new l(p,R),n.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,l.updater=Ka,n.stateNode=l,l._reactInternals=n,w&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=M,n.__reactInternalMemoizedMaskedChildContext=R),l}function xg(n,l,p,w){n=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(p,w),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(p,w),l.state!==n&&Ka.enqueueReplaceState(l,l.state,null)}function Kh(n,l,p,w){var M=n.stateNode;M.props=p,M.state=n.memoizedState,M.refs={},Bh(n);var R=l.contextType;typeof R=="object"&&R!==null?M.context=ms(R):(R=Yt(l)?Xr:Dt.current,M.context=zi(n,R)),M.state=n.memoizedState,R=l.getDerivedStateFromProps,typeof R=="function"&&(qh(n,l,R,p),M.state=n.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof M.getSnapshotBeforeUpdate=="function"||typeof M.UNSAFE_componentWillMount!="function"&&typeof M.componentWillMount!="function"||(l=M.state,typeof M.componentWillMount=="function"&&M.componentWillMount(),typeof M.UNSAFE_componentWillMount=="function"&&M.UNSAFE_componentWillMount(),l!==M.state&&Ka.enqueueReplaceState(M,M.state,null),Ha(n,p,M,w),M.state=n.memoizedState),typeof M.componentDidMount=="function"&&(n.flags|=4194308)}function Zi(n,l){try{var p="",w=l;do p+=he(w),w=w.return;while(w);var M=p}catch(R){M=`
40
+ Error generating stack: `+R.message+`
41
+ `+R.stack}return{value:n,source:l,stack:M,digest:null}}function Yh(n,l,p){return{value:n,source:null,stack:p??null,digest:l??null}}function Xh(n,l){try{console.error(l.value)}catch(p){setTimeout(function(){throw p})}}var MS=typeof WeakMap=="function"?WeakMap:Map;function yg(n,l,p){p=nr(-1,p),p.tag=3,p.payload={element:null};var w=l.value;return p.callback=function(){tl||(tl=!0,uu=w),Xh(n,l)},p}function bg(n,l,p){p=nr(-1,p),p.tag=3;var w=n.type.getDerivedStateFromError;if(typeof w=="function"){var M=l.value;p.payload=function(){return w(M)},p.callback=function(){Xh(n,l)}}var R=n.stateNode;return R!==null&&typeof R.componentDidCatch=="function"&&(p.callback=function(){Xh(n,l),typeof w!="function"&&(Lr===null?Lr=new Set([this]):Lr.add(this));var j=l.stack;this.componentDidCatch(l.value,{componentStack:j!==null?j:""})}),p}function wg(n,l,p){var w=n.pingCache;if(w===null){w=n.pingCache=new MS;var M=new Set;w.set(l,M)}else M=w.get(l),M===void 0&&(M=new Set,w.set(l,M));M.has(p)||(M.add(p),n=US.bind(null,n,l,p),l.then(n,n))}function Sg(n){do{var l;if((l=n.tag===13)&&(l=n.memoizedState,l=l!==null?l.dehydrated!==null:!0),l)return n;n=n.return}while(n!==null);return null}function Cg(n,l,p,w,M){return(n.mode&1)===0?(n===l?n.flags|=65536:(n.flags|=128,p.flags|=131072,p.flags&=-52805,p.tag===1&&(p.alternate===null?p.tag=17:(l=nr(-1,1),l.tag=2,Rr(p,l,1))),p.lanes|=1),n):(n.flags|=65536,n.lanes=M,n)}var AS=C.ReactCurrentOwner,Xt=!1;function Wt(n,l,p,w){l.child=n===null?zm(l,null,p,w):Ki(l,n.child,p,w)}function kg(n,l,p,w,M){p=p.render;var R=l.ref;return Xi(l,M),w=Hh(n,l,p,w,R,M),p=Uh(),n!==null&&!Xt?(l.updateQueue=n.updateQueue,l.flags&=-2053,n.lanes&=~M,or(n,l,M)):(Ze&&p&&Ch(l),l.flags|=1,Wt(n,l,w,M),l.child)}function Eg(n,l,p,w,M){if(n===null){var R=p.type;return typeof R=="function"&&!vu(R)&&R.defaultProps===void 0&&p.compare===null&&p.defaultProps===void 0?(l.tag=15,l.type=R,Pg(n,l,R,w,M)):(n=al(p.type,null,w,l,l.mode,M),n.ref=l.ref,n.return=l,l.child=n)}if(R=n.child,(n.lanes&M)===0){var j=R.memoizedProps;if(p=p.compare,p=p!==null?p:zn,p(j,w)&&n.ref===l.ref)return or(n,l,M)}return l.flags|=1,n=Nr(R,w),n.ref=l.ref,n.return=l,l.child=n}function Pg(n,l,p,w,M){if(n!==null){var R=n.memoizedProps;if(zn(R,w)&&n.ref===l.ref)if(Xt=!1,l.pendingProps=w=R,(n.lanes&M)!==0)(n.flags&131072)!==0&&(Xt=!0);else return l.lanes=n.lanes,or(n,l,M)}return Qh(n,l,p,w,M)}function Mg(n,l,p){var w=l.pendingProps,M=w.children,R=n!==null?n.memoizedState:null;if(w.mode==="hidden")if((l.mode&1)===0)l.memoizedState={baseLanes:0,cachePool:null,transitions:null},qe(en,as),as|=p;else{if((p&1073741824)===0)return n=R!==null?R.baseLanes|p:p,l.lanes=l.childLanes=1073741824,l.memoizedState={baseLanes:n,cachePool:null,transitions:null},l.updateQueue=null,qe(en,as),as|=n,null;l.memoizedState={baseLanes:0,cachePool:null,transitions:null},w=R!==null?R.baseLanes:p,qe(en,as),as|=w}else R!==null?(w=R.baseLanes|p,l.memoizedState=null):w=p,qe(en,as),as|=w;return Wt(n,l,M,p),l.child}function Ag(n,l){var p=l.ref;(n===null&&p!==null||n!==null&&n.ref!==p)&&(l.flags|=512,l.flags|=2097152)}function Qh(n,l,p,w,M){var R=Yt(p)?Xr:Dt.current;return R=zi(l,R),Xi(l,M),p=Hh(n,l,p,w,R,M),w=Uh(),n!==null&&!Xt?(l.updateQueue=n.updateQueue,l.flags&=-2053,n.lanes&=~M,or(n,l,M)):(Ze&&w&&Ch(l),l.flags|=1,Wt(n,l,p,M),l.child)}function Tg(n,l,p,w,M){if(Yt(p)){var R=!0;Da(l)}else R=!1;if(Xi(l,M),l.stateNode===null)Xa(n,l),vg(l,p,w),Kh(l,p,w,M),w=!0;else if(n===null){var j=l.stateNode,W=l.memoizedProps;j.props=W;var G=j.context,te=p.contextType;typeof te=="object"&&te!==null?te=ms(te):(te=Yt(p)?Xr:Dt.current,te=zi(l,te));var ce=p.getDerivedStateFromProps,ue=typeof ce=="function"||typeof j.getSnapshotBeforeUpdate=="function";ue||typeof j.UNSAFE_componentWillReceiveProps!="function"&&typeof j.componentWillReceiveProps!="function"||(W!==w||G!==te)&&xg(l,j,w,te),Tr=!1;var le=l.memoizedState;j.state=le,Ha(l,w,j,M),G=l.memoizedState,W!==w||le!==G||Kt.current||Tr?(typeof ce=="function"&&(qh(l,p,ce,w),G=l.memoizedState),(W=Tr||_g(l,p,W,w,le,G,te))?(ue||typeof j.UNSAFE_componentWillMount!="function"&&typeof j.componentWillMount!="function"||(typeof j.componentWillMount=="function"&&j.componentWillMount(),typeof j.UNSAFE_componentWillMount=="function"&&j.UNSAFE_componentWillMount()),typeof j.componentDidMount=="function"&&(l.flags|=4194308)):(typeof j.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=w,l.memoizedState=G),j.props=w,j.state=G,j.context=te,w=W):(typeof j.componentDidMount=="function"&&(l.flags|=4194308),w=!1)}else{j=l.stateNode,Gm(n,l),W=l.memoizedProps,te=l.type===l.elementType?W:Ms(l.type,W),j.props=te,ue=l.pendingProps,le=j.context,G=p.contextType,typeof G=="object"&&G!==null?G=ms(G):(G=Yt(p)?Xr:Dt.current,G=zi(l,G));var _e=p.getDerivedStateFromProps;(ce=typeof _e=="function"||typeof j.getSnapshotBeforeUpdate=="function")||typeof j.UNSAFE_componentWillReceiveProps!="function"&&typeof j.componentWillReceiveProps!="function"||(W!==ue||le!==G)&&xg(l,j,w,G),Tr=!1,le=l.memoizedState,j.state=le,Ha(l,w,j,M);var xe=l.memoizedState;W!==ue||le!==xe||Kt.current||Tr?(typeof _e=="function"&&(qh(l,p,_e,w),xe=l.memoizedState),(te=Tr||_g(l,p,te,w,le,xe,G)||!1)?(ce||typeof j.UNSAFE_componentWillUpdate!="function"&&typeof j.componentWillUpdate!="function"||(typeof j.componentWillUpdate=="function"&&j.componentWillUpdate(w,xe,G),typeof j.UNSAFE_componentWillUpdate=="function"&&j.UNSAFE_componentWillUpdate(w,xe,G)),typeof j.componentDidUpdate=="function"&&(l.flags|=4),typeof j.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof j.componentDidUpdate!="function"||W===n.memoizedProps&&le===n.memoizedState||(l.flags|=4),typeof j.getSnapshotBeforeUpdate!="function"||W===n.memoizedProps&&le===n.memoizedState||(l.flags|=1024),l.memoizedProps=w,l.memoizedState=xe),j.props=w,j.state=xe,j.context=G,w=te):(typeof j.componentDidUpdate!="function"||W===n.memoizedProps&&le===n.memoizedState||(l.flags|=4),typeof j.getSnapshotBeforeUpdate!="function"||W===n.memoizedProps&&le===n.memoizedState||(l.flags|=1024),w=!1)}return Zh(n,l,p,w,R,M)}function Zh(n,l,p,w,M,R){Ag(n,l);var j=(l.flags&128)!==0;if(!w&&!j)return M&&jm(l,p,!1),or(n,l,R);w=l.stateNode,AS.current=l;var W=j&&typeof p.getDerivedStateFromError!="function"?null:w.render();return l.flags|=1,n!==null&&j?(l.child=Ki(l,n.child,null,R),l.child=Ki(l,null,W,R)):Wt(n,l,W,R),l.memoizedState=w.state,M&&jm(l,p,!0),l.child}function Rg(n){var l=n.stateNode;l.pendingContext?Lm(n,l.pendingContext,l.pendingContext!==l.context):l.context&&Lm(n,l.context,!1),jh(n,l.containerInfo)}function Dg(n,l,p,w,M){return qi(),Mh(M),l.flags|=256,Wt(n,l,p,w),l.child}var Jh={dehydrated:null,treeContext:null,retryLane:0};function eu(n){return{baseLanes:n,cachePool:null,transitions:null}}function Lg(n,l,p){var w=l.pendingProps,M=Je.current,R=!1,j=(l.flags&128)!==0,W;if((W=j)||(W=n!==null&&n.memoizedState===null?!1:(M&2)!==0),W?(R=!0,l.flags&=-129):(n===null||n.memoizedState!==null)&&(M|=1),qe(Je,M&1),n===null)return Ph(l),n=l.memoizedState,n!==null&&(n=n.dehydrated,n!==null)?((l.mode&1)===0?l.lanes=1:n.data==="$!"?l.lanes=8:l.lanes=1073741824,null):(j=w.children,n=w.fallback,R?(w=l.mode,R=l.child,j={mode:"hidden",children:j},(w&1)===0&&R!==null?(R.childLanes=0,R.pendingProps=j):R=ll(j,w,0,null),n=oi(n,w,p,null),R.return=l,n.return=l,R.sibling=n,l.child=R,l.child.memoizedState=eu(p),l.memoizedState=Jh,n):tu(l,j));if(M=n.memoizedState,M!==null&&(W=M.dehydrated,W!==null))return TS(n,l,j,w,W,M,p);if(R){R=w.fallback,j=l.mode,M=n.child,W=M.sibling;var G={mode:"hidden",children:w.children};return(j&1)===0&&l.child!==M?(w=l.child,w.childLanes=0,w.pendingProps=G,l.deletions=null):(w=Nr(M,G),w.subtreeFlags=M.subtreeFlags&14680064),W!==null?R=Nr(W,R):(R=oi(R,j,p,null),R.flags|=2),R.return=l,w.return=l,w.sibling=R,l.child=w,w=R,R=l.child,j=n.child.memoizedState,j=j===null?eu(p):{baseLanes:j.baseLanes|p,cachePool:null,transitions:j.transitions},R.memoizedState=j,R.childLanes=n.childLanes&~p,l.memoizedState=Jh,w}return R=n.child,n=R.sibling,w=Nr(R,{mode:"visible",children:w.children}),(l.mode&1)===0&&(w.lanes=p),w.return=l,w.sibling=null,n!==null&&(p=l.deletions,p===null?(l.deletions=[n],l.flags|=16):p.push(n)),l.child=w,l.memoizedState=null,w}function tu(n,l){return l=ll({mode:"visible",children:l},n.mode,0,null),l.return=n,n.child=l}function Ya(n,l,p,w){return w!==null&&Mh(w),Ki(l,n.child,null,p),n=tu(l,l.pendingProps.children),n.flags|=2,l.memoizedState=null,n}function TS(n,l,p,w,M,R,j){if(p)return l.flags&256?(l.flags&=-257,w=Yh(Error(s(422))),Ya(n,l,j,w)):l.memoizedState!==null?(l.child=n.child,l.flags|=128,null):(R=w.fallback,M=l.mode,w=ll({mode:"visible",children:w.children},M,0,null),R=oi(R,M,j,null),R.flags|=2,w.return=l,R.return=l,w.sibling=R,l.child=w,(l.mode&1)!==0&&Ki(l,n.child,null,j),l.child.memoizedState=eu(j),l.memoizedState=Jh,R);if((l.mode&1)===0)return Ya(n,l,j,null);if(M.data==="$!"){if(w=M.nextSibling&&M.nextSibling.dataset,w)var W=w.dgst;return w=W,R=Error(s(419)),w=Yh(R,w,void 0),Ya(n,l,j,w)}if(W=(j&n.childLanes)!==0,Xt||W){if(w=wt,w!==null){switch(j&-j){case 4:M=2;break;case 16:M=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:M=32;break;case 536870912:M=268435456;break;default:M=0}M=(M&(w.suspendedLanes|j))!==0?0:M,M!==0&&M!==R.retryLane&&(R.retryLane=M,ir(n,M),Rs(w,n,M,-1))}return _u(),w=Yh(Error(s(421))),Ya(n,l,j,w)}return M.data==="$?"?(l.flags|=128,l.child=n.child,l=WS.bind(null,n),M._reactRetry=l,null):(n=R.treeContext,os=Er(M.nextSibling),ns=l,Ze=!0,Ps=null,n!==null&&(fs[ps++]=sr,fs[ps++]=rr,fs[ps++]=Qr,sr=n.id,rr=n.overflow,Qr=l),l=tu(l,w.children),l.flags|=4096,l)}function Bg(n,l,p){n.lanes|=l;var w=n.alternate;w!==null&&(w.lanes|=l),Dh(n.return,l,p)}function su(n,l,p,w,M){var R=n.memoizedState;R===null?n.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:w,tail:p,tailMode:M}:(R.isBackwards=l,R.rendering=null,R.renderingStartTime=0,R.last=w,R.tail=p,R.tailMode=M)}function jg(n,l,p){var w=l.pendingProps,M=w.revealOrder,R=w.tail;if(Wt(n,l,w.children,p),w=Je.current,(w&2)!==0)w=w&1|2,l.flags|=128;else{if(n!==null&&(n.flags&128)!==0)e:for(n=l.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&Bg(n,p,l);else if(n.tag===19)Bg(n,p,l);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===l)break e;for(;n.sibling===null;){if(n.return===null||n.return===l)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}w&=1}if(qe(Je,w),(l.mode&1)===0)l.memoizedState=null;else switch(M){case"forwards":for(p=l.child,M=null;p!==null;)n=p.alternate,n!==null&&Ua(n)===null&&(M=p),p=p.sibling;p=M,p===null?(M=l.child,l.child=null):(M=p.sibling,p.sibling=null),su(l,!1,M,p,R);break;case"backwards":for(p=null,M=l.child,l.child=null;M!==null;){if(n=M.alternate,n!==null&&Ua(n)===null){l.child=M;break}n=M.sibling,M.sibling=p,p=M,M=n}su(l,!0,p,null,R);break;case"together":su(l,!1,null,null,void 0);break;default:l.memoizedState=null}return l.child}function Xa(n,l){(l.mode&1)===0&&n!==null&&(n.alternate=null,l.alternate=null,l.flags|=2)}function or(n,l,p){if(n!==null&&(l.dependencies=n.dependencies),si|=l.lanes,(p&l.childLanes)===0)return null;if(n!==null&&l.child!==n.child)throw Error(s(153));if(l.child!==null){for(n=l.child,p=Nr(n,n.pendingProps),l.child=p,p.return=l;n.sibling!==null;)n=n.sibling,p=p.sibling=Nr(n,n.pendingProps),p.return=l;p.sibling=null}return l.child}function RS(n,l,p){switch(l.tag){case 3:Rg(l),qi();break;case 5:Ym(l);break;case 1:Yt(l.type)&&Da(l);break;case 4:jh(l,l.stateNode.containerInfo);break;case 10:var w=l.type._context,M=l.memoizedProps.value;qe(Oa,w._currentValue),w._currentValue=M;break;case 13:if(w=l.memoizedState,w!==null)return w.dehydrated!==null?(qe(Je,Je.current&1),l.flags|=128,null):(p&l.child.childLanes)!==0?Lg(n,l,p):(qe(Je,Je.current&1),n=or(n,l,p),n!==null?n.sibling:null);qe(Je,Je.current&1);break;case 19:if(w=(p&l.childLanes)!==0,(n.flags&128)!==0){if(w)return jg(n,l,p);l.flags|=128}if(M=l.memoizedState,M!==null&&(M.rendering=null,M.tail=null,M.lastEffect=null),qe(Je,Je.current),w)break;return null;case 22:case 23:return l.lanes=0,Mg(n,l,p)}return or(n,l,p)}var Ig,ru,Ng,Og;Ig=function(n,l){for(var p=l.child;p!==null;){if(p.tag===5||p.tag===6)n.appendChild(p.stateNode);else if(p.tag!==4&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===l)break;for(;p.sibling===null;){if(p.return===null||p.return===l)return;p=p.return}p.sibling.return=p.return,p=p.sibling}},ru=function(){},Ng=function(n,l,p,w){var M=n.memoizedProps;if(M!==w){n=l.stateNode,ei(Us.current);var R=null;switch(p){case"input":M=Oe(n,M),w=Oe(n,w),R=[];break;case"select":M=F({},M,{value:void 0}),w=F({},w,{value:void 0}),R=[];break;case"textarea":M=_r(n,M),w=_r(n,w),R=[];break;default:typeof M.onClick!="function"&&typeof w.onClick=="function"&&(n.onclick=Aa)}Nc(p,w);var j;p=null;for(te in M)if(!w.hasOwnProperty(te)&&M.hasOwnProperty(te)&&M[te]!=null)if(te==="style"){var W=M[te];for(j in W)W.hasOwnProperty(j)&&(p||(p={}),p[j]="")}else te!=="dangerouslySetInnerHTML"&&te!=="children"&&te!=="suppressContentEditableWarning"&&te!=="suppressHydrationWarning"&&te!=="autoFocus"&&(i.hasOwnProperty(te)?R||(R=[]):(R=R||[]).push(te,null));for(te in w){var G=w[te];if(W=M!=null?M[te]:void 0,w.hasOwnProperty(te)&&G!==W&&(G!=null||W!=null))if(te==="style")if(W){for(j in W)!W.hasOwnProperty(j)||G&&G.hasOwnProperty(j)||(p||(p={}),p[j]="");for(j in G)G.hasOwnProperty(j)&&W[j]!==G[j]&&(p||(p={}),p[j]=G[j])}else p||(R||(R=[]),R.push(te,p)),p=G;else te==="dangerouslySetInnerHTML"?(G=G?G.__html:void 0,W=W?W.__html:void 0,G!=null&&W!==G&&(R=R||[]).push(te,G)):te==="children"?typeof G!="string"&&typeof G!="number"||(R=R||[]).push(te,""+G):te!=="suppressContentEditableWarning"&&te!=="suppressHydrationWarning"&&(i.hasOwnProperty(te)?(G!=null&&te==="onScroll"&&Ye("scroll",n),R||W===G||(R=[])):(R=R||[]).push(te,G))}p&&(R=R||[]).push("style",p);var te=R;(l.updateQueue=te)&&(l.flags|=4)}},Og=function(n,l,p,w){p!==w&&(l.flags|=4)};function no(n,l){if(!Ze)switch(n.tailMode){case"hidden":l=n.tail;for(var p=null;l!==null;)l.alternate!==null&&(p=l),l=l.sibling;p===null?n.tail=null:p.sibling=null;break;case"collapsed":p=n.tail;for(var w=null;p!==null;)p.alternate!==null&&(w=p),p=p.sibling;w===null?l||n.tail===null?n.tail=null:n.tail.sibling=null:w.sibling=null}}function Bt(n){var l=n.alternate!==null&&n.alternate.child===n.child,p=0,w=0;if(l)for(var M=n.child;M!==null;)p|=M.lanes|M.childLanes,w|=M.subtreeFlags&14680064,w|=M.flags&14680064,M.return=n,M=M.sibling;else for(M=n.child;M!==null;)p|=M.lanes|M.childLanes,w|=M.subtreeFlags,w|=M.flags,M.return=n,M=M.sibling;return n.subtreeFlags|=w,n.childLanes=p,l}function DS(n,l,p){var w=l.pendingProps;switch(kh(l),l.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Bt(l),null;case 1:return Yt(l.type)&&Ra(),Bt(l),null;case 3:return w=l.stateNode,Qi(),Xe(Kt),Xe(Dt),Oh(),w.pendingContext&&(w.context=w.pendingContext,w.pendingContext=null),(n===null||n.child===null)&&(Ia(l)?l.flags|=4:n===null||n.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,Ps!==null&&(pu(Ps),Ps=null))),ru(n,l),Bt(l),null;case 5:Ih(l);var M=ei(eo.current);if(p=l.type,n!==null&&l.stateNode!=null)Ng(n,l,p,w,M),n.ref!==l.ref&&(l.flags|=512,l.flags|=2097152);else{if(!w){if(l.stateNode===null)throw Error(s(166));return Bt(l),null}if(n=ei(Us.current),Ia(l)){w=l.stateNode,p=l.type;var R=l.memoizedProps;switch(w[Hs]=l,w[Yn]=R,n=(l.mode&1)!==0,p){case"dialog":Ye("cancel",w),Ye("close",w);break;case"iframe":case"object":case"embed":Ye("load",w);break;case"video":case"audio":for(M=0;M<Gn.length;M++)Ye(Gn[M],w);break;case"source":Ye("error",w);break;case"img":case"image":case"link":Ye("error",w),Ye("load",w);break;case"details":Ye("toggle",w);break;case"input":$e(w,R),Ye("invalid",w);break;case"select":w._wrapperState={wasMultiple:!!R.multiple},Ye("invalid",w);break;case"textarea":Ut(w,R),Ye("invalid",w)}Nc(p,R),M=null;for(var j in R)if(R.hasOwnProperty(j)){var W=R[j];j==="children"?typeof W=="string"?w.textContent!==W&&(R.suppressHydrationWarning!==!0&&Ma(w.textContent,W,n),M=["children",W]):typeof W=="number"&&w.textContent!==""+W&&(R.suppressHydrationWarning!==!0&&Ma(w.textContent,W,n),M=["children",""+W]):i.hasOwnProperty(j)&&W!=null&&j==="onScroll"&&Ye("scroll",w)}switch(p){case"input":pe(w),Os(w,R,!0);break;case"textarea":pe(w),ss(w);break;case"select":case"option":break;default:typeof R.onClick=="function"&&(w.onclick=Aa)}w=M,l.updateQueue=w,w!==null&&(l.flags|=4)}else{j=M.nodeType===9?M:M.ownerDocument,n==="http://www.w3.org/1999/xhtml"&&(n=xr(p)),n==="http://www.w3.org/1999/xhtml"?p==="script"?(n=j.createElement("div"),n.innerHTML="<script><\/script>",n=n.removeChild(n.firstChild)):typeof w.is=="string"?n=j.createElement(p,{is:w.is}):(n=j.createElement(p),p==="select"&&(j=n,w.multiple?j.multiple=!0:w.size&&(j.size=w.size))):n=j.createElementNS(n,p),n[Hs]=l,n[Yn]=w,Ig(n,l,!1,!1),l.stateNode=n;e:{switch(j=Oc(p,w),p){case"dialog":Ye("cancel",n),Ye("close",n),M=w;break;case"iframe":case"object":case"embed":Ye("load",n),M=w;break;case"video":case"audio":for(M=0;M<Gn.length;M++)Ye(Gn[M],n);M=w;break;case"source":Ye("error",n),M=w;break;case"img":case"image":case"link":Ye("error",n),Ye("load",n),M=w;break;case"details":Ye("toggle",n),M=w;break;case"input":$e(n,w),M=Oe(n,w),Ye("invalid",n);break;case"option":M=w;break;case"select":n._wrapperState={wasMultiple:!!w.multiple},M=F({},w,{value:void 0}),Ye("invalid",n);break;case"textarea":Ut(n,w),M=_r(n,w),Ye("invalid",n);break;default:M=w}Nc(p,M),W=M;for(R in W)if(W.hasOwnProperty(R)){var G=W[R];R==="style"?Pp(n,G):R==="dangerouslySetInnerHTML"?(G=G?G.__html:void 0,G!=null&&qr(n,G)):R==="children"?typeof G=="string"?(p!=="textarea"||G!=="")&&qt(n,G):typeof G=="number"&&qt(n,""+G):R!=="suppressContentEditableWarning"&&R!=="suppressHydrationWarning"&&R!=="autoFocus"&&(i.hasOwnProperty(R)?G!=null&&R==="onScroll"&&Ye("scroll",n):G!=null&&b(n,R,G,j))}switch(p){case"input":pe(n),Os(n,w,!1);break;case"textarea":pe(n),ss(n);break;case"option":w.value!=null&&n.setAttribute("value",""+N(w.value));break;case"select":n.multiple=!!w.multiple,R=w.value,R!=null?Fs(n,!!w.multiple,R,!1):w.defaultValue!=null&&Fs(n,!!w.multiple,w.defaultValue,!0);break;default:typeof M.onClick=="function"&&(n.onclick=Aa)}switch(p){case"button":case"input":case"select":case"textarea":w=!!w.autoFocus;break e;case"img":w=!0;break e;default:w=!1}}w&&(l.flags|=4)}l.ref!==null&&(l.flags|=512,l.flags|=2097152)}return Bt(l),null;case 6:if(n&&l.stateNode!=null)Og(n,l,n.memoizedProps,w);else{if(typeof w!="string"&&l.stateNode===null)throw Error(s(166));if(p=ei(eo.current),ei(Us.current),Ia(l)){if(w=l.stateNode,p=l.memoizedProps,w[Hs]=l,(R=w.nodeValue!==p)&&(n=ns,n!==null))switch(n.tag){case 3:Ma(w.nodeValue,p,(n.mode&1)!==0);break;case 5:n.memoizedProps.suppressHydrationWarning!==!0&&Ma(w.nodeValue,p,(n.mode&1)!==0)}R&&(l.flags|=4)}else w=(p.nodeType===9?p:p.ownerDocument).createTextNode(w),w[Hs]=l,l.stateNode=w}return Bt(l),null;case 13:if(Xe(Je),w=l.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(Ze&&os!==null&&(l.mode&1)!==0&&(l.flags&128)===0)Hm(),qi(),l.flags|=98560,R=!1;else if(R=Ia(l),w!==null&&w.dehydrated!==null){if(n===null){if(!R)throw Error(s(318));if(R=l.memoizedState,R=R!==null?R.dehydrated:null,!R)throw Error(s(317));R[Hs]=l}else qi(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Bt(l),R=!1}else Ps!==null&&(pu(Ps),Ps=null),R=!0;if(!R)return l.flags&65536?l:null}return(l.flags&128)!==0?(l.lanes=p,l):(w=w!==null,w!==(n!==null&&n.memoizedState!==null)&&w&&(l.child.flags|=8192,(l.mode&1)!==0&&(n===null||(Je.current&1)!==0?_t===0&&(_t=3):_u())),l.updateQueue!==null&&(l.flags|=4),Bt(l),null);case 4:return Qi(),ru(n,l),n===null&&qn(l.stateNode.containerInfo),Bt(l),null;case 10:return Rh(l.type._context),Bt(l),null;case 17:return Yt(l.type)&&Ra(),Bt(l),null;case 19:if(Xe(Je),R=l.memoizedState,R===null)return Bt(l),null;if(w=(l.flags&128)!==0,j=R.rendering,j===null)if(w)no(R,!1);else{if(_t!==0||n!==null&&(n.flags&128)!==0)for(n=l.child;n!==null;){if(j=Ua(n),j!==null){for(l.flags|=128,no(R,!1),w=j.updateQueue,w!==null&&(l.updateQueue=w,l.flags|=4),l.subtreeFlags=0,w=p,p=l.child;p!==null;)R=p,n=w,R.flags&=14680066,j=R.alternate,j===null?(R.childLanes=0,R.lanes=n,R.child=null,R.subtreeFlags=0,R.memoizedProps=null,R.memoizedState=null,R.updateQueue=null,R.dependencies=null,R.stateNode=null):(R.childLanes=j.childLanes,R.lanes=j.lanes,R.child=j.child,R.subtreeFlags=0,R.deletions=null,R.memoizedProps=j.memoizedProps,R.memoizedState=j.memoizedState,R.updateQueue=j.updateQueue,R.type=j.type,n=j.dependencies,R.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),p=p.sibling;return qe(Je,Je.current&1|2),l.child}n=n.sibling}R.tail!==null&&at()>tn&&(l.flags|=128,w=!0,no(R,!1),l.lanes=4194304)}else{if(!w)if(n=Ua(j),n!==null){if(l.flags|=128,w=!0,p=n.updateQueue,p!==null&&(l.updateQueue=p,l.flags|=4),no(R,!0),R.tail===null&&R.tailMode==="hidden"&&!j.alternate&&!Ze)return Bt(l),null}else 2*at()-R.renderingStartTime>tn&&p!==1073741824&&(l.flags|=128,w=!0,no(R,!1),l.lanes=4194304);R.isBackwards?(j.sibling=l.child,l.child=j):(p=R.last,p!==null?p.sibling=j:l.child=j,R.last=j)}return R.tail!==null?(l=R.tail,R.rendering=l,R.tail=l.sibling,R.renderingStartTime=at(),l.sibling=null,p=Je.current,qe(Je,w?p&1|2:p&1),l):(Bt(l),null);case 22:case 23:return gu(),w=l.memoizedState!==null,n!==null&&n.memoizedState!==null!==w&&(l.flags|=8192),w&&(l.mode&1)!==0?(as&1073741824)!==0&&(Bt(l),l.subtreeFlags&6&&(l.flags|=8192)):Bt(l),null;case 24:return null;case 25:return null}throw Error(s(156,l.tag))}function LS(n,l){switch(kh(l),l.tag){case 1:return Yt(l.type)&&Ra(),n=l.flags,n&65536?(l.flags=n&-65537|128,l):null;case 3:return Qi(),Xe(Kt),Xe(Dt),Oh(),n=l.flags,(n&65536)!==0&&(n&128)===0?(l.flags=n&-65537|128,l):null;case 5:return Ih(l),null;case 13:if(Xe(Je),n=l.memoizedState,n!==null&&n.dehydrated!==null){if(l.alternate===null)throw Error(s(340));qi()}return n=l.flags,n&65536?(l.flags=n&-65537|128,l):null;case 19:return Xe(Je),null;case 4:return Qi(),null;case 10:return Rh(l.type._context),null;case 22:case 23:return gu(),null;case 24:return null;default:return null}}var Qa=!1,jt=!1,BS=typeof WeakSet=="function"?WeakSet:Set,ve=null;function Ji(n,l){var p=n.ref;if(p!==null)if(typeof p=="function")try{p(null)}catch(w){it(n,l,w)}else p.current=null}function iu(n,l,p){try{p()}catch(w){it(n,l,w)}}var Fg=!1;function jS(n,l){if(gh=_a,n=_m(),lh(n)){if("selectionStart"in n)var p={start:n.selectionStart,end:n.selectionEnd};else e:{p=(p=n.ownerDocument)&&p.defaultView||window;var w=p.getSelection&&p.getSelection();if(w&&w.rangeCount!==0){p=w.anchorNode;var M=w.anchorOffset,R=w.focusNode;w=w.focusOffset;try{p.nodeType,R.nodeType}catch{p=null;break e}var j=0,W=-1,G=-1,te=0,ce=0,ue=n,le=null;t:for(;;){for(var _e;ue!==p||M!==0&&ue.nodeType!==3||(W=j+M),ue!==R||w!==0&&ue.nodeType!==3||(G=j+w),ue.nodeType===3&&(j+=ue.nodeValue.length),(_e=ue.firstChild)!==null;)le=ue,ue=_e;for(;;){if(ue===n)break t;if(le===p&&++te===M&&(W=j),le===R&&++ce===w&&(G=j),(_e=ue.nextSibling)!==null)break;ue=le,le=ue.parentNode}ue=_e}p=W===-1||G===-1?null:{start:W,end:G}}else p=null}p=p||{start:0,end:0}}else p=null;for(_h={focusedElem:n,selectionRange:p},_a=!1,ve=l;ve!==null;)if(l=ve,n=l.child,(l.subtreeFlags&1028)!==0&&n!==null)n.return=l,ve=n;else for(;ve!==null;){l=ve;try{var xe=l.alternate;if((l.flags&1024)!==0)switch(l.tag){case 0:case 11:case 15:break;case 1:if(xe!==null){var ye=xe.memoizedProps,lt=xe.memoizedState,X=l.stateNode,q=X.getSnapshotBeforeUpdate(l.elementType===l.type?ye:Ms(l.type,ye),lt);X.__reactInternalSnapshotBeforeUpdate=q}break;case 3:var ee=l.stateNode.containerInfo;ee.nodeType===1?ee.textContent="":ee.nodeType===9&&ee.documentElement&&ee.removeChild(ee.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(s(163))}}catch(de){it(l,l.return,de)}if(n=l.sibling,n!==null){n.return=l.return,ve=n;break}ve=l.return}return xe=Fg,Fg=!1,xe}function oo(n,l,p){var w=l.updateQueue;if(w=w!==null?w.lastEffect:null,w!==null){var M=w=w.next;do{if((M.tag&n)===n){var R=M.destroy;M.destroy=void 0,R!==void 0&&iu(l,p,R)}M=M.next}while(M!==w)}}function Za(n,l){if(l=l.updateQueue,l=l!==null?l.lastEffect:null,l!==null){var p=l=l.next;do{if((p.tag&n)===n){var w=p.create;p.destroy=w()}p=p.next}while(p!==l)}}function nu(n){var l=n.ref;if(l!==null){var p=n.stateNode;switch(n.tag){case 5:n=p;break;default:n=p}typeof l=="function"?l(n):l.current=n}}function $g(n){var l=n.alternate;l!==null&&(n.alternate=null,$g(l)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(l=n.stateNode,l!==null&&(delete l[Hs],delete l[Yn],delete l[bh],delete l[_S],delete l[vS])),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}function Hg(n){return n.tag===5||n.tag===3||n.tag===4}function Ug(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||Hg(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function ou(n,l,p){var w=n.tag;if(w===5||w===6)n=n.stateNode,l?p.nodeType===8?p.parentNode.insertBefore(n,l):p.insertBefore(n,l):(p.nodeType===8?(l=p.parentNode,l.insertBefore(n,p)):(l=p,l.appendChild(n)),p=p._reactRootContainer,p!=null||l.onclick!==null||(l.onclick=Aa));else if(w!==4&&(n=n.child,n!==null))for(ou(n,l,p),n=n.sibling;n!==null;)ou(n,l,p),n=n.sibling}function au(n,l,p){var w=n.tag;if(w===5||w===6)n=n.stateNode,l?p.insertBefore(n,l):p.appendChild(n);else if(w!==4&&(n=n.child,n!==null))for(au(n,l,p),n=n.sibling;n!==null;)au(n,l,p),n=n.sibling}var At=null,As=!1;function Dr(n,l,p){for(p=p.child;p!==null;)Wg(n,l,p),p=p.sibling}function Wg(n,l,p){if($s&&typeof $s.onCommitFiberUnmount=="function")try{$s.onCommitFiberUnmount(ua,p)}catch{}switch(p.tag){case 5:jt||Ji(p,l);case 6:var w=At,M=As;At=null,Dr(n,l,p),At=w,As=M,At!==null&&(As?(n=At,p=p.stateNode,n.nodeType===8?n.parentNode.removeChild(p):n.removeChild(p)):At.removeChild(p.stateNode));break;case 18:At!==null&&(As?(n=At,p=p.stateNode,n.nodeType===8?yh(n.parentNode,p):n.nodeType===1&&yh(n,p),On(n)):yh(At,p.stateNode));break;case 4:w=At,M=As,At=p.stateNode.containerInfo,As=!0,Dr(n,l,p),At=w,As=M;break;case 0:case 11:case 14:case 15:if(!jt&&(w=p.updateQueue,w!==null&&(w=w.lastEffect,w!==null))){M=w=w.next;do{var R=M,j=R.destroy;R=R.tag,j!==void 0&&((R&2)!==0||(R&4)!==0)&&iu(p,l,j),M=M.next}while(M!==w)}Dr(n,l,p);break;case 1:if(!jt&&(Ji(p,l),w=p.stateNode,typeof w.componentWillUnmount=="function"))try{w.props=p.memoizedProps,w.state=p.memoizedState,w.componentWillUnmount()}catch(W){it(p,l,W)}Dr(n,l,p);break;case 21:Dr(n,l,p);break;case 22:p.mode&1?(jt=(w=jt)||p.memoizedState!==null,Dr(n,l,p),jt=w):Dr(n,l,p);break;default:Dr(n,l,p)}}function zg(n){var l=n.updateQueue;if(l!==null){n.updateQueue=null;var p=n.stateNode;p===null&&(p=n.stateNode=new BS),l.forEach(function(w){var M=zS.bind(null,n,w);p.has(w)||(p.add(w),w.then(M,M))})}}function Ts(n,l){var p=l.deletions;if(p!==null)for(var w=0;w<p.length;w++){var M=p[w];try{var R=n,j=l,W=j;e:for(;W!==null;){switch(W.tag){case 5:At=W.stateNode,As=!1;break e;case 3:At=W.stateNode.containerInfo,As=!0;break e;case 4:At=W.stateNode.containerInfo,As=!0;break e}W=W.return}if(At===null)throw Error(s(160));Wg(R,j,M),At=null,As=!1;var G=M.alternate;G!==null&&(G.return=null),M.return=null}catch(te){it(M,l,te)}}if(l.subtreeFlags&12854)for(l=l.child;l!==null;)Vg(l,n),l=l.sibling}function Vg(n,l){var p=n.alternate,w=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:if(Ts(l,n),zs(n),w&4){try{oo(3,n,n.return),Za(3,n)}catch(ye){it(n,n.return,ye)}try{oo(5,n,n.return)}catch(ye){it(n,n.return,ye)}}break;case 1:Ts(l,n),zs(n),w&512&&p!==null&&Ji(p,p.return);break;case 5:if(Ts(l,n),zs(n),w&512&&p!==null&&Ji(p,p.return),n.flags&32){var M=n.stateNode;try{qt(M,"")}catch(ye){it(n,n.return,ye)}}if(w&4&&(M=n.stateNode,M!=null)){var R=n.memoizedProps,j=p!==null?p.memoizedProps:R,W=n.type,G=n.updateQueue;if(n.updateQueue=null,G!==null)try{W==="input"&&R.type==="radio"&&R.name!=null&&mt(M,R),Oc(W,j);var te=Oc(W,R);for(j=0;j<G.length;j+=2){var ce=G[j],ue=G[j+1];ce==="style"?Pp(M,ue):ce==="dangerouslySetInnerHTML"?qr(M,ue):ce==="children"?qt(M,ue):b(M,ce,ue,te)}switch(W){case"input":Pe(M,R);break;case"textarea":vr(M,R);break;case"select":var le=M._wrapperState.wasMultiple;M._wrapperState.wasMultiple=!!R.multiple;var _e=R.value;_e!=null?Fs(M,!!R.multiple,_e,!1):le!==!!R.multiple&&(R.defaultValue!=null?Fs(M,!!R.multiple,R.defaultValue,!0):Fs(M,!!R.multiple,R.multiple?[]:"",!1))}M[Yn]=R}catch(ye){it(n,n.return,ye)}}break;case 6:if(Ts(l,n),zs(n),w&4){if(n.stateNode===null)throw Error(s(162));M=n.stateNode,R=n.memoizedProps;try{M.nodeValue=R}catch(ye){it(n,n.return,ye)}}break;case 3:if(Ts(l,n),zs(n),w&4&&p!==null&&p.memoizedState.isDehydrated)try{On(l.containerInfo)}catch(ye){it(n,n.return,ye)}break;case 4:Ts(l,n),zs(n);break;case 13:Ts(l,n),zs(n),M=n.child,M.flags&8192&&(R=M.memoizedState!==null,M.stateNode.isHidden=R,!R||M.alternate!==null&&M.alternate.memoizedState!==null||(hu=at())),w&4&&zg(n);break;case 22:if(ce=p!==null&&p.memoizedState!==null,n.mode&1?(jt=(te=jt)||ce,Ts(l,n),jt=te):Ts(l,n),zs(n),w&8192){if(te=n.memoizedState!==null,(n.stateNode.isHidden=te)&&!ce&&(n.mode&1)!==0)for(ve=n,ce=n.child;ce!==null;){for(ue=ve=ce;ve!==null;){switch(le=ve,_e=le.child,le.tag){case 0:case 11:case 14:case 15:oo(4,le,le.return);break;case 1:Ji(le,le.return);var xe=le.stateNode;if(typeof xe.componentWillUnmount=="function"){w=le,p=le.return;try{l=w,xe.props=l.memoizedProps,xe.state=l.memoizedState,xe.componentWillUnmount()}catch(ye){it(w,p,ye)}}break;case 5:Ji(le,le.return);break;case 22:if(le.memoizedState!==null){Kg(ue);continue}}_e!==null?(_e.return=le,ve=_e):Kg(ue)}ce=ce.sibling}e:for(ce=null,ue=n;;){if(ue.tag===5){if(ce===null){ce=ue;try{M=ue.stateNode,te?(R=M.style,typeof R.setProperty=="function"?R.setProperty("display","none","important"):R.display="none"):(W=ue.stateNode,G=ue.memoizedProps.style,j=G!=null&&G.hasOwnProperty("display")?G.display:null,W.style.display=aa("display",j))}catch(ye){it(n,n.return,ye)}}}else if(ue.tag===6){if(ce===null)try{ue.stateNode.nodeValue=te?"":ue.memoizedProps}catch(ye){it(n,n.return,ye)}}else if((ue.tag!==22&&ue.tag!==23||ue.memoizedState===null||ue===n)&&ue.child!==null){ue.child.return=ue,ue=ue.child;continue}if(ue===n)break e;for(;ue.sibling===null;){if(ue.return===null||ue.return===n)break e;ce===ue&&(ce=null),ue=ue.return}ce===ue&&(ce=null),ue.sibling.return=ue.return,ue=ue.sibling}}break;case 19:Ts(l,n),zs(n),w&4&&zg(n);break;case 21:break;default:Ts(l,n),zs(n)}}function zs(n){var l=n.flags;if(l&2){try{e:{for(var p=n.return;p!==null;){if(Hg(p)){var w=p;break e}p=p.return}throw Error(s(160))}switch(w.tag){case 5:var M=w.stateNode;w.flags&32&&(qt(M,""),w.flags&=-33);var R=Ug(n);au(n,R,M);break;case 3:case 4:var j=w.stateNode.containerInfo,W=Ug(n);ou(n,W,j);break;default:throw Error(s(161))}}catch(G){it(n,n.return,G)}n.flags&=-3}l&4096&&(n.flags&=-4097)}function IS(n,l,p){ve=n,Gg(n)}function Gg(n,l,p){for(var w=(n.mode&1)!==0;ve!==null;){var M=ve,R=M.child;if(M.tag===22&&w){var j=M.memoizedState!==null||Qa;if(!j){var W=M.alternate,G=W!==null&&W.memoizedState!==null||jt;W=Qa;var te=jt;if(Qa=j,(jt=G)&&!te)for(ve=M;ve!==null;)j=ve,G=j.child,j.tag===22&&j.memoizedState!==null?Yg(M):G!==null?(G.return=j,ve=G):Yg(M);for(;R!==null;)ve=R,Gg(R),R=R.sibling;ve=M,Qa=W,jt=te}qg(n)}else(M.subtreeFlags&8772)!==0&&R!==null?(R.return=M,ve=R):qg(n)}}function qg(n){for(;ve!==null;){var l=ve;if((l.flags&8772)!==0){var p=l.alternate;try{if((l.flags&8772)!==0)switch(l.tag){case 0:case 11:case 15:jt||Za(5,l);break;case 1:var w=l.stateNode;if(l.flags&4&&!jt)if(p===null)w.componentDidMount();else{var M=l.elementType===l.type?p.memoizedProps:Ms(l.type,p.memoizedProps);w.componentDidUpdate(M,p.memoizedState,w.__reactInternalSnapshotBeforeUpdate)}var R=l.updateQueue;R!==null&&Km(l,R,w);break;case 3:var j=l.updateQueue;if(j!==null){if(p=null,l.child!==null)switch(l.child.tag){case 5:p=l.child.stateNode;break;case 1:p=l.child.stateNode}Km(l,j,p)}break;case 5:var W=l.stateNode;if(p===null&&l.flags&4){p=W;var G=l.memoizedProps;switch(l.type){case"button":case"input":case"select":case"textarea":G.autoFocus&&p.focus();break;case"img":G.src&&(p.src=G.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(l.memoizedState===null){var te=l.alternate;if(te!==null){var ce=te.memoizedState;if(ce!==null){var ue=ce.dehydrated;ue!==null&&On(ue)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(s(163))}jt||l.flags&512&&nu(l)}catch(le){it(l,l.return,le)}}if(l===n){ve=null;break}if(p=l.sibling,p!==null){p.return=l.return,ve=p;break}ve=l.return}}function Kg(n){for(;ve!==null;){var l=ve;if(l===n){ve=null;break}var p=l.sibling;if(p!==null){p.return=l.return,ve=p;break}ve=l.return}}function Yg(n){for(;ve!==null;){var l=ve;try{switch(l.tag){case 0:case 11:case 15:var p=l.return;try{Za(4,l)}catch(G){it(l,p,G)}break;case 1:var w=l.stateNode;if(typeof w.componentDidMount=="function"){var M=l.return;try{w.componentDidMount()}catch(G){it(l,M,G)}}var R=l.return;try{nu(l)}catch(G){it(l,R,G)}break;case 5:var j=l.return;try{nu(l)}catch(G){it(l,j,G)}}}catch(G){it(l,l.return,G)}if(l===n){ve=null;break}var W=l.sibling;if(W!==null){W.return=l.return,ve=W;break}ve=l.return}}var NS=Math.ceil,Ja=C.ReactCurrentDispatcher,lu=C.ReactCurrentOwner,_s=C.ReactCurrentBatchConfig,He=0,wt=null,ut=null,Tt=0,as=0,en=Pr(0),_t=0,ao=null,si=0,el=0,cu=0,lo=null,Qt=null,hu=0,tn=1/0,ar=null,tl=!1,uu=null,Lr=null,sl=!1,Br=null,rl=0,co=0,du=null,il=-1,nl=0;function zt(){return(He&6)!==0?at():il!==-1?il:il=at()}function jr(n){return(n.mode&1)===0?1:(He&2)!==0&&Tt!==0?Tt&-Tt:yS.transition!==null?(nl===0&&(nl=Up()),nl):(n=ze,n!==0||(n=window.event,n=n===void 0?16:Qp(n.type)),n)}function Rs(n,l,p,w){if(50<co)throw co=0,du=null,Error(s(185));Ln(n,p,w),((He&2)===0||n!==wt)&&(n===wt&&((He&2)===0&&(el|=p),_t===4&&Ir(n,Tt)),Zt(n,w),p===1&&He===0&&(l.mode&1)===0&&(tn=at()+500,La&&Ar()))}function Zt(n,l){var p=n.callbackNode;yw(n,l);var w=pa(n,n===wt?Tt:0);if(w===0)p!==null&&Fp(p),n.callbackNode=null,n.callbackPriority=0;else if(l=w&-w,n.callbackPriority!==l){if(p!=null&&Fp(p),l===1)n.tag===0?xS(Qg.bind(null,n)):Im(Qg.bind(null,n)),mS(function(){(He&6)===0&&Ar()}),p=null;else{switch(Wp(w)){case 1:p=Vc;break;case 4:p=$p;break;case 16:p=ha;break;case 536870912:p=Hp;break;default:p=ha}p=n_(p,Xg.bind(null,n))}n.callbackPriority=l,n.callbackNode=p}}function Xg(n,l){if(il=-1,nl=0,(He&6)!==0)throw Error(s(327));var p=n.callbackNode;if(sn()&&n.callbackNode!==p)return null;var w=pa(n,n===wt?Tt:0);if(w===0)return null;if((w&30)!==0||(w&n.expiredLanes)!==0||l)l=ol(n,w);else{l=w;var M=He;He|=2;var R=Jg();(wt!==n||Tt!==l)&&(ar=null,tn=at()+500,ii(n,l));do try{$S();break}catch(W){Zg(n,W)}while(!0);Th(),Ja.current=R,He=M,ut!==null?l=0:(wt=null,Tt=0,l=_t)}if(l!==0){if(l===2&&(M=Gc(n),M!==0&&(w=M,l=fu(n,M))),l===1)throw p=ao,ii(n,0),Ir(n,w),Zt(n,at()),p;if(l===6)Ir(n,w);else{if(M=n.current.alternate,(w&30)===0&&!OS(M)&&(l=ol(n,w),l===2&&(R=Gc(n),R!==0&&(w=R,l=fu(n,R))),l===1))throw p=ao,ii(n,0),Ir(n,w),Zt(n,at()),p;switch(n.finishedWork=M,n.finishedLanes=w,l){case 0:case 1:throw Error(s(345));case 2:ni(n,Qt,ar);break;case 3:if(Ir(n,w),(w&130023424)===w&&(l=hu+500-at(),10<l)){if(pa(n,0)!==0)break;if(M=n.suspendedLanes,(M&w)!==w){zt(),n.pingedLanes|=n.suspendedLanes&M;break}n.timeoutHandle=xh(ni.bind(null,n,Qt,ar),l);break}ni(n,Qt,ar);break;case 4:if(Ir(n,w),(w&4194240)===w)break;for(l=n.eventTimes,M=-1;0<w;){var j=31-ks(w);R=1<<j,j=l[j],j>M&&(M=j),w&=~R}if(w=M,w=at()-w,w=(120>w?120:480>w?480:1080>w?1080:1920>w?1920:3e3>w?3e3:4320>w?4320:1960*NS(w/1960))-w,10<w){n.timeoutHandle=xh(ni.bind(null,n,Qt,ar),w);break}ni(n,Qt,ar);break;case 5:ni(n,Qt,ar);break;default:throw Error(s(329))}}}return Zt(n,at()),n.callbackNode===p?Xg.bind(null,n):null}function fu(n,l){var p=lo;return n.current.memoizedState.isDehydrated&&(ii(n,l).flags|=256),n=ol(n,l),n!==2&&(l=Qt,Qt=p,l!==null&&pu(l)),n}function pu(n){Qt===null?Qt=n:Qt.push.apply(Qt,n)}function OS(n){for(var l=n;;){if(l.flags&16384){var p=l.updateQueue;if(p!==null&&(p=p.stores,p!==null))for(var w=0;w<p.length;w++){var M=p[w],R=M.getSnapshot;M=M.value;try{if(!Es(R(),M))return!1}catch{return!1}}}if(p=l.child,l.subtreeFlags&16384&&p!==null)p.return=l,l=p;else{if(l===n)break;for(;l.sibling===null;){if(l.return===null||l.return===n)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function Ir(n,l){for(l&=~cu,l&=~el,n.suspendedLanes|=l,n.pingedLanes&=~l,n=n.expirationTimes;0<l;){var p=31-ks(l),w=1<<p;n[p]=-1,l&=~w}}function Qg(n){if((He&6)!==0)throw Error(s(327));sn();var l=pa(n,0);if((l&1)===0)return Zt(n,at()),null;var p=ol(n,l);if(n.tag!==0&&p===2){var w=Gc(n);w!==0&&(l=w,p=fu(n,w))}if(p===1)throw p=ao,ii(n,0),Ir(n,l),Zt(n,at()),p;if(p===6)throw Error(s(345));return n.finishedWork=n.current.alternate,n.finishedLanes=l,ni(n,Qt,ar),Zt(n,at()),null}function mu(n,l){var p=He;He|=1;try{return n(l)}finally{He=p,He===0&&(tn=at()+500,La&&Ar())}}function ri(n){Br!==null&&Br.tag===0&&(He&6)===0&&sn();var l=He;He|=1;var p=_s.transition,w=ze;try{if(_s.transition=null,ze=1,n)return n()}finally{ze=w,_s.transition=p,He=l,(He&6)===0&&Ar()}}function gu(){as=en.current,Xe(en)}function ii(n,l){n.finishedWork=null,n.finishedLanes=0;var p=n.timeoutHandle;if(p!==-1&&(n.timeoutHandle=-1,pS(p)),ut!==null)for(p=ut.return;p!==null;){var w=p;switch(kh(w),w.tag){case 1:w=w.type.childContextTypes,w!=null&&Ra();break;case 3:Qi(),Xe(Kt),Xe(Dt),Oh();break;case 5:Ih(w);break;case 4:Qi();break;case 13:Xe(Je);break;case 19:Xe(Je);break;case 10:Rh(w.type._context);break;case 22:case 23:gu()}p=p.return}if(wt=n,ut=n=Nr(n.current,null),Tt=as=l,_t=0,ao=null,cu=el=si=0,Qt=lo=null,Jr!==null){for(l=0;l<Jr.length;l++)if(p=Jr[l],w=p.interleaved,w!==null){p.interleaved=null;var M=w.next,R=p.pending;if(R!==null){var j=R.next;R.next=M,w.next=j}p.pending=w}Jr=null}return n}function Zg(n,l){do{var p=ut;try{if(Th(),Wa.current=qa,za){for(var w=et.memoizedState;w!==null;){var M=w.queue;M!==null&&(M.pending=null),w=w.next}za=!1}if(ti=0,bt=gt=et=null,to=!1,so=0,lu.current=null,p===null||p.return===null){_t=1,ao=l,ut=null;break}e:{var R=n,j=p.return,W=p,G=l;if(l=Tt,W.flags|=32768,G!==null&&typeof G=="object"&&typeof G.then=="function"){var te=G,ce=W,ue=ce.tag;if((ce.mode&1)===0&&(ue===0||ue===11||ue===15)){var le=ce.alternate;le?(ce.updateQueue=le.updateQueue,ce.memoizedState=le.memoizedState,ce.lanes=le.lanes):(ce.updateQueue=null,ce.memoizedState=null)}var _e=Sg(j);if(_e!==null){_e.flags&=-257,Cg(_e,j,W,R,l),_e.mode&1&&wg(R,te,l),l=_e,G=te;var xe=l.updateQueue;if(xe===null){var ye=new Set;ye.add(G),l.updateQueue=ye}else xe.add(G);break e}else{if((l&1)===0){wg(R,te,l),_u();break e}G=Error(s(426))}}else if(Ze&&W.mode&1){var lt=Sg(j);if(lt!==null){(lt.flags&65536)===0&&(lt.flags|=256),Cg(lt,j,W,R,l),Mh(Zi(G,W));break e}}R=G=Zi(G,W),_t!==4&&(_t=2),lo===null?lo=[R]:lo.push(R),R=j;do{switch(R.tag){case 3:R.flags|=65536,l&=-l,R.lanes|=l;var X=yg(R,G,l);qm(R,X);break e;case 1:W=G;var q=R.type,ee=R.stateNode;if((R.flags&128)===0&&(typeof q.getDerivedStateFromError=="function"||ee!==null&&typeof ee.componentDidCatch=="function"&&(Lr===null||!Lr.has(ee)))){R.flags|=65536,l&=-l,R.lanes|=l;var de=bg(R,W,l);qm(R,de);break e}}R=R.return}while(R!==null)}t_(p)}catch(we){l=we,ut===p&&p!==null&&(ut=p=p.return);continue}break}while(!0)}function Jg(){var n=Ja.current;return Ja.current=qa,n===null?qa:n}function _u(){(_t===0||_t===3||_t===2)&&(_t=4),wt===null||(si&268435455)===0&&(el&268435455)===0||Ir(wt,Tt)}function ol(n,l){var p=He;He|=2;var w=Jg();(wt!==n||Tt!==l)&&(ar=null,ii(n,l));do try{FS();break}catch(M){Zg(n,M)}while(!0);if(Th(),He=p,Ja.current=w,ut!==null)throw Error(s(261));return wt=null,Tt=0,_t}function FS(){for(;ut!==null;)e_(ut)}function $S(){for(;ut!==null&&!uw();)e_(ut)}function e_(n){var l=i_(n.alternate,n,as);n.memoizedProps=n.pendingProps,l===null?t_(n):ut=l,lu.current=null}function t_(n){var l=n;do{var p=l.alternate;if(n=l.return,(l.flags&32768)===0){if(p=DS(p,l,as),p!==null){ut=p;return}}else{if(p=LS(p,l),p!==null){p.flags&=32767,ut=p;return}if(n!==null)n.flags|=32768,n.subtreeFlags=0,n.deletions=null;else{_t=6,ut=null;return}}if(l=l.sibling,l!==null){ut=l;return}ut=l=n}while(l!==null);_t===0&&(_t=5)}function ni(n,l,p){var w=ze,M=_s.transition;try{_s.transition=null,ze=1,HS(n,l,p,w)}finally{_s.transition=M,ze=w}return null}function HS(n,l,p,w){do sn();while(Br!==null);if((He&6)!==0)throw Error(s(327));p=n.finishedWork;var M=n.finishedLanes;if(p===null)return null;if(n.finishedWork=null,n.finishedLanes=0,p===n.current)throw Error(s(177));n.callbackNode=null,n.callbackPriority=0;var R=p.lanes|p.childLanes;if(bw(n,R),n===wt&&(ut=wt=null,Tt=0),(p.subtreeFlags&2064)===0&&(p.flags&2064)===0||sl||(sl=!0,n_(ha,function(){return sn(),null})),R=(p.flags&15990)!==0,(p.subtreeFlags&15990)!==0||R){R=_s.transition,_s.transition=null;var j=ze;ze=1;var W=He;He|=4,lu.current=null,jS(n,p),Vg(p,n),aS(_h),_a=!!gh,_h=gh=null,n.current=p,IS(p),dw(),He=W,ze=j,_s.transition=R}else n.current=p;if(sl&&(sl=!1,Br=n,rl=M),R=n.pendingLanes,R===0&&(Lr=null),mw(p.stateNode),Zt(n,at()),l!==null)for(w=n.onRecoverableError,p=0;p<l.length;p++)M=l[p],w(M.value,{componentStack:M.stack,digest:M.digest});if(tl)throw tl=!1,n=uu,uu=null,n;return(rl&1)!==0&&n.tag!==0&&sn(),R=n.pendingLanes,(R&1)!==0?n===du?co++:(co=0,du=n):co=0,Ar(),null}function sn(){if(Br!==null){var n=Wp(rl),l=_s.transition,p=ze;try{if(_s.transition=null,ze=16>n?16:n,Br===null)var w=!1;else{if(n=Br,Br=null,rl=0,(He&6)!==0)throw Error(s(331));var M=He;for(He|=4,ve=n.current;ve!==null;){var R=ve,j=R.child;if((ve.flags&16)!==0){var W=R.deletions;if(W!==null){for(var G=0;G<W.length;G++){var te=W[G];for(ve=te;ve!==null;){var ce=ve;switch(ce.tag){case 0:case 11:case 15:oo(8,ce,R)}var ue=ce.child;if(ue!==null)ue.return=ce,ve=ue;else for(;ve!==null;){ce=ve;var le=ce.sibling,_e=ce.return;if($g(ce),ce===te){ve=null;break}if(le!==null){le.return=_e,ve=le;break}ve=_e}}}var xe=R.alternate;if(xe!==null){var ye=xe.child;if(ye!==null){xe.child=null;do{var lt=ye.sibling;ye.sibling=null,ye=lt}while(ye!==null)}}ve=R}}if((R.subtreeFlags&2064)!==0&&j!==null)j.return=R,ve=j;else e:for(;ve!==null;){if(R=ve,(R.flags&2048)!==0)switch(R.tag){case 0:case 11:case 15:oo(9,R,R.return)}var X=R.sibling;if(X!==null){X.return=R.return,ve=X;break e}ve=R.return}}var q=n.current;for(ve=q;ve!==null;){j=ve;var ee=j.child;if((j.subtreeFlags&2064)!==0&&ee!==null)ee.return=j,ve=ee;else e:for(j=q;ve!==null;){if(W=ve,(W.flags&2048)!==0)try{switch(W.tag){case 0:case 11:case 15:Za(9,W)}}catch(we){it(W,W.return,we)}if(W===j){ve=null;break e}var de=W.sibling;if(de!==null){de.return=W.return,ve=de;break e}ve=W.return}}if(He=M,Ar(),$s&&typeof $s.onPostCommitFiberRoot=="function")try{$s.onPostCommitFiberRoot(ua,n)}catch{}w=!0}return w}finally{ze=p,_s.transition=l}}return!1}function s_(n,l,p){l=Zi(p,l),l=yg(n,l,1),n=Rr(n,l,1),l=zt(),n!==null&&(Ln(n,1,l),Zt(n,l))}function it(n,l,p){if(n.tag===3)s_(n,n,p);else for(;l!==null;){if(l.tag===3){s_(l,n,p);break}else if(l.tag===1){var w=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof w.componentDidCatch=="function"&&(Lr===null||!Lr.has(w))){n=Zi(p,n),n=bg(l,n,1),l=Rr(l,n,1),n=zt(),l!==null&&(Ln(l,1,n),Zt(l,n));break}}l=l.return}}function US(n,l,p){var w=n.pingCache;w!==null&&w.delete(l),l=zt(),n.pingedLanes|=n.suspendedLanes&p,wt===n&&(Tt&p)===p&&(_t===4||_t===3&&(Tt&130023424)===Tt&&500>at()-hu?ii(n,0):cu|=p),Zt(n,l)}function r_(n,l){l===0&&((n.mode&1)===0?l=1:(l=fa,fa<<=1,(fa&130023424)===0&&(fa=4194304)));var p=zt();n=ir(n,l),n!==null&&(Ln(n,l,p),Zt(n,p))}function WS(n){var l=n.memoizedState,p=0;l!==null&&(p=l.retryLane),r_(n,p)}function zS(n,l){var p=0;switch(n.tag){case 13:var w=n.stateNode,M=n.memoizedState;M!==null&&(p=M.retryLane);break;case 19:w=n.stateNode;break;default:throw Error(s(314))}w!==null&&w.delete(l),r_(n,p)}var i_;i_=function(n,l,p){if(n!==null)if(n.memoizedProps!==l.pendingProps||Kt.current)Xt=!0;else{if((n.lanes&p)===0&&(l.flags&128)===0)return Xt=!1,RS(n,l,p);Xt=(n.flags&131072)!==0}else Xt=!1,Ze&&(l.flags&1048576)!==0&&Nm(l,ja,l.index);switch(l.lanes=0,l.tag){case 2:var w=l.type;Xa(n,l),n=l.pendingProps;var M=zi(l,Dt.current);Xi(l,p),M=Hh(null,l,w,n,M,p);var R=Uh();return l.flags|=1,typeof M=="object"&&M!==null&&typeof M.render=="function"&&M.$$typeof===void 0?(l.tag=1,l.memoizedState=null,l.updateQueue=null,Yt(w)?(R=!0,Da(l)):R=!1,l.memoizedState=M.state!==null&&M.state!==void 0?M.state:null,Bh(l),M.updater=Ka,l.stateNode=M,M._reactInternals=l,Kh(l,w,n,p),l=Zh(null,l,w,!0,R,p)):(l.tag=0,Ze&&R&&Ch(l),Wt(null,l,M,p),l=l.child),l;case 16:w=l.elementType;e:{switch(Xa(n,l),n=l.pendingProps,M=w._init,w=M(w._payload),l.type=w,M=l.tag=GS(w),n=Ms(w,n),M){case 0:l=Qh(null,l,w,n,p);break e;case 1:l=Tg(null,l,w,n,p);break e;case 11:l=kg(null,l,w,n,p);break e;case 14:l=Eg(null,l,w,Ms(w.type,n),p);break e}throw Error(s(306,w,""))}return l;case 0:return w=l.type,M=l.pendingProps,M=l.elementType===w?M:Ms(w,M),Qh(n,l,w,M,p);case 1:return w=l.type,M=l.pendingProps,M=l.elementType===w?M:Ms(w,M),Tg(n,l,w,M,p);case 3:e:{if(Rg(l),n===null)throw Error(s(387));w=l.pendingProps,R=l.memoizedState,M=R.element,Gm(n,l),Ha(l,w,null,p);var j=l.memoizedState;if(w=j.element,R.isDehydrated)if(R={element:w,isDehydrated:!1,cache:j.cache,pendingSuspenseBoundaries:j.pendingSuspenseBoundaries,transitions:j.transitions},l.updateQueue.baseState=R,l.memoizedState=R,l.flags&256){M=Zi(Error(s(423)),l),l=Dg(n,l,w,p,M);break e}else if(w!==M){M=Zi(Error(s(424)),l),l=Dg(n,l,w,p,M);break e}else for(os=Er(l.stateNode.containerInfo.firstChild),ns=l,Ze=!0,Ps=null,p=zm(l,null,w,p),l.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling;else{if(qi(),w===M){l=or(n,l,p);break e}Wt(n,l,w,p)}l=l.child}return l;case 5:return Ym(l),n===null&&Ph(l),w=l.type,M=l.pendingProps,R=n!==null?n.memoizedProps:null,j=M.children,vh(w,M)?j=null:R!==null&&vh(w,R)&&(l.flags|=32),Ag(n,l),Wt(n,l,j,p),l.child;case 6:return n===null&&Ph(l),null;case 13:return Lg(n,l,p);case 4:return jh(l,l.stateNode.containerInfo),w=l.pendingProps,n===null?l.child=Ki(l,null,w,p):Wt(n,l,w,p),l.child;case 11:return w=l.type,M=l.pendingProps,M=l.elementType===w?M:Ms(w,M),kg(n,l,w,M,p);case 7:return Wt(n,l,l.pendingProps,p),l.child;case 8:return Wt(n,l,l.pendingProps.children,p),l.child;case 12:return Wt(n,l,l.pendingProps.children,p),l.child;case 10:e:{if(w=l.type._context,M=l.pendingProps,R=l.memoizedProps,j=M.value,qe(Oa,w._currentValue),w._currentValue=j,R!==null)if(Es(R.value,j)){if(R.children===M.children&&!Kt.current){l=or(n,l,p);break e}}else for(R=l.child,R!==null&&(R.return=l);R!==null;){var W=R.dependencies;if(W!==null){j=R.child;for(var G=W.firstContext;G!==null;){if(G.context===w){if(R.tag===1){G=nr(-1,p&-p),G.tag=2;var te=R.updateQueue;if(te!==null){te=te.shared;var ce=te.pending;ce===null?G.next=G:(G.next=ce.next,ce.next=G),te.pending=G}}R.lanes|=p,G=R.alternate,G!==null&&(G.lanes|=p),Dh(R.return,p,l),W.lanes|=p;break}G=G.next}}else if(R.tag===10)j=R.type===l.type?null:R.child;else if(R.tag===18){if(j=R.return,j===null)throw Error(s(341));j.lanes|=p,W=j.alternate,W!==null&&(W.lanes|=p),Dh(j,p,l),j=R.sibling}else j=R.child;if(j!==null)j.return=R;else for(j=R;j!==null;){if(j===l){j=null;break}if(R=j.sibling,R!==null){R.return=j.return,j=R;break}j=j.return}R=j}Wt(n,l,M.children,p),l=l.child}return l;case 9:return M=l.type,w=l.pendingProps.children,Xi(l,p),M=ms(M),w=w(M),l.flags|=1,Wt(n,l,w,p),l.child;case 14:return w=l.type,M=Ms(w,l.pendingProps),M=Ms(w.type,M),Eg(n,l,w,M,p);case 15:return Pg(n,l,l.type,l.pendingProps,p);case 17:return w=l.type,M=l.pendingProps,M=l.elementType===w?M:Ms(w,M),Xa(n,l),l.tag=1,Yt(w)?(n=!0,Da(l)):n=!1,Xi(l,p),vg(l,w,M),Kh(l,w,M,p),Zh(null,l,w,!0,n,p);case 19:return jg(n,l,p);case 22:return Mg(n,l,p)}throw Error(s(156,l.tag))};function n_(n,l){return Op(n,l)}function VS(n,l,p,w){this.tag=n,this.key=p,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=l,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=w,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function vs(n,l,p,w){return new VS(n,l,p,w)}function vu(n){return n=n.prototype,!(!n||!n.isReactComponent)}function GS(n){if(typeof n=="function")return vu(n)?1:0;if(n!=null){if(n=n.$$typeof,n===z)return 11;if(n===ie)return 14}return 2}function Nr(n,l){var p=n.alternate;return p===null?(p=vs(n.tag,l,n.key,n.mode),p.elementType=n.elementType,p.type=n.type,p.stateNode=n.stateNode,p.alternate=n,n.alternate=p):(p.pendingProps=l,p.type=n.type,p.flags=0,p.subtreeFlags=0,p.deletions=null),p.flags=n.flags&14680064,p.childLanes=n.childLanes,p.lanes=n.lanes,p.child=n.child,p.memoizedProps=n.memoizedProps,p.memoizedState=n.memoizedState,p.updateQueue=n.updateQueue,l=n.dependencies,p.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},p.sibling=n.sibling,p.index=n.index,p.ref=n.ref,p}function al(n,l,p,w,M,R){var j=2;if(w=n,typeof n=="function")vu(n)&&(j=1);else if(typeof n=="string")j=5;else e:switch(n){case T:return oi(p.children,M,R,l);case A:j=8,M|=8;break;case D:return n=vs(12,p,l,M|2),n.elementType=D,n.lanes=R,n;case U:return n=vs(13,p,l,M),n.elementType=U,n.lanes=R,n;case K:return n=vs(19,p,l,M),n.elementType=K,n.lanes=R,n;case J:return ll(p,M,R,l);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case I:j=10;break e;case O:j=9;break e;case z:j=11;break e;case ie:j=14;break e;case Q:j=16,w=null;break e}throw Error(s(130,n==null?n:typeof n,""))}return l=vs(j,p,l,M),l.elementType=n,l.type=w,l.lanes=R,l}function oi(n,l,p,w){return n=vs(7,n,w,l),n.lanes=p,n}function ll(n,l,p,w){return n=vs(22,n,w,l),n.elementType=J,n.lanes=p,n.stateNode={isHidden:!1},n}function xu(n,l,p){return n=vs(6,n,null,l),n.lanes=p,n}function yu(n,l,p){return l=vs(4,n.children!==null?n.children:[],n.key,l),l.lanes=p,l.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},l}function qS(n,l,p,w,M){this.tag=l,this.containerInfo=n,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=qc(0),this.expirationTimes=qc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=qc(0),this.identifierPrefix=w,this.onRecoverableError=M,this.mutableSourceEagerHydrationData=null}function bu(n,l,p,w,M,R,j,W,G){return n=new qS(n,l,p,W,G),l===1?(l=1,R===!0&&(l|=8)):l=0,R=vs(3,null,null,l),n.current=R,R.stateNode=n,R.memoizedState={element:w,isDehydrated:p,cache:null,transitions:null,pendingSuspenseBoundaries:null},Bh(R),n}function KS(n,l,p){var w=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:P,key:w==null?null:""+w,children:n,containerInfo:l,implementation:p}}function o_(n){if(!n)return Mr;n=n._reactInternals;e:{if(Kr(n)!==n||n.tag!==1)throw Error(s(170));var l=n;do{switch(l.tag){case 3:l=l.stateNode.context;break e;case 1:if(Yt(l.type)){l=l.stateNode.__reactInternalMemoizedMergedChildContext;break e}}l=l.return}while(l!==null);throw Error(s(171))}if(n.tag===1){var p=n.type;if(Yt(p))return Bm(n,p,l)}return l}function a_(n,l,p,w,M,R,j,W,G){return n=bu(p,w,!0,n,M,R,j,W,G),n.context=o_(null),p=n.current,w=zt(),M=jr(p),R=nr(w,M),R.callback=l??null,Rr(p,R,M),n.current.lanes=M,Ln(n,M,w),Zt(n,w),n}function cl(n,l,p,w){var M=l.current,R=zt(),j=jr(M);return p=o_(p),l.context===null?l.context=p:l.pendingContext=p,l=nr(R,j),l.payload={element:n},w=w===void 0?null:w,w!==null&&(l.callback=w),n=Rr(M,l,j),n!==null&&(Rs(n,M,j,R),$a(n,M,j)),j}function hl(n){if(n=n.current,!n.child)return null;switch(n.child.tag){case 5:return n.child.stateNode;default:return n.child.stateNode}}function l_(n,l){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var p=n.retryLane;n.retryLane=p!==0&&p<l?p:l}}function wu(n,l){l_(n,l),(n=n.alternate)&&l_(n,l)}function YS(){return null}var c_=typeof reportError=="function"?reportError:function(n){console.error(n)};function Su(n){this._internalRoot=n}ul.prototype.render=Su.prototype.render=function(n){var l=this._internalRoot;if(l===null)throw Error(s(409));cl(n,l,null,null)},ul.prototype.unmount=Su.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var l=n.containerInfo;ri(function(){cl(null,n,null,null)}),l[er]=null}};function ul(n){this._internalRoot=n}ul.prototype.unstable_scheduleHydration=function(n){if(n){var l=Gp();n={blockedOn:null,target:n,priority:l};for(var p=0;p<Sr.length&&l!==0&&l<Sr[p].priority;p++);Sr.splice(p,0,n),p===0&&Yp(n)}};function Cu(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function dl(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11&&(n.nodeType!==8||n.nodeValue!==" react-mount-point-unstable "))}function h_(){}function XS(n,l,p,w,M){if(M){if(typeof w=="function"){var R=w;w=function(){var te=hl(j);R.call(te)}}var j=a_(l,w,n,0,null,!1,!1,"",h_);return n._reactRootContainer=j,n[er]=j.current,qn(n.nodeType===8?n.parentNode:n),ri(),j}for(;M=n.lastChild;)n.removeChild(M);if(typeof w=="function"){var W=w;w=function(){var te=hl(G);W.call(te)}}var G=bu(n,0,!1,null,null,!1,!1,"",h_);return n._reactRootContainer=G,n[er]=G.current,qn(n.nodeType===8?n.parentNode:n),ri(function(){cl(l,G,p,w)}),G}function fl(n,l,p,w,M){var R=p._reactRootContainer;if(R){var j=R;if(typeof M=="function"){var W=M;M=function(){var G=hl(j);W.call(G)}}cl(l,j,n,M)}else j=XS(p,l,n,M,w);return hl(j)}zp=function(n){switch(n.tag){case 3:var l=n.stateNode;if(l.current.memoizedState.isDehydrated){var p=Dn(l.pendingLanes);p!==0&&(Kc(l,p|1),Zt(l,at()),(He&6)===0&&(tn=at()+500,Ar()))}break;case 13:ri(function(){var w=ir(n,1);if(w!==null){var M=zt();Rs(w,n,1,M)}}),wu(n,1)}},Yc=function(n){if(n.tag===13){var l=ir(n,134217728);if(l!==null){var p=zt();Rs(l,n,134217728,p)}wu(n,134217728)}},Vp=function(n){if(n.tag===13){var l=jr(n),p=ir(n,l);if(p!==null){var w=zt();Rs(p,n,l,w)}wu(n,l)}},Gp=function(){return ze},qp=function(n,l){var p=ze;try{return ze=n,l()}finally{ze=p}},Hc=function(n,l,p){switch(l){case"input":if(Pe(n,p),l=p.name,p.type==="radio"&&l!=null){for(p=n;p.parentNode;)p=p.parentNode;for(p=p.querySelectorAll("input[name="+JSON.stringify(""+l)+'][type="radio"]'),l=0;l<p.length;l++){var w=p[l];if(w!==n&&w.form===n.form){var M=Ta(w);if(!M)throw Error(s(90));fe(w),Pe(w,M)}}}break;case"textarea":vr(n,p);break;case"select":l=p.value,l!=null&&Fs(n,!!p.multiple,l,!1)}},Rp=mu,Dp=ri;var QS={usingClientEntryPoint:!1,Events:[Xn,Ui,Ta,Ap,Tp,mu]},ho={findFiberByHostInstance:Yr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},ZS={bundleType:ho.bundleType,version:ho.version,rendererPackageName:ho.rendererPackageName,rendererConfig:ho.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:C.ReactCurrentDispatcher,findHostInstanceByFiber:function(n){return n=Ip(n),n===null?null:n.stateNode},findFiberByHostInstance:ho.findFiberByHostInstance||YS,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 pl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!pl.isDisabled&&pl.supportsFiber)try{ua=pl.inject(ZS),$s=pl}catch{}}return Jt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=QS,Jt.createPortal=function(n,l){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Cu(l))throw Error(s(200));return KS(n,l,null,p)},Jt.createRoot=function(n,l){if(!Cu(n))throw Error(s(299));var p=!1,w="",M=c_;return l!=null&&(l.unstable_strictMode===!0&&(p=!0),l.identifierPrefix!==void 0&&(w=l.identifierPrefix),l.onRecoverableError!==void 0&&(M=l.onRecoverableError)),l=bu(n,1,!1,null,null,p,!1,w,M),n[er]=l.current,qn(n.nodeType===8?n.parentNode:n),new Su(l)},Jt.findDOMNode=function(n){if(n==null)return null;if(n.nodeType===1)return n;var l=n._reactInternals;if(l===void 0)throw typeof n.render=="function"?Error(s(188)):(n=Object.keys(n).join(","),Error(s(268,n)));return n=Ip(l),n=n===null?null:n.stateNode,n},Jt.flushSync=function(n){return ri(n)},Jt.hydrate=function(n,l,p){if(!dl(l))throw Error(s(200));return fl(null,n,l,!0,p)},Jt.hydrateRoot=function(n,l,p){if(!Cu(n))throw Error(s(405));var w=p!=null&&p.hydratedSources||null,M=!1,R="",j=c_;if(p!=null&&(p.unstable_strictMode===!0&&(M=!0),p.identifierPrefix!==void 0&&(R=p.identifierPrefix),p.onRecoverableError!==void 0&&(j=p.onRecoverableError)),l=a_(l,null,n,1,p??null,M,!1,R,j),n[er]=l.current,qn(n),w)for(n=0;n<w.length;n++)p=w[n],M=p._getVersion,M=M(p._source),l.mutableSourceEagerHydrationData==null?l.mutableSourceEagerHydrationData=[p,M]:l.mutableSourceEagerHydrationData.push(p,M);return new ul(l)},Jt.render=function(n,l,p){if(!dl(l))throw Error(s(200));return fl(null,n,l,!1,p)},Jt.unmountComponentAtNode=function(n){if(!dl(n))throw Error(s(40));return n._reactRootContainer?(ri(function(){fl(null,null,n,!1,function(){n._reactRootContainer=null,n[er]=null})}),!0):!1},Jt.unstable_batchedUpdates=mu,Jt.unstable_renderSubtreeIntoContainer=function(n,l,p,w){if(!dl(p))throw Error(s(200));if(n==null||n._reactInternals===void 0)throw Error(s(38));return fl(n,l,p,!1,w)},Jt.version="18.3.1-next-f1338f8080-20240426",Jt}var v_;function lC(){if(v_)return Pu.exports;v_=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Pu.exports=aC(),Pu.exports}var x_;function cC(){if(x_)return gl;x_=1;var t=lC();return gl.createRoot=t.createRoot,gl.hydrateRoot=t.hydrateRoot,gl}var hC=cC();const uC="modulepreload",dC=function(t){return"/"+t},y_={},Ao=function(e,s,r){let i=Promise.resolve();if(s&&s.length>0){let c=function(u){return Promise.all(u.map(f=>Promise.resolve(f).then(d=>({status:"fulfilled",value:d}),d=>({status:"rejected",reason:d}))))};document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),h=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));i=c(s.map(u=>{if(u=dC(u),u in y_)return;y_[u]=!0;const f=u.endsWith(".css"),d=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${d}`))return;const g=document.createElement("link");if(g.rel=f?"stylesheet":uC,f||(g.as="script"),g.crossOrigin="",g.href=u,h&&g.setAttribute("nonce",h),document.head.appendChild(g),f)return new Promise((_,k)=>{g.addEventListener("load",_),g.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${u}`)))})}))}function a(c){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=c,window.dispatchEvent(o),!o.defaultPrevented)throw c}return i.then(c=>{for(const o of c||[])o.status==="rejected"&&a(o.reason);return e().catch(a)})};var Fe=(t=>(t.Application="application",t.WebGLPipes="webgl-pipes",t.WebGLPipesAdaptor="webgl-pipes-adaptor",t.WebGLSystem="webgl-system",t.WebGLLoader="webgl-loader",t.WebGPUPipes="webgpu-pipes",t.WebGPUPipesAdaptor="webgpu-pipes-adaptor",t.WebGPUSystem="webgpu-system",t.WebGPULoader="webgpu-loader",t.CanvasSystem="canvas-system",t.CanvasPipesAdaptor="canvas-pipes-adaptor",t.CanvasPipes="canvas-pipes",t.CanvasLoader="canvas-loader",t.Asset="asset",t.LoadParser="load-parser",t.ResolveParser="resolve-parser",t.CacheParser="cache-parser",t.DetectionParser="detection-parser",t.MaskEffect="mask-effect",t.BlendMode="blend-mode",t.TextureSource="texture-source",t.TextureUploaderWebGL="texture-uploader-webgl",t.TextureUploaderWebGPU="texture-uploader-webgpu",t.Environment="environment",t.ShapeBuilder="shape-builder",t.Batcher="batcher",t))(Fe||{});const Ad=t=>{if(typeof t=="function"||typeof t=="object"&&t.extension){if(!t.extension)throw new Error("Extension class must have an extension object");t={...typeof t.extension!="object"?{type:t.extension}:t.extension,ref:t}}if(typeof t=="object")t={...t};else throw new Error("Invalid extension type");return typeof t.type=="string"&&(t.type=[t.type]),t},_l=(t,e)=>Ad(t).priority??e,Mt={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...t){return t.map(Ad).forEach(e=>{e.type.forEach(s=>{var r,i;return(i=(r=this._removeHandlers)[s])==null?void 0:i.call(r,e)})}),this},add(...t){return t.map(Ad).forEach(e=>{e.type.forEach(s=>{var a,c;const r=this._addHandlers,i=this._queue;r[s]?(c=r[s])==null||c.call(r,e):(i[s]=i[s]||[],(a=i[s])==null||a.push(e))})}),this},handle(t,e,s){var c;const r=this._addHandlers,i=this._removeHandlers;if(r[t]||i[t])throw new Error(`Extension type ${t} already has a handler`);r[t]=e,i[t]=s;const a=this._queue;return a[t]&&((c=a[t])==null||c.forEach(o=>e(o)),delete a[t]),this},handleByMap(t,e){return this.handle(t,s=>{s.name&&(e[s.name]=s.ref)},s=>{s.name&&delete e[s.name]})},handleByNamedList(t,e,s=-1){return this.handle(t,r=>{e.findIndex(a=>a.name===r.name)>=0||(e.push({name:r.name,value:r.ref}),e.sort((a,c)=>_l(c.value,s)-_l(a.value,s)))},r=>{const i=e.findIndex(a=>a.name===r.name);i!==-1&&e.splice(i,1)})},handleByList(t,e,s=-1){return this.handle(t,r=>{e.includes(r.ref)||(e.push(r.ref),e.sort((i,a)=>_l(a,s)-_l(i,s)))},r=>{const i=e.indexOf(r.ref);i!==-1&&e.splice(i,1)})},mixin(t,...e){for(const s of e)Object.defineProperties(t.prototype,Object.getOwnPropertyDescriptors(s))}},fC={extension:{type:Fe.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Ao(()=>import("./browserAll-CXCccwgI.js"),__vite__mapDeps([0,1,2,3]))}},pC={extension:{type:Fe.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Ao(()=>import("./webworkerAll-CkYM11AB.js"),__vite__mapDeps([1,2,3]))}};class Nt{constructor(e,s,r){this._x=s||0,this._y=r||0,this._observer=e}clone(e){return new Nt(e??this._observer,this._x,this._y)}set(e=0,s=e){return(this._x!==e||this._y!==s)&&(this._x=e,this._y=s,this._observer._onUpdate(this)),this}copyFrom(e){return(this._x!==e.x||this._y!==e.y)&&(this._x=e.x,this._y=e.y,this._observer._onUpdate(this)),this}copyTo(e){return e.set(this._x,this._y),e}equals(e){return e.x===this._x&&e.y===this._y}toString(){return`[pixi.js/math:ObservablePoint x=${this._x} y=${this._y} scope=${this._observer}]`}get x(){return this._x}set x(e){this._x!==e&&(this._x=e,this._observer._onUpdate(this))}get y(){return this._y}set y(e){this._y!==e&&(this._y=e,this._observer._onUpdate(this))}}var Tu={exports:{}},b_;function mC(){return b_||(b_=1,(function(t){var e=Object.prototype.hasOwnProperty,s="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(s=!1));function i(h,u,f){this.fn=h,this.context=u,this.once=f||!1}function a(h,u,f,d,g){if(typeof f!="function")throw new TypeError("The listener must be a function");var _=new i(f,d||h,g),k=s?s+u:u;return h._events[k]?h._events[k].fn?h._events[k]=[h._events[k],_]:h._events[k].push(_):(h._events[k]=_,h._eventsCount++),h}function c(h,u){--h._eventsCount===0?h._events=new r:delete h._events[u]}function o(){this._events=new r,this._eventsCount=0}o.prototype.eventNames=function(){var u=[],f,d;if(this._eventsCount===0)return u;for(d in f=this._events)e.call(f,d)&&u.push(s?d.slice(1):d);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(f)):u},o.prototype.listeners=function(u){var f=s?s+u:u,d=this._events[f];if(!d)return[];if(d.fn)return[d.fn];for(var g=0,_=d.length,k=new Array(_);g<_;g++)k[g]=d[g].fn;return k},o.prototype.listenerCount=function(u){var f=s?s+u:u,d=this._events[f];return d?d.fn?1:d.length:0},o.prototype.emit=function(u,f,d,g,_,k){var S=s?s+u:u;if(!this._events[S])return!1;var m=this._events[S],x=arguments.length,v,b;if(m.fn){switch(m.once&&this.removeListener(u,m.fn,void 0,!0),x){case 1:return m.fn.call(m.context),!0;case 2:return m.fn.call(m.context,f),!0;case 3:return m.fn.call(m.context,f,d),!0;case 4:return m.fn.call(m.context,f,d,g),!0;case 5:return m.fn.call(m.context,f,d,g,_),!0;case 6:return m.fn.call(m.context,f,d,g,_,k),!0}for(b=1,v=new Array(x-1);b<x;b++)v[b-1]=arguments[b];m.fn.apply(m.context,v)}else{var C=m.length,E;for(b=0;b<C;b++)switch(m[b].once&&this.removeListener(u,m[b].fn,void 0,!0),x){case 1:m[b].fn.call(m[b].context);break;case 2:m[b].fn.call(m[b].context,f);break;case 3:m[b].fn.call(m[b].context,f,d);break;case 4:m[b].fn.call(m[b].context,f,d,g);break;default:if(!v)for(E=1,v=new Array(x-1);E<x;E++)v[E-1]=arguments[E];m[b].fn.apply(m[b].context,v)}}return!0},o.prototype.on=function(u,f,d){return a(this,u,f,d,!1)},o.prototype.once=function(u,f,d){return a(this,u,f,d,!0)},o.prototype.removeListener=function(u,f,d,g){var _=s?s+u:u;if(!this._events[_])return this;if(!f)return c(this,_),this;var k=this._events[_];if(k.fn)k.fn===f&&(!g||k.once)&&(!d||k.context===d)&&c(this,_);else{for(var S=0,m=[],x=k.length;S<x;S++)(k[S].fn!==f||g&&!k[S].once||d&&k[S].context!==d)&&m.push(k[S]);m.length?this._events[_]=m.length===1?m[0]:m:c(this,_)}return this},o.prototype.removeAllListeners=function(u){var f;return u?(f=s?s+u:u,this._events[f]&&c(this,f)):(this._events=new r,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=s,o.EventEmitter=o,t.exports=o})(Tu)),Tu.exports}var gC=mC();const Zs=Ey(gC),_C=Math.PI*2,vC=180/Math.PI,xC=Math.PI/180;class Ft{constructor(e=0,s=0){this.x=0,this.y=0,this.x=e,this.y=s}clone(){return new Ft(this.x,this.y)}copyFrom(e){return this.set(e.x,e.y),this}copyTo(e){return e.set(this.x,this.y),e}equals(e){return e.x===this.x&&e.y===this.y}set(e=0,s=e){return this.x=e,this.y=s,this}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return Ru.x=0,Ru.y=0,Ru}}const Ru=new Ft;class Ne{constructor(e=1,s=0,r=0,i=1,a=0,c=0){this.array=null,this.a=e,this.b=s,this.c=r,this.d=i,this.tx=a,this.ty=c}fromArray(e){this.a=e[0],this.b=e[1],this.c=e[3],this.d=e[4],this.tx=e[2],this.ty=e[5]}set(e,s,r,i,a,c){return this.a=e,this.b=s,this.c=r,this.d=i,this.tx=a,this.ty=c,this}toArray(e,s){this.array||(this.array=new Float32Array(9));const r=s||this.array;return e?(r[0]=this.a,r[1]=this.b,r[2]=0,r[3]=this.c,r[4]=this.d,r[5]=0,r[6]=this.tx,r[7]=this.ty,r[8]=1):(r[0]=this.a,r[1]=this.c,r[2]=this.tx,r[3]=this.b,r[4]=this.d,r[5]=this.ty,r[6]=0,r[7]=0,r[8]=1),r}apply(e,s){s=s||new Ft;const r=e.x,i=e.y;return s.x=this.a*r+this.c*i+this.tx,s.y=this.b*r+this.d*i+this.ty,s}applyInverse(e,s){s=s||new Ft;const r=this.a,i=this.b,a=this.c,c=this.d,o=this.tx,h=this.ty,u=1/(r*c+a*-i),f=e.x,d=e.y;return s.x=c*u*f+-a*u*d+(h*a-o*c)*u,s.y=r*u*d+-i*u*f+(-h*r+o*i)*u,s}translate(e,s){return this.tx+=e,this.ty+=s,this}scale(e,s){return this.a*=e,this.d*=s,this.c*=e,this.b*=s,this.tx*=e,this.ty*=s,this}rotate(e){const s=Math.cos(e),r=Math.sin(e),i=this.a,a=this.c,c=this.tx;return this.a=i*s-this.b*r,this.b=i*r+this.b*s,this.c=a*s-this.d*r,this.d=a*r+this.d*s,this.tx=c*s-this.ty*r,this.ty=c*r+this.ty*s,this}append(e){const s=this.a,r=this.b,i=this.c,a=this.d;return this.a=e.a*s+e.b*i,this.b=e.a*r+e.b*a,this.c=e.c*s+e.d*i,this.d=e.c*r+e.d*a,this.tx=e.tx*s+e.ty*i+this.tx,this.ty=e.tx*r+e.ty*a+this.ty,this}appendFrom(e,s){const r=e.a,i=e.b,a=e.c,c=e.d,o=e.tx,h=e.ty,u=s.a,f=s.b,d=s.c,g=s.d;return this.a=r*u+i*d,this.b=r*f+i*g,this.c=a*u+c*d,this.d=a*f+c*g,this.tx=o*u+h*d+s.tx,this.ty=o*f+h*g+s.ty,this}setTransform(e,s,r,i,a,c,o,h,u){return this.a=Math.cos(o+u)*a,this.b=Math.sin(o+u)*a,this.c=-Math.sin(o-h)*c,this.d=Math.cos(o-h)*c,this.tx=e-(r*this.a+i*this.c),this.ty=s-(r*this.b+i*this.d),this}prepend(e){const s=this.tx;if(e.a!==1||e.b!==0||e.c!==0||e.d!==1){const r=this.a,i=this.c;this.a=r*e.a+this.b*e.c,this.b=r*e.b+this.b*e.d,this.c=i*e.a+this.d*e.c,this.d=i*e.b+this.d*e.d}return this.tx=s*e.a+this.ty*e.c+e.tx,this.ty=s*e.b+this.ty*e.d+e.ty,this}decompose(e){const s=this.a,r=this.b,i=this.c,a=this.d,c=e.pivot,o=-Math.atan2(-i,a),h=Math.atan2(r,s),u=Math.abs(o+h);let f=Math.sqrt(s*s+r*r);return u<1e-5||Math.abs(_C-u)<1e-5?(e.rotation=h,e.skew.x=e.skew.y=0):Math.abs(Math.PI-u)<1e-5?(e.rotation=h-Math.PI,e.skew.x=e.skew.y=0,f=-f):(e.rotation=0,e.skew.x=o,e.skew.y=h),e.scale.x=f,e.scale.y=Math.sqrt(i*i+a*a),e.position.x=this.tx+(c.x*s+c.y*i),e.position.y=this.ty+(c.x*r+c.y*a),e}invert(){const e=this.a,s=this.b,r=this.c,i=this.d,a=this.tx,c=e*i-s*r;return this.a=i/c,this.b=-s/c,this.c=-r/c,this.d=e/c,this.tx=(r*this.ty-i*a)/c,this.ty=-(e*this.ty-s*a)/c,this}isIdentity(){return this.a===1&&this.b===0&&this.c===0&&this.d===1&&this.tx===0&&this.ty===0}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){const e=new Ne;return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyTo(e){return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyFrom(e){return this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty,this}equals(e){return e.a===this.a&&e.b===this.b&&e.c===this.c&&e.d===this.d&&e.tx===this.tx&&e.ty===this.ty}toString(){return`[pixi.js:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}static get IDENTITY(){return bC.identity()}static get shared(){return yC.identity()}}const yC=new Ne,bC=new Ne,pi=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],mi=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],gi=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],_i=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Td=[],Py=[],vl=Math.sign;function wC(){for(let t=0;t<16;t++){const e=[];Td.push(e);for(let s=0;s<16;s++){const r=vl(pi[t]*pi[s]+gi[t]*mi[s]),i=vl(mi[t]*pi[s]+_i[t]*mi[s]),a=vl(pi[t]*gi[s]+gi[t]*_i[s]),c=vl(mi[t]*gi[s]+_i[t]*_i[s]);for(let o=0;o<16;o++)if(pi[o]===r&&mi[o]===i&&gi[o]===a&&_i[o]===c){e.push(o);break}}}for(let t=0;t<16;t++){const e=new Ne;e.set(pi[t],mi[t],gi[t],_i[t],0,0),Py.push(e)}}wC();const Ge={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:t=>pi[t],uY:t=>mi[t],vX:t=>gi[t],vY:t=>_i[t],inv:t=>t&8?t&15:-t&7,add:(t,e)=>Td[t][e],sub:(t,e)=>Td[t][Ge.inv(e)],rotate180:t=>t^4,isVertical:t=>(t&3)===2,byDirection:(t,e)=>Math.abs(t)*2<=Math.abs(e)?e>=0?Ge.S:Ge.N:Math.abs(e)*2<=Math.abs(t)?t>0?Ge.E:Ge.W:e>0?t>0?Ge.SE:Ge.SW:t>0?Ge.NE:Ge.NW,matrixAppendRotationInv:(t,e,s=0,r=0,i=0,a=0)=>{const c=Py[Ge.inv(e)],o=c.a,h=c.b,u=c.c,f=c.d,d=s-Math.min(0,o*i,u*a,o*i+u*a),g=r-Math.min(0,h*i,f*a,h*i+f*a),_=t.a,k=t.b,S=t.c,m=t.d;t.a=o*_+h*S,t.b=o*k+h*m,t.c=u*_+f*S,t.d=u*k+f*m,t.tx=d*_+g*S+t.tx,t.ty=d*k+g*m+t.ty},transformRectCoords:(t,e,s,r)=>{const{x:i,y:a,width:c,height:o}=t,{x:h,y:u,width:f,height:d}=e;return s===Ge.E?(r.set(i+h,a+u,c,o),r):s===Ge.S?r.set(f-a-o+h,i+u,o,c):s===Ge.W?r.set(f-i-c+h,d-a-o+u,c,o):s===Ge.N?r.set(a+h,d-i-c+u,o,c):r.set(i+h,a+u,c,o)}},xl=[new Ft,new Ft,new Ft,new Ft];class Pt{constructor(e=0,s=0,r=0,i=0){this.type="rectangle",this.x=Number(e),this.y=Number(s),this.width=Number(r),this.height=Number(i)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new Pt(0,0,0,0)}clone(){return new Pt(this.x,this.y,this.width,this.height)}copyFromBounds(e){return this.x=e.minX,this.y=e.minY,this.width=e.maxX-e.minX,this.height=e.maxY-e.minY,this}copyFrom(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this}copyTo(e){return e.copyFrom(this),e}contains(e,s){return this.width<=0||this.height<=0?!1:e>=this.x&&e<this.x+this.width&&s>=this.y&&s<this.y+this.height}strokeContains(e,s,r,i=.5){const{width:a,height:c}=this;if(a<=0||c<=0)return!1;const o=this.x,h=this.y,u=r*(1-i),f=r-u,d=o-u,g=o+a+u,_=h-u,k=h+c+u,S=o+f,m=o+a-f,x=h+f,v=h+c-f;return e>=d&&e<=g&&s>=_&&s<=k&&!(e>S&&e<m&&s>x&&s<v)}intersects(e,s){if(!s){const A=this.x<e.x?e.x:this.x;if((this.right>e.right?e.right:this.right)<=A)return!1;const I=this.y<e.y?e.y:this.y;return(this.bottom>e.bottom?e.bottom:this.bottom)>I}const r=this.left,i=this.right,a=this.top,c=this.bottom;if(i<=r||c<=a)return!1;const o=xl[0].set(e.left,e.top),h=xl[1].set(e.left,e.bottom),u=xl[2].set(e.right,e.top),f=xl[3].set(e.right,e.bottom);if(u.x<=o.x||h.y<=o.y)return!1;const d=Math.sign(s.a*s.d-s.b*s.c);if(d===0||(s.apply(o,o),s.apply(h,h),s.apply(u,u),s.apply(f,f),Math.max(o.x,h.x,u.x,f.x)<=r||Math.min(o.x,h.x,u.x,f.x)>=i||Math.max(o.y,h.y,u.y,f.y)<=a||Math.min(o.y,h.y,u.y,f.y)>=c))return!1;const g=d*(h.y-o.y),_=d*(o.x-h.x),k=g*r+_*a,S=g*i+_*a,m=g*r+_*c,x=g*i+_*c;if(Math.max(k,S,m,x)<=g*o.x+_*o.y||Math.min(k,S,m,x)>=g*f.x+_*f.y)return!1;const v=d*(o.y-u.y),b=d*(u.x-o.x),C=v*r+b*a,E=v*i+b*a,P=v*r+b*c,T=v*i+b*c;return!(Math.max(C,E,P,T)<=v*o.x+b*o.y||Math.min(C,E,P,T)>=v*f.x+b*f.y)}pad(e=0,s=e){return this.x-=e,this.y-=s,this.width+=e*2,this.height+=s*2,this}fit(e){const s=Math.max(this.x,e.x),r=Math.min(this.x+this.width,e.x+e.width),i=Math.max(this.y,e.y),a=Math.min(this.y+this.height,e.y+e.height);return this.x=s,this.width=Math.max(r-s,0),this.y=i,this.height=Math.max(a-i,0),this}ceil(e=1,s=.001){const r=Math.ceil((this.x+this.width-s)*e)/e,i=Math.ceil((this.y+this.height-s)*e)/e;return this.x=Math.floor((this.x+s)*e)/e,this.y=Math.floor((this.y+s)*e)/e,this.width=r-this.x,this.height=i-this.y,this}scale(e,s=e){return this.x*=e,this.y*=s,this.width*=e,this.height*=s,this}enlarge(e){const s=Math.min(this.x,e.x),r=Math.max(this.x+this.width,e.x+e.width),i=Math.min(this.y,e.y),a=Math.max(this.y+this.height,e.y+e.height);return this.x=s,this.width=r-s,this.y=i,this.height=a-i,this}getBounds(e){return e||(e=new Pt),e.copyFrom(this),e}containsRect(e){if(this.width<=0||this.height<=0)return!1;const s=e.x,r=e.y,i=e.x+e.width,a=e.y+e.height;return s>=this.x&&s<this.x+this.width&&r>=this.y&&r<this.y+this.height&&i>=this.x&&i<=this.x+this.width&&a>=this.y&&a<=this.y+this.height}set(e,s,r,i){return this.x=e,this.y=s,this.width=r,this.height=i,this}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}const Du={default:-1};function rt(t="default"){return Du[t]===void 0&&(Du[t]=-1),++Du[t]}const w_=new Set,xt="8.0.0",SC="8.3.4",rn="8.21.0",CC="8.22.0",un={quiet:!1,noColor:!1},je=((t,e,s=3)=>{if(un.quiet||w_.has(e))return;let r=new Error().stack;const i=`${e}
42
+ Deprecated since v${t}`,a=typeof console.groupCollapsed=="function"&&!un.noColor;typeof r>"u"?console.warn("PixiJS Deprecation Warning: ",i):(r=r.split(`
43
+ `).splice(s).join(`
44
+ `),a?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",i),console.warn(r),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",i),console.warn(r))),w_.add(e)});Object.defineProperties(je,{quiet:{get:()=>un.quiet,set:t=>{un.quiet=t},enumerable:!0,configurable:!1},noColor:{get:()=>un.noColor,set:t=>{un.noColor=t},enumerable:!0,configurable:!1}});const My=()=>{};function kC(t){return t.endsWith("int")}function S_(t){return t+=t===0?1:0,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t+1}function Zl(t){return!(t&t-1)&&!!t}function Ay(t){const e={};for(const s in t)t[s]!==void 0&&(e[s]=t[s]);return e}const C_=Object.create(null);function EC(t){const e=C_[t];return e===void 0&&(C_[t]=rt("resource")),e}const Ty=class Ry extends Zs{constructor(e={}){super(),this._resourceType="textureSampler",this._maxAnisotropy=1,this.destroyed=!1,e={...Ry.defaultOptions,...e},this.addressMode=e.addressMode,this.addressModeU=e.addressModeU??this.addressModeU,this.addressModeV=e.addressModeV??this.addressModeV,this.addressModeW=e.addressModeW??this.addressModeW,this.scaleMode=e.scaleMode,this.magFilter=e.magFilter??this.magFilter,this.minFilter=e.minFilter??this.minFilter,this.mipmapFilter=e.mipmapFilter??this.mipmapFilter,this.lodMinClamp=e.lodMinClamp,this.lodMaxClamp=e.lodMaxClamp,this.compare=e.compare,this.maxAnisotropy=e.maxAnisotropy??1}set addressMode(e){this.addressModeU=e,this.addressModeV=e,this.addressModeW=e}get addressMode(){return this.addressModeU}set wrapMode(e){je(xt,"TextureStyle.wrapMode is now TextureStyle.addressMode"),this.addressMode=e}get wrapMode(){return this.addressMode}set scaleMode(e){this.magFilter=e,this.minFilter=e,this.mipmapFilter=e}get scaleMode(){return this.magFilter}set maxAnisotropy(e){this._maxAnisotropy=Math.min(e,16),this._maxAnisotropy>1&&(this.scaleMode="linear")}get maxAnisotropy(){return this._maxAnisotropy}get _resourceId(){return this._sharedResourceId||this._generateResourceId()}update(){this._sharedResourceId=null,this.emit("change",this)}_generateResourceId(){const e=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=EC(e),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};Ty.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};let To=Ty;const Dy=class Ly extends Zs{constructor(e={}){super(),this.options=e,this._gpuData=Object.create(null),this._gcLastUsed=-1,this.uid=rt("textureSource"),this._resourceType="textureSource",this._resourceId=rt("resource"),this.uploadMethodId="unknown",this._resolution=1,this.pixelWidth=1,this.pixelHeight=1,this.width=1,this.height=1,this.sampleCount=1,this.mipLevelCount=1,this.autoGenerateMipmaps=!1,this.format="rgba8unorm",this.dimension="2d",this.viewDimension="2d",this.arrayLayerCount=1,this.depth=1,this._ownsStyle=!1,this.antialias=!1,this.transient=!1,this.storage=!1,this._batchTick=-1,this._textureBindLocation=-1;const s=e;e={...Ly.defaultOptions,...e};const r=PC(e),i=r==="3d"||r==="1d"?r:"2d";MC(s,r,i),this.label=e.label??"",this.resource=e.resource,this.autoGarbageCollect=e.autoGarbageCollect,this._resolution=e.resolution,e.width?this.pixelWidth=e.width*this._resolution:this.pixelWidth=this.resource?this.resourceWidth??1:1,e.height?this.pixelHeight=e.height*this._resolution:this.pixelHeight=this.resource?this.resourceHeight??1:1,this.width=this.pixelWidth/this._resolution,this.height=this.pixelHeight/this._resolution,this.format=e.format,this.dimension=i,this.viewDimension=r,this.arrayLayerCount=e.arrayLayerCount,this.depth=i==="3d"?e.depth??1:1,this.mipLevelCount=e.mipLevelCount,this.autoGenerateMipmaps=e.autoGenerateMipmaps,this.sampleCount=e.sampleCount,this.antialias=i==="3d"?!1:e.antialias,this.transient=e.transient??!1,this.storage=e.storage??!1,this.alphaMode=e.alphaMode,this.style=new To(Ay(e)),this._ownsStyle=!0,this.destroyed=!1,this._refreshPOT()}get depthOrArrayLayers(){return this.dimension==="3d"?this.depth:this.arrayLayerCount||1}get source(){return this}get style(){return this._style}set style(e){var s,r;this.style!==e&&(this._ownsStyle=!1,(s=this._style)==null||s.off("change",this._onStyleChange,this),this._style=e,(r=this._style)==null||r.on("change",this._onStyleChange,this),this._onStyleChange())}set maxAnisotropy(e){this._style.maxAnisotropy=e}get maxAnisotropy(){return this._style.maxAnisotropy}get addressMode(){return this._style.addressMode}set addressMode(e){this._style.addressMode=e}get repeatMode(){return this._style.addressMode}set repeatMode(e){this._style.addressMode=e}get magFilter(){return this._style.magFilter}set magFilter(e){this._style.magFilter=e}get minFilter(){return this._style.minFilter}set minFilter(e){this._style.minFilter=e}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(e){this._style.mipmapFilter=e}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(e){this._style.lodMinClamp=e}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(e){this._style.lodMaxClamp=e}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){const e=this._resolution;if(this.resize(this.resourceWidth/e,this.resourceHeight/e))return}this.emit("update",this)}destroy(){this.destroyed=!0,this.unload(),this.emit("destroy",this),this._style&&(this._ownsStyle&&this._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){var e,s;this._resourceId=rt("resource"),this.emit("change",this),this.emit("unload",this);for(const r in this._gpuData)(s=(e=this._gpuData[r])==null?void 0:e.destroy)==null||s.call(e);this._gpuData=Object.create(null)}get resourceWidth(){const{resource:e}=this;return e.naturalWidth||e.videoWidth||e.displayWidth||e.width}get resourceHeight(){const{resource:e}=this;return e.naturalHeight||e.videoHeight||e.displayHeight||e.height}get resolution(){return this._resolution}set resolution(e){this._resolution!==e&&(this._resolution=e,this.width=this.pixelWidth/e,this.height=this.pixelHeight/e)}resize(e,s,r){r||(r=this._resolution),e||(e=this.width),s||(s=this.height);const i=Math.round(e*r),a=Math.round(s*r);return this.width=i/r,this.height=a/r,this._resolution=r,this.pixelWidth===i&&this.pixelHeight===a?!1:(this._refreshPOT(),this.pixelWidth=i,this.pixelHeight=a,this.emit("resize",this),this._resourceId=rt("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this)}set wrapMode(e){this._style.wrapMode=e}get wrapMode(){return this._style.wrapMode}set scaleMode(e){this._style.scaleMode=e}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=Zl(this.pixelWidth)&&Zl(this.pixelHeight)}static test(e){throw new Error("Unimplemented")}};Dy.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",arrayLayerCount:1,mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};let hs=Dy;function PC(t){return t.viewDimension?t.viewDimension:t.depth?"3d":t.arrayLayerCount>1?"2d-array":"2d"}function MC(t,e,s){if(t.depth!==void 0&&typeof t.depth!="number")throw new Error(`[TextureSource] depth is a 3D texture's depth in texels, but got ${t.depth}. For a depth buffer, use the depth option of a RenderTarget or the renderer.`);if(t.depth&&t.arrayLayerCount>1)throw new Error("[TextureSource] depth and arrayLayerCount can't be combined: use depth for a 3D texture or arrayLayerCount for a 2D array.");if(t.depth&&e!=="3d")throw new Error(`[TextureSource] depth makes a 3D texture, but viewDimension is '${e}'. Use arrayLayerCount for layered textures.`);if(e==="3d"&&t.arrayLayerCount>1)throw new Error("[TextureSource] a 3D texture takes depth, not arrayLayerCount.");if(t.dimensions&&t.dimensions!==s)throw new Error(`[TextureSource] dimensions '${t.dimensions}' doesn't match viewDimension '${e}'. Leave dimensions out; it is derived from the view.`);if(t.dimensions&&je(CC,"TextureSource dimensions is derived from viewDimension and depth; leave it out."),s==="3d"&&t.antialias)throw new Error("[TextureSource] a 3D texture can't be antialiased: WebGPU has no multisampled 3D textures.")}class bf extends hs{constructor(e){const s=e.depth??e.arrayLayerCount??1,r=e.resource||new Float32Array(e.width*e.height*s*4);let i=e.format;i||(r instanceof Float32Array?i="rgba32float":r instanceof Int32Array||r instanceof Uint32Array?i="rgba32uint":r instanceof Int16Array||r instanceof Uint16Array?i="rgba16uint":(r instanceof Int8Array,i="bgra8unorm"));const a=kC(i)||s>1;super({...a&&{alphaMode:"no-premultiply-alpha"},...e,resource:r,format:i}),this.uploadMethodId="buffer",this._updateStart=0,this._updateEnd=1/0}update(e=0,s=1/0){if((e>0||s<1/0)&&this.depthOrArrayLayers>1)throw new Error("[BufferImageSource] a 3D texture or 2D array uploads whole: call update() with no range.");this._updateStart=e,this._updateEnd=s,super.update(),this._updateStart=0,this._updateEnd=1/0}static test(e){return e instanceof Int8Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array}}bf.extension=Fe.TextureSource;const k_=new Ne;class AC{constructor(e,s){this.mapCoord=new Ne,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._updateID=0,this.clampOffset=0,typeof s>"u"?this.clampMargin=e.width<10?0:.5:this.clampMargin=s,this.isSimple=!1,this.texture=e}get texture(){return this._texture}set texture(e){var s;this._texture!==e&&((s=this._texture)==null||s.removeListener("update",this.update,this),this._texture=e,this._texture.addListener("update",this.update,this)),this.update()}destroy(){var e;(e=this._texture)==null||e.removeListener("update",this.update,this),this._texture=null}multiplyUvs(e,s){s===void 0&&(s=e);const r=this.mapCoord;for(let i=0;i<e.length;i+=2){const a=e[i],c=e[i+1];s[i]=a*r.a+c*r.c+r.tx,s[i+1]=a*r.b+c*r.d+r.ty}return s}update(){const e=this._texture;this._updateID++;const s=e.uvs;this.mapCoord.set(s.x1-s.x0,s.y1-s.y0,s.x3-s.x0,s.y3-s.y0,s.x0,s.y0);const r=e.orig,i=e.trim;i&&(k_.set(r.width/i.width,0,0,r.height/i.height,-i.x/i.width,-i.y/i.height),this.mapCoord.append(k_));const a=e.source,c=this.uClampFrame,o=this.clampMargin/a._resolution,h=this.clampOffset/a._resolution;return c[0]=(e.frame.x+o+h)/a.width,c[1]=(e.frame.y+o+h)/a.height,c[2]=(e.frame.x+e.frame.width-o+h)/a.width,c[3]=(e.frame.y+e.frame.height-o+h)/a.height,this.uClampOffset[0]=this.clampOffset/a.pixelWidth,this.uClampOffset[1]=this.clampOffset/a.pixelHeight,this.isSimple=e.frame.width===a.width&&e.frame.height===a.height&&e.rotate===0,!0}}class Ve extends Zs{constructor({source:e,label:s,frame:r,orig:i,trim:a,defaultAnchor:c,defaultBorders:o,rotate:h,dynamic:u}={}){if(super(),this.uid=rt("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new Pt,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=s,this.source=(e==null?void 0:e.source)??new hs,this.noFrame=!r,r)this.frame.copyFrom(r);else{const{width:f,height:d}=this._source;this.frame.width=f,this.frame.height=d}this.orig=i||this.frame,this.trim=a,this.rotate=h??0,this.defaultAnchor=c,this.defaultBorders=o,this.destroyed=!1,this.dynamic=u||!1,this.updateUvs()}set source(e){this._source&&this._source.off("resize",this.update,this),this._source=e,e.on("resize",this.update,this),this.emit("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new AC(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){const{uvs:e,frame:s}=this,{width:r,height:i}=this._source,a=s.x/r,c=s.y/i,o=s.width/r,h=s.height/i;let u=this.rotate;if(u){const f=o/2,d=h/2,g=a+f,_=c+d;u=Ge.add(u,Ge.NW),e.x0=g+f*Ge.uX(u),e.y0=_+d*Ge.uY(u),u=Ge.add(u,2),e.x1=g+f*Ge.uX(u),e.y1=_+d*Ge.uY(u),u=Ge.add(u,2),e.x2=g+f*Ge.uX(u),e.y2=_+d*Ge.uY(u),u=Ge.add(u,2),e.x3=g+f*Ge.uX(u),e.y3=_+d*Ge.uY(u)}else e.x0=a,e.y0=c,e.x1=a+o,e.y1=c,e.x2=a+o,e.y2=c+h,e.x3=a,e.y3=c+h}destroy(e=!1){this._source&&(this._source.off("resize",this.update,this),e&&(this._source.destroy(),this._source=null)),this._textureMatrix=null,this.destroyed=!0,this.emit("destroy",this),this.removeAllListeners()}update(){this.noFrame&&(this.frame.width=this._source.width,this.frame.height=this._source.height),this.updateUvs(),this.emit("update",this)}get baseTexture(){return je(xt,"Texture.baseTexture is now Texture.source"),this._source}}Ve.EMPTY=new Ve({label:"EMPTY",source:new hs({label:"EMPTY"})});Ve.EMPTY.destroy=My;Ve.WHITE=new Ve({source:new bf({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});Ve.WHITE.destroy=My;function TC(t,e,s){const{width:r,height:i}=s.orig,a=s.trim;if(a){const c=a.width,o=a.height;t.minX=a.x-e._x*r,t.maxX=t.minX+c,t.minY=a.y-e._y*i,t.maxY=t.minY+o}else t.minX=-e._x*r,t.maxX=t.minX+r,t.minY=-e._y*i,t.maxY=t.minY+i}const E_=new Ne;class Ns{constructor(e=1/0,s=1/0,r=-1/0,i=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=E_,this.minX=e,this.minY=s,this.maxX=r,this.maxY=i}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new Pt);const e=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(e.x=0,e.y=0,e.width=0,e.height=0):e.copyFromBounds(this),e}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=E_,this}set(e,s,r,i){this.minX=e,this.minY=s,this.maxX=r,this.maxY=i}addFrame(e,s,r,i,a){a||(a=this.matrix);const c=a.a,o=a.b,h=a.c,u=a.d,f=a.tx,d=a.ty;let g=this.minX,_=this.minY,k=this.maxX,S=this.maxY,m=c*e+h*s+f,x=o*e+u*s+d;m<g&&(g=m),x<_&&(_=x),m>k&&(k=m),x>S&&(S=x),m=c*r+h*s+f,x=o*r+u*s+d,m<g&&(g=m),x<_&&(_=x),m>k&&(k=m),x>S&&(S=x),m=c*e+h*i+f,x=o*e+u*i+d,m<g&&(g=m),x<_&&(_=x),m>k&&(k=m),x>S&&(S=x),m=c*r+h*i+f,x=o*r+u*i+d,m<g&&(g=m),x<_&&(_=x),m>k&&(k=m),x>S&&(S=x),this.minX=g,this.minY=_,this.maxX=k,this.maxY=S}addRect(e,s){this.addFrame(e.x,e.y,e.x+e.width,e.y+e.height,s)}addBounds(e,s){this.addFrame(e.minX,e.minY,e.maxX,e.maxY,s)}addBoundsMask(e){this.minX=this.minX>e.minX?this.minX:e.minX,this.minY=this.minY>e.minY?this.minY:e.minY,this.maxX=this.maxX<e.maxX?this.maxX:e.maxX,this.maxY=this.maxY<e.maxY?this.maxY:e.maxY}applyMatrix(e){const s=this.minX,r=this.minY,i=this.maxX,a=this.maxY,{a:c,b:o,c:h,d:u,tx:f,ty:d}=e;let g=c*s+h*r+f,_=o*s+u*r+d;this.minX=g,this.minY=_,this.maxX=g,this.maxY=_,g=c*i+h*r+f,_=o*i+u*r+d,this.minX=g<this.minX?g:this.minX,this.minY=_<this.minY?_:this.minY,this.maxX=g>this.maxX?g:this.maxX,this.maxY=_>this.maxY?_:this.maxY,g=c*s+h*a+f,_=o*s+u*a+d,this.minX=g<this.minX?g:this.minX,this.minY=_<this.minY?_:this.minY,this.maxX=g>this.maxX?g:this.maxX,this.maxY=_>this.maxY?_:this.maxY,g=c*i+h*a+f,_=o*i+u*a+d,this.minX=g<this.minX?g:this.minX,this.minY=_<this.minY?_:this.minY,this.maxX=g>this.maxX?g:this.maxX,this.maxY=_>this.maxY?_:this.maxY}fit(e){return this.minX<e.left&&(this.minX=e.left),this.maxX>e.right&&(this.maxX=e.right),this.minY<e.top&&(this.minY=e.top),this.maxY>e.bottom&&(this.maxY=e.bottom),this}fitBounds(e,s,r,i){return this.minX<e&&(this.minX=e),this.maxX>s&&(this.maxX=s),this.minY<r&&(this.minY=r),this.maxY>i&&(this.maxY=i),this}pad(e,s=e){return this.minX-=e,this.maxX+=e,this.minY-=s,this.maxY+=s,this}ceil(){return this.minX=Math.floor(this.minX),this.minY=Math.floor(this.minY),this.maxX=Math.ceil(this.maxX),this.maxY=Math.ceil(this.maxY),this}clone(){return new Ns(this.minX,this.minY,this.maxX,this.maxY)}scale(e,s=e){return this.minX*=e,this.minY*=s,this.maxX*=e,this.maxY*=s,this}get x(){return this.minX}set x(e){const s=this.maxX-this.minX;this.minX=e,this.maxX=e+s}get y(){return this.minY}set y(e){const s=this.maxY-this.minY;this.minY=e,this.maxY=e+s}get width(){return this.maxX-this.minX}set width(e){this.maxX=this.minX+e}get height(){return this.maxY-this.minY}set height(e){this.maxY=this.minY+e}get left(){return this.minX}get right(){return this.maxX}get top(){return this.minY}get bottom(){return this.maxY}get isPositive(){return this.maxX-this.minX>0&&this.maxY-this.minY>0}get isValid(){return this.minX+this.minY!==1/0}addVertexData(e,s,r,i){let a=this.minX,c=this.minY,o=this.maxX,h=this.maxY;i||(i=this.matrix);const u=i.a,f=i.b,d=i.c,g=i.d,_=i.tx,k=i.ty;for(let S=s;S<r;S+=2){const m=e[S],x=e[S+1],v=u*m+d*x+_,b=f*m+g*x+k;a=v<a?v:a,c=b<c?b:c,o=v>o?v:o,h=b>h?b:h}this.minX=a,this.minY=c,this.maxX=o,this.maxY=h}containsPoint(e,s){return this.minX<=e&&this.minY<=s&&this.maxX>=e&&this.maxY>=s}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}copyFrom(e){return this.minX=e.minX,this.minY=e.minY,this.maxX=e.maxX,this.maxY=e.maxY,this}}var RC={grad:.9,turn:360,rad:360/(2*Math.PI)},lr=function(t){return typeof t=="string"?t.length>0:typeof t=="number"},kt=function(t,e,s){return e===void 0&&(e=0),s===void 0&&(s=Math.pow(10,e)),Math.round(s*t)/s+0},ws=function(t,e,s){return e===void 0&&(e=0),s===void 0&&(s=1),t>s?s:t>e?t:e},By=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},P_=function(t){return{r:ws(t.r,0,255),g:ws(t.g,0,255),b:ws(t.b,0,255),a:ws(t.a)}},Lu=function(t){return{r:kt(t.r),g:kt(t.g),b:kt(t.b),a:kt(t.a,3)}},DC=/^#([0-9a-f]{3,8})$/i,yl=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},jy=function(t){var e=t.r,s=t.g,r=t.b,i=t.a,a=Math.max(e,s,r),c=a-Math.min(e,s,r),o=c?a===e?(s-r)/c:a===s?2+(r-e)/c:4+(e-s)/c:0;return{h:60*(o<0?o+6:o),s:a?c/a*100:0,v:a/255*100,a:i}},Iy=function(t){var e=t.h,s=t.s,r=t.v,i=t.a;e=e/360*6,s/=100,r/=100;var a=Math.floor(e),c=r*(1-s),o=r*(1-(e-a)*s),h=r*(1-(1-e+a)*s),u=a%6;return{r:255*[r,o,c,c,h,r][u],g:255*[h,r,r,o,c,c][u],b:255*[c,c,h,r,r,o][u],a:i}},M_=function(t){return{h:By(t.h),s:ws(t.s,0,100),l:ws(t.l,0,100),a:ws(t.a)}},A_=function(t){return{h:kt(t.h),s:kt(t.s),l:kt(t.l),a:kt(t.a,3)}},T_=function(t){return Iy((s=(e=t).s,{h:e.h,s:(s*=((r=e.l)<50?r:100-r)/100)>0?2*s/(r+s)*100:0,v:r+s,a:e.a}));var e,s,r},Ro=function(t){return{h:(e=jy(t)).h,s:(i=(200-(s=e.s))*(r=e.v)/100)>0&&i<200?s*r/100/(i<=100?i:200-i)*100:0,l:i/2,a:e.a};var e,s,r,i},LC=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,BC=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,jC=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,IC=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Rd={string:[[function(t){var e=DC.exec(t);return e?(t=e[1]).length<=4?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:t.length===4?kt(parseInt(t[3]+t[3],16)/255,2):1}:t.length===6||t.length===8?{r:parseInt(t.substr(0,2),16),g:parseInt(t.substr(2,2),16),b:parseInt(t.substr(4,2),16),a:t.length===8?kt(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=jC.exec(t)||IC.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:P_({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:e[7]===void 0?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(t){var e=LC.exec(t)||BC.exec(t);if(!e)return null;var s,r,i=M_({h:(s=e[1],r=e[2],r===void 0&&(r="deg"),Number(s)*(RC[r]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return T_(i)},"hsl"]],object:[[function(t){var e=t.r,s=t.g,r=t.b,i=t.a,a=i===void 0?1:i;return lr(e)&&lr(s)&&lr(r)?P_({r:Number(e),g:Number(s),b:Number(r),a:Number(a)}):null},"rgb"],[function(t){var e=t.h,s=t.s,r=t.l,i=t.a,a=i===void 0?1:i;if(!lr(e)||!lr(s)||!lr(r))return null;var c=M_({h:Number(e),s:Number(s),l:Number(r),a:Number(a)});return T_(c)},"hsl"],[function(t){var e=t.h,s=t.s,r=t.v,i=t.a,a=i===void 0?1:i;if(!lr(e)||!lr(s)||!lr(r))return null;var c=(function(o){return{h:By(o.h),s:ws(o.s,0,100),v:ws(o.v,0,100),a:ws(o.a)}})({h:Number(e),s:Number(s),v:Number(r),a:Number(a)});return Iy(c)},"hsv"]]},R_=function(t,e){for(var s=0;s<e.length;s++){var r=e[s][0](t);if(r)return[r,e[s][1]]}return[null,void 0]},NC=function(t){return typeof t=="string"?R_(t.trim(),Rd.string):typeof t=="object"&&t!==null?R_(t,Rd.object):[null,void 0]},Bu=function(t,e){var s=Ro(t);return{h:s.h,s:ws(s.s+100*e,0,100),l:s.l,a:s.a}},ju=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},D_=function(t,e){var s=Ro(t);return{h:s.h,s:s.s,l:ws(s.l+100*e,0,100),a:s.a}},Dd=(function(){function t(e){this.parsed=NC(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return t.prototype.isValid=function(){return this.parsed!==null},t.prototype.brightness=function(){return kt(ju(this.rgba),2)},t.prototype.isDark=function(){return ju(this.rgba)<.5},t.prototype.isLight=function(){return ju(this.rgba)>=.5},t.prototype.toHex=function(){return e=Lu(this.rgba),s=e.r,r=e.g,i=e.b,c=(a=e.a)<1?yl(kt(255*a)):"","#"+yl(s)+yl(r)+yl(i)+c;var e,s,r,i,a,c},t.prototype.toRgb=function(){return Lu(this.rgba)},t.prototype.toRgbString=function(){return e=Lu(this.rgba),s=e.r,r=e.g,i=e.b,(a=e.a)<1?"rgba("+s+", "+r+", "+i+", "+a+")":"rgb("+s+", "+r+", "+i+")";var e,s,r,i,a},t.prototype.toHsl=function(){return A_(Ro(this.rgba))},t.prototype.toHslString=function(){return e=A_(Ro(this.rgba)),s=e.h,r=e.s,i=e.l,(a=e.a)<1?"hsla("+s+", "+r+"%, "+i+"%, "+a+")":"hsl("+s+", "+r+"%, "+i+"%)";var e,s,r,i,a},t.prototype.toHsv=function(){return e=jy(this.rgba),{h:kt(e.h),s:kt(e.s),v:kt(e.v),a:kt(e.a,3)};var e},t.prototype.invert=function(){return Gs({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},t.prototype.saturate=function(e){return e===void 0&&(e=.1),Gs(Bu(this.rgba,e))},t.prototype.desaturate=function(e){return e===void 0&&(e=.1),Gs(Bu(this.rgba,-e))},t.prototype.grayscale=function(){return Gs(Bu(this.rgba,-1))},t.prototype.lighten=function(e){return e===void 0&&(e=.1),Gs(D_(this.rgba,e))},t.prototype.darken=function(e){return e===void 0&&(e=.1),Gs(D_(this.rgba,-e))},t.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},t.prototype.alpha=function(e){return typeof e=="number"?Gs({r:(s=this.rgba).r,g:s.g,b:s.b,a:e}):kt(this.rgba.a,3);var s},t.prototype.hue=function(e){var s=Ro(this.rgba);return typeof e=="number"?Gs({h:e,s:s.s,l:s.l,a:s.a}):kt(s.h)},t.prototype.isEqual=function(e){return this.toHex()===Gs(e).toHex()},t})(),Gs=function(t){return t instanceof Dd?t:new Dd(t)},L_=[],OC=function(t){t.forEach(function(e){L_.indexOf(e)<0&&(e(Dd,Rd),L_.push(e))})};function FC(t,e){var s={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},r={};for(var i in s)r[s[i]]=i;var a={};t.prototype.toName=function(c){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var o,h,u=r[this.toHex()];if(u)return u;if(c!=null&&c.closest){var f=this.toRgb(),d=1/0,g="black";if(!a.length)for(var _ in s)a[_]=new t(s[_]).toRgb();for(var k in s){var S=(o=f,h=a[k],Math.pow(o.r-h.r,2)+Math.pow(o.g-h.g,2)+Math.pow(o.b-h.b,2));S<d&&(d=S,g=k)}return g}},e.string.push([function(c){var o=c.toLowerCase(),h=o==="transparent"?"#0000":s[o];return h?new t(h).toRgb():null},"name"])}OC([FC]);const vn=class So{constructor(e=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=e}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(e){return this.value=e,this}set value(e){if(e instanceof So)this._value=this._cloneSource(e._value),this._int=e._int,this._components.set(e._components);else{if(e===null)throw new Error("Cannot set Color#value to null");(this._value===null||!this._isSourceEqual(this._value,e))&&(this._value=this._cloneSource(e),this._normalize(this._value))}}get value(){return this._value}_cloneSource(e){return typeof e=="string"||typeof e=="number"||e instanceof Number||e===null?e:Array.isArray(e)||ArrayBuffer.isView(e)?e.slice(0):typeof e=="object"&&e!==null?{...e}:e}_isSourceEqual(e,s){const r=typeof e;if(r!==typeof s)return!1;if(r==="number"||r==="string"||e instanceof Number)return e===s;if(Array.isArray(e)&&Array.isArray(s)||ArrayBuffer.isView(e)&&ArrayBuffer.isView(s))return e.length!==s.length?!1:e.every((a,c)=>a===s[c]);if(e!==null&&s!==null){const a=Object.keys(e),c=Object.keys(s);return a.length!==c.length?!1:a.every(o=>e[o]===s[o])}return e===s}toRgba(){const[e,s,r,i]=this._components;return{r:e,g:s,b:r,a:i}}toRgb(){const[e,s,r]=this._components;return{r:e,g:s,b:r}}toRgbaString(){const[e,s,r]=this.toUint8RgbArray();return`rgba(${e},${s},${r},${this.alpha})`}toUint8RgbArray(e){const[s,r,i]=this._components;return this._arrayRgb||(this._arrayRgb=[]),e||(e=this._arrayRgb),e[0]=Math.round(s*255),e[1]=Math.round(r*255),e[2]=Math.round(i*255),e}toArray(e){this._arrayRgba||(this._arrayRgba=[]),e||(e=this._arrayRgba);const[s,r,i,a]=this._components;return e[0]=s,e[1]=r,e[2]=i,e[3]=a,e}toRgbArray(e){this._arrayRgb||(this._arrayRgb=[]),e||(e=this._arrayRgb);const[s,r,i]=this._components;return e[0]=s,e[1]=r,e[2]=i,e}toNumber(){return this._int}toBgrNumber(){const[e,s,r]=this.toUint8RgbArray();return(r<<16)+(s<<8)+e}toLittleEndianNumber(){const e=this._int;return(e>>16)+(e&65280)+((e&255)<<16)}multiply(e){const[s,r,i,a]=So._temp.setValue(e)._components;return this._components[0]*=s,this._components[1]*=r,this._components[2]*=i,this._components[3]*=a,this._refreshInt(),this._value=null,this}premultiply(e,s=!0){return s&&(this._components[0]*=e,this._components[1]*=e,this._components[2]*=e),this._components[3]=e,this._refreshInt(),this._value=null,this}toPremultiplied(e,s=!0){if(e===1)return(255<<24)+this._int;if(e===0)return s?0:this._int;let r=this._int>>16&255,i=this._int>>8&255,a=this._int&255;return s&&(r=r*e+.5|0,i=i*e+.5|0,a=a*e+.5|0),(e*255<<24)+(r<<16)+(i<<8)+a}toHex(){const e=this._int.toString(16);return`#${"000000".substring(0,6-e.length)+e}`}toHexa(){const s=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-s.length)+s}setAlpha(e){return this._components[3]=this._clamp(e),this._value=null,this}_normalize(e){let s,r,i,a;if((typeof e=="number"||e instanceof Number)&&e>=0&&e<=16777215){const c=e;s=(c>>16&255)/255,r=(c>>8&255)/255,i=(c&255)/255,a=1}else if((Array.isArray(e)||e instanceof Float32Array)&&e.length>=3&&e.length<=4)e=this._clamp(e),[s,r,i,a=1]=e;else if((e instanceof Uint8Array||e instanceof Uint8ClampedArray)&&e.length>=3&&e.length<=4)e=this._clamp(e,0,255),[s,r,i,a=255]=e,s/=255,r/=255,i/=255,a/=255;else if(typeof e=="string"||typeof e=="object"){if(typeof e=="string"){const o=So.HEX_PATTERN.exec(e);o&&(e=`#${o[2]}`)}const c=Gs(e);c.isValid()&&({r:s,g:r,b:i,a}=c.rgba,s/=255,r/=255,i/=255)}if(s!==void 0)this._components[0]=s,this._components[1]=r,this._components[2]=i,this._components[3]=a,this._refreshInt();else throw new Error(`Unable to convert color ${e}`)}_refreshInt(){this._clamp(this._components);const[e,s,r]=this._components;this._int=(e*255<<16)+(s*255<<8)+(r*255|0)}_clamp(e,s=0,r=1){return typeof e=="number"?Math.min(Math.max(e,s),r):(e.forEach((i,a)=>{e[a]=Math.min(Math.max(i,s),r)}),e)}static isColorLike(e){return typeof e=="number"||typeof e=="string"||e instanceof Number||e instanceof So||Array.isArray(e)||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Float32Array||e.r!==void 0&&e.g!==void 0&&e.b!==void 0||e.r!==void 0&&e.g!==void 0&&e.b!==void 0&&e.a!==void 0||e.h!==void 0&&e.s!==void 0&&e.l!==void 0||e.h!==void 0&&e.s!==void 0&&e.l!==void 0&&e.a!==void 0||e.h!==void 0&&e.s!==void 0&&e.v!==void 0||e.h!==void 0&&e.s!==void 0&&e.v!==void 0&&e.a!==void 0}};vn.shared=new vn;vn._temp=new vn;vn.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let Ss=vn;const $C={cullArea:null,cullable:!1,cullableChildren:!0};let Iu=0;const B_=500;function Ht(...t){Iu!==B_&&(Iu++,Iu===B_?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...t))}const Sc={_registeredResources:new Set,register(t){this._registeredResources.add(t)},unregister(t){this._registeredResources.delete(t)},release(){this._registeredResources.forEach(t=>t.clear())},get registeredCount(){return this._registeredResources.size},isRegistered(t){return this._registeredResources.has(t)},reset(){this._registeredResources.clear()}};class HC{constructor(e,s){this._pool=[],this._count=0,this._index=0,this._classType=e,s&&this.prepopulate(s)}prepopulate(e){for(let s=0;s<e;s++)this._pool[this._index++]=new this._classType;this._count+=e}get(e){var r;let s;return this._index>0?s=this._pool[--this._index]:(s=new this._classType,this._count++),(r=s.init)==null||r.call(s,e),s}return(e){var s;(s=e.reset)==null||s.call(e),this._pool[this._index++]=e}get totalSize(){return this._count}get totalFree(){return this._index}get totalUsed(){return this._count-this._index}clear(){if(this._pool.length>0&&this._pool[0].destroy)for(let e=0;e<this._index;e++)this._pool[e].destroy();this._pool.length=0,this._count=0,this._index=0}}class UC{constructor(){this._poolsByClass=new Map}prepopulate(e,s){this.getPool(e).prepopulate(s)}get(e,s){return this.getPool(e).get(s)}return(e){this.getPool(e.constructor).return(e)}getPool(e){return this._poolsByClass.has(e)||this._poolsByClass.set(e,new HC(e)),this._poolsByClass.get(e)}stats(){const e={};return this._poolsByClass.forEach(s=>{const r=e[s._classType.name]?s._classType.name+s._classType.ID:s._classType.name;e[r]={free:s.totalFree,used:s.totalUsed,size:s.totalSize}}),e}clear(){this._poolsByClass.forEach(e=>e.clear()),this._poolsByClass.clear()}}const ts=new UC;Sc.register(ts);const WC={get isCachedAsTexture(){var t;return!!((t=this.renderGroup)!=null&&t.isCachedAsTexture)},cacheAsTexture(t){typeof t=="boolean"&&t===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(t===!0?{}:t))},updateCacheTexture(){var t;(t=this.renderGroup)==null||t.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(t){je("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(t)}};function zC(t,e,s){const r=t.length;let i;if(e>=r||s===0)return;s=e+s>r?r-e:s;const a=r-s;for(i=e;i<a;++i)t[i]=t[i+s];t.length=a}const VC={allowChildren:!0,removeChildren(t=0,e){var a;const s=e??this.children.length,r=s-t,i=[];if(r>0&&r<=s){for(let o=s-1;o>=t;o--){const h=this.children[o];h&&(i.push(h),h.parent=null)}zC(this.children,t,s);const c=this.renderGroup||this.parentRenderGroup;c&&c.removeChildren(i);for(let o=0;o<i.length;++o){const h=i[o];(a=h.parentRenderLayer)==null||a.detach(h),this.emit("childRemoved",h,this,o),i[o].emit("removed",this)}return i.length>0&&this._didViewChangeTick++,i}else if(r===0&&this.children.length===0)return i;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(t){const e=this.getChildAt(t);return this.removeChild(e)},getChildAt(t){if(t<0||t>=this.children.length)throw new Error(`getChildAt: Index (${t}) does not exist.`);return this.children[t]},setChildIndex(t,e){if(e<0||e>=this.children.length)throw new Error(`The index ${e} supplied is out of bounds ${this.children.length}`);this.getChildIndex(t),this.addChildAt(t,e)},getChildIndex(t){const e=this.children.indexOf(t);if(e===-1)throw new Error("The supplied Container must be a child of the caller");return e},addChildAt(t,e){this.allowChildren||je(xt,"addChildAt: Only Containers will be allowed to add children in v8.0.0");const{children:s}=this;if(e<0||e>s.length)throw new Error(`${t}addChildAt: The index ${e} supplied is out of bounds ${s.length}`);const r=t.parent===this;if(t.parent){const a=t.parent.children.indexOf(t);if(r){if(a===e)return t;t.parent.children.splice(a,1)}else t.removeFromParent()}e===s.length?s.push(t):s.splice(e,0,t);const i=this.renderGroup||this.parentRenderGroup;return this.sortableChildren&&(this.sortDirty=!0),r?(i&&(i.structureDidChange=!0),t):(t.parent=this,t.didChange=!0,t._updateFlags=15,i&&i.addChild(t),this.emit("childAdded",t,this,e),t.emit("added",this),t)},swapChildren(t,e){if(t===e)return;const s=this.getChildIndex(t),r=this.getChildIndex(e);this.children[s]=e,this.children[r]=t;const i=this.renderGroup||this.parentRenderGroup;i&&(i.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){var t;(t=this.parent)==null||t.removeChild(this)},reparentChild(...t){return t.length===1?this.reparentChildAt(t[0],this.children.length):(t.forEach(e=>this.reparentChildAt(e,this.children.length)),t[0])},reparentChildAt(t,e){if(t.parent===this)return this.setChildIndex(t,e),t;const s=t.worldTransform.clone();t.removeFromParent(),this.addChildAt(t,e);const r=this.worldTransform.clone();return r.invert(),s.prepend(r),t.setFromMatrix(s),t},replaceChild(t,e){t.updateLocalTransform(),this.addChildAt(e,this.getChildIndex(t)),e.setFromMatrix(t.localTransform),e.updateLocalTransform(),this.removeChild(t)}},GC={collectRenderables(t,e,s){this.parentRenderLayer&&this.parentRenderLayer!==s||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(t,e,s):this.renderGroup?e.renderPipes.renderGroup.addRenderGroup(this.renderGroup,t):this.collectRenderablesWithEffects(t,e,s))},collectRenderablesSimple(t,e,s){const r=this.children,i=r.length;for(let a=0;a<i;a++)r[a].collectRenderables(t,e,s)},collectRenderablesWithEffects(t,e,s){const{renderPipes:r}=e;for(let i=0;i<this.effects.length;i++){const a=this.effects[i];r[a.pipe].push(a,this,t)}this.collectRenderablesSimple(t,e,s);for(let i=this.effects.length-1;i>=0;i--){const a=this.effects[i];r[a.pipe].pop(a,this,t)}}};class j_{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let e=0;e<this.filters.length;e++)this.filters[e].destroy();this.filters=null,this.filterArea=null}}class qC{constructor(){this._effectClasses=[],this._tests=[],this._initialized=!1}init(){this._initialized||(this._initialized=!0,this._effectClasses.forEach(e=>{this.add({test:e.test,maskClass:e})}))}add(e){this._tests.push(e)}getMaskEffect(e){this._initialized||this.init();for(let s=0;s<this._tests.length;s++){const r=this._tests[s];if(r.test(e))return ts.get(r.maskClass,e)}return e}returnMaskEffect(e){ts.return(e)}}const Ld=new qC;Mt.handleByList(Fe.MaskEffect,Ld._effectClasses);const KC={_maskEffect:null,_maskOptions:{inverse:!1,channel:"red"},_filterEffect:null,effects:[],_markStructureAsChanged(){const t=this.renderGroup||this.parentRenderGroup;t&&(t.structureDidChange=!0)},addEffect(t){this.effects.indexOf(t)===-1&&(this.effects.push(t),this.effects.sort((s,r)=>s.priority-r.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(t){const e=this.effects.indexOf(t);e!==-1&&(this.effects.splice(e,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(t){const e=this._maskEffect;(e==null?void 0:e.mask)!==t&&(e&&(this.removeEffect(e),Ld.returnMaskEffect(e),this._maskEffect=null),t!=null&&(this._maskEffect=Ld.getMaskEffect(t),this.addEffect(this._maskEffect)))},get mask(){var t;return(t=this._maskEffect)==null?void 0:t.mask},setMask(t){this._maskOptions={...this._maskOptions,...t},t.mask&&(this.mask=t.mask),this._markStructureAsChanged()},set filters(t){var a;!Array.isArray(t)&&t&&(t=[t]);const e=this._filterEffect||(this._filterEffect=new j_);t=t;const s=(t==null?void 0:t.length)>0,r=((a=e.filters)==null?void 0:a.length)>0,i=s!==r;t=Array.isArray(t)?t.slice(0):t,e.filters=Object.freeze(t),i&&(s?this.addEffect(e):(this.removeEffect(e),e.filters=t??null))},get filters(){var t;return(t=this._filterEffect)==null?void 0:t.filters},set filterArea(t){this._filterEffect||(this._filterEffect=new j_),this._filterEffect.filterArea=t},get filterArea(){var t;return(t=this._filterEffect)==null?void 0:t.filterArea}},YC={label:null,get name(){return je(xt,"Container.name property has been removed, use Container.label instead"),this.label},set name(t){je(xt,"Container.name property has been removed, use Container.label instead"),this.label=t},getChildByName(t,e=!1){return this.getChildByLabel(t,e)},getChildByLabel(t,e=!1){const s=this.children;for(let r=0;r<s.length;r++){const i=s[r];if(i.label===t||t instanceof RegExp&&t.test(i.label))return i}if(e)for(let r=0;r<s.length;r++){const a=s[r].getChildByLabel(t,!0);if(a)return a}return null},getChildrenByLabel(t,e=!1,s=[]){const r=this.children;for(let i=0;i<r.length;i++){const a=r[i];(a.label===t||t instanceof RegExp&&t.test(a.label))&&s.push(a)}if(e)for(let i=0;i<r.length;i++)r[i].getChildrenByLabel(t,!0,s);return s}},Gt=ts.getPool(Ne),ur=ts.getPool(Ns),XC=new Ne,QC={getFastGlobalBounds(t,e){e||(e=new Ns),e.clear(),this._getGlobalBoundsRecursive(!!t,e,this.parentRenderLayer),e.isValid||e.set(0,0,0,0);const s=this.renderGroup||this.parentRenderGroup;return e.applyMatrix(s.worldTransform),e},_getGlobalBoundsRecursive(t,e,s){let r=e;if(t&&this.parentRenderLayer&&this.parentRenderLayer!==s||this.localDisplayStatus!==7||!this.measurable)return;const i=!!this.effects.length;if((this.renderGroup||i)&&(r=ur.get().clear()),this.boundsArea)e.addRect(this.boundsArea,this.worldTransform);else{if(this.renderPipeId){const c=this.bounds;r.addFrame(c.minX,c.minY,c.maxX,c.maxY,this.groupTransform)}const a=this.children;for(let c=0;c<a.length;c++)a[c]._getGlobalBoundsRecursive(t,r,s)}if(i){let a=!1;const c=this.renderGroup||this.parentRenderGroup;for(let o=0;o<this.effects.length;o++)this.effects[o].addBounds&&(a||(a=!0,r.applyMatrix(c.worldTransform)),this.effects[o].addBounds(r,!0));a&&r.applyMatrix(c.worldTransform.copyTo(XC).invert()),e.addBounds(r),ur.return(r)}else this.renderGroup&&(e.addBounds(r,this.relativeGroupTransform),ur.return(r))}};function Ny(t,e,s){s.clear();let r,i;return t.parent?e?r=t.parent.worldTransform:(i=Gt.get().identity(),r=wf(t,i)):r=Ne.IDENTITY,Oy(t,s,r,e),i&&Gt.return(i),s.isValid||s.set(0,0,0,0),s}function Oy(t,e,s,r){var o,h;if(!t.visible||!t.measurable)return;let i;r?i=t.worldTransform:(t.updateLocalTransform(),i=Gt.get(),i.appendFrom(t.localTransform,s));const a=e,c=!!t.effects.length;if(c&&(e=ur.get().clear()),t.boundsArea)e.addRect(t.boundsArea,i);else{const u=t.bounds;u&&!u.isEmpty()&&(e.matrix=i,e.addBounds(u));for(let f=0;f<t.children.length;f++)Oy(t.children[f],e,i,r)}if(c){for(let u=0;u<t.effects.length;u++)(h=(o=t.effects[u]).addBounds)==null||h.call(o,e);a.addBounds(e,Ne.IDENTITY),ur.return(e)}r||Gt.return(i)}function wf(t,e){const s=t.parent;return s&&(wf(s,e),s.updateLocalTransform(),e.append(s.localTransform)),e}function Fy(t,e){if(t===16777215||!e)return e;if(e===16777215||!t)return t;const s=t>>16&255,r=t>>8&255,i=t&255,a=e>>16&255,c=e>>8&255,o=e&255,h=s*a/255|0,u=r*c/255|0,f=i*o/255|0;return(h<<16)+(u<<8)+f}const I_=16777215;function N_(t,e){return t===I_?e:e===I_?t:Fy(t,e)}function zl(t){return((t&255)<<16)+(t&65280)+(t>>16&255)}const ZC={getGlobalAlpha(t){if(t)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let e=this.alpha,s=this.parent;for(;s;)e*=s.alpha,s=s.parent;return e},getGlobalTransform(t=new Ne,e){if(e)return t.copyFrom(this.worldTransform);this.updateLocalTransform();const s=wf(this,Gt.get().identity());return t.appendFrom(this.localTransform,s),Gt.return(s),t},getGlobalTint(t){if(t)return this.renderGroup?zl(this.renderGroup.worldColor):this.parentRenderGroup?zl(N_(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let e=this.localColor,s=this.parent;for(;s;)e=N_(e,s.localColor),s=s.parent;return zl(e)}};function $y(t,e,s){return e.clear(),s||(s=Ne.IDENTITY),Hy(t,e,s,t,!0),e.isValid||e.set(0,0,0,0),e}function Hy(t,e,s,r,i){var h,u;let a;if(i)a=Gt.get(),a=s.copyTo(a);else{if(!t.visible||!t.measurable)return;t.updateLocalTransform();const f=t.localTransform;a=Gt.get(),a.appendFrom(f,s)}const c=e,o=!!t.effects.length;if(o&&(e=ur.get().clear()),t.boundsArea)e.addRect(t.boundsArea,a);else{t.renderPipeId&&(e.matrix=a,e.addBounds(t.bounds));const f=t.children;for(let d=0;d<f.length;d++)Hy(f[d],e,a,r,!1)}if(o){for(let f=0;f<t.effects.length;f++)(u=(h=t.effects[f]).addLocalBounds)==null||u.call(h,e,r);c.addBounds(e,Ne.IDENTITY),ur.return(e)}Gt.return(a)}function Uy(t,e){const s=t.children;for(let r=0;r<s.length;r++){const i=s[r],a=i.uid,c=(i._didViewChangeTick&65535)<<16|i._didContainerChangeTick&65535,o=e.index;(e.data[o]!==a||e.data[o+1]!==c)&&(e.data[e.index]=a,e.data[e.index+1]=c,e.didChange=!0),e.index=o+2,i.children.length&&Uy(i,e)}return e.didChange}const JC=new Ne,ek={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(t,e){const s=Math.sign(this.scale.x)||1;e!==0?this.scale.x=t/e*s:this.scale.x=s},_setHeight(t,e){const s=Math.sign(this.scale.y)||1;e!==0?this.scale.y=t/e*s:this.scale.y=s},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new Ns});const t=this._localBoundsCacheData;return t.index=1,t.didChange=!1,t.data[0]!==this._didViewChangeTick&&(t.didChange=!0,t.data[0]=this._didViewChangeTick),Uy(this,t),t.didChange&&$y(this,t.localBounds,JC),t.localBounds},getBounds(t,e){return Ny(this,t,e||new Ns)}},tk={_onRender:null,set onRender(t){const e=this.renderGroup||this.parentRenderGroup;if(!t){this._onRender&&(e==null||e.removeOnRender(this)),this._onRender=null;return}this._onRender||e==null||e.addOnRender(this),this._onRender=t},get onRender(){return this._onRender}},sk={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(t){this._zIndex!==t&&(this._zIndex=t,this.depthOfChildModified())},depthOfChildModified(){this.parent&&(this.parent.sortableChildren=!0,this.parent.sortDirty=!0),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0)},sortChildren(){this.sortDirty&&(this.sortDirty=!1,this.children.sort(rk))}};function rk(t,e){return t._zIndex-e._zIndex}const ik={getGlobalPosition(t=new Ft,e=!1){return this.parent?this.parent.toGlobal(this._position,t,e):(t.x=this._position.x,t.y=this._position.y),t},toGlobal(t,e,s=!1){const r=this.getGlobalTransform(Gt.get(),s);return e=r.apply(t,e),Gt.return(r),e},toLocal(t,e,s,r){e&&(t=e.toGlobal(t,s,r));const i=this.getGlobalTransform(Gt.get(),r);return s=i.applyInverse(t,s),Gt.return(i),s}};class Sf{constructor(){this.uid=rt("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.gcTick=0}reset(){this.instructionSize=0}destroy(){var e,s;if(this.renderPipes)for(const r in this.renderPipes)(s=(e=this.renderPipes[r]).destroyInstructionSet)==null||s.call(e,this);this.instructions.length=0,this.renderables.length=0,this.renderPipes=null,this.gcTick=0}add(e){this.instructions[this.instructionSize++]=e}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}class nk{constructor(){this._screenSizes=new Map,this._widths=[],this._heights=[]}get size(){return this._screenSizes.size}set(e,s,r){const i=this._screenSizes.get(e);return i&&i.pixelWidth===s&&i.pixelHeight===r?!1:(this._screenSizes.set(e,{pixelWidth:s,pixelHeight:r}),this._update(),!0)}remove(e){return this._screenSizes.delete(e)?(this._update(),!0):!1}getFittingWidth(e){return this._getFittingAxis(e,this._widths)}getFittingHeight(e){return this._getFittingAxis(e,this._heights)}hasWidth(e){return this._widths.includes(e)}hasHeight(e){return this._heights.includes(e)}_getFittingAxis(e,s){for(let r=0;r<s.length;r++){const i=s[r];if(i>=e)return i}}_update(){this._widths=[...this._screenSizes.values()].map(e=>e.pixelWidth).filter((e,s,r)=>r.indexOf(e)===s).sort((e,s)=>e-s),this._heights=[...this._screenSizes.values()].map(e=>e.pixelHeight).filter((e,s,r)=>r.indexOf(e)===s).sort((e,s)=>e-s)}}let ok=0;const Nu=32767,ak=4294967296,lk=8589934592,O_=Object.create(null);let ck=0;function hk(t){const e=O_[t];return e!==void 0?e:O_[t]=ck++}function uk(t,e,s,r,i,a){return(t<<17)+(e<<2)+((r?1:0)<<1)+(s?1:0)+(a==="nearest"?1:0)*ak+hk(i)*lk}class dk{constructor(e){this._buckets=new Map,this._poolKey=Object.create(null),this._poolStyle=Object.create(null),this._screens=new nk,this._enableFullScreen=!1,this.textureOptions=e||{}}get textureStyle(){return je(rn,"TexturePool.textureStyle is no longer used, pooled textures carry their own style. Pass scaleMode in the request instead."),this._textureStyle||(this._textureStyle=new To(this.textureOptions)),this._textureStyle}set textureStyle(e){je(rn,"TexturePool.textureStyle is no longer used, pooled textures carry their own style. Pass scaleMode in the request instead."),this._textureStyle=e}get enableFullScreen(){return je(rn,"TexturePool.enableFullScreen is no longer used, the pool sizes textures to the screens registered with setScreenSize."),this._enableFullScreen}set enableFullScreen(e){je(rn,"TexturePool.enableFullScreen is no longer used, the pool sizes textures to the screens registered with setScreenSize."),this._enableFullScreen=e}createTexture(...e){let s=e[0];typeof s=="number"&&(je(rn,"TexturePool.createTexture params are now an options object. See params: { width, height, antialias, autoGenerateMipmaps }"),s={width:s,height:e[1],antialias:e[2]??!1,autoGenerateMipmaps:e[3]??!1});const r=s.format??this.textureOptions.format??hs.defaultOptions.format,i=s.scaleMode??this.textureOptions.scaleMode??To.defaultOptions.scaleMode,a=new hs({...this.textureOptions,width:s.width,height:s.height,resolution:1,antialias:s.antialias??!1,autoGarbageCollect:!1,autoGenerateMipmaps:s.autoGenerateMipmaps??!1,format:r,scaleMode:i});return new Ve({source:a,label:`texturePool_${ok++}`})}getOptimalTexture(...e){let s=e[0];typeof s=="number"&&(je(rn,"TexturePool.getOptimalTexture params are now an options object. See params: { width, height, resolution, antialias, autoGenerateMipmaps }"),s={width:s,height:e[1],resolution:e[2]??1,antialias:e[3]??!1,autoGenerateMipmaps:e[4]??!1});const r=s.width,i=s.height,a=s.resolution??1,c=s.antialias??!1,o=s.autoGenerateMipmaps??!1,h=s.format??this.textureOptions.format??hs.defaultOptions.format,u=s.scaleMode??this.textureOptions.scaleMode??To.defaultOptions.scaleMode,{width:f,height:d}=this.getOptimalSize(r,i,a);(f>Nu||d>Nu)&&Ht(`TexturePool: ${f}x${d} is larger than the ${Nu}px pool key limit, textures of this size may be pooled together`);const g=uk(f,d,c,o,h,u);let _=this._buckets.get(g);_||(_=[],this._buckets.set(g,_));let k=_.pop();return k||(k=this.createTexture({width:f,height:d,antialias:c,autoGenerateMipmaps:o,format:h,scaleMode:u}),this._poolStyle[k.uid]=k.source.style),k.source._resolution=a,k.source.width=f/a,k.source.height=d/a,k.source.pixelWidth=f,k.source.pixelHeight=d,k.frame.x=0,k.frame.y=0,k.frame.width=r,k.frame.height=i,k.updateUvs(),this._poolKey[k.uid]=g,k}getOptimalSize(e,s,r=1){const i=Math.ceil(e*r-1e-6),a=Math.ceil(s*r-1e-6),c=S_(i),o=this._screens.getFittingWidth(i),h=S_(a),u=this._screens.getFittingHeight(a);return{width:o!==void 0?Math.min(o,c):c,height:u!==void 0?Math.min(u,h):h}}getSameSizeTexture(e,s=!1){const r=e.source;return this.getOptimalTexture({width:e.width,height:e.height,resolution:r._resolution,antialias:s})}returnTexture(e,s=!1){const r=e.uid,i=this._poolKey[r];if(i===void 0){Ht("TexturePool: returnTexture was passed a texture that did not come from this pool, ignoring it");return}const a=this._poolStyle[r];s&&e.source.style!==a&&(e.source.style=a);const c=this._buckets.get(i);if(!c){delete this._poolKey[r],delete this._poolStyle[r],e.destroy(!0);return}c.push(e)}setScreenSize(e,s,r){this._screens.set(e,s,r)&&this._pruneScreenTextures()}removeScreen(e){this._screens.remove(e)&&this._pruneScreenTextures()}_pruneScreenTextures(){for(const[e,s]of this._buckets){const r=e>>>0,i=r>>>17,a=r>>>2&32767;(Zl(i)||this._screens.hasWidth(i))&&(Zl(a)||this._screens.hasHeight(a))||(this._dropTextures(s,!0),this._buckets.delete(e))}}_dropTextures(e,s){for(let r=0;r<e.length;r++){const i=e[r];delete this._poolKey[i.uid],delete this._poolStyle[i.uid],s&&i.destroy(!0)}}clear(e){for(const s of this._buckets.values())this._dropTextures(s,e!==!1);this._buckets.clear()}}const Wy=new dk;Sc.register(Wy);class fk{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new Ne,this.worldColorAlpha=4294967295,this.worldColor=16777215,this.worldAlpha=1,this.childrenToUpdate=Object.create(null),this.updateTick=0,this.gcTick=0,this.childrenRenderablesToUpdate={list:[],index:0},this.structureDidChange=!0,this.instructionSet=new Sf,this._onRenderContainers=[],this.textureNeedsUpdate=!0,this.isCachedAsTexture=!1,this._matrixDirty=7}init(e){this.root=e,e._onRender&&this.addOnRender(e),e.didChange=!0;const s=e.children;for(let r=0;r<s.length;r++){const i=s[r];i._updateFlags=15,this.addChild(i)}}enableCacheAsTexture(e={}){this.textureOptions=e,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(Wy.returnTexture(this.texture),this.texture=null)}updateCacheTexture(){this.textureNeedsUpdate=!0;const e=this._parentCacheAsTextureRenderGroup;e&&!e.textureNeedsUpdate&&e.updateCacheTexture()}reset(){this.renderGroupChildren.length=0;for(const e in this.childrenToUpdate){const s=this.childrenToUpdate[e];s.list.fill(null),s.index=0}this.childrenRenderablesToUpdate.index=0,this.childrenRenderablesToUpdate.list.fill(null),this.root=null,this.updateTick=0,this.structureDidChange=!0,this._onRenderContainers.length=0,this.renderGroupParent=null,this.disableCacheAsTexture()}get localTransform(){return this.root.localTransform}addRenderGroupChild(e){e.renderGroupParent&&e.renderGroupParent._removeRenderGroupChild(e),e.renderGroupParent=this,this.renderGroupChildren.push(e)}_removeRenderGroupChild(e){const s=this.renderGroupChildren.indexOf(e);s>-1&&this.renderGroupChildren.splice(s,1),e.renderGroupParent=null}addChild(e){if(this.structureDidChange=!0,e.parentRenderGroup=this,e.updateTick=-1,e.parent===this.root?e.relativeRenderGroupDepth=1:e.relativeRenderGroupDepth=e.parent.relativeRenderGroupDepth+1,e.didChange=!0,this.onChildUpdate(e),e.renderGroup){this.addRenderGroupChild(e.renderGroup);return}e._onRender&&this.addOnRender(e);const s=e.children;for(let r=0;r<s.length;r++)this.addChild(s[r])}removeChild(e){if(this.structureDidChange=!0,e._onRender&&(e.renderGroup||this.removeOnRender(e)),e.parentRenderGroup=null,e.renderGroup){this._removeRenderGroupChild(e.renderGroup);return}const s=e.children;for(let r=0;r<s.length;r++)this.removeChild(s[r])}removeChildren(e){for(let s=0;s<e.length;s++)this.removeChild(e[s])}onChildUpdate(e){let s=this.childrenToUpdate[e.relativeRenderGroupDepth];s||(s=this.childrenToUpdate[e.relativeRenderGroupDepth]={index:0,list:[]}),s.list[s.index++]=e}updateRenderable(e){e.globalDisplayStatus<7||(this.instructionSet.renderPipes[e.renderPipeId].updateRenderable(e),e.didViewUpdate=!1)}onChildViewUpdate(e){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=e}get isRenderable(){return this.root.localDisplayStatus===7&&this.worldAlpha>0}addOnRender(e){this._onRenderContainers.indexOf(e)===-1&&this._onRenderContainers.push(e)}removeOnRender(e){const s=this._onRenderContainers.indexOf(e);s!==-1&&this._onRenderContainers.splice(s,1)}runOnRender(e){for(let s=0;s<this._onRenderContainers.length;s++)this._onRenderContainers[s]._onRender(e)}destroy(){var e;this.disableCacheAsTexture(),this.renderGroupParent=null,this.root=null,this.childrenRenderablesToUpdate=null,this.childrenToUpdate=null,this.renderGroupChildren=null,this._onRenderContainers=null,(e=this.instructionSet)==null||e.destroy(),this.instructionSet=null}getChildren(e=[]){const s=this.root.children;for(let r=0;r<s.length;r++)this._getChildren(s[r],e);return e}_getChildren(e,s=[]){if(s.push(e),e.renderGroup)return s;const r=e.children;for(let i=0;i<r.length;i++)this._getChildren(r[i],s);return s}invalidateMatrices(){this._matrixDirty=7}get inverseWorldTransform(){return(this._matrixDirty&1)===0?this._inverseWorldTransform:(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new Ne),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return(this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new Ne),this._textureOffsetInverseTransform.copyFrom(this.inverseWorldTransform).translate(-this._textureBounds.x,-this._textureBounds.y))}get inverseParentTextureTransform(){if((this._matrixDirty&4)===0)return this._inverseParentTextureTransform;this._matrixDirty&=-5;const e=this._parentCacheAsTextureRenderGroup;return e?(this._inverseParentTextureTransform||(this._inverseParentTextureTransform=new Ne),this._inverseParentTextureTransform.copyFrom(this.worldTransform).prepend(e.inverseWorldTransform).translate(-e._textureBounds.x,-e._textureBounds.y)):this.worldTransform}get cacheToLocalTransform(){return this.isCachedAsTexture?this.textureOffsetInverseTransform:this._parentCacheAsTextureRenderGroup?this._parentCacheAsTextureRenderGroup.textureOffsetInverseTransform:null}}function pk(t,e,s={}){for(const r in e)!s[r]&&e[r]!==void 0&&(t[r]=e[r])}const Ou=new Nt(null),bl=new Nt(null),Fu=new Nt(null,1,1),wl=new Nt(null),F_=1,mk=2,$u=4;class Qs extends Zs{constructor(e={}){var s,r;super(),this.uid=rt("renderable"),this._updateFlags=15,this.renderGroup=null,this.parentRenderGroup=null,this.parentRenderGroupIndex=0,this.didChange=!1,this.didViewUpdate=!1,this.relativeRenderGroupDepth=0,this.children=[],this.parent=null,this.includeInBuild=!0,this.measurable=!0,this.isSimple=!0,this.parentRenderLayer=null,this.updateTick=-1,this.localTransform=new Ne,this.relativeGroupTransform=new Ne,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new Nt(this,0,0),this._scale=Fu,this._pivot=bl,this._origin=wl,this._skew=Ou,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._rotation=0,this.localColor=16777215,this.localAlpha=1,this.groupAlpha=1,this.groupColor=16777215,this.groupColorAlpha=4294967295,this.localBlendMode="inherit",this.groupBlendMode="normal",this.localDisplayStatus=7,this.globalDisplayStatus=7,this._didContainerChangeTick=0,this._didViewChangeTick=0,this._didLocalTransformChangeId=-1,this.effects=[],pk(this,e,{children:!0,parent:!0,effects:!0}),(s=e.children)==null||s.forEach(i=>this.addChild(i)),(r=e.parent)==null||r.addChild(this)}static mixin(e){je("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),Mt.mixin(Qs,e)}set _didChangeId(e){this._didViewChangeTick=e>>12&4095,this._didContainerChangeTick=e&4095}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...e){if(this.allowChildren||je(xt,"addChild: Only Containers will be allowed to add children in v8.0.0"),e.length>1){for(let i=0;i<e.length;i++)this.addChild(e[i]);return e[0]}const s=e[0],r=this.renderGroup||this.parentRenderGroup;return s.parent===this?(this.children.splice(this.children.indexOf(s),1),this.children.push(s),r&&(r.structureDidChange=!0),s):(s.parent&&s.parent.removeChild(s),this.children.push(s),this.sortableChildren&&(this.sortDirty=!0),s.parent=this,s.didChange=!0,s._updateFlags=15,r&&r.addChild(s),this.emit("childAdded",s,this,this.children.length-1),s.emit("added",this),this._didViewChangeTick++,s._zIndex!==0&&s.depthOfChildModified(),s)}removeChild(...e){if(e.length>1){for(let i=0;i<e.length;i++)this.removeChild(e[i]);return e[0]}const s=e[0],r=this.children.indexOf(s);return r>-1&&(this._didViewChangeTick++,this.children.splice(r,1),this.renderGroup?this.renderGroup.removeChild(s):this.parentRenderGroup&&this.parentRenderGroup.removeChild(s),s.parentRenderLayer&&s.parentRenderLayer.detach(s),s.parent=null,this.emit("childRemoved",s,this,r),s.emit("removed",this)),s}_onUpdate(e){e&&e===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(e){!!this.renderGroup!==e&&(e?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;const e=this.parentRenderGroup;e==null||e.removeChild(this),this.renderGroup=ts.get(fk,this),this.groupTransform=Ne.IDENTITY,e==null||e.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;const e=this.parentRenderGroup;e==null||e.removeChild(this),ts.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,e==null||e.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0}get worldTransform(){return this._worldTransform||(this._worldTransform=new Ne),this.renderGroup?this._worldTransform.copyFrom(this.renderGroup.worldTransform):this.parentRenderGroup&&this._worldTransform.appendFrom(this.relativeGroupTransform,this.parentRenderGroup.worldTransform),this._worldTransform}get x(){return this._position.x}set x(e){this._position.x=e}get y(){return this._position.y}set y(e){this._position.y=e}get position(){return this._position}set position(e){this._position.copyFrom(e)}get rotation(){return this._rotation}set rotation(e){this._rotation!==e&&(this._rotation=e,this._onUpdate(this._skew))}get angle(){return this.rotation*vC}set angle(e){this.rotation=e*xC}get pivot(){return this._pivot===bl&&(this._pivot=new Nt(this,0,0)),this._pivot}set pivot(e){this._pivot===bl&&(this._pivot=new Nt(this,0,0),this._origin!==wl&&Ht("Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.")),typeof e=="number"?this._pivot.set(e):this._pivot.copyFrom(e)}get skew(){return this._skew===Ou&&(this._skew=new Nt(this,0,0)),this._skew}set skew(e){this._skew===Ou&&(this._skew=new Nt(this,0,0)),this._skew.copyFrom(e)}get scale(){return this._scale===Fu&&(this._scale=new Nt(this,1,1)),this._scale}set scale(e){this._scale===Fu&&(this._scale=new Nt(this,0,0)),typeof e=="string"&&(e=parseFloat(e)),typeof e=="number"?this._scale.set(e):this._scale.copyFrom(e)}get origin(){return this._origin===wl&&(this._origin=new Nt(this,0,0)),this._origin}set origin(e){this._origin===wl&&(this._origin=new Nt(this,0,0),this._pivot!==bl&&Ht("Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.")),typeof e=="number"?this._origin.set(e):this._origin.copyFrom(e)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(e){const s=this.getLocalBounds().width;this._setWidth(e,s)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(e){const s=this.getLocalBounds().height;this._setHeight(e,s)}getSize(e){e||(e={});const s=this.getLocalBounds();return e.width=Math.abs(this.scale.x*s.width),e.height=Math.abs(this.scale.y*s.height),e}setSize(e,s){const r=this.getLocalBounds();typeof e=="object"?(s=e.height??e.width,e=e.width):s??(s=e),e!==void 0&&this._setWidth(e,r.width),s!==void 0&&this._setHeight(s,r.height)}_updateSkew(){const e=this._rotation,s=this._skew;this._cx=Math.cos(e+s._y),this._sx=Math.sin(e+s._y),this._cy=-Math.sin(e-s._x),this._sy=Math.cos(e-s._x)}updateTransform(e){return this.position.set(typeof e.x=="number"?e.x:this.position.x,typeof e.y=="number"?e.y:this.position.y),this.scale.set(typeof e.scaleX=="number"?e.scaleX:this.scale.x,typeof e.scaleY=="number"?e.scaleY:this.scale.y),this.rotation=typeof e.rotation=="number"?e.rotation:this.rotation,this.skew.set(typeof e.skewX=="number"?e.skewX:this.skew.x,typeof e.skewY=="number"?e.skewY:this.skew.y),this.pivot.set(typeof e.pivotX=="number"?e.pivotX:this.pivot.x,typeof e.pivotY=="number"?e.pivotY:this.pivot.y),this.origin.set(typeof e.originX=="number"?e.originX:this.origin.x,typeof e.originY=="number"?e.originY:this.origin.y),this}setFromMatrix(e){e.decompose(this)}updateLocalTransform(){const e=this._didContainerChangeTick;if(this._didLocalTransformChangeId===e)return;this._didLocalTransformChangeId=e;const s=this.localTransform,r=this._scale,i=this._pivot,a=this._origin,c=this._position,o=r._x,h=r._y,u=i._x,f=i._y,d=-a._x,g=-a._y;s.a=this._cx*o,s.b=this._sx*o,s.c=this._cy*h,s.d=this._sy*h,s.tx=c._x-(u*s.a+f*s.c)+(d*s.a+g*s.c)-d,s.ty=c._y-(u*s.b+f*s.d)+(d*s.b+g*s.d)-g}set alpha(e){e!==this.localAlpha&&(this.localAlpha=e,this._updateFlags|=F_,this._onUpdate())}get alpha(){return this.localAlpha}set tint(e){const r=Ss.shared.setValue(e??16777215).toBgrNumber();r!==this.localColor&&(this.localColor=r,this._updateFlags|=F_,this._onUpdate())}get tint(){return zl(this.localColor)}set blendMode(e){this.localBlendMode!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=mk,this.localBlendMode=e,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(e){const s=e?2:0;(this.localDisplayStatus&2)!==s&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=$u,this.localDisplayStatus^=2,this._onUpdate(),this.emit("visibleChanged",e))}get culled(){return!(this.localDisplayStatus&4)}set culled(e){const s=e?0:4;(this.localDisplayStatus&4)!==s&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=$u,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(this.localDisplayStatus&1)}set renderable(e){const s=e?1:0;(this.localDisplayStatus&1)!==s&&(this._updateFlags|=$u,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(e=!1){var i;if(this.destroyed)return;this.destroyed=!0;let s;if(this.children.length&&(s=this.removeChildren(0,this.children.length)),this.removeFromParent(),this.parent=null,this._maskEffect=null,this._filterEffect=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._origin=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners(),(typeof e=="boolean"?e:e==null?void 0:e.children)&&s)for(let a=0;a<s.length;++a)s[a].destroy(e);(i=this.renderGroup)==null||i.destroy(),this.renderGroup=null}}Mt.mixin(Qs,VC,QC,ik,tk,ek,KC,YC,sk,$C,WC,ZC,GC);class zy extends Qs{constructor(e){super(e),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=-1,this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this._bounds=new Ns(0,1,0,0),this._boundsDirty=!0,this.autoGarbageCollect=e.autoGarbageCollect??!0}get bounds(){return this._boundsDirty?(this.updateBounds(),this._boundsDirty=!1,this._bounds):this._bounds}get roundPixels(){return!!this._roundPixels}set roundPixels(e){this._roundPixels=e?1:0}containsPoint(e){const s=this.bounds,{x:r,y:i}=e;return r>=s.minX&&r<=s.maxX&&i>=s.minY&&i<=s.maxY}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;const e=this.renderGroup||this.parentRenderGroup;e&&e.onChildViewUpdate(this)}unload(){var e;this.emit("unload",this);for(const s in this._gpuData)(e=this._gpuData[s])==null||e.destroy();this._gpuData=Object.create(null),this.onViewUpdate()}destroy(e){this.unload(),super.destroy(e),this._bounds=null}collectRenderablesSimple(e,s,r){const{renderPipes:i}=s;i.blendMode.pushBlendMode(this,this.groupBlendMode,e);const c=i[this.renderPipeId];c!=null&&c.addRenderable&&c.addRenderable(this,e),this.didViewUpdate=!1;const o=this.children,h=o.length;for(let u=0;u<h;u++)o[u].collectRenderables(e,s,r);i.blendMode.popBlendMode(e)}}class ki extends zy{constructor(e=Ve.EMPTY){e instanceof Ve&&(e={texture:e});const{texture:s=Ve.EMPTY,anchor:r,roundPixels:i,width:a,height:c,...o}=e;super({label:"Sprite",...o}),this.renderPipeId="sprite",this.batched=!0,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new Nt({_onUpdate:()=>{this.onViewUpdate()}}),r?this.anchor=r:s.defaultAnchor&&(this.anchor=s.defaultAnchor),this.texture=s,this.allowChildren=!1,this.roundPixels=i??!1,a!==void 0&&(this.width=a),c!==void 0&&(this.height=c)}static from(e,s=!1){return e instanceof Ve?new ki(e):new ki(Ve.from(e,s))}set texture(e){e||(e=Ve.EMPTY);const s=this._texture;s!==e&&(s&&s.dynamic&&s.off("update",this.onViewUpdate,this),e.dynamic&&e.on("update",this.onViewUpdate,this),this._texture=e,this._width&&this._setWidth(this._width,this._texture.orig.width),this._height&&this._setHeight(this._height,this._texture.orig.height),this.onViewUpdate())}get texture(){return this._texture}get visualBounds(){return TC(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return je("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){const e=this._anchor,s=this._texture,r=this._bounds,{width:i,height:a}=s.orig;r.minX=-e._x*i,r.maxX=r.minX+i,r.minY=-e._y*a,r.maxY=r.minY+a}destroy(e=!1){if(super.destroy(e),typeof e=="boolean"?e:e==null?void 0:e.texture){const r=typeof e=="boolean"?e:e==null?void 0:e.textureSource;this._texture.destroy(r)}this._texture=null,this._visualBounds=null,this._bounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(e){typeof e=="number"?this._anchor.set(e):this._anchor.copyFrom(e)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(e){this._setWidth(e,this._texture.orig.width),this._width=e}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(e){this._setHeight(e,this._texture.orig.height),this._height=e}getSize(e){return e||(e={}),e.width=Math.abs(this.scale.x)*this._texture.orig.width,e.height=Math.abs(this.scale.y)*this._texture.orig.height,e}setSize(e,s){typeof e=="object"?(s=e.height??e.width,e=e.width):s??(s=e),e!==void 0&&this._setWidth(e,this._texture.orig.width),s!==void 0&&this._setHeight(s,this._texture.orig.height)}}const gk=new Ns;function Vy(t,e,s){const r=gk;t.measurable=!0,Ny(t,s,r),e.addBoundsMask(r),t.measurable=!1}function Gy(t,e,s){const r=ur.get();t.measurable=!0;const i=Gt.get().identity(),a=qy(t,s,i);$y(t,r,a),t.measurable=!1,e.addBoundsMask(r),Gt.return(i),ur.return(r)}function qy(t,e,s){return t?(t!==e&&(qy(t.parent,e,s),t.updateLocalTransform(),s.append(t.localTransform)),s):(Ht("Mask bounds, renderable is not inside the root container"),s)}class Ky{constructor(e){this.priority=0,this.inverse=!1,this.channel="red",this.pipe="alphaMask",e!=null&&e.mask&&this.init(e.mask)}init(e){this.mask=e,this.renderMaskToTexture=!(e instanceof ki),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){this.mask!==null&&(this.mask.measurable=!0,this.mask=null)}addBounds(e,s){this.inverse||Vy(this.mask,e,s)}addLocalBounds(e,s){Gy(this.mask,e,s)}containsPoint(e,s){const r=this.mask;return s(r,e)}destroy(){this.reset()}static test(e){return e instanceof ki}}Ky.extension=Fe.MaskEffect;class Yy{constructor(e){this.priority=0,this.pipe="colorMask",e!=null&&e.mask&&this.init(e.mask)}init(e){this.mask=e}destroy(){}static test(e){return typeof e=="number"}}Yy.extension=Fe.MaskEffect;class Xy{constructor(e){this.priority=0,this.pipe="stencilMask",e!=null&&e.mask&&this.init(e.mask)}init(e){this.mask=e,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){this.mask!==null&&(this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null)}addBounds(e,s){Vy(this.mask,e,s)}addLocalBounds(e,s){Gy(this.mask,e,s)}containsPoint(e,s){const r=this.mask;return s(r,e)}destroy(){this.reset()}static test(e){return e instanceof Qs}}Xy.extension=Fe.MaskEffect;const _k={createCanvas:(t,e)=>{const s=document.createElement("canvas");return s.width=t,s.height=e,s},createImage:()=>new Image,getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(t,e)=>fetch(t,e),parseXML:t=>new DOMParser().parseFromString(t,"text/xml")};let $_=_k;const Hr={get(){return $_},set(t){$_=t}};class Cf extends hs{constructor(e){e.resource||(e.resource=Hr.get().createCanvas()),e.width||(e.width=e.resource.width,e.autoDensity||(e.width/=e.resolution)),e.height||(e.height=e.resource.height,e.autoDensity||(e.height/=e.resolution)),super(e),this.uploadMethodId="image",this.autoDensity=e.autoDensity,this.resizeCanvas(),this.transparent=!!e.transparent}resizeCanvas(){this.autoDensity&&"style"in this.resource&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),(this.resource.width!==this.pixelWidth||this.resource.height!==this.pixelHeight)&&(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight)}resize(e=this.width,s=this.height,r=this._resolution){const i=super.resize(e,s,r);return i&&this.resizeCanvas(),i}static test(e){return globalThis.HTMLCanvasElement&&e instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&e instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}}Cf.extension=Fe.TextureSource;class Jl extends hs{constructor(e){super(e),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(e){return globalThis.HTMLImageElement&&e instanceof HTMLImageElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap||globalThis.VideoFrame&&e instanceof VideoFrame}}Jl.extension=Fe.TextureSource;var ec=(t=>(t[t.INTERACTION=50]="INTERACTION",t[t.HIGH=25]="HIGH",t[t.NORMAL=0]="NORMAL",t[t.LOW=-25]="LOW",t[t.UTILITY=-50]="UTILITY",t))(ec||{});class Hu{constructor(e,s=null,r=0,i=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=e,this._context=s,this.priority=r,this._once=i}match(e,s=null){return this._fn===e&&this._context===s}emit(e){this._fn&&(this._context?this._fn.call(this._context,e):this._fn(e));const s=this.next;return this._once&&this.destroy(!0),this._destroyed&&(this.next=null),s}connect(e){this.previous=e,e.next&&(e.next.previous=this),this.next=e.next,e.next=this}destroy(e=!1){this._destroyed=!0,this._fn=null,this._context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const s=this.next;return this.next=e?null:s,this.previous=null,s}}const Qy=class ls{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new Hu(null,null,1/0),this.deltaMS=1/ls.targetFPMS,this.elapsedMS=1/ls.targetFPMS,this._tick=e=>{this._requestId=null,this.started&&(this.update(e),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(e,s,r=ec.NORMAL){return this._addListener(new Hu(e,s,r))}addOnce(e,s,r=ec.NORMAL){return this._addListener(new Hu(e,s,r,!0))}_addListener(e){let s=this._head.next,r=this._head;if(!s)e.connect(r);else{for(;s;){if(e.priority>s.priority){e.connect(r);break}r=s,s=s.next}e.previous||e.connect(r)}return this._startIfPossible(),this}remove(e,s){let r=this._head.next;for(;r;)r.match(e,s)?r=r.destroy():r=r.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let e=0,s=this._head;for(;s=s.next;)e++;return e}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let e=this._head.next;for(;e;)e=e.destroy(!0);this._head.destroy(),this._head=null}}update(e=performance.now()){let s;if(e>this.lastTime){if(s=this.elapsedMS=e-this.lastTime,s>this._maxElapsedMS&&(s=this._maxElapsedMS),s*=this.speed,this._minElapsedMS){const a=e-this._lastFrame|0;if(a<this._minElapsedMS)return;this._lastFrame=e-a%this._minElapsedMS}this.deltaMS=s,this.deltaTime=this.deltaMS*ls.targetFPMS;const r=this._head;let i=r.next;for(;i;)i=i.emit(this);r.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=e}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(e){const s=Math.min(Math.max(0,e)/1e3,ls.targetFPMS);this._maxElapsedMS=1/s,this._minElapsedMS&&e>this.maxFPS&&(this.maxFPS=e)}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(e){e===0?this._minElapsedMS=0:(e<this.minFPS&&(this.minFPS=e),this._minElapsedMS=1/(e/1e3))}static get shared(){if(!ls._shared){const e=ls._shared=new ls;e.autoStart=!0,e._protected=!0}return ls._shared}static get system(){if(!ls._system){const e=ls._system=new ls;e.autoStart=!0,e._protected=!0}return ls._system}};Qy.targetFPMS=.06;let dn=Qy,Uu;async function vk(){return Uu??(Uu=(async()=>{var c;const e=Hr.get().createCanvas(1,1).getContext("webgl");if(!e)return"premultiply-alpha-on-upload";const s=await new Promise(o=>{const h=document.createElement("video");h.onloadeddata=()=>o(h),h.onerror=()=>o(null),h.autoplay=!1,h.crossOrigin="anonymous",h.preload="auto",h.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",h.load()});if(!s)return"premultiply-alpha-on-upload";const r=e.createTexture();e.bindTexture(e.TEXTURE_2D,r);const i=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,i),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,r,0),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,s);const a=new Uint8Array(4);return e.readPixels(0,0,1,1,e.RGBA,e.UNSIGNED_BYTE,a),e.deleteFramebuffer(i),e.deleteTexture(r),(c=e.getExtension("WEBGL_lose_context"))==null||c.loseContext(),a[0]<=a[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),Uu}const Cc=class Zy extends hs{constructor(e){super(e),this.isReady=!1,this.uploadMethodId="video",e={...Zy.defaultOptions,...e},this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=e.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=e.autoPlay!==!1,this.alphaMode=e.alphaMode??"premultiply-alpha-on-upload",this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onCanPlayThrough=this._onCanPlayThrough.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),this._onLoadedMetadata=this._onLoadedMetadata.bind(this),e.autoLoad!==!1&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){const e=dn.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-e)}(!this._updateFPS||this._msToNextUpdate<=0)&&(this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0),this.isValid&&this.update()}}_videoFrameRequestCallback(){this.updateFrame(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback)}get isValid(){return!!this.resource.videoWidth&&!!this.resource.videoHeight}async load(){if(this._load)return this._load;const e=this.resource,s=this.options;return(e.readyState===e.HAVE_ENOUGH_DATA||e.readyState===e.HAVE_FUTURE_DATA)&&e.width&&e.height&&(e.complete=!0),e.addEventListener("play",this._onPlayStart),e.addEventListener("pause",this._onPlayStop),e.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._mediaReady():(s.preload||e.addEventListener("canplay",this._onCanPlay),e.addEventListener("canplaythrough",this._onCanPlayThrough),e.addEventListener("error",this._onError,!0)),this.isValid||e.addEventListener("loadedmetadata",this._onLoadedMetadata),this.alphaMode=await vk(),this._load=new Promise((r,i)=>{this.isValid?r(this):(this._resolve=r,this._reject=i,s.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${s.preloadTimeoutMs}ms`))})),e.load())}),this._load}_onError(e){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",e),this._reject&&(this._reject(e),this._reject=null,this._resolve=null)}_isSourcePlaying(){const e=this.resource;return!e.paused&&!e.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onLoadedMetadata(){this.isValid&&this._mediaReady()}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlayThrough),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady()}_mediaReady(){const e=this.resource;this.isValid&&(this.isReady=!0,this.resize(e.videoWidth,e.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&this.isValid&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();const e=this.resource;e&&(e.removeEventListener("play",this._onPlayStart),e.removeEventListener("pause",this._onPlayStop),e.removeEventListener("seeked",this._onSeeked),e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlayThrough),e.removeEventListener("loadedmetadata",this._onLoadedMetadata),e.removeEventListener("error",this._onError,!0),e.pause(),e.src="",e.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e!==this._autoUpdate&&(this._autoUpdate=e,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(e){e!==this._updateFPS&&(this._updateFPS=e,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(dn.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(dn.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(dn.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(e){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement}};Cc.extension=Fe.TextureSource;Cc.defaultOptions={...hs.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};Cc.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let xk=Cc;const ln=(t,e,s=!1)=>(Array.isArray(t)||(t=[t]),e?t.map(r=>typeof r=="string"||s?e(r):r):t);class yk{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(e){return this._cache.has(e)}get(e){const s=this._cache.get(e);return s||Ht(`[Assets] Asset id ${e} was not found in the Cache`),s}set(e,s){const r=ln(e);let i;for(let h=0;h<this.parsers.length;h++){const u=this.parsers[h];if(u.test(s)){i=u.getCacheableAssets(r,s);break}}const a=new Map(Object.entries(i||{}));i||r.forEach(h=>{a.set(h,s)});const c=[...a.keys()],o={cacheKeys:c,keys:r};r.forEach(h=>{this._cacheMap.set(h,o)}),c.forEach(h=>{const u=i?i[h]:s;this._cache.has(h)&&this._cache.get(h)!==u&&Ht("[Cache] already has key:",h),this._cache.set(h,a.get(h))})}remove(e){if(!this._cacheMap.has(e)){Ht(`[Assets] Asset id ${e} was not found in the Cache`);return}const s=this._cacheMap.get(e);s.cacheKeys.forEach(i=>{this._cache.delete(i)}),s.keys.forEach(i=>{this._cacheMap.delete(i)})}get parsers(){return this._parsers}}const cn=new yk,Bd=[];Mt.handleByList(Fe.TextureSource,Bd);function Jy(t={}){const e=t&&t.resource,s=e?t.resource:t,r=e?t:{resource:t};for(let i=0;i<Bd.length;i++){const a=Bd[i];if(a.test(s))return new a(r)}throw new Error(`Could not find a source type for resource: ${r.resource}`)}function bk(t={},e=!1){const s=t&&t.resource,r=s?t.resource:t,i=s?t:{resource:t};if(!e&&cn.has(r))return cn.get(r);const a=new Ve({source:Jy(i)});return a.on("destroy",()=>{cn.has(r)&&cn.remove(r)}),e||cn.set(r,a),a}function wk(t,e=!1){return typeof t=="string"?cn.get(t):t instanceof hs?new Ve({source:t}):bk(t,e)}Ve.from=wk;hs.from=Jy;Mt.add(Ky,Yy,Xy,xk,Jl,Cf,bf);var e0=(t=>(t[t.Low=0]="Low",t[t.Normal=1]="Normal",t[t.High=2]="High",t))(e0||{});function Ds(t){if(typeof t!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(t)}`)}function fo(t){return t.split("?")[0].split("#")[0]}function Sk(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ck(t,e,s){return t.replace(new RegExp(Sk(e),"g"),s)}function kk(t,e){let s="",r=0,i=-1,a=0,c=-1;for(let o=0;o<=t.length;++o){if(o<t.length)c=t.charCodeAt(o);else{if(c===47)break;c=47}if(c===47){if(!(i===o-1||a===1))if(i!==o-1&&a===2){if(s.length<2||r!==2||s.charCodeAt(s.length-1)!==46||s.charCodeAt(s.length-2)!==46){if(s.length>2){const h=s.lastIndexOf("/");if(h!==s.length-1){h===-1?(s="",r=0):(s=s.slice(0,h),r=s.length-1-s.lastIndexOf("/")),i=o,a=0;continue}}else if(s.length===2||s.length===1){s="",r=0,i=o,a=0;continue}}}else s.length>0?s+=`/${t.slice(i+1,o)}`:s=t.slice(i+1,o),r=o-i-1;i=o,a=0}else c===46&&a!==-1?++a:a=-1}return s}const $o={toPosix(t){return Ck(t,"\\","/")},isUrl(t){return/^https?:/.test(this.toPosix(t))},isDataUrl(t){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(t)},isBlobUrl(t){return t.startsWith("blob:")},hasProtocol(t){return/^[^/:]+:/.test(this.toPosix(t))},getProtocol(t){Ds(t),t=this.toPosix(t);const e=/^file:\/\/\//.exec(t);if(e)return e[0];const s=/^[^/:]+:\/{0,2}/.exec(t);return s?s[0]:""},toAbsolute(t,e,s){if(Ds(t),this.isDataUrl(t)||this.isBlobUrl(t))return t;const r=fo(this.toPosix(e??Hr.get().getBaseUrl())),i=fo(this.toPosix(s??this.rootname(r)));return t=this.toPosix(t),t.startsWith("/")?$o.join(i,t.slice(1)):this.isAbsolute(t)?t:this.join(r,t)},normalize(t){if(Ds(t),t.length===0)return".";if(this.isDataUrl(t)||this.isBlobUrl(t))return t;t=this.toPosix(t);let e="";const s=t.startsWith("/");this.hasProtocol(t)&&(e=this.rootname(t),t=t.slice(e.length));const r=t.endsWith("/");return t=kk(t),t.length>0&&r&&(t+="/"),s?`/${t}`:e+t},isAbsolute(t){return Ds(t),t=this.toPosix(t),this.hasProtocol(t)?!0:t.startsWith("/")},join(...t){if(t.length===0)return".";let e;for(let s=0;s<t.length;++s){const r=t[s];if(Ds(r),r.length>0)if(e===void 0)e=r;else{const i=t[s-1]??"";this.joinExtensions.includes(this.extname(i).toLowerCase())?e+=`/../${r}`:e+=`/${r}`}}return e===void 0?".":this.normalize(e)},dirname(t){if(Ds(t),t.length===0)return".";t=this.toPosix(t);let e=t.charCodeAt(0);const s=e===47;let r=-1,i=!0;const a=this.getProtocol(t),c=t;t=t.slice(a.length);for(let o=t.length-1;o>=1;--o)if(e=t.charCodeAt(o),e===47){if(!i){r=o;break}}else i=!1;return r===-1?s?"/":this.isUrl(c)?a+t:a:s&&r===1?"//":a+t.slice(0,r)},rootname(t){Ds(t),t=this.toPosix(t);let e="";if(t.startsWith("/")?e="/":e=this.getProtocol(t),this.isUrl(t)){const s=t.indexOf("/",e.length);s!==-1?e=t.slice(0,s):e=t,e.endsWith("/")||(e+="/")}return e},basename(t,e){Ds(t),e&&Ds(e),t=fo(this.toPosix(t));let s=0,r=-1,i=!0,a;if(e!==void 0&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";let c=e.length-1,o=-1;for(a=t.length-1;a>=0;--a){const h=t.charCodeAt(a);if(h===47){if(!i){s=a+1;break}}else o===-1&&(i=!1,o=a+1),c>=0&&(h===e.charCodeAt(c)?--c===-1&&(r=a):(c=-1,r=o))}return s===r?r=o:r===-1&&(r=t.length),t.slice(s,r)}for(a=t.length-1;a>=0;--a)if(t.charCodeAt(a)===47){if(!i){s=a+1;break}}else r===-1&&(i=!1,r=a+1);return r===-1?"":t.slice(s,r)},extname(t){Ds(t),t=fo(this.toPosix(t));let e=-1,s=0,r=-1,i=!0,a=0;for(let c=t.length-1;c>=0;--c){const o=t.charCodeAt(c);if(o===47){if(!i){s=c+1;break}continue}r===-1&&(i=!1,r=c+1),o===46?e===-1?e=c:a!==1&&(a=1):e!==-1&&(a=-1)}return e===-1||r===-1||a===0||a===1&&e===r-1&&e===s+1?"":t.slice(e,r)},parse(t){Ds(t);const e={root:"",dir:"",base:"",ext:"",name:""};if(t.length===0)return e;t=fo(this.toPosix(t));let s=t.charCodeAt(0);const r=this.isAbsolute(t);let i;e.root=this.rootname(t),r||this.hasProtocol(t)?i=1:i=0;let a=-1,c=0,o=-1,h=!0,u=t.length-1,f=0;for(;u>=i;--u){if(s=t.charCodeAt(u),s===47){if(!h){c=u+1;break}continue}o===-1&&(h=!1,o=u+1),s===46?a===-1?a=u:f!==1&&(f=1):a!==-1&&(f=-1)}return a===-1||o===-1||f===0||f===1&&a===o-1&&a===c+1?o!==-1&&(c===0&&r?e.base=e.name=t.slice(1,o):e.base=e.name=t.slice(c,o)):(c===0&&r?(e.name=t.slice(1,a),e.base=t.slice(1,o)):(e.name=t.slice(c,a),e.base=t.slice(c,o)),e.ext=t.slice(a,o)),e.dir=this.dirname(t),e},sep:"/",delimiter:":",joinExtensions:[".html"]};function t0(t,e,s,r,i){const a=e[s];for(let c=0;c<a.length;c++){const o=a[c];s<e.length-1?t0(t.replace(r[s],o),e,s+1,r,i):i.push(t.replace(r[s],o))}}function Ek(t){const e=/\{(.*?)\}/g,s=t.match(e),r=[];if(s){const i=[];s.forEach(a=>{const c=a.substring(1,a.length-1).split(",");i.push(c)}),t0(t,i,0,s,r)}else r.push(t);return r}const H_=t=>!Array.isArray(t);class s0{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(e,s)=>`${e}${this._bundleIdConnector}${s}`,extractAssetIdFromBundle:(e,s)=>s.replace(`${e}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(e){if(this._bundleIdConnector=e.connector??this._bundleIdConnector,this._createBundleAssetId=e.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=e.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...e){e.forEach(s=>{this._preferredOrder.push(s),s.priority||(s.priority=Object.keys(s.params))}),this._resolverHash={}}set basePath(e){this._basePath=e}get basePath(){return this._basePath}set rootPath(e){this._rootPath=e}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(e){if(typeof e=="string")this._defaultSearchParams=e;else{const s=e;this._defaultSearchParams=Object.keys(s).map(r=>`${encodeURIComponent(r)}=${encodeURIComponent(s[r])}`).join("&")}}getAlias(e){const{alias:s,src:r}=e;return ln(s||r,a=>typeof a=="string"?a:Array.isArray(a)?a.map(c=>(c==null?void 0:c.src)??c):a!=null&&a.src?a.src:a,!0)}removeAlias(e,s){this._assetMap[e]&&(s&&s!==this._resolverHash[e]||(delete this._resolverHash[e],delete this._assetMap[e]))}addManifest(e){this._manifest&&Ht("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=e,e.bundles.forEach(s=>{this.addBundle(s.name,s.assets)})}addBundle(e,s){const r=[];let i=s;Array.isArray(s)||(i=Object.entries(s).map(([a,c])=>typeof c=="string"||Array.isArray(c)?{alias:a,src:c}:{alias:a,...c})),i.forEach(a=>{const c=a.src,o=a.alias;let h;if(typeof o=="string"){const u=this._createBundleAssetId(e,o);r.push(u),h=[o,u]}else{const u=o.map(f=>this._createBundleAssetId(e,f));r.push(...u),h=[...o,...u]}this.add({...a,alias:h,src:c})}),this._bundles[e]=r}add(e){const s=[];Array.isArray(e)?s.push(...e):s.push(e);let r;r=a=>{this.hasKey(a)&&Ht(`[Resolver] already has key: ${a} overwriting`)},ln(s).forEach(a=>{const{src:c}=a;let{data:o,format:h,loadParser:u,parser:f}=a;const d=ln(c).map(S=>typeof S=="string"?Ek(S):Array.isArray(S)?S:[S]),g=this.getAlias(a);Array.isArray(g)?g.forEach(r):r(g);const _=[],k=S=>{const m=this._parsers.find(x=>x.test(S));return{src:S,...m==null?void 0:m.parse(S)}};d.forEach(S=>{S.forEach(m=>{let x={};if(typeof m!="object"?x=k(m):(o=m.data??o,h=m.format??h,(m.loadParser||m.parser)&&(u=m.loadParser??u,f=m.parser??f),x={...k(m.src),...m}),!g)throw new Error(`[Resolver] alias is undefined for this asset: ${x.src}`);x=this._buildResolvedAsset(x,{aliases:g,data:o,format:h,loadParser:u,parser:f,progressSize:a.progressSize}),_.push(x)})}),g.forEach(S=>{this._assetMap[S]=_})})}resolveBundle(e){const s=H_(e);e=ln(e);const r={};return e.forEach(i=>{const a=this._bundles[i];if(a){const c=this.resolve(a),o={};for(const h in c){const u=c[h];o[this._extractAssetIdFromBundle(i,h)]=u}r[i]=o}}),s?r[e[0]]:r}resolveUrl(e){const s=this.resolve(e);if(typeof e!="string"){const r={};for(const i in s)r[i]=s[i].src;return r}return s.src}resolve(e){const s=H_(e);e=ln(e);const r={};return e.forEach(i=>{if(!this._resolverHash[i])if(this._assetMap[i]){let a=this._assetMap[i];const c=this._getPreferredOrder(a);c==null||c.priority.forEach(o=>{c.params[o].forEach(h=>{const u=a.filter(f=>f[o]?f[o]===h:!1);u.length&&(a=u)})}),this._resolverHash[i]=a[0]}else this._resolverHash[i]=this._buildResolvedAsset({alias:[i],src:i},{});r[i]=this._resolverHash[i]}),s?r[e[0]]:r}hasKey(e){return!!this._assetMap[e]}hasBundle(e){return!!this._bundles[e]}_getPreferredOrder(e){for(let s=0;s<e.length;s++){const r=e[s],i=this._preferredOrder.find(a=>a.params.format.includes(r.format));if(i)return i}return this._preferredOrder[0]}_appendDefaultSearchParams(e){if(!this._defaultSearchParams)return e;const s=/\?/.test(e)?"&":"?";return`${e}${s}${this._defaultSearchParams}`}_buildResolvedAsset(e,s){const{aliases:r,data:i,loadParser:a,parser:c,format:o,progressSize:h}=s;return(this._basePath||this._rootPath)&&(e.src=$o.toAbsolute(e.src,this._basePath,this._rootPath)),e.alias=r??e.alias??[e.src],e.src=this._appendDefaultSearchParams(e.src),e.data={...i||{},...e.data},e.loadParser=a??e.loadParser,e.parser=c??e.parser,e.format=o??e.format??Pk(e.src),h!==void 0&&(e.progressSize=h),e}}s0.RETINA_PREFIX=/@([0-9\.]+)x/;function Pk(t){return t.split(".").pop().split("?").shift().split("#").shift()}const U_=(t,e)=>{const s=e.split("?")[1];return s&&(t+=`?${s}`),t},r0=class Co{constructor(e,s){this.linkedSheets=[];let r=e;(e==null?void 0:e.source)instanceof hs&&(r={texture:e,data:s});const{texture:i,data:a,cachePrefix:c=""}=r;this.cachePrefix=c,this._texture=i instanceof Ve?i:null,this.textureSource=i.source,this.textures={},this.animations={},this.data=a;const o=parseFloat(a.meta.scale);o?(this.resolution=o,i.source.resolution=this.resolution):this.resolution=i.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}parse(){return new Promise(e=>{this._callback=e,this._batchIndex=0,this._frameKeys.length<=Co.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}parseSync(){return this._processFrames(0,!0),this._processAnimations(),this.textures}_processFrames(e,s=!1){let r=e;const i=s?1/0:Co.BATCH_SIZE;for(;r-e<i&&r<this._frameKeys.length;){const a=this._frameKeys[r],c=this._frames[a],o=c.frame;if(o){let h=null,u=null;const f=c.trimmed!==!1&&c.sourceSize?c.sourceSize:c.frame,d=new Pt(0,0,Math.floor(f.w)/this.resolution,Math.floor(f.h)/this.resolution);c.rotated?h=new Pt(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.h)/this.resolution,Math.floor(o.w)/this.resolution):h=new Pt(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution),c.trimmed!==!1&&c.spriteSourceSize&&(u=new Pt(Math.floor(c.spriteSourceSize.x)/this.resolution,Math.floor(c.spriteSourceSize.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution)),this.textures[a]=new Ve({source:this.textureSource,frame:h,orig:d,trim:u,rotate:c.rotated?2:0,defaultAnchor:c.anchor,defaultBorders:c.borders,label:a.toString()})}r++}}_processAnimations(){const e=this.data.animations||{};for(const s in e){this.animations[s]=[];for(let r=0;r<e[s].length;r++){const i=e[s][r];this.animations[s].push(this.textures[i])}}}_parseComplete(){const e=this._callback;this._callback=null,this._batchIndex=0,e.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*Co.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*Co.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(e=!1){var s;for(const r in this.textures)this.textures[r].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,e&&((s=this._texture)==null||s.destroy(),this.textureSource.destroy()),this._texture=null,this.textureSource=null,this.linkedSheets=[]}};r0.BATCH_SIZE=1e3;let W_=r0;const Mk=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];function i0(t,e,s){const r={};if(t.forEach(i=>{r[i]=e}),Object.keys(e.textures).forEach(i=>{r[`${e.cachePrefix}${i}`]=e.textures[i]}),!s){const i=$o.dirname(t[0]);e.linkedSheets.forEach((a,c)=>{const o=i0([`${i}/${e.data.meta.related_multi_packs[c]}`],a,!0);Object.assign(r,o)})}return r}const Ak={extension:Fe.Asset,cache:{test:t=>t instanceof W_,getCacheableAssets:(t,e)=>i0(t,e,!1)},resolver:{extension:{type:Fe.ResolveParser,name:"resolveSpritesheet"},test:t=>{const s=t.split("?")[0].split("."),r=s.pop(),i=s.pop();return r==="json"&&Mk.includes(i)},parse:t=>{var s;const e=t.split(".");return{resolution:parseFloat(((s=s0.RETINA_PREFIX.exec(t))==null?void 0:s[1])??"1"),format:e[e.length-2],src:t}}},loader:{name:"spritesheetLoader",id:"spritesheet",extension:{type:Fe.LoadParser,priority:e0.Normal,name:"spritesheetLoader"},async testParse(t,e){return $o.extname(e.src).toLowerCase()===".json"&&!!t.frames},async parse(t,e,s){var d,g;const{texture:r,imageFilename:i,textureOptions:a,cachePrefix:c}=(e==null?void 0:e.data)??{};let o=$o.dirname(e.src);o&&o.lastIndexOf("/")!==o.length-1&&(o+="/");let h;if(r instanceof Ve)h=r;else{const _=U_(o+(i??t.meta.image),e.src);h=(await s.load([{src:_,data:a}]))[_]}const u=new W_({texture:h.source,data:t,cachePrefix:c});await u.parse();const f=(d=t==null?void 0:t.meta)==null?void 0:d.related_multi_packs;if(Array.isArray(f)){const _=[];for(const S of f){if(typeof S!="string")continue;let m=o+S;(g=e.data)!=null&&g.ignoreMultiPack||(m=U_(m,e.src),_.push(s.load({src:m,data:{textureOptions:a,ignoreMultiPack:!0}})))}const k=await Promise.all(_);u.linkedSheets=k,k.forEach(S=>{S.linkedSheets=[u].concat(u.linkedSheets.filter(m=>m!==S))})}return u},async unload(t,e,s){await s.unload(t.textureSource._sourceOrigin),t.destroy(!1)}}};Mt.add(Ak);const Wu=Object.create(null),z_=Object.create(null);function kc(t,e){let s=z_[t];return s===void 0&&(Wu[e]===void 0&&(Wu[e]=1),z_[t]=s=Wu[e]++),s}let nn;function n0(){return(!nn||nn!=null&&nn.isContextLost())&&(nn=Hr.get().createCanvas().getContext("webgl",{})),nn}let Sl;function Tk(){if(!Sl){Sl="mediump";const t=n0();t&&t.getShaderPrecisionFormat&&(Sl=t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision?"highp":"mediump")}return Sl}function Rk(t,e,s){return e?t:s?(t=t.replace("out vec4 finalColor;",""),`
45
+
46
+ #ifdef GL_ES // This checks if it is WebGL1
47
+ #define in varying
48
+ #define finalColor gl_FragColor
49
+ #define texture texture2D
50
+ #endif
51
+ ${t}
52
+ `):`
53
+
54
+ #ifdef GL_ES // This checks if it is WebGL1
55
+ #define in attribute
56
+ #define out varying
57
+ #endif
58
+ ${t}
59
+ `}const Dk=/\buniform\s+([iu]?sampler\w+)/g,Lk=/\bprecision\s+\w+\s+([iu]?sampler\w+)\s*;/g,Bk={sampler2D:"lowp",samplerCube:"lowp"};function jk(t,e,s){const r=s?e.maxSupportedFragmentPrecision:e.maxSupportedVertexPrecision;if(t.substring(0,9)!=="precision"){let a=s?e.requestedFragmentPrecision:e.requestedVertexPrecision;a==="highp"&&r!=="highp"&&(a="mediump"),t=`precision ${a} float;
60
+ ${t}`}else r!=="highp"&&t.substring(0,15)==="precision highp"&&(t=t.replace("precision highp","precision mediump"));const i=e.maxSupportedFragmentPrecision==="highp"?"highp":"mediump";return Ik(t,i)}function Ik(t,e){const s=new Set;let r="";for(const[,i]of t.matchAll(Lk))s.add(i);for(const[,i]of t.matchAll(Dk))s.has(i)||(s.add(i),r+=`precision ${Bk[i]??e} ${i};
61
+ `);return r+t}function Nk(t,e){return e?`#version 300 es
62
+ ${t}`:t}const Ok={},Fk={};function $k(t,{name:e="pixi-program"},s=!0){e=e.replace(/\s+/g,"-"),e+=s?"-fragment":"-vertex";const r=s?Ok:Fk;return r[e]?(r[e]++,e+=`-${r[e]}`):r[e]=1,t.indexOf("#define SHADER_NAME")!==-1?t:`${`#define SHADER_NAME ${e}`}
63
+ ${t}`}function Hk(t,e){return e?t.replace("#version 300 es",""):t}const zu={stripVersion:Hk,ensurePrecision:jk,addProgramDefines:Rk,setProgramName:$k,insertVersion:Nk},po=Object.create(null),o0=class jd{constructor(e){e={...jd.defaultOptions,...e};const s=e.fragment.indexOf("#version 300 es")!==-1,r={stripVersion:s,ensurePrecision:{requestedFragmentPrecision:e.preferredFragmentPrecision,requestedVertexPrecision:e.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:Tk()},setProgramName:{name:e.name},addProgramDefines:s,insertVersion:s};let i=e.fragment,a=e.vertex;Object.keys(zu).forEach(c=>{const o=r[c];i=zu[c](i,o,!0),a=zu[c](a,o,!1)}),this.fragment=i,this.vertex=a,this.transformFeedbackVaryings=e.transformFeedbackVaryings,this._key=kc(`${this.vertex}:${this.fragment}`,"gl-program")}destroy(){this.fragment=null,this.vertex=null,this._attributeData=null,this._uniformData=null,this._uniformBlockData=null,this.transformFeedbackVaryings=null,po[this._cacheKey]=null}static from(e){const s=`${e.vertex}:${e.fragment}`;return po[s]||(po[s]=new jd(e),po[s]._cacheKey=s),po[s]}};o0.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};let a0=o0;const V_={uint8x2:{size:2,stride:2,normalised:!1},uint8x4:{size:4,stride:4,normalised:!1},sint8x2:{size:2,stride:2,normalised:!1},sint8x4:{size:4,stride:4,normalised:!1},unorm8x2:{size:2,stride:2,normalised:!0},unorm8x4:{size:4,stride:4,normalised:!0},snorm8x2:{size:2,stride:2,normalised:!0},snorm8x4:{size:4,stride:4,normalised:!0},uint16x2:{size:2,stride:4,normalised:!1},uint16x4:{size:4,stride:8,normalised:!1},sint16x2:{size:2,stride:4,normalised:!1},sint16x4:{size:4,stride:8,normalised:!1},unorm16x2:{size:2,stride:4,normalised:!0},unorm16x4:{size:4,stride:8,normalised:!0},snorm16x2:{size:2,stride:4,normalised:!0},snorm16x4:{size:4,stride:8,normalised:!0},float16x2:{size:2,stride:4,normalised:!1},float16x4:{size:4,stride:8,normalised:!1},float32:{size:1,stride:4,normalised:!1},float32x2:{size:2,stride:8,normalised:!1},float32x3:{size:3,stride:12,normalised:!1},float32x4:{size:4,stride:16,normalised:!1},uint32:{size:1,stride:4,normalised:!1},uint32x2:{size:2,stride:8,normalised:!1},uint32x3:{size:3,stride:12,normalised:!1},uint32x4:{size:4,stride:16,normalised:!1},sint32:{size:1,stride:4,normalised:!1},sint32x2:{size:2,stride:8,normalised:!1},sint32x3:{size:3,stride:12,normalised:!1},sint32x4:{size:4,stride:16,normalised:!1}};function Uk(t){return V_[t]??V_.float32}const Wk={f32:"float32","vec2<f32>":"float32x2","vec3<f32>":"float32x3","vec4<f32>":"float32x4",vec2f:"float32x2",vec3f:"float32x3",vec4f:"float32x4",i32:"sint32","vec2<i32>":"sint32x2","vec3<i32>":"sint32x3","vec4<i32>":"sint32x4",vec2i:"sint32x2",vec3i:"sint32x3",vec4i:"sint32x4",u32:"uint32","vec2<u32>":"uint32x2","vec3<u32>":"uint32x3","vec4<u32>":"uint32x4",vec2u:"uint32x2",vec3u:"uint32x3",vec4u:"uint32x4",bool:"uint32","vec2<bool>":"uint32x2","vec3<bool>":"uint32x3","vec4<bool>":"uint32x4"},G_=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|\)|$)/g;function q_(t,e){let s;for(;(s=G_.exec(t))!==null;){const r=Wk[s[3]]??"float32";e[s[2]]={location:parseInt(s[1],10),format:r,stride:Uk(r).stride,offset:0,instance:!1,start:0}}G_.lastIndex=0}function zk(t){return t.replace(/\/\/.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"")}function Vk({source:t,entryPoint:e}){const s={},r=zk(t),i=r.indexOf(`fn ${e}(`);if(i===-1)return s;const a=r.indexOf("->",i);if(a===-1)return s;const c=r.substring(i,a);if(q_(c,s),Object.keys(s).length===0){const o=c.match(/\(\s*\w+\s*:\s*(\w+)/);if(o){const h=o[1],u=new RegExp(`struct\\s+${h}\\s*\\{([^}]+)\\}`,"s"),f=r.match(u);f&&q_(f[1],s)}}return s}function Vu(t){var d,g;const e=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,s=/@group\((\d+)\)/,r=/@binding\((\d+)\)/,i=/var(<[^>]+>)? (\w+)/,a=/:\s*([\w<>]+)/,c=/struct\s+(\w+)\s*{([^}]+)}/g,o=/(\w+)\s*:\s*([\w\<\>]+)/g,h=/struct\s+(\w+)/,u=(d=t.match(e))==null?void 0:d.map(_=>{const k=_.match(i),S=(k==null?void 0:k[1])??"";let m;return S==="<uniform>"?m="uniform":S.startsWith("<storage")&&(m="storage"),{group:parseInt(_.match(s)[1],10),binding:parseInt(_.match(r)[1],10),name:k[2],accessMode:m,type:_.match(a)[1]}});if(!u)return{groups:[],structs:[]};const f=((g=t.match(c))==null?void 0:g.map(_=>{const k=_.match(h)[1],S=_.match(o).reduce((m,x)=>{const[v,b]=x.split(":");return m[v.trim()]=b.trim(),m},{});return S?{name:k,members:S}:null}).filter(({name:_})=>u.some(k=>k.type===_||k.type.includes(`<${_}>`))))??[];return{groups:u,structs:f}}var ct=(t=>(t[t.VERTEX=1]="VERTEX",t[t.FRAGMENT=2]="FRAGMENT",t[t.COMPUTE=4]="COMPUTE",t))(ct||{});function Cl(t){return t.endsWith("<u32>")?"uint":t.endsWith("<i32>")?"sint":"float"}function Gk({groups:t}){const e=[];for(let s=0;s<t.length;s++){const r=t[s];e[r.group]||(e[r.group]=[]),r.accessMode==="uniform"?e[r.group].push({binding:r.binding,visibility:ct.VERTEX|ct.FRAGMENT,buffer:{type:"uniform"}}):r.accessMode==="storage"?e[r.group].push({binding:r.binding,visibility:ct.VERTEX|ct.FRAGMENT,buffer:{type:"read-only-storage"}}):r.type==="sampler"?e[r.group].push({binding:r.binding,visibility:ct.VERTEX|ct.FRAGMENT,sampler:{type:"filtering"}}):r.type==="sampler_comparison"?e[r.group].push({binding:r.binding,visibility:ct.VERTEX|ct.FRAGMENT,sampler:{type:"comparison"}}):r.type==="texture_2d"||r.type.startsWith("texture_2d<")?e[r.group].push({binding:r.binding,visibility:ct.VERTEX|ct.FRAGMENT,texture:{sampleType:Cl(r.type),viewDimension:"2d",multisampled:!1}}):r.type==="texture_depth_2d"?e[r.group].push({binding:r.binding,visibility:ct.VERTEX|ct.FRAGMENT,texture:{sampleType:"depth",viewDimension:"2d",multisampled:!1}}):r.type==="texture_depth_2d_array"?e[r.group].push({binding:r.binding,visibility:ct.VERTEX|ct.FRAGMENT,texture:{sampleType:"depth",viewDimension:"2d-array",multisampled:!1}}):r.type==="texture_2d_array"||r.type.startsWith("texture_2d_array<")?e[r.group].push({binding:r.binding,visibility:ct.VERTEX|ct.FRAGMENT,texture:{sampleType:Cl(r.type),viewDimension:"2d-array",multisampled:!1}}):r.type==="texture_3d"||r.type.startsWith("texture_3d<")?e[r.group].push({binding:r.binding,visibility:ct.VERTEX|ct.FRAGMENT,texture:{sampleType:Cl(r.type),viewDimension:"3d",multisampled:!1}}):(r.type==="texture_cube"||r.type.startsWith("texture_cube<"))&&e[r.group].push({binding:r.binding,visibility:ct.VERTEX|ct.FRAGMENT,texture:{sampleType:Cl(r.type),viewDimension:"cube",multisampled:!1}})}for(let s=0;s<e.length;s++)e[s]||(e[s]=[]);return e}function qk({groups:t}){const e=[];for(let s=0;s<t.length;s++){const r=t[s];e[r.group]||(e[r.group]={}),e[r.group][r.name]=r.binding}return e}function Kk(t,e){const s=new Set,r=new Set,i=[...t.structs,...e.structs].filter(c=>s.has(c.name)?!1:(s.add(c.name),!0)),a=[...t.groups,...e.groups].filter(c=>{const o=`${c.name}-${c.binding}`;return r.has(o)?!1:(r.add(o),!0)});return{structs:i,groups:a}}const mo=Object.create(null);class Ec{constructor(e){var o,h;this._layoutKey=0,this._attributeLocationsKey=0;const{fragment:s,vertex:r,layout:i,gpuLayout:a,name:c}=e;if(this.name=c,this.fragment=s,this.vertex=r,s.source===r.source){const u=Vu(s.source);this.structsAndGroups=u}else{const u=Vu(r.source),f=Vu(s.source);this.structsAndGroups=Kk(u,f)}this.layout=i??qk(this.structsAndGroups),this.gpuLayout=a??Gk(this.structsAndGroups),this.autoAssignGlobalUniforms=((o=this.layout[0])==null?void 0:o.globalUniforms)!==void 0,this.autoAssignLocalUniforms=((h=this.layout[1])==null?void 0:h.localUniforms)!==void 0,this._generateProgramKey()}_generateProgramKey(){const{vertex:e,fragment:s}=this,r=e.source+s.source+e.entryPoint+s.entryPoint;this._layoutKey=kc(r,"program")}get attributeData(){return this._attributeData??(this._attributeData=Vk(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null,mo[this._cacheKey]=null}static from(e){const s=`${e.vertex.source}:${e.fragment.source}:${e.fragment.entryPoint}:${e.vertex.entryPoint}`;return mo[s]||(mo[s]=new Ec(e),mo[s]._cacheKey=s),mo[s]}}const l0=["f32","i32","u32","vec2<f32>","vec3<f32>","vec4<f32>","mat2x2<f32>","mat3x3<f32>","mat4x4<f32>","mat3x2<f32>","mat4x2<f32>","mat2x3<f32>","mat4x3<f32>","mat2x4<f32>","mat3x4<f32>","vec2<i32>","vec3<i32>","vec4<i32>","vec2<u32>","vec3<u32>","vec4<u32>"],Yk=l0.reduce((t,e)=>(t[e]=!0,t),{});function Xk(t,e){switch(t){case"f32":return 0;case"vec2<f32>":return new Float32Array(2*e);case"vec3<f32>":return new Float32Array(3*e);case"vec4<f32>":return new Float32Array(4*e);case"mat2x2<f32>":return new Float32Array([1,0,0,1]);case"mat3x3<f32>":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4x4<f32>":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}const c0=class h0 extends Zs{constructor(e,s){super(),this.uid=rt("uniform"),this._resourceType="uniformGroup",this._resourceId=rt("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,s={...h0.defaultOptions,...s},this.uniformStructures=e;const r={};for(const i in e){const a=e[i];if(a.name=i,a.size=a.size??1,!Yk[a.type]){const c=a.type.match(/^array<(\w+(?:<\w+>)?),\s*(\d+)>$/);if(c){const[,o,h]=c;throw new Error(`Uniform type ${a.type} is not supported. Use type: '${o}', size: ${h} instead.`)}throw new Error(`Uniform type ${a.type} is not supported. Supported uniform types are: ${l0.join(", ")}`)}a.value??(a.value=Xk(a.type,a.size)),r[i]=a.value}this.uniforms=r,this._dirtyId=1,this.ubo=s.ubo,this.isStatic=s.isStatic,this._signature=kc(Object.keys(r).map(i=>`${i}-${e[i].type}`).join("-"),"uniform-group")}get buffer(){return this._buffer}set buffer(e){var s;this._buffer!==e&&((s=this._buffer)==null||s.off("change",this.onBufferChange,this),this._buffer=e,e==null||e.on("change",this.onBufferChange,this))}get _gcLastUsed(){var e;return((e=this._buffer)==null?void 0:e._gcLastUsed)??-1}set _gcLastUsed(e){this._buffer&&(this._buffer._gcLastUsed=e)}onBufferChange(){this._resourceId=rt("resource"),this.emit("change",this)}update(){this._dirtyId++}};c0.defaultOptions={ubo:!1,isStatic:!1};let u0=c0;class Vl{constructor(e){this.resources=Object.create(null),this._resourceKeysValue=null,this._dirty=!0;let s=0;for(const r in e){const i=e[r];this.setResource(i,s++)}}get _resourceKeys(){return this._resourceKeysValue??(this._resourceKeysValue=Object.keys(this.resources).map(Number)),this._resourceKeysValue}get _key(){if(this._dirty){this._dirty=!1;const e=[];let s=0;for(const r in this.resources)e[s++]=this.resources[r]?this.resources[r]._resourceId:-1;this._keyValue=e.join("|")}return this._keyValue}setResource(e,s){var i,a;const r=this.resources[s];e!==r&&(r&&((i=r.off)==null||i.call(r,"change",this.onResourceChange,this)),(a=e.on)==null||a.call(e,"change",this.onResourceChange,this),r===void 0&&(this._resourceKeysValue=null),this.resources[s]=e,this._dirty=!0)}getResource(e){return this.resources[e]}_touch(e){const s=this.resources,r=this._resourceKeys;for(let i=0;i<r.length;i++){const a=s[r[i]];a&&(a._gcLastUsed=e)}}destroy(){var s;const e=this.resources;for(const r in e){const i=e[r];(s=i==null?void 0:i.off)==null||s.call(i,"change",this.onResourceChange,this)}this.resources=null,this._resourceKeysValue=null}onResourceChange(e){if(this._dirty=!0,e.destroyed){const s=this.resources;for(const r in s)s[r]===e&&(s[r]=null);Ht(`[BindGroup] a '${e._resourceType}' was destroyed while still bound to a shader. Remove it from the shader before destroying it.`)}}}var Id=(t=>(t[t.WEBGL=1]="WEBGL",t[t.WEBGPU=2]="WEBGPU",t[t.CANVAS=4]="CANVAS",t[t.BOTH=3]="BOTH",t))(Id||{});class tc{constructor(e){this.data={...e};const s=Object.keys(e).sort().map(r=>`${r}:${e[r]}`).join("|");this.id=kc(s,"shader-overrides")}static from(e){return e instanceof tc?e:new tc(e)}}class kf extends Zs{constructor(e){super(),this.uid=rt("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[],this._destroyed=!1;let{gpuProgram:s,glProgram:r,groups:i,resources:a,compatibleRenderers:c,groupMap:o,overrides:h}=e;this._overrides=h?tc.from(h):null,this.gpuProgram=s,this.glProgram=r,c===void 0&&(c=0,s&&(c|=Id.WEBGPU),r&&(c|=Id.WEBGL)),this.compatibleRenderers=c;const u={};if(o)for(const f in o)for(const d in o[f]){const g=o[f][d];u[g]={group:f,binding:d,name:g}}if(!a&&!i&&(a={}),a&&i)throw new Error("[Shader] Cannot have both resources and groups");if(!s&&i&&!o)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(s&&i&&!o){const f=s.structsAndGroups.groups;o={},f.forEach(d=>{o[d.group]=o[d.group]||{},o[d.group][d.binding]=d.name,u[d.name]=d})}else if(a){i={},o||(o={}),s&&s.structsAndGroups.groups.forEach(g=>{o[g.group]=o[g.group]||{},o[g.group][g.binding]=g.name,u[g.name]=g});let f=0;for(const d in a)u[d]||(s&&!r&&Ht(`[Shader] the resource '${d}' matches no binding in the WGSL source — is the name correct?`),i[99]||(i[99]=new Vl,this._ownedBindGroups.push(i[99])),u[d]={group:99,binding:f,name:d},o[99]=o[99]||{},o[99][f]=d,f++);for(const d in a){const g=d;let _=a[d];!_.source&&!_._resourceType&&(_=new u0(_));const k=u[g];k&&(i[k.group]||(i[k.group]=new Vl,this._ownedBindGroups.push(i[k.group])),i[k.group].setResource(_,k.binding))}}this.groups=i,this._uniformBindMap=o,this.resources=this._buildResourceAccessor(i,u)}addResource(e,s,r){var i,a;(i=this._uniformBindMap)[s]||(i[s]={}),(a=this._uniformBindMap[s])[r]||(a[r]=e),this.groups[s]||(this.groups[s]=new Vl,this._ownedBindGroups.push(this.groups[s]))}_buildResourceAccessor(e,s){const r={};for(const i in s){const a=s[i];Object.defineProperty(r,a.name,{get(){return e[a.group].getResource(a.binding)},set(c){e[a.group].setResource(c,a.binding)}})}return r}destroy(e=!1){var s,r;this._destroyed||(this._destroyed=!0,this.emit("destroy",this),e&&((s=this.gpuProgram)==null||s.destroy(),(r=this.glProgram)==null||r.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(i=>{i.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null,this._overrides=null)}static from(e){const{gpu:s,gl:r,...i}=e;let a,c;return s&&(a=Ec.from(s)),r&&(c=a0.from(r)),new kf({gpuProgram:a,glProgram:c,...i})}}const Qk={normal:0,add:1,multiply:2,screen:3,overlay:4,erase:5,"normal-npm":6,"add-npm":7,"screen-npm":8,min:9,max:10},Zk={BLEND:0,OFFSET:1,CULLING:2,DEPTH_TEST:3,WINDING:4,DEPTH_MASK:5},{BLEND:Gu,OFFSET:qu,CULLING:Ku,DEPTH_TEST:Yu,WINDING:Xu,DEPTH_MASK:Qu}=Zk,Nd=class d0{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Gu)}set blend(e){!!(this.data&1<<Gu)!==e&&(this.data^=1<<Gu)}get offsets(){return!!(this.data&1<<qu)}set offsets(e){!!(this.data&1<<qu)!==e&&(this.data^=1<<qu)}set cullMode(e){if(e==="none"){this.culling=!1;return}this.culling=!0,this.clockwiseFrontFace=e==="front"}get cullMode(){return this.culling?this.clockwiseFrontFace?"front":"back":"none"}get culling(){return!!(this.data&1<<Ku)}set culling(e){!!(this.data&1<<Ku)!==e&&(this.data^=1<<Ku)}get depthTest(){return!!(this.data&1<<Yu)}set depthTest(e){!!(this.data&1<<Yu)!==e&&(this.data^=1<<Yu)}get depthMask(){return!!(this.data&1<<Qu)}set depthMask(e){!!(this.data&1<<Qu)!==e&&(this.data^=1<<Qu)}get clockwiseFrontFace(){return!!(this.data&1<<Xu)}set clockwiseFrontFace(e){!!(this.data&1<<Xu)!==e&&(this.data^=1<<Xu)}get blendMode(){return this._blendMode}set blendMode(e){this.blend=e!=="none",this._blendMode=e,this._blendModeId=Qk[e]||0}get polygonOffset(){return this._polygonOffset}set polygonOffset(e){this.offsets=!!e,this._polygonOffset=e}toString(){return`[pixi.js/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`}static for2d(){const e=new d0;return e.depthTest=!1,e.depthMask=!1,e.blend=!0,e}};Nd.default2d=Nd.for2d();let f0=Nd;const Od=[];Mt.handleByNamedList(Fe.Environment,Od);async function Jk(t){if(!t)for(let e=0;e<Od.length;e++){const s=Od[e];if(s.value.test()){await s.value.load();return}}}let go;function e2(){if(typeof go=="boolean")return go;try{go=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{go=!1}return go}const Ho=new Set;let Fd=!1;function K_(t,e,s=2){const r=e&&e.length,i=r?e[0]*s:t.length;Ho.size&&Ho.clear();let a=p0(t,0,i,s,!0);const c=[];if(!a||a.next===a.prev)return c;let o=0,h=0,u=0;if(r&&(a=n2(t,e,a,s)),t.length>80*s){o=t[0],h=t[1];let f=o,d=h;for(let g=s;g<i;g+=s){const _=t[g],k=t[g+1];_<o&&(o=_),k<h&&(h=k),_>f&&(f=_),k>d&&(d=k)}u=Math.max(f-o,d-h),u=u!==0?32767/u:0}return $d(a,c,o,h,u),c}function p0(t,e,s,r,i){let a=null;if(i===v2(t,e,s,r)>0)for(let c=e;c<s;c+=r)a=Q_(c/r|0,t[c],t[c+1],a);else for(let c=s-r;c>=e;c-=r)a=Q_(c/r|0,t[c],t[c+1],a);return a&&Uo(a,a.next)&&(zo(a),a=a.next),a}function Ei(t,e=t){const s=e===t;let r=t,i;do i=!1,r!==r.next&&(Ho.size===0||!Ho.has(r))&&(Uo(r,r.next)||pt(r.prev,r,r.next)===0)?((s||r===e)&&(e=r.prev),Fd=!0,zo(r),r=r.prev,i=!0):(s||r!==e)&&(r=r.next,i=!s);while(i||r!==e);return e}function $d(t,e,s,r,i){i&&d2(t,s,r,i);let a=t,c=!1;for(;t.prev!==t.next;){const o=t.prev,h=t.next;if(pt(o,t,h)<0&&(i?s2(t,s,r,i):t2(t))){e.push(o.i,t.i,h.i),zo(t),t=h,a=h;continue}if(t=h,t===a){if(Fd=!1,t=Ei(t),Fd){a=t;continue}if(!c){t=r2(t,e),a=t,c=!0;continue}i2(t,e,s,r,i);break}}}function t2(t){const e=t.prev,s=t,r=t.next,i=e.x,a=s.x,c=r.x,o=e.y,h=s.y,u=r.y,f=Math.min(i,a,c),d=Math.min(o,h,u),g=Math.max(i,a,c),_=Math.max(o,h,u);let k=r.next;for(;k!==e;){if(k.x>=f&&k.x<=g&&k.y>=d&&k.y<=_&&!(i===k.x&&o===k.y)&&rc(i,o,a,h,c,u,k.x,k.y)&&pt(k.prev,k,k.next)>=0)return!1;k=k.next}return!0}function s2(t,e,s,r){const i=t.prev,a=t,c=t.next,o=i.x,h=a.x,u=c.x,f=i.y,d=a.y,g=c.y,_=Math.min(o,h,u),k=Math.min(f,d,g),S=Math.max(o,h,u),m=Math.max(f,d,g),x=zd(_,k,e,s,r),v=zd(S,m,e,s,r);let b=t.prevZ;for(;b&&b.z>=x;){if(b.x>=_&&b.x<=S&&b.y>=k&&b.y<=m&&b!==c&&!(o===b.x&&f===b.y)&&rc(o,f,h,d,u,g,b.x,b.y)&&pt(b.prev,b,b.next)>=0)return!1;b=b.prevZ}let C=t.nextZ;for(;C&&C.z<=v;){if(C.x>=_&&C.x<=S&&C.y>=k&&C.y<=m&&C!==c&&!(o===C.x&&f===C.y)&&rc(o,f,h,d,u,g,C.x,C.y)&&pt(C.prev,C,C.next)>=0)return!1;C=C.nextZ}return!0}function r2(t,e){let s=t,r=!1;do{const i=s.prev,a=s.next.next;_0(i,s,s.next,a,!1)&&Wo(i,a)&&Wo(a,i)&&(e.push(i.i,s.i,a.i),zo(s),zo(s.next),s=t=a,r=!0),s=s.next}while(s!==t);return r?Ei(s):s}function i2(t,e,s,r,i){let a=t;do{let c=a.next.next;for(;c!==a.prev;){if(a.i!==c.i&&m2(a,c)){let o=v0(a,c);a=Ei(a,a.next),o=Ei(o,o.next),$d(a,e,s,r,i),$d(o,e,s,r,i);return}c=c.next}a=a.next}while(a!==t)}let Hd=!1;function n2(t,e,s,r){const i=[];for(let a=0,c=e.length;a<c;a++){const o=e[a]*r,h=a<c-1?e[a+1]*r:t.length,u=p0(t,o,h,r,!1);u===u.next&&Ho.add(u),i.push(p2(u))}i.sort(o2),l2(t.length/r,e.length),g0(s,s),Hd=!0;for(let a=0;a<i.length;a++)s=a2(i[a],s);return Hd=!1,Ei(s)}function o2(t,e){return t.x-e.x||t.y-e.y||(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)}function a2(t,e){const s=h2(t,e);if(!s)return e;const r=v0(s,t),i=r.next;return g0(s,i.next),Ei(r,r.next),Ei(s,s.next)}const m0=16;let ot=new Float64Array(0),sc=0;const Ud=[],Wd=[];function l2(t,e){const s=Math.ceil((t+2*e)/m0)+e+2;ot.length<s*4&&(ot=new Float64Array(s*4)),sc=0}function g0(t,e){let s=t;do{const r=sc++;Ud[r]=s;let i=s.x,a=s.y,c=s.x,o=s.y,h=0;do{const f=s.next;s.z=r,f.x<i&&(i=f.x),f.x>c&&(c=f.x),f.y<a&&(a=f.y),f.y>o&&(o=f.y),s=f}while(++h<m0&&s!==e);Wd[r]=s;const u=r*4;ot[u]=i,ot[u+1]=a,ot[u+2]=c,ot[u+3]=o}while(s!==e)}function c2(t,e){const s=t.z*4;e.x<ot[s]&&(ot[s]=e.x),e.y<ot[s+1]&&(ot[s+1]=e.y),e.x>ot[s+2]&&(ot[s+2]=e.x),e.y>ot[s+3]&&(ot[s+3]=e.y)}function Y_(t){let e=Wd[t];for(;e.prev.next!==e;)e=e.next;return Wd[t]=e,e}function X_(t){let e=Ud[t];for(;e.prev.next!==e;)e=e.next;return Ud[t]=e,e}function h2(t,e){let s=e;const r=t.x,i=t.y;let a=-1/0,c;if(Uo(t,s))return s;for(let g=0,_=0;g<sc;g++,_+=4){if(i<ot[_+1]||i>ot[_+3]||ot[_]>r||ot[_+2]<=a)continue;const k=Y_(g);s=X_(g);do{if(s.prev.next===s){if(Uo(t,s.next))return s.next;if(i<=s.y&&i>=s.next.y&&s.next.y!==s.y){const S=s.x+(i-s.y)*(s.next.x-s.x)/(s.next.y-s.y);if(S<=r&&S>a&&(a=S,c=s.x<s.next.x?s:s.next,S===r))return c}}s=s.next}while(s!==k)}if(!c)return null;const o=c.x,h=c.y,u=Math.min(i,h),f=Math.max(i,h);let d=1/0;for(let g=0,_=0;g<sc;g++,_+=4){if(ot[_+2]<o||ot[_]>r||ot[_+3]<u||ot[_+1]>f)continue;const k=Y_(g);s=X_(g);do{if(s.prev.next===s&&r>=s.x&&s.x>=o&&r!==s.x&&rc(i<h?r:a,i,o,h,i<h?a:r,i,s.x,s.y)){const S=Math.abs(i-s.y)/(r-s.x);(Wo(s,t)||s.y===i&&s.next.y===i&&s.next.x>r)&&(S<d||S===d&&(s.x>c.x||s.x===c.x&&u2(c,s)))&&(c=s,d=S)}s=s.next}while(s!==k)}return c}function u2(t,e){return pt(t.prev,t,e.prev)<0&&pt(e.next,t,t.next)<0}const cs=[];let hn=[],ai=new Uint32Array(0),_o=new Uint32Array(0);const vo=new Uint32Array(256);function d2(t,e,s,r){let i=t,a=0;do i.z=zd(i.x,i.y,e,s,r),cs[a++]=i,i=i.next;while(i!==t);f2(a);let c=null;for(let o=0;o<a;o++){const h=cs[o];h.prevZ=c,c&&(c.nextZ=h),c=h}c.nextZ=null,cs.fill(null,0,a),hn.fill(null,0,a)}function f2(t){if(t<=32){for(let e=1;e<t;e++){const s=cs[e],r=s.z;let i=e-1;for(;i>=0&&cs[i].z>r;)cs[i+1]=cs[i],i--;cs[i+1]=s}return}ai.length<t&&(ai=new Uint32Array(t),_o=new Uint32Array(t),hn=new Array(t));for(let e=0;e<t;e++)ai[e]=cs[e].z;kl(t,cs,ai,hn,_o,0),kl(t,hn,_o,cs,ai,8),kl(t,cs,ai,hn,_o,16),kl(t,hn,_o,cs,ai,24)}function kl(t,e,s,r,i,a){vo.fill(0);for(let o=0;o<t;o++)vo[s[o]>>>a&255]++;let c=0;for(let o=0;o<256;o++){const h=vo[o];vo[o]=c,c+=h}for(let o=0;o<t;o++){const h=s[o],u=vo[h>>>a&255]++;r[u]=e[o],i[u]=h}}function zd(t,e,s,r,i){return t=(t-s)*i|0,e=(e-r)*i|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function p2(t){let e=t,s=t;do(e.x<s.x||e.x===s.x&&e.y<s.y)&&(s=e),e=e.next;while(e!==t);return s}function rc(t,e,s,r,i,a,c,o){return(i-c)*(e-o)>=(t-c)*(a-o)&&(t-c)*(r-o)>=(s-c)*(e-o)&&(s-c)*(a-o)>=(i-c)*(r-o)}function m2(t,e){const s=Uo(t,e)&&pt(t.prev,t,t.next)>0&&pt(e.prev,e,e.next)>0;return t.next.i!==e.i&&(s||Wo(t,e)&&Wo(e,t)&&(pt(t.prev,t,e.prev)!==0||pt(t,e.prev,e)!==0))&&!g2(t,e)&&(s||_2(t,e))}function pt(t,e,s){return(e.y-t.y)*(s.x-e.x)-(e.x-t.x)*(s.y-e.y)}function Uo(t,e){return t.x===e.x&&t.y===e.y}function _0(t,e,s,r,i=!0){const a=pt(t,e,s),c=pt(t,e,r),o=pt(s,r,t),h=pt(s,r,e);return(a>0&&c<0||a<0&&c>0)&&(o>0&&h<0||o<0&&h>0)?!0:i?!!(a===0&&El(t,s,e)||c===0&&El(t,r,e)||o===0&&El(s,t,r)||h===0&&El(s,e,r)):!1}function El(t,e,s){return e.x<=Math.max(t.x,s.x)&&e.x>=Math.min(t.x,s.x)&&e.y<=Math.max(t.y,s.y)&&e.y>=Math.min(t.y,s.y)}function g2(t,e){const s=Math.min(t.x,e.x),r=Math.max(t.x,e.x),i=Math.min(t.y,e.y),a=Math.max(t.y,e.y);let c=t;do{const o=c.next;if(c.x>r&&o.x>r||c.x<s&&o.x<s||c.y>a&&o.y>a||c.y<i&&o.y<i){c=o;continue}if(c.i!==t.i&&o.i!==t.i&&c.i!==e.i&&o.i!==e.i&&_0(c,o,t,e))return!0;c=o}while(c!==t);return!1}function Wo(t,e){return pt(t.prev,t,t.next)<0?pt(t,e,t.next)>=0&&pt(t,t.prev,e)>=0:pt(t,e,t.prev)<0||pt(t,t.next,e)<0}function _2(t,e){let s=t,r=!1;const i=(t.x+e.x)/2,a=(t.y+e.y)/2;do{const c=s.next;s.y>a!=c.y>a&&i<(c.x-s.x)*(a-s.y)/(c.y-s.y)+s.x&&(r=!r),s=c}while(s!==t);return r}function v0(t,e){const s=Vd(t.i,t.x,t.y),r=Vd(e.i,e.x,e.y),i=t.next,a=e.prev;return t.next=e,e.prev=t,s.next=i,i.prev=s,r.next=s,s.prev=r,a.next=r,r.prev=a,r}function Q_(t,e,s,r){const i=Vd(t,e,s);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function zo(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ),Hd&&c2(t.prev,t.next)}function Vd(t,e,s){return{i:t,x:e,y:s,prev:null,next:null,z:0,prevZ:null,nextZ:null}}function v2(t,e,s,r){let i=0;for(let a=e,c=s-r;a<s;a+=r)i+=(t[c]-t[a])*(t[a+1]+t[c+1]),c=a;return i}const x2=K_.default||K_;var x0=(t=>(t[t.NONE=0]="NONE",t[t.COLOR=16384]="COLOR",t[t.STENCIL=1024]="STENCIL",t[t.DEPTH=256]="DEPTH",t[t.COLOR_DEPTH=16640]="COLOR_DEPTH",t[t.COLOR_STENCIL=17408]="COLOR_STENCIL",t[t.DEPTH_STENCIL=1280]="DEPTH_STENCIL",t[t.ALL=17664]="ALL",t))(x0||{});class y2{constructor(e){this.items=[],this._name=e}emit(e,s,r,i,a,c,o,h){const{name:u,items:f}=this;for(let d=0,g=f.length;d<g;d++)f[d][u](e,s,r,i,a,c,o,h);return this}add(e){return e[this._name]&&(this.remove(e),this.items.push(e)),this}remove(e){const s=this.items.indexOf(e);return s!==-1&&this.items.splice(s,1),this}contains(e){return this.items.indexOf(e)!==-1}removeAll(){return this.items.length=0,this}destroy(){this.removeAll(),this.items=null,this._name=null}get empty(){return this.items.length===0}get name(){return this._name}}const b2=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],y0=class b0 extends Zs{constructor(e){super(),this.tick=0,this.uid=rt("renderer"),this.runners=Object.create(null),this.renderPipes=Object.create(null),this._initOptions={},this._systemsHash=Object.create(null),this.type=e.type,this.name=e.name,this.config=e;const s=[...b2,...this.config.runners??[]];this._addRunners(...s),this._unsafeEvalCheck()}async init(e={}){const s=e.skipExtensionImports===!0?!0:e.manageImports===!1;await Jk(s),!s&&this.config.loaders&&await Promise.all(this.config.loaders.map(r=>r.value.load())),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(const r in this._systemsHash)e={...this._systemsHash[r].constructor.defaultOptions,...e};e={...b0.defaultOptions,...e},this._roundPixels=e.roundPixels?1:0;for(let r=0;r<this.runners.init.items.length;r++)await this.runners.init.items[r].init(e);this._initOptions=e}render(e,s){this.tick++;let r=e;if(r instanceof Qs&&(r={container:r},s&&(je(xt,"passing a second argument is deprecated, please use render options instead"),r.target=s.renderTexture)),r.target||(r.target=this.view.renderTarget),r.target===this.view.renderTarget&&(this._lastObjectRendered=r.container,r.clearColor??(r.clearColor=this.background.colorRgba),r.clear??(r.clear=this.background.clearBeforeRender)),r.clearColor){const i=Array.isArray(r.clearColor)&&r.clearColor.length===4;r.clearColor=i?r.clearColor:Ss.shared.setValue(r.clearColor).toArray()}r.transform||(r.container.updateLocalTransform(),r.transform=r.container.localTransform),r.container.visible&&(r.container.enableRenderGroup(),this.runners.prerender.emit(r),this.runners.renderStart.emit(r),this.runners.render.emit(r),this.runners.renderEnd.emit(r),this.runners.postrender.emit(r))}resize(e,s,r){const i=this.view.resolution;this.view.resize(e,s,r),this.emit("resize",this.view.screen.width,this.view.screen.height,this.view.resolution),r!==void 0&&r!==i&&this.runners.resolutionChange.emit(r)}clear(e={}){const s=this;e.target||(e.target=s.renderTarget.renderTarget),e.clearColor||(e.clearColor=this.background.colorRgba),e.clear??(e.clear=x0.ALL);const{clear:r,clearColor:i,target:a,mipLevel:c,layer:o}=e;Ss.shared.setValue(i??this.background.colorRgba),s.renderTarget.clear(a,r,Ss.shared.toArray(),c??0,o??0)}get resolution(){return this.view.resolution}set resolution(e){this.view.resolution=e,this.runners.resolutionChange.emit(e)}get width(){return this.view.texture.frame.width}get height(){return this.view.texture.frame.height}get canvas(){return this.view.canvas}get lastObjectRendered(){return this._lastObjectRendered}get renderingToScreen(){return this.renderTarget.renderingToScreen}get screen(){return this.view.screen}_addRunners(...e){e.forEach(s=>{this.runners[s]=new y2(s)})}_addSystems(e){let s;for(s in e){const r=e[s];this._addSystem(r.value,r.name)}}_addSystem(e,s){const r=new e(this);if(this[s])throw new Error(`Whoops! The name "${s}" is already in use`);this[s]=r,this._systemsHash[s]=r;for(const i in this.runners)this.runners[i].add(r);return this}_addPipes(e,s){const r=s.reduce((i,a)=>(i[a.name]=a.value,i),{});e.forEach(i=>{const a=i.value,c=i.name,o=r[c];this.renderPipes[c]=new a(this,o?new o:null),this.runners.destroy.add(this.renderPipes[c])})}destroy(e=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(e),(e===!0||typeof e=="object"&&e.releaseGlobalResources)&&Sc.release(),Object.values(this.runners).forEach(s=>{s.destroy()}),this._systemsHash=null,this.renderPipes=null,this.removeAllListeners()}generateTexture(e){return this.textureGenerator.generateTexture(e)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!e2())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}resetState(){this.runners.resetState.emit()}};y0.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};let w0=y0,Pl;function w2(t){return Pl!==void 0||(Pl=(()=>{var s;const e={stencil:!0,failIfMajorPerformanceCaveat:t??w0.defaultOptions.failIfMajorPerformanceCaveat};try{if(!Hr.get().getWebGLRenderingContext())return!1;let i=Hr.get().createCanvas().getContext("webgl",e);const a=!!((s=i==null?void 0:i.getContextAttributes())!=null&&s.stencil);if(i){const c=i.getExtension("WEBGL_lose_context");c&&c.loseContext()}return i=null,a}catch{return!1}})()),Pl}let Ml;async function S2(t={}){return Ml!==void 0||(Ml=await(async()=>{const e=Hr.get().getNavigator().gpu;if(!e)return!1;try{return await(await e.requestAdapter(t)).requestDevice(),!0}catch{return!1}})()),Ml}const Z_=["webgl","webgpu","canvas"];async function C2(t){let e=[];t.preference?Array.isArray(t.preference)?e=t.preference.slice():(e.push(t.preference),Z_.forEach(a=>{a!==t.preference&&e.push(a)})):e=Z_.slice();let s,r={};for(let a=0;a<e.length;a++){const c=e[a];if(c==="webgpu"&&await S2()){const{WebGPURenderer:o}=await Ao(async()=>{const{WebGPURenderer:h}=await import("./WebGPURenderer-B-kl5Onz.js");return{WebGPURenderer:h}},__vite__mapDeps([4,5,6,3]));s=o,r={...t,...t.webgpu};break}else if(c==="webgl"&&w2(t.failIfMajorPerformanceCaveat??w0.defaultOptions.failIfMajorPerformanceCaveat)){const{WebGLRenderer:o}=await Ao(async()=>{const{WebGLRenderer:h}=await import("./WebGLRenderer-BceHugHE.js");return{WebGLRenderer:h}},__vite__mapDeps([7,5,6,3]));s=o,r={...t,...t.webgl};break}else if(c==="canvas"){const{CanvasRenderer:o}=await Ao(async()=>{const{CanvasRenderer:h}=await import("./CanvasRenderer-6iBTvAyb.js");return{CanvasRenderer:h}},__vite__mapDeps([8,6,3,2]));s=o,r={...t,...t.canvasOptions};break}}if(delete r.webgpu,delete r.webgl,delete r.canvasOptions,!s)throw new Error("No available renderer for the current environment");const i=new s;return await i.init(r),i}const S0="8.22.0";class C0{static init(){var e;(e=globalThis.__PIXI_APP_INIT__)==null||e.call(globalThis,this,S0)}static destroy(){}}C0.extension=Fe.Application;class k2{constructor(e){this._renderer=e}init(){var e;(e=globalThis.__PIXI_RENDERER_INIT__)==null||e.call(globalThis,this._renderer,S0)}destroy(){this._renderer=null}}k2.extension={type:[Fe.WebGLSystem,Fe.WebGPUSystem],name:"initHook",priority:-10};class k0{static init(e){Object.defineProperty(this,"resizeTo",{configurable:!0,set(s){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=s,s&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this._cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this._cancelResize();let s,r;if(this._resizeTo===globalThis.window)s=globalThis.innerWidth,r=globalThis.innerHeight;else{const{clientWidth:i,clientHeight:a}=this._resizeTo;s=i,r=a}this.renderer.resize(s,r),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=e.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}k0.extension=Fe.Application;class E0{static init(e){e=Object.assign({autoStart:!0,sharedTicker:!1},e),Object.defineProperty(this,"ticker",{configurable:!0,set(s){this._ticker&&this._ticker.remove(this.render,this),this._ticker=s,s&&s.add(this.render,this,ec.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=e.sharedTicker?dn.shared:new dn,e.autoStart&&this.start()}static destroy(){if(this._ticker){const e=this._ticker;this.ticker=null,e.destroy()}}}E0.extension=Fe.Application;Mt.add(k0);Mt.add(E0);const P0=class Gd{constructor(...e){this.stage=new Qs,e[0]!==void 0&&je(xt,"Application constructor options are deprecated, please use Application.init() instead.")}async init(e){e={...e},this.stage||(this.stage=new Qs),this.renderer=await C2(e),Gd._plugins.forEach(s=>{s.init.call(this,e)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return je(xt,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}get domContainerRoot(){var e;return(e=this.renderer.renderPipes.dom)==null?void 0:e._domElement}destroy(e=!1,s=!1){const r=Gd._plugins.slice(0);r.reverse(),r.forEach(i=>{i.destroy.call(this)}),this.stage.destroy(s),this.stage=null,this.renderer.destroy(e),this.renderer=null}};P0._plugins=[];let M0=P0;Mt.handleByList(Fe.Application,M0._plugins);Mt.add(C0);const Zu={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},E2=/([astvzqmhlc])([^astvzqmhlc]*)/gi,P2=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;function M2(t){const e=[];return t.replace(E2,(s,r,i)=>{let a=r.toLowerCase(),c=r;const o=A2(i);for(a==="m"&&o.length>2&&(e.push([c,...o.splice(0,2)]),a="l",c=c==="m"?"l":"L");;){if(o.length===Zu[a])return e.push([c,...o]),"";if(o.length<Zu[a])throw new Error("malformed path data");e.push([c,...o.splice(0,Zu[a])])}}),e}function A2(t){const e=t.match(P2);return e?e.map(Number):[]}function T2(t,e){const s=M2(t),r=[];let i=null,a=0,c=0;for(let o=0;o<s.length;o++){const h=s[o],u=h[0],f=h;switch(u){case"M":a=f[1],c=f[2],e.moveTo(a,c);break;case"m":a+=f[1],c+=f[2],e.moveTo(a,c);break;case"H":a=f[1],e.lineTo(a,c);break;case"h":a+=f[1],e.lineTo(a,c);break;case"V":c=f[1],e.lineTo(a,c);break;case"v":c+=f[1],e.lineTo(a,c);break;case"L":a=f[1],c=f[2],e.lineTo(a,c);break;case"l":a+=f[1],c+=f[2],e.lineTo(a,c);break;case"C":a=f[5],c=f[6],e.bezierCurveTo(f[1],f[2],f[3],f[4],a,c);break;case"c":e.bezierCurveTo(a+f[1],c+f[2],a+f[3],c+f[4],a+f[5],c+f[6]),a+=f[5],c+=f[6];break;case"S":a=f[3],c=f[4],e.bezierCurveToShort(f[1],f[2],a,c);break;case"s":e.bezierCurveToShort(a+f[1],c+f[2],a+f[3],c+f[4]),a+=f[3],c+=f[4];break;case"Q":a=f[3],c=f[4],e.quadraticCurveTo(f[1],f[2],a,c);break;case"q":e.quadraticCurveTo(a+f[1],c+f[2],a+f[3],c+f[4]),a+=f[3],c+=f[4];break;case"T":a=f[1],c=f[2],e.quadraticCurveToShort(a,c);break;case"t":a+=f[1],c+=f[2],e.quadraticCurveToShort(a,c);break;case"A":a=f[6],c=f[7],e.arcToSvg(f[1],f[2],f[3],f[4],f[5],a,c);break;case"a":a+=f[6],c+=f[7],e.arcToSvg(f[1],f[2],f[3],f[4],f[5],a,c);break;case"Z":case"z":e.closePath(),r.length>0&&(i=r.pop(),i?(a=i.startX,c=i.startY):(a=0,c=0)),i=null;break;default:Ht(`Unknown SVG path command: ${u}`)}u!=="Z"&&u!=="z"&&i===null&&(i={startX:a,startY:c},r.push(i))}return e}class Ef{constructor(e=0,s=0,r=0){this.type="circle",this.x=e,this.y=s,this.radius=r}clone(){return new Ef(this.x,this.y,this.radius)}contains(e,s){if(this.radius<=0)return!1;const r=this.radius*this.radius;let i=this.x-e,a=this.y-s;return i*=i,a*=a,i+a<=r}strokeContains(e,s,r,i=.5){if(this.radius===0)return!1;const a=this.x-e,c=this.y-s,o=this.radius,h=(1-i)*r,u=Math.sqrt(a*a+c*c);return u<=o+h&&u>o-(r-h)}getBounds(e){return e||(e=new Pt),e.x=this.x-this.radius,e.y=this.y-this.radius,e.width=this.radius*2,e.height=this.radius*2,e}copyFrom(e){return this.x=e.x,this.y=e.y,this.radius=e.radius,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}class Pf{constructor(e=0,s=0,r=0,i=0){this.type="ellipse",this.x=e,this.y=s,this.halfWidth=r,this.halfHeight=i}clone(){return new Pf(this.x,this.y,this.halfWidth,this.halfHeight)}contains(e,s){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let r=(e-this.x)/this.halfWidth,i=(s-this.y)/this.halfHeight;return r*=r,i*=i,r+i<=1}strokeContains(e,s,r,i=.5){const{halfWidth:a,halfHeight:c}=this;if(a<=0||c<=0)return!1;const o=r*(1-i),h=r-o,u=a-h,f=c-h,d=a+o,g=c+o,_=e-this.x,k=s-this.y;return _*_/(d*d)+k*k/(g*g)>1?!1:u<=0||f<=0?!0:_*_/(u*u)+k*k/(f*f)>1}getBounds(e){return e||(e=new Pt),e.x=this.x-this.halfWidth,e.y=this.y-this.halfHeight,e.width=this.halfWidth*2,e.height=this.halfHeight*2,e}copyFrom(e){return this.x=e.x,this.y=e.y,this.halfWidth=e.halfWidth,this.halfHeight=e.halfHeight,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}function A0(t){const e=t.length;if(e<6)return 1;let s=0;for(let r=0,i=t[e-2],a=t[e-1];r<e;r+=2){const c=t[r],o=t[r+1];s+=(c-i)*(o+a),i=c,a=o}return s<0?-1:1}function R2(t,e,s,r,i,a){const c=t-s,o=e-r,h=i-s,u=a-r,f=c*h+o*u,d=h*h+u*u;let g=-1;d!==0&&(g=f/d);let _,k;g<0?(_=s,k=r):g>1?(_=i,k=a):(_=s+g*h,k=r+g*u);const S=t-_,m=e-k;return S*S+m*m}let D2,L2;class Do{constructor(...e){this.type="polygon";let s=Array.isArray(e[0])?e[0]:e;if(typeof s[0]!="number"){const r=[];for(let i=0,a=s.length;i<a;i++)r.push(s[i].x,s[i].y);s=r}this.points=s,this.closePath=!0}isClockwise(){let e=0;const s=this.points,r=s.length;for(let i=0;i<r;i+=2){const a=s[i],c=s[i+1],o=s[(i+2)%r],h=s[(i+3)%r];e+=(o-a)*(h+c)}return e<0}containsPolygon(e){const s=this.getBounds(D2),r=e.getBounds(L2);if(!s.containsRect(r))return!1;const i=e.points;for(let a=0;a<i.length;a+=2){const c=i[a],o=i[a+1];if(!this.contains(c,o))return!1}return!0}clone(){const e=this.points.slice(),s=new Do(e);return s.closePath=this.closePath,s}contains(e,s){let r=!1;const i=this.points.length/2;for(let a=0,c=i-1;a<i;c=a++){const o=this.points[a*2],h=this.points[a*2+1],u=this.points[c*2],f=this.points[c*2+1];h>s!=f>s&&e<(u-o)*((s-h)/(f-h))+o&&(r=!r)}return r}strokeContains(e,s,r,i=.5){const{points:a}=this,c=i===.5?i:(i-.5)*A0(a)+.5,o=r*c,h=r-o,u=o*o,f=h*h,d=a.length-(this.closePath?0:2);for(let g=0;g<d;g+=2){const _=a[g],k=a[g+1],S=a[(g+2)%a.length],m=a[(g+3)%a.length],x=R2(e,s,_,k,S,m),v=Math.sign((S-_)*(s-k)-(m-k)*(e-_));if(x<=(v<0?u:f))return!0}return!1}getBounds(e){e||(e=new Pt);const s=this.points;let r=1/0,i=-1/0,a=1/0,c=-1/0;for(let o=0,h=s.length;o<h;o+=2){const u=s[o],f=s[o+1];r=u<r?u:r,i=u>i?u:i,a=f<a?f:a,c=f>c?f:c}return e.x=r,e.width=i-r,e.y=a,e.height=c-a,e}copyFrom(e){return this.points=e.points.slice(),this.closePath=e.closePath,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((e,s)=>`${e}, ${s}`,"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return je("8.11.0","Polygon.lastX is deprecated, please use Polygon.lastX instead."),this.points[this.points.length-2]}get y(){return je("8.11.0","Polygon.y is deprecated, please use Polygon.lastY instead."),this.points[this.points.length-1]}get startX(){return this.points[0]}get startY(){return this.points[1]}}const Al=(t,e,s,r,i,a,c)=>{const o=t-s,h=e-r,u=Math.sqrt(o*o+h*h);return u>=i-a&&u<=i+c};class Mf{constructor(e=0,s=0,r=0,i=0,a=20){this.type="roundedRectangle",this.x=e,this.y=s,this.width=r,this.height=i,this.radius=a}getBounds(e){return e||(e=new Pt),e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e}clone(){return new Mf(this.x,this.y,this.width,this.height,this.radius)}copyFrom(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this.radius=e.radius,this}copyTo(e){return e.copyFrom(this),e}contains(e,s){if(this.width<=0||this.height<=0)return!1;if(e>=this.x&&e<=this.x+this.width&&s>=this.y&&s<=this.y+this.height){const r=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(s>=this.y+r&&s<=this.y+this.height-r||e>=this.x+r&&e<=this.x+this.width-r)return!0;let i=e-(this.x+r),a=s-(this.y+r);const c=r*r;if(i*i+a*a<=c||(i=e-(this.x+this.width-r),i*i+a*a<=c)||(a=s-(this.y+this.height-r),i*i+a*a<=c)||(i=e-(this.x+r),i*i+a*a<=c))return!0}return!1}strokeContains(e,s,r,i=.5){const{x:a,y:c,width:o,height:h,radius:u}=this,f=r*(1-i),d=r-f,g=a+u,_=c+u,k=o-u*2,S=h-u*2,m=a+o,x=c+h;return(e>=a-f&&e<=a+d||e>=m-d&&e<=m+f)&&s>=_&&s<=_+S||(s>=c-f&&s<=c+d||s>=x-d&&s<=x+f)&&e>=g&&e<=g+k?!0:e<g&&s<_&&Al(e,s,g,_,u,d,f)||e>m-u&&s<_&&Al(e,s,m-u,_,u,d,f)||e>m-u&&s>x-u&&Al(e,s,m-u,x-u,u,d,f)||e<g&&s>x-u&&Al(e,s,g,x-u,u,d,f)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}const T0={};function B2(t,e,s){let r=2166136261;for(let i=0;i<e;i++)r^=t[i].uid,r=Math.imul(r,16777619),r>>>=0;return T0[r]||j2(t,e,r,s)}function j2(t,e,s,r){const i={};let a=0;for(let o=0;o<r;o++){const h=o<e?t[o]:Ve.EMPTY.source;i[a++]=h.source,i[a++]=h.style}const c=new Vl(i);return T0[s]=c,c}class J_{constructor(e){typeof e=="number"?this.rawBinaryData=new ArrayBuffer(e):e instanceof Uint8Array?this.rawBinaryData=e.buffer:this.rawBinaryData=e,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData),this.size=this.rawBinaryData.byteLength}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}get float64View(){return this._float64Array||(this._float64Array=new Float64Array(this.rawBinaryData)),this._float64Array}get bigUint64View(){return this._bigUint64Array||(this._bigUint64Array=new BigUint64Array(this.rawBinaryData)),this._bigUint64Array}view(e){return this[`${e}View`]}destroy(){this.rawBinaryData=null,this.uint32View=null,this.float32View=null,this.uint16View=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._int32View=null,this._float64Array=null,this._bigUint64Array=null}static sizeOf(e){switch(e){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${e} isn't a valid view type`)}}}function ev(t,e,s,r){if(s??(s=0),r??(r=Math.min(t.byteLength-s,e.byteLength)),!(s&7)&&!(r&7)){const i=r/8;new Float64Array(e,0,i).set(new Float64Array(t,s,i))}else if(!(s&3)&&!(r&3)){const i=r/4;new Float32Array(e,0,i).set(new Float32Array(t,s,i))}else new Uint8Array(e).set(new Uint8Array(t,s,r))}const I2={normal:"normal-npm",add:"add-npm",screen:"screen-npm"};var N2=(t=>(t[t.DISABLED=0]="DISABLED",t[t.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",t[t.MASK_ACTIVE=2]="MASK_ACTIVE",t[t.INVERSE_MASK_ACTIVE=3]="INVERSE_MASK_ACTIVE",t[t.RENDERING_MASK_REMOVE=4]="RENDERING_MASK_REMOVE",t[t.NONE=5]="NONE",t))(N2||{});function tv(t,e){return e.alphaMode==="no-premultiply-alpha"&&I2[t]||t}const O2=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
64
+ `);function F2(t){let e="";for(let s=0;s<t;++s)s>0&&(e+=`
65
+ else `),s<t-1&&(e+=`if(test == ${s}.0){}`);return e}function $2(t,e){if(t===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const s=e.createShader(e.FRAGMENT_SHADER);try{for(;;){const r=O2.replace(/%forloop%/gi,F2(t));if(e.shaderSource(s,r),e.compileShader(s),!e.getShaderParameter(s,e.COMPILE_STATUS))t=t/2|0;else break}}finally{e.deleteShader(s)}return t}let on=null;function H2(){var e;if(on)return on;const t=n0();return on=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),on=$2(on,t),(e=t.getExtension("WEBGL_lose_context"))==null||e.loseContext(),on}class U2{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let e=0;e<this.count;e++){const s=this.textures[e];this.textures[e]=null,this.ids[s.uid]=null}this.count=0}}class W2{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new U2,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null,this.elements=null}}const Lo=[];let ic=0;Sc.register({clear:()=>{if(Lo.length>0)for(const t of Lo)t&&t.destroy();Lo.length=0,ic=0}});function sv(){return ic>0?Lo[--ic]:new W2}function rv(t){t.elements=null,Lo[ic++]=t}let xo=0;const R0=class D0{constructor(e){this.uid=rt("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],e={...D0.defaultOptions,...e},e.maxTextures||(je("v8.8.0","maxTextures is a required option for Batcher now, please pass it in the options"),e.maxTextures=H2());const{maxTextures:s,attributesInitialSize:r,indicesInitialSize:i}=e;this.attributeBuffer=new J_(r*4),this.indexBuffer=new Uint16Array(i),this.maxTextures=s}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let e=0;e<this.batchIndex;e++)rv(this.batches[e]);this.batchIndex=0,this._batchIndexStart=0,this._batchIndexSize=0,this.dirty=!0}add(e){this._elements[this.elementSize++]=e,e._indexStart=this.indexSize,e._attributeStart=this.attributeSize,e._batcher=this,this.indexSize+=e.indexSize,this.attributeSize+=e.attributeSize*this.vertexSize}checkAndUpdateTexture(e,s){const r=e._batch.textures.ids[s._source.uid];return!r&&r!==0?!1:(e._textureId=r,e.texture=s,!0)}updateElement(e){this.dirty=!0;const s=this.attributeBuffer;e.packAsQuad?this.packQuadAttributes(e,s.float32View,s.uint32View,e._attributeStart,e._textureId):this.packAttributes(e,s.float32View,s.uint32View,e._attributeStart,e._textureId)}break(e){const s=this._elements;if(!s[this.elementStart])return;let r=sv(),i=r.textures;i.clear();const a=s[this.elementStart];let c=tv(a.blendMode,a.texture._source),o=a.topology;this.attributeSize*4>this.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);const h=this.attributeBuffer.float32View,u=this.attributeBuffer.uint32View,f=this.indexBuffer;let d=this._batchIndexSize,g=this._batchIndexStart,_="startBatch",k=[];const S=this.maxTextures;for(let m=this.elementStart;m<this.elementSize;++m){const x=s[m];s[m]=null;const b=x.texture._source,C=tv(x.blendMode,b),E=c!==C||o!==x.topology;if(b._batchTick===xo&&!E){x._textureId=b._textureBindLocation,d+=x.indexSize,x.packAsQuad?(this.packQuadAttributes(x,h,u,x._attributeStart,x._textureId),this.packQuadIndex(f,x._indexStart,x._attributeStart/this.vertexSize)):(this.packAttributes(x,h,u,x._attributeStart,x._textureId),this.packIndex(x,f,x._indexStart,x._attributeStart/this.vertexSize)),x._batch=r,k.push(x);continue}b._batchTick=xo,(i.count>=S||E)&&(this._finishBatch(r,g,d-g,i,c,o,e,_,k),_="renderBatch",g=d,c=C,o=x.topology,r=sv(),i=r.textures,i.clear(),k=[],++xo),x._textureId=b._textureBindLocation=i.count,i.ids[b.uid]=i.count,i.textures[i.count++]=b,x._batch=r,k.push(x),d+=x.indexSize,x.packAsQuad?(this.packQuadAttributes(x,h,u,x._attributeStart,x._textureId),this.packQuadIndex(f,x._indexStart,x._attributeStart/this.vertexSize)):(this.packAttributes(x,h,u,x._attributeStart,x._textureId),this.packIndex(x,f,x._indexStart,x._attributeStart/this.vertexSize))}i.count>0&&(this._finishBatch(r,g,d-g,i,c,o,e,_,k),g=d,++xo),this.elementStart=this.elementSize,this._batchIndexStart=g,this._batchIndexSize=d}_finishBatch(e,s,r,i,a,c,o,h,u){e.gpuBindGroup=null,e.bindGroup=null,e.action=h,e.batcher=this,e.textures=i,e.blendMode=a,e.topology=c,e.start=s,e.size=r,e.elements=u,++xo,this.batches[this.batchIndex++]=e,o.add(e)}finish(e){this.break(e)}ensureAttributeBuffer(e){e*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(e*4)}ensureIndexBuffer(e){e<=this.indexBuffer.length||this._resizeIndexBuffer(e)}_resizeAttributeBuffer(e){const s=Math.max(e,this.attributeBuffer.size*2),r=new J_(s);ev(this.attributeBuffer.rawBinaryData,r.rawBinaryData),this.attributeBuffer=r}_resizeIndexBuffer(e){const s=this.indexBuffer;let r=Math.max(e,s.length*1.5);r+=r%2;const i=r>65535?new Uint32Array(r):new Uint16Array(r);if(i.BYTES_PER_ELEMENT!==s.BYTES_PER_ELEMENT)for(let a=0;a<s.length;a++)i[a]=s[a];else ev(s.buffer,i.buffer);this.indexBuffer=i}packQuadIndex(e,s,r){e[s]=r+0,e[s+1]=r+1,e[s+2]=r+2,e[s+3]=r+0,e[s+4]=r+2,e[s+5]=r+3}packIndex(e,s,r,i){const a=e.indices,c=e.indexSize,o=e.indexOffset,h=e.attributeOffset;for(let u=0;u<c;u++)s[r++]=i+a[u+o]-h}destroy(e={}){var s;if(this.batches!==null){for(let r=0;r<this.batchIndex;r++)rv(this.batches[r]);this.batches=null,this.geometry.destroy(!0),this.geometry=null,e.shader&&((s=this.shader)==null||s.destroy(),this.shader=null);for(let r=0;r<this._elements.length;r++)this._elements[r]&&(this._elements[r]._batch=null);this._elements=null,this.indexBuffer=null,this.attributeBuffer.destroy(),this.attributeBuffer=null}}};R0.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};let z2=R0;var es=(t=>(t[t.MAP_READ=1]="MAP_READ",t[t.MAP_WRITE=2]="MAP_WRITE",t[t.COPY_SRC=4]="COPY_SRC",t[t.COPY_DST=8]="COPY_DST",t[t.INDEX=16]="INDEX",t[t.VERTEX=32]="VERTEX",t[t.UNIFORM=64]="UNIFORM",t[t.STORAGE=128]="STORAGE",t[t.INDIRECT=256]="INDIRECT",t[t.QUERY_RESOLVE=512]="QUERY_RESOLVE",t[t.STATIC=1024]="STATIC",t))(es||{});class Vo extends Zs{constructor(e){let{data:s,size:r}=e;const{usage:i,label:a,shrinkToFit:c}=e;super(),this._gpuData=Object.create(null),this._gcLastUsed=-1,this.autoGarbageCollect=!0,this.uid=rt("buffer"),this._resourceType="buffer",this._resourceId=rt("resource"),this._updateID=1,this._updateOffset=0,this._dataInt32=null,this.shrinkToFit=!0,this.destroyed=!1,s instanceof Array&&(s=new Float32Array(s)),this._data=s,r??(r=s==null?void 0:s.byteLength);const o=!!s;this.descriptor={size:r,usage:i,mappedAtCreation:o,label:a},this.shrinkToFit=c??!0}get data(){return this._data}set data(e){this.setDataWithSize(e,e.length,!0)}get dataInt32(){return this._dataInt32||(this._dataInt32=new Int32Array(this.data.buffer)),this._dataInt32}get static(){return!!(this.descriptor.usage&es.STATIC)}set static(e){e?this.descriptor.usage|=es.STATIC:this.descriptor.usage&=~es.STATIC}setDataWithSize(e,s,r){if(this._updateID++,this._updateSize=s*e.BYTES_PER_ELEMENT,this._updateOffset=0,this._data===e){r&&this.emit("update",this);return}const i=this._data;if(this._data=e,this._dataInt32=null,!i||i.length!==e.length){!this.shrinkToFit&&i&&e.byteLength<i.byteLength?r&&this.emit("update",this):(this.descriptor.size=e.byteLength,this._resourceId=rt("resource"),this.emit("change",this));return}r&&this.emit("update",this)}update(e,s){this._updateSize=e??this._updateSize,this._updateOffset=s||0,this._updateID++,this.emit("update",this)}unload(){var e;this.emit("unload",this);for(const s in this._gpuData)(e=this._gpuData[s])==null||e.destroy();this._gpuData=Object.create(null),this.destroyed||(this._resourceId=rt("resource"),this.emit("change",this))}destroy(){this.destroyed=!0,this.unload(),this.emit("destroy",this),this.emit("change",this),this._data=null,this.descriptor=null,this.removeAllListeners()}}function L0(t,e){if(!(t instanceof Vo)){let s=e?es.INDEX:es.VERTEX;t instanceof Array&&(e?(t=new Uint32Array(t),s=es.INDEX|es.COPY_DST):(t=new Float32Array(t),s=es.VERTEX|es.COPY_DST)),t=new Vo({data:t,label:e?"index-mesh-buffer":"vertex-mesh-buffer",usage:s})}return t}function V2(t,e,s){const r=t.getAttribute(e);if(!r)return s.minX=0,s.minY=0,s.maxX=0,s.maxY=0,s;const i=r.buffer.data;let a=1/0,c=1/0,o=-1/0,h=-1/0;const u=i.BYTES_PER_ELEMENT,f=(r.offset||0)/u,d=(r.stride||8)/u;for(let g=f;g<i.length;g+=d){const _=i[g],k=i[g+1];_>o&&(o=_),k>h&&(h=k),_<a&&(a=_),k<c&&(c=k)}return s.minX=a,s.minY=c,s.maxX=o,s.maxY=h,s}function G2(t){return(t instanceof Vo||Array.isArray(t)||t.BYTES_PER_ELEMENT)&&(t={buffer:t}),t.buffer=L0(t.buffer,!1),t}class q2 extends Zs{constructor(e={}){super(),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=rt("geometry"),this._layoutKey=0,this.instanceCount=1,this.indexCount=0,this._bounds=new Ns,this._boundsDirty=!0,this._vertexCount=0,this._vertexCountDirty=!0;const{attributes:s,indexBuffer:r,topology:i}=e;if(this.buffers=[],this.attributes={},s)for(const a in s)this.addAttribute(a,s[a]);this.instanceCount=e.instanceCount??1,this.indexCount=e.indexCount??0,r&&this.addIndex(r),this.topology=i||"triangle-list"}onBufferUpdate(){this._boundsDirty=!0,this._vertexCountDirty=!0,this.emit("update",this)}getAttribute(e){return this.attributes[e]}getIndex(){return this.indexBuffer}getBuffer(e){return this.getAttribute(e).buffer}get vertexCount(){if(!this._vertexCountDirty)return this._vertexCount;this._vertexCountDirty=!1;const e=this.attributes;for(const s in e){const r=e[s];if(r.instance)continue;const i=r.buffer;return this._vertexCount=i.data.length/(r.stride/4||r.size),this._vertexCount}return this._vertexCount=0,0}getSize(){return je("8.20.0","Geometry.getSize is deprecated, please use Geometry.vertexCount instead."),this.vertexCount}addAttribute(e,s){const r=G2(s);this.buffers.indexOf(r.buffer)===-1&&(this.buffers.push(r.buffer),r.buffer.on("update",this.onBufferUpdate,this),r.buffer.on("change",this.onBufferUpdate,this)),this.attributes[e]=r,this._vertexCountDirty=!0}addIndex(e){this.indexBuffer=L0(e,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,V2(this,"aPosition",this._bounds)):this._bounds}unload(){var e;this.emit("unload",this);for(const s in this._gpuData)(e=this._gpuData[s])==null||e.destroy();this._gpuData=Object.create(null)}destroy(e=!1){this.emit("destroy",this);for(const s of this.buffers)s.off("update",this.onBufferUpdate,this),s.off("change",this.onBufferUpdate,this),e&&s.destroy();this.unload(),this.removeAllListeners(),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}const K2=new Float32Array(1),Y2=new Uint32Array(1);class X2 extends q2{constructor(){const s=new Vo({data:K2,label:"attribute-batch-buffer",usage:es.VERTEX|es.COPY_DST,shrinkToFit:!1}),r=new Vo({data:Y2,label:"index-batch-buffer",usage:es.INDEX|es.COPY_DST,shrinkToFit:!1}),i=24;super({attributes:{aPosition:{buffer:s,format:"float32x2",stride:i,offset:0},aUV:{buffer:s,format:"float32x2",stride:i,offset:8},aColor:{buffer:s,format:"unorm8x4",stride:i,offset:16},aTextureIdAndRound:{buffer:s,format:"uint16x2",stride:i,offset:20}},indexBuffer:r})}}function iv(t,e,s){if(t)for(const r in t){const i=r.toLocaleLowerCase(),a=e[i];if(a){let c=t[r];r==="header"&&(c=c.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),s&&a.push(`//----${s}----//`),a.push(c)}else Ht(`${r} placement hook does not exist in shader`)}}const Q2=/\{\{(.*?)\}\}/g;function nv(t){var r;const e={};return(((r=t.match(Q2))==null?void 0:r.map(i=>i.replace(/[{()}]/g,"")))??[]).forEach(i=>{e[i]=[]}),e}function ov(t,e){let s;const r=/@in\s+([^;]+);/g;for(;(s=r.exec(t))!==null;)e.push(s[1])}function av(t,e,s=!1){const r=[];ov(e,r),t.forEach(o=>{o.header&&ov(o.header,r)});const i=r;s&&i.sort();const a=i.map((o,h)=>` @location(${h}) ${o},`).join(`
66
+ `);let c=e.replace(/@in\s+[^;]+;\s*/g,"");return c=c.replace("{{in}}",`
67
+ ${a}
68
+ `),c}function lv(t,e){let s;const r=/@out\s+([^;]+);/g;for(;(s=r.exec(t))!==null;)e.push(s[1])}function Z2(t){const s=/\b(\w+)\s*:/g.exec(t);return s?s[1]:""}function J2(t){const e=/@.*?\s+/g;return t.replace(e,"")}function eE(t,e){const s=[];lv(e,s),t.forEach(h=>{h.header&&lv(h.header,s)});let r=0;const i=s.sort().map(h=>h.indexOf("builtin")>-1?h:`@location(${r++}) ${h}`).join(`,
69
+ `),a=s.sort().map(h=>` var ${J2(h)};`).join(`
70
+ `),c=`return VSOutput(
71
+ ${s.sort().map(h=>` ${Z2(h)}`).join(`,
72
+ `)});`;let o=e.replace(/@out\s+[^;]+;\s*/g,"");return o=o.replace("{{struct}}",`
73
+ ${i}
74
+ `),o=o.replace("{{start}}",`
75
+ ${a}
76
+ `),o=o.replace("{{return}}",`
77
+ ${c}
78
+ `),o}function cv(t,e){let s=t;for(const r in e){const i=e[r];i.join(`
79
+ `).length?s=s.replace(`{{${r}}}`,`//-----${r} START-----//
80
+ ${i.join(`
81
+ `)}
82
+ //----${r} FINISH----//`):s=s.replace(`{{${r}}}`,"")}return s}const $r=Object.create(null),Ju=new Map;let tE=0;function sE({template:t,bits:e}){const s=B0(t,e);if($r[s])return $r[s];const{vertex:r,fragment:i}=iE(t,e);return $r[s]=j0(r,i,e),$r[s]}function rE({template:t,bits:e}){const s=B0(t,e);return $r[s]||($r[s]=j0(t.vertex,t.fragment,e)),$r[s]}function iE(t,e){const s=e.map(c=>c.vertex).filter(c=>!!c),r=e.map(c=>c.fragment).filter(c=>!!c);let i=av(s,t.vertex,!0);i=eE(s,i);const a=av(r,t.fragment,!0);return{vertex:i,fragment:a}}function B0(t,e){return e.map(s=>(Ju.has(s)||Ju.set(s,tE++),Ju.get(s))).sort((s,r)=>s-r).join("-")+t.vertex+t.fragment}function j0(t,e,s){const r=nv(t),i=nv(e);return s.forEach(a=>{iv(a.vertex,r,a.name),iv(a.fragment,i,a.name)}),{vertex:cv(t,r),fragment:cv(e,i)}}const nE=`
83
+ @in aPosition: vec2<f32>;
84
+ @in aUV: vec2<f32>;
85
+
86
+ @out @builtin(position) vPosition: vec4<f32>;
87
+ @out vUV : vec2<f32>;
88
+ @out vColor : vec4<f32>;
89
+
90
+ {{header}}
91
+
92
+ struct VSOutput {
93
+ {{struct}}
94
+ };
95
+
96
+ @vertex
97
+ fn main( {{in}} ) -> VSOutput {
98
+
99
+ var worldTransformMatrix = globalUniforms.uWorldTransformMatrix;
100
+ var modelMatrix = mat3x3<f32>(
101
+ 1.0, 0.0, 0.0,
102
+ 0.0, 1.0, 0.0,
103
+ 0.0, 0.0, 1.0
104
+ );
105
+ var position = aPosition;
106
+ var uv = aUV;
107
+
108
+ {{start}}
109
+
110
+ vColor = vec4<f32>(1., 1., 1., 1.);
111
+
112
+ {{main}}
113
+
114
+ vUV = uv;
115
+
116
+ var modelViewProjectionMatrix = globalUniforms.uProjectionMatrix * worldTransformMatrix * modelMatrix;
117
+
118
+ vPosition = vec4<f32>((modelViewProjectionMatrix * vec3<f32>(position, 1.0)).xy, 0.0, 1.0);
119
+
120
+ vColor *= globalUniforms.uWorldColorAlpha;
121
+
122
+ {{end}}
123
+
124
+ {{return}}
125
+ };
126
+ `,oE=`
127
+ @in vUV : vec2<f32>;
128
+ @in vColor : vec4<f32>;
129
+
130
+ {{header}}
131
+
132
+ @fragment
133
+ fn main(
134
+ {{in}}
135
+ ) -> @location(0) vec4<f32> {
136
+
137
+ {{start}}
138
+
139
+ var outColor:vec4<f32>;
140
+
141
+ {{main}}
142
+
143
+ var finalColor:vec4<f32> = outColor * vColor;
144
+
145
+ {{end}}
146
+
147
+ return finalColor;
148
+ };
149
+ `,aE=`
150
+ in vec2 aPosition;
151
+ in vec2 aUV;
152
+
153
+ out vec4 vColor;
154
+ out vec2 vUV;
155
+
156
+ {{header}}
157
+
158
+ void main(void){
159
+
160
+ mat3 worldTransformMatrix = uWorldTransformMatrix;
161
+ mat3 modelMatrix = mat3(
162
+ 1.0, 0.0, 0.0,
163
+ 0.0, 1.0, 0.0,
164
+ 0.0, 0.0, 1.0
165
+ );
166
+ vec2 position = aPosition;
167
+ vec2 uv = aUV;
168
+
169
+ {{start}}
170
+
171
+ vColor = vec4(1.);
172
+
173
+ {{main}}
174
+
175
+ vUV = uv;
176
+
177
+ mat3 modelViewProjectionMatrix = uProjectionMatrix * worldTransformMatrix * modelMatrix;
178
+
179
+ gl_Position = vec4((modelViewProjectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
180
+
181
+ vColor *= uWorldColorAlpha;
182
+
183
+ {{end}}
184
+ }
185
+ `,lE=`
186
+
187
+ in vec4 vColor;
188
+ in vec2 vUV;
189
+
190
+ out vec4 finalColor;
191
+
192
+ {{header}}
193
+
194
+ void main(void) {
195
+
196
+ {{start}}
197
+
198
+ vec4 outColor;
199
+
200
+ {{main}}
201
+
202
+ finalColor = outColor * vColor;
203
+
204
+ {{end}}
205
+ }
206
+ `,cE={name:"global-uniforms-bit",vertex:{header:`
207
+ struct GlobalUniforms {
208
+ uProjectionMatrix:mat3x3<f32>,
209
+ uWorldTransformMatrix:mat3x3<f32>,
210
+ uWorldColorAlpha: vec4<f32>,
211
+ uResolution: vec2<f32>,
212
+ }
213
+
214
+ @group(0) @binding(0) var<uniform> globalUniforms : GlobalUniforms;
215
+ `}},hE={name:"global-uniforms-bit",vertex:{header:`
216
+ uniform mat3 uProjectionMatrix;
217
+ uniform mat3 uWorldTransformMatrix;
218
+ uniform vec4 uWorldColorAlpha;
219
+ uniform vec2 uResolution;
220
+ `}};function uE({bits:t,name:e}){const s=sE({template:{fragment:oE,vertex:nE},bits:[cE,...t]});return Ec.from({name:e,vertex:{source:s.vertex,entryPoint:"main"},fragment:{source:s.fragment,entryPoint:"main"}})}function dE({bits:t,name:e}){return new a0({name:e,...rE({template:{vertex:aE,fragment:lE},bits:[hE,...t]})})}const fE={name:"color-bit",vertex:{header:`
221
+ @in aColor: vec4<f32>;
222
+ `,main:`
223
+ vColor *= vec4<f32>(aColor.rgb * aColor.a, aColor.a);
224
+ `}},pE={name:"color-bit",vertex:{header:`
225
+ in vec4 aColor;
226
+ `,main:`
227
+ vColor *= vec4(aColor.rgb * aColor.a, aColor.a);
228
+ `}},ed={};function mE(t){const e=[];if(t===1)e.push("@group(1) @binding(0) var textureSource1: texture_2d<f32>;"),e.push("@group(1) @binding(1) var textureSampler1: sampler;");else{let s=0;for(let r=0;r<t;r++)e.push(`@group(1) @binding(${s++}) var textureSource${r+1}: texture_2d<f32>;`),e.push(`@group(1) @binding(${s++}) var textureSampler${r+1}: sampler;`)}return e.join(`
229
+ `)}function gE(t){const e=[];if(t===1)e.push("outColor = textureSampleGrad(textureSource1, textureSampler1, vUV, uvDx, uvDy);");else{e.push("switch vTextureId {");for(let s=0;s<t;s++)s===t-1?e.push(" default:{"):e.push(` case ${s}:{`),e.push(` outColor = textureSampleGrad(textureSource${s+1}, textureSampler${s+1}, vUV, uvDx, uvDy);`),e.push(" break;}");e.push("}")}return e.join(`
230
+ `)}function _E(t){return ed[t]||(ed[t]={name:"texture-batch-bit",vertex:{header:`
231
+ @in aTextureIdAndRound: vec2<u32>;
232
+ @out @interpolate(flat) vTextureId : u32;
233
+ `,main:`
234
+ vTextureId = aTextureIdAndRound.y;
235
+ `,end:`
236
+ if(aTextureIdAndRound.x == 1)
237
+ {
238
+ vPosition = vec4<f32>(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
239
+ }
240
+ `},fragment:{header:`
241
+ @in @interpolate(flat) vTextureId: u32;
242
+
243
+ ${mE(t)}
244
+ `,main:`
245
+ var uvDx = dpdx(vUV);
246
+ var uvDy = dpdy(vUV);
247
+
248
+ ${gE(t)}
249
+ `}}),ed[t]}const td={};function vE(t){const e=[];for(let s=0;s<t;s++)s>0&&e.push("else"),s<t-1&&e.push(`if(vTextureId < ${s}.5)`),e.push("{"),e.push(` outColor = texture(uTextures[${s}], vUV);`),e.push("}");return e.join(`
250
+ `)}function xE(t){return td[t]||(td[t]={name:"texture-batch-bit",vertex:{header:`
251
+ in vec2 aTextureIdAndRound;
252
+ out float vTextureId;
253
+
254
+ `,main:`
255
+ vTextureId = aTextureIdAndRound.y;
256
+ `,end:`
257
+ if(aTextureIdAndRound.x == 1.)
258
+ {
259
+ gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
260
+ }
261
+ `},fragment:{header:`
262
+ in float vTextureId;
263
+
264
+ uniform sampler2D uTextures[${t}];
265
+
266
+ `,main:`
267
+
268
+ ${vE(t)}
269
+ `}}),td[t]}const yE={name:"round-pixels-bit",vertex:{header:`
270
+ fn roundPixels(position: vec2<f32>, targetSize: vec2<f32>) -> vec2<f32>
271
+ {
272
+ return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
273
+ }
274
+ `}},bE={name:"round-pixels-bit",vertex:{header:`
275
+ vec2 roundPixels(vec2 position, vec2 targetSize)
276
+ {
277
+ return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
278
+ }
279
+ `}},hv={};function wE(t){let e=hv[t];if(e)return e;const s=new Int32Array(t);for(let r=0;r<t;r++)s[r]=r;return e=hv[t]=new u0({uTextures:{value:s,type:"i32",size:t}},{isStatic:!0}),e}class uv extends kf{constructor(e){const s=dE({name:"batch",bits:[pE,xE(e),bE]}),r=uE({name:"batch",bits:[fE,_E(e),yE]});super({glProgram:s,gpuProgram:r,resources:{batchSamplers:wE(e)}}),this.maxTextures=e}}let yo=null;const I0=class N0 extends z2{constructor(e){super(e),this.geometry=new X2,this.name=N0.extension.name,this.vertexSize=6,yo??(yo=new uv(e.maxTextures)),this.shader=yo}packAttributes(e,s,r,i,a){const c=a<<16|e.roundPixels&65535,o=e.transform,h=o.a,u=o.b,f=o.c,d=o.d,g=o.tx,_=o.ty,{positions:k,uvs:S}=e,m=e.color,x=e.attributeOffset,v=x+e.attributeSize;for(let b=x;b<v;b++){const C=b*2,E=k[C],P=k[C+1];s[i++]=h*E+f*P+g,s[i++]=d*P+u*E+_,s[i++]=S[C],s[i++]=S[C+1],r[i++]=m,r[i++]=c}}packQuadAttributes(e,s,r,i,a){const c=e.texture,o=e.transform,h=o.a,u=o.b,f=o.c,d=o.d,g=o.tx,_=o.ty,k=e.bounds,S=k.maxX,m=k.minX,x=k.maxY,v=k.minY,b=c.uvs,C=e.color,E=a<<16|e.roundPixels&65535;s[i+0]=h*m+f*v+g,s[i+1]=d*v+u*m+_,s[i+2]=b.x0,s[i+3]=b.y0,r[i+4]=C,r[i+5]=E,s[i+6]=h*S+f*v+g,s[i+7]=d*v+u*S+_,s[i+8]=b.x1,s[i+9]=b.y1,r[i+10]=C,r[i+11]=E,s[i+12]=h*S+f*x+g,s[i+13]=d*x+u*S+_,s[i+14]=b.x2,s[i+15]=b.y2,r[i+16]=C,r[i+17]=E,s[i+18]=h*m+f*x+g,s[i+19]=d*x+u*m+_,s[i+20]=b.x3,s[i+21]=b.y3,r[i+22]=C,r[i+23]=E}_updateMaxTextures(e){this.shader.maxTextures!==e&&(yo=new uv(e),this.shader=yo)}destroy(){this.shader=null,super.destroy()}};I0.extension={type:[Fe.Batcher],name:"default"};let SE=I0;class Pc{constructor(e){this.items=Object.create(null);const{renderer:s,type:r,onUnload:i,priority:a,name:c}=e;this._renderer=s,s.gc.addResourceHash(this,"items",r,a??0),this._onUnload=i,this.name=c}add(e){return this.items[e.uid]?!1:(this.items[e.uid]=e,e.once("unload",this.remove,this),e._gcLastUsed=this._renderer.gc.now,!0)}remove(e,...s){var i;if(!this.items[e.uid])return;const r=e._gpuData[this._renderer.uid];r&&((i=this._onUnload)==null||i.call(this,e,...s),e.off("unload",this.remove,this),r.destroy(),e._gpuData[this._renderer.uid]=null,this.items[e.uid]=null)}removeAll(...e){Object.values(this.items).forEach(s=>s&&this.remove(s,...e))}destroy(...e){this.removeAll(...e),this.items=Object.create(null),this._renderer=null,this._onUnload=null}}function CE(t,e,s,r,i,a,c,o=null){let h=0;s*=e,i*=a;const u=o.a,f=o.b,d=o.c,g=o.d,_=o.tx,k=o.ty;for(;h<c;){const S=t[s],m=t[s+1];r[i]=u*S+d*m+_,r[i+1]=f*S+g*m+k,i+=a,s+=e,h++}}function kE(t,e,s,r){let i=0;for(e*=s;i<r;)t[e]=0,t[e+1]=0,e+=s,i++}function O0(t,e,s,r,i){const a=e.a,c=e.b,o=e.c,h=e.d,u=e.tx,f=e.ty;s||(s=0),r||(r=2),i||(i=t.length/r-s);let d=s*r;for(let g=0;g<i;g++){const _=t[d],k=t[d+1];t[d]=a*_+o*k+u,t[d+1]=c*_+h*k+f,d+=r}}const EE=new Ne;class Af{constructor(){this.packAsQuad=!1,this.batcherName="default",this.topology="triangle-list",this.applyTransform=!0,this.roundPixels=0,this._batcher=null,this._batch=null}get uvs(){return this.geometryData.uvs}get positions(){return this.geometryData.vertices}get indices(){return this.geometryData.indices}get blendMode(){return this.renderable&&this.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){const e=this.baseColor,s=e>>16|e&65280|(e&255)<<16,r=this.renderable;return r?Fy(s,r.groupColor)+(this.alpha*r.groupAlpha*255<<24):s+(this.alpha*255<<24)}get transform(){var e;return((e=this.renderable)==null?void 0:e.groupTransform)||EE}copyTo(e){e.indexOffset=this.indexOffset,e.indexSize=this.indexSize,e.attributeOffset=this.attributeOffset,e.attributeSize=this.attributeSize,e.baseColor=this.baseColor,e.alpha=this.alpha,e.texture=this.texture,e.geometryData=this.geometryData,e.topology=this.topology}reset(){this.applyTransform=!0,this.renderable=null,this.topology="triangle-list"}destroy(){this.renderable=null,this.texture=null,this.geometryData=null,this._batcher=null,this._batch=null}}const Go={extension:{type:Fe.ShapeBuilder,name:"circle"},build(t,e){let s,r,i,a,c,o;if(t.type==="circle"){const C=t;if(c=o=C.radius,c<=0)return!1;s=C.x,r=C.y,i=a=0}else if(t.type==="ellipse"){const C=t;if(c=C.halfWidth,o=C.halfHeight,c<=0||o<=0)return!1;s=C.x,r=C.y,i=a=0}else{const C=t,E=C.width/2,P=C.height/2;s=C.x+E,r=C.y+P,c=o=Math.max(0,Math.min(C.radius,Math.min(E,P))),i=E-c,a=P-o}if(i<0||a<0)return!1;const h=Math.ceil(2.3*Math.sqrt(c+o)),u=h*8+(i?4:0)+(a?4:0);if(u===0)return!1;if(h===0)return e[0]=e[6]=s+i,e[1]=e[3]=r+a,e[2]=e[4]=s-i,e[5]=e[7]=r-a,!0;let f=0,d=h*4+(i?2:0)+2,g=d,_=u,k=i+c,S=a,m=s+k,x=s-k,v=r+S;if(e[f++]=m,e[f++]=v,e[--d]=v,e[--d]=x,a){const C=r-S;e[g++]=x,e[g++]=C,e[--_]=C,e[--_]=m}for(let C=1;C<h;C++){const E=Math.PI/2*(C/h),P=i+Math.cos(E)*c,T=a+Math.sin(E)*o,A=s+P,D=s-P,I=r+T,O=r-T;e[f++]=A,e[f++]=I,e[--d]=I,e[--d]=D,e[g++]=D,e[g++]=O,e[--_]=O,e[--_]=A}k=i,S=a+o,m=s+k,x=s-k,v=r+S;const b=r-S;return e[f++]=m,e[f++]=v,e[--_]=b,e[--_]=m,i&&(e[f++]=x,e[f++]=v,e[--_]=b,e[--_]=x),!0},triangulate(t,e,s,r,i,a){if(t.length===0)return;let c=0,o=0;for(let f=0;f<t.length;f+=2)c+=t[f],o+=t[f+1];c/=t.length/2,o/=t.length/2;let h=r;e[h*s]=c,e[h*s+1]=o;const u=h++;for(let f=0;f<t.length;f+=2)e[h*s]=t[f],e[h*s+1]=t[f+1],f>0&&(i[a++]=h,i[a++]=u,i[a++]=h-1),h++;i[a++]=u+1,i[a++]=u,i[a++]=h-1}},PE={...Go,extension:{...Go.extension,name:"ellipse"}},ME={...Go,extension:{...Go.extension,name:"roundedRectangle"}},F0=1e-4,dv=1e-4;function fv(t,e,s,r,i,a,c,o){const h=t-s*i,u=e-r*i,f=t+s*a,d=e+r*a;let g,_;c?(g=r,_=-s):(g=-r,_=s);const k=h+g,S=u+_,m=f+g,x=d+_;return o.push(k,S),o.push(m,x),2}function li(t,e,s,r,i,a,c,o){const h=s-t,u=r-e;let f=Math.atan2(h,u),d=Math.atan2(i-t,a-e);o&&f<d?f+=Math.PI*2:!o&&f>d&&(d+=Math.PI*2);let g=f;const _=d-f,k=Math.abs(_),S=Math.sqrt(h*h+u*u),m=(15*k*Math.sqrt(S)/Math.PI>>0)+1,x=_/m;if(g+=x,o){c.push(t,e),c.push(s,r);for(let v=1,b=g;v<m;v++,b+=x)c.push(t,e),c.push(t+Math.sin(b)*S,e+Math.cos(b)*S);c.push(t,e),c.push(i,a)}else{c.push(s,r),c.push(t,e);for(let v=1,b=g;v<m;v++,b+=x)c.push(t+Math.sin(b)*S,e+Math.cos(b)*S),c.push(t,e);c.push(i,a),c.push(t,e)}return m*2}function AE(t,e,s,r,i,a){const c=F0;if(t.length===0)return;const o=e;let h=o.alignment;if(e.alignment!==.5){let L=A0(t);h=(h-.5)*L+.5}const u=new Ft(t[0],t[1]),f=new Ft(t[t.length-2],t[t.length-1]),d=r,g=Math.abs(u.x-f.x)<c&&Math.abs(u.y-f.y)<c;if(d){t=t.slice(),g&&(t.pop(),t.pop(),f.set(t[t.length-2],t[t.length-1]));const L=(u.x+f.x)*.5,F=(f.y+u.y)*.5;t.unshift(L,F),t.push(L,F)}const _=i,k=t.length/2;let S=t.length;const m=_.length/2,x=o.width/2,v=x*x,b=o.miterLimit*o.miterLimit;let C=t[0],E=t[1],P=t[2],T=t[3],A=0,D=0,I=-(E-T),O=C-P,z=0,U=0,K=Math.sqrt(I*I+O*O);I/=K,O/=K,I*=x,O*=x;const ie=h,Q=(1-ie)*2,J=ie*2;d||(o.cap==="round"?S+=li(C-I*(Q-J)*.5,E-O*(Q-J)*.5,C-I*Q,E-O*Q,C+I*J,E+O*J,_,!0)+2:o.cap==="square"&&(S+=fv(C,E,I,O,Q,J,!0,_))),_.push(C-I*Q,E-O*Q),_.push(C+I*J,E+O*J);for(let L=1;L<k-1;++L){C=t[(L-1)*2],E=t[(L-1)*2+1],P=t[L*2],T=t[L*2+1],A=t[(L+1)*2],D=t[(L+1)*2+1],I=-(E-T),O=C-P,K=Math.sqrt(I*I+O*O),I/=K,O/=K,I*=x,O*=x,z=-(T-D),U=P-A,K=Math.sqrt(z*z+U*U),z/=K,U/=K,z*=x,U*=x;const F=P-C,B=E-T,$=P-A,Z=D-T,oe=F*$+B*Z,he=B*$-Z*F,ae=he<0;if(Math.abs(he)<.001*Math.abs(oe)){_.push(P-I*Q,T-O*Q),_.push(P+I*J,T+O*J),oe>=0&&(o.join==="round"?S+=li(P,T,P-I*Q,T-O*Q,P-z*Q,T-U*Q,_,!1)+4:S+=2,_.push(P-z*J,T-U*J),_.push(P+z*Q,T+U*Q));continue}const V=(-I+C)*(-O+T)-(-I+P)*(-O+E),N=(-z+A)*(-U+T)-(-z+P)*(-U+D),ne=(F*N-$*V)/he,se=(Z*V-B*N)/he,pe=(ne-P)*(ne-P)+(se-T)*(se-T),fe=P+(ne-P)*Q,Ae=T+(se-T)*Q,Oe=P-(ne-P)*J,$e=T-(se-T)*J,mt=Math.min(F*F+B*B,$*$+Z*Z),Pe=ae?Q:J,Os=mt+Pe*Pe*v;pe<=Os?o.join==="bevel"||pe/v>b?(ae?(_.push(fe,Ae),_.push(P+I*J,T+O*J),_.push(fe,Ae),_.push(P+z*J,T+U*J)):(_.push(P-I*Q,T-O*Q),_.push(Oe,$e),_.push(P-z*Q,T-U*Q),_.push(Oe,$e)),S+=2):o.join==="round"?ae?(_.push(fe,Ae),_.push(P+I*J,T+O*J),S+=li(P,T,P+I*J,T+O*J,P+z*J,T+U*J,_,!0)+4,_.push(fe,Ae),_.push(P+z*J,T+U*J)):(_.push(P-I*Q,T-O*Q),_.push(Oe,$e),S+=li(P,T,P-I*Q,T-O*Q,P-z*Q,T-U*Q,_,!1)+4,_.push(P-z*Q,T-U*Q),_.push(Oe,$e)):(_.push(fe,Ae),_.push(Oe,$e)):(_.push(P-I*Q,T-O*Q),_.push(P+I*J,T+O*J),o.join==="round"?ae?S+=li(P,T,P+I*J,T+O*J,P+z*J,T+U*J,_,!0)+2:S+=li(P,T,P-I*Q,T-O*Q,P-z*Q,T-U*Q,_,!1)+2:o.join==="miter"&&pe/v<=b&&(ae?(_.push(Oe,$e),_.push(Oe,$e)):(_.push(fe,Ae),_.push(fe,Ae)),S+=2),_.push(P-z*Q,T-U*Q),_.push(P+z*J,T+U*J),S+=2)}C=t[(k-2)*2],E=t[(k-2)*2+1],P=t[(k-1)*2],T=t[(k-1)*2+1],I=-(E-T),O=C-P,K=Math.sqrt(I*I+O*O),I/=K,O/=K,I*=x,O*=x,_.push(P-I*Q,T-O*Q),_.push(P+I*J,T+O*J),d||(o.cap==="round"?S+=li(P-I*(Q-J)*.5,T-O*(Q-J)*.5,P-I*Q,T-O*Q,P+I*J,T+O*J,_,!1)+2:o.cap==="square"&&(S+=fv(P,T,I,O,Q,J,!1,_)));const Y=dv*dv;for(let L=m;L<S+m-2;++L)C=_[L*2],E=_[L*2+1],P=_[(L+1)*2],T=_[(L+1)*2+1],A=_[(L+2)*2],D=_[(L+2)*2+1],!(Math.abs(C*(T-D)+P*(D-E)+A*(E-T))<Y)&&a.push(L,L+1,L+2)}function TE(t,e,s,r){const i=F0;if(t.length===0)return;const a=t[0],c=t[1],o=t[t.length-2],h=t[t.length-1],u=e||Math.abs(a-o)<i&&Math.abs(c-h)<i,f=s,d=t.length/2,g=f.length/2;for(let _=0;_<d;_++)f.push(t[_*2]),f.push(t[_*2+1]);for(let _=0;_<d-1;_++)r.push(g+_,g+_+1);u&&r.push(g+d-1,g)}function $0(t,e,s,r,i,a,c){const o=x2(t,e,2);if(!o)return;for(let u=0;u<o.length;u+=3)a[c++]=o[u]+i,a[c++]=o[u+1]+i,a[c++]=o[u+2]+i;let h=i*r;for(let u=0;u<t.length;u+=2)s[h]=t[u],s[h+1]=t[u+1],h+=r}const RE=[],DE={extension:{type:Fe.ShapeBuilder,name:"polygon"},build(t,e){for(let s=0;s<t.points.length;s++)e[s]=t.points[s];return!0},triangulate(t,e,s,r,i,a){$0(t,RE,e,s,r,i,a)}},LE={extension:{type:Fe.ShapeBuilder,name:"rectangle"},build(t,e){const s=t,r=s.x,i=s.y,a=s.width,c=s.height;return a>0&&c>0?(e[0]=r,e[1]=i,e[2]=r+a,e[3]=i,e[4]=r+a,e[5]=i+c,e[6]=r,e[7]=i+c,!0):!1},triangulate(t,e,s,r,i,a){let c=0;r*=s,e[r+c]=t[0],e[r+c+1]=t[1],c+=s,e[r+c]=t[2],e[r+c+1]=t[3],c+=s,e[r+c]=t[6],e[r+c+1]=t[7],c+=s,e[r+c]=t[4],e[r+c+1]=t[5],c+=s;const o=r/s;i[a++]=o,i[a++]=o+1,i[a++]=o+2,i[a++]=o+1,i[a++]=o+3,i[a++]=o+2}},BE={extension:{type:Fe.ShapeBuilder,name:"triangle"},build(t,e){return e[0]=t.x,e[1]=t.y,e[2]=t.x2,e[3]=t.y2,e[4]=t.x3,e[5]=t.y3,!0},triangulate(t,e,s,r,i,a){let c=0;r*=s,e[r+c]=t[0],e[r+c+1]=t[1],c+=s,e[r+c]=t[2],e[r+c+1]=t[3],c+=s,e[r+c]=t[4],e[r+c+1]=t[5];const o=r/s;i[a++]=o,i[a++]=o+1,i[a++]=o+2}},pv=[{offset:0,color:"white"},{offset:1,color:"black"}],Tf=class qd{constructor(...e){this.uid=rt("fillGradient"),this._tick=0,this.type="linear",this.colorStops=[];let s=jE(e);s={...s.type==="radial"?qd.defaultRadialOptions:qd.defaultLinearOptions,...Ay(s)},this._textureSize=s.textureSize,this._wrapMode=s.wrapMode,s.type==="radial"?(this.center=s.center,this.outerCenter=s.outerCenter??this.center,this.innerRadius=s.innerRadius,this.outerRadius=s.outerRadius,this.scale=s.scale,this.rotation=s.rotation):(this.start=s.start,this.end=s.end),this.textureSpace=s.textureSpace,this.type=s.type,s.colorStops.forEach(i=>{this.addColorStop(i.offset,i.color)})}addColorStop(e,s){return this.colorStops.push({offset:e,color:Ss.shared.setValue(s).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:e,y:s}=this.start,{x:r,y:i}=this.end,a=r-e,c=i-s;const o=a<0||c<0;if(this._wrapMode==="clamp-to-edge"){if(a<0){const m=e;e=r,r=m,a*=-1}if(c<0){const m=s;s=i,i=m,c*=-1}}const h=this.colorStops.length?this.colorStops:pv,u=this._textureSize,{canvas:f,context:d}=gv(u,1),g=o?d.createLinearGradient(this._textureSize,0,0,0):d.createLinearGradient(0,0,this._textureSize,0);mv(g,h),d.fillStyle=g,d.fillRect(0,0,u,1),this.texture=new Ve({source:new Jl({resource:f,addressMode:this._wrapMode})});const _=Math.sqrt(a*a+c*c),k=Math.atan2(c,a),S=new Ne;S.scale(_/u,1),S.rotate(k),S.translate(e,s),this.textureSpace==="local"&&S.scale(u,u),this.transform=S}buildGradient(){this.texture||this._tick++,this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;const e=this.colorStops.length?this.colorStops:pv,s=this._textureSize,{canvas:r,context:i}=gv(s,s),{x:a,y:c}=this.center,{x:o,y:h}=this.outerCenter,u=this.innerRadius,f=this.outerRadius,d=o-f,g=h-f,_=s/(f*2),k=(a-d)*_,S=(c-g)*_,m=i.createRadialGradient(k,S,u*_,(o-d)*_,(h-g)*_,f*_);mv(m,e),i.fillStyle=e[e.length-1].color,i.fillRect(0,0,s,s),i.fillStyle=m,i.translate(k,S),i.rotate(this.rotation),i.scale(1,this.scale),i.translate(-k,-S),i.fillRect(0,0,s,s),this.texture=new Ve({source:new Jl({resource:r,addressMode:this._wrapMode})});const x=new Ne;this.textureSpace==="local"?x.scale(2*f,2*f):x.scale(1/_,1/_),x.translate(d,g),this.transform=x}destroy(){var e;(e=this.texture)==null||e.destroy(!0),this.texture=null,this.transform=null,this.colorStops=[],this.start=null,this.end=null,this.center=null,this.outerCenter=null}get styleKey(){return`fill-gradient-${this.uid}-${this._tick}`}};Tf.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};Tf.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,rotation:0,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};let Jo=Tf;function mv(t,e){for(let s=0;s<e.length;s++){const r=e[s];t.addColorStop(r.offset,r.color)}}function gv(t,e){const s=Hr.get().createCanvas(t,e),r=s.getContext("2d");return{canvas:s,context:r}}function jE(t){let e=t[0]??{};return(typeof e=="number"||t[1])&&(je("8.5.2","use options object instead"),e={type:"linear",start:{x:t[0],y:t[1]},end:{x:t[2],y:t[3]},textureSpace:t[4],textureSize:t[5]??Jo.defaultLinearOptions.textureSize}),e}const IE=new Ne,NE=new Pt,OE=new Ne;function FE(t,e,s,r){const i=e.matrix?t.copyFrom(e.matrix).invert():t.identity();if(e.textureSpace==="local"){const c=s.getBounds(NE);e.width&&c.pad(e.width);const{x:o,y:h}=c,u=1/c.width,f=1/c.height,d=-o*u,g=-h*f,_=i.a,k=i.b,S=i.c,m=i.d;i.a*=u,i.b*=u,i.c*=f,i.d*=f,i.tx=d*_+g*S+i.tx,i.ty=d*k+g*m+i.ty}else if(e.texture.rotate){const{uvs:c,orig:o}=e.texture;i.scale(1/o.width,1/o.height),i.prepend(OE.set(c.x1-c.x0,c.y1-c.y0,c.x3-c.x0,c.y3-c.y0,c.x0,c.y0))}else i.translate(e.texture.frame.x,e.texture.frame.y),i.scale(1/e.texture.source.width,1/e.texture.source.height);const a=e.texture.source.style;return!(e.fill instanceof Jo)&&a.addressMode==="clamp-to-edge"&&(a.addressMode="repeat",a.update()),r&&i.append(IE.copyFrom(r).invert()),i}const Mc={};Mt.handleByMap(Fe.ShapeBuilder,Mc);Mt.add(LE,DE,BE,Go,PE,ME);const $E=new Pt,HE=new Ne;function UE(t,e){const{geometryData:s,batches:r}=e;r.length=0,s.indices.length=0,s.vertices.length=0,s.uvs.length=0;for(let i=0;i<t.instructions.length;i++){const a=t.instructions[i];if(a.action==="texture")WE(a.data,r,s);else if(a.action==="fill"||a.action==="stroke"){const c=a.action==="stroke",o=a.data.path.shapePath,h=a.data.style,u=a.data.hole;c&&u&&_v(u.shapePath,h,!0,r,s),u&&(o.shapePrimitives[o.shapePrimitives.length-1].holes=u.shapePath.shapePrimitives),_v(o,h,c,r,s)}}}function WE(t,e,s){const r=[],i=Mc.rectangle,a=$E;a.x=t.dx,a.y=t.dy,a.width=t.dw,a.height=t.dh;const c=t.transform;if(!i.build(a,r))return;const{vertices:o,uvs:h,indices:u}=s,f=u.length,d=o.length/2;c&&O0(r,c),i.triangulate(r,o,2,d,u,f);const g=t.image,_=g.uvs;h.push(_.x0,_.y0,_.x1,_.y1,_.x3,_.y3,_.x2,_.y2);const k=ts.get(Af);k.indexOffset=f,k.indexSize=u.length-f,k.attributeOffset=d,k.attributeSize=o.length/2-d,k.baseColor=t.style,k.alpha=t.alpha,k.texture=g,k.geometryData=s,e.push(k)}function _v(t,e,s,r,i){const{vertices:a,uvs:c,indices:o}=i;t.shapePrimitives.forEach(({shape:h,transform:u,holes:f})=>{const d=[],g=Mc[h.type];if(!g.build(h,d))return;const _=o.length,k=a.length/2;let S="triangle-list";if(u&&O0(d,u),s){const b=h.closePath??!0,C=e;C.pixelLine?(TE(d,b,a,o),S="line-list"):AE(d,C,!1,b,a,o)}else if(f){const b=[],C=d.slice();zE(f).forEach(P=>{b.push(C.length/2),C.push(...P)}),$0(C,b,a,2,k,o,_)}else g.triangulate(d,a,2,k,o,_);const m=c.length/2,x=e.texture;if(x!==Ve.WHITE){const b=FE(HE,e,h,u);CE(a,2,k,c,m,2,a.length/2-k,b)}else kE(c,m,2,a.length/2-k);const v=ts.get(Af);v.indexOffset=_,v.indexSize=o.length-_,v.attributeOffset=k,v.attributeSize=a.length/2-k,v.baseColor=e.color,v.alpha=e.alpha,v.texture=x,v.geometryData=i,v.topology=S,r.push(v)})}function zE(t){const e=[];for(let s=0;s<t.length;s++){const r=t[s].shape,i=[];Mc[r.type].build(r,i)&&e.push(i)}return e}class VE{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}reset(){this.batches&&this.batches.forEach(e=>{ts.return(e)}),this.graphicsData&&ts.return(this.graphicsData),this.isBatchable=!1,this.context=null,this.batches.length=0,this.geometryData.indices.length=0,this.geometryData.vertices.length=0,this.geometryData.uvs.length=0,this.graphicsData=null}destroy(){this.reset(),this.batches=null,this.geometryData=null}}class GE{constructor(){this.instructions=new Sf}init(e){const s=e.maxTextures;this.batcher?this.batcher._updateMaxTextures(s):this.batcher=new SE({maxTextures:s}),this.instructions.reset()}get geometry(){return je(SC,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}destroy(){this.batcher.destroy(),this.instructions.destroy(),this.batcher=null,this.instructions=null}}const Rf=class Kd{constructor(e){this._renderer=e,this._managedContexts=new Pc({renderer:e,type:"resource",name:"graphicsContext"})}init(e){Kd.defaultOptions.bezierSmoothness=(e==null?void 0:e.bezierSmoothness)??Kd.defaultOptions.bezierSmoothness}getContextRenderData(e){return e._gpuData[this._renderer.uid].graphicsData||this._initContextRenderData(e)}updateGpuContext(e){const s=!!e._gpuData[this._renderer.uid],r=e._gpuData[this._renderer.uid]||this._initContext(e);if(e.dirty||!s){s&&r.reset(),UE(e,r);const i=e.batchMode;e.customShader||i==="no-batch"?r.isBatchable=!1:i==="auto"?r.isBatchable=r.geometryData.vertices.length<400:r.isBatchable=!0,e.dirty=!1}return r}getGpuContext(e){return e._gpuData[this._renderer.uid]||this._initContext(e)}_initContextRenderData(e){const s=ts.get(GE,{maxTextures:this._renderer.limits.maxBatchableTextures}),r=e._gpuData[this._renderer.uid],{batches:i,geometryData:a}=r;r.graphicsData=s;const c=a.vertices.length,o=a.indices.length;for(let d=0;d<i.length;d++)i[d].applyTransform=!1;const h=s.batcher;h.ensureAttributeBuffer(c),h.ensureIndexBuffer(o),h.begin();for(let d=0;d<i.length;d++){const g=i[d];h.add(g)}h.finish(s.instructions);const u=h.geometry;u.indexBuffer.setDataWithSize(h.indexBuffer,h.indexSize,!0),u.buffers[0].setDataWithSize(h.attributeBuffer.float32View,h.attributeSize,!0);const f=h.batches;for(let d=0;d<h.batchIndex;d++){const g=f[d];g.bindGroup=B2(g.textures.textures,g.textures.count,this._renderer.limits.maxBatchableTextures)}return s}_initContext(e){const s=new VE;return s.context=e,e._gpuData[this._renderer.uid]=s,this._managedContexts.add(e),s}destroy(){this._managedContexts.destroy(),this._renderer=null}};Rf.extension={type:[Fe.WebGLSystem,Fe.WebGPUSystem],name:"graphicsContext"};Rf.defaultOptions={bezierSmoothness:.5};let Df=Rf;const qE=8,Tl=11920929e-14,KE=1;function H0(t,e,s,r,i,a,c,o,h,u){const d=Math.min(.99,Math.max(0,u??Df.defaultOptions.bezierSmoothness));let g=(KE-d)/1;return g*=g,YE(e,s,r,i,a,c,o,h,t,g),t}function YE(t,e,s,r,i,a,c,o,h,u){Yd(t,e,s,r,i,a,c,o,h,u,0),h.push(c,o)}function Yd(t,e,s,r,i,a,c,o,h,u,f){if(f>qE)return;const d=(t+s)/2,g=(e+r)/2,_=(s+i)/2,k=(r+a)/2,S=(i+c)/2,m=(a+o)/2,x=(d+_)/2,v=(g+k)/2,b=(_+S)/2,C=(k+m)/2,E=(x+b)/2,P=(v+C)/2;if(f>0){let T=c-t,A=o-e;const D=Math.abs((s-c)*A-(r-o)*T),I=Math.abs((i-c)*A-(a-o)*T);if(D>Tl&&I>Tl){if((D+I)*(D+I)<=u*(T*T+A*A)){h.push(E,P);return}}else if(D>Tl){if(D*D<=u*(T*T+A*A)){h.push(E,P);return}}else if(I>Tl){if(I*I<=u*(T*T+A*A)){h.push(E,P);return}}else if(T=E-(t+c)/2,A=P-(e+o)/2,T*T+A*A<=u){h.push(E,P);return}}Yd(t,e,d,g,x,v,E,P,h,u,f+1),Yd(E,P,b,C,S,m,c,o,h,u,f+1)}const XE=8,QE=11920929e-14,ZE=1;function JE(t,e,s,r,i,a,c,o){const u=Math.min(.99,Math.max(0,o??Df.defaultOptions.bezierSmoothness));let f=(ZE-u)/1;return f*=f,eP(e,s,r,i,a,c,t,f),t}function eP(t,e,s,r,i,a,c,o){Xd(c,t,e,s,r,i,a,o,0),c.push(i,a)}function Xd(t,e,s,r,i,a,c,o,h){if(h>XE)return;const u=(e+r)/2,f=(s+i)/2,d=(r+a)/2,g=(i+c)/2,_=(u+d)/2,k=(f+g)/2;let S=a-e,m=c-s;const x=Math.abs((r-a)*m-(i-c)*S);if(x>QE){if(x*x<=o*(S*S+m*m)){t.push(_,k);return}}else if(S=_-(e+a)/2,m=k-(s+c)/2,S*S+m*m<=o){t.push(_,k);return}Xd(t,e,s,u,f,_,k,o,h+1),Xd(t,_,k,d,g,a,c,o,h+1)}function U0(t,e,s,r,i,a,c,o){let h=Math.abs(i-a);(!c&&i>a||c&&a>i)&&(h=2*Math.PI-h),o||(o=Math.max(6,Math.floor(6*Math.pow(r,1/3)*(h/Math.PI)))),o=Math.max(o,3);let u=h/o,f=i;u*=c?-1:1;for(let d=0;d<o+1;d++){const g=Math.cos(f),_=Math.sin(f),k=e+g*r,S=s+_*r;t.push(k,S),f+=u}}function tP(t,e,s,r,i,a){const c=t[t.length-2],h=t[t.length-1]-s,u=c-e,f=i-s,d=r-e,g=Math.abs(h*d-u*f);if(g<1e-8||a===0){(t[t.length-2]!==e||t[t.length-1]!==s)&&t.push(e,s);return}const _=h*h+u*u,k=f*f+d*d,S=h*f+u*d,m=a*Math.sqrt(_)/g,x=a*Math.sqrt(k)/g,v=m*S/_,b=x*S/k,C=m*d+x*u,E=m*f+x*h,P=u*(x+v),T=h*(x+v),A=d*(m+b),D=f*(m+b),I=Math.atan2(T-E,P-C),O=Math.atan2(D-E,A-C);U0(t,C+e,E+s,a,I,O,u*f>d*h)}const Bo=Math.PI*2,sd={centerX:0,centerY:0,ang1:0,ang2:0},rd=({x:t,y:e},s,r,i,a,c,o,h)=>{t*=s,e*=r;const u=i*t-a*e,f=a*t+i*e;return h.x=u+c,h.y=f+o,h};function sP(t,e){const s=e===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(e/4),r=e===1.5707963267948966?.551915024494:s,i=Math.cos(t),a=Math.sin(t),c=Math.cos(t+e),o=Math.sin(t+e);return[{x:i-a*r,y:a+i*r},{x:c+o*r,y:o-c*r},{x:c,y:o}]}const vv=(t,e,s,r)=>{const i=t*r-e*s<0?-1:1;let a=t*s+e*r;return a>1&&(a=1),a<-1&&(a=-1),i*Math.acos(a)},rP=(t,e,s,r,i,a,c,o,h,u,f,d,g)=>{const _=Math.pow(i,2),k=Math.pow(a,2),S=Math.pow(f,2),m=Math.pow(d,2);let x=_*k-_*m-k*S;x<0&&(x=0),x/=_*m+k*S,x=Math.sqrt(x)*(c===o?-1:1);const v=x*i/a*d,b=x*-a/i*f,C=u*v-h*b+(t+s)/2,E=h*v+u*b+(e+r)/2,P=(f-v)/i,T=(d-b)/a,A=(-f-v)/i,D=(-d-b)/a,I=vv(1,0,P,T);let O=vv(P,T,A,D);o===0&&O>0&&(O-=Bo),o===1&&O<0&&(O+=Bo),g.centerX=C,g.centerY=E,g.ang1=I,g.ang2=O};function iP(t,e,s,r,i,a,c,o=0,h=0,u=0){if(a===0||c===0)return;const f=Math.sin(o*Bo/360),d=Math.cos(o*Bo/360),g=d*(e-r)/2+f*(s-i)/2,_=-f*(e-r)/2+d*(s-i)/2;if(g===0&&_===0)return;a=Math.abs(a),c=Math.abs(c);const k=Math.pow(g,2)/Math.pow(a,2)+Math.pow(_,2)/Math.pow(c,2);k>1&&(a*=Math.sqrt(k),c*=Math.sqrt(k)),rP(e,s,r,i,a,c,h,u,f,d,g,_,sd);let{ang1:S,ang2:m}=sd;const{centerX:x,centerY:v}=sd;let b=Math.abs(m)/(Bo/4);Math.abs(1-b)<1e-7&&(b=1);const C=Math.max(Math.ceil(b),1);m/=C;let E=t[t.length-2],P=t[t.length-1];const T={x:0,y:0};for(let A=0;A<C;A++){const D=sP(S,m),{x:I,y:O}=rd(D[0],a,c,d,f,x,v,T),{x:z,y:U}=rd(D[1],a,c,d,f,x,v,T),{x:K,y:ie}=rd(D[2],a,c,d,f,x,v,T);H0(t,E,P,I,O,z,U,K,ie),E=K,P=ie,S+=m}}function nP(t,e,s){const r=(c,o)=>{const h=o.x-c.x,u=o.y-c.y,f=Math.sqrt(h*h+u*u),d=h/f,g=u/f;return{len:f,nx:d,ny:g}},i=(c,o)=>{c===0?t.moveTo(o.x,o.y):t.lineTo(o.x,o.y)};let a=e[e.length-1];for(let c=0;c<e.length;c++){const o=e[c%e.length],h=o.radius??s;if(h<=0){i(c,o),a=o;continue}const u=e[(c+1)%e.length],f=r(o,a),d=r(o,u);if(f.len<1e-4||d.len<1e-4){i(c,o),a=o;continue}let g=Math.asin(f.nx*d.ny-f.ny*d.nx),_=1,k=!1;f.nx*d.nx-f.ny*-d.ny<0?g<0?g=Math.PI+g:(g=Math.PI-g,_=-1,k=!0):g>0&&(_=-1,k=!0);const S=g/2;let m,x=Math.abs(Math.cos(S)*h/Math.sin(S));x>Math.min(f.len/2,d.len/2)?(x=Math.min(f.len/2,d.len/2),m=Math.abs(x*Math.sin(S)/Math.cos(S))):m=h;const v=o.x+d.nx*x+-d.ny*m*_,b=o.y+d.ny*x+d.nx*m*_,C=Math.atan2(f.ny,f.nx)+Math.PI/2*_,E=Math.atan2(d.ny,d.nx)-Math.PI/2*_;c===0&&t.moveTo(v+Math.cos(C)*m,b+Math.sin(C)*m),t.arc(v,b,m,C,E,k),a=o}}function oP(t,e,s,r){const i=(o,h)=>Math.sqrt((o.x-h.x)**2+(o.y-h.y)**2),a=(o,h,u)=>({x:o.x+(h.x-o.x)*u,y:o.y+(h.y-o.y)*u}),c=e.length;for(let o=0;o<c;o++){const h=e[(o+1)%c],u=h.radius??s;if(u<=0){o===0?t.moveTo(h.x,h.y):t.lineTo(h.x,h.y);continue}const f=e[o],d=e[(o+2)%c],g=i(f,h);let _;if(g<1e-4)_=h;else{const m=Math.min(g/2,u);_=a(h,f,m/g)}const k=i(d,h);let S;if(k<1e-4)S=h;else{const m=Math.min(k/2,u);S=a(h,d,m/k)}o===0?t.moveTo(_.x,_.y):t.lineTo(_.x,_.y),t.quadraticCurveTo(h.x,h.y,S.x,S.y,r)}}const aP=new Pt;class lP{constructor(e){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new Ns,this._graphicsPath2D=e,this.signed=e.checkForHoles}moveTo(e,s){return this.startPoly(e,s),this}lineTo(e,s){this._ensurePoly();const r=this._currentPoly.points,i=r[r.length-2],a=r[r.length-1];return(i!==e||a!==s)&&r.push(e,s),this}arc(e,s,r,i,a,c){this._ensurePoly(!1);const o=this._currentPoly.points;return U0(o,e,s,r,i,a,c),this}arcTo(e,s,r,i,a){this._ensurePoly();const c=this._currentPoly.points;return tP(c,e,s,r,i,a),this}arcToSvg(e,s,r,i,a,c,o){const h=this._currentPoly.points;return iP(h,this._currentPoly.lastX,this._currentPoly.lastY,c,o,e,s,r,i,a),this}bezierCurveTo(e,s,r,i,a,c,o){this._ensurePoly();const h=this._currentPoly;return H0(this._currentPoly.points,h.lastX,h.lastY,e,s,r,i,a,c,o),this}quadraticCurveTo(e,s,r,i,a){this._ensurePoly();const c=this._currentPoly;return JE(this._currentPoly.points,c.lastX,c.lastY,e,s,r,i,a),this}closePath(){return this.endPoly(!0),this}addPath(e,s){this.endPoly(),s&&!s.isIdentity()&&(e=e.clone(!0),e.transform(s));const r=this.shapePrimitives,i=r.length;for(let a=0;a<e.instructions.length;a++){const c=e.instructions[a];this[c.action](...c.data)}if(e.checkForHoles&&r.length-i>1){let a=null;for(let c=i;c<r.length;c++){const o=r[c];if(o.shape.type==="polygon"){const h=o.shape,u=a==null?void 0:a.shape;u&&u.containsPolygon(h)?(a.holes||(a.holes=[]),a.holes.push(o),r.copyWithin(c,c+1),r.length--,c--):a=o}}}return this}finish(e=!1){this.endPoly(e)}rect(e,s,r,i,a){return this.drawShape(new Pt(e,s,r,i),a),this}circle(e,s,r,i){return this.drawShape(new Ef(e,s,r),i),this}poly(e,s,r){const i=new Do(e);return i.closePath=s,this.drawShape(i,r),this}regularPoly(e,s,r,i,a=0,c){i=Math.max(i|0,3);const o=-1*Math.PI/2+a,h=Math.PI*2/i,u=[];for(let f=0;f<i;f++){const d=o-f*h;u.push(e+r*Math.cos(d),s+r*Math.sin(d))}return this.poly(u,!0,c),this}roundPoly(e,s,r,i,a,c=0,o){if(i=Math.max(i|0,3),a<=0)return this.regularPoly(e,s,r,i,c);const h=r*Math.sin(Math.PI/i)-.001;a=Math.min(a,h);const u=-1*Math.PI/2+c,f=Math.PI*2/i,d=(i-2)*Math.PI/i/2;for(let g=0;g<i;g++){const _=g*f+u,k=e+r*Math.cos(_),S=s+r*Math.sin(_),m=_+Math.PI+d,x=_-Math.PI-d,v=k+a*Math.cos(m),b=S+a*Math.sin(m),C=k+a*Math.cos(x),E=S+a*Math.sin(x);g===0?this.moveTo(v,b):this.lineTo(v,b),this.quadraticCurveTo(k,S,C,E,o)}return this.closePath()}roundShape(e,s,r=!1,i){return e.length<3?this:(r?oP(this,e,s,i):nP(this,e,s),this.closePath())}filletRect(e,s,r,i,a){if(a===0)return this.rect(e,s,r,i);const c=Math.min(r,i)/2,o=Math.min(c,Math.max(-c,a)),h=e+r,u=s+i,f=o<0?-o:0,d=Math.abs(o);return this.moveTo(e,s+d).arcTo(e+f,s+f,e+d,s,d).lineTo(h-d,s).arcTo(h-f,s+f,h,s+d,d).lineTo(h,u-d).arcTo(h-f,u-f,e+r-d,u,d).lineTo(e+d,u).arcTo(e+f,u-f,e,u-d,d).closePath()}chamferRect(e,s,r,i,a,c){if(a<=0)return this.rect(e,s,r,i);const o=Math.min(a,Math.min(r,i)/2),h=e+r,u=s+i,f=[e+o,s,h-o,s,h,s+o,h,u-o,h-o,u,e+o,u,e,u-o,e,s+o];for(let d=f.length-1;d>=2;d-=2)f[d]===f[d-2]&&f[d-1]===f[d-3]&&f.splice(d-1,2);return this.poly(f,!0,c)}ellipse(e,s,r,i,a){return this.drawShape(new Pf(e,s,r,i),a),this}roundRect(e,s,r,i,a,c){return this.drawShape(new Mf(e,s,r,i,a),c),this}drawShape(e,s){return this.endPoly(),this.shapePrimitives.push({shape:e,transform:s}),this}startPoly(e,s){let r=this._currentPoly;return r&&this.endPoly(),r=new Do,r.points.push(e,s),this._currentPoly=r,this}endPoly(e=!1){const s=this._currentPoly;return s&&s.points.length>2&&(s.closePath=e,this.shapePrimitives.push({shape:s})),this._currentPoly=null,this}_ensurePoly(e=!0){if(!this._currentPoly&&(this._currentPoly=new Do,e)){const s=this.shapePrimitives[this.shapePrimitives.length-1];if(s){let r=s.shape.x,i=s.shape.y;if(s.transform&&!s.transform.isIdentity()){const a=s.transform,c=r;r=a.a*r+a.c*i+a.tx,i=a.b*c+a.d*i+a.ty}this._currentPoly.points.push(r,i)}else this._currentPoly.points.push(0,0)}}buildPath(){const e=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let s=0;s<e.instructions.length;s++){const r=e.instructions[s];this[r.action](...r.data)}this.finish()}get bounds(){const e=this._bounds;e.clear();const s=this.shapePrimitives;for(let r=0;r<s.length;r++){const i=s[r],a=i.shape.getBounds(aP);i.transform?e.addRect(a,i.transform):e.addRect(a)}return e}}class dr{constructor(e,s=!1){this.instructions=[],this.uid=rt("graphicsPath"),this._dirty=!0,this.checkForHoles=s,typeof e=="string"?T2(e,this):this.instructions=(e==null?void 0:e.slice())??[]}get shapePath(){return this._shapePath||(this._shapePath=new lP(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(e,s){return e=e.clone(),this.instructions.push({action:"addPath",data:[e,s]}),this._dirty=!0,this}arc(...e){return this.instructions.push({action:"arc",data:e}),this._dirty=!0,this}arcTo(...e){return this.instructions.push({action:"arcTo",data:e}),this._dirty=!0,this}arcToSvg(...e){return this.instructions.push({action:"arcToSvg",data:e}),this._dirty=!0,this}bezierCurveTo(...e){return this.instructions.push({action:"bezierCurveTo",data:e}),this._dirty=!0,this}bezierCurveToShort(e,s,r,i,a){const c=this.instructions[this.instructions.length-1],o=this.getLastPoint(Ft.shared);let h=0,u=0;if(!c||c.action!=="bezierCurveTo")h=o.x,u=o.y;else{h=c.data[2],u=c.data[3];const f=o.x,d=o.y;h=f+(f-h),u=d+(d-u)}return this.instructions.push({action:"bezierCurveTo",data:[h,u,e,s,r,i,a]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=!0,this}ellipse(...e){return this.instructions.push({action:"ellipse",data:e}),this._dirty=!0,this}lineTo(...e){return this.instructions.push({action:"lineTo",data:e}),this._dirty=!0,this}moveTo(...e){return this.instructions.push({action:"moveTo",data:e}),this}quadraticCurveTo(...e){return this.instructions.push({action:"quadraticCurveTo",data:e}),this._dirty=!0,this}quadraticCurveToShort(e,s,r){const i=this.instructions[this.instructions.length-1],a=this.getLastPoint(Ft.shared);let c=0,o=0;if(!i||i.action!=="quadraticCurveTo")c=a.x,o=a.y;else{c=i.data[0],o=i.data[1];const h=a.x,u=a.y;c=h+(h-c),o=u+(u-o)}return this.instructions.push({action:"quadraticCurveTo",data:[c,o,e,s,r]}),this._dirty=!0,this}rect(e,s,r,i,a){return this.instructions.push({action:"rect",data:[e,s,r,i,a]}),this._dirty=!0,this}circle(e,s,r,i){return this.instructions.push({action:"circle",data:[e,s,r,i]}),this._dirty=!0,this}roundRect(...e){return this.instructions.push({action:"roundRect",data:e}),this._dirty=!0,this}poly(...e){return this.instructions.push({action:"poly",data:e}),this._dirty=!0,this}regularPoly(...e){return this.instructions.push({action:"regularPoly",data:e}),this._dirty=!0,this}roundPoly(...e){return this.instructions.push({action:"roundPoly",data:e}),this._dirty=!0,this}roundShape(...e){return this.instructions.push({action:"roundShape",data:e}),this._dirty=!0,this}filletRect(...e){return this.instructions.push({action:"filletRect",data:e}),this._dirty=!0,this}chamferRect(...e){return this.instructions.push({action:"chamferRect",data:e}),this._dirty=!0,this}star(e,s,r,i,a,c,o){a||(a=i/2);const h=-1*Math.PI/2+c,u=r*2,f=Math.PI*2/u,d=[];for(let g=0;g<u;g++){const _=g%2?a:i,k=g*f+h;d.push(e+_*Math.cos(k),s+_*Math.sin(k))}return this.poly(d,!0,o),this}clone(e=!1){const s=new dr;if(s.checkForHoles=this.checkForHoles,!e)s.instructions=this.instructions.slice();else for(let r=0;r<this.instructions.length;r++){const i=this.instructions[r];s.instructions.push({action:i.action,data:i.data.slice()})}return s}clear(){return this.instructions.length=0,this._dirty=!0,this}transform(e){if(e.isIdentity())return this;const s=e.a,r=e.b,i=e.c,a=e.d,c=e.tx,o=e.ty;let h=0,u=0,f=0,d=0,g=0,_=0,k=0,S=0;for(let m=0;m<this.instructions.length;m++){const x=this.instructions[m],v=x.data;switch(x.action){case"moveTo":case"lineTo":h=v[0],u=v[1],v[0]=s*h+i*u+c,v[1]=r*h+a*u+o;break;case"bezierCurveTo":f=v[0],d=v[1],g=v[2],_=v[3],h=v[4],u=v[5],v[0]=s*f+i*d+c,v[1]=r*f+a*d+o,v[2]=s*g+i*_+c,v[3]=r*g+a*_+o,v[4]=s*h+i*u+c,v[5]=r*h+a*u+o;break;case"quadraticCurveTo":f=v[0],d=v[1],h=v[2],u=v[3],v[0]=s*f+i*d+c,v[1]=r*f+a*d+o,v[2]=s*h+i*u+c,v[3]=r*h+a*u+o;break;case"arcToSvg":h=v[5],u=v[6],k=v[0],S=v[1],v[0]=s*k+i*S,v[1]=r*k+a*S,v[5]=s*h+i*u+c,v[6]=r*h+a*u+o;break;case"circle":v[4]=an(v[3],e);break;case"rect":v[4]=an(v[4],e);break;case"ellipse":v[8]=an(v[8],e);break;case"roundRect":v[5]=an(v[5],e);break;case"addPath":v[0].transform(e);break;case"poly":v[2]=an(v[2],e);break;case"regularPoly":case"chamferRect":v[5]=an(v[5],e);break;case"closePath":break;default:Ht("unknown transform action",x.action);break}}return this._dirty=!0,this}get bounds(){return this.shapePath.bounds}getLastPoint(e){let s=this.instructions.length-1,r=this.instructions[s];if(!r)return e.x=0,e.y=0,e;for(;r.action==="closePath";){if(s--,s<0)return e.x=0,e.y=0,e;r=this.instructions[s]}switch(r.action){case"moveTo":case"lineTo":e.x=r.data[0],e.y=r.data[1];break;case"quadraticCurveTo":e.x=r.data[2],e.y=r.data[3];break;case"bezierCurveTo":e.x=r.data[4],e.y=r.data[5];break;case"arc":case"arcToSvg":e.x=r.data[5],e.y=r.data[6];break;case"addPath":r.data[0].getLastPoint(e);break}return e}}function an(t,e){return t?t.prepend(e):e.clone()}function Ct(t,e,s){const r=t.getAttribute(e);return r?Number(r):s}function cP(t,e){const s=t.querySelectorAll("defs");for(let r=0;r<s.length;r++){const i=s[r];for(let a=0;a<i.children.length;a++){const c=i.children[a];switch(c.nodeName.toLowerCase()){case"lineargradient":e.defs[c.id]=hP(c);break;case"radialgradient":e.defs[c.id]=uP(c);break}}}}function js(t,e,s){const r=t.getAttribute(e);if(r!=null&&r.trim().endsWith("%")){const i=Number(r.trim().slice(0,-1));return Number.isNaN(i)?s:i/100}return Ct(t,e,s)}function W0(t){return(t.getAttribute("gradientUnits")||"objectBoundingBox")==="objectBoundingBox"?"local":"global"}function z0(t){const e=[];for(let s=0;s<t.children.length;s++){const r=t.children[s],i=js(r,"offset",0),a=Ss.shared.setValue(r.getAttribute("stop-color")).toNumber();e.push({offset:i,color:a})}return e}function hP(t){const e=js(t,"x1",0),s=js(t,"y1",0),r=js(t,"x2",1),i=js(t,"y2",0);return new Jo({type:"linear",start:{x:e,y:s},end:{x:r,y:i},textureSpace:W0(t),colorStops:z0(t)})}function uP(t){const e=js(t,"cx",.5),s=js(t,"cy",.5),r=js(t,"r",.5),i=js(t,"fx",e),a=js(t,"fy",s),c=js(t,"fr",0);return new Jo({type:"radial",center:{x:i,y:a},innerRadius:c,outerCenter:{x:e,y:s},outerRadius:r,textureSpace:W0(t),colorStops:z0(t)})}function xv(t){const e=t.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return e?e[1]:""}const yv={fill:{type:"paint",default:0},"fill-opacity":{type:"number",default:1},stroke:{type:"paint",default:0},"stroke-width":{type:"number",default:1},"stroke-opacity":{type:"number",default:1},"stroke-linecap":{type:"string",default:"butt"},"stroke-linejoin":{type:"string",default:"miter"},"stroke-miterlimit":{type:"number",default:10},"stroke-dasharray":{type:"string",default:"none"},"stroke-dashoffset":{type:"number",default:0},opacity:{type:"number",default:1}};function V0(t,e){const s=t.getAttribute("style"),r={},i={},a={strokeStyle:r,fillStyle:i,useFill:!1,useStroke:!1};for(const c in yv){const o=t.getAttribute(c);o&&bv(e,a,c,o.trim())}if(s){const c=s.split(";");for(let o=0;o<c.length;o++){const h=c[o].trim(),[u,f]=h.split(":");yv[u]&&bv(e,a,u,f.trim())}}return{strokeStyle:a.useStroke?r:null,fillStyle:a.useFill?i:null,useFill:a.useFill,useStroke:a.useStroke}}function bv(t,e,s,r){switch(s){case"stroke":if(r!=="none"){if(r.startsWith("url(")){const i=xv(r);e.strokeStyle.fill=t.defs[i]}else e.strokeStyle.color=Ss.shared.setValue(r).toNumber();e.useStroke=!0}break;case"stroke-width":e.strokeStyle.width=Number(r);break;case"fill":if(r!=="none"){if(r.startsWith("url(")){const i=xv(r);e.fillStyle.fill=t.defs[i]}else e.fillStyle.color=Ss.shared.setValue(r).toNumber();e.useFill=!0}break;case"fill-opacity":e.fillStyle.alpha=Number(r);break;case"stroke-opacity":e.strokeStyle.alpha=Number(r);break;case"opacity":e.fillStyle.alpha=Number(r),e.strokeStyle.alpha=Number(r);break}}function dP(t){if(t.length<=2)return!0;const e=t.map(o=>o.area).sort((o,h)=>h-o),[s,r]=e,i=e[e.length-1],a=s/r,c=r/i;return!(a>3&&c<2)}function fP(t){return t.split(/(?=[Mm])/).filter(r=>r.trim().length>0)}function pP(t){const e=t.match(/[-+]?[0-9]*\.?[0-9]+/g);if(!e||e.length<4)return 0;const s=e.map(Number),r=[],i=[];for(let f=0;f<s.length;f+=2)f+1<s.length&&(r.push(s[f]),i.push(s[f+1]));if(r.length===0||i.length===0)return 0;const a=Math.min(...r),c=Math.max(...r),o=Math.min(...i),h=Math.max(...i);return(c-a)*(h-o)}function wv(t,e){const s=new dr(t,!1);for(const r of s.instructions)e.instructions.push(r)}function mP(t,e){if(typeof t=="string"){const c=document.createElement("div");c.innerHTML=t.trim(),t=c.querySelector("svg")}const s={context:e,defs:{},path:new dr};cP(t,s);const r=t.children,{fillStyle:i,strokeStyle:a}=V0(t,s);for(let c=0;c<r.length;c++){const o=r[c];o.nodeName.toLowerCase()!=="defs"&&G0(o,s,i,a)}return e}function G0(t,e,s,r){const i=t.children,{fillStyle:a,strokeStyle:c}=V0(t,e);a&&s?s={...s,...a}:a&&(s=a),c&&r?r={...r,...c}:c&&(r=c);const o=!s&&!r;o&&(s={color:0});let h,u,f,d,g,_,k,S,m,x,v,b,C,E,P,T,A;switch(t.nodeName.toLowerCase()){case"path":{E=t.getAttribute("d");const D=t.getAttribute("fill-rule"),I=fP(E),O=D==="evenodd",z=I.length>1;if(O&&z){const K=I.map(Q=>({path:Q,area:pP(Q)}));if(K.sort((Q,J)=>J.area-Q.area),I.length>3||!dP(K))for(let Q=0;Q<K.length;Q++){const J=K[Q],Y=Q===0;e.context.beginPath();const L=new dr(void 0,!0);wv(J.path,L),e.context.path(L),Y?(s&&e.context.fill(s),r&&e.context.stroke(r)):e.context.cut()}else for(let Q=0;Q<K.length;Q++){const J=K[Q],Y=Q%2===1;e.context.beginPath();const L=new dr(void 0,!0);wv(J.path,L),e.context.path(L),Y?e.context.cut():(s&&e.context.fill(s),r&&e.context.stroke(r))}}else{const K=D?D==="evenodd":!0;P=new dr(E,K),e.context.path(P),s&&e.context.fill(s),r&&e.context.stroke(r)}break}case"circle":k=Ct(t,"cx",0),S=Ct(t,"cy",0),m=Ct(t,"r",0),e.context.ellipse(k,S,m,m),s&&e.context.fill(s),r&&e.context.stroke(r);break;case"rect":h=Ct(t,"x",0),u=Ct(t,"y",0),T=Ct(t,"width",0),A=Ct(t,"height",0),x=Ct(t,"rx",0),v=Ct(t,"ry",0),x||v?e.context.roundRect(h,u,T,A,x||v):e.context.rect(h,u,T,A),s&&e.context.fill(s),r&&e.context.stroke(r);break;case"ellipse":k=Ct(t,"cx",0),S=Ct(t,"cy",0),x=Ct(t,"rx",0),v=Ct(t,"ry",0),e.context.beginPath(),e.context.ellipse(k,S,x,v),s&&e.context.fill(s),r&&e.context.stroke(r);break;case"line":f=Ct(t,"x1",0),d=Ct(t,"y1",0),g=Ct(t,"x2",0),_=Ct(t,"y2",0),e.context.beginPath(),e.context.moveTo(f,d),e.context.lineTo(g,_),r&&e.context.stroke(r);break;case"polygon":C=t.getAttribute("points"),b=C.match(/-?\d+/g).map(D=>parseInt(D,10)),e.context.poly(b,!0),s&&e.context.fill(s),r&&e.context.stroke(r);break;case"polyline":C=t.getAttribute("points"),b=C.match(/-?\d+/g).map(D=>parseInt(D,10)),e.context.poly(b,!1),r&&e.context.stroke(r);break;case"g":case"svg":break;default:{Ht(`[SVG parser] <${t.nodeName}> elements unsupported`);break}}o&&(s=null);for(let D=0;D<i.length;D++)G0(i[D],e,s,r)}function gP(t){return t.texture!==void 0}const Sv={repeat:{addressModeU:"repeat",addressModeV:"repeat"},"repeat-x":{addressModeU:"repeat",addressModeV:"clamp-to-edge"},"repeat-y":{addressModeU:"clamp-to-edge",addressModeV:"repeat"},"no-repeat":{addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}};class _P{constructor(e,s){this.uid=rt("fillPattern"),this._tick=0,this.transform=new Ne;const r=gP(e)?e:{texture:e,repetition:s};this.texture=r.texture,this.textureSpace=r.textureSpace??"global";const i=r.repetition;i&&(this.texture.source.style.addressModeU=Sv[i].addressModeU,this.texture.source.style.addressModeV=Sv[i].addressModeV)}setTransform(e){if(e){if(this.transform.equals(e))return;this.transform.copyFrom(e)}else{if(this.transform.isIdentity())return;this.transform.identity()}this._tick++}get texture(){return this._texture}set texture(e){this._texture!==e&&(this._texture=e,this._tick++)}get styleKey(){return`fill-pattern-${this.uid}-${this._tick}`}destroy(){this.texture.destroy(!0),this.texture=null}}function vP(t){return Ss.isColorLike(t)}function Cv(t){return t instanceof _P}function kv(t){return t instanceof Jo}function xP(t){return t instanceof Ve}function yP(t,e,s){const r=Ss.shared.setValue(e??0);return t.color=r.toNumber(),t.alpha=r.alpha===1?s.alpha:r.alpha,t.texture=Ve.WHITE,{...s,...t}}function bP(t,e,s){return t.texture=e,{...s,...t}}function Ev(t,e,s){return t.fill=e,t.color=16777215,t.texture=e.texture,t.matrix=e.transform,t.textureSpace=e.textureSpace,{...s,...t}}function Pv(t,e,s){return e.buildGradient(),t.fill=e,t.color=16777215,t.texture=e.texture,t.matrix=e.transform,t.textureSpace=e.textureSpace,{...s,...t}}function wP(t,e){const s={...e,...t},r=Ss.shared.setValue(s.color);return s.alpha*=r.alpha,s.color=r.toNumber(),s}function ko(t,e){if(t==null)return null;const s={},r=t;return vP(t)?yP(s,t,e):xP(t)?bP(s,t,e):Cv(t)?Ev(s,t,e):kv(t)?Pv(s,t,e):r.fill&&Cv(r.fill)?Ev(r,r.fill,e):r.fill&&kv(r.fill)?Pv(r,r.fill,e):wP(r,e)}function Mv(t,e){const{width:s,alignment:r,miterLimit:i,cap:a,join:c,pixelLine:o,...h}=e,u=ko(t,h);return u?{width:s,alignment:r,miterLimit:i,cap:a,join:c,pixelLine:o,...u}:null}function SP(t,e){let s=1;const r=t.shapePath.shapePrimitives;for(let i=0;i<r.length;i++){const a=r[i].shape;if(a.type!=="polygon")continue;const c=a.points,o=c.length;if(o<6)continue;const h=a.closePath;for(let u=0;u<o;u+=2){if(!h&&(u===0||u===o-2))continue;const f=(u-2+o)%o,d=(u+2)%o,g=c[f],_=c[f+1],k=c[u],S=c[u+1],m=c[d],x=c[d+1],v=g-k,b=_-S,C=m-k,E=x-S,P=v*v+b*b,T=C*C+E*E;if(P<1e-12||T<1e-12)continue;let I=(v*C+b*E)/Math.sqrt(P*T);I<-1?I=-1:I>1&&(I=1);const O=Math.sqrt((1-I)*.5);if(O<1e-6)continue;const z=Math.min(1/O,e);z>s&&(s=z)}}return s}const CP=new Ft,Av=new Ne,Lf=class qs extends Zs{constructor(){super(...arguments),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=rt("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this.destroyed=!1,this._activePath=new dr,this._transform=new Ne,this._fillStyle={...qs.defaultFillStyle},this._strokeStyle={...qs.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new Ns,this._boundsDirty=!0}clone(){const e=new qs;return e.batchMode=this.batchMode,e.instructions=this.instructions.slice(),e._activePath=this._activePath.clone(),e._transform=this._transform.clone(),e._fillStyle={...this._fillStyle},e._strokeStyle={...this._strokeStyle},e._stateStack=this._stateStack.slice(),e._bounds=this._bounds.clone(),e._boundsDirty=!0,e}get fillStyle(){return this._fillStyle}set fillStyle(e){this._fillStyle=ko(e,qs.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(e){this._strokeStyle=Mv(e,qs.defaultStrokeStyle)}setFillStyle(e){return this._fillStyle=ko(e,qs.defaultFillStyle),this}setStrokeStyle(e){return this._strokeStyle=ko(e,qs.defaultStrokeStyle),this}texture(e,s,r,i,a,c){return this.instructions.push({action:"texture",data:{image:e,dx:r||0,dy:i||0,dw:a||e.frame.width,dh:c||e.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:s||s===0?Ss.shared.setValue(s).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new dr,this}fill(e,s){let r;const i=this.instructions[this.instructions.length-1];return this._tick===0&&(i==null?void 0:i.action)==="stroke"?r=i.data.path:r=this._activePath.clone(),r?(e!=null&&(s!==void 0&&typeof e=="number"&&(je(xt,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),e={color:e,alpha:s}),this._fillStyle=ko(e,qs.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:r}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){const{x:e,y:s}=this._activePath.getLastPoint(Ft.shared);this._activePath.clear(),this._activePath.moveTo(e,s)}stroke(e){let s;const r=this.instructions[this.instructions.length-1];return this._tick===0&&(r==null?void 0:r.action)==="fill"?s=r.data.path:s=this._activePath.clone(),s?(e!=null&&(this._strokeStyle=Mv(e,qs.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:s}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let e=0;e<2;e++){const s=this.instructions[this.instructions.length-1-e],r=this._activePath.clone();if(s&&(s.action==="stroke"||s.action==="fill"))if(s.data.hole)s.data.hole.addPath(r);else{s.data.hole=r;break}}return this._initNextPathLocation(),this}arc(e,s,r,i,a,c){this._tick++;const o=this._transform;return this._activePath.arc(o.a*e+o.c*s+o.tx,o.b*e+o.d*s+o.ty,r,i,a,c),this}arcTo(e,s,r,i,a){this._tick++;const c=this._transform;return this._activePath.arcTo(c.a*e+c.c*s+c.tx,c.b*e+c.d*s+c.ty,c.a*r+c.c*i+c.tx,c.b*r+c.d*i+c.ty,a),this}arcToSvg(e,s,r,i,a,c,o){this._tick++;const h=this._transform;return this._activePath.arcToSvg(e,s,r,i,a,h.a*c+h.c*o+h.tx,h.b*c+h.d*o+h.ty),this}bezierCurveTo(e,s,r,i,a,c,o){this._tick++;const h=this._transform;return this._activePath.bezierCurveTo(h.a*e+h.c*s+h.tx,h.b*e+h.d*s+h.ty,h.a*r+h.c*i+h.tx,h.b*r+h.d*i+h.ty,h.a*a+h.c*c+h.tx,h.b*a+h.d*c+h.ty,o),this}closePath(){var e;return this._tick++,(e=this._activePath)==null||e.closePath(),this}ellipse(e,s,r,i){return this._tick++,this._activePath.ellipse(e,s,r,i,this._transform.clone()),this}circle(e,s,r){return this._tick++,this._activePath.circle(e,s,r,this._transform.clone()),this}path(e){return this._tick++,this._activePath.addPath(e,this._transform.clone()),this}lineTo(e,s){this._tick++;const r=this._transform;return this._activePath.lineTo(r.a*e+r.c*s+r.tx,r.b*e+r.d*s+r.ty),this}moveTo(e,s){this._tick++;const r=this._transform,i=this._activePath.instructions,a=r.a*e+r.c*s+r.tx,c=r.b*e+r.d*s+r.ty;return i.length===1&&i[0].action==="moveTo"?(i[0].data[0]=a,i[0].data[1]=c,this):(this._activePath.moveTo(a,c),this)}quadraticCurveTo(e,s,r,i,a){this._tick++;const c=this._transform;return this._activePath.quadraticCurveTo(c.a*e+c.c*s+c.tx,c.b*e+c.d*s+c.ty,c.a*r+c.c*i+c.tx,c.b*r+c.d*i+c.ty,a),this}rect(e,s,r,i){return this._tick++,this._activePath.rect(e,s,r,i,this._transform.clone()),this}roundRect(e,s,r,i,a){return this._tick++,this._activePath.roundRect(e,s,r,i,a,this._transform.clone()),this}poly(e,s){return this._tick++,this._activePath.poly(e,s,this._transform.clone()),this}regularPoly(e,s,r,i,a=0,c){return this._tick++,this._activePath.regularPoly(e,s,r,i,a,c),this}roundPoly(e,s,r,i,a,c){return this._tick++,this._activePath.roundPoly(e,s,r,i,a,c),this}roundShape(e,s,r,i){return this._tick++,this._activePath.roundShape(e,s,r,i),this}filletRect(e,s,r,i,a){return this._tick++,this._activePath.filletRect(e,s,r,i,a),this}chamferRect(e,s,r,i,a,c){return this._tick++,this._activePath.chamferRect(e,s,r,i,a,c),this}star(e,s,r,i,a=0,c=0){return this._tick++,this._activePath.star(e,s,r,i,a,c,this._transform.clone()),this}svg(e){return this._tick++,mP(e,this),this}restore(){const e=this._stateStack.pop();return e&&(this._transform=e.transform,this._fillStyle=e.fillStyle,this._strokeStyle=e.strokeStyle),this}save(){return this._stateStack.push({transform:this._transform.clone(),fillStyle:{...this._fillStyle},strokeStyle:{...this._strokeStyle}}),this}getTransform(){return this._transform}resetTransform(){return this._transform.identity(),this}rotate(e){return this._transform.rotate(e),this}scale(e,s=e){return this._transform.scale(e,s),this}setTransform(e,s,r,i,a,c){return e instanceof Ne?(this._transform.set(e.a,e.b,e.c,e.d,e.tx,e.ty),this):(this._transform.set(e,s,r,i,a,c),this)}transform(e,s,r,i,a,c){return e instanceof Ne?(this._transform.append(e),this):(Av.set(e,s,r,i,a,c),this._transform.append(Av),this)}translate(e,s=e){return this._transform.translate(e,s),this}clear(){return this._activePath.clear(),this.instructions.length=0,this.resetTransform(),this.onUpdate(),this}onUpdate(){this._boundsDirty=!0,this.dirty=!0,this.emit("update",this,16)}get bounds(){if(!this._boundsDirty)return this._bounds;this._boundsDirty=!1;const e=this._bounds;e.clear();for(let s=0;s<this.instructions.length;s++){const r=this.instructions[s],i=r.action;if(i==="fill"){const a=r.data;e.addBounds(a.path.bounds)}else if(i==="texture"){const a=r.data;e.addFrame(a.dx,a.dy,a.dx+a.dw,a.dy+a.dh,a.transform)}if(i==="stroke"){const a=r.data,c=a.style.alignment;let o=a.style.width*(1-c);a.style.join==="miter"&&(o*=SP(a.path,a.style.miterLimit));const h=a.path.bounds;e.addFrame(h.minX-o,h.minY-o,h.maxX+o,h.maxY+o)}}return e.isValid||e.set(0,0,0,0),e}containsPoint(e){var i;if(!this.bounds.containsPoint(e.x,e.y))return!1;const s=this.instructions;let r=!1;for(let a=0;a<s.length;a++){const c=s[a],o=c.data,h=o.path;if(!c.action||!h)continue;const u=o.style,f=h.shapePath.shapePrimitives;for(let d=0;d<f.length;d++){const g=f[d].shape;if(!u||!g)continue;const _=f[d].transform,k=_?_.applyInverse(e,CP):e;if(c.action==="fill")r=g.contains(k.x,k.y);else{const m=u;r=g.strokeContains(k.x,k.y,m.width,m.alignment)}const S=o.hole;if(S){const m=(i=S.shapePath)==null?void 0:i.shapePrimitives;if(m)for(let x=0;x<m.length;x++)m[x].shape.contains(k.x,k.y)&&(r=!1)}if(r)return!0}}return r}unload(){var e;this.emit("unload",this);for(const s in this._gpuData)(e=this._gpuData[s])==null||e.destroy();this._gpuData=Object.create(null)}destroy(e=!1){if(this.destroyed)return;if(this.destroyed=!0,this._stateStack.length=0,this._transform=null,this.unload(),this.emit("destroy",this),this.removeAllListeners(),typeof e=="boolean"?e:e==null?void 0:e.texture){const r=typeof e=="boolean"?e:e==null?void 0:e.textureSource;this._fillStyle.texture&&(this._fillStyle.fill&&"uid"in this._fillStyle.fill?this._fillStyle.fill.destroy():this._fillStyle.texture.destroy(r)),this._strokeStyle.texture&&(this._strokeStyle.fill&&"uid"in this._strokeStyle.fill?this._strokeStyle.fill.destroy():this._strokeStyle.texture.destroy(r))}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null}};Lf.defaultFillStyle={color:16777215,alpha:1,texture:Ve.WHITE,matrix:null,fill:null,textureSpace:"local"};Lf.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:Ve.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};let bo=Lf;class kP{constructor(){this.isBatchable=!1}reset(){this.isBatchable=!1,this.context=null,this.graphicsData&&(this.graphicsData.destroy(),this.graphicsData=null)}destroy(){this.reset()}}class EP{constructor(){this.instructions=new Sf}init(){this.instructions.reset()}destroy(){this.instructions.destroy(),this.instructions=null}}const Bf=class Qd{constructor(e){this._renderer=e,this._managedContexts=new Pc({renderer:e,type:"resource",name:"graphicsContext"})}init(e){Qd.defaultOptions.bezierSmoothness=(e==null?void 0:e.bezierSmoothness)??Qd.defaultOptions.bezierSmoothness}getContextRenderData(e){return this.getGpuContext(e).graphicsData||this._initContextRenderData(e)}updateGpuContext(e){const s=e._gpuData,r=!!s[this._renderer.uid],i=s[this._renderer.uid]||this._initContext(e);return(e.dirty||!r)&&(r&&i.reset(),i.isBatchable=!1,e.dirty=!1),i}getGpuContext(e){return e._gpuData[this._renderer.uid]||this._initContext(e)}_initContextRenderData(e){const s=new EP,r=this.getGpuContext(e);return r.graphicsData=s,s.init(),s}_initContext(e){const s=new kP;return s.context=e,e._gpuData[this._renderer.uid]=s,this._managedContexts.add(e),s}destroy(){this._managedContexts.destroy(),this._renderer=null}};Bf.extension={type:[Fe.CanvasSystem],name:"graphicsContext"};Bf.defaultOptions={bezierSmoothness:.5};let PP=Bf;class q0{constructor(e,s){this.state=f0.for2d(),this.renderer=e,this._adaptor=s,this.renderer.runners.contextChange.add(this),this._managedGraphics=new Pc({renderer:e,type:"renderable",priority:-1,name:"graphics"})}contextChange(){this._adaptor.contextChange(this.renderer)}validateRenderable(e){return!1}addRenderable(e,s){this._managedGraphics.add(e),this.renderer.renderPipes.batch.break(s),s.add(e)}updateRenderable(e){}execute(e){e.isRenderable&&this._adaptor.execute(this,e)}destroy(){this._managedGraphics.destroy(),this.renderer=null,this._adaptor.destroy(),this._adaptor=null}}q0.extension={type:[Fe.CanvasPipes],name:"graphics"};function MP(t,e,s){const r=(t>>24&255)/255;e[s++]=(t&255)/255*r,e[s++]=(t>>8&255)/255*r,e[s++]=(t>>16&255)/255*r,e[s++]=r}class AP{constructor(){this.batches=[],this.batched=!1}destroy(){this.batches.forEach(e=>{ts.return(e)}),this.batches.length=0}}class K0{constructor(e,s){this.state=f0.for2d(),this.renderer=e,this._adaptor=s,this.renderer.runners.contextChange.add(this),this._managedGraphics=new Pc({renderer:e,type:"renderable",priority:-1,name:"graphics"})}contextChange(){this._adaptor.contextChange(this.renderer)}validateRenderable(e){const s=e.context,r=!!e._gpuData,a=this.renderer.graphicsContext.updateGpuContext(s);return!!(a.isBatchable||r!==a.isBatchable)}addRenderable(e,s){const i=this.renderer.graphicsContext.updateGpuContext(e.context);(e.didViewUpdate||!e._gpuData[this.renderer.uid])&&this._rebuild(e),i.isBatchable?this._addToBatcher(e,s):(this.renderer.renderPipes.batch.break(s),s.add(e))}updateRenderable(e){const r=this._getGpuDataForRenderable(e).batches;for(let i=0;i<r.length;i++){const a=r[i];a._batcher.updateElement(a)}}execute(e){if(!e.isRenderable)return;const s=this.renderer,r=e.context;if(!s.graphicsContext.getGpuContext(r).batches.length)return;const a=r.customShader||this._adaptor.shader;this.state.blendMode=e.groupBlendMode;const c=a.resources.localUniforms.uniforms;c.uTransformMatrix=e.groupTransform,c.uRound=s._roundPixels|e._roundPixels,MP(e.groupColorAlpha,c.uColor,0),this._adaptor.execute(this,e)}_rebuild(e){const s=this._getGpuDataForRenderable(e),i=this.renderer.graphicsContext.updateGpuContext(e.context);s.destroy(),i.isBatchable&&this._updateBatchesForRenderable(e,s)}_addToBatcher(e,s){const r=this.renderer.renderPipes.batch,i=this._getGpuDataForRenderable(e).batches;for(let a=0;a<i.length;a++){const c=i[a];r.addToBatch(c,s)}}_getGpuDataForRenderable(e){return e._gpuData[this.renderer.uid]||this._initGpuDataForRenderable(e)}_initGpuDataForRenderable(e){const s=new AP;return e._gpuData[this.renderer.uid]=s,this._managedGraphics.add(e),s}_updateBatchesForRenderable(e,s){const r=e.context,a=this.renderer.graphicsContext.getGpuContext(r),c=this.renderer._roundPixels|e._roundPixels;s.batches=a.batches.map(o=>{const h=ts.get(Af);return o.copyTo(h),h.renderable=e,h.roundPixels=c,h})}destroy(){this._managedGraphics.destroy(),this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null}}K0.extension={type:[Fe.WebGLPipes,Fe.WebGPUPipes],name:"graphics"};Mt.add(q0);Mt.add(K0);Mt.add(PP);Mt.add(Df);class yi extends zy{constructor(e){e instanceof bo&&(e={context:e});const{context:s,roundPixels:r,...i}=e||{};super({label:"Graphics",...i}),this.renderPipeId="graphics",s?this.context=s:(this.context=this._ownedContext=new bo,this.context.autoGarbageCollect=this.autoGarbageCollect),this.didViewUpdate=!0,this.allowChildren=!1,this.roundPixels=r??!1}set context(e){e!==this._context&&(this._context&&(this._context.off("update",this.onViewUpdate,this),this._context.off("unload",this.unload,this)),this._context=e,this._context.on("update",this.onViewUpdate,this),this._context.on("unload",this.unload,this),this.onViewUpdate())}get context(){return this._context}get bounds(){return this._context.bounds}updateBounds(){}containsPoint(e){return this._context.containsPoint(e)}destroy(e){var s,r;this._ownedContext&&!e?this._ownedContext.destroy(e):(e===!0||(e==null?void 0:e.context)===!0)&&this._context.destroy(e),(s=this._context)==null||s.off("update",this.onViewUpdate,this),(r=this._context)==null||r.off("unload",this.unload,this),this._ownedContext=null,this._context=null,super.destroy(e)}_onTouch(e){this._gcLastUsed=e,this._context._gcLastUsed=e}_callContextMethod(e,s){return this.context[e](...s),this}setFillStyle(...e){return this._callContextMethod("setFillStyle",e)}setStrokeStyle(...e){return this._callContextMethod("setStrokeStyle",e)}fill(...e){return this._callContextMethod("fill",e)}stroke(...e){return this._callContextMethod("stroke",e)}texture(...e){return this._callContextMethod("texture",e)}beginPath(){return this._callContextMethod("beginPath",[])}cut(){return this._callContextMethod("cut",[])}arc(...e){return this._callContextMethod("arc",e)}arcTo(...e){return this._callContextMethod("arcTo",e)}arcToSvg(...e){return this._callContextMethod("arcToSvg",e)}bezierCurveTo(...e){return this._callContextMethod("bezierCurveTo",e)}closePath(){return this._callContextMethod("closePath",[])}ellipse(...e){return this._callContextMethod("ellipse",e)}circle(...e){return this._callContextMethod("circle",e)}path(...e){return this._callContextMethod("path",e)}lineTo(...e){return this._callContextMethod("lineTo",e)}moveTo(...e){return this._callContextMethod("moveTo",e)}quadraticCurveTo(...e){return this._callContextMethod("quadraticCurveTo",e)}rect(...e){return this._callContextMethod("rect",e)}roundRect(...e){return this._callContextMethod("roundRect",e)}poly(...e){return this._callContextMethod("poly",e)}regularPoly(...e){return this._callContextMethod("regularPoly",e)}roundPoly(...e){return this._callContextMethod("roundPoly",e)}roundShape(...e){return this._callContextMethod("roundShape",e)}filletRect(...e){return this._callContextMethod("filletRect",e)}chamferRect(...e){return this._callContextMethod("chamferRect",e)}star(...e){return this._callContextMethod("star",e)}svg(...e){return this._callContextMethod("svg",e)}restore(...e){return this._callContextMethod("restore",e)}save(){return this._callContextMethod("save",[])}getTransform(){return this.context.getTransform()}resetTransform(){return this._callContextMethod("resetTransform",[])}rotateTransform(...e){return this._callContextMethod("rotate",e)}scaleTransform(...e){return this._callContextMethod("scale",e)}setTransform(...e){return this._callContextMethod("setTransform",e)}transform(...e){return this._callContextMethod("transform",e)}translateTransform(...e){return this._callContextMethod("translate",e)}clear(){return this._callContextMethod("clear",[])}get fillStyle(){return this._context.fillStyle}set fillStyle(e){this._context.fillStyle=e}get strokeStyle(){return this._context.strokeStyle}set strokeStyle(e){this._context.strokeStyle=e}clone(e=!1){return e?new yi(this._context.clone()):(this._ownedContext=null,new yi(this._context))}lineStyle(e,s,r){je(xt,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");const i={};return e&&(i.width=e),s&&(i.color=s),r&&(i.alpha=r),this.context.strokeStyle=i,this}beginFill(e,s){je(xt,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");const r={};return e!==void 0&&(r.color=e),s!==void 0&&(r.alpha=s),this.context.fillStyle=r,this}endFill(){je(xt,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();const e=this.context.strokeStyle;return(e.width!==bo.defaultStrokeStyle.width||e.color!==bo.defaultStrokeStyle.color||e.alpha!==bo.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...e){return je(xt,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",e)}drawEllipse(...e){return je(xt,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",e)}drawPolygon(...e){return je(xt,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",e)}drawRect(...e){return je(xt,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",e)}drawRoundedRect(...e){return je(xt,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",e)}drawStar(...e){return je(xt,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",e)}}Mt.add(fC,pC);function jf(t){let e=t;return()=>{e|=0,e=e+1831565813|0;let s=Math.imul(e^e>>>15,1|e);return s=s+Math.imul(s^s>>>7,61|s)^s,((s^s>>>14)>>>0)/4294967296}}const Tv=t=>{let e;const s=new Set,r=(u,f)=>{const d=typeof u=="function"?u(e):u;if(!Object.is(d,e)){const g=e;e=f??(typeof d!="object"||d===null)?d:Object.assign({},e,d),s.forEach(_=>_(e,g))}},i=()=>e,o={setState:r,getState:i,getInitialState:()=>h,subscribe:u=>(s.add(u),()=>s.delete(u))},h=e=t(r,i,o);return o},TP=(t=>t?Tv(t):Tv),RP=t=>t;function DP(t,e=RP){const s=ml.useSyncExternalStore(t.subscribe,ml.useCallback(()=>e(t.getState()),[t,e]),ml.useCallback(()=>e(t.getInitialState()),[t,e]));return ml.useDebugValue(s),s}const Rv=t=>{const e=TP(t),s=r=>DP(e,r);return Object.assign(s,e),s},If=(t=>t?Rv(t):Rv),vt={ink:"#241a2e",navy:"#1d2b53",blue:"#29adff",red:"#ff004d",orange:"#ffa300",green:"#00e436",lav:"#83769c",yellow:"#ffec27",pink:"#ff77a8",white:"#fff1e8"},Cn={working:{label:"Working",color:vt.blue,dim:"#1d6fb8"},"needs-input":{label:"Needs input",color:vt.red,dim:"#7e0f33"},"in-review":{label:"In review",color:vt.orange,dim:"#a86a00"},"review-passed":{label:"Review passed",color:vt.green,dim:"#00873a"},idle:{label:"Idle",color:vt.lav,dim:"#5a5170"}},Y0={pending:{label:"Queued",color:vt.lav,dim:"#5a5170"},reviewing:{label:"Reviewing",color:vt.orange,dim:"#a86a00"},"changes-requested":{label:"Changes",color:vt.red,dim:"#7e0f33"},passed:{label:"Passed",color:vt.green,dim:"#00873a"}},wi=["#ff77a8","#29adff","#ffd23a","#00e436","#ff8a3d","#a98bff","#3ee0d0","#ff5c5c","#c2c3c7","#b0e04a","#f0a6ff","#6fa8ff"];function nc(t,e){const s=parseInt(t.slice(1),16),r=o=>{const h=e>=0?o+(255-o)*e:o*(1+e);return Math.max(0,Math.min(255,Math.round(h)))},i=r(s>>16&255),a=r(s>>8&255),c=r(s&255);return`#${(i<<16|a<<8|c).toString(16).padStart(6,"0")}`}const X0={frameworks:[],tools:{}},Nf=[{id:"auth",label:"Auth",hint:"Sign-in and users"},{id:"payments",label:"Payments",hint:"Billing and subscriptions"},{id:"database",label:"Database",hint:"Data and branches"},{id:"analytics",label:"Analytics",hint:"Product analytics"},{id:"security",label:"Security",hint:"Bots, rate limits, prompt injection"}],cr=(t,e,s,r=[],i=!1)=>({id:t,name:e,category:"framework",docs:s,api:[],keys:[],skills:r,note:`${e} app`,verify:i}),id={source:"vercel-labs/agent-skills",skills:["vercel-react-best-practices","vercel-composition-patterns"]},Ac=[cr("nextjs","Next.js",["nextjs.org"],[{source:"vercel/next.js",skills:["next-dev-loop"]},id]),cr("react-vite","React (Vite)",["react.dev","vite.dev"],[id]),cr("express","Express",["expressjs.com"]),cr("hono","Hono",["hono.dev"]),cr("nestjs","NestJS",["docs.nestjs.com"]),cr("react-router","React Router",["reactrouter.com"],[id]),cr("astro","Astro",["docs.astro.build"]),cr("sveltekit","SvelteKit",["svelte.dev"]),cr("nuxt","Nuxt",["nuxt.com"]),{id:"clerk",name:"Clerk",category:"auth",docs:["clerk.com"],api:["api.clerk.com","*.clerk.accounts.dev"],keys:["NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY","CLERK_SECRET_KEY"],skills:[{source:"clerk/skills",skills:["clerk","clerk-setup","clerk-nextjs-patterns","clerk-react-patterns","clerk-custom-ui","clerk-backend-api","clerk-webhooks","clerk-orgs"]}],note:"Auth uses Clerk"},{id:"better-auth",name:"Better Auth",category:"auth",docs:["better-auth.com"],api:[],keys:["BETTER_AUTH_SECRET","BETTER_AUTH_URL"],skills:[],note:"Auth uses Better Auth (self-hosted)",verify:!0},{id:"auth0",name:"Auth0",category:"auth",docs:["auth0.com"],api:["*.auth0.com"],keys:["AUTH0_DOMAIN","AUTH0_CLIENT_ID","AUTH0_CLIENT_SECRET","AUTH0_SECRET"],skills:[],note:"Auth uses Auth0",verify:!0},{id:"supabase-auth",name:"Supabase Auth",category:"auth",docs:["supabase.com"],api:["*.supabase.co"],keys:["NEXT_PUBLIC_SUPABASE_URL","NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY"],skills:[{source:"supabase/agent-skills",skills:["supabase"]}],note:"Auth uses Supabase Auth",verify:!0},{id:"clerk-billing",name:"Clerk Billing",category:"payments",docs:["clerk.com"],api:["api.clerk.com"],keys:["CLERK_SECRET_KEY"],skills:[{source:"clerk/skills",skills:["clerk-billing","clerk-setup"]}],note:"Subscriptions use Clerk Billing"},{id:"stripe",name:"Stripe",category:"payments",docs:["docs.stripe.com"],api:["api.stripe.com"],keys:["STRIPE_SECRET_KEY","STRIPE_WEBHOOK_SECRET","NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY"],skills:[{source:"stripe/ai",skills:["stripe-best-practices","stripe-docs"]}],mcp:"https://mcp.stripe.com",note:"Payments use Stripe (test mode)"},{id:"polar",name:"Polar",category:"payments",docs:["docs.polar.sh"],api:["api.polar.sh","sandbox-api.polar.sh"],keys:["POLAR_ACCESS_TOKEN","POLAR_WEBHOOK_SECRET"],skills:[],note:"Payments use Polar (sandbox)",verify:!0},{id:"instacloud",name:"InstaCloud",category:"database",docs:["instacloud.com","agents.instacloud.com"],api:["api.instacloud.com"],keys:["DATABASE_URL"],skills:[{source:"InsForge/instacloud-skills",skills:["insta"]}],mcp:"https://mcp.instacloud.com/mcp",note:"Database and branch environments use InstaCloud (the insta CLI)"},{id:"neon",name:"Neon",category:"database",docs:["neon.com"],api:["console.neon.tech","*.neon.tech"],keys:["DATABASE_URL"],skills:[],note:"Database is Neon Postgres",verify:!0},{id:"supabase",name:"Supabase",category:"database",docs:["supabase.com"],api:["*.supabase.co"],keys:["NEXT_PUBLIC_SUPABASE_URL","NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY","SUPABASE_SECRET_KEY","DATABASE_URL"],skills:[{source:"supabase/agent-skills",skills:["supabase","supabase-postgres-best-practices"]}],mcp:"https://mcp.supabase.com/mcp",mcpParam:{name:"project_ref",hint:"Tip: add ?project_ref=<id> to limit it to one project (Project Settings → General). Without it, the agent can reach every project in your account."},note:"Database is Supabase Postgres",verify:!0},{id:"prisma-postgres",name:"Prisma Postgres",category:"database",docs:["prisma.io"],api:["db.prisma.io"],keys:["DATABASE_URL"],skills:[],note:"Database is Prisma Postgres with Prisma ORM",verify:!0},{id:"posthog",name:"PostHog",category:"analytics",docs:["posthog.com"],api:["us.i.posthog.com","eu.i.posthog.com","us-assets.i.posthog.com"],keys:["NEXT_PUBLIC_POSTHOG_KEY","NEXT_PUBLIC_POSTHOG_HOST"],skills:[{source:"PostHog/skills",skills:["instrument-integration","instrument-product-analytics","instrument-llm-analytics"]}],mcp:"https://mcp.posthog.com",note:"Analytics use PostHog"},{id:"plausible",name:"Plausible",category:"analytics",docs:["plausible.io"],api:["plausible.io"],keys:[],skills:[],note:"Analytics use Plausible",verify:!0},{id:"vercel-analytics",name:"Vercel Analytics",category:"analytics",docs:["vercel.com"],api:[],keys:[],skills:[],note:"Analytics use Vercel Web Analytics",verify:!0},{id:"arcjet",name:"Arcjet",category:"security",docs:["docs.arcjet.com"],api:["decide.arcjet.com"],keys:["ARCJET_KEY"],skills:[{source:"arcjet/skills",skills:["arcjet"]}],note:"Bot protection, rate limiting and prompt-injection checks use Arcjet"},{id:"upstash-ratelimit",name:"Upstash Ratelimit",category:"security",docs:["upstash.com"],api:["*.upstash.io"],keys:["UPSTASH_REDIS_REST_URL","UPSTASH_REDIS_REST_TOKEN"],skills:[],note:"Rate limiting uses Upstash Ratelimit",verify:!0}],ea=t=>Ac.find(e=>e.id===t),Q0=()=>Ac.filter(t=>t.category==="framework"),Z0=t=>Ac.filter(e=>e.category===t);function Of(t){if(!t)return[];const e=[...t.frameworks.map(s=>s.id),...Object.values(t.tools).map(s=>s==null?void 0:s.id)];return[...new Set(e)].flatMap(s=>s?[ea(s)].filter(r=>!!r):[])}const LP=t=>{try{return t?new URL(/^https?:\/\//.test(t)?t:`https://${t}`).hostname:null}catch{return null}};function J0(t){if(!t)return[];const e=new Map,s=(r,i)=>e.set(r,(e.get(r)??new Set).add(i));for(const r of Of(t))for(const i of[...r.docs,...r.api])s(i,r.name);for(const r of[...t.frameworks,...Object.values(t.tools)]){const i=(r==null?void 0:r.id)==="other"?LP(r.docsUrl):null;i&&s(i,(r==null?void 0:r.name)||"Other")}return[...e].map(([r,i])=>({domain:r,for:[...i]}))}function BP(t){const e=new Set;return Of(t).flatMap(s=>s.keys.filter(r=>!e.has(r)&&e.add(r)).map(r=>({key:r,for:s.name})))}const Dv=t=>{var e;return t.id==="other"?t.name||"Other":((e=ea(t.id))==null?void 0:e.name)??t.id};function jP(t){if(!t||!t.frameworks.length&&!Object.values(t.tools).some(Boolean))return"";const e=["## Stack"];for(const s of t.frameworks)e.push(`- ${Dv(s)}${s.where?` in \`${s.where}\``:""}${s.id==="other"&&s.docsUrl?` (docs: ${s.docsUrl})`:""}`);for(const s of Nf){const r=t.tools[s.id];if(!r)continue;const i=ea(r.id),a=r.id==="other"?r.docsUrl:i==null?void 0:i.docs[0];e.push(`- ${i?i.note:`${s.label}: ${Dv(r)}`}${a?` (docs: ${a})`:""}`)}return e.push("","Use the installed agent skills for these tools before writing integration code, and follow their current docs rather than memory.","Secrets come from environment variables; never hard-code or commit them."),e.join(`
280
+ `)}const Lv=["anthropic","openai","github","google","groq","mistral","openrouter","xai","nebius","copilot","cursor","devin","droid"],Pi={claude:"Claude Code",codex:"Codex"},IP="you",Ls="shell:@host",NP=(t={})=>({resources:{cpus:null,memoryGb:null},allow:["registry.npmjs.org"],deny:[],...t});function bs(t,e,s,r,i={}){const a=i.isLead??!1;return{id:t,name:e,role:s,isLead:a,cli:"claude",model:a?"Opus":"Sonnet",mode:"sandbox",color:r,skills:a?["plan","review","honest"]:["plan","debug","review"],roleMd:a?`# ${e} — Lead
281
+
282
+ You plan and assign work. You never write app code.
283
+ Use the HQ Team MCP: list_workers, get_status, assign_task, send_message.`:`# ${e} — ${s}
284
+
285
+ You build the tasks assigned to you. One task = one branch = one PR.
286
+ Only edit the files your task file allows.`,sandbox:NP(a?{}:{allow:["registry.npmjs.org","console.instacloud.com"]}),workspacePath:null,...i}}function Gl(t,e,s){return e.map(([r,i],a)=>({id:`${t}-T${String(a+1).padStart(2,"0")}`,boardId:t,title:r,ownerId:i,status:"done",needs:[],prNumber:s+a}))}const e1={id:"askwell",label:"Askwell · 3 agents",config:{project:{id:"askwell",name:"Askwell",repo:"jsmastery-pro/askwell",path:"~/developer/askwell",hqPort:7420},team:[bs("michael","Michael","Lead","#ff77a8",{isLead:!0}),bs("dwight","Dwight","Developer","#29adff"),bs("jim","Jim","Developer","#ffd23a")],workflow:{review:{enabled:!0,tool:"coderabbit",command:""},merge:{by:"human"},deploy:{enabled:!0,tool:"instacloud",command:"",perAgentEnvironments:!0}}},boards:[{id:"P0",title:"Phase 0 — Setup",status:"done",order:0},{id:"P1",title:"Phase 1 — Foundation",status:"done",order:1},{id:"P2",title:"Phase 2 — Projects + widget",status:"done",order:2},{id:"P3",title:"Phase 3 — Knowledge + chat",status:"active",order:3},{id:"P4",title:"Phase 4 — Conversations + analytics",status:"planned",order:4},{id:"P5",title:"Phase 5 — Billing + customize",status:"planned",order:5},{id:"P6",title:"Phase 6 — Harden + launch",status:"planned",order:6}],tasks:[...Gl("P0",[["Repo + CI","dwight"],["Shared contract","jim"]],1),...Gl("P1",[["Auth with Clerk","dwight"],["Database schema","jim"],["App shell","dwight"]],3),...Gl("P2",[["Projects CRUD","jim"],["Widget script tag","dwight"],["Widget bubble UI","jim"],["Embed settings","dwight"],["PostHog events","jim"]],6),{id:"P3-T01",boardId:"P3",title:"Knowledge upload",ownerId:"jim",status:"todo",needs:[],prNumber:null},{id:"P3-T02",boardId:"P3",title:"Chat route",ownerId:"dwight",status:"todo",needs:[],prNumber:null},{id:"P3-T03",boardId:"P3",title:"PDF text extraction",ownerId:"jim",status:"todo",needs:[],prNumber:null},{id:"P3-T04",boardId:"P3",title:"Rate limit",ownerId:"dwight",status:"todo",needs:[],prNumber:null},{id:"P3-T05",boardId:"P3",title:"Connect panel to chat",ownerId:"dwight",status:"todo",needs:["P3-T02"],prNumber:null},{id:"P4-T01",boardId:"P4",title:"Conversation list",ownerId:null,status:"todo",needs:[],prNumber:null},{id:"P4-T02",boardId:"P4",title:"Cost per reply chart",ownerId:null,status:"todo",needs:[],prNumber:null}],mergedPrs:12,taskPool:["Answer feedback","Retry failed embeds","Answer caching","Source previews","Streaming answers","Citations UI","Multi-file upload","Embeddings backfill","Health checks","Prompt templates"],questions:["Max PDF size: 10 MB or 20 MB?","Use pgvector or a hosted vector DB?","OK to add a dependency: pdf-parse?","Stream tokens over SSE or WebSockets?","Run the migration on my DB branch?"],leadQuestions:["Approve the Phase 4 breakdown?","Merge #{pr} before the other open PRs?"]},OP={id:"big-team",label:"Shipyard · 7 agents",config:{project:{id:"shipyard",name:"Shipyard",repo:"jsmastery-pro/shipyard",path:"~/developer/shipyard",hqPort:7420},team:[bs("maya","Maya","Lead","#ff77a8",{isLead:!0}),bs("dwight","Dwight","Developer","#29adff"),bs("jim","Jim","Developer","#ffd23a"),bs("kenji","Kenji","Developer","#00e436",{cli:"codex",model:""}),bs("priya","Priya","QA","#a98bff",{skills:["test","review"]}),bs("leo","Leo","Designer","#ff8a3d",{skills:["frontend-design","review"]}),bs("sam","Sam","Docs","#3ee0d0",{model:"Haiku",skills:["document"]})],workflow:{review:{enabled:!0,tool:"greptile",command:""},merge:{by:"lead"},deploy:{enabled:!0,tool:"vercel",command:"",perAgentEnvironments:!1}}},boards:[{id:"WEB",title:"Web app",status:"active",order:0},{id:"API",title:"API",status:"active",order:1},{id:"OPS",title:"Infra + release",status:"planned",order:2}],tasks:[...Gl("WEB",[["Marketing page","leo"],["Sign-in","dwight"]],1),{id:"WEB-T03",boardId:"WEB",title:"Fleet dashboard",ownerId:"jim",status:"todo",needs:[],prNumber:null},{id:"WEB-T04",boardId:"WEB",title:"Vessel detail page",ownerId:"leo",status:"todo",needs:[],prNumber:null},{id:"WEB-T05",boardId:"WEB",title:"E2E: booking flow",ownerId:"priya",status:"todo",needs:[],prNumber:null},{id:"WEB-T06",boardId:"WEB",title:"Getting started guide",ownerId:"sam",status:"todo",needs:[],prNumber:null},{id:"API-T01",boardId:"API",title:"Bookings endpoint",ownerId:"kenji",status:"todo",needs:[],prNumber:null},{id:"API-T02",boardId:"API",title:"Webhooks",ownerId:"dwight",status:"todo",needs:[],prNumber:null},{id:"API-T03",boardId:"API",title:"Rate limiting",ownerId:null,status:"todo",needs:[],prNumber:null}],mergedPrs:2,taskPool:["Port schedule view","Invoice export","Crew roster","Search filters","Audit log","API docs","Accessibility pass","Load test","Error pages","Onboarding emails"],questions:["Paginate with cursors or offsets?","Is dark mode in scope for this page?","Snapshot tests or visual diff?","Document the beta endpoints too?"],leadQuestions:["Move Rate limiting to the OPS board?"]},FP={id:"duo",label:"Notely · 2 agents",config:{project:{id:"notely",name:"Notely",repo:"you/notely",path:"~/code/notely",hqPort:7420},team:[bs("ada","Ada","Lead","#a98bff",{isLead:!0,model:"Sonnet"}),bs("max","Max","Developer","#29adff")],workflow:{review:{enabled:!0,tool:"human",command:""},merge:{by:"human"},deploy:{enabled:!1,tool:"custom",command:"",perAgentEnvironments:!1}}},boards:[{id:"MVP",title:"MVP",status:"active",order:0}],tasks:[{id:"MVP-T01",boardId:"MVP",title:"Markdown editor",ownerId:"max",status:"todo",needs:[],prNumber:null},{id:"MVP-T02",boardId:"MVP",title:"Local storage sync",ownerId:"max",status:"todo",needs:["MVP-T01"],prNumber:null}],mergedPrs:0,taskPool:["Tags","Search","Export to PDF","Keyboard shortcuts","Themes"],questions:["Store notes in IndexedDB or localStorage?"],leadQuestions:["Ship the MVP with search, or cut it?"]},nd=[e1,OP,FP],$P=e1.id,Ff=t=>`\x1B[${t}m`,Vs=t=>{const e=parseInt(t.slice(1),16);return Ff(`38;2;${e>>16&255};${e>>8&255};${e&255}`)},tt=Ff("0"),$f=Ff("1"),We={tool:Vs("#00e436"),out:Vs("#8d99c4"),ok:Vs("#6cf08a"),err:Vs("#ff5c86"),warn:Vs("#ffc14d"),think:Vs("#c9b6ff"),say:Vs("#dfe6ff"),dim:Vs("#66729f"),pink:Vs("#ff77a8"),yellow:Vs("#ffec27")},yt=(t,e)=>({text:`${We.tool}●${tt} ${$f}${t}${tt}(${e})`}),dt=(t,e=We.out)=>({text:` ${We.dim}└${tt} ${e}${t}${tt}`}),xn=t=>({text:`${We.think}✻ ${t}${tt}`,typed:!0}),oc=t=>({text:`${We.say}${t}${tt}`,typed:!0}),ta={text:""},kn=t=>t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,""),ac=(t,e)=>t[Math.abs(e)%t.length];function t1(t,e,s,r){return[{text:`${We.pink}╭──────────────────────────────────────────╮${tt}`},{text:`${We.pink}│${tt} ${$f}✻ Claude Code${tt} ${We.dim}${t} · ${e}${tt}`},{text:`${We.pink}│${tt} ${We.dim}${s} · ${r==="sandbox"?"docker sandbox (microVM)":"local worktree"}${tt}`},{text:`${We.pink}╰──────────────────────────────────────────╯${tt}`},ta]}function HP(t,e,s){const r=kn(e);return[{text:`${We.yellow}> Pull main, start ${t}${tt}`},ta,yt("Bash","git pull origin main"),dt("Already up to date."),yt("Bash",`git checkout -b ${t.toLowerCase()}-${r}`),dt(`Switched to a new branch '${t.toLowerCase()}-${r}'`),yt("Read",`docs/tasks/${t}.md`),dt(`Read ${30+s%40} lines`),xn(`${e}: read the allowed files first, then write the tests.`)]}const UP=["route.ts","schema.ts","handler.ts","index.tsx","service.ts","utils.ts"];function WP(t,e){const s=kn(t),r=`src/${s}/${ac(UP,e)}`,i=6+e%30,a=[[yt("Read",r),dt(`Read ${40+e%90} lines`),xn("The contract already exports the type I need.")],[yt("Update",r),dt(`Updated with ${i} additions and ${e%7} removals`,We.ok)],[yt("Write",`src/${s}/${s}.test.ts`),dt(`Wrote ${20+e%40} lines`,We.ok),xn("Covering the error path too.")],[yt("Bash",`pnpm test ${s}`),dt(`✓ ${4+e%12} passed (${(.6+e%9/10).toFixed(1)}s)`,We.ok)],[yt("Bash","pnpm typecheck"),dt("No errors",We.ok)],[yt("Grep",`"${s.split("-")[0]}" in src/`),dt(`${2+e%6} matches`)]];return ac(a,e)}function zP(t){return[ta,{text:`${We.err}? ${$f}Needs your input:${tt} ${We.say}${t}${tt}`},{text:`${We.dim} (type your answer and press Enter)${tt}`}]}function VP(t){return[{text:`${We.ok}✓ Answer received${t?` from ${t}`:""}. Continuing.${tt}`}]}function GP(t,e,s,r,i){return[yt("Bash","git push -u origin HEAD"),dt("Branch pushed."),yt("Bash",`gh pr create --title "[${e}] ${s}"`),dt(`https://github.com/${r}/pull/${t}`,We.ok),oc(i?`Opened PR #${t}. Waiting for ${i}.`:`Opened PR #${t}.`)]}function qP(t,e,s){return[ta,{text:`${We.warn}! ${s} requested changes on #${t} (${e.length} comments)${tt}`},...e.map(r=>dt(r,We.warn)),xn("Fixing the review comments on my own PR.")]}function KP(t){return[yt("Bash","git commit -am 'Address review comments'"),dt("1 commit"),yt("Bash","git push"),dt(`Updated #${t}`,We.ok)]}function YP(t,e,s){return[{text:`${We.ok}✓ ${e} approved #${t}. Waiting for ${s} to merge.${tt}`}]}function XP(t){return[{text:`${We.ok}✓ #${t} merged into main.${tt}`},ta,oc("Done. Free for the next task.")]}function Bv(t,e,s,r){return r?[{text:`${We.pink}✉ ${t}:${tt} ${We.say}${s}${tt}`}]:[yt("hq.send_message",`to: "${e}"`),dt(`"${s}"`)]}function QP(t,e){const s=[[yt("hq.get_status",""),dt("All workers reporting."),xn(`Checking what is left on ${t}.`)],[yt("Read","docs/plan.md"),dt(`Read ${80+e%60} lines`),xn("Ordering tasks so nobody waits on a contract change.")],[yt("hq.list_workers",""),dt("Workers listed.")]];return ac(s,e)}function ZP(t,e,s){return[yt("hq.assign_task",`"${t}", to: "${s}"`),dt(`Sent to ${s}: Pull main, start ${t} (${e})`,We.ok)]}function JP(t,e){return[yt("Write",`docs/tasks/${t}.md`),dt(`Created task: ${e}`,We.ok)]}const eM=["Got it. I'll take that into account.","Understood. Adjusting the plan.","On it.","Good call. Updating the task file."];function jv(t,e){return t?[oc(e%2?"Got it. I'll reassign the next free task.":"Noted. I'll keep that in the plan.")]:[oc(ac(eM,e))]}const Iv=["Missing error handling for empty input","Add a test for the 413 path","Avoid the N+1 query in loadChunks()","Validate the request body","Handle the abort signal when streaming","This type should come from the shared contract"],Nv=[["I changed the shared contract, pull main before you push.","Thanks, pulling now."],["Are you touching src/lib/db.ts? I need one export there.","No, it's yours."],["Heads up: the test DB seed changed.","Got it, re-seeding."],["Can I reuse your error helper?","Yes, it's in the contract."]];class Ov{constructor(e){ge(this,"jobs",new Map);ge(this,"seed",1);this.w=e}r(e,s){return e+this.w.rand()*(s-e)}s(){return this.seed+=7,this.seed}start(){const e=this.w;e.syncEnvironments();for(const s of e.snap.config.team)e.write(s.id,t1(s.name,s.role,e.snap.config.project.repo,s.mode));this.startLead(.5),e.workers().forEach((s,r)=>this.startWorker(s.id,1.5+r*2.2))}startLead(e){const s=this.w.lead(),r=this.w.activeBoards()[0];this.w.after(e,()=>{this.w.setStatus(s.id,{state:"working",note:r?`Planning ${r.title}`:"Planning"}),this.leadLoop()},s.id),this.w.after(e+35,()=>this.leadAsk(),s.id)}startWorker(e,s){this.w.after(s,()=>this.needWork(e),e)}stopAgent(e){this.w.cancel(e),this.jobs.delete(e)}tick(e){const s=this.w;for(const[r,i]of this.jobs){const a=s.status(r);if(!a||a.state!=="working")continue;i.left-=e,i.nextChunk-=e;const c=s.task(i.taskId);i.nextChunk<=0&&c&&(i.nextChunk=this.r(2.5,4),s.write(r,WP(c.title,this.s())),s.rand()<.12&&this.chatter(r)),i.inputAt!==null&&i.left<=i.inputAt?(i.inputAt=null,this.ask(r,s.preset.questions[Math.floor(s.rand()*s.preset.questions.length)]??"Which approach do you prefer?")):i.left<=0&&(i.phase==="build"?this.openPr(r,i):this.pushFix(r,i))}}leadLoop(){var i;const e=this.w,s=e.lead(),r=e.activeBoards()[0];if(((i=e.status(s.id))==null?void 0:i.state)==="working"){e.write(s.id,QP((r==null?void 0:r.title)??"the plan",this.s()));const a=[r?`Planning ${r.title}`:"Planning","Checking merge order","Reading open PRs","Writing task files"];e.setStatus(s.id,{note:a[Math.floor(e.rand()*a.length)]})}this.topUp(),e.after(this.r(8,14),()=>this.leadLoop(),s.id)}leadAsk(){var c;const e=this.w,s=e.lead(),r=e.preset.leadQuestions,i=e.snap.pullRequests.find(o=>!o.merged),a=(r[Math.floor(e.rand()*r.length)]??"Approve the plan?").replace("{pr}",String((i==null?void 0:i.number)??e.nextPr));((c=e.status(s.id))==null?void 0:c.state)==="working"&&this.ask(s.id,a),e.after(this.r(60,80),()=>this.leadAsk(),s.id)}topUp(){const e=this.w,s=e.activeBoards();if(!s.length||e.snap.tasks.filter(c=>c.status==="todo"&&c.ownerId===null&&s.some(o=>o.id===c.boardId)&&c.needs.every(o=>{var h;return((h=e.task(o))==null?void 0:h.status)==="done"})).length>0)return;const i=s.reduce((c,o)=>e.snap.tasks.filter(h=>h.boardId===o.id&&h.status==="todo").length<e.snap.tasks.filter(h=>h.boardId===c.id&&h.status==="todo").length?o:c),a=e.lead();for(let c=0;c<2;c++){const o=e.snap.tasks.filter(d=>d.boardId===i.id).length+1,h=e.preset.taskPool,u=h[(o+c*3)%h.length]??`Task ${o}`,f={id:`${i.id}-T${String(o).padStart(2,"0")}`,boardId:i.id,title:u,ownerId:null,status:"todo",needs:[],prNumber:null};e.putTask(f),e.write(a.id,JP(f.id,u)),e.activity("task.created",a.id,`${a.name} added ${f.id} ${u} to ${i.title}`)}}nextTaskFor(e){const s=this.w,r=new Set(s.activeBoards().map(a=>a.id)),i=a=>a.status==="todo"&&r.has(a.boardId)&&a.needs.every(c=>{var o;return((o=s.task(c))==null?void 0:o.status)==="done"});return s.snap.tasks.find(a=>i(a)&&a.ownerId===e)??s.snap.tasks.find(a=>i(a)&&a.ownerId===null)}needWork(e){const s=this.w;if(!s.cfg(e)||this.jobs.has(e))return;const r=this.nextTaskFor(e);if(!r){this.topUp(),s.after(4,()=>this.needWork(e),e);return}const i=s.lead();s.patchTask(r.id,{ownerId:e}),s.write(i.id,ZP(r.id,r.title,s.name(e))),s.activity("task.assigned",i.id,`${i.name} assigned ${r.id} ${r.title} to ${s.name(e)}`),s.message(i.id,e,`Pull main, start ${r.id}.`),s.after(1.5,()=>this.begin(e,r.id),e)}begin(e,s){const r=this.w,i=r.task(s);if(!i||!r.cfg(e))return;r.cancel(e),r.patchTask(s,{ownerId:e,status:"in-progress"}),r.setStatus(e,{state:"working",currentTaskId:s,note:null}),r.activity("task.started",e,`${r.name(e)} started ${s} ${i.title}`),r.write(e,HP(s,i.title,this.s()));const a=this.r(10,18);this.jobs.set(e,{taskId:s,phase:"build",left:a,inputAt:r.rand()<.35?a*.55:null,nextChunk:2,prNumber:null})}ask(e,s){const r=this.w;r.setStatus(e,{state:"needs-input",note:`Asking: ${s}`}),r.activity("agent.needs-input",e,`${r.name(e)} needs you: ${s}`),r.write(e,zP(s)),r.after(this.r(7,9),()=>this.answer(e,"you"),e)}answer(e,s){var i,a;const r=this.w;((i=r.status(e))==null?void 0:i.state)==="needs-input"&&(r.setStatus(e,{state:"working",note:(a=r.cfg(e))!=null&&a.isLead?"Planning":null}),r.activity("agent.answered",e,`${s==="you"?"You":s} answered ${r.name(e)}`),r.write(e,VP(s==="you"?"":s)))}chatter(e){const s=this.w,r=s.workers().filter(o=>o.id!==e);if(!r.length)return;const i=r[Math.floor(s.rand()*r.length)],[a,c]=Nv[Math.floor(s.rand()*Nv.length)];s.message(e,i.id,a),s.after(this.r(2.5,4),()=>s.cfg(i.id)&&s.cfg(e)&&s.message(i.id,e,c),i.id)}openPr(e,s){const r=this.w,i=r.task(s.taskId);if(!i)return void this.jobs.delete(e);const a=r.snap.config.workflow,c=r.nextPr++;s.prNumber=c,r.patchTask(i.id,{status:"in-review",prNumber:c}),r.putPr({number:c,title:`[${i.id}] ${i.title}`,taskId:i.id,authorId:e,review:a.review.enabled?"pending":"passed",openComments:0,mergeable:!a.review.enabled,merged:!1,openedAt:new Date().toISOString()}),r.write(e,GP(c,i.id,i.title,r.snap.config.project.repo,a.review.enabled?r.reviewerLabel():null)),r.activity("pr.opened",e,`${r.name(e)} opened PR #${c} ${i.title}`),a.deploy.enabled&&a.deploy.perAgentEnvironments&&r.deploy(e),a.review.enabled?(r.setStatus(e,{state:"in-review",note:`Waiting for ${r.reviewerLabel()}`}),r.after(4,()=>this.review(e,c),e)):(r.setStatus(e,{state:"review-passed",note:`Waiting for ${r.mergerLabel()} to merge`}),r.after(3,()=>this.merge(e,c),e))}review(e,s){const r=this.w;r.patchPr(s,{review:"reviewing"}),r.activity("review.started",null,`${r.reviewerLabel()} is reviewing #${s}`),r.after(this.r(6,8),()=>this.verdict(e,s),e)}verdict(e,s){const r=this.w,i=this.jobs.get(e);if(!r.pr(s)||!i)return;const c=r.reviewerLabel();if(i.phase==="build"&&r.rand()<.4){const o=1+Math.floor(r.rand()*3),h=Array.from({length:o},(u,f)=>Iv[(s+f*2)%Iv.length]);r.patchPr(s,{review:"changes-requested",openComments:o,mergeable:!1}),r.activity("review.changes",e,`${c} left ${o} comment${o>1?"s":""} on #${s}`),r.write(e,qP(s,h,c)),Object.assign(i,{phase:"fix",left:this.r(6,8),inputAt:null,nextChunk:1.5}),r.setStatus(e,{state:"working",note:"Fixing review comments"});return}r.patchPr(s,{review:"passed",openComments:0,mergeable:!0}),r.activity("review.passed",e,`${c} approved #${s}`),r.write(e,YP(s,c,r.mergerLabel())),r.setStatus(e,{state:"review-passed",note:`Waiting for ${r.mergerLabel()} to merge`}),r.after(4,()=>this.merge(e,s),e)}pushFix(e,s){const r=this.w;if(s.prNumber===null)return;const i=s.prNumber;s.left=1/0,r.write(e,KP(i)),r.setStatus(e,{state:"in-review",note:`Waiting for ${r.reviewerLabel()}`}),r.after(2,()=>this.review(e,i),e)}merge(e,s){var o;const r=this.w,i=r.pr(s);if(!i||i.merged)return;const a=r.snap.config.workflow,c=r.lead();if(r.patchPr(s,{merged:!0,mergeable:!0}),r.patchTask(i.taskId,{status:"done"}),this.pruneDone((o=r.task(i.taskId))==null?void 0:o.boardId),a.merge.by==="lead"&&r.write(c.id,[{text:`\x1B[38;2;0;228;54m●\x1B[0m gh pr merge ${s} --squash`}]),r.activity("pr.merged",a.merge.by==="lead"?c.id:null,`${a.merge.by==="lead"?c.name:"You"} merged #${s}`),r.write(e,XP(s)),a.deploy.enabled){r.deploy("main");const h={instacloud:"InstaCloud",vercel:"Vercel",custom:"custom deploy"}[a.deploy.tool];r.after(3,()=>r.activity("deploy",null,`Deployed main to ${h}`))}this.jobs.delete(e),r.cfg(e)&&(r.setStatus(e,{state:"idle",currentTaskId:null,note:"Coffee break"}),r.after(this.r(3,6),()=>this.needWork(e),e))}pruneDone(e){const s=this.w,r=s.snap.tasks.filter(i=>i.boardId===e&&i.status==="done");for(const i of r.slice(0,Math.max(0,r.length-30)))s.snap.tasks=s.snap.tasks.filter(a=>a.id!==i.id),s.emit({type:"task.removed",taskId:i.id})}workflowChanged(){const e=this.w;if(!e.snap.config.workflow.review.enabled)for(const s of e.snap.pullRequests){if(s.merged||s.review==="passed")continue;e.patchPr(s.number,{review:"passed",openComments:0,mergeable:!0});const r=this.jobs.get(s.authorId);r&&(r.left=1/0),e.setStatus(s.authorId,{state:"review-passed",note:`Waiting for ${e.mergerLabel()} to merge`}),e.after(3,()=>this.merge(s.authorId,s.number),s.authorId)}}hasJob(e){return this.jobs.has(e)}}const hr=()=>new Date().toISOString();function s1(){const t=(e,s,r,i)=>({id:e,label:s,status:"ok",detail:r,neededFor:i,fix:null});return{machine:{cpus:8,memoryGb:16},checks:[t("os","Supported machine","macOS · Apple silicon (mock)","sandbox"),t("sbx","Docker Sandboxes (sbx)","v0.47.0 (mock)","sandbox"),t("sbx-login","Signed in to Docker","signed in (mock)","sandbox"),t("sbx-policy","Sandbox network policy","Balanced (mock)","sandbox"),t("tmux","tmux","3.5a (mock)","all"),t("claude","Claude Code","installed (mock)","local"),t("gh","GitHub CLI","signed in (mock)","github")],sandboxReady:!0,localReady:!0,checkedAt:hr()}}function r1(t,e){var r;const s={};for(const i of t){let a=0;const c=(o,h,u="hq")=>({id:`${i.id}-${++a}`,decision:o,resources:[h],source:u});s[i.id]={rules:[c("allow","api.anthropic.com","kit"),...i.sandbox.allow.map(o=>c("allow",o)),...i.sandbox.deny.map(o=>c("deny",o))],keys:i.isLead?[]:["openai"],envFile:{path:`~/.jsmhq/${kn(e)}/${i.id}.env`,exists:!i.isLead},syncError:null,approvals:!i.isLead&&((r=t.filter(o=>!o.isLead)[0])==null?void 0:r.id)===i.id?["mcp.notion.com:443","mcp.figma.com:443","docs.arcjet.com:443"].map((o,h)=>({id:`network:demo-${i.id}-${h}`,host:o,detail:"no matching allow rule (default deny)"})):[]}}return{basePolicy:"balanced",proxy:null,globalKeys:["anthropic","github"],agents:s,checkedAt:hr()}}function i1(t,e){return{state:"running",detail:null,workspace:`~/.jsmhq/${kn(t)}/${e}`,sandbox:{cpus:8,memoryGb:8}}}class lc{constructor(e){ge(this,"snap");ge(this,"preset");ge(this,"simTime",0);ge(this,"speed",1);ge(this,"rand",jf(7));ge(this,"nextPr");ge(this,"seq",0);ge(this,"timers",[]);ge(this,"term",new Map);ge(this,"emitFn",null);this.preset=e,this.snap=lc.initialSnapshot(e),this.nextPr=e.mergedPrs+1}static initialSnapshot(e){const s=structuredClone(e.config),r=structuredClone(e.tasks),i=s.team.filter(c=>!c.isLead),a=r.filter(c=>c.prNumber!==null).map(c=>{var o;return{number:c.prNumber,title:`[${c.id}] ${c.title}`,taskId:c.id,authorId:c.ownerId??((o=i[0])==null?void 0:o.id)??"",review:"passed",openComments:0,mergeable:!0,merged:!0,openedAt:new Date(Date.now()-(e.mergedPrs-c.prNumber+1)*36e5).toISOString()}});return{setup:s1(),sbx:r1(s.team,s.project.name),config:s,agents:s.team.map(c=>({agentId:c.id,state:"idle",currentTaskId:null,stateSince:hr(),note:null,session:i1(s.project.name,c.id)})),boards:structuredClone(e.boards),tasks:r,pullRequests:a,environments:[],messages:[],activity:[],actionItems:e.config.team.filter(c=>!c.isLead).slice(0,2).map((c,o)=>({id:`ai-demo-${o}`,fromId:c.id,taskId:null,title:o===0?"Create a Supabase dev project and add its URL to my env file":"Add the Clerk webhook secret to Vercel (Preview)",details:o===0?`1. Create a project at supabase.com (dev only).
287
+ 2. Settings → Sandbox → App variables for `+c.name+`:
288
+ NEXT_PUBLIC_SUPABASE_URL=<project URL>
289
+ NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=<publishable key>
290
+ 3. Restart me.`:"Vercel → Project → Settings → Environment Variables → add CLERK_WEBHOOK_SIGNING_SECRET for Preview.",waiting:o===0,status:"open",note:null,at:hr(),closedAt:null})),mcp:{servers:[{name:"supabase-dev",transport:"remote http",status:"ready",nextStep:null},{name:"stripe",transport:"remote http",status:"needs-auth",nextStep:"sbx mcp auth stripe"},{name:"trigger",transport:"local stdio",status:"ready",nextStep:null}],attached:{},error:null,checkedAt:hr()}}}setEmitter(e){this.emitFn=e}emit(e){var s;(s=this.emitFn)==null||s.call(this,e)}id(e){return this.seq+=1,`${e}${this.seq}`}after(e,s,r=null){this.timers.push({at:this.simTime+e,fn:s,owner:r})}cancel(e){this.timers=this.timers.filter(s=>s.owner!==e)}clearTimers(){this.timers=[],this.term.clear()}advance(e){this.simTime+=e;const s=this.timers.filter(r=>r.at<=this.simTime).sort((r,i)=>r.at-i.at);if(s.length){this.timers=this.timers.filter(r=>r.at>this.simTime);for(const r of s)r.fn()}}cfg(e){return this.snap.config.team.find(s=>s.id===e)}status(e){return this.snap.agents.find(s=>s.agentId===e)}lead(){return this.snap.config.team.find(e=>e.isLead)??this.snap.config.team[0]}workers(){return this.snap.config.team.filter(e=>!e.isLead)}name(e){var s;return e==="you"?"You":e&&((s=this.cfg(e))==null?void 0:s.name)||"Someone"}task(e){return this.snap.tasks.find(s=>s.id===e)}pr(e){return this.snap.pullRequests.find(s=>s.number===e)}activeBoards(){return this.snap.boards.filter(e=>e.status==="active").sort((e,s)=>e.order-s.order)}reviewerLabel(){const e=this.snap.config.workflow.review;return{coderabbit:"CodeRabbit",greptile:"Greptile",copilot:"Copilot",human:"you",custom:"the review check"}[e.tool]}mergerLabel(){return this.snap.config.workflow.merge.by==="lead"?this.lead().name:"you"}setStatus(e,s){const r=this.status(e);if(!r)return;const i=s.state!==void 0&&s.state!==r.state;Object.assign(r,s),i&&(r.stateSince=hr()),this.emit({type:"agent.updated",agent:{...r}})}putTask(e){const s=this.snap.tasks.findIndex(r=>r.id===e.id);s===-1?this.snap.tasks.push(e):this.snap.tasks[s]=e,this.emit({type:"task.updated",task:{...e}})}patchTask(e,s){const r=this.task(e);r&&this.putTask({...r,...s})}putPr(e){const s=this.snap.pullRequests.findIndex(r=>r.number===e.number);s===-1?this.snap.pullRequests.push(e):this.snap.pullRequests[s]=e,this.emit({type:"pr.updated",pr:{...e}})}patchPr(e,s){const r=this.pr(e);r&&this.putPr({...r,...s})}putEnv(e){const s=this.snap.environments.findIndex(r=>r.name===e.name);s===-1?this.snap.environments.push(e):this.snap.environments[s]=e,this.emit({type:"env.updated",env:{...e}})}removeEnv(e){this.snap.environments=this.snap.environments.filter(s=>s.name!==e),this.emit({type:"env.removed",name:e})}envUrl(e){const s=kn(this.snap.config.project.name),r=this.snap.config.workflow.deploy.tool;return r==="instacloud"?`https://${e==="main"?s:`${e}-${s}`}.instacloud.app`:r==="vercel"?`https://${s}${e==="main"?"":`-git-${e}`}.vercel.app`:`http://${e}.${s}.local`}syncEnvironments(){const e=this.snap.config.workflow.deploy,s=e.enabled?["main",...e.perAgentEnvironments?this.workers().map(r=>r.id):[]]:[];for(const r of[...this.snap.environments])s.includes(r.name)||this.removeEnv(r.name);for(const r of s){const i=this.snap.environments.find(c=>c.name===r),a=this.envUrl(r);(!i||i.url!==a)&&this.putEnv({name:r,agentId:r==="main"?null:r,url:a,status:(i==null?void 0:i.status)??"live",lastDeployAt:(i==null?void 0:i.lastDeployAt)??new Date(Date.now()-40*6e4).toISOString()})}}deploy(e){const s=this.snap.environments.find(r=>r.name===e);s&&(this.putEnv({...s,status:"deploying"}),this.after(3,()=>{const r=this.snap.environments.find(i=>i.name===e);r&&this.putEnv({...r,status:"live",lastDeployAt:hr()})}))}configChanged(){this.emit({type:"config.updated",config:structuredClone(this.snap.config)})}activity(e,s,r){const i={id:this.id("a"),at:hr(),type:e,agentId:s,text:r};this.snap.activity=[i,...this.snap.activity].slice(0,50),this.emit({type:"activity",event:i})}message(e,s,r){const i={id:this.id("m"),at:hr(),fromId:e,toId:s,text:r};this.snap.messages=[i,...this.snap.messages].slice(0,100),this.emit({type:"message",message:i}),this.activity("message",e==="you"?null:e,`${this.name(e)} → ${this.name(s)}: ${r}`),e!=="you"&&this.write(e,Bv(this.name(e),this.name(s),r,!1)),this.write(s,Bv(this.name(e),this.name(s),r,!0))}write(e,s){const r=this.term.get(e)??{lines:[],pos:0};r.lines.push(...s),this.term.set(e,r)}flushTerminals(e){for(const[s,r]of this.term){let i=e,a="";for(;r.lines.length&&i>0;){const c=r.lines[0];if(!c.typed){a+=c.text+`\r
291
+ `,r.lines.shift(),i-=4;continue}let o=r.pos;for(;o<c.text.length&&i>0;)if(c.text[o]==="\x1B"){const h=c.text.indexOf("m",o);o=h===-1?c.text.length:h+1}else o+=1,i-=1;a+=c.text.slice(r.pos,o),r.pos=o,o>=c.text.length&&(a+=`\r
292
+ `,r.lines.shift(),r.pos=0)}a&&this.emit({type:"terminal.output",agentId:s,data:a})}}}const tM=50,sM=30;function rM(){let t=$P,e=new lc(o(t)),s=new Ov(e),r=null,i=[],a=0,c=new Map;function o(C){return nd.find(E=>E.id===C)??nd[0]}function h(){const C=e.speed;e.clearTimers(),e.setEmitter(null),e=new lc(o(t)),e.speed=C,s=new Ov(e),c=new Map,v.clear()}function u(){e.setEmitter(C=>r==null?void 0:r(C)),r==null||r({type:"snapshot",snapshot:structuredClone(e.snap)}),s.start()}function f(){const C=performance.now(),E=Math.min(.25,(C-a)/1e3)*e.speed;a=C,e.advance(E),s.tick(E)}function d(){const C=e.snap.sbx,E=r1(e.snap.config.team,e.snap.config.project.name);E.globalKeys=C.globalKeys,E.proxy=C.proxy;for(const P of Object.keys(E.agents))C.agents[P]&&(E.agents[P].keys=C.agents[P].keys,E.agents[P].approvals=C.agents[P].approvals);e.snap.sbx=E,e.emit({type:"sbx.updated",sbx:structuredClone(E)})}function g(C,E){e.write(C,[{text:`\x1B[38;2;102;114;159mhq ▸ ${E}\x1B[0m`}])}const _=C=>C===Ls?`\x1B[38;2;108;240;138myou@mac\x1B[0m:\x1B[38;2;41;173;255m${k}\x1B[0m$ `:`\x1B[38;2;108;240;138m${C.slice(6)}@sandbox\x1B[0m:\x1B[38;2;41;173;255m~/workspace\x1B[0m$ `;let k="~/askwell";const S=(C,E)=>r==null?void 0:r({type:"terminal.output",agentId:C,data:E}),m={ls:"README.md app components lib package.json pnpm-lock.yaml",pwd:"/Users/you/.jsmhq/askwell/workspace","git status":`On branch p3-t02-chat-route\r
293
+ Changes not staged for commit:\r
294
+ modified: app/api/chat/route.ts`,"node -v":"v22.11.0",whoami:"agent","npm run dev":`\x1B[1m ▲ Next.js 15.1\x1B[0m\r
295
+ - Local: http://localhost:3000\r
296
+ \r
297
+ ✓ Ready in 1.2s`};function x(C,E){let P=c.get(C)??"";for(const T of E)if(T==="\r"){const A=P.trim();P="",S(C,`\r
298
+ `),A&&S(C,`${m[A]??`(demo shell) ${A}: try ls, pwd, git status, node -v, npm run dev`}\r
299
+ `),S(C,_(C))}else T===""?P.length&&(P=P.slice(0,-1),S(C,"\b \b")):T>=" "&&(P+=T,S(C,T));c.set(C,P)}const v=new Set,b={connect(C,E){return r=C,E==null||E("open"),a=performance.now(),h(),u(),i=[window.setInterval(f,tM),window.setInterval(()=>e.flushTerminals(Math.max(1,Math.round(e.speed*1.3))),sM)],()=>{i.forEach(P=>window.clearInterval(P)),i=[],e.clearTimers(),e.setEmitter(null),r=null}},sendTerminalInput(C,E){if(C.startsWith("shell:"))return v.has(C)?x(C,E):void 0;let P=c.get(C)??"";for(const T of E)if(T==="\r"){const A=P.trim();if(P="",r==null||r({type:"terminal.output",agentId:C,data:`\r
300
+ `}),!A)continue;const D=e.status(C);(D==null?void 0:D.state)==="needs-input"?e.after(.6,()=>s.answer(C,"you")):e.after(1,()=>{var I;return e.write(C,jv(!!((I=e.cfg(C))!=null&&I.isLead),A.length))})}else T===""?P.length&&(P=P.slice(0,-1),r==null||r({type:"terminal.output",agentId:C,data:"\b \b"})):T>=" "&&(P+=T,r==null||r({type:"terminal.output",agentId:C,data:T}));c.set(C,P)},sendMessage(C,E){!e.cfg(C)||!E.trim()||(e.message("you",C,E.trim()),e.after(1.2,()=>{var P;return e.write(C,jv(!!((P=e.cfg(C))!=null&&P.isLead),E.length))}))},resizeTerminal(){},startAgent(C){var P;const E=e.status(C);!E||E.session.state==="running"||(e.setStatus(C,{session:{...E.session,state:"running",detail:null}}),e.activity("session",C,`${e.name(C)}'s session started`),(P=e.cfg(C))!=null&&P.isLead||s.startWorker(C,1.5))},stopAgent(C){const E=e.status(C);E&&(v.has(`shell:${C}`)&&b.closeShell(C),s.stopAgent(C),e.setStatus(C,{state:"idle",currentTaskId:null,note:"Stopped",session:{...E.session,state:"stopped",detail:null}}),e.activity("session",C,`${e.name(C)}'s session stopped`))},recreateSandbox(C){var T;const E=e.status(C),P=(T=e.cfg(C))==null?void 0:T.sandbox.resources;!E||!P||(e.setStatus(C,{session:{...E.session,sandbox:{cpus:P.cpus??8,memoryGb:P.memoryGb??8}}}),g(C,`sbx rm hq-…-${C} && sbx run --cpus ${P.cpus??"auto"} --memory ${P.memoryGb??"auto"}g … (mock)`),e.activity("session",C,`Recreated ${e.name(C)}'s sandbox`))},openWorkspace(C){var E;g(C,`open ${((E=e.status(C))==null?void 0:E.session.workspace)??"?"} (mock: nothing opens)`)},recheckSetup(){e.snap.setup=s1(),e.emit({type:"setup.updated",setup:e.snap.setup})},runSetupFix(){},assignTask(C,E){var A;const P=e.task(C),T=e.cfg(E);!P||!T||T.isLead||P.status!=="todo"||(e.patchTask(C,{ownerId:E}),e.activity("task.assigned",null,`You assigned ${C} ${P.title} to ${T.name}`),!s.hasJob(E)&&((A=e.status(E))==null?void 0:A.state)==="idle"&&(e.message(e.lead().id,E,`Pull main, start ${C}.`),e.after(1,()=>s.begin(E,C),E)))},addAgent(C){const E=e.snap.config.team,P=kn(C.name)||"agent";let T=P;for(let z=2;E.some(U=>U.id===T);z++)T=`${P}-${z}`;const A=new Set(E.map(z=>z.color)),D=wi.find(z=>!A.has(z))??wi[E.length%wi.length],I=e.lead(),O={id:T,name:C.name.trim()||"Agent",role:C.role.trim()||"Developer",isLead:!1,cli:C.cli??"claude",model:C.model??"",mode:C.mode,color:D,skills:["plan","review"],roleMd:`# ${C.name} — ${C.role}
301
+
302
+ You build the tasks assigned to you.`,sandbox:structuredClone(I.sandbox),workspacePath:null};E.push(O),e.snap.agents.push({agentId:T,state:"idle",currentTaskId:null,stateSince:new Date().toISOString(),note:null,session:i1(e.snap.config.project.name,T)}),e.configChanged(),e.emit({type:"agent.updated",agent:{...e.snap.agents[e.snap.agents.length-1]}}),e.syncEnvironments(),e.activity("config",null,`Added ${O.name} (${O.role}) — new sandbox starting`),e.write(T,t1(O.name,O.role,e.snap.config.project.repo,O.mode)),g(T,`sbx run claude · allow host.docker.internal:${e.snap.config.project.hqPort}`),d(),s.startWorker(T,2)},updateAgent(C,E){const P=e.cfg(C);P&&(Object.assign(P,E),e.configChanged())},inspectWorkspace(C){const E=e.status(C);E&&(r==null||r({type:"workspace.info",info:{agentId:C,path:E.session.workspace??"",managed:!0,exists:!0,changedFiles:1,unpushedCommits:2,sandboxName:`hq-mock-${C}`,sandboxExists:!0}}))},removeAgent(C){const E=e.cfg(C);if(!(!E||E.isLead)){v.has(`shell:${C}`)&&b.closeShell(C),s.stopAgent(C),e.snap.config.team=e.snap.config.team.filter(P=>P.id!==C),e.snap.agents=e.snap.agents.filter(P=>P.agentId!==C);for(const P of e.snap.tasks)P.ownerId===C&&P.status!=="done"&&e.patchTask(P.id,{ownerId:null,status:P.status==="in-progress"?"todo":P.status});e.emit({type:"agent.removed",agentId:C}),e.configChanged(),e.syncEnvironments(),e.activity("config",null,`Removed ${E.name} — sandbox stopped`)}},updateSandbox(C,E){const P=e.cfg(C);P&&(Object.assign(P.sandbox,structuredClone(E)),e.configChanged(),(E.allow||E.deny)&&(g(C,`sbx policy allow/deny network --sandbox hq-mock-${C} … (mock)`),d()),e.activity("config",C,`Updated ${P.name}'s sandbox settings`))},setSecret(C,E,P){const T=e.snap.sbx;C===null?T.globalKeys=[...new Set([...T.globalKeys,E])]:T.agents[C]&&(T.agents[C].keys=[...new Set([...T.agents[C].keys,E])]),e.emit({type:"sbx.updated",sbx:structuredClone(T)}),e.activity("config",C,`Stored the ${E} key ${C?`for ${e.name(C)}`:"for every sandbox"} (mock)`)},removeSecret(C,E){const P=e.snap.sbx;C===null?P.globalKeys=P.globalKeys.filter(T=>T!==E):P.agents[C]&&(P.agents[C].keys=P.agents[C].keys.filter(T=>T!==E)),e.emit({type:"sbx.updated",sbx:structuredClone(P)})},setProxy(C){e.snap.sbx.proxy=C,e.emit({type:"sbx.updated",sbx:structuredClone(e.snap.sbx)})},openEnvFile(C){var E;g(C,`open ${((E=e.snap.sbx.agents[C])==null?void 0:E.envFile.path)??"?"} (mock: nothing opens)`)},refreshSbx(){d()},resolveActionItem(C,E,P){var A;const T=(A=e.snap.actionItems)==null?void 0:A.find(D=>D.id===C);!T||T.status!=="open"||(T.status=E,T.note=(P==null?void 0:P.trim())||null,T.closedAt=new Date().toISOString(),e.emit({type:"action.updated",item:{...T}}),e.message("you",T.fromId,E==="done"?`Done: ${T.title}${T.note?` (${T.note})`:""}`:`Dismissed: ${T.title}${T.note?` (${T.note})`:""}`))},refreshMcp(){e.snap.mcp&&e.emit({type:"mcp.updated",mcp:structuredClone(e.snap.mcp)})},addMcp(C){const E=e.snap.mcp,P=C.name.trim().toLowerCase();!E||!P||E.servers.some(T=>T.name===P)||(E.servers.push({name:P,transport:C.command?"local stdio":"remote http",status:C.apiKey||C.command?"ready":"needs-auth",nextStep:null}),e.activity("config",null,`Added MCP server ${P}`),e.emit({type:"mcp.updated",mcp:structuredClone(E)}))},authMcp(C){const E=e.snap.mcp,P=E==null?void 0:E.servers.find(T=>T.name===C);!E||!P||(r==null||r({type:"terminal.output",agentId:`setup:mcp-auth-${C}`,data:`\x1B[2m$ sbx mcp auth ${C}\x1B[0m\r
303
+ Opening your browser to sign in… (demo)\r
304
+ \x1B[32m✓ Done\x1B[0m\r
305
+ `}),P.status="ready",P.nextStep=null,e.emit({type:"mcp.updated",mcp:structuredClone(E)}))},removeMcp(C){var P;const E=e.snap.mcp;if(E){E.servers=E.servers.filter(T=>T.name!==C);for(const T of e.snap.config.team)(P=T.mcp)!=null&&P.includes(C)&&(T.mcp=T.mcp.filter(A=>A!==C));for(const T of Object.keys(E.attached))E.attached[T]=E.attached[T].filter(A=>A!==C);e.configChanged(),e.emit({type:"mcp.updated",mcp:structuredClone(E)})}},setAgentMcp(C,E){var D;const P=e.cfg(C),T=e.snap.mcp;if(!P||!T)return;const A=E.filter(I=>!(P.mcp??[]).includes(I));if(P.mcp=[...E],((D=e.status(C))==null?void 0:D.session.state)==="running"){T.attached[C]=[...new Set([...T.attached[C]??[],...A])];for(const I of A)g(C,`sbx mcp load ${I} --sandbox hq-mock-${C} (mock)`)}e.configChanged(),e.emit({type:"mcp.updated",mcp:structuredClone(T)})},answerApproval(C,E,P){const T=e.snap.sbx.agents[C],A=T==null?void 0:T.approvals.find(D=>D.id===E);if(!(!T||E!=="all"&&!A)){if(P==="allow"){const D=e.cfg(C),I=[...new Set((A?[A]:T.approvals).map(O=>O.host))];for(const O of I)D&&!D.sandbox.allow.includes(O)&&(D.sandbox.allow=[...D.sandbox.allow,O]),g(C,`sbx policy allow network --sandbox hq-mock-${C} ${O} (mock)`);e.configChanged(),e.activity("config",C,`You allowed ${A?A.host:`${I.length} sites`} for ${e.name(C)}'s sandbox`)}T.approvals=E==="all"?[]:T.approvals.filter(D=>P==="allow"?D.host!==(A==null?void 0:A.host):D.id!==E),d()}},updateWorkflow(C){const E=e.snap.config.workflow;Object.assign(E.review,C.review),Object.assign(E.merge,C.merge),Object.assign(E.deploy,C.deploy),e.configChanged(),e.syncEnvironments(),s.workflowChanged(),e.activity("config",null,"Workflow updated")},updateProject(C){Object.assign(e.snap.config.project,C),e.configChanged(),e.syncEnvironments()},createBoard(C){const E=C.trim();if(!E)return;const P=E.split(/\s+/).map(D=>D[0]).join("").toUpperCase().slice(0,3)||"B";let T=P;for(let D=2;e.snap.boards.some(I=>I.id===T);D++)T=`${P}${D}`;const A={id:T,title:E,status:"planned",order:e.snap.boards.length};e.snap.boards.push(A),e.emit({type:"board.updated",board:{...A}}),e.activity("config",null,`Created board ${E}`)},updateBoard(C,E){const P=e.snap.boards.find(T=>T.id===C);P&&(Object.assign(P,E),e.emit({type:"board.updated",board:{...P}}))},openShell(C){const E=`shell:${C}`;v.has(E)||(v.add(E),c.delete(E),S(E,`\x1B[2m$ sbx exec -it hq-mock-${C} bash (demo)\x1B[0m\r
306
+ ${_(E)}`))},openHostShell(C,E){const P=C.trim()||"~/askwell";v.has(Ls)&&!E&&P===k||(v.has(Ls)&&S(Ls,"\x1Bc"),k=P,v.add(Ls),c.delete(Ls),S(Ls,`\x1B[2m$ zsh in ${k} (demo)\x1B[0m\r
307
+ ${_(Ls)}`))},closeHostShell(){v.delete(Ls)},forwardPort(C,E){var T;const P=e.snap.sbx.agents[C];!P||(T=P.ports)!=null&&T.some(A=>A.sandbox===E)||(P.ports=[...P.ports??[],{sandbox:E,host:E}].sort((A,D)=>A.sandbox-D.sandbox),e.emit({type:"sbx.updated",sbx:structuredClone(e.snap.sbx)}),e.activity("config",C,`Forwarded port ${E} from ${e.name(C)}'s sandbox to localhost:${E} on this machine. (demo)`))},unforwardPort(C,E){const P=e.snap.sbx.agents[C];P&&(P.ports=(P.ports??[]).filter(T=>T.sandbox!==E),e.emit({type:"sbx.updated",sbx:structuredClone(e.snap.sbx)}))},closeShell(C){v.delete(`shell:${C}`),c.delete(`shell:${C}`),S(`shell:${C}`,`\r
308
+ \x1B[2m[shell closed]\x1B[0m\r
309
+ `)},completeWelcome(){},updateStack(C){C?e.snap.config.stack=structuredClone(C):delete e.snap.config.stack,e.configChanged()},resolveAccess(C,E){var A,D;const P=(A=e.snap.accessRequests)==null?void 0:A.find(I=>I.id===C);if(!P||P.status!=="pending")return;P.status=E==="deny"?"denied":"allowed",e.emit({type:"access.updated",request:{...P}});const T=e.name(P.agentId);if(E==="deny")e.activity("config",P.agentId,`You denied ${T} access to ${P.domain}`),e.write(P.agentId,[{text:`\x1B[38;2;255;0;77mhq ▸ access to ${P.domain} denied — continuing without it\x1B[0m`}]);else{const I=E==="everyone"?e.snap.config.team.filter(O=>O.mode==="sandbox").map(O=>O.id):[P.agentId];for(const O of I){const z=e.cfg(O);z&&!z.sandbox.allow.includes(P.domain)&&(z.sandbox.allow=[...z.sandbox.allow,P.domain]),g(O,`sbx policy allow network --sandbox hq-mock-${O} ${P.domain} (mock)`)}e.configChanged(),d(),e.activity("config",P.agentId,`You allowed ${P.domain} for ${E==="everyone"?"every agent":T}`)}((D=e.status(P.agentId))==null?void 0:D.state)==="needs-input"&&e.setStatus(P.agentId,{state:"working",note:E==="deny"?"Continuing without it":`Reading ${P.domain}`})},dev:{presets:nd.map(C=>({id:C.id,label:C.label})),loadPreset(C){t=C,h(),u()},setSpeed(C){e.speed=C},simulateAccessRequest(){var z;const C=e.snap.agents.filter(U=>{var K;return U.session.state==="running"&&U.state!=="needs-input"&&!((K=e.cfg(U.agentId))!=null&&K.isLead)}),E=C[Math.floor(Math.random()*C.length)];if(!E)return;const P=new Set(((z=e.cfg(E.agentId))==null?void 0:z.sandbox.allow)??[]),T=U=>U.filter(K=>!K.startsWith("*.")&&!P.has(K)),A=T(J0(e.snap.config.stack).map(U=>U.domain)),D=A.length?A:T(["posthog.com","docs.stripe.com","hono.dev","docs.arcjet.com"]),I=D[Math.floor(Math.random()*D.length)]??"example.com",O={id:e.id("ar"),agentId:E.agentId,domain:I,reason:`Read the ${I} docs before integrating it`,at:new Date().toISOString(),status:"pending"};e.snap.accessRequests=[O,...e.snap.accessRequests??[]].slice(0,30),e.emit({type:"access.updated",request:{...O}}),e.setStatus(E.agentId,{state:"needs-input",note:`Asking: access to ${I}`}),e.activity("agent.needs-input",E.agentId,`${e.name(E.agentId)} needs you: access to ${I}`),e.write(E.agentId,[{text:`\x1B[38;2;255;163;0mhq ▸ request_access ${I} — "${O.reason}" (waiting for you)\x1B[0m`}])}}};return b}function iM(t){let e=null;const s=[],r=(a,...c)=>{const o=JSON.stringify({cmd:a,args:c});(e==null?void 0:e.readyState)===WebSocket.OPEN?e.send(o):s.length<200&&s.push(o)};return{connect(a,c){let o=!0,h=0,u=null,f=null;const d=()=>{if(!o)return;c==null||c(h?"reconnecting":"connecting");const g=location.protocol==="https:"?"wss":"ws",_=new WebSocket(`${g}://${location.host}/ws?token=${encodeURIComponent(t)}`);f=_;let k=!1;_.onopen=()=>{if(!o)return _.close();for(k=!0,h=0,e=_,c==null||c("open");s.length;)_.send(s.shift())},_.onmessage=S=>{if(o)try{a(JSON.parse(String(S.data)))}catch{}},_.onclose=()=>{e===_&&(e=null),o&&(c==null||c(!k&&h>2?"unauthorized":"reconnecting"),h+=1,u=window.setTimeout(d,Math.min(5e3,400*h)))}};return d(),()=>{o=!1,u&&window.clearTimeout(u),f&&f.readyState!==WebSocket.CONNECTING&&f.close(),e===f&&(e=null)}},sendTerminalInput:(a,c)=>r("sendTerminalInput",a,c),resizeTerminal:(a,c,o)=>r("resizeTerminal",a,c,o),assignTask:(a,c)=>r("assignTask",a,c),sendMessage:(a,c)=>r("sendMessage",a,c),startAgent:a=>r("startAgent",a),stopAgent:a=>r("stopAgent",a),openWorkspace:a=>r("openWorkspace",a),recreateSandbox:a=>r("recreateSandbox",a),recheckSetup:()=>r("recheckSetup"),runSetupFix:a=>r("runSetupFix",a),addAgent:a=>r("addAgent",a),updateAgent:(a,c)=>r("updateAgent",a,c),removeAgent:(a,c)=>r("removeAgent",a,c),inspectWorkspace:a=>r("inspectWorkspace",a),updateSandbox:(a,c)=>r("updateSandbox",a,c),setSecret:(a,c,o)=>r("setSecret",a,c,o),removeSecret:(a,c)=>r("removeSecret",a,c),setProxy:a=>r("setProxy",a),openEnvFile:a=>r("openEnvFile",a),refreshSbx:()=>r("refreshSbx"),updateWorkflow:a=>r("updateWorkflow",a),updateProject:a=>r("updateProject",a),createBoard:a=>r("createBoard",a),updateBoard:(a,c)=>r("updateBoard",a,c),completeWelcome:a=>r("completeWelcome",a),openShell:a=>r("openShell",a),closeShell:a=>r("closeShell",a),openHostShell:(a,c)=>r("openHostShell",a,c===!0),closeHostShell:()=>r("closeHostShell"),forwardPort:(a,c)=>r("forwardPort",a,c),unforwardPort:(a,c)=>r("unforwardPort",a,c),updateStack:a=>r("updateStack",a),resolveActionItem:(a,c,o)=>r("resolveActionItem",a,c,o),refreshMcp:()=>r("refreshMcp"),addMcp:a=>r("addMcp",a),authMcp:a=>r("authMcp",a),removeMcp:a=>r("removeMcp",a),setAgentMcp:(a,c)=>r("setAgentMcp",a,c),answerApproval:(a,c,o)=>r("answerApproval",a,c,o),resolveAccess:(a,c)=>r("resolveAccess",a,c)}}const Mi=If(()=>({seen:{},dismissed:{}})),nM=/(?:localhost|127\.0\.0\.1|0\.0\.0\.0)(?::|%3A)(\d{2,5})(?!\d)/gi,Zd=new Map;function oM(t,e){if(t.startsWith("setup:")||t===Ls)return;const s=(Zd.get(t)??"")+e;if(Zd.set(t,s.slice(-48)),!/localhost|127\.0\.0\.1|0\.0\.0\.0/i.test(s))return;const r=Number(window.location.port)||0,i=[];for(const a of s.matchAll(nM)){const c=Number(a[1]);c>=1024&&c<=65535&&c!==r&&i.push(c)}i.length&&Mi.setState(a=>{const c=a.seen[t]??[],o=[...c.filter(h=>!i.includes(h)),...new Set(i)];return c.join()===o.join()?a:{seen:{...a.seen,[t]:o}}})}function Fv(t,e){Mi.setState(s=>({dismissed:{...s.dismissed,[t]:[...s.dismissed[t]??[],e]}}))}function aM(){Zd.clear(),Mi.setState({seen:{},dismissed:{}})}const od=6e4,cc=new Map,hc=new Map;function lM(t,e){var i;let r=(cc.get(t)??"")+e;if(r.length>od){const a=r.indexOf(`
310
+ `,r.length-od);r=r.slice(a===-1?r.length-od:a+1)}cc.set(t,r),oM(t,e),(i=hc.get(t))==null||i.forEach(a=>a(e))}function cM(t){return cc.get(t)??""}function hM(t,e){const s=hc.get(t)??new Set;return s.add(e),hc.set(t,s),()=>s.delete(e)}function uM(){cc.clear(),aM(),hc.forEach(t=>t.forEach(e=>e("\x1Bc")))}function dM(){const t=new URL(location.href),e=t.searchParams.get("token");if(e){try{sessionStorage.setItem("hq-token",e)}catch{}return t.searchParams.delete("token"),history.replaceState(null,"",t.toString()),e}try{return sessionStorage.getItem("hq-token")}catch{return null}}const Jd=dM(),Ce=Jd?iM(Jd):rM(),be=If(()=>{var t;return{snap:null,epoch:0,events:[],terminalChunks:0,speed:1,presets:((t=Ce.dev)==null?void 0:t.presets)??null,live:Jd!==null,workspaceInfo:{},connection:"connecting",source:Ce}});let $v=0;function ci(t,e,s){const r=t.findIndex(s);if(r===-1)return[...t,e];const i=t.slice();return i[r]=e,i}function fM(t,e){switch(e.type){case"snapshot":return e.snapshot;case"workspace.info":return t;case"sbx.updated":return{...t,sbx:e.sbx};case"setup.updated":return{...t,setup:e.setup};case"config.updated":return{...t,config:e.config};case"agent.updated":return{...t,agents:ci(t.agents,e.agent,s=>s.agentId===e.agent.agentId)};case"agent.removed":return{...t,agents:t.agents.filter(s=>s.agentId!==e.agentId)};case"board.updated":return{...t,boards:ci(t.boards,e.board,s=>s.id===e.board.id)};case"task.updated":return{...t,tasks:ci(t.tasks,e.task,s=>s.id===e.task.id)};case"task.removed":return{...t,tasks:t.tasks.filter(s=>s.id!==e.taskId)};case"pr.updated":return{...t,pullRequests:ci(t.pullRequests,e.pr,s=>s.number===e.pr.number)};case"env.updated":return{...t,environments:ci(t.environments,e.env,s=>s.name===e.env.name)};case"env.removed":return{...t,environments:t.environments.filter(s=>s.name!==e.name)};case"message":return{...t,messages:[e.message,...t.messages].slice(0,100)};case"activity":return{...t,activity:[e.event,...t.activity].slice(0,50)};case"terminal.output":return t;case"action.updated":return{...t,actionItems:ci(t.actionItems??[],e.item,s=>s.id===e.item.id)};case"mcp.updated":return{...t,mcp:e.mcp};case"access.updated":return{...t,accessRequests:ci(t.accessRequests??[],e.request,s=>s.id===e.request.id)}}}function pM(t){if(t.type==="terminal.output"){lM(t.agentId,t.data),be.setState(e=>({terminalChunks:e.terminalChunks+1}));return}if(t.type==="workspace.info"){be.setState(e=>({workspaceInfo:{...e.workspaceInfo,[t.info.agentId]:t.info}}));return}t.type==="snapshot"&&uM(),be.setState(e=>{const s=e.snap??(t.type==="snapshot"?t.snapshot:null);return s?($v+=1,{snap:fM(s,t),epoch:t.type==="snapshot"?e.epoch+1:e.epoch,events:[{n:$v,at:Date.now(),event:t},...e.events].slice(0,20)}):{}})}let hi=null;function mM(){return hi||(hi=Ce.connect(pM,t=>be.setState({connection:t})),()=>{hi==null||hi(),hi=null})}const me={sendTerminalInput:(t,e)=>Ce.sendTerminalInput(t,e),resizeTerminal:(t,e,s)=>Ce.resizeTerminal(t,e,s),startAgent:t=>Ce.startAgent(t),stopAgent:t=>Ce.stopAgent(t),openWorkspace:t=>Ce.openWorkspace(t),recreateSandbox:t=>Ce.recreateSandbox(t),openShell:t=>Ce.openShell(t),closeShell:t=>Ce.closeShell(t),openHostShell:(t,e)=>Ce.openHostShell(t,e),closeHostShell:()=>Ce.closeHostShell(),forwardPort:(t,e)=>Ce.forwardPort(t,e),unforwardPort:(t,e)=>Ce.unforwardPort(t,e),recheckSetup:()=>Ce.recheckSetup(),runSetupFix:t=>Ce.runSetupFix(t),assignTask:(t,e)=>Ce.assignTask(t,e),sendMessage:(t,e)=>Ce.sendMessage(t,e),addAgent:Ce.addAgent.bind(Ce),updateAgent:Ce.updateAgent.bind(Ce),removeAgent:(t,e)=>Ce.removeAgent(t,e),inspectWorkspace:t=>Ce.inspectWorkspace(t),updateSandbox:Ce.updateSandbox.bind(Ce),setSecret:(t,e,s)=>Ce.setSecret(t,e,s),removeSecret:(t,e)=>Ce.removeSecret(t,e),setProxy:t=>Ce.setProxy(t),openEnvFile:t=>Ce.openEnvFile(t),refreshSbx:()=>Ce.refreshSbx(),answerApproval:(t,e,s)=>Ce.answerApproval(t,e,s),updateWorkflow:Ce.updateWorkflow.bind(Ce),updateProject:Ce.updateProject.bind(Ce),createBoard:Ce.createBoard.bind(Ce),updateBoard:Ce.updateBoard.bind(Ce),completeWelcome:t=>Ce.completeWelcome(t),updateStack:t=>Ce.updateStack(t),resolveActionItem:(t,e,s)=>Ce.resolveActionItem(t,e,s),refreshMcp:()=>Ce.refreshMcp(),addMcp:t=>Ce.addMcp(t),authMcp:t=>Ce.authMcp(t),removeMcp:t=>Ce.removeMcp(t),setAgentMcp:(t,e)=>Ce.setAgentMcp(t,e),resolveAccess:(t,e)=>Ce.resolveAccess(t,e),simulateAccessRequest:()=>{var t;return(t=Ce.dev)==null?void 0:t.simulateAccessRequest()},setSpeed(t){var e;(e=Ce.dev)==null||e.setSpeed(t),be.setState({speed:t})},loadPreset(t){var e;(e=Ce.dev)==null||e.loadPreset(t)}};function n1(t){return t?t.config.team.flatMap(e=>{const s=t.agents.find(r=>r.agentId===e.id);return s?[{config:e,status:s}]:[]}):[]}const Si={coderabbit:"CodeRabbit",greptile:"Greptile",copilot:"Copilot",human:"Human review",custom:"Custom check"},ql={instacloud:"InstaCloud",vercel:"Vercel",custom:"Custom deploy"};function o1(t){if(!t)return{items:[],asking:[],access:[],blocked:[],readyPrs:[],total:0};const e=(t.actionItems??[]).filter(c=>c.status==="open"),s=(t.accessRequests??[]).filter(c=>c.status==="pending"),r=t.agents.filter(c=>c.state==="needs-input"&&!s.some(o=>o.agentId===c.agentId)),i=t.config.team.map(c=>{var o,h;return{agentId:c.id,count:((h=(o=t.sbx.agents[c.id])==null?void 0:o.approvals)==null?void 0:h.length)??0}}).filter(c=>c.count>0),a=t.pullRequests.filter(c=>c.review==="passed"&&c.mergeable&&!c.merged&&!c.closed);return{items:e,asking:r,access:s,blocked:i,readyPrs:a,total:e.length+r.length+s.length+i.length+a.length}}const a1="jsmhq.drawerWidth",Hf=420,ef=520;function gM(){return Math.max(Hf,window.innerWidth-32)}function _M(){try{const t=Number(localStorage.getItem(a1));return Number.isFinite(t)&&t>=Hf?t:ef}catch{return ef}}const Ie=If(()=>({drawer:null,settings:null,hover:null,focus:null,zoomRequest:null,planBoardId:null,debugOpen:!1,setupOpen:!1,drawerWidth:_M(),drawerMaximized:!1}));let Rl=0;const Se={focus(t){Rl+=1,Ie.setState({focus:{target:t,nonce:Rl}})},openAgent(t,e){Ie.setState({drawer:{kind:"agent",id:t,tab:e}}),Se.focus({kind:"agent",id:t})},openBoards(t){Ie.setState({drawer:{kind:"boards",boardId:t}}),Se.focus({kind:"plan"})},openTerminal(){Ie.setState({drawer:{kind:"terminal"}})},openActions(){Ie.setState({drawer:{kind:"actions"}})},openPrs(){Ie.setState({drawer:{kind:"prs"}}),Se.focus({kind:"prs"})},openEnv(t){Ie.setState({drawer:{kind:"env",name:t}}),Se.focus({kind:"env",name:t})},closeDrawer(){Ie.setState({drawer:null}),Se.focus({kind:"home"})},openSettings(t="team",e){Ie.setState({settings:{tab:t,agentId:e}})},closeSettings(){Ie.setState({settings:null})},setHover(t){Ie.setState({hover:t})},zoom(t){Rl+=1,Ie.setState({zoomRequest:{delta:t,nonce:Rl}})},showBoardOnWall(t){Ie.setState({planBoardId:t})},openSetup(){Ie.setState({setupOpen:!0})},closeSetup(){Ie.setState({setupOpen:!1})},setDrawerWidth(t){const e=Math.round(Math.min(gM(),Math.max(Hf,t)));Ie.setState({drawerWidth:e,drawerMaximized:!1});try{localStorage.setItem(a1,String(e))}catch{}},toggleDrawerMaximized(){Ie.setState(t=>({drawerMaximized:!t.drawerMaximized}))},toggleDebug(){Ie.setState(t=>({debugOpen:!t.debugOpen}))}},H={ink:vt.ink,grass:"#4a8f3d",grassD:"#3d7a34",grassL:"#62a84a",path:"#d9c49a",pathD:"#bfa57a",wood:"#c98e5b",woodD:"#b37a4a",woodL:"#d8a06c",woodLine:"#94603a",wall:"#4f7a6e",wallD:"#41675c",wallL:"#5f8b7e",wallTop:"#2c3d42",wallTopL:"#4a5d61",base:"#6b4a3a",wallSrv:"#3e4a5e",wallSrvD:"#323d50",carpetJ:"#8e3b46",carpetJD:"#742f39",rugG:"#5f8f52",rugGD:"#4e7a43",rugP:"#7a5a8e",rugPD:"#664a78",tileL:"#e9dcc6",tileD:"#d3c3a8",grate:"#4f4a52",grateD:"#3b373e",part:"#8b9bb4",partD:"#6b7a94",partCap:"#c9d1de",desk:"#b97a4b",deskD:"#8a5a3b",deskDD:"#5e3a26",metal:"#c2c3c7",metalL:"#e4e3ea",metalD:"#8e8a96",metalDD:"#5f5a66",screen:"#111d35",bezel:"#3a3f55",leaf:"#38b764",leafD:"#257953",leafL:"#73d36b",pot:"#b5523b",potD:"#8a3b2a",belt:"#3a3640",beltL:"#57525e",rail:"#9d98a6",cork:"#c48a52",corkD:"#9b6638",sky:"#8fd3ff",skyN:"#1d2b53",cloud:"#ffffff",couch:"#3f7f8f",couchD:"#2f5f6b",red:vt.red,orange:vt.orange,yellow:vt.yellow,green:vt.green,blue:vt.blue,lav:vt.lav,pink:vt.pink,peach:"#ffccaa",white:vt.white,navy:vt.navy,rabbit:"#ff7a30",gold:"#ffcf3a",shadow:"#241a2e"},Hv=[["#3e5f8a","#334f75"],["#b5893a","#9a7230"],["#4f7f5a","#41694a"],["#7a4f7e","#663f69"],["#8a5a3e","#744a32"],["#3f7f8f","#2f5f6b"]];class l1{constructor(e){this.g=e,e.imageSmoothingEnabled=!1}rect(e,s,r,i,a,c=1){r<=0||i<=0||(this.g.globalAlpha=c,this.g.fillStyle=a,this.g.fillRect(Math.round(e),Math.round(s),Math.round(r),Math.round(i)),this.g.globalAlpha=1)}}class Dl{constructor(e){this.g=e}rect(e,s,r,i,a,c=1){r<=0||i<=0||c<=0||this.g.rect(Math.round(e),Math.round(s),Math.round(r),Math.round(i)).fill({color:a,alpha:c})}}function Uf(t,e){const s=document.createElement("canvas");return s.width=Math.max(1,Math.ceil(t)),s.height=Math.max(1,Math.ceil(e)),s}function De(t,e,s,r,i,a,c="#241a2e"){t.rect(e,s,r,i,c),t.rect(e+1,s+1,r-2,i-2,a)}function Is(t,e,s,r,i,a=1){for(let c=-r;c<=r;c++){const o=Math.round(Math.sqrt(r*r-c*c));t.rect(e-o,s+c,o*2+1,1,i,a)}}function Ks(t,e,s,r,i,a,c=1){for(let o=-i;o<=i;o++){const h=Math.round(r*Math.sqrt(1-o*o/(i*i)));t.rect(e-h,s+o,h*2+1,1,a,c)}}function uc(t,e,s,r,i,a){let c=Math.round(e),o=Math.round(s);const h=Math.round(r),u=Math.round(i),f=Math.abs(h-c),d=Math.abs(u-o),g=c<h?1:-1,_=o<u?1:-1;let k=f-d;for(;t.rect(c,o,1,1,a),!(c===h&&o===u);){const S=2*k;S>-d&&(k-=d,c+=g),S<f&&(k+=f,o+=_)}}function Ll(t,e){const s=Uf(t[0].length,t.length),r=new l1(s.getContext("2d"));return t.forEach((i,a)=>[...i].forEach((c,o)=>e[c]&&r.rect(o,a,1,1,e[c]))),s}function vM(t){const e=Uf(t.width,t.height),s=e.getContext("2d");return s.translate(t.width,0),s.scale(-1,1),s.drawImage(t,0,0),e}function Uv(t,e,s,r,i){e.forEach((a,c)=>{for(let o=0;o<a.length;o++){const h=s[a[o]];h&&t.rect(r+o,i+c,1,1,h)}})}function c1(t){return new Ve({source:new Cf({resource:t,scaleMode:"nearest"})})}const xM=[".....kk.....","....k..k....",".....kk....."],yM=["..k..kk..k..","..kGkGGkGk..","..kGGGGGGk.."],bM=["..kkkkkkkk..",".khhBBBBBBk.",".khVVVVVVBk.",".kBVVVVVVBk.",".kBVVVVVVBk.",".kbBBBBBBbk.","..kkkkkkkk..","...kBBBBk...",".kbkBBBBkbk.",".kk.kbbk.kk.",".....kk....."],wM=["..kkkkkkkk..",".khhBBBBBBk.",".kBBBBBBBBk.",".kBBkbbkBBk.",".kBBBBBBBBk.",".kbBBBBBBbk.","..kkkkkkkk..","...kBBBBk...",".kbkBBBBkbk.",".kk.kbbk.kk.",".....kk....."],SM=["..kkkkkkkk..",".khhBBBBBBk.",".kBBBBBBBBk.",".kBBkbbkBBk.",".kBBBBBBBBk.",".kbBBBBBBbk.","..kkkkkkkk..",".kbkBBBBkbk.",".kkkBBBBkkk.","....kbbk....",".....kk....."],CM=["..kkkkkkkk..",".khhBBBBBBk.",".kBBBBBVVVk.",".kBBBBBVVVk.",".kBBBBBVVVk.",".kbBBBBBBbk.","..kkkkkkkk..","...kBBBBk...","...kbBBBbk..","....kbbkk...",".....kk....."],Wv=new Map,zv=new Map;function h1(t,e){const s=`${t}|${e}`,r=Wv.get(s);if(r)return r;const i={k:H.ink,B:t,b:nc(t,-.3),h:nc(t,.6),V:"#16213f",G:H.gold},a=e?yM:xM,c=Ll([...a,...CM],i),o={front:Ll([...a,...bM],i),back:Ll([...a,...wM],i),type:Ll([...a,...SM],i),side:c,sideL:vM(c)};return Wv.set(s,o),o}function Vv(t,e){const s=`${t}|${e}`,r=zv.get(s);if(r)return r;const i=h1(t,e),a=Object.fromEntries(Object.entries(i).map(([o,h])=>[o,c1(h)])),c={canvases:i,textures:a};return zv.set(s,c),c}const kM=["..k...k..",".kOk.kOk.",".kPk.kPk.",".kPk.kPk.",".kOkkkOk.","kOOOOOOOk","kOkOOOkOk","kOOOpOOOk",".kOWWWOk.","kOOWWWOOk","kOOWWWOOk",".kkkkkkk."],EM=["..k...k..",".kOk.kOk.",".kPk.kPk.",".kPk.kPk.",".kOkkkOk.","kOOOOOOOk","kOOOOOOOk","kkkOpOkkk",".kOWWWOk.","kOOWWWOOk","kOOWWWOOk",".kkkkkkk."],PM={k:H.ink,O:H.rabbit,P:H.pink,p:"#ff5c86",W:H.white},MM=["..kkkkk..",".kMMMMMk.","kMWWWWWMk","kMWkkkWMk","kMWWWWWMk",".kMMMMMk.","..kkkkk..","....k....","...kkk..."],AM={k:H.ink,M:H.metal,W:H.white};class TM{constructor(e,s){ge(this,"cells");this.w=e,this.h=s,this.cells=new Uint8Array(e*s)}set(e,s,r,i,a){for(let c=Math.max(0,s);c<=Math.min(this.h-1,i);c++)for(let o=Math.max(0,e);o<=Math.min(this.w-1,r);o++)this.cells[c*this.w+o]=a?1:0}ok(e,s){return e>=0&&s>=0&&e<this.w&&s<this.h&&this.cells[s*this.w+e]===1}nearest(e,s){if(this.ok(e,s))return[e,s];for(let r=1;r<Math.max(this.w,this.h);r++)for(let i=-r;i<=r;i++)for(let a=-r;a<=r;a++)if(Math.max(Math.abs(a),Math.abs(i))===r&&this.ok(e+a,s+i))return[e+a,s+i];return[e,s]}find(e,s,r,i){const a=this.w,c=s*a+e,o=i*a+r;if(c===o)return[];const h=new Int32Array(a*this.h).fill(-1),u=[c];h[c]=c;for(let d=0;d<u.length;d++){const g=u[d];if(g===o)break;const _=g%a,k=g/a|0,S=[[_,k+1],[_+1,k],[_,k-1],[_-1,k]];for(const[m,x]of S){if(m<0||x<0||m>=a||x>=this.h)continue;const v=x*a+m;h[v]!==-1||!this.cells[v]&&v!==o||(h[v]=g,u.push(v))}}if(h[o]===-1)return[];const f=[];for(let d=o;d!==c;d=h[d])f.push([d%a,d/a|0]);return f.reverse()}}const Vt=16,Bl=3,ad=20,RM=9,DM=10,LM=4,Gv=14,ui=7,jl=8,Il=5;function u1(t,e){const s=t.workflow;return JSON.stringify([t.team.map(r=>[r.id,r.name,r.color,r.isLead]),s.review.enabled,s.review.tool,s.deploy.enabled,e.map(r=>r.name),t.project.officeName??""])}function BM(t){return t<=4?Math.max(1,t):Math.min(5,Math.ceil(t/2))}function jM(t,e){const s=t.team.find($=>$.isLead),r=t.team.filter($=>!$.isLead),i=t.workflow.review.enabled,a=t.workflow.deploy.enabled&&e.length>0,c=BM(r.length),o=Math.max(1,Math.ceil(r.length/c)),h=2+c*jl,u=Math.max(ad+RM,h+(i?DM:2)-1),f=u-ad,d=a?e.length:0,g=Math.ceil(d/Il),_=a?Math.max(5,2+Math.min(d,Il)*2):0,k=u+1,S=Gv+o*jl,m=a?Math.ceil((22+g*112)/Vt)+3:0,x=Math.max(S+3,m),v=1+u+(a?1+_:0)+1,b=Bl*Vt,C=Bl*Vt,E=$=>b+$*Vt,P=$=>C+$*Vt,T=new TM(v,x);T.set(1,LM,u,x-2,!0),T.set(0,13,0,13,!0),T.set(13,5,17,6,!1),T.set(18,4,19,4,!1),T.set(11,4,11,4,!1),T.set(1,4,1,4,!1);for(const[$,Z]of[[3,8],[8,8],[5,10],[1,11]])T.set($,Z,$,Z,!1);const A=ad+1;T.set(A,4,A+3,4,!1),T.set(A+2,8,A+5,8,!1),T.set(A+3,10,A+4,10,!1),T.set(u,4,u,4,!1),T.set(u,7,u,8,!1),T.set(2,S,u,S,!1);const D=r.map(($,Z)=>{const oe=Z%c,he=Math.floor(Z/c),ae=2+oe*jl,V=Gv+he*jl;return T.set(ae,V,ae+ui-1,V,!1),T.set(ae+1,V,ae+1,V,!0),T.set(ae,V,ae,V+ui-1,!1),T.set(ae+ui-1,V,ae+ui-1,V+ui-1,!1),T.set(ae+2,V+1,ae+4,V+2,!1),{agentId:$.id,index:Z,x0:ae,y0:V,seat:[ae+3,V+3],drop:[ae+3,S-1],rect:{x:E(ae),y:P(V)-4,w:ui*Vt,h:ui*Vt+4},carpet:Hv[Z%Hv.length]}});let I=null,O=null;i&&(I={x:E(h+2),y:P(S)-25,w:68,h:46},T.set(h+2,S-1,h+6,S+1,!1),O={x:E(h+4),y:P(S-6)+4,w:64,h:40},T.set(h+4,S-6,h+7,S-3,!1));const z=[];let U=null;const K=P(S)+8;let ie,Q=null;a?(T.set(k,0,v-1,x-1,!1),e.forEach(($,Z)=>{const oe=Z%Il,he=Math.floor(Z/Il);z.push({name:$.name,agentId:$.agentId,x:E(k+2)+oe*32,y:C+22+he*112,w:32,h:92})}),ie=E(k+1)+8,Q=C+112):(ie=E(u)-4,U={x:E(u)-6,y:P(S)-14,w:22,h:30},T.set(u,S-1,u,S,!1));const J=[];D.forEach(($,Z)=>{const oe=z.find(N=>N.agentId===$.agentId);if(!oe)return;const he=E($.x0+3)+4+Z%3*3,ae=P(S)-4-Z%4*3,V=oe.x+10+Z%3*4;J.push({agentId:$.agentId,pts:[[he,P($.y0+2)+12],[he,ae],[V,ae],[V,oe.y+oe.h]]})});const Y=[],L={x:E(2)+3,y:C+19,w:140,h:40};Y.push({kind:"plan",id:"plan",rect:{x:L.x-3,y:L.y-8,w:L.w+6,h:L.h+14}}),s&&Y.push({kind:"agent",id:s.id,rect:{x:E(12),y:C+64,w:6*Vt,h:3*Vt}});for(const $ of D)Y.push({kind:"agent",id:$.agentId,rect:$.rect});I&&Y.push({kind:"gate",id:"gate",rect:{x:I.x,y:I.y-16,w:I.w,h:I.h+16}}),O&&Y.push({kind:"prs",id:"prs",rect:{x:O.x,y:O.y,w:O.w,h:O.h+26}});for(const $ of z)Y.push({kind:"env",id:$.name,rect:$});const F=[[A,5],[A+1,5],[A+2,5]],B=[[A+3,9],[A+5,9],[A+6,6],[4,9],[7,9],[6,11],[Math.min(u-1,A+7),11]];return{key:u1(t,e),W:v,H:x,ox:b,oy:C,worldW:(v+Bl*2)*Vt,worldH:(x+Bl*2)*Vt,mainW:u,grid:T,lead:{agentId:(s==null?void 0:s.id)??null,seat:[15,7],rect:{x:E(12),y:C+64,w:6*Vt,h:3*Vt}},plan:{board:L,spot:[6,5]},lounge:{x0:A,w:f,coffee:F},desks:D,belt:{y:K,x0:E(2),x1:ie,topY:Q},gate:I,prBoard:O,serverRoom:a?{glassX:k,x0:k+1,w:_}:null,racks:z,mailbox:U,cables:J,door:[1,13],wander:B.filter(([$,Z])=>T.ok($,Z)),hits:Y}}function qo(t,e){return{x:t.ox+e[0]*Vt+8,y:t.oy+e[1]*Vt+8}}const IM=52;class NM{constructor(e,s,r,i){ge(this,"x");ge(this,"y");ge(this,"path",[]);ge(this,"face","up");ge(this,"seated",!1);ge(this,"errand",null);ge(this,"pause",0);ge(this,"emote",null);ge(this,"carry",null);ge(this,"headY",0);ge(this,"color");ge(this,"isLead");ge(this,"sprite");ge(this,"sprites");this.config=e,this.index=s,this.x=r.x,this.y=r.y,this.color=e.color,this.isLead=e.isLead,this.sprites=Vv(e.color,e.isLead),this.sprite=new ki(this.sprites.textures.back),i.addChild(this.sprite)}restyle(e){this.config=e,(e.color!==this.color||e.isLead!==this.isLead)&&(this.color=e.color,this.isLead=e.isLead,this.sprites=Vv(e.color,e.isLead))}destroy(){this.sprite.destroy()}tile(e){return[Math.floor((this.x-e.ox)/16),Math.floor((this.y-e.oy)/16)]}goTo(e,s){const[r,i]=e.grid.nearest(...this.tile(e));this.path=e.grid.find(r,i,s[0],s[1]),this.seated=!1}move(e,s){if(!this.path.length)return;const r=qo(s,this.path[0]),i=r.x-this.x,a=r.y-this.y,c=Math.hypot(i,a),o=IM*e;Math.abs(i)>Math.abs(a)?this.face=i>0?"right":"left":Math.abs(a)>.01&&(this.face=a>0?"down":"up"),c<=o?(this.x=r.x,this.y=r.y,this.path.shift()):(this.x+=i/c*o,this.y+=a/c*o)}render(e,s){const r=this.path.length>0,i=3+Math.floor(e*(r?6:2.5)+this.index)%2,a=Math.round(this.x)-6,c=Math.round(this.y)-13-i;let o="front";this.face==="up"?o=this.seated&&s==="working"&&Math.floor(e*8)%2?"type":"back":this.face==="right"?o="side":this.face==="left"&&(o="sideL"),this.sprite.texture=this.sprites.textures[o],this.sprite.position.set(a,c),this.sprite.zIndex=Math.round(this.y),this.headY=c}}function OM(t,e,s,r,i){if(t.path.length)return;const a=d1(t,e),c=a&&Math.abs(t.x-qo(e,a).x)<1&&Math.abs(t.y-qo(e,a).y)<1,o=t.errand;if(o){if(o.kind==="drop"){t.errand=null,o.onArrive();return}o.kind==="plan"&&(t.emote={type:"talk",until:r+1.6}),o.kind==="coffee"&&(t.emote={type:"coffee",until:r+2.4}),t.errand=null,t.pause=o.kind==="wander"?2+i()*3:1.8;return}if(!(t.pause>0)){if(s!=="idle"){a&&!c?t.goTo(e,a):(t.seated=!0,t.face="up");return}i()<.5&&e.lounge.coffee.length?(t.errand={kind:"coffee"},t.goTo(e,e.lounge.coffee[t.index%e.lounge.coffee.length])):e.wander.length&&(t.errand={kind:"wander"},t.goTo(e,e.wander[Math.floor(i()*e.wander.length)])),t.path.length||(t.errand=null)}}function d1(t,e){var s;return t.config.isLead?e.lead.seat:((s=e.desks.find(r=>r.agentId===t.config.id))==null?void 0:s.seat)??null}function qv(t,e,s,r){t.errand=s,t.pause=0,t.goTo(e,r),!t.path.length&&s.kind==="drop"&&(t.errand=null,s.onArrive())}const Kv={A:[".#.","#.#","###","#.#","#.#"],B:["##.","#.#","##.","#.#","##."],C:[".##","#..","#..","#..",".##"],D:["##.","#.#","#.#","#.#","##."],E:["###","#..","##.","#..","###"],F:["###","#..","##.","#..","#.."],G:[".##","#..","#.#","#.#",".##"],H:["#.#","#.#","###","#.#","#.#"],I:["###",".#.",".#.",".#.","###"],J:["..#","..#","..#","#.#",".#."],K:["#.#","#.#","##.","#.#","#.#"],L:["#..","#..","#..","#..","###"],M:["#.#","###","###","#.#","#.#"],N:["##.","#.#","#.#","#.#","#.#"],O:[".#.","#.#","#.#","#.#",".#."],P:["##.","#.#","##.","#..","#.."],Q:[".#.","#.#","#.#","##.",".##"],R:["##.","#.#","##.","#.#","#.#"],S:[".##","#..",".#.","..#","##."],T:["###",".#.",".#.",".#.",".#."],U:["#.#","#.#","#.#","#.#","###"],V:["#.#","#.#","#.#","#.#",".#."],W:["#.#","#.#","###","###","#.#"],X:["#.#","#.#",".#.","#.#","#.#"],Y:["#.#","#.#",".#.",".#.",".#."],Z:["###","..#",".#.","#..","###"],0:["###","#.#","#.#","#.#","###"],1:[".#.","##.",".#.",".#.","###"],2:["##.","..#",".#.","#..","###"],3:["##.","..#",".#.","..#","##."],4:["#.#","#.#","###","..#","..#"],5:["###","#..","##.","..#","##."],6:[".##","#..","###","#.#","###"],7:["###","..#",".#.",".#.",".#."],8:["###","#.#","###","#.#","###"],9:["###","#.#","###","..#","##."],"#":["#.#","###","#.#","###","#.#"],"-":["...","...","###","...","..."],".":["...","...","...","...",".#."],":":["...",".#.","...",".#.","..."],"!":[".#.",".#.",".#.","...",".#."],"?":["##.","..#",".#.","...",".#."],"+":["...",".#.","###",".#.","..."],"/":["..#","..#",".#.","#..","#.."],"(":["..#",".#.",".#.",".#.","..#"],")":["#..",".#.",".#.",".#.","#.."],",":["...","...","...",".#.","#.."],"'":[".#.",".#.","...","...","..."],"&":[".#.","#.#",".#.","#.#",".##"],_:["...","...","...","...","###"],"=":["...","###","...","###","..."],">":["#..",".#.","..#",".#.","#.."],"·":["...","...",".#.","...","..."],"—":["...","...","###","...","..."]," ":["...","...","...","...","..."]},Ot=(t,e=1)=>Math.max(0,String(t).length*4-1)*e;function Et(t,e,s,r,i,a=1){const c=String(e).toUpperCase(),o=Math.round(s),h=Math.round(r);for(let u=0;u<c.length;u++){const f=Kv[c[u]]??Kv["?"];for(let d=0;d<5;d++){const g=f[d];let _=0;for(;_<3;){if(g[_]!=="#"){_+=1;continue}let k=1;for(;_+k<3&&g[_+k]==="#";)k+=1;t.rect(o+(u*4+_)*a,h+d*a,k*a,a,i),_+=k}}}}function Tc(t,e,s,r,i=H.ink,a=H.white){const c=Ot(e),o=Math.round(s-c/2);t.rect(o-2,r-1,c+4,7,i),Et(t,e,o,r,a)}function f1(t,e){const s=Math.max(1,Math.floor((e+1)/4));return t.length<=s?t:t.slice(0,Math.max(1,s-1))+"."}class FM{constructor(){ge(this,"list",[])}envelope(e,s,r){this.list.push({kind:"env",fromX:e,fromY:s,toId:r,t:0})}text(e,s,r,i=H.yellow){this.list.push({kind:"text",str:e,x:s,y:r,life:1.6,color:i})}burst(e,s,r,i=14){for(let a=0;a<i;a++)this.list.push({kind:"px",x:e,y:s,vx:(Math.random()-.5)*70,vy:-30-Math.random()*50,life:.6+Math.random()*.6,color:r[a%r.length]})}clear(){this.list=[]}update(e){for(const s of this.list)s.kind==="env"?s.t+=e/1.1:s.kind==="text"?(s.life-=e,s.y-=12*e):(s.life-=e,s.vy+=140*e,s.x+=s.vx*e,s.y+=s.vy*e);this.list=this.list.filter(s=>s.kind==="env"?s.t<1:s.life>0)}draw(e,s){for(const r of this.list)if(r.kind==="env"){const i=s(r.toId);if(!i)continue;const a=r.t<.5?2*r.t*r.t:1-Math.pow(-2*r.t+2,2)/2,c=Math.round(r.fromX+(i.x-r.fromX)*a)-4,o=Math.round(r.fromY+(i.y-20-r.fromY)*a-Math.sin(a*Math.PI)*36)-3;e.rect(c,o,9,7,H.ink),e.rect(c+1,o+1,7,5,H.white),e.rect(c+2,o+2,1,1,H.pink),e.rect(c+3,o+3,3,1,H.pink),e.rect(c+6,o+2,1,1,H.pink)}else if(r.kind==="text"){if(r.life>.15||Math.floor(r.life*30)%2){const i=Ot(r.str);e.rect(Math.round(r.x-i/2)-2,Math.round(r.y)-2,i+4,9,H.ink),Tc(e,r.str,r.x,Math.round(r.y),H.ink,r.color)}}else e.rect(Math.round(r.x),Math.round(r.y),1,1,r.color)}}const $M=40,HM=12,UM=t=>t<.5?2*t*t:1-Math.pow(-2*t+2,2)/2;class WM{constructor(e){ge(this,"hLen");ge(this,"len");ge(this,"gateEntry");ge(this,"gateCentre");ge(this,"gateExit");this.l=e;const s=e.belt;this.hLen=s.x1-s.x0,this.len=this.hLen+(s.topY!==null?s.y-s.topY:0),this.gateEntry=e.gate?e.gate.x-6-s.x0:null,this.gateCentre=e.gate?e.gate.x+e.gate.w/2-s.x0:null,this.gateExit=e.gate?e.gate.x+e.gate.w+10-s.x0:null}pos(e){const s=this.l.belt;return e<=this.hLen?{x:s.x0+e,y:s.y}:{x:s.x1,y:s.y-(e-this.hLen)}}sAtX(e){return Math.max(0,Math.min(this.hLen,e-this.l.belt.x0))}}function zM(t,e,s,r,i){for(const h of t)h.mode!=="fly"||!h.fly||(h.fly.t=Math.min(1,h.fly.t+r/.9),h.fly.t>=1&&(h.mode=h.fly.then,h.s=h.fly.s,h.fly=null));const a=t.filter(h=>h.mode==="belt"||h.mode==="scan").sort((h,u)=>u.s-h.s);let c=a.some(h=>h.mode==="scan");for(const h of t){const u=e.get(h.num);if(!u||h.mode==="gone"||h.mode==="fly"||h.mode==="carry")continue;const f=i.deskPos(h.authorId);if(u.review==="changes-requested"&&!u.merged){(h.mode==="belt"||h.mode==="scan")&&f&&(h.fly={from:s.pos(h.s),to:f,t:0,then:"home",s:0},h.mode="fly",h.mode==="fly"&&(c=a.some(d=>d!==h&&d.mode==="scan")));continue}if(h.mode==="home"){const d=(u.review==="passed"||u.merged)&&s.gateExit!==null?s.gateExit:i.dropS(h.authorId);h.fly={from:f??s.pos(d),to:s.pos(d),t:0,then:"belt",s:d},h.mode="fly"}}let o=null;for(const h of a){const u=e.get(h.num);if(!u||h.mode==="fly"||h.mode==="home")continue;let f;if(u.merged?f=s.len:u.review==="passed"||s.gateEntry===null?f=s.gateExit!==null?Math.max(h.s,s.gateExit):s.len-30:u.review==="reviewing"&&!c&&s.gateCentre!==null&&h.s>=s.gateEntry-1?(f=s.gateCentre,h.mode="scan",c=!0):f=h.mode==="scan"&&s.gateCentre!==null?s.gateCentre:s.gateEntry,o&&!u.merged&&o.mode!=="gone"&&(f=Math.min(f,o.s-HM)),u.review==="passed"&&h.mode==="scan"&&(h.mode="belt"),h.s<f&&(h.s=Math.min(f,h.s+$M*(u.merged?2.5:1)*r)),u.merged&&h.s>=s.len-.5){h.mode="gone",i.onMerged(h);continue}o=h}}function VM(t,e){if(t.mode==="belt"||t.mode==="scan")return{...e.pos(t.s),lift:0};if(t.mode==="fly"&&t.fly){const s=UM(t.fly.t),r=t.fly.from.x+(t.fly.to.x-t.fly.from.x)*s,i=t.fly.from.y+(t.fly.to.y-t.fly.from.y)*s;return{x:r,y:i,lift:Math.sin(s*Math.PI)*30}}return null}const GM={todo:0,blocked:0,"in-progress":1,"in-review":2,done:3};class qM{constructor(){ge(this,"notes",new Map);ge(this,"boardId",null)}update(e,s,r,i,a){s!==this.boardId&&(this.notes.clear(),this.boardId=s);const c=e.filter(u=>u.boardId===s),o=new Set;for(let u=0;u<4;u++){const f=c.filter(d=>GM[d.status]===u);u===3&&f.reverse(),f.forEach((d,g)=>{o.add(d.id);const _=r.x+u*35+2+g%4*8,k=r.y+11+Math.floor(g/4)*7,S=this.notes.get(d.id);S?Object.assign(S,{tx:_,ty:k,hidden:g>=16}):this.notes.set(d.id,{x:_,y:k,tx:_,ty:k,hidden:g>=16,born:this.notes.size?a:-10})})}for(const u of[...this.notes.keys()])o.has(u)||this.notes.delete(u);const h=1-Math.exp(-5*i);for(const u of this.notes.values())u.x+=(u.tx-u.x)*h,u.y+=(u.ty-u.y)*h}draw(e,s,r,i){const a=new Map(s.map(o=>[o.id,o])),c=[...this.notes.entries()].sort(([,o],[,h])=>Math.abs(o.x-o.tx)+Math.abs(o.y-o.ty)-(Math.abs(h.x-h.tx)+Math.abs(h.y-h.ty)));for(const[o,h]of c){const u=a.get(o);if(!u||h.hidden)continue;const f=r(u.ownerId),d=Math.abs(h.x-h.tx)+Math.abs(h.y-h.ty),g=d>1?Math.min(3,d/6):0,_=Math.round(h.x),k=Math.round(h.y-g);g&&e.rect(_+1,k+g+1,7,6,H.shadow,.25),u.status==="done"?(e.rect(_,k,7,6,"#ddd5c4"),e.rect(_,k,2,6,f),e.rect(_+3,k+3,1,1,"#008751"),e.rect(_+4,k+2,1,1,"#008751"),e.rect(_+5,k+1,1,1,"#008751")):(e.rect(_,k,7,6,f),e.rect(_,k,7,1,nc(f,.5)),e.rect(_+1,k+3,4,1,nc(f,-.3)),u.status==="in-review"&&e.rect(_+5,k+4,1,1,H.ink),u.status==="blocked"&&e.rect(_+5,k+1,2,2,H.red)),i-h.born<.6&&Math.floor(i*10)%2&&(e.rect(_-1,k-1,9,1,H.white),e.rect(_-1,k+6,9,1,H.white))}}}const Ai=(t,e)=>Math.floor(t*e)%2===1;function ld(t,e,s,r,i,a,c){if(t.rect(e,s,18,11,H.screen),r==="needs-input")Ai(a,4)?(t.rect(e,s,18,11,"#7e0f33"),t.rect(e+8,s+2,2,5,H.white),t.rect(e+8,s+8,2,1,H.white)):(t.rect(e+8,s+2,2,5,H.red),t.rect(e+8,s+8,2,1,H.red));else if(r==="in-review"){const o=H.orange;t.rect(e+6,s+2,6,1,o),t.rect(e+7,s+3,4,1,o),t.rect(e+8,s+4,2,2,o),t.rect(e+7,s+6,4,1,o),t.rect(e+6,s+7,6,1,o)}else if(r==="review-passed")for(let o=0;o<8;o++)t.rect(e+5+o,s+(o<3?5+o:10-o),1,1,H.green);else if(r==="idle"){const o=Math.floor(Math.abs((a*6+c*5)%32-16)),h=Math.floor(Math.abs((a*4+c*3)%18-9));t.rect(e+Math.min(16,o),s+Math.min(9,h),2,2,i)}else{const o=Math.floor(a*3);for(let h=0;h<5;h++){const u=(o+h)*7+c*13,f=u%3*2,d=3+u*5%9;t.rect(e+1+f,s+1+h*2,d,1,[H.blue,H.pink,H.green,"#c9b6ff",H.white][u%5])}Ai(a,3)&&t.rect(e+1,s+11-1,2,1,H.white)}}function KM(t,e,s,r,i,a){const c=Cn[i];let o=c.color;i==="needs-input"&&(o=Ai(a,6)?H.red:c.dim),i==="idle"&&(o=c.dim);const h=s+e.x0*16,u=r+e.y0*16;for(let f=0;f<7;f++)f!==1&&t.rect(h+f*16,u,16,3,o);i==="working"&&t.rect(h+Math.floor(a*40)%112,u,8,3,"#bfe9ff")}function YM(t,e,s,r,i){const a=Cn[r];t.rect(e+278,s+90,6,2,H.ink),t.rect(e+280,s+80,1,10,H.ink),De(t,e+277,s+76,8,5,r==="needs-input"&&Ai(i,6)?a.dim:a.color)}function XM(t,e,s){const r=e.belt,i=Math.floor(s*26)%6,a=r.y-9,c=r.topY!==null?r.x1+9:r.x1;t.rect(r.x0-6,a,c-r.x0+6,18,H.ink),t.rect(r.x0-4,a+3,c-r.x0+2,12,H.belt);for(let o=r.x0-4+i;o<c-2;o+=6)t.rect(o,a+4,1,10,H.beltL);if(t.rect(r.x0-4,a+2,c-r.x0+2,1,H.rail),t.rect(r.x0-4,a+15,c-r.x0+2,1,H.rail),t.rect(r.x0-8,a+1,4,16,H.metalD),r.topY!==null){const o=r.x1-9;t.rect(o,r.topY,18,r.y-r.topY+9,H.ink),t.rect(o+3,r.topY+2,12,r.y-r.topY+4,H.belt);for(let h=r.y-i;h>r.topY+2;h-=6)t.rect(o+4,h,10,1,H.beltL);t.rect(o+2,r.topY+2,1,r.y-r.topY,H.rail),t.rect(o+15,r.topY+2,1,r.y-r.topY,H.rail),t.rect(o+1,r.topY-6,16,6,"#1f1d26")}}function QM(t,e,s,r,i,a,c){const o=e.x,h=e.x+e.w,u=e.w,f=Math.round((o+h)/2),d=e.y;t.rect(o,d,u,46,H.ink),t.rect(o+1,d+1,u-2,11,H.metal),t.rect(o+1,d+1,u-2,1,H.metalL),t.rect(o+1,d+12,u-2,33,H.metalD),t.rect(o+1,d+25,3,15,"#1f1d26"),t.rect(h-4,d+25,3,15,"#1f1d26"),t.rect(o+12,d+16,44,21,H.ink),t.rect(o+13,d+17,42,19,"#0f2a1f");for(let k=d+19;k<d+35;k+=4)t.rect(o+14,k,40,1,"#163d2c");s==="reviewing"?(t.rect(f-5,d+22,10,9,"#a8e72c"),t.rect(f-4,d+23,8,7,"#0f2a1f"),t.rect(f-1,d+23,2,7,"#a8e72c"),t.rect(o+13+Math.floor(i*30%42),d+17,1,19,H.yellow)):s==="passed"?Et(t,"OK",f-3,d+24,H.green):s==="changes"&&Et(t,"FIX",f-5,d+24,H.red);const g=f1(a.toUpperCase(),u-4);Et(t,g,f-Ot(g)/2,d+39,H.ink),[5,15,u-18,u-8].forEach((k,S)=>{let m="#5a5170";s==="reviewing"?m=S===Math.floor(i*8)%4?H.orange:"#7a4a10":s==="passed"?m=Ai(i,8)?H.green:"#00873a":s==="changes"&&(m=Ai(i,8)?H.red:"#7e0f33"),t.rect(o+k,d+3,6,4,H.ink),t.rect(o+k+1,d+3,4,3,m)});let _=0;s==="reviewing"?_=Math.round(Math.abs(Math.sin(i*8))*3):s==="passed"&&(_=Math.round(Math.sin(Math.min(1,r/.6)*Math.PI)*8)),Is(t,f,d+4,4,H.ink,.25),c?Uv(t,Math.floor(i*10)%31===0?EM:kM,PM,f-4,d-8-_):Uv(t,MM,AM,f-4,d-6-_)}function ZM(t,e,s,r,i,a){for(const c of e){const o=s.find(g=>g.name===c.name),h=r(c.agentId),u=(o==null?void 0:o.status)==="sleeping"?.03:h?{working:.8,"in-review":.45,"review-passed":.6,"needs-input":.12,idle:.1}[h]:.35,f=Math.floor(a*10),d=i(c.name);for(let g=0;g<8;g++)for(let _=0;_<3;_++){const k=Math.sin((f+1)*12.9898+(g*3+_)*78.233+c.x)*43758.5453,S=k-Math.floor(k);let m="#2e2b36";(o==null?void 0:o.status)==="deploying"?m=(g+Math.floor(a*12))%3===0?"#3ee0d0":"#1f5f66":d>.05?m=Ai(a,12)?H.green:"#00873a":S<u&&(m=_===2&&S<.08?H.orange:(g+_)%3?H.green:H.blue),t.rect(c.x+18+_*3,c.y+15+g*10,2,1,m)}d>.05&&(t.rect(c.x,c.y-1,32,2,H.green,d),t.rect(c.x,c.y+c.h-1,32,2,H.green,d),t.rect(c.x,c.y-1,2,c.h,H.green,d),t.rect(c.x+30,c.y-1,2,c.h,H.green,d))}}function JM(t,e,s,r){s.slice(-6).forEach((i,a)=>{const c=e.x+3+a%3*20,o=e.y+11+Math.floor(a/3)*14,h=i.merged?"#00873a":Y0[i.review].color;t.rect(c+1,o+1,18,12,H.ink,.3),t.rect(c,o,18,12,i.merged?"#e0dccf":H.white),Et(t,`#${i.number%1e3}`,c+2,o+3,H.ink),t.rect(c+2,o+9,14,2,h),t.rect(c+8,o-1,3,2,r(i.authorId))})}function eA(t,e,s,r,i){for(const a of e.cables){const c=s(a.agentId)??"idle",o={working:60,"in-review":24,"review-passed":40,"needs-input":4,idle:8}[c],h=i*o%14;let u=0;for(let f=0;f<a.pts.length-1;f++){const[d,g]=a.pts[f],[_,k]=a.pts[f+1],S=Math.abs(_-d)+Math.abs(k-g);for(let m=(14-((u-h)%14+14)%14)%14;m<S;m+=14){const x=m/S,v=c==="needs-input"?H.red:c==="idle"?r(a.agentId):H.white;t.rect(Math.round(d+(_-d)*x)-1,Math.round(g+(k-g)*x)-1,3,3,v,c==="idle"?.5:.9)}u+=S}}}function tA(t,e,s){const r={x:e.ox+e.lounge.x0*16+66,y:e.oy+22,w:60,h:28},i=new Date().getHours(),a=i<7||i>=19;if(t.rect(r.x,r.y,r.w,r.h,a?H.skyN:H.sky),a){for(const[g,_]of[[6,5],[19,12],[33,4],[47,9],[54,18],[12,20]])t.rect(r.x+g,r.y+_,1,1,Math.sin(s*2+g)>-.3?H.white:H.lav);Is(t,r.x+44,r.y+8,3,"#fff1c4")}else for(const[g,_,k]of[[0,7,14],[37,17,10]]){const S=r.x+(s*3+g)%(r.w-k);t.rect(S,r.y+_,k,3,H.cloud),t.rect(S+3,r.y+_-2,k-6,2,H.cloud)}t.rect(r.x+r.w/2-1,r.y,2,r.h,H.white),t.rect(r.x,r.y+r.h/2-1,r.w,2,H.white);const c=e.ox+e.lounge.x0*16-8,o=e.oy+36,h=new Date,u=h.getMinutes(),f=u/60*Math.PI*2-Math.PI/2,d=(h.getHours()%12+u/60)/12*Math.PI*2-Math.PI/2;uc(t,c,o,c+Math.cos(f)*5,o+Math.sin(f)*5,H.ink),uc(t,c,o,c+Math.cos(d)*3,o+Math.sin(d)*3,H.red)}function Yv(t,e,s,r,i,a){const c=Math.round(e)-4,o=Math.round(s)-5;t.rect(c,o,8,7,H.ink),t.rect(c+1,o+1,6,2,"#f0c48a"),t.rect(c+1,o+3,6,3,"#c98a4e"),t.rect(c+3,o+1,2,2,H.white),t.rect(c+2,o+4,3,1,i),a&&Tc(t,`#${r}`,e,o-8,H.ink,H.yellow)}function sA(t,e,s){const r=e.plan.board;Tc(t,f1(s.toUpperCase(),r.w),r.x+r.w/2,r.y-11,H.ink,H.yellow)}function rA(t,e){Ks(t,Math.round(e.x),Math.round(e.y)+1,4,1,H.shadow,.3)}function iA(t,e,s,r){const i=Math.round(e.x)-6,a=e.headY,c=Cn[s];let o=c.color;s==="needs-input"?o=Math.floor(r*6)%2?c.color:c.dim:s==="working"&&(o=Math.floor(r*2)%2?c.color:"#9ddcff"),t.rect(i+5,a+1,2,1,o);const h=s==="needs-input"?H.red:s==="review-passed"?H.green:"#bff6ff",u=Math.floor(r*10+e.index*7)%37===0;if(e.face==="down")if(s==="review-passed")for(const f of[3,6])t.rect(i+f,a+7,1,1,h),t.rect(i+f+1,a+6,1,1,h),t.rect(i+f+2,a+7,1,1,h);else s==="idle"?(t.rect(i+3,a+7,2,1,H.lav),t.rect(i+7,a+7,2,1,H.lav)):(t.rect(i+4,a+(u?7:6),1,u?1:2,h),t.rect(i+7,a+(u?7:6),1,u?1:2,h));else(e.face==="right"||e.face==="left")&&t.rect(i+(e.face==="right"?8:3),a+(u?7:6),1,u?1:2,h);e.path.length&&Math.floor(r*12)%2&&t.rect(i+5,a+14,2,1,H.orange)}function Xv(t,e,s,r=H.white){const i=Math.round(e)-6;return t.rect(i+1,s,11,9,H.ink),t.rect(i,s+1,13,7,H.ink),t.rect(i+1,s+1,11,7,r),t.rect(i+5,s+9,3,1,H.ink),t.rect(i+6,s+10,1,1,H.ink),t.rect(i+6,s+8,1,1,r),i}function nA(t,e,s,r,i){if(e.carry!==null)return;let a=null;if(e.emote&&i<e.emote.until?a=e.emote.type:e.path.length?a=null:s==="needs-input"?a="bang":s==="in-review"?a="wait":s==="review-passed"?a="check":s==="working"?a="dots":s==="idle"&&(a="zz"),!a)return;const c=Math.round(e.x),o=e.headY-12;if(a==="zz"){const u=(r*.8+e.index*.3)%1;Et(t,"Z",c+4+Math.round(u*3),o+6-Math.round(u*8),H.lav);return}if(a==="bang"){const u=o-Math.floor(r*4)%2,f=Xv(t,c,u,H.red);t.rect(f+6,u+2,1,3,H.white),t.rect(f+6,u+6,1,1,H.white);return}const h=Xv(t,c,o);if(a==="dots")for(let u=0;u<3;u++)t.rect(h+3+u*3,o+4-(Math.floor(r*4)%3===u?1:0),1,1,H.blue);if(a==="wait"){const u=H.orange;t.rect(h+4,o+2,5,1,u),t.rect(h+5,o+3,3,1,u),t.rect(h+6,o+4,1,1,u),t.rect(h+5,o+5,3,1,u),t.rect(h+4,o+6,5,1,u)}if(a==="check")for(let u=0;u<7;u++)t.rect(h+3+u,o+(u<3?4+u:8-u),1,1,"#00a83a");if(a==="talk")for(let u=0;u<3;u++)t.rect(h+3+u*3,o+4,1,1,Math.floor(r*6)%3>=u?H.ink:H.lav);a==="mail"&&(t.rect(h+3,o+2,7,5,H.pink),t.rect(h+4,o+3,5,3,H.white),t.rect(h+5,o+4,3,1,H.pink)),a==="ok"&&Et(t,"OK",h+3,o+2,"#00a83a"),a==="coffee"&&(t.rect(h+4,o+3,4,4,H.ink),t.rect(h+5,o+3,2,1,"#7a4a2a"),t.rect(h+8,o+4,1,2,H.ink),t.rect(h+5,o+1-Math.floor(r*4)%2,1,1,H.lav))}function oA(t,e){Tc(t,e.config.name.toUpperCase().slice(0,10),Math.round(e.x),e.headY-9,H.ink,e.color)}function aA(t,e,s){if(Math.floor(s*3)%3===0)return;const{x:r,y:i,w:a,h:c}=e,o=4,h=H.yellow;for(const[u,f,d,g]of[[r,i,1,1],[r+a,i,-1,1],[r,i+c,1,-1],[r+a,i+c,-1,-1]])t.rect(d>0?u-1:u-o+1,g>0?f-1:f,o,1,h),t.rect(d>0?u-1:u,g>0?f-1:f-o+1,1,o,h)}const lA="Michael",p1=["Dwight","Jim","Pam","Angela","Kevin","Oscar","Stanley","Phyllis","Andy","Creed","Meredith"];function m1(t){const e=new Set(t.map(s=>s.trim().toLowerCase()));return p1.find(s=>!e.has(s.toLowerCase()))??`Agent ${t.length+1}`}const tf=19,g1="Setups Works Office";function cA(t){return(t??"").trim().slice(0,tf)||g1}function Nl(t,e,s,r=!0){const i=r?7:5;t.rect(e-4,s-7,9,7,H.ink),t.rect(e-3,s-6,7,5,H.pot),t.rect(e-3,s-6,7,1,"#d4704f"),t.rect(e+2,s-5,1,4,H.potD),Is(t,e,s-7-i,i+1,H.ink),Is(t,e,s-7-i,i,H.leafD),Is(t,e-1,s-8-i,i-2,H.leaf),t.rect(e-3,s-10-i,2,2,H.leafL),t.rect(e+2,s-6-i,1,2,H.leafL)}function Ol(t,e,s,r){Ks(t,e+3,s+r-1,r,4,H.shadow,.25),t.rect(e-2,s+r-9,5,9,H.ink),t.rect(e-1,s+r-9,3,8,"#7a4a2a"),Is(t,e,s,r+1,H.ink),Is(t,e,s,r,H.leafD),Is(t,e-2,s-2,r-3,H.leaf),Is(t,e-5,s-5,3,H.leafL),t.rect(e+4,s+2,2,2,H.leafL)}function cd(t,e,s,r,i){Ks(t,e+1,s+5,7,2,H.shadow,.25),Ks(t,e,s,7,6,H.ink),Ks(t,e,s,6,5,r),Ks(t,e-2,s-2,2,1,"#ffffff",.33),t.rect(e-4,s+2,8,2,i)}function hA(t,e,s){De(t,e,s,22,15,H.bezel),t.rect(e+2,s+2,18,11,H.screen),t.rect(e+9,s+15,4,3,H.metalD),t.rect(e+6,s+18,10,1,H.metalDD)}function Qv(t,e,s,r){const i=Ot(e);De(t,Math.round(s-i/2)-3,r,i+6,8,H.white),Et(t,e,Math.round(s-i/2),r+1,H.ink)}function uA(t,e,s,r){t.rect(e+1,s+26,46,4,H.shadow,.25),De(t,e,s+4,48,18,H.desk),t.rect(e+1,s+5,46,1,H.woodL),De(t,e,s+20,48,7,H.deskD),t.rect(e+2,s+26,3,4,H.deskDD),t.rect(e+43,s+26,3,4,H.deskDD),De(t,e+15,s+14,18,4,H.metal);for(let i=e+17;i<e+31;i+=3)t.rect(i,s+15,2,1,H.metalD);De(t,e+37,s+9,5,6,H.white),t.rect(e+42,s+11,1,2,H.ink),r%3===0?(t.rect(e+5,s+9,5,4,H.yellow),t.rect(e+8,s+8,3,2,H.yellow),t.rect(e+11,s+9,2,1,H.orange),t.rect(e+9,s+8,1,1,H.ink)):r%3===1?(De(t,e+4,s+11,7,5,H.pot),t.rect(e+6,s+5,3,6,H.leaf),t.rect(e+5,s+7,1,2,H.leaf),t.rect(e+9,s+6,1,2,H.leaf),t.rect(e+7,s+4,1,1,H.pink)):(t.rect(e+4,s+12,8,2,H.red),t.rect(e+5,s+10,7,2,H.blue),t.rect(e+4,s+8,7,2,H.green)),hA(t,e+13,s-6)}function dA(t,e,s,r){for(const a of[0,r-1]){const c=e+a*16+8;t.rect(c-3,s,6,r*16+4,H.ink),t.rect(c-2,s+1,4,r*16-4,H.part),t.rect(c-2,s+1,2,r*16-4,H.partCap),t.rect(c-2,s+r*16-3,4,6,H.partD)}for(let a=0;a<r;a++){if(a===1)continue;const c=e+a*16;t.rect(c,s-1,16,1,H.ink),t.rect(c,s,16,3,H.partCap),t.rect(c,s+3,16,10,H.part),t.rect(c,s+13,16,2,H.partD),t.rect(c,s+15,16,1,H.ink),t.rect(c+15,s+3,1,10,H.partD)}const i=e+16;t.rect(i-1,s-1,2,17,H.ink),t.rect(i+15,s-1,2,17,H.ink)}function fA(t,e,s,r,i){t.rect(e+1,s+r-1,30,3,"#000000",.3),De(t,e+1,s,30,r,"#2a2833"),t.rect(e+2,s+1,1,r-2,"#3d3a48"),t.rect(e+28,s+1,2,r-2,"#1f1d26");for(let c=0;c<8;c++){const o=s+12+c*10;t.rect(e+4,o,23,8,"#36333f"),t.rect(e+4,o+8,23,1,"#1f1d26"),t.rect(e+6,o+3,8,1,"#4c4858")}const a=i.toUpperCase().slice(0,6);De(t,e+16-Ot(a)/2-3,s+3,Ot(a)+6,8,H.white),Et(t,a,e+16-Ot(a)/2,s+4,H.ink)}function pA(t,e,s,r,i,a,c){t.rect(e+4,s+i-2,3,30,H.deskDD),t.rect(e+r-7,s+i-2,3,30,H.deskDD),t.rect(e+6,s+i+26,r-12,2,H.shadow,.25),De(t,e,s,r,i,H.corkD),t.rect(e+2,s+2,r-4,i-4,H.cork);for(let o=0;o<40;o++)t.rect(e+3+Math.floor(c()*(r-6)),s+9+Math.floor(c()*(i-12)),1,1,H.corkD);t.rect(e+2,s+2,r-4,7,H.white),Et(t,a,e+r/2-Ot(a)/2,s+3,H.ink)}function mA(t,e){var b,C;const s=Uf(t.worldW,t.worldH),r=s.getContext("2d"),i=new l1(r),a=jf(42),c=E=>E[Math.floor(a()*E.length)],o=t.W*16,h=t.H*16;i.rect(0,0,t.worldW,t.worldH,H.grass);for(let E=0;E<t.worldW*t.worldH/260;E++){const P=Math.floor(a()*t.worldW),T=Math.floor(a()*t.worldH),A=a()<.55?H.grassD:H.grassL;i.rect(P,T,1,2,A),i.rect(P+1,T+1,1,1,A)}for(let E=0;E<70;E++)i.rect(Math.floor(a()*t.worldW),Math.floor(a()*t.worldH),1,1,c([H.pink,H.yellow,H.white]));const u=t.oy+t.door[1]*16;i.rect(0,u,t.ox,16,H.path);for(let E=0;E<20;E++)i.rect(Math.floor(a()*(t.ox-2)),u+Math.floor(a()*15),2,1,H.pathD);i.rect(t.ox+o,t.oy+6,5,h,H.shadow,.25),i.rect(t.ox+6,t.oy+h,o,4,H.shadow,.25);for(let E=20;E<t.worldW-10;E+=70+Math.floor(a()*50))Ol(i,E,18+Math.floor(a()*6),12+Math.floor(a()*3)),Ol(i,E+20,t.worldH-22+Math.floor(a()*6),12+Math.floor(a()*3));for(let E=60;E<t.worldH-40;E+=80+Math.floor(a()*40))Math.abs(E-u)>30&&Ol(i,18+Math.floor(a()*6),E,13),Ol(i,t.worldW-22+Math.floor(a()*6),E+20,13);r.save(),r.translate(t.ox,t.oy);const f=(t.mainW+1)*16,d=t.lounge.x0*16;r.save(),r.beginPath(),r.rect(16,64,f-16,h-80),r.clip(),i.rect(16,64,f-16,h-80,H.wood);for(let E=0;E*8<h;E++){const P=64+E*8,T=E%3*16;i.rect(16,P,f,1,H.woodD);for(let A=16-T;A<f;A+=48)i.rect(A+1,P+1,47,7,c([H.wood,"#c4895a","#cf9563",H.wood])),i.rect(A,P,1,8,H.woodLine),a()<.12&&i.rect(A+10+Math.floor(a()*28),P+3,2,1,H.woodLine)}r.restore();const g=e.project.name.toUpperCase().slice(0,12);Et(i,g,Math.round(f/2-Ot(g,2)/2),212,H.woodD,2),i.rect(176,64,144,96,H.carpetJ),i.rect(179,67,138,90,H.carpetJD),i.rect(181,69,134,86,H.carpetJ);for(let E=72;E<154;E+=6)for(let P=184+(E%12?3:0);P<314;P+=6)i.rect(P,E,1,1,H.carpetJD);for(const E of t.desks){const P=(E.x0+1)*16,T=(E.y0+1)*16;i.rect(P,T,80,96,E.carpet[0]);for(let A=T+2;A<T+94;A+=4)for(let D=P+(A%8?2:0);D<P+80;D+=4)i.rect(D,A,1,1,E.carpet[1])}for(let E=0;E<4;E++)for(let P=0;P*8<f-d;P++)i.rect(d+P*8,64+E*8,8,8,(P+E)%2?H.tileD:H.tileL);i.rect(d+16,112,96,80,H.rugPD),i.rect(d+18,114,92,76,H.rugP);for(let E=d+20;E<d+110;E+=4)i.rect(E,116,2,72,"#836399");Ks(i,88,150,42,28,H.rugGD),Ks(i,88,150,39,25,H.rugG),Ks(i,88,150,30,18,H.rugGD),Ks(i,88,150,28,16,H.rugG);const _=t.serverRoom;if(_){const E=_.x0*16,P=_.w*16;i.rect(E,64,P,h-80,H.grate);for(let T=64;T<h-16;T+=8)i.rect(E,T,P,1,H.grateD);for(let T=E;T<E+P;T+=8)i.rect(T,64,1,h-80,H.grateD)}for(const E of t.cables){const P=((b=e.team.find(T=>T.id===E.agentId))==null?void 0:b.color)??H.blue;for(let T=0;T<E.pts.length-1;T++){const[A,D]=E.pts[T],[I,O]=E.pts[T+1],z=Math.min(A,I)-t.ox,U=Math.min(D,O)-t.oy;i.rect(z-1,U-1,Math.abs(I-A)+3,Math.abs(O-D)+3,"#2a2230"),i.rect(z,U,Math.abs(I-A)+1,Math.abs(O-D)+1,P,.55)}}i.rect(0,0,o,16,H.wallTop),i.rect(0,15,o,1,H.wallTopL),i.rect(0,16,f,48,H.wall);for(let E=18;E<44;E+=4)for(let P=E%8?2:0;P<f;P+=4)i.rect(P,E,1,1,H.wallL);i.rect(0,44,f,1,"#7aa597"),i.rect(0,45,f,15,H.wallD);for(let E=8;E<f;E+=16)i.rect(E,47,1,11,"#365a50");if(i.rect(0,60,o,4,H.base),i.rect(0,60,o,1,"#8a6450"),_){i.rect(f,16,o-f,44,H.wallSrv);for(let P=f;P<o;P+=8)i.rect(P,16,1,44,H.wallSrvD);const E="SERVER ROOM";De(i,_.x0*16+_.w*16/2-Ot(E)/2-3,3,Ot(E)+6,9,H.ink),Et(i,E,_.x0*16+_.w*16/2-Ot(E)/2,5,H.white)}if(i.rect(0,16,o,2,"#000000",.2),i.rect(0,0,16,h,H.wallTop),i.rect(15,16,1,h-32,H.wallTopL),i.rect(o-16,0,16,h,H.wallTop),i.rect(o-16,16,1,h-32,H.wallTopL),i.rect(0,h-16,o,16,H.wallTop),i.rect(16,h-16,o-32,1,H.wallTopL),i.rect(0,u-t.oy,16,16,H.wood),i.rect(0,u-t.oy-3,20,3,H.deskDD),i.rect(0,u-t.oy+16,20,3,H.deskDD),_){const E=_.glassX*16;i.rect(E,64,16,h-80,"#a8d8ea",.42),i.rect(E,64,1,h-80,H.metalD),i.rect(E+15,64,1,h-80,H.metalD);for(let P=64;P<h-16;P+=44)i.rect(E,P,16,2,H.metalD),uc(i,E+3,P+16,E+12,P+6,"#e3f6fb"),uc(i,E+3,P+22,E+7,P+18,"#e3f6fb")}const k={x:t.plan.board.x-t.ox,y:t.plan.board.y-t.oy,w:t.plan.board.w};De(i,k.x-3,k.y-2,k.w+6,46,H.deskD),i.rect(k.x,k.y,k.w,40,"#f7f3ea"),i.rect(k.x,k.y+38,k.w,2,"#d8d0c0"),i.rect(k.x+6,k.y+41,k.w-12,2,H.metalD),i.rect(k.x+20,k.y+40,6,1,H.red),i.rect(k.x+28,k.y+40,6,1,H.blue),[["TODO",H.lav],["DOING",H.blue],["REVIEW",H.orange],["DONE",H.green]].forEach(([E,P],T)=>{const A=k.x+T*35;T&&i.rect(A,k.y+2,1,35,"#ddd5c4"),Et(i,E,A+(35-Ot(E))/2+1,k.y+2,H.ink),i.rect(A+3,k.y+8,30,1,P)}),De(i,208,22,80,24,H.desk),i.rect(209,23,78,1,H.woodL);const m=cA(e.project.officeName),x=Ot(m,2)<=76?2:1;Et(i,m,249-Ot(m,x)/2,x===2?30:33,H.ink,x),Et(i,m,248-Ot(m,x)/2,x===2?29:32,H.white,x),De(i,180,22,22,26,H.navy),i.rect(189,27,4,9,H.white),i.rect(190,26,2,1,H.red),i.rect(190,37,2,2,H.orange),Et(i,"SHIP",184,41,H.yellow),Is(i,d-8,36,8,H.ink),Is(i,d-8,36,7,H.white),De(i,d+63,19,66,34,H.white),i.rect(d+62,53,68,3,H.deskD),De(i,288,30,32,44,H.deskD),i.rect(290,32,28,40,"#6e4630");for(let E=0;E<3;E++){const P=34+E*13;i.rect(290,P+10,28,2,H.deskD);for(let T=291;T<316;){const A=2+Math.floor(a()*3),D=7+Math.floor(a()*3);i.rect(T,P+10-D,A,D,c([H.red,H.blue,H.green,H.yellow,H.pink,H.peach,H.lav])),T+=A+(a()<.2?2:0)}}if(Nl(i,184,78),t.lead.agentId){i.rect(210,102,76,3,H.shadow,.25),De(i,208,82,80,18,H.desk),i.rect(209,83,78,1,H.woodL),De(i,208,98,80,7,H.deskD),De(i,222,70,22,15,H.bezel),De(i,248,70,22,15,H.bezel),De(i,230,92,30,4,H.metal),De(i,212,86,6,6,H.white),i.rect(213,87,4,2,"#7a4a2a");const E=e.team.find(P=>P.id===t.lead.agentId);E&&Qv(i,E.name.toUpperCase().slice(0,8),249,99)}Nl(i,24,76),cd(i,56,136,"#e05a47","#b8443a"),cd(i,136,136,"#3fa7a0","#2f817c"),cd(i,88,168,"#f2b33d","#c88d22"),De(i,18,172,13,12,H.metal),i.rect(20,174,9,2,H.ink),i.rect(21,170,7,3,H.white),De(i,d,54,48,10,H.metal),De(i,d,63,48,14,H.desk),De(i,d+18,36,12,20,"#3a3640"),i.rect(d+19,37,10,3,H.white),i.rect(d+21,44,6,6,"#1f1d26"),De(i,d+34,57,12,5,H.metalD),De(i,d+49,26,14,50,"#e9e9ef"),i.rect(d+50,44,12,1,H.metalD),i.rect(d+52,52,3,3,H.red);const v=f-16;De(i,v+1,48,12,26,H.white),De(i,v+2,36,10,13,"#7fd0f2"),i.rect(d+32,140,66,3,H.shadow,.25),De(i,d+30,120,68,10,H.couchD),De(i,d+32,128,64,12,H.couch),De(i,d+28,122,6,18,H.couchD),De(i,d+94,122,6,18,H.couchD),i.rect(d+34,129,60,1,"#5aa0ae"),De(i,d+50,162,28,9,H.desk),De(i,d+57,160,5,5,H.white),De(i,v+1,100,14,34,"#5b3a8e"),i.rect(v+2,101,12,5,H.yellow),Et(i,"GO",v+4,101,H.ink),De(i,v+3,107,10,9,H.ink),De(i,v+2,118,12,4,"#7a55b0"),Nl(i,d-8,76),Nl(i,v+8,204,!1);for(const E of t.desks){const P=E.x0*16,T=E.y0*16;uA(i,(E.x0+2)*16,T+16,E.index),dA(i,P,T,7);const A=((C=e.team.find(D=>D.id===E.agentId))==null?void 0:C.name.toUpperCase().slice(0,10))??"";Qv(i,A,P+64,T+4)}t.prBoard&&pA(i,t.prBoard.x-t.ox,t.prBoard.y-t.oy,t.prBoard.w,t.prBoard.h,"PULL REQS",a);for(const E of t.racks)fA(i,E.x-t.ox,E.y-t.oy,E.h,E.name);if(t.mailbox){const E={x:t.mailbox.x-t.ox,y:t.mailbox.y-t.oy};De(i,E.x,E.y,22,30,"#5f6b80"),i.rect(E.x+3,E.y+10,16,6,"#1f1d26"),Et(i,"MAIN",E.x+4,E.y+3,H.white)}return r.restore(),s}const gA=1,_A=6,sf=Math.max(1,Math.round(window.devicePixelRatio||1)),jo=1/sf,hd=t=>Math.max(gA,Math.min(_A,Math.round(t/jo)*jo)),Zv=t=>Math.round(t*sf)/sf,vA=t=>t<.5?2*t*t:1-Math.pow(-2*t+2,2)/2;class xA{constructor(e,s,r,i){ge(this,"zoom",2);ge(this,"x",0);ge(this,"y",0);ge(this,"worldW",1);ge(this,"worldH",1);ge(this,"flight",null);this.world=e,this.viewport=s,this.insets=r,this.reducedMotion=i}setWorldSize(e,s){this.worldW=e,this.worldH=s}fitZoom(){const{w:e,h:s}=this.viewport(),r=this.insets(),i=Math.max(100,e-r.left-r.right),a=Math.max(100,s-r.top-r.bottom),c=Math.min(i/this.worldW,a/this.worldH)+.2;return hd(Math.floor(c/jo)*jo)}home(e=!0){this.flyTo(this.worldW/2,this.worldH/2,this.fitZoom(),e)}flyTo(e,s,r=this.zoom,i=!0){const a=hd(r);if(!i||this.reducedMotion()){this.flight=null,Object.assign(this,{x:e,y:s,zoom:a}),this.apply();return}this.flight={from:{x:this.x,y:this.y,z:this.zoom},to:{x:e,y:s,z:a},t:0,dur:.7}}zoomBy(e,s){const r=hd(this.zoom+e*jo);if(r!==this.zoom){if(this.flight=null,s){const i=this.screenToWorld(s.x,s.y);this.zoom=r;const a=this.screenToWorld(s.x,s.y);this.x+=i.x-a.x,this.y+=i.y-a.y}else this.zoom=r;this.apply()}}panBy(e,s){this.flight=null,this.x-=e/this.zoom,this.y-=s/this.zoom,this.apply()}update(e){const s=this.flight;if(!s)return;s.t=Math.min(1,s.t+e/s.dur);const r=vA(s.t);this.x=s.from.x+(s.to.x-s.from.x)*r,this.y=s.from.y+(s.to.y-s.from.y)*r,this.zoom=s.t<.5?s.from.z:s.to.z,s.t>=1&&(this.flight=null),this.apply()}centre(){const{w:e,h:s}=this.viewport(),r=this.insets();return{cx:r.left+(e-r.left-r.right)/2,cy:r.top+(s-r.top-r.bottom)/2}}screenToWorld(e,s){return{x:(e-this.world.x)/this.zoom,y:(s-this.world.y)/this.zoom}}worldToScreen(e,s){return{x:e*this.zoom+this.world.x,y:s*this.zoom+this.world.y}}apply(){this.x=Math.max(-60,Math.min(this.worldW+60,this.x)),this.y=Math.max(-60,Math.min(this.worldH+60,this.y));const{cx:s,cy:r}=this.centre();this.world.scale.set(this.zoom),this.world.position.set(Zv(s-this.x*this.zoom),Zv(r-this.y*this.zoom))}}const Jv=(t,e,s)=>e>=t.x&&s>=t.y&&e<=t.x+t.w&&s<=t.y+t.h;function ex(t,e,s){const r=t.layout;if(!r)return null;const{x:i,y:a}=t.camera.screenToWorld(e,s),c=[...t.bots.values()].sort((o,h)=>h.y-o.y);for(const o of c){const h=t.botRect(o);if(Jv(h,i,a))return{hit:{kind:"agent",id:o.config.id,rect:h},rect:h}}for(const o of r.hits)if(Jv(o.rect,i,a))return{hit:o,rect:o.rect};return null}function yA(t){const e=be.getState().snap;if(!e)return{title:""};if(t.kind==="agent"){const r=e.config.team.find(c=>c.id===t.id),i=e.agents.find(c=>c.agentId===t.id),a=i!=null&&i.currentTaskId?e.tasks.find(c=>c.id===i.currentTaskId):null;return{title:`${(r==null?void 0:r.name)??t.id} · ${(r==null?void 0:r.role)??""}`,sub:[i?Cn[i.state].label:"",a?`${a.id} ${a.title}`:(i==null?void 0:i.note)??""].filter(Boolean).join(" — ")}}if(t.kind==="plan"){const r=e.boards.filter(i=>i.status==="active");return{title:"Plan wall",sub:`${e.boards.length} boards · ${r.length} active`}}if(t.kind==="gate"||t.kind==="prs"){const r=e.pullRequests.filter(c=>!c.merged&&!c.closed),i=r.filter(c=>c.review==="reviewing").length,a=Si[e.config.workflow.review.tool];return{title:t.kind==="gate"?`${a} review gate`:"Pull requests",sub:`${r.length} open · ${i} reviewing`}}const s=e.environments.find(r=>r.name===t.id);return{title:`Environment: ${t.id}`,sub:s?`${s.status} · ${s.url}`:void 0}}function bA(t){t.kind==="agent"?Se.openAgent(t.id):t.kind==="plan"?Se.openBoards(Ie.getState().planBoardId??void 0):t.kind==="gate"||t.kind==="prs"?Se.openPrs():Se.openEnv(t.id)}function wA(t){const e=t.app.canvas;let s=null;const r=d=>{const g=e.getBoundingClientRect();return{x:d.clientX-g.left,y:d.clientY-g.top}},i=d=>{const g=r(d),_=ex(t,g.x,g.y);t.hover=_?{rect:_.rect,agentId:_.hit.kind==="agent"?_.hit.id:null}:null,e.style.cursor=s!=null&&s.dragging?"grabbing":_?"pointer":"grab",Se.setHover(_?{...yA(_.hit),x:d.clientX,y:d.clientY}:null)},a=d=>{const g=r(d);s={x:g.x,y:g.y,lastX:g.x,lastY:g.y,dragging:!1},e.setPointerCapture(d.pointerId)},c=d=>{if(s){const g=r(d);if(!s.dragging&&Math.hypot(g.x-s.x,g.y-s.y)>4&&(s.dragging=!0),s.dragging){t.camera.panBy(g.x-s.lastX,g.y-s.lastY),s.lastX=g.x,s.lastY=g.y,e.style.cursor="grabbing",Se.setHover(null);return}}i(d)},o=d=>{const g=s==null?void 0:s.dragging;if(s=null,e.hasPointerCapture(d.pointerId)&&e.releasePointerCapture(d.pointerId),g)return i(d);const _=r(d),k=ex(t,_.x,_.y);k&&bA(k.hit)},h=()=>{t.hover=null,Se.setHover(null)};let u=0;const f=d=>{d.preventDefault(),u+=d.deltaY,!(Math.abs(u)<80)&&(t.camera.zoomBy(u<0?1:-1,r(d)),u=0)};return e.addEventListener("pointerdown",a),e.addEventListener("pointermove",c),e.addEventListener("pointerup",o),e.addEventListener("pointerleave",h),e.addEventListener("wheel",f,{passive:!1}),e.style.cursor="grab",()=>{e.removeEventListener("pointerdown",a),e.removeEventListener("pointermove",c),e.removeEventListener("pointerup",o),e.removeEventListener("pointerleave",h),e.removeEventListener("wheel",f)}}function SA(t,e,s){var f;const r=s!==t.epoch;if(r){t.epoch=s;for(const d of t.bots.values())d.destroy();t.bots.clear(),t.parcels=[],t.prevReview.clear(),t.seenActivity.clear(),t.seenMessages.clear(),t.effects.clear(),t.layout=null}const i=u1(e.config,e.environments),a=!t.layout;if(!t.layout||t.layout.key!==i){const d=jM(e.config,e.environments);t.layout=d,t.belt=new WM(d),t.setStatic(d,e.config),a&&t.camera.home(!1);for(const g of t.bots.values()){((f=g.errand)==null?void 0:f.kind)==="drop"&&g.errand.onArrive(),g.errand=null,g.path=[];const[_,k]=d.grid.nearest(...g.tile(d)),S=qo(d,[_,k]);g.x=S.x,g.y=S.y}}const c=t.layout,o=new Set(e.config.team.map(d=>d.id));for(const[d,g]of t.bots)o.has(d)||(g.destroy(),t.bots.delete(d));e.config.team.forEach((d,g)=>{const _=t.bots.get(d.id);if(_){_.restyle(d),_.index=g;return}const k=new NM(d,g,{x:0,y:0},t.actors),S=d1(k,c),m=r||a||!S?S??c.door:c.door;Object.assign(k,qo(c,m)),t.bots.set(d.id,k)});const h=new Map(e.pullRequests.filter(d=>!d.closed).map(d=>[d.number,d]));t.prs=h,t.parcels=t.parcels.filter(d=>h.has(d.num)&&d.mode!=="gone");for(const d of e.pullRequests){const g=t.prevReview.get(d.number);if(g===void 0&&!d.merged&&!t.parcels.some(_=>_.num===d.number)){const _={num:d.number,authorId:d.authorId,mode:"belt",s:t.dropS(d.authorId),fly:null};t.parcels.push(_);const k=t.bots.get(d.authorId),S=c.desks.find(m=>m.agentId===d.authorId);r?d.review==="changes-requested"?_.mode="home":d.review==="passed"&&t.belt.gateExit!==null&&(_.s=t.belt.gateExit):k&&S&&(_.mode="carry",k.carry=d.number,qv(k,c,{kind:"drop",deadline:t.t+8,onArrive:()=>{k.carry=null,_.mode==="carry"&&(_.mode="belt",_.s=t.dropS(d.authorId))}},S.drop))}g!==void 0&&g!==d.review&&CA(t,d.review),t.prevReview.set(d.number,d.review)}const u=e.config.team.find(d=>d.isLead);for(const d of[...e.activity].reverse())if(!t.seenActivity.has(d.id)&&(t.seenActivity.add(d.id),!r&&d.type==="task.assigned"&&u&&d.agentId===u.id)){const g=t.bots.get(u.id);g&&!g.errand&&qv(g,c,{kind:"plan"},c.plan.spot)}for(const d of[...e.messages].reverse()){if(t.seenMessages.has(d.id)||(t.seenMessages.add(d.id),r))continue;const g=t.bots.get(d.fromId),_=t.bots.get(d.toId);!g||!_||(t.effects.envelope(g.x,g.headY,d.toId),g.emote={type:"talk",until:t.t+1.4},_.emote={type:"mail",until:t.t+2.6})}}function CA(t,e){var i;const s=(i=t.layout)==null?void 0:i.gate;if(!s)return;const r=s.x+s.w/2;e==="passed"?(t.gateMode={mode:"passed",at:t.t},t.effects.text("PASSED",r,s.y-20,H.green),t.reducedMotion||t.effects.burst(r,s.y-6,[H.green,H.yellow,H.white])):e==="changes-requested"&&(t.gateMode={mode:"changes",at:t.t},t.effects.text("CHANGES",r,s.y-20,H.red))}To.defaultOptions.scaleMode="nearest";class kA{constructor(){ge(this,"app",new M0);ge(this,"world",new Qs);ge(this,"actors",new Qs({sortableChildren:!0}));ge(this,"staticSprite",null);ge(this,"staticTex",null);ge(this,"gSlow",new yi);ge(this,"gFast",new yi);ge(this,"gShadow",new yi);ge(this,"gOver",new yi);ge(this,"camera");ge(this,"layout",null);ge(this,"belt");ge(this,"bots",new Map);ge(this,"parcels",[]);ge(this,"prs",new Map);ge(this,"prevReview",new Map);ge(this,"seenActivity",new Set);ge(this,"seenMessages",new Set);ge(this,"notes",new qM);ge(this,"effects",new FM);ge(this,"gateMode",{mode:"idle",at:0});ge(this,"pulses",new Map);ge(this,"hover",null);ge(this,"epoch",-1);ge(this,"t",0);ge(this,"dt",0);ge(this,"reducedMotion",window.matchMedia("(prefers-reduced-motion: reduce)").matches);ge(this,"slowAcc",1);ge(this,"rand",jf(3));ge(this,"cleanups",[]);ge(this,"destroyed",!1)}async init(e){if(await this.app.init({resizeTo:e,background:H.grass,antialias:!1,autoDensity:!0,resolution:window.devicePixelRatio||1,roundPixels:!0}),this.destroyed)return void this.app.destroy(!0);e.appendChild(this.app.canvas),this.app.canvas.style.imageRendering="pixelated",this.world.addChild(this.gSlow,this.gFast,this.gShadow,this.actors,this.gOver),this.app.stage.addChild(this.world),this.camera=new xA(this.world,()=>({w:this.app.screen.width,h:this.app.screen.height}),()=>({left:312,top:74,bottom:16,right:Ie.getState().drawer?552:16}),()=>this.reducedMotion);const s=()=>{const{snap:r,epoch:i}=be.getState();r&&SA(this,r,i)};s(),this.cleanups.push(be.subscribe((r,i)=>(r.snap!==i.snap||r.epoch!==i.epoch)&&s())),this.cleanups.push(Ie.subscribe((r,i)=>{r.focus&&r.focus!==i.focus&&this.focusOn(r.focus.target),r.zoomRequest&&r.zoomRequest!==i.zoomRequest&&this.camera.zoomBy(r.zoomRequest.delta)})),this.cleanups.push(wA(this)),this.app.renderer.on("resize",()=>this.camera.apply()),this.app.ticker.add(r=>this.frame(Math.min(.1,r.deltaMS/1e3)))}destroy(){this.destroyed=!0,this.cleanups.forEach(e=>e()),this.app.renderer&&this.app.destroy(!0,{children:!0})}setStatic(e,s){var i;const r=c1(mA(e,s));this.staticSprite?this.staticSprite.texture=r:(this.staticSprite=new ki(r),this.world.addChildAt(this.staticSprite,0)),(i=this.staticTex)==null||i.destroy(!0),this.staticTex=r,this.camera.setWorldSize(e.worldW,e.worldH),this.slowAcc=1}stateOf(e){var s,r;return e?((r=(s=be.getState().snap)==null?void 0:s.agents.find(i=>i.agentId===e))==null?void 0:r.state)??null:null}colorOf(e){var s,r;return((r=(s=be.getState().snap)==null?void 0:s.config.team.find(i=>i.id===e))==null?void 0:r.color)??H.white}dropS(e){const s=this.layout,r=s==null?void 0:s.desks.find(i=>i.agentId===e);return r&&s?this.belt.sAtX(s.ox+r.drop[0]*16+8):0}botRect(e){return{x:Math.round(e.x)-7,y:e.headY-1,w:14,h:Math.round(e.y)-e.headY+3}}focusOn(e){const s=this.layout;if(!s)return;const r=Math.max(this.camera.zoom,Math.min(4,this.camera.fitZoom()+1));if(e.kind==="home")return this.camera.home();if(e.kind==="agent"){const i=this.bots.get(e.id);i&&this.camera.flyTo(i.x,i.y-10,r)}else if(e.kind==="plan"){const i=s.plan.board;this.camera.flyTo(i.x+i.w/2,i.y+40,r)}else if(e.kind==="prs"){const i=s.prBoard??s.gate??s.mailbox;i&&this.camera.flyTo(i.x+i.w/2,i.y+i.h,r)}else{const i=s.racks.find(a=>a.name===e.name);i&&this.camera.flyTo(i.x+i.w/2,i.y+i.h/2,r)}}frame(e){var h;const s=this.layout,r=be.getState().snap;if(!s||!r)return;this.t+=e,this.dt=e;const i=this.t;this.camera.update(e);const a=n1(r),c=new Map(a.map(u=>[u.config.id,u.status.state]));for(const u of this.bots.values()){const f=c.get(u.config.id)??"idle";if(u.pause=Math.max(0,u.pause-e),((h=u.errand)==null?void 0:h.kind)==="drop"&&i>u.errand.deadline){const d=u.errand;u.errand=null,d.onArrive()}f!=="idle"&&u.errand&&(u.errand.kind==="coffee"||u.errand.kind==="wander")&&(u.errand=null,u.path=[],u.pause=0),OM(u,s,f,i,this.rand),u.move(e,s),u.render(i,f)}zM(this.parcels,this.prs,this.belt,e*be.getState().speed,{deskPos:u=>{const f=this.bots.get(u);return f?{x:f.x,y:f.y-14}:null},dropS:u=>this.dropS(u),onMerged:u=>{this.pulses.set("main",1);const f=this.belt.pos(this.belt.len);this.effects.text(`#${u.num} MERGED`,f.x,f.y-26,H.green)}}),this.effects.update(e);for(const[u,f]of this.pulses)this.pulses.set(u,Math.max(0,f-e*.6));this.gateMode.mode!=="idle"&&this.gateMode.mode!=="reviewing"&&i-this.gateMode.at>1.6&&(this.gateMode={mode:"idle",at:i});const o=this.parcels.some(u=>{var f;return u.mode==="scan"&&((f=this.prs.get(u.num))==null?void 0:f.review)==="reviewing"});this.gateMode.mode==="idle"&&o&&(this.gateMode={mode:"reviewing",at:i}),this.gateMode.mode==="reviewing"&&!o&&(this.gateMode={mode:"idle",at:i}),this.slowAcc+=e,this.slowAcc>=.125&&(this.slowAcc=0,this.drawSlow(r.environments,c,i)),this.drawFast(r,c,i)}drawSlow(e,s,r){const i=this.layout,a=this.gSlow;a.clear();const c=new Dl(a);tA(c,i,r);for(const o of i.desks)ld(c,i.ox+(o.x0+2)*16+15,i.oy+o.y0*16+12,s.get(o.agentId)??"idle",this.colorOf(o.agentId),r,o.index);if(i.lead.agentId){const o=s.get(i.lead.agentId)??"idle";ld(c,i.ox+224,i.oy+72,o,this.colorOf(i.lead.agentId),r,0),ld(c,i.ox+250,i.oy+72,o,this.colorOf(i.lead.agentId),r,1)}i.prBoard&&JM(c,i.prBoard,[...this.prs.values()].sort((o,h)=>o.number-h.number),o=>this.colorOf(o)),ZM(c,i.racks,e,o=>o?s.get(o)??null:null,o=>this.pulses.get(o)??0,r)}drawFast(e,s,r){var _,k;const i=this.layout,a=this.gFast;a.clear();const c=new Dl(a),o=Ie.getState().planBoardId??((_=e.boards.filter(S=>S.status==="active").sort((S,m)=>S.order-m.order)[0])==null?void 0:_.id)??null,h=e.boards.find(S=>S.id===o);h&&sA(c,i,h.title),this.notes.update(e.tasks,o,i.plan.board,this.dt,r),this.notes.draw(c,e.tasks,S=>S?this.colorOf(S):"#ffe9a8",r),this.reducedMotion||eA(c,i,S=>s.get(S)??null,S=>this.colorOf(S),r);for(const S of i.desks)KM(c,S,i.ox,i.oy,s.get(S.agentId)??"idle",this.reducedMotion?0:r);i.lead.agentId&&YM(c,i.ox,i.oy,s.get(i.lead.agentId)??"idle",r),XM(c,i,this.reducedMotion?0:r);for(const S of this.parcels){const m=VM(S,this.belt),x=this.prs.get(S.num);if(!m||!x)continue;i.gate&&S.mode==="scan"||Yv(c,m.x,m.y-m.lift,S.num,this.colorOf(x.authorId),!0)}if(i.gate){const S=e.config.workflow.review.tool,m={coderabbit:"CodeRabbit",greptile:"Greptile",copilot:"Copilot",human:"Human review",custom:"Review check"}[S];QM(c,i.gate,this.gateMode.mode,r-this.gateMode.at,r,m,S==="coderabbit")}const u=this.gShadow;u.clear();const f=new Dl(u),d=this.gOver;d.clear();const g=new Dl(d);for(const S of this.bots.values()){const m=s.get(S.config.id)??"idle";if(rA(f,S),iA(g,S,m,r),S.carry!==null){const x=this.prs.get(S.carry);x&&Yv(g,S.x,S.headY-2,x.number,this.colorOf(x.authorId),!1)}}for(const S of this.bots.values()){const m=s.get(S.config.id)??"idle";nA(g,S,m,r,r),(S.path.length||((k=this.hover)==null?void 0:k.agentId)===S.config.id)&&oA(g,S)}this.effects.draw(g,S=>{const m=this.bots.get(S);return m?{x:m.x,y:m.headY+10}:null}),this.hover&&aA(g,this.hover.rect,r)}}function EA(){const t=re.useRef(null);return re.useEffect(()=>{const e=t.current;if(!e)return;const s=new kA;return s.init(e),()=>s.destroy()},[]),y.jsx("div",{ref:t,className:"fixed inset-0","aria-label":"Pixel-art view of the Setups Works Office office",role:"img"})}function _1({name:t,value:e,depth:s}){if(e===null||typeof e!="object"){const i=typeof e=="string"?"#6cf08a":typeof e=="number"?"#ffc14d":"#ff77a8";return y.jsxs("div",{className:"truncate pl-3",children:[y.jsxs("span",{className:"text-[#9aa6d1]",children:[t,": "]}),y.jsx("span",{style:{color:i},children:JSON.stringify(e)})]})}const r=Array.isArray(e)?e.map((i,a)=>[String(a),i]):Object.entries(e);return y.jsxs("details",{open:s<1,className:"pl-3",children:[y.jsxs("summary",{className:"cursor-pointer text-[#dfe6ff]",children:[t," ",y.jsx("span",{className:"text-[#66729f]",children:Array.isArray(e)?`[${r.length}]`:`{${r.length}}`})]}),r.map(([i,a])=>y.jsx(_1,{name:i,value:a,depth:s+1},i))]})}function PA(t){switch(t.type){case"snapshot":return"full snapshot";case"workspace.info":return`${t.info.agentId} ${t.info.path}`;case"sbx.updated":return`base ${t.sbx.basePolicy}, ${Object.keys(t.sbx.agents).length} sandboxes`;case"setup.updated":return`sandbox ${t.setup.sandboxReady?"ready":"not ready"}`;case"config.updated":return`team ${t.config.team.length}`;case"agent.updated":return`${t.agent.agentId} → ${t.agent.state}`;case"agent.removed":return t.agentId;case"board.updated":return`${t.board.id} ${t.board.status}`;case"task.updated":return`${t.task.id} ${t.task.status}`;case"task.removed":return t.taskId;case"pr.updated":return`#${t.pr.number} ${t.pr.merged?"merged":t.pr.review}`;case"env.updated":return`${t.env.name} ${t.env.status}`;case"env.removed":return t.name;case"message":return`${t.message.fromId} → ${t.message.toId}`;case"activity":return t.event.text;case"terminal.output":return`${t.agentId} +${t.data.length}`;case"action.updated":return`${t.item.fromId} ${t.item.status}: ${t.item.title}`;case"mcp.updated":return`${t.mcp.servers.length} MCP servers`;case"access.updated":return`${t.request.agentId} ${t.request.domain} ${t.request.status}`}}function MA(){const t=Ie(o=>o.debugOpen),e=be(o=>o.snap),s=be(o=>o.events),r=be(o=>o.terminalChunks),i=be(o=>o.presets),[a,c]=re.useState("events");return t?y.jsxs("section",{"aria-label":"Debug",className:"panel-dark fixed bottom-4 left-[312px] z-30 flex h-[360px] w-[560px] flex-col font-term text-[16px] leading-tight",children:[y.jsxs("div",{className:"flex items-center gap-2 border-b-[3px] border-ink px-2 py-1.5 font-ui text-[13px]",children:[y.jsx("b",{className:"uppercase tracking-[0.12em]",children:"Debug"}),["events","snapshot"].map(o=>y.jsx("button",{className:"btn px-2 text-[12px] text-ink","aria-pressed":a===o,onClick:()=>c(o),children:o},o)),i&&y.jsxs("select",{className:"field ml-auto w-[190px] py-0 text-[12px] text-ink",defaultValue:"",onChange:o=>{o.target.value&&(Se.closeDrawer(),me.loadPreset(o.target.value),o.target.value="")},"aria-label":"Load mock preset",children:[y.jsx("option",{value:"",children:"Load preset…"}),i.map(o=>y.jsx("option",{value:o.id,children:o.label},o.id))]}),i&&y.jsx("button",{className:"btn px-2 text-[12px] text-ink",onClick:()=>me.simulateAccessRequest(),title:"A random worker asks for a blocked domain",children:"Access request"}),y.jsx("button",{className:"btn px-2 text-[12px] text-ink","aria-label":"Close debug",onClick:()=>Se.toggleDebug(),children:"✕"})]}),y.jsx("div",{className:"scroll-thin min-h-0 flex-1 overflow-auto p-2",children:a==="events"?y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"mb-1 text-[#66729f]",children:["Last 20 events · ",r," terminal chunks streamed"]}),y.jsx("ul",{children:s.map(o=>y.jsxs("li",{className:"truncate",children:[y.jsxs("span",{className:"text-[#66729f]",children:[new Date(o.at).toLocaleTimeString()," "]}),y.jsx("span",{className:"text-yellow",children:o.event.type})," ",y.jsx("span",{className:"text-[#dfe6ff]",children:PA(o.event)})]},o.n))})]}):e&&y.jsx(_1,{name:"OfficeSnapshot",value:e,depth:0})})]}):null}const Wf=re.createContext({});function zf(t){const e=re.useRef(null);return e.current===null&&(e.current=t()),e.current}const Rc=re.createContext(null),Vf=re.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});class AA extends re.Component{getSnapshotBeforeUpdate(e){const s=this.props.childRef.current;if(s&&e.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=s.offsetHeight||0,r.width=s.offsetWidth||0,r.top=s.offsetTop,r.left=s.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function TA({children:t,isPresent:e}){const s=re.useId(),r=re.useRef(null),i=re.useRef({width:0,height:0,top:0,left:0}),{nonce:a}=re.useContext(Vf);return re.useInsertionEffect(()=>{const{width:c,height:o,top:h,left:u}=i.current;if(e||!r.current||!c||!o)return;r.current.dataset.motionPopId=s;const f=document.createElement("style");return a&&(f.nonce=a),document.head.appendChild(f),f.sheet&&f.sheet.insertRule(`
311
+ [data-motion-pop-id="${s}"] {
312
+ position: absolute !important;
313
+ width: ${c}px !important;
314
+ height: ${o}px !important;
315
+ top: ${h}px !important;
316
+ left: ${u}px !important;
317
+ }
318
+ `),()=>{document.head.removeChild(f)}},[e]),y.jsx(AA,{isPresent:e,childRef:r,sizeRef:i,children:re.cloneElement(t,{ref:r})})}const RA=({children:t,initial:e,isPresent:s,onExitComplete:r,custom:i,presenceAffectsLayout:a,mode:c})=>{const o=zf(DA),h=re.useId(),u=re.useCallback(d=>{o.set(d,!0);for(const g of o.values())if(!g)return;r&&r()},[o,r]),f=re.useMemo(()=>({id:h,initial:e,isPresent:s,custom:i,onExitComplete:u,register:d=>(o.set(d,!1),()=>o.delete(d))}),a?[Math.random(),u]:[s,u]);return re.useMemo(()=>{o.forEach((d,g)=>o.set(g,!1))},[s]),re.useEffect(()=>{!s&&!o.size&&r&&r()},[s]),c==="popLayout"&&(t=y.jsx(TA,{isPresent:s,children:t})),y.jsx(Rc.Provider,{value:f,children:t})};function DA(){return new Map}function v1(t=!0){const e=re.useContext(Rc);if(e===null)return[!0,null];const{isPresent:s,onExitComplete:r,register:i}=e,a=re.useId();re.useEffect(()=>{t&&i(a)},[t]);const c=re.useCallback(()=>t&&r&&r(a),[a,r,t]);return!s&&r?[!1,c]:[!0]}const Fl=t=>t.key||"";function tx(t){const e=[];return re.Children.forEach(t,s=>{re.isValidElement(s)&&e.push(s)}),e}const Gf=typeof window<"u",x1=Gf?re.useLayoutEffect:re.useEffect,y1=({children:t,custom:e,initial:s=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:a="sync",propagate:c=!1})=>{const[o,h]=v1(c),u=re.useMemo(()=>tx(t),[t]),f=c&&!o?[]:u.map(Fl),d=re.useRef(!0),g=re.useRef(u),_=zf(()=>new Map),[k,S]=re.useState(u),[m,x]=re.useState(u);x1(()=>{d.current=!1,g.current=u;for(let C=0;C<m.length;C++){const E=Fl(m[C]);f.includes(E)?_.delete(E):_.get(E)!==!0&&_.set(E,!1)}},[m,f.length,f.join("-")]);const v=[];if(u!==k){let C=[...u];for(let E=0;E<m.length;E++){const P=m[E],T=Fl(P);f.includes(T)||(C.splice(E,0,P),v.push(P))}a==="wait"&&v.length&&(C=v),x(tx(C)),S(u);return}const{forceRender:b}=re.useContext(Wf);return y.jsx(y.Fragment,{children:m.map(C=>{const E=Fl(C),P=c&&!o?!1:u===m||f.includes(E),T=()=>{if(_.has(E))_.set(E,!0);else return;let A=!0;_.forEach(D=>{D||(A=!1)}),A&&(b==null||b(),x(g.current),c&&(h==null||h()),r&&r())};return y.jsx(RA,{isPresent:P,initial:!d.current||s?void 0:!1,custom:P?void 0:e,presenceAffectsLayout:i,mode:a,onExitComplete:P?void 0:T,children:C},E)})})},us=t=>t;let b1=us;function qf(t){let e;return()=>(e===void 0&&(e=t()),e)}const yn=(t,e,s)=>{const r=e-t;return r===0?1:(s-t)/r},fr=t=>t*1e3,pr=t=>t/1e3,LA={useManualTiming:!1};function BA(t){let e=new Set,s=new Set,r=!1,i=!1;const a=new WeakSet;let c={delta:0,timestamp:0,isProcessing:!1};function o(u){a.has(u)&&(h.schedule(u),t()),u(c)}const h={schedule:(u,f=!1,d=!1)=>{const _=d&&r?e:s;return f&&a.add(u),_.has(u)||_.add(u),u},cancel:u=>{s.delete(u),a.delete(u)},process:u=>{if(c=u,r){i=!0;return}r=!0,[e,s]=[s,e],e.forEach(o),e.clear(),r=!1,i&&(i=!1,h.process(u))}};return h}const $l=["read","resolveKeyframes","update","preRender","render","postRender"],jA=40;function w1(t,e){let s=!1,r=!0;const i={delta:0,timestamp:0,isProcessing:!1},a=()=>s=!0,c=$l.reduce((x,v)=>(x[v]=BA(a),x),{}),{read:o,resolveKeyframes:h,update:u,preRender:f,render:d,postRender:g}=c,_=()=>{const x=performance.now();s=!1,i.delta=r?1e3/60:Math.max(Math.min(x-i.timestamp,jA),1),i.timestamp=x,i.isProcessing=!0,o.process(i),h.process(i),u.process(i),f.process(i),d.process(i),g.process(i),i.isProcessing=!1,s&&e&&(r=!1,t(_))},k=()=>{s=!0,r=!0,i.isProcessing||t(_)};return{schedule:$l.reduce((x,v)=>{const b=c[v];return x[v]=(C,E=!1,P=!1)=>(s||k(),b.schedule(C,E,P)),x},{}),cancel:x=>{for(let v=0;v<$l.length;v++)c[$l[v]].cancel(x)},state:i,steps:c}}const{schedule:Qe,cancel:Ur,state:Rt,steps:ud}=w1(typeof requestAnimationFrame<"u"?requestAnimationFrame:us,!0),S1=re.createContext({strict:!1}),sx={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},bn={};for(const t in sx)bn[t]={isEnabled:e=>sx[t].some(s=>!!e[s])};function IA(t){for(const e in t)bn[e]={...bn[e],...t[e]}}const NA=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function dc(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||NA.has(t)}let C1=t=>!dc(t);function OA(t){t&&(C1=e=>e.startsWith("on")?!dc(e):t(e))}try{OA(require("@emotion/is-prop-valid").default)}catch{}function FA(t,e,s){const r={};for(const i in t)i==="values"&&typeof t.values=="object"||(C1(i)||s===!0&&dc(i)||!e&&!dc(i)||t.draggable&&i.startsWith("onDrag"))&&(r[i]=t[i]);return r}function $A(t){if(typeof Proxy>"u")return t;const e=new Map,s=(...r)=>t(...r);return new Proxy(s,{get:(r,i)=>i==="create"?t:(e.has(i)||e.set(i,t(i)),e.get(i))})}const Dc=re.createContext({});function Ko(t){return typeof t=="string"||Array.isArray(t)}function Lc(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const Kf=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Yf=["initial",...Kf];function Bc(t){return Lc(t.animate)||Yf.some(e=>Ko(t[e]))}function k1(t){return!!(Bc(t)||t.variants)}function HA(t,e){if(Bc(t)){const{initial:s,animate:r}=t;return{initial:s===!1||Ko(s)?s:void 0,animate:Ko(r)?r:void 0}}return t.inherit!==!1?e:{}}function UA(t){const{initial:e,animate:s}=HA(t,re.useContext(Dc));return re.useMemo(()=>({initial:e,animate:s}),[rx(e),rx(s)])}function rx(t){return Array.isArray(t)?t.join(" "):t}const WA=Symbol.for("motionComponentSymbol");function fn(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function zA(t,e,s){return re.useCallback(r=>{r&&t.onMount&&t.onMount(r),e&&(r?e.mount(r):e.unmount()),s&&(typeof s=="function"?s(r):fn(s)&&(s.current=r))},[e])}const Xf=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),VA="framerAppearId",E1="data-"+Xf(VA),{schedule:Qf}=w1(queueMicrotask,!1),P1=re.createContext({});function GA(t,e,s,r,i){var a,c;const{visualElement:o}=re.useContext(Dc),h=re.useContext(S1),u=re.useContext(Rc),f=re.useContext(Vf).reducedMotion,d=re.useRef(null);r=r||h.renderer,!d.current&&r&&(d.current=r(t,{visualState:e,parent:o,props:s,presenceContext:u,blockInitialAnimation:u?u.initial===!1:!1,reducedMotionConfig:f}));const g=d.current,_=re.useContext(P1);g&&!g.projection&&i&&(g.type==="html"||g.type==="svg")&&qA(d.current,s,i,_);const k=re.useRef(!1);re.useInsertionEffect(()=>{g&&k.current&&g.update(s,u)});const S=s[E1],m=re.useRef(!!S&&!(!((a=window.MotionHandoffIsComplete)===null||a===void 0)&&a.call(window,S))&&((c=window.MotionHasOptimisedAnimation)===null||c===void 0?void 0:c.call(window,S)));return x1(()=>{g&&(k.current=!0,window.MotionIsMounted=!0,g.updateFeatures(),Qf.render(g.render),m.current&&g.animationState&&g.animationState.animateChanges())}),re.useEffect(()=>{g&&(!m.current&&g.animationState&&g.animationState.animateChanges(),m.current&&(queueMicrotask(()=>{var x;(x=window.MotionHandoffMarkAsComplete)===null||x===void 0||x.call(window,S)}),m.current=!1))}),g}function qA(t,e,s,r){const{layoutId:i,layout:a,drag:c,dragConstraints:o,layoutScroll:h,layoutRoot:u}=e;t.projection=new s(t.latestValues,e["data-framer-portal-id"]?void 0:M1(t.parent)),t.projection.setOptions({layoutId:i,layout:a,alwaysMeasureLayout:!!c||o&&fn(o),visualElement:t,animationType:typeof a=="string"?a:"both",initialPromotionConfig:r,layoutScroll:h,layoutRoot:u})}function M1(t){if(t)return t.options.allowProjection!==!1?t.projection:M1(t.parent)}function KA({preloadedFeatures:t,createVisualElement:e,useRender:s,useVisualState:r,Component:i}){var a,c;t&&IA(t);function o(u,f){let d;const g={...re.useContext(Vf),...u,layoutId:YA(u)},{isStatic:_}=g,k=UA(u),S=r(u,_);if(!_&&Gf){XA();const m=QA(g);d=m.MeasureLayout,k.visualElement=GA(i,S,g,e,m.ProjectionNode)}return y.jsxs(Dc.Provider,{value:k,children:[d&&k.visualElement?y.jsx(d,{visualElement:k.visualElement,...g}):null,s(i,u,zA(S,k.visualElement,f),S,_,k.visualElement)]})}o.displayName=`motion.${typeof i=="string"?i:`create(${(c=(a=i.displayName)!==null&&a!==void 0?a:i.name)!==null&&c!==void 0?c:""})`}`;const h=re.forwardRef(o);return h[WA]=i,h}function YA({layoutId:t}){const e=re.useContext(Wf).id;return e&&t!==void 0?e+"-"+t:t}function XA(t,e){re.useContext(S1).strict}function QA(t){const{drag:e,layout:s}=bn;if(!e&&!s)return{};const r={...e,...s};return{MeasureLayout:e!=null&&e.isEnabled(t)||s!=null&&s.isEnabled(t)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}const ZA=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Zf(t){return typeof t!="string"||t.includes("-")?!1:!!(ZA.indexOf(t)>-1||/[A-Z]/u.test(t))}function ix(t){const e=[{},{}];return t==null||t.values.forEach((s,r)=>{e[0][r]=s.get(),e[1][r]=s.getVelocity()}),e}function Jf(t,e,s,r){if(typeof e=="function"){const[i,a]=ix(r);e=e(s!==void 0?s:t.custom,i,a)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[i,a]=ix(r);e=e(s!==void 0?s:t.custom,i,a)}return e}const rf=t=>Array.isArray(t),JA=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),eT=t=>rf(t)?t[t.length-1]||0:t,$t=t=>!!(t&&t.getVelocity);function Kl(t){const e=$t(t)?t.get():t;return JA(e)?e.toValue():e}function tT({scrapeMotionValuesFromProps:t,createRenderState:e,onUpdate:s},r,i,a){const c={latestValues:sT(r,i,a,t),renderState:e()};return s&&(c.onMount=o=>s({props:r,current:o,...c}),c.onUpdate=o=>s(o)),c}const A1=t=>(e,s)=>{const r=re.useContext(Dc),i=re.useContext(Rc),a=()=>tT(t,e,r,i);return s?a():zf(a)};function sT(t,e,s,r){const i={},a=r(t,{});for(const g in a)i[g]=Kl(a[g]);let{initial:c,animate:o}=t;const h=Bc(t),u=k1(t);e&&u&&!h&&t.inherit!==!1&&(c===void 0&&(c=e.initial),o===void 0&&(o=e.animate));let f=s?s.initial===!1:!1;f=f||c===!1;const d=f?o:c;if(d&&typeof d!="boolean"&&!Lc(d)){const g=Array.isArray(d)?d:[d];for(let _=0;_<g.length;_++){const k=Jf(t,g[_]);if(k){const{transitionEnd:S,transition:m,...x}=k;for(const v in x){let b=x[v];if(Array.isArray(b)){const C=f?b.length-1:0;b=b[C]}b!==null&&(i[v]=b)}for(const v in S)i[v]=S[v]}}}return i}const En=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Ri=new Set(En),T1=t=>e=>typeof e=="string"&&e.startsWith(t),R1=T1("--"),rT=T1("var(--"),ep=t=>rT(t)?iT.test(t.split("/*")[0].trim()):!1,iT=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,D1=(t,e)=>e&&typeof t=="number"?e.transform(t):t,mr=(t,e,s)=>s>e?e:s<t?t:s,Pn={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},Yo={...Pn,transform:t=>mr(0,1,t)},Hl={...Pn,default:1},sa=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),Fr=sa("deg"),Ys=sa("%"),Me=sa("px"),nT=sa("vh"),oT=sa("vw"),nx={...Ys,parse:t=>Ys.parse(t)/100,transform:t=>Ys.transform(t*100)},aT={borderWidth:Me,borderTopWidth:Me,borderRightWidth:Me,borderBottomWidth:Me,borderLeftWidth:Me,borderRadius:Me,radius:Me,borderTopLeftRadius:Me,borderTopRightRadius:Me,borderBottomRightRadius:Me,borderBottomLeftRadius:Me,width:Me,maxWidth:Me,height:Me,maxHeight:Me,top:Me,right:Me,bottom:Me,left:Me,padding:Me,paddingTop:Me,paddingRight:Me,paddingBottom:Me,paddingLeft:Me,margin:Me,marginTop:Me,marginRight:Me,marginBottom:Me,marginLeft:Me,backgroundPositionX:Me,backgroundPositionY:Me},lT={rotate:Fr,rotateX:Fr,rotateY:Fr,rotateZ:Fr,scale:Hl,scaleX:Hl,scaleY:Hl,scaleZ:Hl,skew:Fr,skewX:Fr,skewY:Fr,distance:Me,translateX:Me,translateY:Me,translateZ:Me,x:Me,y:Me,z:Me,perspective:Me,transformPerspective:Me,opacity:Yo,originX:nx,originY:nx,originZ:Me},ox={...Pn,transform:Math.round},tp={...aT,...lT,zIndex:ox,size:Me,fillOpacity:Yo,strokeOpacity:Yo,numOctaves:ox},cT={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},hT=En.length;function uT(t,e,s){let r="",i=!0;for(let a=0;a<hT;a++){const c=En[a],o=t[c];if(o===void 0)continue;let h=!0;if(typeof o=="number"?h=o===(c.startsWith("scale")?1:0):h=parseFloat(o)===0,!h||s){const u=D1(o,tp[c]);if(!h){i=!1;const f=cT[c]||c;r+=`${f}(${u}) `}s&&(e[c]=u)}}return r=r.trim(),s?r=s(e,i?"":r):i&&(r="none"),r}function sp(t,e,s){const{style:r,vars:i,transformOrigin:a}=t;let c=!1,o=!1;for(const h in e){const u=e[h];if(Ri.has(h)){c=!0;continue}else if(R1(h)){i[h]=u;continue}else{const f=D1(u,tp[h]);h.startsWith("origin")?(o=!0,a[h]=f):r[h]=f}}if(e.transform||(c||s?r.transform=uT(e,t.transform,s):r.transform&&(r.transform="none")),o){const{originX:h="50%",originY:u="50%",originZ:f=0}=a;r.transformOrigin=`${h} ${u} ${f}`}}const dT={offset:"stroke-dashoffset",array:"stroke-dasharray"},fT={offset:"strokeDashoffset",array:"strokeDasharray"};function pT(t,e,s=1,r=0,i=!0){t.pathLength=1;const a=i?dT:fT;t[a.offset]=Me.transform(-r);const c=Me.transform(e),o=Me.transform(s);t[a.array]=`${c} ${o}`}function ax(t,e,s){return typeof t=="string"?t:Me.transform(e+s*t)}function mT(t,e,s){const r=ax(e,t.x,t.width),i=ax(s,t.y,t.height);return`${r} ${i}`}function rp(t,{attrX:e,attrY:s,attrScale:r,originX:i,originY:a,pathLength:c,pathSpacing:o=1,pathOffset:h=0,...u},f,d){if(sp(t,u,d),f){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:g,style:_,dimensions:k}=t;g.transform&&(k&&(_.transform=g.transform),delete g.transform),k&&(i!==void 0||a!==void 0||_.transform)&&(_.transformOrigin=mT(k,i!==void 0?i:.5,a!==void 0?a:.5)),e!==void 0&&(g.x=e),s!==void 0&&(g.y=s),r!==void 0&&(g.scale=r),c!==void 0&&pT(g,c,o,h,!1)}const ip=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),L1=()=>({...ip(),attrs:{}}),np=t=>typeof t=="string"&&t.toLowerCase()==="svg";function B1(t,{style:e,vars:s},r,i){Object.assign(t.style,e,i&&i.getProjectionStyles(r));for(const a in s)t.style.setProperty(a,s[a])}const j1=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function I1(t,e,s,r){B1(t,e,void 0,r);for(const i in e.attrs)t.setAttribute(j1.has(i)?i:Xf(i),e.attrs[i])}const fc={};function gT(t){Object.assign(fc,t)}function N1(t,{layout:e,layoutId:s}){return Ri.has(t)||t.startsWith("origin")||(e||s!==void 0)&&(!!fc[t]||t==="opacity")}function op(t,e,s){var r;const{style:i}=t,a={};for(const c in i)($t(i[c])||e.style&&$t(e.style[c])||N1(c,t)||((r=s==null?void 0:s.getValue(c))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(a[c]=i[c]);return a}function O1(t,e,s){const r=op(t,e,s);for(const i in t)if($t(t[i])||$t(e[i])){const a=En.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;r[a]=t[i]}return r}function _T(t,e){try{e.dimensions=typeof t.getBBox=="function"?t.getBBox():t.getBoundingClientRect()}catch{e.dimensions={x:0,y:0,width:0,height:0}}}const lx=["x","y","width","height","cx","cy","r"],vT={useVisualState:A1({scrapeMotionValuesFromProps:O1,createRenderState:L1,onUpdate:({props:t,prevProps:e,current:s,renderState:r,latestValues:i})=>{if(!s)return;let a=!!t.drag;if(!a){for(const o in i)if(Ri.has(o)){a=!0;break}}if(!a)return;let c=!e;if(e)for(let o=0;o<lx.length;o++){const h=lx[o];t[h]!==e[h]&&(c=!0)}c&&Qe.read(()=>{_T(s,r),Qe.render(()=>{rp(r,i,np(s.tagName),t.transformTemplate),I1(s,r)})})}})},xT={useVisualState:A1({scrapeMotionValuesFromProps:op,createRenderState:ip})};function F1(t,e,s){for(const r in e)!$t(e[r])&&!N1(r,s)&&(t[r]=e[r])}function yT({transformTemplate:t},e){return re.useMemo(()=>{const s=ip();return sp(s,e,t),Object.assign({},s.vars,s.style)},[e])}function bT(t,e){const s=t.style||{},r={};return F1(r,s,t),Object.assign(r,yT(t,e)),r}function wT(t,e){const s={},r=bT(t,e);return t.drag&&t.dragListener!==!1&&(s.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(s.tabIndex=0),s.style=r,s}function ST(t,e,s,r){const i=re.useMemo(()=>{const a=L1();return rp(a,e,np(r),t.transformTemplate),{...a.attrs,style:{...a.style}}},[e]);if(t.style){const a={};F1(a,t.style,t),i.style={...a,...i.style}}return i}function CT(t=!1){return(s,r,i,{latestValues:a},c)=>{const h=(Zf(s)?ST:wT)(r,a,c,s),u=FA(r,typeof s=="string",t),f=s!==re.Fragment?{...u,...h,ref:i}:{},{children:d}=r,g=re.useMemo(()=>$t(d)?d.get():d,[d]);return re.createElement(s,{...f,children:g})}}function kT(t,e){return function(r,{forwardMotionProps:i}={forwardMotionProps:!1}){const c={...Zf(r)?vT:xT,preloadedFeatures:t,useRender:CT(i),createVisualElement:e,Component:r};return KA(c)}}function $1(t,e){if(!Array.isArray(e))return!1;const s=e.length;if(s!==t.length)return!1;for(let r=0;r<s;r++)if(e[r]!==t[r])return!1;return!0}function jc(t,e,s){const r=t.getProps();return Jf(r,e,s!==void 0?s:r.custom,t)}const ET=qf(()=>window.ScrollTimeline!==void 0);class PT{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}get finished(){return Promise.all(this.animations.map(e=>"finished"in e?e.finished:e))}getAll(e){return this.animations[0][e]}setAll(e,s){for(let r=0;r<this.animations.length;r++)this.animations[r][e]=s}attachTimeline(e,s){const r=this.animations.map(i=>{if(ET()&&i.attachTimeline)return i.attachTimeline(e);if(typeof s=="function")return s(i)});return()=>{r.forEach((i,a)=>{i&&i(),this.animations[a].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get startTime(){return this.getAll("startTime")}get duration(){let e=0;for(let s=0;s<this.animations.length;s++)e=Math.max(e,this.animations[s].duration);return e}runAll(e){this.animations.forEach(s=>s[e]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class MT extends PT{then(e,s){return Promise.all(this.animations).then(e).catch(s)}}function ap(t,e){return t?t[e]||t.default||t:void 0}const nf=2e4;function H1(t){let e=0;const s=50;let r=t.next(e);for(;!r.done&&e<nf;)e+=s,r=t.next(e);return e>=nf?1/0:e}function lp(t){return typeof t=="function"}function cx(t,e){t.timeline=e,t.onfinish=null}const cp=t=>Array.isArray(t)&&typeof t[0]=="number",AT={linearEasing:void 0};function TT(t,e){const s=qf(t);return()=>{var r;return(r=AT[e])!==null&&r!==void 0?r:s()}}const pc=TT(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),U1=(t,e,s=10)=>{let r="";const i=Math.max(Math.round(e/s),2);for(let a=0;a<i;a++)r+=t(yn(0,i-1,a))+", ";return`linear(${r.substring(0,r.length-2)})`};function W1(t){return!!(typeof t=="function"&&pc()||!t||typeof t=="string"&&(t in of||pc())||cp(t)||Array.isArray(t)&&t.every(W1))}const Eo=([t,e,s,r])=>`cubic-bezier(${t}, ${e}, ${s}, ${r})`,of={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Eo([0,.65,.55,1]),circOut:Eo([.55,0,1,.45]),backIn:Eo([.31,.01,.66,-.59]),backOut:Eo([.33,1.53,.69,.99])};function z1(t,e){if(t)return typeof t=="function"&&pc()?U1(t,e):cp(t)?Eo(t):Array.isArray(t)?t.map(s=>z1(s,e)||of.easeOut):of[t]}const Bs={x:!1,y:!1};function V1(){return Bs.x||Bs.y}function RT(t,e,s){var r;if(t instanceof Element)return[t];if(typeof t=="string"){let i=document;const a=(r=void 0)!==null&&r!==void 0?r:i.querySelectorAll(t);return a?Array.from(a):[]}return Array.from(t)}function G1(t,e){const s=RT(t),r=new AbortController,i={passive:!0,...e,signal:r.signal};return[s,i,()=>r.abort()]}function hx(t){return e=>{e.pointerType==="touch"||V1()||t(e)}}function DT(t,e,s={}){const[r,i,a]=G1(t,s),c=hx(o=>{const{target:h}=o,u=e(o);if(typeof u!="function"||!h)return;const f=hx(d=>{u(d),h.removeEventListener("pointerleave",f)});h.addEventListener("pointerleave",f,i)});return r.forEach(o=>{o.addEventListener("pointerenter",c,i)}),a}const q1=(t,e)=>e?t===e?!0:q1(t,e.parentElement):!1,hp=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,LT=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function BT(t){return LT.has(t.tagName)||t.tabIndex!==-1}const Po=new WeakSet;function ux(t){return e=>{e.key==="Enter"&&t(e)}}function dd(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const jT=(t,e)=>{const s=t.currentTarget;if(!s)return;const r=ux(()=>{if(Po.has(s))return;dd(s,"down");const i=ux(()=>{dd(s,"up")}),a=()=>dd(s,"cancel");s.addEventListener("keyup",i,e),s.addEventListener("blur",a,e)});s.addEventListener("keydown",r,e),s.addEventListener("blur",()=>s.removeEventListener("keydown",r),e)};function dx(t){return hp(t)&&!V1()}function IT(t,e,s={}){const[r,i,a]=G1(t,s),c=o=>{const h=o.currentTarget;if(!dx(o)||Po.has(h))return;Po.add(h);const u=e(o),f=(_,k)=>{window.removeEventListener("pointerup",d),window.removeEventListener("pointercancel",g),!(!dx(_)||!Po.has(h))&&(Po.delete(h),typeof u=="function"&&u(_,{success:k}))},d=_=>{f(_,s.useGlobalTarget||q1(h,_.target))},g=_=>{f(_,!1)};window.addEventListener("pointerup",d,i),window.addEventListener("pointercancel",g,i)};return r.forEach(o=>{!BT(o)&&o.getAttribute("tabindex")===null&&(o.tabIndex=0),(s.useGlobalTarget?window:o).addEventListener("pointerdown",c,i),o.addEventListener("focus",u=>jT(u,i),i)}),a}function NT(t){return t==="x"||t==="y"?Bs[t]?null:(Bs[t]=!0,()=>{Bs[t]=!1}):Bs.x||Bs.y?null:(Bs.x=Bs.y=!0,()=>{Bs.x=Bs.y=!1})}const K1=new Set(["width","height","top","left","right","bottom",...En]);let Yl;function OT(){Yl=void 0}const Xs={now:()=>(Yl===void 0&&Xs.set(Rt.isProcessing||LA.useManualTiming?Rt.timestamp:performance.now()),Yl),set:t=>{Yl=t,queueMicrotask(OT)}};function up(t,e){t.indexOf(e)===-1&&t.push(e)}function dp(t,e){const s=t.indexOf(e);s>-1&&t.splice(s,1)}class fp{constructor(){this.subscriptions=[]}add(e){return up(this.subscriptions,e),()=>dp(this.subscriptions,e)}notify(e,s,r){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](e,s,r);else for(let a=0;a<i;a++){const c=this.subscriptions[a];c&&c(e,s,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function Y1(t,e){return e?t*(1e3/e):0}const fx=30,FT=t=>!isNaN(parseFloat(t));class $T{constructor(e,s={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,i=!0)=>{const a=Xs.now();this.updatedAt!==a&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),i&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=s.owner}setCurrent(e){this.current=e,this.updatedAt=Xs.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=FT(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,s){this.events[e]||(this.events[e]=new fp);const r=this.events[e].add(s);return e==="change"?()=>{r(),Qe.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,s){this.passiveEffect=e,this.stopPassiveEffect=s}set(e,s=!0){!s||!this.passiveEffect?this.updateAndNotify(e,s):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,s,r){this.set(s),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,s=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,s&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=Xs.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>fx)return 0;const s=Math.min(this.updatedAt-this.prevUpdatedAt,fx);return Y1(parseFloat(this.current)-parseFloat(this.prevFrameValue),s)}start(e){return this.stop(),new Promise(s=>{this.hasAnimated=!0,this.animation=e(s),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Xo(t,e){return new $T(t,e)}function HT(t,e,s){t.hasValue(e)?t.getValue(e).set(s):t.addValue(e,Xo(s))}function UT(t,e){const s=jc(t,e);let{transitionEnd:r={},transition:i={},...a}=s||{};a={...a,...r};for(const c in a){const o=eT(a[c]);HT(t,c,o)}}function WT(t){return!!($t(t)&&t.add)}function af(t,e){const s=t.getValue("willChange");if(WT(s))return s.add(e)}function X1(t){return t.props[E1]}const Q1=(t,e,s)=>(((1-3*s+3*e)*t+(3*s-6*e))*t+3*e)*t,zT=1e-7,VT=12;function GT(t,e,s,r,i){let a,c,o=0;do c=e+(s-e)/2,a=Q1(c,r,i)-t,a>0?s=c:e=c;while(Math.abs(a)>zT&&++o<VT);return c}function ra(t,e,s,r){if(t===e&&s===r)return us;const i=a=>GT(a,0,1,t,s);return a=>a===0||a===1?a:Q1(i(a),e,r)}const Z1=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,J1=t=>e=>1-t(1-e),eb=ra(.33,1.53,.69,.99),pp=J1(eb),tb=Z1(pp),sb=t=>(t*=2)<1?.5*pp(t):.5*(2-Math.pow(2,-10*(t-1))),mp=t=>1-Math.sin(Math.acos(t)),rb=J1(mp),ib=Z1(mp),nb=t=>/^0[^.\s]+$/u.test(t);function qT(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||nb(t):!0}const Io=t=>Math.round(t*1e5)/1e5,gp=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function KT(t){return t==null}const YT=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,_p=(t,e)=>s=>!!(typeof s=="string"&&YT.test(s)&&s.startsWith(t)||e&&!KT(s)&&Object.prototype.hasOwnProperty.call(s,e)),ob=(t,e,s)=>r=>{if(typeof r!="string")return r;const[i,a,c,o]=r.match(gp);return{[t]:parseFloat(i),[e]:parseFloat(a),[s]:parseFloat(c),alpha:o!==void 0?parseFloat(o):1}},XT=t=>mr(0,255,t),fd={...Pn,transform:t=>Math.round(XT(t))},bi={test:_p("rgb","red"),parse:ob("red","green","blue"),transform:({red:t,green:e,blue:s,alpha:r=1})=>"rgba("+fd.transform(t)+", "+fd.transform(e)+", "+fd.transform(s)+", "+Io(Yo.transform(r))+")"};function QT(t){let e="",s="",r="",i="";return t.length>5?(e=t.substring(1,3),s=t.substring(3,5),r=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),s=t.substring(2,3),r=t.substring(3,4),i=t.substring(4,5),e+=e,s+=s,r+=r,i+=i),{red:parseInt(e,16),green:parseInt(s,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}const lf={test:_p("#"),parse:QT,transform:bi.transform},pn={test:_p("hsl","hue"),parse:ob("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:s,alpha:r=1})=>"hsla("+Math.round(t)+", "+Ys.transform(Io(e))+", "+Ys.transform(Io(s))+", "+Io(Yo.transform(r))+")"},It={test:t=>bi.test(t)||lf.test(t)||pn.test(t),parse:t=>bi.test(t)?bi.parse(t):pn.test(t)?pn.parse(t):lf.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?bi.transform(t):pn.transform(t)},ZT=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function JT(t){var e,s;return isNaN(t)&&typeof t=="string"&&(((e=t.match(gp))===null||e===void 0?void 0:e.length)||0)+(((s=t.match(ZT))===null||s===void 0?void 0:s.length)||0)>0}const ab="number",lb="color",e3="var",t3="var(",px="${}",s3=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Qo(t){const e=t.toString(),s=[],r={color:[],number:[],var:[]},i=[];let a=0;const o=e.replace(s3,h=>(It.test(h)?(r.color.push(a),i.push(lb),s.push(It.parse(h))):h.startsWith(t3)?(r.var.push(a),i.push(e3),s.push(h)):(r.number.push(a),i.push(ab),s.push(parseFloat(h))),++a,px)).split(px);return{values:s,split:o,indexes:r,types:i}}function cb(t){return Qo(t).values}function hb(t){const{split:e,types:s}=Qo(t),r=e.length;return i=>{let a="";for(let c=0;c<r;c++)if(a+=e[c],i[c]!==void 0){const o=s[c];o===ab?a+=Io(i[c]):o===lb?a+=It.transform(i[c]):a+=i[c]}return a}}const r3=t=>typeof t=="number"?0:t;function i3(t){const e=cb(t);return hb(t)(e.map(r3))}const Wr={test:JT,parse:cb,createTransformer:hb,getAnimatableNone:i3},n3=new Set(["brightness","contrast","saturate","opacity"]);function o3(t){const[e,s]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[r]=s.match(gp)||[];if(!r)return t;const i=s.replace(r,"");let a=n3.has(e)?1:0;return r!==s&&(a*=100),e+"("+a+i+")"}const a3=/\b([a-z-]*)\(.*?\)/gu,cf={...Wr,getAnimatableNone:t=>{const e=t.match(a3);return e?e.map(o3).join(" "):t}},l3={...tp,color:It,backgroundColor:It,outlineColor:It,fill:It,stroke:It,borderColor:It,borderTopColor:It,borderRightColor:It,borderBottomColor:It,borderLeftColor:It,filter:cf,WebkitFilter:cf},vp=t=>l3[t];function ub(t,e){let s=vp(t);return s!==cf&&(s=Wr),s.getAnimatableNone?s.getAnimatableNone(e):void 0}const c3=new Set(["auto","none","0"]);function h3(t,e,s){let r=0,i;for(;r<t.length&&!i;){const a=t[r];typeof a=="string"&&!c3.has(a)&&Qo(a).values.length&&(i=t[r]),r++}if(i&&s)for(const a of e)t[a]=ub(s,i)}const mx=t=>t===Pn||t===Me,gx=(t,e)=>parseFloat(t.split(", ")[e]),_x=(t,e)=>(s,{transform:r})=>{if(r==="none"||!r)return 0;const i=r.match(/^matrix3d\((.+)\)$/u);if(i)return gx(i[1],e);{const a=r.match(/^matrix\((.+)\)$/u);return a?gx(a[1],t):0}},u3=new Set(["x","y","z"]),d3=En.filter(t=>!u3.has(t));function f3(t){const e=[];return d3.forEach(s=>{const r=t.getValue(s);r!==void 0&&(e.push([s,r.get()]),r.set(s.startsWith("scale")?1:0))}),e}const wn={width:({x:t},{paddingLeft:e="0",paddingRight:s="0"})=>t.max-t.min-parseFloat(e)-parseFloat(s),height:({y:t},{paddingTop:e="0",paddingBottom:s="0"})=>t.max-t.min-parseFloat(e)-parseFloat(s),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:_x(4,13),y:_x(5,14)};wn.translateX=wn.x;wn.translateY=wn.y;const Ci=new Set;let hf=!1,uf=!1;function db(){if(uf){const t=Array.from(Ci).filter(r=>r.needsMeasurement),e=new Set(t.map(r=>r.element)),s=new Map;e.forEach(r=>{const i=f3(r);i.length&&(s.set(r,i),r.render())}),t.forEach(r=>r.measureInitialState()),e.forEach(r=>{r.render();const i=s.get(r);i&&i.forEach(([a,c])=>{var o;(o=r.getValue(a))===null||o===void 0||o.set(c)})}),t.forEach(r=>r.measureEndState()),t.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}uf=!1,hf=!1,Ci.forEach(t=>t.complete()),Ci.clear()}function fb(){Ci.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(uf=!0)})}function p3(){fb(),db()}class xp{constructor(e,s,r,i,a,c=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=s,this.name=r,this.motionValue=i,this.element=a,this.isAsync=c}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Ci.add(this),hf||(hf=!0,Qe.read(fb),Qe.resolveKeyframes(db))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:s,element:r,motionValue:i}=this;for(let a=0;a<e.length;a++)if(e[a]===null)if(a===0){const c=i==null?void 0:i.get(),o=e[e.length-1];if(c!==void 0)e[0]=c;else if(r&&s){const h=r.readValue(s,o);h!=null&&(e[0]=h)}e[0]===void 0&&(e[0]=o),i&&c===void 0&&i.set(e[0])}else e[a]=e[a-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),Ci.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Ci.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const pb=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),m3=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function g3(t){const e=m3.exec(t);if(!e)return[,];const[,s,r,i]=e;return[`--${s??r}`,i]}function mb(t,e,s=1){const[r,i]=g3(t);if(!r)return;const a=window.getComputedStyle(e).getPropertyValue(r);if(a){const c=a.trim();return pb(c)?parseFloat(c):c}return ep(i)?mb(i,e,s+1):i}const gb=t=>e=>e.test(t),_3={test:t=>t==="auto",parse:t=>t},_b=[Pn,Me,Ys,Fr,oT,nT,_3],vx=t=>_b.find(gb(t));class vb extends xp{constructor(e,s,r,i,a){super(e,s,r,i,a,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:s,name:r}=this;if(!s||!s.current)return;super.readKeyframes();for(let h=0;h<e.length;h++){let u=e[h];if(typeof u=="string"&&(u=u.trim(),ep(u))){const f=mb(u,s.current);f!==void 0&&(e[h]=f),h===e.length-1&&(this.finalKeyframe=u)}}if(this.resolveNoneKeyframes(),!K1.has(r)||e.length!==2)return;const[i,a]=e,c=vx(i),o=vx(a);if(c!==o)if(mx(c)&&mx(o))for(let h=0;h<e.length;h++){const u=e[h];typeof u=="string"&&(e[h]=parseFloat(u))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:s}=this,r=[];for(let i=0;i<e.length;i++)qT(e[i])&&r.push(i);r.length&&h3(e,r,s)}measureInitialState(){const{element:e,unresolvedKeyframes:s,name:r}=this;if(!e||!e.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=wn[r](e.measureViewportBox(),window.getComputedStyle(e.current)),s[0]=this.measuredOrigin;const i=s[s.length-1];i!==void 0&&e.getValue(r,i).jump(i,!1)}measureEndState(){var e;const{element:s,name:r,unresolvedKeyframes:i}=this;if(!s||!s.current)return;const a=s.getValue(r);a&&a.jump(this.measuredOrigin,!1);const c=i.length-1,o=i[c];i[c]=wn[r](s.measureViewportBox(),window.getComputedStyle(s.current)),o!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=o),!((e=this.removedTransforms)===null||e===void 0)&&e.length&&this.removedTransforms.forEach(([h,u])=>{s.getValue(h).set(u)}),this.resolveNoneKeyframes()}}const xx=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Wr.test(t)||t==="0")&&!t.startsWith("url("));function v3(t){const e=t[0];if(t.length===1)return!0;for(let s=0;s<t.length;s++)if(t[s]!==e)return!0}function x3(t,e,s,r){const i=t[0];if(i===null)return!1;if(e==="display"||e==="visibility")return!0;const a=t[t.length-1],c=xx(i,e),o=xx(a,e);return!c||!o?!1:v3(t)||(s==="spring"||lp(s))&&r}const y3=t=>t!==null;function Ic(t,{repeat:e,repeatType:s="loop"},r){const i=t.filter(y3),a=e&&s!=="loop"&&e%2===1?0:i.length-1;return!a||r===void 0?i[a]:r}const b3=40;class xb{constructor({autoplay:e=!0,delay:s=0,type:r="keyframes",repeat:i=0,repeatDelay:a=0,repeatType:c="loop",...o}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=Xs.now(),this.options={autoplay:e,delay:s,type:r,repeat:i,repeatDelay:a,repeatType:c,...o},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>b3?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&p3(),this._resolved}onKeyframesResolved(e,s){this.resolvedAt=Xs.now(),this.hasAttemptedResolve=!0;const{name:r,type:i,velocity:a,delay:c,onComplete:o,onUpdate:h,isGenerator:u}=this.options;if(!u&&!x3(e,r,i,a))if(c)this.options.duration=0;else{h&&h(Ic(e,this.options,s)),o&&o(),this.resolveFinishedPromise();return}const f=this.initPlayback(e,s);f!==!1&&(this._resolved={keyframes:e,finalKeyframe:s,...f},this.onPostResolved())}onPostResolved(){}then(e,s){return this.currentFinishedPromise.then(e,s)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}const st=(t,e,s)=>t+(e-t)*s;function pd(t,e,s){return s<0&&(s+=1),s>1&&(s-=1),s<1/6?t+(e-t)*6*s:s<1/2?e:s<2/3?t+(e-t)*(2/3-s)*6:t}function w3({hue:t,saturation:e,lightness:s,alpha:r}){t/=360,e/=100,s/=100;let i=0,a=0,c=0;if(!e)i=a=c=s;else{const o=s<.5?s*(1+e):s+e-s*e,h=2*s-o;i=pd(h,o,t+1/3),a=pd(h,o,t),c=pd(h,o,t-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(c*255),alpha:r}}function mc(t,e){return s=>s>0?e:t}const md=(t,e,s)=>{const r=t*t,i=s*(e*e-r)+r;return i<0?0:Math.sqrt(i)},S3=[lf,bi,pn],C3=t=>S3.find(e=>e.test(t));function yx(t){const e=C3(t);if(!e)return!1;let s=e.parse(t);return e===pn&&(s=w3(s)),s}const bx=(t,e)=>{const s=yx(t),r=yx(e);if(!s||!r)return mc(t,e);const i={...s};return a=>(i.red=md(s.red,r.red,a),i.green=md(s.green,r.green,a),i.blue=md(s.blue,r.blue,a),i.alpha=st(s.alpha,r.alpha,a),bi.transform(i))},k3=(t,e)=>s=>e(t(s)),ia=(...t)=>t.reduce(k3),df=new Set(["none","hidden"]);function E3(t,e){return df.has(t)?s=>s<=0?t:e:s=>s>=1?e:t}function P3(t,e){return s=>st(t,e,s)}function yp(t){return typeof t=="number"?P3:typeof t=="string"?ep(t)?mc:It.test(t)?bx:T3:Array.isArray(t)?yb:typeof t=="object"?It.test(t)?bx:M3:mc}function yb(t,e){const s=[...t],r=s.length,i=t.map((a,c)=>yp(a)(a,e[c]));return a=>{for(let c=0;c<r;c++)s[c]=i[c](a);return s}}function M3(t,e){const s={...t,...e},r={};for(const i in s)t[i]!==void 0&&e[i]!==void 0&&(r[i]=yp(t[i])(t[i],e[i]));return i=>{for(const a in r)s[a]=r[a](i);return s}}function A3(t,e){var s;const r=[],i={color:0,var:0,number:0};for(let a=0;a<e.values.length;a++){const c=e.types[a],o=t.indexes[c][i[c]],h=(s=t.values[o])!==null&&s!==void 0?s:0;r[a]=h,i[c]++}return r}const T3=(t,e)=>{const s=Wr.createTransformer(e),r=Qo(t),i=Qo(e);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?df.has(t)&&!i.values.length||df.has(e)&&!r.values.length?E3(t,e):ia(yb(A3(r,i),i.values),s):mc(t,e)};function bb(t,e,s){return typeof t=="number"&&typeof e=="number"&&typeof s=="number"?st(t,e,s):yp(t)(t,e)}const R3=5;function wb(t,e,s){const r=Math.max(e-R3,0);return Y1(s-t(r),e-r)}const nt={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},gd=.001;function D3({duration:t=nt.duration,bounce:e=nt.bounce,velocity:s=nt.velocity,mass:r=nt.mass}){let i,a,c=1-e;c=mr(nt.minDamping,nt.maxDamping,c),t=mr(nt.minDuration,nt.maxDuration,pr(t)),c<1?(i=u=>{const f=u*c,d=f*t,g=f-s,_=ff(u,c),k=Math.exp(-d);return gd-g/_*k},a=u=>{const d=u*c*t,g=d*s+s,_=Math.pow(c,2)*Math.pow(u,2)*t,k=Math.exp(-d),S=ff(Math.pow(u,2),c);return(-i(u)+gd>0?-1:1)*((g-_)*k)/S}):(i=u=>{const f=Math.exp(-u*t),d=(u-s)*t+1;return-gd+f*d},a=u=>{const f=Math.exp(-u*t),d=(s-u)*(t*t);return f*d});const o=5/t,h=B3(i,a,o);if(t=fr(t),isNaN(h))return{stiffness:nt.stiffness,damping:nt.damping,duration:t};{const u=Math.pow(h,2)*r;return{stiffness:u,damping:c*2*Math.sqrt(r*u),duration:t}}}const L3=12;function B3(t,e,s){let r=s;for(let i=1;i<L3;i++)r=r-t(r)/e(r);return r}function ff(t,e){return t*Math.sqrt(1-e*e)}const j3=["duration","bounce"],I3=["stiffness","damping","mass"];function wx(t,e){return e.some(s=>t[s]!==void 0)}function N3(t){let e={velocity:nt.velocity,stiffness:nt.stiffness,damping:nt.damping,mass:nt.mass,isResolvedFromDuration:!1,...t};if(!wx(t,I3)&&wx(t,j3))if(t.visualDuration){const s=t.visualDuration,r=2*Math.PI/(s*1.2),i=r*r,a=2*mr(.05,1,1-(t.bounce||0))*Math.sqrt(i);e={...e,mass:nt.mass,stiffness:i,damping:a}}else{const s=D3(t);e={...e,...s,mass:nt.mass},e.isResolvedFromDuration=!0}return e}function Sb(t=nt.visualDuration,e=nt.bounce){const s=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:r,restDelta:i}=s;const a=s.keyframes[0],c=s.keyframes[s.keyframes.length-1],o={done:!1,value:a},{stiffness:h,damping:u,mass:f,duration:d,velocity:g,isResolvedFromDuration:_}=N3({...s,velocity:-pr(s.velocity||0)}),k=g||0,S=u/(2*Math.sqrt(h*f)),m=c-a,x=pr(Math.sqrt(h/f)),v=Math.abs(m)<5;r||(r=v?nt.restSpeed.granular:nt.restSpeed.default),i||(i=v?nt.restDelta.granular:nt.restDelta.default);let b;if(S<1){const E=ff(x,S);b=P=>{const T=Math.exp(-S*x*P);return c-T*((k+S*x*m)/E*Math.sin(E*P)+m*Math.cos(E*P))}}else if(S===1)b=E=>c-Math.exp(-x*E)*(m+(k+x*m)*E);else{const E=x*Math.sqrt(S*S-1);b=P=>{const T=Math.exp(-S*x*P),A=Math.min(E*P,300);return c-T*((k+S*x*m)*Math.sinh(A)+E*m*Math.cosh(A))/E}}const C={calculatedDuration:_&&d||null,next:E=>{const P=b(E);if(_)o.done=E>=d;else{let T=0;S<1&&(T=E===0?fr(k):wb(b,E,P));const A=Math.abs(T)<=r,D=Math.abs(c-P)<=i;o.done=A&&D}return o.value=o.done?c:P,o},toString:()=>{const E=Math.min(H1(C),nf),P=U1(T=>C.next(E*T).value,E,30);return E+"ms "+P}};return C}function Sx({keyframes:t,velocity:e=0,power:s=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:c,min:o,max:h,restDelta:u=.5,restSpeed:f}){const d=t[0],g={done:!1,value:d},_=A=>o!==void 0&&A<o||h!==void 0&&A>h,k=A=>o===void 0?h:h===void 0||Math.abs(o-A)<Math.abs(h-A)?o:h;let S=s*e;const m=d+S,x=c===void 0?m:c(m);x!==m&&(S=x-d);const v=A=>-S*Math.exp(-A/r),b=A=>x+v(A),C=A=>{const D=v(A),I=b(A);g.done=Math.abs(D)<=u,g.value=g.done?x:I};let E,P;const T=A=>{_(g.value)&&(E=A,P=Sb({keyframes:[g.value,k(g.value)],velocity:wb(b,A,g.value),damping:i,stiffness:a,restDelta:u,restSpeed:f}))};return T(0),{calculatedDuration:null,next:A=>{let D=!1;return!P&&E===void 0&&(D=!0,C(A),T(A)),E!==void 0&&A>=E?P.next(A-E):(!D&&C(A),g)}}}const O3=ra(.42,0,1,1),F3=ra(0,0,.58,1),Cb=ra(.42,0,.58,1),$3=t=>Array.isArray(t)&&typeof t[0]!="number",H3={linear:us,easeIn:O3,easeInOut:Cb,easeOut:F3,circIn:mp,circInOut:ib,circOut:rb,backIn:pp,backInOut:tb,backOut:eb,anticipate:sb},Cx=t=>{if(cp(t)){b1(t.length===4);const[e,s,r,i]=t;return ra(e,s,r,i)}else if(typeof t=="string")return H3[t];return t};function U3(t,e,s){const r=[],i=s||bb,a=t.length-1;for(let c=0;c<a;c++){let o=i(t[c],t[c+1]);if(e){const h=Array.isArray(e)?e[c]||us:e;o=ia(h,o)}r.push(o)}return r}function W3(t,e,{clamp:s=!0,ease:r,mixer:i}={}){const a=t.length;if(b1(a===e.length),a===1)return()=>e[0];if(a===2&&e[0]===e[1])return()=>e[1];const c=t[0]===t[1];t[0]>t[a-1]&&(t=[...t].reverse(),e=[...e].reverse());const o=U3(e,r,i),h=o.length,u=f=>{if(c&&f<t[0])return e[0];let d=0;if(h>1)for(;d<t.length-2&&!(f<t[d+1]);d++);const g=yn(t[d],t[d+1],f);return o[d](g)};return s?f=>u(mr(t[0],t[a-1],f)):u}function z3(t,e){const s=t[t.length-1];for(let r=1;r<=e;r++){const i=yn(0,e,r);t.push(st(s,1,i))}}function V3(t){const e=[0];return z3(e,t.length-1),e}function G3(t,e){return t.map(s=>s*e)}function q3(t,e){return t.map(()=>e||Cb).splice(0,t.length-1)}function gc({duration:t=300,keyframes:e,times:s,ease:r="easeInOut"}){const i=$3(r)?r.map(Cx):Cx(r),a={done:!1,value:e[0]},c=G3(s&&s.length===e.length?s:V3(e),t),o=W3(c,e,{ease:Array.isArray(i)?i:q3(e,i)});return{calculatedDuration:t,next:h=>(a.value=o(h),a.done=h>=t,a)}}const K3=t=>{const e=({timestamp:s})=>t(s);return{start:()=>Qe.update(e,!0),stop:()=>Ur(e),now:()=>Rt.isProcessing?Rt.timestamp:Xs.now()}},Y3={decay:Sx,inertia:Sx,tween:gc,keyframes:gc,spring:Sb},X3=t=>t/100;class bp extends xb{constructor(e){super(e),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:h}=this.options;h&&h()};const{name:s,motionValue:r,element:i,keyframes:a}=this.options,c=(i==null?void 0:i.KeyframeResolver)||xp,o=(h,u)=>this.onKeyframesResolved(h,u);this.resolver=new c(a,o,s,r,i),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(e){const{type:s="keyframes",repeat:r=0,repeatDelay:i=0,repeatType:a,velocity:c=0}=this.options,o=lp(s)?s:Y3[s]||gc;let h,u;o!==gc&&typeof e[0]!="number"&&(h=ia(X3,bb(e[0],e[1])),e=[0,100]);const f=o({...this.options,keyframes:e});a==="mirror"&&(u=o({...this.options,keyframes:[...e].reverse(),velocity:-c})),f.calculatedDuration===null&&(f.calculatedDuration=H1(f));const{calculatedDuration:d}=f,g=d+i,_=g*(r+1)-i;return{generator:f,mirroredGenerator:u,mapPercentToKeyframes:h,calculatedDuration:d,resolvedDuration:g,totalDuration:_}}onPostResolved(){const{autoplay:e=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!e?this.pause():this.state=this.pendingPlayState}tick(e,s=!1){const{resolved:r}=this;if(!r){const{keyframes:A}=this.options;return{done:!0,value:A[A.length-1]}}const{finalKeyframe:i,generator:a,mirroredGenerator:c,mapPercentToKeyframes:o,keyframes:h,calculatedDuration:u,totalDuration:f,resolvedDuration:d}=r;if(this.startTime===null)return a.next(0);const{delay:g,repeat:_,repeatType:k,repeatDelay:S,onUpdate:m}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-f/this.speed,this.startTime)),s?this.currentTime=e:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;const x=this.currentTime-g*(this.speed>=0?1:-1),v=this.speed>=0?x<0:x>f;this.currentTime=Math.max(x,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=f);let b=this.currentTime,C=a;if(_){const A=Math.min(this.currentTime,f)/d;let D=Math.floor(A),I=A%1;!I&&A>=1&&(I=1),I===1&&D--,D=Math.min(D,_+1),!!(D%2)&&(k==="reverse"?(I=1-I,S&&(I-=S/d)):k==="mirror"&&(C=c)),b=mr(0,1,I)*d}const E=v?{done:!1,value:h[0]}:C.next(b);o&&(E.value=o(E.value));let{done:P}=E;!v&&u!==null&&(P=this.speed>=0?this.currentTime>=f:this.currentTime<=0);const T=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&P);return T&&i!==void 0&&(E.value=Ic(h,this.options,i)),m&&m(E.value),T&&this.finish(),E}get duration(){const{resolved:e}=this;return e?pr(e.calculatedDuration):0}get time(){return pr(this.currentTime)}set time(e){e=fr(e),this.currentTime=e,this.holdTime!==null||this.speed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){const s=this.playbackSpeed!==e;this.playbackSpeed=e,s&&(this.time=pr(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=K3,onPlay:s,startTime:r}=this.options;this.driver||(this.driver=e(a=>this.tick(a))),s&&s();const i=this.driver.now();this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=i):this.startTime=r??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var e;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(e=this.currentTime)!==null&&e!==void 0?e:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:e}=this.options;e&&e()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}}const Q3=new Set(["opacity","clipPath","filter","transform"]);function Z3(t,e,s,{delay:r=0,duration:i=300,repeat:a=0,repeatType:c="loop",ease:o="easeInOut",times:h}={}){const u={[e]:s};h&&(u.offset=h);const f=z1(o,i);return Array.isArray(f)&&(u.easing=f),t.animate(u,{delay:r,duration:i,easing:Array.isArray(f)?"linear":f,fill:"both",iterations:a+1,direction:c==="reverse"?"alternate":"normal"})}const J3=qf(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),_c=10,eR=2e4;function tR(t){return lp(t.type)||t.type==="spring"||!W1(t.ease)}function sR(t,e){const s=new bp({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:t[0]};const i=[];let a=0;for(;!r.done&&a<eR;)r=s.sample(a),i.push(r.value),a+=_c;return{times:void 0,keyframes:i,duration:a-_c,ease:"linear"}}const kb={anticipate:sb,backInOut:tb,circInOut:ib};function rR(t){return t in kb}class kx extends xb{constructor(e){super(e);const{name:s,motionValue:r,element:i,keyframes:a}=this.options;this.resolver=new vb(a,(c,o)=>this.onKeyframesResolved(c,o),s,r,i),this.resolver.scheduleResolve()}initPlayback(e,s){let{duration:r=300,times:i,ease:a,type:c,motionValue:o,name:h,startTime:u}=this.options;if(!o.owner||!o.owner.current)return!1;if(typeof a=="string"&&pc()&&rR(a)&&(a=kb[a]),tR(this.options)){const{onComplete:d,onUpdate:g,motionValue:_,element:k,...S}=this.options,m=sR(e,S);e=m.keyframes,e.length===1&&(e[1]=e[0]),r=m.duration,i=m.times,a=m.ease,c="keyframes"}const f=Z3(o.owner.current,h,e,{...this.options,duration:r,times:i,ease:a});return f.startTime=u??this.calcStartTime(),this.pendingTimeline?(cx(f,this.pendingTimeline),this.pendingTimeline=void 0):f.onfinish=()=>{const{onComplete:d}=this.options;o.set(Ic(e,this.options,s)),d&&d(),this.cancel(),this.resolveFinishedPromise()},{animation:f,duration:r,times:i,type:c,ease:a,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:s}=e;return pr(s)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:s}=e;return pr(s.currentTime||0)}set time(e){const{resolved:s}=this;if(!s)return;const{animation:r}=s;r.currentTime=fr(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:s}=e;return s.playbackRate}set speed(e){const{resolved:s}=this;if(!s)return;const{animation:r}=s;r.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:s}=e;return s.playState}get startTime(){const{resolved:e}=this;if(!e)return null;const{animation:s}=e;return s.startTime}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{const{resolved:s}=this;if(!s)return us;const{animation:r}=s;cx(r,e)}return us}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:s}=e;s.playState==="finished"&&this.updateFinishedPromise(),s.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:s}=e;s.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:e}=this;if(!e)return;const{animation:s,keyframes:r,duration:i,type:a,ease:c,times:o}=e;if(s.playState==="idle"||s.playState==="finished")return;if(this.time){const{motionValue:u,onUpdate:f,onComplete:d,element:g,..._}=this.options,k=new bp({..._,keyframes:r,duration:i,type:a,ease:c,times:o,isGenerator:!0}),S=fr(this.time);u.setWithVelocity(k.sample(S-_c).value,k.sample(S).value,_c)}const{onStop:h}=this.options;h&&h(),this.cancel()}complete(){const{resolved:e}=this;e&&e.animation.finish()}cancel(){const{resolved:e}=this;e&&e.animation.cancel()}static supports(e){const{motionValue:s,name:r,repeatDelay:i,repeatType:a,damping:c,type:o}=e;if(!s||!s.owner||!(s.owner.current instanceof HTMLElement))return!1;const{onUpdate:h,transformTemplate:u}=s.owner.getProps();return J3()&&r&&Q3.has(r)&&!h&&!u&&!i&&a!=="mirror"&&c!==0&&o!=="inertia"}}const iR={type:"spring",stiffness:500,damping:25,restSpeed:10},nR=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),oR={type:"keyframes",duration:.8},aR={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},lR=(t,{keyframes:e})=>e.length>2?oR:Ri.has(t)?t.startsWith("scale")?nR(e[1]):iR:aR;function cR({when:t,delay:e,delayChildren:s,staggerChildren:r,staggerDirection:i,repeat:a,repeatType:c,repeatDelay:o,from:h,elapsed:u,...f}){return!!Object.keys(f).length}const wp=(t,e,s,r={},i,a)=>c=>{const o=ap(r,t)||{},h=o.delay||r.delay||0;let{elapsed:u=0}=r;u=u-fr(h);let f={keyframes:Array.isArray(s)?s:[null,s],ease:"easeOut",velocity:e.getVelocity(),...o,delay:-u,onUpdate:g=>{e.set(g),o.onUpdate&&o.onUpdate(g)},onComplete:()=>{c(),o.onComplete&&o.onComplete()},name:t,motionValue:e,element:a?void 0:i};cR(o)||(f={...f,...lR(t,f)}),f.duration&&(f.duration=fr(f.duration)),f.repeatDelay&&(f.repeatDelay=fr(f.repeatDelay)),f.from!==void 0&&(f.keyframes[0]=f.from);let d=!1;if((f.type===!1||f.duration===0&&!f.repeatDelay)&&(f.duration=0,f.delay===0&&(d=!0)),d&&!a&&e.get()!==void 0){const g=Ic(f.keyframes,o);if(g!==void 0)return Qe.update(()=>{f.onUpdate(g),f.onComplete()}),new MT([])}return!a&&kx.supports(f)?new kx(f):new bp(f)};function hR({protectedKeys:t,needsAnimating:e},s){const r=t.hasOwnProperty(s)&&e[s]!==!0;return e[s]=!1,r}function Eb(t,e,{delay:s=0,transitionOverride:r,type:i}={}){var a;let{transition:c=t.getDefaultTransition(),transitionEnd:o,...h}=e;r&&(c=r);const u=[],f=i&&t.animationState&&t.animationState.getState()[i];for(const d in h){const g=t.getValue(d,(a=t.latestValues[d])!==null&&a!==void 0?a:null),_=h[d];if(_===void 0||f&&hR(f,d))continue;const k={delay:s,...ap(c||{},d)};let S=!1;if(window.MotionHandoffAnimation){const x=X1(t);if(x){const v=window.MotionHandoffAnimation(x,d,Qe);v!==null&&(k.startTime=v,S=!0)}}af(t,d),g.start(wp(d,g,_,t.shouldReduceMotion&&K1.has(d)?{type:!1}:k,t,S));const m=g.animation;m&&u.push(m)}return o&&Promise.all(u).then(()=>{Qe.update(()=>{o&&UT(t,o)})}),u}function pf(t,e,s={}){var r;const i=jc(t,e,s.type==="exit"?(r=t.presenceContext)===null||r===void 0?void 0:r.custom:void 0);let{transition:a=t.getDefaultTransition()||{}}=i||{};s.transitionOverride&&(a=s.transitionOverride);const c=i?()=>Promise.all(Eb(t,i,s)):()=>Promise.resolve(),o=t.variantChildren&&t.variantChildren.size?(u=0)=>{const{delayChildren:f=0,staggerChildren:d,staggerDirection:g}=a;return uR(t,e,f+u,d,g,s)}:()=>Promise.resolve(),{when:h}=a;if(h){const[u,f]=h==="beforeChildren"?[c,o]:[o,c];return u().then(()=>f())}else return Promise.all([c(),o(s.delay)])}function uR(t,e,s=0,r=0,i=1,a){const c=[],o=(t.variantChildren.size-1)*r,h=i===1?(u=0)=>u*r:(u=0)=>o-u*r;return Array.from(t.variantChildren).sort(dR).forEach((u,f)=>{u.notify("AnimationStart",e),c.push(pf(u,e,{...a,delay:s+h(f)}).then(()=>u.notify("AnimationComplete",e)))}),Promise.all(c)}function dR(t,e){return t.sortNodePosition(e)}function fR(t,e,s={}){t.notify("AnimationStart",e);let r;if(Array.isArray(e)){const i=e.map(a=>pf(t,a,s));r=Promise.all(i)}else if(typeof e=="string")r=pf(t,e,s);else{const i=typeof e=="function"?jc(t,e,s.custom):e;r=Promise.all(Eb(t,i,s))}return r.then(()=>{t.notify("AnimationComplete",e)})}const pR=Yf.length;function Pb(t){if(!t)return;if(!t.isControllingVariants){const s=t.parent?Pb(t.parent)||{}:{};return t.props.initial!==void 0&&(s.initial=t.props.initial),s}const e={};for(let s=0;s<pR;s++){const r=Yf[s],i=t.props[r];(Ko(i)||i===!1)&&(e[r]=i)}return e}const mR=[...Kf].reverse(),gR=Kf.length;function _R(t){return e=>Promise.all(e.map(({animation:s,options:r})=>fR(t,s,r)))}function vR(t){let e=_R(t),s=Ex(),r=!0;const i=h=>(u,f)=>{var d;const g=jc(t,f,h==="exit"?(d=t.presenceContext)===null||d===void 0?void 0:d.custom:void 0);if(g){const{transition:_,transitionEnd:k,...S}=g;u={...u,...S,...k}}return u};function a(h){e=h(t)}function c(h){const{props:u}=t,f=Pb(t.parent)||{},d=[],g=new Set;let _={},k=1/0;for(let m=0;m<gR;m++){const x=mR[m],v=s[x],b=u[x]!==void 0?u[x]:f[x],C=Ko(b),E=x===h?v.isActive:null;E===!1&&(k=m);let P=b===f[x]&&b!==u[x]&&C;if(P&&r&&t.manuallyAnimateOnMount&&(P=!1),v.protectedKeys={..._},!v.isActive&&E===null||!b&&!v.prevProp||Lc(b)||typeof b=="boolean")continue;const T=xR(v.prevProp,b);let A=T||x===h&&v.isActive&&!P&&C||m>k&&C,D=!1;const I=Array.isArray(b)?b:[b];let O=I.reduce(i(x),{});E===!1&&(O={});const{prevResolvedValues:z={}}=v,U={...z,...O},K=J=>{A=!0,g.has(J)&&(D=!0,g.delete(J)),v.needsAnimating[J]=!0;const Y=t.getValue(J);Y&&(Y.liveStyle=!1)};for(const J in U){const Y=O[J],L=z[J];if(_.hasOwnProperty(J))continue;let F=!1;rf(Y)&&rf(L)?F=!$1(Y,L):F=Y!==L,F?Y!=null?K(J):g.add(J):Y!==void 0&&g.has(J)?K(J):v.protectedKeys[J]=!0}v.prevProp=b,v.prevResolvedValues=O,v.isActive&&(_={..._,...O}),r&&t.blockInitialAnimation&&(A=!1),A&&(!(P&&T)||D)&&d.push(...I.map(J=>({animation:J,options:{type:x}})))}if(g.size){const m={};g.forEach(x=>{const v=t.getBaseTarget(x),b=t.getValue(x);b&&(b.liveStyle=!0),m[x]=v??null}),d.push({animation:m})}let S=!!d.length;return r&&(u.initial===!1||u.initial===u.animate)&&!t.manuallyAnimateOnMount&&(S=!1),r=!1,S?e(d):Promise.resolve()}function o(h,u){var f;if(s[h].isActive===u)return Promise.resolve();(f=t.variantChildren)===null||f===void 0||f.forEach(g=>{var _;return(_=g.animationState)===null||_===void 0?void 0:_.setActive(h,u)}),s[h].isActive=u;const d=c(h);for(const g in s)s[g].protectedKeys={};return d}return{animateChanges:c,setActive:o,setAnimateFunction:a,getState:()=>s,reset:()=>{s=Ex(),r=!0}}}function xR(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!$1(e,t):!1}function di(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Ex(){return{animate:di(!0),whileInView:di(),whileHover:di(),whileTap:di(),whileDrag:di(),whileFocus:di(),exit:di()}}class zr{constructor(e){this.isMounted=!1,this.node=e}update(){}}class yR extends zr{constructor(e){super(e),e.animationState||(e.animationState=vR(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Lc(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:s}=this.node.prevProps||{};e!==s&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)===null||e===void 0||e.call(this)}}let bR=0;class wR extends zr{constructor(){super(...arguments),this.id=bR++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:s}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;const i=this.node.animationState.setActive("exit",!e);s&&!e&&i.then(()=>s(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const SR={animation:{Feature:yR},exit:{Feature:wR}};function Zo(t,e,s,r={passive:!0}){return t.addEventListener(e,s,r),()=>t.removeEventListener(e,s)}function na(t){return{point:{x:t.pageX,y:t.pageY}}}const CR=t=>e=>hp(e)&&t(e,na(e));function No(t,e,s,r){return Zo(t,e,CR(s),r)}const Px=(t,e)=>Math.abs(t-e);function kR(t,e){const s=Px(t.x,e.x),r=Px(t.y,e.y);return Math.sqrt(s**2+r**2)}class Mb{constructor(e,s,{transformPagePoint:r,contextWindow:i,dragSnapToOrigin:a=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const d=vd(this.lastMoveEventInfo,this.history),g=this.startEvent!==null,_=kR(d.offset,{x:0,y:0})>=3;if(!g&&!_)return;const{point:k}=d,{timestamp:S}=Rt;this.history.push({...k,timestamp:S});const{onStart:m,onMove:x}=this.handlers;g||(m&&m(this.lastMoveEvent,d),this.startEvent=this.lastMoveEvent),x&&x(this.lastMoveEvent,d)},this.handlePointerMove=(d,g)=>{this.lastMoveEvent=d,this.lastMoveEventInfo=_d(g,this.transformPagePoint),Qe.update(this.updatePoint,!0)},this.handlePointerUp=(d,g)=>{this.end();const{onEnd:_,onSessionEnd:k,resumeAnimation:S}=this.handlers;if(this.dragSnapToOrigin&&S&&S(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const m=vd(d.type==="pointercancel"?this.lastMoveEventInfo:_d(g,this.transformPagePoint),this.history);this.startEvent&&_&&_(d,m),k&&k(d,m)},!hp(e))return;this.dragSnapToOrigin=a,this.handlers=s,this.transformPagePoint=r,this.contextWindow=i||window;const c=na(e),o=_d(c,this.transformPagePoint),{point:h}=o,{timestamp:u}=Rt;this.history=[{...h,timestamp:u}];const{onSessionStart:f}=s;f&&f(e,vd(o,this.history)),this.removeListeners=ia(No(this.contextWindow,"pointermove",this.handlePointerMove),No(this.contextWindow,"pointerup",this.handlePointerUp),No(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),Ur(this.updatePoint)}}function _d(t,e){return e?{point:e(t.point)}:t}function Mx(t,e){return{x:t.x-e.x,y:t.y-e.y}}function vd({point:t},e){return{point:t,delta:Mx(t,Ab(e)),offset:Mx(t,ER(e)),velocity:PR(e,.1)}}function ER(t){return t[0]}function Ab(t){return t[t.length-1]}function PR(t,e){if(t.length<2)return{x:0,y:0};let s=t.length-1,r=null;const i=Ab(t);for(;s>=0&&(r=t[s],!(i.timestamp-r.timestamp>fr(e)));)s--;if(!r)return{x:0,y:0};const a=pr(i.timestamp-r.timestamp);if(a===0)return{x:0,y:0};const c={x:(i.x-r.x)/a,y:(i.y-r.y)/a};return c.x===1/0&&(c.x=0),c.y===1/0&&(c.y=0),c}const Tb=1e-4,MR=1-Tb,AR=1+Tb,Rb=.01,TR=0-Rb,RR=0+Rb;function ds(t){return t.max-t.min}function DR(t,e,s){return Math.abs(t-e)<=s}function Ax(t,e,s,r=.5){t.origin=r,t.originPoint=st(e.min,e.max,t.origin),t.scale=ds(s)/ds(e),t.translate=st(s.min,s.max,t.origin)-t.originPoint,(t.scale>=MR&&t.scale<=AR||isNaN(t.scale))&&(t.scale=1),(t.translate>=TR&&t.translate<=RR||isNaN(t.translate))&&(t.translate=0)}function Oo(t,e,s,r){Ax(t.x,e.x,s.x,r?r.originX:void 0),Ax(t.y,e.y,s.y,r?r.originY:void 0)}function Tx(t,e,s){t.min=s.min+e.min,t.max=t.min+ds(e)}function LR(t,e,s){Tx(t.x,e.x,s.x),Tx(t.y,e.y,s.y)}function Rx(t,e,s){t.min=e.min-s.min,t.max=t.min+ds(e)}function Fo(t,e,s){Rx(t.x,e.x,s.x),Rx(t.y,e.y,s.y)}function BR(t,{min:e,max:s},r){return e!==void 0&&t<e?t=r?st(e,t,r.min):Math.max(t,e):s!==void 0&&t>s&&(t=r?st(s,t,r.max):Math.min(t,s)),t}function Dx(t,e,s){return{min:e!==void 0?t.min+e:void 0,max:s!==void 0?t.max+s-(t.max-t.min):void 0}}function jR(t,{top:e,left:s,bottom:r,right:i}){return{x:Dx(t.x,s,i),y:Dx(t.y,e,r)}}function Lx(t,e){let s=e.min-t.min,r=e.max-t.max;return e.max-e.min<t.max-t.min&&([s,r]=[r,s]),{min:s,max:r}}function IR(t,e){return{x:Lx(t.x,e.x),y:Lx(t.y,e.y)}}function NR(t,e){let s=.5;const r=ds(t),i=ds(e);return i>r?s=yn(e.min,e.max-r,t.min):r>i&&(s=yn(t.min,t.max-i,e.min)),mr(0,1,s)}function OR(t,e){const s={};return e.min!==void 0&&(s.min=e.min-t.min),e.max!==void 0&&(s.max=e.max-t.min),s}const mf=.35;function FR(t=mf){return t===!1?t=0:t===!0&&(t=mf),{x:Bx(t,"left","right"),y:Bx(t,"top","bottom")}}function Bx(t,e,s){return{min:jx(t,e),max:jx(t,s)}}function jx(t,e){return typeof t=="number"?t:t[e]||0}const Ix=()=>({translate:0,scale:1,origin:0,originPoint:0}),mn=()=>({x:Ix(),y:Ix()}),Nx=()=>({min:0,max:0}),ht=()=>({x:Nx(),y:Nx()});function ys(t){return[t("x"),t("y")]}function Db({top:t,left:e,right:s,bottom:r}){return{x:{min:e,max:s},y:{min:t,max:r}}}function $R({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function HR(t,e){if(!e)return t;const s=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:s.y,left:s.x,bottom:r.y,right:r.x}}function xd(t){return t===void 0||t===1}function gf({scale:t,scaleX:e,scaleY:s}){return!xd(t)||!xd(e)||!xd(s)}function vi(t){return gf(t)||Lb(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function Lb(t){return Ox(t.x)||Ox(t.y)}function Ox(t){return t&&t!=="0%"}function vc(t,e,s){const r=t-s,i=e*r;return s+i}function Fx(t,e,s,r,i){return i!==void 0&&(t=vc(t,i,r)),vc(t,s,r)+e}function _f(t,e=0,s=1,r,i){t.min=Fx(t.min,e,s,r,i),t.max=Fx(t.max,e,s,r,i)}function Bb(t,{x:e,y:s}){_f(t.x,e.translate,e.scale,e.originPoint),_f(t.y,s.translate,s.scale,s.originPoint)}const $x=.999999999999,Hx=1.0000000000001;function UR(t,e,s,r=!1){const i=s.length;if(!i)return;e.x=e.y=1;let a,c;for(let o=0;o<i;o++){a=s[o],c=a.projectionDelta;const{visualElement:h}=a.options;h&&h.props.style&&h.props.style.display==="contents"||(r&&a.options.layoutScroll&&a.scroll&&a!==a.root&&_n(t,{x:-a.scroll.offset.x,y:-a.scroll.offset.y}),c&&(e.x*=c.x.scale,e.y*=c.y.scale,Bb(t,c)),r&&vi(a.latestValues)&&_n(t,a.latestValues))}e.x<Hx&&e.x>$x&&(e.x=1),e.y<Hx&&e.y>$x&&(e.y=1)}function gn(t,e){t.min=t.min+e,t.max=t.max+e}function Ux(t,e,s,r,i=.5){const a=st(t.min,t.max,i);_f(t,e,s,a,r)}function _n(t,e){Ux(t.x,e.x,e.scaleX,e.scale,e.originX),Ux(t.y,e.y,e.scaleY,e.scale,e.originY)}function jb(t,e){return Db(HR(t.getBoundingClientRect(),e))}function WR(t,e,s){const r=jb(t,s),{scroll:i}=e;return i&&(gn(r.x,i.offset.x),gn(r.y,i.offset.y)),r}const Ib=({current:t})=>t?t.ownerDocument.defaultView:null,zR=new WeakMap;class VR{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ht(),this.visualElement=e}start(e,{snapToCursor:s=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const i=f=>{const{dragSnapToOrigin:d}=this.getProps();d?this.pauseAnimation():this.stopAnimation(),s&&this.snapToCursor(na(f).point)},a=(f,d)=>{const{drag:g,dragPropagation:_,onDragStart:k}=this.getProps();if(g&&!_&&(this.openDragLock&&this.openDragLock(),this.openDragLock=NT(g),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),ys(m=>{let x=this.getAxisMotionValue(m).get()||0;if(Ys.test(x)){const{projection:v}=this.visualElement;if(v&&v.layout){const b=v.layout.layoutBox[m];b&&(x=ds(b)*(parseFloat(x)/100))}}this.originPoint[m]=x}),k&&Qe.postRender(()=>k(f,d)),af(this.visualElement,"transform");const{animationState:S}=this.visualElement;S&&S.setActive("whileDrag",!0)},c=(f,d)=>{const{dragPropagation:g,dragDirectionLock:_,onDirectionLock:k,onDrag:S}=this.getProps();if(!g&&!this.openDragLock)return;const{offset:m}=d;if(_&&this.currentDirection===null){this.currentDirection=GR(m),this.currentDirection!==null&&k&&k(this.currentDirection);return}this.updateAxis("x",d.point,m),this.updateAxis("y",d.point,m),this.visualElement.render(),S&&S(f,d)},o=(f,d)=>this.stop(f,d),h=()=>ys(f=>{var d;return this.getAnimationState(f)==="paused"&&((d=this.getAxisMotionValue(f).animation)===null||d===void 0?void 0:d.play())}),{dragSnapToOrigin:u}=this.getProps();this.panSession=new Mb(e,{onSessionStart:i,onStart:a,onMove:c,onSessionEnd:o,resumeAnimation:h},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:Ib(this.visualElement)})}stop(e,s){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:i}=s;this.startAnimation(i);const{onDragEnd:a}=this.getProps();a&&Qe.postRender(()=>a(e,s))}cancel(){this.isDragging=!1;const{projection:e,animationState:s}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),s&&s.setActive("whileDrag",!1)}updateAxis(e,s,r){const{drag:i}=this.getProps();if(!r||!Ul(e,i,this.currentDirection))return;const a=this.getAxisMotionValue(e);let c=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(c=BR(c,this.constraints[e],this.elastic[e])),a.set(c)}resolveConstraints(){var e;const{dragConstraints:s,dragElastic:r}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(e=this.visualElement.projection)===null||e===void 0?void 0:e.layout,a=this.constraints;s&&fn(s)?this.constraints||(this.constraints=this.resolveRefConstraints()):s&&i?this.constraints=jR(i.layoutBox,s):this.constraints=!1,this.elastic=FR(r),a!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&ys(c=>{this.constraints!==!1&&this.getAxisMotionValue(c)&&(this.constraints[c]=OR(i.layoutBox[c],this.constraints[c]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:s}=this.getProps();if(!e||!fn(e))return!1;const r=e.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const a=WR(r,i.root,this.visualElement.getTransformPagePoint());let c=IR(i.layout.layoutBox,a);if(s){const o=s($R(c));this.hasMutatedConstraints=!!o,o&&(c=Db(o))}return c}startAnimation(e){const{drag:s,dragMomentum:r,dragElastic:i,dragTransition:a,dragSnapToOrigin:c,onDragTransitionEnd:o}=this.getProps(),h=this.constraints||{},u=ys(f=>{if(!Ul(f,s,this.currentDirection))return;let d=h&&h[f]||{};c&&(d={min:0,max:0});const g=i?200:1e6,_=i?40:1e7,k={type:"inertia",velocity:r?e[f]:0,bounceStiffness:g,bounceDamping:_,timeConstant:750,restDelta:1,restSpeed:10,...a,...d};return this.startAxisValueAnimation(f,k)});return Promise.all(u).then(o)}startAxisValueAnimation(e,s){const r=this.getAxisMotionValue(e);return af(this.visualElement,e),r.start(wp(e,r,0,s,this.visualElement,!1))}stopAnimation(){ys(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){ys(e=>{var s;return(s=this.getAxisMotionValue(e).animation)===null||s===void 0?void 0:s.pause()})}getAnimationState(e){var s;return(s=this.getAxisMotionValue(e).animation)===null||s===void 0?void 0:s.state}getAxisMotionValue(e){const s=`_drag${e.toUpperCase()}`,r=this.visualElement.getProps(),i=r[s];return i||this.visualElement.getValue(e,(r.initial?r.initial[e]:void 0)||0)}snapToCursor(e){ys(s=>{const{drag:r}=this.getProps();if(!Ul(s,r,this.currentDirection))return;const{projection:i}=this.visualElement,a=this.getAxisMotionValue(s);if(i&&i.layout){const{min:c,max:o}=i.layout.layoutBox[s];a.set(e[s]-st(c,o,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:s}=this.getProps(),{projection:r}=this.visualElement;if(!fn(s)||!r||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};ys(c=>{const o=this.getAxisMotionValue(c);if(o&&this.constraints!==!1){const h=o.get();i[c]=NR({min:h,max:h},this.constraints[c])}});const{transformTemplate:a}=this.visualElement.getProps();this.visualElement.current.style.transform=a?a({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),ys(c=>{if(!Ul(c,e,null))return;const o=this.getAxisMotionValue(c),{min:h,max:u}=this.constraints[c];o.set(st(h,u,i[c]))})}addListeners(){if(!this.visualElement.current)return;zR.set(this.visualElement,this);const e=this.visualElement.current,s=No(e,"pointerdown",h=>{const{drag:u,dragListener:f=!0}=this.getProps();u&&f&&this.start(h)}),r=()=>{const{dragConstraints:h}=this.getProps();fn(h)&&h.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,a=i.addEventListener("measure",r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),Qe.read(r);const c=Zo(window,"resize",()=>this.scalePositionWithinConstraints()),o=i.addEventListener("didUpdate",(({delta:h,hasLayoutChanged:u})=>{this.isDragging&&u&&(ys(f=>{const d=this.getAxisMotionValue(f);d&&(this.originPoint[f]+=h[f].translate,d.set(d.get()+h[f].translate))}),this.visualElement.render())}));return()=>{c(),s(),a(),o&&o()}}getProps(){const e=this.visualElement.getProps(),{drag:s=!1,dragDirectionLock:r=!1,dragPropagation:i=!1,dragConstraints:a=!1,dragElastic:c=mf,dragMomentum:o=!0}=e;return{...e,drag:s,dragDirectionLock:r,dragPropagation:i,dragConstraints:a,dragElastic:c,dragMomentum:o}}}function Ul(t,e,s){return(e===!0||e===t)&&(s===null||s===t)}function GR(t,e=10){let s=null;return Math.abs(t.y)>e?s="y":Math.abs(t.x)>e&&(s="x"),s}class qR extends zr{constructor(e){super(e),this.removeGroupControls=us,this.removeListeners=us,this.controls=new VR(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||us}unmount(){this.removeGroupControls(),this.removeListeners()}}const Wx=t=>(e,s)=>{t&&Qe.postRender(()=>t(e,s))};class KR extends zr{constructor(){super(...arguments),this.removePointerDownListener=us}onPointerDown(e){this.session=new Mb(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Ib(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:s,onPan:r,onPanEnd:i}=this.node.getProps();return{onSessionStart:Wx(e),onStart:Wx(s),onMove:r,onEnd:(a,c)=>{delete this.session,i&&Qe.postRender(()=>i(a,c))}}}mount(){this.removePointerDownListener=No(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const Xl={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function zx(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const wo={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(Me.test(t))t=parseFloat(t);else return t;const s=zx(t,e.target.x),r=zx(t,e.target.y);return`${s}% ${r}%`}},YR={correct:(t,{treeScale:e,projectionDelta:s})=>{const r=t,i=Wr.parse(t);if(i.length>5)return r;const a=Wr.createTransformer(t),c=typeof i[0]!="number"?1:0,o=s.x.scale*e.x,h=s.y.scale*e.y;i[0+c]/=o,i[1+c]/=h;const u=st(o,h,.5);return typeof i[2+c]=="number"&&(i[2+c]/=u),typeof i[3+c]=="number"&&(i[3+c]/=u),a(i)}};class XR extends re.Component{componentDidMount(){const{visualElement:e,layoutGroup:s,switchLayoutGroup:r,layoutId:i}=this.props,{projection:a}=e;gT(QR),a&&(s.group&&s.group.add(a),r&&r.register&&i&&r.register(a),a.root.didUpdate(),a.addEventListener("animationComplete",()=>{this.safeToRemove()}),a.setOptions({...a.options,onExitComplete:()=>this.safeToRemove()})),Xl.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:s,visualElement:r,drag:i,isPresent:a}=this.props,c=r.projection;return c&&(c.isPresent=a,i||e.layoutDependency!==s||s===void 0?c.willUpdate():this.safeToRemove(),e.isPresent!==a&&(a?c.promote():c.relegate()||Qe.postRender(()=>{const o=c.getStack();(!o||!o.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),Qf.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:s,switchLayoutGroup:r}=this.props,{projection:i}=e;i&&(i.scheduleCheckAfterUnmount(),s&&s.group&&s.group.remove(i),r&&r.deregister&&r.deregister(i))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function Nb(t){const[e,s]=v1(),r=re.useContext(Wf);return y.jsx(XR,{...t,layoutGroup:r,switchLayoutGroup:re.useContext(P1),isPresent:e,safeToRemove:s})}const QR={borderRadius:{...wo,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:wo,borderTopRightRadius:wo,borderBottomLeftRadius:wo,borderBottomRightRadius:wo,boxShadow:YR};function ZR(t,e,s){const r=$t(t)?t:Xo(t);return r.start(wp("",r,e,s)),r.animation}function JR(t){return t instanceof SVGElement&&t.tagName!=="svg"}const eD=(t,e)=>t.depth-e.depth;class tD{constructor(){this.children=[],this.isDirty=!1}add(e){up(this.children,e),this.isDirty=!0}remove(e){dp(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(eD),this.isDirty=!1,this.children.forEach(e)}}function sD(t,e){const s=Xs.now(),r=({timestamp:i})=>{const a=i-s;a>=e&&(Ur(r),t(a-e))};return Qe.read(r,!0),()=>Ur(r)}const Ob=["TopLeft","TopRight","BottomLeft","BottomRight"],rD=Ob.length,Vx=t=>typeof t=="string"?parseFloat(t):t,Gx=t=>typeof t=="number"||Me.test(t);function iD(t,e,s,r,i,a){i?(t.opacity=st(0,s.opacity!==void 0?s.opacity:1,nD(r)),t.opacityExit=st(e.opacity!==void 0?e.opacity:1,0,oD(r))):a&&(t.opacity=st(e.opacity!==void 0?e.opacity:1,s.opacity!==void 0?s.opacity:1,r));for(let c=0;c<rD;c++){const o=`border${Ob[c]}Radius`;let h=qx(e,o),u=qx(s,o);if(h===void 0&&u===void 0)continue;h||(h=0),u||(u=0),h===0||u===0||Gx(h)===Gx(u)?(t[o]=Math.max(st(Vx(h),Vx(u),r),0),(Ys.test(u)||Ys.test(h))&&(t[o]+="%")):t[o]=u}(e.rotate||s.rotate)&&(t.rotate=st(e.rotate||0,s.rotate||0,r))}function qx(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const nD=Fb(0,.5,rb),oD=Fb(.5,.95,us);function Fb(t,e,s){return r=>r<t?0:r>e?1:s(yn(t,e,r))}function Kx(t,e){t.min=e.min,t.max=e.max}function xs(t,e){Kx(t.x,e.x),Kx(t.y,e.y)}function Yx(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function Xx(t,e,s,r,i){return t-=e,t=vc(t,1/s,r),i!==void 0&&(t=vc(t,1/i,r)),t}function aD(t,e=0,s=1,r=.5,i,a=t,c=t){if(Ys.test(e)&&(e=parseFloat(e),e=st(c.min,c.max,e/100)-c.min),typeof e!="number")return;let o=st(a.min,a.max,r);t===a&&(o-=e),t.min=Xx(t.min,e,s,o,i),t.max=Xx(t.max,e,s,o,i)}function Qx(t,e,[s,r,i],a,c){aD(t,e[s],e[r],e[i],e.scale,a,c)}const lD=["x","scaleX","originX"],cD=["y","scaleY","originY"];function Zx(t,e,s,r){Qx(t.x,e,lD,s?s.x:void 0,r?r.x:void 0),Qx(t.y,e,cD,s?s.y:void 0,r?r.y:void 0)}function Jx(t){return t.translate===0&&t.scale===1}function $b(t){return Jx(t.x)&&Jx(t.y)}function ey(t,e){return t.min===e.min&&t.max===e.max}function hD(t,e){return ey(t.x,e.x)&&ey(t.y,e.y)}function ty(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function Hb(t,e){return ty(t.x,e.x)&&ty(t.y,e.y)}function sy(t){return ds(t.x)/ds(t.y)}function ry(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class uD{constructor(){this.members=[]}add(e){up(this.members,e),e.scheduleRender()}remove(e){if(dp(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const s=this.members[this.members.length-1];s&&this.promote(s)}}relegate(e){const s=this.members.findIndex(i=>e===i);if(s===0)return!1;let r;for(let i=s;i>=0;i--){const a=this.members[i];if(a.isPresent!==!1){r=a;break}}return r?(this.promote(r),!0):!1}promote(e,s){const r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.instance&&r.scheduleRender(),e.scheduleRender(),e.resumeFrom=r,s&&(e.resumeFrom.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:i}=e.options;i===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:s,resumingFrom:r}=e;s.onExitComplete&&s.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function dD(t,e,s){let r="";const i=t.x.translate/e.x,a=t.y.translate/e.y,c=(s==null?void 0:s.z)||0;if((i||a||c)&&(r=`translate3d(${i}px, ${a}px, ${c}px) `),(e.x!==1||e.y!==1)&&(r+=`scale(${1/e.x}, ${1/e.y}) `),s){const{transformPerspective:u,rotate:f,rotateX:d,rotateY:g,skewX:_,skewY:k}=s;u&&(r=`perspective(${u}px) ${r}`),f&&(r+=`rotate(${f}deg) `),d&&(r+=`rotateX(${d}deg) `),g&&(r+=`rotateY(${g}deg) `),_&&(r+=`skewX(${_}deg) `),k&&(r+=`skewY(${k}deg) `)}const o=t.x.scale*e.x,h=t.y.scale*e.y;return(o!==1||h!==1)&&(r+=`scale(${o}, ${h})`),r||"none"}const xi={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},Mo=typeof window<"u"&&window.MotionDebug!==void 0,yd=["","X","Y","Z"],fD={visibility:"hidden"},iy=1e3;let pD=0;function bd(t,e,s,r){const{latestValues:i}=e;i[t]&&(s[t]=i[t],e.setStaticValue(t,0),r&&(r[t]=0))}function Ub(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const s=X1(e);if(window.MotionHasOptimisedAnimation(s,"transform")){const{layout:i,layoutId:a}=t.options;window.MotionCancelOptimisedAnimation(s,"transform",Qe,!(i||a))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&Ub(r)}function Wb({attachResizeListener:t,defaultParent:e,measureScroll:s,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(c={},o=e==null?void 0:e()){this.id=pD++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,Mo&&(xi.totalNodes=xi.resolvedTargetDeltas=xi.recalculatedProjection=0),this.nodes.forEach(_D),this.nodes.forEach(wD),this.nodes.forEach(SD),this.nodes.forEach(vD),Mo&&window.MotionDebug.record(xi)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=c,this.root=o?o.root||o:this,this.path=o?[...o.path,o]:[],this.parent=o,this.depth=o?o.depth+1:0;for(let h=0;h<this.path.length;h++)this.path[h].shouldResetTransform=!0;this.root===this&&(this.nodes=new tD)}addEventListener(c,o){return this.eventHandlers.has(c)||this.eventHandlers.set(c,new fp),this.eventHandlers.get(c).add(o)}notifyListeners(c,...o){const h=this.eventHandlers.get(c);h&&h.notify(...o)}hasListeners(c){return this.eventHandlers.has(c)}mount(c,o=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=JR(c),this.instance=c;const{layoutId:h,layout:u,visualElement:f}=this.options;if(f&&!f.current&&f.mount(c),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),o&&(u||h)&&(this.isLayoutDirty=!0),t){let d;const g=()=>this.root.updateBlockedByResize=!1;t(c,()=>{this.root.updateBlockedByResize=!0,d&&d(),d=sD(g,250),Xl.hasAnimatedSinceResize&&(Xl.hasAnimatedSinceResize=!1,this.nodes.forEach(oy))})}h&&this.root.registerSharedNode(h,this),this.options.animate!==!1&&f&&(h||u)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:g,hasRelativeTargetChanged:_,layout:k})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const S=this.options.transition||f.getDefaultTransition()||MD,{onLayoutAnimationStart:m,onLayoutAnimationComplete:x}=f.getProps(),v=!this.targetLayout||!Hb(this.targetLayout,k)||_,b=!g&&_;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||b||g&&(v||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(d,b);const C={...ap(S,"layout"),onPlay:m,onComplete:x};(f.shouldReduceMotion||this.options.layoutRoot)&&(C.delay=0,C.type=!1),this.startAnimation(C)}else g||oy(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=k})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const c=this.getStack();c&&c.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Ur(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(CD),this.animationId++)}getTransformTemplate(){const{visualElement:c}=this.options;return c&&c.getProps().transformTemplate}willUpdate(c=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Ub(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let f=0;f<this.path.length;f++){const d=this.path[f];d.shouldResetTransform=!0,d.updateScroll("snapshot"),d.options.layoutRoot&&d.willUpdate(!1)}const{layoutId:o,layout:h}=this.options;if(o===void 0&&!h)return;const u=this.getTransformTemplate();this.prevTransformTemplateValue=u?u(this.latestValues,""):void 0,this.updateSnapshot(),c&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(ny);return}this.isUpdating||this.nodes.forEach(yD),this.isUpdating=!1,this.nodes.forEach(bD),this.nodes.forEach(mD),this.nodes.forEach(gD),this.clearAllSnapshots();const o=Xs.now();Rt.delta=mr(0,1e3/60,o-Rt.timestamp),Rt.timestamp=o,Rt.isProcessing=!0,ud.update.process(Rt),ud.preRender.process(Rt),ud.render.process(Rt),Rt.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Qf.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(xD),this.sharedNodes.forEach(kD)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Qe.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Qe.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let h=0;h<this.path.length;h++)this.path[h].updateScroll();const c=this.layout;this.layout=this.measure(!1),this.layoutCorrected=ht(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:o}=this.options;o&&o.notify("LayoutMeasure",this.layout.layoutBox,c?c.layoutBox:void 0)}updateScroll(c="measure"){let o=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===c&&(o=!1),o){const h=r(this.instance);this.scroll={animationId:this.root.animationId,phase:c,isRoot:h,offset:s(this.instance),wasRoot:this.scroll?this.scroll.isRoot:h}}}resetTransform(){if(!i)return;const c=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,o=this.projectionDelta&&!$b(this.projectionDelta),h=this.getTransformTemplate(),u=h?h(this.latestValues,""):void 0,f=u!==this.prevTransformTemplateValue;c&&(o||vi(this.latestValues)||f)&&(i(this.instance,u),this.shouldResetTransform=!1,this.scheduleRender())}measure(c=!0){const o=this.measurePageBox();let h=this.removeElementScroll(o);return c&&(h=this.removeTransform(h)),AD(h),{animationId:this.root.animationId,measuredBox:o,layoutBox:h,latestValues:{},source:this.id}}measurePageBox(){var c;const{visualElement:o}=this.options;if(!o)return ht();const h=o.measureViewportBox();if(!(((c=this.scroll)===null||c===void 0?void 0:c.wasRoot)||this.path.some(TD))){const{scroll:f}=this.root;f&&(gn(h.x,f.offset.x),gn(h.y,f.offset.y))}return h}removeElementScroll(c){var o;const h=ht();if(xs(h,c),!((o=this.scroll)===null||o===void 0)&&o.wasRoot)return h;for(let u=0;u<this.path.length;u++){const f=this.path[u],{scroll:d,options:g}=f;f!==this.root&&d&&g.layoutScroll&&(d.wasRoot&&xs(h,c),gn(h.x,d.offset.x),gn(h.y,d.offset.y))}return h}applyTransform(c,o=!1){const h=ht();xs(h,c);for(let u=0;u<this.path.length;u++){const f=this.path[u];!o&&f.options.layoutScroll&&f.scroll&&f!==f.root&&_n(h,{x:-f.scroll.offset.x,y:-f.scroll.offset.y}),vi(f.latestValues)&&_n(h,f.latestValues)}return vi(this.latestValues)&&_n(h,this.latestValues),h}removeTransform(c){const o=ht();xs(o,c);for(let h=0;h<this.path.length;h++){const u=this.path[h];if(!u.instance||!vi(u.latestValues))continue;gf(u.latestValues)&&u.updateSnapshot();const f=ht(),d=u.measurePageBox();xs(f,d),Zx(o,u.latestValues,u.snapshot?u.snapshot.layoutBox:void 0,f)}return vi(this.latestValues)&&Zx(o,this.latestValues),o}setTargetDelta(c){this.targetDelta=c,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(c){this.options={...this.options,...c,crossfade:c.crossfade!==void 0?c.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Rt.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(c=!1){var o;const h=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=h.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=h.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=h.isSharedProjectionDirty);const u=!!this.resumingFrom||this!==h;if(!(c||u&&this.isSharedProjectionDirty||this.isProjectionDirty||!((o=this.parent)===null||o===void 0)&&o.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:d,layoutId:g}=this.options;if(!(!this.layout||!(d||g))){if(this.resolvedRelativeTargetAt=Rt.timestamp,!this.targetDelta&&!this.relativeTarget){const _=this.getClosestProjectingParent();_&&_.layout&&this.animationProgress!==1?(this.relativeParent=_,this.forceRelativeParentToResolveTarget(),this.relativeTarget=ht(),this.relativeTargetOrigin=ht(),Fo(this.relativeTargetOrigin,this.layout.layoutBox,_.layout.layoutBox),xs(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=ht(),this.targetWithTransforms=ht()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),LR(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):xs(this.target,this.layout.layoutBox),Bb(this.target,this.targetDelta)):xs(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const _=this.getClosestProjectingParent();_&&!!_.resumingFrom==!!this.resumingFrom&&!_.options.layoutScroll&&_.target&&this.animationProgress!==1?(this.relativeParent=_,this.forceRelativeParentToResolveTarget(),this.relativeTarget=ht(),this.relativeTargetOrigin=ht(),Fo(this.relativeTargetOrigin,this.target,_.target),xs(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}Mo&&xi.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||gf(this.parent.latestValues)||Lb(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var c;const o=this.getLead(),h=!!this.resumingFrom||this!==o;let u=!0;if((this.isProjectionDirty||!((c=this.parent)===null||c===void 0)&&c.isProjectionDirty)&&(u=!1),h&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(u=!1),this.resolvedRelativeTargetAt===Rt.timestamp&&(u=!1),u)return;const{layout:f,layoutId:d}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(f||d))return;xs(this.layoutCorrected,this.layout.layoutBox);const g=this.treeScale.x,_=this.treeScale.y;UR(this.layoutCorrected,this.treeScale,this.path,h),o.layout&&!o.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(o.target=o.layout.layoutBox,o.targetWithTransforms=ht());const{target:k}=o;if(!k){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Yx(this.prevProjectionDelta.x,this.projectionDelta.x),Yx(this.prevProjectionDelta.y,this.projectionDelta.y)),Oo(this.projectionDelta,this.layoutCorrected,k,this.latestValues),(this.treeScale.x!==g||this.treeScale.y!==_||!ry(this.projectionDelta.x,this.prevProjectionDelta.x)||!ry(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",k)),Mo&&xi.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(c=!0){var o;if((o=this.options.visualElement)===null||o===void 0||o.scheduleRender(),c){const h=this.getStack();h&&h.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=mn(),this.projectionDelta=mn(),this.projectionDeltaWithTransform=mn()}setAnimationOrigin(c,o=!1){const h=this.snapshot,u=h?h.latestValues:{},f={...this.latestValues},d=mn();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!o;const g=ht(),_=h?h.source:void 0,k=this.layout?this.layout.source:void 0,S=_!==k,m=this.getStack(),x=!m||m.members.length<=1,v=!!(S&&!x&&this.options.crossfade===!0&&!this.path.some(PD));this.animationProgress=0;let b;this.mixTargetDelta=C=>{const E=C/1e3;ay(d.x,c.x,E),ay(d.y,c.y,E),this.setTargetDelta(d),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Fo(g,this.layout.layoutBox,this.relativeParent.layout.layoutBox),ED(this.relativeTarget,this.relativeTargetOrigin,g,E),b&&hD(this.relativeTarget,b)&&(this.isProjectionDirty=!1),b||(b=ht()),xs(b,this.relativeTarget)),S&&(this.animationValues=f,iD(f,u,this.latestValues,E,v,x)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=E},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(c){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Ur(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Qe.update(()=>{Xl.hasAnimatedSinceResize=!0,this.currentAnimation=ZR(0,iy,{...c,onUpdate:o=>{this.mixTargetDelta(o),c.onUpdate&&c.onUpdate(o)},onComplete:()=>{c.onComplete&&c.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const c=this.getStack();c&&c.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(iy),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const c=this.getLead();let{targetWithTransforms:o,target:h,layout:u,latestValues:f}=c;if(!(!o||!h||!u)){if(this!==c&&this.layout&&u&&zb(this.options.animationType,this.layout.layoutBox,u.layoutBox)){h=this.target||ht();const d=ds(this.layout.layoutBox.x);h.x.min=c.target.x.min,h.x.max=h.x.min+d;const g=ds(this.layout.layoutBox.y);h.y.min=c.target.y.min,h.y.max=h.y.min+g}xs(o,h),_n(o,f),Oo(this.projectionDeltaWithTransform,this.layoutCorrected,o,f)}}registerSharedNode(c,o){this.sharedNodes.has(c)||this.sharedNodes.set(c,new uD),this.sharedNodes.get(c).add(o);const u=o.options.initialPromotionConfig;o.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(o):void 0})}isLead(){const c=this.getStack();return c?c.lead===this:!0}getLead(){var c;const{layoutId:o}=this.options;return o?((c=this.getStack())===null||c===void 0?void 0:c.lead)||this:this}getPrevLead(){var c;const{layoutId:o}=this.options;return o?(c=this.getStack())===null||c===void 0?void 0:c.prevLead:void 0}getStack(){const{layoutId:c}=this.options;if(c)return this.root.sharedNodes.get(c)}promote({needsReset:c,transition:o,preserveFollowOpacity:h}={}){const u=this.getStack();u&&u.promote(this,h),c&&(this.projectionDelta=void 0,this.needsReset=!0),o&&this.setOptions({transition:o})}relegate(){const c=this.getStack();return c?c.relegate(this):!1}resetSkewAndRotation(){const{visualElement:c}=this.options;if(!c)return;let o=!1;const{latestValues:h}=c;if((h.z||h.rotate||h.rotateX||h.rotateY||h.rotateZ||h.skewX||h.skewY)&&(o=!0),!o)return;const u={};h.z&&bd("z",c,u,this.animationValues);for(let f=0;f<yd.length;f++)bd(`rotate${yd[f]}`,c,u,this.animationValues),bd(`skew${yd[f]}`,c,u,this.animationValues);c.render();for(const f in u)c.setStaticValue(f,u[f]),this.animationValues&&(this.animationValues[f]=u[f]);c.scheduleRender()}getProjectionStyles(c){var o,h;if(!this.instance||this.isSVG)return;if(!this.isVisible)return fD;const u={visibility:""},f=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,u.opacity="",u.pointerEvents=Kl(c==null?void 0:c.pointerEvents)||"",u.transform=f?f(this.latestValues,""):"none",u;const d=this.getLead();if(!this.projectionDelta||!this.layout||!d.target){const S={};return this.options.layoutId&&(S.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,S.pointerEvents=Kl(c==null?void 0:c.pointerEvents)||""),this.hasProjected&&!vi(this.latestValues)&&(S.transform=f?f({},""):"none",this.hasProjected=!1),S}const g=d.animationValues||d.latestValues;this.applyTransformsToTarget(),u.transform=dD(this.projectionDeltaWithTransform,this.treeScale,g),f&&(u.transform=f(g,u.transform));const{x:_,y:k}=this.projectionDelta;u.transformOrigin=`${_.origin*100}% ${k.origin*100}% 0`,d.animationValues?u.opacity=d===this?(h=(o=g.opacity)!==null&&o!==void 0?o:this.latestValues.opacity)!==null&&h!==void 0?h:1:this.preserveOpacity?this.latestValues.opacity:g.opacityExit:u.opacity=d===this?g.opacity!==void 0?g.opacity:"":g.opacityExit!==void 0?g.opacityExit:0;for(const S in fc){if(g[S]===void 0)continue;const{correct:m,applyTo:x}=fc[S],v=u.transform==="none"?g[S]:m(g[S],d);if(x){const b=x.length;for(let C=0;C<b;C++)u[x[C]]=v}else u[S]=v}return this.options.layoutId&&(u.pointerEvents=d===this?Kl(c==null?void 0:c.pointerEvents)||"":"none"),u}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(c=>{var o;return(o=c.currentAnimation)===null||o===void 0?void 0:o.stop()}),this.root.nodes.forEach(ny),this.root.sharedNodes.clear()}}}function mD(t){t.updateLayout()}function gD(t){var e;const s=((e=t.resumeFrom)===null||e===void 0?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&s&&t.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:i}=t.layout,{animationType:a}=t.options,c=s.source!==t.layout.source;a==="size"?ys(d=>{const g=c?s.measuredBox[d]:s.layoutBox[d],_=ds(g);g.min=r[d].min,g.max=g.min+_}):zb(a,s.layoutBox,r)&&ys(d=>{const g=c?s.measuredBox[d]:s.layoutBox[d],_=ds(r[d]);g.max=g.min+_,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[d].max=t.relativeTarget[d].min+_)});const o=mn();Oo(o,r,s.layoutBox);const h=mn();c?Oo(h,t.applyTransform(i,!0),s.measuredBox):Oo(h,r,s.layoutBox);const u=!$b(o);let f=!1;if(!t.resumeFrom){const d=t.getClosestProjectingParent();if(d&&!d.resumeFrom){const{snapshot:g,layout:_}=d;if(g&&_){const k=ht();Fo(k,s.layoutBox,g.layoutBox);const S=ht();Fo(S,r,_.layoutBox),Hb(k,S)||(f=!0),d.options.layoutRoot&&(t.relativeTarget=S,t.relativeTargetOrigin=k,t.relativeParent=d)}}}t.notifyListeners("didUpdate",{layout:r,snapshot:s,delta:h,layoutDelta:o,hasLayoutChanged:u,hasRelativeTargetChanged:f})}else if(t.isLead()){const{onExitComplete:r}=t.options;r&&r()}t.options.transition=void 0}function _D(t){Mo&&xi.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function vD(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function xD(t){t.clearSnapshot()}function ny(t){t.clearMeasurements()}function yD(t){t.isLayoutDirty=!1}function bD(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function oy(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function wD(t){t.resolveTargetDelta()}function SD(t){t.calcProjection()}function CD(t){t.resetSkewAndRotation()}function kD(t){t.removeLeadSnapshot()}function ay(t,e,s){t.translate=st(e.translate,0,s),t.scale=st(e.scale,1,s),t.origin=e.origin,t.originPoint=e.originPoint}function ly(t,e,s,r){t.min=st(e.min,s.min,r),t.max=st(e.max,s.max,r)}function ED(t,e,s,r){ly(t.x,e.x,s.x,r),ly(t.y,e.y,s.y,r)}function PD(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const MD={duration:.45,ease:[.4,0,.1,1]},cy=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),hy=cy("applewebkit/")&&!cy("chrome/")?Math.round:us;function uy(t){t.min=hy(t.min),t.max=hy(t.max)}function AD(t){uy(t.x),uy(t.y)}function zb(t,e,s){return t==="position"||t==="preserve-aspect"&&!DR(sy(e),sy(s),.2)}function TD(t){var e;return t!==t.root&&((e=t.scroll)===null||e===void 0?void 0:e.wasRoot)}const RD=Wb({attachResizeListener:(t,e)=>Zo(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),wd={current:void 0},Vb=Wb({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!wd.current){const t=new RD({});t.mount(window),t.setOptions({layoutScroll:!0}),wd.current=t}return wd.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),DD={pan:{Feature:KR},drag:{Feature:qR,ProjectionNode:Vb,MeasureLayout:Nb}};function dy(t,e,s){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover",s==="Start");const i="onHover"+s,a=r[i];a&&Qe.postRender(()=>a(e,na(e)))}class LD extends zr{mount(){const{current:e}=this.node;e&&(this.unmount=DT(e,s=>(dy(this.node,s,"Start"),r=>dy(this.node,r,"End"))))}unmount(){}}class BD extends zr{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=ia(Zo(this.node.current,"focus",()=>this.onFocus()),Zo(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function fy(t,e,s){const{props:r}=t;t.animationState&&r.whileTap&&t.animationState.setActive("whileTap",s==="Start");const i="onTap"+(s==="End"?"":s),a=r[i];a&&Qe.postRender(()=>a(e,na(e)))}class jD extends zr{mount(){const{current:e}=this.node;e&&(this.unmount=IT(e,s=>(fy(this.node,s,"Start"),(r,{success:i})=>fy(this.node,r,i?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const vf=new WeakMap,Sd=new WeakMap,ID=t=>{const e=vf.get(t.target);e&&e(t)},ND=t=>{t.forEach(ID)};function OD({root:t,...e}){const s=t||document;Sd.has(s)||Sd.set(s,{});const r=Sd.get(s),i=JSON.stringify(e);return r[i]||(r[i]=new IntersectionObserver(ND,{root:t,...e})),r[i]}function FD(t,e,s){const r=OD(e);return vf.set(t,s),r.observe(t),()=>{vf.delete(t),r.unobserve(t)}}const $D={some:0,all:1};class HD extends zr{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:s,margin:r,amount:i="some",once:a}=e,c={root:s?s.current:void 0,rootMargin:r,threshold:typeof i=="number"?i:$D[i]},o=h=>{const{isIntersecting:u}=h;if(this.isInView===u||(this.isInView=u,a&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:f,onViewportLeave:d}=this.node.getProps(),g=u?f:d;g&&g(h)};return FD(this.node.current,c,o)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:s}=this.node;["amount","margin","root"].some(UD(e,s))&&this.startObserver()}unmount(){}}function UD({viewport:t={}},{viewport:e={}}={}){return s=>t[s]!==e[s]}const WD={inView:{Feature:HD},tap:{Feature:jD},focus:{Feature:BD},hover:{Feature:LD}},zD={layout:{ProjectionNode:Vb,MeasureLayout:Nb}},xc={current:null},Sp={current:!1};function Gb(){if(Sp.current=!0,!!Gf)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>xc.current=t.matches;t.addListener(e),e()}else xc.current=!1}const VD=[..._b,It,Wr],GD=t=>VD.find(gb(t)),py=new WeakMap;function qD(t,e,s){for(const r in e){const i=e[r],a=s[r];if($t(i))t.addValue(r,i);else if($t(a))t.addValue(r,Xo(i,{owner:t}));else if(a!==i)if(t.hasValue(r)){const c=t.getValue(r);c.liveStyle===!0?c.jump(i):c.hasAnimated||c.set(i)}else{const c=t.getStaticValue(r);t.addValue(r,Xo(c!==void 0?c:i,{owner:t}))}}for(const r in s)e[r]===void 0&&t.removeValue(r);return e}const my=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class KD{scrapeMotionValuesFromProps(e,s,r){return{}}constructor({parent:e,props:s,presenceContext:r,reducedMotionConfig:i,blockInitialAnimation:a,visualState:c},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=xp,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const _=Xs.now();this.renderScheduledAt<_&&(this.renderScheduledAt=_,Qe.render(this.render,!1,!0))};const{latestValues:h,renderState:u,onUpdate:f}=c;this.onUpdate=f,this.latestValues=h,this.baseTarget={...h},this.initialValues=s.initial?{...h}:{},this.renderState=u,this.parent=e,this.props=s,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=i,this.options=o,this.blockInitialAnimation=!!a,this.isControllingVariants=Bc(s),this.isVariantNode=k1(s),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:d,...g}=this.scrapeMotionValuesFromProps(s,{},this);for(const _ in g){const k=g[_];h[_]!==void 0&&$t(k)&&k.set(h[_],!1)}}mount(e){this.current=e,py.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((s,r)=>this.bindToMotionValue(r,s)),Sp.current||Gb(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:xc.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){py.delete(this.current),this.projection&&this.projection.unmount(),Ur(this.notifyUpdate),Ur(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const s=this.features[e];s&&(s.unmount(),s.isMounted=!1)}this.current=null}bindToMotionValue(e,s){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const r=Ri.has(e),i=s.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&Qe.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),a=s.on("renderRequest",this.scheduleRender);let c;window.MotionCheckAppearSync&&(c=window.MotionCheckAppearSync(this,e,s)),this.valueSubscriptions.set(e,()=>{i(),a(),c&&c(),s.owner&&s.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in bn){const s=bn[e];if(!s)continue;const{isEnabled:r,Feature:i}=s;if(!this.features[e]&&i&&r(this.props)&&(this.features[e]=new i(this)),this.features[e]){const a=this.features[e];a.isMounted?a.update():(a.mount(),a.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):ht()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,s){this.latestValues[e]=s}update(e,s){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=s;for(let r=0;r<my.length;r++){const i=my[r];this.propEventSubscriptions[i]&&(this.propEventSubscriptions[i](),delete this.propEventSubscriptions[i]);const a="on"+i,c=e[a];c&&(this.propEventSubscriptions[i]=this.on(i,c))}this.prevMotionValues=qD(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue(),this.onUpdate&&this.onUpdate(this)}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const s=this.getClosestVariantNode();if(s)return s.variantChildren&&s.variantChildren.add(e),()=>s.variantChildren.delete(e)}addValue(e,s){const r=this.values.get(e);s!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,s),this.values.set(e,s),this.latestValues[e]=s.get())}removeValue(e){this.values.delete(e);const s=this.valueSubscriptions.get(e);s&&(s(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,s){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return r===void 0&&s!==void 0&&(r=Xo(s===null?void 0:s,{owner:this}),this.addValue(e,r)),r}readValue(e,s){var r;let i=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:(r=this.getBaseTargetFromProps(this.props,e))!==null&&r!==void 0?r:this.readValueFromInstance(this.current,e,this.options);return i!=null&&(typeof i=="string"&&(pb(i)||nb(i))?i=parseFloat(i):!GD(i)&&Wr.test(s)&&(i=ub(e,s)),this.setBaseTarget(e,$t(i)?i.get():i)),$t(i)?i.get():i}setBaseTarget(e,s){this.baseTarget[e]=s}getBaseTarget(e){var s;const{initial:r}=this.props;let i;if(typeof r=="string"||typeof r=="object"){const c=Jf(this.props,r,(s=this.presenceContext)===null||s===void 0?void 0:s.custom);c&&(i=c[e])}if(r&&i!==void 0)return i;const a=this.getBaseTargetFromProps(this.props,e);return a!==void 0&&!$t(a)?a:this.initialValues[e]!==void 0&&i===void 0?void 0:this.baseTarget[e]}on(e,s){return this.events[e]||(this.events[e]=new fp),this.events[e].add(s)}notify(e,...s){this.events[e]&&this.events[e].notify(...s)}}class qb extends KD{constructor(){super(...arguments),this.KeyframeResolver=vb}sortInstanceNodePosition(e,s){return e.compareDocumentPosition(s)&2?1:-1}getBaseTargetFromProps(e,s){return e.style?e.style[s]:void 0}removeValueFromRenderState(e,{vars:s,style:r}){delete s[e],delete r[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;$t(e)&&(this.childSubscription=e.on("change",s=>{this.current&&(this.current.textContent=`${s}`)}))}}function YD(t){return window.getComputedStyle(t)}class XD extends qb{constructor(){super(...arguments),this.type="html",this.renderInstance=B1}readValueFromInstance(e,s){if(Ri.has(s)){const r=vp(s);return r&&r.default||0}else{const r=YD(e),i=(R1(s)?r.getPropertyValue(s):r[s])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:s}){return jb(e,s)}build(e,s,r){sp(e,s,r.transformTemplate)}scrapeMotionValuesFromProps(e,s,r){return op(e,s,r)}}class QD extends qb{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ht}getBaseTargetFromProps(e,s){return e[s]}readValueFromInstance(e,s){if(Ri.has(s)){const r=vp(s);return r&&r.default||0}return s=j1.has(s)?s:Xf(s),e.getAttribute(s)}scrapeMotionValuesFromProps(e,s,r){return O1(e,s,r)}build(e,s,r){rp(e,s,this.isSVGTag,r.transformTemplate)}renderInstance(e,s,r,i){I1(e,s,r,i)}mount(e){this.isSVGTag=np(e.tagName),super.mount(e)}}const ZD=(t,e)=>Zf(t)?new QD(e):new XD(e,{allowProjection:t!==re.Fragment}),JD=kT({...SR,...WD,...DD,...zD},ZD),yc=$A(JD);function Cp(){!Sp.current&&Gb();const[t]=re.useState(xc.current);return t}function Kb({state:t,blink:e=!0}){const s=Cn[t];return y.jsx("span",{className:`chip chip-dot ${e&&t==="needs-input"?"blink":""}`,style:{"--c":s.color},children:s.label})}function Yb({review:t,merged:e}){const s=e?{label:"Merged",color:"#00873a"}:Y0[t];return y.jsx("span",{className:"chip chip-dot",style:{"--c":s.color,color:e?"#fff":void 0},children:s.label})}function Sn({color:t,lead:e,size:s=40}){const r=re.useRef(null);return re.useEffect(()=>{const i=r.current,a=i==null?void 0:i.getContext("2d");if(!i||!a)return;const c=h1(t,e).front;a.imageSmoothingEnabled=!1,a.clearRect(0,0,16,16),a.drawImage(c,2,1)},[t,e]),y.jsx("canvas",{ref:r,width:16,height:16,className:"shrink-0 border-[3px] border-ink bg-navy",style:{width:s,height:s,imageRendering:"pixelated"},"aria-hidden":!0})}function Mn({color:t,size:e=10}){return y.jsx("i",{className:"inline-block shrink-0 border-2 border-ink",style:{width:e,height:e,background:t}})}function Le({children:t}){return y.jsx("h3",{className:"mb-2 text-[13px] font-semibold uppercase tracking-[0.12em] text-muted",children:t})}function Re({label:t,hint:e,children:s}){return y.jsxs("label",{className:"flex flex-col gap-1",children:[y.jsx("span",{className:"text-[14px] font-semibold",children:t}),s,e&&y.jsx("span",{className:"text-[12px] text-muted",children:e})]})}function eL({tabs:t,value:e,onChange:s}){return y.jsx("div",{role:"tablist",className:"flex flex-wrap gap-2",children:t.map(r=>y.jsx("button",{role:"tab","aria-selected":e===r.id,"aria-pressed":e===r.id,className:"btn text-[14px]",onClick:()=>s(r.id),children:r.label},r.id))})}function Di(t=1e3){const[e,s]=re.useState(()=>Date.now());return re.useEffect(()=>{const r=window.setInterval(()=>s(Date.now()),t);return()=>window.clearInterval(r)},[t]),e}function Vr(t,e){const s=Math.max(0,Math.round((e-Date.parse(t))/1e3));if(s<60)return`${s}s`;const r=Math.floor(s/60);if(r<60)return`${r}m`;const i=Math.floor(r/60);return i<24?`${i}h`:`${Math.floor(i/24)}d`}const bc=[];function Xb(t){return be(e=>{var s,r;return(r=(s=e.snap)==null?void 0:s.sbx.agents[t])==null?void 0:r.ports})??[]}function Qb(t){const[e,s]=re.useState(null);return re.useEffect(()=>s(null),[t]),re.useEffect(()=>{if(e===null)return;const r=window.setTimeout(()=>s(null),15e3);return()=>window.clearTimeout(r)},[e]),[e,s]}function tL({agent:t,status:e}){const s=Mi(u=>u.seen[`shell:${t.id}`])??bc,r=Mi(u=>u.dismissed[t.id])??bc,i=Xb(t.id),[a,c]=Qb(i.map(u=>u.sandbox).join());if(t.mode!=="sandbox"||e.session.state!=="running")return null;const o=[...s].reverse().find(u=>!r.includes(u));if(!o)return null;const h=i.some(u=>u.sandbox===o);return y.jsxs("div",{className:`flex items-center gap-2 border-b-[3px] border-ink px-3 py-1.5 text-[13px] ${h?"bg-[#dcf7e3]":"bg-[#fff3cf]"}`,children:[y.jsx("span",{className:"min-w-0 flex-1",children:h?y.jsxs(y.Fragment,{children:[y.jsxs("b",{children:["localhost:",o]})," now reaches the sandbox. If a page already opened and failed, reload it."]}):y.jsxs(y.Fragment,{children:["Something in the sandbox uses ",y.jsxs("b",{children:["localhost:",o]}),". Your browser can't reach it until you forward the port."]})}),h?y.jsx("button",{className:"btn px-2 text-[12px]",onClick:()=>Fv(t.id,o),children:"OK"}):y.jsxs(y.Fragment,{children:[y.jsx("button",{className:"btn px-2 text-[12px]",disabled:a===o,onClick:()=>{c(o),me.forwardPort(t.id,o)},children:a===o?"Forwarding…":`Forward port ${o}`}),y.jsx("button",{className:"btn px-2 text-[12px]",onClick:()=>Fv(t.id,o),children:"Not now"})]})]})}function sL({agent:t,running:e}){const s=Xb(t.id),r=Mi(_=>_.seen[t.id])??bc,i=Mi(_=>_.seen[`shell:${t.id}`])??bc,[a,c]=Qb(s.map(_=>_.sandbox).join()),[o,h]=re.useState("");if(t.mode!=="sandbox")return y.jsx("span",{className:"text-muted",children:"Sandbox mode only"});if(!e)return y.jsxs("span",{className:"text-muted",children:["Start ",t.name," to forward ports"]});const u=[...new Set([...i,...r])].filter(_=>!s.some(k=>k.sandbox===_)).slice(-4),f=Number(o),d=Number.isInteger(f)&&f>=1&&f<=65535,g=_=>{c(_),me.forwardPort(t.id,_)};return y.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.map(_=>y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsxs("a",{className:"font-term text-[17px] underline",href:`http://localhost:${_.host}`,target:"_blank",rel:"noopener noreferrer",children:["localhost:",_.host]}),_.host!==_.sandbox&&y.jsxs("span",{className:"text-muted",children:["→ sandbox :",_.sandbox]}),y.jsx("button",{className:"btn ml-auto px-2 text-[12px]",disabled:a===_.sandbox,onClick:()=>{c(_.sandbox),me.unforwardPort(t.id,_.sandbox)},children:"Stop"})]},_.sandbox)),u.length>0&&y.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[y.jsx("span",{className:"text-muted",children:"Seen in output:"}),u.map(_=>y.jsxs("button",{className:"btn px-2 text-[12px]",disabled:a===_,onClick:()=>g(_),title:`Forward port ${_} to localhost:${_} on this machine`,children:["Forward ",_]},_))]}),y.jsxs("form",{className:"flex items-center gap-1.5",onSubmit:_=>{_.preventDefault(),d&&(g(f),h(""))},children:[y.jsx("input",{className:"w-[90px] border-2 border-ink bg-white px-1.5 py-0.5 font-term text-[16px]",inputMode:"numeric",placeholder:"3000","aria-label":"Port to forward",value:o,onChange:_=>h(_.target.value.replace(/\D/g,"").slice(0,5))}),y.jsx("button",{className:"btn px-2 text-[12px]",disabled:!d,children:"Forward port"})]}),y.jsx("span",{className:"text-[12px] text-muted",children:"Opens a port in the sandbox at the same port on this machine (localhost only)."})]})}var Cd={exports:{}},gy;function rL(){return gy||(gy=1,(function(t,e){(function(s,r){t.exports=r()})(self,(()=>(()=>{var s={};return(()=>{var r=s;Object.defineProperty(r,"__esModule",{value:!0}),r.FitAddon=void 0,r.FitAddon=class{activate(i){this._terminal=i}dispose(){}fit(){const i=this.proposeDimensions();if(!i||!this._terminal||isNaN(i.cols)||isNaN(i.rows))return;const a=this._terminal._core;this._terminal.rows===i.rows&&this._terminal.cols===i.cols||(a._renderService.clear(),this._terminal.resize(i.cols,i.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const i=this._terminal._core,a=i._renderService.dimensions;if(a.css.cell.width===0||a.css.cell.height===0)return;const c=this._terminal.options.scrollback===0?0:i.viewport.scrollBarWidth,o=window.getComputedStyle(this._terminal.element.parentElement),h=parseInt(o.getPropertyValue("height")),u=Math.max(0,parseInt(o.getPropertyValue("width"))),f=window.getComputedStyle(this._terminal.element),d=h-(parseInt(f.getPropertyValue("padding-top"))+parseInt(f.getPropertyValue("padding-bottom"))),g=u-(parseInt(f.getPropertyValue("padding-right"))+parseInt(f.getPropertyValue("padding-left")))-c;return{cols:Math.max(2,Math.floor(g/a.css.cell.width)),rows:Math.max(1,Math.floor(d/a.css.cell.height))}}}})(),s})()))})(Cd)),Cd.exports}var iL=rL(),kd={exports:{}},_y;function nL(){return _y||(_y=1,(function(t,e){(function(s,r){t.exports=r()})(self,(()=>(()=>{var s={6:(c,o)=>{function h(f){try{const d=new URL(f),g=d.password&&d.username?`${d.protocol}//${d.username}:${d.password}@${d.host}`:d.username?`${d.protocol}//${d.username}@${d.host}`:`${d.protocol}//${d.host}`;return f.toLocaleLowerCase().startsWith(g.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(o,"__esModule",{value:!0}),o.LinkComputer=o.WebLinkProvider=void 0,o.WebLinkProvider=class{constructor(f,d,g,_={}){this._terminal=f,this._regex=d,this._handler=g,this._options=_}provideLinks(f,d){const g=u.computeLink(f,this._regex,this._terminal,this._handler);d(this._addCallbacks(g))}_addCallbacks(f){return f.map((d=>(d.leave=this._options.leave,d.hover=(g,_)=>{if(this._options.hover){const{range:k}=d;this._options.hover(g,_,k)}},d)))}};class u{static computeLink(d,g,_,k){const S=new RegExp(g.source,(g.flags||"")+"g"),[m,x]=u._getWindowedLineStrings(d-1,_),v=m.join("");let b;const C=[];for(;b=S.exec(v);){const E=b[0];if(!h(E))continue;const[P,T]=u._mapStrIdx(_,x,0,b.index),[A,D]=u._mapStrIdx(_,P,T,E.length);if(P===-1||T===-1||A===-1||D===-1)continue;const I={start:{x:T+1,y:P+1},end:{x:D,y:A+1}};C.push({range:I,text:E,activate:k})}return C}static _getWindowedLineStrings(d,g){let _,k=d,S=d,m=0,x="";const v=[];if(_=g.buffer.active.getLine(d)){const b=_.translateToString(!0);if(_.isWrapped&&b[0]!==" "){for(m=0;(_=g.buffer.active.getLine(--k))&&m<2048&&(x=_.translateToString(!0),m+=x.length,v.push(x),_.isWrapped&&x.indexOf(" ")===-1););v.reverse()}for(v.push(b),m=0;(_=g.buffer.active.getLine(++S))&&_.isWrapped&&m<2048&&(x=_.translateToString(!0),m+=x.length,v.push(x),x.indexOf(" ")===-1););}return[v,k]}static _mapStrIdx(d,g,_,k){const S=d.buffer.active,m=S.getNullCell();let x=_;for(;k;){const v=S.getLine(g);if(!v)return[-1,-1];for(let b=x;b<v.length;++b){v.getCell(b,m);const C=m.getChars();if(m.getWidth()&&(k-=C.length||1,b===v.length-1&&C==="")){const E=S.getLine(g+1);E&&E.isWrapped&&(E.getCell(0,m),m.getWidth()===2&&(k+=1))}if(k<0)return[g,b]}g++,x=0}return[g,x]}}o.LinkComputer=u}},r={};function i(c){var o=r[c];if(o!==void 0)return o.exports;var h=r[c]={exports:{}};return s[c](h,h.exports,i),h.exports}var a={};return(()=>{var c=a;Object.defineProperty(c,"__esModule",{value:!0}),c.WebLinksAddon=void 0;const o=i(6),h=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function u(f,d){const g=window.open();if(g){try{g.opener=null}catch{}g.location.href=d}else console.warn("Opening link blocked as opener could not be cleared")}c.WebLinksAddon=class{constructor(f=u,d={}){this._handler=f,this._options=d}activate(f){this._terminal=f;const d=this._options,g=d.urlRegex||h;this._linkProvider=this._terminal.registerLinkProvider(new o.WebLinkProvider(this._terminal,g,this._handler,d))}dispose(){var f;(f=this._linkProvider)==null||f.dispose()}}})(),a})()))})(kd)),kd.exports}var oL=nL(),Ed={exports:{}},vy;function aL(){return vy||(vy=1,(function(t,e){(function(s,r){t.exports=r()})(globalThis,(()=>(()=>{var s={4567:function(c,o,h){var u=this&&this.__decorate||function(v,b,C,E){var P,T=arguments.length,A=T<3?b:E===null?E=Object.getOwnPropertyDescriptor(b,C):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(v,b,C,E);else for(var D=v.length-1;D>=0;D--)(P=v[D])&&(A=(T<3?P(A):T>3?P(b,C,A):P(b,C))||A);return T>3&&A&&Object.defineProperty(b,C,A),A},f=this&&this.__param||function(v,b){return function(C,E){b(C,E,v)}};Object.defineProperty(o,"__esModule",{value:!0}),o.AccessibilityManager=void 0;const d=h(9042),g=h(9924),_=h(844),k=h(4725),S=h(2585),m=h(3656);let x=o.AccessibilityManager=class extends _.Disposable{constructor(v,b,C,E){super(),this._terminal=v,this._coreBrowserService=C,this._renderService=E,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let P=0;P<this._terminal.rows;P++)this._rowElements[P]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[P]);if(this._topBoundaryFocusListener=P=>this._handleBoundaryFocus(P,0),this._bottomBoundaryFocusListener=P=>this._handleBoundaryFocus(P,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new g.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((P=>this._handleResize(P.rows)))),this.register(this._terminal.onRender((P=>this._refreshRows(P.start,P.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((P=>this._handleChar(P)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
319
+ `)))),this.register(this._terminal.onA11yTab((P=>this._handleTab(P)))),this.register(this._terminal.onKey((P=>this._handleKey(P.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,m.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,_.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(v){for(let b=0;b<v;b++)this._handleChar(" ")}_handleChar(v){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==v&&(this._charsToAnnounce+=v):this._charsToAnnounce+=v,v===`
320
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=d.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(v){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(v)||this._charsToConsume.push(v)}_refreshRows(v,b){this._liveRegionDebouncer.refresh(v,b,this._terminal.rows)}_renderRows(v,b){const C=this._terminal.buffer,E=C.lines.length.toString();for(let P=v;P<=b;P++){const T=C.lines.get(C.ydisp+P),A=[],D=(T==null?void 0:T.translateToString(!0,void 0,void 0,A))||"",I=(C.ydisp+P+1).toString(),O=this._rowElements[P];O&&(D.length===0?(O.innerText=" ",this._rowColumns.set(O,[0,1])):(O.textContent=D,this._rowColumns.set(O,A)),O.setAttribute("aria-posinset",I),O.setAttribute("aria-setsize",E))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(v,b){const C=v.target,E=this._rowElements[b===0?1:this._rowElements.length-2];if(C.getAttribute("aria-posinset")===(b===0?"1":`${this._terminal.buffer.lines.length}`)||v.relatedTarget!==E)return;let P,T;if(b===0?(P=C,T=this._rowElements.pop(),this._rowContainer.removeChild(T)):(P=this._rowElements.shift(),T=C,this._rowContainer.removeChild(P)),P.removeEventListener("focus",this._topBoundaryFocusListener),T.removeEventListener("focus",this._bottomBoundaryFocusListener),b===0){const A=this._createAccessibilityTreeNode();this._rowElements.unshift(A),this._rowContainer.insertAdjacentElement("afterbegin",A)}else{const A=this._createAccessibilityTreeNode();this._rowElements.push(A),this._rowContainer.appendChild(A)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(b===0?-1:1),this._rowElements[b===0?1:this._rowElements.length-2].focus(),v.preventDefault(),v.stopImmediatePropagation()}_handleSelectionChange(){var D;if(this._rowElements.length===0)return;const v=document.getSelection();if(!v)return;if(v.isCollapsed)return void(this._rowContainer.contains(v.anchorNode)&&this._terminal.clearSelection());if(!v.anchorNode||!v.focusNode)return void console.error("anchorNode and/or focusNode are null");let b={node:v.anchorNode,offset:v.anchorOffset},C={node:v.focusNode,offset:v.focusOffset};if((b.node.compareDocumentPosition(C.node)&Node.DOCUMENT_POSITION_PRECEDING||b.node===C.node&&b.offset>C.offset)&&([b,C]=[C,b]),b.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(b={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(b.node))return;const E=this._rowElements.slice(-1)[0];if(C.node.compareDocumentPosition(E)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(C={node:E,offset:((D=E.textContent)==null?void 0:D.length)??0}),!this._rowContainer.contains(C.node))return;const P=({node:I,offset:O})=>{const z=I instanceof Text?I.parentNode:I;let U=parseInt(z==null?void 0:z.getAttribute("aria-posinset"),10)-1;if(isNaN(U))return console.warn("row is invalid. Race condition?"),null;const K=this._rowColumns.get(z);if(!K)return console.warn("columns is null. Race condition?"),null;let ie=O<K.length?K[O]:K.slice(-1)[0]+1;return ie>=this._terminal.cols&&(++U,ie=0),{row:U,column:ie}},T=P(b),A=P(C);if(T&&A){if(T.row>A.row||T.row===A.row&&T.column>=A.column)throw new Error("invalid range");this._terminal.select(T.column,T.row,(A.row-T.row)*this._terminal.cols-T.column+A.column)}}_handleResize(v){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let b=this._rowContainer.children.length;b<this._terminal.rows;b++)this._rowElements[b]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[b]);for(;this._rowElements.length>v;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const v=this._coreBrowserService.mainDocument.createElement("div");return v.setAttribute("role","listitem"),v.tabIndex=-1,this._refreshRowDimensions(v),v}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let v=0;v<this._terminal.rows;v++)this._refreshRowDimensions(this._rowElements[v])}}_refreshRowDimensions(v){v.style.height=`${this._renderService.dimensions.css.cell.height}px`}};o.AccessibilityManager=x=u([f(1,S.IInstantiationService),f(2,k.ICoreBrowserService),f(3,k.IRenderService)],x)},3614:(c,o)=>{function h(g){return g.replace(/\r?\n/g,"\r")}function u(g,_){return _?"\x1B[200~"+g+"\x1B[201~":g}function f(g,_,k,S){g=u(g=h(g),k.decPrivateModes.bracketedPasteMode&&S.rawOptions.ignoreBracketedPasteMode!==!0),k.triggerDataEvent(g,!0),_.value=""}function d(g,_,k){const S=k.getBoundingClientRect(),m=g.clientX-S.left-10,x=g.clientY-S.top-10;_.style.width="20px",_.style.height="20px",_.style.left=`${m}px`,_.style.top=`${x}px`,_.style.zIndex="1000",_.focus()}Object.defineProperty(o,"__esModule",{value:!0}),o.rightClickHandler=o.moveTextAreaUnderMouseCursor=o.paste=o.handlePasteEvent=o.copyHandler=o.bracketTextForPaste=o.prepareTextForTerminal=void 0,o.prepareTextForTerminal=h,o.bracketTextForPaste=u,o.copyHandler=function(g,_){g.clipboardData&&g.clipboardData.setData("text/plain",_.selectionText),g.preventDefault()},o.handlePasteEvent=function(g,_,k,S){g.stopPropagation(),g.clipboardData&&f(g.clipboardData.getData("text/plain"),_,k,S)},o.paste=f,o.moveTextAreaUnderMouseCursor=d,o.rightClickHandler=function(g,_,k,S,m){d(g,_,k),m&&S.rightClickSelect(g),_.value=S.selectionText,_.select()}},7239:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ColorContrastCache=void 0;const u=h(1505);o.ColorContrastCache=class{constructor(){this._color=new u.TwoKeyMap,this._css=new u.TwoKeyMap}setCss(f,d,g){this._css.set(f,d,g)}getCss(f,d){return this._css.get(f,d)}setColor(f,d,g){this._color.set(f,d,g)}getColor(f,d){return this._color.get(f,d)}clear(){this._color.clear(),this._css.clear()}}},3656:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.addDisposableDomListener=void 0,o.addDisposableDomListener=function(h,u,f,d){h.addEventListener(u,f,d);let g=!1;return{dispose:()=>{g||(g=!0,h.removeEventListener(u,f,d))}}}},3551:function(c,o,h){var u=this&&this.__decorate||function(x,v,b,C){var E,P=arguments.length,T=P<3?v:C===null?C=Object.getOwnPropertyDescriptor(v,b):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(x,v,b,C);else for(var A=x.length-1;A>=0;A--)(E=x[A])&&(T=(P<3?E(T):P>3?E(v,b,T):E(v,b))||T);return P>3&&T&&Object.defineProperty(v,b,T),T},f=this&&this.__param||function(x,v){return function(b,C){v(b,C,x)}};Object.defineProperty(o,"__esModule",{value:!0}),o.Linkifier=void 0;const d=h(3656),g=h(8460),_=h(844),k=h(2585),S=h(4725);let m=o.Linkifier=class extends _.Disposable{get currentLink(){return this._currentLink}constructor(x,v,b,C,E){super(),this._element=x,this._mouseService=v,this._renderService=b,this._bufferService=C,this._linkProviderService=E,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new g.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new g.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,_.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,_.toDisposable)((()=>{var P;this._lastMouseEvent=void 0,(P=this._activeProviderReplies)==null||P.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,d.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,d.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,d.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,d.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(x){this._lastMouseEvent=x;const v=this._positionFromMouseEvent(x,this._element,this._mouseService);if(!v)return;this._isMouseOut=!1;const b=x.composedPath();for(let C=0;C<b.length;C++){const E=b[C];if(E.classList.contains("xterm"))break;if(E.classList.contains("xterm-hover"))return}this._lastBufferCell&&v.x===this._lastBufferCell.x&&v.y===this._lastBufferCell.y||(this._handleHover(v),this._lastBufferCell=v)}_handleHover(x){if(this._activeLine!==x.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(x,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,x)||(this._clearCurrentLink(),this._askForLink(x,!0))}_askForLink(x,v){var C,E;this._activeProviderReplies&&v||((C=this._activeProviderReplies)==null||C.forEach((P=>{P==null||P.forEach((T=>{T.link.dispose&&T.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=x.y);let b=!1;for(const[P,T]of this._linkProviderService.linkProviders.entries())v?(E=this._activeProviderReplies)!=null&&E.get(P)&&(b=this._checkLinkProviderResult(P,x,b)):T.provideLinks(x.y,(A=>{var I,O;if(this._isMouseOut)return;const D=A==null?void 0:A.map((z=>({link:z})));(I=this._activeProviderReplies)==null||I.set(P,D),b=this._checkLinkProviderResult(P,x,b),((O=this._activeProviderReplies)==null?void 0:O.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(x.y,this._activeProviderReplies)}))}_removeIntersectingLinks(x,v){const b=new Set;for(let C=0;C<v.size;C++){const E=v.get(C);if(E)for(let P=0;P<E.length;P++){const T=E[P],A=T.link.range.start.y<x?0:T.link.range.start.x,D=T.link.range.end.y>x?this._bufferService.cols:T.link.range.end.x;for(let I=A;I<=D;I++){if(b.has(I)){E.splice(P--,1);break}b.add(I)}}}}_checkLinkProviderResult(x,v,b){var P;if(!this._activeProviderReplies)return b;const C=this._activeProviderReplies.get(x);let E=!1;for(let T=0;T<x;T++)this._activeProviderReplies.has(T)&&!this._activeProviderReplies.get(T)||(E=!0);if(!E&&C){const T=C.find((A=>this._linkAtPosition(A.link,v)));T&&(b=!0,this._handleNewLink(T))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!b)for(let T=0;T<this._activeProviderReplies.size;T++){const A=(P=this._activeProviderReplies.get(T))==null?void 0:P.find((D=>this._linkAtPosition(D.link,v)));if(A){b=!0,this._handleNewLink(A);break}}return b}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(x){if(!this._currentLink)return;const v=this._positionFromMouseEvent(x,this._element,this._mouseService);v&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,v)&&this._currentLink.link.activate(x,this._currentLink.link.text)}_clearCurrentLink(x,v){this._currentLink&&this._lastMouseEvent&&(!x||!v||this._currentLink.link.range.start.y>=x&&this._currentLink.link.range.end.y<=v)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,_.disposeArray)(this._linkCacheDisposables))}_handleNewLink(x){if(!this._lastMouseEvent)return;const v=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);v&&this._linkAtPosition(x.link,v)&&(this._currentLink=x,this._currentLink.state={decorations:{underline:x.link.decorations===void 0||x.link.decorations.underline,pointerCursor:x.link.decorations===void 0||x.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,x.link,this._lastMouseEvent),x.link.decorations={},Object.defineProperties(x.link.decorations,{pointerCursor:{get:()=>{var b,C;return(C=(b=this._currentLink)==null?void 0:b.state)==null?void 0:C.decorations.pointerCursor},set:b=>{var C;(C=this._currentLink)!=null&&C.state&&this._currentLink.state.decorations.pointerCursor!==b&&(this._currentLink.state.decorations.pointerCursor=b,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",b))}},underline:{get:()=>{var b,C;return(C=(b=this._currentLink)==null?void 0:b.state)==null?void 0:C.decorations.underline},set:b=>{var C,E,P;(C=this._currentLink)!=null&&C.state&&((P=(E=this._currentLink)==null?void 0:E.state)==null?void 0:P.decorations.underline)!==b&&(this._currentLink.state.decorations.underline=b,this._currentLink.state.isHovered&&this._fireUnderlineEvent(x.link,b))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((b=>{if(!this._currentLink)return;const C=b.start===0?0:b.start+1+this._bufferService.buffer.ydisp,E=this._bufferService.buffer.ydisp+1+b.end;if(this._currentLink.link.range.start.y>=C&&this._currentLink.link.range.end.y<=E&&(this._clearCurrentLink(C,E),this._lastMouseEvent)){const P=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);P&&this._askForLink(P,!1)}}))))}_linkHover(x,v,b){var C;(C=this._currentLink)!=null&&C.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(v,!0),this._currentLink.state.decorations.pointerCursor&&x.classList.add("xterm-cursor-pointer")),v.hover&&v.hover(b,v.text)}_fireUnderlineEvent(x,v){const b=x.range,C=this._bufferService.buffer.ydisp,E=this._createLinkUnderlineEvent(b.start.x-1,b.start.y-C-1,b.end.x,b.end.y-C-1,void 0);(v?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(E)}_linkLeave(x,v,b){var C;(C=this._currentLink)!=null&&C.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(v,!1),this._currentLink.state.decorations.pointerCursor&&x.classList.remove("xterm-cursor-pointer")),v.leave&&v.leave(b,v.text)}_linkAtPosition(x,v){const b=x.range.start.y*this._bufferService.cols+x.range.start.x,C=x.range.end.y*this._bufferService.cols+x.range.end.x,E=v.y*this._bufferService.cols+v.x;return b<=E&&E<=C}_positionFromMouseEvent(x,v,b){const C=b.getCoords(x,v,this._bufferService.cols,this._bufferService.rows);if(C)return{x:C[0],y:C[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(x,v,b,C,E){return{x1:x,y1:v,x2:b,y2:C,cols:this._bufferService.cols,fg:E}}};o.Linkifier=m=u([f(1,S.IMouseService),f(2,S.IRenderService),f(3,k.IBufferService),f(4,S.ILinkProviderService)],m)},9042:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.tooMuchOutput=o.promptLabel=void 0,o.promptLabel="Terminal input",o.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(c,o,h){var u=this&&this.__decorate||function(S,m,x,v){var b,C=arguments.length,E=C<3?m:v===null?v=Object.getOwnPropertyDescriptor(m,x):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(S,m,x,v);else for(var P=S.length-1;P>=0;P--)(b=S[P])&&(E=(C<3?b(E):C>3?b(m,x,E):b(m,x))||E);return C>3&&E&&Object.defineProperty(m,x,E),E},f=this&&this.__param||function(S,m){return function(x,v){m(x,v,S)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OscLinkProvider=void 0;const d=h(511),g=h(2585);let _=o.OscLinkProvider=class{constructor(S,m,x){this._bufferService=S,this._optionsService=m,this._oscLinkService=x}provideLinks(S,m){var D;const x=this._bufferService.buffer.lines.get(S-1);if(!x)return void m(void 0);const v=[],b=this._optionsService.rawOptions.linkHandler,C=new d.CellData,E=x.getTrimmedLength();let P=-1,T=-1,A=!1;for(let I=0;I<E;I++)if(T!==-1||x.hasContent(I)){if(x.loadCell(I,C),C.hasExtendedAttrs()&&C.extended.urlId){if(T===-1){T=I,P=C.extended.urlId;continue}A=C.extended.urlId!==P}else T!==-1&&(A=!0);if(A||T!==-1&&I===E-1){const O=(D=this._oscLinkService.getLinkData(P))==null?void 0:D.uri;if(O){const z={start:{x:T+1,y:S},end:{x:I+(A||I!==E-1?0:1),y:S}};let U=!1;if(!(b!=null&&b.allowNonHttpProtocols))try{const K=new URL(O);["http:","https:"].includes(K.protocol)||(U=!0)}catch{U=!0}U||v.push({text:O,range:z,activate:(K,ie)=>b?b.activate(K,ie,z):k(0,ie),hover:(K,ie)=>{var Q;return(Q=b==null?void 0:b.hover)==null?void 0:Q.call(b,K,ie,z)},leave:(K,ie)=>{var Q;return(Q=b==null?void 0:b.leave)==null?void 0:Q.call(b,K,ie,z)}})}A=!1,C.hasExtendedAttrs()&&C.extended.urlId?(T=I,P=C.extended.urlId):(T=-1,P=-1)}}m(v)}};function k(S,m){if(confirm(`Do you want to navigate to ${m}?
321
+
322
+ WARNING: This link could potentially be dangerous`)){const x=window.open();if(x){try{x.opener=null}catch{}x.location.href=m}else console.warn("Opening link blocked as opener could not be cleared")}}o.OscLinkProvider=_=u([f(0,g.IBufferService),f(1,g.IOptionsService),f(2,g.IOscLinkService)],_)},6193:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.RenderDebouncer=void 0,o.RenderDebouncer=class{constructor(h,u){this._renderCallback=h,this._coreBrowserService=u,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(h){return this._refreshCallbacks.push(h),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(h,u,f){this._rowCount=f,h=h!==void 0?h:0,u=u!==void 0?u:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,h):h,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,u):u,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();const h=Math.max(this._rowStart,0),u=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(h,u),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const h of this._refreshCallbacks)h(0);this._refreshCallbacks=[]}}},3236:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Terminal=void 0;const u=h(3614),f=h(3656),d=h(3551),g=h(9042),_=h(3730),k=h(1680),S=h(3107),m=h(5744),x=h(2950),v=h(1296),b=h(428),C=h(4269),E=h(5114),P=h(8934),T=h(3230),A=h(9312),D=h(4725),I=h(6731),O=h(8055),z=h(8969),U=h(8460),K=h(844),ie=h(6114),Q=h(8437),J=h(2584),Y=h(7399),L=h(5941),F=h(9074),B=h(2585),$=h(5435),Z=h(4567),oe=h(779);class he extends z.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(V={}){super(V),this.browser=ie,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new K.MutableDisposable),this._onCursorMove=this.register(new U.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new U.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new U.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new U.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new U.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new U.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new U.EventEmitter),this._onBlur=this.register(new U.EventEmitter),this._onA11yCharEmitter=this.register(new U.EventEmitter),this._onA11yTabEmitter=this.register(new U.EventEmitter),this._onWillOpen=this.register(new U.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(F.DecorationService),this._instantiationService.setService(B.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(oe.LinkProviderService),this._instantiationService.setService(D.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(_.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((N,ne)=>this.refresh(N,ne)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((N=>this._reportWindowsOptions(N)))),this.register(this._inputHandler.onColor((N=>this._handleColorEvent(N)))),this.register((0,U.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,U.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,U.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,U.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((N=>this._afterResize(N.cols,N.rows)))),this.register((0,K.toDisposable)((()=>{var N,ne;this._customKeyEventHandler=void 0,(ne=(N=this.element)==null?void 0:N.parentNode)==null||ne.removeChild(this.element)})))}_handleColorEvent(V){if(this._themeService)for(const N of V){let ne,se="";switch(N.index){case 256:ne="foreground",se="10";break;case 257:ne="background",se="11";break;case 258:ne="cursor",se="12";break;default:ne="ansi",se="4;"+N.index}switch(N.type){case 0:const pe=O.color.toColorRGB(ne==="ansi"?this._themeService.colors.ansi[N.index]:this._themeService.colors[ne]);this.coreService.triggerDataEvent(`${J.C0.ESC}]${se};${(0,L.toRgbString)(pe)}${J.C1_ESCAPED.ST}`);break;case 1:if(ne==="ansi")this._themeService.modifyColors((fe=>fe.ansi[N.index]=O.channels.toColor(...N.color)));else{const fe=ne;this._themeService.modifyColors((Ae=>Ae[fe]=O.channels.toColor(...N.color)))}break;case 2:this._themeService.restoreColor(N.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(V){V?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Z.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(V){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(J.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var V;return(V=this.textarea)==null?void 0:V.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(J.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const V=this.buffer.ybase+this.buffer.y,N=this.buffer.lines.get(V);if(!N)return;const ne=Math.min(this.buffer.x,this.cols-1),se=this._renderService.dimensions.css.cell.height,pe=N.getWidth(ne),fe=this._renderService.dimensions.css.cell.width*pe,Ae=this.buffer.y*this._renderService.dimensions.css.cell.height,Oe=ne*this._renderService.dimensions.css.cell.width;this.textarea.style.left=Oe+"px",this.textarea.style.top=Ae+"px",this.textarea.style.width=fe+"px",this.textarea.style.height=se+"px",this.textarea.style.lineHeight=se+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,f.addDisposableDomListener)(this.element,"copy",(N=>{this.hasSelection()&&(0,u.copyHandler)(N,this._selectionService)})));const V=N=>(0,u.handlePasteEvent)(N,this.textarea,this.coreService,this.optionsService);this.register((0,f.addDisposableDomListener)(this.textarea,"paste",V)),this.register((0,f.addDisposableDomListener)(this.element,"paste",V)),ie.isFirefox?this.register((0,f.addDisposableDomListener)(this.element,"mousedown",(N=>{N.button===2&&(0,u.rightClickHandler)(N,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,f.addDisposableDomListener)(this.element,"contextmenu",(N=>{(0,u.rightClickHandler)(N,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),ie.isLinux&&this.register((0,f.addDisposableDomListener)(this.element,"auxclick",(N=>{N.button===1&&(0,u.moveTextAreaUnderMouseCursor)(N,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,f.addDisposableDomListener)(this.textarea,"keyup",(V=>this._keyUp(V)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"keydown",(V=>this._keyDown(V)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"keypress",(V=>this._keyPress(V)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionupdate",(V=>this._compositionHelper.compositionupdate(V)))),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,f.addDisposableDomListener)(this.textarea,"input",(V=>this._inputEvent(V)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(V){var ne;if(!V)throw new Error("Terminal requires a parent element.");if(V.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((ne=this.element)==null?void 0:ne.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=V.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),V.appendChild(this.element);const N=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),N.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,f.addDisposableDomListener)(this.screenElement,"mousemove",(se=>this.updateCursorStyle(se)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),N.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",g.promptLabel),ie.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(E.CoreBrowserService,this.textarea,V.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(D.ICoreBrowserService,this._coreBrowserService),this.register((0,f.addDisposableDomListener)(this.textarea,"focus",(se=>this._handleTextAreaFocus(se)))),this.register((0,f.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(b.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(D.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(I.ThemeService),this._instantiationService.setService(D.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(C.CharacterJoinerService),this._instantiationService.setService(D.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(T.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(D.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((se=>this._onRender.fire(se)))),this.onResize((se=>this._renderService.resize(se.cols,se.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(x.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(P.MouseService),this._instantiationService.setService(D.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(d.Linkifier,this.screenElement)),this.element.appendChild(N);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(k.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((se=>this.scrollLines(se.amount,se.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(A.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(D.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((se=>this.scrollLines(se.amount,se.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((se=>this._renderService.handleSelectionChanged(se.start,se.end,se.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((se=>{this.textarea.value=se,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((se=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,f.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(S.BufferDecorationRenderer,this.screenElement)),this.register((0,f.addDisposableDomListener)(this.element,"mousedown",(se=>this._selectionService.handleMouseDown(se)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(Z.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(se=>this._handleScreenReaderModeOptionChange(se)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(m.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(se=>{!this._overviewRulerRenderer&&se&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(m.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(v.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const V=this,N=this.element;function ne(fe){const Ae=V._mouseService.getMouseReportCoords(fe,V.screenElement);if(!Ae)return!1;let Oe,$e;switch(fe.overrideType||fe.type){case"mousemove":$e=32,fe.buttons===void 0?(Oe=3,fe.button!==void 0&&(Oe=fe.button<3?fe.button:3)):Oe=1&fe.buttons?0:4&fe.buttons?1:2&fe.buttons?2:3;break;case"mouseup":$e=0,Oe=fe.button<3?fe.button:3;break;case"mousedown":$e=1,Oe=fe.button<3?fe.button:3;break;case"wheel":if(V._customWheelEventHandler&&V._customWheelEventHandler(fe)===!1||V.viewport.getLinesScrolled(fe)===0)return!1;$e=fe.deltaY<0?0:1,Oe=4;break;default:return!1}return!($e===void 0||Oe===void 0||Oe>4)&&V.coreMouseService.triggerMouseEvent({col:Ae.col,row:Ae.row,x:Ae.x,y:Ae.y,button:Oe,action:$e,ctrl:fe.ctrlKey,alt:fe.altKey,shift:fe.shiftKey})}const se={mouseup:null,wheel:null,mousedrag:null,mousemove:null},pe={mouseup:fe=>(ne(fe),fe.buttons||(this._document.removeEventListener("mouseup",se.mouseup),se.mousedrag&&this._document.removeEventListener("mousemove",se.mousedrag)),this.cancel(fe)),wheel:fe=>(ne(fe),this.cancel(fe,!0)),mousedrag:fe=>{fe.buttons&&ne(fe)},mousemove:fe=>{fe.buttons||ne(fe)}};this.register(this.coreMouseService.onProtocolChange((fe=>{fe?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(fe)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&fe?se.mousemove||(N.addEventListener("mousemove",pe.mousemove),se.mousemove=pe.mousemove):(N.removeEventListener("mousemove",se.mousemove),se.mousemove=null),16&fe?se.wheel||(N.addEventListener("wheel",pe.wheel,{passive:!1}),se.wheel=pe.wheel):(N.removeEventListener("wheel",se.wheel),se.wheel=null),2&fe?se.mouseup||(se.mouseup=pe.mouseup):(this._document.removeEventListener("mouseup",se.mouseup),se.mouseup=null),4&fe?se.mousedrag||(se.mousedrag=pe.mousedrag):(this._document.removeEventListener("mousemove",se.mousedrag),se.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,f.addDisposableDomListener)(N,"mousedown",(fe=>{if(fe.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(fe))return ne(fe),se.mouseup&&this._document.addEventListener("mouseup",se.mouseup),se.mousedrag&&this._document.addEventListener("mousemove",se.mousedrag),this.cancel(fe)}))),this.register((0,f.addDisposableDomListener)(N,"wheel",(fe=>{if(!se.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(fe)===!1)return!1;if(!this.buffer.hasScrollback){const Ae=this.viewport.getLinesScrolled(fe);if(Ae===0)return;const Oe=J.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(fe.deltaY<0?"A":"B");let $e="";for(let mt=0;mt<Math.abs(Ae);mt++)$e+=Oe;return this.coreService.triggerDataEvent($e,!0),this.cancel(fe,!0)}return this.viewport.handleWheel(fe)?this.cancel(fe):void 0}}),{passive:!1})),this.register((0,f.addDisposableDomListener)(N,"touchstart",(fe=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(fe),this.cancel(fe)}),{passive:!0})),this.register((0,f.addDisposableDomListener)(N,"touchmove",(fe=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(fe)?void 0:this.cancel(fe)}),{passive:!1}))}refresh(V,N){var ne;(ne=this._renderService)==null||ne.refreshRows(V,N)}updateCursorStyle(V){var N;(N=this._selectionService)!=null&&N.shouldColumnSelect(V)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(V,N,ne=0){var se;ne===1?(super.scrollLines(V,N,ne),this.refresh(0,this.rows-1)):(se=this.viewport)==null||se.scrollLines(V)}paste(V){(0,u.paste)(V,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(V){this._customKeyEventHandler=V}attachCustomWheelEventHandler(V){this._customWheelEventHandler=V}registerLinkProvider(V){return this._linkProviderService.registerLinkProvider(V)}registerCharacterJoiner(V){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const N=this._characterJoinerService.register(V);return this.refresh(0,this.rows-1),N}deregisterCharacterJoiner(V){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(V)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(V){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+V)}registerDecoration(V){return this._decorationService.registerDecoration(V)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(V,N,ne){this._selectionService.setSelection(V,N,ne)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var V;(V=this._selectionService)==null||V.clearSelection()}selectAll(){var V;(V=this._selectionService)==null||V.selectAll()}selectLines(V,N){var ne;(ne=this._selectionService)==null||ne.selectLines(V,N)}_keyDown(V){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(V)===!1)return!1;const N=this.browser.isMac&&this.options.macOptionIsMeta&&V.altKey;if(!N&&!this._compositionHelper.keydown(V))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;N||V.key!=="Dead"&&V.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const ne=(0,Y.evaluateKeyboardEvent)(V,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(V),ne.type===3||ne.type===2){const se=this.rows-1;return this.scrollLines(ne.type===2?-se:se),this.cancel(V,!0)}return ne.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,V)||(ne.cancel&&this.cancel(V,!0),!ne.key||!!(V.key&&!V.ctrlKey&&!V.altKey&&!V.metaKey&&V.key.length===1&&V.key.charCodeAt(0)>=65&&V.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(ne.key!==J.C0.ETX&&ne.key!==J.C0.CR||(this.textarea.value=""),this._onKey.fire({key:ne.key,domEvent:V}),this._showCursor(),this.coreService.triggerDataEvent(ne.key,!0),!this.optionsService.rawOptions.screenReaderMode||V.altKey||V.ctrlKey?this.cancel(V,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(V,N){const ne=V.isMac&&!this.options.macOptionIsMeta&&N.altKey&&!N.ctrlKey&&!N.metaKey||V.isWindows&&N.altKey&&N.ctrlKey&&!N.metaKey||V.isWindows&&N.getModifierState("AltGraph");return N.type==="keypress"?ne:ne&&(!N.keyCode||N.keyCode>47)}_keyUp(V){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(V)===!1||((function(N){return N.keyCode===16||N.keyCode===17||N.keyCode===18})(V)||this.focus(),this.updateCursorStyle(V),this._keyPressHandled=!1)}_keyPress(V){let N;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(V)===!1)return!1;if(this.cancel(V),V.charCode)N=V.charCode;else if(V.which===null||V.which===void 0)N=V.keyCode;else{if(V.which===0||V.charCode===0)return!1;N=V.which}return!(!N||(V.altKey||V.ctrlKey||V.metaKey)&&!this._isThirdLevelShift(this.browser,V)||(N=String.fromCharCode(N),this._onKey.fire({key:N,domEvent:V}),this._showCursor(),this.coreService.triggerDataEvent(N,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(V){if(V.data&&V.inputType==="insertText"&&(!V.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const N=V.data;return this.coreService.triggerDataEvent(N,!0),this.cancel(V),!0}return!1}resize(V,N){V!==this.cols||N!==this.rows?super.resize(V,N):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(V,N){var ne,se;(ne=this._charSizeService)==null||ne.measure(),(se=this.viewport)==null||se.syncScrollArea(!0)}clear(){var V;if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let N=1;N<this.rows;N++)this.buffer.lines.push(this.buffer.getBlankLine(Q.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(V=this.viewport)==null||V.reset(),this.refresh(0,this.rows-1)}}reset(){var N,ne;this.options.rows=this.rows,this.options.cols=this.cols;const V=this._customKeyEventHandler;this._setup(),super.reset(),(N=this._selectionService)==null||N.reset(),this._decorationService.reset(),(ne=this.viewport)==null||ne.reset(),this._customKeyEventHandler=V,this.refresh(0,this.rows-1)}clearTextureAtlas(){var V;(V=this._renderService)==null||V.clearTextureAtlas()}_reportFocus(){var V;(V=this.element)!=null&&V.classList.contains("focus")?this.coreService.triggerDataEvent(J.C0.ESC+"[I"):this.coreService.triggerDataEvent(J.C0.ESC+"[O")}_reportWindowsOptions(V){if(this._renderService)switch(V){case $.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const N=this._renderService.dimensions.css.canvas.width.toFixed(0),ne=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${J.C0.ESC}[4;${ne};${N}t`);break;case $.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const se=this._renderService.dimensions.css.cell.width.toFixed(0),pe=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${J.C0.ESC}[6;${pe};${se}t`)}}cancel(V,N){if(this.options.cancelEvents||N)return V.preventDefault(),V.stopPropagation(),!1}}o.Terminal=he},9924:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.TimeBasedDebouncer=void 0,o.TimeBasedDebouncer=class{constructor(h,u=1e3){this._renderCallback=h,this._debounceThresholdMS=u,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(h,u,f){this._rowCount=f,h=h!==void 0?h:0,u=u!==void 0?u:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,h):h,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,u):u;const d=Date.now();if(d-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=d,this._innerRefresh();else if(!this._additionalRefreshRequested){const g=d-this._lastRefreshMs,_=this._debounceThresholdMS-g;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),_)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const h=Math.max(this._rowStart,0),u=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(h,u)}}},1680:function(c,o,h){var u=this&&this.__decorate||function(x,v,b,C){var E,P=arguments.length,T=P<3?v:C===null?C=Object.getOwnPropertyDescriptor(v,b):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(x,v,b,C);else for(var A=x.length-1;A>=0;A--)(E=x[A])&&(T=(P<3?E(T):P>3?E(v,b,T):E(v,b))||T);return P>3&&T&&Object.defineProperty(v,b,T),T},f=this&&this.__param||function(x,v){return function(b,C){v(b,C,x)}};Object.defineProperty(o,"__esModule",{value:!0}),o.Viewport=void 0;const d=h(3656),g=h(4725),_=h(8460),k=h(844),S=h(2585);let m=o.Viewport=class extends k.Disposable{constructor(x,v,b,C,E,P,T,A){super(),this._viewportElement=x,this._scrollArea=v,this._bufferService=b,this._optionsService=C,this._charSizeService=E,this._renderService=P,this._coreBrowserService=T,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new _.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,d.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((D=>this._activeBuffer=D.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((D=>this._renderDimensions=D))),this._handleThemeChange(A.colors),this.register(A.onChangeColors((D=>this._handleThemeChange(D)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(x){this._viewportElement.style.backgroundColor=x.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(x){if(x)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const v=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==v&&(this._lastRecordedBufferHeight=v,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const x=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==x&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=x),this._refreshAnimationFrame=null}syncScrollArea(x=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(x);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(x)}_handleScroll(x){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const v=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:v,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const x=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(x*(this._smoothScrollState.target-this._smoothScrollState.origin)),x<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(x,v){const b=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(v<0&&this._viewportElement.scrollTop!==0||v>0&&b<this._lastRecordedBufferHeight)||(x.cancelable&&x.preventDefault(),!1)}handleWheel(x){const v=this._getPixelsScrolled(x);return v!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+v:this._smoothScrollState.target+=v,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=v,this._bubbleScroll(x,v))}scrollLines(x){if(x!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const v=x*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+v,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:x,suppressScrollEvent:!1})}_getPixelsScrolled(x){if(x.deltaY===0||x.shiftKey)return 0;let v=this._applyScrollModifier(x.deltaY,x);return x.deltaMode===WheelEvent.DOM_DELTA_LINE?v*=this._currentRowHeight:x.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(v*=this._currentRowHeight*this._bufferService.rows),v}getBufferElements(x,v){var A;let b,C="";const E=[],P=v??this._bufferService.buffer.lines.length,T=this._bufferService.buffer.lines;for(let D=x;D<P;D++){const I=T.get(D);if(!I)continue;const O=(A=T.get(D+1))==null?void 0:A.isWrapped;if(C+=I.translateToString(!O),!O||D===T.length-1){const z=document.createElement("div");z.textContent=C,E.push(z),C.length>0&&(b=z),C=""}}return{bufferElements:E,cursorElement:b}}getLinesScrolled(x){if(x.deltaY===0||x.shiftKey)return 0;let v=this._applyScrollModifier(x.deltaY,x);return x.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(v/=this._currentRowHeight+0,this._wheelPartialScroll+=v,v=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):x.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(v*=this._bufferService.rows),v}_applyScrollModifier(x,v){const b=this._optionsService.rawOptions.fastScrollModifier;return b==="alt"&&v.altKey||b==="ctrl"&&v.ctrlKey||b==="shift"&&v.shiftKey?x*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:x*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(x){this._lastTouchY=x.touches[0].pageY}handleTouchMove(x){const v=this._lastTouchY-x.touches[0].pageY;return this._lastTouchY=x.touches[0].pageY,v!==0&&(this._viewportElement.scrollTop+=v,this._bubbleScroll(x,v))}};o.Viewport=m=u([f(2,S.IBufferService),f(3,S.IOptionsService),f(4,g.ICharSizeService),f(5,g.IRenderService),f(6,g.ICoreBrowserService),f(7,g.IThemeService)],m)},3107:function(c,o,h){var u=this&&this.__decorate||function(S,m,x,v){var b,C=arguments.length,E=C<3?m:v===null?v=Object.getOwnPropertyDescriptor(m,x):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(S,m,x,v);else for(var P=S.length-1;P>=0;P--)(b=S[P])&&(E=(C<3?b(E):C>3?b(m,x,E):b(m,x))||E);return C>3&&E&&Object.defineProperty(m,x,E),E},f=this&&this.__param||function(S,m){return function(x,v){m(x,v,S)}};Object.defineProperty(o,"__esModule",{value:!0}),o.BufferDecorationRenderer=void 0;const d=h(4725),g=h(844),_=h(2585);let k=o.BufferDecorationRenderer=class extends g.Disposable{constructor(S,m,x,v,b){super(),this._screenElement=S,this._bufferService=m,this._coreBrowserService=x,this._decorationService=v,this._renderService=b,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((C=>this._removeDecoration(C)))),this.register((0,g.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const S of this._decorationService.decorations)this._renderDecoration(S);this._dimensionsChanged=!1}_renderDecoration(S){this._refreshStyle(S),this._dimensionsChanged&&this._refreshXPosition(S)}_createElement(S){var v;const m=this._coreBrowserService.mainDocument.createElement("div");m.classList.add("xterm-decoration"),m.classList.toggle("xterm-decoration-top-layer",((v=S==null?void 0:S.options)==null?void 0:v.layer)==="top"),m.style.width=`${Math.round((S.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,m.style.height=(S.options.height||1)*this._renderService.dimensions.css.cell.height+"px",m.style.top=(S.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",m.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const x=S.options.x??0;return x&&x>this._bufferService.cols&&(m.style.display="none"),this._refreshXPosition(S,m),m}_refreshStyle(S){const m=S.marker.line-this._bufferService.buffers.active.ydisp;if(m<0||m>=this._bufferService.rows)S.element&&(S.element.style.display="none",S.onRenderEmitter.fire(S.element));else{let x=this._decorationElements.get(S);x||(x=this._createElement(S),S.element=x,this._decorationElements.set(S,x),this._container.appendChild(x),S.onDispose((()=>{this._decorationElements.delete(S),x.remove()}))),x.style.top=m*this._renderService.dimensions.css.cell.height+"px",x.style.display=this._altBufferIsActive?"none":"block",S.onRenderEmitter.fire(x)}}_refreshXPosition(S,m=S.element){if(!m)return;const x=S.options.x??0;(S.options.anchor||"left")==="right"?m.style.right=x?x*this._renderService.dimensions.css.cell.width+"px":"":m.style.left=x?x*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(S){var m;(m=this._decorationElements.get(S))==null||m.remove(),this._decorationElements.delete(S),S.dispose()}};o.BufferDecorationRenderer=k=u([f(1,_.IBufferService),f(2,d.ICoreBrowserService),f(3,_.IDecorationService),f(4,d.IRenderService)],k)},5871:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ColorZoneStore=void 0,o.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(h){if(h.options.overviewRulerOptions){for(const u of this._zones)if(u.color===h.options.overviewRulerOptions.color&&u.position===h.options.overviewRulerOptions.position){if(this._lineIntersectsZone(u,h.marker.line))return;if(this._lineAdjacentToZone(u,h.marker.line,h.options.overviewRulerOptions.position))return void this._addLineToZone(u,h.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=h.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=h.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=h.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=h.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:h.options.overviewRulerOptions.color,position:h.options.overviewRulerOptions.position,startBufferLine:h.marker.line,endBufferLine:h.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(h){this._linePadding=h}_lineIntersectsZone(h,u){return u>=h.startBufferLine&&u<=h.endBufferLine}_lineAdjacentToZone(h,u,f){return u>=h.startBufferLine-this._linePadding[f||"full"]&&u<=h.endBufferLine+this._linePadding[f||"full"]}_addLineToZone(h,u){h.startBufferLine=Math.min(h.startBufferLine,u),h.endBufferLine=Math.max(h.endBufferLine,u)}}},5744:function(c,o,h){var u=this&&this.__decorate||function(b,C,E,P){var T,A=arguments.length,D=A<3?C:P===null?P=Object.getOwnPropertyDescriptor(C,E):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(b,C,E,P);else for(var I=b.length-1;I>=0;I--)(T=b[I])&&(D=(A<3?T(D):A>3?T(C,E,D):T(C,E))||D);return A>3&&D&&Object.defineProperty(C,E,D),D},f=this&&this.__param||function(b,C){return function(E,P){C(E,P,b)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OverviewRulerRenderer=void 0;const d=h(5871),g=h(4725),_=h(844),k=h(2585),S={full:0,left:0,center:0,right:0},m={full:0,left:0,center:0,right:0},x={full:0,left:0,center:0,right:0};let v=o.OverviewRulerRenderer=class extends _.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(b,C,E,P,T,A,D){var O;super(),this._viewportElement=b,this._screenElement=C,this._bufferService=E,this._decorationService=P,this._renderService=T,this._optionsService=A,this._coreBrowserService=D,this._colorZoneStore=new d.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(O=this._viewportElement.parentElement)==null||O.insertBefore(this._canvas,this._viewportElement);const I=this._canvas.getContext("2d");if(!I)throw new Error("Ctx cannot be null");this._ctx=I,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,_.toDisposable)((()=>{var z;(z=this._canvas)==null||z.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const b=Math.floor(this._canvas.width/3),C=Math.ceil(this._canvas.width/3);m.full=this._canvas.width,m.left=b,m.center=C,m.right=b,this._refreshDrawHeightConstants(),x.full=0,x.left=0,x.center=m.left,x.right=m.left+m.center}_refreshDrawHeightConstants(){S.full=Math.round(2*this._coreBrowserService.dpr);const b=this._canvas.height/this._bufferService.buffer.lines.length,C=Math.round(Math.max(Math.min(b,12),6)*this._coreBrowserService.dpr);S.left=C,S.center=C,S.right=C}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*S.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*S.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*S.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*S.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const C of this._decorationService.decorations)this._colorZoneStore.addDecoration(C);this._ctx.lineWidth=1;const b=this._colorZoneStore.zones;for(const C of b)C.position!=="full"&&this._renderColorZone(C);for(const C of b)C.position==="full"&&this._renderColorZone(C);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(b){this._ctx.fillStyle=b.color,this._ctx.fillRect(x[b.position||"full"],Math.round((this._canvas.height-1)*(b.startBufferLine/this._bufferService.buffers.active.lines.length)-S[b.position||"full"]/2),m[b.position||"full"],Math.round((this._canvas.height-1)*((b.endBufferLine-b.startBufferLine)/this._bufferService.buffers.active.lines.length)+S[b.position||"full"]))}_queueRefresh(b,C){this._shouldUpdateDimensions=b||this._shouldUpdateDimensions,this._shouldUpdateAnchor=C||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};o.OverviewRulerRenderer=v=u([f(2,k.IBufferService),f(3,k.IDecorationService),f(4,g.IRenderService),f(5,k.IOptionsService),f(6,g.ICoreBrowserService)],v)},2950:function(c,o,h){var u=this&&this.__decorate||function(S,m,x,v){var b,C=arguments.length,E=C<3?m:v===null?v=Object.getOwnPropertyDescriptor(m,x):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(S,m,x,v);else for(var P=S.length-1;P>=0;P--)(b=S[P])&&(E=(C<3?b(E):C>3?b(m,x,E):b(m,x))||E);return C>3&&E&&Object.defineProperty(m,x,E),E},f=this&&this.__param||function(S,m){return function(x,v){m(x,v,S)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CompositionHelper=void 0;const d=h(4725),g=h(2585),_=h(2584);let k=o.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(S,m,x,v,b,C){this._textarea=S,this._compositionView=m,this._bufferService=x,this._optionsService=v,this._coreService=b,this._renderService=C,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(S){this._compositionView.textContent=S.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(S){if(this._isComposing||this._isSendingComposition){if(S.keyCode===229||S.keyCode===16||S.keyCode===17||S.keyCode===18)return!1;this._finalizeComposition(!1)}return S.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(S){if(this._compositionView.classList.remove("active"),this._isComposing=!1,S){const m={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let x;this._isSendingComposition=!1,m.start+=this._dataAlreadySent.length,x=this._isComposing?this._textarea.value.substring(m.start,m.end):this._textarea.value.substring(m.start),x.length>0&&this._coreService.triggerDataEvent(x,!0)}}),0)}else{this._isSendingComposition=!1;const m=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(m,!0)}}_handleAnyTextareaChanges(){const S=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const m=this._textarea.value,x=m.replace(S,"");this._dataAlreadySent=x,m.length>S.length?this._coreService.triggerDataEvent(x,!0):m.length<S.length?this._coreService.triggerDataEvent(`${_.C0.DEL}`,!0):m.length===S.length&&m!==S&&this._coreService.triggerDataEvent(m,!0)}}),0)}updateCompositionElements(S){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const m=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),x=this._renderService.dimensions.css.cell.height,v=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,b=m*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=b+"px",this._compositionView.style.top=v+"px",this._compositionView.style.height=x+"px",this._compositionView.style.lineHeight=x+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const C=this._compositionView.getBoundingClientRect();this._textarea.style.left=b+"px",this._textarea.style.top=v+"px",this._textarea.style.width=Math.max(C.width,1)+"px",this._textarea.style.height=Math.max(C.height,1)+"px",this._textarea.style.lineHeight=C.height+"px"}S||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};o.CompositionHelper=k=u([f(2,g.IBufferService),f(3,g.IOptionsService),f(4,g.ICoreService),f(5,d.IRenderService)],k)},9806:(c,o)=>{function h(u,f,d){const g=d.getBoundingClientRect(),_=u.getComputedStyle(d),k=parseInt(_.getPropertyValue("padding-left")),S=parseInt(_.getPropertyValue("padding-top"));return[f.clientX-g.left-k,f.clientY-g.top-S]}Object.defineProperty(o,"__esModule",{value:!0}),o.getCoords=o.getCoordsRelativeToElement=void 0,o.getCoordsRelativeToElement=h,o.getCoords=function(u,f,d,g,_,k,S,m,x){if(!k)return;const v=h(u,f,d);return v?(v[0]=Math.ceil((v[0]+(x?S/2:0))/S),v[1]=Math.ceil(v[1]/m),v[0]=Math.min(Math.max(v[0],1),g+(x?1:0)),v[1]=Math.min(Math.max(v[1],1),_),v):void 0}},9504:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.moveToCellSequence=void 0;const u=h(2584);function f(m,x,v,b){const C=m-d(m,v),E=x-d(x,v),P=Math.abs(C-E)-(function(T,A,D){let I=0;const O=T-d(T,D),z=A-d(A,D);for(let U=0;U<Math.abs(O-z);U++){const K=g(T,A)==="A"?-1:1,ie=D.buffer.lines.get(O+K*U);ie!=null&&ie.isWrapped&&I++}return I})(m,x,v);return S(P,k(g(m,x),b))}function d(m,x){let v=0,b=x.buffer.lines.get(m),C=b==null?void 0:b.isWrapped;for(;C&&m>=0&&m<x.rows;)v++,b=x.buffer.lines.get(--m),C=b==null?void 0:b.isWrapped;return v}function g(m,x){return m>x?"A":"B"}function _(m,x,v,b,C,E){let P=m,T=x,A="";for(;P!==v||T!==b;)P+=C?1:-1,C&&P>E.cols-1?(A+=E.buffer.translateBufferLineToString(T,!1,m,P),P=0,m=0,T++):!C&&P<0&&(A+=E.buffer.translateBufferLineToString(T,!1,0,m+1),P=E.cols-1,m=P,T--);return A+E.buffer.translateBufferLineToString(T,!1,m,P)}function k(m,x){const v=x?"O":"[";return u.C0.ESC+v+m}function S(m,x){m=Math.floor(m);let v="";for(let b=0;b<m;b++)v+=x;return v}o.moveToCellSequence=function(m,x,v,b){const C=v.buffer.x,E=v.buffer.y;if(!v.buffer.hasScrollback)return(function(A,D,I,O,z,U){return f(D,O,z,U).length===0?"":S(_(A,D,A,D-d(D,z),!1,z).length,k("D",U))})(C,E,0,x,v,b)+f(E,x,v,b)+(function(A,D,I,O,z,U){let K;K=f(D,O,z,U).length>0?O-d(O,z):D;const ie=O,Q=(function(J,Y,L,F,B,$){let Z;return Z=f(L,F,B,$).length>0?F-d(F,B):Y,J<L&&Z<=F||J>=L&&Z<F?"C":"D"})(A,D,I,O,z,U);return S(_(A,K,I,ie,Q==="C",z).length,k(Q,U))})(C,E,m,x,v,b);let P;if(E===x)return P=C>m?"D":"C",S(Math.abs(C-m),k(P,b));P=E>x?"D":"C";const T=Math.abs(E-x);return S((function(A,D){return D.cols-A})(E>x?m:C,v)+(T-1)*v.cols+1+((E>x?C:m)-1),k(P,b))}},1296:function(c,o,h){var u=this&&this.__decorate||function(U,K,ie,Q){var J,Y=arguments.length,L=Y<3?K:Q===null?Q=Object.getOwnPropertyDescriptor(K,ie):Q;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(U,K,ie,Q);else for(var F=U.length-1;F>=0;F--)(J=U[F])&&(L=(Y<3?J(L):Y>3?J(K,ie,L):J(K,ie))||L);return Y>3&&L&&Object.defineProperty(K,ie,L),L},f=this&&this.__param||function(U,K){return function(ie,Q){K(ie,Q,U)}};Object.defineProperty(o,"__esModule",{value:!0}),o.DomRenderer=void 0;const d=h(3787),g=h(2550),_=h(2223),k=h(6171),S=h(6052),m=h(4725),x=h(8055),v=h(8460),b=h(844),C=h(2585),E="xterm-dom-renderer-owner-",P="xterm-rows",T="xterm-fg-",A="xterm-bg-",D="xterm-focus",I="xterm-selection";let O=1,z=o.DomRenderer=class extends b.Disposable{constructor(U,K,ie,Q,J,Y,L,F,B,$,Z,oe,he){super(),this._terminal=U,this._document=K,this._element=ie,this._screenElement=Q,this._viewportElement=J,this._helperContainer=Y,this._linkifier2=L,this._charSizeService=B,this._optionsService=$,this._bufferService=Z,this._coreBrowserService=oe,this._themeService=he,this._terminalClass=O++,this._rowElements=[],this._selectionRenderModel=(0,S.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new v.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(P),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(I),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,k.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((ae=>this._injectCss(ae)))),this._injectCss(this._themeService.colors),this._rowFactory=F.createInstance(d.DomRendererRowFactory,document),this._element.classList.add(E+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((ae=>this._handleLinkHover(ae)))),this.register(this._linkifier2.onHideLinkUnderline((ae=>this._handleLinkLeave(ae)))),this.register((0,b.toDisposable)((()=>{this._element.classList.remove(E+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new g.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const U=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*U,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*U),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/U),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/U),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(const ie of this._rowElements)ie.style.width=`${this.dimensions.css.canvas.width}px`,ie.style.height=`${this.dimensions.css.cell.height}px`,ie.style.lineHeight=`${this.dimensions.css.cell.height}px`,ie.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const K=`${this._terminalSelector} .${P} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=K,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(U){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let K=`${this._terminalSelector} .${P} { color: ${U.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;K+=`${this._terminalSelector} .${P} .xterm-dim { color: ${x.color.multiplyOpacity(U.foreground,.5).css};}`,K+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;const ie=`blink_underline_${this._terminalClass}`,Q=`blink_bar_${this._terminalClass}`,J=`blink_block_${this._terminalClass}`;K+=`@keyframes ${ie} { 50% { border-bottom-style: hidden; }}`,K+=`@keyframes ${Q} { 50% { box-shadow: none; }}`,K+=`@keyframes ${J} { 0% { background-color: ${U.cursor.css}; color: ${U.cursorAccent.css}; } 50% { background-color: inherit; color: ${U.cursor.css}; }}`,K+=`${this._terminalSelector} .${P}.${D} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${ie} 1s step-end infinite;}${this._terminalSelector} .${P}.${D} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${Q} 1s step-end infinite;}${this._terminalSelector} .${P}.${D} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${J} 1s step-end infinite;}${this._terminalSelector} .${P} .xterm-cursor.xterm-cursor-block { background-color: ${U.cursor.css}; color: ${U.cursorAccent.css};}${this._terminalSelector} .${P} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${U.cursor.css} !important; color: ${U.cursorAccent.css} !important;}${this._terminalSelector} .${P} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${U.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${P} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${U.cursor.css} inset;}${this._terminalSelector} .${P} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${U.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,K+=`${this._terminalSelector} .${I} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${I} div { position: absolute; background-color: ${U.selectionBackgroundOpaque.css};}${this._terminalSelector} .${I} div { position: absolute; background-color: ${U.selectionInactiveBackgroundOpaque.css};}`;for(const[Y,L]of U.ansi.entries())K+=`${this._terminalSelector} .${T}${Y} { color: ${L.css}; }${this._terminalSelector} .${T}${Y}.xterm-dim { color: ${x.color.multiplyOpacity(L,.5).css}; }${this._terminalSelector} .${A}${Y} { background-color: ${L.css}; }`;K+=`${this._terminalSelector} .${T}${_.INVERTED_DEFAULT_COLOR} { color: ${x.color.opaque(U.background).css}; }${this._terminalSelector} .${T}${_.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${x.color.multiplyOpacity(x.color.opaque(U.background),.5).css}; }${this._terminalSelector} .${A}${_.INVERTED_DEFAULT_COLOR} { background-color: ${U.foreground.css}; }`,this._themeStyleElement.textContent=K}_setDefaultSpacing(){const U=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${U}px`,this._rowFactory.defaultSpacing=U}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(U,K){for(let ie=this._rowElements.length;ie<=K;ie++){const Q=this._document.createElement("div");this._rowContainer.appendChild(Q),this._rowElements.push(Q)}for(;this._rowElements.length>K;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(U,K){this._refreshRowElements(U,K),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(D),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(D),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(U,K,ie){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(U,K,ie),this.renderRows(0,this._bufferService.rows-1),!U||!K)return;this._selectionRenderModel.update(this._terminal,U,K,ie);const Q=this._selectionRenderModel.viewportStartRow,J=this._selectionRenderModel.viewportEndRow,Y=this._selectionRenderModel.viewportCappedStartRow,L=this._selectionRenderModel.viewportCappedEndRow;if(Y>=this._bufferService.rows||L<0)return;const F=this._document.createDocumentFragment();if(ie){const B=U[0]>K[0];F.appendChild(this._createSelectionElement(Y,B?K[0]:U[0],B?U[0]:K[0],L-Y+1))}else{const B=Q===Y?U[0]:0,$=Y===J?K[0]:this._bufferService.cols;F.appendChild(this._createSelectionElement(Y,B,$));const Z=L-Y-1;if(F.appendChild(this._createSelectionElement(Y+1,0,this._bufferService.cols,Z)),Y!==L){const oe=J===L?K[0]:this._bufferService.cols;F.appendChild(this._createSelectionElement(L,0,oe))}}this._selectionContainer.appendChild(F)}_createSelectionElement(U,K,ie,Q=1){const J=this._document.createElement("div"),Y=K*this.dimensions.css.cell.width;let L=this.dimensions.css.cell.width*(ie-K);return Y+L>this.dimensions.css.canvas.width&&(L=this.dimensions.css.canvas.width-Y),J.style.height=Q*this.dimensions.css.cell.height+"px",J.style.top=U*this.dimensions.css.cell.height+"px",J.style.left=`${Y}px`,J.style.width=`${L}px`,J}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(const U of this._rowElements)U.replaceChildren()}renderRows(U,K){const ie=this._bufferService.buffer,Q=ie.ybase+ie.y,J=Math.min(ie.x,this._bufferService.cols-1),Y=this._optionsService.rawOptions.cursorBlink,L=this._optionsService.rawOptions.cursorStyle,F=this._optionsService.rawOptions.cursorInactiveStyle;for(let B=U;B<=K;B++){const $=B+ie.ydisp,Z=this._rowElements[B],oe=ie.lines.get($);if(!Z||!oe)break;Z.replaceChildren(...this._rowFactory.createRow(oe,$,$===Q,L,F,J,Y,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${E}${this._terminalClass}`}_handleLinkHover(U){this._setCellUnderline(U.x1,U.x2,U.y1,U.y2,U.cols,!0)}_handleLinkLeave(U){this._setCellUnderline(U.x1,U.x2,U.y1,U.y2,U.cols,!1)}_setCellUnderline(U,K,ie,Q,J,Y){ie<0&&(U=0),Q<0&&(K=0);const L=this._bufferService.rows-1;ie=Math.max(Math.min(ie,L),0),Q=Math.max(Math.min(Q,L),0),J=Math.min(J,this._bufferService.cols);const F=this._bufferService.buffer,B=F.ybase+F.y,$=Math.min(F.x,J-1),Z=this._optionsService.rawOptions.cursorBlink,oe=this._optionsService.rawOptions.cursorStyle,he=this._optionsService.rawOptions.cursorInactiveStyle;for(let ae=ie;ae<=Q;++ae){const V=ae+F.ydisp,N=this._rowElements[ae],ne=F.lines.get(V);if(!N||!ne)break;N.replaceChildren(...this._rowFactory.createRow(ne,V,V===B,oe,he,$,Z,this.dimensions.css.cell.width,this._widthCache,Y?ae===ie?U:0:-1,Y?(ae===Q?K:J)-1:-1))}}};o.DomRenderer=z=u([f(7,C.IInstantiationService),f(8,m.ICharSizeService),f(9,C.IOptionsService),f(10,C.IBufferService),f(11,m.ICoreBrowserService),f(12,m.IThemeService)],z)},3787:function(c,o,h){var u=this&&this.__decorate||function(P,T,A,D){var I,O=arguments.length,z=O<3?T:D===null?D=Object.getOwnPropertyDescriptor(T,A):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")z=Reflect.decorate(P,T,A,D);else for(var U=P.length-1;U>=0;U--)(I=P[U])&&(z=(O<3?I(z):O>3?I(T,A,z):I(T,A))||z);return O>3&&z&&Object.defineProperty(T,A,z),z},f=this&&this.__param||function(P,T){return function(A,D){T(A,D,P)}};Object.defineProperty(o,"__esModule",{value:!0}),o.DomRendererRowFactory=void 0;const d=h(2223),g=h(643),_=h(511),k=h(2585),S=h(8055),m=h(4725),x=h(4269),v=h(6171),b=h(3734);let C=o.DomRendererRowFactory=class{constructor(P,T,A,D,I,O,z){this._document=P,this._characterJoinerService=T,this._optionsService=A,this._coreBrowserService=D,this._coreService=I,this._decorationService=O,this._themeService=z,this._workCell=new _.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(P,T,A){this._selectionStart=P,this._selectionEnd=T,this._columnSelectMode=A}createRow(P,T,A,D,I,O,z,U,K,ie,Q){const J=[],Y=this._characterJoinerService.getJoinedCharacters(T),L=this._themeService.colors;let F,B=P.getNoBgTrimmedLength();A&&B<O+1&&(B=O+1);let $=0,Z="",oe=0,he=0,ae=0,V=!1,N=0,ne=!1,se=0;const pe=[],fe=ie!==-1&&Q!==-1;for(let Ae=0;Ae<B;Ae++){P.loadCell(Ae,this._workCell);let Oe=this._workCell.getWidth();if(Oe===0)continue;let $e=!1,mt=Ae,Pe=this._workCell;if(Y.length>0&&Ae===Y[0][0]){$e=!0;const Ke=Y.shift();Pe=new x.JoinedCellData(this._workCell,P.translateToString(!0,Ke[0],Ke[1]),Ke[1]-Ke[0]),mt=Ke[1]-1,Oe=Pe.getWidth()}const Os=this._isCellInSelection(Ae,T),gr=A&&Ae===O,Js=fe&&Ae>=ie&&Ae<=Q;let Fs=!1;this._decorationService.forEachDecorationAtCell(Ae,T,void 0,(Ke=>{Fs=!0}));let _r=Pe.getChars()||g.WHITESPACE_CELL_CHAR;if(_r===" "&&(Pe.isUnderline()||Pe.isOverline())&&(_r=" "),se=Oe*U-K.get(_r,Pe.isBold(),Pe.isItalic()),F){if($&&(Os&&ne||!Os&&!ne&&Pe.bg===oe)&&(Os&&ne&&L.selectionForeground||Pe.fg===he)&&Pe.extended.ext===ae&&Js===V&&se===N&&!gr&&!$e&&!Fs){Pe.isInvisible()?Z+=g.WHITESPACE_CELL_CHAR:Z+=_r,$++;continue}$&&(F.textContent=Z),F=this._document.createElement("span"),$=0,Z=""}else F=this._document.createElement("span");if(oe=Pe.bg,he=Pe.fg,ae=Pe.extended.ext,V=Js,N=se,ne=Os,$e&&O>=Ae&&O<=mt&&(O=Ae),!this._coreService.isCursorHidden&&gr&&this._coreService.isCursorInitialized){if(pe.push("xterm-cursor"),this._coreBrowserService.isFocused)z&&pe.push("xterm-cursor-blink"),pe.push(D==="bar"?"xterm-cursor-bar":D==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(I)switch(I){case"outline":pe.push("xterm-cursor-outline");break;case"block":pe.push("xterm-cursor-block");break;case"bar":pe.push("xterm-cursor-bar");break;case"underline":pe.push("xterm-cursor-underline")}}if(Pe.isBold()&&pe.push("xterm-bold"),Pe.isItalic()&&pe.push("xterm-italic"),Pe.isDim()&&pe.push("xterm-dim"),Z=Pe.isInvisible()?g.WHITESPACE_CELL_CHAR:Pe.getChars()||g.WHITESPACE_CELL_CHAR,Pe.isUnderline()&&(pe.push(`xterm-underline-${Pe.extended.underlineStyle}`),Z===" "&&(Z=" "),!Pe.isUnderlineColorDefault()))if(Pe.isUnderlineColorRGB())F.style.textDecorationColor=`rgb(${b.AttributeData.toColorRGB(Pe.getUnderlineColor()).join(",")})`;else{let Ke=Pe.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Pe.isBold()&&Ke<8&&(Ke+=8),F.style.textDecorationColor=L.ansi[Ke].css}Pe.isOverline()&&(pe.push("xterm-overline"),Z===" "&&(Z=" ")),Pe.isStrikethrough()&&pe.push("xterm-strikethrough"),Js&&(F.style.textDecoration="underline");let Ut=Pe.getFgColor(),vr=Pe.getFgColorMode(),ss=Pe.getBgColor(),xr=Pe.getBgColorMode();const Gr=!!Pe.isInverse();if(Gr){const Ke=Ut;Ut=ss,ss=Ke;const aa=vr;vr=xr,xr=aa}let rs,qr,qt,Cs=!1;switch(this._decorationService.forEachDecorationAtCell(Ae,T,void 0,(Ke=>{Ke.options.layer!=="top"&&Cs||(Ke.backgroundColorRGB&&(xr=50331648,ss=Ke.backgroundColorRGB.rgba>>8&16777215,rs=Ke.backgroundColorRGB),Ke.foregroundColorRGB&&(vr=50331648,Ut=Ke.foregroundColorRGB.rgba>>8&16777215,qr=Ke.foregroundColorRGB),Cs=Ke.options.layer==="top")})),!Cs&&Os&&(rs=this._coreBrowserService.isFocused?L.selectionBackgroundOpaque:L.selectionInactiveBackgroundOpaque,ss=rs.rgba>>8&16777215,xr=50331648,Cs=!0,L.selectionForeground&&(vr=50331648,Ut=L.selectionForeground.rgba>>8&16777215,qr=L.selectionForeground)),Cs&&pe.push("xterm-decoration-top"),xr){case 16777216:case 33554432:qt=L.ansi[ss],pe.push(`xterm-bg-${ss}`);break;case 50331648:qt=S.channels.toColor(ss>>16,ss>>8&255,255&ss),this._addStyle(F,`background-color:#${E((ss>>>0).toString(16),"0",6)}`);break;default:Gr?(qt=L.foreground,pe.push(`xterm-bg-${d.INVERTED_DEFAULT_COLOR}`)):qt=L.background}switch(rs||Pe.isDim()&&(rs=S.color.multiplyOpacity(qt,.5)),vr){case 16777216:case 33554432:Pe.isBold()&&Ut<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Ut+=8),this._applyMinimumContrast(F,qt,L.ansi[Ut],Pe,rs,void 0)||pe.push(`xterm-fg-${Ut}`);break;case 50331648:const Ke=S.channels.toColor(Ut>>16&255,Ut>>8&255,255&Ut);this._applyMinimumContrast(F,qt,Ke,Pe,rs,qr)||this._addStyle(F,`color:#${E(Ut.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(F,qt,L.foreground,Pe,rs,qr)||Gr&&pe.push(`xterm-fg-${d.INVERTED_DEFAULT_COLOR}`)}pe.length&&(F.className=pe.join(" "),pe.length=0),gr||$e||Fs?F.textContent=Z:$++,se!==this.defaultSpacing&&(F.style.letterSpacing=`${se}px`),J.push(F),Ae=mt}return F&&$&&(F.textContent=Z),J}_applyMinimumContrast(P,T,A,D,I,O){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,v.treatGlyphAsBackgroundColor)(D.getCode()))return!1;const z=this._getContrastCache(D);let U;if(I||O||(U=z.getColor(T.rgba,A.rgba)),U===void 0){const K=this._optionsService.rawOptions.minimumContrastRatio/(D.isDim()?2:1);U=S.color.ensureContrastRatio(I||T,O||A,K),z.setColor((I||T).rgba,(O||A).rgba,U??null)}return!!U&&(this._addStyle(P,`color:${U.css}`),!0)}_getContrastCache(P){return P.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(P,T){P.setAttribute("style",`${P.getAttribute("style")||""}${T};`)}_isCellInSelection(P,T){const A=this._selectionStart,D=this._selectionEnd;return!(!A||!D)&&(this._columnSelectMode?A[0]<=D[0]?P>=A[0]&&T>=A[1]&&P<D[0]&&T<=D[1]:P<A[0]&&T>=A[1]&&P>=D[0]&&T<=D[1]:T>A[1]&&T<D[1]||A[1]===D[1]&&T===A[1]&&P>=A[0]&&P<D[0]||A[1]<D[1]&&T===D[1]&&P<D[0]||A[1]<D[1]&&T===A[1]&&P>=A[0])}};function E(P,T,A){for(;P.length<A;)P=T+P;return P}o.DomRendererRowFactory=C=u([f(1,m.ICharacterJoinerService),f(2,k.IOptionsService),f(3,m.ICoreBrowserService),f(4,k.ICoreService),f(5,k.IDecorationService),f(6,m.IThemeService)],C)},2550:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.WidthCache=void 0,o.WidthCache=class{constructor(h,u){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=h.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const f=h.createElement("span");f.classList.add("xterm-char-measure-element");const d=h.createElement("span");d.classList.add("xterm-char-measure-element"),d.style.fontWeight="bold";const g=h.createElement("span");g.classList.add("xterm-char-measure-element"),g.style.fontStyle="italic";const _=h.createElement("span");_.classList.add("xterm-char-measure-element"),_.style.fontWeight="bold",_.style.fontStyle="italic",this._measureElements=[f,d,g,_],this._container.appendChild(f),this._container.appendChild(d),this._container.appendChild(g),this._container.appendChild(_),u.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(h,u,f,d){h===this._font&&u===this._fontSize&&f===this._weight&&d===this._weightBold||(this._font=h,this._fontSize=u,this._weight=f,this._weightBold=d,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${f}`,this._measureElements[1].style.fontWeight=`${d}`,this._measureElements[2].style.fontWeight=`${f}`,this._measureElements[3].style.fontWeight=`${d}`,this.clear())}get(h,u,f){let d=0;if(!u&&!f&&h.length===1&&(d=h.charCodeAt(0))<256){if(this._flat[d]!==-9999)return this._flat[d];const k=this._measure(h,0);return k>0&&(this._flat[d]=k),k}let g=h;u&&(g+="B"),f&&(g+="I");let _=this._holey.get(g);if(_===void 0){let k=0;u&&(k|=1),f&&(k|=2),_=this._measure(h,k),_>0&&this._holey.set(g,_)}return _}_measure(h,u){const f=this._measureElements[u];return f.textContent=h.repeat(32),f.offsetWidth/32}}},2223:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.TEXT_BASELINE=o.DIM_OPACITY=o.INVERTED_DEFAULT_COLOR=void 0;const u=h(6114);o.INVERTED_DEFAULT_COLOR=257,o.DIM_OPACITY=.5,o.TEXT_BASELINE=u.isFirefox||u.isLegacyEdge?"bottom":"ideographic"},6171:(c,o)=>{function h(f){return 57508<=f&&f<=57558}function u(f){return f>=128512&&f<=128591||f>=127744&&f<=128511||f>=128640&&f<=128767||f>=9728&&f<=9983||f>=9984&&f<=10175||f>=65024&&f<=65039||f>=129280&&f<=129535||f>=127462&&f<=127487}Object.defineProperty(o,"__esModule",{value:!0}),o.computeNextVariantOffset=o.createRenderDimensions=o.treatGlyphAsBackgroundColor=o.allowRescaling=o.isEmoji=o.isRestrictedPowerlineGlyph=o.isPowerlineGlyph=o.throwIfFalsy=void 0,o.throwIfFalsy=function(f){if(!f)throw new Error("value must not be falsy");return f},o.isPowerlineGlyph=h,o.isRestrictedPowerlineGlyph=function(f){return 57520<=f&&f<=57527},o.isEmoji=u,o.allowRescaling=function(f,d,g,_){return d===1&&g>Math.ceil(1.5*_)&&f!==void 0&&f>255&&!u(f)&&!h(f)&&!(function(k){return 57344<=k&&k<=63743})(f)},o.treatGlyphAsBackgroundColor=function(f){return h(f)||(function(d){return 9472<=d&&d<=9631})(f)},o.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},o.computeNextVariantOffset=function(f,d,g=0){return(f-(2*Math.round(d)-g))%(2*Math.round(d))}},6052:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.createSelectionRenderModel=void 0;class h{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(f,d,g,_=!1){if(this.selectionStart=d,this.selectionEnd=g,!d||!g||d[0]===g[0]&&d[1]===g[1])return void this.clear();const k=f.buffers.active.ydisp,S=d[1]-k,m=g[1]-k,x=Math.max(S,0),v=Math.min(m,f.rows-1);x>=f.rows||v<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=_,this.viewportStartRow=S,this.viewportEndRow=m,this.viewportCappedStartRow=x,this.viewportCappedEndRow=v,this.startCol=d[0],this.endCol=g[0])}isCellSelected(f,d,g){return!!this.hasSelection&&(g-=f.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?d>=this.startCol&&g>=this.viewportCappedStartRow&&d<this.endCol&&g<=this.viewportCappedEndRow:d<this.startCol&&g>=this.viewportCappedStartRow&&d>=this.endCol&&g<=this.viewportCappedEndRow:g>this.viewportStartRow&&g<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&g===this.viewportStartRow&&d>=this.startCol&&d<this.endCol||this.viewportStartRow<this.viewportEndRow&&g===this.viewportEndRow&&d<this.endCol||this.viewportStartRow<this.viewportEndRow&&g===this.viewportStartRow&&d>=this.startCol)}}o.createSelectionRenderModel=function(){return new h}},456:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.SelectionModel=void 0,o.SelectionModel=class{constructor(h){this._bufferService=h,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const h=this.selectionStart[0]+this.selectionStartLength;return h>this._bufferService.cols?h%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(h/this._bufferService.cols)-1]:[h%this._bufferService.cols,this.selectionStart[1]+Math.floor(h/this._bufferService.cols)]:[h,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const h=this.selectionStart[0]+this.selectionStartLength;return h>this._bufferService.cols?[h%this._bufferService.cols,this.selectionStart[1]+Math.floor(h/this._bufferService.cols)]:[Math.max(h,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const h=this.selectionStart,u=this.selectionEnd;return!(!h||!u)&&(h[1]>u[1]||h[1]===u[1]&&h[0]>u[0])}handleTrim(h){return this.selectionStart&&(this.selectionStart[1]-=h),this.selectionEnd&&(this.selectionEnd[1]-=h),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(c,o,h){var u=this&&this.__decorate||function(v,b,C,E){var P,T=arguments.length,A=T<3?b:E===null?E=Object.getOwnPropertyDescriptor(b,C):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(v,b,C,E);else for(var D=v.length-1;D>=0;D--)(P=v[D])&&(A=(T<3?P(A):T>3?P(b,C,A):P(b,C))||A);return T>3&&A&&Object.defineProperty(b,C,A),A},f=this&&this.__param||function(v,b){return function(C,E){b(C,E,v)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CharSizeService=void 0;const d=h(2585),g=h(8460),_=h(844);let k=o.CharSizeService=class extends _.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(v,b,C){super(),this._optionsService=C,this.width=0,this.height=0,this._onCharSizeChange=this.register(new g.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new x(this._optionsService))}catch{this._measureStrategy=this.register(new m(v,b,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const v=this._measureStrategy.measure();v.width===this.width&&v.height===this.height||(this.width=v.width,this.height=v.height,this._onCharSizeChange.fire())}};o.CharSizeService=k=u([f(2,d.IOptionsService)],k);class S extends _.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(b,C){b!==void 0&&b>0&&C!==void 0&&C>0&&(this._result.width=b,this._result.height=C)}}class m extends S{constructor(b,C,E){super(),this._document=b,this._parentElement=C,this._optionsService=E,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class x extends S{constructor(b){super(),this._optionsService=b,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const C=this._ctx.measureText("W");if(!("width"in C&&"fontBoundingBoxAscent"in C&&"fontBoundingBoxDescent"in C))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const b=this._ctx.measureText("W");return this._validateAndSet(b.width,b.fontBoundingBoxAscent+b.fontBoundingBoxDescent),this._result}}},4269:function(c,o,h){var u=this&&this.__decorate||function(x,v,b,C){var E,P=arguments.length,T=P<3?v:C===null?C=Object.getOwnPropertyDescriptor(v,b):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(x,v,b,C);else for(var A=x.length-1;A>=0;A--)(E=x[A])&&(T=(P<3?E(T):P>3?E(v,b,T):E(v,b))||T);return P>3&&T&&Object.defineProperty(v,b,T),T},f=this&&this.__param||function(x,v){return function(b,C){v(b,C,x)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CharacterJoinerService=o.JoinedCellData=void 0;const d=h(3734),g=h(643),_=h(511),k=h(2585);class S extends d.AttributeData{constructor(v,b,C){super(),this.content=0,this.combinedData="",this.fg=v.fg,this.bg=v.bg,this.combinedData=b,this._width=C}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(v){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}o.JoinedCellData=S;let m=o.CharacterJoinerService=class Zb{constructor(v){this._bufferService=v,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new _.CellData}register(v){const b={id:this._nextCharacterJoinerId++,handler:v};return this._characterJoiners.push(b),b.id}deregister(v){for(let b=0;b<this._characterJoiners.length;b++)if(this._characterJoiners[b].id===v)return this._characterJoiners.splice(b,1),!0;return!1}getJoinedCharacters(v){if(this._characterJoiners.length===0)return[];const b=this._bufferService.buffer.lines.get(v);if(!b||b.length===0)return[];const C=[],E=b.translateToString(!0);let P=0,T=0,A=0,D=b.getFg(0),I=b.getBg(0);for(let O=0;O<b.getTrimmedLength();O++)if(b.loadCell(O,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==D||this._workCell.bg!==I){if(O-P>1){const z=this._getJoinedRanges(E,A,T,b,P);for(let U=0;U<z.length;U++)C.push(z[U])}P=O,A=T,D=this._workCell.fg,I=this._workCell.bg}T+=this._workCell.getChars().length||g.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-P>1){const O=this._getJoinedRanges(E,A,T,b,P);for(let z=0;z<O.length;z++)C.push(O[z])}return C}_getJoinedRanges(v,b,C,E,P){const T=v.substring(b,C);let A=[];try{A=this._characterJoiners[0].handler(T)}catch(D){console.error(D)}for(let D=1;D<this._characterJoiners.length;D++)try{const I=this._characterJoiners[D].handler(T);for(let O=0;O<I.length;O++)Zb._mergeRanges(A,I[O])}catch(I){console.error(I)}return this._stringRangesToCellRanges(A,E,P),A}_stringRangesToCellRanges(v,b,C){let E=0,P=!1,T=0,A=v[E];if(A){for(let D=C;D<this._bufferService.cols;D++){const I=b.getWidth(D),O=b.getString(D).length||g.WHITESPACE_CELL_CHAR.length;if(I!==0){if(!P&&A[0]<=T&&(A[0]=D,P=!0),A[1]<=T){if(A[1]=D,A=v[++E],!A)break;A[0]<=T?(A[0]=D,P=!0):P=!1}T+=O}}A&&(A[1]=this._bufferService.cols)}}static _mergeRanges(v,b){let C=!1;for(let E=0;E<v.length;E++){const P=v[E];if(C){if(b[1]<=P[0])return v[E-1][1]=b[1],v;if(b[1]<=P[1])return v[E-1][1]=Math.max(b[1],P[1]),v.splice(E,1),v;v.splice(E,1),E--}else{if(b[1]<=P[0])return v.splice(E,0,b),v;if(b[1]<=P[1])return P[0]=Math.min(b[0],P[0]),v;b[0]<P[1]&&(P[0]=Math.min(b[0],P[0]),C=!0)}}return C?v[v.length-1][1]=b[1]:v.push(b),v}};o.CharacterJoinerService=m=u([f(0,k.IBufferService)],m)},5114:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CoreBrowserService=void 0;const u=h(844),f=h(8460),d=h(3656);class g extends u.Disposable{constructor(S,m,x){super(),this._textarea=S,this._window=m,this.mainDocument=x,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new _(this._window),this._onDprChange=this.register(new f.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new f.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((v=>this._screenDprMonitor.setWindow(v)))),this.register((0,f.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(S){this._window!==S&&(this._window=S,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}o.CoreBrowserService=g;class _ extends u.Disposable{constructor(S){super(),this._parentWindow=S,this._windowResizeListener=this.register(new u.MutableDisposable),this._onDprChange=this.register(new f.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,u.toDisposable)((()=>this.clearListener())))}setWindow(S){this._parentWindow=S,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,d.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var S;this._outerListener&&((S=this._resolutionMediaMatchList)==null||S.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.LinkProviderService=void 0;const u=h(844);class f extends u.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,u.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(g){return this.linkProviders.push(g),{dispose:()=>{const _=this.linkProviders.indexOf(g);_!==-1&&this.linkProviders.splice(_,1)}}}}o.LinkProviderService=f},8934:function(c,o,h){var u=this&&this.__decorate||function(k,S,m,x){var v,b=arguments.length,C=b<3?S:x===null?x=Object.getOwnPropertyDescriptor(S,m):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(k,S,m,x);else for(var E=k.length-1;E>=0;E--)(v=k[E])&&(C=(b<3?v(C):b>3?v(S,m,C):v(S,m))||C);return b>3&&C&&Object.defineProperty(S,m,C),C},f=this&&this.__param||function(k,S){return function(m,x){S(m,x,k)}};Object.defineProperty(o,"__esModule",{value:!0}),o.MouseService=void 0;const d=h(4725),g=h(9806);let _=o.MouseService=class{constructor(k,S){this._renderService=k,this._charSizeService=S}getCoords(k,S,m,x,v){return(0,g.getCoords)(window,k,S,m,x,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,v)}getMouseReportCoords(k,S){const m=(0,g.getCoordsRelativeToElement)(window,k,S);if(this._charSizeService.hasValidSize)return m[0]=Math.min(Math.max(m[0],0),this._renderService.dimensions.css.canvas.width-1),m[1]=Math.min(Math.max(m[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(m[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(m[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(m[0]),y:Math.floor(m[1])}}};o.MouseService=_=u([f(0,d.IRenderService),f(1,d.ICharSizeService)],_)},3230:function(c,o,h){var u=this&&this.__decorate||function(v,b,C,E){var P,T=arguments.length,A=T<3?b:E===null?E=Object.getOwnPropertyDescriptor(b,C):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(v,b,C,E);else for(var D=v.length-1;D>=0;D--)(P=v[D])&&(A=(T<3?P(A):T>3?P(b,C,A):P(b,C))||A);return T>3&&A&&Object.defineProperty(b,C,A),A},f=this&&this.__param||function(v,b){return function(C,E){b(C,E,v)}};Object.defineProperty(o,"__esModule",{value:!0}),o.RenderService=void 0;const d=h(6193),g=h(4725),_=h(8460),k=h(844),S=h(7226),m=h(2585);let x=o.RenderService=class extends k.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(v,b,C,E,P,T,A,D){super(),this._rowCount=v,this._charSizeService=E,this._renderer=this.register(new k.MutableDisposable),this._pausedResizeTask=new S.DebouncedIdleTask,this._observerDisposable=this.register(new k.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new _.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new _.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new _.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new _.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new d.RenderDebouncer(((I,O)=>this._renderRows(I,O)),A),this.register(this._renderDebouncer),this.register(A.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(T.onResize((()=>this._fullRefresh()))),this.register(T.buffers.onBufferActivate((()=>{var I;return(I=this._renderer.value)==null?void 0:I.clear()}))),this.register(C.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(P.onDecorationRegistered((()=>this._fullRefresh()))),this.register(P.onDecorationRemoved((()=>this._fullRefresh()))),this.register(C.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(T.cols,T.rows),this._fullRefresh()}))),this.register(C.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(T.buffer.y,T.buffer.y,!0)))),this.register(D.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(A.window,b),this.register(A.onWindowChange((I=>this._registerIntersectionObserver(I,b))))}_registerIntersectionObserver(v,b){if("IntersectionObserver"in v){const C=new v.IntersectionObserver((E=>this._handleIntersectionChange(E[E.length-1])),{threshold:0});C.observe(b),this._observerDisposable.value=(0,k.toDisposable)((()=>C.disconnect()))}}_handleIntersectionChange(v){this._isPaused=v.isIntersecting===void 0?v.intersectionRatio===0:!v.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(v,b,C=!1){this._isPaused?this._needsFullRefresh=!0:(C||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(v,b,this._rowCount))}_renderRows(v,b){this._renderer.value&&(v=Math.min(v,this._rowCount-1),b=Math.min(b,this._rowCount-1),this._renderer.value.renderRows(v,b),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:v,end:b}),this._onRender.fire({start:v,end:b}),this._isNextRenderRedrawOnly=!0)}resize(v,b){this._rowCount=b,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(v){this._renderer.value=v,this._renderer.value&&(this._renderer.value.onRequestRedraw((b=>this.refreshRows(b.start,b.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(v){return this._renderDebouncer.addRefreshCallback(v)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var v,b;this._renderer.value&&((b=(v=this._renderer.value).clearTextureAtlas)==null||b.call(v),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(v,b){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var C;return(C=this._renderer.value)==null?void 0:C.handleResize(v,b)})):this._renderer.value.handleResize(v,b),this._fullRefresh())}handleCharSizeChanged(){var v;(v=this._renderer.value)==null||v.handleCharSizeChanged()}handleBlur(){var v;(v=this._renderer.value)==null||v.handleBlur()}handleFocus(){var v;(v=this._renderer.value)==null||v.handleFocus()}handleSelectionChanged(v,b,C){var E;this._selectionState.start=v,this._selectionState.end=b,this._selectionState.columnSelectMode=C,(E=this._renderer.value)==null||E.handleSelectionChanged(v,b,C)}handleCursorMove(){var v;(v=this._renderer.value)==null||v.handleCursorMove()}clear(){var v;(v=this._renderer.value)==null||v.clear()}};o.RenderService=x=u([f(2,m.IOptionsService),f(3,g.ICharSizeService),f(4,m.IDecorationService),f(5,m.IBufferService),f(6,g.ICoreBrowserService),f(7,g.IThemeService)],x)},9312:function(c,o,h){var u=this&&this.__decorate||function(A,D,I,O){var z,U=arguments.length,K=U<3?D:O===null?O=Object.getOwnPropertyDescriptor(D,I):O;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")K=Reflect.decorate(A,D,I,O);else for(var ie=A.length-1;ie>=0;ie--)(z=A[ie])&&(K=(U<3?z(K):U>3?z(D,I,K):z(D,I))||K);return U>3&&K&&Object.defineProperty(D,I,K),K},f=this&&this.__param||function(A,D){return function(I,O){D(I,O,A)}};Object.defineProperty(o,"__esModule",{value:!0}),o.SelectionService=void 0;const d=h(9806),g=h(9504),_=h(456),k=h(4725),S=h(8460),m=h(844),x=h(6114),v=h(4841),b=h(511),C=h(2585),E=" ",P=new RegExp(E,"g");let T=o.SelectionService=class extends m.Disposable{constructor(A,D,I,O,z,U,K,ie,Q){super(),this._element=A,this._screenElement=D,this._linkifier=I,this._bufferService=O,this._coreService=z,this._mouseService=U,this._optionsService=K,this._renderService=ie,this._coreBrowserService=Q,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new b.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new S.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new S.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new S.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new S.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=J=>this._handleMouseMove(J),this._mouseUpListener=J=>this._handleMouseUp(J),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((J=>this._handleTrim(J))),this.register(this._bufferService.buffers.onBufferActivate((J=>this._handleBufferActivate(J)))),this.enable(),this._model=new _.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,m.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const A=this._model.finalSelectionStart,D=this._model.finalSelectionEnd;return!(!A||!D||A[0]===D[0]&&A[1]===D[1])}get selectionText(){const A=this._model.finalSelectionStart,D=this._model.finalSelectionEnd;if(!A||!D)return"";const I=this._bufferService.buffer,O=[];if(this._activeSelectionMode===3){if(A[0]===D[0])return"";const z=A[0]<D[0]?A[0]:D[0],U=A[0]<D[0]?D[0]:A[0];for(let K=A[1];K<=D[1];K++){const ie=I.translateBufferLineToString(K,!0,z,U);O.push(ie)}}else{const z=A[1]===D[1]?D[0]:void 0;O.push(I.translateBufferLineToString(A[1],!0,A[0],z));for(let U=A[1]+1;U<=D[1]-1;U++){const K=I.lines.get(U),ie=I.translateBufferLineToString(U,!0);K!=null&&K.isWrapped?O[O.length-1]+=ie:O.push(ie)}if(A[1]!==D[1]){const U=I.lines.get(D[1]),K=I.translateBufferLineToString(D[1],!0,0,D[0]);U&&U.isWrapped?O[O.length-1]+=K:O.push(K)}}return O.map((z=>z.replace(P," "))).join(x.isWindows?`\r
323
+ `:`
324
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(A){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),x.isLinux&&A&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(A){const D=this._getMouseBufferCoords(A),I=this._model.finalSelectionStart,O=this._model.finalSelectionEnd;return!!(I&&O&&D)&&this._areCoordsInSelection(D,I,O)}isCellInSelection(A,D){const I=this._model.finalSelectionStart,O=this._model.finalSelectionEnd;return!(!I||!O)&&this._areCoordsInSelection([A,D],I,O)}_areCoordsInSelection(A,D,I){return A[1]>D[1]&&A[1]<I[1]||D[1]===I[1]&&A[1]===D[1]&&A[0]>=D[0]&&A[0]<I[0]||D[1]<I[1]&&A[1]===I[1]&&A[0]<I[0]||D[1]<I[1]&&A[1]===D[1]&&A[0]>=D[0]}_selectWordAtCursor(A,D){var z,U;const I=(U=(z=this._linkifier.currentLink)==null?void 0:z.link)==null?void 0:U.range;if(I)return this._model.selectionStart=[I.start.x-1,I.start.y-1],this._model.selectionStartLength=(0,v.getRangeLength)(I,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const O=this._getMouseBufferCoords(A);return!!O&&(this._selectWordAt(O,D),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(A,D){this._model.clearSelection(),A=Math.max(A,0),D=Math.min(D,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,A],this._model.selectionEnd=[this._bufferService.cols,D],this.refresh(),this._onSelectionChange.fire()}_handleTrim(A){this._model.handleTrim(A)&&this.refresh()}_getMouseBufferCoords(A){const D=this._mouseService.getCoords(A,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(D)return D[0]--,D[1]--,D[1]+=this._bufferService.buffer.ydisp,D}_getMouseEventScrollAmount(A){let D=(0,d.getCoordsRelativeToElement)(this._coreBrowserService.window,A,this._screenElement)[1];const I=this._renderService.dimensions.css.canvas.height;return D>=0&&D<=I?0:(D>I&&(D-=I),D=Math.min(Math.max(D,-50),50),D/=50,D/Math.abs(D)+Math.round(14*D))}shouldForceSelection(A){return x.isMac?A.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:A.shiftKey}handleMouseDown(A){if(this._mouseDownTimeStamp=A.timeStamp,(A.button!==2||!this.hasSelection)&&A.button===0){if(!this._enabled){if(!this.shouldForceSelection(A))return;A.stopPropagation()}A.preventDefault(),this._dragScrollAmount=0,this._enabled&&A.shiftKey?this._handleIncrementalClick(A):A.detail===1?this._handleSingleClick(A):A.detail===2?this._handleDoubleClick(A):A.detail===3&&this._handleTripleClick(A),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval((()=>this._dragScroll()),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(A){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(A))}_handleSingleClick(A){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(A)?3:0,this._model.selectionStart=this._getMouseBufferCoords(A),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const D=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);D&&D.length!==this._model.selectionStart[0]&&D.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(A){this._selectWordAtCursor(A,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(A){const D=this._getMouseBufferCoords(A);D&&(this._activeSelectionMode=2,this._selectLineAt(D[1]))}shouldColumnSelect(A){return A.altKey&&!(x.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(A){if(A.stopImmediatePropagation(),!this._model.selectionStart)return;const D=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(A),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(A),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const I=this._bufferService.buffer;if(this._model.selectionEnd[1]<I.lines.length){const O=I.lines.get(this._model.selectionEnd[1]);O&&O.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}D&&D[0]===this._model.selectionEnd[0]&&D[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});const A=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(A.ydisp+this._bufferService.rows,A.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=A.ydisp),this.refresh()}}_handleMouseUp(A){const D=A.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&D<500&&A.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const I=this._mouseService.getCoords(A,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(I&&I[0]!==void 0&&I[1]!==void 0){const O=(0,g.moveToCellSequence)(I[0]-1,I[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(O,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const A=this._model.finalSelectionStart,D=this._model.finalSelectionEnd,I=!(!A||!D||A[0]===D[0]&&A[1]===D[1]);I?A&&D&&(this._oldSelectionStart&&this._oldSelectionEnd&&A[0]===this._oldSelectionStart[0]&&A[1]===this._oldSelectionStart[1]&&D[0]===this._oldSelectionEnd[0]&&D[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(A,D,I)):this._oldHasSelection&&this._fireOnSelectionChange(A,D,I)}_fireOnSelectionChange(A,D,I){this._oldSelectionStart=A,this._oldSelectionEnd=D,this._oldHasSelection=I,this._onSelectionChange.fire()}_handleBufferActivate(A){this.clearSelection(),this._trimListener.dispose(),this._trimListener=A.activeBuffer.lines.onTrim((D=>this._handleTrim(D)))}_convertViewportColToCharacterIndex(A,D){let I=D;for(let O=0;D>=O;O++){const z=A.loadCell(O,this._workCell).getChars().length;this._workCell.getWidth()===0?I--:z>1&&D!==O&&(I+=z-1)}return I}setSelection(A,D,I){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[A,D],this._model.selectionStartLength=I,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(A){this._isClickInSelection(A)||(this._selectWordAtCursor(A,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(A,D,I=!0,O=!0){if(A[0]>=this._bufferService.cols)return;const z=this._bufferService.buffer,U=z.lines.get(A[1]);if(!U)return;const K=z.translateBufferLineToString(A[1],!1);let ie=this._convertViewportColToCharacterIndex(U,A[0]),Q=ie;const J=A[0]-ie;let Y=0,L=0,F=0,B=0;if(K.charAt(ie)===" "){for(;ie>0&&K.charAt(ie-1)===" ";)ie--;for(;Q<K.length&&K.charAt(Q+1)===" ";)Q++}else{let oe=A[0],he=A[0];U.getWidth(oe)===0&&(Y++,oe--),U.getWidth(he)===2&&(L++,he++);const ae=U.getString(he).length;for(ae>1&&(B+=ae-1,Q+=ae-1);oe>0&&ie>0&&!this._isCharWordSeparator(U.loadCell(oe-1,this._workCell));){U.loadCell(oe-1,this._workCell);const V=this._workCell.getChars().length;this._workCell.getWidth()===0?(Y++,oe--):V>1&&(F+=V-1,ie-=V-1),ie--,oe--}for(;he<U.length&&Q+1<K.length&&!this._isCharWordSeparator(U.loadCell(he+1,this._workCell));){U.loadCell(he+1,this._workCell);const V=this._workCell.getChars().length;this._workCell.getWidth()===2?(L++,he++):V>1&&(B+=V-1,Q+=V-1),Q++,he++}}Q++;let $=ie+J-Y+F,Z=Math.min(this._bufferService.cols,Q-ie+Y+L-F-B);if(D||K.slice(ie,Q).trim()!==""){if(I&&$===0&&U.getCodePoint(0)!==32){const oe=z.lines.get(A[1]-1);if(oe&&U.isWrapped&&oe.getCodePoint(this._bufferService.cols-1)!==32){const he=this._getWordAt([this._bufferService.cols-1,A[1]-1],!1,!0,!1);if(he){const ae=this._bufferService.cols-he.start;$-=ae,Z+=ae}}}if(O&&$+Z===this._bufferService.cols&&U.getCodePoint(this._bufferService.cols-1)!==32){const oe=z.lines.get(A[1]+1);if(oe!=null&&oe.isWrapped&&oe.getCodePoint(0)!==32){const he=this._getWordAt([0,A[1]+1],!1,!1,!0);he&&(Z+=he.length)}}return{start:$,length:Z}}}_selectWordAt(A,D){const I=this._getWordAt(A,D);if(I){for(;I.start<0;)I.start+=this._bufferService.cols,A[1]--;this._model.selectionStart=[I.start,A[1]],this._model.selectionStartLength=I.length}}_selectToWordAt(A){const D=this._getWordAt(A,!0);if(D){let I=A[1];for(;D.start<0;)D.start+=this._bufferService.cols,I--;if(!this._model.areSelectionValuesReversed())for(;D.start+D.length>this._bufferService.cols;)D.length-=this._bufferService.cols,I++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?D.start:D.start+D.length,I]}}_isCharWordSeparator(A){return A.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(A.getChars())>=0}_selectLineAt(A){const D=this._bufferService.buffer.getWrappedRangeForLine(A),I={start:{x:0,y:D.first},end:{x:this._bufferService.cols-1,y:D.last}};this._model.selectionStart=[0,D.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,v.getRangeLength)(I,this._bufferService.cols)}};o.SelectionService=T=u([f(3,C.IBufferService),f(4,C.ICoreService),f(5,k.IMouseService),f(6,C.IOptionsService),f(7,k.IRenderService),f(8,k.ICoreBrowserService)],T)},4725:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ILinkProviderService=o.IThemeService=o.ICharacterJoinerService=o.ISelectionService=o.IRenderService=o.IMouseService=o.ICoreBrowserService=o.ICharSizeService=void 0;const u=h(8343);o.ICharSizeService=(0,u.createDecorator)("CharSizeService"),o.ICoreBrowserService=(0,u.createDecorator)("CoreBrowserService"),o.IMouseService=(0,u.createDecorator)("MouseService"),o.IRenderService=(0,u.createDecorator)("RenderService"),o.ISelectionService=(0,u.createDecorator)("SelectionService"),o.ICharacterJoinerService=(0,u.createDecorator)("CharacterJoinerService"),o.IThemeService=(0,u.createDecorator)("ThemeService"),o.ILinkProviderService=(0,u.createDecorator)("LinkProviderService")},6731:function(c,o,h){var u=this&&this.__decorate||function(T,A,D,I){var O,z=arguments.length,U=z<3?A:I===null?I=Object.getOwnPropertyDescriptor(A,D):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")U=Reflect.decorate(T,A,D,I);else for(var K=T.length-1;K>=0;K--)(O=T[K])&&(U=(z<3?O(U):z>3?O(A,D,U):O(A,D))||U);return z>3&&U&&Object.defineProperty(A,D,U),U},f=this&&this.__param||function(T,A){return function(D,I){A(D,I,T)}};Object.defineProperty(o,"__esModule",{value:!0}),o.ThemeService=o.DEFAULT_ANSI_COLORS=void 0;const d=h(7239),g=h(8055),_=h(8460),k=h(844),S=h(2585),m=g.css.toColor("#ffffff"),x=g.css.toColor("#000000"),v=g.css.toColor("#ffffff"),b=g.css.toColor("#000000"),C={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};o.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const T=[g.css.toColor("#2e3436"),g.css.toColor("#cc0000"),g.css.toColor("#4e9a06"),g.css.toColor("#c4a000"),g.css.toColor("#3465a4"),g.css.toColor("#75507b"),g.css.toColor("#06989a"),g.css.toColor("#d3d7cf"),g.css.toColor("#555753"),g.css.toColor("#ef2929"),g.css.toColor("#8ae234"),g.css.toColor("#fce94f"),g.css.toColor("#729fcf"),g.css.toColor("#ad7fa8"),g.css.toColor("#34e2e2"),g.css.toColor("#eeeeec")],A=[0,95,135,175,215,255];for(let D=0;D<216;D++){const I=A[D/36%6|0],O=A[D/6%6|0],z=A[D%6];T.push({css:g.channels.toCss(I,O,z),rgba:g.channels.toRgba(I,O,z)})}for(let D=0;D<24;D++){const I=8+10*D;T.push({css:g.channels.toCss(I,I,I),rgba:g.channels.toRgba(I,I,I)})}return T})());let E=o.ThemeService=class extends k.Disposable{get colors(){return this._colors}constructor(T){super(),this._optionsService=T,this._contrastCache=new d.ColorContrastCache,this._halfContrastCache=new d.ColorContrastCache,this._onChangeColors=this.register(new _.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:m,background:x,cursor:v,cursorAccent:b,selectionForeground:void 0,selectionBackgroundTransparent:C,selectionBackgroundOpaque:g.color.blend(x,C),selectionInactiveBackgroundTransparent:C,selectionInactiveBackgroundOpaque:g.color.blend(x,C),ansi:o.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",(()=>this._contrastCache.clear()))),this.register(this._optionsService.onSpecificOptionChange("theme",(()=>this._setTheme(this._optionsService.rawOptions.theme))))}_setTheme(T={}){const A=this._colors;if(A.foreground=P(T.foreground,m),A.background=P(T.background,x),A.cursor=P(T.cursor,v),A.cursorAccent=P(T.cursorAccent,b),A.selectionBackgroundTransparent=P(T.selectionBackground,C),A.selectionBackgroundOpaque=g.color.blend(A.background,A.selectionBackgroundTransparent),A.selectionInactiveBackgroundTransparent=P(T.selectionInactiveBackground,A.selectionBackgroundTransparent),A.selectionInactiveBackgroundOpaque=g.color.blend(A.background,A.selectionInactiveBackgroundTransparent),A.selectionForeground=T.selectionForeground?P(T.selectionForeground,g.NULL_COLOR):void 0,A.selectionForeground===g.NULL_COLOR&&(A.selectionForeground=void 0),g.color.isOpaque(A.selectionBackgroundTransparent)&&(A.selectionBackgroundTransparent=g.color.opacity(A.selectionBackgroundTransparent,.3)),g.color.isOpaque(A.selectionInactiveBackgroundTransparent)&&(A.selectionInactiveBackgroundTransparent=g.color.opacity(A.selectionInactiveBackgroundTransparent,.3)),A.ansi=o.DEFAULT_ANSI_COLORS.slice(),A.ansi[0]=P(T.black,o.DEFAULT_ANSI_COLORS[0]),A.ansi[1]=P(T.red,o.DEFAULT_ANSI_COLORS[1]),A.ansi[2]=P(T.green,o.DEFAULT_ANSI_COLORS[2]),A.ansi[3]=P(T.yellow,o.DEFAULT_ANSI_COLORS[3]),A.ansi[4]=P(T.blue,o.DEFAULT_ANSI_COLORS[4]),A.ansi[5]=P(T.magenta,o.DEFAULT_ANSI_COLORS[5]),A.ansi[6]=P(T.cyan,o.DEFAULT_ANSI_COLORS[6]),A.ansi[7]=P(T.white,o.DEFAULT_ANSI_COLORS[7]),A.ansi[8]=P(T.brightBlack,o.DEFAULT_ANSI_COLORS[8]),A.ansi[9]=P(T.brightRed,o.DEFAULT_ANSI_COLORS[9]),A.ansi[10]=P(T.brightGreen,o.DEFAULT_ANSI_COLORS[10]),A.ansi[11]=P(T.brightYellow,o.DEFAULT_ANSI_COLORS[11]),A.ansi[12]=P(T.brightBlue,o.DEFAULT_ANSI_COLORS[12]),A.ansi[13]=P(T.brightMagenta,o.DEFAULT_ANSI_COLORS[13]),A.ansi[14]=P(T.brightCyan,o.DEFAULT_ANSI_COLORS[14]),A.ansi[15]=P(T.brightWhite,o.DEFAULT_ANSI_COLORS[15]),T.extendedAnsi){const D=Math.min(A.ansi.length-16,T.extendedAnsi.length);for(let I=0;I<D;I++)A.ansi[I+16]=P(T.extendedAnsi[I],o.DEFAULT_ANSI_COLORS[I+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(T){this._restoreColor(T),this._onChangeColors.fire(this.colors)}_restoreColor(T){if(T!==void 0)switch(T){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[T]=this._restoreColors.ansi[T]}else for(let A=0;A<this._restoreColors.ansi.length;++A)this._colors.ansi[A]=this._restoreColors.ansi[A]}modifyColors(T){T(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function P(T,A){if(T!==void 0)try{return g.css.toColor(T)}catch{}return A}o.ThemeService=E=u([f(0,S.IOptionsService)],E)},6349:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CircularList=void 0;const u=h(8460),f=h(844);class d extends f.Disposable{constructor(_){super(),this._maxLength=_,this.onDeleteEmitter=this.register(new u.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new u.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new u.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(_){if(this._maxLength===_)return;const k=new Array(_);for(let S=0;S<Math.min(_,this.length);S++)k[S]=this._array[this._getCyclicIndex(S)];this._array=k,this._maxLength=_,this._startIndex=0}get length(){return this._length}set length(_){if(_>this._length)for(let k=this._length;k<_;k++)this._array[k]=void 0;this._length=_}get(_){return this._array[this._getCyclicIndex(_)]}set(_,k){this._array[this._getCyclicIndex(_)]=k}push(_){this._array[this._getCyclicIndex(this._length)]=_,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(_,k,...S){if(k){for(let m=_;m<this._length-k;m++)this._array[this._getCyclicIndex(m)]=this._array[this._getCyclicIndex(m+k)];this._length-=k,this.onDeleteEmitter.fire({index:_,amount:k})}for(let m=this._length-1;m>=_;m--)this._array[this._getCyclicIndex(m+S.length)]=this._array[this._getCyclicIndex(m)];for(let m=0;m<S.length;m++)this._array[this._getCyclicIndex(_+m)]=S[m];if(S.length&&this.onInsertEmitter.fire({index:_,amount:S.length}),this._length+S.length>this._maxLength){const m=this._length+S.length-this._maxLength;this._startIndex+=m,this._length=this._maxLength,this.onTrimEmitter.fire(m)}else this._length+=S.length}trimStart(_){_>this._length&&(_=this._length),this._startIndex+=_,this._length-=_,this.onTrimEmitter.fire(_)}shiftElements(_,k,S){if(!(k<=0)){if(_<0||_>=this._length)throw new Error("start argument out of range");if(_+S<0)throw new Error("Cannot shift elements in list beyond index 0");if(S>0){for(let x=k-1;x>=0;x--)this.set(_+x+S,this.get(_+x));const m=_+k+S-this._length;if(m>0)for(this._length+=m;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let m=0;m<k;m++)this.set(_+m+S,this.get(_+m))}}_getCyclicIndex(_){return(this._startIndex+_)%this._maxLength}}o.CircularList=d},1439:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.clone=void 0,o.clone=function h(u,f=5){if(typeof u!="object")return u;const d=Array.isArray(u)?[]:{};for(const g in u)d[g]=f<=1?u[g]:u[g]&&h(u[g],f-1);return d}},8055:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.contrastRatio=o.toPaddedHex=o.rgba=o.rgb=o.css=o.color=o.channels=o.NULL_COLOR=void 0;let h=0,u=0,f=0,d=0;var g,_,k,S,m;function x(b){const C=b.toString(16);return C.length<2?"0"+C:C}function v(b,C){return b<C?(C+.05)/(b+.05):(b+.05)/(C+.05)}o.NULL_COLOR={css:"#00000000",rgba:0},(function(b){b.toCss=function(C,E,P,T){return T!==void 0?`#${x(C)}${x(E)}${x(P)}${x(T)}`:`#${x(C)}${x(E)}${x(P)}`},b.toRgba=function(C,E,P,T=255){return(C<<24|E<<16|P<<8|T)>>>0},b.toColor=function(C,E,P,T){return{css:b.toCss(C,E,P,T),rgba:b.toRgba(C,E,P,T)}}})(g||(o.channels=g={})),(function(b){function C(E,P){return d=Math.round(255*P),[h,u,f]=m.toChannels(E.rgba),{css:g.toCss(h,u,f,d),rgba:g.toRgba(h,u,f,d)}}b.blend=function(E,P){if(d=(255&P.rgba)/255,d===1)return{css:P.css,rgba:P.rgba};const T=P.rgba>>24&255,A=P.rgba>>16&255,D=P.rgba>>8&255,I=E.rgba>>24&255,O=E.rgba>>16&255,z=E.rgba>>8&255;return h=I+Math.round((T-I)*d),u=O+Math.round((A-O)*d),f=z+Math.round((D-z)*d),{css:g.toCss(h,u,f),rgba:g.toRgba(h,u,f)}},b.isOpaque=function(E){return(255&E.rgba)==255},b.ensureContrastRatio=function(E,P,T){const A=m.ensureContrastRatio(E.rgba,P.rgba,T);if(A)return g.toColor(A>>24&255,A>>16&255,A>>8&255)},b.opaque=function(E){const P=(255|E.rgba)>>>0;return[h,u,f]=m.toChannels(P),{css:g.toCss(h,u,f),rgba:P}},b.opacity=C,b.multiplyOpacity=function(E,P){return d=255&E.rgba,C(E,d*P/255)},b.toColorRGB=function(E){return[E.rgba>>24&255,E.rgba>>16&255,E.rgba>>8&255]}})(_||(o.color=_={})),(function(b){let C,E;try{const P=document.createElement("canvas");P.width=1,P.height=1;const T=P.getContext("2d",{willReadFrequently:!0});T&&(C=T,C.globalCompositeOperation="copy",E=C.createLinearGradient(0,0,1,1))}catch{}b.toColor=function(P){if(P.match(/#[\da-f]{3,8}/i))switch(P.length){case 4:return h=parseInt(P.slice(1,2).repeat(2),16),u=parseInt(P.slice(2,3).repeat(2),16),f=parseInt(P.slice(3,4).repeat(2),16),g.toColor(h,u,f);case 5:return h=parseInt(P.slice(1,2).repeat(2),16),u=parseInt(P.slice(2,3).repeat(2),16),f=parseInt(P.slice(3,4).repeat(2),16),d=parseInt(P.slice(4,5).repeat(2),16),g.toColor(h,u,f,d);case 7:return{css:P,rgba:(parseInt(P.slice(1),16)<<8|255)>>>0};case 9:return{css:P,rgba:parseInt(P.slice(1),16)>>>0}}const T=P.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(T)return h=parseInt(T[1]),u=parseInt(T[2]),f=parseInt(T[3]),d=Math.round(255*(T[5]===void 0?1:parseFloat(T[5]))),g.toColor(h,u,f,d);if(!C||!E)throw new Error("css.toColor: Unsupported css format");if(C.fillStyle=E,C.fillStyle=P,typeof C.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(C.fillRect(0,0,1,1),[h,u,f,d]=C.getImageData(0,0,1,1).data,d!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:g.toRgba(h,u,f,d),css:P}}})(k||(o.css=k={})),(function(b){function C(E,P,T){const A=E/255,D=P/255,I=T/255;return .2126*(A<=.03928?A/12.92:Math.pow((A+.055)/1.055,2.4))+.7152*(D<=.03928?D/12.92:Math.pow((D+.055)/1.055,2.4))+.0722*(I<=.03928?I/12.92:Math.pow((I+.055)/1.055,2.4))}b.relativeLuminance=function(E){return C(E>>16&255,E>>8&255,255&E)},b.relativeLuminance2=C})(S||(o.rgb=S={})),(function(b){function C(P,T,A){const D=P>>24&255,I=P>>16&255,O=P>>8&255;let z=T>>24&255,U=T>>16&255,K=T>>8&255,ie=v(S.relativeLuminance2(z,U,K),S.relativeLuminance2(D,I,O));for(;ie<A&&(z>0||U>0||K>0);)z-=Math.max(0,Math.ceil(.1*z)),U-=Math.max(0,Math.ceil(.1*U)),K-=Math.max(0,Math.ceil(.1*K)),ie=v(S.relativeLuminance2(z,U,K),S.relativeLuminance2(D,I,O));return(z<<24|U<<16|K<<8|255)>>>0}function E(P,T,A){const D=P>>24&255,I=P>>16&255,O=P>>8&255;let z=T>>24&255,U=T>>16&255,K=T>>8&255,ie=v(S.relativeLuminance2(z,U,K),S.relativeLuminance2(D,I,O));for(;ie<A&&(z<255||U<255||K<255);)z=Math.min(255,z+Math.ceil(.1*(255-z))),U=Math.min(255,U+Math.ceil(.1*(255-U))),K=Math.min(255,K+Math.ceil(.1*(255-K))),ie=v(S.relativeLuminance2(z,U,K),S.relativeLuminance2(D,I,O));return(z<<24|U<<16|K<<8|255)>>>0}b.blend=function(P,T){if(d=(255&T)/255,d===1)return T;const A=T>>24&255,D=T>>16&255,I=T>>8&255,O=P>>24&255,z=P>>16&255,U=P>>8&255;return h=O+Math.round((A-O)*d),u=z+Math.round((D-z)*d),f=U+Math.round((I-U)*d),g.toRgba(h,u,f)},b.ensureContrastRatio=function(P,T,A){const D=S.relativeLuminance(P>>8),I=S.relativeLuminance(T>>8);if(v(D,I)<A){if(I<D){const U=C(P,T,A),K=v(D,S.relativeLuminance(U>>8));if(K<A){const ie=E(P,T,A);return K>v(D,S.relativeLuminance(ie>>8))?U:ie}return U}const O=E(P,T,A),z=v(D,S.relativeLuminance(O>>8));if(z<A){const U=C(P,T,A);return z>v(D,S.relativeLuminance(U>>8))?O:U}return O}},b.reduceLuminance=C,b.increaseLuminance=E,b.toChannels=function(P){return[P>>24&255,P>>16&255,P>>8&255,255&P]}})(m||(o.rgba=m={})),o.toPaddedHex=x,o.contrastRatio=v},8969:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CoreTerminal=void 0;const u=h(844),f=h(2585),d=h(4348),g=h(7866),_=h(744),k=h(7302),S=h(6975),m=h(8460),x=h(1753),v=h(1480),b=h(7994),C=h(9282),E=h(5435),P=h(5981),T=h(2660);let A=!1;class D extends u.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new m.EventEmitter),this._onScroll.event((O=>{var z;(z=this._onScrollApi)==null||z.fire(O.position)}))),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(O){for(const z in O)this.optionsService.options[z]=O[z]}constructor(O){super(),this._windowsWrappingHeuristics=this.register(new u.MutableDisposable),this._onBinary=this.register(new m.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new m.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new m.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new m.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new m.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new m.EventEmitter),this._instantiationService=new d.InstantiationService,this.optionsService=this.register(new k.OptionsService(O)),this._instantiationService.setService(f.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(_.BufferService)),this._instantiationService.setService(f.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(g.LogService)),this._instantiationService.setService(f.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(S.CoreService)),this._instantiationService.setService(f.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(x.CoreMouseService)),this._instantiationService.setService(f.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(v.UnicodeService)),this._instantiationService.setService(f.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(b.CharsetService),this._instantiationService.setService(f.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(T.OscLinkService),this._instantiationService.setService(f.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new E.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,m.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,m.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,m.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,m.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((z=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((z=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new P.WriteBuffer(((z,U)=>this._inputHandler.parse(z,U)))),this.register((0,m.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(O,z){this._writeBuffer.write(O,z)}writeSync(O,z){this._logService.logLevel<=f.LogLevelEnum.WARN&&!A&&(this._logService.warn("writeSync is unreliable and will be removed soon."),A=!0),this._writeBuffer.writeSync(O,z)}input(O,z=!0){this.coreService.triggerDataEvent(O,z)}resize(O,z){isNaN(O)||isNaN(z)||(O=Math.max(O,_.MINIMUM_COLS),z=Math.max(z,_.MINIMUM_ROWS),this._bufferService.resize(O,z))}scroll(O,z=!1){this._bufferService.scroll(O,z)}scrollLines(O,z,U){this._bufferService.scrollLines(O,z,U)}scrollPages(O){this.scrollLines(O*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(O){const z=O-this._bufferService.buffer.ydisp;z!==0&&this.scrollLines(z)}registerEscHandler(O,z){return this._inputHandler.registerEscHandler(O,z)}registerDcsHandler(O,z){return this._inputHandler.registerDcsHandler(O,z)}registerCsiHandler(O,z){return this._inputHandler.registerCsiHandler(O,z)}registerOscHandler(O,z){return this._inputHandler.registerOscHandler(O,z)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let O=!1;const z=this.optionsService.rawOptions.windowsPty;z&&z.buildNumber!==void 0&&z.buildNumber!==void 0?O=z.backend==="conpty"&&z.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(O=!0),O?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const O=[];O.push(this.onLineFeed(C.updateWindowsModeWrappedState.bind(null,this._bufferService))),O.push(this.registerCsiHandler({final:"H"},(()=>((0,C.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,u.toDisposable)((()=>{for(const z of O)z.dispose()}))}}}o.CoreTerminal=D},8460:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.runAndSubscribe=o.forwardEvent=o.EventEmitter=void 0,o.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=h=>(this._listeners.push(h),{dispose:()=>{if(!this._disposed){for(let u=0;u<this._listeners.length;u++)if(this._listeners[u]===h)return void this._listeners.splice(u,1)}}})),this._event}fire(h,u){const f=[];for(let d=0;d<this._listeners.length;d++)f.push(this._listeners[d]);for(let d=0;d<f.length;d++)f[d].call(void 0,h,u)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},o.forwardEvent=function(h,u){return h((f=>u.fire(f)))},o.runAndSubscribe=function(h,u){return u(void 0),h((f=>u(f)))}},5435:function(c,o,h){var u=this&&this.__decorate||function(Y,L,F,B){var $,Z=arguments.length,oe=Z<3?L:B===null?B=Object.getOwnPropertyDescriptor(L,F):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")oe=Reflect.decorate(Y,L,F,B);else for(var he=Y.length-1;he>=0;he--)($=Y[he])&&(oe=(Z<3?$(oe):Z>3?$(L,F,oe):$(L,F))||oe);return Z>3&&oe&&Object.defineProperty(L,F,oe),oe},f=this&&this.__param||function(Y,L){return function(F,B){L(F,B,Y)}};Object.defineProperty(o,"__esModule",{value:!0}),o.InputHandler=o.WindowsOptionsReportType=void 0;const d=h(2584),g=h(7116),_=h(2015),k=h(844),S=h(482),m=h(8437),x=h(8460),v=h(643),b=h(511),C=h(3734),E=h(2585),P=h(1480),T=h(6242),A=h(6351),D=h(5941),I={"(":0,")":1,"*":2,"+":3,"-":1,".":2},O=131072;function z(Y,L){if(Y>24)return L.setWinLines||!1;switch(Y){case 1:return!!L.restoreWin;case 2:return!!L.minimizeWin;case 3:return!!L.setWinPosition;case 4:return!!L.setWinSizePixels;case 5:return!!L.raiseWin;case 6:return!!L.lowerWin;case 7:return!!L.refreshWin;case 8:return!!L.setWinSizeChars;case 9:return!!L.maximizeWin;case 10:return!!L.fullscreenWin;case 11:return!!L.getWinState;case 13:return!!L.getWinPosition;case 14:return!!L.getWinSizePixels;case 15:return!!L.getScreenSizePixels;case 16:return!!L.getCellSizePixels;case 18:return!!L.getWinSizeChars;case 19:return!!L.getScreenSizeChars;case 20:return!!L.getIconTitle;case 21:return!!L.getWinTitle;case 22:return!!L.pushTitle;case 23:return!!L.popTitle;case 24:return!!L.setWinLines}return!1}var U;(function(Y){Y[Y.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",Y[Y.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(U||(o.WindowsOptionsReportType=U={}));let K=0;class ie extends k.Disposable{getAttrData(){return this._curAttrData}constructor(L,F,B,$,Z,oe,he,ae,V=new _.EscapeSequenceParser){super(),this._bufferService=L,this._charsetService=F,this._coreService=B,this._logService=$,this._optionsService=Z,this._oscLinkService=oe,this._coreMouseService=he,this._unicodeService=ae,this._parser=V,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new S.StringToUtf32,this._utf8Decoder=new S.Utf8ToUtf32,this._workCell=new b.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=m.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=m.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new x.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new x.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new x.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new x.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new x.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new x.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new x.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new x.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new x.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new x.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new x.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new x.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new x.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new Q(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((N=>this._activeBuffer=N.activeBuffer))),this._parser.setCsiHandlerFallback(((N,ne)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(N),params:ne.toArray()})})),this._parser.setEscHandlerFallback((N=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(N)})})),this._parser.setExecuteHandlerFallback((N=>{this._logService.debug("Unknown EXECUTE code: ",{code:N})})),this._parser.setOscHandlerFallback(((N,ne,se)=>{this._logService.debug("Unknown OSC code: ",{identifier:N,action:ne,data:se})})),this._parser.setDcsHandlerFallback(((N,ne,se)=>{ne==="HOOK"&&(se=se.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(N),action:ne,payload:se})})),this._parser.setPrintHandler(((N,ne,se)=>this.print(N,ne,se))),this._parser.registerCsiHandler({final:"@"},(N=>this.insertChars(N))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(N=>this.scrollLeft(N))),this._parser.registerCsiHandler({final:"A"},(N=>this.cursorUp(N))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(N=>this.scrollRight(N))),this._parser.registerCsiHandler({final:"B"},(N=>this.cursorDown(N))),this._parser.registerCsiHandler({final:"C"},(N=>this.cursorForward(N))),this._parser.registerCsiHandler({final:"D"},(N=>this.cursorBackward(N))),this._parser.registerCsiHandler({final:"E"},(N=>this.cursorNextLine(N))),this._parser.registerCsiHandler({final:"F"},(N=>this.cursorPrecedingLine(N))),this._parser.registerCsiHandler({final:"G"},(N=>this.cursorCharAbsolute(N))),this._parser.registerCsiHandler({final:"H"},(N=>this.cursorPosition(N))),this._parser.registerCsiHandler({final:"I"},(N=>this.cursorForwardTab(N))),this._parser.registerCsiHandler({final:"J"},(N=>this.eraseInDisplay(N,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(N=>this.eraseInDisplay(N,!0))),this._parser.registerCsiHandler({final:"K"},(N=>this.eraseInLine(N,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(N=>this.eraseInLine(N,!0))),this._parser.registerCsiHandler({final:"L"},(N=>this.insertLines(N))),this._parser.registerCsiHandler({final:"M"},(N=>this.deleteLines(N))),this._parser.registerCsiHandler({final:"P"},(N=>this.deleteChars(N))),this._parser.registerCsiHandler({final:"S"},(N=>this.scrollUp(N))),this._parser.registerCsiHandler({final:"T"},(N=>this.scrollDown(N))),this._parser.registerCsiHandler({final:"X"},(N=>this.eraseChars(N))),this._parser.registerCsiHandler({final:"Z"},(N=>this.cursorBackwardTab(N))),this._parser.registerCsiHandler({final:"`"},(N=>this.charPosAbsolute(N))),this._parser.registerCsiHandler({final:"a"},(N=>this.hPositionRelative(N))),this._parser.registerCsiHandler({final:"b"},(N=>this.repeatPrecedingCharacter(N))),this._parser.registerCsiHandler({final:"c"},(N=>this.sendDeviceAttributesPrimary(N))),this._parser.registerCsiHandler({prefix:">",final:"c"},(N=>this.sendDeviceAttributesSecondary(N))),this._parser.registerCsiHandler({final:"d"},(N=>this.linePosAbsolute(N))),this._parser.registerCsiHandler({final:"e"},(N=>this.vPositionRelative(N))),this._parser.registerCsiHandler({final:"f"},(N=>this.hVPosition(N))),this._parser.registerCsiHandler({final:"g"},(N=>this.tabClear(N))),this._parser.registerCsiHandler({final:"h"},(N=>this.setMode(N))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(N=>this.setModePrivate(N))),this._parser.registerCsiHandler({final:"l"},(N=>this.resetMode(N))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(N=>this.resetModePrivate(N))),this._parser.registerCsiHandler({final:"m"},(N=>this.charAttributes(N))),this._parser.registerCsiHandler({final:"n"},(N=>this.deviceStatus(N))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(N=>this.deviceStatusPrivate(N))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(N=>this.softReset(N))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(N=>this.setCursorStyle(N))),this._parser.registerCsiHandler({final:"r"},(N=>this.setScrollRegion(N))),this._parser.registerCsiHandler({final:"s"},(N=>this.saveCursor(N))),this._parser.registerCsiHandler({final:"t"},(N=>this.windowOptions(N))),this._parser.registerCsiHandler({final:"u"},(N=>this.restoreCursor(N))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(N=>this.insertColumns(N))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(N=>this.deleteColumns(N))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(N=>this.selectProtected(N))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(N=>this.requestMode(N,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(N=>this.requestMode(N,!1))),this._parser.setExecuteHandler(d.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(d.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(d.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(d.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(d.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(d.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(d.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(d.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(d.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(d.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(d.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(d.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new T.OscHandler((N=>(this.setTitle(N),this.setIconName(N),!0)))),this._parser.registerOscHandler(1,new T.OscHandler((N=>this.setIconName(N)))),this._parser.registerOscHandler(2,new T.OscHandler((N=>this.setTitle(N)))),this._parser.registerOscHandler(4,new T.OscHandler((N=>this.setOrReportIndexedColor(N)))),this._parser.registerOscHandler(8,new T.OscHandler((N=>this.setHyperlink(N)))),this._parser.registerOscHandler(10,new T.OscHandler((N=>this.setOrReportFgColor(N)))),this._parser.registerOscHandler(11,new T.OscHandler((N=>this.setOrReportBgColor(N)))),this._parser.registerOscHandler(12,new T.OscHandler((N=>this.setOrReportCursorColor(N)))),this._parser.registerOscHandler(104,new T.OscHandler((N=>this.restoreIndexedColor(N)))),this._parser.registerOscHandler(110,new T.OscHandler((N=>this.restoreFgColor(N)))),this._parser.registerOscHandler(111,new T.OscHandler((N=>this.restoreBgColor(N)))),this._parser.registerOscHandler(112,new T.OscHandler((N=>this.restoreCursorColor(N)))),this._parser.registerEscHandler({final:"7"},(()=>this.saveCursor())),this._parser.registerEscHandler({final:"8"},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:"D"},(()=>this.index())),this._parser.registerEscHandler({final:"E"},(()=>this.nextLine())),this._parser.registerEscHandler({final:"H"},(()=>this.tabSet())),this._parser.registerEscHandler({final:"M"},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:"="},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:">"},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:"c"},(()=>this.fullReset())),this._parser.registerEscHandler({final:"n"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"o"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"|"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"}"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"~"},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:"%",final:"@"},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:"%",final:"G"},(()=>this.selectDefaultCharset()));for(const N in g.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:N},(()=>this.selectCharset("("+N))),this._parser.registerEscHandler({intermediates:")",final:N},(()=>this.selectCharset(")"+N))),this._parser.registerEscHandler({intermediates:"*",final:N},(()=>this.selectCharset("*"+N))),this._parser.registerEscHandler({intermediates:"+",final:N},(()=>this.selectCharset("+"+N))),this._parser.registerEscHandler({intermediates:"-",final:N},(()=>this.selectCharset("-"+N))),this._parser.registerEscHandler({intermediates:".",final:N},(()=>this.selectCharset("."+N))),this._parser.registerEscHandler({intermediates:"/",final:N},(()=>this.selectCharset("/"+N)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((N=>(this._logService.error("Parsing error: ",N),N))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new A.DcsHandler(((N,ne)=>this.requestStatusString(N,ne))))}_preserveStack(L,F,B,$){this._parseStack.paused=!0,this._parseStack.cursorStartX=L,this._parseStack.cursorStartY=F,this._parseStack.decodedLength=B,this._parseStack.position=$}_logSlowResolvingAsync(L){this._logService.logLevel<=E.LogLevelEnum.WARN&&Promise.race([L,new Promise(((F,B)=>setTimeout((()=>B("#SLOW_TIMEOUT")),5e3)))]).catch((F=>{if(F!=="#SLOW_TIMEOUT")throw F;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(L,F){let B,$=this._activeBuffer.x,Z=this._activeBuffer.y,oe=0;const he=this._parseStack.paused;if(he){if(B=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,F))return this._logSlowResolvingAsync(B),B;$=this._parseStack.cursorStartX,Z=this._parseStack.cursorStartY,this._parseStack.paused=!1,L.length>O&&(oe=this._parseStack.position+O)}if(this._logService.logLevel<=E.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof L=="string"?` "${L}"`:` "${Array.prototype.map.call(L,(N=>String.fromCharCode(N))).join("")}"`),typeof L=="string"?L.split("").map((N=>N.charCodeAt(0))):L),this._parseBuffer.length<L.length&&this._parseBuffer.length<O&&(this._parseBuffer=new Uint32Array(Math.min(L.length,O))),he||this._dirtyRowTracker.clearRange(),L.length>O)for(let N=oe;N<L.length;N+=O){const ne=N+O<L.length?N+O:L.length,se=typeof L=="string"?this._stringDecoder.decode(L.substring(N,ne),this._parseBuffer):this._utf8Decoder.decode(L.subarray(N,ne),this._parseBuffer);if(B=this._parser.parse(this._parseBuffer,se))return this._preserveStack($,Z,se,N),this._logSlowResolvingAsync(B),B}else if(!he){const N=typeof L=="string"?this._stringDecoder.decode(L,this._parseBuffer):this._utf8Decoder.decode(L,this._parseBuffer);if(B=this._parser.parse(this._parseBuffer,N))return this._preserveStack($,Z,N,0),this._logSlowResolvingAsync(B),B}this._activeBuffer.x===$&&this._activeBuffer.y===Z||this._onCursorMove.fire();const ae=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),V=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);V<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(V,this._bufferService.rows-1),Math.min(ae,this._bufferService.rows-1))}print(L,F,B){let $,Z;const oe=this._charsetService.charset,he=this._optionsService.rawOptions.screenReaderMode,ae=this._bufferService.cols,V=this._coreService.decPrivateModes.wraparound,N=this._coreService.modes.insertMode,ne=this._curAttrData;let se=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&B-F>0&&se.getWidth(this._activeBuffer.x-1)===2&&se.setCellFromCodepoint(this._activeBuffer.x-1,0,1,ne);let pe=this._parser.precedingJoinState;for(let fe=F;fe<B;++fe){if($=L[fe],$<127&&oe){const mt=oe[String.fromCharCode($)];mt&&($=mt.charCodeAt(0))}const Ae=this._unicodeService.charProperties($,pe);Z=P.UnicodeService.extractWidth(Ae);const Oe=P.UnicodeService.extractShouldJoin(Ae),$e=Oe?P.UnicodeService.extractWidth(pe):0;if(pe=Ae,he&&this._onA11yChar.fire((0,S.stringFromCodePoint)($)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+Z-$e>ae){if(V){const mt=se;let Pe=this._activeBuffer.x-$e;for(this._activeBuffer.x=$e,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),se=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),$e>0&&se instanceof m.BufferLine&&se.copyCellsFrom(mt,Pe,0,$e,!1);Pe<ae;)mt.setCellFromCodepoint(Pe++,0,1,ne)}else if(this._activeBuffer.x=ae-1,Z===2)continue}if(Oe&&this._activeBuffer.x){const mt=se.getWidth(this._activeBuffer.x-1)?1:2;se.addCodepointToCell(this._activeBuffer.x-mt,$,Z);for(let Pe=Z-$e;--Pe>=0;)se.setCellFromCodepoint(this._activeBuffer.x++,0,0,ne)}else if(N&&(se.insertCells(this._activeBuffer.x,Z-$e,this._activeBuffer.getNullCell(ne)),se.getWidth(ae-1)===2&&se.setCellFromCodepoint(ae-1,v.NULL_CELL_CODE,v.NULL_CELL_WIDTH,ne)),se.setCellFromCodepoint(this._activeBuffer.x++,$,Z,ne),Z>0)for(;--Z;)se.setCellFromCodepoint(this._activeBuffer.x++,0,0,ne)}this._parser.precedingJoinState=pe,this._activeBuffer.x<ae&&B-F>0&&se.getWidth(this._activeBuffer.x)===0&&!se.hasContent(this._activeBuffer.x)&&se.setCellFromCodepoint(this._activeBuffer.x,0,1,ne),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(L,F){return L.final!=="t"||L.prefix||L.intermediates?this._parser.registerCsiHandler(L,F):this._parser.registerCsiHandler(L,(B=>!z(B.params[0],this._optionsService.rawOptions.windowOptions)||F(B)))}registerDcsHandler(L,F){return this._parser.registerDcsHandler(L,new A.DcsHandler(F))}registerEscHandler(L,F){return this._parser.registerEscHandler(L,F)}registerOscHandler(L,F){return this._parser.registerOscHandler(L,new T.OscHandler(F))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var L;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&L.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const F=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);F.hasWidth(this._activeBuffer.x)&&!F.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const L=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-L),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(L=this._bufferService.cols-1){this._activeBuffer.x=Math.min(L,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(L,F){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=L,this._activeBuffer.y=this._activeBuffer.scrollTop+F):(this._activeBuffer.x=L,this._activeBuffer.y=F),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(L,F){this._restrictCursor(),this._setCursor(this._activeBuffer.x+L,this._activeBuffer.y+F)}cursorUp(L){const F=this._activeBuffer.y-this._activeBuffer.scrollTop;return F>=0?this._moveCursor(0,-Math.min(F,L.params[0]||1)):this._moveCursor(0,-(L.params[0]||1)),!0}cursorDown(L){const F=this._activeBuffer.scrollBottom-this._activeBuffer.y;return F>=0?this._moveCursor(0,Math.min(F,L.params[0]||1)):this._moveCursor(0,L.params[0]||1),!0}cursorForward(L){return this._moveCursor(L.params[0]||1,0),!0}cursorBackward(L){return this._moveCursor(-(L.params[0]||1),0),!0}cursorNextLine(L){return this.cursorDown(L),this._activeBuffer.x=0,!0}cursorPrecedingLine(L){return this.cursorUp(L),this._activeBuffer.x=0,!0}cursorCharAbsolute(L){return this._setCursor((L.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(L){return this._setCursor(L.length>=2?(L.params[1]||1)-1:0,(L.params[0]||1)-1),!0}charPosAbsolute(L){return this._setCursor((L.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(L){return this._moveCursor(L.params[0]||1,0),!0}linePosAbsolute(L){return this._setCursor(this._activeBuffer.x,(L.params[0]||1)-1),!0}vPositionRelative(L){return this._moveCursor(0,L.params[0]||1),!0}hVPosition(L){return this.cursorPosition(L),!0}tabClear(L){const F=L.params[0];return F===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:F===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(L){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let F=L.params[0]||1;for(;F--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(L){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let F=L.params[0]||1;for(;F--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(L){const F=L.params[0];return F===1&&(this._curAttrData.bg|=536870912),F!==2&&F!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(L,F,B,$=!1,Z=!1){const oe=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);oe.replaceCells(F,B,this._activeBuffer.getNullCell(this._eraseAttrData()),Z),$&&(oe.isWrapped=!1)}_resetBufferLine(L,F=!1){const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);B&&(B.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),F),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+L),B.isWrapped=!1)}eraseInDisplay(L,F=!1){let B;switch(this._restrictCursor(this._bufferService.cols),L.params[0]){case 0:for(B=this._activeBuffer.y,this._dirtyRowTracker.markDirty(B),this._eraseInBufferLine(B++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,F);B<this._bufferService.rows;B++)this._resetBufferLine(B,F);this._dirtyRowTracker.markDirty(B);break;case 1:for(B=this._activeBuffer.y,this._dirtyRowTracker.markDirty(B),this._eraseInBufferLine(B,0,this._activeBuffer.x+1,!0,F),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(B+1).isWrapped=!1);B--;)this._resetBufferLine(B,F);this._dirtyRowTracker.markDirty(0);break;case 2:for(B=this._bufferService.rows,this._dirtyRowTracker.markDirty(B-1);B--;)this._resetBufferLine(B,F);this._dirtyRowTracker.markDirty(0);break;case 3:const $=this._activeBuffer.lines.length-this._bufferService.rows;$>0&&(this._activeBuffer.lines.trimStart($),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-$,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-$,0),this._onScroll.fire(0))}return!0}eraseInLine(L,F=!1){switch(this._restrictCursor(this._bufferService.cols),L.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,F);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,F);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,F)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(L){this._restrictCursor();let F=L.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=this._activeBuffer.ybase+this._activeBuffer.y,$=this._bufferService.rows-1-this._activeBuffer.scrollBottom,Z=this._bufferService.rows-1+this._activeBuffer.ybase-$+1;for(;F--;)this._activeBuffer.lines.splice(Z-1,1),this._activeBuffer.lines.splice(B,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(L){this._restrictCursor();let F=L.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=this._activeBuffer.ybase+this._activeBuffer.y;let $;for($=this._bufferService.rows-1-this._activeBuffer.scrollBottom,$=this._bufferService.rows-1+this._activeBuffer.ybase-$;F--;)this._activeBuffer.lines.splice(B,1),this._activeBuffer.lines.splice($,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(L){this._restrictCursor();const F=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return F&&(F.insertCells(this._activeBuffer.x,L.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(L){this._restrictCursor();const F=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return F&&(F.deleteCells(this._activeBuffer.x,L.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(L){let F=L.params[0]||1;for(;F--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(L){let F=L.params[0]||1;for(;F--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(m.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(L){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const F=L.params[0]||1;for(let B=this._activeBuffer.scrollTop;B<=this._activeBuffer.scrollBottom;++B){const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);$.deleteCells(0,F,this._activeBuffer.getNullCell(this._eraseAttrData())),$.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(L){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const F=L.params[0]||1;for(let B=this._activeBuffer.scrollTop;B<=this._activeBuffer.scrollBottom;++B){const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);$.insertCells(0,F,this._activeBuffer.getNullCell(this._eraseAttrData())),$.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(L){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const F=L.params[0]||1;for(let B=this._activeBuffer.scrollTop;B<=this._activeBuffer.scrollBottom;++B){const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);$.insertCells(this._activeBuffer.x,F,this._activeBuffer.getNullCell(this._eraseAttrData())),$.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(L){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const F=L.params[0]||1;for(let B=this._activeBuffer.scrollTop;B<=this._activeBuffer.scrollBottom;++B){const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);$.deleteCells(this._activeBuffer.x,F,this._activeBuffer.getNullCell(this._eraseAttrData())),$.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(L){this._restrictCursor();const F=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return F&&(F.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(L.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(L){const F=this._parser.precedingJoinState;if(!F)return!0;const B=L.params[0]||1,$=P.UnicodeService.extractWidth(F),Z=this._activeBuffer.x-$,oe=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(Z),he=new Uint32Array(oe.length*B);let ae=0;for(let N=0;N<oe.length;){const ne=oe.codePointAt(N)||0;he[ae++]=ne,N+=ne>65535?2:1}let V=ae;for(let N=1;N<B;++N)he.copyWithin(V,0,ae),V+=ae;return this.print(he,0,V),!0}sendDeviceAttributesPrimary(L){return L.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(d.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(d.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(L){return L.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(d.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(d.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(L.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(d.C0.ESC+"[>83;40003;0c")),!0}_is(L){return(this._optionsService.rawOptions.termName+"").indexOf(L)===0}setMode(L){for(let F=0;F<L.length;F++)switch(L.params[F]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(L){for(let F=0;F<L.length;F++)switch(L.params[F]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,g.DEFAULT_CHARSET),this._charsetService.setgCharset(1,g.DEFAULT_CHARSET),this._charsetService.setgCharset(2,g.DEFAULT_CHARSET),this._charsetService.setgCharset(3,g.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(L){for(let F=0;F<L.length;F++)switch(L.params[F]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(L){for(let F=0;F<L.length;F++)switch(L.params[F]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),L.params[F]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(L,F){const B=this._coreService.decPrivateModes,{activeProtocol:$,activeEncoding:Z}=this._coreMouseService,oe=this._coreService,{buffers:he,cols:ae}=this._bufferService,{active:V,alt:N}=he,ne=this._optionsService.rawOptions,se=Oe=>Oe?1:2,pe=L.params[0];return fe=pe,Ae=F?pe===2?4:pe===4?se(oe.modes.insertMode):pe===12?3:pe===20?se(ne.convertEol):0:pe===1?se(B.applicationCursorKeys):pe===3?ne.windowOptions.setWinLines?ae===80?2:ae===132?1:0:0:pe===6?se(B.origin):pe===7?se(B.wraparound):pe===8?3:pe===9?se($==="X10"):pe===12?se(ne.cursorBlink):pe===25?se(!oe.isCursorHidden):pe===45?se(B.reverseWraparound):pe===66?se(B.applicationKeypad):pe===67?4:pe===1e3?se($==="VT200"):pe===1002?se($==="DRAG"):pe===1003?se($==="ANY"):pe===1004?se(B.sendFocus):pe===1005?4:pe===1006?se(Z==="SGR"):pe===1015?4:pe===1016?se(Z==="SGR_PIXELS"):pe===1048?1:pe===47||pe===1047||pe===1049?se(V===N):pe===2004?se(B.bracketedPasteMode):0,oe.triggerDataEvent(`${d.C0.ESC}[${F?"":"?"}${fe};${Ae}$y`),!0;var fe,Ae}_updateAttrColor(L,F,B,$,Z){return F===2?(L|=50331648,L&=-16777216,L|=C.AttributeData.fromColorRGB([B,$,Z])):F===5&&(L&=-50331904,L|=33554432|255&B),L}_extractColor(L,F,B){const $=[0,0,-1,0,0,0];let Z=0,oe=0;do{if($[oe+Z]=L.params[F+oe],L.hasSubParams(F+oe)){const he=L.getSubParams(F+oe);let ae=0;do $[1]===5&&(Z=1),$[oe+ae+1+Z]=he[ae];while(++ae<he.length&&ae+oe+1+Z<$.length);break}if($[1]===5&&oe+Z>=2||$[1]===2&&oe+Z>=5)break;$[1]&&(Z=1)}while(++oe+F<L.length&&oe+Z<$.length);for(let he=2;he<$.length;++he)$[he]===-1&&($[he]=0);switch($[0]){case 38:B.fg=this._updateAttrColor(B.fg,$[1],$[3],$[4],$[5]);break;case 48:B.bg=this._updateAttrColor(B.bg,$[1],$[3],$[4],$[5]);break;case 58:B.extended=B.extended.clone(),B.extended.underlineColor=this._updateAttrColor(B.extended.underlineColor,$[1],$[3],$[4],$[5])}return oe}_processUnderline(L,F){F.extended=F.extended.clone(),(!~L||L>5)&&(L=1),F.extended.underlineStyle=L,F.fg|=268435456,L===0&&(F.fg&=-268435457),F.updateExtended()}_processSGR0(L){L.fg=m.DEFAULT_ATTR_DATA.fg,L.bg=m.DEFAULT_ATTR_DATA.bg,L.extended=L.extended.clone(),L.extended.underlineStyle=0,L.extended.underlineColor&=-67108864,L.updateExtended()}charAttributes(L){if(L.length===1&&L.params[0]===0)return this._processSGR0(this._curAttrData),!0;const F=L.length;let B;const $=this._curAttrData;for(let Z=0;Z<F;Z++)B=L.params[Z],B>=30&&B<=37?($.fg&=-50331904,$.fg|=16777216|B-30):B>=40&&B<=47?($.bg&=-50331904,$.bg|=16777216|B-40):B>=90&&B<=97?($.fg&=-50331904,$.fg|=16777224|B-90):B>=100&&B<=107?($.bg&=-50331904,$.bg|=16777224|B-100):B===0?this._processSGR0($):B===1?$.fg|=134217728:B===3?$.bg|=67108864:B===4?($.fg|=268435456,this._processUnderline(L.hasSubParams(Z)?L.getSubParams(Z)[0]:1,$)):B===5?$.fg|=536870912:B===7?$.fg|=67108864:B===8?$.fg|=1073741824:B===9?$.fg|=2147483648:B===2?$.bg|=134217728:B===21?this._processUnderline(2,$):B===22?($.fg&=-134217729,$.bg&=-134217729):B===23?$.bg&=-67108865:B===24?($.fg&=-268435457,this._processUnderline(0,$)):B===25?$.fg&=-536870913:B===27?$.fg&=-67108865:B===28?$.fg&=-1073741825:B===29?$.fg&=2147483647:B===39?($.fg&=-67108864,$.fg|=16777215&m.DEFAULT_ATTR_DATA.fg):B===49?($.bg&=-67108864,$.bg|=16777215&m.DEFAULT_ATTR_DATA.bg):B===38||B===48||B===58?Z+=this._extractColor(L,Z,$):B===53?$.bg|=1073741824:B===55?$.bg&=-1073741825:B===59?($.extended=$.extended.clone(),$.extended.underlineColor=-1,$.updateExtended()):B===100?($.fg&=-67108864,$.fg|=16777215&m.DEFAULT_ATTR_DATA.fg,$.bg&=-67108864,$.bg|=16777215&m.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",B);return!0}deviceStatus(L){switch(L.params[0]){case 5:this._coreService.triggerDataEvent(`${d.C0.ESC}[0n`);break;case 6:const F=this._activeBuffer.y+1,B=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${d.C0.ESC}[${F};${B}R`)}return!0}deviceStatusPrivate(L){if(L.params[0]===6){const F=this._activeBuffer.y+1,B=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${d.C0.ESC}[?${F};${B}R`)}return!0}softReset(L){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=m.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(L){const F=L.params[0]||1;switch(F){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const B=F%2==1;return this._optionsService.options.cursorBlink=B,!0}setScrollRegion(L){const F=L.params[0]||1;let B;return(L.length<2||(B=L.params[1])>this._bufferService.rows||B===0)&&(B=this._bufferService.rows),B>F&&(this._activeBuffer.scrollTop=F-1,this._activeBuffer.scrollBottom=B-1,this._setCursor(0,0)),!0}windowOptions(L){if(!z(L.params[0],this._optionsService.rawOptions.windowOptions))return!0;const F=L.length>1?L.params[1]:0;switch(L.params[0]){case 14:F!==2&&this._onRequestWindowsOptionsReport.fire(U.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(U.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${d.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:F!==0&&F!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),F!==0&&F!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:F!==0&&F!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),F!==0&&F!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(L){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(L){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(L){return this._windowTitle=L,this._onTitleChange.fire(L),!0}setIconName(L){return this._iconName=L,!0}setOrReportIndexedColor(L){const F=[],B=L.split(";");for(;B.length>1;){const $=B.shift(),Z=B.shift();if(/^\d+$/.exec($)){const oe=parseInt($);if(J(oe))if(Z==="?")F.push({type:0,index:oe});else{const he=(0,D.parseColor)(Z);he&&F.push({type:1,index:oe,color:he})}}}return F.length&&this._onColor.fire(F),!0}setHyperlink(L){const F=L.split(";");return!(F.length<2)&&(F[1]?this._createHyperlink(F[0],F[1]):!F[0]&&this._finishHyperlink())}_createHyperlink(L,F){this._getCurrentLinkId()&&this._finishHyperlink();const B=L.split(":");let $;const Z=B.findIndex((oe=>oe.startsWith("id=")));return Z!==-1&&($=B[Z].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:$,uri:F}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(L,F){const B=L.split(";");for(let $=0;$<B.length&&!(F>=this._specialColors.length);++$,++F)if(B[$]==="?")this._onColor.fire([{type:0,index:this._specialColors[F]}]);else{const Z=(0,D.parseColor)(B[$]);Z&&this._onColor.fire([{type:1,index:this._specialColors[F],color:Z}])}return!0}setOrReportFgColor(L){return this._setOrReportSpecialColor(L,0)}setOrReportBgColor(L){return this._setOrReportSpecialColor(L,1)}setOrReportCursorColor(L){return this._setOrReportSpecialColor(L,2)}restoreIndexedColor(L){if(!L)return this._onColor.fire([{type:2}]),!0;const F=[],B=L.split(";");for(let $=0;$<B.length;++$)if(/^\d+$/.exec(B[$])){const Z=parseInt(B[$]);J(Z)&&F.push({type:2,index:Z})}return F.length&&this._onColor.fire(F),!0}restoreFgColor(L){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(L){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(L){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,g.DEFAULT_CHARSET),!0}selectCharset(L){return L.length!==2?(this.selectDefaultCharset(),!0):(L[0]==="/"||this._charsetService.setgCharset(I[L[0]],g.CHARSETS[L[1]]||g.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const L=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,L,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=m.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=m.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(L){return this._charsetService.setgLevel(L),!0}screenAlignmentPattern(){const L=new b.CellData;L.content=4194373,L.fg=this._curAttrData.fg,L.bg=this._curAttrData.bg,this._setCursor(0,0);for(let F=0;F<this._bufferService.rows;++F){const B=this._activeBuffer.ybase+this._activeBuffer.y+F,$=this._activeBuffer.lines.get(B);$&&($.fill(L),$.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(L,F){const B=this._bufferService.buffer,$=this._optionsService.rawOptions;return(Z=>(this._coreService.triggerDataEvent(`${d.C0.ESC}${Z}${d.C0.ESC}\\`),!0))(L==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:L==='"p'?'P1$r61;1"p':L==="r"?`P1$r${B.scrollTop+1};${B.scrollBottom+1}r`:L==="m"?"P1$r0m":L===" q"?`P1$r${{block:2,underline:4,bar:6}[$.cursorStyle]-($.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(L,F){this._dirtyRowTracker.markRangeDirty(L,F)}}o.InputHandler=ie;let Q=class{constructor(Y){this._bufferService=Y,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(Y){Y<this.start?this.start=Y:Y>this.end&&(this.end=Y)}markRangeDirty(Y,L){Y>L&&(K=Y,Y=L,L=K),Y<this.start&&(this.start=Y),L>this.end&&(this.end=L)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function J(Y){return 0<=Y&&Y<256}Q=u([f(0,E.IBufferService)],Q)},844:(c,o)=>{function h(u){for(const f of u)f.dispose();u.length=0}Object.defineProperty(o,"__esModule",{value:!0}),o.getDisposeArrayDisposable=o.disposeArray=o.toDisposable=o.MutableDisposable=o.Disposable=void 0,o.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const u of this._disposables)u.dispose();this._disposables.length=0}register(u){return this._disposables.push(u),u}unregister(u){const f=this._disposables.indexOf(u);f!==-1&&this._disposables.splice(f,1)}},o.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(u){var f;this._isDisposed||u===this._value||((f=this._value)==null||f.dispose(),this._value=u)}clear(){this.value=void 0}dispose(){var u;this._isDisposed=!0,(u=this._value)==null||u.dispose(),this._value=void 0}},o.toDisposable=function(u){return{dispose:u}},o.disposeArray=h,o.getDisposeArrayDisposable=function(u){return{dispose:()=>h(u)}}},1505:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.FourKeyMap=o.TwoKeyMap=void 0;class h{constructor(){this._data={}}set(f,d,g){this._data[f]||(this._data[f]={}),this._data[f][d]=g}get(f,d){return this._data[f]?this._data[f][d]:void 0}clear(){this._data={}}}o.TwoKeyMap=h,o.FourKeyMap=class{constructor(){this._data=new h}set(u,f,d,g,_){this._data.get(u,f)||this._data.set(u,f,new h),this._data.get(u,f).set(d,g,_)}get(u,f,d,g){var _;return(_=this._data.get(u,f))==null?void 0:_.get(d,g)}clear(){this._data.clear()}}},6114:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.isChromeOS=o.isLinux=o.isWindows=o.isIphone=o.isIpad=o.isMac=o.getSafariVersion=o.isSafari=o.isLegacyEdge=o.isFirefox=o.isNode=void 0,o.isNode=typeof process<"u"&&"title"in process;const h=o.isNode?"node":navigator.userAgent,u=o.isNode?"node":navigator.platform;o.isFirefox=h.includes("Firefox"),o.isLegacyEdge=h.includes("Edge"),o.isSafari=/^((?!chrome|android).)*safari/i.test(h),o.getSafariVersion=function(){if(!o.isSafari)return 0;const f=h.match(/Version\/(\d+)/);return f===null||f.length<2?0:parseInt(f[1])},o.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(u),o.isIpad=u==="iPad",o.isIphone=u==="iPhone",o.isWindows=["Windows","Win16","Win32","WinCE"].includes(u),o.isLinux=u.indexOf("Linux")>=0,o.isChromeOS=/\bCrOS\b/.test(h)},6106:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.SortedList=void 0;let h=0;o.SortedList=class{constructor(u){this._getKey=u,this._array=[]}clear(){this._array.length=0}insert(u){this._array.length!==0?(h=this._search(this._getKey(u)),this._array.splice(h,0,u)):this._array.push(u)}delete(u){if(this._array.length===0)return!1;const f=this._getKey(u);if(f===void 0||(h=this._search(f),h===-1)||this._getKey(this._array[h])!==f)return!1;do if(this._array[h]===u)return this._array.splice(h,1),!0;while(++h<this._array.length&&this._getKey(this._array[h])===f);return!1}*getKeyIterator(u){if(this._array.length!==0&&(h=this._search(u),!(h<0||h>=this._array.length)&&this._getKey(this._array[h])===u))do yield this._array[h];while(++h<this._array.length&&this._getKey(this._array[h])===u)}forEachByKey(u,f){if(this._array.length!==0&&(h=this._search(u),!(h<0||h>=this._array.length)&&this._getKey(this._array[h])===u))do f(this._array[h]);while(++h<this._array.length&&this._getKey(this._array[h])===u)}values(){return[...this._array].values()}_search(u){let f=0,d=this._array.length-1;for(;d>=f;){let g=f+d>>1;const _=this._getKey(this._array[g]);if(_>u)d=g-1;else{if(!(_<u)){for(;g>0&&this._getKey(this._array[g-1])===u;)g--;return g}f=g+1}}return f}}},7226:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DebouncedIdleTask=o.IdleTaskQueue=o.PriorityTaskQueue=void 0;const u=h(6114);class f{constructor(){this._tasks=[],this._i=0}enqueue(_){this._tasks.push(_),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(_){this._idleCallback=void 0;let k=0,S=0,m=_.timeRemaining(),x=0;for(;this._i<this._tasks.length;){if(k=Date.now(),this._tasks[this._i]()||this._i++,k=Math.max(1,Date.now()-k),S=Math.max(k,S),x=_.timeRemaining(),1.5*S>x)return m-k<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(m-k))}ms`),void this._start();m=x}this.clear()}}class d extends f{_requestCallback(_){return setTimeout((()=>_(this._createDeadline(16))))}_cancelCallback(_){clearTimeout(_)}_createDeadline(_){const k=Date.now()+_;return{timeRemaining:()=>Math.max(0,k-Date.now())}}}o.PriorityTaskQueue=d,o.IdleTaskQueue=!u.isNode&&"requestIdleCallback"in window?class extends f{_requestCallback(g){return requestIdleCallback(g)}_cancelCallback(g){cancelIdleCallback(g)}}:d,o.DebouncedIdleTask=class{constructor(){this._queue=new o.IdleTaskQueue}set(g){this._queue.clear(),this._queue.enqueue(g)}flush(){this._queue.flush()}}},9282:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.updateWindowsModeWrappedState=void 0;const u=h(643);o.updateWindowsModeWrappedState=function(f){const d=f.buffer.lines.get(f.buffer.ybase+f.buffer.y-1),g=d==null?void 0:d.get(f.cols-1),_=f.buffer.lines.get(f.buffer.ybase+f.buffer.y);_&&g&&(_.isWrapped=g[u.CHAR_DATA_CODE_INDEX]!==u.NULL_CELL_CODE&&g[u.CHAR_DATA_CODE_INDEX]!==u.WHITESPACE_CELL_CODE)}},3734:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ExtendedAttrs=o.AttributeData=void 0;class h{constructor(){this.fg=0,this.bg=0,this.extended=new u}static toColorRGB(d){return[d>>>16&255,d>>>8&255,255&d]}static fromColorRGB(d){return(255&d[0])<<16|(255&d[1])<<8|255&d[2]}clone(){const d=new h;return d.fg=this.fg,d.bg=this.bg,d.extended=this.extended.clone(),d}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}o.AttributeData=h;class u{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(d){this._ext=d}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(d){this._ext&=-469762049,this._ext|=d<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(d){this._ext&=-67108864,this._ext|=67108863&d}get urlId(){return this._urlId}set urlId(d){this._urlId=d}get underlineVariantOffset(){const d=(3758096384&this._ext)>>29;return d<0?4294967288^d:d}set underlineVariantOffset(d){this._ext&=536870911,this._ext|=d<<29&3758096384}constructor(d=0,g=0){this._ext=0,this._urlId=0,this._ext=d,this._urlId=g}clone(){return new u(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}o.ExtendedAttrs=u},9092:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Buffer=o.MAX_BUFFER_SIZE=void 0;const u=h(6349),f=h(7226),d=h(3734),g=h(8437),_=h(4634),k=h(511),S=h(643),m=h(4863),x=h(7116);o.MAX_BUFFER_SIZE=4294967295,o.Buffer=class{constructor(v,b,C){this._hasScrollback=v,this._optionsService=b,this._bufferService=C,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=g.DEFAULT_ATTR_DATA.clone(),this.savedCharset=x.DEFAULT_CHARSET,this.markers=[],this._nullCell=k.CellData.fromCharData([0,S.NULL_CELL_CHAR,S.NULL_CELL_WIDTH,S.NULL_CELL_CODE]),this._whitespaceCell=k.CellData.fromCharData([0,S.WHITESPACE_CELL_CHAR,S.WHITESPACE_CELL_WIDTH,S.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new f.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new u.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(v){return v?(this._nullCell.fg=v.fg,this._nullCell.bg=v.bg,this._nullCell.extended=v.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new d.ExtendedAttrs),this._nullCell}getWhitespaceCell(v){return v?(this._whitespaceCell.fg=v.fg,this._whitespaceCell.bg=v.bg,this._whitespaceCell.extended=v.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new d.ExtendedAttrs),this._whitespaceCell}getBlankLine(v,b){return new g.BufferLine(this._bufferService.cols,this.getNullCell(v),b)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const v=this.ybase+this.y-this.ydisp;return v>=0&&v<this._rows}_getCorrectBufferLength(v){if(!this._hasScrollback)return v;const b=v+this._optionsService.rawOptions.scrollback;return b>o.MAX_BUFFER_SIZE?o.MAX_BUFFER_SIZE:b}fillViewportRows(v){if(this.lines.length===0){v===void 0&&(v=g.DEFAULT_ATTR_DATA);let b=this._rows;for(;b--;)this.lines.push(this.getBlankLine(v))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new u.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(v,b){const C=this.getNullCell(g.DEFAULT_ATTR_DATA);let E=0;const P=this._getCorrectBufferLength(b);if(P>this.lines.maxLength&&(this.lines.maxLength=P),this.lines.length>0){if(this._cols<v)for(let A=0;A<this.lines.length;A++)E+=+this.lines.get(A).resize(v,C);let T=0;if(this._rows<b)for(let A=this._rows;A<b;A++)this.lines.length<b+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new g.BufferLine(v,C)):this.ybase>0&&this.lines.length<=this.ybase+this.y+T+1?(this.ybase--,T++,this.ydisp>0&&this.ydisp--):this.lines.push(new g.BufferLine(v,C)));else for(let A=this._rows;A>b;A--)this.lines.length>b+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(P<this.lines.maxLength){const A=this.lines.length-P;A>0&&(this.lines.trimStart(A),this.ybase=Math.max(this.ybase-A,0),this.ydisp=Math.max(this.ydisp-A,0),this.savedY=Math.max(this.savedY-A,0)),this.lines.maxLength=P}this.x=Math.min(this.x,v-1),this.y=Math.min(this.y,b-1),T&&(this.y+=T),this.savedX=Math.min(this.savedX,v-1),this.scrollTop=0}if(this.scrollBottom=b-1,this._isReflowEnabled&&(this._reflow(v,b),this._cols>v))for(let T=0;T<this.lines.length;T++)E+=+this.lines.get(T).resize(v,C);this._cols=v,this._rows=b,this._memoryCleanupQueue.clear(),E>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let v=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,v=!1);let b=0;for(;this._memoryCleanupPosition<this.lines.length;)if(b+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),b>100)return!0;return v}get _isReflowEnabled(){const v=this._optionsService.rawOptions.windowsPty;return v&&v.buildNumber?this._hasScrollback&&v.backend==="conpty"&&v.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(v,b){this._cols!==v&&(v>this._cols?this._reflowLarger(v,b):this._reflowSmaller(v,b))}_reflowLarger(v,b){const C=(0,_.reflowLargerGetLinesToRemove)(this.lines,this._cols,v,this.ybase+this.y,this.getNullCell(g.DEFAULT_ATTR_DATA));if(C.length>0){const E=(0,_.reflowLargerCreateNewLayout)(this.lines,C);(0,_.reflowLargerApplyNewLayout)(this.lines,E.layout),this._reflowLargerAdjustViewport(v,b,E.countRemoved)}}_reflowLargerAdjustViewport(v,b,C){const E=this.getNullCell(g.DEFAULT_ATTR_DATA);let P=C;for(;P-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<b&&this.lines.push(new g.BufferLine(v,E))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-C,0)}_reflowSmaller(v,b){const C=this.getNullCell(g.DEFAULT_ATTR_DATA),E=[];let P=0;for(let T=this.lines.length-1;T>=0;T--){let A=this.lines.get(T);if(!A||!A.isWrapped&&A.getTrimmedLength()<=v)continue;const D=[A];for(;A.isWrapped&&T>0;)A=this.lines.get(--T),D.unshift(A);const I=this.ybase+this.y;if(I>=T&&I<T+D.length)continue;const O=D[D.length-1].getTrimmedLength(),z=(0,_.reflowSmallerGetNewLineLengths)(D,this._cols,v),U=z.length-D.length;let K;K=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+U):Math.max(0,this.lines.length-this.lines.maxLength+U);const ie=[];for(let B=0;B<U;B++){const $=this.getBlankLine(g.DEFAULT_ATTR_DATA,!0);ie.push($)}ie.length>0&&(E.push({start:T+D.length+P,newLines:ie}),P+=ie.length),D.push(...ie);let Q=z.length-1,J=z[Q];J===0&&(Q--,J=z[Q]);let Y=D.length-U-1,L=O;for(;Y>=0;){const B=Math.min(L,J);if(D[Q]===void 0)break;if(D[Q].copyCellsFrom(D[Y],L-B,J-B,B,!0),J-=B,J===0&&(Q--,J=z[Q]),L-=B,L===0){Y--;const $=Math.max(Y,0);L=(0,_.getWrappedLineTrimmedLength)(D,$,this._cols)}}for(let B=0;B<D.length;B++)z[B]<v&&D[B].setCell(z[B],C);let F=U-K;for(;F-- >0;)this.ybase===0?this.y<b-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+P)-b&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+U,this.ybase+b-1)}if(E.length>0){const T=[],A=[];for(let Q=0;Q<this.lines.length;Q++)A.push(this.lines.get(Q));const D=this.lines.length;let I=D-1,O=0,z=E[O];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+P);let U=0;for(let Q=Math.min(this.lines.maxLength-1,D+P-1);Q>=0;Q--)if(z&&z.start>I+U){for(let J=z.newLines.length-1;J>=0;J--)this.lines.set(Q--,z.newLines[J]);Q++,T.push({index:I+1,amount:z.newLines.length}),U+=z.newLines.length,z=E[++O]}else this.lines.set(Q,A[I--]);let K=0;for(let Q=T.length-1;Q>=0;Q--)T[Q].index+=K,this.lines.onInsertEmitter.fire(T[Q]),K+=T[Q].amount;const ie=Math.max(0,D+P-this.lines.maxLength);ie>0&&this.lines.onTrimEmitter.fire(ie)}}translateBufferLineToString(v,b,C=0,E){const P=this.lines.get(v);return P?P.translateToString(b,C,E):""}getWrappedRangeForLine(v){let b=v,C=v;for(;b>0&&this.lines.get(b).isWrapped;)b--;for(;C+1<this.lines.length&&this.lines.get(C+1).isWrapped;)C++;return{first:b,last:C}}setupTabStops(v){for(v!=null?this.tabs[v]||(v=this.prevStop(v)):(this.tabs={},v=0);v<this._cols;v+=this._optionsService.rawOptions.tabStopWidth)this.tabs[v]=!0}prevStop(v){for(v==null&&(v=this.x);!this.tabs[--v]&&v>0;);return v>=this._cols?this._cols-1:v<0?0:v}nextStop(v){for(v==null&&(v=this.x);!this.tabs[++v]&&v<this._cols;);return v>=this._cols?this._cols-1:v<0?0:v}clearMarkers(v){this._isClearing=!0;for(let b=0;b<this.markers.length;b++)this.markers[b].line===v&&(this.markers[b].dispose(),this.markers.splice(b--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let v=0;v<this.markers.length;v++)this.markers[v].dispose(),this.markers.splice(v--,1);this._isClearing=!1}addMarker(v){const b=new m.Marker(v);return this.markers.push(b),b.register(this.lines.onTrim((C=>{b.line-=C,b.line<0&&b.dispose()}))),b.register(this.lines.onInsert((C=>{b.line>=C.index&&(b.line+=C.amount)}))),b.register(this.lines.onDelete((C=>{b.line>=C.index&&b.line<C.index+C.amount&&b.dispose(),b.line>C.index&&(b.line-=C.amount)}))),b.register(b.onDispose((()=>this._removeMarker(b)))),b}_removeMarker(v){this._isClearing||this.markers.splice(this.markers.indexOf(v),1)}}},8437:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferLine=o.DEFAULT_ATTR_DATA=void 0;const u=h(3734),f=h(511),d=h(643),g=h(482);o.DEFAULT_ATTR_DATA=Object.freeze(new u.AttributeData);let _=0;class k{constructor(m,x,v=!1){this.isWrapped=v,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*m);const b=x||f.CellData.fromCharData([0,d.NULL_CELL_CHAR,d.NULL_CELL_WIDTH,d.NULL_CELL_CODE]);for(let C=0;C<m;++C)this.setCell(C,b);this.length=m}get(m){const x=this._data[3*m+0],v=2097151&x;return[this._data[3*m+1],2097152&x?this._combined[m]:v?(0,g.stringFromCodePoint)(v):"",x>>22,2097152&x?this._combined[m].charCodeAt(this._combined[m].length-1):v]}set(m,x){this._data[3*m+1]=x[d.CHAR_DATA_ATTR_INDEX],x[d.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[m]=x[1],this._data[3*m+0]=2097152|m|x[d.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*m+0]=x[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|x[d.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(m){return this._data[3*m+0]>>22}hasWidth(m){return 12582912&this._data[3*m+0]}getFg(m){return this._data[3*m+1]}getBg(m){return this._data[3*m+2]}hasContent(m){return 4194303&this._data[3*m+0]}getCodePoint(m){const x=this._data[3*m+0];return 2097152&x?this._combined[m].charCodeAt(this._combined[m].length-1):2097151&x}isCombined(m){return 2097152&this._data[3*m+0]}getString(m){const x=this._data[3*m+0];return 2097152&x?this._combined[m]:2097151&x?(0,g.stringFromCodePoint)(2097151&x):""}isProtected(m){return 536870912&this._data[3*m+2]}loadCell(m,x){return _=3*m,x.content=this._data[_+0],x.fg=this._data[_+1],x.bg=this._data[_+2],2097152&x.content&&(x.combinedData=this._combined[m]),268435456&x.bg&&(x.extended=this._extendedAttrs[m]),x}setCell(m,x){2097152&x.content&&(this._combined[m]=x.combinedData),268435456&x.bg&&(this._extendedAttrs[m]=x.extended),this._data[3*m+0]=x.content,this._data[3*m+1]=x.fg,this._data[3*m+2]=x.bg}setCellFromCodepoint(m,x,v,b){268435456&b.bg&&(this._extendedAttrs[m]=b.extended),this._data[3*m+0]=x|v<<22,this._data[3*m+1]=b.fg,this._data[3*m+2]=b.bg}addCodepointToCell(m,x,v){let b=this._data[3*m+0];2097152&b?this._combined[m]+=(0,g.stringFromCodePoint)(x):2097151&b?(this._combined[m]=(0,g.stringFromCodePoint)(2097151&b)+(0,g.stringFromCodePoint)(x),b&=-2097152,b|=2097152):b=x|4194304,v&&(b&=-12582913,b|=v<<22),this._data[3*m+0]=b}insertCells(m,x,v){if((m%=this.length)&&this.getWidth(m-1)===2&&this.setCellFromCodepoint(m-1,0,1,v),x<this.length-m){const b=new f.CellData;for(let C=this.length-m-x-1;C>=0;--C)this.setCell(m+x+C,this.loadCell(m+C,b));for(let C=0;C<x;++C)this.setCell(m+C,v)}else for(let b=m;b<this.length;++b)this.setCell(b,v);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,v)}deleteCells(m,x,v){if(m%=this.length,x<this.length-m){const b=new f.CellData;for(let C=0;C<this.length-m-x;++C)this.setCell(m+C,this.loadCell(m+x+C,b));for(let C=this.length-x;C<this.length;++C)this.setCell(C,v)}else for(let b=m;b<this.length;++b)this.setCell(b,v);m&&this.getWidth(m-1)===2&&this.setCellFromCodepoint(m-1,0,1,v),this.getWidth(m)!==0||this.hasContent(m)||this.setCellFromCodepoint(m,0,1,v)}replaceCells(m,x,v,b=!1){if(b)for(m&&this.getWidth(m-1)===2&&!this.isProtected(m-1)&&this.setCellFromCodepoint(m-1,0,1,v),x<this.length&&this.getWidth(x-1)===2&&!this.isProtected(x)&&this.setCellFromCodepoint(x,0,1,v);m<x&&m<this.length;)this.isProtected(m)||this.setCell(m,v),m++;else for(m&&this.getWidth(m-1)===2&&this.setCellFromCodepoint(m-1,0,1,v),x<this.length&&this.getWidth(x-1)===2&&this.setCellFromCodepoint(x,0,1,v);m<x&&m<this.length;)this.setCell(m++,v)}resize(m,x){if(m===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const v=3*m;if(m>this.length){if(this._data.buffer.byteLength>=4*v)this._data=new Uint32Array(this._data.buffer,0,v);else{const b=new Uint32Array(v);b.set(this._data),this._data=b}for(let b=this.length;b<m;++b)this.setCell(b,x)}else{this._data=this._data.subarray(0,v);const b=Object.keys(this._combined);for(let E=0;E<b.length;E++){const P=parseInt(b[E],10);P>=m&&delete this._combined[P]}const C=Object.keys(this._extendedAttrs);for(let E=0;E<C.length;E++){const P=parseInt(C[E],10);P>=m&&delete this._extendedAttrs[P]}}return this.length=m,4*v*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const m=new Uint32Array(this._data.length);return m.set(this._data),this._data=m,1}return 0}fill(m,x=!1){if(x)for(let v=0;v<this.length;++v)this.isProtected(v)||this.setCell(v,m);else{this._combined={},this._extendedAttrs={};for(let v=0;v<this.length;++v)this.setCell(v,m)}}copyFrom(m){this.length!==m.length?this._data=new Uint32Array(m._data):this._data.set(m._data),this.length=m.length,this._combined={};for(const x in m._combined)this._combined[x]=m._combined[x];this._extendedAttrs={};for(const x in m._extendedAttrs)this._extendedAttrs[x]=m._extendedAttrs[x];this.isWrapped=m.isWrapped}clone(){const m=new k(0);m._data=new Uint32Array(this._data),m.length=this.length;for(const x in this._combined)m._combined[x]=this._combined[x];for(const x in this._extendedAttrs)m._extendedAttrs[x]=this._extendedAttrs[x];return m.isWrapped=this.isWrapped,m}getTrimmedLength(){for(let m=this.length-1;m>=0;--m)if(4194303&this._data[3*m+0])return m+(this._data[3*m+0]>>22);return 0}getNoBgTrimmedLength(){for(let m=this.length-1;m>=0;--m)if(4194303&this._data[3*m+0]||50331648&this._data[3*m+2])return m+(this._data[3*m+0]>>22);return 0}copyCellsFrom(m,x,v,b,C){const E=m._data;if(C)for(let T=b-1;T>=0;T--){for(let A=0;A<3;A++)this._data[3*(v+T)+A]=E[3*(x+T)+A];268435456&E[3*(x+T)+2]&&(this._extendedAttrs[v+T]=m._extendedAttrs[x+T])}else for(let T=0;T<b;T++){for(let A=0;A<3;A++)this._data[3*(v+T)+A]=E[3*(x+T)+A];268435456&E[3*(x+T)+2]&&(this._extendedAttrs[v+T]=m._extendedAttrs[x+T])}const P=Object.keys(m._combined);for(let T=0;T<P.length;T++){const A=parseInt(P[T],10);A>=x&&(this._combined[A-x+v]=m._combined[A])}}translateToString(m,x,v,b){x=x??0,v=v??this.length,m&&(v=Math.min(v,this.getTrimmedLength())),b&&(b.length=0);let C="";for(;x<v;){const E=this._data[3*x+0],P=2097151&E,T=2097152&E?this._combined[x]:P?(0,g.stringFromCodePoint)(P):d.WHITESPACE_CELL_CHAR;if(C+=T,b)for(let A=0;A<T.length;++A)b.push(x);x+=E>>22||1}return b&&b.push(x),C}}o.BufferLine=k},4841:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.getRangeLength=void 0,o.getRangeLength=function(h,u){if(h.start.y>h.end.y)throw new Error(`Buffer range end (${h.end.x}, ${h.end.y}) cannot be before start (${h.start.x}, ${h.start.y})`);return u*(h.end.y-h.start.y)+(h.end.x-h.start.x+1)}},4634:(c,o)=>{function h(u,f,d){if(f===u.length-1)return u[f].getTrimmedLength();const g=!u[f].hasContent(d-1)&&u[f].getWidth(d-1)===1,_=u[f+1].getWidth(0)===2;return g&&_?d-1:d}Object.defineProperty(o,"__esModule",{value:!0}),o.getWrappedLineTrimmedLength=o.reflowSmallerGetNewLineLengths=o.reflowLargerApplyNewLayout=o.reflowLargerCreateNewLayout=o.reflowLargerGetLinesToRemove=void 0,o.reflowLargerGetLinesToRemove=function(u,f,d,g,_){const k=[];for(let S=0;S<u.length-1;S++){let m=S,x=u.get(++m);if(!x.isWrapped)continue;const v=[u.get(S)];for(;m<u.length&&x.isWrapped;)v.push(x),x=u.get(++m);if(g>=S&&g<m){S+=v.length-1;continue}let b=0,C=h(v,b,f),E=1,P=0;for(;E<v.length;){const A=h(v,E,f),D=A-P,I=d-C,O=Math.min(D,I);v[b].copyCellsFrom(v[E],P,C,O,!1),C+=O,C===d&&(b++,C=0),P+=O,P===A&&(E++,P=0),C===0&&b!==0&&v[b-1].getWidth(d-1)===2&&(v[b].copyCellsFrom(v[b-1],d-1,C++,1,!1),v[b-1].setCell(d-1,_))}v[b].replaceCells(C,d,_);let T=0;for(let A=v.length-1;A>0&&(A>b||v[A].getTrimmedLength()===0);A--)T++;T>0&&(k.push(S+v.length-T),k.push(T)),S+=v.length-1}return k},o.reflowLargerCreateNewLayout=function(u,f){const d=[];let g=0,_=f[g],k=0;for(let S=0;S<u.length;S++)if(_===S){const m=f[++g];u.onDeleteEmitter.fire({index:S-k,amount:m}),S+=m-1,k+=m,_=f[++g]}else d.push(S);return{layout:d,countRemoved:k}},o.reflowLargerApplyNewLayout=function(u,f){const d=[];for(let g=0;g<f.length;g++)d.push(u.get(f[g]));for(let g=0;g<d.length;g++)u.set(g,d[g]);u.length=f.length},o.reflowSmallerGetNewLineLengths=function(u,f,d){const g=[],_=u.map(((x,v)=>h(u,v,f))).reduce(((x,v)=>x+v));let k=0,S=0,m=0;for(;m<_;){if(_-m<d){g.push(_-m);break}k+=d;const x=h(u,S,f);k>x&&(k-=x,S++);const v=u[S].getWidth(k-1)===2;v&&k--;const b=v?d-1:d;g.push(b),m+=b}return g},o.getWrappedLineTrimmedLength=h},5295:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferSet=void 0;const u=h(8460),f=h(844),d=h(9092);class g extends f.Disposable{constructor(k,S){super(),this._optionsService=k,this._bufferService=S,this._onBufferActivate=this.register(new u.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",(()=>this.setupTabStops())))}reset(){this._normal=new d.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new d.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(k){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(k),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(k,S){this._normal.resize(k,S),this._alt.resize(k,S),this.setupTabStops(k)}setupTabStops(k){this._normal.setupTabStops(k),this._alt.setupTabStops(k)}}o.BufferSet=g},511:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CellData=void 0;const u=h(482),f=h(643),d=h(3734);class g extends d.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new d.ExtendedAttrs,this.combinedData=""}static fromCharData(k){const S=new g;return S.setFromCharData(k),S}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,u.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(k){this.fg=k[f.CHAR_DATA_ATTR_INDEX],this.bg=0;let S=!1;if(k[f.CHAR_DATA_CHAR_INDEX].length>2)S=!0;else if(k[f.CHAR_DATA_CHAR_INDEX].length===2){const m=k[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=m&&m<=56319){const x=k[f.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=x&&x<=57343?this.content=1024*(m-55296)+x-56320+65536|k[f.CHAR_DATA_WIDTH_INDEX]<<22:S=!0}else S=!0}else this.content=k[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|k[f.CHAR_DATA_WIDTH_INDEX]<<22;S&&(this.combinedData=k[f.CHAR_DATA_CHAR_INDEX],this.content=2097152|k[f.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}o.CellData=g},643:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.WHITESPACE_CELL_CODE=o.WHITESPACE_CELL_WIDTH=o.WHITESPACE_CELL_CHAR=o.NULL_CELL_CODE=o.NULL_CELL_WIDTH=o.NULL_CELL_CHAR=o.CHAR_DATA_CODE_INDEX=o.CHAR_DATA_WIDTH_INDEX=o.CHAR_DATA_CHAR_INDEX=o.CHAR_DATA_ATTR_INDEX=o.DEFAULT_EXT=o.DEFAULT_ATTR=o.DEFAULT_COLOR=void 0,o.DEFAULT_COLOR=0,o.DEFAULT_ATTR=256|o.DEFAULT_COLOR<<9,o.DEFAULT_EXT=0,o.CHAR_DATA_ATTR_INDEX=0,o.CHAR_DATA_CHAR_INDEX=1,o.CHAR_DATA_WIDTH_INDEX=2,o.CHAR_DATA_CODE_INDEX=3,o.NULL_CELL_CHAR="",o.NULL_CELL_WIDTH=1,o.NULL_CELL_CODE=0,o.WHITESPACE_CELL_CHAR=" ",o.WHITESPACE_CELL_WIDTH=1,o.WHITESPACE_CELL_CODE=32},4863:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Marker=void 0;const u=h(8460),f=h(844);class d{get id(){return this._id}constructor(_){this.line=_,this.isDisposed=!1,this._disposables=[],this._id=d._nextId++,this._onDispose=this.register(new u.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,f.disposeArray)(this._disposables),this._disposables.length=0)}register(_){return this._disposables.push(_),_}}o.Marker=d,d._nextId=1},7116:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DEFAULT_CHARSET=o.CHARSETS=void 0,o.CHARSETS={},o.DEFAULT_CHARSET=o.CHARSETS.B,o.CHARSETS[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},o.CHARSETS.A={"#":"£"},o.CHARSETS.B=void 0,o.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},o.CHARSETS.C=o.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},o.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},o.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},o.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},o.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},o.CHARSETS.E=o.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},o.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},o.CHARSETS.H=o.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},o.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(c,o)=>{var h,u,f;Object.defineProperty(o,"__esModule",{value:!0}),o.C1_ESCAPED=o.C1=o.C0=void 0,(function(d){d.NUL="\0",d.SOH="",d.STX="",d.ETX="",d.EOT="",d.ENQ="",d.ACK="",d.BEL="\x07",d.BS="\b",d.HT=" ",d.LF=`
325
+ `,d.VT="\v",d.FF="\f",d.CR="\r",d.SO="",d.SI="",d.DLE="",d.DC1="",d.DC2="",d.DC3="",d.DC4="",d.NAK="",d.SYN="",d.ETB="",d.CAN="",d.EM="",d.SUB="",d.ESC="\x1B",d.FS="",d.GS="",d.RS="",d.US="",d.SP=" ",d.DEL=""})(h||(o.C0=h={})),(function(d){d.PAD="€",d.HOP="",d.BPH="‚",d.NBH="ƒ",d.IND="„",d.NEL="…",d.SSA="†",d.ESA="‡",d.HTS="ˆ",d.HTJ="‰",d.VTS="Š",d.PLD="‹",d.PLU="Œ",d.RI="",d.SS2="Ž",d.SS3="",d.DCS="",d.PU1="‘",d.PU2="’",d.STS="“",d.CCH="”",d.MW="•",d.SPA="–",d.EPA="—",d.SOS="˜",d.SGCI="™",d.SCI="š",d.CSI="›",d.ST="œ",d.OSC="",d.PM="ž",d.APC="Ÿ"})(u||(o.C1=u={})),(function(d){d.ST=`${h.ESC}\\`})(f||(o.C1_ESCAPED=f={}))},7399:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.evaluateKeyboardEvent=void 0;const u=h(2584),f={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};o.evaluateKeyboardEvent=function(d,g,_,k){const S={type:0,cancel:!1,key:void 0},m=(d.shiftKey?1:0)|(d.altKey?2:0)|(d.ctrlKey?4:0)|(d.metaKey?8:0);switch(d.keyCode){case 0:d.key==="UIKeyInputUpArrow"?S.key=g?u.C0.ESC+"OA":u.C0.ESC+"[A":d.key==="UIKeyInputLeftArrow"?S.key=g?u.C0.ESC+"OD":u.C0.ESC+"[D":d.key==="UIKeyInputRightArrow"?S.key=g?u.C0.ESC+"OC":u.C0.ESC+"[C":d.key==="UIKeyInputDownArrow"&&(S.key=g?u.C0.ESC+"OB":u.C0.ESC+"[B");break;case 8:S.key=d.ctrlKey?"\b":u.C0.DEL,d.altKey&&(S.key=u.C0.ESC+S.key);break;case 9:if(d.shiftKey){S.key=u.C0.ESC+"[Z";break}S.key=u.C0.HT,S.cancel=!0;break;case 13:S.key=d.altKey?u.C0.ESC+u.C0.CR:u.C0.CR,S.cancel=!0;break;case 27:S.key=u.C0.ESC,d.altKey&&(S.key=u.C0.ESC+u.C0.ESC),S.cancel=!0;break;case 37:if(d.metaKey)break;m?(S.key=u.C0.ESC+"[1;"+(m+1)+"D",S.key===u.C0.ESC+"[1;3D"&&(S.key=u.C0.ESC+(_?"b":"[1;5D"))):S.key=g?u.C0.ESC+"OD":u.C0.ESC+"[D";break;case 39:if(d.metaKey)break;m?(S.key=u.C0.ESC+"[1;"+(m+1)+"C",S.key===u.C0.ESC+"[1;3C"&&(S.key=u.C0.ESC+(_?"f":"[1;5C"))):S.key=g?u.C0.ESC+"OC":u.C0.ESC+"[C";break;case 38:if(d.metaKey)break;m?(S.key=u.C0.ESC+"[1;"+(m+1)+"A",_||S.key!==u.C0.ESC+"[1;3A"||(S.key=u.C0.ESC+"[1;5A")):S.key=g?u.C0.ESC+"OA":u.C0.ESC+"[A";break;case 40:if(d.metaKey)break;m?(S.key=u.C0.ESC+"[1;"+(m+1)+"B",_||S.key!==u.C0.ESC+"[1;3B"||(S.key=u.C0.ESC+"[1;5B")):S.key=g?u.C0.ESC+"OB":u.C0.ESC+"[B";break;case 45:d.shiftKey||d.ctrlKey||(S.key=u.C0.ESC+"[2~");break;case 46:S.key=m?u.C0.ESC+"[3;"+(m+1)+"~":u.C0.ESC+"[3~";break;case 36:S.key=m?u.C0.ESC+"[1;"+(m+1)+"H":g?u.C0.ESC+"OH":u.C0.ESC+"[H";break;case 35:S.key=m?u.C0.ESC+"[1;"+(m+1)+"F":g?u.C0.ESC+"OF":u.C0.ESC+"[F";break;case 33:d.shiftKey?S.type=2:d.ctrlKey?S.key=u.C0.ESC+"[5;"+(m+1)+"~":S.key=u.C0.ESC+"[5~";break;case 34:d.shiftKey?S.type=3:d.ctrlKey?S.key=u.C0.ESC+"[6;"+(m+1)+"~":S.key=u.C0.ESC+"[6~";break;case 112:S.key=m?u.C0.ESC+"[1;"+(m+1)+"P":u.C0.ESC+"OP";break;case 113:S.key=m?u.C0.ESC+"[1;"+(m+1)+"Q":u.C0.ESC+"OQ";break;case 114:S.key=m?u.C0.ESC+"[1;"+(m+1)+"R":u.C0.ESC+"OR";break;case 115:S.key=m?u.C0.ESC+"[1;"+(m+1)+"S":u.C0.ESC+"OS";break;case 116:S.key=m?u.C0.ESC+"[15;"+(m+1)+"~":u.C0.ESC+"[15~";break;case 117:S.key=m?u.C0.ESC+"[17;"+(m+1)+"~":u.C0.ESC+"[17~";break;case 118:S.key=m?u.C0.ESC+"[18;"+(m+1)+"~":u.C0.ESC+"[18~";break;case 119:S.key=m?u.C0.ESC+"[19;"+(m+1)+"~":u.C0.ESC+"[19~";break;case 120:S.key=m?u.C0.ESC+"[20;"+(m+1)+"~":u.C0.ESC+"[20~";break;case 121:S.key=m?u.C0.ESC+"[21;"+(m+1)+"~":u.C0.ESC+"[21~";break;case 122:S.key=m?u.C0.ESC+"[23;"+(m+1)+"~":u.C0.ESC+"[23~";break;case 123:S.key=m?u.C0.ESC+"[24;"+(m+1)+"~":u.C0.ESC+"[24~";break;default:if(!d.ctrlKey||d.shiftKey||d.altKey||d.metaKey)if(_&&!k||!d.altKey||d.metaKey)!_||d.altKey||d.ctrlKey||d.shiftKey||!d.metaKey?d.key&&!d.ctrlKey&&!d.altKey&&!d.metaKey&&d.keyCode>=48&&d.key.length===1?S.key=d.key:d.key&&d.ctrlKey&&(d.key==="_"&&(S.key=u.C0.US),d.key==="@"&&(S.key=u.C0.NUL)):d.keyCode===65&&(S.type=1);else{const x=f[d.keyCode],v=x==null?void 0:x[d.shiftKey?1:0];if(v)S.key=u.C0.ESC+v;else if(d.keyCode>=65&&d.keyCode<=90){const b=d.ctrlKey?d.keyCode-64:d.keyCode+32;let C=String.fromCharCode(b);d.shiftKey&&(C=C.toUpperCase()),S.key=u.C0.ESC+C}else if(d.keyCode===32)S.key=u.C0.ESC+(d.ctrlKey?u.C0.NUL:" ");else if(d.key==="Dead"&&d.code.startsWith("Key")){let b=d.code.slice(3,4);d.shiftKey||(b=b.toLowerCase()),S.key=u.C0.ESC+b,S.cancel=!0}}else d.keyCode>=65&&d.keyCode<=90?S.key=String.fromCharCode(d.keyCode-64):d.keyCode===32?S.key=u.C0.NUL:d.keyCode>=51&&d.keyCode<=55?S.key=String.fromCharCode(d.keyCode-51+27):d.keyCode===56?S.key=u.C0.DEL:d.keyCode===219?S.key=u.C0.ESC:d.keyCode===220?S.key=u.C0.FS:d.keyCode===221&&(S.key=u.C0.GS)}return S}},482:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Utf8ToUtf32=o.StringToUtf32=o.utf32ToString=o.stringFromCodePoint=void 0,o.stringFromCodePoint=function(h){return h>65535?(h-=65536,String.fromCharCode(55296+(h>>10))+String.fromCharCode(h%1024+56320)):String.fromCharCode(h)},o.utf32ToString=function(h,u=0,f=h.length){let d="";for(let g=u;g<f;++g){let _=h[g];_>65535?(_-=65536,d+=String.fromCharCode(55296+(_>>10))+String.fromCharCode(_%1024+56320)):d+=String.fromCharCode(_)}return d},o.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(h,u){const f=h.length;if(!f)return 0;let d=0,g=0;if(this._interim){const _=h.charCodeAt(g++);56320<=_&&_<=57343?u[d++]=1024*(this._interim-55296)+_-56320+65536:(u[d++]=this._interim,u[d++]=_),this._interim=0}for(let _=g;_<f;++_){const k=h.charCodeAt(_);if(55296<=k&&k<=56319){if(++_>=f)return this._interim=k,d;const S=h.charCodeAt(_);56320<=S&&S<=57343?u[d++]=1024*(k-55296)+S-56320+65536:(u[d++]=k,u[d++]=S)}else k!==65279&&(u[d++]=k)}return d}},o.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(h,u){const f=h.length;if(!f)return 0;let d,g,_,k,S=0,m=0,x=0;if(this.interim[0]){let C=!1,E=this.interim[0];E&=(224&E)==192?31:(240&E)==224?15:7;let P,T=0;for(;(P=63&this.interim[++T])&&T<4;)E<<=6,E|=P;const A=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,D=A-T;for(;x<D;){if(x>=f)return 0;if(P=h[x++],(192&P)!=128){x--,C=!0;break}this.interim[T++]=P,E<<=6,E|=63&P}C||(A===2?E<128?x--:u[S++]=E:A===3?E<2048||E>=55296&&E<=57343||E===65279||(u[S++]=E):E<65536||E>1114111||(u[S++]=E)),this.interim.fill(0)}const v=f-4;let b=x;for(;b<f;){for(;!(!(b<v)||128&(d=h[b])||128&(g=h[b+1])||128&(_=h[b+2])||128&(k=h[b+3]));)u[S++]=d,u[S++]=g,u[S++]=_,u[S++]=k,b+=4;if(d=h[b++],d<128)u[S++]=d;else if((224&d)==192){if(b>=f)return this.interim[0]=d,S;if(g=h[b++],(192&g)!=128){b--;continue}if(m=(31&d)<<6|63&g,m<128){b--;continue}u[S++]=m}else if((240&d)==224){if(b>=f)return this.interim[0]=d,S;if(g=h[b++],(192&g)!=128){b--;continue}if(b>=f)return this.interim[0]=d,this.interim[1]=g,S;if(_=h[b++],(192&_)!=128){b--;continue}if(m=(15&d)<<12|(63&g)<<6|63&_,m<2048||m>=55296&&m<=57343||m===65279)continue;u[S++]=m}else if((248&d)==240){if(b>=f)return this.interim[0]=d,S;if(g=h[b++],(192&g)!=128){b--;continue}if(b>=f)return this.interim[0]=d,this.interim[1]=g,S;if(_=h[b++],(192&_)!=128){b--;continue}if(b>=f)return this.interim[0]=d,this.interim[1]=g,this.interim[2]=_,S;if(k=h[b++],(192&k)!=128){b--;continue}if(m=(7&d)<<18|(63&g)<<12|(63&_)<<6|63&k,m<65536||m>1114111)continue;u[S++]=m}}return S}}},225:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeV6=void 0;const u=h(1480),f=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],d=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let g;o.UnicodeV6=class{constructor(){if(this.version="6",!g){g=new Uint8Array(65536),g.fill(1),g[0]=0,g.fill(0,1,32),g.fill(0,127,160),g.fill(2,4352,4448),g[9001]=2,g[9002]=2,g.fill(2,11904,42192),g[12351]=1,g.fill(2,44032,55204),g.fill(2,63744,64256),g.fill(2,65040,65050),g.fill(2,65072,65136),g.fill(2,65280,65377),g.fill(2,65504,65511);for(let _=0;_<f.length;++_)g.fill(0,f[_][0],f[_][1]+1)}}wcwidth(_){return _<32?0:_<127?1:_<65536?g[_]:(function(k,S){let m,x=0,v=S.length-1;if(k<S[0][0]||k>S[v][1])return!1;for(;v>=x;)if(m=x+v>>1,k>S[m][1])x=m+1;else{if(!(k<S[m][0]))return!0;v=m-1}return!1})(_,d)?0:_>=131072&&_<=196605||_>=196608&&_<=262141?2:1}charProperties(_,k){let S=this.wcwidth(_),m=S===0&&k!==0;if(m){const x=u.UnicodeService.extractWidth(k);x===0?m=!1:x>S&&(S=x)}return u.UnicodeService.createPropertyValue(0,S,m)}}},5981:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.WriteBuffer=void 0;const u=h(8460),f=h(844);class d extends f.Disposable{constructor(_){super(),this._action=_,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new u.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(_,k){if(k!==void 0&&this._syncCalls>k)return void(this._syncCalls=0);if(this._pendingData+=_.length,this._writeBuffer.push(_),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let S;for(this._isSyncWriting=!0;S=this._writeBuffer.shift();){this._action(S);const m=this._callbacks.shift();m&&m()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(_,k){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=_.length,this._writeBuffer.push(_),this._callbacks.push(k),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=_.length,this._writeBuffer.push(_),this._callbacks.push(k)}_innerWrite(_=0,k=!0){const S=_||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const m=this._writeBuffer[this._bufferOffset],x=this._action(m,k);if(x){const b=C=>Date.now()-S>=12?setTimeout((()=>this._innerWrite(0,C))):this._innerWrite(S,C);return void x.catch((C=>(queueMicrotask((()=>{throw C})),Promise.resolve(!1)))).then(b)}const v=this._callbacks[this._bufferOffset];if(v&&v(),this._bufferOffset++,this._pendingData-=m.length,Date.now()-S>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}o.WriteBuffer=d},5941:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.toRgbString=o.parseColor=void 0;const h=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,u=/^[\da-f]+$/;function f(d,g){const _=d.toString(16),k=_.length<2?"0"+_:_;switch(g){case 4:return _[0];case 8:return k;case 12:return(k+k).slice(0,3);default:return k+k}}o.parseColor=function(d){if(!d)return;let g=d.toLowerCase();if(g.indexOf("rgb:")===0){g=g.slice(4);const _=h.exec(g);if(_){const k=_[1]?15:_[4]?255:_[7]?4095:65535;return[Math.round(parseInt(_[1]||_[4]||_[7]||_[10],16)/k*255),Math.round(parseInt(_[2]||_[5]||_[8]||_[11],16)/k*255),Math.round(parseInt(_[3]||_[6]||_[9]||_[12],16)/k*255)]}}else if(g.indexOf("#")===0&&(g=g.slice(1),u.exec(g)&&[3,6,9,12].includes(g.length))){const _=g.length/3,k=[0,0,0];for(let S=0;S<3;++S){const m=parseInt(g.slice(_*S,_*S+_),16);k[S]=_===1?m<<4:_===2?m:_===3?m>>4:m>>8}return k}},o.toRgbString=function(d,g=16){const[_,k,S]=d;return`rgb:${f(_,g)}/${f(k,g)}/${f(S,g)}`}},5770:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.PAYLOAD_LIMIT=void 0,o.PAYLOAD_LIMIT=1e7},6351:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DcsHandler=o.DcsParser=void 0;const u=h(482),f=h(8742),d=h(5770),g=[];o.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=g,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=g}registerHandler(k,S){this._handlers[k]===void 0&&(this._handlers[k]=[]);const m=this._handlers[k];return m.push(S),{dispose:()=>{const x=m.indexOf(S);x!==-1&&m.splice(x,1)}}}clearHandler(k){this._handlers[k]&&delete this._handlers[k]}setHandlerFallback(k){this._handlerFb=k}reset(){if(this._active.length)for(let k=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;k>=0;--k)this._active[k].unhook(!1);this._stack.paused=!1,this._active=g,this._ident=0}hook(k,S){if(this.reset(),this._ident=k,this._active=this._handlers[k]||g,this._active.length)for(let m=this._active.length-1;m>=0;m--)this._active[m].hook(S);else this._handlerFb(this._ident,"HOOK",S)}put(k,S,m){if(this._active.length)for(let x=this._active.length-1;x>=0;x--)this._active[x].put(k,S,m);else this._handlerFb(this._ident,"PUT",(0,u.utf32ToString)(k,S,m))}unhook(k,S=!0){if(this._active.length){let m=!1,x=this._active.length-1,v=!1;if(this._stack.paused&&(x=this._stack.loopPosition-1,m=S,v=this._stack.fallThrough,this._stack.paused=!1),!v&&m===!1){for(;x>=0&&(m=this._active[x].unhook(k),m!==!0);x--)if(m instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=x,this._stack.fallThrough=!1,m;x--}for(;x>=0;x--)if(m=this._active[x].unhook(!1),m instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=x,this._stack.fallThrough=!0,m}else this._handlerFb(this._ident,"UNHOOK",k);this._active=g,this._ident=0}};const _=new f.Params;_.addParam(0),o.DcsHandler=class{constructor(k){this._handler=k,this._data="",this._params=_,this._hitLimit=!1}hook(k){this._params=k.length>1||k.params[0]?k.clone():_,this._data="",this._hitLimit=!1}put(k,S,m){this._hitLimit||(this._data+=(0,u.utf32ToString)(k,S,m),this._data.length>d.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(k){let S=!1;if(this._hitLimit)S=!1;else if(k&&(S=this._handler(this._data,this._params),S instanceof Promise))return S.then((m=>(this._params=_,this._data="",this._hitLimit=!1,m)));return this._params=_,this._data="",this._hitLimit=!1,S}}},2015:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.EscapeSequenceParser=o.VT500_TRANSITION_TABLE=o.TransitionTable=void 0;const u=h(844),f=h(8742),d=h(6242),g=h(6351);class _{constructor(x){this.table=new Uint8Array(x)}setDefault(x,v){this.table.fill(x<<4|v)}add(x,v,b,C){this.table[v<<8|x]=b<<4|C}addMany(x,v,b,C){for(let E=0;E<x.length;E++)this.table[v<<8|x[E]]=b<<4|C}}o.TransitionTable=_;const k=160;o.VT500_TRANSITION_TABLE=(function(){const m=new _(4095),x=Array.apply(null,Array(256)).map(((T,A)=>A)),v=(T,A)=>x.slice(T,A),b=v(32,127),C=v(0,24);C.push(25),C.push.apply(C,v(28,32));const E=v(0,14);let P;for(P in m.setDefault(1,0),m.addMany(b,0,2,0),E)m.addMany([24,26,153,154],P,3,0),m.addMany(v(128,144),P,3,0),m.addMany(v(144,152),P,3,0),m.add(156,P,0,0),m.add(27,P,11,1),m.add(157,P,4,8),m.addMany([152,158,159],P,0,7),m.add(155,P,11,3),m.add(144,P,11,9);return m.addMany(C,0,3,0),m.addMany(C,1,3,1),m.add(127,1,0,1),m.addMany(C,8,0,8),m.addMany(C,3,3,3),m.add(127,3,0,3),m.addMany(C,4,3,4),m.add(127,4,0,4),m.addMany(C,6,3,6),m.addMany(C,5,3,5),m.add(127,5,0,5),m.addMany(C,2,3,2),m.add(127,2,0,2),m.add(93,1,4,8),m.addMany(b,8,5,8),m.add(127,8,5,8),m.addMany([156,27,24,26,7],8,6,0),m.addMany(v(28,32),8,0,8),m.addMany([88,94,95],1,0,7),m.addMany(b,7,0,7),m.addMany(C,7,0,7),m.add(156,7,0,0),m.add(127,7,0,7),m.add(91,1,11,3),m.addMany(v(64,127),3,7,0),m.addMany(v(48,60),3,8,4),m.addMany([60,61,62,63],3,9,4),m.addMany(v(48,60),4,8,4),m.addMany(v(64,127),4,7,0),m.addMany([60,61,62,63],4,0,6),m.addMany(v(32,64),6,0,6),m.add(127,6,0,6),m.addMany(v(64,127),6,0,0),m.addMany(v(32,48),3,9,5),m.addMany(v(32,48),5,9,5),m.addMany(v(48,64),5,0,6),m.addMany(v(64,127),5,7,0),m.addMany(v(32,48),4,9,5),m.addMany(v(32,48),1,9,2),m.addMany(v(32,48),2,9,2),m.addMany(v(48,127),2,10,0),m.addMany(v(48,80),1,10,0),m.addMany(v(81,88),1,10,0),m.addMany([89,90,92],1,10,0),m.addMany(v(96,127),1,10,0),m.add(80,1,11,9),m.addMany(C,9,0,9),m.add(127,9,0,9),m.addMany(v(28,32),9,0,9),m.addMany(v(32,48),9,9,12),m.addMany(v(48,60),9,8,10),m.addMany([60,61,62,63],9,9,10),m.addMany(C,11,0,11),m.addMany(v(32,128),11,0,11),m.addMany(v(28,32),11,0,11),m.addMany(C,10,0,10),m.add(127,10,0,10),m.addMany(v(28,32),10,0,10),m.addMany(v(48,60),10,8,10),m.addMany([60,61,62,63],10,0,11),m.addMany(v(32,48),10,9,12),m.addMany(C,12,0,12),m.add(127,12,0,12),m.addMany(v(28,32),12,0,12),m.addMany(v(32,48),12,9,12),m.addMany(v(48,64),12,0,11),m.addMany(v(64,127),12,12,13),m.addMany(v(64,127),10,12,13),m.addMany(v(64,127),9,12,13),m.addMany(C,13,13,13),m.addMany(b,13,13,13),m.add(127,13,0,13),m.addMany([27,156,24,26],13,14,0),m.add(k,0,2,0),m.add(k,8,5,8),m.add(k,6,0,6),m.add(k,11,0,11),m.add(k,13,13,13),m})();class S extends u.Disposable{constructor(x=o.VT500_TRANSITION_TABLE){super(),this._transitions=x,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new f.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(v,b,C)=>{},this._executeHandlerFb=v=>{},this._csiHandlerFb=(v,b)=>{},this._escHandlerFb=v=>{},this._errorHandlerFb=v=>v,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,u.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new d.OscParser),this._dcsParser=this.register(new g.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(x,v=[64,126]){let b=0;if(x.prefix){if(x.prefix.length>1)throw new Error("only one byte as prefix supported");if(b=x.prefix.charCodeAt(0),b&&60>b||b>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(x.intermediates){if(x.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let E=0;E<x.intermediates.length;++E){const P=x.intermediates.charCodeAt(E);if(32>P||P>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");b<<=8,b|=P}}if(x.final.length!==1)throw new Error("final must be a single byte");const C=x.final.charCodeAt(0);if(v[0]>C||C>v[1])throw new Error(`final must be in range ${v[0]} .. ${v[1]}`);return b<<=8,b|=C,b}identToString(x){const v=[];for(;x;)v.push(String.fromCharCode(255&x)),x>>=8;return v.reverse().join("")}setPrintHandler(x){this._printHandler=x}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(x,v){const b=this._identifier(x,[48,126]);this._escHandlers[b]===void 0&&(this._escHandlers[b]=[]);const C=this._escHandlers[b];return C.push(v),{dispose:()=>{const E=C.indexOf(v);E!==-1&&C.splice(E,1)}}}clearEscHandler(x){this._escHandlers[this._identifier(x,[48,126])]&&delete this._escHandlers[this._identifier(x,[48,126])]}setEscHandlerFallback(x){this._escHandlerFb=x}setExecuteHandler(x,v){this._executeHandlers[x.charCodeAt(0)]=v}clearExecuteHandler(x){this._executeHandlers[x.charCodeAt(0)]&&delete this._executeHandlers[x.charCodeAt(0)]}setExecuteHandlerFallback(x){this._executeHandlerFb=x}registerCsiHandler(x,v){const b=this._identifier(x);this._csiHandlers[b]===void 0&&(this._csiHandlers[b]=[]);const C=this._csiHandlers[b];return C.push(v),{dispose:()=>{const E=C.indexOf(v);E!==-1&&C.splice(E,1)}}}clearCsiHandler(x){this._csiHandlers[this._identifier(x)]&&delete this._csiHandlers[this._identifier(x)]}setCsiHandlerFallback(x){this._csiHandlerFb=x}registerDcsHandler(x,v){return this._dcsParser.registerHandler(this._identifier(x),v)}clearDcsHandler(x){this._dcsParser.clearHandler(this._identifier(x))}setDcsHandlerFallback(x){this._dcsParser.setHandlerFallback(x)}registerOscHandler(x,v){return this._oscParser.registerHandler(x,v)}clearOscHandler(x){this._oscParser.clearHandler(x)}setOscHandlerFallback(x){this._oscParser.setHandlerFallback(x)}setErrorHandler(x){this._errorHandler=x}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(x,v,b,C,E){this._parseStack.state=x,this._parseStack.handlers=v,this._parseStack.handlerPos=b,this._parseStack.transition=C,this._parseStack.chunkPos=E}parse(x,v,b){let C,E=0,P=0,T=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,T=this._parseStack.chunkPos+1;else{if(b===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const A=this._parseStack.handlers;let D=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(b===!1&&D>-1){for(;D>=0&&(C=A[D](this._params),C!==!0);D--)if(C instanceof Promise)return this._parseStack.handlerPos=D,C}this._parseStack.handlers=[];break;case 4:if(b===!1&&D>-1){for(;D>=0&&(C=A[D](),C!==!0);D--)if(C instanceof Promise)return this._parseStack.handlerPos=D,C}this._parseStack.handlers=[];break;case 6:if(E=x[this._parseStack.chunkPos],C=this._dcsParser.unhook(E!==24&&E!==26,b),C)return C;E===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(E=x[this._parseStack.chunkPos],C=this._oscParser.end(E!==24&&E!==26,b),C)return C;E===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,T=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let A=T;A<v;++A){switch(E=x[A],P=this._transitions.table[this.currentState<<8|(E<160?E:k)],P>>4){case 2:for(let U=A+1;;++U){if(U>=v||(E=x[U])<32||E>126&&E<k){this._printHandler(x,A,U),A=U-1;break}if(++U>=v||(E=x[U])<32||E>126&&E<k){this._printHandler(x,A,U),A=U-1;break}if(++U>=v||(E=x[U])<32||E>126&&E<k){this._printHandler(x,A,U),A=U-1;break}if(++U>=v||(E=x[U])<32||E>126&&E<k){this._printHandler(x,A,U),A=U-1;break}}break;case 3:this._executeHandlers[E]?this._executeHandlers[E]():this._executeHandlerFb(E),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:A,code:E,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const D=this._csiHandlers[this._collect<<8|E];let I=D?D.length-1:-1;for(;I>=0&&(C=D[I](this._params),C!==!0);I--)if(C instanceof Promise)return this._preserveStack(3,D,I,P,A),C;I<0&&this._csiHandlerFb(this._collect<<8|E,this._params),this.precedingJoinState=0;break;case 8:do switch(E){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(E-48)}while(++A<v&&(E=x[A])>47&&E<60);A--;break;case 9:this._collect<<=8,this._collect|=E;break;case 10:const O=this._escHandlers[this._collect<<8|E];let z=O?O.length-1:-1;for(;z>=0&&(C=O[z](),C!==!0);z--)if(C instanceof Promise)return this._preserveStack(4,O,z,P,A),C;z<0&&this._escHandlerFb(this._collect<<8|E),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|E,this._params);break;case 13:for(let U=A+1;;++U)if(U>=v||(E=x[U])===24||E===26||E===27||E>127&&E<k){this._dcsParser.put(x,A,U),A=U-1;break}break;case 14:if(C=this._dcsParser.unhook(E!==24&&E!==26),C)return this._preserveStack(6,[],0,P,A),C;E===27&&(P|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let U=A+1;;U++)if(U>=v||(E=x[U])<32||E>127&&E<k){this._oscParser.put(x,A,U),A=U-1;break}break;case 6:if(C=this._oscParser.end(E!==24&&E!==26),C)return this._preserveStack(5,[],0,P,A),C;E===27&&(P|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&P}}}o.EscapeSequenceParser=S},6242:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.OscHandler=o.OscParser=void 0;const u=h(5770),f=h(482),d=[];o.OscParser=class{constructor(){this._state=0,this._active=d,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(g,_){this._handlers[g]===void 0&&(this._handlers[g]=[]);const k=this._handlers[g];return k.push(_),{dispose:()=>{const S=k.indexOf(_);S!==-1&&k.splice(S,1)}}}clearHandler(g){this._handlers[g]&&delete this._handlers[g]}setHandlerFallback(g){this._handlerFb=g}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=d}reset(){if(this._state===2)for(let g=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;g>=0;--g)this._active[g].end(!1);this._stack.paused=!1,this._active=d,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||d,this._active.length)for(let g=this._active.length-1;g>=0;g--)this._active[g].start();else this._handlerFb(this._id,"START")}_put(g,_,k){if(this._active.length)for(let S=this._active.length-1;S>=0;S--)this._active[S].put(g,_,k);else this._handlerFb(this._id,"PUT",(0,f.utf32ToString)(g,_,k))}start(){this.reset(),this._state=1}put(g,_,k){if(this._state!==3){if(this._state===1)for(;_<k;){const S=g[_++];if(S===59){this._state=2,this._start();break}if(S<48||57<S)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+S-48}this._state===2&&k-_>0&&this._put(g,_,k)}}end(g,_=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let k=!1,S=this._active.length-1,m=!1;if(this._stack.paused&&(S=this._stack.loopPosition-1,k=_,m=this._stack.fallThrough,this._stack.paused=!1),!m&&k===!1){for(;S>=0&&(k=this._active[S].end(g),k!==!0);S--)if(k instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=S,this._stack.fallThrough=!1,k;S--}for(;S>=0;S--)if(k=this._active[S].end(!1),k instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=S,this._stack.fallThrough=!0,k}else this._handlerFb(this._id,"END",g);this._active=d,this._id=-1,this._state=0}}},o.OscHandler=class{constructor(g){this._handler=g,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(g,_,k){this._hitLimit||(this._data+=(0,f.utf32ToString)(g,_,k),this._data.length>u.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(g){let _=!1;if(this._hitLimit)_=!1;else if(g&&(_=this._handler(this._data),_ instanceof Promise))return _.then((k=>(this._data="",this._hitLimit=!1,k)));return this._data="",this._hitLimit=!1,_}}},8742:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Params=void 0;const h=2147483647;class u{static fromArray(d){const g=new u;if(!d.length)return g;for(let _=Array.isArray(d[0])?1:0;_<d.length;++_){const k=d[_];if(Array.isArray(k))for(let S=0;S<k.length;++S)g.addSubParam(k[S]);else g.addParam(k)}return g}constructor(d=32,g=32){if(this.maxLength=d,this.maxSubParamsLength=g,g>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(d),this.length=0,this._subParams=new Int32Array(g),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(d),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const d=new u(this.maxLength,this.maxSubParamsLength);return d.params.set(this.params),d.length=this.length,d._subParams.set(this._subParams),d._subParamsLength=this._subParamsLength,d._subParamsIdx.set(this._subParamsIdx),d._rejectDigits=this._rejectDigits,d._rejectSubDigits=this._rejectSubDigits,d._digitIsSub=this._digitIsSub,d}toArray(){const d=[];for(let g=0;g<this.length;++g){d.push(this.params[g]);const _=this._subParamsIdx[g]>>8,k=255&this._subParamsIdx[g];k-_>0&&d.push(Array.prototype.slice.call(this._subParams,_,k))}return d}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(d){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(d<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=d>h?h:d}}addSubParam(d){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(d<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=d>h?h:d,this._subParamsIdx[this.length-1]++}}hasSubParams(d){return(255&this._subParamsIdx[d])-(this._subParamsIdx[d]>>8)>0}getSubParams(d){const g=this._subParamsIdx[d]>>8,_=255&this._subParamsIdx[d];return _-g>0?this._subParams.subarray(g,_):null}getSubParamsAll(){const d={};for(let g=0;g<this.length;++g){const _=this._subParamsIdx[g]>>8,k=255&this._subParamsIdx[g];k-_>0&&(d[g]=this._subParams.slice(_,k))}return d}addDigit(d){let g;if(this._rejectDigits||!(g=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const _=this._digitIsSub?this._subParams:this.params,k=_[g-1];_[g-1]=~k?Math.min(10*k+d,h):d}}o.Params=u},5741:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.AddonManager=void 0,o.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let h=this._addons.length-1;h>=0;h--)this._addons[h].instance.dispose()}loadAddon(h,u){const f={instance:u,dispose:u.dispose,isDisposed:!1};this._addons.push(f),u.dispose=()=>this._wrappedAddonDispose(f),u.activate(h)}_wrappedAddonDispose(h){if(h.isDisposed)return;let u=-1;for(let f=0;f<this._addons.length;f++)if(this._addons[f]===h){u=f;break}if(u===-1)throw new Error("Could not dispose an addon that has not been loaded");h.isDisposed=!0,h.dispose.apply(h.instance),this._addons.splice(u,1)}}},8771:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferApiView=void 0;const u=h(3785),f=h(511);o.BufferApiView=class{constructor(d,g){this._buffer=d,this.type=g}init(d){return this._buffer=d,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(d){const g=this._buffer.lines.get(d);if(g)return new u.BufferLineApiView(g)}getNullCell(){return new f.CellData}}},3785:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferLineApiView=void 0;const u=h(511);o.BufferLineApiView=class{constructor(f){this._line=f}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(f,d){if(!(f<0||f>=this._line.length))return d?(this._line.loadCell(f,d),d):this._line.loadCell(f,new u.CellData)}translateToString(f,d,g){return this._line.translateToString(f,d,g)}}},8285:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferNamespaceApi=void 0;const u=h(8771),f=h(8460),d=h(844);class g extends d.Disposable{constructor(k){super(),this._core=k,this._onBufferChange=this.register(new f.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new u.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new u.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}o.BufferNamespaceApi=g},7975:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ParserApi=void 0,o.ParserApi=class{constructor(h){this._core=h}registerCsiHandler(h,u){return this._core.registerCsiHandler(h,(f=>u(f.toArray())))}addCsiHandler(h,u){return this.registerCsiHandler(h,u)}registerDcsHandler(h,u){return this._core.registerDcsHandler(h,((f,d)=>u(f,d.toArray())))}addDcsHandler(h,u){return this.registerDcsHandler(h,u)}registerEscHandler(h,u){return this._core.registerEscHandler(h,u)}addEscHandler(h,u){return this.registerEscHandler(h,u)}registerOscHandler(h,u){return this._core.registerOscHandler(h,u)}addOscHandler(h,u){return this.registerOscHandler(h,u)}}},7090:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeApi=void 0,o.UnicodeApi=class{constructor(h){this._core=h}register(h){this._core.unicodeService.register(h)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(h){this._core.unicodeService.activeVersion=h}}},744:function(c,o,h){var u=this&&this.__decorate||function(m,x,v,b){var C,E=arguments.length,P=E<3?x:b===null?b=Object.getOwnPropertyDescriptor(x,v):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")P=Reflect.decorate(m,x,v,b);else for(var T=m.length-1;T>=0;T--)(C=m[T])&&(P=(E<3?C(P):E>3?C(x,v,P):C(x,v))||P);return E>3&&P&&Object.defineProperty(x,v,P),P},f=this&&this.__param||function(m,x){return function(v,b){x(v,b,m)}};Object.defineProperty(o,"__esModule",{value:!0}),o.BufferService=o.MINIMUM_ROWS=o.MINIMUM_COLS=void 0;const d=h(8460),g=h(844),_=h(5295),k=h(2585);o.MINIMUM_COLS=2,o.MINIMUM_ROWS=1;let S=o.BufferService=class extends g.Disposable{get buffer(){return this.buffers.active}constructor(m){super(),this.isUserScrolling=!1,this._onResize=this.register(new d.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new d.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(m.rawOptions.cols||0,o.MINIMUM_COLS),this.rows=Math.max(m.rawOptions.rows||0,o.MINIMUM_ROWS),this.buffers=this.register(new _.BufferSet(m,this))}resize(m,x){this.cols=m,this.rows=x,this.buffers.resize(m,x),this._onResize.fire({cols:m,rows:x})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(m,x=!1){const v=this.buffer;let b;b=this._cachedBlankLine,b&&b.length===this.cols&&b.getFg(0)===m.fg&&b.getBg(0)===m.bg||(b=v.getBlankLine(m,x),this._cachedBlankLine=b),b.isWrapped=x;const C=v.ybase+v.scrollTop,E=v.ybase+v.scrollBottom;if(v.scrollTop===0){const P=v.lines.isFull;E===v.lines.length-1?P?v.lines.recycle().copyFrom(b):v.lines.push(b.clone()):v.lines.splice(E+1,0,b.clone()),P?this.isUserScrolling&&(v.ydisp=Math.max(v.ydisp-1,0)):(v.ybase++,this.isUserScrolling||v.ydisp++)}else{const P=E-C+1;v.lines.shiftElements(C+1,P-1,-1),v.lines.set(E,b.clone())}this.isUserScrolling||(v.ydisp=v.ybase),this._onScroll.fire(v.ydisp)}scrollLines(m,x,v){const b=this.buffer;if(m<0){if(b.ydisp===0)return;this.isUserScrolling=!0}else m+b.ydisp>=b.ybase&&(this.isUserScrolling=!1);const C=b.ydisp;b.ydisp=Math.max(Math.min(b.ydisp+m,b.ybase),0),C!==b.ydisp&&(x||this._onScroll.fire(b.ydisp))}};o.BufferService=S=u([f(0,k.IOptionsService)],S)},7994:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CharsetService=void 0,o.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(h){this.glevel=h,this.charset=this._charsets[h]}setgCharset(h,u){this._charsets[h]=u,this.glevel===h&&(this.charset=u)}}},1753:function(c,o,h){var u=this&&this.__decorate||function(b,C,E,P){var T,A=arguments.length,D=A<3?C:P===null?P=Object.getOwnPropertyDescriptor(C,E):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(b,C,E,P);else for(var I=b.length-1;I>=0;I--)(T=b[I])&&(D=(A<3?T(D):A>3?T(C,E,D):T(C,E))||D);return A>3&&D&&Object.defineProperty(C,E,D),D},f=this&&this.__param||function(b,C){return function(E,P){C(E,P,b)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CoreMouseService=void 0;const d=h(2585),g=h(8460),_=h(844),k={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:b=>b.button!==4&&b.action===1&&(b.ctrl=!1,b.alt=!1,b.shift=!1,!0)},VT200:{events:19,restrict:b=>b.action!==32},DRAG:{events:23,restrict:b=>b.action!==32||b.button!==3},ANY:{events:31,restrict:b=>!0}};function S(b,C){let E=(b.ctrl?16:0)|(b.shift?4:0)|(b.alt?8:0);return b.button===4?(E|=64,E|=b.action):(E|=3&b.button,4&b.button&&(E|=64),8&b.button&&(E|=128),b.action===32?E|=32:b.action!==0||C||(E|=3)),E}const m=String.fromCharCode,x={DEFAULT:b=>{const C=[S(b,!1)+32,b.col+32,b.row+32];return C[0]>255||C[1]>255||C[2]>255?"":`\x1B[M${m(C[0])}${m(C[1])}${m(C[2])}`},SGR:b=>{const C=b.action===0&&b.button!==4?"m":"M";return`\x1B[<${S(b,!0)};${b.col};${b.row}${C}`},SGR_PIXELS:b=>{const C=b.action===0&&b.button!==4?"m":"M";return`\x1B[<${S(b,!0)};${b.x};${b.y}${C}`}};let v=o.CoreMouseService=class extends _.Disposable{constructor(b,C){super(),this._bufferService=b,this._coreService=C,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new g.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const E of Object.keys(k))this.addProtocol(E,k[E]);for(const E of Object.keys(x))this.addEncoding(E,x[E]);this.reset()}addProtocol(b,C){this._protocols[b]=C}addEncoding(b,C){this._encodings[b]=C}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(b){if(!this._protocols[b])throw new Error(`unknown protocol "${b}"`);this._activeProtocol=b,this._onProtocolChange.fire(this._protocols[b].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(b){if(!this._encodings[b])throw new Error(`unknown encoding "${b}"`);this._activeEncoding=b}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(b){if(b.col<0||b.col>=this._bufferService.cols||b.row<0||b.row>=this._bufferService.rows||b.button===4&&b.action===32||b.button===3&&b.action!==32||b.button!==4&&(b.action===2||b.action===3)||(b.col++,b.row++,b.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,b,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(b))return!1;const C=this._encodings[this._activeEncoding](b);return C&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(C):this._coreService.triggerDataEvent(C,!0)),this._lastEvent=b,!0}explainEvents(b){return{down:!!(1&b),up:!!(2&b),drag:!!(4&b),move:!!(8&b),wheel:!!(16&b)}}_equalEvents(b,C,E){if(E){if(b.x!==C.x||b.y!==C.y)return!1}else if(b.col!==C.col||b.row!==C.row)return!1;return b.button===C.button&&b.action===C.action&&b.ctrl===C.ctrl&&b.alt===C.alt&&b.shift===C.shift}};o.CoreMouseService=v=u([f(0,d.IBufferService),f(1,d.ICoreService)],v)},6975:function(c,o,h){var u=this&&this.__decorate||function(v,b,C,E){var P,T=arguments.length,A=T<3?b:E===null?E=Object.getOwnPropertyDescriptor(b,C):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(v,b,C,E);else for(var D=v.length-1;D>=0;D--)(P=v[D])&&(A=(T<3?P(A):T>3?P(b,C,A):P(b,C))||A);return T>3&&A&&Object.defineProperty(b,C,A),A},f=this&&this.__param||function(v,b){return function(C,E){b(C,E,v)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CoreService=void 0;const d=h(1439),g=h(8460),_=h(844),k=h(2585),S=Object.freeze({insertMode:!1}),m=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let x=o.CoreService=class extends _.Disposable{constructor(v,b,C){super(),this._bufferService=v,this._logService=b,this._optionsService=C,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new g.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new g.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new g.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new g.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,d.clone)(S),this.decPrivateModes=(0,d.clone)(m)}reset(){this.modes=(0,d.clone)(S),this.decPrivateModes=(0,d.clone)(m)}triggerDataEvent(v,b=!1){if(this._optionsService.rawOptions.disableStdin)return;const C=this._bufferService.buffer;b&&this._optionsService.rawOptions.scrollOnUserInput&&C.ybase!==C.ydisp&&this._onRequestScrollToBottom.fire(),b&&this._onUserInput.fire(),this._logService.debug(`sending data "${v}"`,(()=>v.split("").map((E=>E.charCodeAt(0))))),this._onData.fire(v)}triggerBinaryEvent(v){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${v}"`,(()=>v.split("").map((b=>b.charCodeAt(0))))),this._onBinary.fire(v))}};o.CoreService=x=u([f(0,k.IBufferService),f(1,k.ILogService),f(2,k.IOptionsService)],x)},9074:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DecorationService=void 0;const u=h(8055),f=h(8460),d=h(844),g=h(6106);let _=0,k=0;class S extends d.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new g.SortedList((v=>v==null?void 0:v.marker.line)),this._onDecorationRegistered=this.register(new f.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new f.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,d.toDisposable)((()=>this.reset())))}registerDecoration(v){if(v.marker.isDisposed)return;const b=new m(v);if(b){const C=b.marker.onDispose((()=>b.dispose()));b.onDispose((()=>{b&&(this._decorations.delete(b)&&this._onDecorationRemoved.fire(b),C.dispose())})),this._decorations.insert(b),this._onDecorationRegistered.fire(b)}return b}reset(){for(const v of this._decorations.values())v.dispose();this._decorations.clear()}*getDecorationsAtCell(v,b,C){let E=0,P=0;for(const T of this._decorations.getKeyIterator(b))E=T.options.x??0,P=E+(T.options.width??1),v>=E&&v<P&&(!C||(T.options.layer??"bottom")===C)&&(yield T)}forEachDecorationAtCell(v,b,C,E){this._decorations.forEachByKey(b,(P=>{_=P.options.x??0,k=_+(P.options.width??1),v>=_&&v<k&&(!C||(P.options.layer??"bottom")===C)&&E(P)}))}}o.DecorationService=S;class m extends d.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=u.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=u.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(v){super(),this.options=v,this.onRenderEmitter=this.register(new f.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new f.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=v.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.InstantiationService=o.ServiceCollection=void 0;const u=h(2585),f=h(8343);class d{constructor(..._){this._entries=new Map;for(const[k,S]of _)this.set(k,S)}set(_,k){const S=this._entries.get(_);return this._entries.set(_,k),S}forEach(_){for(const[k,S]of this._entries.entries())_(k,S)}has(_){return this._entries.has(_)}get(_){return this._entries.get(_)}}o.ServiceCollection=d,o.InstantiationService=class{constructor(){this._services=new d,this._services.set(u.IInstantiationService,this)}setService(g,_){this._services.set(g,_)}getService(g){return this._services.get(g)}createInstance(g,..._){const k=(0,f.getServiceDependencies)(g).sort(((x,v)=>x.index-v.index)),S=[];for(const x of k){const v=this._services.get(x.id);if(!v)throw new Error(`[createInstance] ${g.name} depends on UNKNOWN service ${x.id}.`);S.push(v)}const m=k.length>0?k[0].index:_.length;if(_.length!==m)throw new Error(`[createInstance] First service dependency of ${g.name} at position ${m+1} conflicts with ${_.length} static arguments`);return new g(..._,...S)}}},7866:function(c,o,h){var u=this&&this.__decorate||function(m,x,v,b){var C,E=arguments.length,P=E<3?x:b===null?b=Object.getOwnPropertyDescriptor(x,v):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")P=Reflect.decorate(m,x,v,b);else for(var T=m.length-1;T>=0;T--)(C=m[T])&&(P=(E<3?C(P):E>3?C(x,v,P):C(x,v))||P);return E>3&&P&&Object.defineProperty(x,v,P),P},f=this&&this.__param||function(m,x){return function(v,b){x(v,b,m)}};Object.defineProperty(o,"__esModule",{value:!0}),o.traceCall=o.setTraceLogger=o.LogService=void 0;const d=h(844),g=h(2585),_={trace:g.LogLevelEnum.TRACE,debug:g.LogLevelEnum.DEBUG,info:g.LogLevelEnum.INFO,warn:g.LogLevelEnum.WARN,error:g.LogLevelEnum.ERROR,off:g.LogLevelEnum.OFF};let k,S=o.LogService=class extends d.Disposable{get logLevel(){return this._logLevel}constructor(m){super(),this._optionsService=m,this._logLevel=g.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),k=this}_updateLogLevel(){this._logLevel=_[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(m){for(let x=0;x<m.length;x++)typeof m[x]=="function"&&(m[x]=m[x]())}_log(m,x,v){this._evalLazyOptionalParams(v),m.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+x,...v)}trace(m,...x){var v;this._logLevel<=g.LogLevelEnum.TRACE&&this._log(((v=this._optionsService.options.logger)==null?void 0:v.trace.bind(this._optionsService.options.logger))??console.log,m,x)}debug(m,...x){var v;this._logLevel<=g.LogLevelEnum.DEBUG&&this._log(((v=this._optionsService.options.logger)==null?void 0:v.debug.bind(this._optionsService.options.logger))??console.log,m,x)}info(m,...x){var v;this._logLevel<=g.LogLevelEnum.INFO&&this._log(((v=this._optionsService.options.logger)==null?void 0:v.info.bind(this._optionsService.options.logger))??console.info,m,x)}warn(m,...x){var v;this._logLevel<=g.LogLevelEnum.WARN&&this._log(((v=this._optionsService.options.logger)==null?void 0:v.warn.bind(this._optionsService.options.logger))??console.warn,m,x)}error(m,...x){var v;this._logLevel<=g.LogLevelEnum.ERROR&&this._log(((v=this._optionsService.options.logger)==null?void 0:v.error.bind(this._optionsService.options.logger))??console.error,m,x)}};o.LogService=S=u([f(0,g.IOptionsService)],S),o.setTraceLogger=function(m){k=m},o.traceCall=function(m,x,v){if(typeof v.value!="function")throw new Error("not supported");const b=v.value;v.value=function(...C){if(k.logLevel!==g.LogLevelEnum.TRACE)return b.apply(this,C);k.trace(`GlyphRenderer#${b.name}(${C.map((P=>JSON.stringify(P))).join(", ")})`);const E=b.apply(this,C);return k.trace(`GlyphRenderer#${b.name} return`,E),E}}},7302:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.OptionsService=o.DEFAULT_OPTIONS=void 0;const u=h(8460),f=h(844),d=h(6114);o.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:d.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const g=["normal","bold","100","200","300","400","500","600","700","800","900"];class _ extends f.Disposable{constructor(S){super(),this._onOptionChange=this.register(new u.EventEmitter),this.onOptionChange=this._onOptionChange.event;const m={...o.DEFAULT_OPTIONS};for(const x in S)if(x in m)try{const v=S[x];m[x]=this._sanitizeAndValidateOption(x,v)}catch(v){console.error(v)}this.rawOptions=m,this.options={...m},this._setupOptions(),this.register((0,f.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(S,m){return this.onOptionChange((x=>{x===S&&m(this.rawOptions[S])}))}onMultipleOptionChange(S,m){return this.onOptionChange((x=>{S.indexOf(x)!==-1&&m()}))}_setupOptions(){const S=x=>{if(!(x in o.DEFAULT_OPTIONS))throw new Error(`No option with key "${x}"`);return this.rawOptions[x]},m=(x,v)=>{if(!(x in o.DEFAULT_OPTIONS))throw new Error(`No option with key "${x}"`);v=this._sanitizeAndValidateOption(x,v),this.rawOptions[x]!==v&&(this.rawOptions[x]=v,this._onOptionChange.fire(x))};for(const x in this.rawOptions){const v={get:S.bind(this,x),set:m.bind(this,x)};Object.defineProperty(this.options,x,v)}}_sanitizeAndValidateOption(S,m){switch(S){case"cursorStyle":if(m||(m=o.DEFAULT_OPTIONS[S]),!(function(x){return x==="block"||x==="underline"||x==="bar"})(m))throw new Error(`"${m}" is not a valid value for ${S}`);break;case"wordSeparator":m||(m=o.DEFAULT_OPTIONS[S]);break;case"fontWeight":case"fontWeightBold":if(typeof m=="number"&&1<=m&&m<=1e3)break;m=g.includes(m)?m:o.DEFAULT_OPTIONS[S];break;case"cursorWidth":m=Math.floor(m);case"lineHeight":case"tabStopWidth":if(m<1)throw new Error(`${S} cannot be less than 1, value: ${m}`);break;case"minimumContrastRatio":m=Math.max(1,Math.min(21,Math.round(10*m)/10));break;case"scrollback":if((m=Math.min(m,4294967295))<0)throw new Error(`${S} cannot be less than 0, value: ${m}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(m<=0)throw new Error(`${S} cannot be less than or equal to 0, value: ${m}`);break;case"rows":case"cols":if(!m&&m!==0)throw new Error(`${S} must be numeric, value: ${m}`);break;case"windowsPty":m=m??{}}return m}}o.OptionsService=_},2660:function(c,o,h){var u=this&&this.__decorate||function(_,k,S,m){var x,v=arguments.length,b=v<3?k:m===null?m=Object.getOwnPropertyDescriptor(k,S):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(_,k,S,m);else for(var C=_.length-1;C>=0;C--)(x=_[C])&&(b=(v<3?x(b):v>3?x(k,S,b):x(k,S))||b);return v>3&&b&&Object.defineProperty(k,S,b),b},f=this&&this.__param||function(_,k){return function(S,m){k(S,m,_)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OscLinkService=void 0;const d=h(2585);let g=o.OscLinkService=class{constructor(_){this._bufferService=_,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(_){const k=this._bufferService.buffer;if(_.id===void 0){const C=k.addMarker(k.ybase+k.y),E={data:_,id:this._nextId++,lines:[C]};return C.onDispose((()=>this._removeMarkerFromLink(E,C))),this._dataByLinkId.set(E.id,E),E.id}const S=_,m=this._getEntryIdKey(S),x=this._entriesWithId.get(m);if(x)return this.addLineToLink(x.id,k.ybase+k.y),x.id;const v=k.addMarker(k.ybase+k.y),b={id:this._nextId++,key:this._getEntryIdKey(S),data:S,lines:[v]};return v.onDispose((()=>this._removeMarkerFromLink(b,v))),this._entriesWithId.set(b.key,b),this._dataByLinkId.set(b.id,b),b.id}addLineToLink(_,k){const S=this._dataByLinkId.get(_);if(S&&S.lines.every((m=>m.line!==k))){const m=this._bufferService.buffer.addMarker(k);S.lines.push(m),m.onDispose((()=>this._removeMarkerFromLink(S,m)))}}getLinkData(_){var k;return(k=this._dataByLinkId.get(_))==null?void 0:k.data}_getEntryIdKey(_){return`${_.id};;${_.uri}`}_removeMarkerFromLink(_,k){const S=_.lines.indexOf(k);S!==-1&&(_.lines.splice(S,1),_.lines.length===0&&(_.data.id!==void 0&&this._entriesWithId.delete(_.key),this._dataByLinkId.delete(_.id)))}};o.OscLinkService=g=u([f(0,d.IBufferService)],g)},8343:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.createDecorator=o.getServiceDependencies=o.serviceRegistry=void 0;const h="di$target",u="di$dependencies";o.serviceRegistry=new Map,o.getServiceDependencies=function(f){return f[u]||[]},o.createDecorator=function(f){if(o.serviceRegistry.has(f))return o.serviceRegistry.get(f);const d=function(g,_,k){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(S,m,x){m[h]===m?m[u].push({id:S,index:x}):(m[u]=[{id:S,index:x}],m[h]=m)})(d,g,k)};return d.toString=()=>f,o.serviceRegistry.set(f,d),d}},2585:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.IDecorationService=o.IUnicodeService=o.IOscLinkService=o.IOptionsService=o.ILogService=o.LogLevelEnum=o.IInstantiationService=o.ICharsetService=o.ICoreService=o.ICoreMouseService=o.IBufferService=void 0;const u=h(8343);var f;o.IBufferService=(0,u.createDecorator)("BufferService"),o.ICoreMouseService=(0,u.createDecorator)("CoreMouseService"),o.ICoreService=(0,u.createDecorator)("CoreService"),o.ICharsetService=(0,u.createDecorator)("CharsetService"),o.IInstantiationService=(0,u.createDecorator)("InstantiationService"),(function(d){d[d.TRACE=0]="TRACE",d[d.DEBUG=1]="DEBUG",d[d.INFO=2]="INFO",d[d.WARN=3]="WARN",d[d.ERROR=4]="ERROR",d[d.OFF=5]="OFF"})(f||(o.LogLevelEnum=f={})),o.ILogService=(0,u.createDecorator)("LogService"),o.IOptionsService=(0,u.createDecorator)("OptionsService"),o.IOscLinkService=(0,u.createDecorator)("OscLinkService"),o.IUnicodeService=(0,u.createDecorator)("UnicodeService"),o.IDecorationService=(0,u.createDecorator)("DecorationService")},1480:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeService=void 0;const u=h(8460),f=h(225);class d{static extractShouldJoin(_){return(1&_)!=0}static extractWidth(_){return _>>1&3}static extractCharKind(_){return _>>3}static createPropertyValue(_,k,S=!1){return(16777215&_)<<3|(3&k)<<1|(S?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new u.EventEmitter,this.onChange=this._onChange.event;const _=new f.UnicodeV6;this.register(_),this._active=_.version,this._activeProvider=_}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(_){if(!this._providers[_])throw new Error(`unknown Unicode version "${_}"`);this._active=_,this._activeProvider=this._providers[_],this._onChange.fire(_)}register(_){this._providers[_.version]=_}wcwidth(_){return this._activeProvider.wcwidth(_)}getStringCellWidth(_){let k=0,S=0;const m=_.length;for(let x=0;x<m;++x){let v=_.charCodeAt(x);if(55296<=v&&v<=56319){if(++x>=m)return k+this.wcwidth(v);const E=_.charCodeAt(x);56320<=E&&E<=57343?v=1024*(v-55296)+E-56320+65536:k+=this.wcwidth(E)}const b=this.charProperties(v,S);let C=d.extractWidth(b);d.extractShouldJoin(b)&&(C-=d.extractWidth(S)),k+=C,S=b}return k}charProperties(_,k){return this._activeProvider.charProperties(_,k)}}o.UnicodeService=d}},r={};function i(c){var o=r[c];if(o!==void 0)return o.exports;var h=r[c]={exports:{}};return s[c].call(h.exports,h,h.exports,i),h.exports}var a={};return(()=>{var c=a;Object.defineProperty(c,"__esModule",{value:!0}),c.Terminal=void 0;const o=i(9042),h=i(3236),u=i(844),f=i(5741),d=i(8285),g=i(7975),_=i(7090),k=["cols","rows"];class S extends u.Disposable{constructor(x){super(),this._core=this.register(new h.Terminal(x)),this._addonManager=this.register(new f.AddonManager),this._publicOptions={...this._core.options};const v=C=>this._core.options[C],b=(C,E)=>{this._checkReadonlyOptions(C),this._core.options[C]=E};for(const C in this._core.options){const E={get:v.bind(this,C),set:b.bind(this,C)};Object.defineProperty(this._publicOptions,C,E)}}_checkReadonlyOptions(x){if(k.includes(x))throw new Error(`Option "${x}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new g.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new _.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new d.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const x=this._core.coreService.decPrivateModes;let v="none";switch(this._core.coreMouseService.activeProtocol){case"X10":v="x10";break;case"VT200":v="vt200";break;case"DRAG":v="drag";break;case"ANY":v="any"}return{applicationCursorKeysMode:x.applicationCursorKeys,applicationKeypadMode:x.applicationKeypad,bracketedPasteMode:x.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:v,originMode:x.origin,reverseWraparoundMode:x.reverseWraparound,sendFocusMode:x.sendFocus,wraparoundMode:x.wraparound}}get options(){return this._publicOptions}set options(x){for(const v in x)this._publicOptions[v]=x[v]}blur(){this._core.blur()}focus(){this._core.focus()}input(x,v=!0){this._core.input(x,v)}resize(x,v){this._verifyIntegers(x,v),this._core.resize(x,v)}open(x){this._core.open(x)}attachCustomKeyEventHandler(x){this._core.attachCustomKeyEventHandler(x)}attachCustomWheelEventHandler(x){this._core.attachCustomWheelEventHandler(x)}registerLinkProvider(x){return this._core.registerLinkProvider(x)}registerCharacterJoiner(x){return this._checkProposedApi(),this._core.registerCharacterJoiner(x)}deregisterCharacterJoiner(x){this._checkProposedApi(),this._core.deregisterCharacterJoiner(x)}registerMarker(x=0){return this._verifyIntegers(x),this._core.registerMarker(x)}registerDecoration(x){return this._checkProposedApi(),this._verifyPositiveIntegers(x.x??0,x.width??0,x.height??0),this._core.registerDecoration(x)}hasSelection(){return this._core.hasSelection()}select(x,v,b){this._verifyIntegers(x,v,b),this._core.select(x,v,b)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(x,v){this._verifyIntegers(x,v),this._core.selectLines(x,v)}dispose(){super.dispose()}scrollLines(x){this._verifyIntegers(x),this._core.scrollLines(x)}scrollPages(x){this._verifyIntegers(x),this._core.scrollPages(x)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(x){this._verifyIntegers(x),this._core.scrollToLine(x)}clear(){this._core.clear()}write(x,v){this._core.write(x,v)}writeln(x,v){this._core.write(x),this._core.write(`\r
326
+ `,v)}paste(x){this._core.paste(x)}refresh(x,v){this._verifyIntegers(x,v),this._core.refresh(x,v)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(x){this._addonManager.loadAddon(this,x)}static get strings(){return o}_verifyIntegers(...x){for(const v of x)if(v===1/0||isNaN(v)||v%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...x){for(const v of x)if(v&&(v===1/0||isNaN(v)||v%1!=0||v<0))throw new Error("This API only accepts positive integers")}}c.Terminal=S})(),a})()))})(Ed)),Ed.exports}var lL=aL();const Jb=[{id:"pixel",label:"Pixel",hint:"Pixelify Sans, the game look"},{id:"clean",label:"Clean",hint:"Inter, easiest to read"},{id:"mono",label:"Mono",hint:"JetBrains Mono, like a terminal"}],ew="jsmhq.font",xf="jsmhq:font";function xy(t){return t==="pixel"?{family:'"VT323", ui-monospace, Menlo, monospace',size:19,lineHeight:1.05,load:'19px "VT323"'}:{family:'"JetBrains Mono", ui-monospace, Menlo, monospace',size:13,lineHeight:1.2,load:'13px "JetBrains Mono"'}}function kp(){try{const t=localStorage.getItem(ew);return Jb.some(e=>e.id===t)?t:"pixel"}catch{return"pixel"}}function tw(t){t==="pixel"?delete document.documentElement.dataset.font:document.documentElement.dataset.font=t}function cL(t){tw(t),window.dispatchEvent(new CustomEvent(xf,{detail:t}));try{localStorage.setItem(ew,t)}catch{}}const hL={background:"#16213f",foreground:"#dfe6ff",cursor:"#dfe6ff",cursorAccent:"#16213f",selectionBackground:"#2c3b6b",black:"#241a2e",red:"#ff5c86",green:"#6cf08a",yellow:"#ffc14d",blue:"#29adff",magenta:"#ff77a8",cyan:"#3ee0d0",white:"#dfe6ff"};function yy(t){let e;try{e=new URL(t)}catch{return}e.protocol!=="http:"&&e.protocol!=="https:"||window.open(e.href,"_blank","noopener,noreferrer")}function oa({agentId:t,autoFocus:e=!0}){const s=re.useRef(null);return re.useEffect(()=>{const r=s.current;if(!r)return;let i=!1;const a=xy(kp()),c=new lL.Terminal({theme:hL,fontFamily:a.family,fontSize:a.size,lineHeight:a.lineHeight,cursorBlink:!0,scrollback:3e3,convertEol:!1,allowProposedApi:!1,linkHandler:{activate:(d,g)=>yy(g),allowNonHttpProtocols:!1}}),o=new iL.FitAddon;c.loadAddon(o),c.loadAddon(new oL.WebLinksAddon((d,g)=>yy(g)));let h=()=>{},u=null;const f=d=>{const g=xy(d.detail);document.fonts.load(g.load).finally(()=>{if(!i){c.options.fontFamily=g.family,c.options.fontSize=g.size,c.options.lineHeight=g.lineHeight;try{o.fit()}catch{}}})};return window.addEventListener(xf,f),document.fonts.load(a.load).finally(()=>{i||(c.open(r),o.fit(),me.resizeTerminal(t,c.cols,c.rows),c.onResize(({cols:d,rows:g})=>me.resizeTerminal(t,d,g)),c.write(cM(t)),h=hM(t,d=>c.write(d)),c.onData(d=>me.sendTerminalInput(t,d)),c.attachCustomKeyEventHandler(d=>d.key!=="Enter"||!d.shiftKey||d.ctrlKey||d.metaKey||d.altKey?!0:(d.type==="keydown"&&me.sendTerminalInput(t,"\x1B\r"),d.preventDefault(),!1)),u=new ResizeObserver(()=>{try{o.fit()}catch{}}),u.observe(r),e&&c.focus())}),()=>{i=!0,window.removeEventListener(xf,f),h(),u==null||u.disconnect(),c.dispose()}},[t,e]),y.jsx("div",{ref:s,className:"h-full min-h-0 w-full bg-navy-2"})}function uL({id:t,initialTab:e}){var u;const s=be(f=>f.snap),[r,i]=re.useState(e??"terminal"),a=s==null?void 0:s.config.team.find(f=>f.id===t),c=s==null?void 0:s.agents.find(f=>f.agentId===t);if(!s||!a||!c)return y.jsx(y.Fragment,{children:y.jsx(Ti,{children:y.jsx("b",{children:"Agent removed"})})});const o=s.messages.filter(f=>f.toId===t).length,h=(u=s.accessRequests)==null?void 0:u.find(f=>f.agentId===t&&f.status==="pending");return y.jsxs(y.Fragment,{children:[y.jsxs(Ti,{children:[y.jsx(Sn,{color:a.color,lead:a.isLead,size:36}),y.jsxs("div",{className:"min-w-0",children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("b",{className:"text-[18px]",children:a.name}),y.jsx(Kb,{state:c.state})]}),y.jsxs("div",{className:"truncate font-term text-[17px] text-muted",children:[a.role," · ",Pi[a.cli],a.model?` ${a.model}`:""," · ",a.mode==="sandbox"?"Docker Sandbox":"Local mode"]})]})]}),y.jsx(gL,{agent:a,status:c}),h?y.jsx(pL,{request:h,agent:a}):c.note&&y.jsxs("div",{className:`border-b-[3px] border-ink px-3 py-1.5 text-[14px] ${c.state==="needs-input"?"bg-[#ffe1ea] text-red":"bg-cream-2"}`,children:[c.note,c.state==="needs-input"&&y.jsx("span",{className:"ml-2 text-muted",children:"— answer in the terminal and press Enter"})]}),y.jsx(fL,{agent:a}),y.jsx(tL,{agent:a,status:c}),y.jsx("div",{className:"border-b-[3px] border-ink px-3 py-2",children:y.jsx(eL,{value:r,onChange:i,tabs:[{id:"terminal",label:"Terminal"},{id:"shell",label:"Shell"},{id:"task",label:"Task"},{id:"sandbox",label:"Sandbox"},{id:"messages",label:`Messages${o?` · ${o}`:""}`}]})}),y.jsxs("div",{className:"min-h-0 flex-1 overflow-hidden",children:[r==="terminal"&&(c.session.state==="running"?y.jsx(oa,{agentId:t}):y.jsx(_L,{agent:a,status:c})),r==="shell"&&y.jsx(dL,{agent:a,status:c}),r==="task"&&y.jsx(vL,{snap:s,agent:a,taskId:c.currentTaskId}),r==="sandbox"&&y.jsx(xL,{snap:s,agent:a}),r==="messages"&&y.jsx(yL,{snap:s,agent:a})]})]})}function dL({agent:t,status:e}){const s=e.session.state==="running",[r,i]=re.useState(0);return re.useEffect(()=>{s&&me.openShell(t.id)},[t.id,s,r]),s?y.jsxs("div",{className:"flex h-full flex-col",children:[y.jsxs("div",{className:"flex items-center gap-2 border-b-[3px] border-ink bg-cream-2 px-3 py-1 text-[12px] text-muted",children:[y.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.mode==="sandbox"?`A shell in ${t.name}'s sandbox, beside the agent`:`Your shell in ${t.name}'s folder`}),y.jsx("button",{className:"btn px-2 text-[12px] text-ink",onClick:()=>{me.closeShell(t.id),i(a=>a+1)},children:"New shell"})]}),y.jsx("div",{className:"min-h-0 flex-1",children:y.jsx(oa,{agentId:`shell:${t.id}`})})]}):y.jsxs("div",{className:"p-4 text-[14px] text-muted",children:["Start ",t.name," first. The shell opens inside ",t.mode==="sandbox"?"their sandbox":"their folder","."]})}function fL({agent:t}){const e=be(u=>{var f,d;return(d=(f=u.snap)==null?void 0:f.sbx.agents[t.id])==null?void 0:d.approvals})??[],[s,r]=re.useState(!1),[i,a]=re.useState(!1),c=e.map(u=>u.id).join(",");if(re.useEffect(()=>a(!1),[c]),!e.length)return null;const o=(u,f)=>{a(!0),me.answerApproval(t.id,u,f),window.setTimeout(()=>a(!1),15e3)},h=s?e:e.slice(0,3);return y.jsxs("div",{className:"border-b-[3px] border-ink bg-[#fff1d6] px-3 py-1.5 text-[13px]",children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsxs("b",{className:"flex-1",children:["Blocked by the sandbox · ",e.length]}),y.jsx("button",{className:"text-[12px] underline disabled:opacity-50",disabled:i,onClick:()=>{const u=[...new Set(e.map(d=>d.title??d.host))],f=u.slice(0,15).join(`
327
+ `)+(u.length>15?`
328
+ …and ${u.length-15} more`:"");window.confirm(`Allow all ${u.length} for ${t.name}'s sandbox?
329
+
330
+ ${f}
331
+
332
+ Only allow sites you trust. You can remove them later in Settings → Sandbox.`)&&o("all","allow")},children:"Allow all"}),y.jsx("button",{className:"text-[12px] underline disabled:opacity-50",disabled:i,onClick:()=>o("all","dismiss"),children:"Dismiss all"})]}),y.jsx("ul",{className:"mt-1",children:h.map(u=>y.jsxs("li",{className:"flex items-center gap-2 py-0.5",children:[y.jsx("span",{className:"min-w-0 flex-1 truncate font-term text-[16px]",title:`${u.title??u.host} — ${u.detail}`,children:u.title??u.host}),y.jsx("button",{className:"btn px-1.5 text-[11px]",disabled:i,onClick:()=>o(u.id,"allow"),children:"Allow"}),y.jsx("button",{className:"btn px-1.5 text-[11px]",disabled:i,onClick:()=>o(u.id,"dismiss"),children:"Dismiss"})]},u.id))}),e.length>3&&y.jsx("button",{className:"text-[12px] underline",onClick:()=>r(!s),children:s?"Show fewer":`Show all ${e.length}`})]})}function pL({request:t,agent:e}){return y.jsxs("div",{className:"border-b-[3px] border-ink bg-[#ffe1ea] px-3 py-2",children:[y.jsxs("div",{className:"text-[14px] text-red",children:[y.jsx("b",{children:e.name})," wants to reach ",y.jsx("b",{className:"font-term text-[17px]",children:t.domain})]}),y.jsxs("div",{className:"mb-2 text-[13px] text-muted",children:["“",t.reason,"”"]}),y.jsxs("div",{className:"flex flex-wrap gap-2",children:[y.jsxs("button",{className:"btn px-2 text-[13px]",onClick:()=>me.resolveAccess(t.id,"agent"),children:["Allow for ",e.name]}),y.jsx("button",{className:"btn px-2 text-[13px]",onClick:()=>me.resolveAccess(t.id,"everyone"),children:"Allow for everyone"}),y.jsx("button",{className:"btn px-2 text-[13px]",onClick:()=>me.resolveAccess(t.id,"deny"),children:"Deny"})]})]})}const mL={running:"#00e436",starting:"#29adff",stopped:"#83769c",failed:"#ff004d"};function gL({agent:t,status:e}){const s=e.session,r=be(i=>i.live);return y.jsxs("div",{className:"flex items-center gap-2 border-b-[3px] border-ink bg-cream px-3 py-1.5 text-[13px]",children:[y.jsx("span",{className:`chip chip-dot ${s.state==="starting"?"blink":""}`,style:{"--c":mL[s.state]},children:s.state==="running"?"Session running":s.state==="starting"?"Starting":s.state==="failed"?"Failed":"Stopped"}),y.jsx("span",{className:"min-w-0 flex-1 truncate font-term text-[15px] text-muted",title:s.workspace??void 0,children:s.state==="starting"?s.detail:s.workspace??""}),s.workspace&&r&&y.jsx("button",{className:"btn px-2 text-[12px]",onClick:()=>me.openWorkspace(t.id),title:"Open the agent's folder",children:"Open folder"}),s.state==="running"||s.state==="starting"?y.jsx("button",{className:"btn px-2 text-[12px]",disabled:s.state==="starting",onClick:()=>me.stopAgent(t.id),children:"Stop"}):y.jsx("button",{className:"btn px-2 text-[12px]",onClick:()=>me.startAgent(t.id),children:"Start"})]})}function _L({agent:t,status:e}){const s=e.session,r=be(a=>{var c;return(c=a.snap)==null?void 0:c.setup}),i=t.mode==="sandbox"?!(r!=null&&r.sandboxReady):!(r!=null&&r.localReady);return y.jsx("div",{className:"grid h-full place-items-center bg-navy-2 p-6 text-center text-[#dfe6ff]",children:y.jsx("div",{className:"max-w-[380px]",children:s.state==="starting"?y.jsx("p",{className:"blink font-term text-[22px]",children:s.detail??"Starting…"}):y.jsxs(y.Fragment,{children:[y.jsx("p",{className:"mb-2 font-term text-[22px]",children:s.state==="failed"?`${t.name} could not start`:`${t.name} isn't running`}),s.detail&&y.jsx("pre",{className:"mb-3 whitespace-pre-wrap border-2 border-red px-2 py-1 text-left font-term text-[16px] text-[#ffd0dc]",children:s.detail}),y.jsx("p",{className:"mb-4 text-[13px] text-[#9aa6d1]",children:t.mode==="sandbox"?`Start runs ${Pi[t.cli]} in a Docker Sandbox on this agent's own copy of the repo.`:`Start runs ${Pi[t.cli]} locally in this agent's own copy of the repo, with permission prompts on.`}),t.cli==="codex"&&y.jsxs("p",{className:"mb-4 text-[12px] text-[#ffc14d]",children:["First start only: Codex asks you to trust this folder and HQ's hooks. Choose ",y.jsx("b",{children:"Yes"}),", then ",y.jsx("b",{children:"Trust all and continue"}),", in the terminal."]}),y.jsx("p",{className:"hidden"}),y.jsxs("div",{className:"flex justify-center gap-2",children:[y.jsxs("button",{className:"btn text-ink",onClick:()=>me.startAgent(t.id),children:["Start ",t.name]}),i&&y.jsx("button",{className:"btn text-ink",onClick:()=>Se.openSetup(),children:"Setup checklist"})]})]})})})}function vL({snap:t,agent:e,taskId:s}){var u,f;const r=s?t.tasks.find(d=>d.id===s):null,i=r!=null&&r.prNumber?t.pullRequests.find(d=>d.number===r.prNumber):null,a=t.boards.filter(d=>d.status==="active"),c=t.tasks.filter(d=>d.status==="todo"&&a.some(g=>g.id===d.boardId)),[o,h]=re.useState("");return e.isLead?y.jsxs("div",{className:"scroll-thin h-full overflow-y-auto p-4",children:[y.jsx(Le,{children:"Planning"}),y.jsx("p",{className:"mb-3 text-[15px]",children:"The lead plans and assigns work through the HQ Team MCP. It writes no app code."}),a.map(d=>{const g=t.tasks.filter(k=>k.boardId===d.id),_=k=>g.filter(S=>S.status===k).length;return y.jsxs("button",{className:"panel mb-2 block w-full px-3 py-2 text-left",onClick:()=>Se.openBoards(d.id),children:[y.jsx("b",{children:d.title}),y.jsxs("div",{className:"font-term text-[17px] text-muted",children:[_("todo")," to do · ",_("in-progress")," in progress · ",_("in-review")," in review · ",_("done")," done"]})]},d.id)})]}):y.jsxs("div",{className:"scroll-thin h-full overflow-y-auto p-4",children:[y.jsx(Le,{children:"Current task"}),r?y.jsxs("div",{className:"panel mb-4 px-3 py-2",children:[y.jsxs("div",{className:"font-term text-[18px] text-muted",children:[r.id," · ",(u=t.boards.find(d=>d.id===r.boardId))==null?void 0:u.title]}),y.jsx("b",{className:"text-[17px]",children:r.title}),y.jsxs("div",{className:"mt-1 text-[14px]",children:["Status: ",r.status,r.note?` — ${r.note}`:""]}),r.description&&y.jsx("p",{className:"mt-1 whitespace-pre-wrap text-[14px]",children:r.description}),!!((f=r.files)!=null&&f.length)&&y.jsxs("div",{className:"mt-1 text-[13px]",children:["Files: ",r.files.map(d=>y.jsx("code",{className:"mr-1 bg-cream-2 px-1 font-term text-[15px]",children:d},d))]}),r.doneWhen&&y.jsxs("div",{className:"mt-1 text-[13px]",children:[y.jsx("b",{children:"Done when:"})," ",r.doneWhen]}),r.needs.length>0&&y.jsxs("div",{className:"text-[14px]",children:["Needs: ",r.needs.map(d=>{var g;return`${d} (${((g=t.tasks.find(_=>_.id===d))==null?void 0:g.status)??"?"})`}).join(", ")]}),i&&y.jsxs("div",{className:"mt-2 flex items-center gap-2 text-[14px]",children:[y.jsxs("button",{className:"font-semibold underline",onClick:()=>Se.openPrs(),children:["PR #",i.number]}),y.jsx(Yb,{review:i.review,merged:i.merged}),i.openComments>0&&y.jsxs("span",{children:[i.openComments," comments"]})]})]}):y.jsx("p",{className:"mb-4 text-[15px] text-muted",children:"No task right now."}),y.jsx(Le,{children:"Assign a task"}),y.jsxs("div",{className:"flex gap-2",children:[y.jsxs("select",{className:"field",value:o,onChange:d=>h(d.target.value),"aria-label":"Task to assign",children:[y.jsx("option",{value:"",children:"Pick a to-do task…"}),c.map(d=>y.jsxs("option",{value:d.id,children:[d.id," ",d.title]},d.id))]}),y.jsx("button",{className:"btn",disabled:!o,onClick:()=>(me.assignTask(o,e.id),h("")),children:"Assign"})]}),y.jsxs("p",{className:"mt-1 text-[12px] text-muted",children:["If ",e.name," is free, the lead tells them to start right away."]})]})}function xL({snap:t,agent:e}){var o,h,u,f;const s=t.environments.find(d=>d.agentId===e.id),r=Di(5e3),i=e.sandbox,a=(o=t.agents.find(d=>d.agentId===e.id))==null?void 0:o.session.sandbox,c=(d,g)=>y.jsxs("div",{className:"grid grid-cols-[140px_1fr] gap-2 border-t border-dashed border-cream-3 py-1.5 text-[14px] first:border-t-0",children:[y.jsx("span",{className:"text-muted",children:d}),y.jsx("span",{className:"min-w-0 break-words",children:g})]});return y.jsxs("div",{className:"scroll-thin h-full overflow-y-auto p-4",children:[y.jsx(Le,{children:"Sandbox"}),y.jsxs("div",{className:"panel mb-4 px-3 py-1",children:[c("Mode",e.mode==="sandbox"?"Docker Sandbox (microVM), full access inside the VM":"Local worktree, permission prompts on"),c("Resources",y.jsxs(y.Fragment,{children:[i.resources.cpus||i.resources.memoryGb?`${i.resources.cpus??"all"} CPUs · ${i.resources.memoryGb??"default"} GB`:"sbx default",a&&y.jsxs("span",{className:"text-muted",children:[" (now ",a.cpus," CPUs · ",a.memoryGb," GB)"]})]})),c("Network",`base: ${t.sbx.basePolicy}`),c("Allowed",i.allow.length?i.allow.join(", "):"—"),c("Blocked",i.deny.length?i.deny.join(", "):"—"),c("MCP servers",e.mode!=="sandbox"?y.jsx("span",{className:"text-muted",children:"Sandbox mode only"}):(e.mcp??[]).length?(e.mcp??[]).map(d=>{var g,_;return y.jsxs("span",{className:"chip mb-1 mr-1 font-term text-[14px]",title:(((g=t.mcp)==null?void 0:g.attached[e.id])??[]).includes(d)?"Attached":"Attaches on next start",children:[d,(((_=t.mcp)==null?void 0:_.attached[e.id])??[]).includes(d)?"":" · next start"]},d)}):y.jsx("button",{className:"text-[13px] underline",onClick:()=>Se.openSettings("mcp"),children:"None — add in Settings → MCP"})),c("Ports",y.jsx(sL,{agent:e,running:((h=t.agents.find(d=>d.agentId===e.id))==null?void 0:h.session.state)==="running"})),c("HQ access",y.jsxs("span",{className:"font-term text-[17px]",children:["localhost / host.docker.internal :",t.config.project.hqPort," (added by HQ)"]})),c("Service keys",[...t.sbx.globalKeys.map(d=>`${d} (all)`),...((u=t.sbx.agents[e.id])==null?void 0:u.keys)??[]].map(d=>y.jsx("span",{className:"chip mb-1 mr-1 font-term text-[14px]",children:d},d))),c("App variables",(f=t.sbx.agents[e.id])!=null&&f.envFile.exists?"env file set":"—"),c("Skills",e.skills.join(", ")||"—")]}),s&&y.jsxs(y.Fragment,{children:[y.jsx(Le,{children:"Environment"}),y.jsxs("button",{className:"panel mb-4 block w-full px-3 py-2 text-left",onClick:()=>Se.openEnv(s.name),children:[y.jsx("div",{className:"font-term text-[17px]",children:s.url}),y.jsxs("div",{className:"text-[14px] text-muted",children:[s.status," · deployed ",Vr(s.lastDeployAt,r)," ago"]})]})]}),y.jsx("button",{className:"btn",onClick:()=>Se.openSettings("sandbox",e.id),children:"Edit sandbox settings"})]})}function yL({snap:t,agent:e}){var u;const s=Di(1e3),[r,i]=re.useState(""),a=t.messages.filter(f=>f.fromId===e.id||f.toId===e.id),c=f=>f===IP?{name:"You",color:"#ffec27"}:f==="hq"?{name:"HQ",color:"#3ee0d0"}:t.config.team.find(d=>d.id===f),o=((u=t.agents.find(f=>f.agentId===e.id))==null?void 0:u.session.state)==="running",h=()=>{r.trim()&&(me.sendMessage(e.id,r.trim()),i(""))};return y.jsxs("div",{className:"flex h-full flex-col",children:[y.jsxs("div",{className:"scroll-thin min-h-0 flex-1 overflow-y-auto p-4",children:[y.jsx(Le,{children:"Team MCP messages"}),y.jsx("p",{className:"mb-3 text-[13px] text-muted",children:"Agents can't reach each other's sandboxes. Every message goes through HQ."}),a.length===0&&y.jsx("p",{className:"text-[15px] text-muted",children:"No messages yet."}),y.jsx("ul",{className:"flex flex-col gap-2",children:a.map(f=>{const d=f.fromId===e.id,g=c(d?f.toId:f.fromId);return y.jsxs("li",{className:`border-2 border-ink px-2.5 py-1.5 ${d?"ml-8 bg-white":"mr-8 bg-cream-2"}`,children:[y.jsxs("div",{className:"flex items-center gap-1.5 text-[13px] text-muted",children:[g&&y.jsx(Mn,{color:g.color,size:8}),d?`To ${(g==null?void 0:g.name)??"?"}`:`From ${(g==null?void 0:g.name)??"?"}`,y.jsx("span",{className:"ml-auto font-term text-[15px]",children:Vr(f.at,s)})]}),y.jsx("div",{className:"text-[15px]",children:f.text})]},f.id)})})]}),y.jsxs("form",{className:"flex gap-2 border-t-[3px] border-ink bg-cream p-2",onSubmit:f=>{f.preventDefault(),h()},children:[y.jsx("input",{className:"field",value:r,onChange:f=>i(f.target.value),placeholder:`Message ${e.name}…`,"aria-label":`Message ${e.name}`}),y.jsx("button",{className:"btn",type:"submit",disabled:!r.trim(),children:"Send"})]}),y.jsx("p",{className:"bg-cream px-2 pb-1.5 text-[11px] text-muted",children:o?"Delivered now if idle, otherwise when the current turn ends.":`${e.name} isn't running; it's delivered after Start.`})]})}const bL=[{id:"todo",label:"To do",color:"#83769c"},{id:"in-progress",label:"Doing",color:"#29adff"},{id:"in-review",label:"Review",color:"#ffa300"},{id:"done",label:"Done",color:"#00e436"},{id:"blocked",label:"Blocked",color:"#ff004d"}],by={active:"Active",planned:"Planned",done:"Done"};function wL({initialBoardId:t}){var f,d,g;const e=be(_=>_.snap),s=Ie(_=>_.planBoardId),r=[...(e==null?void 0:e.boards)??[]].sort((_,k)=>_.order-k.order),[i,a]=re.useState(t??((f=r.find(_=>_.status==="active"))==null?void 0:f.id)??((d=r[0])==null?void 0:d.id));if(!e)return null;const c=r.find(_=>_.id===i),o=e.tasks.filter(_=>_.boardId===i),h=bL.filter(_=>_.id!=="blocked"||o.some(k=>k.status==="blocked")),u=(s??((g=r.find(_=>_.status==="active"))==null?void 0:g.id))===i;return y.jsxs(y.Fragment,{children:[y.jsxs(Ti,{children:[y.jsx("b",{className:"text-[18px]",children:"Boards"}),y.jsxs("span",{className:"text-[14px] text-muted",children:[r.length," in ",e.config.project.name]})]}),y.jsx("div",{className:"flex flex-wrap gap-1.5 border-b-[3px] border-ink px-3 py-2",children:r.map(_=>y.jsxs("button",{className:"btn px-2 text-[13px]","aria-pressed":_.id===i,onClick:()=>a(_.id),children:[_.status==="active"&&y.jsx("span",{className:"mr-1 text-blue",children:"●"}),_.title]},_.id))}),c&&y.jsxs("div",{className:"flex items-center gap-2 border-b-[3px] border-ink bg-cream-2 px-3 py-1.5 text-[14px]",children:[y.jsx("span",{className:"text-muted",children:"Status"}),y.jsx("select",{className:"field w-[120px] py-0 text-[14px]",value:c.status,onChange:_=>me.updateBoard(c.id,{status:_.target.value}),children:Object.keys(by).map(_=>y.jsx("option",{value:_,children:by[_]},_))}),y.jsx("span",{className:"text-[12px] text-muted",children:"Agents only pick tasks from active boards."}),y.jsx("button",{className:"btn ml-auto px-2 text-[13px]",disabled:u,onClick:()=>Se.showBoardOnWall(c.id),children:u?"On the wall":"Show on wall"})]}),y.jsxs("div",{className:"scroll-thin grid min-h-0 flex-1 auto-cols-[minmax(200px,1fr)] grid-flow-col gap-2 overflow-auto bg-[#f7f3ea] p-3",children:[h.map(_=>{const k=o.filter(S=>S.status===_.id);return _.id==="done"&&k.reverse(),y.jsxs("div",{className:"min-w-0",children:[y.jsxs("h4",{className:"mb-2 flex justify-between border-b-[3px] pb-0.5 text-[14px] font-semibold",style:{borderColor:_.color},children:[_.label," ",y.jsx("span",{className:"font-term text-[17px] text-muted",children:k.length})]}),y.jsx("div",{className:"flex flex-col gap-2",children:k.map(S=>y.jsx(SL,{task:S},S.id))})]},_.id)}),o.length===0&&y.jsx("p",{className:"col-span-full p-6 text-center text-muted",children:"No tasks on this board yet. The lead adds tasks when a board is active."})]})]})}function SL({task:t}){var a;const e=be(c=>c.snap),s=e==null?void 0:e.config.team.find(c=>c.id===t.ownerId),r=(e==null?void 0:e.config.team.filter(c=>!c.isLead))??[],i=t.needs.filter(c=>{var o;return((o=e==null?void 0:e.tasks.find(h=>h.id===c))==null?void 0:o.status)!=="done"});return y.jsxs("div",{className:`border-2 border-ink px-2 py-1.5 shadow-[0_3px_0_rgba(36,26,46,0.35)] ${t.status==="done"?"bg-[#e8e1d2] text-muted":"bg-white"}`,children:[y.jsxs("div",{className:"font-term text-[16px] leading-none text-muted",children:[t.id,t.prNumber&&y.jsxs("span",{className:"ml-1.5",children:["#",t.prNumber]})]}),y.jsx("div",{className:`text-[14px] font-semibold leading-tight ${t.status==="done"?"line-through":""}`,title:[t.description,(a=t.files)!=null&&a.length?`Files: ${t.files.join(", ")}`:"",t.doneWhen?`Done when: ${t.doneWhen}`:""].filter(Boolean).join(`
333
+
334
+ `)||void 0,children:t.title}),t.status==="blocked"&&t.note&&y.jsx("div",{className:"text-[12px] text-red",children:t.note}),y.jsx("div",{className:"mt-1 flex items-center gap-1.5 text-[12px]",children:s?y.jsxs(y.Fragment,{children:[y.jsx(Mn,{color:s.color,size:8})," ",s.name]}):y.jsx("span",{className:"text-muted",children:"Unassigned"})}),i.length>0&&t.status==="todo"&&y.jsxs("div",{className:"text-[12px] text-red",children:["Waits on ",i.join(", ")]}),t.status==="todo"&&y.jsxs("select",{className:"field mt-1 py-0 text-[12px]",value:"",onChange:c=>c.target.value&&me.assignTask(t.id,c.target.value),"aria-label":`Assign ${t.id}`,children:[y.jsx("option",{value:"",children:"Assign to…"}),r.map(c=>y.jsxs("option",{value:c.id,children:[c.name," (",c.role,")"]},c.id))]})]})}const CL={live:"#00e436",deploying:"#3ee0d0",sleeping:"#83769c"};function kL({name:t}){const e=be(c=>c.snap),s=Di(1e3);if(!e)return null;const r=e.environments.find(c=>c.name===t),i=r!=null&&r.agentId?e.config.team.find(c=>c.id===r.agentId):null,a=ql[e.config.workflow.deploy.tool];return y.jsxs(y.Fragment,{children:[y.jsxs(Ti,{children:[y.jsxs("b",{className:"text-[18px]",children:["Environment: ",t]}),r&&y.jsx("span",{className:`chip chip-dot ${r.status==="deploying"?"blink":""}`,style:{"--c":CL[r.status]},children:r.status})]}),y.jsxs("div",{className:"scroll-thin min-h-0 flex-1 overflow-y-auto p-4",children:[r?y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"panel mb-4 px-3 py-2 text-[14px]",children:[y.jsx("div",{className:"font-term text-[19px]",children:r.url}),y.jsxs("div",{className:"mt-1 text-muted",children:[a," · last deploy ",Vr(r.lastDeployAt,s)," ago"]})]}),y.jsx(Le,{children:"Used by"}),i?y.jsxs("button",{className:"panel mb-4 flex w-full items-center gap-3 px-3 py-2 text-left",onClick:()=>Se.openAgent(i.id),children:[y.jsx(Sn,{color:i.color,lead:i.isLead,size:32}),y.jsxs("div",{children:[y.jsx("b",{children:i.name}),y.jsx("div",{className:"text-[13px] text-muted",children:"Its own copy of the app and database, so agents never share state."})]})]}):y.jsx("p",{className:"mb-4 text-[15px]",children:"Production. Every merged PR deploys here."})]}):y.jsx("p",{className:"text-muted",children:"This environment no longer exists."}),y.jsx(Le,{children:"All environments"}),y.jsx("div",{className:"flex flex-wrap gap-2",children:e.environments.map(c=>y.jsx("button",{className:"btn text-[13px]","aria-pressed":c.name===t,onClick:()=>Se.openEnv(c.name),children:c.name},c.name))})]})]})}function EL(){const t=be(c=>c.snap),e=Di(5e3);if(!t)return null;const s=t.config.workflow,r=t.pullRequests.filter(c=>!c.merged&&!c.closed).sort((c,o)=>o.number-c.number),i=t.pullRequests.filter(c=>c.merged).sort((c,o)=>o.number-c.number).slice(0,15),a=({pr:c})=>{const o=t.config.team.find(h=>h.id===c.authorId);return y.jsxs("li",{className:"grid grid-cols-[52px_1fr_auto] items-center gap-2.5 border-[3px] border-ink bg-white px-2.5 py-1.5 shadow-[0_3px_0_rgba(36,26,46,0.35)]",children:[y.jsxs("span",{className:"font-term text-[24px] leading-none",children:["#",c.number]}),y.jsxs("div",{className:"min-w-0",children:[y.jsx("div",{className:"truncate text-[15px] font-semibold",children:c.title}),y.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] text-muted",children:[o&&y.jsx(Mn,{color:o.color,size:8}),y.jsx("button",{className:"underline",onClick:()=>o&&Se.openAgent(o.id),children:(o==null?void 0:o.name)??(c.authorId||"—")}),"· ",Vr(c.openedAt,e)," ago",!c.merged&&y.jsxs(y.Fragment,{children:[" · ",c.openComments," open comment",c.openComments===1?"":"s",c.conflict?" · merge conflict":""]})]}),c.reviewNote&&!c.merged&&y.jsx("div",{className:"text-[12px] text-[#a35d00]",children:c.reviewNote})]}),y.jsxs("div",{className:"flex flex-col items-end gap-1",children:[y.jsx(Yb,{review:c.review,merged:c.merged}),c.url?y.jsx("a",{className:"btn px-1.5 text-[11px]",href:c.url,target:"_blank",rel:"noreferrer",children:"Open on GitHub ↗"}):y.jsx("button",{className:"btn px-1.5 text-[11px]",disabled:!0,title:"Demo data has no GitHub link",children:"Open on GitHub"})]})]})};return y.jsxs(y.Fragment,{children:[y.jsxs(Ti,{children:[y.jsx("b",{className:"text-[18px]",children:"Pull requests"}),y.jsxs("span",{className:"truncate text-[14px] text-muted",children:["Review: ",s.review.enabled?Si[s.review.tool]:"off"," · Merge: ",s.merge.by==="lead"?"the lead":"you"]})]}),y.jsxs("div",{className:"scroll-thin min-h-0 flex-1 overflow-y-auto p-3",children:[y.jsxs(Le,{children:["Open · ",r.length]}),r.length===0&&y.jsx("p",{className:"mb-4 text-[15px] text-muted",children:"No open PRs."}),y.jsx("ul",{className:"mb-5 flex flex-col gap-2",children:r.map(c=>y.jsx(a,{pr:c},c.number))}),y.jsx(Le,{children:"Merged"}),y.jsx("ul",{className:"flex flex-col gap-2",children:i.map(c=>y.jsx(a,{pr:c},c.number))})]})]})}function PL(){const t=be(u=>u.snap),e=Di(1e4),[s,r]=re.useState(!1);if(!t)return null;const i=o1(t),a=u=>t.config.team.find(f=>f.id===u),c=(t.actionItems??[]).filter(u=>u.status!=="open").sort((u,f)=>(f.closedAt??"").localeCompare(u.closedAt??"")).slice(0,20),o=[...i.items].sort((u,f)=>Number(f.waiting)-Number(u.waiting)||u.at.localeCompare(f.at)),h=i.asking.length+i.access.length+i.blocked.length+i.readyPrs.length;return y.jsxs(y.Fragment,{children:[y.jsxs(Ti,{children:[y.jsx("b",{className:"text-[18px]",children:"Action items"}),y.jsx("span",{className:"text-[13px] text-muted",children:i.total?`${i.total} waiting on you`:"Nothing waiting on you"})]}),y.jsxs("div",{className:"scroll-thin min-h-0 flex-1 overflow-y-auto p-4",children:[y.jsx(Le,{children:"From agents"}),o.length===0?y.jsx("p",{className:"mb-4 text-[13px] text-muted",children:"No requests. When an agent needs you to do something outside its sandbox, it shows up here."}):y.jsx("ul",{className:"mb-4 flex flex-col gap-2",children:o.map(u=>y.jsx(ML,{item:u,from:a(u.fromId),now:e},u.id))}),h>0&&y.jsxs(y.Fragment,{children:[y.jsx(Le,{children:"Also waiting on you"}),y.jsxs("ul",{className:"mb-4 flex flex-col gap-1.5 text-[14px]",children:[i.asking.map(u=>{var f,d;return y.jsx(Wl,{color:(f=a(u.agentId))==null?void 0:f.color,text:`${((d=a(u.agentId))==null?void 0:d.name)??u.agentId} is asking you something in the terminal`,onOpen:()=>Se.openAgent(u.agentId,"terminal")},`ask-${u.agentId}`)}),i.access.map(u=>{var f,d;return y.jsx(Wl,{color:(f=a(u.agentId))==null?void 0:f.color,text:`${((d=a(u.agentId))==null?void 0:d.name)??u.agentId} wants to reach ${u.domain}`,onOpen:()=>Se.openAgent(u.agentId)},u.id)}),i.blocked.map(u=>{var f,d;return y.jsx(Wl,{color:(f=a(u.agentId))==null?void 0:f.color,text:`${((d=a(u.agentId))==null?void 0:d.name)??u.agentId}'s sandbox blocked ${u.count} request${u.count===1?"":"s"}`,onOpen:()=>Se.openAgent(u.agentId)},`blk-${u.agentId}`)}),i.readyPrs.map(u=>u.url?y.jsxs("li",{className:"flex items-center gap-2 border-[3px] border-ink bg-white px-2.5 py-1.5",children:[y.jsxs("span",{className:"flex-1",children:["PR ",y.jsxs("b",{children:["#",u.number]})," ",u.title," passed review and is ready to merge"]}),y.jsx("a",{className:"btn px-2 text-[12px]",href:u.url,target:"_blank",rel:"noreferrer",children:"Open ↗"})]},`pr-${u.number}`):y.jsx(Wl,{text:`PR #${u.number} ${u.title} passed review and is ready to merge`,onOpen:()=>Se.openPrs()},`pr-${u.number}`))]})]}),c.length>0&&y.jsxs(y.Fragment,{children:[y.jsx("button",{className:"text-[13px] underline",onClick:()=>r(!s),children:s?"Hide closed":`Show closed (${c.length})`}),s&&y.jsx("ul",{className:"mt-2 flex flex-col gap-1 text-[13px] text-muted",children:c.map(u=>{var f;return y.jsxs("li",{className:"border-t-2 border-dashed border-cream-3 py-1",children:[y.jsx("span",{className:u.status==="dismissed"?"line-through":"",children:u.title})," · ",((f=a(u.fromId))==null?void 0:f.name)??u.fromId," ·"," ",u.status," ",u.closedAt?`${Vr(u.closedAt,e)} ago`:"",u.note&&y.jsxs("div",{className:"pl-3",children:["“",u.note,"”"]})]},u.id)})})]})]})]})}function Wl({text:t,color:e,onOpen:s}){return y.jsxs("li",{className:"flex items-center gap-2 border-[3px] border-ink bg-white px-2.5 py-1.5",children:[e&&y.jsx(Mn,{color:e,size:8}),y.jsx("span",{className:"flex-1",children:t}),y.jsx("button",{className:"btn px-2 text-[12px]",onClick:s,children:"Open"})]})}function ML({item:t,from:e,now:s}){const[r,i]=re.useState(""),[a,c]=re.useState(!1),o=t.details.split(`
335
+ `).length>6||t.details.length>400;return y.jsxs("li",{className:`border-[3px] border-ink bg-white px-3 py-2 shadow-[0_3px_0_rgba(36,26,46,0.35)] ${t.waiting?"outline outline-[3px] outline-orange":""}`,children:[y.jsxs("div",{className:"flex items-start gap-2",children:[y.jsx("b",{className:"flex-1 text-[15px]",children:t.title}),t.waiting&&y.jsx("span",{className:"chip shrink-0 text-[11px]",style:{background:"#fff1d6"},children:"waiting"})]}),y.jsxs("div",{className:"mb-1 flex items-center gap-1.5 text-[12px] text-muted",children:[e&&y.jsx(Mn,{color:e.color,size:8}),y.jsx("button",{className:"underline",onClick:()=>e&&Se.openAgent(e.id,"messages"),children:(e==null?void 0:e.name)??t.fromId}),t.taskId&&y.jsxs("span",{children:["· ",t.taskId]}),y.jsxs("span",{children:["· ",Vr(t.at,s)," ago"]})]}),t.details&&y.jsx("div",{className:`whitespace-pre-wrap text-[13px] ${o&&!a?"line-clamp-6":""}`,children:t.details}),o&&y.jsx("button",{className:"text-[12px] underline",onClick:()=>c(!a),children:a?"Show less":"Show all"}),y.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[y.jsx("input",{className:"field min-w-0 flex-1 text-[13px]",value:r,placeholder:"Note for the agent (optional, no secrets)",onChange:h=>i(h.target.value),onKeyDown:h=>h.key==="Enter"&&me.resolveActionItem(t.id,"done",r)}),y.jsx("button",{className:"btn px-2 text-[12px]",onClick:()=>me.resolveActionItem(t.id,"done",r),children:"Done"}),y.jsx("button",{className:"btn px-2 text-[12px]",onClick:()=>me.resolveActionItem(t.id,"dismissed",r),children:"Dismiss"})]})]})}const Pd="\0other";let Md="";function AL(){const t=be(d=>d.snap),[e,s]=re.useState(Md),[r,i]=re.useState(""),[a,c]=re.useState(!1);re.useEffect(()=>{me.openHostShell(Md)},[]);const o=((t==null?void 0:t.config.team)??[]).flatMap(d=>{var _,k;const g=(_=t==null?void 0:t.agents.find(S=>S.agentId===d.id))==null?void 0:_.session.workspace;return g?[{path:g,agent:d,running:((k=t==null?void 0:t.agents.find(S=>S.agentId===d.id))==null?void 0:k.session.state)==="running"}]:[]}),h=o.find(d=>d.path===e),u=e===""||!!h,f=(d,g=!1)=>{Md=d,s(d),c(!1),me.openHostShell(d,g)};return y.jsxs(y.Fragment,{children:[y.jsx(Ti,{children:y.jsxs("div",{className:"min-w-0",children:[y.jsx("b",{className:"text-[18px]",children:"Terminal"}),y.jsx("div",{className:"truncate text-[13px] text-muted",children:"Your own shell on this machine, not in a sandbox."})]})}),y.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b-[3px] border-ink bg-cream-2 px-3 py-1.5 text-[13px]",children:[y.jsx("label",{className:"text-muted",htmlFor:"host-term-dir",children:"Folder"}),y.jsxs("select",{id:"host-term-dir",className:"min-w-0 max-w-full flex-1 border-2 border-ink bg-white px-1 py-0.5 text-[13px]",value:a||!u?Pd:e,onChange:d=>{d.target.value===Pd?(i(u?"":e),c(!0)):f(d.target.value)},children:[y.jsx("option",{value:"",children:"This repo (your working copy)"}),o.map(d=>y.jsxs("option",{value:d.path,children:[d.agent.name,"'s folder"]},d.agent.id)),y.jsx("option",{value:Pd,children:!u&&!a?e:"Other folder…"})]}),y.jsx("button",{className:"btn px-2 text-[12px]",onClick:()=>f(e,!0),title:"Close this shell and open a new one in the same folder",children:"New shell"}),a&&y.jsxs("form",{className:"flex w-full items-center gap-1.5",onSubmit:d=>{d.preventDefault(),r.trim()&&f(r.trim())},children:[y.jsx("input",{autoFocus:!0,className:"min-w-0 flex-1 border-2 border-ink bg-white px-1.5 py-0.5 font-term text-[16px]",placeholder:"~/developer/my-app","aria-label":"Folder path",value:r,onChange:d=>i(d.target.value)}),y.jsx("button",{className:"btn px-2 text-[12px]",disabled:!r.trim(),children:"Open"}),y.jsx("button",{type:"button",className:"btn px-2 text-[12px]",onClick:()=>c(!1),children:"Cancel"})]})]}),(h==null?void 0:h.running)&&y.jsxs("div",{className:"border-b-[3px] border-ink bg-[#fff3cf] px-3 py-1.5 text-[13px]",children:[h.agent.name," is working in this folder. Switching branches or committing here can break ",h.agent.name,"'s work."]}),y.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:y.jsx(oa,{agentId:Ls})})]})}function Ti({children:t}){return y.jsxs("div",{className:"flex items-center gap-2.5 border-b-[3px] border-ink px-3 py-2",children:[y.jsx("div",{className:"flex min-w-0 flex-1 items-center gap-2.5",children:t}),y.jsx(TL,{}),y.jsx("button",{className:"btn px-2.5","aria-label":"Close",onClick:()=>Se.closeDrawer(),children:"✕"})]})}function TL(){const t=Ie(s=>s.drawerMaximized),e=t?"Restore size":"Maximize";return y.jsx("button",{className:"btn grid h-[30px] w-[34px] place-items-center px-0","aria-label":e,title:e,"aria-pressed":t,onClick:()=>Se.toggleDrawerMaximized(),children:y.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t?y.jsxs(y.Fragment,{children:[y.jsx("rect",{x:"1",y:"4",width:"9",height:"9"}),y.jsx("path",{d:"M4 4V1h9v9h-3"})]}):y.jsx("rect",{x:"1",y:"1",width:"12",height:"12"})})})}function RL(){const t=re.useRef(null),e=i=>{if(i.button!==0)return;const a=i.currentTarget.parentElement;a&&(i.preventDefault(),i.currentTarget.setPointerCapture(i.pointerId),t.current={x:i.clientX,width:a.getBoundingClientRect().width},document.body.style.userSelect="none")},s=i=>{t.current&&Se.setDrawerWidth(t.current.width+(t.current.x-i.clientX))},r=()=>{t.current=null,document.body.style.userSelect=""};return y.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize panel",title:"Drag to resize. Double-click to reset.",className:"group absolute -left-[9px] top-0 z-10 flex h-full w-[12px] cursor-col-resize justify-center",onPointerDown:e,onPointerMove:s,onPointerUp:r,onPointerCancel:r,onDoubleClick:()=>Se.setDrawerWidth(ef),children:y.jsx("div",{className:"my-auto h-12 w-[4px] bg-ink opacity-0 transition-opacity group-hover:opacity-60"})})}function DL(){const t=Ie(a=>a.drawer),e=Cp(),s=Ie(a=>a.drawerWidth),r=Ie(a=>a.drawerMaximized),i=t?t.kind==="agent"?`agent:${t.id}`:t.kind==="env"?`env:${t.name}`:t.kind:null;return(t==null?void 0:t.kind)==="boards"?y.jsx("div",{className:"fixed inset-0 z-30 grid place-items-center bg-[rgba(36,26,46,0.55)] p-4",role:"dialog","aria-modal":"true","aria-label":"Boards",onMouseDown:a=>a.target===a.currentTarget&&Se.closeDrawer(),children:y.jsx(yc.div,{initial:e?!1:{y:-16,opacity:0},animate:{y:0,opacity:1},transition:{duration:.2},className:"panel flex h-[90vh] w-[90vw] flex-col",children:y.jsx(wL,{initialBoardId:t.boardId})})}):y.jsx(y1,{mode:"wait",children:t&&y.jsxs(yc.aside,{initial:e?!1:{x:"110%"},animate:{x:0},exit:e?{opacity:0}:{x:"110%"},transition:{duration:e?0:.28,ease:[.3,0,.2,1]},className:`panel fixed bottom-4 right-4 top-[74px] z-20 flex flex-col ${r?"left-4":""}`,style:r?void 0:{width:`min(${s}px, calc(100vw - 32px))`},"aria-label":"Details",children:[!r&&y.jsx(RL,{}),t.kind==="agent"&&y.jsx(uL,{id:t.id,initialTab:t.tab}),t.kind==="prs"&&y.jsx(EL,{}),t.kind==="actions"&&y.jsx(PL,{}),t.kind==="env"&&y.jsx(kL,{name:t.name}),t.kind==="terminal"&&y.jsx(AL,{})]},i)})}const LL={"task.assigned":["▸","#c9b6ff"],"task.started":["●","#29adff"],"task.created":["+","#c9b6ff"],"agent.needs-input":["!","#ff5c86"],"agent.answered":["✓","#6cf08a"],message:["✉","#ff77a8"],"pr.opened":["⇡","#ffec27"],"review.started":["◎","#ffc14d"],"review.passed":["✓","#6cf08a"],"review.changes":["✗","#ff5c86"],"pr.merged":["⇢","#6cf08a"],deploy:["▲","#3ee0d0"],session:["◆","#9aa6d1"],config:["⚙","#9aa6d1"]},BL=[];function jL(){const t=be(i=>{var a;return((a=i.snap)==null?void 0:a.activity)??BL}),e=Di(1e3),s=Cp(),r=t.slice(0,7);return y.jsxs("section",{"aria-label":"Activity",className:"panel-dark fixed bottom-4 left-4 z-10 h-[220px] w-[280px] overflow-hidden px-2.5 pb-1.5 pt-2",children:[y.jsxs("div",{className:"mb-1 flex items-center gap-2 text-[13px] uppercase tracking-[0.14em] text-[#b9c3e6]",children:[y.jsx("i",{className:"led"}),"Activity"]}),y.jsx("ul",{className:"m-0 list-none p-0 font-term text-[17px] leading-none","aria-live":"polite",children:y.jsx(y1,{initial:!1,children:r.map(i=>{const[a,c]=LL[i.type];return y.jsxs(yc.li,{layout:!s,initial:s?!1:{opacity:0,x:-8},animate:{opacity:1,x:0},transition:{duration:.25},className:"flex gap-1.5 border-t border-dashed border-[rgba(185,195,230,0.15)] py-[3px] first:border-t-0",children:[y.jsx("span",{className:"w-3 shrink-0 text-center",style:{color:c},children:a}),y.jsx("span",{className:"min-w-0 flex-1 truncate",title:i.text,children:i.text}),y.jsx("time",{className:"shrink-0 text-[#7f8bb5]",children:Vr(i.at,e)})]},i.id)})})})]})}function IL(){const t=be(a=>a.live),e=be(a=>a.connection),s=be(a=>a.snap!==null),r=be(a=>{var c;return((c=a.snap)==null?void 0:c.setup.machine.persistentAgents)??!0});if(!t||e==="open"||e==="connecting"&&!s)return null;const i=e==="unauthorized"?"HQ restarted with a new link. Open the URL printed in your terminal.":`Lost connection to HQ. Reconnecting…${r?" Agents keep running in tmux.":""}`;return y.jsx("div",{role:"status",className:"fixed left-1/2 top-[68px] z-50 -translate-x-1/2 border-[3px] border-ink bg-red px-3 py-1 text-[14px] font-semibold text-white shadow-[0_3px_0_rgba(36,26,46,0.45)]",children:i})}const NL={ok:["✓","#00a83a"],missing:["✗","#ff004d"],unsupported:["✗","#ff004d"],warning:["!","#d48a1a"]},OL={sandbox:"for sandboxes",local:"for Local mode",all:"required",github:"for PRs & reviews"};function FL({c:t,running:e,onRun:s}){const[r,i]=re.useState(!1),[a,c]=NL[t.status];return y.jsx("li",{className:"border-t-2 border-dashed border-cream-3 py-2.5 first:border-t-0",children:y.jsxs("div",{className:"flex items-start gap-2.5",children:[y.jsx("span",{className:"w-4 shrink-0 text-center text-[18px] font-bold leading-6",style:{color:c},"aria-label":t.status,children:a}),y.jsxs("div",{className:"min-w-0 flex-1",children:[y.jsxs("div",{className:"flex items-baseline gap-2",children:[y.jsx("b",{className:"text-[16px]",children:t.label}),y.jsx("span",{className:"text-[12px] text-muted",children:OL[t.neededFor]})]}),y.jsx("div",{className:"text-[14px] text-muted",children:t.detail}),t.fix&&t.status!=="ok"&&y.jsxs("div",{className:"mt-1.5 flex flex-wrap items-center gap-2",children:[t.fix.command&&y.jsxs(y.Fragment,{children:[y.jsx("code",{className:"max-w-full truncate border-2 border-ink bg-navy-2 px-2 py-0.5 font-term text-[17px] text-[#dfe6ff]",children:t.fix.command}),y.jsx("button",{className:"btn px-2 text-[12px]",onClick:()=>{var o,h;(h=navigator.clipboard)==null||h.writeText(((o=t.fix)==null?void 0:o.command)??""),i(!0),window.setTimeout(()=>i(!1),1200)},children:r?"Copied":"Copy"}),t.fix.runnable&&y.jsx("button",{className:"btn px-2 text-[12px]",disabled:e,onClick:s,children:e?"Running…":"Run in terminal"})]}),t.fix.docs&&y.jsx("a",{className:"text-[13px] font-semibold underline",href:t.fix.docs,target:"_blank",rel:"noreferrer",children:"Docs ↗"})]})]})]})})}function $L(){const t=be(r=>{var i;return(i=r.snap)==null?void 0:i.setup}),[e,s]=re.useState(null);return t?y.jsx("div",{className:"fixed inset-0 z-40 grid place-items-center bg-[rgba(36,26,46,0.55)] p-4",role:"dialog","aria-modal":"true","aria-label":"Setup checklist",children:y.jsxs("div",{className:"panel flex max-h-[calc(100dvh-2rem)] w-[min(760px,100%)] flex-col",children:[y.jsxs("div",{className:"flex items-center gap-3 border-b-[3px] border-ink px-4 py-2",children:[y.jsx("h2",{className:"m-0 flex-1 text-[22px] font-bold",children:"Get Setups Works Office ready"}),y.jsx("button",{className:"btn text-[14px]",onClick:()=>me.recheckSetup(),children:"Check again"})]}),y.jsxs("div",{className:"scroll-thin min-h-0 overflow-y-auto px-4 py-2",children:[y.jsxs("div",{className:"mb-2 flex flex-wrap gap-2 text-[14px]",children:[y.jsxs("span",{className:"chip chip-dot",style:{"--c":t.sandboxReady?"#00e436":"#ff004d"},children:["Sandboxes ",t.sandboxReady?"ready":"not ready"]}),y.jsxs("span",{className:"chip chip-dot",style:{"--c":t.localReady?"#00e436":"#83769c"},children:["Local mode ",t.localReady?"ready":"not ready"]})]}),y.jsx("ul",{children:t.checks.map(r=>y.jsx(FL,{c:r,running:e===r.id,onRun:()=>{s(r.id),me.runSetupFix(r.id)}},r.id))}),e&&y.jsxs("div",{className:"mb-2 mt-1 border-[3px] border-ink",children:[y.jsxs("div",{className:"flex items-center justify-between bg-navy px-2 py-1 text-[13px] text-cream",children:[y.jsx("span",{children:"Running · type here if it asks for input"}),y.jsx("button",{className:"text-[12px] underline",onClick:()=>s(null),children:"Hide"})]}),y.jsx("div",{className:"h-[220px]",children:y.jsx(oa,{agentId:`setup:${e}`},e)})]}),!t.sandboxReady&&t.localReady&&y.jsxs("p",{className:"mb-2 border-[3px] border-orange bg-[#fff1d6] px-3 py-2 text-[14px]",children:["Sandboxes aren't available here, but Local mode is. Set agents to ",y.jsx("b",{children:"Local"})," in Settings → Team. They run plain Claude Code in their own folder, with permission prompts on."]})]}),y.jsxs("div",{className:"flex items-center justify-between gap-3 border-t-[3px] border-ink px-4 py-2",children:[y.jsx("span",{className:"text-[12px] text-muted",children:'HQ never runs sudo or install scripts for you. "Run in terminal" shows exactly what runs.'}),y.jsx("button",{className:"btn",onClick:()=>Se.closeSetup(),children:"Continue to the office"})]})]})}):null}function ft({value:t,onCommit:e,multiline:s,...r}){const[i,a]=re.useState(t);re.useEffect(()=>a(t),[t]);const c=()=>i!==t&&e(i);return s?y.jsx("textarea",{...r,value:i,onChange:o=>a(o.target.value),onBlur:c}):y.jsx("input",{...r,value:i,onChange:o=>a(o.target.value),onBlur:c,onKeyDown:o=>o.key==="Enter"&&o.currentTarget.blur()})}function wy({items:t,onChange:e,placeholder:s,validate:r}){const[i,a]=re.useState(""),[c,o]=re.useState(null),h=()=>{const u=i.trim().toLowerCase();if(!u)return;const f=(r==null?void 0:r(u))??(t.includes(u)?"Already in the list":null);if(f)return o(f);e([...t,u]),a(""),o(null)};return y.jsxs("div",{children:[y.jsxs("div",{className:"mb-2 flex flex-wrap gap-1.5",children:[t.length===0&&y.jsx("span",{className:"text-[13px] text-muted",children:"None"}),t.map(u=>y.jsxs("span",{className:"chip font-term text-[15px]",children:[u,y.jsx("button",{className:"ml-1 text-[12px] leading-none","aria-label":`Remove ${u}`,onClick:()=>e(t.filter(f=>f!==u)),children:"✕"})]},u))]}),y.jsxs("div",{className:"flex gap-2",children:[y.jsx("input",{className:"field",value:i,placeholder:s,onChange:u=>(a(u.target.value),o(null)),onKeyDown:u=>u.key==="Enter"&&(u.preventDefault(),h())}),y.jsx("button",{className:"btn",onClick:h,disabled:!i.trim(),children:"Add"})]}),c&&y.jsx("div",{className:"mt-1 text-[12px] text-red",children:c})]})}function Ql({checked:t,onChange:e,label:s}){return y.jsxs("button",{className:"btn flex items-center gap-2 px-2 text-[14px]",role:"switch","aria-checked":t,"aria-pressed":t,onClick:()=>e(!t),children:[y.jsx("span",{className:"inline-block h-3 w-3 border-2 border-ink",style:{background:t?"#00e436":"#fff"}}),s]})}const Sy=t=>/^(\*\.)?([a-z0-9-]+\.)+[a-z]{2,}(:\d+)?$/.test(t)||/^host\.docker\.internal(:\d+)?$/.test(t)||/^localhost(:\d+)?$/.test(t)?null:"Enter a domain like registry.npmjs.org or *.example.com";function HL({agent:t,onClose:e}){const s=be(g=>g.workspaceInfo[t.id]),[r,i]=re.useState(!1),[a,c]=re.useState(!0),[o,h]=re.useState(!1);re.useEffect(()=>{be.setState(g=>{const _={...g.workspaceInfo};return delete _[t.id],{workspaceInfo:_}}),me.inspectWorkspace(t.id),i(!0)},[t.id]);const u=r&&!s,f=s?s.changedFiles+s.unpushedCommits>0:!1,d=()=>{me.removeAgent(t.id,{deleteSandbox:a,deleteFolder:o&&!!(s!=null&&s.managed)}),e()};return y.jsx("div",{className:"fixed inset-0 z-50 grid place-items-center bg-[rgba(36,26,46,0.55)] p-4",role:"dialog","aria-modal":"true","aria-label":`Remove ${t.name}`,children:y.jsxs("div",{className:"panel w-[min(560px,100%)] p-4",children:[y.jsxs("h3",{className:"mb-1 text-[20px] font-bold",children:["Remove ",t.name," from the team?"]}),y.jsx("p",{className:"mb-3 text-[13px] text-muted",children:"Their session stops, and their unfinished tasks go back to the board."}),u&&y.jsxs("p",{className:"blink mb-3 font-term text-[18px]",children:["Checking ",t.name,"'s folder…"]}),s&&y.jsxs("div",{className:"mb-3 flex flex-col gap-2.5",children:[y.jsxs("label",{className:`flex items-start gap-2 border-2 border-ink bg-white p-2 ${s.sandboxExists?"":"opacity-60"}`,children:[y.jsx("input",{type:"checkbox",className:"mt-1",checked:a&&s.sandboxExists,disabled:!s.sandboxExists,onChange:g=>c(g.target.checked)}),y.jsxs("span",{className:"min-w-0",children:[y.jsxs("b",{className:"text-[15px]",children:["Delete ",t.name,"'s sandbox (the VM)"]}),y.jsx("span",{className:"block font-term text-[16px] text-muted",children:s.sandboxExists?`sbx rm ${s.sandboxName}`:"No sandbox exists"}),y.jsx("span",{className:"block text-[12px] text-muted",children:"Safe: the code lives in the folder, not the VM. Anything installed inside the VM is lost."})]})]}),y.jsxs("label",{className:`flex items-start gap-2 border-2 p-2 ${f&&o?"border-red bg-[#ffe1ea]":"border-ink bg-white"} ${s.managed&&s.exists?"":"opacity-60"}`,children:[y.jsx("input",{type:"checkbox",className:"mt-1",checked:o,disabled:!s.managed||!s.exists,onChange:g=>h(g.target.checked)}),y.jsxs("span",{className:"min-w-0",children:[y.jsxs("b",{className:"text-[15px]",children:["Delete ",t.name,"'s folder"]}),y.jsx("span",{className:"block truncate font-term text-[16px] text-muted",title:s.path,children:s.path}),!s.managed&&y.jsx("span",{className:"block text-[12px] text-muted",children:"This is your own folder, so HQ never deletes it."}),s.managed&&!s.exists&&y.jsx("span",{className:"block text-[12px] text-muted",children:"The folder doesn't exist."}),s.managed&&s.exists&&y.jsx("span",{className:`block text-[12px] ${f?"font-semibold text-red":"text-muted"}`,children:f?`⚠ ${[s.unpushedCommits?`${s.unpushedCommits} commit${s.unpushedCommits>1?"s":""} not pushed`:"",s.changedFiles?`${s.changedFiles} file${s.changedFiles>1?"s":""} changed`:""].filter(Boolean).join(" · ")} — deleting loses them.`:"Everything here is committed and pushed."})]})]})]}),y.jsxs("div",{className:"flex justify-end gap-2",children:[y.jsx("button",{className:"btn",onClick:e,children:"Cancel"}),y.jsxs("button",{className:"btn text-red",disabled:u,onClick:d,children:["Remove ",t.name]})]})]})})}function wc({value:t,onChange:e}){return y.jsx("select",{className:"field",value:t,onChange:s=>e(s.target.value),"aria-label":"Coding agent",children:Object.keys(Pi).map(s=>y.jsx("option",{value:s,children:Pi[s]},s))})}const sw=["Developer","QA","Designer","Docs","DevOps","Security"];function UL(){const t=be(a=>{var c;return(c=a.snap)==null?void 0:c.config.team}),[e,s]=re.useState(null),[r,i]=re.useState(null);return t?y.jsxs("div",{className:"flex flex-col gap-5",children:[y.jsxs("section",{children:[y.jsxs(Le,{children:["Team · ",t.length," agents"]}),y.jsx("p",{className:"mb-3 text-[14px] text-muted",children:"Changes to model, mode or folder apply the next time the agent starts. One lead plans and assigns work. Every other agent gets its own desk, sandbox and (optionally) environment. The office grows as you add agents."}),y.jsx("div",{className:"flex flex-col gap-2",children:t.map(a=>y.jsx(WL,{agent:a,expanded:e===a.id,onToggle:()=>s(e===a.id?null:a.id),onRemove:()=>i(a)},a.id))})]}),y.jsx(zL,{}),r&&y.jsx(HL,{agent:r,onClose:()=>i(null)})]}):null}function WL({agent:t,expanded:e,onToggle:s,onRemove:r}){const i=a=>me.updateAgent(t.id,a);return y.jsxs("div",{className:"border-[3px] border-ink bg-white",children:[y.jsxs("div",{className:"grid grid-cols-[40px_1fr_1fr_150px_130px_auto] items-end gap-2.5 p-2.5",children:[y.jsx(Sn,{color:t.color,lead:t.isLead}),y.jsx(Re,{label:"Name",children:y.jsx(ft,{className:"field",value:t.name,onCommit:a=>a.trim()&&i({name:a.trim()})})}),y.jsx(Re,{label:"Role",children:t.isLead?y.jsx("div",{className:"field flex h-9 items-center bg-cream-2",children:"Lead"}):y.jsx(ft,{className:"field",value:t.role,list:"role-suggestions",onCommit:a=>a.trim()&&i({role:a.trim()})})}),y.jsx(Re,{label:"Agent",children:y.jsx(wc,{value:t.cli,onChange:a=>i({cli:a})})}),y.jsx(Re,{label:"Runs in",children:y.jsxs("select",{className:"field",value:t.mode,onChange:a=>i({mode:a.target.value}),children:[y.jsx("option",{value:"sandbox",children:"Sandbox"}),y.jsx("option",{value:"local",children:"Local"})]})}),y.jsxs("div",{className:"flex gap-1.5",children:[y.jsx("button",{className:"btn px-2 text-[13px]","aria-expanded":e,onClick:s,children:e?"Less":"More"}),!t.isLead&&y.jsx("button",{className:"btn px-2 text-[13px] text-red",onClick:r,children:"Remove"})]})]}),t.mode==="local"&&y.jsxs("div",{className:"border-t-2 border-dashed border-cream-3 px-3 py-1 text-[12px] text-muted",children:["Local mode runs plain ",y.jsx("code",{children:t.cli})," in the agent's own folder. Permission prompts stay on."]}),e&&y.jsxs("div",{className:"grid grid-cols-2 gap-3 border-t-[3px] border-ink bg-cream p-3",children:[y.jsx(Re,{label:"Colour",children:y.jsx("div",{className:"flex flex-wrap gap-1.5",children:wi.map(a=>y.jsx("button",{className:"h-6 w-6 border-[3px] border-ink",style:{background:a,outline:a===t.color?"3px solid #241a2e":void 0,outlineOffset:1},"aria-label":`Colour ${a}`,onClick:()=>i({color:a})},a))})}),y.jsx(Re,{label:"Start with model",hint:"Optional. Leave empty to use the CLI's default — you can always switch with /model in the terminal. Set it to keep a choice across restarts (e.g. Opus for the lead).",children:y.jsx(ft,{className:"field",value:t.model,placeholder:`${Pi[t.cli]} default`,list:t.cli==="codex"?"codex-models":"claude-models",onCommit:a=>i({model:a.trim()})})}),y.jsx(Re,{label:"Skills",hint:"Comma separated. Copied into the agent's .claude/skills.",children:y.jsx(ft,{className:"field",value:t.skills.join(", "),onCommit:a=>i({skills:a.split(",").map(c=>c.trim()).filter(Boolean)})})}),y.jsx("div",{className:"col-span-2",children:y.jsx(Re,{label:"Folder",hint:"Leave empty and HQ keeps its own clone of the repo for this agent. Or enter an existing git folder.",children:y.jsx(ft,{className:"field font-term text-[17px]",value:t.workspacePath??"",placeholder:`HQ-managed: ~/.jsmhq/…/${t.id}`,onCommit:a=>i({workspacePath:a.trim()||null})})})}),y.jsx("div",{className:"col-span-2",children:y.jsx(Re,{label:"ROLE.md",hint:"Who this agent is. HQ adds the team, rules and tools, writes it to .jsmhq-role.md in the agent's folder (never committed) and loads it when the session starts. A ROLE.md the folder already has is included too, never overwritten.",children:y.jsx(ft,{multiline:!0,className:"field h-[120px] resize-y font-term text-[17px] leading-tight",value:t.roleMd,onCommit:a=>i({roleMd:a})})})})]})]})}function zL(){const[t,e]=re.useState(""),[s,r]=re.useState("Developer"),[i,a]=re.useState("claude"),[c,o]=re.useState("sandbox"),h=be(d=>{var g;return(g=d.snap)==null?void 0:g.config.team})??[],u=m1(h.map(d=>d.name)),f=()=>{me.addAgent({name:t.trim()||u,role:s,cli:i,mode:c}),e("")};return y.jsxs("section",{className:"border-[3px] border-dashed border-ink p-3",children:[y.jsx(Le,{children:"Add an agent"}),y.jsxs("form",{className:"grid grid-cols-[1fr_1fr_150px_130px_auto] items-end gap-2.5",onSubmit:d=>{d.preventDefault(),f()},children:[y.jsx(Re,{label:"Name",children:y.jsx("input",{className:"field",value:t,onChange:d=>e(d.target.value),placeholder:u})}),y.jsx(Re,{label:"Role",children:y.jsx("input",{className:"field",value:s,list:"role-suggestions",onChange:d=>r(d.target.value)})}),y.jsx(Re,{label:"Agent",children:y.jsx(wc,{value:i,onChange:a})}),y.jsx(Re,{label:"Runs in",children:y.jsxs("select",{className:"field",value:c,onChange:d=>o(d.target.value),children:[y.jsx("option",{value:"sandbox",children:"Sandbox"}),y.jsx("option",{value:"local",children:"Local"})]})}),y.jsx("button",{className:"btn",type:"submit",children:"Add"})]}),y.jsx("p",{className:"mt-2 text-[12px] text-muted",children:"HQ starts a new sandbox with the lead's network policy and allows it to reach HQ at host.docker.internal."}),y.jsx("datalist",{id:"codex-models",children:y.jsx("option",{value:"gpt-5.6-sol"})}),y.jsxs("datalist",{id:"claude-models",children:[y.jsx("option",{value:"opus"}),y.jsx("option",{value:"sonnet"}),y.jsx("option",{value:"haiku"})]}),y.jsx("datalist",{id:"role-suggestions",children:sw.map(d=>y.jsx("option",{value:d},d))})]})}const VL=11;function GL(){const t=be(b=>b.snap),[e,s]=re.useState((t==null?void 0:t.config.project.name)??""),[r,i]=re.useState({name:lA,cli:"claude"}),[a,c]=re.useState([{name:p1[0],role:"Developer",cli:"claude"}]),[o,h]=re.useState((t==null?void 0:t.config.workflow.review.enabled)??!0),[u,f]=re.useState((t==null?void 0:t.config.workflow.review.tool)??"human"),[d,g]=re.useState(!1),[_,k]=re.useState(X0);if(!t)return null;const S=(b,C)=>c(E=>E.map((P,T)=>T===b?{...P,...C}:P)),m=()=>c(b=>[...b,{name:m1([r.name,...b.map(C=>C.name)]),role:"Developer",cli:"claude"}]),x=r.name.trim()&&a.length>0&&a.every(b=>b.name.trim()),v=()=>{if(!x)return;g(!0);const b=_.frameworks.length>0||Object.values(_.tools).some(Boolean);me.completeWelcome({projectName:e.trim(),lead:r,workers:a,reviewTool:u,reviewEnabled:o,...b?{stack:_}:{}})};return y.jsx("div",{className:"fixed inset-0 z-50 grid place-items-center bg-[rgba(36,26,46,0.55)] p-4",role:"dialog","aria-modal":"true","aria-label":"Welcome to Setups Works Office",children:y.jsxs("div",{className:"panel flex max-h-[calc(100dvh-2rem)] w-[min(720px,100%)] flex-col",children:[y.jsxs("div",{className:"border-b-[3px] border-ink px-4 py-2",children:[y.jsx("h2",{className:"m-0 text-[22px] font-bold",children:"Welcome to Setups Works Office"}),y.jsxs("p",{className:"m-0 text-[14px] text-muted",children:["Set up the team for ",y.jsx("b",{className:"text-ink",children:t.config.project.repo||t.config.project.name}),". You can change all of this later in Settings."]})]}),y.jsxs("div",{className:"scroll-thin flex min-h-0 flex-col gap-4 overflow-y-auto px-4 py-3",children:[y.jsx(Re,{label:"Project name",children:y.jsx("input",{className:"field w-full",value:e,maxLength:80,onChange:b=>s(b.target.value)})}),y.jsxs("section",{children:[y.jsx("h3",{className:"mb-1 text-[16px] font-bold",children:"Lead"}),y.jsx("p",{className:"mb-2 text-[13px] text-muted",children:"Plans the work, creates tasks and assigns them to workers."}),y.jsxs("div",{className:"grid grid-cols-[40px_1fr_150px] items-end gap-2",children:[y.jsx(Sn,{color:wi[0],lead:!0}),y.jsx(Re,{label:"Name",children:y.jsx("input",{className:"field w-full",value:r.name,maxLength:40,onChange:b=>i({...r,name:b.target.value})})}),y.jsx(Re,{label:"Agent",children:y.jsx(wc,{value:r.cli,onChange:b=>i({...r,cli:b})})})]})]}),y.jsxs("section",{children:[y.jsxs("h3",{className:"mb-1 text-[16px] font-bold",children:["Workers · ",a.length]}),y.jsx("p",{className:"mb-2 text-[13px] text-muted",children:"Each worker gets its own desk, copy of the repo and sandbox."}),y.jsx("datalist",{id:"welcome-roles",children:sw.map(b=>y.jsx("option",{value:b},b))}),y.jsx("div",{className:"flex flex-col gap-2",children:a.map((b,C)=>y.jsxs("div",{className:"grid grid-cols-[40px_1fr_1fr_150px_auto] items-end gap-2",children:[y.jsx(Sn,{color:wi[(C+1)%wi.length],lead:!1}),y.jsx(Re,{label:"Name",children:y.jsx("input",{className:"field w-full",value:b.name,maxLength:40,onChange:E=>S(C,{name:E.target.value})})}),y.jsx(Re,{label:"Role",children:y.jsx("input",{className:"field w-full",list:"welcome-roles",value:b.role,maxLength:40,onChange:E=>S(C,{role:E.target.value})})}),y.jsx(Re,{label:"Agent",children:y.jsx(wc,{value:b.cli,onChange:E=>S(C,{cli:E})})}),y.jsx("button",{className:"btn px-2 text-[13px]",disabled:a.length===1,"aria-label":`Remove ${b.name||"worker"}`,onClick:()=>c(E=>E.filter((P,T)=>T!==C)),children:"✕"})]},C))}),y.jsx("button",{className:"btn mt-2 text-[13px]",disabled:a.length>=VL,onClick:m,children:"+ Add worker"})]}),y.jsx(qL,{stack:_,setStack:k}),y.jsxs("section",{children:[y.jsx("h3",{className:"mb-1 text-[16px] font-bold",children:"Code review"}),y.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[y.jsxs("label",{className:"flex items-center gap-2 text-[14px]",children:[y.jsx("input",{type:"checkbox",checked:o,onChange:b=>h(b.target.checked)}),"Review PRs before merge"]}),y.jsx("select",{className:"field w-[220px]",value:u,disabled:!o,onChange:b=>f(b.target.value),"aria-label":"Review tool",children:Object.keys(Si).map(b=>y.jsx("option",{value:b,children:Si[b]},b))})]})]})]}),y.jsxs("div",{className:"flex items-center justify-between gap-3 border-t-[3px] border-ink px-4 py-2",children:[y.jsx("span",{className:"text-[12px] text-muted",children:"Saved to .jsmhq/config.json in your repo. Agents don't start until you press Start."}),y.jsx("button",{className:"btn",disabled:!x||d,onClick:v,children:d?"Creating…":"Create team"})]})]})})}function qL({stack:t,setStack:e}){const[s,r]=re.useState(!1),i=a=>t.frameworks.some(c=>c.id===a);return y.jsxs("section",{children:[y.jsxs("div",{className:"flex items-center gap-3",children:[y.jsx("h3",{className:"m-0 text-[16px] font-bold",children:"Stack"}),y.jsx("span",{className:"text-[13px] text-muted",children:"Optional. Agents get the tools' skills and docs access."}),y.jsx("button",{className:"btn ml-auto px-2 text-[12px]","aria-expanded":s,onClick:()=>r(!s),children:s?"Hide":"Choose"})]}),s&&y.jsxs("div",{className:"mt-2 flex flex-col gap-2",children:[y.jsx("div",{className:"flex flex-wrap gap-1.5",children:Q0().map(a=>y.jsx("button",{className:"btn px-2 py-0.5 text-[12px]","aria-pressed":i(a.id),onClick:()=>e({...t,frameworks:i(a.id)?t.frameworks.filter(c=>c.id!==a.id):[...t.frameworks,{id:a.id}]}),children:a.name},a.id))}),y.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3",children:Nf.map(a=>{var c;return y.jsxs("label",{className:"flex flex-col gap-0.5 text-[12px] font-semibold",children:[a.label,y.jsxs("select",{className:"field",value:((c=t.tools[a.id])==null?void 0:c.id)??"",onChange:o=>{const h={...t.tools};o.target.value?h[a.id]={id:o.target.value}:delete h[a.id],e({...t,tools:h})},children:[y.jsx("option",{value:"",children:"None"}),Z0(a.id).map(o=>y.jsx("option",{value:o.id,children:o.name},o.id))]})]},a.id)})}),y.jsx("span",{className:"text-[12px] text-muted",children:'"Other" tools, where each framework lives, and network access are in Settings → Stack.'})]})]})}function KL({a:t,focused:e,n:s,now:r}){const i=be(f=>f.snap),a=t.status.currentTaskId?i==null?void 0:i.tasks.find(f=>f.id===t.status.currentTaskId):null,c=Cn[t.status.state],o=t.status.state==="needs-input",h=be(f=>{var d,g,_;return((_=(g=(d=f.snap)==null?void 0:d.sbx.agents[t.config.id])==null?void 0:g.approvals)==null?void 0:_.length)??0}),u=be(f=>{var d;return(((d=f.snap)==null?void 0:d.actionItems)??[]).filter(g=>g.status==="open"&&g.fromId===t.config.id).length});return y.jsxs("button",{className:`panel relative grid w-full cursor-pointer grid-cols-[40px_1fr] gap-x-2.5 gap-y-1 px-2.5 pb-2.5 pt-2 text-left transition-transform hover:-translate-x-px hover:-translate-y-px ${o?"outline-[3px] outline-red":""}`,style:o?{outlineStyle:"solid"}:void 0,onClick:()=>Se.openAgent(t.config.id),"aria-label":`${t.config.name}, ${t.config.role}, ${c.label}`,children:[e&&y.jsx("span",{className:"absolute -left-4 top-4 text-[14px]",children:"▶"}),y.jsx("div",{className:"row-span-2",children:y.jsx(Sn,{color:t.config.color,lead:t.config.isLead})}),y.jsxs("div",{className:"flex min-w-0 items-baseline gap-1.5",children:[y.jsx("b",{className:"text-[17px]",children:t.config.name}),y.jsxs("span",{className:"truncate text-[13px] text-muted",children:[t.config.role," · ",Pi[t.config.cli],t.config.model?` · ${t.config.model}`:""]}),y.jsx("span",{className:"kbd ml-auto px-1 text-[13px] leading-none",children:s})]}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx(Kb,{state:t.status.state}),y.jsx("span",{className:"font-term text-[16px] text-muted",children:Vr(t.status.stateSince,r)}),t.config.mode==="local"&&y.jsx("span",{className:"chip text-[11px]",children:"local"}),u>0&&y.jsxs("span",{className:"chip text-[11px]",style:{background:"#ffec27"},title:"Action items from this agent. Open Action items in the top bar.",children:[u," for you"]}),h>0&&y.jsxs("span",{className:"chip text-[11px]",style:{background:"#fff1d6"},title:"Requests the sandbox blocked. Open the agent to allow or dismiss them.",children:[h," blocked"]})]}),y.jsx("div",{className:`col-span-2 mt-1 truncate text-[13px] ${a||o?"":"text-muted"}`,children:o?y.jsx("span",{className:"text-red",children:t.status.note}):a?y.jsxs(y.Fragment,{children:[y.jsx("span",{className:"mr-1 font-term text-[16px] text-muted",children:a.id}),a.title]}):t.status.note??"No task"})]})}function YL(){const t=be(a=>a.snap),e=Ie(a=>a.drawer),s=Di(1e3),r=n1(t),i=r.filter(a=>a.status.state==="needs-input").length;return y.jsxs("section",{"aria-label":"Team",className:"fixed bottom-[250px] left-4 top-[74px] z-10 flex w-[280px] flex-col gap-2",children:[y.jsxs("div",{className:"flex items-center justify-between px-1 text-[13px] font-semibold uppercase tracking-[0.12em] text-cream [text-shadow:0_2px_0_#241a2e]",children:[y.jsxs("span",{children:["Team · ",r.length,i>0&&y.jsxs("span",{className:"ml-2 text-yellow",children:[i," need you"]})]}),y.jsx("button",{className:"btn px-2 text-[12px] normal-case tracking-normal text-ink [text-shadow:none]",onClick:()=>Se.openSettings("team"),children:"+ Agent"})]}),y.jsx("div",{className:"scroll-thin flex min-h-0 flex-col gap-2.5 overflow-y-auto pb-2 pl-4 -ml-4 pr-1",children:r.map((a,c)=>y.jsx(KL,{a,n:c+1,now:s,focused:(e==null?void 0:e.kind)==="agent"&&e.id===a.config.id},a.config.id))})]})}function XL(){const t=Ie(e=>e.hover);return t?y.jsxs("div",{className:"pointer-events-none fixed z-30 max-w-[340px] border-2 border-ink bg-cream px-2 py-0.5 text-[14px] shadow-[0_3px_0_rgba(36,26,46,0.45)]",style:{left:t.x+14,top:t.y+16},children:[y.jsx("div",{className:"font-semibold",children:t.title}),t.sub&&y.jsx("div",{className:"truncate text-[13px] text-muted",children:t.sub})]}):null}const QL=[1,2,4];function ZL(){return y.jsxs("svg",{className:"h-[30px] w-[30px] shrink-0",viewBox:"0 0 10 10",shapeRendering:"crispEdges","aria-hidden":!0,children:[y.jsx("rect",{x:"1",y:"1",width:"8",height:"8",fill:"#241a2e"}),y.jsx("rect",{x:"2",y:"2",width:"6",height:"6",fill:"#29adff"}),y.jsx("rect",{x:"3",y:"3",width:"1",height:"2",fill:"#fff6e9"}),y.jsx("rect",{x:"6",y:"3",width:"1",height:"2",fill:"#fff6e9"}),y.jsx("rect",{x:"3",y:"6",width:"4",height:"1",fill:"#1d2b53"}),y.jsx("rect",{x:"4",y:"0",width:"2",height:"1",fill:"#ffec27"})]})}function JL(){var S;const t=be(m=>m.snap),e=be(m=>m.speed),s=be(m=>m.presets!==null),r=Ie(m=>m.planBoardId),i=o1(t).total,a=Ie(m=>m.debugOpen),c=be(m=>m.live);if(!t)return null;const o=t.setup.checks.filter(m=>m.status!=="ok").length,h=t.agents.filter(m=>m.session.state==="stopped"||m.session.state==="failed"),u=new Set(t.agents.filter(m=>m.session.state==="running").map(m=>m.agentId)),f=t.config.team.filter(m=>m.mode==="sandbox"&&u.has(m.id)).length,d=t.config.team.filter(m=>m.mode==="local"&&u.has(m.id)).length,g=[...t.boards].sort((m,x)=>m.order-x.order),_=g.filter(m=>m.status==="active"),k=t.pullRequests.filter(m=>!m.merged&&!m.closed).length;return y.jsxs("header",{className:"panel fixed left-4 right-4 top-[10px] z-10 flex h-[50px] items-center gap-4 px-3",children:[y.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[y.jsx(ZL,{}),y.jsx("b",{className:"whitespace-nowrap text-[22px] font-bold tracking-[0.02em]",children:"Setups Works Office"}),!c&&y.jsx("span",{className:"chip shrink-0 text-[12px]",style:{"--c":"#ffec27"},title:"Running on mock data. Start the real HQ with `pnpm dev:hq`.",children:"Demo data"}),y.jsxs("span",{className:"truncate text-[16px] text-muted",children:["— ",y.jsx("em",{className:"font-semibold not-italic text-ink",children:t.config.project.name})," ",y.jsx("span",{className:"font-term text-[17px]",children:t.config.project.repo})]})]}),y.jsx("div",{className:"flex-1"}),y.jsxs("label",{className:"flex items-center gap-2 text-[14px]",children:[y.jsx("span",{className:"text-muted",children:"Plan wall"}),y.jsxs("select",{className:"field w-[190px] py-0 text-[14px]",value:r??"",onChange:m=>Se.showBoardOnWall(m.target.value||null),"aria-label":"Board shown on the plan wall",children:[y.jsxs("option",{value:"",children:["First active (",((S=_[0])==null?void 0:S.title)??"none",")"]}),g.map(m=>y.jsxs("option",{value:m.id,children:[m.title," · ",m.status]},m.id))]})]}),s&&y.jsx("div",{className:"flex items-center gap-1.5",role:"group","aria-label":"Simulation speed",children:QL.map(m=>y.jsxs("button",{className:"btn px-2 text-[14px]","aria-pressed":e===m,onClick:()=>me.setSpeed(m),children:[m,"x"]},m))}),y.jsxs("div",{className:"flex gap-1.5",children:[y.jsx("button",{className:"btn w-8 px-0 text-[18px] leading-none","aria-label":"Zoom out",onClick:()=>Se.zoom(-1),children:"−"}),y.jsx("button",{className:"btn w-8 px-0 text-[18px] leading-none","aria-label":"Zoom in",onClick:()=>Se.zoom(1),children:"+"})]}),y.jsxs("div",{className:"flex items-center gap-2 whitespace-nowrap border-[3px] border-ink bg-navy px-2.5 py-0.5 text-[15px] text-cream",title:"Each agent runs in its own isolated Docker Sandbox (microVM)",children:[y.jsxs("span",{children:["Sandbox · ",y.jsx("b",{children:f})," running",d?` · ${d} local`:""]}),y.jsx("i",{className:"led",style:u.size?void 0:{background:"#83769c",animation:"none"}})]}),c&&h.length>0&&y.jsxs("button",{className:"btn text-[14px]",onClick:()=>h.forEach(m=>me.startAgent(m.agentId)),children:["Start ",h.length===t.agents.length?"team":`${h.length} stopped`]}),c&&y.jsxs("button",{className:"btn text-[14px]",onClick:()=>Se.openSetup(),title:"Setup checklist",children:["Setup",o?` · ${o}`:" ✓"]}),y.jsxs("div",{className:"flex gap-1.5",children:[y.jsxs("button",{className:"btn text-[14px]",style:i?{background:"#ffec27"}:void 0,onClick:()=>Se.openActions(),title:"Everything waiting on you",children:["Action items",i?` · ${i}`:""]}),y.jsx("button",{className:"btn text-[14px]",onClick:()=>Se.openBoards(r??void 0),children:"Boards"}),y.jsxs("button",{className:"btn text-[14px]",onClick:()=>Se.openPrs(),children:["PRs",k?` · ${k}`:""]}),y.jsx("button",{className:"btn text-[14px]",onClick:()=>Se.openTerminal(),title:"Your own shell on this machine: the repo, an agent's folder or any folder",children:"Terminal"})]}),y.jsx("button",{className:"btn text-[14px]",onClick:()=>Se.openSettings("team"),children:"Settings"}),y.jsx("button",{className:"btn text-[14px]","aria-pressed":a,onClick:()=>Se.toggleDebug(),title:"Debug panel (D)",children:"Debug"})]})}function e5(){const t=be(i=>i.snap),[e,s]=re.useState("");if(!t)return null;const r=[...t.boards].sort((i,a)=>i.order-a.order);return y.jsxs("div",{className:"flex flex-col gap-5",children:[y.jsxs("section",{children:[y.jsxs(Le,{children:["Boards · ",r.length]}),y.jsx("p",{className:"mb-3 text-[14px] text-muted",children:"A project can have many boards: one per phase, or one per area. Agents pick work only from active boards. The lead tops up active boards when they run low."}),y.jsx("div",{className:"flex flex-col gap-2",children:r.map(i=>{const a=t.tasks.filter(o=>o.boardId===i.id),c=a.filter(o=>o.status==="done").length;return y.jsxs("div",{className:"grid grid-cols-[60px_1fr_140px_120px] items-center gap-2.5 border-[3px] border-ink bg-white px-2.5 py-2",children:[y.jsx("span",{className:"font-term text-[19px] text-muted",children:i.id}),y.jsx(ft,{className:"field",value:i.title,onCommit:o=>o.trim()&&me.updateBoard(i.id,{title:o.trim()})}),y.jsxs("select",{className:"field",value:i.status,onChange:o=>me.updateBoard(i.id,{status:o.target.value}),"aria-label":`${i.title} status`,children:[y.jsx("option",{value:"active",children:"Active"}),y.jsx("option",{value:"planned",children:"Planned"}),y.jsx("option",{value:"done",children:"Done"})]}),y.jsxs("span",{className:"text-right font-term text-[17px] text-muted",children:[c,"/",a.length," done"]})]},i.id)})})]}),y.jsxs("form",{className:"flex items-end gap-2 border-[3px] border-dashed border-ink p-3",onSubmit:i=>{i.preventDefault(),e.trim()&&(me.createBoard(e),s(""))},children:[y.jsxs("label",{className:"flex flex-1 flex-col gap-1",children:[y.jsx("span",{className:"text-[14px] font-semibold",children:"New board"}),y.jsx("input",{className:"field",value:e,onChange:i=>s(i.target.value),placeholder:"e.g. Phase 7 — Mobile"})]}),y.jsx("button",{className:"btn",type:"submit",disabled:!e.trim(),children:"Create"})]})]})}function t5(){const[t,e]=re.useState(kp);return y.jsxs("section",{className:"border-[3px] border-ink bg-white p-3",children:[y.jsx(Le,{children:"Font"}),y.jsx(Re,{label:"Font style",hint:"For panels, drawers, settings and agent terminals. The office stays pixel. Saved in this browser only.",children:y.jsx("select",{className:"field w-[320px]",value:t,onChange:s=>{const r=s.target.value;cL(r),e(r)},children:Jb.map(s=>y.jsxs("option",{value:s.id,children:[s.label," · ",s.hint]},s.id))})})]})}function s5(){const t=be(e=>{var s;return(s=e.snap)==null?void 0:s.config.project});return t?y.jsxs("div",{className:"flex flex-col gap-5",children:[y.jsx(t5,{}),y.jsxs("section",{className:"grid grid-cols-2 gap-3 border-[3px] border-ink bg-white p-3",children:[y.jsx("div",{className:"col-span-2",children:y.jsx(Le,{children:"Project"})}),y.jsx(Re,{label:"Name",children:y.jsx(ft,{className:"field",value:t.name,onCommit:e=>e.trim()&&me.updateProject({name:e.trim()})})}),y.jsx(Re,{label:"Office name",hint:`The sign on the office wall. Up to ${tf} characters; letters and numbers read best.`,children:y.jsx(ft,{className:"field",maxLength:tf,value:t.officeName??"",placeholder:g1,onCommit:e=>me.updateProject({officeName:e.trim()})})}),y.jsx(Re,{label:"GitHub repo",hint:"owner/name. HQ only reads PRs, checks and comments.",children:y.jsx(ft,{className:"field font-term text-[17px]",value:t.repo,onCommit:e=>e.trim()&&me.updateProject({repo:e.trim()})})}),y.jsx(Re,{label:"Local path",children:y.jsx(ft,{className:"field font-term text-[17px]",value:t.path,onCommit:e=>e.trim()&&me.updateProject({path:e.trim()})})}),y.jsx(Re,{label:"HQ port",hint:"Sandboxes reach HQ at host.docker.internal on this port.",children:y.jsx(ft,{className:"field font-term text-[17px]",value:String(t.hqPort),onCommit:e=>{const s=Number(e);Number.isInteger(s)&&s>1023&&s<65536&&me.updateProject({hqPort:s})}})})]}),y.jsxs("section",{children:[y.jsx(Le,{children:"Plan"}),y.jsx(Ql,{checked:!!t.exportPlan,onChange:e=>me.updateProject({exportPlan:e}),label:"Export plan to docs/plan.md"}),y.jsx("p",{className:"mt-1 text-[13px] text-muted",children:"HQ keeps the plan in .jsmhq/plan.json. With this on, it also writes a readable copy to docs/plan.md every time the plan changes, so you can commit it or read it on GitHub. Edits to that file are overwritten."})]}),y.jsxs("section",{className:"text-[13px] text-muted",children:[y.jsx(Le,{children:"Security"}),y.jsxs("ul",{className:"list-disc pl-5",children:[y.jsx("li",{children:"HQ binds 127.0.0.1 only."}),y.jsx("li",{children:"A random token is created on every start. The browser, hooks and the Team MCP must send it."}),y.jsx("li",{children:"HQ never reads .env files. Sandboxes get keys from Docker's secret store."})]})]})]}):null}function rw(t){return{cpus:t.cpus,memoryGb:Math.min(32,Math.max(.5,t.memoryGb/2))}}function Ep(t,e){const s=rw(e);return{cpus:t.cpus??s.cpus,memoryGb:t.memoryGb??s.memoryGb}}const r5=t=>Math.max(.5,Math.floor(t.memoryGb*.75*2)/2);function i5(t,e){const s=t.filter(i=>i.mode==="sandbox"),r=s.reduce((i,a)=>{const c=Ep(a.sandbox.resources,e);return{cpus:i.cpus+c.cpus,memoryGb:i.memoryGb+c.memoryGb}},{cpus:0,memoryGb:0});return{...r,count:s.length,overMemory:r.memoryGb>e.memoryGb}}function n5(t,e,s){if(!e.sandbox)return!1;const r=Ep(t,s);return r.cpus!==e.sandbox.cpus||Math.abs(r.memoryGb-e.sandbox.memoryGb)>.26}const fi=t=>`${Number.isInteger(t)?t:t.toFixed(1)} GB`;function o5({agent:t,status:e,team:s,machine:r}){const i=t.sandbox.resources,a=i.cpus!==null||i.memoryGb!==null,c=rw(r),o=Ep(i,r),h=r5(r),[u,f]=re.useState(o);re.useEffect(()=>f(o),[o.cpus,o.memoryGb]);const d=S=>me.updateSandbox(t.id,{resources:S}),g=i5(s,r),_=e==null?void 0:e.session,k=_?n5(i,_,r):!1;return y.jsxs("section",{className:"border-[3px] border-ink bg-white p-3",children:[y.jsx(Le,{children:"Resources"}),y.jsxs("div",{className:"grid grid-cols-2 gap-2",role:"radiogroup","aria-label":"Sandbox size",children:[y.jsxs("button",{className:"btn whitespace-normal px-2.5 py-1.5 text-left",role:"radio","aria-checked":!a,"aria-pressed":!a,onClick:()=>me.updateSandbox(t.id,{resources:{cpus:null,memoryGb:null}}),children:[y.jsx("div",{children:"sbx default"}),y.jsxs("div",{className:"text-[12px] font-normal text-muted",children:["All ",c.cpus," CPUs · ",fi(c.memoryGb)," (half your memory)"]})]}),y.jsxs("button",{className:"btn whitespace-normal px-2.5 py-1.5 text-left",role:"radio","aria-checked":a,"aria-pressed":a,onClick:()=>d({cpus:Math.min(4,r.cpus),memoryGb:Math.min(4,h)}),children:[y.jsx("div",{children:"Custom"}),y.jsx("div",{className:"text-[12px] font-normal text-muted",children:"Pick CPUs and memory for this agent."})]})]}),a&&y.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-4",children:[y.jsxs("label",{className:"flex flex-col gap-1 text-[14px]",children:[y.jsxs("span",{className:"flex justify-between font-semibold",children:["CPUs ",y.jsxs("span",{className:"font-term text-[17px]",children:[u.cpus," of ",r.cpus]})]}),y.jsx("input",{type:"range",min:1,max:r.cpus,step:1,value:u.cpus,className:"accent-[#29adff]",onChange:S=>f({...u,cpus:Number(S.target.value)}),onPointerUp:()=>d(u),onKeyUp:()=>d(u)})]}),y.jsxs("label",{className:"flex flex-col gap-1 text-[14px]",children:[y.jsxs("span",{className:"flex justify-between font-semibold",children:["Memory ",y.jsxs("span",{className:"font-term text-[17px]",children:[fi(u.memoryGb)," of ",fi(h)," max"]})]}),y.jsx("input",{type:"range",min:.5,max:h,step:.5,value:u.memoryGb,className:"accent-[#29adff]",onChange:S=>f({...u,memoryGb:Number(S.target.value)}),onPointerUp:()=>d(u),onKeyUp:()=>d(u)})]})]}),y.jsxs("div",{className:`mt-3 border-2 px-2.5 py-1.5 text-[13px] ${g.overMemory?"border-orange bg-[#fff1d6]":"border-cream-3 bg-cream"}`,children:[y.jsx("b",{children:"Team:"})," ",g.count," sandbox",g.count===1?"":"es"," · ",g.cpus," CPUs · ",fi(g.memoryGb)," of your ",fi(r.memoryGb)," memory",g.overMemory&&y.jsx("div",{className:"text-[#a35d00]",children:"That's more memory than this machine has. Give agents less with Custom, or run fewer at once."})]}),t.mode==="sandbox"&&(_==null?void 0:_.sandbox)&&y.jsxs("div",{className:`mt-3 flex items-center gap-2 text-[13px] ${k?"border-2 border-orange bg-[#fff1d6] px-2.5 py-1.5":"text-muted"}`,children:[y.jsxs("span",{className:"flex-1",children:["The sandbox now has ",_.sandbox.cpus," CPUs · ",fi(_.sandbox.memoryGb),".",k&&" Size is fixed when a sandbox is created, so recreate it to apply the new size."]}),k&&y.jsx("button",{className:"btn px-2 text-[12px]",onClick:()=>window.confirm(`Recreate ${t.name}'s sandbox with ${o.cpus} CPUs and ${fi(o.memoryGb)}?
336
+
337
+ The agent's folder and code are kept. Anything installed inside the VM is lost, and the current session restarts.`)&&me.recreateSandbox(t.id),children:"Recreate sandbox"})]}),t.mode==="sandbox"&&!(_!=null&&_.sandbox)&&y.jsxs("p",{className:"mt-2 text-[12px] text-muted",children:["Applied when ",t.name,"'s sandbox is created on first Start."]})]})}const a5={"allow-all":"Allow all — every outbound connection is allowed",balanced:"Balanced — blocked by default; AI services, package registries and common dev sites allowed","deny-all":"Deny all — everything blocked unless a rule allows it",unknown:"Unknown — sbx didn't say"},Cy={hq:"HQ",kit:"agent kit",org:"your org",cli:"sbx CLI"};function ky({keys:t,onSet:e,onRemove:s,disabled:r}){const[i,a]=re.useState(Lv[0]),[c,o]=re.useState("");return y.jsxs("div",{children:[y.jsxs("ul",{className:"mb-2 flex flex-wrap gap-1.5",children:[t.length===0&&y.jsx("li",{className:"text-[13px] text-muted",children:"None"}),t.map(h=>y.jsxs("li",{className:"chip font-term text-[15px]",children:[h," ",y.jsx("span",{className:"text-muted",children:"••••"}),y.jsx("button",{className:"ml-1 text-[12px]","aria-label":`Remove ${h} key`,onClick:()=>window.confirm(`Remove the ${h} key from sbx?`)&&s(h),children:"✕"})]},h))]}),r?y.jsx("p",{className:"text-[12px] text-muted",children:r}):y.jsxs("form",{className:"grid grid-cols-[150px_1fr_auto] items-end gap-2",onSubmit:h=>{h.preventDefault(),c&&(e(i,c),o(""))},children:[y.jsx(Re,{label:"Service",children:y.jsx("select",{className:"field",value:i,onChange:h=>a(h.target.value),children:Lv.map(h=>y.jsx("option",{children:h},h))})}),y.jsx(Re,{label:"Key / token",children:y.jsx("input",{className:"field",type:"password",autoComplete:"off",value:c,onChange:h=>o(h.target.value)})}),y.jsx("button",{className:"btn",type:"submit",disabled:!c,children:"Store"})]})]})}function l5({initialAgentId:t}){var k;const e=be(S=>S.snap),s=be(S=>S.live),[r,i]=re.useState(t??((k=e==null?void 0:e.config.team[0])==null?void 0:k.id)??"");if(!e)return null;const a=e.config.team.find(S=>S.id===r)??e.config.team[0];if(!a)return null;const c=a.sandbox,o=e.sbx,h=o.agents[a.id],u=e.agents.find(S=>S.agentId===a.id),f=!!(u!=null&&u.session.sandbox)||!!(h!=null&&h.rules.length),d=S=>me.updateSandbox(a.id,S),g=e.config.project.hqPort,_=()=>{for(const S of e.config.team)S.id!==a.id&&me.updateSandbox(S.id,{allow:[...c.allow],deny:[...c.deny]})};return y.jsxs("div",{className:"flex flex-col gap-5",children:[y.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.config.team.map(S=>y.jsxs("button",{className:"btn flex items-center gap-1.5 text-[14px]","aria-pressed":S.id===a.id,onClick:()=>i(S.id),children:[y.jsx(Mn,{color:S.color,size:8})," ",S.name]},S.id)),y.jsx("button",{className:"btn ml-auto text-[13px]",onClick:()=>me.refreshSbx(),title:"Read rules, keys and proxy from sbx again",children:"Refresh from sbx"})]}),a.mode==="local"&&y.jsxs("p",{className:"border-[3px] border-orange bg-[#fff1d6] px-3 py-2 text-[14px]",children:[a.name," runs in Local mode, so sandbox settings don't apply until it's switched back to Sandbox. The env file still applies."]}),y.jsx("h3",{className:"-mb-2 text-[18px] font-bold",children:"This agent"}),y.jsx(o5,{agent:a,status:u,team:e.config.team,machine:e.setup.machine}),y.jsxs("section",{className:"border-[3px] border-ink bg-white p-3",children:[y.jsxs("div",{className:"flex items-center justify-between",children:[y.jsxs(Le,{children:["Network for ",a.name,"'s sandbox"]}),y.jsx("button",{className:"btn mb-2 px-2 text-[12px]",onClick:_,title:"Copy these allowed and blocked domains to every agent",children:"Copy to all agents"})]}),y.jsxs("p",{className:"mb-3 text-[13px] text-muted",children:["On top of the machine's base policy (",o.basePolicy,"). Blocked wins over allowed. Applied with"," ",y.jsx("code",{className:"font-term text-[15px]",children:"sbx policy allow/deny network --sandbox"}),"."]}),y.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[y.jsx(Re,{label:"Allowed domains",children:y.jsx(wy,{items:c.allow,onChange:S=>d({allow:S}),placeholder:"registry.npmjs.org",validate:Sy})}),y.jsx(Re,{label:"Blocked domains",children:y.jsx(wy,{items:c.deny,onChange:S=>d({deny:S}),placeholder:"*.googleapis.com",validate:Sy})})]}),(h==null?void 0:h.syncError)&&y.jsxs("p",{className:"mt-2 border-2 border-red bg-[#ffe1ea] px-2 py-1 text-[13px] text-red",children:["sbx: ",h.syncError]}),y.jsxs("div",{className:"mt-3",children:[y.jsxs("div",{className:"mb-1 text-[13px] font-semibold",children:["Rules in effect ",s?"(read from sbx)":"(demo)"]}),f?y.jsxs("ul",{className:"flex flex-wrap gap-1.5",children:[(h==null?void 0:h.rules.length)===0&&y.jsx("li",{className:"text-[12px] text-muted",children:"No sandbox-specific rules."}),h==null?void 0:h.rules.map(S=>S.resources.map(m=>y.jsxs("li",{className:"chip font-term text-[14px]",style:{"--c":S.decision==="allow"?"#c8f5d2":"#ffd0dc"},title:`${S.decision} · added by ${Cy[S.source]}`,children:[S.decision==="allow"?"✓":"✗"," ",m," ",y.jsx("span",{className:"text-[11px] text-muted",children:Cy[S.source]})]},`${S.id}-${m}`)))]}):y.jsxs("p",{className:"text-[12px] text-muted",children:[a.name,"'s sandbox doesn't exist yet. The rules above are applied when it's created on first Start."]})]})]}),y.jsxs("section",{className:"border-[3px] border-ink bg-white p-3",children:[y.jsxs(Le,{children:["Service keys for ",a.name," only"]}),y.jsxs("p",{className:"mb-2 text-[13px] text-muted",children:["The host proxy adds these to ",a.name,"'s requests, so the key never enters the VM. HQ passes the value straight to"," ",y.jsx("code",{className:"font-term text-[15px]",children:"sbx secret set"})," and never stores it."]}),y.jsx(ky,{keys:(h==null?void 0:h.keys)??[],disabled:f?void 0:`Start ${a.name} once to add keys only for this sandbox. Keys for every sandbox are under This machine.`,onSet:(S,m)=>me.setSecret(a.id,S,m),onRemove:S=>me.removeSecret(a.id,S)})]}),y.jsxs("section",{className:"border-[3px] border-ink bg-white p-3",children:[y.jsx(Le,{children:"App variables (env file)"}),y.jsxs("p",{className:"mb-2 text-[13px] text-muted",children:["For values your app needs to run and test (DATABASE_URL, STRIPE_KEY…). One ",y.jsx("code",{className:"font-term text-[15px]",children:"KEY=value"})," per line. HQ never reads or commits this file. When the agent starts, the values become environment variables in its session and in its Shell tab — not a .env file in the project. Restart the agent after editing."]}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("code",{className:"min-w-0 flex-1 truncate border-2 border-ink bg-cream px-2 py-0.5 font-term text-[16px]",title:h==null?void 0:h.envFile.path,children:(h==null?void 0:h.envFile.path)??"—"}),y.jsx("button",{className:"btn text-[13px]",onClick:()=>me.openEnvFile(a.id),children:h!=null&&h.envFile.exists?"Open":"Create & open"})]}),y.jsx("p",{className:"mt-2 text-[12px] font-semibold text-[#a35d00]",children:"⚠ Unlike service keys, these values do enter the VM. Use test or development credentials. Restart the agent after editing."})]}),y.jsx("h3",{className:"-mb-2 mt-2 text-[18px] font-bold",children:"This machine — all sandboxes"}),y.jsx("p",{className:"-mt-3 text-[13px] text-muted",children:"These are sbx's machine-wide settings. They affect every sandbox on this machine, including ones HQ didn't create."}),y.jsxs("section",{className:"border-[3px] border-ink bg-white p-3",children:[y.jsx(Le,{children:"Base network policy"}),y.jsx("p",{className:"text-[15px]",children:a5[o.basePolicy]}),y.jsxs("p",{className:"mt-1 text-[12px] text-muted",children:["Set once with ",y.jsx("code",{className:"font-term text-[14px]",children:"sbx policy init"}),". Changing it means ",y.jsx("code",{className:"font-term text-[14px]",children:"sbx policy reset"}),", which deletes every rule on this machine, so HQ doesn't do it. HQ always allows ",y.jsxs("code",{className:"font-term text-[14px]",children:["localhost:",g]})," and"," ",y.jsxs("code",{className:"font-term text-[14px]",children:["host.docker.internal:",g]})," so agents can reach it."," ",y.jsx("a",{className:"underline",href:"https://docs.docker.com/ai/sandboxes/security/",target:"_blank",rel:"noreferrer",children:"Docs ↗"})]})]}),y.jsxs("section",{className:"border-[3px] border-ink bg-white p-3",children:[y.jsx(Le,{children:"Upstream proxy"}),y.jsx(Re,{label:"Proxy URL",hint:"Optional. All sandbox traffic goes through this proxy. Leave empty for none.",children:y.jsx(ft,{className:"field font-term text-[17px]",value:o.proxy??"",placeholder:"http://proxy.internal:3128",onCommit:S=>me.setProxy(S.trim()||null)})})]}),y.jsxs("section",{className:"border-[3px] border-ink bg-white p-3",children:[y.jsx(Le,{children:"Service keys for every sandbox"}),y.jsx(ky,{keys:o.globalKeys,onSet:(S,m)=>me.setSecret(null,S,m),onRemove:S=>me.removeSecret(null,S)})]})]})}function c5(){const t=be(i=>{var a;return(a=i.snap)==null?void 0:a.config.stack})??X0,e=be(i=>{var a;return(a=i.snap)==null?void 0:a.config.team})??[],s=i=>{const a=!i.frameworks.length&&!Object.values(i.tools).some(Boolean);me.updateStack(a?null:i)},r=!t.frameworks.length&&!Object.values(t.tools).some(Boolean);return y.jsxs("div",{className:"flex flex-col gap-5",children:[y.jsx("p",{className:"m-0 text-[14px] text-muted",children:"Optional. Tell the agents what this project is built with: they'll get it in their ROLE.md, the tools' agent skills, and access to their docs once you allow it. Skip it and agents work as before."}),y.jsx(h5,{stack:t,save:s}),y.jsxs("section",{children:[y.jsx(Le,{children:"Tools"}),y.jsx("div",{className:"flex flex-col gap-2",children:Nf.map(i=>y.jsx(u5,{category:i.id,label:i.label,hint:i.hint,stack:t,save:s},i.id))})]}),!r&&y.jsxs(y.Fragment,{children:[y.jsx(d5,{stack:t,sandboxed:e.filter(i=>i.mode==="sandbox").map(i=>i.id)}),y.jsx(f5,{stack:t}),y.jsxs("section",{children:[y.jsx(Le,{children:"What agents read"}),y.jsx("p",{className:"mb-2 text-[13px] text-muted",children:"Added to every agent's ROLE.md the next time it starts."}),y.jsx("pre",{className:"m-0 whitespace-pre-wrap border-[3px] border-ink bg-navy-2 p-3 font-term text-[16px] leading-tight text-[#dfe6ff]",children:jP(t)})]}),y.jsx("div",{children:y.jsx("button",{className:"btn text-[13px]",onClick:()=>me.updateStack(null),children:"Clear stack"})})]})]})}function h5({stack:t,save:e}){const s=a=>t.frameworks.some(c=>c.id===a),r=a=>e({...t,frameworks:s(a)?t.frameworks.filter(c=>c.id!==a):[...t.frameworks,{id:a}]}),i=(a,c)=>e({...t,frameworks:t.frameworks.map((o,h)=>h===a?{...o,...c}:o)});return y.jsxs("section",{children:[y.jsx(Le,{children:"Frameworks"}),y.jsx("p",{className:"mb-2 text-[13px] text-muted",children:"Pick one or more, e.g. Next.js for the app and Express for an API."}),y.jsx("div",{className:"mb-3 flex flex-wrap gap-1.5",children:[...Q0(),{id:"other",name:"Other"}].map(a=>y.jsx("button",{className:"btn px-2 py-0.5 text-[13px]","aria-pressed":s(a.id),onClick:()=>r(a.id),children:a.name},a.id))}),t.frameworks.length>0&&y.jsx("div",{className:"flex flex-col gap-2",children:t.frameworks.map((a,c)=>{var o;return y.jsxs("div",{className:"grid grid-cols-[150px_1fr_1fr] items-end gap-2 border-[3px] border-ink bg-white px-3 py-2",children:[y.jsx("b",{className:"pb-2 text-[15px]",children:a.id==="other"?"Other":(o=ea(a.id))==null?void 0:o.name}),a.id==="other"?y.jsx(Re,{label:"Name",children:y.jsx(ft,{className:"field",value:a.name??"",placeholder:"Remix",onCommit:h=>i(c,{name:h.trim()||void 0})})}):y.jsx(iw,{id:a.id}),y.jsx(Re,{label:"Where (optional)",children:y.jsx(ft,{className:"field font-term text-[17px]",value:a.where??"",placeholder:c===0?"apps/web":"apps/api",onCommit:h=>i(c,{where:h.trim()||void 0})})}),a.id==="other"&&y.jsx("div",{className:"col-span-3",children:y.jsx(Re,{label:"Docs URL",children:y.jsx(ft,{className:"field font-term text-[17px]",value:a.docsUrl??"",placeholder:"https://remix.run/docs",onCommit:h=>i(c,{docsUrl:h.trim()||void 0})})})})]},a.id)})})]})}function u5({category:t,label:e,hint:s,stack:r,save:i}){const a=r.tools[t],c=o=>{const h={...r.tools};o?h[t]=o:delete h[t],i({...r,tools:h})};return y.jsxs("div",{className:"grid grid-cols-[150px_220px_1fr] items-center gap-3 border-[3px] border-ink bg-white px-3 py-2",children:[y.jsxs("div",{children:[y.jsx("b",{className:"text-[15px]",children:e}),y.jsx("div",{className:"text-[12px] text-muted",children:s})]}),y.jsxs("select",{className:"field",value:(a==null?void 0:a.id)??"","aria-label":e,onChange:o=>c(o.target.value?{id:o.target.value}:void 0),children:[y.jsx("option",{value:"",children:"None"}),Z0(t).map(o=>y.jsx("option",{value:o.id,children:o.name},o.id)),y.jsx("option",{value:"other",children:"Other…"})]}),(a==null?void 0:a.id)==="other"?y.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[y.jsx(ft,{className:"field",value:a.name??"",placeholder:"Tool name",onCommit:o=>c({...a,name:o.trim()||void 0})}),y.jsx(ft,{className:"field font-term text-[17px]",value:a.docsUrl??"",placeholder:"Docs URL",onCommit:o=>c({...a,docsUrl:o.trim()||void 0})})]}):a?y.jsx(iw,{id:a.id}):y.jsx("span",{className:"text-[13px] text-muted",children:"Not set"})]})}function iw({id:t}){const e=ea(t);return e?y.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 pb-1 text-[12px]",children:[e.skills.length?e.skills.map(s=>y.jsxs("span",{className:"chip font-term text-[14px]",title:s.skills.join(", "),children:[s.skills.length," skill",s.skills.length===1?"":"s"," · ",s.source]},s.source)):y.jsx("span",{className:"text-muted",children:"No agent skills listed"}),e.mcp&&y.jsx("span",{className:"chip font-term text-[14px]",title:e.mcp,children:"MCP"})]}):null}function d5({stack:t,sandboxed:e}){const s=be(f=>{var d;return(d=f.snap)==null?void 0:d.config.team})??[],r=J0(t),i=f=>e.length>0&&e.every(d=>{var g;return(g=s.find(_=>_.id===d))==null?void 0:g.sandbox.allow.includes(f)}),a=r.filter(f=>!i(f.domain)).map(f=>f.domain),[c,o]=re.useState(null),h=c??new Set(a),u=()=>{for(const f of e){const d=s.find(_=>_.id===f);if(!d)continue;const g=[...new Set([...d.sandbox.allow,...h])];g.length!==d.sandbox.allow.length&&me.updateSandbox(f,{allow:g})}o(null)};return y.jsxs("section",{children:[y.jsx(Le,{children:"Network access"}),y.jsxs("p",{className:"mb-2 text-[13px] text-muted",children:["Sandboxes block most docs sites and APIs. Allow these for every sandboxed agent, or leave them: an agent that needs a site asks you first (",y.jsx("i",{children:"request_access"}),")."]}),y.jsx("div",{className:"border-[3px] border-ink bg-white",children:r.map(f=>{const d=i(f.domain);return y.jsxs("label",{className:"flex items-center gap-2.5 border-t-2 border-dashed border-cream-3 px-3 py-1.5 first:border-t-0",children:[y.jsx("input",{type:"checkbox",disabled:d,checked:d||h.has(f.domain),onChange:g=>{const _=new Set(h);g.target.checked?_.add(f.domain):_.delete(f.domain),o(_)}}),y.jsx("span",{className:"font-term text-[17px]",children:f.domain}),y.jsx("span",{className:"text-[12px] text-muted",children:f.for.join(", ")}),d&&y.jsx("span",{className:"ml-auto text-[12px] font-semibold",style:{color:"#00a83a"},children:"allowed"})]},f.domain)})}),y.jsxs("div",{className:"mt-2 flex items-center gap-3",children:[y.jsxs("button",{className:"btn text-[13px]",disabled:!e.length||![...h].some(f=>a.includes(f)),onClick:u,children:["Allow selected for ",e.length," sandboxed agent",e.length===1?"":"s"]}),y.jsx("button",{className:"text-[13px] underline",onClick:()=>Se.openSettings("sandbox"),children:"Per-agent rules"})]})]})}function f5({stack:t}){const e=BP(t);return e.length?y.jsxs("section",{children:[y.jsx(Le,{children:"Keys the app needs"}),y.jsx("p",{className:"mb-2 text-[13px] text-muted",children:"Put test keys in each agent's env file (Settings → Sandbox → Env file). HQ never asks for, stores or reads the values."}),y.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.map(s=>y.jsx("span",{className:"chip font-term text-[15px]",title:s.for,children:s.key},s.key))})]}):null}const p5={ready:["Ready","#00e436"],"needs-auth":["Needs sign-in","#ffa300"]};function m5(){const t=be(x=>{var v;return(v=x.snap)==null?void 0:v.mcp}),e=be(x=>{var v;return(v=x.snap)==null?void 0:v.config.team})??[],s=be(x=>{var v;return(v=x.snap)==null?void 0:v.config.stack}),[r,i]=re.useState(null),[a,c]=re.useState(null),[o,h]=re.useState({name:"",url:"",apiKey:"",command:"",args:"",local:!1});if(!t)return y.jsx("p",{className:"text-[14px] text-muted",children:"Loading MCP servers…"});const u=t.servers,f=e.filter(x=>x.mode==="sandbox"),d=Of(s).filter(x=>x.mcp&&!u.some(v=>v.name===x.id)),g=(x,v,b)=>{var E;const C=((E=e.find(P=>P.id===x))==null?void 0:E.mcp)??[];me.setAgentMcp(x,b?[...C,v]:C.filter(P=>P!==v))},_=e.flatMap(x=>(t.attached[x.id]??[]).filter(v=>!(x.mcp??[]).includes(v)).map(v=>({agent:x,name:v}))),k=o.local?null:g5(o.url),S=/^[a-z0-9][a-z0-9_-]{0,39}$/.test(o.name.trim().toLowerCase())&&(o.local?o.command.trim():o.url.trim()),m=()=>{me.addMcp({name:o.name.trim().toLowerCase(),...o.local?{command:o.command.trim(),args:o.args.trim()?o.args.split(",").map(x=>x.trim()).filter(Boolean):void 0}:{url:o.url.trim(),apiKey:o.apiKey.trim()||void 0}}),h({name:"",url:"",apiKey:"",command:"",args:"",local:!1})};return y.jsxs("div",{className:"flex flex-col gap-5",children:[y.jsx("p",{className:"m-0 text-[14px] text-muted",children:"MCP servers come from Docker Sandboxes' registry. Each one runs through sbx's gateway, so its sign-in or key never enters a sandbox. Tick a server for an agent and it's attached right away if the agent is running; agents don't need a restart."}),y.jsxs("section",{children:[y.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[y.jsx(Le,{children:"Servers"}),y.jsx("button",{className:"btn px-2 text-[12px]",onClick:()=>me.refreshMcp(),children:"Refresh"})]}),t.error&&y.jsx("p",{className:"mb-2 border-[3px] border-orange bg-[#fff1d6] px-3 py-1.5 text-[13px]",children:t.error}),u.length===0?y.jsx("p",{className:"text-[13px] text-muted",children:"No MCP servers yet. Add one below."}):y.jsx("div",{className:"border-[3px] border-ink bg-white",children:u.map(x=>{const[v,b]=p5[x.status]??[x.status,"#83769c"];return y.jsxs("div",{className:"flex items-center gap-3 border-t-2 border-dashed border-cream-3 px-3 py-2 first:border-t-0",children:[y.jsx("b",{className:"font-term text-[17px]",children:x.name}),y.jsx("span",{className:"text-[12px] text-muted",children:x.transport}),y.jsx("span",{className:"chip chip-dot text-[12px]",style:{"--c":b},children:v}),y.jsx("span",{className:"flex-1"}),x.status==="needs-auth"&&y.jsx("button",{className:"btn px-2 text-[12px]",onClick:()=>{i(x.name),me.authMcp(x.name)},children:"Sign in"}),a===x.name?y.jsxs(y.Fragment,{children:[y.jsx("span",{className:"text-[12px] text-red",children:"Removes it from every sandbox on this Mac."}),y.jsx("button",{className:"btn px-2 text-[12px]",onClick:()=>{me.removeMcp(x.name),c(null)},children:"Delete"}),y.jsx("button",{className:"text-[12px] underline",onClick:()=>c(null),children:"Cancel"})]}):y.jsx("button",{className:"text-[12px] underline",onClick:()=>c(x.name),children:"Delete…"})]},x.name)})}),r&&y.jsxs("div",{className:"mt-2 border-[3px] border-ink",children:[y.jsxs("div",{className:"flex items-center justify-between bg-navy px-2 py-1 text-[13px] text-cream",children:[y.jsxs("span",{children:["Signing in to ",r," · your browser opens; answer here if it asks"]}),y.jsx("button",{className:"text-[12px] underline",onClick:()=>i(null),children:"Hide"})]}),y.jsx("div",{className:"h-[200px]",children:y.jsx(oa,{agentId:`setup:mcp-auth-${r}`},r)})]})]}),u.length>0&&y.jsxs("section",{children:[y.jsx(Le,{children:"Which agents get them"}),f.length===0?y.jsx("p",{className:"text-[13px] text-muted",children:"MCP servers attach to sandboxes. All agents are in Local mode."}):y.jsxs("table",{className:"w-full border-[3px] border-ink bg-white text-[14px]",children:[y.jsx("thead",{children:y.jsxs("tr",{className:"bg-cream-2 text-left",children:[y.jsx("th",{className:"px-3 py-1.5",children:"Server"}),f.map(x=>y.jsx("th",{className:"px-3 py-1.5 text-center",children:x.name},x.id))]})}),y.jsx("tbody",{children:u.map(x=>y.jsxs("tr",{className:"border-t-2 border-dashed border-cream-3",children:[y.jsx("td",{className:"px-3 py-1.5 font-term text-[16px]",children:x.name}),f.map(v=>{const b=(v.mcp??[]).includes(x.name),C=(t.attached[v.id]??[]).includes(x.name);return y.jsxs("td",{className:"px-3 py-1.5 text-center",children:[y.jsx("input",{type:"checkbox",checked:b,"aria-label":`${x.name} for ${v.name}`,onChange:E=>g(v.id,x.name,E.target.checked)}),b&&!C&&y.jsx("div",{className:"text-[11px] text-muted",children:"on next start"})]},v.id)})]},x.name))})]}),e.some(x=>x.mode==="local")&&y.jsx("p",{className:"mt-1 text-[12px] text-muted",children:"Local-mode agents aren't listed: MCP servers attach to sandboxes."}),_.map(({agent:x,name:v})=>y.jsxs("p",{className:"mt-2 flex flex-wrap items-center gap-2 border-[3px] border-ink bg-[#fff1d6] px-3 py-1.5 text-[13px]",children:[y.jsxs("span",{className:"flex-1",children:[x.name,"'s sandbox still has ",y.jsx("b",{children:v}),": sbx can't detach a server, so it goes when the sandbox is recreated. The folder and code are kept; installed packages and the conversation are not."]}),y.jsx("button",{className:"btn px-2 text-[12px]",onClick:()=>{window.confirm(`Recreate ${x.name}'s sandbox? Its folder is kept; the VM starts fresh.`)&&me.recreateSandbox(x.id)},children:"Recreate sandbox"})]},`${x.id}-${v}`))]}),y.jsxs("section",{className:"border-[3px] border-ink bg-white p-3",children:[y.jsx(Le,{children:"Add a server"}),d.length>0&&y.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-1.5 text-[13px]",children:[y.jsx("span",{className:"text-muted",children:"From your stack:"}),d.map(x=>y.jsx("button",{className:"btn px-2 text-[12px]",onClick:()=>h({...o,local:!1,name:x.id,url:x.mcp??""}),children:x.name},x.id))]}),y.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[y.jsx(Re,{label:"Name",hint:"Letters, numbers, - or _",children:y.jsx("input",{className:"field w-full font-term text-[17px]",value:o.name,placeholder:"supabase",onChange:x=>h({...o,name:x.target.value})})}),o.local?y.jsx(Re,{label:"Command",hint:"A program on this Mac (local stdio server)",children:y.jsx("input",{className:"field w-full font-term text-[17px]",value:o.command,placeholder:"npx",onChange:x=>h({...o,command:x.target.value})})}):y.jsx(Re,{label:"URL",children:y.jsx("input",{className:"field w-full font-term text-[17px]",value:o.url,placeholder:"https://mcp.example.com/mcp",onChange:x=>h({...o,url:x.target.value})})}),o.local?y.jsx(Re,{label:"Arguments",hint:"Comma separated",children:y.jsx("input",{className:"field w-full font-term text-[17px]",value:o.args,placeholder:"-y, @supabase/mcp-server",onChange:x=>h({...o,args:x.target.value})})}):y.jsx(Re,{label:"API key (optional)",hint:"Sent as a Bearer token. Stored by Docker Sandboxes, never by HQ. Leave empty to sign in instead.",children:y.jsx("input",{type:"password",autoComplete:"off",className:"field w-full font-term text-[17px]",value:o.apiKey,placeholder:"••••",onChange:x=>h({...o,apiKey:x.target.value})})})]}),k&&y.jsx("p",{className:"mt-2 text-[13px] text-muted",children:k}),y.jsxs("div",{className:"mt-3 flex items-center gap-3",children:[y.jsx("button",{className:"btn",disabled:!S,onClick:m,children:"Add server"}),y.jsx("button",{className:"text-[12px] underline",onClick:()=>h({...o,local:!o.local}),children:o.local?"Use a URL instead":"Local server (command)…"})]})]})]})}function g5(t){var r;let e;try{e=new URL(t.trim())}catch{return null}const s=Ac.find(i=>i.mcp&&i.mcpParam&&new URL(i.mcp).host===e.host);return s!=null&&s.mcpParam&&!((r=e.searchParams.get(s.mcpParam.name))!=null&&r.trim())?s.mcpParam.hint:null}const _5={coderabbit:"Reads CodeRabbit's check and comments on each PR.",greptile:"Reads Greptile's review status and comments.",copilot:"Reads GitHub Copilot code review results.",human:"A person reviews. HQ waits for an approving GitHub review.",custom:"Runs your command; exit code 0 = passed, anything else = changes."};function v5(){const t=be(r=>{var i;return(i=r.snap)==null?void 0:i.config.workflow}),e=be(r=>r.live);if(!t)return null;const s=(r,i,a)=>y.jsxs("span",{className:`border-[3px] border-ink px-2 py-0.5 ${i?"bg-white":"bg-cream-2 text-muted line-through"}`,children:[y.jsx("b",{children:r})," ",y.jsx("span",{className:"text-[12px]",children:a})]});return y.jsxs("div",{className:"flex flex-col gap-6",children:[y.jsxs("section",{children:[y.jsx(Le,{children:"Pipeline"}),y.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[14px]",children:[s("Build",!0,"agent in its sandbox"),y.jsx("span",{children:"→"}),s("Review",t.review.enabled,Si[t.review.tool]),y.jsx("span",{children:"→"}),s("Merge",!0,t.merge.by==="lead"?"by the lead":"by you"),y.jsx("span",{children:"→"}),e?y.jsxs("span",{className:"border-[3px] border-dashed border-ink bg-cream-2 px-2 py-0.5 text-muted",children:[y.jsx("b",{children:"Deploy"})," ",y.jsx("span",{className:"text-[12px]",children:"coming soon"})]}):s("Deploy",t.deploy.enabled,ql[t.deploy.tool])]}),y.jsx("p",{className:"mt-2 text-[13px] text-muted",children:"One task = one branch = one PR. HQ only reads results from these tools; it never merges or deploys itself."})]}),y.jsxs("section",{className:"border-[3px] border-ink bg-white p-3",children:[y.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[y.jsx(Le,{children:"Review"}),y.jsx(Ql,{checked:t.review.enabled,onChange:r=>me.updateWorkflow({review:{enabled:r}}),label:t.review.enabled?"On":"Off"})]}),y.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[y.jsx(Re,{label:"Tool",hint:_5[t.review.tool],children:y.jsx("select",{className:"field",disabled:!t.review.enabled,value:t.review.tool,onChange:r=>me.updateWorkflow({review:{tool:r.target.value}}),children:Object.keys(Si).map(r=>y.jsx("option",{value:r,children:Si[r]},r))})}),t.review.tool==="custom"&&y.jsx(Re,{label:"Command",hint:"Runs on the host against the PR branch.",children:y.jsx(ft,{className:"field font-term text-[17px]",value:t.review.command,placeholder:"pnpm lint && pnpm test",onCommit:r=>me.updateWorkflow({review:{command:r}})})})]}),y.jsx("p",{className:"mt-2 text-[12px] text-muted",children:"When a review finishes with comments, HQ tells the PR's author to fix them."})]}),y.jsxs("section",{className:"border-[3px] border-ink bg-white p-3",children:[y.jsx(Le,{children:"Merge"}),y.jsx("div",{className:"flex gap-2",role:"radiogroup","aria-label":"Who merges",children:["human","lead"].map(r=>y.jsx("button",{className:"btn text-[14px]",role:"radio","aria-checked":t.merge.by===r,"aria-pressed":t.merge.by===r,onClick:()=>me.updateWorkflow({merge:{by:r}}),children:r==="human"?"You merge":"The lead merges"},r))}),y.jsx("p",{className:"mt-2 text-[12px] text-muted",children:"The lead always sets the merge order and handles conflicts between PRs."})]}),e?y.jsxs("section",{className:"border-[3px] border-dashed border-ink bg-cream-2 p-3",children:[y.jsxs("div",{className:"mb-1 flex items-center justify-between",children:[y.jsx(Le,{children:"Deploy"}),y.jsx("span",{className:"chip text-[12px]",children:"Coming soon"})]}),y.jsx("p",{className:"m-0 text-[13px] text-muted",children:"Preview deployments per PR (Vercel, InstaCloud) and one environment per agent, shown in the office's server room. Not available yet; agents can still deploy with their own tools."})]}):y.jsxs("section",{className:"border-[3px] border-ink bg-white p-3",children:[y.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[y.jsx(Le,{children:"Deploy"}),y.jsx(Ql,{checked:t.deploy.enabled,onChange:r=>me.updateWorkflow({deploy:{enabled:r}}),label:t.deploy.enabled?"On":"Off"})]}),y.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[y.jsx(Re,{label:"Tool",children:y.jsx("select",{className:"field",disabled:!t.deploy.enabled,value:t.deploy.tool,onChange:r=>me.updateWorkflow({deploy:{tool:r.target.value}}),children:Object.keys(ql).map(r=>y.jsx("option",{value:r,children:ql[r]},r))})}),t.deploy.tool==="custom"&&y.jsx(Re,{label:"Command",children:y.jsx(ft,{className:"field font-term text-[17px]",value:t.deploy.command,placeholder:"./scripts/deploy.sh",onCommit:r=>me.updateWorkflow({deploy:{command:r}})})}),y.jsx("div",{className:"col-span-2",children:y.jsx(Ql,{checked:t.deploy.perAgentEnvironments,onChange:r=>me.updateWorkflow({deploy:{perAgentEnvironments:r}}),label:"One environment per agent (own app + database copy)"})})]}),y.jsx("p",{className:"mt-2 text-[12px] text-muted",children:"The server room shows one rack per environment. Turn deploy off to hide it."})]})]})}const x5=[{id:"team",label:"Team",hint:"Agents, roles, skills"},{id:"workflow",label:"Workflow",hint:"Review, merge, deploy"},{id:"stack",label:"Stack",hint:"Frameworks, tools"},{id:"mcp",label:"MCP",hint:"Servers for agents"},{id:"sandbox",label:"Sandbox",hint:"Network, proxy, secrets"},{id:"boards",label:"Boards",hint:"Progress boards"},{id:"project",label:"Project",hint:"Repo and HQ"}];function y5(){const t=Ie(s=>s.settings),e=Cp();return t?y.jsx("div",{className:"fixed inset-0 z-40 grid place-items-center bg-[rgba(36,26,46,0.55)] p-4",role:"dialog","aria-modal":"true","aria-label":"Settings",onMouseDown:s=>s.target===s.currentTarget&&Se.closeSettings(),children:y.jsxs(yc.div,{initial:e?!1:{y:-16,opacity:0},animate:{y:0,opacity:1},transition:{duration:.2},className:"panel flex h-[min(760px,calc(100dvh-2rem))] w-[min(1080px,100%)] flex-col",children:[y.jsxs("div",{className:"flex items-center gap-3 border-b-[3px] border-ink px-4 py-2",children:[y.jsx("h2",{className:"m-0 flex-1 text-[22px] font-bold",children:"Settings"}),y.jsx("span",{className:"text-[13px] text-muted",children:"Changes apply right away."}),y.jsx("button",{className:"btn px-2.5","aria-label":"Close settings",onClick:()=>Se.closeSettings(),children:"✕"})]}),y.jsxs("div",{className:"flex min-h-0 flex-1",children:[y.jsx("nav",{className:"flex w-[200px] shrink-0 flex-col gap-2 border-r-[3px] border-ink bg-cream-2 p-3","aria-label":"Settings sections",children:x5.map(s=>y.jsxs("button",{className:"btn block px-2.5 py-1 text-left","aria-pressed":t.tab===s.id,onClick:()=>Se.openSettings(s.id,t.agentId),children:[y.jsx("div",{className:"text-[16px]",children:s.label}),y.jsx("div",{className:"text-[11px] font-normal text-muted",children:s.hint})]},s.id))}),y.jsxs("div",{className:"scroll-thin min-w-0 flex-1 overflow-y-auto p-5",children:[t.tab==="team"&&y.jsx(UL,{}),t.tab==="workflow"&&y.jsx(v5,{}),t.tab==="stack"&&y.jsx(c5,{}),t.tab==="mcp"&&y.jsx(m5,{}),t.tab==="sandbox"&&y.jsx(l5,{initialAgentId:t.agentId}),t.tab==="boards"&&y.jsx(e5,{}),t.tab==="project"&&y.jsx(s5,{})]})]})]})}):null}function b5(){re.useEffect(()=>{const t=e=>{var o;const s=e.target;if(s&&(s.closest("input, textarea, select, [contenteditable], .xterm")||e.metaKey||e.ctrlKey||e.altKey)){e.key==="Escape"&&s.closest(".xterm")&&s.blur();return}const{settings:r,drawer:i,setupOpen:a}=Ie.getState();if(e.key==="Escape"){a?Se.closeSetup():r?Se.closeSettings():i&&Se.closeDrawer();return}if(r||a)return;let c=!0;if(e.key==="d"||e.key==="D")Se.toggleDebug();else if(e.key==="+"||e.key==="=")Se.zoom(1);else if(e.key==="-")Se.zoom(-1);else if(/^[1-9]$/.test(e.key)){const u=(((o=be.getState().snap)==null?void 0:o.config.team)??[])[Number(e.key)-1];u&&Se.openAgent(u.id)}else c=!1;c&&e.preventDefault()};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[])}function w5(){re.useEffect(()=>{let t=!1;return be.subscribe(e=>{if(t||!e.live||!e.snap||e.snap.welcome)return;t=!0,e.snap.setup.checks.some(r=>r.status!=="ok"&&r.neededFor!=="github"&&r.neededFor!=="local")&&Se.openSetup()})},[])}function S5(){re.useEffect(()=>mM(),[]),b5(),w5();const t=be(r=>r.snap!==null),e=Ie(r=>r.setupOpen),s=be(r=>{var i;return r.live&&!!((i=r.snap)!=null&&i.welcome)});return y.jsxs(y.Fragment,{children:[y.jsx(EA,{}),y.jsx(IL,{}),t&&y.jsxs(y.Fragment,{children:[y.jsx(JL,{}),y.jsx(YL,{}),y.jsx(jL,{}),y.jsx(DL,{}),y.jsx(MA,{}),y.jsx(y5,{}),s?y.jsx(GL,{}):e&&y.jsx($L,{}),y.jsx(XL,{})]})]})}tw(kp());hC.createRoot(document.getElementById("root")).render(y.jsx(re.StrictMode,{children:y.jsx(S5,{})}));export{yE as $,w0 as A,Vo as B,Ss as C,Hr as D,Zs as E,Jo as F,Ec as G,zC as H,Qs as I,B2 as J,Pc as K,ev as L,Ne as M,Vl as N,kc as O,Ft as P,tc as Q,Id as R,kf as S,Ve as T,ec as U,hs as V,x0 as W,Pt as X,u0 as Y,uE as Z,fE as _,f0 as a,_E as a0,AC as a1,SE as a2,ts as a3,Ny as a4,Ns as a5,Wy as a6,j_ as a7,ki as a8,fk as a9,N_ as aa,$u as ab,F_ as ac,mk as ad,$y as ae,MP as af,S0 as ag,xt as ah,k2 as ai,y2 as aj,q2 as ak,$2 as al,Zk as am,kC as an,dE as ao,pE as ap,bE as aq,xE as ar,wE as as,a0 as b,nk as c,je as d,Sc as e,Uk as f,Ge as g,N2 as h,Zl as i,es as j,rt as k,zl as l,Fy as m,S_ as n,Fe as o,yi as p,AE as q,FE as r,Mc as s,_P as t,e2 as u,rn as v,Ht as w,Cf as x,Mt as y,dn as z};