@therealjsmastery/jsm-hq 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +119 -2
- package/TRADEMARKS.md +17 -0
- package/bin/jsm-hq.mjs +50 -0
- package/dist/assets/CanvasPool-O1IaWL-9.js +1 -0
- package/dist/assets/CanvasRenderer-Dd4pZNIN.js +1 -0
- package/dist/assets/RenderTargetSystem-BccyHTeF.js +184 -0
- package/dist/assets/WebGLRenderer-1zkR__s9.js +156 -0
- package/dist/assets/WebGPURenderer-CSiZQVKf.js +75 -0
- package/dist/assets/browserAll-K-v47ayM.js +14 -0
- package/dist/assets/canvasUtils-C3DGUQjp.js +1 -0
- package/dist/assets/getTexelRangeRects-D8_SvULv.js +195 -0
- package/dist/assets/index-BHNtDgvI.css +1 -0
- package/dist/assets/index-DPTN0V6X.js +311 -0
- package/dist/assets/pixelify-sans-cyrillic-400-normal-DfOZNMlW.woff +0 -0
- package/dist/assets/pixelify-sans-cyrillic-600-normal-B3EuUOZG.woff +0 -0
- package/dist/assets/pixelify-sans-cyrillic-700-normal-BrZTw8tu.woff +0 -0
- package/dist/assets/pixelify-sans-latin-400-normal-DLrIX9QE.woff2 +0 -0
- package/dist/assets/pixelify-sans-latin-400-normal-JapMNN6Z.woff +0 -0
- package/dist/assets/pixelify-sans-latin-600-normal-BNlgYbDL.woff +0 -0
- package/dist/assets/pixelify-sans-latin-600-normal-Dd_Dy7u5.woff2 +0 -0
- package/dist/assets/pixelify-sans-latin-700-normal-BctWAS0u.woff +0 -0
- package/dist/assets/pixelify-sans-latin-700-normal-D3Xxx3QE.woff2 +0 -0
- package/dist/assets/pixelify-sans-latin-ext-400-normal-BkfTUL4s.woff +0 -0
- package/dist/assets/pixelify-sans-latin-ext-400-normal-DdH6zlBQ.woff2 +0 -0
- package/dist/assets/pixelify-sans-latin-ext-600-normal-CDaIumwU.woff +0 -0
- package/dist/assets/pixelify-sans-latin-ext-600-normal-Dha6RiOG.woff2 +0 -0
- package/dist/assets/pixelify-sans-latin-ext-700-normal-BadXkHzZ.woff +0 -0
- package/dist/assets/pixelify-sans-latin-ext-700-normal-ClyJstAh.woff2 +0 -0
- package/dist/assets/vt323-latin-400-normal-Dqn9ZSPj.woff +0 -0
- package/dist/assets/vt323-latin-400-normal-wDgJuOC9.woff2 +0 -0
- package/dist/assets/vt323-latin-ext-400-normal-DqOq58ri.woff +0 -0
- package/dist/assets/vt323-latin-ext-400-normal-iUdYUaX4.woff2 +0 -0
- package/dist/assets/vt323-vietnamese-400-normal-D0VnvwZ9.woff2 +0 -0
- package/dist/assets/vt323-vietnamese-400-normal-D_5Q7Vcv.woff +0 -0
- package/dist/assets/webworkerAll-wf0zq30l.js +83 -0
- package/dist/index.html +14 -0
- package/dist-server/main.mjs +2342 -0
- package/package.json +79 -4
- package/scripts/fix-node-pty.mjs +17 -0
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/browserAll-K-v47ayM.js","assets/webworkerAll-wf0zq30l.js","assets/canvasUtils-C3DGUQjp.js","assets/CanvasPool-O1IaWL-9.js","assets/WebGPURenderer-CSiZQVKf.js","assets/getTexelRangeRects-D8_SvULv.js","assets/RenderTargetSystem-BccyHTeF.js","assets/WebGLRenderer-1zkR__s9.js","assets/CanvasRenderer-Dd4pZNIN.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var mS=Object.defineProperty;var gS=(t,e,s)=>e in t?mS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var me=(t,e,s)=>gS(t,typeof e!="symbol"?e+"":e,s);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))r(n);new MutationObserver(n=>{for(const l of n)if(l.type==="childList")for(const c of l.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&r(c)}).observe(document,{childList:!0,subtree:!0});function s(n){const l={};return n.integrity&&(l.integrity=n.integrity),n.referrerPolicy&&(l.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?l.credentials="include":n.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(n){if(n.ep)return;n.ep=!0;const l=s(n);fetch(n.href,l)}})();function e0(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var gu={exports:{}},no={},_u={exports:{}},Re={};/**
|
|
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 Ug;function _S(){if(Ug)return Re;Ug=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),n=Symbol.for("react.profiler"),l=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"),p=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 w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,y={};function m(B,F,Z){this.props=B,this.context=F,this.refs=y,this.updater=Z||w}m.prototype.isReactComponent={},m.prototype.setState=function(B,F){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,F,"setState")},m.prototype.forceUpdate=function(B){this.updater.enqueueForceUpdate(this,B,"forceUpdate")};function v(){}v.prototype=m.prototype;function x(B,F,Z){this.props=B,this.context=F,this.refs=y,this.updater=Z||w}var _=x.prototype=new v;_.constructor=x,S(_,m.prototype),_.isPureReactComponent=!0;var C=Array.isArray,M=Object.prototype.hasOwnProperty,T={current:null},R={key:!0,ref:!0,__self:!0,__source:!0};function P(B,F,Z){var ne,he={},ae=null,V=null;if(F!=null)for(ne in F.ref!==void 0&&(V=F.ref),F.key!==void 0&&(ae=""+F.key),F)M.call(F,ne)&&!R.hasOwnProperty(ne)&&(he[ne]=F[ne]);var O=arguments.length-2;if(O===1)he.children=Z;else if(1<O){for(var ie=Array(O),se=0;se<O;se++)ie[se]=arguments[se+2];he.children=ie}if(B&&B.defaultProps)for(ne in O=B.defaultProps,O)he[ne]===void 0&&(he[ne]=O[ne]);return{$$typeof:t,type:B,key:ae,ref:V,props:he,_owner:T.current}}function L(B,F){return{$$typeof:t,type:B.type,key:F,ref:B.ref,props:B.props,_owner:B._owner}}function j(B){return typeof B=="object"&&B!==null&&B.$$typeof===t}function $(B){var F={"=":"=0",":":"=2"};return"$"+B.replace(/[=:]/g,function(Z){return F[Z]})}var U=/\/+/g;function z(B,F){return typeof B=="object"&&B!==null&&B.key!=null?$(""+B.key):F.toString(36)}function Y(B,F,Z,ne,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=ne===""?"."+z(V,0):ne,C(he)?(Z="",B!=null&&(Z=B.replace(U,"$&/")+"/"),Y(he,F,Z,"",function(se){return se})):he!=null&&(j(he)&&(he=L(he,Z+(!he.key||V&&V.key===he.key?"":(""+he.key).replace(U,"$&/")+"/")+B)),F.push(he)),1;if(V=0,ne=ne===""?".":ne+":",C(B))for(var O=0;O<B.length;O++){ae=B[O];var ie=ne+z(ae,O);V+=Y(ae,F,Z,ie,he)}else if(ie=g(B),typeof ie=="function")for(B=ie.call(B),O=0;!(ae=B.next()).done;)ae=ae.value,ie=ne+z(ae,O++),V+=Y(ae,F,Z,ie,he);else if(ae==="object")throw F=String(B),Error("Objects are not valid as a React child (found: "+(F==="[object Object]"?"object with keys {"+Object.keys(B).join(", ")+"}":F)+"). If you meant to render a collection of children, use an array instead.");return V}function re(B,F,Z){if(B==null)return B;var ne=[],he=0;return Y(B,ne,"","",function(ae){return F.call(Z,ae,he++)}),ne}function Q(B){if(B._status===-1){var F=B._result;F=F(),F.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=F)}if(B._status===1)return B._result.default;throw B._result}var J={current:null},K={transition:null},D={ReactCurrentDispatcher:J,ReactCurrentBatchConfig:K,ReactCurrentOwner:T};function N(){throw Error("act(...) is not supported in production builds of React.")}return Re.Children={map:re,forEach:function(B,F,Z){re(B,function(){F.apply(this,arguments)},Z)},count:function(B){var F=0;return re(B,function(){F++}),F},toArray:function(B){return re(B,function(F){return F})||[]},only:function(B){if(!j(B))throw Error("React.Children.only expected to receive a single React element child.");return B}},Re.Component=m,Re.Fragment=s,Re.Profiler=n,Re.PureComponent=x,Re.StrictMode=r,Re.Suspense=h,Re.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=D,Re.act=N,Re.cloneElement=function(B,F,Z){if(B==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+B+".");var ne=S({},B.props),he=B.key,ae=B.ref,V=B._owner;if(F!=null){if(F.ref!==void 0&&(ae=F.ref,V=T.current),F.key!==void 0&&(he=""+F.key),B.type&&B.type.defaultProps)var O=B.type.defaultProps;for(ie in F)M.call(F,ie)&&!R.hasOwnProperty(ie)&&(ne[ie]=F[ie]===void 0&&O!==void 0?O[ie]:F[ie])}var ie=arguments.length-2;if(ie===1)ne.children=Z;else if(1<ie){O=Array(ie);for(var se=0;se<ie;se++)O[se]=arguments[se+2];ne.children=O}return{$$typeof:t,type:B.type,key:he,ref:ae,props:ne,_owner:V}},Re.createContext=function(B){return B={$$typeof:c,_currentValue:B,_currentValue2:B,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},B.Provider={$$typeof:l,_context:B},B.Consumer=B},Re.createElement=P,Re.createFactory=function(B){var F=P.bind(null,B);return F.type=B,F},Re.createRef=function(){return{current:null}},Re.forwardRef=function(B){return{$$typeof:o,render:B}},Re.isValidElement=j,Re.lazy=function(B){return{$$typeof:p,_payload:{_status:-1,_result:B},_init:Q}},Re.memo=function(B,F){return{$$typeof:u,type:B,compare:F===void 0?null:F}},Re.startTransition=function(B){var F=K.transition;K.transition={};try{B()}finally{K.transition=F}},Re.unstable_act=N,Re.useCallback=function(B,F){return J.current.useCallback(B,F)},Re.useContext=function(B){return J.current.useContext(B)},Re.useDebugValue=function(){},Re.useDeferredValue=function(B){return J.current.useDeferredValue(B)},Re.useEffect=function(B,F){return J.current.useEffect(B,F)},Re.useId=function(){return J.current.useId()},Re.useImperativeHandle=function(B,F,Z){return J.current.useImperativeHandle(B,F,Z)},Re.useInsertionEffect=function(B,F){return J.current.useInsertionEffect(B,F)},Re.useLayoutEffect=function(B,F){return J.current.useLayoutEffect(B,F)},Re.useMemo=function(B,F){return J.current.useMemo(B,F)},Re.useReducer=function(B,F,Z){return J.current.useReducer(B,F,Z)},Re.useRef=function(B){return J.current.useRef(B)},Re.useState=function(B){return J.current.useState(B)},Re.useSyncExternalStore=function(B,F,Z){return J.current.useSyncExternalStore(B,F,Z)},Re.useTransition=function(){return J.current.useTransition()},Re.version="18.3.1",Re}var Vg;function sf(){return Vg||(Vg=1,_u.exports=_S()),_u.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 Gg;function vS(){if(Gg)return no;Gg=1;var t=sf(),e=Symbol.for("react.element"),s=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,n=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function c(o,h,u){var p,d={},g=null,w=null;u!==void 0&&(g=""+u),h.key!==void 0&&(g=""+h.key),h.ref!==void 0&&(w=h.ref);for(p in h)r.call(h,p)&&!l.hasOwnProperty(p)&&(d[p]=h[p]);if(o&&o.defaultProps)for(p in h=o.defaultProps,h)d[p]===void 0&&(d[p]=h[p]);return{$$typeof:e,type:o,key:g,ref:w,props:d,_owner:n.current}}return no.Fragment=s,no.jsx=c,no.jsxs=c,no}var qg;function yS(){return qg||(qg=1,gu.exports=vS()),gu.exports}var E=yS(),oe=sf();const cl=e0(oe);var hl={},vu={exports:{}},Zt={},yu={exports:{}},xu={};/**
|
|
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 Kg;function xS(){return Kg||(Kg=1,(function(t){function e(K,D){var N=K.length;K.push(D);e:for(;0<N;){var B=N-1>>>1,F=K[B];if(0<n(F,D))K[B]=D,K[N]=F,N=B;else break e}}function s(K){return K.length===0?null:K[0]}function r(K){if(K.length===0)return null;var D=K[0],N=K.pop();if(N!==D){K[0]=N;e:for(var B=0,F=K.length,Z=F>>>1;B<Z;){var ne=2*(B+1)-1,he=K[ne],ae=ne+1,V=K[ae];if(0>n(he,N))ae<F&&0>n(V,he)?(K[B]=V,K[ae]=N,B=ae):(K[B]=he,K[ne]=N,B=ne);else if(ae<F&&0>n(V,N))K[B]=V,K[ae]=N,B=ae;else break e}}return D}function n(K,D){var N=K.sortIndex-D.sortIndex;return N!==0?N:K.id-D.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;t.unstable_now=function(){return l.now()}}else{var c=Date,o=c.now();t.unstable_now=function(){return c.now()-o}}var h=[],u=[],p=1,d=null,g=3,w=!1,S=!1,y=!1,m=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function _(K){for(var D=s(u);D!==null;){if(D.callback===null)r(u);else if(D.startTime<=K)r(u),D.sortIndex=D.expirationTime,e(h,D);else break;D=s(u)}}function C(K){if(y=!1,_(K),!S)if(s(h)!==null)S=!0,Q(M);else{var D=s(u);D!==null&&J(C,D.startTime-K)}}function M(K,D){S=!1,y&&(y=!1,v(P),P=-1),w=!0;var N=g;try{for(_(D),d=s(h);d!==null&&(!(d.expirationTime>D)||K&&!$());){var B=d.callback;if(typeof B=="function"){d.callback=null,g=d.priorityLevel;var F=B(d.expirationTime<=D);D=t.unstable_now(),typeof F=="function"?d.callback=F:d===s(h)&&r(h),_(D)}else r(h);d=s(h)}if(d!==null)var Z=!0;else{var ne=s(u);ne!==null&&J(C,ne.startTime-D),Z=!1}return Z}finally{d=null,g=N,w=!1}}var T=!1,R=null,P=-1,L=5,j=-1;function $(){return!(t.unstable_now()-j<L)}function U(){if(R!==null){var K=t.unstable_now();j=K;var D=!0;try{D=R(!0,K)}finally{D?z():(T=!1,R=null)}}else T=!1}var z;if(typeof x=="function")z=function(){x(U)};else if(typeof MessageChannel<"u"){var Y=new MessageChannel,re=Y.port2;Y.port1.onmessage=U,z=function(){re.postMessage(null)}}else z=function(){m(U,0)};function Q(K){R=K,T||(T=!0,z())}function J(K,D){P=m(function(){K(t.unstable_now())},D)}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(K){K.callback=null},t.unstable_continueExecution=function(){S||w||(S=!0,Q(M))},t.unstable_forceFrameRate=function(K){0>K||125<K?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):L=0<K?Math.floor(1e3/K):5},t.unstable_getCurrentPriorityLevel=function(){return g},t.unstable_getFirstCallbackNode=function(){return s(h)},t.unstable_next=function(K){switch(g){case 1:case 2:case 3:var D=3;break;default:D=g}var N=g;g=D;try{return K()}finally{g=N}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(K,D){switch(K){case 1:case 2:case 3:case 4:case 5:break;default:K=3}var N=g;g=K;try{return D()}finally{g=N}},t.unstable_scheduleCallback=function(K,D,N){var B=t.unstable_now();switch(typeof N=="object"&&N!==null?(N=N.delay,N=typeof N=="number"&&0<N?B+N:B):N=B,K){case 1:var F=-1;break;case 2:F=250;break;case 5:F=1073741823;break;case 4:F=1e4;break;default:F=5e3}return F=N+F,K={id:p++,callback:D,priorityLevel:K,startTime:N,expirationTime:F,sortIndex:-1},N>B?(K.sortIndex=N,e(u,K),s(h)===null&&K===s(u)&&(y?(v(P),P=-1):y=!0,J(C,N-B))):(K.sortIndex=F,e(h,K),S||w||(S=!0,Q(M))),K},t.unstable_shouldYield=$,t.unstable_wrapCallback=function(K){var D=g;return function(){var N=g;g=D;try{return K.apply(this,arguments)}finally{g=N}}}})(xu)),xu}var Yg;function wS(){return Yg||(Yg=1,yu.exports=xS()),yu.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 Xg;function bS(){if(Xg)return Zt;Xg=1;var t=sf(),e=wS();function s(i){for(var a="https://reactjs.org/docs/error-decoder.html?invariant="+i,f=1;f<arguments.length;f++)a+="&args[]="+encodeURIComponent(arguments[f]);return"Minified React error #"+i+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var r=new Set,n={};function l(i,a){c(i,a),c(i+"Capture",a)}function c(i,a){for(n[i]=a,i=0;i<a.length;i++)r.add(a[i])}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]*$/,p={},d={};function g(i){return h.call(d,i)?!0:h.call(p,i)?!1:u.test(i)?d[i]=!0:(p[i]=!0,!1)}function w(i,a,f,b){if(f!==null&&f.type===0)return!1;switch(typeof a){case"function":case"symbol":return!0;case"boolean":return b?!1:f!==null?!f.acceptsBooleans:(i=i.toLowerCase().slice(0,5),i!=="data-"&&i!=="aria-");default:return!1}}function S(i,a,f,b){if(a===null||typeof a>"u"||w(i,a,f,b))return!0;if(b)return!1;if(f!==null)switch(f.type){case 3:return!a;case 4:return a===!1;case 5:return isNaN(a);case 6:return isNaN(a)||1>a}return!1}function y(i,a,f,b,k,A,I){this.acceptsBooleans=a===2||a===3||a===4,this.attributeName=b,this.attributeNamespace=k,this.mustUseProperty=f,this.propertyName=i,this.type=a,this.sanitizeURL=A,this.removeEmptyString=I}var m={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(i){m[i]=new y(i,0,!1,i,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(i){var a=i[0];m[a]=new y(a,1,!1,i[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(i){m[i]=new y(i,2,!1,i.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(i){m[i]=new y(i,2,!1,i,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(i){m[i]=new y(i,3,!1,i.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(i){m[i]=new y(i,3,!0,i,null,!1,!1)}),["capture","download"].forEach(function(i){m[i]=new y(i,4,!1,i,null,!1,!1)}),["cols","rows","size","span"].forEach(function(i){m[i]=new y(i,6,!1,i,null,!1,!1)}),["rowSpan","start"].forEach(function(i){m[i]=new y(i,5,!1,i.toLowerCase(),null,!1,!1)});var v=/[\-:]([a-z])/g;function x(i){return i[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(i){var a=i.replace(v,x);m[a]=new y(a,1,!1,i,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(i){var a=i.replace(v,x);m[a]=new y(a,1,!1,i,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(i){var a=i.replace(v,x);m[a]=new y(a,1,!1,i,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(i){m[i]=new y(i,1,!1,i.toLowerCase(),null,!1,!1)}),m.xlinkHref=new y("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(i){m[i]=new y(i,1,!1,i.toLowerCase(),null,!0,!0)});function _(i,a,f,b){var k=m.hasOwnProperty(a)?m[a]:null;(k!==null?k.type!==0:b||!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(S(a,f,k,b)&&(f=null),b||k===null?g(a)&&(f===null?i.removeAttribute(a):i.setAttribute(a,""+f)):k.mustUseProperty?i[k.propertyName]=f===null?k.type===3?!1:"":f:(a=k.attributeName,b=k.attributeNamespace,f===null?i.removeAttribute(a):(k=k.type,f=k===3||k===4&&f===!0?"":""+f,b?i.setAttributeNS(b,a,f):i.setAttribute(a,f))))}var C=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,M=Symbol.for("react.element"),T=Symbol.for("react.portal"),R=Symbol.for("react.fragment"),P=Symbol.for("react.strict_mode"),L=Symbol.for("react.profiler"),j=Symbol.for("react.provider"),$=Symbol.for("react.context"),U=Symbol.for("react.forward_ref"),z=Symbol.for("react.suspense"),Y=Symbol.for("react.suspense_list"),re=Symbol.for("react.memo"),Q=Symbol.for("react.lazy"),J=Symbol.for("react.offscreen"),K=Symbol.iterator;function D(i){return i===null||typeof i!="object"?null:(i=K&&i[K]||i["@@iterator"],typeof i=="function"?i:null)}var N=Object.assign,B;function F(i){if(B===void 0)try{throw Error()}catch(f){var a=f.stack.trim().match(/\n( *(at )?)/);B=a&&a[1]||""}return`
|
|
35
|
+
`+B+i}var Z=!1;function ne(i,a){if(!i||Z)return"";Z=!0;var f=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(a)if(a=function(){throw Error()},Object.defineProperty(a.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(a,[])}catch(te){var b=te}Reflect.construct(i,[],a)}else{try{a.call()}catch(te){b=te}i.call(a.prototype)}else{try{throw Error()}catch(te){b=te}i()}}catch(te){if(te&&b&&typeof te.stack=="string"){for(var k=te.stack.split(`
|
|
36
|
+
`),A=b.stack.split(`
|
|
37
|
+
`),I=k.length-1,W=A.length-1;1<=I&&0<=W&&k[I]!==A[W];)W--;for(;1<=I&&0<=W;I--,W--)if(k[I]!==A[W]){if(I!==1||W!==1)do if(I--,W--,0>W||k[I]!==A[W]){var G=`
|
|
38
|
+
`+k[I].replace(" at new "," at ");return i.displayName&&G.includes("<anonymous>")&&(G=G.replace("<anonymous>",i.displayName)),G}while(1<=I&&0<=W);break}}}finally{Z=!1,Error.prepareStackTrace=f}return(i=i?i.displayName||i.name:"")?F(i):""}function he(i){switch(i.tag){case 5:return F(i.type);case 16:return F("Lazy");case 13:return F("Suspense");case 19:return F("SuspenseList");case 0:case 2:case 15:return i=ne(i.type,!1),i;case 11:return i=ne(i.type.render,!1),i;case 1:return i=ne(i.type,!0),i;default:return""}}function ae(i){if(i==null)return null;if(typeof i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case R:return"Fragment";case T:return"Portal";case L:return"Profiler";case P:return"StrictMode";case z:return"Suspense";case Y:return"SuspenseList"}if(typeof i=="object")switch(i.$$typeof){case $:return(i.displayName||"Context")+".Consumer";case j:return(i._context.displayName||"Context")+".Provider";case U:var a=i.render;return i=i.displayName,i||(i=a.displayName||a.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case re:return a=i.displayName||null,a!==null?a:ae(i.type)||"Memo";case Q:a=i._payload,i=i._init;try{return ae(i(a))}catch{}}return null}function V(i){var a=i.type;switch(i.tag){case 24:return"Cache";case 9:return(a.displayName||"Context")+".Consumer";case 10:return(a._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return i=a.render,i=i.displayName||i.name||"",a.displayName||(i!==""?"ForwardRef("+i+")":"ForwardRef");case 7:return"Fragment";case 5:return a;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ae(a);case 8:return a===P?"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 a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a}return null}function O(i){switch(typeof i){case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function ie(i){var a=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function se(i){var a=ie(i)?"checked":"value",f=Object.getOwnPropertyDescriptor(i.constructor.prototype,a),b=""+i[a];if(!i.hasOwnProperty(a)&&typeof f<"u"&&typeof f.get=="function"&&typeof f.set=="function"){var k=f.get,A=f.set;return Object.defineProperty(i,a,{configurable:!0,get:function(){return k.call(this)},set:function(I){b=""+I,A.call(this,I)}}),Object.defineProperty(i,a,{enumerable:f.enumerable}),{getValue:function(){return b},setValue:function(I){b=""+I},stopTracking:function(){i._valueTracker=null,delete i[a]}}}}function pe(i){i._valueTracker||(i._valueTracker=se(i))}function fe(i){if(!i)return!1;var a=i._valueTracker;if(!a)return!0;var f=a.getValue(),b="";return i&&(b=ie(i)?i.checked?"true":"false":i.value),i=b,i!==f?(a.setValue(i),!0):!1}function Ee(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}function Ie(i,a){var f=a.checked;return N({},a,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:f??i._wrapperState.initialChecked})}function je(i,a){var f=a.defaultValue==null?"":a.defaultValue,b=a.checked!=null?a.checked:a.defaultChecked;f=O(a.value!=null?a.value:f),i._wrapperState={initialChecked:b,initialValue:f,controlled:a.type==="checkbox"||a.type==="radio"?a.checked!=null:a.value!=null}}function pt(i,a){a=a.checked,a!=null&&_(i,"checked",a,!1)}function Se(i,a){pt(i,a);var f=O(a.value),b=a.type;if(f!=null)b==="number"?(f===0&&i.value===""||i.value!=f)&&(i.value=""+f):i.value!==""+f&&(i.value=""+f);else if(b==="submit"||b==="reset"){i.removeAttribute("value");return}a.hasOwnProperty("value")?fr(i,a.type,f):a.hasOwnProperty("defaultValue")&&fr(i,a.type,O(a.defaultValue)),a.checked==null&&a.defaultChecked!=null&&(i.defaultChecked=!!a.defaultChecked)}function js(i,a,f){if(a.hasOwnProperty("value")||a.hasOwnProperty("defaultValue")){var b=a.type;if(!(b!=="submit"&&b!=="reset"||a.value!==void 0&&a.value!==null))return;a=""+i._wrapperState.initialValue,f||a===i.value||(i.value=a),i.defaultValue=a}f=i.name,f!==""&&(i.name=""),i.defaultChecked=!!i._wrapperState.initialChecked,f!==""&&(i.name=f)}function fr(i,a,f){(a!=="number"||Ee(i.ownerDocument)!==i)&&(f==null?i.defaultValue=""+i._wrapperState.initialValue:i.defaultValue!==""+f&&(i.defaultValue=""+f))}var Zs=Array.isArray;function Ns(i,a,f,b){if(i=i.options,a){a={};for(var k=0;k<f.length;k++)a["$"+f[k]]=!0;for(f=0;f<i.length;f++)k=a.hasOwnProperty("$"+i[f].value),i[f].selected!==k&&(i[f].selected=k),k&&b&&(i[f].defaultSelected=!0)}else{for(f=""+O(f),a=null,k=0;k<i.length;k++){if(i[k].value===f){i[k].selected=!0,b&&(i[k].defaultSelected=!0);return}a!==null||i[k].disabled||(a=i[k])}a!==null&&(a.selected=!0)}}function pr(i,a){if(a.dangerouslySetInnerHTML!=null)throw Error(s(91));return N({},a,{value:void 0,defaultValue:void 0,children:""+i._wrapperState.initialValue})}function Ht(i,a){var f=a.value;if(f==null){if(f=a.children,a=a.defaultValue,f!=null){if(a!=null)throw Error(s(92));if(Zs(f)){if(1<f.length)throw Error(s(93));f=f[0]}a=f}a==null&&(a=""),f=a}i._wrapperState={initialValue:O(f)}}function mr(i,a){var f=O(a.value),b=O(a.defaultValue);f!=null&&(f=""+f,f!==i.value&&(i.value=f),a.defaultValue==null&&i.defaultValue!==f&&(i.defaultValue=f)),b!=null&&(i.defaultValue=""+b)}function ss(i){var a=i.textContent;a===i._wrapperState.initialValue&&a!==""&&a!==null&&(i.value=a)}function gr(i){switch(i){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 zr(i,a){return i==null||i==="http://www.w3.org/1999/xhtml"?gr(a):i==="http://www.w3.org/2000/svg"&&a==="foreignObject"?"http://www.w3.org/1999/xhtml":i}var rs,Wr=(function(i){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(a,f,b,k){MSApp.execUnsafeLocalFunction(function(){return i(a,f,b,k)})}:i})(function(i,a){if(i.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in i)i.innerHTML=a;else{for(rs=rs||document.createElement("div"),rs.innerHTML="<svg>"+a.valueOf().toString()+"</svg>",a=rs.firstChild;i.firstChild;)i.removeChild(i.firstChild);for(;a.firstChild;)i.appendChild(a.firstChild)}});function Gt(i,a){if(a){var f=i.firstChild;if(f&&f===i.lastChild&&f.nodeType===3){f.nodeValue=a;return}}i.textContent=a}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(i){Ke.forEach(function(a){a=a+i.charAt(0).toUpperCase()+i.substring(1),Cs[a]=Cs[i]})});function ta(i,a,f){return a==null||typeof a=="boolean"||a===""?"":f||typeof a!="number"||a===0||Cs.hasOwnProperty(i)&&Cs[i]?(""+a).trim():a+"px"}function op(i,a){i=i.style;for(var f in a)if(a.hasOwnProperty(f)){var b=f.indexOf("--")===0,k=ta(f,a[f],b);f==="float"&&(f="cssFloat"),b?i.setProperty(f,k):i[f]=k}}var xw=N({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 Tc(i,a){if(a){if(xw[i]&&(a.children!=null||a.dangerouslySetInnerHTML!=null))throw Error(s(137,i));if(a.dangerouslySetInnerHTML!=null){if(a.children!=null)throw Error(s(60));if(typeof a.dangerouslySetInnerHTML!="object"||!("__html"in a.dangerouslySetInnerHTML))throw Error(s(61))}if(a.style!=null&&typeof a.style!="object")throw Error(s(62))}}function Pc(i,a){if(i.indexOf("-")===-1)return typeof a.is=="string";switch(i){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 Ac=null;function Rc(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var Dc=null,Ei=null,Mi=null;function ap(i){if(i=Un(i)){if(typeof Dc!="function")throw Error(s(280));var a=i.stateNode;a&&(a=Ca(a),Dc(i.stateNode,i.type,a))}}function lp(i){Ei?Mi?Mi.push(i):Mi=[i]:Ei=i}function cp(){if(Ei){var i=Ei,a=Mi;if(Mi=Ei=null,ap(i),a)for(i=0;i<a.length;i++)ap(a[i])}}function hp(i,a){return i(a)}function up(){}var Lc=!1;function dp(i,a,f){if(Lc)return i(a,f);Lc=!0;try{return hp(i,a,f)}finally{Lc=!1,(Ei!==null||Mi!==null)&&(up(),cp())}}function Sn(i,a){var f=i.stateNode;if(f===null)return null;var b=Ca(f);if(b===null)return null;f=b[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(b=!b.disabled)||(i=i.type,b=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!b;break e;default:i=!1}if(i)return null;if(f&&typeof f!="function")throw Error(s(231,a,typeof f));return f}var Bc=!1;if(o)try{var Cn={};Object.defineProperty(Cn,"passive",{get:function(){Bc=!0}}),window.addEventListener("test",Cn,Cn),window.removeEventListener("test",Cn,Cn)}catch{Bc=!1}function ww(i,a,f,b,k,A,I,W,G){var te=Array.prototype.slice.call(arguments,3);try{a.apply(f,te)}catch(ce){this.onError(ce)}}var kn=!1,sa=null,ra=!1,Ic=null,bw={onError:function(i){kn=!0,sa=i}};function Sw(i,a,f,b,k,A,I,W,G){kn=!1,sa=null,ww.apply(bw,arguments)}function Cw(i,a,f,b,k,A,I,W,G){if(Sw.apply(this,arguments),kn){if(kn){var te=sa;kn=!1,sa=null}else throw Error(s(198));ra||(ra=!0,Ic=te)}}function Ur(i){var a=i,f=i;if(i.alternate)for(;a.return;)a=a.return;else{i=a;do a=i,(a.flags&4098)!==0&&(f=a.return),i=a.return;while(i)}return a.tag===3?f:null}function fp(i){if(i.tag===13){var a=i.memoizedState;if(a===null&&(i=i.alternate,i!==null&&(a=i.memoizedState)),a!==null)return a.dehydrated}return null}function pp(i){if(Ur(i)!==i)throw Error(s(188))}function kw(i){var a=i.alternate;if(!a){if(a=Ur(i),a===null)throw Error(s(188));return a!==i?null:i}for(var f=i,b=a;;){var k=f.return;if(k===null)break;var A=k.alternate;if(A===null){if(b=k.return,b!==null){f=b;continue}break}if(k.child===A.child){for(A=k.child;A;){if(A===f)return pp(k),i;if(A===b)return pp(k),a;A=A.sibling}throw Error(s(188))}if(f.return!==b.return)f=k,b=A;else{for(var I=!1,W=k.child;W;){if(W===f){I=!0,f=k,b=A;break}if(W===b){I=!0,b=k,f=A;break}W=W.sibling}if(!I){for(W=A.child;W;){if(W===f){I=!0,f=A,b=k;break}if(W===b){I=!0,b=A,f=k;break}W=W.sibling}if(!I)throw Error(s(189))}}if(f.alternate!==b)throw Error(s(190))}if(f.tag!==3)throw Error(s(188));return f.stateNode.current===f?i:a}function mp(i){return i=kw(i),i!==null?gp(i):null}function gp(i){if(i.tag===5||i.tag===6)return i;for(i=i.child;i!==null;){var a=gp(i);if(a!==null)return a;i=i.sibling}return null}var _p=e.unstable_scheduleCallback,vp=e.unstable_cancelCallback,Ew=e.unstable_shouldYield,Mw=e.unstable_requestPaint,at=e.unstable_now,Tw=e.unstable_getCurrentPriorityLevel,Oc=e.unstable_ImmediatePriority,yp=e.unstable_UserBlockingPriority,ia=e.unstable_NormalPriority,Pw=e.unstable_LowPriority,xp=e.unstable_IdlePriority,na=null,Fs=null;function Aw(i){if(Fs&&typeof Fs.onCommitFiberRoot=="function")try{Fs.onCommitFiberRoot(na,i,void 0,(i.current.flags&128)===128)}catch{}}var ks=Math.clz32?Math.clz32:Lw,Rw=Math.log,Dw=Math.LN2;function Lw(i){return i>>>=0,i===0?32:31-(Rw(i)/Dw|0)|0}var oa=64,aa=4194304;function En(i){switch(i&-i){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 i&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return i&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return i}}function la(i,a){var f=i.pendingLanes;if(f===0)return 0;var b=0,k=i.suspendedLanes,A=i.pingedLanes,I=f&268435455;if(I!==0){var W=I&~k;W!==0?b=En(W):(A&=I,A!==0&&(b=En(A)))}else I=f&~k,I!==0?b=En(I):A!==0&&(b=En(A));if(b===0)return 0;if(a!==0&&a!==b&&(a&k)===0&&(k=b&-b,A=a&-a,k>=A||k===16&&(A&4194240)!==0))return a;if((b&4)!==0&&(b|=f&16),a=i.entangledLanes,a!==0)for(i=i.entanglements,a&=b;0<a;)f=31-ks(a),k=1<<f,b|=i[f],a&=~k;return b}function Bw(i,a){switch(i){case 1:case 2:case 4:return a+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 a+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 Iw(i,a){for(var f=i.suspendedLanes,b=i.pingedLanes,k=i.expirationTimes,A=i.pendingLanes;0<A;){var I=31-ks(A),W=1<<I,G=k[I];G===-1?((W&f)===0||(W&b)!==0)&&(k[I]=Bw(W,a)):G<=a&&(i.expiredLanes|=W),A&=~W}}function jc(i){return i=i.pendingLanes&-1073741825,i!==0?i:i&1073741824?1073741824:0}function wp(){var i=oa;return oa<<=1,(oa&4194240)===0&&(oa=64),i}function Nc(i){for(var a=[],f=0;31>f;f++)a.push(i);return a}function Mn(i,a,f){i.pendingLanes|=a,a!==536870912&&(i.suspendedLanes=0,i.pingedLanes=0),i=i.eventTimes,a=31-ks(a),i[a]=f}function Ow(i,a){var f=i.pendingLanes&~a;i.pendingLanes=a,i.suspendedLanes=0,i.pingedLanes=0,i.expiredLanes&=a,i.mutableReadLanes&=a,i.entangledLanes&=a,a=i.entanglements;var b=i.eventTimes;for(i=i.expirationTimes;0<f;){var k=31-ks(f),A=1<<k;a[k]=0,b[k]=-1,i[k]=-1,f&=~A}}function Fc(i,a){var f=i.entangledLanes|=a;for(i=i.entanglements;f;){var b=31-ks(f),k=1<<b;k&a|i[b]&a&&(i[b]|=a),f&=~k}}var ze=0;function bp(i){return i&=-i,1<i?4<i?(i&268435455)!==0?16:536870912:4:1}var Sp,Hc,Cp,kp,Ep,$c=!1,ca=[],_r=null,vr=null,yr=null,Tn=new Map,Pn=new Map,xr=[],jw="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 Mp(i,a){switch(i){case"focusin":case"focusout":_r=null;break;case"dragenter":case"dragleave":vr=null;break;case"mouseover":case"mouseout":yr=null;break;case"pointerover":case"pointerout":Tn.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Pn.delete(a.pointerId)}}function An(i,a,f,b,k,A){return i===null||i.nativeEvent!==A?(i={blockedOn:a,domEventName:f,eventSystemFlags:b,nativeEvent:A,targetContainers:[k]},a!==null&&(a=Un(a),a!==null&&Hc(a)),i):(i.eventSystemFlags|=b,a=i.targetContainers,k!==null&&a.indexOf(k)===-1&&a.push(k),i)}function Nw(i,a,f,b,k){switch(a){case"focusin":return _r=An(_r,i,a,f,b,k),!0;case"dragenter":return vr=An(vr,i,a,f,b,k),!0;case"mouseover":return yr=An(yr,i,a,f,b,k),!0;case"pointerover":var A=k.pointerId;return Tn.set(A,An(Tn.get(A)||null,i,a,f,b,k)),!0;case"gotpointercapture":return A=k.pointerId,Pn.set(A,An(Pn.get(A)||null,i,a,f,b,k)),!0}return!1}function Tp(i){var a=Vr(i.target);if(a!==null){var f=Ur(a);if(f!==null){if(a=f.tag,a===13){if(a=fp(f),a!==null){i.blockedOn=a,Ep(i.priority,function(){Cp(f)});return}}else if(a===3&&f.stateNode.current.memoizedState.isDehydrated){i.blockedOn=f.tag===3?f.stateNode.containerInfo:null;return}}}i.blockedOn=null}function ha(i){if(i.blockedOn!==null)return!1;for(var a=i.targetContainers;0<a.length;){var f=Wc(i.domEventName,i.eventSystemFlags,a[0],i.nativeEvent);if(f===null){f=i.nativeEvent;var b=new f.constructor(f.type,f);Ac=b,f.target.dispatchEvent(b),Ac=null}else return a=Un(f),a!==null&&Hc(a),i.blockedOn=f,!1;a.shift()}return!0}function Pp(i,a,f){ha(i)&&f.delete(a)}function Fw(){$c=!1,_r!==null&&ha(_r)&&(_r=null),vr!==null&&ha(vr)&&(vr=null),yr!==null&&ha(yr)&&(yr=null),Tn.forEach(Pp),Pn.forEach(Pp)}function Rn(i,a){i.blockedOn===a&&(i.blockedOn=null,$c||($c=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Fw)))}function Dn(i){function a(k){return Rn(k,i)}if(0<ca.length){Rn(ca[0],i);for(var f=1;f<ca.length;f++){var b=ca[f];b.blockedOn===i&&(b.blockedOn=null)}}for(_r!==null&&Rn(_r,i),vr!==null&&Rn(vr,i),yr!==null&&Rn(yr,i),Tn.forEach(a),Pn.forEach(a),f=0;f<xr.length;f++)b=xr[f],b.blockedOn===i&&(b.blockedOn=null);for(;0<xr.length&&(f=xr[0],f.blockedOn===null);)Tp(f),f.blockedOn===null&&xr.shift()}var Ti=C.ReactCurrentBatchConfig,ua=!0;function Hw(i,a,f,b){var k=ze,A=Ti.transition;Ti.transition=null;try{ze=1,zc(i,a,f,b)}finally{ze=k,Ti.transition=A}}function $w(i,a,f,b){var k=ze,A=Ti.transition;Ti.transition=null;try{ze=4,zc(i,a,f,b)}finally{ze=k,Ti.transition=A}}function zc(i,a,f,b){if(ua){var k=Wc(i,a,f,b);if(k===null)oh(i,a,b,da,f),Mp(i,b);else if(Nw(k,i,a,f,b))b.stopPropagation();else if(Mp(i,b),a&4&&-1<jw.indexOf(i)){for(;k!==null;){var A=Un(k);if(A!==null&&Sp(A),A=Wc(i,a,f,b),A===null&&oh(i,a,b,da,f),A===k)break;k=A}k!==null&&b.stopPropagation()}else oh(i,a,b,null,f)}}var da=null;function Wc(i,a,f,b){if(da=null,i=Rc(b),i=Vr(i),i!==null)if(a=Ur(i),a===null)i=null;else if(f=a.tag,f===13){if(i=fp(a),i!==null)return i;i=null}else if(f===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;i=null}else a!==i&&(i=null);return da=i,null}function Ap(i){switch(i){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(Tw()){case Oc:return 1;case yp:return 4;case ia:case Pw:return 16;case xp:return 536870912;default:return 16}default:return 16}}var wr=null,Uc=null,fa=null;function Rp(){if(fa)return fa;var i,a=Uc,f=a.length,b,k="value"in wr?wr.value:wr.textContent,A=k.length;for(i=0;i<f&&a[i]===k[i];i++);var I=f-i;for(b=1;b<=I&&a[f-b]===k[A-b];b++);return fa=k.slice(i,1<b?1-b:void 0)}function pa(i){var a=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&a===13&&(i=13)):i=a,i===10&&(i=13),32<=i||i===13?i:0}function ma(){return!0}function Dp(){return!1}function is(i){function a(f,b,k,A,I){this._reactName=f,this._targetInst=k,this.type=b,this.nativeEvent=A,this.target=I,this.currentTarget=null;for(var W in i)i.hasOwnProperty(W)&&(f=i[W],this[W]=f?f(A):A[W]);return this.isDefaultPrevented=(A.defaultPrevented!=null?A.defaultPrevented:A.returnValue===!1)?ma:Dp,this.isPropagationStopped=Dp,this}return N(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var f=this.nativeEvent;f&&(f.preventDefault?f.preventDefault():typeof f.returnValue!="unknown"&&(f.returnValue=!1),this.isDefaultPrevented=ma)},stopPropagation:function(){var f=this.nativeEvent;f&&(f.stopPropagation?f.stopPropagation():typeof f.cancelBubble!="unknown"&&(f.cancelBubble=!0),this.isPropagationStopped=ma)},persist:function(){},isPersistent:ma}),a}var Pi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Vc=is(Pi),Ln=N({},Pi,{view:0,detail:0}),zw=is(Ln),Gc,qc,Bn,ga=N({},Ln,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Yc,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==Bn&&(Bn&&i.type==="mousemove"?(Gc=i.screenX-Bn.screenX,qc=i.screenY-Bn.screenY):qc=Gc=0,Bn=i),Gc)},movementY:function(i){return"movementY"in i?i.movementY:qc}}),Lp=is(ga),Ww=N({},ga,{dataTransfer:0}),Uw=is(Ww),Vw=N({},Ln,{relatedTarget:0}),Kc=is(Vw),Gw=N({},Pi,{animationName:0,elapsedTime:0,pseudoElement:0}),qw=is(Gw),Kw=N({},Pi,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),Yw=is(Kw),Xw=N({},Pi,{data:0}),Bp=is(Xw),Qw={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Zw={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"},Jw={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function eb(i){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(i):(i=Jw[i])?!!a[i]:!1}function Yc(){return eb}var tb=N({},Ln,{key:function(i){if(i.key){var a=Qw[i.key]||i.key;if(a!=="Unidentified")return a}return i.type==="keypress"?(i=pa(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?Zw[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Yc,charCode:function(i){return i.type==="keypress"?pa(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?pa(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),sb=is(tb),rb=N({},ga,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ip=is(rb),ib=N({},Ln,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Yc}),nb=is(ib),ob=N({},Pi,{propertyName:0,elapsedTime:0,pseudoElement:0}),ab=is(ob),lb=N({},ga,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),cb=is(lb),hb=[9,13,27,32],Xc=o&&"CompositionEvent"in window,In=null;o&&"documentMode"in document&&(In=document.documentMode);var ub=o&&"TextEvent"in window&&!In,Op=o&&(!Xc||In&&8<In&&11>=In),jp=" ",Np=!1;function Fp(i,a){switch(i){case"keyup":return hb.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Hp(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var Ai=!1;function db(i,a){switch(i){case"compositionend":return Hp(a);case"keypress":return a.which!==32?null:(Np=!0,jp);case"textInput":return i=a.data,i===jp&&Np?null:i;default:return null}}function fb(i,a){if(Ai)return i==="compositionend"||!Xc&&Fp(i,a)?(i=Rp(),fa=Uc=wr=null,Ai=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return Op&&a.locale!=="ko"?null:a.data;default:return null}}var pb={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 $p(i){var a=i&&i.nodeName&&i.nodeName.toLowerCase();return a==="input"?!!pb[i.type]:a==="textarea"}function zp(i,a,f,b){lp(b),a=wa(a,"onChange"),0<a.length&&(f=new Vc("onChange","change",null,f,b),i.push({event:f,listeners:a}))}var On=null,jn=null;function mb(i){om(i,0)}function _a(i){var a=Ii(i);if(fe(a))return i}function gb(i,a){if(i==="change")return a}var Wp=!1;if(o){var Qc;if(o){var Zc="oninput"in document;if(!Zc){var Up=document.createElement("div");Up.setAttribute("oninput","return;"),Zc=typeof Up.oninput=="function"}Qc=Zc}else Qc=!1;Wp=Qc&&(!document.documentMode||9<document.documentMode)}function Vp(){On&&(On.detachEvent("onpropertychange",Gp),jn=On=null)}function Gp(i){if(i.propertyName==="value"&&_a(jn)){var a=[];zp(a,jn,i,Rc(i)),dp(mb,a)}}function _b(i,a,f){i==="focusin"?(Vp(),On=a,jn=f,On.attachEvent("onpropertychange",Gp)):i==="focusout"&&Vp()}function vb(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return _a(jn)}function yb(i,a){if(i==="click")return _a(a)}function xb(i,a){if(i==="input"||i==="change")return _a(a)}function wb(i,a){return i===a&&(i!==0||1/i===1/a)||i!==i&&a!==a}var Es=typeof Object.is=="function"?Object.is:wb;function Nn(i,a){if(Es(i,a))return!0;if(typeof i!="object"||i===null||typeof a!="object"||a===null)return!1;var f=Object.keys(i),b=Object.keys(a);if(f.length!==b.length)return!1;for(b=0;b<f.length;b++){var k=f[b];if(!h.call(a,k)||!Es(i[k],a[k]))return!1}return!0}function qp(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function Kp(i,a){var f=qp(i);i=0;for(var b;f;){if(f.nodeType===3){if(b=i+f.textContent.length,i<=a&&b>=a)return{node:f,offset:a-i};i=b}e:{for(;f;){if(f.nextSibling){f=f.nextSibling;break e}f=f.parentNode}f=void 0}f=qp(f)}}function Yp(i,a){return i&&a?i===a?!0:i&&i.nodeType===3?!1:a&&a.nodeType===3?Yp(i,a.parentNode):"contains"in i?i.contains(a):i.compareDocumentPosition?!!(i.compareDocumentPosition(a)&16):!1:!1}function Xp(){for(var i=window,a=Ee();a instanceof i.HTMLIFrameElement;){try{var f=typeof a.contentWindow.location.href=="string"}catch{f=!1}if(f)i=a.contentWindow;else break;a=Ee(i.document)}return a}function Jc(i){var a=i&&i.nodeName&&i.nodeName.toLowerCase();return a&&(a==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||a==="textarea"||i.contentEditable==="true")}function bb(i){var a=Xp(),f=i.focusedElem,b=i.selectionRange;if(a!==f&&f&&f.ownerDocument&&Yp(f.ownerDocument.documentElement,f)){if(b!==null&&Jc(f)){if(a=b.start,i=b.end,i===void 0&&(i=a),"selectionStart"in f)f.selectionStart=a,f.selectionEnd=Math.min(i,f.value.length);else if(i=(a=f.ownerDocument||document)&&a.defaultView||window,i.getSelection){i=i.getSelection();var k=f.textContent.length,A=Math.min(b.start,k);b=b.end===void 0?A:Math.min(b.end,k),!i.extend&&A>b&&(k=b,b=A,A=k),k=Kp(f,A);var I=Kp(f,b);k&&I&&(i.rangeCount!==1||i.anchorNode!==k.node||i.anchorOffset!==k.offset||i.focusNode!==I.node||i.focusOffset!==I.offset)&&(a=a.createRange(),a.setStart(k.node,k.offset),i.removeAllRanges(),A>b?(i.addRange(a),i.extend(I.node,I.offset)):(a.setEnd(I.node,I.offset),i.addRange(a)))}}for(a=[],i=f;i=i.parentNode;)i.nodeType===1&&a.push({element:i,left:i.scrollLeft,top:i.scrollTop});for(typeof f.focus=="function"&&f.focus(),f=0;f<a.length;f++)i=a[f],i.element.scrollLeft=i.left,i.element.scrollTop=i.top}}var Sb=o&&"documentMode"in document&&11>=document.documentMode,Ri=null,eh=null,Fn=null,th=!1;function Qp(i,a,f){var b=f.window===f?f.document:f.nodeType===9?f:f.ownerDocument;th||Ri==null||Ri!==Ee(b)||(b=Ri,"selectionStart"in b&&Jc(b)?b={start:b.selectionStart,end:b.selectionEnd}:(b=(b.ownerDocument&&b.ownerDocument.defaultView||window).getSelection(),b={anchorNode:b.anchorNode,anchorOffset:b.anchorOffset,focusNode:b.focusNode,focusOffset:b.focusOffset}),Fn&&Nn(Fn,b)||(Fn=b,b=wa(eh,"onSelect"),0<b.length&&(a=new Vc("onSelect","select",null,a,f),i.push({event:a,listeners:b}),a.target=Ri)))}function va(i,a){var f={};return f[i.toLowerCase()]=a.toLowerCase(),f["Webkit"+i]="webkit"+a,f["Moz"+i]="moz"+a,f}var Di={animationend:va("Animation","AnimationEnd"),animationiteration:va("Animation","AnimationIteration"),animationstart:va("Animation","AnimationStart"),transitionend:va("Transition","TransitionEnd")},sh={},Zp={};o&&(Zp=document.createElement("div").style,"AnimationEvent"in window||(delete Di.animationend.animation,delete Di.animationiteration.animation,delete Di.animationstart.animation),"TransitionEvent"in window||delete Di.transitionend.transition);function ya(i){if(sh[i])return sh[i];if(!Di[i])return i;var a=Di[i],f;for(f in a)if(a.hasOwnProperty(f)&&f in Zp)return sh[i]=a[f];return i}var Jp=ya("animationend"),em=ya("animationiteration"),tm=ya("animationstart"),sm=ya("transitionend"),rm=new Map,im="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 br(i,a){rm.set(i,a),l(a,[i])}for(var rh=0;rh<im.length;rh++){var ih=im[rh],Cb=ih.toLowerCase(),kb=ih[0].toUpperCase()+ih.slice(1);br(Cb,"on"+kb)}br(Jp,"onAnimationEnd"),br(em,"onAnimationIteration"),br(tm,"onAnimationStart"),br("dblclick","onDoubleClick"),br("focusin","onFocus"),br("focusout","onBlur"),br(sm,"onTransitionEnd"),c("onMouseEnter",["mouseout","mouseover"]),c("onMouseLeave",["mouseout","mouseover"]),c("onPointerEnter",["pointerout","pointerover"]),c("onPointerLeave",["pointerout","pointerover"]),l("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),l("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),l("onBeforeInput",["compositionend","keypress","textInput","paste"]),l("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Hn="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(" "),Eb=new Set("cancel close invalid load scroll toggle".split(" ").concat(Hn));function nm(i,a,f){var b=i.type||"unknown-event";i.currentTarget=f,Cw(b,a,void 0,i),i.currentTarget=null}function om(i,a){a=(a&4)!==0;for(var f=0;f<i.length;f++){var b=i[f],k=b.event;b=b.listeners;e:{var A=void 0;if(a)for(var I=b.length-1;0<=I;I--){var W=b[I],G=W.instance,te=W.currentTarget;if(W=W.listener,G!==A&&k.isPropagationStopped())break e;nm(k,W,te),A=G}else for(I=0;I<b.length;I++){if(W=b[I],G=W.instance,te=W.currentTarget,W=W.listener,G!==A&&k.isPropagationStopped())break e;nm(k,W,te),A=G}}}if(ra)throw i=Ic,ra=!1,Ic=null,i}function Ye(i,a){var f=a[dh];f===void 0&&(f=a[dh]=new Set);var b=i+"__bubble";f.has(b)||(am(a,i,2,!1),f.add(b))}function nh(i,a,f){var b=0;a&&(b|=4),am(f,i,b,a)}var xa="_reactListening"+Math.random().toString(36).slice(2);function $n(i){if(!i[xa]){i[xa]=!0,r.forEach(function(f){f!=="selectionchange"&&(Eb.has(f)||nh(f,!1,i),nh(f,!0,i))});var a=i.nodeType===9?i:i.ownerDocument;a===null||a[xa]||(a[xa]=!0,nh("selectionchange",!1,a))}}function am(i,a,f,b){switch(Ap(a)){case 1:var k=Hw;break;case 4:k=$w;break;default:k=zc}f=k.bind(null,a,f,i),k=void 0,!Bc||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(k=!0),b?k!==void 0?i.addEventListener(a,f,{capture:!0,passive:k}):i.addEventListener(a,f,!0):k!==void 0?i.addEventListener(a,f,{passive:k}):i.addEventListener(a,f,!1)}function oh(i,a,f,b,k){var A=b;if((a&1)===0&&(a&2)===0&&b!==null)e:for(;;){if(b===null)return;var I=b.tag;if(I===3||I===4){var W=b.stateNode.containerInfo;if(W===k||W.nodeType===8&&W.parentNode===k)break;if(I===4)for(I=b.return;I!==null;){var G=I.tag;if((G===3||G===4)&&(G=I.stateNode.containerInfo,G===k||G.nodeType===8&&G.parentNode===k))return;I=I.return}for(;W!==null;){if(I=Vr(W),I===null)return;if(G=I.tag,G===5||G===6){b=A=I;continue e}W=W.parentNode}}b=b.return}dp(function(){var te=A,ce=Rc(f),ue=[];e:{var le=rm.get(i);if(le!==void 0){var ge=Vc,ve=i;switch(i){case"keypress":if(pa(f)===0)break e;case"keydown":case"keyup":ge=sb;break;case"focusin":ve="focus",ge=Kc;break;case"focusout":ve="blur",ge=Kc;break;case"beforeblur":case"afterblur":ge=Kc;break;case"click":if(f.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ge=Lp;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ge=Uw;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ge=nb;break;case Jp:case em:case tm:ge=qw;break;case sm:ge=ab;break;case"scroll":ge=zw;break;case"wheel":ge=cb;break;case"copy":case"cut":case"paste":ge=Yw;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ge=Ip}var ye=(a&4)!==0,lt=!ye&&i==="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=Sn(q,X),de!=null&&ye.push(zn(q,de,ee)))),lt)break;q=q.return}0<ye.length&&(le=new ge(le,ve,null,f,ce),ue.push({event:le,listeners:ye}))}}if((a&7)===0){e:{if(le=i==="mouseover"||i==="pointerover",ge=i==="mouseout"||i==="pointerout",le&&f!==Ac&&(ve=f.relatedTarget||f.fromElement)&&(Vr(ve)||ve[Js]))break e;if((ge||le)&&(le=ce.window===ce?ce:(le=ce.ownerDocument)?le.defaultView||le.parentWindow:window,ge?(ve=f.relatedTarget||f.toElement,ge=te,ve=ve?Vr(ve):null,ve!==null&&(lt=Ur(ve),ve!==lt||ve.tag!==5&&ve.tag!==6)&&(ve=null)):(ge=null,ve=te),ge!==ve)){if(ye=Lp,de="onMouseLeave",X="onMouseEnter",q="mouse",(i==="pointerout"||i==="pointerover")&&(ye=Ip,de="onPointerLeave",X="onPointerEnter",q="pointer"),lt=ge==null?le:Ii(ge),ee=ve==null?le:Ii(ve),le=new ye(de,q+"leave",ge,f,ce),le.target=lt,le.relatedTarget=ee,de=null,Vr(ce)===te&&(ye=new ye(X,q+"enter",ve,f,ce),ye.target=ee,ye.relatedTarget=lt,de=ye),lt=de,ge&&ve)t:{for(ye=ge,X=ve,q=0,ee=ye;ee;ee=Li(ee))q++;for(ee=0,de=X;de;de=Li(de))ee++;for(;0<q-ee;)ye=Li(ye),q--;for(;0<ee-q;)X=Li(X),ee--;for(;q--;){if(ye===X||X!==null&&ye===X.alternate)break t;ye=Li(ye),X=Li(X)}ye=null}else ye=null;ge!==null&&lm(ue,le,ge,ye,!1),ve!==null&<!==null&&lm(ue,lt,ve,ye,!0)}}e:{if(le=te?Ii(te):window,ge=le.nodeName&&le.nodeName.toLowerCase(),ge==="select"||ge==="input"&&le.type==="file")var xe=gb;else if($p(le))if(Wp)xe=xb;else{xe=vb;var we=_b}else(ge=le.nodeName)&&ge.toLowerCase()==="input"&&(le.type==="checkbox"||le.type==="radio")&&(xe=yb);if(xe&&(xe=xe(i,te))){zp(ue,xe,f,ce);break e}we&&we(i,le,te),i==="focusout"&&(we=le._wrapperState)&&we.controlled&&le.type==="number"&&fr(le,"number",le.value)}switch(we=te?Ii(te):window,i){case"focusin":($p(we)||we.contentEditable==="true")&&(Ri=we,eh=te,Fn=null);break;case"focusout":Fn=eh=Ri=null;break;case"mousedown":th=!0;break;case"contextmenu":case"mouseup":case"dragend":th=!1,Qp(ue,f,ce);break;case"selectionchange":if(Sb)break;case"keydown":case"keyup":Qp(ue,f,ce)}var be;if(Xc)e:{switch(i){case"compositionstart":var Me="onCompositionStart";break e;case"compositionend":Me="onCompositionEnd";break e;case"compositionupdate":Me="onCompositionUpdate";break e}Me=void 0}else Ai?Fp(i,f)&&(Me="onCompositionEnd"):i==="keydown"&&f.keyCode===229&&(Me="onCompositionStart");Me&&(Op&&f.locale!=="ko"&&(Ai||Me!=="onCompositionStart"?Me==="onCompositionEnd"&&Ai&&(be=Rp()):(wr=ce,Uc="value"in wr?wr.value:wr.textContent,Ai=!0)),we=wa(te,Me),0<we.length&&(Me=new Bp(Me,i,null,f,ce),ue.push({event:Me,listeners:we}),be?Me.data=be:(be=Hp(f),be!==null&&(Me.data=be)))),(be=ub?db(i,f):fb(i,f))&&(te=wa(te,"onBeforeInput"),0<te.length&&(ce=new Bp("onBeforeInput","beforeinput",null,f,ce),ue.push({event:ce,listeners:te}),ce.data=be))}om(ue,a)})}function zn(i,a,f){return{instance:i,listener:a,currentTarget:f}}function wa(i,a){for(var f=a+"Capture",b=[];i!==null;){var k=i,A=k.stateNode;k.tag===5&&A!==null&&(k=A,A=Sn(i,f),A!=null&&b.unshift(zn(i,A,k)),A=Sn(i,a),A!=null&&b.push(zn(i,A,k))),i=i.return}return b}function Li(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5);return i||null}function lm(i,a,f,b,k){for(var A=a._reactName,I=[];f!==null&&f!==b;){var W=f,G=W.alternate,te=W.stateNode;if(G!==null&&G===b)break;W.tag===5&&te!==null&&(W=te,k?(G=Sn(f,A),G!=null&&I.unshift(zn(f,G,W))):k||(G=Sn(f,A),G!=null&&I.push(zn(f,G,W)))),f=f.return}I.length!==0&&i.push({event:a,listeners:I})}var Mb=/\r\n?/g,Tb=/\u0000|\uFFFD/g;function cm(i){return(typeof i=="string"?i:""+i).replace(Mb,`
|
|
39
|
+
`).replace(Tb,"")}function ba(i,a,f){if(a=cm(a),cm(i)!==a&&f)throw Error(s(425))}function Sa(){}var ah=null,lh=null;function ch(i,a){return i==="textarea"||i==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var hh=typeof setTimeout=="function"?setTimeout:void 0,Pb=typeof clearTimeout=="function"?clearTimeout:void 0,hm=typeof Promise=="function"?Promise:void 0,Ab=typeof queueMicrotask=="function"?queueMicrotask:typeof hm<"u"?function(i){return hm.resolve(null).then(i).catch(Rb)}:hh;function Rb(i){setTimeout(function(){throw i})}function uh(i,a){var f=a,b=0;do{var k=f.nextSibling;if(i.removeChild(f),k&&k.nodeType===8)if(f=k.data,f==="/$"){if(b===0){i.removeChild(k),Dn(a);return}b--}else f!=="$"&&f!=="$?"&&f!=="$!"||b++;f=k}while(f);Dn(a)}function Sr(i){for(;i!=null;i=i.nextSibling){var a=i.nodeType;if(a===1||a===3)break;if(a===8){if(a=i.data,a==="$"||a==="$!"||a==="$?")break;if(a==="/$")return null}}return i}function um(i){i=i.previousSibling;for(var a=0;i;){if(i.nodeType===8){var f=i.data;if(f==="$"||f==="$!"||f==="$?"){if(a===0)return i;a--}else f==="/$"&&a++}i=i.previousSibling}return null}var Bi=Math.random().toString(36).slice(2),Hs="__reactFiber$"+Bi,Wn="__reactProps$"+Bi,Js="__reactContainer$"+Bi,dh="__reactEvents$"+Bi,Db="__reactListeners$"+Bi,Lb="__reactHandles$"+Bi;function Vr(i){var a=i[Hs];if(a)return a;for(var f=i.parentNode;f;){if(a=f[Js]||f[Hs]){if(f=a.alternate,a.child!==null||f!==null&&f.child!==null)for(i=um(i);i!==null;){if(f=i[Hs])return f;i=um(i)}return a}i=f,f=i.parentNode}return null}function Un(i){return i=i[Hs]||i[Js],!i||i.tag!==5&&i.tag!==6&&i.tag!==13&&i.tag!==3?null:i}function Ii(i){if(i.tag===5||i.tag===6)return i.stateNode;throw Error(s(33))}function Ca(i){return i[Wn]||null}var fh=[],Oi=-1;function Cr(i){return{current:i}}function Xe(i){0>Oi||(i.current=fh[Oi],fh[Oi]=null,Oi--)}function qe(i,a){Oi++,fh[Oi]=i.current,i.current=a}var kr={},Rt=Cr(kr),qt=Cr(!1),Gr=kr;function ji(i,a){var f=i.type.contextTypes;if(!f)return kr;var b=i.stateNode;if(b&&b.__reactInternalMemoizedUnmaskedChildContext===a)return b.__reactInternalMemoizedMaskedChildContext;var k={},A;for(A in f)k[A]=a[A];return b&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=a,i.__reactInternalMemoizedMaskedChildContext=k),k}function Kt(i){return i=i.childContextTypes,i!=null}function ka(){Xe(qt),Xe(Rt)}function dm(i,a,f){if(Rt.current!==kr)throw Error(s(168));qe(Rt,a),qe(qt,f)}function fm(i,a,f){var b=i.stateNode;if(a=a.childContextTypes,typeof b.getChildContext!="function")return f;b=b.getChildContext();for(var k in b)if(!(k in a))throw Error(s(108,V(i)||"Unknown",k));return N({},f,b)}function Ea(i){return i=(i=i.stateNode)&&i.__reactInternalMemoizedMergedChildContext||kr,Gr=Rt.current,qe(Rt,i),qe(qt,qt.current),!0}function pm(i,a,f){var b=i.stateNode;if(!b)throw Error(s(169));f?(i=fm(i,a,Gr),b.__reactInternalMemoizedMergedChildContext=i,Xe(qt),Xe(Rt),qe(Rt,i)):Xe(qt),qe(qt,f)}var er=null,Ma=!1,ph=!1;function mm(i){er===null?er=[i]:er.push(i)}function Bb(i){Ma=!0,mm(i)}function Er(){if(!ph&&er!==null){ph=!0;var i=0,a=ze;try{var f=er;for(ze=1;i<f.length;i++){var b=f[i];do b=b(!0);while(b!==null)}er=null,Ma=!1}catch(k){throw er!==null&&(er=er.slice(i+1)),_p(Oc,Er),k}finally{ze=a,ph=!1}}return null}var Ni=[],Fi=0,Ta=null,Pa=0,fs=[],ps=0,qr=null,tr=1,sr="";function Kr(i,a){Ni[Fi++]=Pa,Ni[Fi++]=Ta,Ta=i,Pa=a}function gm(i,a,f){fs[ps++]=tr,fs[ps++]=sr,fs[ps++]=qr,qr=i;var b=tr;i=sr;var k=32-ks(b)-1;b&=~(1<<k),f+=1;var A=32-ks(a)+k;if(30<A){var I=k-k%5;A=(b&(1<<I)-1).toString(32),b>>=I,k-=I,tr=1<<32-ks(a)+k|f<<k|b,sr=A+i}else tr=1<<A|f<<k|b,sr=i}function mh(i){i.return!==null&&(Kr(i,1),gm(i,1,0))}function gh(i){for(;i===Ta;)Ta=Ni[--Fi],Ni[Fi]=null,Pa=Ni[--Fi],Ni[Fi]=null;for(;i===qr;)qr=fs[--ps],fs[ps]=null,sr=fs[--ps],fs[ps]=null,tr=fs[--ps],fs[ps]=null}var ns=null,os=null,Ze=!1,Ms=null;function _m(i,a){var f=vs(5,null,null,0);f.elementType="DELETED",f.stateNode=a,f.return=i,a=i.deletions,a===null?(i.deletions=[f],i.flags|=16):a.push(f)}function vm(i,a){switch(i.tag){case 5:var f=i.type;return a=a.nodeType!==1||f.toLowerCase()!==a.nodeName.toLowerCase()?null:a,a!==null?(i.stateNode=a,ns=i,os=Sr(a.firstChild),!0):!1;case 6:return a=i.pendingProps===""||a.nodeType!==3?null:a,a!==null?(i.stateNode=a,ns=i,os=null,!0):!1;case 13:return a=a.nodeType!==8?null:a,a!==null?(f=qr!==null?{id:tr,overflow:sr}:null,i.memoizedState={dehydrated:a,treeContext:f,retryLane:1073741824},f=vs(18,null,null,0),f.stateNode=a,f.return=i,i.child=f,ns=i,os=null,!0):!1;default:return!1}}function _h(i){return(i.mode&1)!==0&&(i.flags&128)===0}function vh(i){if(Ze){var a=os;if(a){var f=a;if(!vm(i,a)){if(_h(i))throw Error(s(418));a=Sr(f.nextSibling);var b=ns;a&&vm(i,a)?_m(b,f):(i.flags=i.flags&-4097|2,Ze=!1,ns=i)}}else{if(_h(i))throw Error(s(418));i.flags=i.flags&-4097|2,Ze=!1,ns=i}}}function ym(i){for(i=i.return;i!==null&&i.tag!==5&&i.tag!==3&&i.tag!==13;)i=i.return;ns=i}function Aa(i){if(i!==ns)return!1;if(!Ze)return ym(i),Ze=!0,!1;var a;if((a=i.tag!==3)&&!(a=i.tag!==5)&&(a=i.type,a=a!=="head"&&a!=="body"&&!ch(i.type,i.memoizedProps)),a&&(a=os)){if(_h(i))throw xm(),Error(s(418));for(;a;)_m(i,a),a=Sr(a.nextSibling)}if(ym(i),i.tag===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(s(317));e:{for(i=i.nextSibling,a=0;i;){if(i.nodeType===8){var f=i.data;if(f==="/$"){if(a===0){os=Sr(i.nextSibling);break e}a--}else f!=="$"&&f!=="$!"&&f!=="$?"||a++}i=i.nextSibling}os=null}}else os=ns?Sr(i.stateNode.nextSibling):null;return!0}function xm(){for(var i=os;i;)i=Sr(i.nextSibling)}function Hi(){os=ns=null,Ze=!1}function yh(i){Ms===null?Ms=[i]:Ms.push(i)}var Ib=C.ReactCurrentBatchConfig;function Vn(i,a,f){if(i=f.ref,i!==null&&typeof i!="function"&&typeof i!="object"){if(f._owner){if(f=f._owner,f){if(f.tag!==1)throw Error(s(309));var b=f.stateNode}if(!b)throw Error(s(147,i));var k=b,A=""+i;return a!==null&&a.ref!==null&&typeof a.ref=="function"&&a.ref._stringRef===A?a.ref:(a=function(I){var W=k.refs;I===null?delete W[A]:W[A]=I},a._stringRef=A,a)}if(typeof i!="string")throw Error(s(284));if(!f._owner)throw Error(s(290,i))}return i}function Ra(i,a){throw i=Object.prototype.toString.call(a),Error(s(31,i==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":i))}function wm(i){var a=i._init;return a(i._payload)}function bm(i){function a(X,q){if(i){var ee=X.deletions;ee===null?(X.deletions=[q],X.flags|=16):ee.push(q)}}function f(X,q){if(!i)return null;for(;q!==null;)a(X,q),q=q.sibling;return null}function b(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 k(X,q){return X=Br(X,q),X.index=0,X.sibling=null,X}function A(X,q,ee){return X.index=ee,i?(ee=X.alternate,ee!==null?(ee=ee.index,ee<q?(X.flags|=2,q):ee):(X.flags|=2,q)):(X.flags|=1048576,q)}function I(X){return i&&X.alternate===null&&(X.flags|=2),X}function W(X,q,ee,de){return q===null||q.tag!==6?(q=hu(ee,X.mode,de),q.return=X,q):(q=k(q,ee),q.return=X,q)}function G(X,q,ee,de){var xe=ee.type;return xe===R?ce(X,q,ee.props.children,de,ee.key):q!==null&&(q.elementType===xe||typeof xe=="object"&&xe!==null&&xe.$$typeof===Q&&wm(xe)===q.type)?(de=k(q,ee.props),de.ref=Vn(X,q,ee),de.return=X,de):(de=tl(ee.type,ee.key,ee.props,null,X.mode,de),de.ref=Vn(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=uu(ee,X.mode,de),q.return=X,q):(q=k(q,ee.children||[]),q.return=X,q)}function ce(X,q,ee,de,xe){return q===null||q.tag!==7?(q=si(ee,X.mode,de,xe),q.return=X,q):(q=k(q,ee),q.return=X,q)}function ue(X,q,ee){if(typeof q=="string"&&q!==""||typeof q=="number")return q=hu(""+q,X.mode,ee),q.return=X,q;if(typeof q=="object"&&q!==null){switch(q.$$typeof){case M:return ee=tl(q.type,q.key,q.props,null,X.mode,ee),ee.ref=Vn(X,null,q),ee.return=X,ee;case T:return q=uu(q,X.mode,ee),q.return=X,q;case Q:var de=q._init;return ue(X,de(q._payload),ee)}if(Zs(q)||D(q))return q=si(q,X.mode,ee,null),q.return=X,q;Ra(X,q)}return null}function le(X,q,ee,de){var xe=q!==null?q.key:null;if(typeof ee=="string"&&ee!==""||typeof ee=="number")return xe!==null?null:W(X,q,""+ee,de);if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case M:return ee.key===xe?G(X,q,ee,de):null;case T:return ee.key===xe?te(X,q,ee,de):null;case Q:return xe=ee._init,le(X,q,xe(ee._payload),de)}if(Zs(ee)||D(ee))return xe!==null?null:ce(X,q,ee,de,null);Ra(X,ee)}return null}function ge(X,q,ee,de,xe){if(typeof de=="string"&&de!==""||typeof de=="number")return X=X.get(ee)||null,W(q,X,""+de,xe);if(typeof de=="object"&&de!==null){switch(de.$$typeof){case M:return X=X.get(de.key===null?ee:de.key)||null,G(q,X,de,xe);case T:return X=X.get(de.key===null?ee:de.key)||null,te(q,X,de,xe);case Q:var we=de._init;return ge(X,q,ee,we(de._payload),xe)}if(Zs(de)||D(de))return X=X.get(ee)||null,ce(q,X,de,xe,null);Ra(q,de)}return null}function ve(X,q,ee,de){for(var xe=null,we=null,be=q,Me=q=0,bt=null;be!==null&&Me<ee.length;Me++){be.index>Me?(bt=be,be=null):bt=be.sibling;var Fe=le(X,be,ee[Me],de);if(Fe===null){be===null&&(be=bt);break}i&&be&&Fe.alternate===null&&a(X,be),q=A(Fe,q,Me),we===null?xe=Fe:we.sibling=Fe,we=Fe,be=bt}if(Me===ee.length)return f(X,be),Ze&&Kr(X,Me),xe;if(be===null){for(;Me<ee.length;Me++)be=ue(X,ee[Me],de),be!==null&&(q=A(be,q,Me),we===null?xe=be:we.sibling=be,we=be);return Ze&&Kr(X,Me),xe}for(be=b(X,be);Me<ee.length;Me++)bt=ge(be,X,Me,ee[Me],de),bt!==null&&(i&&bt.alternate!==null&&be.delete(bt.key===null?Me:bt.key),q=A(bt,q,Me),we===null?xe=bt:we.sibling=bt,we=bt);return i&&be.forEach(function(Ir){return a(X,Ir)}),Ze&&Kr(X,Me),xe}function ye(X,q,ee,de){var xe=D(ee);if(typeof xe!="function")throw Error(s(150));if(ee=xe.call(ee),ee==null)throw Error(s(151));for(var we=xe=null,be=q,Me=q=0,bt=null,Fe=ee.next();be!==null&&!Fe.done;Me++,Fe=ee.next()){be.index>Me?(bt=be,be=null):bt=be.sibling;var Ir=le(X,be,Fe.value,de);if(Ir===null){be===null&&(be=bt);break}i&&be&&Ir.alternate===null&&a(X,be),q=A(Ir,q,Me),we===null?xe=Ir:we.sibling=Ir,we=Ir,be=bt}if(Fe.done)return f(X,be),Ze&&Kr(X,Me),xe;if(be===null){for(;!Fe.done;Me++,Fe=ee.next())Fe=ue(X,Fe.value,de),Fe!==null&&(q=A(Fe,q,Me),we===null?xe=Fe:we.sibling=Fe,we=Fe);return Ze&&Kr(X,Me),xe}for(be=b(X,be);!Fe.done;Me++,Fe=ee.next())Fe=ge(be,X,Me,Fe.value,de),Fe!==null&&(i&&Fe.alternate!==null&&be.delete(Fe.key===null?Me:Fe.key),q=A(Fe,q,Me),we===null?xe=Fe:we.sibling=Fe,we=Fe);return i&&be.forEach(function(pS){return a(X,pS)}),Ze&&Kr(X,Me),xe}function lt(X,q,ee,de){if(typeof ee=="object"&&ee!==null&&ee.type===R&&ee.key===null&&(ee=ee.props.children),typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case M:e:{for(var xe=ee.key,we=q;we!==null;){if(we.key===xe){if(xe=ee.type,xe===R){if(we.tag===7){f(X,we.sibling),q=k(we,ee.props.children),q.return=X,X=q;break e}}else if(we.elementType===xe||typeof xe=="object"&&xe!==null&&xe.$$typeof===Q&&wm(xe)===we.type){f(X,we.sibling),q=k(we,ee.props),q.ref=Vn(X,we,ee),q.return=X,X=q;break e}f(X,we);break}else a(X,we);we=we.sibling}ee.type===R?(q=si(ee.props.children,X.mode,de,ee.key),q.return=X,X=q):(de=tl(ee.type,ee.key,ee.props,null,X.mode,de),de.ref=Vn(X,q,ee),de.return=X,X=de)}return I(X);case T:e:{for(we=ee.key;q!==null;){if(q.key===we)if(q.tag===4&&q.stateNode.containerInfo===ee.containerInfo&&q.stateNode.implementation===ee.implementation){f(X,q.sibling),q=k(q,ee.children||[]),q.return=X,X=q;break e}else{f(X,q);break}else a(X,q);q=q.sibling}q=uu(ee,X.mode,de),q.return=X,X=q}return I(X);case Q:return we=ee._init,lt(X,q,we(ee._payload),de)}if(Zs(ee))return ve(X,q,ee,de);if(D(ee))return ye(X,q,ee,de);Ra(X,ee)}return typeof ee=="string"&&ee!==""||typeof ee=="number"?(ee=""+ee,q!==null&&q.tag===6?(f(X,q.sibling),q=k(q,ee),q.return=X,X=q):(f(X,q),q=hu(ee,X.mode,de),q.return=X,X=q),I(X)):f(X,q)}return lt}var $i=bm(!0),Sm=bm(!1),Da=Cr(null),La=null,zi=null,xh=null;function wh(){xh=zi=La=null}function bh(i){var a=Da.current;Xe(Da),i._currentValue=a}function Sh(i,a,f){for(;i!==null;){var b=i.alternate;if((i.childLanes&a)!==a?(i.childLanes|=a,b!==null&&(b.childLanes|=a)):b!==null&&(b.childLanes&a)!==a&&(b.childLanes|=a),i===f)break;i=i.return}}function Wi(i,a){La=i,xh=zi=null,i=i.dependencies,i!==null&&i.firstContext!==null&&((i.lanes&a)!==0&&(Yt=!0),i.firstContext=null)}function ms(i){var a=i._currentValue;if(xh!==i)if(i={context:i,memoizedValue:a,next:null},zi===null){if(La===null)throw Error(s(308));zi=i,La.dependencies={lanes:0,firstContext:i}}else zi=zi.next=i;return a}var Yr=null;function Ch(i){Yr===null?Yr=[i]:Yr.push(i)}function Cm(i,a,f,b){var k=a.interleaved;return k===null?(f.next=f,Ch(a)):(f.next=k.next,k.next=f),a.interleaved=f,rr(i,b)}function rr(i,a){i.lanes|=a;var f=i.alternate;for(f!==null&&(f.lanes|=a),f=i,i=i.return;i!==null;)i.childLanes|=a,f=i.alternate,f!==null&&(f.childLanes|=a),f=i,i=i.return;return f.tag===3?f.stateNode:null}var Mr=!1;function kh(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function km(i,a){i=i.updateQueue,a.updateQueue===i&&(a.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,effects:i.effects})}function ir(i,a){return{eventTime:i,lane:a,tag:0,payload:null,callback:null,next:null}}function Tr(i,a,f){var b=i.updateQueue;if(b===null)return null;if(b=b.shared,(Ne&2)!==0){var k=b.pending;return k===null?a.next=a:(a.next=k.next,k.next=a),b.pending=a,rr(i,f)}return k=b.interleaved,k===null?(a.next=a,Ch(b)):(a.next=k.next,k.next=a),b.interleaved=a,rr(i,f)}function Ba(i,a,f){if(a=a.updateQueue,a!==null&&(a=a.shared,(f&4194240)!==0)){var b=a.lanes;b&=i.pendingLanes,f|=b,a.lanes=f,Fc(i,f)}}function Em(i,a){var f=i.updateQueue,b=i.alternate;if(b!==null&&(b=b.updateQueue,f===b)){var k=null,A=null;if(f=f.firstBaseUpdate,f!==null){do{var I={eventTime:f.eventTime,lane:f.lane,tag:f.tag,payload:f.payload,callback:f.callback,next:null};A===null?k=A=I:A=A.next=I,f=f.next}while(f!==null);A===null?k=A=a:A=A.next=a}else k=A=a;f={baseState:b.baseState,firstBaseUpdate:k,lastBaseUpdate:A,shared:b.shared,effects:b.effects},i.updateQueue=f;return}i=f.lastBaseUpdate,i===null?f.firstBaseUpdate=a:i.next=a,f.lastBaseUpdate=a}function Ia(i,a,f,b){var k=i.updateQueue;Mr=!1;var A=k.firstBaseUpdate,I=k.lastBaseUpdate,W=k.shared.pending;if(W!==null){k.shared.pending=null;var G=W,te=G.next;G.next=null,I===null?A=te:I.next=te,I=G;var ce=i.alternate;ce!==null&&(ce=ce.updateQueue,W=ce.lastBaseUpdate,W!==I&&(W===null?ce.firstBaseUpdate=te:W.next=te,ce.lastBaseUpdate=G))}if(A!==null){var ue=k.baseState;I=0,ce=te=G=null,W=A;do{var le=W.lane,ge=W.eventTime;if((b&le)===le){ce!==null&&(ce=ce.next={eventTime:ge,lane:0,tag:W.tag,payload:W.payload,callback:W.callback,next:null});e:{var ve=i,ye=W;switch(le=a,ge=f,ye.tag){case 1:if(ve=ye.payload,typeof ve=="function"){ue=ve.call(ge,ue,le);break e}ue=ve;break e;case 3:ve.flags=ve.flags&-65537|128;case 0:if(ve=ye.payload,le=typeof ve=="function"?ve.call(ge,ue,le):ve,le==null)break e;ue=N({},ue,le);break e;case 2:Mr=!0}}W.callback!==null&&W.lane!==0&&(i.flags|=64,le=k.effects,le===null?k.effects=[W]:le.push(W))}else ge={eventTime:ge,lane:le,tag:W.tag,payload:W.payload,callback:W.callback,next:null},ce===null?(te=ce=ge,G=ue):ce=ce.next=ge,I|=le;if(W=W.next,W===null){if(W=k.shared.pending,W===null)break;le=W,W=le.next,le.next=null,k.lastBaseUpdate=le,k.shared.pending=null}}while(!0);if(ce===null&&(G=ue),k.baseState=G,k.firstBaseUpdate=te,k.lastBaseUpdate=ce,a=k.shared.interleaved,a!==null){k=a;do I|=k.lane,k=k.next;while(k!==a)}else A===null&&(k.shared.lanes=0);Zr|=I,i.lanes=I,i.memoizedState=ue}}function Mm(i,a,f){if(i=a.effects,a.effects=null,i!==null)for(a=0;a<i.length;a++){var b=i[a],k=b.callback;if(k!==null){if(b.callback=null,b=f,typeof k!="function")throw Error(s(191,k));k.call(b)}}}var Gn={},$s=Cr(Gn),qn=Cr(Gn),Kn=Cr(Gn);function Xr(i){if(i===Gn)throw Error(s(174));return i}function Eh(i,a){switch(qe(Kn,a),qe(qn,i),qe($s,Gn),i=a.nodeType,i){case 9:case 11:a=(a=a.documentElement)?a.namespaceURI:zr(null,"");break;default:i=i===8?a.parentNode:a,a=i.namespaceURI||null,i=i.tagName,a=zr(a,i)}Xe($s),qe($s,a)}function Ui(){Xe($s),Xe(qn),Xe(Kn)}function Tm(i){Xr(Kn.current);var a=Xr($s.current),f=zr(a,i.type);a!==f&&(qe(qn,i),qe($s,f))}function Mh(i){qn.current===i&&(Xe($s),Xe(qn))}var Je=Cr(0);function Oa(i){for(var a=i;a!==null;){if(a.tag===13){var f=a.memoizedState;if(f!==null&&(f=f.dehydrated,f===null||f.data==="$?"||f.data==="$!"))return a}else if(a.tag===19&&a.memoizedProps.revealOrder!==void 0){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===i)break;for(;a.sibling===null;){if(a.return===null||a.return===i)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var Th=[];function Ph(){for(var i=0;i<Th.length;i++)Th[i]._workInProgressVersionPrimary=null;Th.length=0}var ja=C.ReactCurrentDispatcher,Ah=C.ReactCurrentBatchConfig,Qr=0,et=null,mt=null,xt=null,Na=!1,Yn=!1,Xn=0,Ob=0;function Dt(){throw Error(s(321))}function Rh(i,a){if(a===null)return!1;for(var f=0;f<a.length&&f<i.length;f++)if(!Es(i[f],a[f]))return!1;return!0}function Dh(i,a,f,b,k,A){if(Qr=A,et=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,ja.current=i===null||i.memoizedState===null?Hb:$b,i=f(b,k),Yn){A=0;do{if(Yn=!1,Xn=0,25<=A)throw Error(s(301));A+=1,xt=mt=null,a.updateQueue=null,ja.current=zb,i=f(b,k)}while(Yn)}if(ja.current=$a,a=mt!==null&&mt.next!==null,Qr=0,xt=mt=et=null,Na=!1,a)throw Error(s(300));return i}function Lh(){var i=Xn!==0;return Xn=0,i}function zs(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return xt===null?et.memoizedState=xt=i:xt=xt.next=i,xt}function gs(){if(mt===null){var i=et.alternate;i=i!==null?i.memoizedState:null}else i=mt.next;var a=xt===null?et.memoizedState:xt.next;if(a!==null)xt=a,mt=i;else{if(i===null)throw Error(s(310));mt=i,i={memoizedState:mt.memoizedState,baseState:mt.baseState,baseQueue:mt.baseQueue,queue:mt.queue,next:null},xt===null?et.memoizedState=xt=i:xt=xt.next=i}return xt}function Qn(i,a){return typeof a=="function"?a(i):a}function Bh(i){var a=gs(),f=a.queue;if(f===null)throw Error(s(311));f.lastRenderedReducer=i;var b=mt,k=b.baseQueue,A=f.pending;if(A!==null){if(k!==null){var I=k.next;k.next=A.next,A.next=I}b.baseQueue=k=A,f.pending=null}if(k!==null){A=k.next,b=b.baseState;var W=I=null,G=null,te=A;do{var ce=te.lane;if((Qr&ce)===ce)G!==null&&(G=G.next={lane:0,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null}),b=te.hasEagerState?te.eagerState:i(b,te.action);else{var ue={lane:ce,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null};G===null?(W=G=ue,I=b):G=G.next=ue,et.lanes|=ce,Zr|=ce}te=te.next}while(te!==null&&te!==A);G===null?I=b:G.next=W,Es(b,a.memoizedState)||(Yt=!0),a.memoizedState=b,a.baseState=I,a.baseQueue=G,f.lastRenderedState=b}if(i=f.interleaved,i!==null){k=i;do A=k.lane,et.lanes|=A,Zr|=A,k=k.next;while(k!==i)}else k===null&&(f.lanes=0);return[a.memoizedState,f.dispatch]}function Ih(i){var a=gs(),f=a.queue;if(f===null)throw Error(s(311));f.lastRenderedReducer=i;var b=f.dispatch,k=f.pending,A=a.memoizedState;if(k!==null){f.pending=null;var I=k=k.next;do A=i(A,I.action),I=I.next;while(I!==k);Es(A,a.memoizedState)||(Yt=!0),a.memoizedState=A,a.baseQueue===null&&(a.baseState=A),f.lastRenderedState=A}return[A,b]}function Pm(){}function Am(i,a){var f=et,b=gs(),k=a(),A=!Es(b.memoizedState,k);if(A&&(b.memoizedState=k,Yt=!0),b=b.queue,Oh(Lm.bind(null,f,b,i),[i]),b.getSnapshot!==a||A||xt!==null&&xt.memoizedState.tag&1){if(f.flags|=2048,Zn(9,Dm.bind(null,f,b,k,a),void 0,null),wt===null)throw Error(s(349));(Qr&30)!==0||Rm(f,a,k)}return k}function Rm(i,a,f){i.flags|=16384,i={getSnapshot:a,value:f},a=et.updateQueue,a===null?(a={lastEffect:null,stores:null},et.updateQueue=a,a.stores=[i]):(f=a.stores,f===null?a.stores=[i]:f.push(i))}function Dm(i,a,f,b){a.value=f,a.getSnapshot=b,Bm(a)&&Im(i)}function Lm(i,a,f){return f(function(){Bm(a)&&Im(i)})}function Bm(i){var a=i.getSnapshot;i=i.value;try{var f=a();return!Es(i,f)}catch{return!0}}function Im(i){var a=rr(i,1);a!==null&&Rs(a,i,1,-1)}function Om(i){var a=zs();return typeof i=="function"&&(i=i()),a.memoizedState=a.baseState=i,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Qn,lastRenderedState:i},a.queue=i,i=i.dispatch=Fb.bind(null,et,i),[a.memoizedState,i]}function Zn(i,a,f,b){return i={tag:i,create:a,destroy:f,deps:b,next:null},a=et.updateQueue,a===null?(a={lastEffect:null,stores:null},et.updateQueue=a,a.lastEffect=i.next=i):(f=a.lastEffect,f===null?a.lastEffect=i.next=i:(b=f.next,f.next=i,i.next=b,a.lastEffect=i)),i}function jm(){return gs().memoizedState}function Fa(i,a,f,b){var k=zs();et.flags|=i,k.memoizedState=Zn(1|a,f,void 0,b===void 0?null:b)}function Ha(i,a,f,b){var k=gs();b=b===void 0?null:b;var A=void 0;if(mt!==null){var I=mt.memoizedState;if(A=I.destroy,b!==null&&Rh(b,I.deps)){k.memoizedState=Zn(a,f,A,b);return}}et.flags|=i,k.memoizedState=Zn(1|a,f,A,b)}function Nm(i,a){return Fa(8390656,8,i,a)}function Oh(i,a){return Ha(2048,8,i,a)}function Fm(i,a){return Ha(4,2,i,a)}function Hm(i,a){return Ha(4,4,i,a)}function $m(i,a){if(typeof a=="function")return i=i(),a(i),function(){a(null)};if(a!=null)return i=i(),a.current=i,function(){a.current=null}}function zm(i,a,f){return f=f!=null?f.concat([i]):null,Ha(4,4,$m.bind(null,a,i),f)}function jh(){}function Wm(i,a){var f=gs();a=a===void 0?null:a;var b=f.memoizedState;return b!==null&&a!==null&&Rh(a,b[1])?b[0]:(f.memoizedState=[i,a],i)}function Um(i,a){var f=gs();a=a===void 0?null:a;var b=f.memoizedState;return b!==null&&a!==null&&Rh(a,b[1])?b[0]:(i=i(),f.memoizedState=[i,a],i)}function Vm(i,a,f){return(Qr&21)===0?(i.baseState&&(i.baseState=!1,Yt=!0),i.memoizedState=f):(Es(f,a)||(f=wp(),et.lanes|=f,Zr|=f,i.baseState=!0),a)}function jb(i,a){var f=ze;ze=f!==0&&4>f?f:4,i(!0);var b=Ah.transition;Ah.transition={};try{i(!1),a()}finally{ze=f,Ah.transition=b}}function Gm(){return gs().memoizedState}function Nb(i,a,f){var b=Dr(i);if(f={lane:b,action:f,hasEagerState:!1,eagerState:null,next:null},qm(i))Km(a,f);else if(f=Cm(i,a,f,b),f!==null){var k=zt();Rs(f,i,b,k),Ym(f,a,b)}}function Fb(i,a,f){var b=Dr(i),k={lane:b,action:f,hasEagerState:!1,eagerState:null,next:null};if(qm(i))Km(a,k);else{var A=i.alternate;if(i.lanes===0&&(A===null||A.lanes===0)&&(A=a.lastRenderedReducer,A!==null))try{var I=a.lastRenderedState,W=A(I,f);if(k.hasEagerState=!0,k.eagerState=W,Es(W,I)){var G=a.interleaved;G===null?(k.next=k,Ch(a)):(k.next=G.next,G.next=k),a.interleaved=k;return}}catch{}finally{}f=Cm(i,a,k,b),f!==null&&(k=zt(),Rs(f,i,b,k),Ym(f,a,b))}}function qm(i){var a=i.alternate;return i===et||a!==null&&a===et}function Km(i,a){Yn=Na=!0;var f=i.pending;f===null?a.next=a:(a.next=f.next,f.next=a),i.pending=a}function Ym(i,a,f){if((f&4194240)!==0){var b=a.lanes;b&=i.pendingLanes,f|=b,a.lanes=f,Fc(i,f)}}var $a={readContext:ms,useCallback:Dt,useContext:Dt,useEffect:Dt,useImperativeHandle:Dt,useInsertionEffect:Dt,useLayoutEffect:Dt,useMemo:Dt,useReducer:Dt,useRef:Dt,useState:Dt,useDebugValue:Dt,useDeferredValue:Dt,useTransition:Dt,useMutableSource:Dt,useSyncExternalStore:Dt,useId:Dt,unstable_isNewReconciler:!1},Hb={readContext:ms,useCallback:function(i,a){return zs().memoizedState=[i,a===void 0?null:a],i},useContext:ms,useEffect:Nm,useImperativeHandle:function(i,a,f){return f=f!=null?f.concat([i]):null,Fa(4194308,4,$m.bind(null,a,i),f)},useLayoutEffect:function(i,a){return Fa(4194308,4,i,a)},useInsertionEffect:function(i,a){return Fa(4,2,i,a)},useMemo:function(i,a){var f=zs();return a=a===void 0?null:a,i=i(),f.memoizedState=[i,a],i},useReducer:function(i,a,f){var b=zs();return a=f!==void 0?f(a):a,b.memoizedState=b.baseState=a,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:a},b.queue=i,i=i.dispatch=Nb.bind(null,et,i),[b.memoizedState,i]},useRef:function(i){var a=zs();return i={current:i},a.memoizedState=i},useState:Om,useDebugValue:jh,useDeferredValue:function(i){return zs().memoizedState=i},useTransition:function(){var i=Om(!1),a=i[0];return i=jb.bind(null,i[1]),zs().memoizedState=i,[a,i]},useMutableSource:function(){},useSyncExternalStore:function(i,a,f){var b=et,k=zs();if(Ze){if(f===void 0)throw Error(s(407));f=f()}else{if(f=a(),wt===null)throw Error(s(349));(Qr&30)!==0||Rm(b,a,f)}k.memoizedState=f;var A={value:f,getSnapshot:a};return k.queue=A,Nm(Lm.bind(null,b,A,i),[i]),b.flags|=2048,Zn(9,Dm.bind(null,b,A,f,a),void 0,null),f},useId:function(){var i=zs(),a=wt.identifierPrefix;if(Ze){var f=sr,b=tr;f=(b&~(1<<32-ks(b)-1)).toString(32)+f,a=":"+a+"R"+f,f=Xn++,0<f&&(a+="H"+f.toString(32)),a+=":"}else f=Ob++,a=":"+a+"r"+f.toString(32)+":";return i.memoizedState=a},unstable_isNewReconciler:!1},$b={readContext:ms,useCallback:Wm,useContext:ms,useEffect:Oh,useImperativeHandle:zm,useInsertionEffect:Fm,useLayoutEffect:Hm,useMemo:Um,useReducer:Bh,useRef:jm,useState:function(){return Bh(Qn)},useDebugValue:jh,useDeferredValue:function(i){var a=gs();return Vm(a,mt.memoizedState,i)},useTransition:function(){var i=Bh(Qn)[0],a=gs().memoizedState;return[i,a]},useMutableSource:Pm,useSyncExternalStore:Am,useId:Gm,unstable_isNewReconciler:!1},zb={readContext:ms,useCallback:Wm,useContext:ms,useEffect:Oh,useImperativeHandle:zm,useInsertionEffect:Fm,useLayoutEffect:Hm,useMemo:Um,useReducer:Ih,useRef:jm,useState:function(){return Ih(Qn)},useDebugValue:jh,useDeferredValue:function(i){var a=gs();return mt===null?a.memoizedState=i:Vm(a,mt.memoizedState,i)},useTransition:function(){var i=Ih(Qn)[0],a=gs().memoizedState;return[i,a]},useMutableSource:Pm,useSyncExternalStore:Am,useId:Gm,unstable_isNewReconciler:!1};function Ts(i,a){if(i&&i.defaultProps){a=N({},a),i=i.defaultProps;for(var f in i)a[f]===void 0&&(a[f]=i[f]);return a}return a}function Nh(i,a,f,b){a=i.memoizedState,f=f(b,a),f=f==null?a:N({},a,f),i.memoizedState=f,i.lanes===0&&(i.updateQueue.baseState=f)}var za={isMounted:function(i){return(i=i._reactInternals)?Ur(i)===i:!1},enqueueSetState:function(i,a,f){i=i._reactInternals;var b=zt(),k=Dr(i),A=ir(b,k);A.payload=a,f!=null&&(A.callback=f),a=Tr(i,A,k),a!==null&&(Rs(a,i,k,b),Ba(a,i,k))},enqueueReplaceState:function(i,a,f){i=i._reactInternals;var b=zt(),k=Dr(i),A=ir(b,k);A.tag=1,A.payload=a,f!=null&&(A.callback=f),a=Tr(i,A,k),a!==null&&(Rs(a,i,k,b),Ba(a,i,k))},enqueueForceUpdate:function(i,a){i=i._reactInternals;var f=zt(),b=Dr(i),k=ir(f,b);k.tag=2,a!=null&&(k.callback=a),a=Tr(i,k,b),a!==null&&(Rs(a,i,b,f),Ba(a,i,b))}};function Xm(i,a,f,b,k,A,I){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(b,A,I):a.prototype&&a.prototype.isPureReactComponent?!Nn(f,b)||!Nn(k,A):!0}function Qm(i,a,f){var b=!1,k=kr,A=a.contextType;return typeof A=="object"&&A!==null?A=ms(A):(k=Kt(a)?Gr:Rt.current,b=a.contextTypes,A=(b=b!=null)?ji(i,k):kr),a=new a(f,A),i.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=za,i.stateNode=a,a._reactInternals=i,b&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=k,i.__reactInternalMemoizedMaskedChildContext=A),a}function Zm(i,a,f,b){i=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(f,b),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(f,b),a.state!==i&&za.enqueueReplaceState(a,a.state,null)}function Fh(i,a,f,b){var k=i.stateNode;k.props=f,k.state=i.memoizedState,k.refs={},kh(i);var A=a.contextType;typeof A=="object"&&A!==null?k.context=ms(A):(A=Kt(a)?Gr:Rt.current,k.context=ji(i,A)),k.state=i.memoizedState,A=a.getDerivedStateFromProps,typeof A=="function"&&(Nh(i,a,A,f),k.state=i.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof k.getSnapshotBeforeUpdate=="function"||typeof k.UNSAFE_componentWillMount!="function"&&typeof k.componentWillMount!="function"||(a=k.state,typeof k.componentWillMount=="function"&&k.componentWillMount(),typeof k.UNSAFE_componentWillMount=="function"&&k.UNSAFE_componentWillMount(),a!==k.state&&za.enqueueReplaceState(k,k.state,null),Ia(i,f,k,b),k.state=i.memoizedState),typeof k.componentDidMount=="function"&&(i.flags|=4194308)}function Vi(i,a){try{var f="",b=a;do f+=he(b),b=b.return;while(b);var k=f}catch(A){k=`
|
|
40
|
+
Error generating stack: `+A.message+`
|
|
41
|
+
`+A.stack}return{value:i,source:a,stack:k,digest:null}}function Hh(i,a,f){return{value:i,source:null,stack:f??null,digest:a??null}}function $h(i,a){try{console.error(a.value)}catch(f){setTimeout(function(){throw f})}}var Wb=typeof WeakMap=="function"?WeakMap:Map;function Jm(i,a,f){f=ir(-1,f),f.tag=3,f.payload={element:null};var b=a.value;return f.callback=function(){Ya||(Ya=!0,su=b),$h(i,a)},f}function eg(i,a,f){f=ir(-1,f),f.tag=3;var b=i.type.getDerivedStateFromError;if(typeof b=="function"){var k=a.value;f.payload=function(){return b(k)},f.callback=function(){$h(i,a)}}var A=i.stateNode;return A!==null&&typeof A.componentDidCatch=="function"&&(f.callback=function(){$h(i,a),typeof b!="function"&&(Ar===null?Ar=new Set([this]):Ar.add(this));var I=a.stack;this.componentDidCatch(a.value,{componentStack:I!==null?I:""})}),f}function tg(i,a,f){var b=i.pingCache;if(b===null){b=i.pingCache=new Wb;var k=new Set;b.set(a,k)}else k=b.get(a),k===void 0&&(k=new Set,b.set(a,k));k.has(f)||(k.add(f),i=rS.bind(null,i,a,f),a.then(i,i))}function sg(i){do{var a;if((a=i.tag===13)&&(a=i.memoizedState,a=a!==null?a.dehydrated!==null:!0),a)return i;i=i.return}while(i!==null);return null}function rg(i,a,f,b,k){return(i.mode&1)===0?(i===a?i.flags|=65536:(i.flags|=128,f.flags|=131072,f.flags&=-52805,f.tag===1&&(f.alternate===null?f.tag=17:(a=ir(-1,1),a.tag=2,Tr(f,a,1))),f.lanes|=1),i):(i.flags|=65536,i.lanes=k,i)}var Ub=C.ReactCurrentOwner,Yt=!1;function $t(i,a,f,b){a.child=i===null?Sm(a,null,f,b):$i(a,i.child,f,b)}function ig(i,a,f,b,k){f=f.render;var A=a.ref;return Wi(a,k),b=Dh(i,a,f,b,A,k),f=Lh(),i!==null&&!Yt?(a.updateQueue=i.updateQueue,a.flags&=-2053,i.lanes&=~k,nr(i,a,k)):(Ze&&f&&mh(a),a.flags|=1,$t(i,a,b,k),a.child)}function ng(i,a,f,b,k){if(i===null){var A=f.type;return typeof A=="function"&&!cu(A)&&A.defaultProps===void 0&&f.compare===null&&f.defaultProps===void 0?(a.tag=15,a.type=A,og(i,a,A,b,k)):(i=tl(f.type,null,b,a,a.mode,k),i.ref=a.ref,i.return=a,a.child=i)}if(A=i.child,(i.lanes&k)===0){var I=A.memoizedProps;if(f=f.compare,f=f!==null?f:Nn,f(I,b)&&i.ref===a.ref)return nr(i,a,k)}return a.flags|=1,i=Br(A,b),i.ref=a.ref,i.return=a,a.child=i}function og(i,a,f,b,k){if(i!==null){var A=i.memoizedProps;if(Nn(A,b)&&i.ref===a.ref)if(Yt=!1,a.pendingProps=b=A,(i.lanes&k)!==0)(i.flags&131072)!==0&&(Yt=!0);else return a.lanes=i.lanes,nr(i,a,k)}return zh(i,a,f,b,k)}function ag(i,a,f){var b=a.pendingProps,k=b.children,A=i!==null?i.memoizedState:null;if(b.mode==="hidden")if((a.mode&1)===0)a.memoizedState={baseLanes:0,cachePool:null,transitions:null},qe(qi,as),as|=f;else{if((f&1073741824)===0)return i=A!==null?A.baseLanes|f:f,a.lanes=a.childLanes=1073741824,a.memoizedState={baseLanes:i,cachePool:null,transitions:null},a.updateQueue=null,qe(qi,as),as|=i,null;a.memoizedState={baseLanes:0,cachePool:null,transitions:null},b=A!==null?A.baseLanes:f,qe(qi,as),as|=b}else A!==null?(b=A.baseLanes|f,a.memoizedState=null):b=f,qe(qi,as),as|=b;return $t(i,a,k,f),a.child}function lg(i,a){var f=a.ref;(i===null&&f!==null||i!==null&&i.ref!==f)&&(a.flags|=512,a.flags|=2097152)}function zh(i,a,f,b,k){var A=Kt(f)?Gr:Rt.current;return A=ji(a,A),Wi(a,k),f=Dh(i,a,f,b,A,k),b=Lh(),i!==null&&!Yt?(a.updateQueue=i.updateQueue,a.flags&=-2053,i.lanes&=~k,nr(i,a,k)):(Ze&&b&&mh(a),a.flags|=1,$t(i,a,f,k),a.child)}function cg(i,a,f,b,k){if(Kt(f)){var A=!0;Ea(a)}else A=!1;if(Wi(a,k),a.stateNode===null)Ua(i,a),Qm(a,f,b),Fh(a,f,b,k),b=!0;else if(i===null){var I=a.stateNode,W=a.memoizedProps;I.props=W;var G=I.context,te=f.contextType;typeof te=="object"&&te!==null?te=ms(te):(te=Kt(f)?Gr:Rt.current,te=ji(a,te));var ce=f.getDerivedStateFromProps,ue=typeof ce=="function"||typeof I.getSnapshotBeforeUpdate=="function";ue||typeof I.UNSAFE_componentWillReceiveProps!="function"&&typeof I.componentWillReceiveProps!="function"||(W!==b||G!==te)&&Zm(a,I,b,te),Mr=!1;var le=a.memoizedState;I.state=le,Ia(a,b,I,k),G=a.memoizedState,W!==b||le!==G||qt.current||Mr?(typeof ce=="function"&&(Nh(a,f,ce,b),G=a.memoizedState),(W=Mr||Xm(a,f,W,b,le,G,te))?(ue||typeof I.UNSAFE_componentWillMount!="function"&&typeof I.componentWillMount!="function"||(typeof I.componentWillMount=="function"&&I.componentWillMount(),typeof I.UNSAFE_componentWillMount=="function"&&I.UNSAFE_componentWillMount()),typeof I.componentDidMount=="function"&&(a.flags|=4194308)):(typeof I.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=b,a.memoizedState=G),I.props=b,I.state=G,I.context=te,b=W):(typeof I.componentDidMount=="function"&&(a.flags|=4194308),b=!1)}else{I=a.stateNode,km(i,a),W=a.memoizedProps,te=a.type===a.elementType?W:Ts(a.type,W),I.props=te,ue=a.pendingProps,le=I.context,G=f.contextType,typeof G=="object"&&G!==null?G=ms(G):(G=Kt(f)?Gr:Rt.current,G=ji(a,G));var ge=f.getDerivedStateFromProps;(ce=typeof ge=="function"||typeof I.getSnapshotBeforeUpdate=="function")||typeof I.UNSAFE_componentWillReceiveProps!="function"&&typeof I.componentWillReceiveProps!="function"||(W!==ue||le!==G)&&Zm(a,I,b,G),Mr=!1,le=a.memoizedState,I.state=le,Ia(a,b,I,k);var ve=a.memoizedState;W!==ue||le!==ve||qt.current||Mr?(typeof ge=="function"&&(Nh(a,f,ge,b),ve=a.memoizedState),(te=Mr||Xm(a,f,te,b,le,ve,G)||!1)?(ce||typeof I.UNSAFE_componentWillUpdate!="function"&&typeof I.componentWillUpdate!="function"||(typeof I.componentWillUpdate=="function"&&I.componentWillUpdate(b,ve,G),typeof I.UNSAFE_componentWillUpdate=="function"&&I.UNSAFE_componentWillUpdate(b,ve,G)),typeof I.componentDidUpdate=="function"&&(a.flags|=4),typeof I.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof I.componentDidUpdate!="function"||W===i.memoizedProps&&le===i.memoizedState||(a.flags|=4),typeof I.getSnapshotBeforeUpdate!="function"||W===i.memoizedProps&&le===i.memoizedState||(a.flags|=1024),a.memoizedProps=b,a.memoizedState=ve),I.props=b,I.state=ve,I.context=G,b=te):(typeof I.componentDidUpdate!="function"||W===i.memoizedProps&&le===i.memoizedState||(a.flags|=4),typeof I.getSnapshotBeforeUpdate!="function"||W===i.memoizedProps&&le===i.memoizedState||(a.flags|=1024),b=!1)}return Wh(i,a,f,b,A,k)}function Wh(i,a,f,b,k,A){lg(i,a);var I=(a.flags&128)!==0;if(!b&&!I)return k&&pm(a,f,!1),nr(i,a,A);b=a.stateNode,Ub.current=a;var W=I&&typeof f.getDerivedStateFromError!="function"?null:b.render();return a.flags|=1,i!==null&&I?(a.child=$i(a,i.child,null,A),a.child=$i(a,null,W,A)):$t(i,a,W,A),a.memoizedState=b.state,k&&pm(a,f,!0),a.child}function hg(i){var a=i.stateNode;a.pendingContext?dm(i,a.pendingContext,a.pendingContext!==a.context):a.context&&dm(i,a.context,!1),Eh(i,a.containerInfo)}function ug(i,a,f,b,k){return Hi(),yh(k),a.flags|=256,$t(i,a,f,b),a.child}var Uh={dehydrated:null,treeContext:null,retryLane:0};function Vh(i){return{baseLanes:i,cachePool:null,transitions:null}}function dg(i,a,f){var b=a.pendingProps,k=Je.current,A=!1,I=(a.flags&128)!==0,W;if((W=I)||(W=i!==null&&i.memoizedState===null?!1:(k&2)!==0),W?(A=!0,a.flags&=-129):(i===null||i.memoizedState!==null)&&(k|=1),qe(Je,k&1),i===null)return vh(a),i=a.memoizedState,i!==null&&(i=i.dehydrated,i!==null)?((a.mode&1)===0?a.lanes=1:i.data==="$!"?a.lanes=8:a.lanes=1073741824,null):(I=b.children,i=b.fallback,A?(b=a.mode,A=a.child,I={mode:"hidden",children:I},(b&1)===0&&A!==null?(A.childLanes=0,A.pendingProps=I):A=sl(I,b,0,null),i=si(i,b,f,null),A.return=a,i.return=a,A.sibling=i,a.child=A,a.child.memoizedState=Vh(f),a.memoizedState=Uh,i):Gh(a,I));if(k=i.memoizedState,k!==null&&(W=k.dehydrated,W!==null))return Vb(i,a,I,b,W,k,f);if(A){A=b.fallback,I=a.mode,k=i.child,W=k.sibling;var G={mode:"hidden",children:b.children};return(I&1)===0&&a.child!==k?(b=a.child,b.childLanes=0,b.pendingProps=G,a.deletions=null):(b=Br(k,G),b.subtreeFlags=k.subtreeFlags&14680064),W!==null?A=Br(W,A):(A=si(A,I,f,null),A.flags|=2),A.return=a,b.return=a,b.sibling=A,a.child=b,b=A,A=a.child,I=i.child.memoizedState,I=I===null?Vh(f):{baseLanes:I.baseLanes|f,cachePool:null,transitions:I.transitions},A.memoizedState=I,A.childLanes=i.childLanes&~f,a.memoizedState=Uh,b}return A=i.child,i=A.sibling,b=Br(A,{mode:"visible",children:b.children}),(a.mode&1)===0&&(b.lanes=f),b.return=a,b.sibling=null,i!==null&&(f=a.deletions,f===null?(a.deletions=[i],a.flags|=16):f.push(i)),a.child=b,a.memoizedState=null,b}function Gh(i,a){return a=sl({mode:"visible",children:a},i.mode,0,null),a.return=i,i.child=a}function Wa(i,a,f,b){return b!==null&&yh(b),$i(a,i.child,null,f),i=Gh(a,a.pendingProps.children),i.flags|=2,a.memoizedState=null,i}function Vb(i,a,f,b,k,A,I){if(f)return a.flags&256?(a.flags&=-257,b=Hh(Error(s(422))),Wa(i,a,I,b)):a.memoizedState!==null?(a.child=i.child,a.flags|=128,null):(A=b.fallback,k=a.mode,b=sl({mode:"visible",children:b.children},k,0,null),A=si(A,k,I,null),A.flags|=2,b.return=a,A.return=a,b.sibling=A,a.child=b,(a.mode&1)!==0&&$i(a,i.child,null,I),a.child.memoizedState=Vh(I),a.memoizedState=Uh,A);if((a.mode&1)===0)return Wa(i,a,I,null);if(k.data==="$!"){if(b=k.nextSibling&&k.nextSibling.dataset,b)var W=b.dgst;return b=W,A=Error(s(419)),b=Hh(A,b,void 0),Wa(i,a,I,b)}if(W=(I&i.childLanes)!==0,Yt||W){if(b=wt,b!==null){switch(I&-I){case 4:k=2;break;case 16:k=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:k=32;break;case 536870912:k=268435456;break;default:k=0}k=(k&(b.suspendedLanes|I))!==0?0:k,k!==0&&k!==A.retryLane&&(A.retryLane=k,rr(i,k),Rs(b,i,k,-1))}return lu(),b=Hh(Error(s(421))),Wa(i,a,I,b)}return k.data==="$?"?(a.flags|=128,a.child=i.child,a=iS.bind(null,i),k._reactRetry=a,null):(i=A.treeContext,os=Sr(k.nextSibling),ns=a,Ze=!0,Ms=null,i!==null&&(fs[ps++]=tr,fs[ps++]=sr,fs[ps++]=qr,tr=i.id,sr=i.overflow,qr=a),a=Gh(a,b.children),a.flags|=4096,a)}function fg(i,a,f){i.lanes|=a;var b=i.alternate;b!==null&&(b.lanes|=a),Sh(i.return,a,f)}function qh(i,a,f,b,k){var A=i.memoizedState;A===null?i.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:b,tail:f,tailMode:k}:(A.isBackwards=a,A.rendering=null,A.renderingStartTime=0,A.last=b,A.tail=f,A.tailMode=k)}function pg(i,a,f){var b=a.pendingProps,k=b.revealOrder,A=b.tail;if($t(i,a,b.children,f),b=Je.current,(b&2)!==0)b=b&1|2,a.flags|=128;else{if(i!==null&&(i.flags&128)!==0)e:for(i=a.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&fg(i,f,a);else if(i.tag===19)fg(i,f,a);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===a)break e;for(;i.sibling===null;){if(i.return===null||i.return===a)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}b&=1}if(qe(Je,b),(a.mode&1)===0)a.memoizedState=null;else switch(k){case"forwards":for(f=a.child,k=null;f!==null;)i=f.alternate,i!==null&&Oa(i)===null&&(k=f),f=f.sibling;f=k,f===null?(k=a.child,a.child=null):(k=f.sibling,f.sibling=null),qh(a,!1,k,f,A);break;case"backwards":for(f=null,k=a.child,a.child=null;k!==null;){if(i=k.alternate,i!==null&&Oa(i)===null){a.child=k;break}i=k.sibling,k.sibling=f,f=k,k=i}qh(a,!0,f,null,A);break;case"together":qh(a,!1,null,null,void 0);break;default:a.memoizedState=null}return a.child}function Ua(i,a){(a.mode&1)===0&&i!==null&&(i.alternate=null,a.alternate=null,a.flags|=2)}function nr(i,a,f){if(i!==null&&(a.dependencies=i.dependencies),Zr|=a.lanes,(f&a.childLanes)===0)return null;if(i!==null&&a.child!==i.child)throw Error(s(153));if(a.child!==null){for(i=a.child,f=Br(i,i.pendingProps),a.child=f,f.return=a;i.sibling!==null;)i=i.sibling,f=f.sibling=Br(i,i.pendingProps),f.return=a;f.sibling=null}return a.child}function Gb(i,a,f){switch(a.tag){case 3:hg(a),Hi();break;case 5:Tm(a);break;case 1:Kt(a.type)&&Ea(a);break;case 4:Eh(a,a.stateNode.containerInfo);break;case 10:var b=a.type._context,k=a.memoizedProps.value;qe(Da,b._currentValue),b._currentValue=k;break;case 13:if(b=a.memoizedState,b!==null)return b.dehydrated!==null?(qe(Je,Je.current&1),a.flags|=128,null):(f&a.child.childLanes)!==0?dg(i,a,f):(qe(Je,Je.current&1),i=nr(i,a,f),i!==null?i.sibling:null);qe(Je,Je.current&1);break;case 19:if(b=(f&a.childLanes)!==0,(i.flags&128)!==0){if(b)return pg(i,a,f);a.flags|=128}if(k=a.memoizedState,k!==null&&(k.rendering=null,k.tail=null,k.lastEffect=null),qe(Je,Je.current),b)break;return null;case 22:case 23:return a.lanes=0,ag(i,a,f)}return nr(i,a,f)}var mg,Kh,gg,_g;mg=function(i,a){for(var f=a.child;f!==null;){if(f.tag===5||f.tag===6)i.appendChild(f.stateNode);else if(f.tag!==4&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===a)break;for(;f.sibling===null;){if(f.return===null||f.return===a)return;f=f.return}f.sibling.return=f.return,f=f.sibling}},Kh=function(){},gg=function(i,a,f,b){var k=i.memoizedProps;if(k!==b){i=a.stateNode,Xr($s.current);var A=null;switch(f){case"input":k=Ie(i,k),b=Ie(i,b),A=[];break;case"select":k=N({},k,{value:void 0}),b=N({},b,{value:void 0}),A=[];break;case"textarea":k=pr(i,k),b=pr(i,b),A=[];break;default:typeof k.onClick!="function"&&typeof b.onClick=="function"&&(i.onclick=Sa)}Tc(f,b);var I;f=null;for(te in k)if(!b.hasOwnProperty(te)&&k.hasOwnProperty(te)&&k[te]!=null)if(te==="style"){var W=k[te];for(I in W)W.hasOwnProperty(I)&&(f||(f={}),f[I]="")}else te!=="dangerouslySetInnerHTML"&&te!=="children"&&te!=="suppressContentEditableWarning"&&te!=="suppressHydrationWarning"&&te!=="autoFocus"&&(n.hasOwnProperty(te)?A||(A=[]):(A=A||[]).push(te,null));for(te in b){var G=b[te];if(W=k!=null?k[te]:void 0,b.hasOwnProperty(te)&&G!==W&&(G!=null||W!=null))if(te==="style")if(W){for(I in W)!W.hasOwnProperty(I)||G&&G.hasOwnProperty(I)||(f||(f={}),f[I]="");for(I in G)G.hasOwnProperty(I)&&W[I]!==G[I]&&(f||(f={}),f[I]=G[I])}else f||(A||(A=[]),A.push(te,f)),f=G;else te==="dangerouslySetInnerHTML"?(G=G?G.__html:void 0,W=W?W.__html:void 0,G!=null&&W!==G&&(A=A||[]).push(te,G)):te==="children"?typeof G!="string"&&typeof G!="number"||(A=A||[]).push(te,""+G):te!=="suppressContentEditableWarning"&&te!=="suppressHydrationWarning"&&(n.hasOwnProperty(te)?(G!=null&&te==="onScroll"&&Ye("scroll",i),A||W===G||(A=[])):(A=A||[]).push(te,G))}f&&(A=A||[]).push("style",f);var te=A;(a.updateQueue=te)&&(a.flags|=4)}},_g=function(i,a,f,b){f!==b&&(a.flags|=4)};function Jn(i,a){if(!Ze)switch(i.tailMode){case"hidden":a=i.tail;for(var f=null;a!==null;)a.alternate!==null&&(f=a),a=a.sibling;f===null?i.tail=null:f.sibling=null;break;case"collapsed":f=i.tail;for(var b=null;f!==null;)f.alternate!==null&&(b=f),f=f.sibling;b===null?a||i.tail===null?i.tail=null:i.tail.sibling=null:b.sibling=null}}function Lt(i){var a=i.alternate!==null&&i.alternate.child===i.child,f=0,b=0;if(a)for(var k=i.child;k!==null;)f|=k.lanes|k.childLanes,b|=k.subtreeFlags&14680064,b|=k.flags&14680064,k.return=i,k=k.sibling;else for(k=i.child;k!==null;)f|=k.lanes|k.childLanes,b|=k.subtreeFlags,b|=k.flags,k.return=i,k=k.sibling;return i.subtreeFlags|=b,i.childLanes=f,a}function qb(i,a,f){var b=a.pendingProps;switch(gh(a),a.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Lt(a),null;case 1:return Kt(a.type)&&ka(),Lt(a),null;case 3:return b=a.stateNode,Ui(),Xe(qt),Xe(Rt),Ph(),b.pendingContext&&(b.context=b.pendingContext,b.pendingContext=null),(i===null||i.child===null)&&(Aa(a)?a.flags|=4:i===null||i.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,Ms!==null&&(nu(Ms),Ms=null))),Kh(i,a),Lt(a),null;case 5:Mh(a);var k=Xr(Kn.current);if(f=a.type,i!==null&&a.stateNode!=null)gg(i,a,f,b,k),i.ref!==a.ref&&(a.flags|=512,a.flags|=2097152);else{if(!b){if(a.stateNode===null)throw Error(s(166));return Lt(a),null}if(i=Xr($s.current),Aa(a)){b=a.stateNode,f=a.type;var A=a.memoizedProps;switch(b[Hs]=a,b[Wn]=A,i=(a.mode&1)!==0,f){case"dialog":Ye("cancel",b),Ye("close",b);break;case"iframe":case"object":case"embed":Ye("load",b);break;case"video":case"audio":for(k=0;k<Hn.length;k++)Ye(Hn[k],b);break;case"source":Ye("error",b);break;case"img":case"image":case"link":Ye("error",b),Ye("load",b);break;case"details":Ye("toggle",b);break;case"input":je(b,A),Ye("invalid",b);break;case"select":b._wrapperState={wasMultiple:!!A.multiple},Ye("invalid",b);break;case"textarea":Ht(b,A),Ye("invalid",b)}Tc(f,A),k=null;for(var I in A)if(A.hasOwnProperty(I)){var W=A[I];I==="children"?typeof W=="string"?b.textContent!==W&&(A.suppressHydrationWarning!==!0&&ba(b.textContent,W,i),k=["children",W]):typeof W=="number"&&b.textContent!==""+W&&(A.suppressHydrationWarning!==!0&&ba(b.textContent,W,i),k=["children",""+W]):n.hasOwnProperty(I)&&W!=null&&I==="onScroll"&&Ye("scroll",b)}switch(f){case"input":pe(b),js(b,A,!0);break;case"textarea":pe(b),ss(b);break;case"select":case"option":break;default:typeof A.onClick=="function"&&(b.onclick=Sa)}b=k,a.updateQueue=b,b!==null&&(a.flags|=4)}else{I=k.nodeType===9?k:k.ownerDocument,i==="http://www.w3.org/1999/xhtml"&&(i=gr(f)),i==="http://www.w3.org/1999/xhtml"?f==="script"?(i=I.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild)):typeof b.is=="string"?i=I.createElement(f,{is:b.is}):(i=I.createElement(f),f==="select"&&(I=i,b.multiple?I.multiple=!0:b.size&&(I.size=b.size))):i=I.createElementNS(i,f),i[Hs]=a,i[Wn]=b,mg(i,a,!1,!1),a.stateNode=i;e:{switch(I=Pc(f,b),f){case"dialog":Ye("cancel",i),Ye("close",i),k=b;break;case"iframe":case"object":case"embed":Ye("load",i),k=b;break;case"video":case"audio":for(k=0;k<Hn.length;k++)Ye(Hn[k],i);k=b;break;case"source":Ye("error",i),k=b;break;case"img":case"image":case"link":Ye("error",i),Ye("load",i),k=b;break;case"details":Ye("toggle",i),k=b;break;case"input":je(i,b),k=Ie(i,b),Ye("invalid",i);break;case"option":k=b;break;case"select":i._wrapperState={wasMultiple:!!b.multiple},k=N({},b,{value:void 0}),Ye("invalid",i);break;case"textarea":Ht(i,b),k=pr(i,b),Ye("invalid",i);break;default:k=b}Tc(f,k),W=k;for(A in W)if(W.hasOwnProperty(A)){var G=W[A];A==="style"?op(i,G):A==="dangerouslySetInnerHTML"?(G=G?G.__html:void 0,G!=null&&Wr(i,G)):A==="children"?typeof G=="string"?(f!=="textarea"||G!=="")&&Gt(i,G):typeof G=="number"&&Gt(i,""+G):A!=="suppressContentEditableWarning"&&A!=="suppressHydrationWarning"&&A!=="autoFocus"&&(n.hasOwnProperty(A)?G!=null&&A==="onScroll"&&Ye("scroll",i):G!=null&&_(i,A,G,I))}switch(f){case"input":pe(i),js(i,b,!1);break;case"textarea":pe(i),ss(i);break;case"option":b.value!=null&&i.setAttribute("value",""+O(b.value));break;case"select":i.multiple=!!b.multiple,A=b.value,A!=null?Ns(i,!!b.multiple,A,!1):b.defaultValue!=null&&Ns(i,!!b.multiple,b.defaultValue,!0);break;default:typeof k.onClick=="function"&&(i.onclick=Sa)}switch(f){case"button":case"input":case"select":case"textarea":b=!!b.autoFocus;break e;case"img":b=!0;break e;default:b=!1}}b&&(a.flags|=4)}a.ref!==null&&(a.flags|=512,a.flags|=2097152)}return Lt(a),null;case 6:if(i&&a.stateNode!=null)_g(i,a,i.memoizedProps,b);else{if(typeof b!="string"&&a.stateNode===null)throw Error(s(166));if(f=Xr(Kn.current),Xr($s.current),Aa(a)){if(b=a.stateNode,f=a.memoizedProps,b[Hs]=a,(A=b.nodeValue!==f)&&(i=ns,i!==null))switch(i.tag){case 3:ba(b.nodeValue,f,(i.mode&1)!==0);break;case 5:i.memoizedProps.suppressHydrationWarning!==!0&&ba(b.nodeValue,f,(i.mode&1)!==0)}A&&(a.flags|=4)}else b=(f.nodeType===9?f:f.ownerDocument).createTextNode(b),b[Hs]=a,a.stateNode=b}return Lt(a),null;case 13:if(Xe(Je),b=a.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(Ze&&os!==null&&(a.mode&1)!==0&&(a.flags&128)===0)xm(),Hi(),a.flags|=98560,A=!1;else if(A=Aa(a),b!==null&&b.dehydrated!==null){if(i===null){if(!A)throw Error(s(318));if(A=a.memoizedState,A=A!==null?A.dehydrated:null,!A)throw Error(s(317));A[Hs]=a}else Hi(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Lt(a),A=!1}else Ms!==null&&(nu(Ms),Ms=null),A=!0;if(!A)return a.flags&65536?a:null}return(a.flags&128)!==0?(a.lanes=f,a):(b=b!==null,b!==(i!==null&&i.memoizedState!==null)&&b&&(a.child.flags|=8192,(a.mode&1)!==0&&(i===null||(Je.current&1)!==0?gt===0&&(gt=3):lu())),a.updateQueue!==null&&(a.flags|=4),Lt(a),null);case 4:return Ui(),Kh(i,a),i===null&&$n(a.stateNode.containerInfo),Lt(a),null;case 10:return bh(a.type._context),Lt(a),null;case 17:return Kt(a.type)&&ka(),Lt(a),null;case 19:if(Xe(Je),A=a.memoizedState,A===null)return Lt(a),null;if(b=(a.flags&128)!==0,I=A.rendering,I===null)if(b)Jn(A,!1);else{if(gt!==0||i!==null&&(i.flags&128)!==0)for(i=a.child;i!==null;){if(I=Oa(i),I!==null){for(a.flags|=128,Jn(A,!1),b=I.updateQueue,b!==null&&(a.updateQueue=b,a.flags|=4),a.subtreeFlags=0,b=f,f=a.child;f!==null;)A=f,i=b,A.flags&=14680066,I=A.alternate,I===null?(A.childLanes=0,A.lanes=i,A.child=null,A.subtreeFlags=0,A.memoizedProps=null,A.memoizedState=null,A.updateQueue=null,A.dependencies=null,A.stateNode=null):(A.childLanes=I.childLanes,A.lanes=I.lanes,A.child=I.child,A.subtreeFlags=0,A.deletions=null,A.memoizedProps=I.memoizedProps,A.memoizedState=I.memoizedState,A.updateQueue=I.updateQueue,A.type=I.type,i=I.dependencies,A.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),f=f.sibling;return qe(Je,Je.current&1|2),a.child}i=i.sibling}A.tail!==null&&at()>Ki&&(a.flags|=128,b=!0,Jn(A,!1),a.lanes=4194304)}else{if(!b)if(i=Oa(I),i!==null){if(a.flags|=128,b=!0,f=i.updateQueue,f!==null&&(a.updateQueue=f,a.flags|=4),Jn(A,!0),A.tail===null&&A.tailMode==="hidden"&&!I.alternate&&!Ze)return Lt(a),null}else 2*at()-A.renderingStartTime>Ki&&f!==1073741824&&(a.flags|=128,b=!0,Jn(A,!1),a.lanes=4194304);A.isBackwards?(I.sibling=a.child,a.child=I):(f=A.last,f!==null?f.sibling=I:a.child=I,A.last=I)}return A.tail!==null?(a=A.tail,A.rendering=a,A.tail=a.sibling,A.renderingStartTime=at(),a.sibling=null,f=Je.current,qe(Je,b?f&1|2:f&1),a):(Lt(a),null);case 22:case 23:return au(),b=a.memoizedState!==null,i!==null&&i.memoizedState!==null!==b&&(a.flags|=8192),b&&(a.mode&1)!==0?(as&1073741824)!==0&&(Lt(a),a.subtreeFlags&6&&(a.flags|=8192)):Lt(a),null;case 24:return null;case 25:return null}throw Error(s(156,a.tag))}function Kb(i,a){switch(gh(a),a.tag){case 1:return Kt(a.type)&&ka(),i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 3:return Ui(),Xe(qt),Xe(Rt),Ph(),i=a.flags,(i&65536)!==0&&(i&128)===0?(a.flags=i&-65537|128,a):null;case 5:return Mh(a),null;case 13:if(Xe(Je),i=a.memoizedState,i!==null&&i.dehydrated!==null){if(a.alternate===null)throw Error(s(340));Hi()}return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 19:return Xe(Je),null;case 4:return Ui(),null;case 10:return bh(a.type._context),null;case 22:case 23:return au(),null;case 24:return null;default:return null}}var Va=!1,Bt=!1,Yb=typeof WeakSet=="function"?WeakSet:Set,_e=null;function Gi(i,a){var f=i.ref;if(f!==null)if(typeof f=="function")try{f(null)}catch(b){it(i,a,b)}else f.current=null}function Yh(i,a,f){try{f()}catch(b){it(i,a,b)}}var vg=!1;function Xb(i,a){if(ah=ua,i=Xp(),Jc(i)){if("selectionStart"in i)var f={start:i.selectionStart,end:i.selectionEnd};else e:{f=(f=i.ownerDocument)&&f.defaultView||window;var b=f.getSelection&&f.getSelection();if(b&&b.rangeCount!==0){f=b.anchorNode;var k=b.anchorOffset,A=b.focusNode;b=b.focusOffset;try{f.nodeType,A.nodeType}catch{f=null;break e}var I=0,W=-1,G=-1,te=0,ce=0,ue=i,le=null;t:for(;;){for(var ge;ue!==f||k!==0&&ue.nodeType!==3||(W=I+k),ue!==A||b!==0&&ue.nodeType!==3||(G=I+b),ue.nodeType===3&&(I+=ue.nodeValue.length),(ge=ue.firstChild)!==null;)le=ue,ue=ge;for(;;){if(ue===i)break t;if(le===f&&++te===k&&(W=I),le===A&&++ce===b&&(G=I),(ge=ue.nextSibling)!==null)break;ue=le,le=ue.parentNode}ue=ge}f=W===-1||G===-1?null:{start:W,end:G}}else f=null}f=f||{start:0,end:0}}else f=null;for(lh={focusedElem:i,selectionRange:f},ua=!1,_e=a;_e!==null;)if(a=_e,i=a.child,(a.subtreeFlags&1028)!==0&&i!==null)i.return=a,_e=i;else for(;_e!==null;){a=_e;try{var ve=a.alternate;if((a.flags&1024)!==0)switch(a.tag){case 0:case 11:case 15:break;case 1:if(ve!==null){var ye=ve.memoizedProps,lt=ve.memoizedState,X=a.stateNode,q=X.getSnapshotBeforeUpdate(a.elementType===a.type?ye:Ts(a.type,ye),lt);X.__reactInternalSnapshotBeforeUpdate=q}break;case 3:var ee=a.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(a,a.return,de)}if(i=a.sibling,i!==null){i.return=a.return,_e=i;break}_e=a.return}return ve=vg,vg=!1,ve}function eo(i,a,f){var b=a.updateQueue;if(b=b!==null?b.lastEffect:null,b!==null){var k=b=b.next;do{if((k.tag&i)===i){var A=k.destroy;k.destroy=void 0,A!==void 0&&Yh(a,f,A)}k=k.next}while(k!==b)}}function Ga(i,a){if(a=a.updateQueue,a=a!==null?a.lastEffect:null,a!==null){var f=a=a.next;do{if((f.tag&i)===i){var b=f.create;f.destroy=b()}f=f.next}while(f!==a)}}function Xh(i){var a=i.ref;if(a!==null){var f=i.stateNode;switch(i.tag){case 5:i=f;break;default:i=f}typeof a=="function"?a(i):a.current=i}}function yg(i){var a=i.alternate;a!==null&&(i.alternate=null,yg(a)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(a=i.stateNode,a!==null&&(delete a[Hs],delete a[Wn],delete a[dh],delete a[Db],delete a[Lb])),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}function xg(i){return i.tag===5||i.tag===3||i.tag===4}function wg(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||xg(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function Qh(i,a,f){var b=i.tag;if(b===5||b===6)i=i.stateNode,a?f.nodeType===8?f.parentNode.insertBefore(i,a):f.insertBefore(i,a):(f.nodeType===8?(a=f.parentNode,a.insertBefore(i,f)):(a=f,a.appendChild(i)),f=f._reactRootContainer,f!=null||a.onclick!==null||(a.onclick=Sa));else if(b!==4&&(i=i.child,i!==null))for(Qh(i,a,f),i=i.sibling;i!==null;)Qh(i,a,f),i=i.sibling}function Zh(i,a,f){var b=i.tag;if(b===5||b===6)i=i.stateNode,a?f.insertBefore(i,a):f.appendChild(i);else if(b!==4&&(i=i.child,i!==null))for(Zh(i,a,f),i=i.sibling;i!==null;)Zh(i,a,f),i=i.sibling}var Tt=null,Ps=!1;function Pr(i,a,f){for(f=f.child;f!==null;)bg(i,a,f),f=f.sibling}function bg(i,a,f){if(Fs&&typeof Fs.onCommitFiberUnmount=="function")try{Fs.onCommitFiberUnmount(na,f)}catch{}switch(f.tag){case 5:Bt||Gi(f,a);case 6:var b=Tt,k=Ps;Tt=null,Pr(i,a,f),Tt=b,Ps=k,Tt!==null&&(Ps?(i=Tt,f=f.stateNode,i.nodeType===8?i.parentNode.removeChild(f):i.removeChild(f)):Tt.removeChild(f.stateNode));break;case 18:Tt!==null&&(Ps?(i=Tt,f=f.stateNode,i.nodeType===8?uh(i.parentNode,f):i.nodeType===1&&uh(i,f),Dn(i)):uh(Tt,f.stateNode));break;case 4:b=Tt,k=Ps,Tt=f.stateNode.containerInfo,Ps=!0,Pr(i,a,f),Tt=b,Ps=k;break;case 0:case 11:case 14:case 15:if(!Bt&&(b=f.updateQueue,b!==null&&(b=b.lastEffect,b!==null))){k=b=b.next;do{var A=k,I=A.destroy;A=A.tag,I!==void 0&&((A&2)!==0||(A&4)!==0)&&Yh(f,a,I),k=k.next}while(k!==b)}Pr(i,a,f);break;case 1:if(!Bt&&(Gi(f,a),b=f.stateNode,typeof b.componentWillUnmount=="function"))try{b.props=f.memoizedProps,b.state=f.memoizedState,b.componentWillUnmount()}catch(W){it(f,a,W)}Pr(i,a,f);break;case 21:Pr(i,a,f);break;case 22:f.mode&1?(Bt=(b=Bt)||f.memoizedState!==null,Pr(i,a,f),Bt=b):Pr(i,a,f);break;default:Pr(i,a,f)}}function Sg(i){var a=i.updateQueue;if(a!==null){i.updateQueue=null;var f=i.stateNode;f===null&&(f=i.stateNode=new Yb),a.forEach(function(b){var k=nS.bind(null,i,b);f.has(b)||(f.add(b),b.then(k,k))})}}function As(i,a){var f=a.deletions;if(f!==null)for(var b=0;b<f.length;b++){var k=f[b];try{var A=i,I=a,W=I;e:for(;W!==null;){switch(W.tag){case 5:Tt=W.stateNode,Ps=!1;break e;case 3:Tt=W.stateNode.containerInfo,Ps=!0;break e;case 4:Tt=W.stateNode.containerInfo,Ps=!0;break e}W=W.return}if(Tt===null)throw Error(s(160));bg(A,I,k),Tt=null,Ps=!1;var G=k.alternate;G!==null&&(G.return=null),k.return=null}catch(te){it(k,a,te)}}if(a.subtreeFlags&12854)for(a=a.child;a!==null;)Cg(a,i),a=a.sibling}function Cg(i,a){var f=i.alternate,b=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:if(As(a,i),Ws(i),b&4){try{eo(3,i,i.return),Ga(3,i)}catch(ye){it(i,i.return,ye)}try{eo(5,i,i.return)}catch(ye){it(i,i.return,ye)}}break;case 1:As(a,i),Ws(i),b&512&&f!==null&&Gi(f,f.return);break;case 5:if(As(a,i),Ws(i),b&512&&f!==null&&Gi(f,f.return),i.flags&32){var k=i.stateNode;try{Gt(k,"")}catch(ye){it(i,i.return,ye)}}if(b&4&&(k=i.stateNode,k!=null)){var A=i.memoizedProps,I=f!==null?f.memoizedProps:A,W=i.type,G=i.updateQueue;if(i.updateQueue=null,G!==null)try{W==="input"&&A.type==="radio"&&A.name!=null&&pt(k,A),Pc(W,I);var te=Pc(W,A);for(I=0;I<G.length;I+=2){var ce=G[I],ue=G[I+1];ce==="style"?op(k,ue):ce==="dangerouslySetInnerHTML"?Wr(k,ue):ce==="children"?Gt(k,ue):_(k,ce,ue,te)}switch(W){case"input":Se(k,A);break;case"textarea":mr(k,A);break;case"select":var le=k._wrapperState.wasMultiple;k._wrapperState.wasMultiple=!!A.multiple;var ge=A.value;ge!=null?Ns(k,!!A.multiple,ge,!1):le!==!!A.multiple&&(A.defaultValue!=null?Ns(k,!!A.multiple,A.defaultValue,!0):Ns(k,!!A.multiple,A.multiple?[]:"",!1))}k[Wn]=A}catch(ye){it(i,i.return,ye)}}break;case 6:if(As(a,i),Ws(i),b&4){if(i.stateNode===null)throw Error(s(162));k=i.stateNode,A=i.memoizedProps;try{k.nodeValue=A}catch(ye){it(i,i.return,ye)}}break;case 3:if(As(a,i),Ws(i),b&4&&f!==null&&f.memoizedState.isDehydrated)try{Dn(a.containerInfo)}catch(ye){it(i,i.return,ye)}break;case 4:As(a,i),Ws(i);break;case 13:As(a,i),Ws(i),k=i.child,k.flags&8192&&(A=k.memoizedState!==null,k.stateNode.isHidden=A,!A||k.alternate!==null&&k.alternate.memoizedState!==null||(tu=at())),b&4&&Sg(i);break;case 22:if(ce=f!==null&&f.memoizedState!==null,i.mode&1?(Bt=(te=Bt)||ce,As(a,i),Bt=te):As(a,i),Ws(i),b&8192){if(te=i.memoizedState!==null,(i.stateNode.isHidden=te)&&!ce&&(i.mode&1)!==0)for(_e=i,ce=i.child;ce!==null;){for(ue=_e=ce;_e!==null;){switch(le=_e,ge=le.child,le.tag){case 0:case 11:case 14:case 15:eo(4,le,le.return);break;case 1:Gi(le,le.return);var ve=le.stateNode;if(typeof ve.componentWillUnmount=="function"){b=le,f=le.return;try{a=b,ve.props=a.memoizedProps,ve.state=a.memoizedState,ve.componentWillUnmount()}catch(ye){it(b,f,ye)}}break;case 5:Gi(le,le.return);break;case 22:if(le.memoizedState!==null){Mg(ue);continue}}ge!==null?(ge.return=le,_e=ge):Mg(ue)}ce=ce.sibling}e:for(ce=null,ue=i;;){if(ue.tag===5){if(ce===null){ce=ue;try{k=ue.stateNode,te?(A=k.style,typeof A.setProperty=="function"?A.setProperty("display","none","important"):A.display="none"):(W=ue.stateNode,G=ue.memoizedProps.style,I=G!=null&&G.hasOwnProperty("display")?G.display:null,W.style.display=ta("display",I))}catch(ye){it(i,i.return,ye)}}}else if(ue.tag===6){if(ce===null)try{ue.stateNode.nodeValue=te?"":ue.memoizedProps}catch(ye){it(i,i.return,ye)}}else if((ue.tag!==22&&ue.tag!==23||ue.memoizedState===null||ue===i)&&ue.child!==null){ue.child.return=ue,ue=ue.child;continue}if(ue===i)break e;for(;ue.sibling===null;){if(ue.return===null||ue.return===i)break e;ce===ue&&(ce=null),ue=ue.return}ce===ue&&(ce=null),ue.sibling.return=ue.return,ue=ue.sibling}}break;case 19:As(a,i),Ws(i),b&4&&Sg(i);break;case 21:break;default:As(a,i),Ws(i)}}function Ws(i){var a=i.flags;if(a&2){try{e:{for(var f=i.return;f!==null;){if(xg(f)){var b=f;break e}f=f.return}throw Error(s(160))}switch(b.tag){case 5:var k=b.stateNode;b.flags&32&&(Gt(k,""),b.flags&=-33);var A=wg(i);Zh(i,A,k);break;case 3:case 4:var I=b.stateNode.containerInfo,W=wg(i);Qh(i,W,I);break;default:throw Error(s(161))}}catch(G){it(i,i.return,G)}i.flags&=-3}a&4096&&(i.flags&=-4097)}function Qb(i,a,f){_e=i,kg(i)}function kg(i,a,f){for(var b=(i.mode&1)!==0;_e!==null;){var k=_e,A=k.child;if(k.tag===22&&b){var I=k.memoizedState!==null||Va;if(!I){var W=k.alternate,G=W!==null&&W.memoizedState!==null||Bt;W=Va;var te=Bt;if(Va=I,(Bt=G)&&!te)for(_e=k;_e!==null;)I=_e,G=I.child,I.tag===22&&I.memoizedState!==null?Tg(k):G!==null?(G.return=I,_e=G):Tg(k);for(;A!==null;)_e=A,kg(A),A=A.sibling;_e=k,Va=W,Bt=te}Eg(i)}else(k.subtreeFlags&8772)!==0&&A!==null?(A.return=k,_e=A):Eg(i)}}function Eg(i){for(;_e!==null;){var a=_e;if((a.flags&8772)!==0){var f=a.alternate;try{if((a.flags&8772)!==0)switch(a.tag){case 0:case 11:case 15:Bt||Ga(5,a);break;case 1:var b=a.stateNode;if(a.flags&4&&!Bt)if(f===null)b.componentDidMount();else{var k=a.elementType===a.type?f.memoizedProps:Ts(a.type,f.memoizedProps);b.componentDidUpdate(k,f.memoizedState,b.__reactInternalSnapshotBeforeUpdate)}var A=a.updateQueue;A!==null&&Mm(a,A,b);break;case 3:var I=a.updateQueue;if(I!==null){if(f=null,a.child!==null)switch(a.child.tag){case 5:f=a.child.stateNode;break;case 1:f=a.child.stateNode}Mm(a,I,f)}break;case 5:var W=a.stateNode;if(f===null&&a.flags&4){f=W;var G=a.memoizedProps;switch(a.type){case"button":case"input":case"select":case"textarea":G.autoFocus&&f.focus();break;case"img":G.src&&(f.src=G.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(a.memoizedState===null){var te=a.alternate;if(te!==null){var ce=te.memoizedState;if(ce!==null){var ue=ce.dehydrated;ue!==null&&Dn(ue)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(s(163))}Bt||a.flags&512&&Xh(a)}catch(le){it(a,a.return,le)}}if(a===i){_e=null;break}if(f=a.sibling,f!==null){f.return=a.return,_e=f;break}_e=a.return}}function Mg(i){for(;_e!==null;){var a=_e;if(a===i){_e=null;break}var f=a.sibling;if(f!==null){f.return=a.return,_e=f;break}_e=a.return}}function Tg(i){for(;_e!==null;){var a=_e;try{switch(a.tag){case 0:case 11:case 15:var f=a.return;try{Ga(4,a)}catch(G){it(a,f,G)}break;case 1:var b=a.stateNode;if(typeof b.componentDidMount=="function"){var k=a.return;try{b.componentDidMount()}catch(G){it(a,k,G)}}var A=a.return;try{Xh(a)}catch(G){it(a,A,G)}break;case 5:var I=a.return;try{Xh(a)}catch(G){it(a,I,G)}}}catch(G){it(a,a.return,G)}if(a===i){_e=null;break}var W=a.sibling;if(W!==null){W.return=a.return,_e=W;break}_e=a.return}}var Zb=Math.ceil,qa=C.ReactCurrentDispatcher,Jh=C.ReactCurrentOwner,_s=C.ReactCurrentBatchConfig,Ne=0,wt=null,ut=null,Pt=0,as=0,qi=Cr(0),gt=0,to=null,Zr=0,Ka=0,eu=0,so=null,Xt=null,tu=0,Ki=1/0,or=null,Ya=!1,su=null,Ar=null,Xa=!1,Rr=null,Qa=0,ro=0,ru=null,Za=-1,Ja=0;function zt(){return(Ne&6)!==0?at():Za!==-1?Za:Za=at()}function Dr(i){return(i.mode&1)===0?1:(Ne&2)!==0&&Pt!==0?Pt&-Pt:Ib.transition!==null?(Ja===0&&(Ja=wp()),Ja):(i=ze,i!==0||(i=window.event,i=i===void 0?16:Ap(i.type)),i)}function Rs(i,a,f,b){if(50<ro)throw ro=0,ru=null,Error(s(185));Mn(i,f,b),((Ne&2)===0||i!==wt)&&(i===wt&&((Ne&2)===0&&(Ka|=f),gt===4&&Lr(i,Pt)),Qt(i,b),f===1&&Ne===0&&(a.mode&1)===0&&(Ki=at()+500,Ma&&Er()))}function Qt(i,a){var f=i.callbackNode;Iw(i,a);var b=la(i,i===wt?Pt:0);if(b===0)f!==null&&vp(f),i.callbackNode=null,i.callbackPriority=0;else if(a=b&-b,i.callbackPriority!==a){if(f!=null&&vp(f),a===1)i.tag===0?Bb(Ag.bind(null,i)):mm(Ag.bind(null,i)),Ab(function(){(Ne&6)===0&&Er()}),f=null;else{switch(bp(b)){case 1:f=Oc;break;case 4:f=yp;break;case 16:f=ia;break;case 536870912:f=xp;break;default:f=ia}f=Ng(f,Pg.bind(null,i))}i.callbackPriority=a,i.callbackNode=f}}function Pg(i,a){if(Za=-1,Ja=0,(Ne&6)!==0)throw Error(s(327));var f=i.callbackNode;if(Yi()&&i.callbackNode!==f)return null;var b=la(i,i===wt?Pt:0);if(b===0)return null;if((b&30)!==0||(b&i.expiredLanes)!==0||a)a=el(i,b);else{a=b;var k=Ne;Ne|=2;var A=Dg();(wt!==i||Pt!==a)&&(or=null,Ki=at()+500,ei(i,a));do try{tS();break}catch(W){Rg(i,W)}while(!0);wh(),qa.current=A,Ne=k,ut!==null?a=0:(wt=null,Pt=0,a=gt)}if(a!==0){if(a===2&&(k=jc(i),k!==0&&(b=k,a=iu(i,k))),a===1)throw f=to,ei(i,0),Lr(i,b),Qt(i,at()),f;if(a===6)Lr(i,b);else{if(k=i.current.alternate,(b&30)===0&&!Jb(k)&&(a=el(i,b),a===2&&(A=jc(i),A!==0&&(b=A,a=iu(i,A))),a===1))throw f=to,ei(i,0),Lr(i,b),Qt(i,at()),f;switch(i.finishedWork=k,i.finishedLanes=b,a){case 0:case 1:throw Error(s(345));case 2:ti(i,Xt,or);break;case 3:if(Lr(i,b),(b&130023424)===b&&(a=tu+500-at(),10<a)){if(la(i,0)!==0)break;if(k=i.suspendedLanes,(k&b)!==b){zt(),i.pingedLanes|=i.suspendedLanes&k;break}i.timeoutHandle=hh(ti.bind(null,i,Xt,or),a);break}ti(i,Xt,or);break;case 4:if(Lr(i,b),(b&4194240)===b)break;for(a=i.eventTimes,k=-1;0<b;){var I=31-ks(b);A=1<<I,I=a[I],I>k&&(k=I),b&=~A}if(b=k,b=at()-b,b=(120>b?120:480>b?480:1080>b?1080:1920>b?1920:3e3>b?3e3:4320>b?4320:1960*Zb(b/1960))-b,10<b){i.timeoutHandle=hh(ti.bind(null,i,Xt,or),b);break}ti(i,Xt,or);break;case 5:ti(i,Xt,or);break;default:throw Error(s(329))}}}return Qt(i,at()),i.callbackNode===f?Pg.bind(null,i):null}function iu(i,a){var f=so;return i.current.memoizedState.isDehydrated&&(ei(i,a).flags|=256),i=el(i,a),i!==2&&(a=Xt,Xt=f,a!==null&&nu(a)),i}function nu(i){Xt===null?Xt=i:Xt.push.apply(Xt,i)}function Jb(i){for(var a=i;;){if(a.flags&16384){var f=a.updateQueue;if(f!==null&&(f=f.stores,f!==null))for(var b=0;b<f.length;b++){var k=f[b],A=k.getSnapshot;k=k.value;try{if(!Es(A(),k))return!1}catch{return!1}}}if(f=a.child,a.subtreeFlags&16384&&f!==null)f.return=a,a=f;else{if(a===i)break;for(;a.sibling===null;){if(a.return===null||a.return===i)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function Lr(i,a){for(a&=~eu,a&=~Ka,i.suspendedLanes|=a,i.pingedLanes&=~a,i=i.expirationTimes;0<a;){var f=31-ks(a),b=1<<f;i[f]=-1,a&=~b}}function Ag(i){if((Ne&6)!==0)throw Error(s(327));Yi();var a=la(i,0);if((a&1)===0)return Qt(i,at()),null;var f=el(i,a);if(i.tag!==0&&f===2){var b=jc(i);b!==0&&(a=b,f=iu(i,b))}if(f===1)throw f=to,ei(i,0),Lr(i,a),Qt(i,at()),f;if(f===6)throw Error(s(345));return i.finishedWork=i.current.alternate,i.finishedLanes=a,ti(i,Xt,or),Qt(i,at()),null}function ou(i,a){var f=Ne;Ne|=1;try{return i(a)}finally{Ne=f,Ne===0&&(Ki=at()+500,Ma&&Er())}}function Jr(i){Rr!==null&&Rr.tag===0&&(Ne&6)===0&&Yi();var a=Ne;Ne|=1;var f=_s.transition,b=ze;try{if(_s.transition=null,ze=1,i)return i()}finally{ze=b,_s.transition=f,Ne=a,(Ne&6)===0&&Er()}}function au(){as=qi.current,Xe(qi)}function ei(i,a){i.finishedWork=null,i.finishedLanes=0;var f=i.timeoutHandle;if(f!==-1&&(i.timeoutHandle=-1,Pb(f)),ut!==null)for(f=ut.return;f!==null;){var b=f;switch(gh(b),b.tag){case 1:b=b.type.childContextTypes,b!=null&&ka();break;case 3:Ui(),Xe(qt),Xe(Rt),Ph();break;case 5:Mh(b);break;case 4:Ui();break;case 13:Xe(Je);break;case 19:Xe(Je);break;case 10:bh(b.type._context);break;case 22:case 23:au()}f=f.return}if(wt=i,ut=i=Br(i.current,null),Pt=as=a,gt=0,to=null,eu=Ka=Zr=0,Xt=so=null,Yr!==null){for(a=0;a<Yr.length;a++)if(f=Yr[a],b=f.interleaved,b!==null){f.interleaved=null;var k=b.next,A=f.pending;if(A!==null){var I=A.next;A.next=k,b.next=I}f.pending=b}Yr=null}return i}function Rg(i,a){do{var f=ut;try{if(wh(),ja.current=$a,Na){for(var b=et.memoizedState;b!==null;){var k=b.queue;k!==null&&(k.pending=null),b=b.next}Na=!1}if(Qr=0,xt=mt=et=null,Yn=!1,Xn=0,Jh.current=null,f===null||f.return===null){gt=1,to=a,ut=null;break}e:{var A=i,I=f.return,W=f,G=a;if(a=Pt,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 ge=sg(I);if(ge!==null){ge.flags&=-257,rg(ge,I,W,A,a),ge.mode&1&&tg(A,te,a),a=ge,G=te;var ve=a.updateQueue;if(ve===null){var ye=new Set;ye.add(G),a.updateQueue=ye}else ve.add(G);break e}else{if((a&1)===0){tg(A,te,a),lu();break e}G=Error(s(426))}}else if(Ze&&W.mode&1){var lt=sg(I);if(lt!==null){(lt.flags&65536)===0&&(lt.flags|=256),rg(lt,I,W,A,a),yh(Vi(G,W));break e}}A=G=Vi(G,W),gt!==4&&(gt=2),so===null?so=[A]:so.push(A),A=I;do{switch(A.tag){case 3:A.flags|=65536,a&=-a,A.lanes|=a;var X=Jm(A,G,a);Em(A,X);break e;case 1:W=G;var q=A.type,ee=A.stateNode;if((A.flags&128)===0&&(typeof q.getDerivedStateFromError=="function"||ee!==null&&typeof ee.componentDidCatch=="function"&&(Ar===null||!Ar.has(ee)))){A.flags|=65536,a&=-a,A.lanes|=a;var de=eg(A,W,a);Em(A,de);break e}}A=A.return}while(A!==null)}Bg(f)}catch(xe){a=xe,ut===f&&f!==null&&(ut=f=f.return);continue}break}while(!0)}function Dg(){var i=qa.current;return qa.current=$a,i===null?$a:i}function lu(){(gt===0||gt===3||gt===2)&&(gt=4),wt===null||(Zr&268435455)===0&&(Ka&268435455)===0||Lr(wt,Pt)}function el(i,a){var f=Ne;Ne|=2;var b=Dg();(wt!==i||Pt!==a)&&(or=null,ei(i,a));do try{eS();break}catch(k){Rg(i,k)}while(!0);if(wh(),Ne=f,qa.current=b,ut!==null)throw Error(s(261));return wt=null,Pt=0,gt}function eS(){for(;ut!==null;)Lg(ut)}function tS(){for(;ut!==null&&!Ew();)Lg(ut)}function Lg(i){var a=jg(i.alternate,i,as);i.memoizedProps=i.pendingProps,a===null?Bg(i):ut=a,Jh.current=null}function Bg(i){var a=i;do{var f=a.alternate;if(i=a.return,(a.flags&32768)===0){if(f=qb(f,a,as),f!==null){ut=f;return}}else{if(f=Kb(f,a),f!==null){f.flags&=32767,ut=f;return}if(i!==null)i.flags|=32768,i.subtreeFlags=0,i.deletions=null;else{gt=6,ut=null;return}}if(a=a.sibling,a!==null){ut=a;return}ut=a=i}while(a!==null);gt===0&&(gt=5)}function ti(i,a,f){var b=ze,k=_s.transition;try{_s.transition=null,ze=1,sS(i,a,f,b)}finally{_s.transition=k,ze=b}return null}function sS(i,a,f,b){do Yi();while(Rr!==null);if((Ne&6)!==0)throw Error(s(327));f=i.finishedWork;var k=i.finishedLanes;if(f===null)return null;if(i.finishedWork=null,i.finishedLanes=0,f===i.current)throw Error(s(177));i.callbackNode=null,i.callbackPriority=0;var A=f.lanes|f.childLanes;if(Ow(i,A),i===wt&&(ut=wt=null,Pt=0),(f.subtreeFlags&2064)===0&&(f.flags&2064)===0||Xa||(Xa=!0,Ng(ia,function(){return Yi(),null})),A=(f.flags&15990)!==0,(f.subtreeFlags&15990)!==0||A){A=_s.transition,_s.transition=null;var I=ze;ze=1;var W=Ne;Ne|=4,Jh.current=null,Xb(i,f),Cg(f,i),bb(lh),ua=!!ah,lh=ah=null,i.current=f,Qb(f),Mw(),Ne=W,ze=I,_s.transition=A}else i.current=f;if(Xa&&(Xa=!1,Rr=i,Qa=k),A=i.pendingLanes,A===0&&(Ar=null),Aw(f.stateNode),Qt(i,at()),a!==null)for(b=i.onRecoverableError,f=0;f<a.length;f++)k=a[f],b(k.value,{componentStack:k.stack,digest:k.digest});if(Ya)throw Ya=!1,i=su,su=null,i;return(Qa&1)!==0&&i.tag!==0&&Yi(),A=i.pendingLanes,(A&1)!==0?i===ru?ro++:(ro=0,ru=i):ro=0,Er(),null}function Yi(){if(Rr!==null){var i=bp(Qa),a=_s.transition,f=ze;try{if(_s.transition=null,ze=16>i?16:i,Rr===null)var b=!1;else{if(i=Rr,Rr=null,Qa=0,(Ne&6)!==0)throw Error(s(331));var k=Ne;for(Ne|=4,_e=i.current;_e!==null;){var A=_e,I=A.child;if((_e.flags&16)!==0){var W=A.deletions;if(W!==null){for(var G=0;G<W.length;G++){var te=W[G];for(_e=te;_e!==null;){var ce=_e;switch(ce.tag){case 0:case 11:case 15:eo(8,ce,A)}var ue=ce.child;if(ue!==null)ue.return=ce,_e=ue;else for(;_e!==null;){ce=_e;var le=ce.sibling,ge=ce.return;if(yg(ce),ce===te){_e=null;break}if(le!==null){le.return=ge,_e=le;break}_e=ge}}}var ve=A.alternate;if(ve!==null){var ye=ve.child;if(ye!==null){ve.child=null;do{var lt=ye.sibling;ye.sibling=null,ye=lt}while(ye!==null)}}_e=A}}if((A.subtreeFlags&2064)!==0&&I!==null)I.return=A,_e=I;else e:for(;_e!==null;){if(A=_e,(A.flags&2048)!==0)switch(A.tag){case 0:case 11:case 15:eo(9,A,A.return)}var X=A.sibling;if(X!==null){X.return=A.return,_e=X;break e}_e=A.return}}var q=i.current;for(_e=q;_e!==null;){I=_e;var ee=I.child;if((I.subtreeFlags&2064)!==0&&ee!==null)ee.return=I,_e=ee;else e:for(I=q;_e!==null;){if(W=_e,(W.flags&2048)!==0)try{switch(W.tag){case 0:case 11:case 15:Ga(9,W)}}catch(xe){it(W,W.return,xe)}if(W===I){_e=null;break e}var de=W.sibling;if(de!==null){de.return=W.return,_e=de;break e}_e=W.return}}if(Ne=k,Er(),Fs&&typeof Fs.onPostCommitFiberRoot=="function")try{Fs.onPostCommitFiberRoot(na,i)}catch{}b=!0}return b}finally{ze=f,_s.transition=a}}return!1}function Ig(i,a,f){a=Vi(f,a),a=Jm(i,a,1),i=Tr(i,a,1),a=zt(),i!==null&&(Mn(i,1,a),Qt(i,a))}function it(i,a,f){if(i.tag===3)Ig(i,i,f);else for(;a!==null;){if(a.tag===3){Ig(a,i,f);break}else if(a.tag===1){var b=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof b.componentDidCatch=="function"&&(Ar===null||!Ar.has(b))){i=Vi(f,i),i=eg(a,i,1),a=Tr(a,i,1),i=zt(),a!==null&&(Mn(a,1,i),Qt(a,i));break}}a=a.return}}function rS(i,a,f){var b=i.pingCache;b!==null&&b.delete(a),a=zt(),i.pingedLanes|=i.suspendedLanes&f,wt===i&&(Pt&f)===f&&(gt===4||gt===3&&(Pt&130023424)===Pt&&500>at()-tu?ei(i,0):eu|=f),Qt(i,a)}function Og(i,a){a===0&&((i.mode&1)===0?a=1:(a=aa,aa<<=1,(aa&130023424)===0&&(aa=4194304)));var f=zt();i=rr(i,a),i!==null&&(Mn(i,a,f),Qt(i,f))}function iS(i){var a=i.memoizedState,f=0;a!==null&&(f=a.retryLane),Og(i,f)}function nS(i,a){var f=0;switch(i.tag){case 13:var b=i.stateNode,k=i.memoizedState;k!==null&&(f=k.retryLane);break;case 19:b=i.stateNode;break;default:throw Error(s(314))}b!==null&&b.delete(a),Og(i,f)}var jg;jg=function(i,a,f){if(i!==null)if(i.memoizedProps!==a.pendingProps||qt.current)Yt=!0;else{if((i.lanes&f)===0&&(a.flags&128)===0)return Yt=!1,Gb(i,a,f);Yt=(i.flags&131072)!==0}else Yt=!1,Ze&&(a.flags&1048576)!==0&&gm(a,Pa,a.index);switch(a.lanes=0,a.tag){case 2:var b=a.type;Ua(i,a),i=a.pendingProps;var k=ji(a,Rt.current);Wi(a,f),k=Dh(null,a,b,i,k,f);var A=Lh();return a.flags|=1,typeof k=="object"&&k!==null&&typeof k.render=="function"&&k.$$typeof===void 0?(a.tag=1,a.memoizedState=null,a.updateQueue=null,Kt(b)?(A=!0,Ea(a)):A=!1,a.memoizedState=k.state!==null&&k.state!==void 0?k.state:null,kh(a),k.updater=za,a.stateNode=k,k._reactInternals=a,Fh(a,b,i,f),a=Wh(null,a,b,!0,A,f)):(a.tag=0,Ze&&A&&mh(a),$t(null,a,k,f),a=a.child),a;case 16:b=a.elementType;e:{switch(Ua(i,a),i=a.pendingProps,k=b._init,b=k(b._payload),a.type=b,k=a.tag=aS(b),i=Ts(b,i),k){case 0:a=zh(null,a,b,i,f);break e;case 1:a=cg(null,a,b,i,f);break e;case 11:a=ig(null,a,b,i,f);break e;case 14:a=ng(null,a,b,Ts(b.type,i),f);break e}throw Error(s(306,b,""))}return a;case 0:return b=a.type,k=a.pendingProps,k=a.elementType===b?k:Ts(b,k),zh(i,a,b,k,f);case 1:return b=a.type,k=a.pendingProps,k=a.elementType===b?k:Ts(b,k),cg(i,a,b,k,f);case 3:e:{if(hg(a),i===null)throw Error(s(387));b=a.pendingProps,A=a.memoizedState,k=A.element,km(i,a),Ia(a,b,null,f);var I=a.memoizedState;if(b=I.element,A.isDehydrated)if(A={element:b,isDehydrated:!1,cache:I.cache,pendingSuspenseBoundaries:I.pendingSuspenseBoundaries,transitions:I.transitions},a.updateQueue.baseState=A,a.memoizedState=A,a.flags&256){k=Vi(Error(s(423)),a),a=ug(i,a,b,f,k);break e}else if(b!==k){k=Vi(Error(s(424)),a),a=ug(i,a,b,f,k);break e}else for(os=Sr(a.stateNode.containerInfo.firstChild),ns=a,Ze=!0,Ms=null,f=Sm(a,null,b,f),a.child=f;f;)f.flags=f.flags&-3|4096,f=f.sibling;else{if(Hi(),b===k){a=nr(i,a,f);break e}$t(i,a,b,f)}a=a.child}return a;case 5:return Tm(a),i===null&&vh(a),b=a.type,k=a.pendingProps,A=i!==null?i.memoizedProps:null,I=k.children,ch(b,k)?I=null:A!==null&&ch(b,A)&&(a.flags|=32),lg(i,a),$t(i,a,I,f),a.child;case 6:return i===null&&vh(a),null;case 13:return dg(i,a,f);case 4:return Eh(a,a.stateNode.containerInfo),b=a.pendingProps,i===null?a.child=$i(a,null,b,f):$t(i,a,b,f),a.child;case 11:return b=a.type,k=a.pendingProps,k=a.elementType===b?k:Ts(b,k),ig(i,a,b,k,f);case 7:return $t(i,a,a.pendingProps,f),a.child;case 8:return $t(i,a,a.pendingProps.children,f),a.child;case 12:return $t(i,a,a.pendingProps.children,f),a.child;case 10:e:{if(b=a.type._context,k=a.pendingProps,A=a.memoizedProps,I=k.value,qe(Da,b._currentValue),b._currentValue=I,A!==null)if(Es(A.value,I)){if(A.children===k.children&&!qt.current){a=nr(i,a,f);break e}}else for(A=a.child,A!==null&&(A.return=a);A!==null;){var W=A.dependencies;if(W!==null){I=A.child;for(var G=W.firstContext;G!==null;){if(G.context===b){if(A.tag===1){G=ir(-1,f&-f),G.tag=2;var te=A.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}}A.lanes|=f,G=A.alternate,G!==null&&(G.lanes|=f),Sh(A.return,f,a),W.lanes|=f;break}G=G.next}}else if(A.tag===10)I=A.type===a.type?null:A.child;else if(A.tag===18){if(I=A.return,I===null)throw Error(s(341));I.lanes|=f,W=I.alternate,W!==null&&(W.lanes|=f),Sh(I,f,a),I=A.sibling}else I=A.child;if(I!==null)I.return=A;else for(I=A;I!==null;){if(I===a){I=null;break}if(A=I.sibling,A!==null){A.return=I.return,I=A;break}I=I.return}A=I}$t(i,a,k.children,f),a=a.child}return a;case 9:return k=a.type,b=a.pendingProps.children,Wi(a,f),k=ms(k),b=b(k),a.flags|=1,$t(i,a,b,f),a.child;case 14:return b=a.type,k=Ts(b,a.pendingProps),k=Ts(b.type,k),ng(i,a,b,k,f);case 15:return og(i,a,a.type,a.pendingProps,f);case 17:return b=a.type,k=a.pendingProps,k=a.elementType===b?k:Ts(b,k),Ua(i,a),a.tag=1,Kt(b)?(i=!0,Ea(a)):i=!1,Wi(a,f),Qm(a,b,k),Fh(a,b,k,f),Wh(null,a,b,!0,i,f);case 19:return pg(i,a,f);case 22:return ag(i,a,f)}throw Error(s(156,a.tag))};function Ng(i,a){return _p(i,a)}function oS(i,a,f,b){this.tag=i,this.key=f,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=b,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function vs(i,a,f,b){return new oS(i,a,f,b)}function cu(i){return i=i.prototype,!(!i||!i.isReactComponent)}function aS(i){if(typeof i=="function")return cu(i)?1:0;if(i!=null){if(i=i.$$typeof,i===U)return 11;if(i===re)return 14}return 2}function Br(i,a){var f=i.alternate;return f===null?(f=vs(i.tag,a,i.key,i.mode),f.elementType=i.elementType,f.type=i.type,f.stateNode=i.stateNode,f.alternate=i,i.alternate=f):(f.pendingProps=a,f.type=i.type,f.flags=0,f.subtreeFlags=0,f.deletions=null),f.flags=i.flags&14680064,f.childLanes=i.childLanes,f.lanes=i.lanes,f.child=i.child,f.memoizedProps=i.memoizedProps,f.memoizedState=i.memoizedState,f.updateQueue=i.updateQueue,a=i.dependencies,f.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},f.sibling=i.sibling,f.index=i.index,f.ref=i.ref,f}function tl(i,a,f,b,k,A){var I=2;if(b=i,typeof i=="function")cu(i)&&(I=1);else if(typeof i=="string")I=5;else e:switch(i){case R:return si(f.children,k,A,a);case P:I=8,k|=8;break;case L:return i=vs(12,f,a,k|2),i.elementType=L,i.lanes=A,i;case z:return i=vs(13,f,a,k),i.elementType=z,i.lanes=A,i;case Y:return i=vs(19,f,a,k),i.elementType=Y,i.lanes=A,i;case J:return sl(f,k,A,a);default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case j:I=10;break e;case $:I=9;break e;case U:I=11;break e;case re:I=14;break e;case Q:I=16,b=null;break e}throw Error(s(130,i==null?i:typeof i,""))}return a=vs(I,f,a,k),a.elementType=i,a.type=b,a.lanes=A,a}function si(i,a,f,b){return i=vs(7,i,b,a),i.lanes=f,i}function sl(i,a,f,b){return i=vs(22,i,b,a),i.elementType=J,i.lanes=f,i.stateNode={isHidden:!1},i}function hu(i,a,f){return i=vs(6,i,null,a),i.lanes=f,i}function uu(i,a,f){return a=vs(4,i.children!==null?i.children:[],i.key,a),a.lanes=f,a.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},a}function lS(i,a,f,b,k){this.tag=a,this.containerInfo=i,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Nc(0),this.expirationTimes=Nc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Nc(0),this.identifierPrefix=b,this.onRecoverableError=k,this.mutableSourceEagerHydrationData=null}function du(i,a,f,b,k,A,I,W,G){return i=new lS(i,a,f,W,G),a===1?(a=1,A===!0&&(a|=8)):a=0,A=vs(3,null,null,a),i.current=A,A.stateNode=i,A.memoizedState={element:b,isDehydrated:f,cache:null,transitions:null,pendingSuspenseBoundaries:null},kh(A),i}function cS(i,a,f){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:T,key:b==null?null:""+b,children:i,containerInfo:a,implementation:f}}function Fg(i){if(!i)return kr;i=i._reactInternals;e:{if(Ur(i)!==i||i.tag!==1)throw Error(s(170));var a=i;do{switch(a.tag){case 3:a=a.stateNode.context;break e;case 1:if(Kt(a.type)){a=a.stateNode.__reactInternalMemoizedMergedChildContext;break e}}a=a.return}while(a!==null);throw Error(s(171))}if(i.tag===1){var f=i.type;if(Kt(f))return fm(i,f,a)}return a}function Hg(i,a,f,b,k,A,I,W,G){return i=du(f,b,!0,i,k,A,I,W,G),i.context=Fg(null),f=i.current,b=zt(),k=Dr(f),A=ir(b,k),A.callback=a??null,Tr(f,A,k),i.current.lanes=k,Mn(i,k,b),Qt(i,b),i}function rl(i,a,f,b){var k=a.current,A=zt(),I=Dr(k);return f=Fg(f),a.context===null?a.context=f:a.pendingContext=f,a=ir(A,I),a.payload={element:i},b=b===void 0?null:b,b!==null&&(a.callback=b),i=Tr(k,a,I),i!==null&&(Rs(i,k,I,A),Ba(i,k,I)),I}function il(i){if(i=i.current,!i.child)return null;switch(i.child.tag){case 5:return i.child.stateNode;default:return i.child.stateNode}}function $g(i,a){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var f=i.retryLane;i.retryLane=f!==0&&f<a?f:a}}function fu(i,a){$g(i,a),(i=i.alternate)&&$g(i,a)}function hS(){return null}var zg=typeof reportError=="function"?reportError:function(i){console.error(i)};function pu(i){this._internalRoot=i}nl.prototype.render=pu.prototype.render=function(i){var a=this._internalRoot;if(a===null)throw Error(s(409));rl(i,a,null,null)},nl.prototype.unmount=pu.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var a=i.containerInfo;Jr(function(){rl(null,i,null,null)}),a[Js]=null}};function nl(i){this._internalRoot=i}nl.prototype.unstable_scheduleHydration=function(i){if(i){var a=kp();i={blockedOn:null,target:i,priority:a};for(var f=0;f<xr.length&&a!==0&&a<xr[f].priority;f++);xr.splice(f,0,i),f===0&&Tp(i)}};function mu(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function ol(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11&&(i.nodeType!==8||i.nodeValue!==" react-mount-point-unstable "))}function Wg(){}function uS(i,a,f,b,k){if(k){if(typeof b=="function"){var A=b;b=function(){var te=il(I);A.call(te)}}var I=Hg(a,b,i,0,null,!1,!1,"",Wg);return i._reactRootContainer=I,i[Js]=I.current,$n(i.nodeType===8?i.parentNode:i),Jr(),I}for(;k=i.lastChild;)i.removeChild(k);if(typeof b=="function"){var W=b;b=function(){var te=il(G);W.call(te)}}var G=du(i,0,!1,null,null,!1,!1,"",Wg);return i._reactRootContainer=G,i[Js]=G.current,$n(i.nodeType===8?i.parentNode:i),Jr(function(){rl(a,G,f,b)}),G}function al(i,a,f,b,k){var A=f._reactRootContainer;if(A){var I=A;if(typeof k=="function"){var W=k;k=function(){var G=il(I);W.call(G)}}rl(a,I,i,k)}else I=uS(f,a,i,k,b);return il(I)}Sp=function(i){switch(i.tag){case 3:var a=i.stateNode;if(a.current.memoizedState.isDehydrated){var f=En(a.pendingLanes);f!==0&&(Fc(a,f|1),Qt(a,at()),(Ne&6)===0&&(Ki=at()+500,Er()))}break;case 13:Jr(function(){var b=rr(i,1);if(b!==null){var k=zt();Rs(b,i,1,k)}}),fu(i,1)}},Hc=function(i){if(i.tag===13){var a=rr(i,134217728);if(a!==null){var f=zt();Rs(a,i,134217728,f)}fu(i,134217728)}},Cp=function(i){if(i.tag===13){var a=Dr(i),f=rr(i,a);if(f!==null){var b=zt();Rs(f,i,a,b)}fu(i,a)}},kp=function(){return ze},Ep=function(i,a){var f=ze;try{return ze=i,a()}finally{ze=f}},Dc=function(i,a,f){switch(a){case"input":if(Se(i,f),a=f.name,f.type==="radio"&&a!=null){for(f=i;f.parentNode;)f=f.parentNode;for(f=f.querySelectorAll("input[name="+JSON.stringify(""+a)+'][type="radio"]'),a=0;a<f.length;a++){var b=f[a];if(b!==i&&b.form===i.form){var k=Ca(b);if(!k)throw Error(s(90));fe(b),Se(b,k)}}}break;case"textarea":mr(i,f);break;case"select":a=f.value,a!=null&&Ns(i,!!f.multiple,a,!1)}},hp=ou,up=Jr;var dS={usingClientEntryPoint:!1,Events:[Un,Ii,Ca,lp,cp,ou]},io={findFiberByHostInstance:Vr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},fS={bundleType:io.bundleType,version:io.version,rendererPackageName:io.rendererPackageName,rendererConfig:io.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:C.ReactCurrentDispatcher,findHostInstanceByFiber:function(i){return i=mp(i),i===null?null:i.stateNode},findFiberByHostInstance:io.findFiberByHostInstance||hS,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 ll=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ll.isDisabled&&ll.supportsFiber)try{na=ll.inject(fS),Fs=ll}catch{}}return Zt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=dS,Zt.createPortal=function(i,a){var f=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!mu(a))throw Error(s(200));return cS(i,a,null,f)},Zt.createRoot=function(i,a){if(!mu(i))throw Error(s(299));var f=!1,b="",k=zg;return a!=null&&(a.unstable_strictMode===!0&&(f=!0),a.identifierPrefix!==void 0&&(b=a.identifierPrefix),a.onRecoverableError!==void 0&&(k=a.onRecoverableError)),a=du(i,1,!1,null,null,f,!1,b,k),i[Js]=a.current,$n(i.nodeType===8?i.parentNode:i),new pu(a)},Zt.findDOMNode=function(i){if(i==null)return null;if(i.nodeType===1)return i;var a=i._reactInternals;if(a===void 0)throw typeof i.render=="function"?Error(s(188)):(i=Object.keys(i).join(","),Error(s(268,i)));return i=mp(a),i=i===null?null:i.stateNode,i},Zt.flushSync=function(i){return Jr(i)},Zt.hydrate=function(i,a,f){if(!ol(a))throw Error(s(200));return al(null,i,a,!0,f)},Zt.hydrateRoot=function(i,a,f){if(!mu(i))throw Error(s(405));var b=f!=null&&f.hydratedSources||null,k=!1,A="",I=zg;if(f!=null&&(f.unstable_strictMode===!0&&(k=!0),f.identifierPrefix!==void 0&&(A=f.identifierPrefix),f.onRecoverableError!==void 0&&(I=f.onRecoverableError)),a=Hg(a,null,i,1,f??null,k,!1,A,I),i[Js]=a.current,$n(i),b)for(i=0;i<b.length;i++)f=b[i],k=f._getVersion,k=k(f._source),a.mutableSourceEagerHydrationData==null?a.mutableSourceEagerHydrationData=[f,k]:a.mutableSourceEagerHydrationData.push(f,k);return new nl(a)},Zt.render=function(i,a,f){if(!ol(a))throw Error(s(200));return al(null,i,a,!1,f)},Zt.unmountComponentAtNode=function(i){if(!ol(i))throw Error(s(40));return i._reactRootContainer?(Jr(function(){al(null,null,i,!1,function(){i._reactRootContainer=null,i[Js]=null})}),!0):!1},Zt.unstable_batchedUpdates=ou,Zt.unstable_renderSubtreeIntoContainer=function(i,a,f,b){if(!ol(f))throw Error(s(200));if(i==null||i._reactInternals===void 0)throw Error(s(38));return al(i,a,f,!1,b)},Zt.version="18.3.1-next-f1338f8080-20240426",Zt}var Qg;function SS(){if(Qg)return vu.exports;Qg=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(),vu.exports=bS(),vu.exports}var Zg;function CS(){if(Zg)return hl;Zg=1;var t=SS();return hl.createRoot=t.createRoot,hl.hydrateRoot=t.hydrateRoot,hl}var kS=CS();const ES="modulepreload",MS=function(t){return"/"+t},Jg={},Co=function(e,s,r){let n=Promise.resolve();if(s&&s.length>0){let c=function(u){return Promise.all(u.map(p=>Promise.resolve(p).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"));n=c(s.map(u=>{if(u=MS(u),u in Jg)return;Jg[u]=!0;const p=u.endsWith(".css"),d=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${d}`))return;const g=document.createElement("link");if(g.rel=p?"stylesheet":ES,p||(g.as="script"),g.crossOrigin="",g.href=u,h&&g.setAttribute("nonce",h),document.head.appendChild(g),p)return new Promise((w,S)=>{g.addEventListener("load",w),g.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${u}`)))})}))}function l(c){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=c,window.dispatchEvent(o),!o.defaultPrevented)throw c}return n.then(c=>{for(const o of c||[])o.status==="rejected"&&l(o.reason);return e().catch(l)})};var Oe=(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))(Oe||{});const gd=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},ul=(t,e)=>gd(t).priority??e,Mt={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...t){return t.map(gd).forEach(e=>{e.type.forEach(s=>{var r,n;return(n=(r=this._removeHandlers)[s])==null?void 0:n.call(r,e)})}),this},add(...t){return t.map(gd).forEach(e=>{e.type.forEach(s=>{var l,c;const r=this._addHandlers,n=this._queue;r[s]?(c=r[s])==null||c.call(r,e):(n[s]=n[s]||[],(l=n[s])==null||l.push(e))})}),this},handle(t,e,s){var c;const r=this._addHandlers,n=this._removeHandlers;if(r[t]||n[t])throw new Error(`Extension type ${t} already has a handler`);r[t]=e,n[t]=s;const l=this._queue;return l[t]&&((c=l[t])==null||c.forEach(o=>e(o)),delete l[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(l=>l.name===r.name)>=0||(e.push({name:r.name,value:r.ref}),e.sort((l,c)=>ul(c.value,s)-ul(l.value,s)))},r=>{const n=e.findIndex(l=>l.name===r.name);n!==-1&&e.splice(n,1)})},handleByList(t,e,s=-1){return this.handle(t,r=>{e.includes(r.ref)||(e.push(r.ref),e.sort((n,l)=>ul(l,s)-ul(n,s)))},r=>{const n=e.indexOf(r.ref);n!==-1&&e.splice(n,1)})},mixin(t,...e){for(const s of e)Object.defineProperties(t.prototype,Object.getOwnPropertyDescriptors(s))}},TS={extension:{type:Oe.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Co(()=>import("./browserAll-K-v47ayM.js"),__vite__mapDeps([0,1,2,3]))}},PS={extension:{type:Oe.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Co(()=>import("./webworkerAll-wf0zq30l.js"),__vite__mapDeps([1,2,3]))}};class Ot{constructor(e,s,r){this._x=s||0,this._y=r||0,this._observer=e}clone(e){return new Ot(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 wu={exports:{}},e_;function AS(){return e_||(e_=1,(function(t){var e=Object.prototype.hasOwnProperty,s="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(s=!1));function n(h,u,p){this.fn=h,this.context=u,this.once=p||!1}function l(h,u,p,d,g){if(typeof p!="function")throw new TypeError("The listener must be a function");var w=new n(p,d||h,g),S=s?s+u:u;return h._events[S]?h._events[S].fn?h._events[S]=[h._events[S],w]:h._events[S].push(w):(h._events[S]=w,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=[],p,d;if(this._eventsCount===0)return u;for(d in p=this._events)e.call(p,d)&&u.push(s?d.slice(1):d);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(p)):u},o.prototype.listeners=function(u){var p=s?s+u:u,d=this._events[p];if(!d)return[];if(d.fn)return[d.fn];for(var g=0,w=d.length,S=new Array(w);g<w;g++)S[g]=d[g].fn;return S},o.prototype.listenerCount=function(u){var p=s?s+u:u,d=this._events[p];return d?d.fn?1:d.length:0},o.prototype.emit=function(u,p,d,g,w,S){var y=s?s+u:u;if(!this._events[y])return!1;var m=this._events[y],v=arguments.length,x,_;if(m.fn){switch(m.once&&this.removeListener(u,m.fn,void 0,!0),v){case 1:return m.fn.call(m.context),!0;case 2:return m.fn.call(m.context,p),!0;case 3:return m.fn.call(m.context,p,d),!0;case 4:return m.fn.call(m.context,p,d,g),!0;case 5:return m.fn.call(m.context,p,d,g,w),!0;case 6:return m.fn.call(m.context,p,d,g,w,S),!0}for(_=1,x=new Array(v-1);_<v;_++)x[_-1]=arguments[_];m.fn.apply(m.context,x)}else{var C=m.length,M;for(_=0;_<C;_++)switch(m[_].once&&this.removeListener(u,m[_].fn,void 0,!0),v){case 1:m[_].fn.call(m[_].context);break;case 2:m[_].fn.call(m[_].context,p);break;case 3:m[_].fn.call(m[_].context,p,d);break;case 4:m[_].fn.call(m[_].context,p,d,g);break;default:if(!x)for(M=1,x=new Array(v-1);M<v;M++)x[M-1]=arguments[M];m[_].fn.apply(m[_].context,x)}}return!0},o.prototype.on=function(u,p,d){return l(this,u,p,d,!1)},o.prototype.once=function(u,p,d){return l(this,u,p,d,!0)},o.prototype.removeListener=function(u,p,d,g){var w=s?s+u:u;if(!this._events[w])return this;if(!p)return c(this,w),this;var S=this._events[w];if(S.fn)S.fn===p&&(!g||S.once)&&(!d||S.context===d)&&c(this,w);else{for(var y=0,m=[],v=S.length;y<v;y++)(S[y].fn!==p||g&&!S[y].once||d&&S[y].context!==d)&&m.push(S[y]);m.length?this._events[w]=m.length===1?m[0]:m:c(this,w)}return this},o.prototype.removeAllListeners=function(u){var p;return u?(p=s?s+u:u,this._events[p]&&c(this,p)):(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})(wu)),wu.exports}var RS=AS();const Qs=e0(RS),DS=Math.PI*2,LS=180/Math.PI,BS=Math.PI/180;class jt{constructor(e=0,s=0){this.x=0,this.y=0,this.x=e,this.y=s}clone(){return new jt(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 bu.x=0,bu.y=0,bu}}const bu=new jt;class Be{constructor(e=1,s=0,r=0,n=1,l=0,c=0){this.array=null,this.a=e,this.b=s,this.c=r,this.d=n,this.tx=l,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,n,l,c){return this.a=e,this.b=s,this.c=r,this.d=n,this.tx=l,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 jt;const r=e.x,n=e.y;return s.x=this.a*r+this.c*n+this.tx,s.y=this.b*r+this.d*n+this.ty,s}applyInverse(e,s){s=s||new jt;const r=this.a,n=this.b,l=this.c,c=this.d,o=this.tx,h=this.ty,u=1/(r*c+l*-n),p=e.x,d=e.y;return s.x=c*u*p+-l*u*d+(h*l-o*c)*u,s.y=r*u*d+-n*u*p+(-h*r+o*n)*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),n=this.a,l=this.c,c=this.tx;return this.a=n*s-this.b*r,this.b=n*r+this.b*s,this.c=l*s-this.d*r,this.d=l*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,n=this.c,l=this.d;return this.a=e.a*s+e.b*n,this.b=e.a*r+e.b*l,this.c=e.c*s+e.d*n,this.d=e.c*r+e.d*l,this.tx=e.tx*s+e.ty*n+this.tx,this.ty=e.tx*r+e.ty*l+this.ty,this}appendFrom(e,s){const r=e.a,n=e.b,l=e.c,c=e.d,o=e.tx,h=e.ty,u=s.a,p=s.b,d=s.c,g=s.d;return this.a=r*u+n*d,this.b=r*p+n*g,this.c=l*u+c*d,this.d=l*p+c*g,this.tx=o*u+h*d+s.tx,this.ty=o*p+h*g+s.ty,this}setTransform(e,s,r,n,l,c,o,h,u){return this.a=Math.cos(o+u)*l,this.b=Math.sin(o+u)*l,this.c=-Math.sin(o-h)*c,this.d=Math.cos(o-h)*c,this.tx=e-(r*this.a+n*this.c),this.ty=s-(r*this.b+n*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,n=this.c;this.a=r*e.a+this.b*e.c,this.b=r*e.b+this.b*e.d,this.c=n*e.a+this.d*e.c,this.d=n*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,n=this.c,l=this.d,c=e.pivot,o=-Math.atan2(-n,l),h=Math.atan2(r,s),u=Math.abs(o+h);let p=Math.sqrt(s*s+r*r);return u<1e-5||Math.abs(DS-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,p=-p):(e.rotation=0,e.skew.x=o,e.skew.y=h),e.scale.x=p,e.scale.y=Math.sqrt(n*n+l*l),e.position.x=this.tx+(c.x*s+c.y*n),e.position.y=this.ty+(c.x*r+c.y*l),e}invert(){const e=this.a,s=this.b,r=this.c,n=this.d,l=this.tx,c=e*n-s*r;return this.a=n/c,this.b=-s/c,this.c=-r/c,this.d=e/c,this.tx=(r*this.ty-n*l)/c,this.ty=-(e*this.ty-s*l)/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 Be;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 OS.identity()}static get shared(){return IS.identity()}}const IS=new Be,OS=new Be,ci=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],hi=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],ui=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],di=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],_d=[],t0=[],dl=Math.sign;function jS(){for(let t=0;t<16;t++){const e=[];_d.push(e);for(let s=0;s<16;s++){const r=dl(ci[t]*ci[s]+ui[t]*hi[s]),n=dl(hi[t]*ci[s]+di[t]*hi[s]),l=dl(ci[t]*ui[s]+ui[t]*di[s]),c=dl(hi[t]*ui[s]+di[t]*di[s]);for(let o=0;o<16;o++)if(ci[o]===r&&hi[o]===n&&ui[o]===l&&di[o]===c){e.push(o);break}}}for(let t=0;t<16;t++){const e=new Be;e.set(ci[t],hi[t],ui[t],di[t],0,0),t0.push(e)}}jS();const Ve={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=>ci[t],uY:t=>hi[t],vX:t=>ui[t],vY:t=>di[t],inv:t=>t&8?t&15:-t&7,add:(t,e)=>_d[t][e],sub:(t,e)=>_d[t][Ve.inv(e)],rotate180:t=>t^4,isVertical:t=>(t&3)===2,byDirection:(t,e)=>Math.abs(t)*2<=Math.abs(e)?e>=0?Ve.S:Ve.N:Math.abs(e)*2<=Math.abs(t)?t>0?Ve.E:Ve.W:e>0?t>0?Ve.SE:Ve.SW:t>0?Ve.NE:Ve.NW,matrixAppendRotationInv:(t,e,s=0,r=0,n=0,l=0)=>{const c=t0[Ve.inv(e)],o=c.a,h=c.b,u=c.c,p=c.d,d=s-Math.min(0,o*n,u*l,o*n+u*l),g=r-Math.min(0,h*n,p*l,h*n+p*l),w=t.a,S=t.b,y=t.c,m=t.d;t.a=o*w+h*y,t.b=o*S+h*m,t.c=u*w+p*y,t.d=u*S+p*m,t.tx=d*w+g*y+t.tx,t.ty=d*S+g*m+t.ty},transformRectCoords:(t,e,s,r)=>{const{x:n,y:l,width:c,height:o}=t,{x:h,y:u,width:p,height:d}=e;return s===Ve.E?(r.set(n+h,l+u,c,o),r):s===Ve.S?r.set(p-l-o+h,n+u,o,c):s===Ve.W?r.set(p-n-c+h,d-l-o+u,c,o):s===Ve.N?r.set(l+h,d-n-c+u,o,c):r.set(n+h,l+u,c,o)}},fl=[new jt,new jt,new jt,new jt];class Et{constructor(e=0,s=0,r=0,n=0){this.type="rectangle",this.x=Number(e),this.y=Number(s),this.width=Number(r),this.height=Number(n)}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 Et(0,0,0,0)}clone(){return new Et(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,n=.5){const{width:l,height:c}=this;if(l<=0||c<=0)return!1;const o=this.x,h=this.y,u=r*(1-n),p=r-u,d=o-u,g=o+l+u,w=h-u,S=h+c+u,y=o+p,m=o+l-p,v=h+p,x=h+c-p;return e>=d&&e<=g&&s>=w&&s<=S&&!(e>y&&e<m&&s>v&&s<x)}intersects(e,s){if(!s){const P=this.x<e.x?e.x:this.x;if((this.right>e.right?e.right:this.right)<=P)return!1;const j=this.y<e.y?e.y:this.y;return(this.bottom>e.bottom?e.bottom:this.bottom)>j}const r=this.left,n=this.right,l=this.top,c=this.bottom;if(n<=r||c<=l)return!1;const o=fl[0].set(e.left,e.top),h=fl[1].set(e.left,e.bottom),u=fl[2].set(e.right,e.top),p=fl[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(p,p),Math.max(o.x,h.x,u.x,p.x)<=r||Math.min(o.x,h.x,u.x,p.x)>=n||Math.max(o.y,h.y,u.y,p.y)<=l||Math.min(o.y,h.y,u.y,p.y)>=c))return!1;const g=d*(h.y-o.y),w=d*(o.x-h.x),S=g*r+w*l,y=g*n+w*l,m=g*r+w*c,v=g*n+w*c;if(Math.max(S,y,m,v)<=g*o.x+w*o.y||Math.min(S,y,m,v)>=g*p.x+w*p.y)return!1;const x=d*(o.y-u.y),_=d*(u.x-o.x),C=x*r+_*l,M=x*n+_*l,T=x*r+_*c,R=x*n+_*c;return!(Math.max(C,M,T,R)<=x*o.x+_*o.y||Math.min(C,M,T,R)>=x*p.x+_*p.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),n=Math.max(this.y,e.y),l=Math.min(this.y+this.height,e.y+e.height);return this.x=s,this.width=Math.max(r-s,0),this.y=n,this.height=Math.max(l-n,0),this}ceil(e=1,s=.001){const r=Math.ceil((this.x+this.width-s)*e)/e,n=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=n-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),n=Math.min(this.y,e.y),l=Math.max(this.y+this.height,e.y+e.height);return this.x=s,this.width=r-s,this.y=n,this.height=l-n,this}getBounds(e){return e||(e=new Et),e.copyFrom(this),e}containsRect(e){if(this.width<=0||this.height<=0)return!1;const s=e.x,r=e.y,n=e.x+e.width,l=e.y+e.height;return s>=this.x&&s<this.x+this.width&&r>=this.y&&r<this.y+this.height&&n>=this.x&&n<=this.x+this.width&&l>=this.y&&l<=this.y+this.height}set(e,s,r,n){return this.x=e,this.y=s,this.width=r,this.height=n,this}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}const Su={default:-1};function rt(t="default"){return Su[t]===void 0&&(Su[t]=-1),++Su[t]}const t_=new Set,vt="8.0.0",NS="8.3.4",Xi="8.21.0",FS="8.22.0",rn={quiet:!1,noColor:!1},Le=((t,e,s=3)=>{if(rn.quiet||t_.has(e))return;let r=new Error().stack;const n=`${e}
|
|
42
|
+
Deprecated since v${t}`,l=typeof console.groupCollapsed=="function"&&!rn.noColor;typeof r>"u"?console.warn("PixiJS Deprecation Warning: ",n):(r=r.split(`
|
|
43
|
+
`).splice(s).join(`
|
|
44
|
+
`),l?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",n),console.warn(r),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",n),console.warn(r))),t_.add(e)});Object.defineProperties(Le,{quiet:{get:()=>rn.quiet,set:t=>{rn.quiet=t},enumerable:!0,configurable:!1},noColor:{get:()=>rn.noColor,set:t=>{rn.noColor=t},enumerable:!0,configurable:!1}});const s0=()=>{};function HS(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 Vl(t){return!(t&t-1)&&!!t}function r0(t){const e={};for(const s in t)t[s]!==void 0&&(e[s]=t[s]);return e}const r_=Object.create(null);function $S(t){const e=r_[t];return e===void 0&&(r_[t]=rt("resource")),e}const i0=class n0 extends Qs{constructor(e={}){super(),this._resourceType="textureSampler",this._maxAnisotropy=1,this.destroyed=!1,e={...n0.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){Le(vt,"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=$S(e),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};i0.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};let ko=i0;const o0=class a0 extends Qs{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={...a0.defaultOptions,...e};const r=zS(e),n=r==="3d"||r==="1d"?r:"2d";WS(s,r,n),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=n,this.viewDimension=r,this.arrayLayerCount=e.arrayLayerCount,this.depth=n==="3d"?e.depth??1:1,this.mipLevelCount=e.mipLevelCount,this.autoGenerateMipmaps=e.autoGenerateMipmaps,this.sampleCount=e.sampleCount,this.antialias=n==="3d"?!1:e.antialias,this.transient=e.transient??!1,this.storage=e.storage??!1,this.alphaMode=e.alphaMode,this.style=new ko(r0(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 n=Math.round(e*r),l=Math.round(s*r);return this.width=n/r,this.height=l/r,this._resolution=r,this.pixelWidth===n&&this.pixelHeight===l?!1:(this._refreshPOT(),this.pixelWidth=n,this.pixelHeight=l,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=Vl(this.pixelWidth)&&Vl(this.pixelHeight)}static test(e){throw new Error("Unimplemented")}};o0.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",arrayLayerCount:1,mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};let hs=o0;function zS(t){return t.viewDimension?t.viewDimension:t.depth?"3d":t.arrayLayerCount>1?"2d-array":"2d"}function WS(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&&Le(FS,"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 rf extends hs{constructor(e){const s=e.depth??e.arrayLayerCount??1,r=e.resource||new Float32Array(e.width*e.height*s*4);let n=e.format;n||(r instanceof Float32Array?n="rgba32float":r instanceof Int32Array||r instanceof Uint32Array?n="rgba32uint":r instanceof Int16Array||r instanceof Uint16Array?n="rgba16uint":(r instanceof Int8Array,n="bgra8unorm"));const l=HS(n)||s>1;super({...l&&{alphaMode:"no-premultiply-alpha"},...e,resource:r,format:n}),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}}rf.extension=Oe.TextureSource;const i_=new Be;class US{constructor(e,s){this.mapCoord=new Be,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 n=0;n<e.length;n+=2){const l=e[n],c=e[n+1];s[n]=l*r.a+c*r.c+r.tx,s[n+1]=l*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,n=e.trim;n&&(i_.set(r.width/n.width,0,0,r.height/n.height,-n.x/n.width,-n.y/n.height),this.mapCoord.append(i_));const l=e.source,c=this.uClampFrame,o=this.clampMargin/l._resolution,h=this.clampOffset/l._resolution;return c[0]=(e.frame.x+o+h)/l.width,c[1]=(e.frame.y+o+h)/l.height,c[2]=(e.frame.x+e.frame.width-o+h)/l.width,c[3]=(e.frame.y+e.frame.height-o+h)/l.height,this.uClampOffset[0]=this.clampOffset/l.pixelWidth,this.uClampOffset[1]=this.clampOffset/l.pixelHeight,this.isSimple=e.frame.width===l.width&&e.frame.height===l.height&&e.rotate===0,!0}}class Ue extends Qs{constructor({source:e,label:s,frame:r,orig:n,trim:l,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 Et,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:p,height:d}=this._source;this.frame.width=p,this.frame.height=d}this.orig=n||this.frame,this.trim=l,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 US(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:n}=this._source,l=s.x/r,c=s.y/n,o=s.width/r,h=s.height/n;let u=this.rotate;if(u){const p=o/2,d=h/2,g=l+p,w=c+d;u=Ve.add(u,Ve.NW),e.x0=g+p*Ve.uX(u),e.y0=w+d*Ve.uY(u),u=Ve.add(u,2),e.x1=g+p*Ve.uX(u),e.y1=w+d*Ve.uY(u),u=Ve.add(u,2),e.x2=g+p*Ve.uX(u),e.y2=w+d*Ve.uY(u),u=Ve.add(u,2),e.x3=g+p*Ve.uX(u),e.y3=w+d*Ve.uY(u)}else e.x0=l,e.y0=c,e.x1=l+o,e.y1=c,e.x2=l+o,e.y2=c+h,e.x3=l,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 Le(vt,"Texture.baseTexture is now Texture.source"),this._source}}Ue.EMPTY=new Ue({label:"EMPTY",source:new hs({label:"EMPTY"})});Ue.EMPTY.destroy=s0;Ue.WHITE=new Ue({source:new rf({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});Ue.WHITE.destroy=s0;function VS(t,e,s){const{width:r,height:n}=s.orig,l=s.trim;if(l){const c=l.width,o=l.height;t.minX=l.x-e._x*r,t.maxX=t.minX+c,t.minY=l.y-e._y*n,t.maxY=t.minY+o}else t.minX=-e._x*r,t.maxX=t.minX+r,t.minY=-e._y*n,t.maxY=t.minY+n}const n_=new Be;class Os{constructor(e=1/0,s=1/0,r=-1/0,n=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=n_,this.minX=e,this.minY=s,this.maxX=r,this.maxY=n}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new Et);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=n_,this}set(e,s,r,n){this.minX=e,this.minY=s,this.maxX=r,this.maxY=n}addFrame(e,s,r,n,l){l||(l=this.matrix);const c=l.a,o=l.b,h=l.c,u=l.d,p=l.tx,d=l.ty;let g=this.minX,w=this.minY,S=this.maxX,y=this.maxY,m=c*e+h*s+p,v=o*e+u*s+d;m<g&&(g=m),v<w&&(w=v),m>S&&(S=m),v>y&&(y=v),m=c*r+h*s+p,v=o*r+u*s+d,m<g&&(g=m),v<w&&(w=v),m>S&&(S=m),v>y&&(y=v),m=c*e+h*n+p,v=o*e+u*n+d,m<g&&(g=m),v<w&&(w=v),m>S&&(S=m),v>y&&(y=v),m=c*r+h*n+p,v=o*r+u*n+d,m<g&&(g=m),v<w&&(w=v),m>S&&(S=m),v>y&&(y=v),this.minX=g,this.minY=w,this.maxX=S,this.maxY=y}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,n=this.maxX,l=this.maxY,{a:c,b:o,c:h,d:u,tx:p,ty:d}=e;let g=c*s+h*r+p,w=o*s+u*r+d;this.minX=g,this.minY=w,this.maxX=g,this.maxY=w,g=c*n+h*r+p,w=o*n+u*r+d,this.minX=g<this.minX?g:this.minX,this.minY=w<this.minY?w:this.minY,this.maxX=g>this.maxX?g:this.maxX,this.maxY=w>this.maxY?w:this.maxY,g=c*s+h*l+p,w=o*s+u*l+d,this.minX=g<this.minX?g:this.minX,this.minY=w<this.minY?w:this.minY,this.maxX=g>this.maxX?g:this.maxX,this.maxY=w>this.maxY?w:this.maxY,g=c*n+h*l+p,w=o*n+u*l+d,this.minX=g<this.minX?g:this.minX,this.minY=w<this.minY?w:this.minY,this.maxX=g>this.maxX?g:this.maxX,this.maxY=w>this.maxY?w: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,n){return this.minX<e&&(this.minX=e),this.maxX>s&&(this.maxX=s),this.minY<r&&(this.minY=r),this.maxY>n&&(this.maxY=n),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 Os(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,n){let l=this.minX,c=this.minY,o=this.maxX,h=this.maxY;n||(n=this.matrix);const u=n.a,p=n.b,d=n.c,g=n.d,w=n.tx,S=n.ty;for(let y=s;y<r;y+=2){const m=e[y],v=e[y+1],x=u*m+d*v+w,_=p*m+g*v+S;l=x<l?x:l,c=_<c?_:c,o=x>o?x:o,h=_>h?_:h}this.minX=l,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 GS={grad:.9,turn:360,rad:360/(2*Math.PI)},ar=function(t){return typeof t=="string"?t.length>0:typeof t=="number"},Ct=function(t,e,s){return e===void 0&&(e=0),s===void 0&&(s=Math.pow(10,e)),Math.round(s*t)/s+0},bs=function(t,e,s){return e===void 0&&(e=0),s===void 0&&(s=1),t>s?s:t>e?t:e},l0=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},o_=function(t){return{r:bs(t.r,0,255),g:bs(t.g,0,255),b:bs(t.b,0,255),a:bs(t.a)}},Cu=function(t){return{r:Ct(t.r),g:Ct(t.g),b:Ct(t.b),a:Ct(t.a,3)}},qS=/^#([0-9a-f]{3,8})$/i,pl=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},c0=function(t){var e=t.r,s=t.g,r=t.b,n=t.a,l=Math.max(e,s,r),c=l-Math.min(e,s,r),o=c?l===e?(s-r)/c:l===s?2+(r-e)/c:4+(e-s)/c:0;return{h:60*(o<0?o+6:o),s:l?c/l*100:0,v:l/255*100,a:n}},h0=function(t){var e=t.h,s=t.s,r=t.v,n=t.a;e=e/360*6,s/=100,r/=100;var l=Math.floor(e),c=r*(1-s),o=r*(1-(e-l)*s),h=r*(1-(1-e+l)*s),u=l%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:n}},a_=function(t){return{h:l0(t.h),s:bs(t.s,0,100),l:bs(t.l,0,100),a:bs(t.a)}},l_=function(t){return{h:Ct(t.h),s:Ct(t.s),l:Ct(t.l),a:Ct(t.a,3)}},c_=function(t){return h0((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},Eo=function(t){return{h:(e=c0(t)).h,s:(n=(200-(s=e.s))*(r=e.v)/100)>0&&n<200?s*r/100/(n<=100?n:200-n)*100:0,l:n/2,a:e.a};var e,s,r,n},KS=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,YS=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,XS=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,QS=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,vd={string:[[function(t){var e=qS.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?Ct(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?Ct(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=XS.exec(t)||QS.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:o_({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=KS.exec(t)||YS.exec(t);if(!e)return null;var s,r,n=a_({h:(s=e[1],r=e[2],r===void 0&&(r="deg"),Number(s)*(GS[r]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return c_(n)},"hsl"]],object:[[function(t){var e=t.r,s=t.g,r=t.b,n=t.a,l=n===void 0?1:n;return ar(e)&&ar(s)&&ar(r)?o_({r:Number(e),g:Number(s),b:Number(r),a:Number(l)}):null},"rgb"],[function(t){var e=t.h,s=t.s,r=t.l,n=t.a,l=n===void 0?1:n;if(!ar(e)||!ar(s)||!ar(r))return null;var c=a_({h:Number(e),s:Number(s),l:Number(r),a:Number(l)});return c_(c)},"hsl"],[function(t){var e=t.h,s=t.s,r=t.v,n=t.a,l=n===void 0?1:n;if(!ar(e)||!ar(s)||!ar(r))return null;var c=(function(o){return{h:l0(o.h),s:bs(o.s,0,100),v:bs(o.v,0,100),a:bs(o.a)}})({h:Number(e),s:Number(s),v:Number(r),a:Number(l)});return h0(c)},"hsv"]]},h_=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]},ZS=function(t){return typeof t=="string"?h_(t.trim(),vd.string):typeof t=="object"&&t!==null?h_(t,vd.object):[null,void 0]},ku=function(t,e){var s=Eo(t);return{h:s.h,s:bs(s.s+100*e,0,100),l:s.l,a:s.a}},Eu=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},u_=function(t,e){var s=Eo(t);return{h:s.h,s:s.s,l:bs(s.l+100*e,0,100),a:s.a}},yd=(function(){function t(e){this.parsed=ZS(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 Ct(Eu(this.rgba),2)},t.prototype.isDark=function(){return Eu(this.rgba)<.5},t.prototype.isLight=function(){return Eu(this.rgba)>=.5},t.prototype.toHex=function(){return e=Cu(this.rgba),s=e.r,r=e.g,n=e.b,c=(l=e.a)<1?pl(Ct(255*l)):"","#"+pl(s)+pl(r)+pl(n)+c;var e,s,r,n,l,c},t.prototype.toRgb=function(){return Cu(this.rgba)},t.prototype.toRgbString=function(){return e=Cu(this.rgba),s=e.r,r=e.g,n=e.b,(l=e.a)<1?"rgba("+s+", "+r+", "+n+", "+l+")":"rgb("+s+", "+r+", "+n+")";var e,s,r,n,l},t.prototype.toHsl=function(){return l_(Eo(this.rgba))},t.prototype.toHslString=function(){return e=l_(Eo(this.rgba)),s=e.h,r=e.s,n=e.l,(l=e.a)<1?"hsla("+s+", "+r+"%, "+n+"%, "+l+")":"hsl("+s+", "+r+"%, "+n+"%)";var e,s,r,n,l},t.prototype.toHsv=function(){return e=c0(this.rgba),{h:Ct(e.h),s:Ct(e.s),v:Ct(e.v),a:Ct(e.a,3)};var e},t.prototype.invert=function(){return Vs({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),Vs(ku(this.rgba,e))},t.prototype.desaturate=function(e){return e===void 0&&(e=.1),Vs(ku(this.rgba,-e))},t.prototype.grayscale=function(){return Vs(ku(this.rgba,-1))},t.prototype.lighten=function(e){return e===void 0&&(e=.1),Vs(u_(this.rgba,e))},t.prototype.darken=function(e){return e===void 0&&(e=.1),Vs(u_(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"?Vs({r:(s=this.rgba).r,g:s.g,b:s.b,a:e}):Ct(this.rgba.a,3);var s},t.prototype.hue=function(e){var s=Eo(this.rgba);return typeof e=="number"?Vs({h:e,s:s.s,l:s.l,a:s.a}):Ct(s.h)},t.prototype.isEqual=function(e){return this.toHex()===Vs(e).toHex()},t})(),Vs=function(t){return t instanceof yd?t:new yd(t)},d_=[],JS=function(t){t.forEach(function(e){d_.indexOf(e)<0&&(e(yd,vd),d_.push(e))})};function eC(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 n in s)r[s[n]]=n;var l={};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 p=this.toRgb(),d=1/0,g="black";if(!l.length)for(var w in s)l[w]=new t(s[w]).toRgb();for(var S in s){var y=(o=p,h=l[S],Math.pow(o.r-h.r,2)+Math.pow(o.g-h.g,2)+Math.pow(o.b-h.b,2));y<d&&(d=y,g=S)}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"])}JS([eC]);const un=class vo{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 vo)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((l,c)=>l===s[c]);if(e!==null&&s!==null){const l=Object.keys(e),c=Object.keys(s);return l.length!==c.length?!1:l.every(o=>e[o]===s[o])}return e===s}toRgba(){const[e,s,r,n]=this._components;return{r:e,g:s,b:r,a:n}}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,n]=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(n*255),e}toArray(e){this._arrayRgba||(this._arrayRgba=[]),e||(e=this._arrayRgba);const[s,r,n,l]=this._components;return e[0]=s,e[1]=r,e[2]=n,e[3]=l,e}toRgbArray(e){this._arrayRgb||(this._arrayRgb=[]),e||(e=this._arrayRgb);const[s,r,n]=this._components;return e[0]=s,e[1]=r,e[2]=n,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,n,l]=vo._temp.setValue(e)._components;return this._components[0]*=s,this._components[1]*=r,this._components[2]*=n,this._components[3]*=l,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,n=this._int>>8&255,l=this._int&255;return s&&(r=r*e+.5|0,n=n*e+.5|0,l=l*e+.5|0),(e*255<<24)+(r<<16)+(n<<8)+l}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,n,l;if((typeof e=="number"||e instanceof Number)&&e>=0&&e<=16777215){const c=e;s=(c>>16&255)/255,r=(c>>8&255)/255,n=(c&255)/255,l=1}else if((Array.isArray(e)||e instanceof Float32Array)&&e.length>=3&&e.length<=4)e=this._clamp(e),[s,r,n,l=1]=e;else if((e instanceof Uint8Array||e instanceof Uint8ClampedArray)&&e.length>=3&&e.length<=4)e=this._clamp(e,0,255),[s,r,n,l=255]=e,s/=255,r/=255,n/=255,l/=255;else if(typeof e=="string"||typeof e=="object"){if(typeof e=="string"){const o=vo.HEX_PATTERN.exec(e);o&&(e=`#${o[2]}`)}const c=Vs(e);c.isValid()&&({r:s,g:r,b:n,a:l}=c.rgba,s/=255,r/=255,n/=255)}if(s!==void 0)this._components[0]=s,this._components[1]=r,this._components[2]=n,this._components[3]=l,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((n,l)=>{e[l]=Math.min(Math.max(n,s),r)}),e)}static isColorLike(e){return typeof e=="number"||typeof e=="string"||e instanceof Number||e instanceof vo||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}};un.shared=new un;un._temp=new un;un.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let Ss=un;const tC={cullArea:null,cullable:!1,cullableChildren:!0};let Mu=0;const f_=500;function Ft(...t){Mu!==f_&&(Mu++,Mu===f_?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...t))}const pc={_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 sC{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 rC{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 sC(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 rC;pc.register(ts);const iC={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){Le("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(t)}};function nC(t,e,s){const r=t.length;let n;if(e>=r||s===0)return;s=e+s>r?r-e:s;const l=r-s;for(n=e;n<l;++n)t[n]=t[n+s];t.length=l}const oC={allowChildren:!0,removeChildren(t=0,e){var l;const s=e??this.children.length,r=s-t,n=[];if(r>0&&r<=s){for(let o=s-1;o>=t;o--){const h=this.children[o];h&&(n.push(h),h.parent=null)}nC(this.children,t,s);const c=this.renderGroup||this.parentRenderGroup;c&&c.removeChildren(n);for(let o=0;o<n.length;++o){const h=n[o];(l=h.parentRenderLayer)==null||l.detach(h),this.emit("childRemoved",h,this,o),n[o].emit("removed",this)}return n.length>0&&this._didViewChangeTick++,n}else if(r===0&&this.children.length===0)return n;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||Le(vt,"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 l=t.parent.children.indexOf(t);if(r){if(l===e)return t;t.parent.children.splice(l,1)}else t.removeFromParent()}e===s.length?s.push(t):s.splice(e,0,t);const n=this.renderGroup||this.parentRenderGroup;return this.sortableChildren&&(this.sortDirty=!0),r?(n&&(n.structureDidChange=!0),t):(t.parent=this,t.didChange=!0,t._updateFlags=15,n&&n.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 n=this.renderGroup||this.parentRenderGroup;n&&(n.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)}},aC={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,n=r.length;for(let l=0;l<n;l++)r[l].collectRenderables(t,e,s)},collectRenderablesWithEffects(t,e,s){const{renderPipes:r}=e;for(let n=0;n<this.effects.length;n++){const l=this.effects[n];r[l.pipe].push(l,this,t)}this.collectRenderablesSimple(t,e,s);for(let n=this.effects.length-1;n>=0;n--){const l=this.effects[n];r[l.pipe].pop(l,this,t)}}};class p_{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 lC{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 xd=new lC;Mt.handleByList(Oe.MaskEffect,xd._effectClasses);const cC={_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),xd.returnMaskEffect(e),this._maskEffect=null),t!=null&&(this._maskEffect=xd.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 l;!Array.isArray(t)&&t&&(t=[t]);const e=this._filterEffect||(this._filterEffect=new p_);t=t;const s=(t==null?void 0:t.length)>0,r=((l=e.filters)==null?void 0:l.length)>0,n=s!==r;t=Array.isArray(t)?t.slice(0):t,e.filters=Object.freeze(t),n&&(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 p_),this._filterEffect.filterArea=t},get filterArea(){var t;return(t=this._filterEffect)==null?void 0:t.filterArea}},hC={label:null,get name(){return Le(vt,"Container.name property has been removed, use Container.label instead"),this.label},set name(t){Le(vt,"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 n=s[r];if(n.label===t||t instanceof RegExp&&t.test(n.label))return n}if(e)for(let r=0;r<s.length;r++){const l=s[r].getChildByLabel(t,!0);if(l)return l}return null},getChildrenByLabel(t,e=!1,s=[]){const r=this.children;for(let n=0;n<r.length;n++){const l=r[n];(l.label===t||t instanceof RegExp&&t.test(l.label))&&s.push(l)}if(e)for(let n=0;n<r.length;n++)r[n].getChildrenByLabel(t,!0,s);return s}},Vt=ts.getPool(Be),lr=ts.getPool(Os),uC=new Be,dC={getFastGlobalBounds(t,e){e||(e=new Os),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 n=!!this.effects.length;if((this.renderGroup||n)&&(r=lr.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 l=this.children;for(let c=0;c<l.length;c++)l[c]._getGlobalBoundsRecursive(t,r,s)}if(n){let l=!1;const c=this.renderGroup||this.parentRenderGroup;for(let o=0;o<this.effects.length;o++)this.effects[o].addBounds&&(l||(l=!0,r.applyMatrix(c.worldTransform)),this.effects[o].addBounds(r,!0));l&&r.applyMatrix(c.worldTransform.copyTo(uC).invert()),e.addBounds(r),lr.return(r)}else this.renderGroup&&(e.addBounds(r,this.relativeGroupTransform),lr.return(r))}};function u0(t,e,s){s.clear();let r,n;return t.parent?e?r=t.parent.worldTransform:(n=Vt.get().identity(),r=nf(t,n)):r=Be.IDENTITY,d0(t,s,r,e),n&&Vt.return(n),s.isValid||s.set(0,0,0,0),s}function d0(t,e,s,r){var o,h;if(!t.visible||!t.measurable)return;let n;r?n=t.worldTransform:(t.updateLocalTransform(),n=Vt.get(),n.appendFrom(t.localTransform,s));const l=e,c=!!t.effects.length;if(c&&(e=lr.get().clear()),t.boundsArea)e.addRect(t.boundsArea,n);else{const u=t.bounds;u&&!u.isEmpty()&&(e.matrix=n,e.addBounds(u));for(let p=0;p<t.children.length;p++)d0(t.children[p],e,n,r)}if(c){for(let u=0;u<t.effects.length;u++)(h=(o=t.effects[u]).addBounds)==null||h.call(o,e);l.addBounds(e,Be.IDENTITY),lr.return(e)}r||Vt.return(n)}function nf(t,e){const s=t.parent;return s&&(nf(s,e),s.updateLocalTransform(),e.append(s.localTransform)),e}function f0(t,e){if(t===16777215||!e)return e;if(e===16777215||!t)return t;const s=t>>16&255,r=t>>8&255,n=t&255,l=e>>16&255,c=e>>8&255,o=e&255,h=s*l/255|0,u=r*c/255|0,p=n*o/255|0;return(h<<16)+(u<<8)+p}const m_=16777215;function g_(t,e){return t===m_?e:e===m_?t:f0(t,e)}function jl(t){return((t&255)<<16)+(t&65280)+(t>>16&255)}const fC={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 Be,e){if(e)return t.copyFrom(this.worldTransform);this.updateLocalTransform();const s=nf(this,Vt.get().identity());return t.appendFrom(this.localTransform,s),Vt.return(s),t},getGlobalTint(t){if(t)return this.renderGroup?jl(this.renderGroup.worldColor):this.parentRenderGroup?jl(g_(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let e=this.localColor,s=this.parent;for(;s;)e=g_(e,s.localColor),s=s.parent;return jl(e)}};function p0(t,e,s){return e.clear(),s||(s=Be.IDENTITY),m0(t,e,s,t,!0),e.isValid||e.set(0,0,0,0),e}function m0(t,e,s,r,n){var h,u;let l;if(n)l=Vt.get(),l=s.copyTo(l);else{if(!t.visible||!t.measurable)return;t.updateLocalTransform();const p=t.localTransform;l=Vt.get(),l.appendFrom(p,s)}const c=e,o=!!t.effects.length;if(o&&(e=lr.get().clear()),t.boundsArea)e.addRect(t.boundsArea,l);else{t.renderPipeId&&(e.matrix=l,e.addBounds(t.bounds));const p=t.children;for(let d=0;d<p.length;d++)m0(p[d],e,l,r,!1)}if(o){for(let p=0;p<t.effects.length;p++)(u=(h=t.effects[p]).addLocalBounds)==null||u.call(h,e,r);c.addBounds(e,Be.IDENTITY),lr.return(e)}Vt.return(l)}function g0(t,e){const s=t.children;for(let r=0;r<s.length;r++){const n=s[r],l=n.uid,c=(n._didViewChangeTick&65535)<<16|n._didContainerChangeTick&65535,o=e.index;(e.data[o]!==l||e.data[o+1]!==c)&&(e.data[e.index]=l,e.data[e.index+1]=c,e.didChange=!0),e.index=o+2,n.children.length&&g0(n,e)}return e.didChange}const pC=new Be,mC={_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 Os});const t=this._localBoundsCacheData;return t.index=1,t.didChange=!1,t.data[0]!==this._didViewChangeTick&&(t.didChange=!0,t.data[0]=this._didViewChangeTick),g0(this,t),t.didChange&&p0(this,t.localBounds,pC),t.localBounds},getBounds(t,e){return u0(this,t,e||new Os)}},gC={_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}},_C={_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(vC))}};function vC(t,e){return t._zIndex-e._zIndex}const yC={getGlobalPosition(t=new jt,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(Vt.get(),s);return e=r.apply(t,e),Vt.return(r),e},toLocal(t,e,s,r){e&&(t=e.toGlobal(t,s,r));const n=this.getGlobalTransform(Vt.get(),r);return s=n.applyInverse(t,s),Vt.return(n),s}};class of{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 xC{constructor(){this._screenSizes=new Map,this._widths=[],this._heights=[]}get size(){return this._screenSizes.size}set(e,s,r){const n=this._screenSizes.get(e);return n&&n.pixelWidth===s&&n.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 n=s[r];if(n>=e)return n}}_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 wC=0;const Tu=32767,bC=4294967296,SC=8589934592,__=Object.create(null);let CC=0;function kC(t){const e=__[t];return e!==void 0?e:__[t]=CC++}function EC(t,e,s,r,n,l){return(t<<17)+(e<<2)+((r?1:0)<<1)+(s?1:0)+(l==="nearest"?1:0)*bC+kC(n)*SC}class MC{constructor(e){this._buckets=new Map,this._poolKey=Object.create(null),this._poolStyle=Object.create(null),this._screens=new xC,this._enableFullScreen=!1,this.textureOptions=e||{}}get textureStyle(){return Le(Xi,"TexturePool.textureStyle is no longer used, pooled textures carry their own style. Pass scaleMode in the request instead."),this._textureStyle||(this._textureStyle=new ko(this.textureOptions)),this._textureStyle}set textureStyle(e){Le(Xi,"TexturePool.textureStyle is no longer used, pooled textures carry their own style. Pass scaleMode in the request instead."),this._textureStyle=e}get enableFullScreen(){return Le(Xi,"TexturePool.enableFullScreen is no longer used, the pool sizes textures to the screens registered with setScreenSize."),this._enableFullScreen}set enableFullScreen(e){Le(Xi,"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"&&(Le(Xi,"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,n=s.scaleMode??this.textureOptions.scaleMode??ko.defaultOptions.scaleMode,l=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:n});return new Ue({source:l,label:`texturePool_${wC++}`})}getOptimalTexture(...e){let s=e[0];typeof s=="number"&&(Le(Xi,"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,n=s.height,l=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??ko.defaultOptions.scaleMode,{width:p,height:d}=this.getOptimalSize(r,n,l);(p>Tu||d>Tu)&&Ft(`TexturePool: ${p}x${d} is larger than the ${Tu}px pool key limit, textures of this size may be pooled together`);const g=EC(p,d,c,o,h,u);let w=this._buckets.get(g);w||(w=[],this._buckets.set(g,w));let S=w.pop();return S||(S=this.createTexture({width:p,height:d,antialias:c,autoGenerateMipmaps:o,format:h,scaleMode:u}),this._poolStyle[S.uid]=S.source.style),S.source._resolution=l,S.source.width=p/l,S.source.height=d/l,S.source.pixelWidth=p,S.source.pixelHeight=d,S.frame.x=0,S.frame.y=0,S.frame.width=r,S.frame.height=n,S.updateUvs(),this._poolKey[S.uid]=g,S}getOptimalSize(e,s,r=1){const n=Math.ceil(e*r-1e-6),l=Math.ceil(s*r-1e-6),c=s_(n),o=this._screens.getFittingWidth(n),h=s_(l),u=this._screens.getFittingHeight(l);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,n=this._poolKey[r];if(n===void 0){Ft("TexturePool: returnTexture was passed a texture that did not come from this pool, ignoring it");return}const l=this._poolStyle[r];s&&e.source.style!==l&&(e.source.style=l);const c=this._buckets.get(n);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,n=r>>>17,l=r>>>2&32767;(Vl(n)||this._screens.hasWidth(n))&&(Vl(l)||this._screens.hasHeight(l))||(this._dropTextures(s,!0),this._buckets.delete(e))}}_dropTextures(e,s){for(let r=0;r<e.length;r++){const n=e[r];delete this._poolKey[n.uid],delete this._poolStyle[n.uid],s&&n.destroy(!0)}}clear(e){for(const s of this._buckets.values())this._dropTextures(s,e!==!1);this._buckets.clear()}}const _0=new MC;pc.register(_0);class TC{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new Be,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 of,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 n=s[r];n._updateFlags=15,this.addChild(n)}}enableCacheAsTexture(e={}){this.textureOptions=e,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(_0.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 n=0;n<r.length;n++)this._getChildren(r[n],s);return s}invalidateMatrices(){this._matrixDirty=7}get inverseWorldTransform(){return(this._matrixDirty&1)===0?this._inverseWorldTransform:(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new Be),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return(this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new Be),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 Be),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 PC(t,e,s={}){for(const r in e)!s[r]&&e[r]!==void 0&&(t[r]=e[r])}const Pu=new Ot(null),ml=new Ot(null),Au=new Ot(null,1,1),gl=new Ot(null),v_=1,AC=2,Ru=4;class Xs extends Qs{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 Be,this.relativeGroupTransform=new Be,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new Ot(this,0,0),this._scale=Au,this._pivot=ml,this._origin=gl,this._skew=Pu,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=[],PC(this,e,{children:!0,parent:!0,effects:!0}),(s=e.children)==null||s.forEach(n=>this.addChild(n)),(r=e.parent)==null||r.addChild(this)}static mixin(e){Le("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),Mt.mixin(Xs,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||Le(vt,"addChild: Only Containers will be allowed to add children in v8.0.0"),e.length>1){for(let n=0;n<e.length;n++)this.addChild(e[n]);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 n=0;n<e.length;n++)this.removeChild(e[n]);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(TC,this),this.groupTransform=Be.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 Be),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*LS}set angle(e){this.rotation=e*BS}get pivot(){return this._pivot===ml&&(this._pivot=new Ot(this,0,0)),this._pivot}set pivot(e){this._pivot===ml&&(this._pivot=new Ot(this,0,0),this._origin!==gl&&Ft("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===Pu&&(this._skew=new Ot(this,0,0)),this._skew}set skew(e){this._skew===Pu&&(this._skew=new Ot(this,0,0)),this._skew.copyFrom(e)}get scale(){return this._scale===Au&&(this._scale=new Ot(this,1,1)),this._scale}set scale(e){this._scale===Au&&(this._scale=new Ot(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===gl&&(this._origin=new Ot(this,0,0)),this._origin}set origin(e){this._origin===gl&&(this._origin=new Ot(this,0,0),this._pivot!==ml&&Ft("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,n=this._pivot,l=this._origin,c=this._position,o=r._x,h=r._y,u=n._x,p=n._y,d=-l._x,g=-l._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+p*s.c)+(d*s.a+g*s.c)-d,s.ty=c._y-(u*s.b+p*s.d)+(d*s.b+g*s.d)-g}set alpha(e){e!==this.localAlpha&&(this.localAlpha=e,this._updateFlags|=v_,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|=v_,this._onUpdate())}get tint(){return jl(this.localColor)}set blendMode(e){this.localBlendMode!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=AC,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|=Ru,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|=Ru,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|=Ru,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(e=!1){var n;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 l=0;l<s.length;++l)s[l].destroy(e);(n=this.renderGroup)==null||n.destroy(),this.renderGroup=null}}Mt.mixin(Xs,oC,dC,yC,gC,mC,cC,hC,_C,tC,iC,fC,aC);class v0 extends Xs{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 Os(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:n}=e;return r>=s.minX&&r<=s.maxX&&n>=s.minY&&n<=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:n}=s;n.blendMode.pushBlendMode(this,this.groupBlendMode,e);const c=n[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);n.blendMode.popBlendMode(e)}}class wi extends v0{constructor(e=Ue.EMPTY){e instanceof Ue&&(e={texture:e});const{texture:s=Ue.EMPTY,anchor:r,roundPixels:n,width:l,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 Ot({_onUpdate:()=>{this.onViewUpdate()}}),r?this.anchor=r:s.defaultAnchor&&(this.anchor=s.defaultAnchor),this.texture=s,this.allowChildren=!1,this.roundPixels=n??!1,l!==void 0&&(this.width=l),c!==void 0&&(this.height=c)}static from(e,s=!1){return e instanceof Ue?new wi(e):new wi(Ue.from(e,s))}set texture(e){e||(e=Ue.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 VS(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return Le("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){const e=this._anchor,s=this._texture,r=this._bounds,{width:n,height:l}=s.orig;r.minX=-e._x*n,r.maxX=r.minX+n,r.minY=-e._y*l,r.maxY=r.minY+l}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 RC=new Os;function y0(t,e,s){const r=RC;t.measurable=!0,u0(t,s,r),e.addBoundsMask(r),t.measurable=!1}function x0(t,e,s){const r=lr.get();t.measurable=!0;const n=Vt.get().identity(),l=w0(t,s,n);p0(t,r,l),t.measurable=!1,e.addBoundsMask(r),Vt.return(n),lr.return(r)}function w0(t,e,s){return t?(t!==e&&(w0(t.parent,e,s),t.updateLocalTransform(),s.append(t.localTransform)),s):(Ft("Mask bounds, renderable is not inside the root container"),s)}class b0{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 wi),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||y0(this.mask,e,s)}addLocalBounds(e,s){x0(this.mask,e,s)}containsPoint(e,s){const r=this.mask;return s(r,e)}destroy(){this.reset()}static test(e){return e instanceof wi}}b0.extension=Oe.MaskEffect;class S0{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"}}S0.extension=Oe.MaskEffect;class C0{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){y0(this.mask,e,s)}addLocalBounds(e,s){x0(this.mask,e,s)}containsPoint(e,s){const r=this.mask;return s(r,e)}destroy(){this.reset()}static test(e){return e instanceof Xs}}C0.extension=Oe.MaskEffect;const DC={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 y_=DC;const Nr={get(){return y_},set(t){y_=t}};class af extends hs{constructor(e){e.resource||(e.resource=Nr.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 n=super.resize(e,s,r);return n&&this.resizeCanvas(),n}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"))}}af.extension=Oe.TextureSource;class Gl 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}}Gl.extension=Oe.TextureSource;var ql=(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))(ql||{});class Du{constructor(e,s=null,r=0,n=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=e,this._context=s,this.priority=r,this._once=n}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 k0=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 Du(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=ql.NORMAL){return this._addListener(new Du(e,s,r))}addOnce(e,s,r=ql.NORMAL){return this._addListener(new Du(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 l=e-this._lastFrame|0;if(l<this._minElapsedMS)return;this._lastFrame=e-l%this._minElapsedMS}this.deltaMS=s,this.deltaTime=this.deltaMS*ls.targetFPMS;const r=this._head;let n=r.next;for(;n;)n=n.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}};k0.targetFPMS=.06;let nn=k0,Lu;async function LC(){return Lu??(Lu=(async()=>{var c;const e=Nr.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 n=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,n),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 l=new Uint8Array(4);return e.readPixels(0,0,1,1,e.RGBA,e.UNSIGNED_BYTE,l),e.deleteFramebuffer(n),e.deleteTexture(r),(c=e.getExtension("WEBGL_lose_context"))==null||c.loseContext(),l[0]<=l[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),Lu}const mc=class E0 extends hs{constructor(e){super(e),this.isReady=!1,this.uploadMethodId="video",e={...E0.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=nn.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 LC(),this._load=new Promise((r,n)=>{this.isValid?r(this):(this._resolve=r,this._reject=n,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&&(nn.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||(nn.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(nn.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(e){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement}};mc.extension=Oe.TextureSource;mc.defaultOptions={...hs.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};mc.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let BC=mc;const en=(t,e,s=!1)=>(Array.isArray(t)||(t=[t]),e?t.map(r=>typeof r=="string"||s?e(r):r):t);class IC{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||Ft(`[Assets] Asset id ${e} was not found in the Cache`),s}set(e,s){const r=en(e);let n;for(let h=0;h<this.parsers.length;h++){const u=this.parsers[h];if(u.test(s)){n=u.getCacheableAssets(r,s);break}}const l=new Map(Object.entries(n||{}));n||r.forEach(h=>{l.set(h,s)});const c=[...l.keys()],o={cacheKeys:c,keys:r};r.forEach(h=>{this._cacheMap.set(h,o)}),c.forEach(h=>{const u=n?n[h]:s;this._cache.has(h)&&this._cache.get(h)!==u&&Ft("[Cache] already has key:",h),this._cache.set(h,l.get(h))})}remove(e){if(!this._cacheMap.has(e)){Ft(`[Assets] Asset id ${e} was not found in the Cache`);return}const s=this._cacheMap.get(e);s.cacheKeys.forEach(n=>{this._cache.delete(n)}),s.keys.forEach(n=>{this._cacheMap.delete(n)})}get parsers(){return this._parsers}}const tn=new IC,wd=[];Mt.handleByList(Oe.TextureSource,wd);function M0(t={}){const e=t&&t.resource,s=e?t.resource:t,r=e?t:{resource:t};for(let n=0;n<wd.length;n++){const l=wd[n];if(l.test(s))return new l(r)}throw new Error(`Could not find a source type for resource: ${r.resource}`)}function OC(t={},e=!1){const s=t&&t.resource,r=s?t.resource:t,n=s?t:{resource:t};if(!e&&tn.has(r))return tn.get(r);const l=new Ue({source:M0(n)});return l.on("destroy",()=>{tn.has(r)&&tn.remove(r)}),e||tn.set(r,l),l}function jC(t,e=!1){return typeof t=="string"?tn.get(t):t instanceof hs?new Ue({source:t}):OC(t,e)}Ue.from=jC;hs.from=M0;Mt.add(b0,S0,C0,BC,Gl,af,rf);var T0=(t=>(t[t.Low=0]="Low",t[t.Normal=1]="Normal",t[t.High=2]="High",t))(T0||{});function Ds(t){if(typeof t!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(t)}`)}function oo(t){return t.split("?")[0].split("#")[0]}function NC(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function FC(t,e,s){return t.replace(new RegExp(NC(e),"g"),s)}function HC(t,e){let s="",r=0,n=-1,l=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(!(n===o-1||l===1))if(n!==o-1&&l===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("/")),n=o,l=0;continue}}else if(s.length===2||s.length===1){s="",r=0,n=o,l=0;continue}}}else s.length>0?s+=`/${t.slice(n+1,o)}`:s=t.slice(n+1,o),r=o-n-1;n=o,l=0}else c===46&&l!==-1?++l:l=-1}return s}const Io={toPosix(t){return FC(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=oo(this.toPosix(e??Nr.get().getBaseUrl())),n=oo(this.toPosix(s??this.rootname(r)));return t=this.toPosix(t),t.startsWith("/")?Io.join(n,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=HC(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 n=t[s-1]??"";this.joinExtensions.includes(this.extname(n).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,n=!0;const l=this.getProtocol(t),c=t;t=t.slice(l.length);for(let o=t.length-1;o>=1;--o)if(e=t.charCodeAt(o),e===47){if(!n){r=o;break}}else n=!1;return r===-1?s?"/":this.isUrl(c)?l+t:l:s&&r===1?"//":l+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=oo(this.toPosix(t));let s=0,r=-1,n=!0,l;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(l=t.length-1;l>=0;--l){const h=t.charCodeAt(l);if(h===47){if(!n){s=l+1;break}}else o===-1&&(n=!1,o=l+1),c>=0&&(h===e.charCodeAt(c)?--c===-1&&(r=l):(c=-1,r=o))}return s===r?r=o:r===-1&&(r=t.length),t.slice(s,r)}for(l=t.length-1;l>=0;--l)if(t.charCodeAt(l)===47){if(!n){s=l+1;break}}else r===-1&&(n=!1,r=l+1);return r===-1?"":t.slice(s,r)},extname(t){Ds(t),t=oo(this.toPosix(t));let e=-1,s=0,r=-1,n=!0,l=0;for(let c=t.length-1;c>=0;--c){const o=t.charCodeAt(c);if(o===47){if(!n){s=c+1;break}continue}r===-1&&(n=!1,r=c+1),o===46?e===-1?e=c:l!==1&&(l=1):e!==-1&&(l=-1)}return e===-1||r===-1||l===0||l===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=oo(this.toPosix(t));let s=t.charCodeAt(0);const r=this.isAbsolute(t);let n;e.root=this.rootname(t),r||this.hasProtocol(t)?n=1:n=0;let l=-1,c=0,o=-1,h=!0,u=t.length-1,p=0;for(;u>=n;--u){if(s=t.charCodeAt(u),s===47){if(!h){c=u+1;break}continue}o===-1&&(h=!1,o=u+1),s===46?l===-1?l=u:p!==1&&(p=1):l!==-1&&(p=-1)}return l===-1||o===-1||p===0||p===1&&l===o-1&&l===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,l),e.base=t.slice(1,o)):(e.name=t.slice(c,l),e.base=t.slice(c,o)),e.ext=t.slice(l,o)),e.dir=this.dirname(t),e},sep:"/",delimiter:":",joinExtensions:[".html"]};function P0(t,e,s,r,n){const l=e[s];for(let c=0;c<l.length;c++){const o=l[c];s<e.length-1?P0(t.replace(r[s],o),e,s+1,r,n):n.push(t.replace(r[s],o))}}function $C(t){const e=/\{(.*?)\}/g,s=t.match(e),r=[];if(s){const n=[];s.forEach(l=>{const c=l.substring(1,l.length-1).split(",");n.push(c)}),P0(t,n,0,s,r)}else r.push(t);return r}const x_=t=>!Array.isArray(t);class A0{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 en(s||r,l=>typeof l=="string"?l:Array.isArray(l)?l.map(c=>(c==null?void 0:c.src)??c):l!=null&&l.src?l.src:l,!0)}removeAlias(e,s){this._assetMap[e]&&(s&&s!==this._resolverHash[e]||(delete this._resolverHash[e],delete this._assetMap[e]))}addManifest(e){this._manifest&&Ft("[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 n=s;Array.isArray(s)||(n=Object.entries(s).map(([l,c])=>typeof c=="string"||Array.isArray(c)?{alias:l,src:c}:{alias:l,...c})),n.forEach(l=>{const c=l.src,o=l.alias;let h;if(typeof o=="string"){const u=this._createBundleAssetId(e,o);r.push(u),h=[o,u]}else{const u=o.map(p=>this._createBundleAssetId(e,p));r.push(...u),h=[...o,...u]}this.add({...l,alias:h,src:c})}),this._bundles[e]=r}add(e){const s=[];Array.isArray(e)?s.push(...e):s.push(e);let r;r=l=>{this.hasKey(l)&&Ft(`[Resolver] already has key: ${l} overwriting`)},en(s).forEach(l=>{const{src:c}=l;let{data:o,format:h,loadParser:u,parser:p}=l;const d=en(c).map(y=>typeof y=="string"?$C(y):Array.isArray(y)?y:[y]),g=this.getAlias(l);Array.isArray(g)?g.forEach(r):r(g);const w=[],S=y=>{const m=this._parsers.find(v=>v.test(y));return{src:y,...m==null?void 0:m.parse(y)}};d.forEach(y=>{y.forEach(m=>{let v={};if(typeof m!="object"?v=S(m):(o=m.data??o,h=m.format??h,(m.loadParser||m.parser)&&(u=m.loadParser??u,p=m.parser??p),v={...S(m.src),...m}),!g)throw new Error(`[Resolver] alias is undefined for this asset: ${v.src}`);v=this._buildResolvedAsset(v,{aliases:g,data:o,format:h,loadParser:u,parser:p,progressSize:l.progressSize}),w.push(v)})}),g.forEach(y=>{this._assetMap[y]=w})})}resolveBundle(e){const s=x_(e);e=en(e);const r={};return e.forEach(n=>{const l=this._bundles[n];if(l){const c=this.resolve(l),o={};for(const h in c){const u=c[h];o[this._extractAssetIdFromBundle(n,h)]=u}r[n]=o}}),s?r[e[0]]:r}resolveUrl(e){const s=this.resolve(e);if(typeof e!="string"){const r={};for(const n in s)r[n]=s[n].src;return r}return s.src}resolve(e){const s=x_(e);e=en(e);const r={};return e.forEach(n=>{if(!this._resolverHash[n])if(this._assetMap[n]){let l=this._assetMap[n];const c=this._getPreferredOrder(l);c==null||c.priority.forEach(o=>{c.params[o].forEach(h=>{const u=l.filter(p=>p[o]?p[o]===h:!1);u.length&&(l=u)})}),this._resolverHash[n]=l[0]}else this._resolverHash[n]=this._buildResolvedAsset({alias:[n],src:n},{});r[n]=this._resolverHash[n]}),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],n=this._preferredOrder.find(l=>l.params.format.includes(r.format));if(n)return n}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:n,loadParser:l,parser:c,format:o,progressSize:h}=s;return(this._basePath||this._rootPath)&&(e.src=Io.toAbsolute(e.src,this._basePath,this._rootPath)),e.alias=r??e.alias??[e.src],e.src=this._appendDefaultSearchParams(e.src),e.data={...n||{},...e.data},e.loadParser=l??e.loadParser,e.parser=c??e.parser,e.format=o??e.format??zC(e.src),h!==void 0&&(e.progressSize=h),e}}A0.RETINA_PREFIX=/@([0-9\.]+)x/;function zC(t){return t.split(".").pop().split("?").shift().split("#").shift()}const w_=(t,e)=>{const s=e.split("?")[1];return s&&(t+=`?${s}`),t},R0=class yo{constructor(e,s){this.linkedSheets=[];let r=e;(e==null?void 0:e.source)instanceof hs&&(r={texture:e,data:s});const{texture:n,data:l,cachePrefix:c=""}=r;this.cachePrefix=c,this._texture=n instanceof Ue?n:null,this.textureSource=n.source,this.textures={},this.animations={},this.data=l;const o=parseFloat(l.meta.scale);o?(this.resolution=o,n.source.resolution=this.resolution):this.resolution=n.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<=yo.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 n=s?1/0:yo.BATCH_SIZE;for(;r-e<n&&r<this._frameKeys.length;){const l=this._frameKeys[r],c=this._frames[l],o=c.frame;if(o){let h=null,u=null;const p=c.trimmed!==!1&&c.sourceSize?c.sourceSize:c.frame,d=new Et(0,0,Math.floor(p.w)/this.resolution,Math.floor(p.h)/this.resolution);c.rotated?h=new Et(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 Et(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 Et(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[l]=new Ue({source:this.textureSource,frame:h,orig:d,trim:u,rotate:c.rotated?2:0,defaultAnchor:c.anchor,defaultBorders:c.borders,label:l.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 n=e[s][r];this.animations[s].push(this.textures[n])}}}_parseComplete(){const e=this._callback;this._callback=null,this._batchIndex=0,e.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*yo.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*yo.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 b_=R0;const WC=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];function D0(t,e,s){const r={};if(t.forEach(n=>{r[n]=e}),Object.keys(e.textures).forEach(n=>{r[`${e.cachePrefix}${n}`]=e.textures[n]}),!s){const n=Io.dirname(t[0]);e.linkedSheets.forEach((l,c)=>{const o=D0([`${n}/${e.data.meta.related_multi_packs[c]}`],l,!0);Object.assign(r,o)})}return r}const UC={extension:Oe.Asset,cache:{test:t=>t instanceof b_,getCacheableAssets:(t,e)=>D0(t,e,!1)},resolver:{extension:{type:Oe.ResolveParser,name:"resolveSpritesheet"},test:t=>{const s=t.split("?")[0].split("."),r=s.pop(),n=s.pop();return r==="json"&&WC.includes(n)},parse:t=>{var s;const e=t.split(".");return{resolution:parseFloat(((s=A0.RETINA_PREFIX.exec(t))==null?void 0:s[1])??"1"),format:e[e.length-2],src:t}}},loader:{name:"spritesheetLoader",id:"spritesheet",extension:{type:Oe.LoadParser,priority:T0.Normal,name:"spritesheetLoader"},async testParse(t,e){return Io.extname(e.src).toLowerCase()===".json"&&!!t.frames},async parse(t,e,s){var d,g;const{texture:r,imageFilename:n,textureOptions:l,cachePrefix:c}=(e==null?void 0:e.data)??{};let o=Io.dirname(e.src);o&&o.lastIndexOf("/")!==o.length-1&&(o+="/");let h;if(r instanceof Ue)h=r;else{const w=w_(o+(n??t.meta.image),e.src);h=(await s.load([{src:w,data:l}]))[w]}const u=new b_({texture:h.source,data:t,cachePrefix:c});await u.parse();const p=(d=t==null?void 0:t.meta)==null?void 0:d.related_multi_packs;if(Array.isArray(p)){const w=[];for(const y of p){if(typeof y!="string")continue;let m=o+y;(g=e.data)!=null&&g.ignoreMultiPack||(m=w_(m,e.src),w.push(s.load({src:m,data:{textureOptions:l,ignoreMultiPack:!0}})))}const S=await Promise.all(w);u.linkedSheets=S,S.forEach(y=>{y.linkedSheets=[u].concat(u.linkedSheets.filter(m=>m!==y))})}return u},async unload(t,e,s){await s.unload(t.textureSource._sourceOrigin),t.destroy(!1)}}};Mt.add(UC);const Bu=Object.create(null),S_=Object.create(null);function gc(t,e){let s=S_[t];return s===void 0&&(Bu[e]===void 0&&(Bu[e]=1),S_[t]=s=Bu[e]++),s}let Qi;function L0(){return(!Qi||Qi!=null&&Qi.isContextLost())&&(Qi=Nr.get().createCanvas().getContext("webgl",{})),Qi}let _l;function VC(){if(!_l){_l="mediump";const t=L0();t&&t.getShaderPrecisionFormat&&(_l=t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision?"highp":"mediump")}return _l}function GC(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 qC=/\buniform\s+([iu]?sampler\w+)/g,KC=/\bprecision\s+\w+\s+([iu]?sampler\w+)\s*;/g,YC={sampler2D:"lowp",samplerCube:"lowp"};function XC(t,e,s){const r=s?e.maxSupportedFragmentPrecision:e.maxSupportedVertexPrecision;if(t.substring(0,9)!=="precision"){let l=s?e.requestedFragmentPrecision:e.requestedVertexPrecision;l==="highp"&&r!=="highp"&&(l="mediump"),t=`precision ${l} float;
|
|
60
|
+
${t}`}else r!=="highp"&&t.substring(0,15)==="precision highp"&&(t=t.replace("precision highp","precision mediump"));const n=e.maxSupportedFragmentPrecision==="highp"?"highp":"mediump";return QC(t,n)}function QC(t,e){const s=new Set;let r="";for(const[,n]of t.matchAll(KC))s.add(n);for(const[,n]of t.matchAll(qC))s.has(n)||(s.add(n),r+=`precision ${YC[n]??e} ${n};
|
|
61
|
+
`);return r+t}function ZC(t,e){return e?`#version 300 es
|
|
62
|
+
${t}`:t}const JC={},ek={};function tk(t,{name:e="pixi-program"},s=!0){e=e.replace(/\s+/g,"-"),e+=s?"-fragment":"-vertex";const r=s?JC:ek;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 sk(t,e){return e?t.replace("#version 300 es",""):t}const Iu={stripVersion:sk,ensurePrecision:XC,addProgramDefines:GC,setProgramName:tk,insertVersion:ZC},ao=Object.create(null),B0=class bd{constructor(e){e={...bd.defaultOptions,...e};const s=e.fragment.indexOf("#version 300 es")!==-1,r={stripVersion:s,ensurePrecision:{requestedFragmentPrecision:e.preferredFragmentPrecision,requestedVertexPrecision:e.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:VC()},setProgramName:{name:e.name},addProgramDefines:s,insertVersion:s};let n=e.fragment,l=e.vertex;Object.keys(Iu).forEach(c=>{const o=r[c];n=Iu[c](n,o,!0),l=Iu[c](l,o,!1)}),this.fragment=n,this.vertex=l,this.transformFeedbackVaryings=e.transformFeedbackVaryings,this._key=gc(`${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,ao[this._cacheKey]=null}static from(e){const s=`${e.vertex}:${e.fragment}`;return ao[s]||(ao[s]=new bd(e),ao[s]._cacheKey=s),ao[s]}};B0.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};let I0=B0;const C_={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 rk(t){return C_[t]??C_.float32}const ik={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"},k_=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|\)|$)/g;function E_(t,e){let s;for(;(s=k_.exec(t))!==null;){const r=ik[s[3]]??"float32";e[s[2]]={location:parseInt(s[1],10),format:r,stride:rk(r).stride,offset:0,instance:!1,start:0}}k_.lastIndex=0}function nk(t){return t.replace(/\/\/.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"")}function ok({source:t,entryPoint:e}){const s={},r=nk(t),n=r.indexOf(`fn ${e}(`);if(n===-1)return s;const l=r.indexOf("->",n);if(l===-1)return s;const c=r.substring(n,l);if(E_(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"),p=r.match(u);p&&E_(p[1],s)}}return s}function Ou(t){var d,g;const e=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,s=/@group\((\d+)\)/,r=/@binding\((\d+)\)/,n=/var(<[^>]+>)? (\w+)/,l=/:\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(w=>{const S=w.match(n),y=(S==null?void 0:S[1])??"";let m;return y==="<uniform>"?m="uniform":y.startsWith("<storage")&&(m="storage"),{group:parseInt(w.match(s)[1],10),binding:parseInt(w.match(r)[1],10),name:S[2],accessMode:m,type:w.match(l)[1]}});if(!u)return{groups:[],structs:[]};const p=((g=t.match(c))==null?void 0:g.map(w=>{const S=w.match(h)[1],y=w.match(o).reduce((m,v)=>{const[x,_]=v.split(":");return m[x.trim()]=_.trim(),m},{});return y?{name:S,members:y}:null}).filter(({name:w})=>u.some(S=>S.type===w||S.type.includes(`<${w}>`))))??[];return{groups:u,structs:p}}var ct=(t=>(t[t.VERTEX=1]="VERTEX",t[t.FRAGMENT=2]="FRAGMENT",t[t.COMPUTE=4]="COMPUTE",t))(ct||{});function vl(t){return t.endsWith("<u32>")?"uint":t.endsWith("<i32>")?"sint":"float"}function ak({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:vl(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:vl(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:vl(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:vl(r.type),viewDimension:"cube",multisampled:!1}})}for(let s=0;s<e.length;s++)e[s]||(e[s]=[]);return e}function lk({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 ck(t,e){const s=new Set,r=new Set,n=[...t.structs,...e.structs].filter(c=>s.has(c.name)?!1:(s.add(c.name),!0)),l=[...t.groups,...e.groups].filter(c=>{const o=`${c.name}-${c.binding}`;return r.has(o)?!1:(r.add(o),!0)});return{structs:n,groups:l}}const lo=Object.create(null);class _c{constructor(e){var o,h;this._layoutKey=0,this._attributeLocationsKey=0;const{fragment:s,vertex:r,layout:n,gpuLayout:l,name:c}=e;if(this.name=c,this.fragment=s,this.vertex=r,s.source===r.source){const u=Ou(s.source);this.structsAndGroups=u}else{const u=Ou(r.source),p=Ou(s.source);this.structsAndGroups=ck(u,p)}this.layout=n??lk(this.structsAndGroups),this.gpuLayout=l??ak(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=gc(r,"program")}get attributeData(){return this._attributeData??(this._attributeData=ok(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null,lo[this._cacheKey]=null}static from(e){const s=`${e.vertex.source}:${e.fragment.source}:${e.fragment.entryPoint}:${e.vertex.entryPoint}`;return lo[s]||(lo[s]=new _c(e),lo[s]._cacheKey=s),lo[s]}}const O0=["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>"],hk=O0.reduce((t,e)=>(t[e]=!0,t),{});function uk(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 j0=class N0 extends Qs{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={...N0.defaultOptions,...s},this.uniformStructures=e;const r={};for(const n in e){const l=e[n];if(l.name=n,l.size=l.size??1,!hk[l.type]){const c=l.type.match(/^array<(\w+(?:<\w+>)?),\s*(\d+)>$/);if(c){const[,o,h]=c;throw new Error(`Uniform type ${l.type} is not supported. Use type: '${o}', size: ${h} instead.`)}throw new Error(`Uniform type ${l.type} is not supported. Supported uniform types are: ${O0.join(", ")}`)}l.value??(l.value=uk(l.type,l.size)),r[n]=l.value}this.uniforms=r,this._dirtyId=1,this.ubo=s.ubo,this.isStatic=s.isStatic,this._signature=gc(Object.keys(r).map(n=>`${n}-${e[n].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++}};j0.defaultOptions={ubo:!1,isStatic:!1};let F0=j0;class Nl{constructor(e){this.resources=Object.create(null),this._resourceKeysValue=null,this._dirty=!0;let s=0;for(const r in e){const n=e[r];this.setResource(n,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 n,l;const r=this.resources[s];e!==r&&(r&&((n=r.off)==null||n.call(r,"change",this.onResourceChange,this)),(l=e.on)==null||l.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 n=0;n<r.length;n++){const l=s[r[n]];l&&(l._gcLastUsed=e)}}destroy(){var s;const e=this.resources;for(const r in e){const n=e[r];(s=n==null?void 0:n.off)==null||s.call(n,"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);Ft(`[BindGroup] a '${e._resourceType}' was destroyed while still bound to a shader. Remove it from the shader before destroying it.`)}}}var Sd=(t=>(t[t.WEBGL=1]="WEBGL",t[t.WEBGPU=2]="WEBGPU",t[t.CANVAS=4]="CANVAS",t[t.BOTH=3]="BOTH",t))(Sd||{});class Kl{constructor(e){this.data={...e};const s=Object.keys(e).sort().map(r=>`${r}:${e[r]}`).join("|");this.id=gc(s,"shader-overrides")}static from(e){return e instanceof Kl?e:new Kl(e)}}class lf extends Qs{constructor(e){super(),this.uid=rt("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[],this._destroyed=!1;let{gpuProgram:s,glProgram:r,groups:n,resources:l,compatibleRenderers:c,groupMap:o,overrides:h}=e;this._overrides=h?Kl.from(h):null,this.gpuProgram=s,this.glProgram=r,c===void 0&&(c=0,s&&(c|=Sd.WEBGPU),r&&(c|=Sd.WEBGL)),this.compatibleRenderers=c;const u={};if(o)for(const p in o)for(const d in o[p]){const g=o[p][d];u[g]={group:p,binding:d,name:g}}if(!l&&!n&&(l={}),l&&n)throw new Error("[Shader] Cannot have both resources and groups");if(!s&&n&&!o)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(s&&n&&!o){const p=s.structsAndGroups.groups;o={},p.forEach(d=>{o[d.group]=o[d.group]||{},o[d.group][d.binding]=d.name,u[d.name]=d})}else if(l){n={},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 p=0;for(const d in l)u[d]||(s&&!r&&Ft(`[Shader] the resource '${d}' matches no binding in the WGSL source — is the name correct?`),n[99]||(n[99]=new Nl,this._ownedBindGroups.push(n[99])),u[d]={group:99,binding:p,name:d},o[99]=o[99]||{},o[99][p]=d,p++);for(const d in l){const g=d;let w=l[d];!w.source&&!w._resourceType&&(w=new F0(w));const S=u[g];S&&(n[S.group]||(n[S.group]=new Nl,this._ownedBindGroups.push(n[S.group])),n[S.group].setResource(w,S.binding))}}this.groups=n,this._uniformBindMap=o,this.resources=this._buildResourceAccessor(n,u)}addResource(e,s,r){var n,l;(n=this._uniformBindMap)[s]||(n[s]={}),(l=this._uniformBindMap[s])[r]||(l[r]=e),this.groups[s]||(this.groups[s]=new Nl,this._ownedBindGroups.push(this.groups[s]))}_buildResourceAccessor(e,s){const r={};for(const n in s){const l=s[n];Object.defineProperty(r,l.name,{get(){return e[l.group].getResource(l.binding)},set(c){e[l.group].setResource(c,l.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(n=>{n.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null,this._overrides=null)}static from(e){const{gpu:s,gl:r,...n}=e;let l,c;return s&&(l=_c.from(s)),r&&(c=I0.from(r)),new lf({gpuProgram:l,glProgram:c,...n})}}const dk={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},fk={BLEND:0,OFFSET:1,CULLING:2,DEPTH_TEST:3,WINDING:4,DEPTH_MASK:5},{BLEND:ju,OFFSET:Nu,CULLING:Fu,DEPTH_TEST:Hu,WINDING:$u,DEPTH_MASK:zu}=fk,Cd=class H0{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<ju)}set blend(e){!!(this.data&1<<ju)!==e&&(this.data^=1<<ju)}get offsets(){return!!(this.data&1<<Nu)}set offsets(e){!!(this.data&1<<Nu)!==e&&(this.data^=1<<Nu)}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<<Fu)}set culling(e){!!(this.data&1<<Fu)!==e&&(this.data^=1<<Fu)}get depthTest(){return!!(this.data&1<<Hu)}set depthTest(e){!!(this.data&1<<Hu)!==e&&(this.data^=1<<Hu)}get depthMask(){return!!(this.data&1<<zu)}set depthMask(e){!!(this.data&1<<zu)!==e&&(this.data^=1<<zu)}get clockwiseFrontFace(){return!!(this.data&1<<$u)}set clockwiseFrontFace(e){!!(this.data&1<<$u)!==e&&(this.data^=1<<$u)}get blendMode(){return this._blendMode}set blendMode(e){this.blend=e!=="none",this._blendMode=e,this._blendModeId=dk[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 H0;return e.depthTest=!1,e.depthMask=!1,e.blend=!0,e}};Cd.default2d=Cd.for2d();let $0=Cd;const kd=[];Mt.handleByNamedList(Oe.Environment,kd);async function pk(t){if(!t)for(let e=0;e<kd.length;e++){const s=kd[e];if(s.value.test()){await s.value.load();return}}}let co;function mk(){if(typeof co=="boolean")return co;try{co=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{co=!1}return co}const Oo=new Set;let Ed=!1;function M_(t,e,s=2){const r=e&&e.length,n=r?e[0]*s:t.length;Oo.size&&Oo.clear();let l=z0(t,0,n,s,!0);const c=[];if(!l||l.next===l.prev)return c;let o=0,h=0,u=0;if(r&&(l=xk(t,e,l,s)),t.length>80*s){o=t[0],h=t[1];let p=o,d=h;for(let g=s;g<n;g+=s){const w=t[g],S=t[g+1];w<o&&(o=w),S<h&&(h=S),w>p&&(p=w),S>d&&(d=S)}u=Math.max(p-o,d-h),u=u!==0?32767/u:0}return Md(l,c,o,h,u),c}function z0(t,e,s,r,n){let l=null;if(n===Lk(t,e,s,r)>0)for(let c=e;c<s;c+=r)l=A_(c/r|0,t[c],t[c+1],l);else for(let c=s-r;c>=e;c-=r)l=A_(c/r|0,t[c],t[c+1],l);return l&&jo(l,l.next)&&(Fo(l),l=l.next),l}function bi(t,e=t){const s=e===t;let r=t,n;do n=!1,r!==r.next&&(Oo.size===0||!Oo.has(r))&&(jo(r,r.next)||ft(r.prev,r,r.next)===0)?((s||r===e)&&(e=r.prev),Ed=!0,Fo(r),r=r.prev,n=!0):(s||r!==e)&&(r=r.next,n=!s);while(n||r!==e);return e}function Md(t,e,s,r,n){n&&Mk(t,s,r,n);let l=t,c=!1;for(;t.prev!==t.next;){const o=t.prev,h=t.next;if(ft(o,t,h)<0&&(n?_k(t,s,r,n):gk(t))){e.push(o.i,t.i,h.i),Fo(t),t=h,l=h;continue}if(t=h,t===l){if(Ed=!1,t=bi(t),Ed){l=t;continue}if(!c){t=vk(t,e),l=t,c=!0;continue}yk(t,e,s,r,n);break}}}function gk(t){const e=t.prev,s=t,r=t.next,n=e.x,l=s.x,c=r.x,o=e.y,h=s.y,u=r.y,p=Math.min(n,l,c),d=Math.min(o,h,u),g=Math.max(n,l,c),w=Math.max(o,h,u);let S=r.next;for(;S!==e;){if(S.x>=p&&S.x<=g&&S.y>=d&&S.y<=w&&!(n===S.x&&o===S.y)&&Xl(n,o,l,h,c,u,S.x,S.y)&&ft(S.prev,S,S.next)>=0)return!1;S=S.next}return!0}function _k(t,e,s,r){const n=t.prev,l=t,c=t.next,o=n.x,h=l.x,u=c.x,p=n.y,d=l.y,g=c.y,w=Math.min(o,h,u),S=Math.min(p,d,g),y=Math.max(o,h,u),m=Math.max(p,d,g),v=Rd(w,S,e,s,r),x=Rd(y,m,e,s,r);let _=t.prevZ;for(;_&&_.z>=v;){if(_.x>=w&&_.x<=y&&_.y>=S&&_.y<=m&&_!==c&&!(o===_.x&&p===_.y)&&Xl(o,p,h,d,u,g,_.x,_.y)&&ft(_.prev,_,_.next)>=0)return!1;_=_.prevZ}let C=t.nextZ;for(;C&&C.z<=x;){if(C.x>=w&&C.x<=y&&C.y>=S&&C.y<=m&&C!==c&&!(o===C.x&&p===C.y)&&Xl(o,p,h,d,u,g,C.x,C.y)&&ft(C.prev,C,C.next)>=0)return!1;C=C.nextZ}return!0}function vk(t,e){let s=t,r=!1;do{const n=s.prev,l=s.next.next;V0(n,s,s.next,l,!1)&&No(n,l)&&No(l,n)&&(e.push(n.i,s.i,l.i),Fo(s),Fo(s.next),s=t=l,r=!0),s=s.next}while(s!==t);return r?bi(s):s}function yk(t,e,s,r,n){let l=t;do{let c=l.next.next;for(;c!==l.prev;){if(l.i!==c.i&&Ak(l,c)){let o=G0(l,c);l=bi(l,l.next),o=bi(o,o.next),Md(l,e,s,r,n),Md(o,e,s,r,n);return}c=c.next}l=l.next}while(l!==t)}let Td=!1;function xk(t,e,s,r){const n=[];for(let l=0,c=e.length;l<c;l++){const o=e[l]*r,h=l<c-1?e[l+1]*r:t.length,u=z0(t,o,h,r,!1);u===u.next&&Oo.add(u),n.push(Pk(u))}n.sort(wk),Sk(t.length/r,e.length),U0(s,s),Td=!0;for(let l=0;l<n.length;l++)s=bk(n[l],s);return Td=!1,bi(s)}function wk(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 bk(t,e){const s=kk(t,e);if(!s)return e;const r=G0(s,t),n=r.next;return U0(s,n.next),bi(r,r.next),bi(s,s.next)}const W0=16;let ot=new Float64Array(0),Yl=0;const Pd=[],Ad=[];function Sk(t,e){const s=Math.ceil((t+2*e)/W0)+e+2;ot.length<s*4&&(ot=new Float64Array(s*4)),Yl=0}function U0(t,e){let s=t;do{const r=Yl++;Pd[r]=s;let n=s.x,l=s.y,c=s.x,o=s.y,h=0;do{const p=s.next;s.z=r,p.x<n&&(n=p.x),p.x>c&&(c=p.x),p.y<l&&(l=p.y),p.y>o&&(o=p.y),s=p}while(++h<W0&&s!==e);Ad[r]=s;const u=r*4;ot[u]=n,ot[u+1]=l,ot[u+2]=c,ot[u+3]=o}while(s!==e)}function Ck(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 T_(t){let e=Ad[t];for(;e.prev.next!==e;)e=e.next;return Ad[t]=e,e}function P_(t){let e=Pd[t];for(;e.prev.next!==e;)e=e.next;return Pd[t]=e,e}function kk(t,e){let s=e;const r=t.x,n=t.y;let l=-1/0,c;if(jo(t,s))return s;for(let g=0,w=0;g<Yl;g++,w+=4){if(n<ot[w+1]||n>ot[w+3]||ot[w]>r||ot[w+2]<=l)continue;const S=T_(g);s=P_(g);do{if(s.prev.next===s){if(jo(t,s.next))return s.next;if(n<=s.y&&n>=s.next.y&&s.next.y!==s.y){const y=s.x+(n-s.y)*(s.next.x-s.x)/(s.next.y-s.y);if(y<=r&&y>l&&(l=y,c=s.x<s.next.x?s:s.next,y===r))return c}}s=s.next}while(s!==S)}if(!c)return null;const o=c.x,h=c.y,u=Math.min(n,h),p=Math.max(n,h);let d=1/0;for(let g=0,w=0;g<Yl;g++,w+=4){if(ot[w+2]<o||ot[w]>r||ot[w+3]<u||ot[w+1]>p)continue;const S=T_(g);s=P_(g);do{if(s.prev.next===s&&r>=s.x&&s.x>=o&&r!==s.x&&Xl(n<h?r:l,n,o,h,n<h?l:r,n,s.x,s.y)){const y=Math.abs(n-s.y)/(r-s.x);(No(s,t)||s.y===n&&s.next.y===n&&s.next.x>r)&&(y<d||y===d&&(s.x>c.x||s.x===c.x&&Ek(c,s)))&&(c=s,d=y)}s=s.next}while(s!==S)}return c}function Ek(t,e){return ft(t.prev,t,e.prev)<0&&ft(e.next,t,t.next)<0}const cs=[];let sn=[],ri=new Uint32Array(0),ho=new Uint32Array(0);const uo=new Uint32Array(256);function Mk(t,e,s,r){let n=t,l=0;do n.z=Rd(n.x,n.y,e,s,r),cs[l++]=n,n=n.next;while(n!==t);Tk(l);let c=null;for(let o=0;o<l;o++){const h=cs[o];h.prevZ=c,c&&(c.nextZ=h),c=h}c.nextZ=null,cs.fill(null,0,l),sn.fill(null,0,l)}function Tk(t){if(t<=32){for(let e=1;e<t;e++){const s=cs[e],r=s.z;let n=e-1;for(;n>=0&&cs[n].z>r;)cs[n+1]=cs[n],n--;cs[n+1]=s}return}ri.length<t&&(ri=new Uint32Array(t),ho=new Uint32Array(t),sn=new Array(t));for(let e=0;e<t;e++)ri[e]=cs[e].z;yl(t,cs,ri,sn,ho,0),yl(t,sn,ho,cs,ri,8),yl(t,cs,ri,sn,ho,16),yl(t,sn,ho,cs,ri,24)}function yl(t,e,s,r,n,l){uo.fill(0);for(let o=0;o<t;o++)uo[s[o]>>>l&255]++;let c=0;for(let o=0;o<256;o++){const h=uo[o];uo[o]=c,c+=h}for(let o=0;o<t;o++){const h=s[o],u=uo[h>>>l&255]++;r[u]=e[o],n[u]=h}}function Rd(t,e,s,r,n){return t=(t-s)*n|0,e=(e-r)*n|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 Pk(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 Xl(t,e,s,r,n,l,c,o){return(n-c)*(e-o)>=(t-c)*(l-o)&&(t-c)*(r-o)>=(s-c)*(e-o)&&(s-c)*(l-o)>=(n-c)*(r-o)}function Ak(t,e){const s=jo(t,e)&&ft(t.prev,t,t.next)>0&&ft(e.prev,e,e.next)>0;return t.next.i!==e.i&&(s||No(t,e)&&No(e,t)&&(ft(t.prev,t,e.prev)!==0||ft(t,e.prev,e)!==0))&&!Rk(t,e)&&(s||Dk(t,e))}function ft(t,e,s){return(e.y-t.y)*(s.x-e.x)-(e.x-t.x)*(s.y-e.y)}function jo(t,e){return t.x===e.x&&t.y===e.y}function V0(t,e,s,r,n=!0){const l=ft(t,e,s),c=ft(t,e,r),o=ft(s,r,t),h=ft(s,r,e);return(l>0&&c<0||l<0&&c>0)&&(o>0&&h<0||o<0&&h>0)?!0:n?!!(l===0&&xl(t,s,e)||c===0&&xl(t,r,e)||o===0&&xl(s,t,r)||h===0&&xl(s,e,r)):!1}function xl(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 Rk(t,e){const s=Math.min(t.x,e.x),r=Math.max(t.x,e.x),n=Math.min(t.y,e.y),l=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>l&&o.y>l||c.y<n&&o.y<n){c=o;continue}if(c.i!==t.i&&o.i!==t.i&&c.i!==e.i&&o.i!==e.i&&V0(c,o,t,e))return!0;c=o}while(c!==t);return!1}function No(t,e){return ft(t.prev,t,t.next)<0?ft(t,e,t.next)>=0&&ft(t,t.prev,e)>=0:ft(t,e,t.prev)<0||ft(t,t.next,e)<0}function Dk(t,e){let s=t,r=!1;const n=(t.x+e.x)/2,l=(t.y+e.y)/2;do{const c=s.next;s.y>l!=c.y>l&&n<(c.x-s.x)*(l-s.y)/(c.y-s.y)+s.x&&(r=!r),s=c}while(s!==t);return r}function G0(t,e){const s=Dd(t.i,t.x,t.y),r=Dd(e.i,e.x,e.y),n=t.next,l=e.prev;return t.next=e,e.prev=t,s.next=n,n.prev=s,r.next=s,s.prev=r,l.next=r,r.prev=l,r}function A_(t,e,s,r){const n=Dd(t,e,s);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function Fo(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),Td&&Ck(t.prev,t.next)}function Dd(t,e,s){return{i:t,x:e,y:s,prev:null,next:null,z:0,prevZ:null,nextZ:null}}function Lk(t,e,s,r){let n=0;for(let l=e,c=s-r;l<s;l+=r)n+=(t[c]-t[l])*(t[l+1]+t[c+1]),c=l;return n}const Bk=M_.default||M_;var q0=(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))(q0||{});class Ik{constructor(e){this.items=[],this._name=e}emit(e,s,r,n,l,c,o,h){const{name:u,items:p}=this;for(let d=0,g=p.length;d<g;d++)p[d][u](e,s,r,n,l,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 Ok=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],K0=class Y0 extends Qs{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=[...Ok,...this.config.runners??[]];this._addRunners(...s),this._unsafeEvalCheck()}async init(e={}){const s=e.skipExtensionImports===!0?!0:e.manageImports===!1;await pk(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={...Y0.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 Xs&&(r={container:r},s&&(Le(vt,"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 n=Array.isArray(r.clearColor)&&r.clearColor.length===4;r.clearColor=n?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 n=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!==n&&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=q0.ALL);const{clear:r,clearColor:n,target:l,mipLevel:c,layer:o}=e;Ss.shared.setValue(n??this.background.colorRgba),s.renderTarget.clear(l,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 Ik(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 n in this.runners)this.runners[n].add(r);return this}_addPipes(e,s){const r=s.reduce((n,l)=>(n[l.name]=l.value,n),{});e.forEach(n=>{const l=n.value,c=n.name,o=r[c];this.renderPipes[c]=new l(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)&&pc.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(!mk())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()}};K0.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};let X0=K0,wl;function jk(t){return wl!==void 0||(wl=(()=>{var s;const e={stencil:!0,failIfMajorPerformanceCaveat:t??X0.defaultOptions.failIfMajorPerformanceCaveat};try{if(!Nr.get().getWebGLRenderingContext())return!1;let n=Nr.get().createCanvas().getContext("webgl",e);const l=!!((s=n==null?void 0:n.getContextAttributes())!=null&&s.stencil);if(n){const c=n.getExtension("WEBGL_lose_context");c&&c.loseContext()}return n=null,l}catch{return!1}})()),wl}let bl;async function Nk(t={}){return bl!==void 0||(bl=await(async()=>{const e=Nr.get().getNavigator().gpu;if(!e)return!1;try{return await(await e.requestAdapter(t)).requestDevice(),!0}catch{return!1}})()),bl}const R_=["webgl","webgpu","canvas"];async function Fk(t){let e=[];t.preference?Array.isArray(t.preference)?e=t.preference.slice():(e.push(t.preference),R_.forEach(l=>{l!==t.preference&&e.push(l)})):e=R_.slice();let s,r={};for(let l=0;l<e.length;l++){const c=e[l];if(c==="webgpu"&&await Nk()){const{WebGPURenderer:o}=await Co(async()=>{const{WebGPURenderer:h}=await import("./WebGPURenderer-CSiZQVKf.js");return{WebGPURenderer:h}},__vite__mapDeps([4,5,6,3]));s=o,r={...t,...t.webgpu};break}else if(c==="webgl"&&jk(t.failIfMajorPerformanceCaveat??X0.defaultOptions.failIfMajorPerformanceCaveat)){const{WebGLRenderer:o}=await Co(async()=>{const{WebGLRenderer:h}=await import("./WebGLRenderer-1zkR__s9.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 Co(async()=>{const{CanvasRenderer:h}=await import("./CanvasRenderer-Dd4pZNIN.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 n=new s;return await n.init(r),n}const Q0="8.22.0";class Z0{static init(){var e;(e=globalThis.__PIXI_APP_INIT__)==null||e.call(globalThis,this,Q0)}static destroy(){}}Z0.extension=Oe.Application;class Hk{constructor(e){this._renderer=e}init(){var e;(e=globalThis.__PIXI_RENDERER_INIT__)==null||e.call(globalThis,this._renderer,Q0)}destroy(){this._renderer=null}}Hk.extension={type:[Oe.WebGLSystem,Oe.WebGPUSystem],name:"initHook",priority:-10};class J0{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:n,clientHeight:l}=this._resizeTo;s=n,r=l}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}}J0.extension=Oe.Application;class ex{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,ql.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=e.sharedTicker?nn.shared:new nn,e.autoStart&&this.start()}static destroy(){if(this._ticker){const e=this._ticker;this.ticker=null,e.destroy()}}}ex.extension=Oe.Application;Mt.add(J0);Mt.add(ex);const tx=class Ld{constructor(...e){this.stage=new Xs,e[0]!==void 0&&Le(vt,"Application constructor options are deprecated, please use Application.init() instead.")}async init(e){e={...e},this.stage||(this.stage=new Xs),this.renderer=await Fk(e),Ld._plugins.forEach(s=>{s.init.call(this,e)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return Le(vt,"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=Ld._plugins.slice(0);r.reverse(),r.forEach(n=>{n.destroy.call(this)}),this.stage.destroy(s),this.stage=null,this.renderer.destroy(e),this.renderer=null}};tx._plugins=[];let sx=tx;Mt.handleByList(Oe.Application,sx._plugins);Mt.add(Z0);const Wu={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},$k=/([astvzqmhlc])([^astvzqmhlc]*)/gi,zk=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;function Wk(t){const e=[];return t.replace($k,(s,r,n)=>{let l=r.toLowerCase(),c=r;const o=Uk(n);for(l==="m"&&o.length>2&&(e.push([c,...o.splice(0,2)]),l="l",c=c==="m"?"l":"L");;){if(o.length===Wu[l])return e.push([c,...o]),"";if(o.length<Wu[l])throw new Error("malformed path data");e.push([c,...o.splice(0,Wu[l])])}}),e}function Uk(t){const e=t.match(zk);return e?e.map(Number):[]}function Vk(t,e){const s=Wk(t),r=[];let n=null,l=0,c=0;for(let o=0;o<s.length;o++){const h=s[o],u=h[0],p=h;switch(u){case"M":l=p[1],c=p[2],e.moveTo(l,c);break;case"m":l+=p[1],c+=p[2],e.moveTo(l,c);break;case"H":l=p[1],e.lineTo(l,c);break;case"h":l+=p[1],e.lineTo(l,c);break;case"V":c=p[1],e.lineTo(l,c);break;case"v":c+=p[1],e.lineTo(l,c);break;case"L":l=p[1],c=p[2],e.lineTo(l,c);break;case"l":l+=p[1],c+=p[2],e.lineTo(l,c);break;case"C":l=p[5],c=p[6],e.bezierCurveTo(p[1],p[2],p[3],p[4],l,c);break;case"c":e.bezierCurveTo(l+p[1],c+p[2],l+p[3],c+p[4],l+p[5],c+p[6]),l+=p[5],c+=p[6];break;case"S":l=p[3],c=p[4],e.bezierCurveToShort(p[1],p[2],l,c);break;case"s":e.bezierCurveToShort(l+p[1],c+p[2],l+p[3],c+p[4]),l+=p[3],c+=p[4];break;case"Q":l=p[3],c=p[4],e.quadraticCurveTo(p[1],p[2],l,c);break;case"q":e.quadraticCurveTo(l+p[1],c+p[2],l+p[3],c+p[4]),l+=p[3],c+=p[4];break;case"T":l=p[1],c=p[2],e.quadraticCurveToShort(l,c);break;case"t":l+=p[1],c+=p[2],e.quadraticCurveToShort(l,c);break;case"A":l=p[6],c=p[7],e.arcToSvg(p[1],p[2],p[3],p[4],p[5],l,c);break;case"a":l+=p[6],c+=p[7],e.arcToSvg(p[1],p[2],p[3],p[4],p[5],l,c);break;case"Z":case"z":e.closePath(),r.length>0&&(n=r.pop(),n?(l=n.startX,c=n.startY):(l=0,c=0)),n=null;break;default:Ft(`Unknown SVG path command: ${u}`)}u!=="Z"&&u!=="z"&&n===null&&(n={startX:l,startY:c},r.push(n))}return e}class cf{constructor(e=0,s=0,r=0){this.type="circle",this.x=e,this.y=s,this.radius=r}clone(){return new cf(this.x,this.y,this.radius)}contains(e,s){if(this.radius<=0)return!1;const r=this.radius*this.radius;let n=this.x-e,l=this.y-s;return n*=n,l*=l,n+l<=r}strokeContains(e,s,r,n=.5){if(this.radius===0)return!1;const l=this.x-e,c=this.y-s,o=this.radius,h=(1-n)*r,u=Math.sqrt(l*l+c*c);return u<=o+h&&u>o-(r-h)}getBounds(e){return e||(e=new Et),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 hf{constructor(e=0,s=0,r=0,n=0){this.type="ellipse",this.x=e,this.y=s,this.halfWidth=r,this.halfHeight=n}clone(){return new hf(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,n=(s-this.y)/this.halfHeight;return r*=r,n*=n,r+n<=1}strokeContains(e,s,r,n=.5){const{halfWidth:l,halfHeight:c}=this;if(l<=0||c<=0)return!1;const o=r*(1-n),h=r-o,u=l-h,p=c-h,d=l+o,g=c+o,w=e-this.x,S=s-this.y;return w*w/(d*d)+S*S/(g*g)>1?!1:u<=0||p<=0?!0:w*w/(u*u)+S*S/(p*p)>1}getBounds(e){return e||(e=new Et),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 rx(t){const e=t.length;if(e<6)return 1;let s=0;for(let r=0,n=t[e-2],l=t[e-1];r<e;r+=2){const c=t[r],o=t[r+1];s+=(c-n)*(o+l),n=c,l=o}return s<0?-1:1}function Gk(t,e,s,r,n,l){const c=t-s,o=e-r,h=n-s,u=l-r,p=c*h+o*u,d=h*h+u*u;let g=-1;d!==0&&(g=p/d);let w,S;g<0?(w=s,S=r):g>1?(w=n,S=l):(w=s+g*h,S=r+g*u);const y=t-w,m=e-S;return y*y+m*m}let qk,Kk;class Mo{constructor(...e){this.type="polygon";let s=Array.isArray(e[0])?e[0]:e;if(typeof s[0]!="number"){const r=[];for(let n=0,l=s.length;n<l;n++)r.push(s[n].x,s[n].y);s=r}this.points=s,this.closePath=!0}isClockwise(){let e=0;const s=this.points,r=s.length;for(let n=0;n<r;n+=2){const l=s[n],c=s[n+1],o=s[(n+2)%r],h=s[(n+3)%r];e+=(o-l)*(h+c)}return e<0}containsPolygon(e){const s=this.getBounds(qk),r=e.getBounds(Kk);if(!s.containsRect(r))return!1;const n=e.points;for(let l=0;l<n.length;l+=2){const c=n[l],o=n[l+1];if(!this.contains(c,o))return!1}return!0}clone(){const e=this.points.slice(),s=new Mo(e);return s.closePath=this.closePath,s}contains(e,s){let r=!1;const n=this.points.length/2;for(let l=0,c=n-1;l<n;c=l++){const o=this.points[l*2],h=this.points[l*2+1],u=this.points[c*2],p=this.points[c*2+1];h>s!=p>s&&e<(u-o)*((s-h)/(p-h))+o&&(r=!r)}return r}strokeContains(e,s,r,n=.5){const{points:l}=this,c=n===.5?n:(n-.5)*rx(l)+.5,o=r*c,h=r-o,u=o*o,p=h*h,d=l.length-(this.closePath?0:2);for(let g=0;g<d;g+=2){const w=l[g],S=l[g+1],y=l[(g+2)%l.length],m=l[(g+3)%l.length],v=Gk(e,s,w,S,y,m),x=Math.sign((y-w)*(s-S)-(m-S)*(e-w));if(v<=(x<0?u:p))return!0}return!1}getBounds(e){e||(e=new Et);const s=this.points;let r=1/0,n=-1/0,l=1/0,c=-1/0;for(let o=0,h=s.length;o<h;o+=2){const u=s[o],p=s[o+1];r=u<r?u:r,n=u>n?u:n,l=p<l?p:l,c=p>c?p:c}return e.x=r,e.width=n-r,e.y=l,e.height=c-l,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 Le("8.11.0","Polygon.lastX is deprecated, please use Polygon.lastX instead."),this.points[this.points.length-2]}get y(){return Le("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 Sl=(t,e,s,r,n,l,c)=>{const o=t-s,h=e-r,u=Math.sqrt(o*o+h*h);return u>=n-l&&u<=n+c};class uf{constructor(e=0,s=0,r=0,n=0,l=20){this.type="roundedRectangle",this.x=e,this.y=s,this.width=r,this.height=n,this.radius=l}getBounds(e){return e||(e=new Et),e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e}clone(){return new uf(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 n=e-(this.x+r),l=s-(this.y+r);const c=r*r;if(n*n+l*l<=c||(n=e-(this.x+this.width-r),n*n+l*l<=c)||(l=s-(this.y+this.height-r),n*n+l*l<=c)||(n=e-(this.x+r),n*n+l*l<=c))return!0}return!1}strokeContains(e,s,r,n=.5){const{x:l,y:c,width:o,height:h,radius:u}=this,p=r*(1-n),d=r-p,g=l+u,w=c+u,S=o-u*2,y=h-u*2,m=l+o,v=c+h;return(e>=l-p&&e<=l+d||e>=m-d&&e<=m+p)&&s>=w&&s<=w+y||(s>=c-p&&s<=c+d||s>=v-d&&s<=v+p)&&e>=g&&e<=g+S?!0:e<g&&s<w&&Sl(e,s,g,w,u,d,p)||e>m-u&&s<w&&Sl(e,s,m-u,w,u,d,p)||e>m-u&&s>v-u&&Sl(e,s,m-u,v-u,u,d,p)||e<g&&s>v-u&&Sl(e,s,g,v-u,u,d,p)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}const ix={};function Yk(t,e,s){let r=2166136261;for(let n=0;n<e;n++)r^=t[n].uid,r=Math.imul(r,16777619),r>>>=0;return ix[r]||Xk(t,e,r,s)}function Xk(t,e,s,r){const n={};let l=0;for(let o=0;o<r;o++){const h=o<e?t[o]:Ue.EMPTY.source;n[l++]=h.source,n[l++]=h.style}const c=new Nl(n);return ix[s]=c,c}class D_{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 L_(t,e,s,r){if(s??(s=0),r??(r=Math.min(t.byteLength-s,e.byteLength)),!(s&7)&&!(r&7)){const n=r/8;new Float64Array(e,0,n).set(new Float64Array(t,s,n))}else if(!(s&3)&&!(r&3)){const n=r/4;new Float32Array(e,0,n).set(new Float32Array(t,s,n))}else new Uint8Array(e).set(new Uint8Array(t,s,r))}const Qk={normal:"normal-npm",add:"add-npm",screen:"screen-npm"};var Zk=(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))(Zk||{});function B_(t,e){return e.alphaMode==="no-premultiply-alpha"&&Qk[t]||t}const Jk=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
|
64
|
+
`);function e2(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 t2(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=Jk.replace(/%forloop%/gi,e2(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 Zi=null;function s2(){var e;if(Zi)return Zi;const t=L0();return Zi=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),Zi=t2(Zi,t),(e=t.getExtension("WEBGL_lose_context"))==null||e.loseContext(),Zi}class r2{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 i2{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new r2,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 To=[];let Ql=0;pc.register({clear:()=>{if(To.length>0)for(const t of To)t&&t.destroy();To.length=0,Ql=0}});function I_(){return Ql>0?To[--Ql]:new i2}function O_(t){t.elements=null,To[Ql++]=t}let fo=0;const nx=class ox{constructor(e){this.uid=rt("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],e={...ox.defaultOptions,...e},e.maxTextures||(Le("v8.8.0","maxTextures is a required option for Batcher now, please pass it in the options"),e.maxTextures=s2());const{maxTextures:s,attributesInitialSize:r,indicesInitialSize:n}=e;this.attributeBuffer=new D_(r*4),this.indexBuffer=new Uint16Array(n),this.maxTextures=s}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let e=0;e<this.batchIndex;e++)O_(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=I_(),n=r.textures;n.clear();const l=s[this.elementStart];let c=B_(l.blendMode,l.texture._source),o=l.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,p=this.indexBuffer;let d=this._batchIndexSize,g=this._batchIndexStart,w="startBatch",S=[];const y=this.maxTextures;for(let m=this.elementStart;m<this.elementSize;++m){const v=s[m];s[m]=null;const _=v.texture._source,C=B_(v.blendMode,_),M=c!==C||o!==v.topology;if(_._batchTick===fo&&!M){v._textureId=_._textureBindLocation,d+=v.indexSize,v.packAsQuad?(this.packQuadAttributes(v,h,u,v._attributeStart,v._textureId),this.packQuadIndex(p,v._indexStart,v._attributeStart/this.vertexSize)):(this.packAttributes(v,h,u,v._attributeStart,v._textureId),this.packIndex(v,p,v._indexStart,v._attributeStart/this.vertexSize)),v._batch=r,S.push(v);continue}_._batchTick=fo,(n.count>=y||M)&&(this._finishBatch(r,g,d-g,n,c,o,e,w,S),w="renderBatch",g=d,c=C,o=v.topology,r=I_(),n=r.textures,n.clear(),S=[],++fo),v._textureId=_._textureBindLocation=n.count,n.ids[_.uid]=n.count,n.textures[n.count++]=_,v._batch=r,S.push(v),d+=v.indexSize,v.packAsQuad?(this.packQuadAttributes(v,h,u,v._attributeStart,v._textureId),this.packQuadIndex(p,v._indexStart,v._attributeStart/this.vertexSize)):(this.packAttributes(v,h,u,v._attributeStart,v._textureId),this.packIndex(v,p,v._indexStart,v._attributeStart/this.vertexSize))}n.count>0&&(this._finishBatch(r,g,d-g,n,c,o,e,w,S),g=d,++fo),this.elementStart=this.elementSize,this._batchIndexStart=g,this._batchIndexSize=d}_finishBatch(e,s,r,n,l,c,o,h,u){e.gpuBindGroup=null,e.bindGroup=null,e.action=h,e.batcher=this,e.textures=n,e.blendMode=l,e.topology=c,e.start=s,e.size=r,e.elements=u,++fo,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 D_(s);L_(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 n=r>65535?new Uint32Array(r):new Uint16Array(r);if(n.BYTES_PER_ELEMENT!==s.BYTES_PER_ELEMENT)for(let l=0;l<s.length;l++)n[l]=s[l];else L_(s.buffer,n.buffer);this.indexBuffer=n}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,n){const l=e.indices,c=e.indexSize,o=e.indexOffset,h=e.attributeOffset;for(let u=0;u<c;u++)s[r++]=n+l[u+o]-h}destroy(e={}){var s;if(this.batches!==null){for(let r=0;r<this.batchIndex;r++)O_(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}}};nx.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};let n2=nx;var Jt=(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))(Jt||{});class Ho extends Qs{constructor(e){let{data:s,size:r}=e;const{usage:n,label:l,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:n,mappedAtCreation:o,label:l},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&Jt.STATIC)}set static(e){e?this.descriptor.usage|=Jt.STATIC:this.descriptor.usage&=~Jt.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 n=this._data;if(this._data=e,this._dataInt32=null,!n||n.length!==e.length){!this.shrinkToFit&&n&&e.byteLength<n.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 ax(t,e){if(!(t instanceof Ho)){let s=e?Jt.INDEX:Jt.VERTEX;t instanceof Array&&(e?(t=new Uint32Array(t),s=Jt.INDEX|Jt.COPY_DST):(t=new Float32Array(t),s=Jt.VERTEX|Jt.COPY_DST)),t=new Ho({data:t,label:e?"index-mesh-buffer":"vertex-mesh-buffer",usage:s})}return t}function o2(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 n=r.buffer.data;let l=1/0,c=1/0,o=-1/0,h=-1/0;const u=n.BYTES_PER_ELEMENT,p=(r.offset||0)/u,d=(r.stride||8)/u;for(let g=p;g<n.length;g+=d){const w=n[g],S=n[g+1];w>o&&(o=w),S>h&&(h=S),w<l&&(l=w),S<c&&(c=S)}return s.minX=l,s.minY=c,s.maxX=o,s.maxY=h,s}function a2(t){return(t instanceof Ho||Array.isArray(t)||t.BYTES_PER_ELEMENT)&&(t={buffer:t}),t.buffer=ax(t.buffer,!1),t}class l2 extends Qs{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 Os,this._boundsDirty=!0,this._vertexCount=0,this._vertexCountDirty=!0;const{attributes:s,indexBuffer:r,topology:n}=e;if(this.buffers=[],this.attributes={},s)for(const l in s)this.addAttribute(l,s[l]);this.instanceCount=e.instanceCount??1,this.indexCount=e.indexCount??0,r&&this.addIndex(r),this.topology=n||"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 n=r.buffer;return this._vertexCount=n.data.length/(r.stride/4||r.size),this._vertexCount}return this._vertexCount=0,0}getSize(){return Le("8.20.0","Geometry.getSize is deprecated, please use Geometry.vertexCount instead."),this.vertexCount}addAttribute(e,s){const r=a2(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=ax(e,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,o2(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 c2=new Float32Array(1),h2=new Uint32Array(1);class u2 extends l2{constructor(){const s=new Ho({data:c2,label:"attribute-batch-buffer",usage:Jt.VERTEX|Jt.COPY_DST,shrinkToFit:!1}),r=new Ho({data:h2,label:"index-batch-buffer",usage:Jt.INDEX|Jt.COPY_DST,shrinkToFit:!1}),n=24;super({attributes:{aPosition:{buffer:s,format:"float32x2",stride:n,offset:0},aUV:{buffer:s,format:"float32x2",stride:n,offset:8},aColor:{buffer:s,format:"unorm8x4",stride:n,offset:16},aTextureIdAndRound:{buffer:s,format:"uint16x2",stride:n,offset:20}},indexBuffer:r})}}function j_(t,e,s){if(t)for(const r in t){const n=r.toLocaleLowerCase(),l=e[n];if(l){let c=t[r];r==="header"&&(c=c.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),s&&l.push(`//----${s}----//`),l.push(c)}else Ft(`${r} placement hook does not exist in shader`)}}const d2=/\{\{(.*?)\}\}/g;function N_(t){var r;const e={};return(((r=t.match(d2))==null?void 0:r.map(n=>n.replace(/[{()}]/g,"")))??[]).forEach(n=>{e[n]=[]}),e}function F_(t,e){let s;const r=/@in\s+([^;]+);/g;for(;(s=r.exec(t))!==null;)e.push(s[1])}function H_(t,e,s=!1){const r=[];F_(e,r),t.forEach(o=>{o.header&&F_(o.header,r)});const n=r;s&&n.sort();const l=n.map((o,h)=>` @location(${h}) ${o},`).join(`
|
|
66
|
+
`);let c=e.replace(/@in\s+[^;]+;\s*/g,"");return c=c.replace("{{in}}",`
|
|
67
|
+
${l}
|
|
68
|
+
`),c}function $_(t,e){let s;const r=/@out\s+([^;]+);/g;for(;(s=r.exec(t))!==null;)e.push(s[1])}function f2(t){const s=/\b(\w+)\s*:/g.exec(t);return s?s[1]:""}function p2(t){const e=/@.*?\s+/g;return t.replace(e,"")}function m2(t,e){const s=[];$_(e,s),t.forEach(h=>{h.header&&$_(h.header,s)});let r=0;const n=s.sort().map(h=>h.indexOf("builtin")>-1?h:`@location(${r++}) ${h}`).join(`,
|
|
69
|
+
`),l=s.sort().map(h=>` var ${p2(h)};`).join(`
|
|
70
|
+
`),c=`return VSOutput(
|
|
71
|
+
${s.sort().map(h=>` ${f2(h)}`).join(`,
|
|
72
|
+
`)});`;let o=e.replace(/@out\s+[^;]+;\s*/g,"");return o=o.replace("{{struct}}",`
|
|
73
|
+
${n}
|
|
74
|
+
`),o=o.replace("{{start}}",`
|
|
75
|
+
${l}
|
|
76
|
+
`),o=o.replace("{{return}}",`
|
|
77
|
+
${c}
|
|
78
|
+
`),o}function z_(t,e){let s=t;for(const r in e){const n=e[r];n.join(`
|
|
79
|
+
`).length?s=s.replace(`{{${r}}}`,`//-----${r} START-----//
|
|
80
|
+
${n.join(`
|
|
81
|
+
`)}
|
|
82
|
+
//----${r} FINISH----//`):s=s.replace(`{{${r}}}`,"")}return s}const jr=Object.create(null),Uu=new Map;let g2=0;function _2({template:t,bits:e}){const s=lx(t,e);if(jr[s])return jr[s];const{vertex:r,fragment:n}=y2(t,e);return jr[s]=cx(r,n,e),jr[s]}function v2({template:t,bits:e}){const s=lx(t,e);return jr[s]||(jr[s]=cx(t.vertex,t.fragment,e)),jr[s]}function y2(t,e){const s=e.map(c=>c.vertex).filter(c=>!!c),r=e.map(c=>c.fragment).filter(c=>!!c);let n=H_(s,t.vertex,!0);n=m2(s,n);const l=H_(r,t.fragment,!0);return{vertex:n,fragment:l}}function lx(t,e){return e.map(s=>(Uu.has(s)||Uu.set(s,g2++),Uu.get(s))).sort((s,r)=>s-r).join("-")+t.vertex+t.fragment}function cx(t,e,s){const r=N_(t),n=N_(e);return s.forEach(l=>{j_(l.vertex,r,l.name),j_(l.fragment,n,l.name)}),{vertex:z_(t,r),fragment:z_(e,n)}}const x2=`
|
|
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
|
+
`,w2=`
|
|
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
|
+
`,b2=`
|
|
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
|
+
`,S2=`
|
|
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
|
+
`,C2={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
|
+
`}},k2={name:"global-uniforms-bit",vertex:{header:`
|
|
216
|
+
uniform mat3 uProjectionMatrix;
|
|
217
|
+
uniform mat3 uWorldTransformMatrix;
|
|
218
|
+
uniform vec4 uWorldColorAlpha;
|
|
219
|
+
uniform vec2 uResolution;
|
|
220
|
+
`}};function E2({bits:t,name:e}){const s=_2({template:{fragment:w2,vertex:x2},bits:[C2,...t]});return _c.from({name:e,vertex:{source:s.vertex,entryPoint:"main"},fragment:{source:s.fragment,entryPoint:"main"}})}function M2({bits:t,name:e}){return new I0({name:e,...v2({template:{vertex:b2,fragment:S2},bits:[k2,...t]})})}const T2={name:"color-bit",vertex:{header:`
|
|
221
|
+
@in aColor: vec4<f32>;
|
|
222
|
+
`,main:`
|
|
223
|
+
vColor *= vec4<f32>(aColor.rgb * aColor.a, aColor.a);
|
|
224
|
+
`}},P2={name:"color-bit",vertex:{header:`
|
|
225
|
+
in vec4 aColor;
|
|
226
|
+
`,main:`
|
|
227
|
+
vColor *= vec4(aColor.rgb * aColor.a, aColor.a);
|
|
228
|
+
`}},Vu={};function A2(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 R2(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 D2(t){return Vu[t]||(Vu[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
|
+
${A2(t)}
|
|
244
|
+
`,main:`
|
|
245
|
+
var uvDx = dpdx(vUV);
|
|
246
|
+
var uvDy = dpdy(vUV);
|
|
247
|
+
|
|
248
|
+
${R2(t)}
|
|
249
|
+
`}}),Vu[t]}const Gu={};function L2(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 B2(t){return Gu[t]||(Gu[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
|
+
${L2(t)}
|
|
269
|
+
`}}),Gu[t]}const I2={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
|
+
`}},O2={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
|
+
`}},W_={};function j2(t){let e=W_[t];if(e)return e;const s=new Int32Array(t);for(let r=0;r<t;r++)s[r]=r;return e=W_[t]=new F0({uTextures:{value:s,type:"i32",size:t}},{isStatic:!0}),e}class U_ extends lf{constructor(e){const s=M2({name:"batch",bits:[P2,B2(e),O2]}),r=E2({name:"batch",bits:[T2,D2(e),I2]});super({glProgram:s,gpuProgram:r,resources:{batchSamplers:j2(e)}}),this.maxTextures=e}}let po=null;const hx=class ux extends n2{constructor(e){super(e),this.geometry=new u2,this.name=ux.extension.name,this.vertexSize=6,po??(po=new U_(e.maxTextures)),this.shader=po}packAttributes(e,s,r,n,l){const c=l<<16|e.roundPixels&65535,o=e.transform,h=o.a,u=o.b,p=o.c,d=o.d,g=o.tx,w=o.ty,{positions:S,uvs:y}=e,m=e.color,v=e.attributeOffset,x=v+e.attributeSize;for(let _=v;_<x;_++){const C=_*2,M=S[C],T=S[C+1];s[n++]=h*M+p*T+g,s[n++]=d*T+u*M+w,s[n++]=y[C],s[n++]=y[C+1],r[n++]=m,r[n++]=c}}packQuadAttributes(e,s,r,n,l){const c=e.texture,o=e.transform,h=o.a,u=o.b,p=o.c,d=o.d,g=o.tx,w=o.ty,S=e.bounds,y=S.maxX,m=S.minX,v=S.maxY,x=S.minY,_=c.uvs,C=e.color,M=l<<16|e.roundPixels&65535;s[n+0]=h*m+p*x+g,s[n+1]=d*x+u*m+w,s[n+2]=_.x0,s[n+3]=_.y0,r[n+4]=C,r[n+5]=M,s[n+6]=h*y+p*x+g,s[n+7]=d*x+u*y+w,s[n+8]=_.x1,s[n+9]=_.y1,r[n+10]=C,r[n+11]=M,s[n+12]=h*y+p*v+g,s[n+13]=d*v+u*y+w,s[n+14]=_.x2,s[n+15]=_.y2,r[n+16]=C,r[n+17]=M,s[n+18]=h*m+p*v+g,s[n+19]=d*v+u*m+w,s[n+20]=_.x3,s[n+21]=_.y3,r[n+22]=C,r[n+23]=M}_updateMaxTextures(e){this.shader.maxTextures!==e&&(po=new U_(e),this.shader=po)}destroy(){this.shader=null,super.destroy()}};hx.extension={type:[Oe.Batcher],name:"default"};let N2=hx;class vc{constructor(e){this.items=Object.create(null);const{renderer:s,type:r,onUnload:n,priority:l,name:c}=e;this._renderer=s,s.gc.addResourceHash(this,"items",r,l??0),this._onUnload=n,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 n;if(!this.items[e.uid])return;const r=e._gpuData[this._renderer.uid];r&&((n=this._onUnload)==null||n.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 F2(t,e,s,r,n,l,c,o=null){let h=0;s*=e,n*=l;const u=o.a,p=o.b,d=o.c,g=o.d,w=o.tx,S=o.ty;for(;h<c;){const y=t[s],m=t[s+1];r[n]=u*y+d*m+w,r[n+1]=p*y+g*m+S,n+=l,s+=e,h++}}function H2(t,e,s,r){let n=0;for(e*=s;n<r;)t[e]=0,t[e+1]=0,e+=s,n++}function dx(t,e,s,r,n){const l=e.a,c=e.b,o=e.c,h=e.d,u=e.tx,p=e.ty;s||(s=0),r||(r=2),n||(n=t.length/r-s);let d=s*r;for(let g=0;g<n;g++){const w=t[d],S=t[d+1];t[d]=l*w+o*S+u,t[d+1]=c*w+h*S+p,d+=r}}const $2=new Be;class df{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?f0(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)||$2}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 $o={extension:{type:Oe.ShapeBuilder,name:"circle"},build(t,e){let s,r,n,l,c,o;if(t.type==="circle"){const C=t;if(c=o=C.radius,c<=0)return!1;s=C.x,r=C.y,n=l=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,n=l=0}else{const C=t,M=C.width/2,T=C.height/2;s=C.x+M,r=C.y+T,c=o=Math.max(0,Math.min(C.radius,Math.min(M,T))),n=M-c,l=T-o}if(n<0||l<0)return!1;const h=Math.ceil(2.3*Math.sqrt(c+o)),u=h*8+(n?4:0)+(l?4:0);if(u===0)return!1;if(h===0)return e[0]=e[6]=s+n,e[1]=e[3]=r+l,e[2]=e[4]=s-n,e[5]=e[7]=r-l,!0;let p=0,d=h*4+(n?2:0)+2,g=d,w=u,S=n+c,y=l,m=s+S,v=s-S,x=r+y;if(e[p++]=m,e[p++]=x,e[--d]=x,e[--d]=v,l){const C=r-y;e[g++]=v,e[g++]=C,e[--w]=C,e[--w]=m}for(let C=1;C<h;C++){const M=Math.PI/2*(C/h),T=n+Math.cos(M)*c,R=l+Math.sin(M)*o,P=s+T,L=s-T,j=r+R,$=r-R;e[p++]=P,e[p++]=j,e[--d]=j,e[--d]=L,e[g++]=L,e[g++]=$,e[--w]=$,e[--w]=P}S=n,y=l+o,m=s+S,v=s-S,x=r+y;const _=r-y;return e[p++]=m,e[p++]=x,e[--w]=_,e[--w]=m,n&&(e[p++]=v,e[p++]=x,e[--w]=_,e[--w]=v),!0},triangulate(t,e,s,r,n,l){if(t.length===0)return;let c=0,o=0;for(let p=0;p<t.length;p+=2)c+=t[p],o+=t[p+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 p=0;p<t.length;p+=2)e[h*s]=t[p],e[h*s+1]=t[p+1],p>0&&(n[l++]=h,n[l++]=u,n[l++]=h-1),h++;n[l++]=u+1,n[l++]=u,n[l++]=h-1}},z2={...$o,extension:{...$o.extension,name:"ellipse"}},W2={...$o,extension:{...$o.extension,name:"roundedRectangle"}},fx=1e-4,V_=1e-4;function G_(t,e,s,r,n,l,c,o){const h=t-s*n,u=e-r*n,p=t+s*l,d=e+r*l;let g,w;c?(g=r,w=-s):(g=-r,w=s);const S=h+g,y=u+w,m=p+g,v=d+w;return o.push(S,y),o.push(m,v),2}function ii(t,e,s,r,n,l,c,o){const h=s-t,u=r-e;let p=Math.atan2(h,u),d=Math.atan2(n-t,l-e);o&&p<d?p+=Math.PI*2:!o&&p>d&&(d+=Math.PI*2);let g=p;const w=d-p,S=Math.abs(w),y=Math.sqrt(h*h+u*u),m=(15*S*Math.sqrt(y)/Math.PI>>0)+1,v=w/m;if(g+=v,o){c.push(t,e),c.push(s,r);for(let x=1,_=g;x<m;x++,_+=v)c.push(t,e),c.push(t+Math.sin(_)*y,e+Math.cos(_)*y);c.push(t,e),c.push(n,l)}else{c.push(s,r),c.push(t,e);for(let x=1,_=g;x<m;x++,_+=v)c.push(t+Math.sin(_)*y,e+Math.cos(_)*y),c.push(t,e);c.push(n,l),c.push(t,e)}return m*2}function U2(t,e,s,r,n,l){const c=fx;if(t.length===0)return;const o=e;let h=o.alignment;if(e.alignment!==.5){let D=rx(t);h=(h-.5)*D+.5}const u=new jt(t[0],t[1]),p=new jt(t[t.length-2],t[t.length-1]),d=r,g=Math.abs(u.x-p.x)<c&&Math.abs(u.y-p.y)<c;if(d){t=t.slice(),g&&(t.pop(),t.pop(),p.set(t[t.length-2],t[t.length-1]));const D=(u.x+p.x)*.5,N=(p.y+u.y)*.5;t.unshift(D,N),t.push(D,N)}const w=n,S=t.length/2;let y=t.length;const m=w.length/2,v=o.width/2,x=v*v,_=o.miterLimit*o.miterLimit;let C=t[0],M=t[1],T=t[2],R=t[3],P=0,L=0,j=-(M-R),$=C-T,U=0,z=0,Y=Math.sqrt(j*j+$*$);j/=Y,$/=Y,j*=v,$*=v;const re=h,Q=(1-re)*2,J=re*2;d||(o.cap==="round"?y+=ii(C-j*(Q-J)*.5,M-$*(Q-J)*.5,C-j*Q,M-$*Q,C+j*J,M+$*J,w,!0)+2:o.cap==="square"&&(y+=G_(C,M,j,$,Q,J,!0,w))),w.push(C-j*Q,M-$*Q),w.push(C+j*J,M+$*J);for(let D=1;D<S-1;++D){C=t[(D-1)*2],M=t[(D-1)*2+1],T=t[D*2],R=t[D*2+1],P=t[(D+1)*2],L=t[(D+1)*2+1],j=-(M-R),$=C-T,Y=Math.sqrt(j*j+$*$),j/=Y,$/=Y,j*=v,$*=v,U=-(R-L),z=T-P,Y=Math.sqrt(U*U+z*z),U/=Y,z/=Y,U*=v,z*=v;const N=T-C,B=M-R,F=T-P,Z=L-R,ne=N*F+B*Z,he=B*F-Z*N,ae=he<0;if(Math.abs(he)<.001*Math.abs(ne)){w.push(T-j*Q,R-$*Q),w.push(T+j*J,R+$*J),ne>=0&&(o.join==="round"?y+=ii(T,R,T-j*Q,R-$*Q,T-U*Q,R-z*Q,w,!1)+4:y+=2,w.push(T-U*J,R-z*J),w.push(T+U*Q,R+z*Q));continue}const V=(-j+C)*(-$+R)-(-j+T)*(-$+M),O=(-U+P)*(-z+R)-(-U+T)*(-z+L),ie=(N*O-F*V)/he,se=(Z*V-B*O)/he,pe=(ie-T)*(ie-T)+(se-R)*(se-R),fe=T+(ie-T)*Q,Ee=R+(se-R)*Q,Ie=T-(ie-T)*J,je=R-(se-R)*J,pt=Math.min(N*N+B*B,F*F+Z*Z),Se=ae?Q:J,js=pt+Se*Se*x;pe<=js?o.join==="bevel"||pe/x>_?(ae?(w.push(fe,Ee),w.push(T+j*J,R+$*J),w.push(fe,Ee),w.push(T+U*J,R+z*J)):(w.push(T-j*Q,R-$*Q),w.push(Ie,je),w.push(T-U*Q,R-z*Q),w.push(Ie,je)),y+=2):o.join==="round"?ae?(w.push(fe,Ee),w.push(T+j*J,R+$*J),y+=ii(T,R,T+j*J,R+$*J,T+U*J,R+z*J,w,!0)+4,w.push(fe,Ee),w.push(T+U*J,R+z*J)):(w.push(T-j*Q,R-$*Q),w.push(Ie,je),y+=ii(T,R,T-j*Q,R-$*Q,T-U*Q,R-z*Q,w,!1)+4,w.push(T-U*Q,R-z*Q),w.push(Ie,je)):(w.push(fe,Ee),w.push(Ie,je)):(w.push(T-j*Q,R-$*Q),w.push(T+j*J,R+$*J),o.join==="round"?ae?y+=ii(T,R,T+j*J,R+$*J,T+U*J,R+z*J,w,!0)+2:y+=ii(T,R,T-j*Q,R-$*Q,T-U*Q,R-z*Q,w,!1)+2:o.join==="miter"&&pe/x<=_&&(ae?(w.push(Ie,je),w.push(Ie,je)):(w.push(fe,Ee),w.push(fe,Ee)),y+=2),w.push(T-U*Q,R-z*Q),w.push(T+U*J,R+z*J),y+=2)}C=t[(S-2)*2],M=t[(S-2)*2+1],T=t[(S-1)*2],R=t[(S-1)*2+1],j=-(M-R),$=C-T,Y=Math.sqrt(j*j+$*$),j/=Y,$/=Y,j*=v,$*=v,w.push(T-j*Q,R-$*Q),w.push(T+j*J,R+$*J),d||(o.cap==="round"?y+=ii(T-j*(Q-J)*.5,R-$*(Q-J)*.5,T-j*Q,R-$*Q,T+j*J,R+$*J,w,!1)+2:o.cap==="square"&&(y+=G_(T,R,j,$,Q,J,!1,w)));const K=V_*V_;for(let D=m;D<y+m-2;++D)C=w[D*2],M=w[D*2+1],T=w[(D+1)*2],R=w[(D+1)*2+1],P=w[(D+2)*2],L=w[(D+2)*2+1],!(Math.abs(C*(R-L)+T*(L-M)+P*(M-R))<K)&&l.push(D,D+1,D+2)}function V2(t,e,s,r){const n=fx;if(t.length===0)return;const l=t[0],c=t[1],o=t[t.length-2],h=t[t.length-1],u=e||Math.abs(l-o)<n&&Math.abs(c-h)<n,p=s,d=t.length/2,g=p.length/2;for(let w=0;w<d;w++)p.push(t[w*2]),p.push(t[w*2+1]);for(let w=0;w<d-1;w++)r.push(g+w,g+w+1);u&&r.push(g+d-1,g)}function px(t,e,s,r,n,l,c){const o=Bk(t,e,2);if(!o)return;for(let u=0;u<o.length;u+=3)l[c++]=o[u]+n,l[c++]=o[u+1]+n,l[c++]=o[u+2]+n;let h=n*r;for(let u=0;u<t.length;u+=2)s[h]=t[u],s[h+1]=t[u+1],h+=r}const G2=[],q2={extension:{type:Oe.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,n,l){px(t,G2,e,s,r,n,l)}},K2={extension:{type:Oe.ShapeBuilder,name:"rectangle"},build(t,e){const s=t,r=s.x,n=s.y,l=s.width,c=s.height;return l>0&&c>0?(e[0]=r,e[1]=n,e[2]=r+l,e[3]=n,e[4]=r+l,e[5]=n+c,e[6]=r,e[7]=n+c,!0):!1},triangulate(t,e,s,r,n,l){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;n[l++]=o,n[l++]=o+1,n[l++]=o+2,n[l++]=o+1,n[l++]=o+3,n[l++]=o+2}},Y2={extension:{type:Oe.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,n,l){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;n[l++]=o,n[l++]=o+1,n[l++]=o+2}},q_=[{offset:0,color:"white"},{offset:1,color:"black"}],ff=class Bd{constructor(...e){this.uid=rt("fillGradient"),this._tick=0,this.type="linear",this.colorStops=[];let s=X2(e);s={...s.type==="radial"?Bd.defaultRadialOptions:Bd.defaultLinearOptions,...r0(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(n=>{this.addColorStop(n.offset,n.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:n}=this.end,l=r-e,c=n-s;const o=l<0||c<0;if(this._wrapMode==="clamp-to-edge"){if(l<0){const m=e;e=r,r=m,l*=-1}if(c<0){const m=s;s=n,n=m,c*=-1}}const h=this.colorStops.length?this.colorStops:q_,u=this._textureSize,{canvas:p,context:d}=Y_(u,1),g=o?d.createLinearGradient(this._textureSize,0,0,0):d.createLinearGradient(0,0,this._textureSize,0);K_(g,h),d.fillStyle=g,d.fillRect(0,0,u,1),this.texture=new Ue({source:new Gl({resource:p,addressMode:this._wrapMode})});const w=Math.sqrt(l*l+c*c),S=Math.atan2(c,l),y=new Be;y.scale(w/u,1),y.rotate(S),y.translate(e,s),this.textureSpace==="local"&&y.scale(u,u),this.transform=y}buildGradient(){this.texture||this._tick++,this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;const e=this.colorStops.length?this.colorStops:q_,s=this._textureSize,{canvas:r,context:n}=Y_(s,s),{x:l,y:c}=this.center,{x:o,y:h}=this.outerCenter,u=this.innerRadius,p=this.outerRadius,d=o-p,g=h-p,w=s/(p*2),S=(l-d)*w,y=(c-g)*w,m=n.createRadialGradient(S,y,u*w,(o-d)*w,(h-g)*w,p*w);K_(m,e),n.fillStyle=e[e.length-1].color,n.fillRect(0,0,s,s),n.fillStyle=m,n.translate(S,y),n.rotate(this.rotation),n.scale(1,this.scale),n.translate(-S,-y),n.fillRect(0,0,s,s),this.texture=new Ue({source:new Gl({resource:r,addressMode:this._wrapMode})});const v=new Be;this.textureSpace==="local"?v.scale(2*p,2*p):v.scale(1/w,1/w),v.translate(d,g),this.transform=v}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}`}};ff.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};ff.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 Yo=ff;function K_(t,e){for(let s=0;s<e.length;s++){const r=e[s];t.addColorStop(r.offset,r.color)}}function Y_(t,e){const s=Nr.get().createCanvas(t,e),r=s.getContext("2d");return{canvas:s,context:r}}function X2(t){let e=t[0]??{};return(typeof e=="number"||t[1])&&(Le("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]??Yo.defaultLinearOptions.textureSize}),e}const Q2=new Be,Z2=new Et,J2=new Be;function eE(t,e,s,r){const n=e.matrix?t.copyFrom(e.matrix).invert():t.identity();if(e.textureSpace==="local"){const c=s.getBounds(Z2);e.width&&c.pad(e.width);const{x:o,y:h}=c,u=1/c.width,p=1/c.height,d=-o*u,g=-h*p,w=n.a,S=n.b,y=n.c,m=n.d;n.a*=u,n.b*=u,n.c*=p,n.d*=p,n.tx=d*w+g*y+n.tx,n.ty=d*S+g*m+n.ty}else if(e.texture.rotate){const{uvs:c,orig:o}=e.texture;n.scale(1/o.width,1/o.height),n.prepend(J2.set(c.x1-c.x0,c.y1-c.y0,c.x3-c.x0,c.y3-c.y0,c.x0,c.y0))}else n.translate(e.texture.frame.x,e.texture.frame.y),n.scale(1/e.texture.source.width,1/e.texture.source.height);const l=e.texture.source.style;return!(e.fill instanceof Yo)&&l.addressMode==="clamp-to-edge"&&(l.addressMode="repeat",l.update()),r&&n.append(Q2.copyFrom(r).invert()),n}const yc={};Mt.handleByMap(Oe.ShapeBuilder,yc);Mt.add(K2,q2,Y2,$o,z2,W2);const tE=new Et,sE=new Be;function rE(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 n=0;n<t.instructions.length;n++){const l=t.instructions[n];if(l.action==="texture")iE(l.data,r,s);else if(l.action==="fill"||l.action==="stroke"){const c=l.action==="stroke",o=l.data.path.shapePath,h=l.data.style,u=l.data.hole;c&&u&&X_(u.shapePath,h,!0,r,s),u&&(o.shapePrimitives[o.shapePrimitives.length-1].holes=u.shapePath.shapePrimitives),X_(o,h,c,r,s)}}}function iE(t,e,s){const r=[],n=yc.rectangle,l=tE;l.x=t.dx,l.y=t.dy,l.width=t.dw,l.height=t.dh;const c=t.transform;if(!n.build(l,r))return;const{vertices:o,uvs:h,indices:u}=s,p=u.length,d=o.length/2;c&&dx(r,c),n.triangulate(r,o,2,d,u,p);const g=t.image,w=g.uvs;h.push(w.x0,w.y0,w.x1,w.y1,w.x3,w.y3,w.x2,w.y2);const S=ts.get(df);S.indexOffset=p,S.indexSize=u.length-p,S.attributeOffset=d,S.attributeSize=o.length/2-d,S.baseColor=t.style,S.alpha=t.alpha,S.texture=g,S.geometryData=s,e.push(S)}function X_(t,e,s,r,n){const{vertices:l,uvs:c,indices:o}=n;t.shapePrimitives.forEach(({shape:h,transform:u,holes:p})=>{const d=[],g=yc[h.type];if(!g.build(h,d))return;const w=o.length,S=l.length/2;let y="triangle-list";if(u&&dx(d,u),s){const _=h.closePath??!0,C=e;C.pixelLine?(V2(d,_,l,o),y="line-list"):U2(d,C,!1,_,l,o)}else if(p){const _=[],C=d.slice();nE(p).forEach(T=>{_.push(C.length/2),C.push(...T)}),px(C,_,l,2,S,o,w)}else g.triangulate(d,l,2,S,o,w);const m=c.length/2,v=e.texture;if(v!==Ue.WHITE){const _=eE(sE,e,h,u);F2(l,2,S,c,m,2,l.length/2-S,_)}else H2(c,m,2,l.length/2-S);const x=ts.get(df);x.indexOffset=w,x.indexSize=o.length-w,x.attributeOffset=S,x.attributeSize=l.length/2-S,x.baseColor=e.color,x.alpha=e.alpha,x.texture=v,x.geometryData=n,x.topology=y,r.push(x)})}function nE(t){const e=[];for(let s=0;s<t.length;s++){const r=t[s].shape,n=[];yc[r.type].build(r,n)&&e.push(n)}return e}class oE{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 aE{constructor(){this.instructions=new of}init(e){const s=e.maxTextures;this.batcher?this.batcher._updateMaxTextures(s):this.batcher=new N2({maxTextures:s}),this.instructions.reset()}get geometry(){return Le(NS,"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 pf=class Id{constructor(e){this._renderer=e,this._managedContexts=new vc({renderer:e,type:"resource",name:"graphicsContext"})}init(e){Id.defaultOptions.bezierSmoothness=(e==null?void 0:e.bezierSmoothness)??Id.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(),rE(e,r);const n=e.batchMode;e.customShader||n==="no-batch"?r.isBatchable=!1:n==="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(aE,{maxTextures:this._renderer.limits.maxBatchableTextures}),r=e._gpuData[this._renderer.uid],{batches:n,geometryData:l}=r;r.graphicsData=s;const c=l.vertices.length,o=l.indices.length;for(let d=0;d<n.length;d++)n[d].applyTransform=!1;const h=s.batcher;h.ensureAttributeBuffer(c),h.ensureIndexBuffer(o),h.begin();for(let d=0;d<n.length;d++){const g=n[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 p=h.batches;for(let d=0;d<h.batchIndex;d++){const g=p[d];g.bindGroup=Yk(g.textures.textures,g.textures.count,this._renderer.limits.maxBatchableTextures)}return s}_initContext(e){const s=new oE;return s.context=e,e._gpuData[this._renderer.uid]=s,this._managedContexts.add(e),s}destroy(){this._managedContexts.destroy(),this._renderer=null}};pf.extension={type:[Oe.WebGLSystem,Oe.WebGPUSystem],name:"graphicsContext"};pf.defaultOptions={bezierSmoothness:.5};let mf=pf;const lE=8,Cl=11920929e-14,cE=1;function mx(t,e,s,r,n,l,c,o,h,u){const d=Math.min(.99,Math.max(0,u??mf.defaultOptions.bezierSmoothness));let g=(cE-d)/1;return g*=g,hE(e,s,r,n,l,c,o,h,t,g),t}function hE(t,e,s,r,n,l,c,o,h,u){Od(t,e,s,r,n,l,c,o,h,u,0),h.push(c,o)}function Od(t,e,s,r,n,l,c,o,h,u,p){if(p>lE)return;const d=(t+s)/2,g=(e+r)/2,w=(s+n)/2,S=(r+l)/2,y=(n+c)/2,m=(l+o)/2,v=(d+w)/2,x=(g+S)/2,_=(w+y)/2,C=(S+m)/2,M=(v+_)/2,T=(x+C)/2;if(p>0){let R=c-t,P=o-e;const L=Math.abs((s-c)*P-(r-o)*R),j=Math.abs((n-c)*P-(l-o)*R);if(L>Cl&&j>Cl){if((L+j)*(L+j)<=u*(R*R+P*P)){h.push(M,T);return}}else if(L>Cl){if(L*L<=u*(R*R+P*P)){h.push(M,T);return}}else if(j>Cl){if(j*j<=u*(R*R+P*P)){h.push(M,T);return}}else if(R=M-(t+c)/2,P=T-(e+o)/2,R*R+P*P<=u){h.push(M,T);return}}Od(t,e,d,g,v,x,M,T,h,u,p+1),Od(M,T,_,C,y,m,c,o,h,u,p+1)}const uE=8,dE=11920929e-14,fE=1;function pE(t,e,s,r,n,l,c,o){const u=Math.min(.99,Math.max(0,o??mf.defaultOptions.bezierSmoothness));let p=(fE-u)/1;return p*=p,mE(e,s,r,n,l,c,t,p),t}function mE(t,e,s,r,n,l,c,o){jd(c,t,e,s,r,n,l,o,0),c.push(n,l)}function jd(t,e,s,r,n,l,c,o,h){if(h>uE)return;const u=(e+r)/2,p=(s+n)/2,d=(r+l)/2,g=(n+c)/2,w=(u+d)/2,S=(p+g)/2;let y=l-e,m=c-s;const v=Math.abs((r-l)*m-(n-c)*y);if(v>dE){if(v*v<=o*(y*y+m*m)){t.push(w,S);return}}else if(y=w-(e+l)/2,m=S-(s+c)/2,y*y+m*m<=o){t.push(w,S);return}jd(t,e,s,u,p,w,S,o,h+1),jd(t,w,S,d,g,l,c,o,h+1)}function gx(t,e,s,r,n,l,c,o){let h=Math.abs(n-l);(!c&&n>l||c&&l>n)&&(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,p=n;u*=c?-1:1;for(let d=0;d<o+1;d++){const g=Math.cos(p),w=Math.sin(p),S=e+g*r,y=s+w*r;t.push(S,y),p+=u}}function gE(t,e,s,r,n,l){const c=t[t.length-2],h=t[t.length-1]-s,u=c-e,p=n-s,d=r-e,g=Math.abs(h*d-u*p);if(g<1e-8||l===0){(t[t.length-2]!==e||t[t.length-1]!==s)&&t.push(e,s);return}const w=h*h+u*u,S=p*p+d*d,y=h*p+u*d,m=l*Math.sqrt(w)/g,v=l*Math.sqrt(S)/g,x=m*y/w,_=v*y/S,C=m*d+v*u,M=m*p+v*h,T=u*(v+x),R=h*(v+x),P=d*(m+_),L=p*(m+_),j=Math.atan2(R-M,T-C),$=Math.atan2(L-M,P-C);gx(t,C+e,M+s,l,j,$,u*p>d*h)}const Po=Math.PI*2,qu={centerX:0,centerY:0,ang1:0,ang2:0},Ku=({x:t,y:e},s,r,n,l,c,o,h)=>{t*=s,e*=r;const u=n*t-l*e,p=l*t+n*e;return h.x=u+c,h.y=p+o,h};function _E(t,e){const s=e===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(e/4),r=e===1.5707963267948966?.551915024494:s,n=Math.cos(t),l=Math.sin(t),c=Math.cos(t+e),o=Math.sin(t+e);return[{x:n-l*r,y:l+n*r},{x:c+o*r,y:o-c*r},{x:c,y:o}]}const Q_=(t,e,s,r)=>{const n=t*r-e*s<0?-1:1;let l=t*s+e*r;return l>1&&(l=1),l<-1&&(l=-1),n*Math.acos(l)},vE=(t,e,s,r,n,l,c,o,h,u,p,d,g)=>{const w=Math.pow(n,2),S=Math.pow(l,2),y=Math.pow(p,2),m=Math.pow(d,2);let v=w*S-w*m-S*y;v<0&&(v=0),v/=w*m+S*y,v=Math.sqrt(v)*(c===o?-1:1);const x=v*n/l*d,_=v*-l/n*p,C=u*x-h*_+(t+s)/2,M=h*x+u*_+(e+r)/2,T=(p-x)/n,R=(d-_)/l,P=(-p-x)/n,L=(-d-_)/l,j=Q_(1,0,T,R);let $=Q_(T,R,P,L);o===0&&$>0&&($-=Po),o===1&&$<0&&($+=Po),g.centerX=C,g.centerY=M,g.ang1=j,g.ang2=$};function yE(t,e,s,r,n,l,c,o=0,h=0,u=0){if(l===0||c===0)return;const p=Math.sin(o*Po/360),d=Math.cos(o*Po/360),g=d*(e-r)/2+p*(s-n)/2,w=-p*(e-r)/2+d*(s-n)/2;if(g===0&&w===0)return;l=Math.abs(l),c=Math.abs(c);const S=Math.pow(g,2)/Math.pow(l,2)+Math.pow(w,2)/Math.pow(c,2);S>1&&(l*=Math.sqrt(S),c*=Math.sqrt(S)),vE(e,s,r,n,l,c,h,u,p,d,g,w,qu);let{ang1:y,ang2:m}=qu;const{centerX:v,centerY:x}=qu;let _=Math.abs(m)/(Po/4);Math.abs(1-_)<1e-7&&(_=1);const C=Math.max(Math.ceil(_),1);m/=C;let M=t[t.length-2],T=t[t.length-1];const R={x:0,y:0};for(let P=0;P<C;P++){const L=_E(y,m),{x:j,y:$}=Ku(L[0],l,c,d,p,v,x,R),{x:U,y:z}=Ku(L[1],l,c,d,p,v,x,R),{x:Y,y:re}=Ku(L[2],l,c,d,p,v,x,R);mx(t,M,T,j,$,U,z,Y,re),M=Y,T=re,y+=m}}function xE(t,e,s){const r=(c,o)=>{const h=o.x-c.x,u=o.y-c.y,p=Math.sqrt(h*h+u*u),d=h/p,g=u/p;return{len:p,nx:d,ny:g}},n=(c,o)=>{c===0?t.moveTo(o.x,o.y):t.lineTo(o.x,o.y)};let l=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){n(c,o),l=o;continue}const u=e[(c+1)%e.length],p=r(o,l),d=r(o,u);if(p.len<1e-4||d.len<1e-4){n(c,o),l=o;continue}let g=Math.asin(p.nx*d.ny-p.ny*d.nx),w=1,S=!1;p.nx*d.nx-p.ny*-d.ny<0?g<0?g=Math.PI+g:(g=Math.PI-g,w=-1,S=!0):g>0&&(w=-1,S=!0);const y=g/2;let m,v=Math.abs(Math.cos(y)*h/Math.sin(y));v>Math.min(p.len/2,d.len/2)?(v=Math.min(p.len/2,d.len/2),m=Math.abs(v*Math.sin(y)/Math.cos(y))):m=h;const x=o.x+d.nx*v+-d.ny*m*w,_=o.y+d.ny*v+d.nx*m*w,C=Math.atan2(p.ny,p.nx)+Math.PI/2*w,M=Math.atan2(d.ny,d.nx)-Math.PI/2*w;c===0&&t.moveTo(x+Math.cos(C)*m,_+Math.sin(C)*m),t.arc(x,_,m,C,M,S),l=o}}function wE(t,e,s,r){const n=(o,h)=>Math.sqrt((o.x-h.x)**2+(o.y-h.y)**2),l=(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 p=e[o],d=e[(o+2)%c],g=n(p,h);let w;if(g<1e-4)w=h;else{const m=Math.min(g/2,u);w=l(h,p,m/g)}const S=n(d,h);let y;if(S<1e-4)y=h;else{const m=Math.min(S/2,u);y=l(h,d,m/S)}o===0?t.moveTo(w.x,w.y):t.lineTo(w.x,w.y),t.quadraticCurveTo(h.x,h.y,y.x,y.y,r)}}const bE=new Et;class SE{constructor(e){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new Os,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,n=r[r.length-2],l=r[r.length-1];return(n!==e||l!==s)&&r.push(e,s),this}arc(e,s,r,n,l,c){this._ensurePoly(!1);const o=this._currentPoly.points;return gx(o,e,s,r,n,l,c),this}arcTo(e,s,r,n,l){this._ensurePoly();const c=this._currentPoly.points;return gE(c,e,s,r,n,l),this}arcToSvg(e,s,r,n,l,c,o){const h=this._currentPoly.points;return yE(h,this._currentPoly.lastX,this._currentPoly.lastY,c,o,e,s,r,n,l),this}bezierCurveTo(e,s,r,n,l,c,o){this._ensurePoly();const h=this._currentPoly;return mx(this._currentPoly.points,h.lastX,h.lastY,e,s,r,n,l,c,o),this}quadraticCurveTo(e,s,r,n,l){this._ensurePoly();const c=this._currentPoly;return pE(this._currentPoly.points,c.lastX,c.lastY,e,s,r,n,l),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,n=r.length;for(let l=0;l<e.instructions.length;l++){const c=e.instructions[l];this[c.action](...c.data)}if(e.checkForHoles&&r.length-n>1){let l=null;for(let c=n;c<r.length;c++){const o=r[c];if(o.shape.type==="polygon"){const h=o.shape,u=l==null?void 0:l.shape;u&&u.containsPolygon(h)?(l.holes||(l.holes=[]),l.holes.push(o),r.copyWithin(c,c+1),r.length--,c--):l=o}}}return this}finish(e=!1){this.endPoly(e)}rect(e,s,r,n,l){return this.drawShape(new Et(e,s,r,n),l),this}circle(e,s,r,n){return this.drawShape(new cf(e,s,r),n),this}poly(e,s,r){const n=new Mo(e);return n.closePath=s,this.drawShape(n,r),this}regularPoly(e,s,r,n,l=0,c){n=Math.max(n|0,3);const o=-1*Math.PI/2+l,h=Math.PI*2/n,u=[];for(let p=0;p<n;p++){const d=o-p*h;u.push(e+r*Math.cos(d),s+r*Math.sin(d))}return this.poly(u,!0,c),this}roundPoly(e,s,r,n,l,c=0,o){if(n=Math.max(n|0,3),l<=0)return this.regularPoly(e,s,r,n,c);const h=r*Math.sin(Math.PI/n)-.001;l=Math.min(l,h);const u=-1*Math.PI/2+c,p=Math.PI*2/n,d=(n-2)*Math.PI/n/2;for(let g=0;g<n;g++){const w=g*p+u,S=e+r*Math.cos(w),y=s+r*Math.sin(w),m=w+Math.PI+d,v=w-Math.PI-d,x=S+l*Math.cos(m),_=y+l*Math.sin(m),C=S+l*Math.cos(v),M=y+l*Math.sin(v);g===0?this.moveTo(x,_):this.lineTo(x,_),this.quadraticCurveTo(S,y,C,M,o)}return this.closePath()}roundShape(e,s,r=!1,n){return e.length<3?this:(r?wE(this,e,s,n):xE(this,e,s),this.closePath())}filletRect(e,s,r,n,l){if(l===0)return this.rect(e,s,r,n);const c=Math.min(r,n)/2,o=Math.min(c,Math.max(-c,l)),h=e+r,u=s+n,p=o<0?-o:0,d=Math.abs(o);return this.moveTo(e,s+d).arcTo(e+p,s+p,e+d,s,d).lineTo(h-d,s).arcTo(h-p,s+p,h,s+d,d).lineTo(h,u-d).arcTo(h-p,u-p,e+r-d,u,d).lineTo(e+d,u).arcTo(e+p,u-p,e,u-d,d).closePath()}chamferRect(e,s,r,n,l,c){if(l<=0)return this.rect(e,s,r,n);const o=Math.min(l,Math.min(r,n)/2),h=e+r,u=s+n,p=[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=p.length-1;d>=2;d-=2)p[d]===p[d-2]&&p[d-1]===p[d-3]&&p.splice(d-1,2);return this.poly(p,!0,c)}ellipse(e,s,r,n,l){return this.drawShape(new hf(e,s,r,n),l),this}roundRect(e,s,r,n,l,c){return this.drawShape(new uf(e,s,r,n,l),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 Mo,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 Mo,e)){const s=this.shapePrimitives[this.shapePrimitives.length-1];if(s){let r=s.shape.x,n=s.shape.y;if(s.transform&&!s.transform.isIdentity()){const l=s.transform,c=r;r=l.a*r+l.c*n+l.tx,n=l.b*c+l.d*n+l.ty}this._currentPoly.points.push(r,n)}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 n=s[r],l=n.shape.getBounds(bE);n.transform?e.addRect(l,n.transform):e.addRect(l)}return e}}class cr{constructor(e,s=!1){this.instructions=[],this.uid=rt("graphicsPath"),this._dirty=!0,this.checkForHoles=s,typeof e=="string"?Vk(e,this):this.instructions=(e==null?void 0:e.slice())??[]}get shapePath(){return this._shapePath||(this._shapePath=new SE(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,n,l){const c=this.instructions[this.instructions.length-1],o=this.getLastPoint(jt.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 p=o.x,d=o.y;h=p+(p-h),u=d+(d-u)}return this.instructions.push({action:"bezierCurveTo",data:[h,u,e,s,r,n,l]}),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 n=this.instructions[this.instructions.length-1],l=this.getLastPoint(jt.shared);let c=0,o=0;if(!n||n.action!=="quadraticCurveTo")c=l.x,o=l.y;else{c=n.data[0],o=n.data[1];const h=l.x,u=l.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,n,l){return this.instructions.push({action:"rect",data:[e,s,r,n,l]}),this._dirty=!0,this}circle(e,s,r,n){return this.instructions.push({action:"circle",data:[e,s,r,n]}),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,n,l,c,o){l||(l=n/2);const h=-1*Math.PI/2+c,u=r*2,p=Math.PI*2/u,d=[];for(let g=0;g<u;g++){const w=g%2?l:n,S=g*p+h;d.push(e+w*Math.cos(S),s+w*Math.sin(S))}return this.poly(d,!0,o),this}clone(e=!1){const s=new cr;if(s.checkForHoles=this.checkForHoles,!e)s.instructions=this.instructions.slice();else for(let r=0;r<this.instructions.length;r++){const n=this.instructions[r];s.instructions.push({action:n.action,data:n.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,n=e.c,l=e.d,c=e.tx,o=e.ty;let h=0,u=0,p=0,d=0,g=0,w=0,S=0,y=0;for(let m=0;m<this.instructions.length;m++){const v=this.instructions[m],x=v.data;switch(v.action){case"moveTo":case"lineTo":h=x[0],u=x[1],x[0]=s*h+n*u+c,x[1]=r*h+l*u+o;break;case"bezierCurveTo":p=x[0],d=x[1],g=x[2],w=x[3],h=x[4],u=x[5],x[0]=s*p+n*d+c,x[1]=r*p+l*d+o,x[2]=s*g+n*w+c,x[3]=r*g+l*w+o,x[4]=s*h+n*u+c,x[5]=r*h+l*u+o;break;case"quadraticCurveTo":p=x[0],d=x[1],h=x[2],u=x[3],x[0]=s*p+n*d+c,x[1]=r*p+l*d+o,x[2]=s*h+n*u+c,x[3]=r*h+l*u+o;break;case"arcToSvg":h=x[5],u=x[6],S=x[0],y=x[1],x[0]=s*S+n*y,x[1]=r*S+l*y,x[5]=s*h+n*u+c,x[6]=r*h+l*u+o;break;case"circle":x[4]=Ji(x[3],e);break;case"rect":x[4]=Ji(x[4],e);break;case"ellipse":x[8]=Ji(x[8],e);break;case"roundRect":x[5]=Ji(x[5],e);break;case"addPath":x[0].transform(e);break;case"poly":x[2]=Ji(x[2],e);break;case"regularPoly":case"chamferRect":x[5]=Ji(x[5],e);break;case"closePath":break;default:Ft("unknown transform action",v.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 Ji(t,e){return t?t.prepend(e):e.clone()}function St(t,e,s){const r=t.getAttribute(e);return r?Number(r):s}function CE(t,e){const s=t.querySelectorAll("defs");for(let r=0;r<s.length;r++){const n=s[r];for(let l=0;l<n.children.length;l++){const c=n.children[l];switch(c.nodeName.toLowerCase()){case"lineargradient":e.defs[c.id]=kE(c);break;case"radialgradient":e.defs[c.id]=EE(c);break}}}}function Bs(t,e,s){const r=t.getAttribute(e);if(r!=null&&r.trim().endsWith("%")){const n=Number(r.trim().slice(0,-1));return Number.isNaN(n)?s:n/100}return St(t,e,s)}function _x(t){return(t.getAttribute("gradientUnits")||"objectBoundingBox")==="objectBoundingBox"?"local":"global"}function vx(t){const e=[];for(let s=0;s<t.children.length;s++){const r=t.children[s],n=Bs(r,"offset",0),l=Ss.shared.setValue(r.getAttribute("stop-color")).toNumber();e.push({offset:n,color:l})}return e}function kE(t){const e=Bs(t,"x1",0),s=Bs(t,"y1",0),r=Bs(t,"x2",1),n=Bs(t,"y2",0);return new Yo({type:"linear",start:{x:e,y:s},end:{x:r,y:n},textureSpace:_x(t),colorStops:vx(t)})}function EE(t){const e=Bs(t,"cx",.5),s=Bs(t,"cy",.5),r=Bs(t,"r",.5),n=Bs(t,"fx",e),l=Bs(t,"fy",s),c=Bs(t,"fr",0);return new Yo({type:"radial",center:{x:n,y:l},innerRadius:c,outerCenter:{x:e,y:s},outerRadius:r,textureSpace:_x(t),colorStops:vx(t)})}function Z_(t){const e=t.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return e?e[1]:""}const J_={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 yx(t,e){const s=t.getAttribute("style"),r={},n={},l={strokeStyle:r,fillStyle:n,useFill:!1,useStroke:!1};for(const c in J_){const o=t.getAttribute(c);o&&ev(e,l,c,o.trim())}if(s){const c=s.split(";");for(let o=0;o<c.length;o++){const h=c[o].trim(),[u,p]=h.split(":");J_[u]&&ev(e,l,u,p.trim())}}return{strokeStyle:l.useStroke?r:null,fillStyle:l.useFill?n:null,useFill:l.useFill,useStroke:l.useStroke}}function ev(t,e,s,r){switch(s){case"stroke":if(r!=="none"){if(r.startsWith("url(")){const n=Z_(r);e.strokeStyle.fill=t.defs[n]}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 n=Z_(r);e.fillStyle.fill=t.defs[n]}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 ME(t){if(t.length<=2)return!0;const e=t.map(o=>o.area).sort((o,h)=>h-o),[s,r]=e,n=e[e.length-1],l=s/r,c=r/n;return!(l>3&&c<2)}function TE(t){return t.split(/(?=[Mm])/).filter(r=>r.trim().length>0)}function PE(t){const e=t.match(/[-+]?[0-9]*\.?[0-9]+/g);if(!e||e.length<4)return 0;const s=e.map(Number),r=[],n=[];for(let p=0;p<s.length;p+=2)p+1<s.length&&(r.push(s[p]),n.push(s[p+1]));if(r.length===0||n.length===0)return 0;const l=Math.min(...r),c=Math.max(...r),o=Math.min(...n),h=Math.max(...n);return(c-l)*(h-o)}function tv(t,e){const s=new cr(t,!1);for(const r of s.instructions)e.instructions.push(r)}function AE(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 cr};CE(t,s);const r=t.children,{fillStyle:n,strokeStyle:l}=yx(t,s);for(let c=0;c<r.length;c++){const o=r[c];o.nodeName.toLowerCase()!=="defs"&&xx(o,s,n,l)}return e}function xx(t,e,s,r){const n=t.children,{fillStyle:l,strokeStyle:c}=yx(t,e);l&&s?s={...s,...l}:l&&(s=l),c&&r?r={...r,...c}:c&&(r=c);const o=!s&&!r;o&&(s={color:0});let h,u,p,d,g,w,S,y,m,v,x,_,C,M,T,R,P;switch(t.nodeName.toLowerCase()){case"path":{M=t.getAttribute("d");const L=t.getAttribute("fill-rule"),j=TE(M),$=L==="evenodd",U=j.length>1;if($&&U){const Y=j.map(Q=>({path:Q,area:PE(Q)}));if(Y.sort((Q,J)=>J.area-Q.area),j.length>3||!ME(Y))for(let Q=0;Q<Y.length;Q++){const J=Y[Q],K=Q===0;e.context.beginPath();const D=new cr(void 0,!0);tv(J.path,D),e.context.path(D),K?(s&&e.context.fill(s),r&&e.context.stroke(r)):e.context.cut()}else for(let Q=0;Q<Y.length;Q++){const J=Y[Q],K=Q%2===1;e.context.beginPath();const D=new cr(void 0,!0);tv(J.path,D),e.context.path(D),K?e.context.cut():(s&&e.context.fill(s),r&&e.context.stroke(r))}}else{const Y=L?L==="evenodd":!0;T=new cr(M,Y),e.context.path(T),s&&e.context.fill(s),r&&e.context.stroke(r)}break}case"circle":S=St(t,"cx",0),y=St(t,"cy",0),m=St(t,"r",0),e.context.ellipse(S,y,m,m),s&&e.context.fill(s),r&&e.context.stroke(r);break;case"rect":h=St(t,"x",0),u=St(t,"y",0),R=St(t,"width",0),P=St(t,"height",0),v=St(t,"rx",0),x=St(t,"ry",0),v||x?e.context.roundRect(h,u,R,P,v||x):e.context.rect(h,u,R,P),s&&e.context.fill(s),r&&e.context.stroke(r);break;case"ellipse":S=St(t,"cx",0),y=St(t,"cy",0),v=St(t,"rx",0),x=St(t,"ry",0),e.context.beginPath(),e.context.ellipse(S,y,v,x),s&&e.context.fill(s),r&&e.context.stroke(r);break;case"line":p=St(t,"x1",0),d=St(t,"y1",0),g=St(t,"x2",0),w=St(t,"y2",0),e.context.beginPath(),e.context.moveTo(p,d),e.context.lineTo(g,w),r&&e.context.stroke(r);break;case"polygon":C=t.getAttribute("points"),_=C.match(/-?\d+/g).map(L=>parseInt(L,10)),e.context.poly(_,!0),s&&e.context.fill(s),r&&e.context.stroke(r);break;case"polyline":C=t.getAttribute("points"),_=C.match(/-?\d+/g).map(L=>parseInt(L,10)),e.context.poly(_,!1),r&&e.context.stroke(r);break;case"g":case"svg":break;default:{Ft(`[SVG parser] <${t.nodeName}> elements unsupported`);break}}o&&(s=null);for(let L=0;L<n.length;L++)xx(n[L],e,s,r)}function RE(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 DE{constructor(e,s){this.uid=rt("fillPattern"),this._tick=0,this.transform=new Be;const r=RE(e)?e:{texture:e,repetition:s};this.texture=r.texture,this.textureSpace=r.textureSpace??"global";const n=r.repetition;n&&(this.texture.source.style.addressModeU=sv[n].addressModeU,this.texture.source.style.addressModeV=sv[n].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 LE(t){return Ss.isColorLike(t)}function rv(t){return t instanceof DE}function iv(t){return t instanceof Yo}function BE(t){return t instanceof Ue}function IE(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=Ue.WHITE,{...s,...t}}function OE(t,e,s){return t.texture=e,{...s,...t}}function nv(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 ov(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 jE(t,e){const s={...e,...t},r=Ss.shared.setValue(s.color);return s.alpha*=r.alpha,s.color=r.toNumber(),s}function xo(t,e){if(t==null)return null;const s={},r=t;return LE(t)?IE(s,t,e):BE(t)?OE(s,t,e):rv(t)?nv(s,t,e):iv(t)?ov(s,t,e):r.fill&&rv(r.fill)?nv(r,r.fill,e):r.fill&&iv(r.fill)?ov(r,r.fill,e):jE(r,e)}function av(t,e){const{width:s,alignment:r,miterLimit:n,cap:l,join:c,pixelLine:o,...h}=e,u=xo(t,h);return u?{width:s,alignment:r,miterLimit:n,cap:l,join:c,pixelLine:o,...u}:null}function NE(t,e){let s=1;const r=t.shapePath.shapePrimitives;for(let n=0;n<r.length;n++){const l=r[n].shape;if(l.type!=="polygon")continue;const c=l.points,o=c.length;if(o<6)continue;const h=l.closePath;for(let u=0;u<o;u+=2){if(!h&&(u===0||u===o-2))continue;const p=(u-2+o)%o,d=(u+2)%o,g=c[p],w=c[p+1],S=c[u],y=c[u+1],m=c[d],v=c[d+1],x=g-S,_=w-y,C=m-S,M=v-y,T=x*x+_*_,R=C*C+M*M;if(T<1e-12||R<1e-12)continue;let j=(x*C+_*M)/Math.sqrt(T*R);j<-1?j=-1:j>1&&(j=1);const $=Math.sqrt((1-j)*.5);if($<1e-6)continue;const U=Math.min(1/$,e);U>s&&(s=U)}}return s}const FE=new jt,lv=new Be,gf=class Gs extends Qs{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 cr,this._transform=new Be,this._fillStyle={...Gs.defaultFillStyle},this._strokeStyle={...Gs.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new Os,this._boundsDirty=!0}clone(){const e=new Gs;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=xo(e,Gs.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(e){this._strokeStyle=av(e,Gs.defaultStrokeStyle)}setFillStyle(e){return this._fillStyle=xo(e,Gs.defaultFillStyle),this}setStrokeStyle(e){return this._strokeStyle=xo(e,Gs.defaultStrokeStyle),this}texture(e,s,r,n,l,c){return this.instructions.push({action:"texture",data:{image:e,dx:r||0,dy:n||0,dw:l||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 cr,this}fill(e,s){let r;const n=this.instructions[this.instructions.length-1];return this._tick===0&&(n==null?void 0:n.action)==="stroke"?r=n.data.path:r=this._activePath.clone(),r?(e!=null&&(s!==void 0&&typeof e=="number"&&(Le(vt,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),e={color:e,alpha:s}),this._fillStyle=xo(e,Gs.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(jt.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=av(e,Gs.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,n,l,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,n,l,c),this}arcTo(e,s,r,n,l){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*n+c.tx,c.b*r+c.d*n+c.ty,l),this}arcToSvg(e,s,r,n,l,c,o){this._tick++;const h=this._transform;return this._activePath.arcToSvg(e,s,r,n,l,h.a*c+h.c*o+h.tx,h.b*c+h.d*o+h.ty),this}bezierCurveTo(e,s,r,n,l,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*n+h.tx,h.b*r+h.d*n+h.ty,h.a*l+h.c*c+h.tx,h.b*l+h.d*c+h.ty,o),this}closePath(){var e;return this._tick++,(e=this._activePath)==null||e.closePath(),this}ellipse(e,s,r,n){return this._tick++,this._activePath.ellipse(e,s,r,n,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,n=this._activePath.instructions,l=r.a*e+r.c*s+r.tx,c=r.b*e+r.d*s+r.ty;return n.length===1&&n[0].action==="moveTo"?(n[0].data[0]=l,n[0].data[1]=c,this):(this._activePath.moveTo(l,c),this)}quadraticCurveTo(e,s,r,n,l){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*n+c.tx,c.b*r+c.d*n+c.ty,l),this}rect(e,s,r,n){return this._tick++,this._activePath.rect(e,s,r,n,this._transform.clone()),this}roundRect(e,s,r,n,l){return this._tick++,this._activePath.roundRect(e,s,r,n,l,this._transform.clone()),this}poly(e,s){return this._tick++,this._activePath.poly(e,s,this._transform.clone()),this}regularPoly(e,s,r,n,l=0,c){return this._tick++,this._activePath.regularPoly(e,s,r,n,l,c),this}roundPoly(e,s,r,n,l,c){return this._tick++,this._activePath.roundPoly(e,s,r,n,l,c),this}roundShape(e,s,r,n){return this._tick++,this._activePath.roundShape(e,s,r,n),this}filletRect(e,s,r,n,l){return this._tick++,this._activePath.filletRect(e,s,r,n,l),this}chamferRect(e,s,r,n,l,c){return this._tick++,this._activePath.chamferRect(e,s,r,n,l,c),this}star(e,s,r,n,l=0,c=0){return this._tick++,this._activePath.star(e,s,r,n,l,c,this._transform.clone()),this}svg(e){return this._tick++,AE(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,n,l,c){return e instanceof Be?(this._transform.set(e.a,e.b,e.c,e.d,e.tx,e.ty),this):(this._transform.set(e,s,r,n,l,c),this)}transform(e,s,r,n,l,c){return e instanceof Be?(this._transform.append(e),this):(lv.set(e,s,r,n,l,c),this._transform.append(lv),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],n=r.action;if(n==="fill"){const l=r.data;e.addBounds(l.path.bounds)}else if(n==="texture"){const l=r.data;e.addFrame(l.dx,l.dy,l.dx+l.dw,l.dy+l.dh,l.transform)}if(n==="stroke"){const l=r.data,c=l.style.alignment;let o=l.style.width*(1-c);l.style.join==="miter"&&(o*=NE(l.path,l.style.miterLimit));const h=l.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 n;if(!this.bounds.containsPoint(e.x,e.y))return!1;const s=this.instructions;let r=!1;for(let l=0;l<s.length;l++){const c=s[l],o=c.data,h=o.path;if(!c.action||!h)continue;const u=o.style,p=h.shapePath.shapePrimitives;for(let d=0;d<p.length;d++){const g=p[d].shape;if(!u||!g)continue;const w=p[d].transform,S=w?w.applyInverse(e,FE):e;if(c.action==="fill")r=g.contains(S.x,S.y);else{const m=u;r=g.strokeContains(S.x,S.y,m.width,m.alignment)}const y=o.hole;if(y){const m=(n=y.shapePath)==null?void 0:n.shapePrimitives;if(m)for(let v=0;v<m.length;v++)m[v].shape.contains(S.x,S.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}};gf.defaultFillStyle={color:16777215,alpha:1,texture:Ue.WHITE,matrix:null,fill:null,textureSpace:"local"};gf.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:Ue.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};let mo=gf;class HE{constructor(){this.isBatchable=!1}reset(){this.isBatchable=!1,this.context=null,this.graphicsData&&(this.graphicsData.destroy(),this.graphicsData=null)}destroy(){this.reset()}}class $E{constructor(){this.instructions=new of}init(){this.instructions.reset()}destroy(){this.instructions.destroy(),this.instructions=null}}const _f=class Nd{constructor(e){this._renderer=e,this._managedContexts=new vc({renderer:e,type:"resource",name:"graphicsContext"})}init(e){Nd.defaultOptions.bezierSmoothness=(e==null?void 0:e.bezierSmoothness)??Nd.defaultOptions.bezierSmoothness}getContextRenderData(e){return this.getGpuContext(e).graphicsData||this._initContextRenderData(e)}updateGpuContext(e){const s=e._gpuData,r=!!s[this._renderer.uid],n=s[this._renderer.uid]||this._initContext(e);return(e.dirty||!r)&&(r&&n.reset(),n.isBatchable=!1,e.dirty=!1),n}getGpuContext(e){return e._gpuData[this._renderer.uid]||this._initContext(e)}_initContextRenderData(e){const s=new $E,r=this.getGpuContext(e);return r.graphicsData=s,s.init(),s}_initContext(e){const s=new HE;return s.context=e,e._gpuData[this._renderer.uid]=s,this._managedContexts.add(e),s}destroy(){this._managedContexts.destroy(),this._renderer=null}};_f.extension={type:[Oe.CanvasSystem],name:"graphicsContext"};_f.defaultOptions={bezierSmoothness:.5};let zE=_f;class wx{constructor(e,s){this.state=$0.for2d(),this.renderer=e,this._adaptor=s,this.renderer.runners.contextChange.add(this),this._managedGraphics=new vc({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}}wx.extension={type:[Oe.CanvasPipes],name:"graphics"};function WE(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 UE{constructor(){this.batches=[],this.batched=!1}destroy(){this.batches.forEach(e=>{ts.return(e)}),this.batches.length=0}}class bx{constructor(e,s){this.state=$0.for2d(),this.renderer=e,this._adaptor=s,this.renderer.runners.contextChange.add(this),this._managedGraphics=new vc({renderer:e,type:"renderable",priority:-1,name:"graphics"})}contextChange(){this._adaptor.contextChange(this.renderer)}validateRenderable(e){const s=e.context,r=!!e._gpuData,l=this.renderer.graphicsContext.updateGpuContext(s);return!!(l.isBatchable||r!==l.isBatchable)}addRenderable(e,s){const n=this.renderer.graphicsContext.updateGpuContext(e.context);(e.didViewUpdate||!e._gpuData[this.renderer.uid])&&this._rebuild(e),n.isBatchable?this._addToBatcher(e,s):(this.renderer.renderPipes.batch.break(s),s.add(e))}updateRenderable(e){const r=this._getGpuDataForRenderable(e).batches;for(let n=0;n<r.length;n++){const l=r[n];l._batcher.updateElement(l)}}execute(e){if(!e.isRenderable)return;const s=this.renderer,r=e.context;if(!s.graphicsContext.getGpuContext(r).batches.length)return;const l=r.customShader||this._adaptor.shader;this.state.blendMode=e.groupBlendMode;const c=l.resources.localUniforms.uniforms;c.uTransformMatrix=e.groupTransform,c.uRound=s._roundPixels|e._roundPixels,WE(e.groupColorAlpha,c.uColor,0),this._adaptor.execute(this,e)}_rebuild(e){const s=this._getGpuDataForRenderable(e),n=this.renderer.graphicsContext.updateGpuContext(e.context);s.destroy(),n.isBatchable&&this._updateBatchesForRenderable(e,s)}_addToBatcher(e,s){const r=this.renderer.renderPipes.batch,n=this._getGpuDataForRenderable(e).batches;for(let l=0;l<n.length;l++){const c=n[l];r.addToBatch(c,s)}}_getGpuDataForRenderable(e){return e._gpuData[this.renderer.uid]||this._initGpuDataForRenderable(e)}_initGpuDataForRenderable(e){const s=new UE;return e._gpuData[this.renderer.uid]=s,this._managedGraphics.add(e),s}_updateBatchesForRenderable(e,s){const r=e.context,l=this.renderer.graphicsContext.getGpuContext(r),c=this.renderer._roundPixels|e._roundPixels;s.batches=l.batches.map(o=>{const h=ts.get(df);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}}bx.extension={type:[Oe.WebGLPipes,Oe.WebGPUPipes],name:"graphics"};Mt.add(wx);Mt.add(bx);Mt.add(zE);Mt.add(mf);class gi extends v0{constructor(e){e instanceof mo&&(e={context:e});const{context:s,roundPixels:r,...n}=e||{};super({label:"Graphics",...n}),this.renderPipeId="graphics",s?this.context=s:(this.context=this._ownedContext=new mo,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 gi(this._context.clone()):(this._ownedContext=null,new gi(this._context))}lineStyle(e,s,r){Le(vt,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");const n={};return e&&(n.width=e),s&&(n.color=s),r&&(n.alpha=r),this.context.strokeStyle=n,this}beginFill(e,s){Le(vt,"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(){Le(vt,"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!==mo.defaultStrokeStyle.width||e.color!==mo.defaultStrokeStyle.color||e.alpha!==mo.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...e){return Le(vt,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",e)}drawEllipse(...e){return Le(vt,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",e)}drawPolygon(...e){return Le(vt,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",e)}drawRect(...e){return Le(vt,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",e)}drawRoundedRect(...e){return Le(vt,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",e)}drawStar(...e){return Le(vt,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",e)}}Mt.add(TS,PS);function vf(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 cv=t=>{let e;const s=new Set,r=(u,p)=>{const d=typeof u=="function"?u(e):u;if(!Object.is(d,e)){const g=e;e=p??(typeof d!="object"||d===null)?d:Object.assign({},e,d),s.forEach(w=>w(e,g))}},n=()=>e,o={setState:r,getState:n,getInitialState:()=>h,subscribe:u=>(s.add(u),()=>s.delete(u))},h=e=t(r,n,o);return o},VE=(t=>t?cv(t):cv),GE=t=>t;function qE(t,e=GE){const s=cl.useSyncExternalStore(t.subscribe,cl.useCallback(()=>e(t.getState()),[t,e]),cl.useCallback(()=>e(t.getInitialState()),[t,e]));return cl.useDebugValue(s),s}const hv=t=>{const e=VE(t),s=r=>qE(e,r);return Object.assign(s,e),s},Sx=(t=>t?hv(t):hv),_t={ink:"#241a2e",navy:"#1d2b53",blue:"#29adff",red:"#ff004d",orange:"#ffa300",green:"#00e436",lav:"#83769c",yellow:"#ffec27",pink:"#ff77a8",white:"#fff1e8"},_n={working:{label:"Working",color:_t.blue,dim:"#1d6fb8"},"needs-input":{label:"Needs input",color:_t.red,dim:"#7e0f33"},"in-review":{label:"In review",color:_t.orange,dim:"#a86a00"},"review-passed":{label:"Review passed",color:_t.green,dim:"#00873a"},idle:{label:"Idle",color:_t.lav,dim:"#5a5170"}},Cx={pending:{label:"Queued",color:_t.lav,dim:"#5a5170"},reviewing:{label:"Reviewing",color:_t.orange,dim:"#a86a00"},"changes-requested":{label:"Changes",color:_t.red,dim:"#7e0f33"},passed:{label:"Passed",color:_t.green,dim:"#00873a"}},vi=["#ff77a8","#29adff","#ffd23a","#00e436","#ff8a3d","#a98bff","#3ee0d0","#ff5c5c","#c2c3c7","#b0e04a","#f0a6ff","#6fa8ff"];function Zl(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)))},n=r(s>>16&255),l=r(s>>8&255),c=r(s&255);return`#${(n<<16|l<<8|c).toString(16).padStart(6,"0")}`}const KE=(t={})=>({resources:{cpus:null,memoryGb:null},allow:["registry.npmjs.org"],deny:[],...t});function ws(t,e,s,r,n={}){const l=n.isLead??!1;return{id:t,name:e,role:s,isLead:l,cli:"claude",model:l?"Opus":"Sonnet",mode:"sandbox",color:r,skills:l?["plan","review","honest"]:["plan","debug","review"],roleMd:l?`# ${e} — Lead
|
|
280
|
+
|
|
281
|
+
You plan and assign work. You never write app code.
|
|
282
|
+
Use the HQ Team MCP: list_workers, get_status, assign_task, send_message.`:`# ${e} — ${s}
|
|
283
|
+
|
|
284
|
+
You build the tasks assigned to you. One task = one branch = one PR.
|
|
285
|
+
Only edit the files your task file allows.`,sandbox:KE(l?{}:{allow:["registry.npmjs.org","console.instacloud.com"]}),workspacePath:null,...n}}function Fl(t,e,s){return e.map(([r,n],l)=>({id:`${t}-T${String(l+1).padStart(2,"0")}`,boardId:t,title:r,ownerId:n,status:"done",needs:[],prNumber:s+l}))}const kx={id:"askwell",label:"Askwell · 3 agents",config:{project:{id:"askwell",name:"Askwell",repo:"jsmastery-pro/askwell",path:"~/developer/askwell",hqPort:7420},team:[ws("john","John","Lead","#ff77a8",{isLead:!0}),ws("bob","Bob","Developer","#29adff"),ws("alice","Alice","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:[...Fl("P0",[["Repo + CI","bob"],["Shared contract","alice"]],1),...Fl("P1",[["Auth with Clerk","bob"],["Database schema","alice"],["App shell","bob"]],3),...Fl("P2",[["Projects CRUD","alice"],["Widget script tag","bob"],["Widget bubble UI","alice"],["Embed settings","bob"],["PostHog events","alice"]],6),{id:"P3-T01",boardId:"P3",title:"Knowledge upload",ownerId:"alice",status:"todo",needs:[],prNumber:null},{id:"P3-T02",boardId:"P3",title:"Chat route",ownerId:"bob",status:"todo",needs:[],prNumber:null},{id:"P3-T03",boardId:"P3",title:"PDF text extraction",ownerId:"alice",status:"todo",needs:[],prNumber:null},{id:"P3-T04",boardId:"P3",title:"Rate limit",ownerId:"bob",status:"todo",needs:[],prNumber:null},{id:"P3-T05",boardId:"P3",title:"Connect panel to chat",ownerId:"bob",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?"]},YE={id:"big-team",label:"Shipyard · 7 agents",config:{project:{id:"shipyard",name:"Shipyard",repo:"jsmastery-pro/shipyard",path:"~/developer/shipyard",hqPort:7420},team:[ws("maya","Maya","Lead","#ff77a8",{isLead:!0}),ws("bob","Bob","Developer","#29adff"),ws("alice","Alice","Developer","#ffd23a"),ws("kenji","Kenji","Developer","#00e436",{cli:"codex",model:""}),ws("priya","Priya","QA","#a98bff",{skills:["test","review"]}),ws("leo","Leo","Designer","#ff8a3d",{skills:["frontend-design","review"]}),ws("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:[...Fl("WEB",[["Marketing page","leo"],["Sign-in","bob"]],1),{id:"WEB-T03",boardId:"WEB",title:"Fleet dashboard",ownerId:"alice",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:"bob",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?"]},XE={id:"duo",label:"Notely · 2 agents",config:{project:{id:"notely",name:"Notely",repo:"you/notely",path:"~/code/notely",hqPort:7420},team:[ws("ada","Ada","Lead","#a98bff",{isLead:!0,model:"Sonnet"}),ws("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?"]},Yu=[kx,YE,XE],QE=kx.id,yf=t=>`\x1B[${t}m`,Us=t=>{const e=parseInt(t.slice(1),16);return yf(`38;2;${e>>16&255};${e>>8&255};${e&255}`)},tt=yf("0"),xf=yf("1"),$e={tool:Us("#00e436"),out:Us("#8d99c4"),ok:Us("#6cf08a"),err:Us("#ff5c86"),warn:Us("#ffc14d"),think:Us("#c9b6ff"),say:Us("#dfe6ff"),dim:Us("#66729f"),pink:Us("#ff77a8"),yellow:Us("#ffec27")},yt=(t,e)=>({text:`${$e.tool}●${tt} ${xf}${t}${tt}(${e})`}),dt=(t,e=$e.out)=>({text:` ${$e.dim}└${tt} ${e}${t}${tt}`}),dn=t=>({text:`${$e.think}✻ ${t}${tt}`,typed:!0}),Jl=t=>({text:`${$e.say}${t}${tt}`,typed:!0}),Xo={text:""},vn=t=>t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,""),ec=(t,e)=>t[Math.abs(e)%t.length];function Ex(t,e,s,r){return[{text:`${$e.pink}╭──────────────────────────────────────────╮${tt}`},{text:`${$e.pink}│${tt} ${xf}✻ Claude Code${tt} ${$e.dim}${t} · ${e}${tt}`},{text:`${$e.pink}│${tt} ${$e.dim}${s} · ${r==="sandbox"?"docker sandbox (microVM)":"local worktree"}${tt}`},{text:`${$e.pink}╰──────────────────────────────────────────╯${tt}`},Xo]}function ZE(t,e,s){const r=vn(e);return[{text:`${$e.yellow}> Pull main, start ${t}${tt}`},Xo,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`),dn(`${e}: read the allowed files first, then write the tests.`)]}const JE=["route.ts","schema.ts","handler.ts","index.tsx","service.ts","utils.ts"];function eM(t,e){const s=vn(t),r=`src/${s}/${ec(JE,e)}`,n=6+e%30,l=[[yt("Read",r),dt(`Read ${40+e%90} lines`),dn("The contract already exports the type I need.")],[yt("Update",r),dt(`Updated with ${n} additions and ${e%7} removals`,$e.ok)],[yt("Write",`src/${s}/${s}.test.ts`),dt(`Wrote ${20+e%40} lines`,$e.ok),dn("Covering the error path too.")],[yt("Bash",`pnpm test ${s}`),dt(`✓ ${4+e%12} passed (${(.6+e%9/10).toFixed(1)}s)`,$e.ok)],[yt("Bash","pnpm typecheck"),dt("No errors",$e.ok)],[yt("Grep",`"${s.split("-")[0]}" in src/`),dt(`${2+e%6} matches`)]];return ec(l,e)}function tM(t){return[Xo,{text:`${$e.err}? ${xf}Needs your input:${tt} ${$e.say}${t}${tt}`},{text:`${$e.dim} (type your answer and press Enter)${tt}`}]}function sM(t){return[{text:`${$e.ok}✓ Answer received${t?` from ${t}`:""}. Continuing.${tt}`}]}function rM(t,e,s,r,n){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}`,$e.ok),Jl(n?`Opened PR #${t}. Waiting for ${n}.`:`Opened PR #${t}.`)]}function iM(t,e,s){return[Xo,{text:`${$e.warn}! ${s} requested changes on #${t} (${e.length} comments)${tt}`},...e.map(r=>dt(r,$e.warn)),dn("Fixing the review comments on my own PR.")]}function nM(t){return[yt("Bash","git commit -am 'Address review comments'"),dt("1 commit"),yt("Bash","git push"),dt(`Updated #${t}`,$e.ok)]}function oM(t,e,s){return[{text:`${$e.ok}✓ ${e} approved #${t}. Waiting for ${s} to merge.${tt}`}]}function aM(t){return[{text:`${$e.ok}✓ #${t} merged into main.${tt}`},Xo,Jl("Done. Free for the next task.")]}function uv(t,e,s,r){return r?[{text:`${$e.pink}✉ ${t}:${tt} ${$e.say}${s}${tt}`}]:[yt("hq.send_message",`to: "${e}"`),dt(`"${s}"`)]}function lM(t,e){const s=[[yt("hq.get_status",""),dt("All workers reporting."),dn(`Checking what is left on ${t}.`)],[yt("Read","docs/plan.md"),dt(`Read ${80+e%60} lines`),dn("Ordering tasks so nobody waits on a contract change.")],[yt("hq.list_workers",""),dt("Workers listed.")]];return ec(s,e)}function cM(t,e,s){return[yt("hq.assign_task",`"${t}", to: "${s}"`),dt(`Sent to ${s}: Pull main, start ${t} (${e})`,$e.ok)]}function hM(t,e){return[yt("Write",`docs/tasks/${t}.md`),dt(`Created task: ${e}`,$e.ok)]}const uM=["Got it. I'll take that into account.","Understood. Adjusting the plan.","On it.","Good call. Updating the task file."];function dv(t,e){return t?[Jl(e%2?"Got it. I'll reassign the next free task.":"Noted. I'll keep that in the plan.")]:[Jl(ec(uM,e))]}const fv=["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"],pv=[["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 mv{constructor(e){me(this,"jobs",new Map);me(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,Ex(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,n]of this.jobs){const l=s.status(r);if(!l||l.state!=="working")continue;n.left-=e,n.nextChunk-=e;const c=s.task(n.taskId);n.nextChunk<=0&&c&&(n.nextChunk=this.r(2.5,4),s.write(r,eM(c.title,this.s())),s.rand()<.12&&this.chatter(r)),n.inputAt!==null&&n.left<=n.inputAt?(n.inputAt=null,this.ask(r,s.preset.questions[Math.floor(s.rand()*s.preset.questions.length)]??"Which approach do you prefer?")):n.left<=0&&(n.phase==="build"?this.openPr(r,n):this.pushFix(r,n))}}leadLoop(){var n;const e=this.w,s=e.lead(),r=e.activeBoards()[0];if(((n=e.status(s.id))==null?void 0:n.state)==="working"){e.write(s.id,lM((r==null?void 0:r.title)??"the plan",this.s()));const l=[r?`Planning ${r.title}`:"Planning","Checking merge order","Reading open PRs","Writing task files"];e.setStatus(s.id,{note:l[Math.floor(e.rand()*l.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,n=e.snap.pullRequests.find(o=>!o.merged),l=(r[Math.floor(e.rand()*r.length)]??"Approve the plan?").replace("{pr}",String((n==null?void 0:n.number)??e.nextPr));((c=e.status(s.id))==null?void 0:c.state)==="working"&&this.ask(s.id,l),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 n=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),l=e.lead();for(let c=0;c<2;c++){const o=e.snap.tasks.filter(d=>d.boardId===n.id).length+1,h=e.preset.taskPool,u=h[(o+c*3)%h.length]??`Task ${o}`,p={id:`${n.id}-T${String(o).padStart(2,"0")}`,boardId:n.id,title:u,ownerId:null,status:"todo",needs:[],prNumber:null};e.putTask(p),e.write(l.id,hM(p.id,u)),e.activity("task.created",l.id,`${l.name} added ${p.id} ${u} to ${n.title}`)}}nextTaskFor(e){const s=this.w,r=new Set(s.activeBoards().map(l=>l.id)),n=l=>l.status==="todo"&&r.has(l.boardId)&&l.needs.every(c=>{var o;return((o=s.task(c))==null?void 0:o.status)==="done"});return s.snap.tasks.find(l=>n(l)&&l.ownerId===e)??s.snap.tasks.find(l=>n(l)&&l.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 n=s.lead();s.patchTask(r.id,{ownerId:e}),s.write(n.id,cM(r.id,r.title,s.name(e))),s.activity("task.assigned",n.id,`${n.name} assigned ${r.id} ${r.title} to ${s.name(e)}`),s.message(n.id,e,`Pull main, start ${r.id}.`),s.after(1.5,()=>this.begin(e,r.id),e)}begin(e,s){const r=this.w,n=r.task(s);if(!n||!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} ${n.title}`),r.write(e,ZE(s,n.title,this.s()));const l=this.r(10,18);this.jobs.set(e,{taskId:s,phase:"build",left:l,inputAt:r.rand()<.35?l*.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,tM(s)),r.after(this.r(7,9),()=>this.answer(e,"you"),e)}answer(e,s){var n,l;const r=this.w;((n=r.status(e))==null?void 0:n.state)==="needs-input"&&(r.setStatus(e,{state:"working",note:(l=r.cfg(e))!=null&&l.isLead?"Planning":null}),r.activity("agent.answered",e,`${s==="you"?"You":s} answered ${r.name(e)}`),r.write(e,sM(s==="you"?"":s)))}chatter(e){const s=this.w,r=s.workers().filter(o=>o.id!==e);if(!r.length)return;const n=r[Math.floor(s.rand()*r.length)],[l,c]=pv[Math.floor(s.rand()*pv.length)];s.message(e,n.id,l),s.after(this.r(2.5,4),()=>s.cfg(n.id)&&s.cfg(e)&&s.message(n.id,e,c),n.id)}openPr(e,s){const r=this.w,n=r.task(s.taskId);if(!n)return void this.jobs.delete(e);const l=r.snap.config.workflow,c=r.nextPr++;s.prNumber=c,r.patchTask(n.id,{status:"in-review",prNumber:c}),r.putPr({number:c,title:`[${n.id}] ${n.title}`,taskId:n.id,authorId:e,review:l.review.enabled?"pending":"passed",openComments:0,mergeable:!l.review.enabled,merged:!1,openedAt:new Date().toISOString()}),r.write(e,rM(c,n.id,n.title,r.snap.config.project.repo,l.review.enabled?r.reviewerLabel():null)),r.activity("pr.opened",e,`${r.name(e)} opened PR #${c} ${n.title}`),l.deploy.enabled&&l.deploy.perAgentEnvironments&&r.deploy(e),l.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,n=this.jobs.get(e);if(!r.pr(s)||!n)return;const c=r.reviewerLabel();if(n.phase==="build"&&r.rand()<.4){const o=1+Math.floor(r.rand()*3),h=Array.from({length:o},(u,p)=>fv[(s+p*2)%fv.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,iM(s,h,c)),Object.assign(n,{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,oM(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 n=s.prNumber;s.left=1/0,r.write(e,nM(n)),r.setStatus(e,{state:"in-review",note:`Waiting for ${r.reviewerLabel()}`}),r.after(2,()=>this.review(e,n),e)}merge(e,s){var o;const r=this.w,n=r.pr(s);if(!n||n.merged)return;const l=r.snap.config.workflow,c=r.lead();if(r.patchPr(s,{merged:!0,mergeable:!0}),r.patchTask(n.taskId,{status:"done"}),this.pruneDone((o=r.task(n.taskId))==null?void 0:o.boardId),l.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",l.merge.by==="lead"?c.id:null,`${l.merge.by==="lead"?c.name:"You"} merged #${s}`),r.write(e,aM(s)),l.deploy.enabled){r.deploy("main");const h={instacloud:"InstaCloud",vercel:"Vercel",custom:"custom deploy"}[l.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(n=>n.boardId===e&&n.status==="done");for(const n of r.slice(0,Math.max(0,r.length-30)))s.snap.tasks=s.snap.tasks.filter(l=>l.id!==n.id),s.emit({type:"task.removed",taskId:n.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 mi=()=>new Date().toISOString();function Mx(){const t=(e,s,r,n)=>({id:e,label:s,status:"ok",detail:r,neededFor:n,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("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:mi()}}function Tx(t,e){const s={};for(const r of t){let n=0;const l=(c,o,h="hq")=>({id:`${r.id}-${++n}`,decision:c,resources:[o],source:h});s[r.id]={rules:[l("allow","api.anthropic.com","kit"),...r.sandbox.allow.map(c=>l("allow",c)),...r.sandbox.deny.map(c=>l("deny",c))],keys:r.isLead?[]:["openai"],envFile:{path:`~/.jsmhq/${vn(e)}/${r.id}.env`,exists:!r.isLead},syncError:null}}return{basePolicy:"balanced",proxy:null,globalKeys:["anthropic","github"],agents:s,checkedAt:mi()}}function Px(t,e){return{state:"running",detail:null,workspace:`~/.jsmhq/${vn(t)}/${e}`,sandbox:{cpus:8,memoryGb:8}}}class tc{constructor(e){me(this,"snap");me(this,"preset");me(this,"simTime",0);me(this,"speed",1);me(this,"rand",vf(7));me(this,"nextPr");me(this,"seq",0);me(this,"timers",[]);me(this,"term",new Map);me(this,"emitFn",null);this.preset=e,this.snap=tc.initialSnapshot(e),this.nextPr=e.mergedPrs+1}static initialSnapshot(e){const s=structuredClone(e.config),r=structuredClone(e.tasks),n=s.team.filter(c=>!c.isLead),l=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=n[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:Mx(),sbx:Tx(s.team,s.project.name),config:s,agents:s.team.map(c=>({agentId:c.id,state:"idle",currentTaskId:null,stateSince:mi(),note:null,session:Px(s.project.name,c.id)})),boards:structuredClone(e.boards),tasks:r,pullRequests:l,environments:[],messages:[],activity:[]}}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,n)=>r.at-n.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 n=s.state!==void 0&&s.state!==r.state;Object.assign(r,s),n&&(r.stateSince=mi()),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=vn(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 n=this.snap.environments.find(c=>c.name===r),l=this.envUrl(r);(!n||n.url!==l)&&this.putEnv({name:r,agentId:r==="main"?null:r,url:l,status:(n==null?void 0:n.status)??"live",lastDeployAt:(n==null?void 0:n.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(n=>n.name===e);r&&this.putEnv({...r,status:"live",lastDeployAt:mi()})}))}configChanged(){this.emit({type:"config.updated",config:structuredClone(this.snap.config)})}activity(e,s,r){const n={id:this.id("a"),at:mi(),type:e,agentId:s,text:r};this.snap.activity=[n,...this.snap.activity].slice(0,50),this.emit({type:"activity",event:n})}message(e,s,r){const n={id:this.id("m"),at:mi(),fromId:e,toId:s,text:r};this.snap.messages=[n,...this.snap.messages].slice(0,100),this.emit({type:"message",message:n}),this.activity("message",e==="you"?null:e,`${this.name(e)} → ${this.name(s)}: ${r}`),e!=="you"&&this.write(e,uv(this.name(e),this.name(s),r,!1)),this.write(s,uv(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 n=e,l="";for(;r.lines.length&&n>0;){const c=r.lines[0];if(!c.typed){l+=c.text+`\r
|
|
286
|
+
`,r.lines.shift(),n-=4;continue}let o=r.pos;for(;o<c.text.length&&n>0;)if(c.text[o]==="\x1B"){const h=c.text.indexOf("m",o);o=h===-1?c.text.length:h+1}else o+=1,n-=1;l+=c.text.slice(r.pos,o),r.pos=o,o>=c.text.length&&(l+=`\r
|
|
287
|
+
`,r.lines.shift(),r.pos=0)}l&&this.emit({type:"terminal.output",agentId:s,data:l})}}}const dM=50,fM=30;function pM(){let t=QE,e=new tc(o(t)),s=new mv(e),r=null,n=[],l=0,c=new Map;function o(S){return Yu.find(y=>y.id===S)??Yu[0]}function h(){const S=e.speed;e.clearTimers(),e.setEmitter(null),e=new tc(o(t)),e.speed=S,s=new mv(e),c=new Map}function u(){e.setEmitter(S=>r==null?void 0:r(S)),r==null||r({type:"snapshot",snapshot:structuredClone(e.snap)}),s.start()}function p(){const S=performance.now(),y=Math.min(.25,(S-l)/1e3)*e.speed;l=S,e.advance(y),s.tick(y)}function d(){const S=e.snap.sbx,y=Tx(e.snap.config.team,e.snap.config.project.name);y.globalKeys=S.globalKeys,y.proxy=S.proxy;for(const m of Object.keys(y.agents))S.agents[m]&&(y.agents[m].keys=S.agents[m].keys);e.snap.sbx=y,e.emit({type:"sbx.updated",sbx:structuredClone(y)})}function g(S,y){e.write(S,[{text:`\x1B[38;2;102;114;159mhq ▸ ${y}\x1B[0m`}])}return{connect(S,y){return r=S,y==null||y("open"),l=performance.now(),h(),u(),n=[window.setInterval(p,dM),window.setInterval(()=>e.flushTerminals(Math.max(1,Math.round(e.speed*1.3))),fM)],()=>{n.forEach(m=>window.clearInterval(m)),n=[],e.clearTimers(),e.setEmitter(null),r=null}},sendTerminalInput(S,y){let m=c.get(S)??"";for(const v of y)if(v==="\r"){const x=m.trim();if(m="",r==null||r({type:"terminal.output",agentId:S,data:`\r
|
|
288
|
+
`}),!x)continue;const _=e.status(S);(_==null?void 0:_.state)==="needs-input"?e.after(.6,()=>s.answer(S,"you")):e.after(1,()=>{var C;return e.write(S,dv(!!((C=e.cfg(S))!=null&&C.isLead),x.length))})}else v===""?m.length&&(m=m.slice(0,-1),r==null||r({type:"terminal.output",agentId:S,data:"\b \b"})):v>=" "&&(m+=v,r==null||r({type:"terminal.output",agentId:S,data:v}));c.set(S,m)},sendMessage(S,y){!e.cfg(S)||!y.trim()||(e.message("you",S,y.trim()),e.after(1.2,()=>{var m;return e.write(S,dv(!!((m=e.cfg(S))!=null&&m.isLead),y.length))}))},resizeTerminal(){},startAgent(S){var m;const y=e.status(S);!y||y.session.state==="running"||(e.setStatus(S,{session:{...y.session,state:"running",detail:null}}),e.activity("session",S,`${e.name(S)}'s session started`),(m=e.cfg(S))!=null&&m.isLead||s.startWorker(S,1.5))},stopAgent(S){const y=e.status(S);y&&(s.stopAgent(S),e.setStatus(S,{state:"idle",currentTaskId:null,note:"Stopped",session:{...y.session,state:"stopped",detail:null}}),e.activity("session",S,`${e.name(S)}'s session stopped`))},recreateSandbox(S){var v;const y=e.status(S),m=(v=e.cfg(S))==null?void 0:v.sandbox.resources;!y||!m||(e.setStatus(S,{session:{...y.session,sandbox:{cpus:m.cpus??8,memoryGb:m.memoryGb??8}}}),g(S,`sbx rm hq-…-${S} && sbx run --cpus ${m.cpus??"auto"} --memory ${m.memoryGb??"auto"}g … (mock)`),e.activity("session",S,`Recreated ${e.name(S)}'s sandbox`))},openWorkspace(S){var y;g(S,`open ${((y=e.status(S))==null?void 0:y.session.workspace)??"?"} (mock: nothing opens)`)},recheckSetup(){e.snap.setup=Mx(),e.emit({type:"setup.updated",setup:e.snap.setup})},runSetupFix(){},assignTask(S,y){var x;const m=e.task(S),v=e.cfg(y);!m||!v||v.isLead||m.status!=="todo"||(e.patchTask(S,{ownerId:y}),e.activity("task.assigned",null,`You assigned ${S} ${m.title} to ${v.name}`),!s.hasJob(y)&&((x=e.status(y))==null?void 0:x.state)==="idle"&&(e.message(e.lead().id,y,`Pull main, start ${S}.`),e.after(1,()=>s.begin(y,S),y)))},addAgent(S){const y=e.snap.config.team,m=vn(S.name)||"agent";let v=m;for(let T=2;y.some(R=>R.id===v);T++)v=`${m}-${T}`;const x=new Set(y.map(T=>T.color)),_=vi.find(T=>!x.has(T))??vi[y.length%vi.length],C=e.lead(),M={id:v,name:S.name.trim()||"Agent",role:S.role.trim()||"Developer",isLead:!1,cli:S.cli??"claude",model:S.model??"",mode:S.mode,color:_,skills:["plan","review"],roleMd:`# ${S.name} — ${S.role}
|
|
289
|
+
|
|
290
|
+
You build the tasks assigned to you.`,sandbox:structuredClone(C.sandbox),workspacePath:null};y.push(M),e.snap.agents.push({agentId:v,state:"idle",currentTaskId:null,stateSince:new Date().toISOString(),note:null,session:Px(e.snap.config.project.name,v)}),e.configChanged(),e.emit({type:"agent.updated",agent:{...e.snap.agents[e.snap.agents.length-1]}}),e.syncEnvironments(),e.activity("config",null,`Added ${M.name} (${M.role}) — new sandbox starting`),e.write(v,Ex(M.name,M.role,e.snap.config.project.repo,M.mode)),g(v,`sbx run claude · allow host.docker.internal:${e.snap.config.project.hqPort}`),d(),s.startWorker(v,2)},updateAgent(S,y){const m=e.cfg(S);m&&(Object.assign(m,y),e.configChanged())},inspectWorkspace(S){const y=e.status(S);y&&(r==null||r({type:"workspace.info",info:{agentId:S,path:y.session.workspace??"",managed:!0,exists:!0,changedFiles:1,unpushedCommits:2,sandboxName:`hq-mock-${S}`,sandboxExists:!0}}))},removeAgent(S){const y=e.cfg(S);if(!(!y||y.isLead)){s.stopAgent(S),e.snap.config.team=e.snap.config.team.filter(m=>m.id!==S),e.snap.agents=e.snap.agents.filter(m=>m.agentId!==S);for(const m of e.snap.tasks)m.ownerId===S&&m.status!=="done"&&e.patchTask(m.id,{ownerId:null,status:m.status==="in-progress"?"todo":m.status});e.emit({type:"agent.removed",agentId:S}),e.configChanged(),e.syncEnvironments(),e.activity("config",null,`Removed ${y.name} — sandbox stopped`)}},updateSandbox(S,y){const m=e.cfg(S);m&&(Object.assign(m.sandbox,structuredClone(y)),e.configChanged(),(y.allow||y.deny)&&(g(S,`sbx policy allow/deny network --sandbox hq-mock-${S} … (mock)`),d()),e.activity("config",S,`Updated ${m.name}'s sandbox settings`))},setSecret(S,y,m){const v=e.snap.sbx;S===null?v.globalKeys=[...new Set([...v.globalKeys,y])]:v.agents[S]&&(v.agents[S].keys=[...new Set([...v.agents[S].keys,y])]),e.emit({type:"sbx.updated",sbx:structuredClone(v)}),e.activity("config",S,`Stored the ${y} key ${S?`for ${e.name(S)}`:"for every sandbox"} (mock)`)},removeSecret(S,y){const m=e.snap.sbx;S===null?m.globalKeys=m.globalKeys.filter(v=>v!==y):m.agents[S]&&(m.agents[S].keys=m.agents[S].keys.filter(v=>v!==y)),e.emit({type:"sbx.updated",sbx:structuredClone(m)})},setProxy(S){e.snap.sbx.proxy=S,e.emit({type:"sbx.updated",sbx:structuredClone(e.snap.sbx)})},openEnvFile(S){var y;g(S,`open ${((y=e.snap.sbx.agents[S])==null?void 0:y.envFile.path)??"?"} (mock: nothing opens)`)},refreshSbx(){d()},updateWorkflow(S){const y=e.snap.config.workflow;Object.assign(y.review,S.review),Object.assign(y.merge,S.merge),Object.assign(y.deploy,S.deploy),e.configChanged(),e.syncEnvironments(),s.workflowChanged(),e.activity("config",null,"Workflow updated")},updateProject(S){Object.assign(e.snap.config.project,S),e.configChanged(),e.syncEnvironments()},createBoard(S){const y=S.trim();if(!y)return;const m=y.split(/\s+/).map(_=>_[0]).join("").toUpperCase().slice(0,3)||"B";let v=m;for(let _=2;e.snap.boards.some(C=>C.id===v);_++)v=`${m}${_}`;const x={id:v,title:y,status:"planned",order:e.snap.boards.length};e.snap.boards.push(x),e.emit({type:"board.updated",board:{...x}}),e.activity("config",null,`Created board ${y}`)},updateBoard(S,y){const m=e.snap.boards.find(v=>v.id===S);m&&(Object.assign(m,y),e.emit({type:"board.updated",board:{...m}}))},completeWelcome(){},dev:{presets:Yu.map(S=>({id:S.id,label:S.label})),loadPreset(S){t=S,h(),u()},setSpeed(S){e.speed=S}}}}function mM(t){let e=null;const s=[],r=(l,...c)=>{const o=JSON.stringify({cmd:l,args:c});(e==null?void 0:e.readyState)===WebSocket.OPEN?e.send(o):s.length<200&&s.push(o)};return{connect(l,c){let o=!0,h=0,u=null,p=null;const d=()=>{if(!o)return;c==null||c(h?"reconnecting":"connecting");const g=location.protocol==="https:"?"wss":"ws",w=new WebSocket(`${g}://${location.host}/ws?token=${encodeURIComponent(t)}`);p=w;let S=!1;w.onopen=()=>{if(!o)return w.close();for(S=!0,h=0,e=w,c==null||c("open");s.length;)w.send(s.shift())},w.onmessage=y=>{if(o)try{l(JSON.parse(String(y.data)))}catch{}},w.onclose=()=>{e===w&&(e=null),o&&(c==null||c(!S&&h>2?"unauthorized":"reconnecting"),h+=1,u=window.setTimeout(d,Math.min(5e3,400*h)))}};return d(),()=>{o=!1,u&&window.clearTimeout(u),p&&p.readyState!==WebSocket.CONNECTING&&p.close(),e===p&&(e=null)}},sendTerminalInput:(l,c)=>r("sendTerminalInput",l,c),resizeTerminal:(l,c,o)=>r("resizeTerminal",l,c,o),assignTask:(l,c)=>r("assignTask",l,c),sendMessage:(l,c)=>r("sendMessage",l,c),startAgent:l=>r("startAgent",l),stopAgent:l=>r("stopAgent",l),openWorkspace:l=>r("openWorkspace",l),recreateSandbox:l=>r("recreateSandbox",l),recheckSetup:()=>r("recheckSetup"),runSetupFix:l=>r("runSetupFix",l),addAgent:l=>r("addAgent",l),updateAgent:(l,c)=>r("updateAgent",l,c),removeAgent:(l,c)=>r("removeAgent",l,c),inspectWorkspace:l=>r("inspectWorkspace",l),updateSandbox:(l,c)=>r("updateSandbox",l,c),setSecret:(l,c,o)=>r("setSecret",l,c,o),removeSecret:(l,c)=>r("removeSecret",l,c),setProxy:l=>r("setProxy",l),openEnvFile:l=>r("openEnvFile",l),refreshSbx:()=>r("refreshSbx"),updateWorkflow:l=>r("updateWorkflow",l),updateProject:l=>r("updateProject",l),createBoard:l=>r("createBoard",l),updateBoard:(l,c)=>r("updateBoard",l,c),completeWelcome:l=>r("completeWelcome",l)}}const Xu=6e4,sc=new Map,rc=new Map;function gM(t,e){var n;let r=(sc.get(t)??"")+e;if(r.length>Xu){const l=r.indexOf(`
|
|
291
|
+
`,r.length-Xu);r=r.slice(l===-1?r.length-Xu:l+1)}sc.set(t,r),(n=rc.get(t))==null||n.forEach(l=>l(e))}function _M(t){return sc.get(t)??""}function vM(t,e){const s=rc.get(t)??new Set;return s.add(e),rc.set(t,s),()=>s.delete(e)}function yM(){sc.clear(),rc.forEach(t=>t.forEach(e=>e("\x1Bc")))}function xM(){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 Fd=xM(),De=Fd?mM(Fd):pM(),Te=Sx(()=>{var t;return{snap:null,epoch:0,events:[],terminalChunks:0,speed:1,presets:((t=De.dev)==null?void 0:t.presets)??null,live:Fd!==null,workspaceInfo:{},connection:"connecting",source:De}});let gv=0;function go(t,e,s){const r=t.findIndex(s);if(r===-1)return[...t,e];const n=t.slice();return n[r]=e,n}function wM(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:go(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:go(t.boards,e.board,s=>s.id===e.board.id)};case"task.updated":return{...t,tasks:go(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:go(t.pullRequests,e.pr,s=>s.number===e.pr.number)};case"env.updated":return{...t,environments:go(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}}function bM(t){if(t.type==="terminal.output"){gM(t.agentId,t.data),Te.setState(e=>({terminalChunks:e.terminalChunks+1}));return}if(t.type==="workspace.info"){Te.setState(e=>({workspaceInfo:{...e.workspaceInfo,[t.info.agentId]:t.info}}));return}t.type==="snapshot"&&yM(),Te.setState(e=>{const s=e.snap??(t.type==="snapshot"?t.snapshot:null);return s?(gv+=1,{snap:wM(s,t),epoch:t.type==="snapshot"?e.epoch+1:e.epoch,events:[{n:gv,at:Date.now(),event:t},...e.events].slice(0,20)}):{}})}let ni=null;function SM(){return ni||(ni=De.connect(bM,t=>Te.setState({connection:t})),()=>{ni==null||ni(),ni=null})}const ke={sendTerminalInput:(t,e)=>De.sendTerminalInput(t,e),resizeTerminal:(t,e,s)=>De.resizeTerminal(t,e,s),startAgent:t=>De.startAgent(t),stopAgent:t=>De.stopAgent(t),openWorkspace:t=>De.openWorkspace(t),recreateSandbox:t=>De.recreateSandbox(t),recheckSetup:()=>De.recheckSetup(),runSetupFix:t=>De.runSetupFix(t),assignTask:(t,e)=>De.assignTask(t,e),sendMessage:(t,e)=>De.sendMessage(t,e),addAgent:De.addAgent.bind(De),updateAgent:De.updateAgent.bind(De),removeAgent:(t,e)=>De.removeAgent(t,e),inspectWorkspace:t=>De.inspectWorkspace(t),updateSandbox:De.updateSandbox.bind(De),setSecret:(t,e,s)=>De.setSecret(t,e,s),removeSecret:(t,e)=>De.removeSecret(t,e),setProxy:t=>De.setProxy(t),openEnvFile:t=>De.openEnvFile(t),refreshSbx:()=>De.refreshSbx(),updateWorkflow:De.updateWorkflow.bind(De),updateProject:De.updateProject.bind(De),createBoard:De.createBoard.bind(De),updateBoard:De.updateBoard.bind(De),completeWelcome:t=>De.completeWelcome(t),setSpeed(t){var e;(e=De.dev)==null||e.setSpeed(t),Te.setState({speed:t})},loadPreset(t){var e;(e=De.dev)==null||e.loadPreset(t)}};function Ax(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 yi={coderabbit:"CodeRabbit",greptile:"Greptile",copilot:"Copilot",human:"Human review",custom:"Custom check"},Hl={instacloud:"InstaCloud",vercel:"Vercel",custom:"Custom deploy"},We=Sx(()=>({drawer:null,settings:null,hover:null,focus:null,zoomRequest:null,planBoardId:null,debugOpen:!1,setupOpen:!1}));let kl=0;const Pe={focus(t){kl+=1,We.setState({focus:{target:t,nonce:kl}})},openAgent(t,e){We.setState({drawer:{kind:"agent",id:t,tab:e}}),Pe.focus({kind:"agent",id:t})},openBoards(t){We.setState({drawer:{kind:"boards",boardId:t}}),Pe.focus({kind:"plan"})},openPrs(){We.setState({drawer:{kind:"prs"}}),Pe.focus({kind:"prs"})},openEnv(t){We.setState({drawer:{kind:"env",name:t}}),Pe.focus({kind:"env",name:t})},closeDrawer(){We.setState({drawer:null}),Pe.focus({kind:"home"})},openSettings(t="team",e){We.setState({settings:{tab:t,agentId:e}})},closeSettings(){We.setState({settings:null})},setHover(t){We.setState({hover:t})},zoom(t){kl+=1,We.setState({zoomRequest:{delta:t,nonce:kl}})},showBoardOnWall(t){We.setState({planBoardId:t})},openSetup(){We.setState({setupOpen:!0})},closeSetup(){We.setState({setupOpen:!1})},toggleDebug(){We.setState(t=>({debugOpen:!t.debugOpen}))}},H={ink:_t.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:_t.red,orange:_t.orange,yellow:_t.yellow,green:_t.green,blue:_t.blue,lav:_t.lav,pink:_t.pink,peach:"#ffccaa",white:_t.white,navy:_t.navy,rabbit:"#ff7a30",gold:"#ffcf3a",shadow:"#241a2e"},_v=[["#3e5f8a","#334f75"],["#b5893a","#9a7230"],["#4f7f5a","#41694a"],["#7a4f7e","#663f69"],["#8a5a3e","#744a32"],["#3f7f8f","#2f5f6b"]];class Rx{constructor(e){this.g=e,e.imageSmoothingEnabled=!1}rect(e,s,r,n,l,c=1){r<=0||n<=0||(this.g.globalAlpha=c,this.g.fillStyle=l,this.g.fillRect(Math.round(e),Math.round(s),Math.round(r),Math.round(n)),this.g.globalAlpha=1)}}class El{constructor(e){this.g=e}rect(e,s,r,n,l,c=1){r<=0||n<=0||c<=0||this.g.rect(Math.round(e),Math.round(s),Math.round(r),Math.round(n)).fill({color:l,alpha:c})}}function wf(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 Ae(t,e,s,r,n,l,c="#241a2e"){t.rect(e,s,r,n,c),t.rect(e+1,s+1,r-2,n-2,l)}function Is(t,e,s,r,n,l=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,n,l)}}function qs(t,e,s,r,n,l,c=1){for(let o=-n;o<=n;o++){const h=Math.round(r*Math.sqrt(1-o*o/(n*n)));t.rect(e-h,s+o,h*2+1,1,l,c)}}function ic(t,e,s,r,n,l){let c=Math.round(e),o=Math.round(s);const h=Math.round(r),u=Math.round(n),p=Math.abs(h-c),d=Math.abs(u-o),g=c<h?1:-1,w=o<u?1:-1;let S=p-d;for(;t.rect(c,o,1,1,l),!(c===h&&o===u);){const y=2*S;y>-d&&(S-=d,c+=g),y<p&&(S+=p,o+=w)}}function Ml(t,e){const s=wf(t[0].length,t.length),r=new Rx(s.getContext("2d"));return t.forEach((n,l)=>[...n].forEach((c,o)=>e[c]&&r.rect(o,l,1,1,e[c]))),s}function CM(t){const e=wf(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 vv(t,e,s,r,n){e.forEach((l,c)=>{for(let o=0;o<l.length;o++){const h=s[l[o]];h&&t.rect(r+o,n+c,1,1,h)}})}function Dx(t){return new Ue({source:new af({resource:t,scaleMode:"nearest"})})}const kM=[".....kk.....","....k..k....",".....kk....."],EM=["..k..kk..k..","..kGkGGkGk..","..kGGGGGGk.."],MM=["..kkkkkkkk..",".khhBBBBBBk.",".khVVVVVVBk.",".kBVVVVVVBk.",".kBVVVVVVBk.",".kbBBBBBBbk.","..kkkkkkkk..","...kBBBBk...",".kbkBBBBkbk.",".kk.kbbk.kk.",".....kk....."],TM=["..kkkkkkkk..",".khhBBBBBBk.",".kBBBBBBBBk.",".kBBkbbkBBk.",".kBBBBBBBBk.",".kbBBBBBBbk.","..kkkkkkkk..","...kBBBBk...",".kbkBBBBkbk.",".kk.kbbk.kk.",".....kk....."],PM=["..kkkkkkkk..",".khhBBBBBBk.",".kBBBBBBBBk.",".kBBkbbkBBk.",".kBBBBBBBBk.",".kbBBBBBBbk.","..kkkkkkkk..",".kbkBBBBkbk.",".kkkBBBBkkk.","....kbbk....",".....kk....."],AM=["..kkkkkkkk..",".khhBBBBBBk.",".kBBBBBVVVk.",".kBBBBBVVVk.",".kBBBBBVVVk.",".kbBBBBBBbk.","..kkkkkkkk..","...kBBBBk...","...kbBBBbk..","....kbbkk...",".....kk....."],yv=new Map,xv=new Map;function Lx(t,e){const s=`${t}|${e}`,r=yv.get(s);if(r)return r;const n={k:H.ink,B:t,b:Zl(t,-.3),h:Zl(t,.6),V:"#16213f",G:H.gold},l=e?EM:kM,c=Ml([...l,...AM],n),o={front:Ml([...l,...MM],n),back:Ml([...l,...TM],n),type:Ml([...l,...PM],n),side:c,sideL:CM(c)};return yv.set(s,o),o}function wv(t,e){const s=`${t}|${e}`,r=xv.get(s);if(r)return r;const n=Lx(t,e),l=Object.fromEntries(Object.entries(n).map(([o,h])=>[o,Dx(h)])),c={canvases:n,textures:l};return xv.set(s,c),c}const RM=["..k...k..",".kOk.kOk.",".kPk.kPk.",".kPk.kPk.",".kOkkkOk.","kOOOOOOOk","kOkOOOkOk","kOOOpOOOk",".kOWWWOk.","kOOWWWOOk","kOOWWWOOk",".kkkkkkk."],DM=["..k...k..",".kOk.kOk.",".kPk.kPk.",".kPk.kPk.",".kOkkkOk.","kOOOOOOOk","kOOOOOOOk","kkkOpOkkk",".kOWWWOk.","kOOWWWOOk","kOOWWWOOk",".kkkkkkk."],LM={k:H.ink,O:H.rabbit,P:H.pink,p:"#ff5c86",W:H.white},BM=["..kkkkk..",".kMMMMMk.","kMWWWWWMk","kMWkkkWMk","kMWWWWWMk",".kMMMMMk.","..kkkkk..","....k....","...kkk..."],IM={k:H.ink,M:H.metal,W:H.white};class OM{constructor(e,s){me(this,"cells");this.w=e,this.h=s,this.cells=new Uint8Array(e*s)}set(e,s,r,n,l){for(let c=Math.max(0,s);c<=Math.min(this.h-1,n);c++)for(let o=Math.max(0,e);o<=Math.min(this.w-1,r);o++)this.cells[c*this.w+o]=l?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 n=-r;n<=r;n++)for(let l=-r;l<=r;l++)if(Math.max(Math.abs(l),Math.abs(n))===r&&this.ok(e+l,s+n))return[e+l,s+n];return[e,s]}find(e,s,r,n){const l=this.w,c=s*l+e,o=n*l+r;if(c===o)return[];const h=new Int32Array(l*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 w=g%l,S=g/l|0,y=[[w,S+1],[w+1,S],[w,S-1],[w-1,S]];for(const[m,v]of y){if(m<0||v<0||m>=l||v>=this.h)continue;const x=v*l+m;h[x]!==-1||!this.cells[x]&&x!==o||(h[x]=g,u.push(x))}}if(h[o]===-1)return[];const p=[];for(let d=o;d!==c;d=h[d])p.push([d%l,d/l|0]);return p.reverse()}}const Wt=16,Tl=3,Qu=20,jM=9,NM=10,FM=4,bv=14,oi=7,Pl=8,Al=5;function Bx(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)])}function HM(t){return t<=4?Math.max(1,t):Math.min(5,Math.ceil(t/2))}function $M(t,e){const s=t.team.find(F=>F.isLead),r=t.team.filter(F=>!F.isLead),n=t.workflow.review.enabled,l=t.workflow.deploy.enabled&&e.length>0,c=HM(r.length),o=Math.max(1,Math.ceil(r.length/c)),h=2+c*Pl,u=Math.max(Qu+jM,h+(n?NM:2)-1),p=u-Qu,d=l?e.length:0,g=Math.ceil(d/Al),w=l?Math.max(5,2+Math.min(d,Al)*2):0,S=u+1,y=bv+o*Pl,m=l?Math.ceil((22+g*112)/Wt)+3:0,v=Math.max(y+3,m),x=1+u+(l?1+w:0)+1,_=Tl*Wt,C=Tl*Wt,M=F=>_+F*Wt,T=F=>C+F*Wt,R=new OM(x,v);R.set(1,FM,u,v-2,!0),R.set(0,13,0,13,!0),R.set(13,5,17,6,!1),R.set(18,4,19,4,!1),R.set(11,4,11,4,!1),R.set(1,4,1,4,!1);for(const[F,Z]of[[3,8],[8,8],[5,10],[1,11]])R.set(F,Z,F,Z,!1);const P=Qu+1;R.set(P,4,P+3,4,!1),R.set(P+2,8,P+5,8,!1),R.set(P+3,10,P+4,10,!1),R.set(u,4,u,4,!1),R.set(u,7,u,8,!1),R.set(2,y,u,y,!1);const L=r.map((F,Z)=>{const ne=Z%c,he=Math.floor(Z/c),ae=2+ne*Pl,V=bv+he*Pl;return R.set(ae,V,ae+oi-1,V,!1),R.set(ae+1,V,ae+1,V,!0),R.set(ae,V,ae,V+oi-1,!1),R.set(ae+oi-1,V,ae+oi-1,V+oi-1,!1),R.set(ae+2,V+1,ae+4,V+2,!1),{agentId:F.id,index:Z,x0:ae,y0:V,seat:[ae+3,V+3],drop:[ae+3,y-1],rect:{x:M(ae),y:T(V)-4,w:oi*Wt,h:oi*Wt+4},carpet:_v[Z%_v.length]}});let j=null,$=null;n&&(j={x:M(h+2),y:T(y)-25,w:68,h:46},R.set(h+2,y-1,h+6,y+1,!1),$={x:M(h+4),y:T(y-6)+4,w:64,h:40},R.set(h+4,y-6,h+7,y-3,!1));const U=[];let z=null;const Y=T(y)+8;let re,Q=null;l?(R.set(S,0,x-1,v-1,!1),e.forEach((F,Z)=>{const ne=Z%Al,he=Math.floor(Z/Al);U.push({name:F.name,agentId:F.agentId,x:M(S+2)+ne*32,y:C+22+he*112,w:32,h:92})}),re=M(S+1)+8,Q=C+112):(re=M(u)-4,z={x:M(u)-6,y:T(y)-14,w:22,h:30},R.set(u,y-1,u,y,!1));const J=[];L.forEach((F,Z)=>{const ne=U.find(O=>O.agentId===F.agentId);if(!ne)return;const he=M(F.x0+3)+4+Z%3*3,ae=T(y)-4-Z%4*3,V=ne.x+10+Z%3*4;J.push({agentId:F.agentId,pts:[[he,T(F.y0+2)+12],[he,ae],[V,ae],[V,ne.y+ne.h]]})});const K=[],D={x:M(2)+3,y:C+19,w:140,h:40};K.push({kind:"plan",id:"plan",rect:{x:D.x-3,y:D.y-8,w:D.w+6,h:D.h+14}}),s&&K.push({kind:"agent",id:s.id,rect:{x:M(12),y:C+64,w:6*Wt,h:3*Wt}});for(const F of L)K.push({kind:"agent",id:F.agentId,rect:F.rect});j&&K.push({kind:"gate",id:"gate",rect:{x:j.x,y:j.y-16,w:j.w,h:j.h+16}}),$&&K.push({kind:"prs",id:"prs",rect:{x:$.x,y:$.y,w:$.w,h:$.h+26}});for(const F of U)K.push({kind:"env",id:F.name,rect:F});const N=[[P,5],[P+1,5],[P+2,5]],B=[[P+3,9],[P+5,9],[P+6,6],[4,9],[7,9],[6,11],[Math.min(u-1,P+7),11]];return{key:Bx(t,e),W:x,H:v,ox:_,oy:C,worldW:(x+Tl*2)*Wt,worldH:(v+Tl*2)*Wt,mainW:u,grid:R,lead:{agentId:(s==null?void 0:s.id)??null,seat:[15,7],rect:{x:M(12),y:C+64,w:6*Wt,h:3*Wt}},plan:{board:D,spot:[6,5]},lounge:{x0:P,w:p,coffee:N},desks:L,belt:{y:Y,x0:M(2),x1:re,topY:Q},gate:j,prBoard:$,serverRoom:l?{glassX:S,x0:S+1,w}:null,racks:U,mailbox:z,cables:J,door:[1,13],wander:B.filter(([F,Z])=>R.ok(F,Z)),hits:K}}function zo(t,e){return{x:t.ox+e[0]*Wt+8,y:t.oy+e[1]*Wt+8}}const zM=52;class WM{constructor(e,s,r,n){me(this,"x");me(this,"y");me(this,"path",[]);me(this,"face","up");me(this,"seated",!1);me(this,"errand",null);me(this,"pause",0);me(this,"emote",null);me(this,"carry",null);me(this,"headY",0);me(this,"color");me(this,"isLead");me(this,"sprite");me(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=wv(e.color,e.isLead),this.sprite=new wi(this.sprites.textures.back),n.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=wv(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,n]=e.grid.nearest(...this.tile(e));this.path=e.grid.find(r,n,s[0],s[1]),this.seated=!1}move(e,s){if(!this.path.length)return;const r=zo(s,this.path[0]),n=r.x-this.x,l=r.y-this.y,c=Math.hypot(n,l),o=zM*e;Math.abs(n)>Math.abs(l)?this.face=n>0?"right":"left":Math.abs(l)>.01&&(this.face=l>0?"down":"up"),c<=o?(this.x=r.x,this.y=r.y,this.path.shift()):(this.x+=n/c*o,this.y+=l/c*o)}render(e,s){const r=this.path.length>0,n=3+Math.floor(e*(r?6:2.5)+this.index)%2,l=Math.round(this.x)-6,c=Math.round(this.y)-13-n;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(l,c),this.sprite.zIndex=Math.round(this.y),this.headY=c}}function UM(t,e,s,r,n){if(t.path.length)return;const l=Ix(t,e),c=l&&Math.abs(t.x-zo(e,l).x)<1&&Math.abs(t.y-zo(e,l).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+n()*3:1.8;return}if(!(t.pause>0)){if(s!=="idle"){l&&!c?t.goTo(e,l):(t.seated=!0,t.face="up");return}n()<.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(n()*e.wander.length)])),t.path.length||(t.errand=null)}}function Ix(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 Sv(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 Cv={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:["###","#.#","###","..#","##."],"#":["#.#","###","#.#","###","#.#"],"-":["...","...","###","...","..."],".":["...","...","...","...",".#."],":":["...",".#.","...",".#.","..."],"!":[".#.",".#.",".#.","...",".#."],"?":["##.","..#",".#.","...",".#."],"+":["...",".#.","###",".#.","..."],"/":["..#","..#",".#.","#..","#.."],"(":["..#",".#.",".#.",".#.","..#"],")":["#..",".#.",".#.",".#.","#.."],",":["...","...","...",".#.","#.."],"'":[".#.",".#.","...","...","..."],"&":[".#.","#.#",".#.","#.#",".##"],_:["...","...","...","...","###"],"=":["...","###","...","###","..."],">":["#..",".#.","..#",".#.","#.."],"·":["...","...",".#.","...","..."],"—":["...","...","###","...","..."]," ":["...","...","...","...","..."]},Ut=(t,e=1)=>Math.max(0,String(t).length*4-1)*e;function kt(t,e,s,r,n,l=1){const c=String(e).toUpperCase(),o=Math.round(s),h=Math.round(r);for(let u=0;u<c.length;u++){const p=Cv[c[u]]??Cv["?"];for(let d=0;d<5;d++){const g=p[d];let w=0;for(;w<3;){if(g[w]!=="#"){w+=1;continue}let S=1;for(;w+S<3&&g[w+S]==="#";)S+=1;t.rect(o+(u*4+w)*l,h+d*l,S*l,l,n),w+=S}}}}function xc(t,e,s,r,n=H.ink,l=H.white){const c=Ut(e),o=Math.round(s-c/2);t.rect(o-2,r-1,c+4,7,n),kt(t,e,o,r,l)}function Ox(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 VM{constructor(){me(this,"list",[])}envelope(e,s,r){this.list.push({kind:"env",fromX:e,fromY:s,toId:r,t:0})}text(e,s,r,n=H.yellow){this.list.push({kind:"text",str:e,x:s,y:r,life:1.6,color:n})}burst(e,s,r,n=14){for(let l=0;l<n;l++)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[l%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 n=s(r.toId);if(!n)continue;const l=r.t<.5?2*r.t*r.t:1-Math.pow(-2*r.t+2,2)/2,c=Math.round(r.fromX+(n.x-r.fromX)*l)-4,o=Math.round(r.fromY+(n.y-20-r.fromY)*l-Math.sin(l*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 n=Ut(r.str);e.rect(Math.round(r.x-n/2)-2,Math.round(r.y)-2,n+4,9,H.ink),xc(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 GM=40,qM=12,KM=t=>t<.5?2*t*t:1-Math.pow(-2*t+2,2)/2;class YM{constructor(e){me(this,"hLen");me(this,"len");me(this,"gateEntry");me(this,"gateCentre");me(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 XM(t,e,s,r,n){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 l=t.filter(h=>h.mode==="belt"||h.mode==="scan").sort((h,u)=>u.s-h.s);let c=l.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 p=n.deskPos(h.authorId);if(u.review==="changes-requested"&&!u.merged){(h.mode==="belt"||h.mode==="scan")&&p&&(h.fly={from:s.pos(h.s),to:p,t:0,then:"home",s:0},h.mode="fly",h.mode==="fly"&&(c=l.some(d=>d!==h&&d.mode==="scan")));continue}if(h.mode==="home"){const d=(u.review==="passed"||u.merged)&&s.gateExit!==null?s.gateExit:n.dropS(h.authorId);h.fly={from:p??s.pos(d),to:s.pos(d),t:0,then:"belt",s:d},h.mode="fly"}}let o=null;for(const h of l){const u=e.get(h.num);if(!u||h.mode==="fly"||h.mode==="home")continue;let p;if(u.merged?p=s.len:u.review==="passed"||s.gateEntry===null?p=s.gateExit!==null?Math.max(h.s,s.gateExit):s.len-30:u.review==="reviewing"&&!c&&s.gateCentre!==null&&h.s>=s.gateEntry-1?(p=s.gateCentre,h.mode="scan",c=!0):p=h.mode==="scan"&&s.gateCentre!==null?s.gateCentre:s.gateEntry,o&&!u.merged&&o.mode!=="gone"&&(p=Math.min(p,o.s-qM)),u.review==="passed"&&h.mode==="scan"&&(h.mode="belt"),h.s<p&&(h.s=Math.min(p,h.s+GM*(u.merged?2.5:1)*r)),u.merged&&h.s>=s.len-.5){h.mode="gone",n.onMerged(h);continue}o=h}}function QM(t,e){if(t.mode==="belt"||t.mode==="scan")return{...e.pos(t.s),lift:0};if(t.mode==="fly"&&t.fly){const s=KM(t.fly.t),r=t.fly.from.x+(t.fly.to.x-t.fly.from.x)*s,n=t.fly.from.y+(t.fly.to.y-t.fly.from.y)*s;return{x:r,y:n,lift:Math.sin(s*Math.PI)*30}}return null}const ZM={todo:0,blocked:0,"in-progress":1,"in-review":2,done:3};class JM{constructor(){me(this,"notes",new Map);me(this,"boardId",null)}update(e,s,r,n,l){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 p=c.filter(d=>ZM[d.status]===u);u===3&&p.reverse(),p.forEach((d,g)=>{o.add(d.id);const w=r.x+u*35+2+g%4*8,S=r.y+11+Math.floor(g/4)*7,y=this.notes.get(d.id);y?Object.assign(y,{tx:w,ty:S,hidden:g>=16}):this.notes.set(d.id,{x:w,y:S,tx:w,ty:S,hidden:g>=16,born:this.notes.size?l:-10})})}for(const u of[...this.notes.keys()])o.has(u)||this.notes.delete(u);const h=1-Math.exp(-5*n);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,n){const l=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=l.get(o);if(!u||h.hidden)continue;const p=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,w=Math.round(h.x),S=Math.round(h.y-g);g&&e.rect(w+1,S+g+1,7,6,H.shadow,.25),u.status==="done"?(e.rect(w,S,7,6,"#ddd5c4"),e.rect(w,S,2,6,p),e.rect(w+3,S+3,1,1,"#008751"),e.rect(w+4,S+2,1,1,"#008751"),e.rect(w+5,S+1,1,1,"#008751")):(e.rect(w,S,7,6,p),e.rect(w,S,7,1,Zl(p,.5)),e.rect(w+1,S+3,4,1,Zl(p,-.3)),u.status==="in-review"&&e.rect(w+5,S+4,1,1,H.ink),u.status==="blocked"&&e.rect(w+5,S+1,2,2,H.red)),n-h.born<.6&&Math.floor(n*10)%2&&(e.rect(w-1,S-1,9,1,H.white),e.rect(w-1,S+6,9,1,H.white))}}}const Si=(t,e)=>Math.floor(t*e)%2===1;function Zu(t,e,s,r,n,l,c){if(t.rect(e,s,18,11,H.screen),r==="needs-input")Si(l,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((l*6+c*5)%32-16)),h=Math.floor(Math.abs((l*4+c*3)%18-9));t.rect(e+Math.min(16,o),s+Math.min(9,h),2,2,n)}else{const o=Math.floor(l*3);for(let h=0;h<5;h++){const u=(o+h)*7+c*13,p=u%3*2,d=3+u*5%9;t.rect(e+1+p,s+1+h*2,d,1,[H.blue,H.pink,H.green,"#c9b6ff",H.white][u%5])}Si(l,3)&&t.rect(e+1,s+11-1,2,1,H.white)}}function eT(t,e,s,r,n,l){const c=_n[n];let o=c.color;n==="needs-input"&&(o=Si(l,6)?H.red:c.dim),n==="idle"&&(o=c.dim);const h=s+e.x0*16,u=r+e.y0*16;for(let p=0;p<7;p++)p!==1&&t.rect(h+p*16,u,16,3,o);n==="working"&&t.rect(h+Math.floor(l*40)%112,u,8,3,"#bfe9ff")}function tT(t,e,s,r,n){const l=_n[r];t.rect(e+278,s+90,6,2,H.ink),t.rect(e+280,s+80,1,10,H.ink),Ae(t,e+277,s+76,8,5,r==="needs-input"&&Si(n,6)?l.dim:l.color)}function sT(t,e,s){const r=e.belt,n=Math.floor(s*26)%6,l=r.y-9,c=r.topY!==null?r.x1+9:r.x1;t.rect(r.x0-6,l,c-r.x0+6,18,H.ink),t.rect(r.x0-4,l+3,c-r.x0+2,12,H.belt);for(let o=r.x0-4+n;o<c-2;o+=6)t.rect(o,l+4,1,10,H.beltL);if(t.rect(r.x0-4,l+2,c-r.x0+2,1,H.rail),t.rect(r.x0-4,l+15,c-r.x0+2,1,H.rail),t.rect(r.x0-8,l+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-n;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 rT(t,e,s,r,n,l,c){const o=e.x,h=e.x+e.w,u=e.w,p=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 S=d+19;S<d+35;S+=4)t.rect(o+14,S,40,1,"#163d2c");s==="reviewing"?(t.rect(p-5,d+22,10,9,"#a8e72c"),t.rect(p-4,d+23,8,7,"#0f2a1f"),t.rect(p-1,d+23,2,7,"#a8e72c"),t.rect(o+13+Math.floor(n*30%42),d+17,1,19,H.yellow)):s==="passed"?kt(t,"OK",p-3,d+24,H.green):s==="changes"&&kt(t,"FIX",p-5,d+24,H.red);const g=Ox(l.toUpperCase(),u-4);kt(t,g,p-Ut(g)/2,d+39,H.ink),[5,15,u-18,u-8].forEach((S,y)=>{let m="#5a5170";s==="reviewing"?m=y===Math.floor(n*8)%4?H.orange:"#7a4a10":s==="passed"?m=Si(n,8)?H.green:"#00873a":s==="changes"&&(m=Si(n,8)?H.red:"#7e0f33"),t.rect(o+S,d+3,6,4,H.ink),t.rect(o+S+1,d+3,4,3,m)});let w=0;s==="reviewing"?w=Math.round(Math.abs(Math.sin(n*8))*3):s==="passed"&&(w=Math.round(Math.sin(Math.min(1,r/.6)*Math.PI)*8)),Is(t,p,d+4,4,H.ink,.25),c?vv(t,Math.floor(n*10)%31===0?DM:RM,LM,p-4,d-8-w):vv(t,BM,IM,p-4,d-6-w)}function iT(t,e,s,r,n,l){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,p=Math.floor(l*10),d=n(c.name);for(let g=0;g<8;g++)for(let w=0;w<3;w++){const S=Math.sin((p+1)*12.9898+(g*3+w)*78.233+c.x)*43758.5453,y=S-Math.floor(S);let m="#2e2b36";(o==null?void 0:o.status)==="deploying"?m=(g+Math.floor(l*12))%3===0?"#3ee0d0":"#1f5f66":d>.05?m=Si(l,12)?H.green:"#00873a":y<u&&(m=w===2&&y<.08?H.orange:(g+w)%3?H.green:H.blue),t.rect(c.x+18+w*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 nT(t,e,s,r){s.slice(-6).forEach((n,l)=>{const c=e.x+3+l%3*20,o=e.y+11+Math.floor(l/3)*14,h=n.merged?"#00873a":Cx[n.review].color;t.rect(c+1,o+1,18,12,H.ink,.3),t.rect(c,o,18,12,n.merged?"#e0dccf":H.white),kt(t,`#${n.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(n.authorId))})}function oT(t,e,s,r,n){for(const l of e.cables){const c=s(l.agentId)??"idle",o={working:60,"in-review":24,"review-passed":40,"needs-input":4,idle:8}[c],h=n*o%14;let u=0;for(let p=0;p<l.pts.length-1;p++){const[d,g]=l.pts[p],[w,S]=l.pts[p+1],y=Math.abs(w-d)+Math.abs(S-g);for(let m=(14-((u-h)%14+14)%14)%14;m<y;m+=14){const v=m/y,x=c==="needs-input"?H.red:c==="idle"?r(l.agentId):H.white;t.rect(Math.round(d+(w-d)*v)-1,Math.round(g+(S-g)*v)-1,3,3,x,c==="idle"?.5:.9)}u+=y}}}function aT(t,e,s){const r={x:e.ox+e.lounge.x0*16+66,y:e.oy+22,w:60,h:28},n=new Date().getHours(),l=n<7||n>=19;if(t.rect(r.x,r.y,r.w,r.h,l?H.skyN:H.sky),l){for(const[g,w]of[[6,5],[19,12],[33,4],[47,9],[54,18],[12,20]])t.rect(r.x+g,r.y+w,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,w,S]of[[0,7,14],[37,17,10]]){const y=r.x+(s*3+g)%(r.w-S);t.rect(y,r.y+w,S,3,H.cloud),t.rect(y+3,r.y+w-2,S-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(),p=u/60*Math.PI*2-Math.PI/2,d=(h.getHours()%12+u/60)/12*Math.PI*2-Math.PI/2;ic(t,c,o,c+Math.cos(p)*5,o+Math.sin(p)*5,H.ink),ic(t,c,o,c+Math.cos(d)*3,o+Math.sin(d)*3,H.red)}function kv(t,e,s,r,n,l){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,n),l&&xc(t,`#${r}`,e,o-8,H.ink,H.yellow)}function lT(t,e,s){const r=e.plan.board;xc(t,Ox(s.toUpperCase(),r.w),r.x+r.w/2,r.y-11,H.ink,H.yellow)}function cT(t,e){qs(t,Math.round(e.x),Math.round(e.y)+1,4,1,H.shadow,.3)}function hT(t,e,s,r){const n=Math.round(e.x)-6,l=e.headY,c=_n[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(n+5,l+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 p of[3,6])t.rect(n+p,l+7,1,1,h),t.rect(n+p+1,l+6,1,1,h),t.rect(n+p+2,l+7,1,1,h);else s==="idle"?(t.rect(n+3,l+7,2,1,H.lav),t.rect(n+7,l+7,2,1,H.lav)):(t.rect(n+4,l+(u?7:6),1,u?1:2,h),t.rect(n+7,l+(u?7:6),1,u?1:2,h));else(e.face==="right"||e.face==="left")&&t.rect(n+(e.face==="right"?8:3),l+(u?7:6),1,u?1:2,h);e.path.length&&Math.floor(r*12)%2&&t.rect(n+5,l+14,2,1,H.orange)}function Ev(t,e,s,r=H.white){const n=Math.round(e)-6;return t.rect(n+1,s,11,9,H.ink),t.rect(n,s+1,13,7,H.ink),t.rect(n+1,s+1,11,7,r),t.rect(n+5,s+9,3,1,H.ink),t.rect(n+6,s+10,1,1,H.ink),t.rect(n+6,s+8,1,1,r),n}function uT(t,e,s,r,n){if(e.carry!==null)return;let l=null;if(e.emote&&n<e.emote.until?l=e.emote.type:e.path.length?l=null:s==="needs-input"?l="bang":s==="in-review"?l="wait":s==="review-passed"?l="check":s==="working"?l="dots":s==="idle"&&(l="zz"),!l)return;const c=Math.round(e.x),o=e.headY-12;if(l==="zz"){const u=(r*.8+e.index*.3)%1;kt(t,"Z",c+4+Math.round(u*3),o+6-Math.round(u*8),H.lav);return}if(l==="bang"){const u=o-Math.floor(r*4)%2,p=Ev(t,c,u,H.red);t.rect(p+6,u+2,1,3,H.white),t.rect(p+6,u+6,1,1,H.white);return}const h=Ev(t,c,o);if(l==="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(l==="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(l==="check")for(let u=0;u<7;u++)t.rect(h+3+u,o+(u<3?4+u:8-u),1,1,"#00a83a");if(l==="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);l==="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)),l==="ok"&&kt(t,"OK",h+3,o+2,"#00a83a"),l==="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 dT(t,e){xc(t,e.config.name.toUpperCase().slice(0,10),Math.round(e.x),e.headY-9,H.ink,e.color)}function fT(t,e,s){if(Math.floor(s*3)%3===0)return;const{x:r,y:n,w:l,h:c}=e,o=4,h=H.yellow;for(const[u,p,d,g]of[[r,n,1,1],[r+l,n,-1,1],[r,n+c,1,-1],[r+l,n+c,-1,-1]])t.rect(d>0?u-1:u-o+1,g>0?p-1:p,o,1,h),t.rect(d>0?u-1:u,g>0?p-1:p-o+1,1,o,h)}function Rl(t,e,s,r=!0){const n=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-n,n+1,H.ink),Is(t,e,s-7-n,n,H.leafD),Is(t,e-1,s-8-n,n-2,H.leaf),t.rect(e-3,s-10-n,2,2,H.leafL),t.rect(e+2,s-6-n,1,2,H.leafL)}function Dl(t,e,s,r){qs(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 Ju(t,e,s,r,n){qs(t,e+1,s+5,7,2,H.shadow,.25),qs(t,e,s,7,6,H.ink),qs(t,e,s,6,5,r),qs(t,e-2,s-2,2,1,"#ffffff",.33),t.rect(e-4,s+2,8,2,n)}function pT(t,e,s){Ae(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 Mv(t,e,s,r){const n=Ut(e);Ae(t,Math.round(s-n/2)-3,r,n+6,8,H.white),kt(t,e,Math.round(s-n/2),r+1,H.ink)}function mT(t,e,s,r){t.rect(e+1,s+26,46,4,H.shadow,.25),Ae(t,e,s+4,48,18,H.desk),t.rect(e+1,s+5,46,1,H.woodL),Ae(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),Ae(t,e+15,s+14,18,4,H.metal);for(let n=e+17;n<e+31;n+=3)t.rect(n,s+15,2,1,H.metalD);Ae(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?(Ae(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)),pT(t,e+13,s-6)}function gT(t,e,s,r){for(const l of[0,r-1]){const c=e+l*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 l=0;l<r;l++){if(l===1)continue;const c=e+l*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 n=e+16;t.rect(n-1,s-1,2,17,H.ink),t.rect(n+15,s-1,2,17,H.ink)}function _T(t,e,s,r,n){t.rect(e+1,s+r-1,30,3,"#000000",.3),Ae(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 l=n.toUpperCase().slice(0,6);Ae(t,e+16-Ut(l)/2-3,s+3,Ut(l)+6,8,H.white),kt(t,l,e+16-Ut(l)/2,s+4,H.ink)}function vT(t,e,s,r,n,l,c){t.rect(e+4,s+n-2,3,30,H.deskDD),t.rect(e+r-7,s+n-2,3,30,H.deskDD),t.rect(e+6,s+n+26,r-12,2,H.shadow,.25),Ae(t,e,s,r,n,H.corkD),t.rect(e+2,s+2,r-4,n-4,H.cork);for(let o=0;o<40;o++)t.rect(e+3+Math.floor(c()*(r-6)),s+9+Math.floor(c()*(n-12)),1,1,H.corkD);t.rect(e+2,s+2,r-4,7,H.white),kt(t,l,e+r/2-Ut(l)/2,s+3,H.ink)}function yT(t,e){var v,x;const s=wf(t.worldW,t.worldH),r=s.getContext("2d"),n=new Rx(r),l=vf(42),c=_=>_[Math.floor(l()*_.length)],o=t.W*16,h=t.H*16;n.rect(0,0,t.worldW,t.worldH,H.grass);for(let _=0;_<t.worldW*t.worldH/260;_++){const C=Math.floor(l()*t.worldW),M=Math.floor(l()*t.worldH),T=l()<.55?H.grassD:H.grassL;n.rect(C,M,1,2,T),n.rect(C+1,M+1,1,1,T)}for(let _=0;_<70;_++)n.rect(Math.floor(l()*t.worldW),Math.floor(l()*t.worldH),1,1,c([H.pink,H.yellow,H.white]));const u=t.oy+t.door[1]*16;n.rect(0,u,t.ox,16,H.path);for(let _=0;_<20;_++)n.rect(Math.floor(l()*(t.ox-2)),u+Math.floor(l()*15),2,1,H.pathD);n.rect(t.ox+o,t.oy+6,5,h,H.shadow,.25),n.rect(t.ox+6,t.oy+h,o,4,H.shadow,.25);for(let _=20;_<t.worldW-10;_+=70+Math.floor(l()*50))Dl(n,_,18+Math.floor(l()*6),12+Math.floor(l()*3)),Dl(n,_+20,t.worldH-22+Math.floor(l()*6),12+Math.floor(l()*3));for(let _=60;_<t.worldH-40;_+=80+Math.floor(l()*40))Math.abs(_-u)>30&&Dl(n,18+Math.floor(l()*6),_,13),Dl(n,t.worldW-22+Math.floor(l()*6),_+20,13);r.save(),r.translate(t.ox,t.oy);const p=(t.mainW+1)*16,d=t.lounge.x0*16;r.save(),r.beginPath(),r.rect(16,64,p-16,h-80),r.clip(),n.rect(16,64,p-16,h-80,H.wood);for(let _=0;_*8<h;_++){const C=64+_*8,M=_%3*16;n.rect(16,C,p,1,H.woodD);for(let T=16-M;T<p;T+=48)n.rect(T+1,C+1,47,7,c([H.wood,"#c4895a","#cf9563",H.wood])),n.rect(T,C,1,8,H.woodLine),l()<.12&&n.rect(T+10+Math.floor(l()*28),C+3,2,1,H.woodLine)}r.restore();const g=e.project.name.toUpperCase().slice(0,12);kt(n,g,Math.round(p/2-Ut(g,2)/2),212,H.woodD,2),n.rect(176,64,144,96,H.carpetJ),n.rect(179,67,138,90,H.carpetJD),n.rect(181,69,134,86,H.carpetJ);for(let _=72;_<154;_+=6)for(let C=184+(_%12?3:0);C<314;C+=6)n.rect(C,_,1,1,H.carpetJD);for(const _ of t.desks){const C=(_.x0+1)*16,M=(_.y0+1)*16;n.rect(C,M,80,96,_.carpet[0]);for(let T=M+2;T<M+94;T+=4)for(let R=C+(T%8?2:0);R<C+80;R+=4)n.rect(R,T,1,1,_.carpet[1])}for(let _=0;_<4;_++)for(let C=0;C*8<p-d;C++)n.rect(d+C*8,64+_*8,8,8,(C+_)%2?H.tileD:H.tileL);n.rect(d+16,112,96,80,H.rugPD),n.rect(d+18,114,92,76,H.rugP);for(let _=d+20;_<d+110;_+=4)n.rect(_,116,2,72,"#836399");qs(n,88,150,42,28,H.rugGD),qs(n,88,150,39,25,H.rugG),qs(n,88,150,30,18,H.rugGD),qs(n,88,150,28,16,H.rugG);const w=t.serverRoom;if(w){const _=w.x0*16,C=w.w*16;n.rect(_,64,C,h-80,H.grate);for(let M=64;M<h-16;M+=8)n.rect(_,M,C,1,H.grateD);for(let M=_;M<_+C;M+=8)n.rect(M,64,1,h-80,H.grateD)}for(const _ of t.cables){const C=((v=e.team.find(M=>M.id===_.agentId))==null?void 0:v.color)??H.blue;for(let M=0;M<_.pts.length-1;M++){const[T,R]=_.pts[M],[P,L]=_.pts[M+1],j=Math.min(T,P)-t.ox,$=Math.min(R,L)-t.oy;n.rect(j-1,$-1,Math.abs(P-T)+3,Math.abs(L-R)+3,"#2a2230"),n.rect(j,$,Math.abs(P-T)+1,Math.abs(L-R)+1,C,.55)}}n.rect(0,0,o,16,H.wallTop),n.rect(0,15,o,1,H.wallTopL),n.rect(0,16,p,48,H.wall);for(let _=18;_<44;_+=4)for(let C=_%8?2:0;C<p;C+=4)n.rect(C,_,1,1,H.wallL);n.rect(0,44,p,1,"#7aa597"),n.rect(0,45,p,15,H.wallD);for(let _=8;_<p;_+=16)n.rect(_,47,1,11,"#365a50");if(n.rect(0,60,o,4,H.base),n.rect(0,60,o,1,"#8a6450"),w){n.rect(p,16,o-p,44,H.wallSrv);for(let C=p;C<o;C+=8)n.rect(C,16,1,44,H.wallSrvD);const _="SERVER ROOM";Ae(n,w.x0*16+w.w*16/2-Ut(_)/2-3,3,Ut(_)+6,9,H.ink),kt(n,_,w.x0*16+w.w*16/2-Ut(_)/2,5,H.white)}if(n.rect(0,16,o,2,"#000000",.2),n.rect(0,0,16,h,H.wallTop),n.rect(15,16,1,h-32,H.wallTopL),n.rect(o-16,0,16,h,H.wallTop),n.rect(o-16,16,1,h-32,H.wallTopL),n.rect(0,h-16,o,16,H.wallTop),n.rect(16,h-16,o-32,1,H.wallTopL),n.rect(0,u-t.oy,16,16,H.wood),n.rect(0,u-t.oy-3,20,3,H.deskDD),n.rect(0,u-t.oy+16,20,3,H.deskDD),w){const _=w.glassX*16;n.rect(_,64,16,h-80,"#a8d8ea",.42),n.rect(_,64,1,h-80,H.metalD),n.rect(_+15,64,1,h-80,H.metalD);for(let C=64;C<h-16;C+=44)n.rect(_,C,16,2,H.metalD),ic(n,_+3,C+16,_+12,C+6,"#e3f6fb"),ic(n,_+3,C+22,_+7,C+18,"#e3f6fb")}const S={x:t.plan.board.x-t.ox,y:t.plan.board.y-t.oy,w:t.plan.board.w};Ae(n,S.x-3,S.y-2,S.w+6,46,H.deskD),n.rect(S.x,S.y,S.w,40,"#f7f3ea"),n.rect(S.x,S.y+38,S.w,2,"#d8d0c0"),n.rect(S.x+6,S.y+41,S.w-12,2,H.metalD),n.rect(S.x+20,S.y+40,6,1,H.red),n.rect(S.x+28,S.y+40,6,1,H.blue),[["TODO",H.lav],["DOING",H.blue],["REVIEW",H.orange],["DONE",H.green]].forEach(([_,C],M)=>{const T=S.x+M*35;M&&n.rect(T,S.y+2,1,35,"#ddd5c4"),kt(n,_,T+(35-Ut(_))/2+1,S.y+2,H.ink),n.rect(T+3,S.y+8,30,1,C)}),Ae(n,208,22,80,24,H.desk),n.rect(209,23,78,1,H.woodL),kt(n,"JSM HQ",249-Ut("JSM HQ",2)/2,30,H.ink,2),kt(n,"JSM HQ",248-Ut("JSM HQ",2)/2,29,H.white,2),Ae(n,180,22,22,26,H.navy),n.rect(189,27,4,9,H.white),n.rect(190,26,2,1,H.red),n.rect(190,37,2,2,H.orange),kt(n,"SHIP",184,41,H.yellow),Is(n,d-8,36,8,H.ink),Is(n,d-8,36,7,H.white),Ae(n,d+63,19,66,34,H.white),n.rect(d+62,53,68,3,H.deskD),Ae(n,288,30,32,44,H.deskD),n.rect(290,32,28,40,"#6e4630");for(let _=0;_<3;_++){const C=34+_*13;n.rect(290,C+10,28,2,H.deskD);for(let M=291;M<316;){const T=2+Math.floor(l()*3),R=7+Math.floor(l()*3);n.rect(M,C+10-R,T,R,c([H.red,H.blue,H.green,H.yellow,H.pink,H.peach,H.lav])),M+=T+(l()<.2?2:0)}}if(Rl(n,184,78),t.lead.agentId){n.rect(210,102,76,3,H.shadow,.25),Ae(n,208,82,80,18,H.desk),n.rect(209,83,78,1,H.woodL),Ae(n,208,98,80,7,H.deskD),Ae(n,222,70,22,15,H.bezel),Ae(n,248,70,22,15,H.bezel),Ae(n,230,92,30,4,H.metal),Ae(n,212,86,6,6,H.white),n.rect(213,87,4,2,"#7a4a2a");const _=e.team.find(C=>C.id===t.lead.agentId);_&&Mv(n,_.name.toUpperCase().slice(0,8),249,99)}Rl(n,24,76),Ju(n,56,136,"#e05a47","#b8443a"),Ju(n,136,136,"#3fa7a0","#2f817c"),Ju(n,88,168,"#f2b33d","#c88d22"),Ae(n,18,172,13,12,H.metal),n.rect(20,174,9,2,H.ink),n.rect(21,170,7,3,H.white),Ae(n,d,54,48,10,H.metal),Ae(n,d,63,48,14,H.desk),Ae(n,d+18,36,12,20,"#3a3640"),n.rect(d+19,37,10,3,H.white),n.rect(d+21,44,6,6,"#1f1d26"),Ae(n,d+34,57,12,5,H.metalD),Ae(n,d+49,26,14,50,"#e9e9ef"),n.rect(d+50,44,12,1,H.metalD),n.rect(d+52,52,3,3,H.red);const m=p-16;Ae(n,m+1,48,12,26,H.white),Ae(n,m+2,36,10,13,"#7fd0f2"),n.rect(d+32,140,66,3,H.shadow,.25),Ae(n,d+30,120,68,10,H.couchD),Ae(n,d+32,128,64,12,H.couch),Ae(n,d+28,122,6,18,H.couchD),Ae(n,d+94,122,6,18,H.couchD),n.rect(d+34,129,60,1,"#5aa0ae"),Ae(n,d+50,162,28,9,H.desk),Ae(n,d+57,160,5,5,H.white),Ae(n,m+1,100,14,34,"#5b3a8e"),n.rect(m+2,101,12,5,H.yellow),kt(n,"GO",m+4,101,H.ink),Ae(n,m+3,107,10,9,H.ink),Ae(n,m+2,118,12,4,"#7a55b0"),Rl(n,d-8,76),Rl(n,m+8,204,!1);for(const _ of t.desks){const C=_.x0*16,M=_.y0*16;mT(n,(_.x0+2)*16,M+16,_.index),gT(n,C,M,7);const T=((x=e.team.find(R=>R.id===_.agentId))==null?void 0:x.name.toUpperCase().slice(0,10))??"";Mv(n,T,C+64,M+4)}t.prBoard&&vT(n,t.prBoard.x-t.ox,t.prBoard.y-t.oy,t.prBoard.w,t.prBoard.h,"PULL REQS",l);for(const _ of t.racks)_T(n,_.x-t.ox,_.y-t.oy,_.h,_.name);if(t.mailbox){const _={x:t.mailbox.x-t.ox,y:t.mailbox.y-t.oy};Ae(n,_.x,_.y,22,30,"#5f6b80"),n.rect(_.x+3,_.y+10,16,6,"#1f1d26"),kt(n,"MAIN",_.x+4,_.y+3,H.white)}return r.restore(),s}const xT=1,wT=6,Hd=Math.max(1,Math.round(window.devicePixelRatio||1)),Ao=1/Hd,ed=t=>Math.max(xT,Math.min(wT,Math.round(t/Ao)*Ao)),Tv=t=>Math.round(t*Hd)/Hd,bT=t=>t<.5?2*t*t:1-Math.pow(-2*t+2,2)/2;class ST{constructor(e,s,r,n){me(this,"zoom",2);me(this,"x",0);me(this,"y",0);me(this,"worldW",1);me(this,"worldH",1);me(this,"flight",null);this.world=e,this.viewport=s,this.insets=r,this.reducedMotion=n}setWorldSize(e,s){this.worldW=e,this.worldH=s}fitZoom(){const{w:e,h:s}=this.viewport(),r=this.insets(),n=Math.max(100,e-r.left-r.right),l=Math.max(100,s-r.top-r.bottom),c=Math.min(n/this.worldW,l/this.worldH)+.2;return ed(Math.floor(c/Ao)*Ao)}home(e=!0){this.flyTo(this.worldW/2,this.worldH/2,this.fitZoom(),e)}flyTo(e,s,r=this.zoom,n=!0){const l=ed(r);if(!n||this.reducedMotion()){this.flight=null,Object.assign(this,{x:e,y:s,zoom:l}),this.apply();return}this.flight={from:{x:this.x,y:this.y,z:this.zoom},to:{x:e,y:s,z:l},t:0,dur:.7}}zoomBy(e,s){const r=ed(this.zoom+e*Ao);if(r!==this.zoom){if(this.flight=null,s){const n=this.screenToWorld(s.x,s.y);this.zoom=r;const l=this.screenToWorld(s.x,s.y);this.x+=n.x-l.x,this.y+=n.y-l.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=bT(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(Tv(s-this.x*this.zoom),Tv(r-this.y*this.zoom))}}const Pv=(t,e,s)=>e>=t.x&&s>=t.y&&e<=t.x+t.w&&s<=t.y+t.h;function Av(t,e,s){const r=t.layout;if(!r)return null;const{x:n,y:l}=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(Pv(h,n,l))return{hit:{kind:"agent",id:o.config.id,rect:h},rect:h}}for(const o of r.hits)if(Pv(o.rect,n,l))return{hit:o,rect:o.rect};return null}function CT(t){const e=Te.getState().snap;if(!e)return{title:""};if(t.kind==="agent"){const r=e.config.team.find(c=>c.id===t.id),n=e.agents.find(c=>c.agentId===t.id),l=n!=null&&n.currentTaskId?e.tasks.find(c=>c.id===n.currentTaskId):null;return{title:`${(r==null?void 0:r.name)??t.id} · ${(r==null?void 0:r.role)??""}`,sub:[n?_n[n.state].label:"",l?`${l.id} ${l.title}`:(n==null?void 0:n.note)??""].filter(Boolean).join(" — ")}}if(t.kind==="plan"){const r=e.boards.filter(n=>n.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),n=r.filter(c=>c.review==="reviewing").length,l=yi[e.config.workflow.review.tool];return{title:t.kind==="gate"?`${l} review gate`:"Pull requests",sub:`${r.length} open · ${n} 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 kT(t){t.kind==="agent"?Pe.openAgent(t.id):t.kind==="plan"?Pe.openBoards(We.getState().planBoardId??void 0):t.kind==="gate"||t.kind==="prs"?Pe.openPrs():Pe.openEnv(t.id)}function ET(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}},n=d=>{const g=r(d),w=Av(t,g.x,g.y);t.hover=w?{rect:w.rect,agentId:w.hit.kind==="agent"?w.hit.id:null}:null,e.style.cursor=s!=null&&s.dragging?"grabbing":w?"pointer":"grab",Pe.setHover(w?{...CT(w.hit),x:d.clientX,y:d.clientY}:null)},l=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",Pe.setHover(null);return}}n(d)},o=d=>{const g=s==null?void 0:s.dragging;if(s=null,e.hasPointerCapture(d.pointerId)&&e.releasePointerCapture(d.pointerId),g)return n(d);const w=r(d),S=Av(t,w.x,w.y);S&&kT(S.hit)},h=()=>{t.hover=null,Pe.setHover(null)};let u=0;const p=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",l),e.addEventListener("pointermove",c),e.addEventListener("pointerup",o),e.addEventListener("pointerleave",h),e.addEventListener("wheel",p,{passive:!1}),e.style.cursor="grab",()=>{e.removeEventListener("pointerdown",l),e.removeEventListener("pointermove",c),e.removeEventListener("pointerup",o),e.removeEventListener("pointerleave",h),e.removeEventListener("wheel",p)}}function MT(t,e,s){var p;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 n=Bx(e.config,e.environments),l=!t.layout;if(!t.layout||t.layout.key!==n){const d=$M(e.config,e.environments);t.layout=d,t.belt=new YM(d),t.setStatic(d,e.config),l&&t.camera.home(!1);for(const g of t.bots.values()){((p=g.errand)==null?void 0:p.kind)==="drop"&&g.errand.onArrive(),g.errand=null,g.path=[];const[w,S]=d.grid.nearest(...g.tile(d)),y=zo(d,[w,S]);g.x=y.x,g.y=y.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 w=t.bots.get(d.id);if(w){w.restyle(d),w.index=g;return}const S=new WM(d,g,{x:0,y:0},t.actors),y=Ix(S,c),m=r||l||!y?y??c.door:c.door;Object.assign(S,zo(c,m)),t.bots.set(d.id,S)});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(w=>w.num===d.number)){const w={num:d.number,authorId:d.authorId,mode:"belt",s:t.dropS(d.authorId),fly:null};t.parcels.push(w);const S=t.bots.get(d.authorId),y=c.desks.find(m=>m.agentId===d.authorId);r?d.review==="changes-requested"?w.mode="home":d.review==="passed"&&t.belt.gateExit!==null&&(w.s=t.belt.gateExit):S&&y&&(w.mode="carry",S.carry=d.number,Sv(S,c,{kind:"drop",deadline:t.t+8,onArrive:()=>{S.carry=null,w.mode==="carry"&&(w.mode="belt",w.s=t.dropS(d.authorId))}},y.drop))}g!==void 0&&g!==d.review&&TT(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&&Sv(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),w=t.bots.get(d.toId);!g||!w||(t.effects.envelope(g.x,g.headY,d.toId),g.emote={type:"talk",until:t.t+1.4},w.emote={type:"mail",until:t.t+2.6})}}function TT(t,e){var n;const s=(n=t.layout)==null?void 0:n.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))}ko.defaultOptions.scaleMode="nearest";class PT{constructor(){me(this,"app",new sx);me(this,"world",new Xs);me(this,"actors",new Xs({sortableChildren:!0}));me(this,"staticSprite",null);me(this,"staticTex",null);me(this,"gSlow",new gi);me(this,"gFast",new gi);me(this,"gShadow",new gi);me(this,"gOver",new gi);me(this,"camera");me(this,"layout",null);me(this,"belt");me(this,"bots",new Map);me(this,"parcels",[]);me(this,"prs",new Map);me(this,"prevReview",new Map);me(this,"seenActivity",new Set);me(this,"seenMessages",new Set);me(this,"notes",new JM);me(this,"effects",new VM);me(this,"gateMode",{mode:"idle",at:0});me(this,"pulses",new Map);me(this,"hover",null);me(this,"epoch",-1);me(this,"t",0);me(this,"dt",0);me(this,"reducedMotion",window.matchMedia("(prefers-reduced-motion: reduce)").matches);me(this,"slowAcc",1);me(this,"rand",vf(3));me(this,"cleanups",[]);me(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 ST(this.world,()=>({w:this.app.screen.width,h:this.app.screen.height}),()=>({left:312,top:74,bottom:16,right:We.getState().drawer?552:16}),()=>this.reducedMotion);const s=()=>{const{snap:r,epoch:n}=Te.getState();r&&MT(this,r,n)};s(),this.cleanups.push(Te.subscribe((r,n)=>(r.snap!==n.snap||r.epoch!==n.epoch)&&s())),this.cleanups.push(We.subscribe((r,n)=>{r.focus&&r.focus!==n.focus&&this.focusOn(r.focus.target),r.zoomRequest&&r.zoomRequest!==n.zoomRequest&&this.camera.zoomBy(r.zoomRequest.delta)})),this.cleanups.push(ET(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 n;const r=Dx(yT(e,s));this.staticSprite?this.staticSprite.texture=r:(this.staticSprite=new wi(r),this.world.addChildAt(this.staticSprite,0)),(n=this.staticTex)==null||n.destroy(!0),this.staticTex=r,this.camera.setWorldSize(e.worldW,e.worldH),this.slowAcc=1}stateOf(e){var s,r;return e?((r=(s=Te.getState().snap)==null?void 0:s.agents.find(n=>n.agentId===e))==null?void 0:r.state)??null:null}colorOf(e){var s,r;return((r=(s=Te.getState().snap)==null?void 0:s.config.team.find(n=>n.id===e))==null?void 0:r.color)??H.white}dropS(e){const s=this.layout,r=s==null?void 0:s.desks.find(n=>n.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 n=this.bots.get(e.id);n&&this.camera.flyTo(n.x,n.y-10,r)}else if(e.kind==="plan"){const n=s.plan.board;this.camera.flyTo(n.x+n.w/2,n.y+40,r)}else if(e.kind==="prs"){const n=s.prBoard??s.gate??s.mailbox;n&&this.camera.flyTo(n.x+n.w/2,n.y+n.h,r)}else{const n=s.racks.find(l=>l.name===e.name);n&&this.camera.flyTo(n.x+n.w/2,n.y+n.h/2,r)}}frame(e){var h;const s=this.layout,r=Te.getState().snap;if(!s||!r)return;this.t+=e,this.dt=e;const n=this.t;this.camera.update(e);const l=Ax(r),c=new Map(l.map(u=>[u.config.id,u.status.state]));for(const u of this.bots.values()){const p=c.get(u.config.id)??"idle";if(u.pause=Math.max(0,u.pause-e),((h=u.errand)==null?void 0:h.kind)==="drop"&&n>u.errand.deadline){const d=u.errand;u.errand=null,d.onArrive()}p!=="idle"&&u.errand&&(u.errand.kind==="coffee"||u.errand.kind==="wander")&&(u.errand=null,u.path=[],u.pause=0),UM(u,s,p,n,this.rand),u.move(e,s),u.render(n,p)}XM(this.parcels,this.prs,this.belt,e*Te.getState().speed,{deskPos:u=>{const p=this.bots.get(u);return p?{x:p.x,y:p.y-14}:null},dropS:u=>this.dropS(u),onMerged:u=>{this.pulses.set("main",1);const p=this.belt.pos(this.belt.len);this.effects.text(`#${u.num} MERGED`,p.x,p.y-26,H.green)}}),this.effects.update(e);for(const[u,p]of this.pulses)this.pulses.set(u,Math.max(0,p-e*.6));this.gateMode.mode!=="idle"&&this.gateMode.mode!=="reviewing"&&n-this.gateMode.at>1.6&&(this.gateMode={mode:"idle",at:n});const o=this.parcels.some(u=>{var p;return u.mode==="scan"&&((p=this.prs.get(u.num))==null?void 0:p.review)==="reviewing"});this.gateMode.mode==="idle"&&o&&(this.gateMode={mode:"reviewing",at:n}),this.gateMode.mode==="reviewing"&&!o&&(this.gateMode={mode:"idle",at:n}),this.slowAcc+=e,this.slowAcc>=.125&&(this.slowAcc=0,this.drawSlow(r.environments,c,n)),this.drawFast(r,c,n)}drawSlow(e,s,r){const n=this.layout,l=this.gSlow;l.clear();const c=new El(l);aT(c,n,r);for(const o of n.desks)Zu(c,n.ox+(o.x0+2)*16+15,n.oy+o.y0*16+12,s.get(o.agentId)??"idle",this.colorOf(o.agentId),r,o.index);if(n.lead.agentId){const o=s.get(n.lead.agentId)??"idle";Zu(c,n.ox+224,n.oy+72,o,this.colorOf(n.lead.agentId),r,0),Zu(c,n.ox+250,n.oy+72,o,this.colorOf(n.lead.agentId),r,1)}n.prBoard&&nT(c,n.prBoard,[...this.prs.values()].sort((o,h)=>o.number-h.number),o=>this.colorOf(o)),iT(c,n.racks,e,o=>o?s.get(o)??null:null,o=>this.pulses.get(o)??0,r)}drawFast(e,s,r){var w,S;const n=this.layout,l=this.gFast;l.clear();const c=new El(l),o=We.getState().planBoardId??((w=e.boards.filter(y=>y.status==="active").sort((y,m)=>y.order-m.order)[0])==null?void 0:w.id)??null,h=e.boards.find(y=>y.id===o);h&&lT(c,n,h.title),this.notes.update(e.tasks,o,n.plan.board,this.dt,r),this.notes.draw(c,e.tasks,y=>y?this.colorOf(y):"#ffe9a8",r),this.reducedMotion||oT(c,n,y=>s.get(y)??null,y=>this.colorOf(y),r);for(const y of n.desks)eT(c,y,n.ox,n.oy,s.get(y.agentId)??"idle",this.reducedMotion?0:r);n.lead.agentId&&tT(c,n.ox,n.oy,s.get(n.lead.agentId)??"idle",r),sT(c,n,this.reducedMotion?0:r);for(const y of this.parcels){const m=QM(y,this.belt),v=this.prs.get(y.num);if(!m||!v)continue;n.gate&&y.mode==="scan"||kv(c,m.x,m.y-m.lift,y.num,this.colorOf(v.authorId),!0)}if(n.gate){const y=e.config.workflow.review.tool,m={coderabbit:"CodeRabbit",greptile:"Greptile",copilot:"Copilot",human:"Human review",custom:"Review check"}[y];rT(c,n.gate,this.gateMode.mode,r-this.gateMode.at,r,m,y==="coderabbit")}const u=this.gShadow;u.clear();const p=new El(u),d=this.gOver;d.clear();const g=new El(d);for(const y of this.bots.values()){const m=s.get(y.config.id)??"idle";if(cT(p,y),hT(g,y,m,r),y.carry!==null){const v=this.prs.get(y.carry);v&&kv(g,y.x,y.headY-2,v.number,this.colorOf(v.authorId),!1)}}for(const y of this.bots.values()){const m=s.get(y.config.id)??"idle";uT(g,y,m,r,r),(y.path.length||((S=this.hover)==null?void 0:S.agentId)===y.config.id)&&dT(g,y)}this.effects.draw(g,y=>{const m=this.bots.get(y);return m?{x:m.x,y:m.headY+10}:null}),this.hover&&fT(g,this.hover.rect,r)}}function AT(){const t=oe.useRef(null);return oe.useEffect(()=>{const e=t.current;if(!e)return;const s=new PT;return s.init(e),()=>s.destroy()},[]),E.jsx("div",{ref:t,className:"fixed inset-0","aria-label":"Pixel-art view of the JSM HQ office",role:"img"})}function jx({name:t,value:e,depth:s}){if(e===null||typeof e!="object"){const n=typeof e=="string"?"#6cf08a":typeof e=="number"?"#ffc14d":"#ff77a8";return E.jsxs("div",{className:"truncate pl-3",children:[E.jsxs("span",{className:"text-[#9aa6d1]",children:[t,": "]}),E.jsx("span",{style:{color:n},children:JSON.stringify(e)})]})}const r=Array.isArray(e)?e.map((n,l)=>[String(l),n]):Object.entries(e);return E.jsxs("details",{open:s<1,className:"pl-3",children:[E.jsxs("summary",{className:"cursor-pointer text-[#dfe6ff]",children:[t," ",E.jsx("span",{className:"text-[#66729f]",children:Array.isArray(e)?`[${r.length}]`:`{${r.length}}`})]}),r.map(([n,l])=>E.jsx(jx,{name:n,value:l,depth:s+1},n))]})}function RT(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}`}}function DT(){const t=We(o=>o.debugOpen),e=Te(o=>o.snap),s=Te(o=>o.events),r=Te(o=>o.terminalChunks),n=Te(o=>o.presets),[l,c]=oe.useState("events");return t?E.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:[E.jsxs("div",{className:"flex items-center gap-2 border-b-[3px] border-ink px-2 py-1.5 font-ui text-[13px]",children:[E.jsx("b",{className:"uppercase tracking-[0.12em]",children:"Debug"}),["events","snapshot"].map(o=>E.jsx("button",{className:"btn px-2 text-[12px] text-ink","aria-pressed":l===o,onClick:()=>c(o),children:o},o)),n&&E.jsxs("select",{className:"field ml-auto w-[190px] py-0 text-[12px] text-ink",defaultValue:"",onChange:o=>{o.target.value&&(Pe.closeDrawer(),ke.loadPreset(o.target.value),o.target.value="")},"aria-label":"Load mock preset",children:[E.jsx("option",{value:"",children:"Load preset…"}),n.map(o=>E.jsx("option",{value:o.id,children:o.label},o.id))]}),E.jsx("button",{className:"btn px-2 text-[12px] text-ink","aria-label":"Close debug",onClick:()=>Pe.toggleDebug(),children:"✕"})]}),E.jsx("div",{className:"scroll-thin min-h-0 flex-1 overflow-auto p-2",children:l==="events"?E.jsxs(E.Fragment,{children:[E.jsxs("div",{className:"mb-1 text-[#66729f]",children:["Last 20 events · ",r," terminal chunks streamed"]}),E.jsx("ul",{children:s.map(o=>E.jsxs("li",{className:"truncate",children:[E.jsxs("span",{className:"text-[#66729f]",children:[new Date(o.at).toLocaleTimeString()," "]}),E.jsx("span",{className:"text-yellow",children:o.event.type})," ",E.jsx("span",{className:"text-[#dfe6ff]",children:RT(o.event)})]},o.n))})]}):e&&E.jsx(jx,{name:"OfficeSnapshot",value:e,depth:0})})]}):null}const bf=oe.createContext({});function Sf(t){const e=oe.useRef(null);return e.current===null&&(e.current=t()),e.current}const wc=oe.createContext(null),Cf=oe.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});class LT extends oe.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 BT({children:t,isPresent:e}){const s=oe.useId(),r=oe.useRef(null),n=oe.useRef({width:0,height:0,top:0,left:0}),{nonce:l}=oe.useContext(Cf);return oe.useInsertionEffect(()=>{const{width:c,height:o,top:h,left:u}=n.current;if(e||!r.current||!c||!o)return;r.current.dataset.motionPopId=s;const p=document.createElement("style");return l&&(p.nonce=l),document.head.appendChild(p),p.sheet&&p.sheet.insertRule(`
|
|
292
|
+
[data-motion-pop-id="${s}"] {
|
|
293
|
+
position: absolute !important;
|
|
294
|
+
width: ${c}px !important;
|
|
295
|
+
height: ${o}px !important;
|
|
296
|
+
top: ${h}px !important;
|
|
297
|
+
left: ${u}px !important;
|
|
298
|
+
}
|
|
299
|
+
`),()=>{document.head.removeChild(p)}},[e]),E.jsx(LT,{isPresent:e,childRef:r,sizeRef:n,children:oe.cloneElement(t,{ref:r})})}const IT=({children:t,initial:e,isPresent:s,onExitComplete:r,custom:n,presenceAffectsLayout:l,mode:c})=>{const o=Sf(OT),h=oe.useId(),u=oe.useCallback(d=>{o.set(d,!0);for(const g of o.values())if(!g)return;r&&r()},[o,r]),p=oe.useMemo(()=>({id:h,initial:e,isPresent:s,custom:n,onExitComplete:u,register:d=>(o.set(d,!1),()=>o.delete(d))}),l?[Math.random(),u]:[s,u]);return oe.useMemo(()=>{o.forEach((d,g)=>o.set(g,!1))},[s]),oe.useEffect(()=>{!s&&!o.size&&r&&r()},[s]),c==="popLayout"&&(t=E.jsx(BT,{isPresent:s,children:t})),E.jsx(wc.Provider,{value:p,children:t})};function OT(){return new Map}function Nx(t=!0){const e=oe.useContext(wc);if(e===null)return[!0,null];const{isPresent:s,onExitComplete:r,register:n}=e,l=oe.useId();oe.useEffect(()=>{t&&n(l)},[t]);const c=oe.useCallback(()=>t&&r&&r(l),[l,r,t]);return!s&&r?[!1,c]:[!0]}const Ll=t=>t.key||"";function Rv(t){const e=[];return oe.Children.forEach(t,s=>{oe.isValidElement(s)&&e.push(s)}),e}const kf=typeof window<"u",Fx=kf?oe.useLayoutEffect:oe.useEffect,Hx=({children:t,custom:e,initial:s=!0,onExitComplete:r,presenceAffectsLayout:n=!0,mode:l="sync",propagate:c=!1})=>{const[o,h]=Nx(c),u=oe.useMemo(()=>Rv(t),[t]),p=c&&!o?[]:u.map(Ll),d=oe.useRef(!0),g=oe.useRef(u),w=Sf(()=>new Map),[S,y]=oe.useState(u),[m,v]=oe.useState(u);Fx(()=>{d.current=!1,g.current=u;for(let C=0;C<m.length;C++){const M=Ll(m[C]);p.includes(M)?w.delete(M):w.get(M)!==!0&&w.set(M,!1)}},[m,p.length,p.join("-")]);const x=[];if(u!==S){let C=[...u];for(let M=0;M<m.length;M++){const T=m[M],R=Ll(T);p.includes(R)||(C.splice(M,0,T),x.push(T))}l==="wait"&&x.length&&(C=x),v(Rv(C)),y(u);return}const{forceRender:_}=oe.useContext(bf);return E.jsx(E.Fragment,{children:m.map(C=>{const M=Ll(C),T=c&&!o?!1:u===m||p.includes(M),R=()=>{if(w.has(M))w.set(M,!0);else return;let P=!0;w.forEach(L=>{L||(P=!1)}),P&&(_==null||_(),v(g.current),c&&(h==null||h()),r&&r())};return E.jsx(IT,{isPresent:T,initial:!d.current||s?void 0:!1,custom:T?void 0:e,presenceAffectsLayout:n,mode:l,onExitComplete:T?void 0:R,children:C},M)})})},us=t=>t;let $x=us;function Ef(t){let e;return()=>(e===void 0&&(e=t()),e)}const fn=(t,e,s)=>{const r=e-t;return r===0?1:(s-t)/r},hr=t=>t*1e3,ur=t=>t/1e3,jT={useManualTiming:!1};function NT(t){let e=new Set,s=new Set,r=!1,n=!1;const l=new WeakSet;let c={delta:0,timestamp:0,isProcessing:!1};function o(u){l.has(u)&&(h.schedule(u),t()),u(c)}const h={schedule:(u,p=!1,d=!1)=>{const w=d&&r?e:s;return p&&l.add(u),w.has(u)||w.add(u),u},cancel:u=>{s.delete(u),l.delete(u)},process:u=>{if(c=u,r){n=!0;return}r=!0,[e,s]=[s,e],e.forEach(o),e.clear(),r=!1,n&&(n=!1,h.process(u))}};return h}const Bl=["read","resolveKeyframes","update","preRender","render","postRender"],FT=40;function zx(t,e){let s=!1,r=!0;const n={delta:0,timestamp:0,isProcessing:!1},l=()=>s=!0,c=Bl.reduce((v,x)=>(v[x]=NT(l),v),{}),{read:o,resolveKeyframes:h,update:u,preRender:p,render:d,postRender:g}=c,w=()=>{const v=performance.now();s=!1,n.delta=r?1e3/60:Math.max(Math.min(v-n.timestamp,FT),1),n.timestamp=v,n.isProcessing=!0,o.process(n),h.process(n),u.process(n),p.process(n),d.process(n),g.process(n),n.isProcessing=!1,s&&e&&(r=!1,t(w))},S=()=>{s=!0,r=!0,n.isProcessing||t(w)};return{schedule:Bl.reduce((v,x)=>{const _=c[x];return v[x]=(C,M=!1,T=!1)=>(s||S(),_.schedule(C,M,T)),v},{}),cancel:v=>{for(let x=0;x<Bl.length;x++)c[Bl[x]].cancel(v)},state:n,steps:c}}const{schedule:Qe,cancel:Fr,state:At,steps:td}=zx(typeof requestAnimationFrame<"u"?requestAnimationFrame:us,!0),Wx=oe.createContext({strict:!1}),Dv={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"]},pn={};for(const t in Dv)pn[t]={isEnabled:e=>Dv[t].some(s=>!!e[s])};function HT(t){for(const e in t)pn[e]={...pn[e],...t[e]}}const $T=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 nc(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||$T.has(t)}let Ux=t=>!nc(t);function zT(t){t&&(Ux=e=>e.startsWith("on")?!nc(e):t(e))}try{zT(require("@emotion/is-prop-valid").default)}catch{}function WT(t,e,s){const r={};for(const n in t)n==="values"&&typeof t.values=="object"||(Ux(n)||s===!0&&nc(n)||!e&&!nc(n)||t.draggable&&n.startsWith("onDrag"))&&(r[n]=t[n]);return r}function UT(t){if(typeof Proxy>"u")return t;const e=new Map,s=(...r)=>t(...r);return new Proxy(s,{get:(r,n)=>n==="create"?t:(e.has(n)||e.set(n,t(n)),e.get(n))})}const bc=oe.createContext({});function Wo(t){return typeof t=="string"||Array.isArray(t)}function Sc(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const Mf=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Tf=["initial",...Mf];function Cc(t){return Sc(t.animate)||Tf.some(e=>Wo(t[e]))}function Vx(t){return!!(Cc(t)||t.variants)}function VT(t,e){if(Cc(t)){const{initial:s,animate:r}=t;return{initial:s===!1||Wo(s)?s:void 0,animate:Wo(r)?r:void 0}}return t.inherit!==!1?e:{}}function GT(t){const{initial:e,animate:s}=VT(t,oe.useContext(bc));return oe.useMemo(()=>({initial:e,animate:s}),[Lv(e),Lv(s)])}function Lv(t){return Array.isArray(t)?t.join(" "):t}const qT=Symbol.for("motionComponentSymbol");function on(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function KT(t,e,s){return oe.useCallback(r=>{r&&t.onMount&&t.onMount(r),e&&(r?e.mount(r):e.unmount()),s&&(typeof s=="function"?s(r):on(s)&&(s.current=r))},[e])}const Pf=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),YT="framerAppearId",Gx="data-"+Pf(YT),{schedule:Af}=zx(queueMicrotask,!1),qx=oe.createContext({});function XT(t,e,s,r,n){var l,c;const{visualElement:o}=oe.useContext(bc),h=oe.useContext(Wx),u=oe.useContext(wc),p=oe.useContext(Cf).reducedMotion,d=oe.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:p}));const g=d.current,w=oe.useContext(qx);g&&!g.projection&&n&&(g.type==="html"||g.type==="svg")&&QT(d.current,s,n,w);const S=oe.useRef(!1);oe.useInsertionEffect(()=>{g&&S.current&&g.update(s,u)});const y=s[Gx],m=oe.useRef(!!y&&!(!((l=window.MotionHandoffIsComplete)===null||l===void 0)&&l.call(window,y))&&((c=window.MotionHasOptimisedAnimation)===null||c===void 0?void 0:c.call(window,y)));return Fx(()=>{g&&(S.current=!0,window.MotionIsMounted=!0,g.updateFeatures(),Af.render(g.render),m.current&&g.animationState&&g.animationState.animateChanges())}),oe.useEffect(()=>{g&&(!m.current&&g.animationState&&g.animationState.animateChanges(),m.current&&(queueMicrotask(()=>{var v;(v=window.MotionHandoffMarkAsComplete)===null||v===void 0||v.call(window,y)}),m.current=!1))}),g}function QT(t,e,s,r){const{layoutId:n,layout:l,drag:c,dragConstraints:o,layoutScroll:h,layoutRoot:u}=e;t.projection=new s(t.latestValues,e["data-framer-portal-id"]?void 0:Kx(t.parent)),t.projection.setOptions({layoutId:n,layout:l,alwaysMeasureLayout:!!c||o&&on(o),visualElement:t,animationType:typeof l=="string"?l:"both",initialPromotionConfig:r,layoutScroll:h,layoutRoot:u})}function Kx(t){if(t)return t.options.allowProjection!==!1?t.projection:Kx(t.parent)}function ZT({preloadedFeatures:t,createVisualElement:e,useRender:s,useVisualState:r,Component:n}){var l,c;t&&HT(t);function o(u,p){let d;const g={...oe.useContext(Cf),...u,layoutId:JT(u)},{isStatic:w}=g,S=GT(u),y=r(u,w);if(!w&&kf){eP();const m=tP(g);d=m.MeasureLayout,S.visualElement=XT(n,y,g,e,m.ProjectionNode)}return E.jsxs(bc.Provider,{value:S,children:[d&&S.visualElement?E.jsx(d,{visualElement:S.visualElement,...g}):null,s(n,u,KT(y,S.visualElement,p),y,w,S.visualElement)]})}o.displayName=`motion.${typeof n=="string"?n:`create(${(c=(l=n.displayName)!==null&&l!==void 0?l:n.name)!==null&&c!==void 0?c:""})`}`;const h=oe.forwardRef(o);return h[qT]=n,h}function JT({layoutId:t}){const e=oe.useContext(bf).id;return e&&t!==void 0?e+"-"+t:t}function eP(t,e){oe.useContext(Wx).strict}function tP(t){const{drag:e,layout:s}=pn;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 sP=["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 Rf(t){return typeof t!="string"||t.includes("-")?!1:!!(sP.indexOf(t)>-1||/[A-Z]/u.test(t))}function Bv(t){const e=[{},{}];return t==null||t.values.forEach((s,r)=>{e[0][r]=s.get(),e[1][r]=s.getVelocity()}),e}function Df(t,e,s,r){if(typeof e=="function"){const[n,l]=Bv(r);e=e(s!==void 0?s:t.custom,n,l)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[n,l]=Bv(r);e=e(s!==void 0?s:t.custom,n,l)}return e}const $d=t=>Array.isArray(t),rP=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),iP=t=>$d(t)?t[t.length-1]||0:t,Nt=t=>!!(t&&t.getVelocity);function $l(t){const e=Nt(t)?t.get():t;return rP(e)?e.toValue():e}function nP({scrapeMotionValuesFromProps:t,createRenderState:e,onUpdate:s},r,n,l){const c={latestValues:oP(r,n,l,t),renderState:e()};return s&&(c.onMount=o=>s({props:r,current:o,...c}),c.onUpdate=o=>s(o)),c}const Yx=t=>(e,s)=>{const r=oe.useContext(bc),n=oe.useContext(wc),l=()=>nP(t,e,r,n);return s?l():Sf(l)};function oP(t,e,s,r){const n={},l=r(t,{});for(const g in l)n[g]=$l(l[g]);let{initial:c,animate:o}=t;const h=Cc(t),u=Vx(t);e&&u&&!h&&t.inherit!==!1&&(c===void 0&&(c=e.initial),o===void 0&&(o=e.animate));let p=s?s.initial===!1:!1;p=p||c===!1;const d=p?o:c;if(d&&typeof d!="boolean"&&!Sc(d)){const g=Array.isArray(d)?d:[d];for(let w=0;w<g.length;w++){const S=Df(t,g[w]);if(S){const{transitionEnd:y,transition:m,...v}=S;for(const x in v){let _=v[x];if(Array.isArray(_)){const C=p?_.length-1:0;_=_[C]}_!==null&&(n[x]=_)}for(const x in y)n[x]=y[x]}}}return n}const yn=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],ki=new Set(yn),Xx=t=>e=>typeof e=="string"&&e.startsWith(t),Qx=Xx("--"),aP=Xx("var(--"),Lf=t=>aP(t)?lP.test(t.split("/*")[0].trim()):!1,lP=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Zx=(t,e)=>e&&typeof t=="number"?e.transform(t):t,dr=(t,e,s)=>s>e?e:s<t?t:s,xn={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},Uo={...xn,transform:t=>dr(0,1,t)},Il={...xn,default:1},Qo=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),Or=Qo("deg"),Ks=Qo("%"),Ce=Qo("px"),cP=Qo("vh"),hP=Qo("vw"),Iv={...Ks,parse:t=>Ks.parse(t)/100,transform:t=>Ks.transform(t*100)},uP={borderWidth:Ce,borderTopWidth:Ce,borderRightWidth:Ce,borderBottomWidth:Ce,borderLeftWidth:Ce,borderRadius:Ce,radius:Ce,borderTopLeftRadius:Ce,borderTopRightRadius:Ce,borderBottomRightRadius:Ce,borderBottomLeftRadius:Ce,width:Ce,maxWidth:Ce,height:Ce,maxHeight:Ce,top:Ce,right:Ce,bottom:Ce,left:Ce,padding:Ce,paddingTop:Ce,paddingRight:Ce,paddingBottom:Ce,paddingLeft:Ce,margin:Ce,marginTop:Ce,marginRight:Ce,marginBottom:Ce,marginLeft:Ce,backgroundPositionX:Ce,backgroundPositionY:Ce},dP={rotate:Or,rotateX:Or,rotateY:Or,rotateZ:Or,scale:Il,scaleX:Il,scaleY:Il,scaleZ:Il,skew:Or,skewX:Or,skewY:Or,distance:Ce,translateX:Ce,translateY:Ce,translateZ:Ce,x:Ce,y:Ce,z:Ce,perspective:Ce,transformPerspective:Ce,opacity:Uo,originX:Iv,originY:Iv,originZ:Ce},Ov={...xn,transform:Math.round},Bf={...uP,...dP,zIndex:Ov,size:Ce,fillOpacity:Uo,strokeOpacity:Uo,numOctaves:Ov},fP={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},pP=yn.length;function mP(t,e,s){let r="",n=!0;for(let l=0;l<pP;l++){const c=yn[l],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=Zx(o,Bf[c]);if(!h){n=!1;const p=fP[c]||c;r+=`${p}(${u}) `}s&&(e[c]=u)}}return r=r.trim(),s?r=s(e,n?"":r):n&&(r="none"),r}function If(t,e,s){const{style:r,vars:n,transformOrigin:l}=t;let c=!1,o=!1;for(const h in e){const u=e[h];if(ki.has(h)){c=!0;continue}else if(Qx(h)){n[h]=u;continue}else{const p=Zx(u,Bf[h]);h.startsWith("origin")?(o=!0,l[h]=p):r[h]=p}}if(e.transform||(c||s?r.transform=mP(e,t.transform,s):r.transform&&(r.transform="none")),o){const{originX:h="50%",originY:u="50%",originZ:p=0}=l;r.transformOrigin=`${h} ${u} ${p}`}}const gP={offset:"stroke-dashoffset",array:"stroke-dasharray"},_P={offset:"strokeDashoffset",array:"strokeDasharray"};function vP(t,e,s=1,r=0,n=!0){t.pathLength=1;const l=n?gP:_P;t[l.offset]=Ce.transform(-r);const c=Ce.transform(e),o=Ce.transform(s);t[l.array]=`${c} ${o}`}function jv(t,e,s){return typeof t=="string"?t:Ce.transform(e+s*t)}function yP(t,e,s){const r=jv(e,t.x,t.width),n=jv(s,t.y,t.height);return`${r} ${n}`}function Of(t,{attrX:e,attrY:s,attrScale:r,originX:n,originY:l,pathLength:c,pathSpacing:o=1,pathOffset:h=0,...u},p,d){if(If(t,u,d),p){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:g,style:w,dimensions:S}=t;g.transform&&(S&&(w.transform=g.transform),delete g.transform),S&&(n!==void 0||l!==void 0||w.transform)&&(w.transformOrigin=yP(S,n!==void 0?n:.5,l!==void 0?l:.5)),e!==void 0&&(g.x=e),s!==void 0&&(g.y=s),r!==void 0&&(g.scale=r),c!==void 0&&vP(g,c,o,h,!1)}const jf=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),Jx=()=>({...jf(),attrs:{}}),Nf=t=>typeof t=="string"&&t.toLowerCase()==="svg";function e1(t,{style:e,vars:s},r,n){Object.assign(t.style,e,n&&n.getProjectionStyles(r));for(const l in s)t.style.setProperty(l,s[l])}const t1=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 s1(t,e,s,r){e1(t,e,void 0,r);for(const n in e.attrs)t.setAttribute(t1.has(n)?n:Pf(n),e.attrs[n])}const oc={};function xP(t){Object.assign(oc,t)}function r1(t,{layout:e,layoutId:s}){return ki.has(t)||t.startsWith("origin")||(e||s!==void 0)&&(!!oc[t]||t==="opacity")}function Ff(t,e,s){var r;const{style:n}=t,l={};for(const c in n)(Nt(n[c])||e.style&&Nt(e.style[c])||r1(c,t)||((r=s==null?void 0:s.getValue(c))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(l[c]=n[c]);return l}function i1(t,e,s){const r=Ff(t,e,s);for(const n in t)if(Nt(t[n])||Nt(e[n])){const l=yn.indexOf(n)!==-1?"attr"+n.charAt(0).toUpperCase()+n.substring(1):n;r[l]=t[n]}return r}function wP(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 Nv=["x","y","width","height","cx","cy","r"],bP={useVisualState:Yx({scrapeMotionValuesFromProps:i1,createRenderState:Jx,onUpdate:({props:t,prevProps:e,current:s,renderState:r,latestValues:n})=>{if(!s)return;let l=!!t.drag;if(!l){for(const o in n)if(ki.has(o)){l=!0;break}}if(!l)return;let c=!e;if(e)for(let o=0;o<Nv.length;o++){const h=Nv[o];t[h]!==e[h]&&(c=!0)}c&&Qe.read(()=>{wP(s,r),Qe.render(()=>{Of(r,n,Nf(s.tagName),t.transformTemplate),s1(s,r)})})}})},SP={useVisualState:Yx({scrapeMotionValuesFromProps:Ff,createRenderState:jf})};function n1(t,e,s){for(const r in e)!Nt(e[r])&&!r1(r,s)&&(t[r]=e[r])}function CP({transformTemplate:t},e){return oe.useMemo(()=>{const s=jf();return If(s,e,t),Object.assign({},s.vars,s.style)},[e])}function kP(t,e){const s=t.style||{},r={};return n1(r,s,t),Object.assign(r,CP(t,e)),r}function EP(t,e){const s={},r=kP(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 MP(t,e,s,r){const n=oe.useMemo(()=>{const l=Jx();return Of(l,e,Nf(r),t.transformTemplate),{...l.attrs,style:{...l.style}}},[e]);if(t.style){const l={};n1(l,t.style,t),n.style={...l,...n.style}}return n}function TP(t=!1){return(s,r,n,{latestValues:l},c)=>{const h=(Rf(s)?MP:EP)(r,l,c,s),u=WT(r,typeof s=="string",t),p=s!==oe.Fragment?{...u,...h,ref:n}:{},{children:d}=r,g=oe.useMemo(()=>Nt(d)?d.get():d,[d]);return oe.createElement(s,{...p,children:g})}}function PP(t,e){return function(r,{forwardMotionProps:n}={forwardMotionProps:!1}){const c={...Rf(r)?bP:SP,preloadedFeatures:t,useRender:TP(n),createVisualElement:e,Component:r};return ZT(c)}}function o1(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 kc(t,e,s){const r=t.getProps();return Df(r,e,s!==void 0?s:r.custom,t)}const AP=Ef(()=>window.ScrollTimeline!==void 0);class RP{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(n=>{if(AP()&&n.attachTimeline)return n.attachTimeline(e);if(typeof s=="function")return s(n)});return()=>{r.forEach((n,l)=>{n&&n(),this.animations[l].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 DP extends RP{then(e,s){return Promise.all(this.animations).then(e).catch(s)}}function Hf(t,e){return t?t[e]||t.default||t:void 0}const zd=2e4;function a1(t){let e=0;const s=50;let r=t.next(e);for(;!r.done&&e<zd;)e+=s,r=t.next(e);return e>=zd?1/0:e}function $f(t){return typeof t=="function"}function Fv(t,e){t.timeline=e,t.onfinish=null}const zf=t=>Array.isArray(t)&&typeof t[0]=="number",LP={linearEasing:void 0};function BP(t,e){const s=Ef(t);return()=>{var r;return(r=LP[e])!==null&&r!==void 0?r:s()}}const ac=BP(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),l1=(t,e,s=10)=>{let r="";const n=Math.max(Math.round(e/s),2);for(let l=0;l<n;l++)r+=t(fn(0,n-1,l))+", ";return`linear(${r.substring(0,r.length-2)})`};function c1(t){return!!(typeof t=="function"&&ac()||!t||typeof t=="string"&&(t in Wd||ac())||zf(t)||Array.isArray(t)&&t.every(c1))}const wo=([t,e,s,r])=>`cubic-bezier(${t}, ${e}, ${s}, ${r})`,Wd={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:wo([0,.65,.55,1]),circOut:wo([.55,0,1,.45]),backIn:wo([.31,.01,.66,-.59]),backOut:wo([.33,1.53,.69,.99])};function h1(t,e){if(t)return typeof t=="function"&&ac()?l1(t,e):zf(t)?wo(t):Array.isArray(t)?t.map(s=>h1(s,e)||Wd.easeOut):Wd[t]}const Ls={x:!1,y:!1};function u1(){return Ls.x||Ls.y}function IP(t,e,s){var r;if(t instanceof Element)return[t];if(typeof t=="string"){let n=document;const l=(r=void 0)!==null&&r!==void 0?r:n.querySelectorAll(t);return l?Array.from(l):[]}return Array.from(t)}function d1(t,e){const s=IP(t),r=new AbortController,n={passive:!0,...e,signal:r.signal};return[s,n,()=>r.abort()]}function Hv(t){return e=>{e.pointerType==="touch"||u1()||t(e)}}function OP(t,e,s={}){const[r,n,l]=d1(t,s),c=Hv(o=>{const{target:h}=o,u=e(o);if(typeof u!="function"||!h)return;const p=Hv(d=>{u(d),h.removeEventListener("pointerleave",p)});h.addEventListener("pointerleave",p,n)});return r.forEach(o=>{o.addEventListener("pointerenter",c,n)}),l}const f1=(t,e)=>e?t===e?!0:f1(t,e.parentElement):!1,Wf=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,jP=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function NP(t){return jP.has(t.tagName)||t.tabIndex!==-1}const bo=new WeakSet;function $v(t){return e=>{e.key==="Enter"&&t(e)}}function sd(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const FP=(t,e)=>{const s=t.currentTarget;if(!s)return;const r=$v(()=>{if(bo.has(s))return;sd(s,"down");const n=$v(()=>{sd(s,"up")}),l=()=>sd(s,"cancel");s.addEventListener("keyup",n,e),s.addEventListener("blur",l,e)});s.addEventListener("keydown",r,e),s.addEventListener("blur",()=>s.removeEventListener("keydown",r),e)};function zv(t){return Wf(t)&&!u1()}function HP(t,e,s={}){const[r,n,l]=d1(t,s),c=o=>{const h=o.currentTarget;if(!zv(o)||bo.has(h))return;bo.add(h);const u=e(o),p=(w,S)=>{window.removeEventListener("pointerup",d),window.removeEventListener("pointercancel",g),!(!zv(w)||!bo.has(h))&&(bo.delete(h),typeof u=="function"&&u(w,{success:S}))},d=w=>{p(w,s.useGlobalTarget||f1(h,w.target))},g=w=>{p(w,!1)};window.addEventListener("pointerup",d,n),window.addEventListener("pointercancel",g,n)};return r.forEach(o=>{!NP(o)&&o.getAttribute("tabindex")===null&&(o.tabIndex=0),(s.useGlobalTarget?window:o).addEventListener("pointerdown",c,n),o.addEventListener("focus",u=>FP(u,n),n)}),l}function $P(t){return t==="x"||t==="y"?Ls[t]?null:(Ls[t]=!0,()=>{Ls[t]=!1}):Ls.x||Ls.y?null:(Ls.x=Ls.y=!0,()=>{Ls.x=Ls.y=!1})}const p1=new Set(["width","height","top","left","right","bottom",...yn]);let zl;function zP(){zl=void 0}const Ys={now:()=>(zl===void 0&&Ys.set(At.isProcessing||jT.useManualTiming?At.timestamp:performance.now()),zl),set:t=>{zl=t,queueMicrotask(zP)}};function Uf(t,e){t.indexOf(e)===-1&&t.push(e)}function Vf(t,e){const s=t.indexOf(e);s>-1&&t.splice(s,1)}class Gf{constructor(){this.subscriptions=[]}add(e){return Uf(this.subscriptions,e),()=>Vf(this.subscriptions,e)}notify(e,s,r){const n=this.subscriptions.length;if(n)if(n===1)this.subscriptions[0](e,s,r);else for(let l=0;l<n;l++){const c=this.subscriptions[l];c&&c(e,s,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function m1(t,e){return e?t*(1e3/e):0}const Wv=30,WP=t=>!isNaN(parseFloat(t));class UP{constructor(e,s={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,n=!0)=>{const l=Ys.now();this.updatedAt!==l&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),n&&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=Ys.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=WP(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 Gf);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=Ys.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>Wv)return 0;const s=Math.min(this.updatedAt-this.prevUpdatedAt,Wv);return m1(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 Vo(t,e){return new UP(t,e)}function VP(t,e,s){t.hasValue(e)?t.getValue(e).set(s):t.addValue(e,Vo(s))}function GP(t,e){const s=kc(t,e);let{transitionEnd:r={},transition:n={},...l}=s||{};l={...l,...r};for(const c in l){const o=iP(l[c]);VP(t,c,o)}}function qP(t){return!!(Nt(t)&&t.add)}function Ud(t,e){const s=t.getValue("willChange");if(qP(s))return s.add(e)}function g1(t){return t.props[Gx]}const _1=(t,e,s)=>(((1-3*s+3*e)*t+(3*s-6*e))*t+3*e)*t,KP=1e-7,YP=12;function XP(t,e,s,r,n){let l,c,o=0;do c=e+(s-e)/2,l=_1(c,r,n)-t,l>0?s=c:e=c;while(Math.abs(l)>KP&&++o<YP);return c}function Zo(t,e,s,r){if(t===e&&s===r)return us;const n=l=>XP(l,0,1,t,s);return l=>l===0||l===1?l:_1(n(l),e,r)}const v1=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,y1=t=>e=>1-t(1-e),x1=Zo(.33,1.53,.69,.99),qf=y1(x1),w1=v1(qf),b1=t=>(t*=2)<1?.5*qf(t):.5*(2-Math.pow(2,-10*(t-1))),Kf=t=>1-Math.sin(Math.acos(t)),S1=y1(Kf),C1=v1(Kf),k1=t=>/^0[^.\s]+$/u.test(t);function QP(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||k1(t):!0}const Ro=t=>Math.round(t*1e5)/1e5,Yf=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function ZP(t){return t==null}const JP=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Xf=(t,e)=>s=>!!(typeof s=="string"&&JP.test(s)&&s.startsWith(t)||e&&!ZP(s)&&Object.prototype.hasOwnProperty.call(s,e)),E1=(t,e,s)=>r=>{if(typeof r!="string")return r;const[n,l,c,o]=r.match(Yf);return{[t]:parseFloat(n),[e]:parseFloat(l),[s]:parseFloat(c),alpha:o!==void 0?parseFloat(o):1}},e3=t=>dr(0,255,t),rd={...xn,transform:t=>Math.round(e3(t))},_i={test:Xf("rgb","red"),parse:E1("red","green","blue"),transform:({red:t,green:e,blue:s,alpha:r=1})=>"rgba("+rd.transform(t)+", "+rd.transform(e)+", "+rd.transform(s)+", "+Ro(Uo.transform(r))+")"};function t3(t){let e="",s="",r="",n="";return t.length>5?(e=t.substring(1,3),s=t.substring(3,5),r=t.substring(5,7),n=t.substring(7,9)):(e=t.substring(1,2),s=t.substring(2,3),r=t.substring(3,4),n=t.substring(4,5),e+=e,s+=s,r+=r,n+=n),{red:parseInt(e,16),green:parseInt(s,16),blue:parseInt(r,16),alpha:n?parseInt(n,16)/255:1}}const Vd={test:Xf("#"),parse:t3,transform:_i.transform},an={test:Xf("hsl","hue"),parse:E1("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:s,alpha:r=1})=>"hsla("+Math.round(t)+", "+Ks.transform(Ro(e))+", "+Ks.transform(Ro(s))+", "+Ro(Uo.transform(r))+")"},It={test:t=>_i.test(t)||Vd.test(t)||an.test(t),parse:t=>_i.test(t)?_i.parse(t):an.test(t)?an.parse(t):Vd.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?_i.transform(t):an.transform(t)},s3=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function r3(t){var e,s;return isNaN(t)&&typeof t=="string"&&(((e=t.match(Yf))===null||e===void 0?void 0:e.length)||0)+(((s=t.match(s3))===null||s===void 0?void 0:s.length)||0)>0}const M1="number",T1="color",i3="var",n3="var(",Uv="${}",o3=/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 Go(t){const e=t.toString(),s=[],r={color:[],number:[],var:[]},n=[];let l=0;const o=e.replace(o3,h=>(It.test(h)?(r.color.push(l),n.push(T1),s.push(It.parse(h))):h.startsWith(n3)?(r.var.push(l),n.push(i3),s.push(h)):(r.number.push(l),n.push(M1),s.push(parseFloat(h))),++l,Uv)).split(Uv);return{values:s,split:o,indexes:r,types:n}}function P1(t){return Go(t).values}function A1(t){const{split:e,types:s}=Go(t),r=e.length;return n=>{let l="";for(let c=0;c<r;c++)if(l+=e[c],n[c]!==void 0){const o=s[c];o===M1?l+=Ro(n[c]):o===T1?l+=It.transform(n[c]):l+=n[c]}return l}}const a3=t=>typeof t=="number"?0:t;function l3(t){const e=P1(t);return A1(t)(e.map(a3))}const Hr={test:r3,parse:P1,createTransformer:A1,getAnimatableNone:l3},c3=new Set(["brightness","contrast","saturate","opacity"]);function h3(t){const[e,s]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[r]=s.match(Yf)||[];if(!r)return t;const n=s.replace(r,"");let l=c3.has(e)?1:0;return r!==s&&(l*=100),e+"("+l+n+")"}const u3=/\b([a-z-]*)\(.*?\)/gu,Gd={...Hr,getAnimatableNone:t=>{const e=t.match(u3);return e?e.map(h3).join(" "):t}},d3={...Bf,color:It,backgroundColor:It,outlineColor:It,fill:It,stroke:It,borderColor:It,borderTopColor:It,borderRightColor:It,borderBottomColor:It,borderLeftColor:It,filter:Gd,WebkitFilter:Gd},Qf=t=>d3[t];function R1(t,e){let s=Qf(t);return s!==Gd&&(s=Hr),s.getAnimatableNone?s.getAnimatableNone(e):void 0}const f3=new Set(["auto","none","0"]);function p3(t,e,s){let r=0,n;for(;r<t.length&&!n;){const l=t[r];typeof l=="string"&&!f3.has(l)&&Go(l).values.length&&(n=t[r]),r++}if(n&&s)for(const l of e)t[l]=R1(s,n)}const Vv=t=>t===xn||t===Ce,Gv=(t,e)=>parseFloat(t.split(", ")[e]),qv=(t,e)=>(s,{transform:r})=>{if(r==="none"||!r)return 0;const n=r.match(/^matrix3d\((.+)\)$/u);if(n)return Gv(n[1],e);{const l=r.match(/^matrix\((.+)\)$/u);return l?Gv(l[1],t):0}},m3=new Set(["x","y","z"]),g3=yn.filter(t=>!m3.has(t));function _3(t){const e=[];return g3.forEach(s=>{const r=t.getValue(s);r!==void 0&&(e.push([s,r.get()]),r.set(s.startsWith("scale")?1:0))}),e}const mn={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:qv(4,13),y:qv(5,14)};mn.translateX=mn.x;mn.translateY=mn.y;const xi=new Set;let qd=!1,Kd=!1;function D1(){if(Kd){const t=Array.from(xi).filter(r=>r.needsMeasurement),e=new Set(t.map(r=>r.element)),s=new Map;e.forEach(r=>{const n=_3(r);n.length&&(s.set(r,n),r.render())}),t.forEach(r=>r.measureInitialState()),e.forEach(r=>{r.render();const n=s.get(r);n&&n.forEach(([l,c])=>{var o;(o=r.getValue(l))===null||o===void 0||o.set(c)})}),t.forEach(r=>r.measureEndState()),t.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Kd=!1,qd=!1,xi.forEach(t=>t.complete()),xi.clear()}function L1(){xi.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Kd=!0)})}function v3(){L1(),D1()}class Zf{constructor(e,s,r,n,l,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=n,this.element=l,this.isAsync=c}scheduleResolve(){this.isScheduled=!0,this.isAsync?(xi.add(this),qd||(qd=!0,Qe.read(L1),Qe.resolveKeyframes(D1))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:s,element:r,motionValue:n}=this;for(let l=0;l<e.length;l++)if(e[l]===null)if(l===0){const c=n==null?void 0:n.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),n&&c===void 0&&n.set(e[0])}else e[l]=e[l-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),xi.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,xi.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const B1=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),y3=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function x3(t){const e=y3.exec(t);if(!e)return[,];const[,s,r,n]=e;return[`--${s??r}`,n]}function I1(t,e,s=1){const[r,n]=x3(t);if(!r)return;const l=window.getComputedStyle(e).getPropertyValue(r);if(l){const c=l.trim();return B1(c)?parseFloat(c):c}return Lf(n)?I1(n,e,s+1):n}const O1=t=>e=>e.test(t),w3={test:t=>t==="auto",parse:t=>t},j1=[xn,Ce,Ks,Or,hP,cP,w3],Kv=t=>j1.find(O1(t));class N1 extends Zf{constructor(e,s,r,n,l){super(e,s,r,n,l,!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(),Lf(u))){const p=I1(u,s.current);p!==void 0&&(e[h]=p),h===e.length-1&&(this.finalKeyframe=u)}}if(this.resolveNoneKeyframes(),!p1.has(r)||e.length!==2)return;const[n,l]=e,c=Kv(n),o=Kv(l);if(c!==o)if(Vv(c)&&Vv(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 n=0;n<e.length;n++)QP(e[n])&&r.push(n);r.length&&p3(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=mn[r](e.measureViewportBox(),window.getComputedStyle(e.current)),s[0]=this.measuredOrigin;const n=s[s.length-1];n!==void 0&&e.getValue(r,n).jump(n,!1)}measureEndState(){var e;const{element:s,name:r,unresolvedKeyframes:n}=this;if(!s||!s.current)return;const l=s.getValue(r);l&&l.jump(this.measuredOrigin,!1);const c=n.length-1,o=n[c];n[c]=mn[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 Yv=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Hr.test(t)||t==="0")&&!t.startsWith("url("));function b3(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 S3(t,e,s,r){const n=t[0];if(n===null)return!1;if(e==="display"||e==="visibility")return!0;const l=t[t.length-1],c=Yv(n,e),o=Yv(l,e);return!c||!o?!1:b3(t)||(s==="spring"||$f(s))&&r}const C3=t=>t!==null;function Ec(t,{repeat:e,repeatType:s="loop"},r){const n=t.filter(C3),l=e&&s!=="loop"&&e%2===1?0:n.length-1;return!l||r===void 0?n[l]:r}const k3=40;class F1{constructor({autoplay:e=!0,delay:s=0,type:r="keyframes",repeat:n=0,repeatDelay:l=0,repeatType:c="loop",...o}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=Ys.now(),this.options={autoplay:e,delay:s,type:r,repeat:n,repeatDelay:l,repeatType:c,...o},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>k3?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&v3(),this._resolved}onKeyframesResolved(e,s){this.resolvedAt=Ys.now(),this.hasAttemptedResolve=!0;const{name:r,type:n,velocity:l,delay:c,onComplete:o,onUpdate:h,isGenerator:u}=this.options;if(!u&&!S3(e,r,n,l))if(c)this.options.duration=0;else{h&&h(Ec(e,this.options,s)),o&&o(),this.resolveFinishedPromise();return}const p=this.initPlayback(e,s);p!==!1&&(this._resolved={keyframes:e,finalKeyframe:s,...p},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 id(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 E3({hue:t,saturation:e,lightness:s,alpha:r}){t/=360,e/=100,s/=100;let n=0,l=0,c=0;if(!e)n=l=c=s;else{const o=s<.5?s*(1+e):s+e-s*e,h=2*s-o;n=id(h,o,t+1/3),l=id(h,o,t),c=id(h,o,t-1/3)}return{red:Math.round(n*255),green:Math.round(l*255),blue:Math.round(c*255),alpha:r}}function lc(t,e){return s=>s>0?e:t}const nd=(t,e,s)=>{const r=t*t,n=s*(e*e-r)+r;return n<0?0:Math.sqrt(n)},M3=[Vd,_i,an],T3=t=>M3.find(e=>e.test(t));function Xv(t){const e=T3(t);if(!e)return!1;let s=e.parse(t);return e===an&&(s=E3(s)),s}const Qv=(t,e)=>{const s=Xv(t),r=Xv(e);if(!s||!r)return lc(t,e);const n={...s};return l=>(n.red=nd(s.red,r.red,l),n.green=nd(s.green,r.green,l),n.blue=nd(s.blue,r.blue,l),n.alpha=st(s.alpha,r.alpha,l),_i.transform(n))},P3=(t,e)=>s=>e(t(s)),Jo=(...t)=>t.reduce(P3),Yd=new Set(["none","hidden"]);function A3(t,e){return Yd.has(t)?s=>s<=0?t:e:s=>s>=1?e:t}function R3(t,e){return s=>st(t,e,s)}function Jf(t){return typeof t=="number"?R3:typeof t=="string"?Lf(t)?lc:It.test(t)?Qv:B3:Array.isArray(t)?H1:typeof t=="object"?It.test(t)?Qv:D3:lc}function H1(t,e){const s=[...t],r=s.length,n=t.map((l,c)=>Jf(l)(l,e[c]));return l=>{for(let c=0;c<r;c++)s[c]=n[c](l);return s}}function D3(t,e){const s={...t,...e},r={};for(const n in s)t[n]!==void 0&&e[n]!==void 0&&(r[n]=Jf(t[n])(t[n],e[n]));return n=>{for(const l in r)s[l]=r[l](n);return s}}function L3(t,e){var s;const r=[],n={color:0,var:0,number:0};for(let l=0;l<e.values.length;l++){const c=e.types[l],o=t.indexes[c][n[c]],h=(s=t.values[o])!==null&&s!==void 0?s:0;r[l]=h,n[c]++}return r}const B3=(t,e)=>{const s=Hr.createTransformer(e),r=Go(t),n=Go(e);return r.indexes.var.length===n.indexes.var.length&&r.indexes.color.length===n.indexes.color.length&&r.indexes.number.length>=n.indexes.number.length?Yd.has(t)&&!n.values.length||Yd.has(e)&&!r.values.length?A3(t,e):Jo(H1(L3(r,n),n.values),s):lc(t,e)};function $1(t,e,s){return typeof t=="number"&&typeof e=="number"&&typeof s=="number"?st(t,e,s):Jf(t)(t,e)}const I3=5;function z1(t,e,s){const r=Math.max(e-I3,0);return m1(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},od=.001;function O3({duration:t=nt.duration,bounce:e=nt.bounce,velocity:s=nt.velocity,mass:r=nt.mass}){let n,l,c=1-e;c=dr(nt.minDamping,nt.maxDamping,c),t=dr(nt.minDuration,nt.maxDuration,ur(t)),c<1?(n=u=>{const p=u*c,d=p*t,g=p-s,w=Xd(u,c),S=Math.exp(-d);return od-g/w*S},l=u=>{const d=u*c*t,g=d*s+s,w=Math.pow(c,2)*Math.pow(u,2)*t,S=Math.exp(-d),y=Xd(Math.pow(u,2),c);return(-n(u)+od>0?-1:1)*((g-w)*S)/y}):(n=u=>{const p=Math.exp(-u*t),d=(u-s)*t+1;return-od+p*d},l=u=>{const p=Math.exp(-u*t),d=(s-u)*(t*t);return p*d});const o=5/t,h=N3(n,l,o);if(t=hr(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 j3=12;function N3(t,e,s){let r=s;for(let n=1;n<j3;n++)r=r-t(r)/e(r);return r}function Xd(t,e){return t*Math.sqrt(1-e*e)}const F3=["duration","bounce"],H3=["stiffness","damping","mass"];function Zv(t,e){return e.some(s=>t[s]!==void 0)}function $3(t){let e={velocity:nt.velocity,stiffness:nt.stiffness,damping:nt.damping,mass:nt.mass,isResolvedFromDuration:!1,...t};if(!Zv(t,H3)&&Zv(t,F3))if(t.visualDuration){const s=t.visualDuration,r=2*Math.PI/(s*1.2),n=r*r,l=2*dr(.05,1,1-(t.bounce||0))*Math.sqrt(n);e={...e,mass:nt.mass,stiffness:n,damping:l}}else{const s=O3(t);e={...e,...s,mass:nt.mass},e.isResolvedFromDuration=!0}return e}function W1(t=nt.visualDuration,e=nt.bounce){const s=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:r,restDelta:n}=s;const l=s.keyframes[0],c=s.keyframes[s.keyframes.length-1],o={done:!1,value:l},{stiffness:h,damping:u,mass:p,duration:d,velocity:g,isResolvedFromDuration:w}=$3({...s,velocity:-ur(s.velocity||0)}),S=g||0,y=u/(2*Math.sqrt(h*p)),m=c-l,v=ur(Math.sqrt(h/p)),x=Math.abs(m)<5;r||(r=x?nt.restSpeed.granular:nt.restSpeed.default),n||(n=x?nt.restDelta.granular:nt.restDelta.default);let _;if(y<1){const M=Xd(v,y);_=T=>{const R=Math.exp(-y*v*T);return c-R*((S+y*v*m)/M*Math.sin(M*T)+m*Math.cos(M*T))}}else if(y===1)_=M=>c-Math.exp(-v*M)*(m+(S+v*m)*M);else{const M=v*Math.sqrt(y*y-1);_=T=>{const R=Math.exp(-y*v*T),P=Math.min(M*T,300);return c-R*((S+y*v*m)*Math.sinh(P)+M*m*Math.cosh(P))/M}}const C={calculatedDuration:w&&d||null,next:M=>{const T=_(M);if(w)o.done=M>=d;else{let R=0;y<1&&(R=M===0?hr(S):z1(_,M,T));const P=Math.abs(R)<=r,L=Math.abs(c-T)<=n;o.done=P&&L}return o.value=o.done?c:T,o},toString:()=>{const M=Math.min(a1(C),zd),T=l1(R=>C.next(M*R).value,M,30);return M+"ms "+T}};return C}function Jv({keyframes:t,velocity:e=0,power:s=.8,timeConstant:r=325,bounceDamping:n=10,bounceStiffness:l=500,modifyTarget:c,min:o,max:h,restDelta:u=.5,restSpeed:p}){const d=t[0],g={done:!1,value:d},w=P=>o!==void 0&&P<o||h!==void 0&&P>h,S=P=>o===void 0?h:h===void 0||Math.abs(o-P)<Math.abs(h-P)?o:h;let y=s*e;const m=d+y,v=c===void 0?m:c(m);v!==m&&(y=v-d);const x=P=>-y*Math.exp(-P/r),_=P=>v+x(P),C=P=>{const L=x(P),j=_(P);g.done=Math.abs(L)<=u,g.value=g.done?v:j};let M,T;const R=P=>{w(g.value)&&(M=P,T=W1({keyframes:[g.value,S(g.value)],velocity:z1(_,P,g.value),damping:n,stiffness:l,restDelta:u,restSpeed:p}))};return R(0),{calculatedDuration:null,next:P=>{let L=!1;return!T&&M===void 0&&(L=!0,C(P),R(P)),M!==void 0&&P>=M?T.next(P-M):(!L&&C(P),g)}}}const z3=Zo(.42,0,1,1),W3=Zo(0,0,.58,1),U1=Zo(.42,0,.58,1),U3=t=>Array.isArray(t)&&typeof t[0]!="number",V3={linear:us,easeIn:z3,easeInOut:U1,easeOut:W3,circIn:Kf,circInOut:C1,circOut:S1,backIn:qf,backInOut:w1,backOut:x1,anticipate:b1},ey=t=>{if(zf(t)){$x(t.length===4);const[e,s,r,n]=t;return Zo(e,s,r,n)}else if(typeof t=="string")return V3[t];return t};function G3(t,e,s){const r=[],n=s||$1,l=t.length-1;for(let c=0;c<l;c++){let o=n(t[c],t[c+1]);if(e){const h=Array.isArray(e)?e[c]||us:e;o=Jo(h,o)}r.push(o)}return r}function q3(t,e,{clamp:s=!0,ease:r,mixer:n}={}){const l=t.length;if($x(l===e.length),l===1)return()=>e[0];if(l===2&&e[0]===e[1])return()=>e[1];const c=t[0]===t[1];t[0]>t[l-1]&&(t=[...t].reverse(),e=[...e].reverse());const o=G3(e,r,n),h=o.length,u=p=>{if(c&&p<t[0])return e[0];let d=0;if(h>1)for(;d<t.length-2&&!(p<t[d+1]);d++);const g=fn(t[d],t[d+1],p);return o[d](g)};return s?p=>u(dr(t[0],t[l-1],p)):u}function K3(t,e){const s=t[t.length-1];for(let r=1;r<=e;r++){const n=fn(0,e,r);t.push(st(s,1,n))}}function Y3(t){const e=[0];return K3(e,t.length-1),e}function X3(t,e){return t.map(s=>s*e)}function Q3(t,e){return t.map(()=>e||U1).splice(0,t.length-1)}function cc({duration:t=300,keyframes:e,times:s,ease:r="easeInOut"}){const n=U3(r)?r.map(ey):ey(r),l={done:!1,value:e[0]},c=X3(s&&s.length===e.length?s:Y3(e),t),o=q3(c,e,{ease:Array.isArray(n)?n:Q3(e,n)});return{calculatedDuration:t,next:h=>(l.value=o(h),l.done=h>=t,l)}}const Z3=t=>{const e=({timestamp:s})=>t(s);return{start:()=>Qe.update(e,!0),stop:()=>Fr(e),now:()=>At.isProcessing?At.timestamp:Ys.now()}},J3={decay:Jv,inertia:Jv,tween:cc,keyframes:cc,spring:W1},eA=t=>t/100;class ep extends F1{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:n,keyframes:l}=this.options,c=(n==null?void 0:n.KeyframeResolver)||Zf,o=(h,u)=>this.onKeyframesResolved(h,u);this.resolver=new c(l,o,s,r,n),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:n=0,repeatType:l,velocity:c=0}=this.options,o=$f(s)?s:J3[s]||cc;let h,u;o!==cc&&typeof e[0]!="number"&&(h=Jo(eA,$1(e[0],e[1])),e=[0,100]);const p=o({...this.options,keyframes:e});l==="mirror"&&(u=o({...this.options,keyframes:[...e].reverse(),velocity:-c})),p.calculatedDuration===null&&(p.calculatedDuration=a1(p));const{calculatedDuration:d}=p,g=d+n,w=g*(r+1)-n;return{generator:p,mirroredGenerator:u,mapPercentToKeyframes:h,calculatedDuration:d,resolvedDuration:g,totalDuration:w}}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:P}=this.options;return{done:!0,value:P[P.length-1]}}const{finalKeyframe:n,generator:l,mirroredGenerator:c,mapPercentToKeyframes:o,keyframes:h,calculatedDuration:u,totalDuration:p,resolvedDuration:d}=r;if(this.startTime===null)return l.next(0);const{delay:g,repeat:w,repeatType:S,repeatDelay:y,onUpdate:m}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-p/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 v=this.currentTime-g*(this.speed>=0?1:-1),x=this.speed>=0?v<0:v>p;this.currentTime=Math.max(v,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=p);let _=this.currentTime,C=l;if(w){const P=Math.min(this.currentTime,p)/d;let L=Math.floor(P),j=P%1;!j&&P>=1&&(j=1),j===1&&L--,L=Math.min(L,w+1),!!(L%2)&&(S==="reverse"?(j=1-j,y&&(j-=y/d)):S==="mirror"&&(C=c)),_=dr(0,1,j)*d}const M=x?{done:!1,value:h[0]}:C.next(_);o&&(M.value=o(M.value));let{done:T}=M;!x&&u!==null&&(T=this.speed>=0?this.currentTime>=p:this.currentTime<=0);const R=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&T);return R&&n!==void 0&&(M.value=Ec(h,this.options,n)),m&&m(M.value),R&&this.finish(),M}get duration(){const{resolved:e}=this;return e?ur(e.calculatedDuration):0}get time(){return ur(this.currentTime)}set time(e){e=hr(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=ur(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=Z3,onPlay:s,startTime:r}=this.options;this.driver||(this.driver=e(l=>this.tick(l))),s&&s();const n=this.driver.now();this.holdTime!==null?this.startTime=n-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=n):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 tA=new Set(["opacity","clipPath","filter","transform"]);function sA(t,e,s,{delay:r=0,duration:n=300,repeat:l=0,repeatType:c="loop",ease:o="easeInOut",times:h}={}){const u={[e]:s};h&&(u.offset=h);const p=h1(o,n);return Array.isArray(p)&&(u.easing=p),t.animate(u,{delay:r,duration:n,easing:Array.isArray(p)?"linear":p,fill:"both",iterations:l+1,direction:c==="reverse"?"alternate":"normal"})}const rA=Ef(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),hc=10,iA=2e4;function nA(t){return $f(t.type)||t.type==="spring"||!c1(t.ease)}function oA(t,e){const s=new ep({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:t[0]};const n=[];let l=0;for(;!r.done&&l<iA;)r=s.sample(l),n.push(r.value),l+=hc;return{times:void 0,keyframes:n,duration:l-hc,ease:"linear"}}const V1={anticipate:b1,backInOut:w1,circInOut:C1};function aA(t){return t in V1}class ty extends F1{constructor(e){super(e);const{name:s,motionValue:r,element:n,keyframes:l}=this.options;this.resolver=new N1(l,(c,o)=>this.onKeyframesResolved(c,o),s,r,n),this.resolver.scheduleResolve()}initPlayback(e,s){let{duration:r=300,times:n,ease:l,type:c,motionValue:o,name:h,startTime:u}=this.options;if(!o.owner||!o.owner.current)return!1;if(typeof l=="string"&&ac()&&aA(l)&&(l=V1[l]),nA(this.options)){const{onComplete:d,onUpdate:g,motionValue:w,element:S,...y}=this.options,m=oA(e,y);e=m.keyframes,e.length===1&&(e[1]=e[0]),r=m.duration,n=m.times,l=m.ease,c="keyframes"}const p=sA(o.owner.current,h,e,{...this.options,duration:r,times:n,ease:l});return p.startTime=u??this.calcStartTime(),this.pendingTimeline?(Fv(p,this.pendingTimeline),this.pendingTimeline=void 0):p.onfinish=()=>{const{onComplete:d}=this.options;o.set(Ec(e,this.options,s)),d&&d(),this.cancel(),this.resolveFinishedPromise()},{animation:p,duration:r,times:n,type:c,ease:l,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:s}=e;return ur(s)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:s}=e;return ur(s.currentTime||0)}set time(e){const{resolved:s}=this;if(!s)return;const{animation:r}=s;r.currentTime=hr(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;Fv(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:n,type:l,ease:c,times:o}=e;if(s.playState==="idle"||s.playState==="finished")return;if(this.time){const{motionValue:u,onUpdate:p,onComplete:d,element:g,...w}=this.options,S=new ep({...w,keyframes:r,duration:n,type:l,ease:c,times:o,isGenerator:!0}),y=hr(this.time);u.setWithVelocity(S.sample(y-hc).value,S.sample(y).value,hc)}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:n,repeatType:l,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 rA()&&r&&tA.has(r)&&!h&&!u&&!n&&l!=="mirror"&&c!==0&&o!=="inertia"}}const lA={type:"spring",stiffness:500,damping:25,restSpeed:10},cA=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),hA={type:"keyframes",duration:.8},uA={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},dA=(t,{keyframes:e})=>e.length>2?hA:ki.has(t)?t.startsWith("scale")?cA(e[1]):lA:uA;function fA({when:t,delay:e,delayChildren:s,staggerChildren:r,staggerDirection:n,repeat:l,repeatType:c,repeatDelay:o,from:h,elapsed:u,...p}){return!!Object.keys(p).length}const tp=(t,e,s,r={},n,l)=>c=>{const o=Hf(r,t)||{},h=o.delay||r.delay||0;let{elapsed:u=0}=r;u=u-hr(h);let p={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:l?void 0:n};fA(o)||(p={...p,...dA(t,p)}),p.duration&&(p.duration=hr(p.duration)),p.repeatDelay&&(p.repeatDelay=hr(p.repeatDelay)),p.from!==void 0&&(p.keyframes[0]=p.from);let d=!1;if((p.type===!1||p.duration===0&&!p.repeatDelay)&&(p.duration=0,p.delay===0&&(d=!0)),d&&!l&&e.get()!==void 0){const g=Ec(p.keyframes,o);if(g!==void 0)return Qe.update(()=>{p.onUpdate(g),p.onComplete()}),new DP([])}return!l&&ty.supports(p)?new ty(p):new ep(p)};function pA({protectedKeys:t,needsAnimating:e},s){const r=t.hasOwnProperty(s)&&e[s]!==!0;return e[s]=!1,r}function G1(t,e,{delay:s=0,transitionOverride:r,type:n}={}){var l;let{transition:c=t.getDefaultTransition(),transitionEnd:o,...h}=e;r&&(c=r);const u=[],p=n&&t.animationState&&t.animationState.getState()[n];for(const d in h){const g=t.getValue(d,(l=t.latestValues[d])!==null&&l!==void 0?l:null),w=h[d];if(w===void 0||p&&pA(p,d))continue;const S={delay:s,...Hf(c||{},d)};let y=!1;if(window.MotionHandoffAnimation){const v=g1(t);if(v){const x=window.MotionHandoffAnimation(v,d,Qe);x!==null&&(S.startTime=x,y=!0)}}Ud(t,d),g.start(tp(d,g,w,t.shouldReduceMotion&&p1.has(d)?{type:!1}:S,t,y));const m=g.animation;m&&u.push(m)}return o&&Promise.all(u).then(()=>{Qe.update(()=>{o&&GP(t,o)})}),u}function Qd(t,e,s={}){var r;const n=kc(t,e,s.type==="exit"?(r=t.presenceContext)===null||r===void 0?void 0:r.custom:void 0);let{transition:l=t.getDefaultTransition()||{}}=n||{};s.transitionOverride&&(l=s.transitionOverride);const c=n?()=>Promise.all(G1(t,n,s)):()=>Promise.resolve(),o=t.variantChildren&&t.variantChildren.size?(u=0)=>{const{delayChildren:p=0,staggerChildren:d,staggerDirection:g}=l;return mA(t,e,p+u,d,g,s)}:()=>Promise.resolve(),{when:h}=l;if(h){const[u,p]=h==="beforeChildren"?[c,o]:[o,c];return u().then(()=>p())}else return Promise.all([c(),o(s.delay)])}function mA(t,e,s=0,r=0,n=1,l){const c=[],o=(t.variantChildren.size-1)*r,h=n===1?(u=0)=>u*r:(u=0)=>o-u*r;return Array.from(t.variantChildren).sort(gA).forEach((u,p)=>{u.notify("AnimationStart",e),c.push(Qd(u,e,{...l,delay:s+h(p)}).then(()=>u.notify("AnimationComplete",e)))}),Promise.all(c)}function gA(t,e){return t.sortNodePosition(e)}function _A(t,e,s={}){t.notify("AnimationStart",e);let r;if(Array.isArray(e)){const n=e.map(l=>Qd(t,l,s));r=Promise.all(n)}else if(typeof e=="string")r=Qd(t,e,s);else{const n=typeof e=="function"?kc(t,e,s.custom):e;r=Promise.all(G1(t,n,s))}return r.then(()=>{t.notify("AnimationComplete",e)})}const vA=Tf.length;function q1(t){if(!t)return;if(!t.isControllingVariants){const s=t.parent?q1(t.parent)||{}:{};return t.props.initial!==void 0&&(s.initial=t.props.initial),s}const e={};for(let s=0;s<vA;s++){const r=Tf[s],n=t.props[r];(Wo(n)||n===!1)&&(e[r]=n)}return e}const yA=[...Mf].reverse(),xA=Mf.length;function wA(t){return e=>Promise.all(e.map(({animation:s,options:r})=>_A(t,s,r)))}function bA(t){let e=wA(t),s=sy(),r=!0;const n=h=>(u,p)=>{var d;const g=kc(t,p,h==="exit"?(d=t.presenceContext)===null||d===void 0?void 0:d.custom:void 0);if(g){const{transition:w,transitionEnd:S,...y}=g;u={...u,...y,...S}}return u};function l(h){e=h(t)}function c(h){const{props:u}=t,p=q1(t.parent)||{},d=[],g=new Set;let w={},S=1/0;for(let m=0;m<xA;m++){const v=yA[m],x=s[v],_=u[v]!==void 0?u[v]:p[v],C=Wo(_),M=v===h?x.isActive:null;M===!1&&(S=m);let T=_===p[v]&&_!==u[v]&&C;if(T&&r&&t.manuallyAnimateOnMount&&(T=!1),x.protectedKeys={...w},!x.isActive&&M===null||!_&&!x.prevProp||Sc(_)||typeof _=="boolean")continue;const R=SA(x.prevProp,_);let P=R||v===h&&x.isActive&&!T&&C||m>S&&C,L=!1;const j=Array.isArray(_)?_:[_];let $=j.reduce(n(v),{});M===!1&&($={});const{prevResolvedValues:U={}}=x,z={...U,...$},Y=J=>{P=!0,g.has(J)&&(L=!0,g.delete(J)),x.needsAnimating[J]=!0;const K=t.getValue(J);K&&(K.liveStyle=!1)};for(const J in z){const K=$[J],D=U[J];if(w.hasOwnProperty(J))continue;let N=!1;$d(K)&&$d(D)?N=!o1(K,D):N=K!==D,N?K!=null?Y(J):g.add(J):K!==void 0&&g.has(J)?Y(J):x.protectedKeys[J]=!0}x.prevProp=_,x.prevResolvedValues=$,x.isActive&&(w={...w,...$}),r&&t.blockInitialAnimation&&(P=!1),P&&(!(T&&R)||L)&&d.push(...j.map(J=>({animation:J,options:{type:v}})))}if(g.size){const m={};g.forEach(v=>{const x=t.getBaseTarget(v),_=t.getValue(v);_&&(_.liveStyle=!0),m[v]=x??null}),d.push({animation:m})}let y=!!d.length;return r&&(u.initial===!1||u.initial===u.animate)&&!t.manuallyAnimateOnMount&&(y=!1),r=!1,y?e(d):Promise.resolve()}function o(h,u){var p;if(s[h].isActive===u)return Promise.resolve();(p=t.variantChildren)===null||p===void 0||p.forEach(g=>{var w;return(w=g.animationState)===null||w===void 0?void 0:w.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:l,getState:()=>s,reset:()=>{s=sy(),r=!0}}}function SA(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!o1(e,t):!1}function ai(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function sy(){return{animate:ai(!0),whileInView:ai(),whileHover:ai(),whileTap:ai(),whileDrag:ai(),whileFocus:ai(),exit:ai()}}class $r{constructor(e){this.isMounted=!1,this.node=e}update(){}}class CA extends $r{constructor(e){super(e),e.animationState||(e.animationState=bA(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Sc(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 kA=0;class EA extends $r{constructor(){super(...arguments),this.id=kA++}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 n=this.node.animationState.setActive("exit",!e);s&&!e&&n.then(()=>s(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const MA={animation:{Feature:CA},exit:{Feature:EA}};function qo(t,e,s,r={passive:!0}){return t.addEventListener(e,s,r),()=>t.removeEventListener(e,s)}function ea(t){return{point:{x:t.pageX,y:t.pageY}}}const TA=t=>e=>Wf(e)&&t(e,ea(e));function Do(t,e,s,r){return qo(t,e,TA(s),r)}const ry=(t,e)=>Math.abs(t-e);function PA(t,e){const s=ry(t.x,e.x),r=ry(t.y,e.y);return Math.sqrt(s**2+r**2)}class K1{constructor(e,s,{transformPagePoint:r,contextWindow:n,dragSnapToOrigin:l=!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=ld(this.lastMoveEventInfo,this.history),g=this.startEvent!==null,w=PA(d.offset,{x:0,y:0})>=3;if(!g&&!w)return;const{point:S}=d,{timestamp:y}=At;this.history.push({...S,timestamp:y});const{onStart:m,onMove:v}=this.handlers;g||(m&&m(this.lastMoveEvent,d),this.startEvent=this.lastMoveEvent),v&&v(this.lastMoveEvent,d)},this.handlePointerMove=(d,g)=>{this.lastMoveEvent=d,this.lastMoveEventInfo=ad(g,this.transformPagePoint),Qe.update(this.updatePoint,!0)},this.handlePointerUp=(d,g)=>{this.end();const{onEnd:w,onSessionEnd:S,resumeAnimation:y}=this.handlers;if(this.dragSnapToOrigin&&y&&y(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const m=ld(d.type==="pointercancel"?this.lastMoveEventInfo:ad(g,this.transformPagePoint),this.history);this.startEvent&&w&&w(d,m),S&&S(d,m)},!Wf(e))return;this.dragSnapToOrigin=l,this.handlers=s,this.transformPagePoint=r,this.contextWindow=n||window;const c=ea(e),o=ad(c,this.transformPagePoint),{point:h}=o,{timestamp:u}=At;this.history=[{...h,timestamp:u}];const{onSessionStart:p}=s;p&&p(e,ld(o,this.history)),this.removeListeners=Jo(Do(this.contextWindow,"pointermove",this.handlePointerMove),Do(this.contextWindow,"pointerup",this.handlePointerUp),Do(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),Fr(this.updatePoint)}}function ad(t,e){return e?{point:e(t.point)}:t}function iy(t,e){return{x:t.x-e.x,y:t.y-e.y}}function ld({point:t},e){return{point:t,delta:iy(t,Y1(e)),offset:iy(t,AA(e)),velocity:RA(e,.1)}}function AA(t){return t[0]}function Y1(t){return t[t.length-1]}function RA(t,e){if(t.length<2)return{x:0,y:0};let s=t.length-1,r=null;const n=Y1(t);for(;s>=0&&(r=t[s],!(n.timestamp-r.timestamp>hr(e)));)s--;if(!r)return{x:0,y:0};const l=ur(n.timestamp-r.timestamp);if(l===0)return{x:0,y:0};const c={x:(n.x-r.x)/l,y:(n.y-r.y)/l};return c.x===1/0&&(c.x=0),c.y===1/0&&(c.y=0),c}const X1=1e-4,DA=1-X1,LA=1+X1,Q1=.01,BA=0-Q1,IA=0+Q1;function ds(t){return t.max-t.min}function OA(t,e,s){return Math.abs(t-e)<=s}function ny(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>=DA&&t.scale<=LA||isNaN(t.scale))&&(t.scale=1),(t.translate>=BA&&t.translate<=IA||isNaN(t.translate))&&(t.translate=0)}function Lo(t,e,s,r){ny(t.x,e.x,s.x,r?r.originX:void 0),ny(t.y,e.y,s.y,r?r.originY:void 0)}function oy(t,e,s){t.min=s.min+e.min,t.max=t.min+ds(e)}function jA(t,e,s){oy(t.x,e.x,s.x),oy(t.y,e.y,s.y)}function ay(t,e,s){t.min=e.min-s.min,t.max=t.min+ds(e)}function Bo(t,e,s){ay(t.x,e.x,s.x),ay(t.y,e.y,s.y)}function NA(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 ly(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 FA(t,{top:e,left:s,bottom:r,right:n}){return{x:ly(t.x,s,n),y:ly(t.y,e,r)}}function cy(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 HA(t,e){return{x:cy(t.x,e.x),y:cy(t.y,e.y)}}function $A(t,e){let s=.5;const r=ds(t),n=ds(e);return n>r?s=fn(e.min,e.max-r,t.min):r>n&&(s=fn(t.min,t.max-n,e.min)),dr(0,1,s)}function zA(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 Zd=.35;function WA(t=Zd){return t===!1?t=0:t===!0&&(t=Zd),{x:hy(t,"left","right"),y:hy(t,"top","bottom")}}function hy(t,e,s){return{min:uy(t,e),max:uy(t,s)}}function uy(t,e){return typeof t=="number"?t:t[e]||0}const dy=()=>({translate:0,scale:1,origin:0,originPoint:0}),ln=()=>({x:dy(),y:dy()}),fy=()=>({min:0,max:0}),ht=()=>({x:fy(),y:fy()});function xs(t){return[t("x"),t("y")]}function Z1({top:t,left:e,right:s,bottom:r}){return{x:{min:e,max:s},y:{min:t,max:r}}}function UA({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function VA(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 cd(t){return t===void 0||t===1}function Jd({scale:t,scaleX:e,scaleY:s}){return!cd(t)||!cd(e)||!cd(s)}function fi(t){return Jd(t)||J1(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function J1(t){return py(t.x)||py(t.y)}function py(t){return t&&t!=="0%"}function uc(t,e,s){const r=t-s,n=e*r;return s+n}function my(t,e,s,r,n){return n!==void 0&&(t=uc(t,n,r)),uc(t,s,r)+e}function ef(t,e=0,s=1,r,n){t.min=my(t.min,e,s,r,n),t.max=my(t.max,e,s,r,n)}function ew(t,{x:e,y:s}){ef(t.x,e.translate,e.scale,e.originPoint),ef(t.y,s.translate,s.scale,s.originPoint)}const gy=.999999999999,_y=1.0000000000001;function GA(t,e,s,r=!1){const n=s.length;if(!n)return;e.x=e.y=1;let l,c;for(let o=0;o<n;o++){l=s[o],c=l.projectionDelta;const{visualElement:h}=l.options;h&&h.props.style&&h.props.style.display==="contents"||(r&&l.options.layoutScroll&&l.scroll&&l!==l.root&&hn(t,{x:-l.scroll.offset.x,y:-l.scroll.offset.y}),c&&(e.x*=c.x.scale,e.y*=c.y.scale,ew(t,c)),r&&fi(l.latestValues)&&hn(t,l.latestValues))}e.x<_y&&e.x>gy&&(e.x=1),e.y<_y&&e.y>gy&&(e.y=1)}function cn(t,e){t.min=t.min+e,t.max=t.max+e}function vy(t,e,s,r,n=.5){const l=st(t.min,t.max,n);ef(t,e,s,l,r)}function hn(t,e){vy(t.x,e.x,e.scaleX,e.scale,e.originX),vy(t.y,e.y,e.scaleY,e.scale,e.originY)}function tw(t,e){return Z1(VA(t.getBoundingClientRect(),e))}function qA(t,e,s){const r=tw(t,s),{scroll:n}=e;return n&&(cn(r.x,n.offset.x),cn(r.y,n.offset.y)),r}const sw=({current:t})=>t?t.ownerDocument.defaultView:null,KA=new WeakMap;class YA{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 n=p=>{const{dragSnapToOrigin:d}=this.getProps();d?this.pauseAnimation():this.stopAnimation(),s&&this.snapToCursor(ea(p).point)},l=(p,d)=>{const{drag:g,dragPropagation:w,onDragStart:S}=this.getProps();if(g&&!w&&(this.openDragLock&&this.openDragLock(),this.openDragLock=$P(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),xs(m=>{let v=this.getAxisMotionValue(m).get()||0;if(Ks.test(v)){const{projection:x}=this.visualElement;if(x&&x.layout){const _=x.layout.layoutBox[m];_&&(v=ds(_)*(parseFloat(v)/100))}}this.originPoint[m]=v}),S&&Qe.postRender(()=>S(p,d)),Ud(this.visualElement,"transform");const{animationState:y}=this.visualElement;y&&y.setActive("whileDrag",!0)},c=(p,d)=>{const{dragPropagation:g,dragDirectionLock:w,onDirectionLock:S,onDrag:y}=this.getProps();if(!g&&!this.openDragLock)return;const{offset:m}=d;if(w&&this.currentDirection===null){this.currentDirection=XA(m),this.currentDirection!==null&&S&&S(this.currentDirection);return}this.updateAxis("x",d.point,m),this.updateAxis("y",d.point,m),this.visualElement.render(),y&&y(p,d)},o=(p,d)=>this.stop(p,d),h=()=>xs(p=>{var d;return this.getAnimationState(p)==="paused"&&((d=this.getAxisMotionValue(p).animation)===null||d===void 0?void 0:d.play())}),{dragSnapToOrigin:u}=this.getProps();this.panSession=new K1(e,{onSessionStart:n,onStart:l,onMove:c,onSessionEnd:o,resumeAnimation:h},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:sw(this.visualElement)})}stop(e,s){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:n}=s;this.startAnimation(n);const{onDragEnd:l}=this.getProps();l&&Qe.postRender(()=>l(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:n}=this.getProps();if(!r||!Ol(e,n,this.currentDirection))return;const l=this.getAxisMotionValue(e);let c=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(c=NA(c,this.constraints[e],this.elastic[e])),l.set(c)}resolveConstraints(){var e;const{dragConstraints:s,dragElastic:r}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(e=this.visualElement.projection)===null||e===void 0?void 0:e.layout,l=this.constraints;s&&on(s)?this.constraints||(this.constraints=this.resolveRefConstraints()):s&&n?this.constraints=FA(n.layoutBox,s):this.constraints=!1,this.elastic=WA(r),l!==this.constraints&&n&&this.constraints&&!this.hasMutatedConstraints&&xs(c=>{this.constraints!==!1&&this.getAxisMotionValue(c)&&(this.constraints[c]=zA(n.layoutBox[c],this.constraints[c]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:s}=this.getProps();if(!e||!on(e))return!1;const r=e.current,{projection:n}=this.visualElement;if(!n||!n.layout)return!1;const l=qA(r,n.root,this.visualElement.getTransformPagePoint());let c=HA(n.layout.layoutBox,l);if(s){const o=s(UA(c));this.hasMutatedConstraints=!!o,o&&(c=Z1(o))}return c}startAnimation(e){const{drag:s,dragMomentum:r,dragElastic:n,dragTransition:l,dragSnapToOrigin:c,onDragTransitionEnd:o}=this.getProps(),h=this.constraints||{},u=xs(p=>{if(!Ol(p,s,this.currentDirection))return;let d=h&&h[p]||{};c&&(d={min:0,max:0});const g=n?200:1e6,w=n?40:1e7,S={type:"inertia",velocity:r?e[p]:0,bounceStiffness:g,bounceDamping:w,timeConstant:750,restDelta:1,restSpeed:10,...l,...d};return this.startAxisValueAnimation(p,S)});return Promise.all(u).then(o)}startAxisValueAnimation(e,s){const r=this.getAxisMotionValue(e);return Ud(this.visualElement,e),r.start(tp(e,r,0,s,this.visualElement,!1))}stopAnimation(){xs(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){xs(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(),n=r[s];return n||this.visualElement.getValue(e,(r.initial?r.initial[e]:void 0)||0)}snapToCursor(e){xs(s=>{const{drag:r}=this.getProps();if(!Ol(s,r,this.currentDirection))return;const{projection:n}=this.visualElement,l=this.getAxisMotionValue(s);if(n&&n.layout){const{min:c,max:o}=n.layout.layoutBox[s];l.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(!on(s)||!r||!this.constraints)return;this.stopAnimation();const n={x:0,y:0};xs(c=>{const o=this.getAxisMotionValue(c);if(o&&this.constraints!==!1){const h=o.get();n[c]=$A({min:h,max:h},this.constraints[c])}});const{transformTemplate:l}=this.visualElement.getProps();this.visualElement.current.style.transform=l?l({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),xs(c=>{if(!Ol(c,e,null))return;const o=this.getAxisMotionValue(c),{min:h,max:u}=this.constraints[c];o.set(st(h,u,n[c]))})}addListeners(){if(!this.visualElement.current)return;KA.set(this.visualElement,this);const e=this.visualElement.current,s=Do(e,"pointerdown",h=>{const{drag:u,dragListener:p=!0}=this.getProps();u&&p&&this.start(h)}),r=()=>{const{dragConstraints:h}=this.getProps();on(h)&&h.current&&(this.constraints=this.resolveRefConstraints())},{projection:n}=this.visualElement,l=n.addEventListener("measure",r);n&&!n.layout&&(n.root&&n.root.updateScroll(),n.updateLayout()),Qe.read(r);const c=qo(window,"resize",()=>this.scalePositionWithinConstraints()),o=n.addEventListener("didUpdate",(({delta:h,hasLayoutChanged:u})=>{this.isDragging&&u&&(xs(p=>{const d=this.getAxisMotionValue(p);d&&(this.originPoint[p]+=h[p].translate,d.set(d.get()+h[p].translate))}),this.visualElement.render())}));return()=>{c(),s(),l(),o&&o()}}getProps(){const e=this.visualElement.getProps(),{drag:s=!1,dragDirectionLock:r=!1,dragPropagation:n=!1,dragConstraints:l=!1,dragElastic:c=Zd,dragMomentum:o=!0}=e;return{...e,drag:s,dragDirectionLock:r,dragPropagation:n,dragConstraints:l,dragElastic:c,dragMomentum:o}}}function Ol(t,e,s){return(e===!0||e===t)&&(s===null||s===t)}function XA(t,e=10){let s=null;return Math.abs(t.y)>e?s="y":Math.abs(t.x)>e&&(s="x"),s}class QA extends $r{constructor(e){super(e),this.removeGroupControls=us,this.removeListeners=us,this.controls=new YA(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 yy=t=>(e,s)=>{t&&Qe.postRender(()=>t(e,s))};class ZA extends $r{constructor(){super(...arguments),this.removePointerDownListener=us}onPointerDown(e){this.session=new K1(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:sw(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:s,onPan:r,onPanEnd:n}=this.node.getProps();return{onSessionStart:yy(e),onStart:yy(s),onMove:r,onEnd:(l,c)=>{delete this.session,n&&Qe.postRender(()=>n(l,c))}}}mount(){this.removePointerDownListener=Do(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 Wl={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function xy(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const _o={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(Ce.test(t))t=parseFloat(t);else return t;const s=xy(t,e.target.x),r=xy(t,e.target.y);return`${s}% ${r}%`}},JA={correct:(t,{treeScale:e,projectionDelta:s})=>{const r=t,n=Hr.parse(t);if(n.length>5)return r;const l=Hr.createTransformer(t),c=typeof n[0]!="number"?1:0,o=s.x.scale*e.x,h=s.y.scale*e.y;n[0+c]/=o,n[1+c]/=h;const u=st(o,h,.5);return typeof n[2+c]=="number"&&(n[2+c]/=u),typeof n[3+c]=="number"&&(n[3+c]/=u),l(n)}};class eR extends oe.Component{componentDidMount(){const{visualElement:e,layoutGroup:s,switchLayoutGroup:r,layoutId:n}=this.props,{projection:l}=e;xP(tR),l&&(s.group&&s.group.add(l),r&&r.register&&n&&r.register(l),l.root.didUpdate(),l.addEventListener("animationComplete",()=>{this.safeToRemove()}),l.setOptions({...l.options,onExitComplete:()=>this.safeToRemove()})),Wl.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:s,visualElement:r,drag:n,isPresent:l}=this.props,c=r.projection;return c&&(c.isPresent=l,n||e.layoutDependency!==s||s===void 0?c.willUpdate():this.safeToRemove(),e.isPresent!==l&&(l?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(),Af.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:s,switchLayoutGroup:r}=this.props,{projection:n}=e;n&&(n.scheduleCheckAfterUnmount(),s&&s.group&&s.group.remove(n),r&&r.deregister&&r.deregister(n))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function rw(t){const[e,s]=Nx(),r=oe.useContext(bf);return E.jsx(eR,{...t,layoutGroup:r,switchLayoutGroup:oe.useContext(qx),isPresent:e,safeToRemove:s})}const tR={borderRadius:{..._o,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:_o,borderTopRightRadius:_o,borderBottomLeftRadius:_o,borderBottomRightRadius:_o,boxShadow:JA};function sR(t,e,s){const r=Nt(t)?t:Vo(t);return r.start(tp("",r,e,s)),r.animation}function rR(t){return t instanceof SVGElement&&t.tagName!=="svg"}const iR=(t,e)=>t.depth-e.depth;class nR{constructor(){this.children=[],this.isDirty=!1}add(e){Uf(this.children,e),this.isDirty=!0}remove(e){Vf(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(iR),this.isDirty=!1,this.children.forEach(e)}}function oR(t,e){const s=Ys.now(),r=({timestamp:n})=>{const l=n-s;l>=e&&(Fr(r),t(l-e))};return Qe.read(r,!0),()=>Fr(r)}const iw=["TopLeft","TopRight","BottomLeft","BottomRight"],aR=iw.length,wy=t=>typeof t=="string"?parseFloat(t):t,by=t=>typeof t=="number"||Ce.test(t);function lR(t,e,s,r,n,l){n?(t.opacity=st(0,s.opacity!==void 0?s.opacity:1,cR(r)),t.opacityExit=st(e.opacity!==void 0?e.opacity:1,0,hR(r))):l&&(t.opacity=st(e.opacity!==void 0?e.opacity:1,s.opacity!==void 0?s.opacity:1,r));for(let c=0;c<aR;c++){const o=`border${iw[c]}Radius`;let h=Sy(e,o),u=Sy(s,o);if(h===void 0&&u===void 0)continue;h||(h=0),u||(u=0),h===0||u===0||by(h)===by(u)?(t[o]=Math.max(st(wy(h),wy(u),r),0),(Ks.test(u)||Ks.test(h))&&(t[o]+="%")):t[o]=u}(e.rotate||s.rotate)&&(t.rotate=st(e.rotate||0,s.rotate||0,r))}function Sy(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const cR=nw(0,.5,S1),hR=nw(.5,.95,us);function nw(t,e,s){return r=>r<t?0:r>e?1:s(fn(t,e,r))}function Cy(t,e){t.min=e.min,t.max=e.max}function ys(t,e){Cy(t.x,e.x),Cy(t.y,e.y)}function ky(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function Ey(t,e,s,r,n){return t-=e,t=uc(t,1/s,r),n!==void 0&&(t=uc(t,1/n,r)),t}function uR(t,e=0,s=1,r=.5,n,l=t,c=t){if(Ks.test(e)&&(e=parseFloat(e),e=st(c.min,c.max,e/100)-c.min),typeof e!="number")return;let o=st(l.min,l.max,r);t===l&&(o-=e),t.min=Ey(t.min,e,s,o,n),t.max=Ey(t.max,e,s,o,n)}function My(t,e,[s,r,n],l,c){uR(t,e[s],e[r],e[n],e.scale,l,c)}const dR=["x","scaleX","originX"],fR=["y","scaleY","originY"];function Ty(t,e,s,r){My(t.x,e,dR,s?s.x:void 0,r?r.x:void 0),My(t.y,e,fR,s?s.y:void 0,r?r.y:void 0)}function Py(t){return t.translate===0&&t.scale===1}function ow(t){return Py(t.x)&&Py(t.y)}function Ay(t,e){return t.min===e.min&&t.max===e.max}function pR(t,e){return Ay(t.x,e.x)&&Ay(t.y,e.y)}function Ry(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function aw(t,e){return Ry(t.x,e.x)&&Ry(t.y,e.y)}function Dy(t){return ds(t.x)/ds(t.y)}function Ly(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class mR{constructor(){this.members=[]}add(e){Uf(this.members,e),e.scheduleRender()}remove(e){if(Vf(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(n=>e===n);if(s===0)return!1;let r;for(let n=s;n>=0;n--){const l=this.members[n];if(l.isPresent!==!1){r=l;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:n}=e.options;n===!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 gR(t,e,s){let r="";const n=t.x.translate/e.x,l=t.y.translate/e.y,c=(s==null?void 0:s.z)||0;if((n||l||c)&&(r=`translate3d(${n}px, ${l}px, ${c}px) `),(e.x!==1||e.y!==1)&&(r+=`scale(${1/e.x}, ${1/e.y}) `),s){const{transformPerspective:u,rotate:p,rotateX:d,rotateY:g,skewX:w,skewY:S}=s;u&&(r=`perspective(${u}px) ${r}`),p&&(r+=`rotate(${p}deg) `),d&&(r+=`rotateX(${d}deg) `),g&&(r+=`rotateY(${g}deg) `),w&&(r+=`skewX(${w}deg) `),S&&(r+=`skewY(${S}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 pi={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},So=typeof window<"u"&&window.MotionDebug!==void 0,hd=["","X","Y","Z"],_R={visibility:"hidden"},By=1e3;let vR=0;function ud(t,e,s,r){const{latestValues:n}=e;n[t]&&(s[t]=n[t],e.setStaticValue(t,0),r&&(r[t]=0))}function lw(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const s=g1(e);if(window.MotionHasOptimisedAnimation(s,"transform")){const{layout:n,layoutId:l}=t.options;window.MotionCancelOptimisedAnimation(s,"transform",Qe,!(n||l))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&lw(r)}function cw({attachResizeListener:t,defaultParent:e,measureScroll:s,checkIsScrollRoot:r,resetTransform:n}){return class{constructor(c={},o=e==null?void 0:e()){this.id=vR++,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,So&&(pi.totalNodes=pi.resolvedTargetDeltas=pi.recalculatedProjection=0),this.nodes.forEach(wR),this.nodes.forEach(ER),this.nodes.forEach(MR),this.nodes.forEach(bR),So&&window.MotionDebug.record(pi)},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 nR)}addEventListener(c,o){return this.eventHandlers.has(c)||this.eventHandlers.set(c,new Gf),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=rR(c),this.instance=c;const{layoutId:h,layout:u,visualElement:p}=this.options;if(p&&!p.current&&p.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=oR(g,250),Wl.hasAnimatedSinceResize&&(Wl.hasAnimatedSinceResize=!1,this.nodes.forEach(Oy))})}h&&this.root.registerSharedNode(h,this),this.options.animate!==!1&&p&&(h||u)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:g,hasRelativeTargetChanged:w,layout:S})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const y=this.options.transition||p.getDefaultTransition()||DR,{onLayoutAnimationStart:m,onLayoutAnimationComplete:v}=p.getProps(),x=!this.targetLayout||!aw(this.targetLayout,S)||w,_=!g&&w;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||_||g&&(x||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(d,_);const C={...Hf(y,"layout"),onPlay:m,onComplete:v};(p.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=S})}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,Fr(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(TR),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&&lw(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let p=0;p<this.path.length;p++){const d=this.path[p];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(Iy);return}this.isUpdating||this.nodes.forEach(CR),this.isUpdating=!1,this.nodes.forEach(kR),this.nodes.forEach(yR),this.nodes.forEach(xR),this.clearAllSnapshots();const o=Ys.now();At.delta=dr(0,1e3/60,o-At.timestamp),At.timestamp=o,At.isProcessing=!0,td.update.process(At),td.preRender.process(At),td.render.process(At),At.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Af.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(SR),this.sharedNodes.forEach(PR)}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(!n)return;const c=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,o=this.projectionDelta&&!ow(this.projectionDelta),h=this.getTransformTemplate(),u=h?h(this.latestValues,""):void 0,p=u!==this.prevTransformTemplateValue;c&&(o||fi(this.latestValues)||p)&&(n(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)),LR(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(BR))){const{scroll:p}=this.root;p&&(cn(h.x,p.offset.x),cn(h.y,p.offset.y))}return h}removeElementScroll(c){var o;const h=ht();if(ys(h,c),!((o=this.scroll)===null||o===void 0)&&o.wasRoot)return h;for(let u=0;u<this.path.length;u++){const p=this.path[u],{scroll:d,options:g}=p;p!==this.root&&d&&g.layoutScroll&&(d.wasRoot&&ys(h,c),cn(h.x,d.offset.x),cn(h.y,d.offset.y))}return h}applyTransform(c,o=!1){const h=ht();ys(h,c);for(let u=0;u<this.path.length;u++){const p=this.path[u];!o&&p.options.layoutScroll&&p.scroll&&p!==p.root&&hn(h,{x:-p.scroll.offset.x,y:-p.scroll.offset.y}),fi(p.latestValues)&&hn(h,p.latestValues)}return fi(this.latestValues)&&hn(h,this.latestValues),h}removeTransform(c){const o=ht();ys(o,c);for(let h=0;h<this.path.length;h++){const u=this.path[h];if(!u.instance||!fi(u.latestValues))continue;Jd(u.latestValues)&&u.updateSnapshot();const p=ht(),d=u.measurePageBox();ys(p,d),Ty(o,u.latestValues,u.snapshot?u.snapshot.layoutBox:void 0,p)}return fi(this.latestValues)&&Ty(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!==At.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=At.timestamp,!this.targetDelta&&!this.relativeTarget){const w=this.getClosestProjectingParent();w&&w.layout&&this.animationProgress!==1?(this.relativeParent=w,this.forceRelativeParentToResolveTarget(),this.relativeTarget=ht(),this.relativeTargetOrigin=ht(),Bo(this.relativeTargetOrigin,this.layout.layoutBox,w.layout.layoutBox),ys(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(),jA(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):ys(this.target,this.layout.layoutBox),ew(this.target,this.targetDelta)):ys(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const w=this.getClosestProjectingParent();w&&!!w.resumingFrom==!!this.resumingFrom&&!w.options.layoutScroll&&w.target&&this.animationProgress!==1?(this.relativeParent=w,this.forceRelativeParentToResolveTarget(),this.relativeTarget=ht(),this.relativeTargetOrigin=ht(),Bo(this.relativeTargetOrigin,this.target,w.target),ys(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}So&&pi.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||Jd(this.parent.latestValues)||J1(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===At.timestamp&&(u=!1),u)return;const{layout:p,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||!(p||d))return;ys(this.layoutCorrected,this.layout.layoutBox);const g=this.treeScale.x,w=this.treeScale.y;GA(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:S}=o;if(!S){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(ky(this.prevProjectionDelta.x,this.projectionDelta.x),ky(this.prevProjectionDelta.y,this.projectionDelta.y)),Lo(this.projectionDelta,this.layoutCorrected,S,this.latestValues),(this.treeScale.x!==g||this.treeScale.y!==w||!Ly(this.projectionDelta.x,this.prevProjectionDelta.x)||!Ly(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",S)),So&&pi.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=ln(),this.projectionDelta=ln(),this.projectionDeltaWithTransform=ln()}setAnimationOrigin(c,o=!1){const h=this.snapshot,u=h?h.latestValues:{},p={...this.latestValues},d=ln();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!o;const g=ht(),w=h?h.source:void 0,S=this.layout?this.layout.source:void 0,y=w!==S,m=this.getStack(),v=!m||m.members.length<=1,x=!!(y&&!v&&this.options.crossfade===!0&&!this.path.some(RR));this.animationProgress=0;let _;this.mixTargetDelta=C=>{const M=C/1e3;jy(d.x,c.x,M),jy(d.y,c.y,M),this.setTargetDelta(d),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Bo(g,this.layout.layoutBox,this.relativeParent.layout.layoutBox),AR(this.relativeTarget,this.relativeTargetOrigin,g,M),_&&pR(this.relativeTarget,_)&&(this.isProjectionDirty=!1),_||(_=ht()),ys(_,this.relativeTarget)),y&&(this.animationValues=p,lR(p,u,this.latestValues,M,x,v)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=M},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&&(Fr(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Qe.update(()=>{Wl.hasAnimatedSinceResize=!0,this.currentAnimation=sR(0,By,{...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(By),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const c=this.getLead();let{targetWithTransforms:o,target:h,layout:u,latestValues:p}=c;if(!(!o||!h||!u)){if(this!==c&&this.layout&&u&&hw(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}ys(o,h),hn(o,p),Lo(this.projectionDeltaWithTransform,this.layoutCorrected,o,p)}}registerSharedNode(c,o){this.sharedNodes.has(c)||this.sharedNodes.set(c,new mR),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&&ud("z",c,u,this.animationValues);for(let p=0;p<hd.length;p++)ud(`rotate${hd[p]}`,c,u,this.animationValues),ud(`skew${hd[p]}`,c,u,this.animationValues);c.render();for(const p in u)c.setStaticValue(p,u[p]),this.animationValues&&(this.animationValues[p]=u[p]);c.scheduleRender()}getProjectionStyles(c){var o,h;if(!this.instance||this.isSVG)return;if(!this.isVisible)return _R;const u={visibility:""},p=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,u.opacity="",u.pointerEvents=$l(c==null?void 0:c.pointerEvents)||"",u.transform=p?p(this.latestValues,""):"none",u;const d=this.getLead();if(!this.projectionDelta||!this.layout||!d.target){const y={};return this.options.layoutId&&(y.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,y.pointerEvents=$l(c==null?void 0:c.pointerEvents)||""),this.hasProjected&&!fi(this.latestValues)&&(y.transform=p?p({},""):"none",this.hasProjected=!1),y}const g=d.animationValues||d.latestValues;this.applyTransformsToTarget(),u.transform=gR(this.projectionDeltaWithTransform,this.treeScale,g),p&&(u.transform=p(g,u.transform));const{x:w,y:S}=this.projectionDelta;u.transformOrigin=`${w.origin*100}% ${S.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 y in oc){if(g[y]===void 0)continue;const{correct:m,applyTo:v}=oc[y],x=u.transform==="none"?g[y]:m(g[y],d);if(v){const _=v.length;for(let C=0;C<_;C++)u[v[C]]=x}else u[y]=x}return this.options.layoutId&&(u.pointerEvents=d===this?$l(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(Iy),this.root.sharedNodes.clear()}}}function yR(t){t.updateLayout()}function xR(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:n}=t.layout,{animationType:l}=t.options,c=s.source!==t.layout.source;l==="size"?xs(d=>{const g=c?s.measuredBox[d]:s.layoutBox[d],w=ds(g);g.min=r[d].min,g.max=g.min+w}):hw(l,s.layoutBox,r)&&xs(d=>{const g=c?s.measuredBox[d]:s.layoutBox[d],w=ds(r[d]);g.max=g.min+w,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[d].max=t.relativeTarget[d].min+w)});const o=ln();Lo(o,r,s.layoutBox);const h=ln();c?Lo(h,t.applyTransform(n,!0),s.measuredBox):Lo(h,r,s.layoutBox);const u=!ow(o);let p=!1;if(!t.resumeFrom){const d=t.getClosestProjectingParent();if(d&&!d.resumeFrom){const{snapshot:g,layout:w}=d;if(g&&w){const S=ht();Bo(S,s.layoutBox,g.layoutBox);const y=ht();Bo(y,r,w.layoutBox),aw(S,y)||(p=!0),d.options.layoutRoot&&(t.relativeTarget=y,t.relativeTargetOrigin=S,t.relativeParent=d)}}}t.notifyListeners("didUpdate",{layout:r,snapshot:s,delta:h,layoutDelta:o,hasLayoutChanged:u,hasRelativeTargetChanged:p})}else if(t.isLead()){const{onExitComplete:r}=t.options;r&&r()}t.options.transition=void 0}function wR(t){So&&pi.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 bR(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function SR(t){t.clearSnapshot()}function Iy(t){t.clearMeasurements()}function CR(t){t.isLayoutDirty=!1}function kR(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 ER(t){t.resolveTargetDelta()}function MR(t){t.calcProjection()}function TR(t){t.resetSkewAndRotation()}function PR(t){t.removeLeadSnapshot()}function jy(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 Ny(t,e,s,r){t.min=st(e.min,s.min,r),t.max=st(e.max,s.max,r)}function AR(t,e,s,r){Ny(t.x,e.x,s.x,r),Ny(t.y,e.y,s.y,r)}function RR(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const DR={duration:.45,ease:[.4,0,.1,1]},Fy=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),Hy=Fy("applewebkit/")&&!Fy("chrome/")?Math.round:us;function $y(t){t.min=Hy(t.min),t.max=Hy(t.max)}function LR(t){$y(t.x),$y(t.y)}function hw(t,e,s){return t==="position"||t==="preserve-aspect"&&!OA(Dy(e),Dy(s),.2)}function BR(t){var e;return t!==t.root&&((e=t.scroll)===null||e===void 0?void 0:e.wasRoot)}const IR=cw({attachResizeListener:(t,e)=>qo(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),dd={current:void 0},uw=cw({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!dd.current){const t=new IR({});t.mount(window),t.setOptions({layoutScroll:!0}),dd.current=t}return dd.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),OR={pan:{Feature:ZA},drag:{Feature:QA,ProjectionNode:uw,MeasureLayout:rw}};function zy(t,e,s){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover",s==="Start");const n="onHover"+s,l=r[n];l&&Qe.postRender(()=>l(e,ea(e)))}class jR extends $r{mount(){const{current:e}=this.node;e&&(this.unmount=OP(e,s=>(zy(this.node,s,"Start"),r=>zy(this.node,r,"End"))))}unmount(){}}class NR extends $r{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=Jo(qo(this.node.current,"focus",()=>this.onFocus()),qo(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function Wy(t,e,s){const{props:r}=t;t.animationState&&r.whileTap&&t.animationState.setActive("whileTap",s==="Start");const n="onTap"+(s==="End"?"":s),l=r[n];l&&Qe.postRender(()=>l(e,ea(e)))}class FR extends $r{mount(){const{current:e}=this.node;e&&(this.unmount=HP(e,s=>(Wy(this.node,s,"Start"),(r,{success:n})=>Wy(this.node,r,n?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const tf=new WeakMap,fd=new WeakMap,HR=t=>{const e=tf.get(t.target);e&&e(t)},$R=t=>{t.forEach(HR)};function zR({root:t,...e}){const s=t||document;fd.has(s)||fd.set(s,{});const r=fd.get(s),n=JSON.stringify(e);return r[n]||(r[n]=new IntersectionObserver($R,{root:t,...e})),r[n]}function WR(t,e,s){const r=zR(e);return tf.set(t,s),r.observe(t),()=>{tf.delete(t),r.unobserve(t)}}const UR={some:0,all:1};class VR extends $r{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:s,margin:r,amount:n="some",once:l}=e,c={root:s?s.current:void 0,rootMargin:r,threshold:typeof n=="number"?n:UR[n]},o=h=>{const{isIntersecting:u}=h;if(this.isInView===u||(this.isInView=u,l&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:p,onViewportLeave:d}=this.node.getProps(),g=u?p:d;g&&g(h)};return WR(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(GR(e,s))&&this.startObserver()}unmount(){}}function GR({viewport:t={}},{viewport:e={}}={}){return s=>t[s]!==e[s]}const qR={inView:{Feature:VR},tap:{Feature:FR},focus:{Feature:NR},hover:{Feature:jR}},KR={layout:{ProjectionNode:uw,MeasureLayout:rw}},dc={current:null},sp={current:!1};function dw(){if(sp.current=!0,!!kf)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>dc.current=t.matches;t.addListener(e),e()}else dc.current=!1}const YR=[...j1,It,Hr],XR=t=>YR.find(O1(t)),Uy=new WeakMap;function QR(t,e,s){for(const r in e){const n=e[r],l=s[r];if(Nt(n))t.addValue(r,n);else if(Nt(l))t.addValue(r,Vo(n,{owner:t}));else if(l!==n)if(t.hasValue(r)){const c=t.getValue(r);c.liveStyle===!0?c.jump(n):c.hasAnimated||c.set(n)}else{const c=t.getStaticValue(r);t.addValue(r,Vo(c!==void 0?c:n,{owner:t}))}}for(const r in s)e[r]===void 0&&t.removeValue(r);return e}const Vy=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class ZR{scrapeMotionValuesFromProps(e,s,r){return{}}constructor({parent:e,props:s,presenceContext:r,reducedMotionConfig:n,blockInitialAnimation:l,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=Zf,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 w=Ys.now();this.renderScheduledAt<w&&(this.renderScheduledAt=w,Qe.render(this.render,!1,!0))};const{latestValues:h,renderState:u,onUpdate:p}=c;this.onUpdate=p,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=n,this.options=o,this.blockInitialAnimation=!!l,this.isControllingVariants=Cc(s),this.isVariantNode=Vx(s),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:d,...g}=this.scrapeMotionValuesFromProps(s,{},this);for(const w in g){const S=g[w];h[w]!==void 0&&Nt(S)&&S.set(h[w],!1)}}mount(e){this.current=e,Uy.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||dw(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:dc.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Uy.delete(this.current),this.projection&&this.projection.unmount(),Fr(this.notifyUpdate),Fr(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=ki.has(e),n=s.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&Qe.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),l=s.on("renderRequest",this.scheduleRender);let c;window.MotionCheckAppearSync&&(c=window.MotionCheckAppearSync(this,e,s)),this.valueSubscriptions.set(e,()=>{n(),l(),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 pn){const s=pn[e];if(!s)continue;const{isEnabled:r,Feature:n}=s;if(!this.features[e]&&n&&r(this.props)&&(this.features[e]=new n(this)),this.features[e]){const l=this.features[e];l.isMounted?l.update():(l.mount(),l.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<Vy.length;r++){const n=Vy[r];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);const l="on"+n,c=e[l];c&&(this.propEventSubscriptions[n]=this.on(n,c))}this.prevMotionValues=QR(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=Vo(s===null?void 0:s,{owner:this}),this.addValue(e,r)),r}readValue(e,s){var r;let n=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 n!=null&&(typeof n=="string"&&(B1(n)||k1(n))?n=parseFloat(n):!XR(n)&&Hr.test(s)&&(n=R1(e,s)),this.setBaseTarget(e,Nt(n)?n.get():n)),Nt(n)?n.get():n}setBaseTarget(e,s){this.baseTarget[e]=s}getBaseTarget(e){var s;const{initial:r}=this.props;let n;if(typeof r=="string"||typeof r=="object"){const c=Df(this.props,r,(s=this.presenceContext)===null||s===void 0?void 0:s.custom);c&&(n=c[e])}if(r&&n!==void 0)return n;const l=this.getBaseTargetFromProps(this.props,e);return l!==void 0&&!Nt(l)?l:this.initialValues[e]!==void 0&&n===void 0?void 0:this.baseTarget[e]}on(e,s){return this.events[e]||(this.events[e]=new Gf),this.events[e].add(s)}notify(e,...s){this.events[e]&&this.events[e].notify(...s)}}class fw extends ZR{constructor(){super(...arguments),this.KeyframeResolver=N1}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;Nt(e)&&(this.childSubscription=e.on("change",s=>{this.current&&(this.current.textContent=`${s}`)}))}}function JR(t){return window.getComputedStyle(t)}class eD extends fw{constructor(){super(...arguments),this.type="html",this.renderInstance=e1}readValueFromInstance(e,s){if(ki.has(s)){const r=Qf(s);return r&&r.default||0}else{const r=JR(e),n=(Qx(s)?r.getPropertyValue(s):r[s])||0;return typeof n=="string"?n.trim():n}}measureInstanceViewportBox(e,{transformPagePoint:s}){return tw(e,s)}build(e,s,r){If(e,s,r.transformTemplate)}scrapeMotionValuesFromProps(e,s,r){return Ff(e,s,r)}}class tD extends fw{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ht}getBaseTargetFromProps(e,s){return e[s]}readValueFromInstance(e,s){if(ki.has(s)){const r=Qf(s);return r&&r.default||0}return s=t1.has(s)?s:Pf(s),e.getAttribute(s)}scrapeMotionValuesFromProps(e,s,r){return i1(e,s,r)}build(e,s,r){Of(e,s,this.isSVGTag,r.transformTemplate)}renderInstance(e,s,r,n){s1(e,s,r,n)}mount(e){this.isSVGTag=Nf(e.tagName),super.mount(e)}}const sD=(t,e)=>Rf(t)?new tD(e):new eD(e,{allowProjection:t!==oe.Fragment}),rD=PP({...MA,...qR,...OR,...KR},sD),rp=UT(rD);function ip(){!sp.current&&dw();const[t]=oe.useState(dc.current);return t}const Gy=["anthropic","openai","github","google","groq","mistral","openrouter","xai","nebius","copilot","cursor","devin","droid"],Ci={claude:"Claude Code",codex:"Codex"},iD="you";function pw({state:t,blink:e=!0}){const s=_n[t];return E.jsx("span",{className:`chip chip-dot ${e&&t==="needs-input"?"blink":""}`,style:{"--c":s.color},children:s.label})}function mw({review:t,merged:e}){const s=e?{label:"Merged",color:"#00873a"}:Cx[t];return E.jsx("span",{className:"chip chip-dot",style:{"--c":s.color,color:e?"#fff":void 0},children:s.label})}function gn({color:t,lead:e,size:s=40}){const r=oe.useRef(null);return oe.useEffect(()=>{const n=r.current,l=n==null?void 0:n.getContext("2d");if(!n||!l)return;const c=Lx(t,e).front;l.imageSmoothingEnabled=!1,l.clearRect(0,0,16,16),l.drawImage(c,2,1)},[t,e]),E.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 Mc({color:t,size:e=10}){return E.jsx("i",{className:"inline-block shrink-0 border-2 border-ink",style:{width:e,height:e,background:t}})}function Ge({children:t}){return E.jsx("h3",{className:"mb-2 text-[13px] font-semibold uppercase tracking-[0.12em] text-muted",children:t})}function He({label:t,hint:e,children:s}){return E.jsxs("label",{className:"flex flex-col gap-1",children:[E.jsx("span",{className:"text-[14px] font-semibold",children:t}),s,e&&E.jsx("span",{className:"text-[12px] text-muted",children:e})]})}function nD({tabs:t,value:e,onChange:s}){return E.jsx("div",{role:"tablist",className:"flex flex-wrap gap-2",children:t.map(r=>E.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 wn(t=1e3){const[e,s]=oe.useState(()=>Date.now());return oe.useEffect(()=>{const r=window.setInterval(()=>s(Date.now()),t);return()=>window.clearInterval(r)},[t]),e}function bn(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 n=Math.floor(r/60);return n<24?`${n}h`:`${Math.floor(n/24)}d`}var pd={exports:{}},qy;function oD(){return qy||(qy=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(n){this._terminal=n}dispose(){}fit(){const n=this.proposeDimensions();if(!n||!this._terminal||isNaN(n.cols)||isNaN(n.rows))return;const l=this._terminal._core;this._terminal.rows===n.rows&&this._terminal.cols===n.cols||(l._renderService.clear(),this._terminal.resize(n.cols,n.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const n=this._terminal._core,l=n._renderService.dimensions;if(l.css.cell.width===0||l.css.cell.height===0)return;const c=this._terminal.options.scrollback===0?0:n.viewport.scrollBarWidth,o=window.getComputedStyle(this._terminal.element.parentElement),h=parseInt(o.getPropertyValue("height")),u=Math.max(0,parseInt(o.getPropertyValue("width"))),p=window.getComputedStyle(this._terminal.element),d=h-(parseInt(p.getPropertyValue("padding-top"))+parseInt(p.getPropertyValue("padding-bottom"))),g=u-(parseInt(p.getPropertyValue("padding-right"))+parseInt(p.getPropertyValue("padding-left")))-c;return{cols:Math.max(2,Math.floor(g/l.css.cell.width)),rows:Math.max(1,Math.floor(d/l.css.cell.height))}}}})(),s})()))})(pd)),pd.exports}var aD=oD(),md={exports:{}},Ky;function lD(){return Ky||(Ky=1,(function(t,e){(function(s,r){t.exports=r()})(globalThis,(()=>(()=>{var s={4567:function(c,o,h){var u=this&&this.__decorate||function(x,_,C,M){var T,R=arguments.length,P=R<3?_:M===null?M=Object.getOwnPropertyDescriptor(_,C):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")P=Reflect.decorate(x,_,C,M);else for(var L=x.length-1;L>=0;L--)(T=x[L])&&(P=(R<3?T(P):R>3?T(_,C,P):T(_,C))||P);return R>3&&P&&Object.defineProperty(_,C,P),P},p=this&&this.__param||function(x,_){return function(C,M){_(C,M,x)}};Object.defineProperty(o,"__esModule",{value:!0}),o.AccessibilityManager=void 0;const d=h(9042),g=h(9924),w=h(844),S=h(4725),y=h(2585),m=h(3656);let v=o.AccessibilityManager=class extends w.Disposable{constructor(x,_,C,M){super(),this._terminal=x,this._coreBrowserService=C,this._renderService=M,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 T=0;T<this._terminal.rows;T++)this._rowElements[T]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[T]);if(this._topBoundaryFocusListener=T=>this._handleBoundaryFocus(T,0),this._bottomBoundaryFocusListener=T=>this._handleBoundaryFocus(T,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((T=>this._handleResize(T.rows)))),this.register(this._terminal.onRender((T=>this._refreshRows(T.start,T.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((T=>this._handleChar(T)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
300
|
+
`)))),this.register(this._terminal.onA11yTab((T=>this._handleTab(T)))),this.register(this._terminal.onKey((T=>this._handleKey(T.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,w.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(x){for(let _=0;_<x;_++)this._handleChar(" ")}_handleChar(x){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==x&&(this._charsToAnnounce+=x):this._charsToAnnounce+=x,x===`
|
|
301
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=d.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(x){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(x)||this._charsToConsume.push(x)}_refreshRows(x,_){this._liveRegionDebouncer.refresh(x,_,this._terminal.rows)}_renderRows(x,_){const C=this._terminal.buffer,M=C.lines.length.toString();for(let T=x;T<=_;T++){const R=C.lines.get(C.ydisp+T),P=[],L=(R==null?void 0:R.translateToString(!0,void 0,void 0,P))||"",j=(C.ydisp+T+1).toString(),$=this._rowElements[T];$&&(L.length===0?($.innerText=" ",this._rowColumns.set($,[0,1])):($.textContent=L,this._rowColumns.set($,P)),$.setAttribute("aria-posinset",j),$.setAttribute("aria-setsize",M))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(x,_){const C=x.target,M=this._rowElements[_===0?1:this._rowElements.length-2];if(C.getAttribute("aria-posinset")===(_===0?"1":`${this._terminal.buffer.lines.length}`)||x.relatedTarget!==M)return;let T,R;if(_===0?(T=C,R=this._rowElements.pop(),this._rowContainer.removeChild(R)):(T=this._rowElements.shift(),R=C,this._rowContainer.removeChild(T)),T.removeEventListener("focus",this._topBoundaryFocusListener),R.removeEventListener("focus",this._bottomBoundaryFocusListener),_===0){const P=this._createAccessibilityTreeNode();this._rowElements.unshift(P),this._rowContainer.insertAdjacentElement("afterbegin",P)}else{const P=this._createAccessibilityTreeNode();this._rowElements.push(P),this._rowContainer.appendChild(P)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(_===0?-1:1),this._rowElements[_===0?1:this._rowElements.length-2].focus(),x.preventDefault(),x.stopImmediatePropagation()}_handleSelectionChange(){var L;if(this._rowElements.length===0)return;const x=document.getSelection();if(!x)return;if(x.isCollapsed)return void(this._rowContainer.contains(x.anchorNode)&&this._terminal.clearSelection());if(!x.anchorNode||!x.focusNode)return void console.error("anchorNode and/or focusNode are null");let _={node:x.anchorNode,offset:x.anchorOffset},C={node:x.focusNode,offset:x.focusOffset};if((_.node.compareDocumentPosition(C.node)&Node.DOCUMENT_POSITION_PRECEDING||_.node===C.node&&_.offset>C.offset)&&([_,C]=[C,_]),_.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(_={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(_.node))return;const M=this._rowElements.slice(-1)[0];if(C.node.compareDocumentPosition(M)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(C={node:M,offset:((L=M.textContent)==null?void 0:L.length)??0}),!this._rowContainer.contains(C.node))return;const T=({node:j,offset:$})=>{const U=j instanceof Text?j.parentNode:j;let z=parseInt(U==null?void 0:U.getAttribute("aria-posinset"),10)-1;if(isNaN(z))return console.warn("row is invalid. Race condition?"),null;const Y=this._rowColumns.get(U);if(!Y)return console.warn("columns is null. Race condition?"),null;let re=$<Y.length?Y[$]:Y.slice(-1)[0]+1;return re>=this._terminal.cols&&(++z,re=0),{row:z,column:re}},R=T(_),P=T(C);if(R&&P){if(R.row>P.row||R.row===P.row&&R.column>=P.column)throw new Error("invalid range");this._terminal.select(R.column,R.row,(P.row-R.row)*this._terminal.cols-R.column+P.column)}}_handleResize(x){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let _=this._rowContainer.children.length;_<this._terminal.rows;_++)this._rowElements[_]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[_]);for(;this._rowElements.length>x;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const x=this._coreBrowserService.mainDocument.createElement("div");return x.setAttribute("role","listitem"),x.tabIndex=-1,this._refreshRowDimensions(x),x}_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 x=0;x<this._terminal.rows;x++)this._refreshRowDimensions(this._rowElements[x])}}_refreshRowDimensions(x){x.style.height=`${this._renderService.dimensions.css.cell.height}px`}};o.AccessibilityManager=v=u([p(1,y.IInstantiationService),p(2,S.ICoreBrowserService),p(3,S.IRenderService)],v)},3614:(c,o)=>{function h(g){return g.replace(/\r?\n/g,"\r")}function u(g,w){return w?"\x1B[200~"+g+"\x1B[201~":g}function p(g,w,S,y){g=u(g=h(g),S.decPrivateModes.bracketedPasteMode&&y.rawOptions.ignoreBracketedPasteMode!==!0),S.triggerDataEvent(g,!0),w.value=""}function d(g,w,S){const y=S.getBoundingClientRect(),m=g.clientX-y.left-10,v=g.clientY-y.top-10;w.style.width="20px",w.style.height="20px",w.style.left=`${m}px`,w.style.top=`${v}px`,w.style.zIndex="1000",w.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,w){g.clipboardData&&g.clipboardData.setData("text/plain",w.selectionText),g.preventDefault()},o.handlePasteEvent=function(g,w,S,y){g.stopPropagation(),g.clipboardData&&p(g.clipboardData.getData("text/plain"),w,S,y)},o.paste=p,o.moveTextAreaUnderMouseCursor=d,o.rightClickHandler=function(g,w,S,y,m){d(g,w,S),m&&y.rightClickSelect(g),w.value=y.selectionText,w.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(p,d,g){this._css.set(p,d,g)}getCss(p,d){return this._css.get(p,d)}setColor(p,d,g){this._color.set(p,d,g)}getColor(p,d){return this._color.get(p,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,p,d){h.addEventListener(u,p,d);let g=!1;return{dispose:()=>{g||(g=!0,h.removeEventListener(u,p,d))}}}},3551:function(c,o,h){var u=this&&this.__decorate||function(v,x,_,C){var M,T=arguments.length,R=T<3?x:C===null?C=Object.getOwnPropertyDescriptor(x,_):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(v,x,_,C);else for(var P=v.length-1;P>=0;P--)(M=v[P])&&(R=(T<3?M(R):T>3?M(x,_,R):M(x,_))||R);return T>3&&R&&Object.defineProperty(x,_,R),R},p=this&&this.__param||function(v,x){return function(_,C){x(_,C,v)}};Object.defineProperty(o,"__esModule",{value:!0}),o.Linkifier=void 0;const d=h(3656),g=h(8460),w=h(844),S=h(2585),y=h(4725);let m=o.Linkifier=class extends w.Disposable{get currentLink(){return this._currentLink}constructor(v,x,_,C,M){super(),this._element=v,this._mouseService=x,this._renderService=_,this._bufferService=C,this._linkProviderService=M,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,w.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,w.toDisposable)((()=>{var T;this._lastMouseEvent=void 0,(T=this._activeProviderReplies)==null||T.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(v){this._lastMouseEvent=v;const x=this._positionFromMouseEvent(v,this._element,this._mouseService);if(!x)return;this._isMouseOut=!1;const _=v.composedPath();for(let C=0;C<_.length;C++){const M=_[C];if(M.classList.contains("xterm"))break;if(M.classList.contains("xterm-hover"))return}this._lastBufferCell&&x.x===this._lastBufferCell.x&&x.y===this._lastBufferCell.y||(this._handleHover(x),this._lastBufferCell=x)}_handleHover(v){if(this._activeLine!==v.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(v,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,v)||(this._clearCurrentLink(),this._askForLink(v,!0))}_askForLink(v,x){var C,M;this._activeProviderReplies&&x||((C=this._activeProviderReplies)==null||C.forEach((T=>{T==null||T.forEach((R=>{R.link.dispose&&R.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=v.y);let _=!1;for(const[T,R]of this._linkProviderService.linkProviders.entries())x?(M=this._activeProviderReplies)!=null&&M.get(T)&&(_=this._checkLinkProviderResult(T,v,_)):R.provideLinks(v.y,(P=>{var j,$;if(this._isMouseOut)return;const L=P==null?void 0:P.map((U=>({link:U})));(j=this._activeProviderReplies)==null||j.set(T,L),_=this._checkLinkProviderResult(T,v,_),(($=this._activeProviderReplies)==null?void 0:$.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(v.y,this._activeProviderReplies)}))}_removeIntersectingLinks(v,x){const _=new Set;for(let C=0;C<x.size;C++){const M=x.get(C);if(M)for(let T=0;T<M.length;T++){const R=M[T],P=R.link.range.start.y<v?0:R.link.range.start.x,L=R.link.range.end.y>v?this._bufferService.cols:R.link.range.end.x;for(let j=P;j<=L;j++){if(_.has(j)){M.splice(T--,1);break}_.add(j)}}}}_checkLinkProviderResult(v,x,_){var T;if(!this._activeProviderReplies)return _;const C=this._activeProviderReplies.get(v);let M=!1;for(let R=0;R<v;R++)this._activeProviderReplies.has(R)&&!this._activeProviderReplies.get(R)||(M=!0);if(!M&&C){const R=C.find((P=>this._linkAtPosition(P.link,x)));R&&(_=!0,this._handleNewLink(R))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!_)for(let R=0;R<this._activeProviderReplies.size;R++){const P=(T=this._activeProviderReplies.get(R))==null?void 0:T.find((L=>this._linkAtPosition(L.link,x)));if(P){_=!0,this._handleNewLink(P);break}}return _}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(v){if(!this._currentLink)return;const x=this._positionFromMouseEvent(v,this._element,this._mouseService);x&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,x)&&this._currentLink.link.activate(v,this._currentLink.link.text)}_clearCurrentLink(v,x){this._currentLink&&this._lastMouseEvent&&(!v||!x||this._currentLink.link.range.start.y>=v&&this._currentLink.link.range.end.y<=x)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,w.disposeArray)(this._linkCacheDisposables))}_handleNewLink(v){if(!this._lastMouseEvent)return;const x=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);x&&this._linkAtPosition(v.link,x)&&(this._currentLink=v,this._currentLink.state={decorations:{underline:v.link.decorations===void 0||v.link.decorations.underline,pointerCursor:v.link.decorations===void 0||v.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,v.link,this._lastMouseEvent),v.link.decorations={},Object.defineProperties(v.link.decorations,{pointerCursor:{get:()=>{var _,C;return(C=(_=this._currentLink)==null?void 0:_.state)==null?void 0:C.decorations.pointerCursor},set:_=>{var C;(C=this._currentLink)!=null&&C.state&&this._currentLink.state.decorations.pointerCursor!==_&&(this._currentLink.state.decorations.pointerCursor=_,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",_))}},underline:{get:()=>{var _,C;return(C=(_=this._currentLink)==null?void 0:_.state)==null?void 0:C.decorations.underline},set:_=>{var C,M,T;(C=this._currentLink)!=null&&C.state&&((T=(M=this._currentLink)==null?void 0:M.state)==null?void 0:T.decorations.underline)!==_&&(this._currentLink.state.decorations.underline=_,this._currentLink.state.isHovered&&this._fireUnderlineEvent(v.link,_))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((_=>{if(!this._currentLink)return;const C=_.start===0?0:_.start+1+this._bufferService.buffer.ydisp,M=this._bufferService.buffer.ydisp+1+_.end;if(this._currentLink.link.range.start.y>=C&&this._currentLink.link.range.end.y<=M&&(this._clearCurrentLink(C,M),this._lastMouseEvent)){const T=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);T&&this._askForLink(T,!1)}}))))}_linkHover(v,x,_){var C;(C=this._currentLink)!=null&&C.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(x,!0),this._currentLink.state.decorations.pointerCursor&&v.classList.add("xterm-cursor-pointer")),x.hover&&x.hover(_,x.text)}_fireUnderlineEvent(v,x){const _=v.range,C=this._bufferService.buffer.ydisp,M=this._createLinkUnderlineEvent(_.start.x-1,_.start.y-C-1,_.end.x,_.end.y-C-1,void 0);(x?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(M)}_linkLeave(v,x,_){var C;(C=this._currentLink)!=null&&C.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(x,!1),this._currentLink.state.decorations.pointerCursor&&v.classList.remove("xterm-cursor-pointer")),x.leave&&x.leave(_,x.text)}_linkAtPosition(v,x){const _=v.range.start.y*this._bufferService.cols+v.range.start.x,C=v.range.end.y*this._bufferService.cols+v.range.end.x,M=x.y*this._bufferService.cols+x.x;return _<=M&&M<=C}_positionFromMouseEvent(v,x,_){const C=_.getCoords(v,x,this._bufferService.cols,this._bufferService.rows);if(C)return{x:C[0],y:C[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(v,x,_,C,M){return{x1:v,y1:x,x2:_,y2:C,cols:this._bufferService.cols,fg:M}}};o.Linkifier=m=u([p(1,y.IMouseService),p(2,y.IRenderService),p(3,S.IBufferService),p(4,y.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(y,m,v,x){var _,C=arguments.length,M=C<3?m:x===null?x=Object.getOwnPropertyDescriptor(m,v):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(y,m,v,x);else for(var T=y.length-1;T>=0;T--)(_=y[T])&&(M=(C<3?_(M):C>3?_(m,v,M):_(m,v))||M);return C>3&&M&&Object.defineProperty(m,v,M),M},p=this&&this.__param||function(y,m){return function(v,x){m(v,x,y)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OscLinkProvider=void 0;const d=h(511),g=h(2585);let w=o.OscLinkProvider=class{constructor(y,m,v){this._bufferService=y,this._optionsService=m,this._oscLinkService=v}provideLinks(y,m){var L;const v=this._bufferService.buffer.lines.get(y-1);if(!v)return void m(void 0);const x=[],_=this._optionsService.rawOptions.linkHandler,C=new d.CellData,M=v.getTrimmedLength();let T=-1,R=-1,P=!1;for(let j=0;j<M;j++)if(R!==-1||v.hasContent(j)){if(v.loadCell(j,C),C.hasExtendedAttrs()&&C.extended.urlId){if(R===-1){R=j,T=C.extended.urlId;continue}P=C.extended.urlId!==T}else R!==-1&&(P=!0);if(P||R!==-1&&j===M-1){const $=(L=this._oscLinkService.getLinkData(T))==null?void 0:L.uri;if($){const U={start:{x:R+1,y},end:{x:j+(P||j!==M-1?0:1),y}};let z=!1;if(!(_!=null&&_.allowNonHttpProtocols))try{const Y=new URL($);["http:","https:"].includes(Y.protocol)||(z=!0)}catch{z=!0}z||x.push({text:$,range:U,activate:(Y,re)=>_?_.activate(Y,re,U):S(0,re),hover:(Y,re)=>{var Q;return(Q=_==null?void 0:_.hover)==null?void 0:Q.call(_,Y,re,U)},leave:(Y,re)=>{var Q;return(Q=_==null?void 0:_.leave)==null?void 0:Q.call(_,Y,re,U)}})}P=!1,C.hasExtendedAttrs()&&C.extended.urlId?(R=j,T=C.extended.urlId):(R=-1,T=-1)}}m(x)}};function S(y,m){if(confirm(`Do you want to navigate to ${m}?
|
|
302
|
+
|
|
303
|
+
WARNING: This link could potentially be dangerous`)){const v=window.open();if(v){try{v.opener=null}catch{}v.location.href=m}else console.warn("Opening link blocked as opener could not be cleared")}}o.OscLinkProvider=w=u([p(0,g.IBufferService),p(1,g.IOptionsService),p(2,g.IOscLinkService)],w)},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,p){this._rowCount=p,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),p=h(3656),d=h(3551),g=h(9042),w=h(3730),S=h(1680),y=h(3107),m=h(5744),v=h(2950),x=h(1296),_=h(428),C=h(4269),M=h(5114),T=h(8934),R=h(3230),P=h(9312),L=h(4725),j=h(6731),$=h(8055),U=h(8969),z=h(8460),Y=h(844),re=h(6114),Q=h(8437),J=h(2584),K=h(7399),D=h(5941),N=h(9074),B=h(2585),F=h(5435),Z=h(4567),ne=h(779);class he extends U.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=re,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new Y.MutableDisposable),this._onCursorMove=this.register(new z.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new z.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new z.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new z.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new z.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new z.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new z.EventEmitter),this._onBlur=this.register(new z.EventEmitter),this._onA11yCharEmitter=this.register(new z.EventEmitter),this._onA11yTabEmitter=this.register(new z.EventEmitter),this._onWillOpen=this.register(new z.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(N.DecorationService),this._instantiationService.setService(B.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(ne.LinkProviderService),this._instantiationService.setService(L.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(w.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((O,ie)=>this.refresh(O,ie)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((O=>this._reportWindowsOptions(O)))),this.register(this._inputHandler.onColor((O=>this._handleColorEvent(O)))),this.register((0,z.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,z.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,z.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,z.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((O=>this._afterResize(O.cols,O.rows)))),this.register((0,Y.toDisposable)((()=>{var O,ie;this._customKeyEventHandler=void 0,(ie=(O=this.element)==null?void 0:O.parentNode)==null||ie.removeChild(this.element)})))}_handleColorEvent(V){if(this._themeService)for(const O of V){let ie,se="";switch(O.index){case 256:ie="foreground",se="10";break;case 257:ie="background",se="11";break;case 258:ie="cursor",se="12";break;default:ie="ansi",se="4;"+O.index}switch(O.type){case 0:const pe=$.color.toColorRGB(ie==="ansi"?this._themeService.colors.ansi[O.index]:this._themeService.colors[ie]);this.coreService.triggerDataEvent(`${J.C0.ESC}]${se};${(0,D.toRgbString)(pe)}${J.C1_ESCAPED.ST}`);break;case 1:if(ie==="ansi")this._themeService.modifyColors((fe=>fe.ansi[O.index]=$.channels.toColor(...O.color)));else{const fe=ie;this._themeService.modifyColors((Ee=>Ee[fe]=$.channels.toColor(...O.color)))}break;case 2:this._themeService.restoreColor(O.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,O=this.buffer.lines.get(V);if(!O)return;const ie=Math.min(this.buffer.x,this.cols-1),se=this._renderService.dimensions.css.cell.height,pe=O.getWidth(ie),fe=this._renderService.dimensions.css.cell.width*pe,Ee=this.buffer.y*this._renderService.dimensions.css.cell.height,Ie=ie*this._renderService.dimensions.css.cell.width;this.textarea.style.left=Ie+"px",this.textarea.style.top=Ee+"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,p.addDisposableDomListener)(this.element,"copy",(O=>{this.hasSelection()&&(0,u.copyHandler)(O,this._selectionService)})));const V=O=>(0,u.handlePasteEvent)(O,this.textarea,this.coreService,this.optionsService);this.register((0,p.addDisposableDomListener)(this.textarea,"paste",V)),this.register((0,p.addDisposableDomListener)(this.element,"paste",V)),re.isFirefox?this.register((0,p.addDisposableDomListener)(this.element,"mousedown",(O=>{O.button===2&&(0,u.rightClickHandler)(O,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,p.addDisposableDomListener)(this.element,"contextmenu",(O=>{(0,u.rightClickHandler)(O,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),re.isLinux&&this.register((0,p.addDisposableDomListener)(this.element,"auxclick",(O=>{O.button===1&&(0,u.moveTextAreaUnderMouseCursor)(O,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,p.addDisposableDomListener)(this.textarea,"keyup",(V=>this._keyUp(V)),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"keydown",(V=>this._keyDown(V)),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"keypress",(V=>this._keyPress(V)),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionupdate",(V=>this._compositionHelper.compositionupdate(V)))),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,p.addDisposableDomListener)(this.textarea,"input",(V=>this._inputEvent(V)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(V){var ie;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"),((ie=this.element)==null?void 0:ie.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 O=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),O.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,p.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),O.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",g.promptLabel),re.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(M.CoreBrowserService,this.textarea,V.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(L.ICoreBrowserService,this._coreBrowserService),this.register((0,p.addDisposableDomListener)(this.textarea,"focus",(se=>this._handleTextAreaFocus(se)))),this.register((0,p.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(_.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(L.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(j.ThemeService),this._instantiationService.setService(L.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(C.CharacterJoinerService),this._instantiationService.setService(L.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(R.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(L.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(v.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(T.MouseService),this._instantiationService.setService(L.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(d.Linkifier,this.screenElement)),this.element.appendChild(O);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(S.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(P.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(L.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,p.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(y.BufferDecorationRenderer,this.screenElement)),this.register((0,p.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(x.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const V=this,O=this.element;function ie(fe){const Ee=V._mouseService.getMouseReportCoords(fe,V.screenElement);if(!Ee)return!1;let Ie,je;switch(fe.overrideType||fe.type){case"mousemove":je=32,fe.buttons===void 0?(Ie=3,fe.button!==void 0&&(Ie=fe.button<3?fe.button:3)):Ie=1&fe.buttons?0:4&fe.buttons?1:2&fe.buttons?2:3;break;case"mouseup":je=0,Ie=fe.button<3?fe.button:3;break;case"mousedown":je=1,Ie=fe.button<3?fe.button:3;break;case"wheel":if(V._customWheelEventHandler&&V._customWheelEventHandler(fe)===!1||V.viewport.getLinesScrolled(fe)===0)return!1;je=fe.deltaY<0?0:1,Ie=4;break;default:return!1}return!(je===void 0||Ie===void 0||Ie>4)&&V.coreMouseService.triggerMouseEvent({col:Ee.col,row:Ee.row,x:Ee.x,y:Ee.y,button:Ie,action:je,ctrl:fe.ctrlKey,alt:fe.altKey,shift:fe.shiftKey})}const se={mouseup:null,wheel:null,mousedrag:null,mousemove:null},pe={mouseup:fe=>(ie(fe),fe.buttons||(this._document.removeEventListener("mouseup",se.mouseup),se.mousedrag&&this._document.removeEventListener("mousemove",se.mousedrag)),this.cancel(fe)),wheel:fe=>(ie(fe),this.cancel(fe,!0)),mousedrag:fe=>{fe.buttons&&ie(fe)},mousemove:fe=>{fe.buttons||ie(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||(O.addEventListener("mousemove",pe.mousemove),se.mousemove=pe.mousemove):(O.removeEventListener("mousemove",se.mousemove),se.mousemove=null),16&fe?se.wheel||(O.addEventListener("wheel",pe.wheel,{passive:!1}),se.wheel=pe.wheel):(O.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,p.addDisposableDomListener)(O,"mousedown",(fe=>{if(fe.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(fe))return ie(fe),se.mouseup&&this._document.addEventListener("mouseup",se.mouseup),se.mousedrag&&this._document.addEventListener("mousemove",se.mousedrag),this.cancel(fe)}))),this.register((0,p.addDisposableDomListener)(O,"wheel",(fe=>{if(!se.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(fe)===!1)return!1;if(!this.buffer.hasScrollback){const Ee=this.viewport.getLinesScrolled(fe);if(Ee===0)return;const Ie=J.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(fe.deltaY<0?"A":"B");let je="";for(let pt=0;pt<Math.abs(Ee);pt++)je+=Ie;return this.coreService.triggerDataEvent(je,!0),this.cancel(fe,!0)}return this.viewport.handleWheel(fe)?this.cancel(fe):void 0}}),{passive:!1})),this.register((0,p.addDisposableDomListener)(O,"touchstart",(fe=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(fe),this.cancel(fe)}),{passive:!0})),this.register((0,p.addDisposableDomListener)(O,"touchmove",(fe=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(fe)?void 0:this.cancel(fe)}),{passive:!1}))}refresh(V,O){var ie;(ie=this._renderService)==null||ie.refreshRows(V,O)}updateCursorStyle(V){var O;(O=this._selectionService)!=null&&O.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,O,ie=0){var se;ie===1?(super.scrollLines(V,O,ie),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 O=this._characterJoinerService.register(V);return this.refresh(0,this.rows-1),O}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,O,ie){this._selectionService.setSelection(V,O,ie)}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,O){var ie;(ie=this._selectionService)==null||ie.selectLines(V,O)}_keyDown(V){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(V)===!1)return!1;const O=this.browser.isMac&&this.options.macOptionIsMeta&&V.altKey;if(!O&&!this._compositionHelper.keydown(V))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;O||V.key!=="Dead"&&V.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const ie=(0,K.evaluateKeyboardEvent)(V,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(V),ie.type===3||ie.type===2){const se=this.rows-1;return this.scrollLines(ie.type===2?-se:se),this.cancel(V,!0)}return ie.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,V)||(ie.cancel&&this.cancel(V,!0),!ie.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):(ie.key!==J.C0.ETX&&ie.key!==J.C0.CR||(this.textarea.value=""),this._onKey.fire({key:ie.key,domEvent:V}),this._showCursor(),this.coreService.triggerDataEvent(ie.key,!0),!this.optionsService.rawOptions.screenReaderMode||V.altKey||V.ctrlKey?this.cancel(V,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(V,O){const ie=V.isMac&&!this.options.macOptionIsMeta&&O.altKey&&!O.ctrlKey&&!O.metaKey||V.isWindows&&O.altKey&&O.ctrlKey&&!O.metaKey||V.isWindows&&O.getModifierState("AltGraph");return O.type==="keypress"?ie:ie&&(!O.keyCode||O.keyCode>47)}_keyUp(V){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(V)===!1||((function(O){return O.keyCode===16||O.keyCode===17||O.keyCode===18})(V)||this.focus(),this.updateCursorStyle(V),this._keyPressHandled=!1)}_keyPress(V){let O;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(V)===!1)return!1;if(this.cancel(V),V.charCode)O=V.charCode;else if(V.which===null||V.which===void 0)O=V.keyCode;else{if(V.which===0||V.charCode===0)return!1;O=V.which}return!(!O||(V.altKey||V.ctrlKey||V.metaKey)&&!this._isThirdLevelShift(this.browser,V)||(O=String.fromCharCode(O),this._onKey.fire({key:O,domEvent:V}),this._showCursor(),this.coreService.triggerDataEvent(O,!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 O=V.data;return this.coreService.triggerDataEvent(O,!0),this.cancel(V),!0}return!1}resize(V,O){V!==this.cols||O!==this.rows?super.resize(V,O):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(V,O){var ie,se;(ie=this._charSizeService)==null||ie.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 O=1;O<this.rows;O++)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 O,ie;this.options.rows=this.rows,this.options.cols=this.cols;const V=this._customKeyEventHandler;this._setup(),super.reset(),(O=this._selectionService)==null||O.reset(),this._decorationService.reset(),(ie=this.viewport)==null||ie.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 F.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const O=this._renderService.dimensions.css.canvas.width.toFixed(0),ie=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${J.C0.ESC}[4;${ie};${O}t`);break;case F.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,O){if(this.options.cancelEvents||O)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,p){this._rowCount=p,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,w=this._debounceThresholdMS-g;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),w)}}_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(v,x,_,C){var M,T=arguments.length,R=T<3?x:C===null?C=Object.getOwnPropertyDescriptor(x,_):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(v,x,_,C);else for(var P=v.length-1;P>=0;P--)(M=v[P])&&(R=(T<3?M(R):T>3?M(x,_,R):M(x,_))||R);return T>3&&R&&Object.defineProperty(x,_,R),R},p=this&&this.__param||function(v,x){return function(_,C){x(_,C,v)}};Object.defineProperty(o,"__esModule",{value:!0}),o.Viewport=void 0;const d=h(3656),g=h(4725),w=h(8460),S=h(844),y=h(2585);let m=o.Viewport=class extends S.Disposable{constructor(v,x,_,C,M,T,R,P){super(),this._viewportElement=v,this._scrollArea=x,this._bufferService=_,this._optionsService=C,this._charSizeService=M,this._renderService=T,this._coreBrowserService=R,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 w.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((L=>this._activeBuffer=L.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((L=>this._renderDimensions=L))),this._handleThemeChange(P.colors),this.register(P.onChangeColors((L=>this._handleThemeChange(L)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(v){this._viewportElement.style.backgroundColor=v.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(v){if(v)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 x=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==x&&(this._lastRecordedBufferHeight=x,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const v=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==v&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=v),this._refreshAnimationFrame=null}syncScrollArea(v=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(v);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(v)}_handleScroll(v){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 x=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:x,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const v=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(v*(this._smoothScrollState.target-this._smoothScrollState.origin)),v<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(v,x){const _=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(x<0&&this._viewportElement.scrollTop!==0||x>0&&_<this._lastRecordedBufferHeight)||(v.cancelable&&v.preventDefault(),!1)}handleWheel(v){const x=this._getPixelsScrolled(v);return x!==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+x:this._smoothScrollState.target+=x,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=x,this._bubbleScroll(v,x))}scrollLines(v){if(v!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const x=v*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+x,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:v,suppressScrollEvent:!1})}_getPixelsScrolled(v){if(v.deltaY===0||v.shiftKey)return 0;let x=this._applyScrollModifier(v.deltaY,v);return v.deltaMode===WheelEvent.DOM_DELTA_LINE?x*=this._currentRowHeight:v.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(x*=this._currentRowHeight*this._bufferService.rows),x}getBufferElements(v,x){var P;let _,C="";const M=[],T=x??this._bufferService.buffer.lines.length,R=this._bufferService.buffer.lines;for(let L=v;L<T;L++){const j=R.get(L);if(!j)continue;const $=(P=R.get(L+1))==null?void 0:P.isWrapped;if(C+=j.translateToString(!$),!$||L===R.length-1){const U=document.createElement("div");U.textContent=C,M.push(U),C.length>0&&(_=U),C=""}}return{bufferElements:M,cursorElement:_}}getLinesScrolled(v){if(v.deltaY===0||v.shiftKey)return 0;let x=this._applyScrollModifier(v.deltaY,v);return v.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(x/=this._currentRowHeight+0,this._wheelPartialScroll+=x,x=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):v.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(x*=this._bufferService.rows),x}_applyScrollModifier(v,x){const _=this._optionsService.rawOptions.fastScrollModifier;return _==="alt"&&x.altKey||_==="ctrl"&&x.ctrlKey||_==="shift"&&x.shiftKey?v*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:v*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(v){this._lastTouchY=v.touches[0].pageY}handleTouchMove(v){const x=this._lastTouchY-v.touches[0].pageY;return this._lastTouchY=v.touches[0].pageY,x!==0&&(this._viewportElement.scrollTop+=x,this._bubbleScroll(v,x))}};o.Viewport=m=u([p(2,y.IBufferService),p(3,y.IOptionsService),p(4,g.ICharSizeService),p(5,g.IRenderService),p(6,g.ICoreBrowserService),p(7,g.IThemeService)],m)},3107:function(c,o,h){var u=this&&this.__decorate||function(y,m,v,x){var _,C=arguments.length,M=C<3?m:x===null?x=Object.getOwnPropertyDescriptor(m,v):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(y,m,v,x);else for(var T=y.length-1;T>=0;T--)(_=y[T])&&(M=(C<3?_(M):C>3?_(m,v,M):_(m,v))||M);return C>3&&M&&Object.defineProperty(m,v,M),M},p=this&&this.__param||function(y,m){return function(v,x){m(v,x,y)}};Object.defineProperty(o,"__esModule",{value:!0}),o.BufferDecorationRenderer=void 0;const d=h(4725),g=h(844),w=h(2585);let S=o.BufferDecorationRenderer=class extends g.Disposable{constructor(y,m,v,x,_){super(),this._screenElement=y,this._bufferService=m,this._coreBrowserService=v,this._decorationService=x,this._renderService=_,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 y of this._decorationService.decorations)this._renderDecoration(y);this._dimensionsChanged=!1}_renderDecoration(y){this._refreshStyle(y),this._dimensionsChanged&&this._refreshXPosition(y)}_createElement(y){var x;const m=this._coreBrowserService.mainDocument.createElement("div");m.classList.add("xterm-decoration"),m.classList.toggle("xterm-decoration-top-layer",((x=y==null?void 0:y.options)==null?void 0:x.layer)==="top"),m.style.width=`${Math.round((y.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,m.style.height=(y.options.height||1)*this._renderService.dimensions.css.cell.height+"px",m.style.top=(y.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 v=y.options.x??0;return v&&v>this._bufferService.cols&&(m.style.display="none"),this._refreshXPosition(y,m),m}_refreshStyle(y){const m=y.marker.line-this._bufferService.buffers.active.ydisp;if(m<0||m>=this._bufferService.rows)y.element&&(y.element.style.display="none",y.onRenderEmitter.fire(y.element));else{let v=this._decorationElements.get(y);v||(v=this._createElement(y),y.element=v,this._decorationElements.set(y,v),this._container.appendChild(v),y.onDispose((()=>{this._decorationElements.delete(y),v.remove()}))),v.style.top=m*this._renderService.dimensions.css.cell.height+"px",v.style.display=this._altBufferIsActive?"none":"block",y.onRenderEmitter.fire(v)}}_refreshXPosition(y,m=y.element){if(!m)return;const v=y.options.x??0;(y.options.anchor||"left")==="right"?m.style.right=v?v*this._renderService.dimensions.css.cell.width+"px":"":m.style.left=v?v*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(y){var m;(m=this._decorationElements.get(y))==null||m.remove(),this._decorationElements.delete(y),y.dispose()}};o.BufferDecorationRenderer=S=u([p(1,w.IBufferService),p(2,d.ICoreBrowserService),p(3,w.IDecorationService),p(4,d.IRenderService)],S)},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,p){return u>=h.startBufferLine-this._linePadding[p||"full"]&&u<=h.endBufferLine+this._linePadding[p||"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(_,C,M,T){var R,P=arguments.length,L=P<3?C:T===null?T=Object.getOwnPropertyDescriptor(C,M):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(_,C,M,T);else for(var j=_.length-1;j>=0;j--)(R=_[j])&&(L=(P<3?R(L):P>3?R(C,M,L):R(C,M))||L);return P>3&&L&&Object.defineProperty(C,M,L),L},p=this&&this.__param||function(_,C){return function(M,T){C(M,T,_)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OverviewRulerRenderer=void 0;const d=h(5871),g=h(4725),w=h(844),S=h(2585),y={full:0,left:0,center:0,right:0},m={full:0,left:0,center:0,right:0},v={full:0,left:0,center:0,right:0};let x=o.OverviewRulerRenderer=class extends w.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(_,C,M,T,R,P,L){var $;super(),this._viewportElement=_,this._screenElement=C,this._bufferService=M,this._decorationService=T,this._renderService=R,this._optionsService=P,this._coreBrowserService=L,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(),($=this._viewportElement.parentElement)==null||$.insertBefore(this._canvas,this._viewportElement);const j=this._canvas.getContext("2d");if(!j)throw new Error("Ctx cannot be null");this._ctx=j,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,w.toDisposable)((()=>{var U;(U=this._canvas)==null||U.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 _=Math.floor(this._canvas.width/3),C=Math.ceil(this._canvas.width/3);m.full=this._canvas.width,m.left=_,m.center=C,m.right=_,this._refreshDrawHeightConstants(),v.full=0,v.left=0,v.center=m.left,v.right=m.left+m.center}_refreshDrawHeightConstants(){y.full=Math.round(2*this._coreBrowserService.dpr);const _=this._canvas.height/this._bufferService.buffer.lines.length,C=Math.round(Math.max(Math.min(_,12),6)*this._coreBrowserService.dpr);y.left=C,y.center=C,y.right=C}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*y.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*y.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*y.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*y.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 _=this._colorZoneStore.zones;for(const C of _)C.position!=="full"&&this._renderColorZone(C);for(const C of _)C.position==="full"&&this._renderColorZone(C);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(_){this._ctx.fillStyle=_.color,this._ctx.fillRect(v[_.position||"full"],Math.round((this._canvas.height-1)*(_.startBufferLine/this._bufferService.buffers.active.lines.length)-y[_.position||"full"]/2),m[_.position||"full"],Math.round((this._canvas.height-1)*((_.endBufferLine-_.startBufferLine)/this._bufferService.buffers.active.lines.length)+y[_.position||"full"]))}_queueRefresh(_,C){this._shouldUpdateDimensions=_||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=x=u([p(2,S.IBufferService),p(3,S.IDecorationService),p(4,g.IRenderService),p(5,S.IOptionsService),p(6,g.ICoreBrowserService)],x)},2950:function(c,o,h){var u=this&&this.__decorate||function(y,m,v,x){var _,C=arguments.length,M=C<3?m:x===null?x=Object.getOwnPropertyDescriptor(m,v):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(y,m,v,x);else for(var T=y.length-1;T>=0;T--)(_=y[T])&&(M=(C<3?_(M):C>3?_(m,v,M):_(m,v))||M);return C>3&&M&&Object.defineProperty(m,v,M),M},p=this&&this.__param||function(y,m){return function(v,x){m(v,x,y)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CompositionHelper=void 0;const d=h(4725),g=h(2585),w=h(2584);let S=o.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(y,m,v,x,_,C){this._textarea=y,this._compositionView=m,this._bufferService=v,this._optionsService=x,this._coreService=_,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(y){this._compositionView.textContent=y.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(y){if(this._isComposing||this._isSendingComposition){if(y.keyCode===229||y.keyCode===16||y.keyCode===17||y.keyCode===18)return!1;this._finalizeComposition(!1)}return y.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(y){if(this._compositionView.classList.remove("active"),this._isComposing=!1,y){const m={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let v;this._isSendingComposition=!1,m.start+=this._dataAlreadySent.length,v=this._isComposing?this._textarea.value.substring(m.start,m.end):this._textarea.value.substring(m.start),v.length>0&&this._coreService.triggerDataEvent(v,!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 y=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const m=this._textarea.value,v=m.replace(y,"");this._dataAlreadySent=v,m.length>y.length?this._coreService.triggerDataEvent(v,!0):m.length<y.length?this._coreService.triggerDataEvent(`${w.C0.DEL}`,!0):m.length===y.length&&m!==y&&this._coreService.triggerDataEvent(m,!0)}}),0)}updateCompositionElements(y){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const m=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),v=this._renderService.dimensions.css.cell.height,x=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,_=m*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=_+"px",this._compositionView.style.top=x+"px",this._compositionView.style.height=v+"px",this._compositionView.style.lineHeight=v+"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=_+"px",this._textarea.style.top=x+"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"}y||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};o.CompositionHelper=S=u([p(2,g.IBufferService),p(3,g.IOptionsService),p(4,g.ICoreService),p(5,d.IRenderService)],S)},9806:(c,o)=>{function h(u,p,d){const g=d.getBoundingClientRect(),w=u.getComputedStyle(d),S=parseInt(w.getPropertyValue("padding-left")),y=parseInt(w.getPropertyValue("padding-top"));return[p.clientX-g.left-S,p.clientY-g.top-y]}Object.defineProperty(o,"__esModule",{value:!0}),o.getCoords=o.getCoordsRelativeToElement=void 0,o.getCoordsRelativeToElement=h,o.getCoords=function(u,p,d,g,w,S,y,m,v){if(!S)return;const x=h(u,p,d);return x?(x[0]=Math.ceil((x[0]+(v?y/2:0))/y),x[1]=Math.ceil(x[1]/m),x[0]=Math.min(Math.max(x[0],1),g+(v?1:0)),x[1]=Math.min(Math.max(x[1],1),w),x):void 0}},9504:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.moveToCellSequence=void 0;const u=h(2584);function p(m,v,x,_){const C=m-d(m,x),M=v-d(v,x),T=Math.abs(C-M)-(function(R,P,L){let j=0;const $=R-d(R,L),U=P-d(P,L);for(let z=0;z<Math.abs($-U);z++){const Y=g(R,P)==="A"?-1:1,re=L.buffer.lines.get($+Y*z);re!=null&&re.isWrapped&&j++}return j})(m,v,x);return y(T,S(g(m,v),_))}function d(m,v){let x=0,_=v.buffer.lines.get(m),C=_==null?void 0:_.isWrapped;for(;C&&m>=0&&m<v.rows;)x++,_=v.buffer.lines.get(--m),C=_==null?void 0:_.isWrapped;return x}function g(m,v){return m>v?"A":"B"}function w(m,v,x,_,C,M){let T=m,R=v,P="";for(;T!==x||R!==_;)T+=C?1:-1,C&&T>M.cols-1?(P+=M.buffer.translateBufferLineToString(R,!1,m,T),T=0,m=0,R++):!C&&T<0&&(P+=M.buffer.translateBufferLineToString(R,!1,0,m+1),T=M.cols-1,m=T,R--);return P+M.buffer.translateBufferLineToString(R,!1,m,T)}function S(m,v){const x=v?"O":"[";return u.C0.ESC+x+m}function y(m,v){m=Math.floor(m);let x="";for(let _=0;_<m;_++)x+=v;return x}o.moveToCellSequence=function(m,v,x,_){const C=x.buffer.x,M=x.buffer.y;if(!x.buffer.hasScrollback)return(function(P,L,j,$,U,z){return p(L,$,U,z).length===0?"":y(w(P,L,P,L-d(L,U),!1,U).length,S("D",z))})(C,M,0,v,x,_)+p(M,v,x,_)+(function(P,L,j,$,U,z){let Y;Y=p(L,$,U,z).length>0?$-d($,U):L;const re=$,Q=(function(J,K,D,N,B,F){let Z;return Z=p(D,N,B,F).length>0?N-d(N,B):K,J<D&&Z<=N||J>=D&&Z<N?"C":"D"})(P,L,j,$,U,z);return y(w(P,Y,j,re,Q==="C",U).length,S(Q,z))})(C,M,m,v,x,_);let T;if(M===v)return T=C>m?"D":"C",y(Math.abs(C-m),S(T,_));T=M>v?"D":"C";const R=Math.abs(M-v);return y((function(P,L){return L.cols-P})(M>v?m:C,x)+(R-1)*x.cols+1+((M>v?C:m)-1),S(T,_))}},1296:function(c,o,h){var u=this&&this.__decorate||function(z,Y,re,Q){var J,K=arguments.length,D=K<3?Y:Q===null?Q=Object.getOwnPropertyDescriptor(Y,re):Q;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(z,Y,re,Q);else for(var N=z.length-1;N>=0;N--)(J=z[N])&&(D=(K<3?J(D):K>3?J(Y,re,D):J(Y,re))||D);return K>3&&D&&Object.defineProperty(Y,re,D),D},p=this&&this.__param||function(z,Y){return function(re,Q){Y(re,Q,z)}};Object.defineProperty(o,"__esModule",{value:!0}),o.DomRenderer=void 0;const d=h(3787),g=h(2550),w=h(2223),S=h(6171),y=h(6052),m=h(4725),v=h(8055),x=h(8460),_=h(844),C=h(2585),M="xterm-dom-renderer-owner-",T="xterm-rows",R="xterm-fg-",P="xterm-bg-",L="xterm-focus",j="xterm-selection";let $=1,U=o.DomRenderer=class extends _.Disposable{constructor(z,Y,re,Q,J,K,D,N,B,F,Z,ne,he){super(),this._terminal=z,this._document=Y,this._element=re,this._screenElement=Q,this._viewportElement=J,this._helperContainer=K,this._linkifier2=D,this._charSizeService=B,this._optionsService=F,this._bufferService=Z,this._coreBrowserService=ne,this._themeService=he,this._terminalClass=$++,this._rowElements=[],this._selectionRenderModel=(0,y.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new x.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(T),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(j),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,S.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=N.createInstance(d.DomRendererRowFactory,document),this._element.classList.add(M+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,_.toDisposable)((()=>{this._element.classList.remove(M+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 z=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*z,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*z),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/z),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/z),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 re of this._rowElements)re.style.width=`${this.dimensions.css.canvas.width}px`,re.style.height=`${this.dimensions.css.cell.height}px`,re.style.lineHeight=`${this.dimensions.css.cell.height}px`,re.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const Y=`${this._terminalSelector} .${T} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=Y,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(z){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let Y=`${this._terminalSelector} .${T} { color: ${z.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;Y+=`${this._terminalSelector} .${T} .xterm-dim { color: ${v.color.multiplyOpacity(z.foreground,.5).css};}`,Y+=`${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 re=`blink_underline_${this._terminalClass}`,Q=`blink_bar_${this._terminalClass}`,J=`blink_block_${this._terminalClass}`;Y+=`@keyframes ${re} { 50% { border-bottom-style: hidden; }}`,Y+=`@keyframes ${Q} { 50% { box-shadow: none; }}`,Y+=`@keyframes ${J} { 0% { background-color: ${z.cursor.css}; color: ${z.cursorAccent.css}; } 50% { background-color: inherit; color: ${z.cursor.css}; }}`,Y+=`${this._terminalSelector} .${T}.${L} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${re} 1s step-end infinite;}${this._terminalSelector} .${T}.${L} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${Q} 1s step-end infinite;}${this._terminalSelector} .${T}.${L} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${J} 1s step-end infinite;}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-block { background-color: ${z.cursor.css}; color: ${z.cursorAccent.css};}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${z.cursor.css} !important; color: ${z.cursorAccent.css} !important;}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${z.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${z.cursor.css} inset;}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${z.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,Y+=`${this._terminalSelector} .${j} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${j} div { position: absolute; background-color: ${z.selectionBackgroundOpaque.css};}${this._terminalSelector} .${j} div { position: absolute; background-color: ${z.selectionInactiveBackgroundOpaque.css};}`;for(const[K,D]of z.ansi.entries())Y+=`${this._terminalSelector} .${R}${K} { color: ${D.css}; }${this._terminalSelector} .${R}${K}.xterm-dim { color: ${v.color.multiplyOpacity(D,.5).css}; }${this._terminalSelector} .${P}${K} { background-color: ${D.css}; }`;Y+=`${this._terminalSelector} .${R}${w.INVERTED_DEFAULT_COLOR} { color: ${v.color.opaque(z.background).css}; }${this._terminalSelector} .${R}${w.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${v.color.multiplyOpacity(v.color.opaque(z.background),.5).css}; }${this._terminalSelector} .${P}${w.INVERTED_DEFAULT_COLOR} { background-color: ${z.foreground.css}; }`,this._themeStyleElement.textContent=Y}_setDefaultSpacing(){const z=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${z}px`,this._rowFactory.defaultSpacing=z}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(z,Y){for(let re=this._rowElements.length;re<=Y;re++){const Q=this._document.createElement("div");this._rowContainer.appendChild(Q),this._rowElements.push(Q)}for(;this._rowElements.length>Y;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(z,Y){this._refreshRowElements(z,Y),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(L),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(L),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(z,Y,re){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(z,Y,re),this.renderRows(0,this._bufferService.rows-1),!z||!Y)return;this._selectionRenderModel.update(this._terminal,z,Y,re);const Q=this._selectionRenderModel.viewportStartRow,J=this._selectionRenderModel.viewportEndRow,K=this._selectionRenderModel.viewportCappedStartRow,D=this._selectionRenderModel.viewportCappedEndRow;if(K>=this._bufferService.rows||D<0)return;const N=this._document.createDocumentFragment();if(re){const B=z[0]>Y[0];N.appendChild(this._createSelectionElement(K,B?Y[0]:z[0],B?z[0]:Y[0],D-K+1))}else{const B=Q===K?z[0]:0,F=K===J?Y[0]:this._bufferService.cols;N.appendChild(this._createSelectionElement(K,B,F));const Z=D-K-1;if(N.appendChild(this._createSelectionElement(K+1,0,this._bufferService.cols,Z)),K!==D){const ne=J===D?Y[0]:this._bufferService.cols;N.appendChild(this._createSelectionElement(D,0,ne))}}this._selectionContainer.appendChild(N)}_createSelectionElement(z,Y,re,Q=1){const J=this._document.createElement("div"),K=Y*this.dimensions.css.cell.width;let D=this.dimensions.css.cell.width*(re-Y);return K+D>this.dimensions.css.canvas.width&&(D=this.dimensions.css.canvas.width-K),J.style.height=Q*this.dimensions.css.cell.height+"px",J.style.top=z*this.dimensions.css.cell.height+"px",J.style.left=`${K}px`,J.style.width=`${D}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 z of this._rowElements)z.replaceChildren()}renderRows(z,Y){const re=this._bufferService.buffer,Q=re.ybase+re.y,J=Math.min(re.x,this._bufferService.cols-1),K=this._optionsService.rawOptions.cursorBlink,D=this._optionsService.rawOptions.cursorStyle,N=this._optionsService.rawOptions.cursorInactiveStyle;for(let B=z;B<=Y;B++){const F=B+re.ydisp,Z=this._rowElements[B],ne=re.lines.get(F);if(!Z||!ne)break;Z.replaceChildren(...this._rowFactory.createRow(ne,F,F===Q,D,N,J,K,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${M}${this._terminalClass}`}_handleLinkHover(z){this._setCellUnderline(z.x1,z.x2,z.y1,z.y2,z.cols,!0)}_handleLinkLeave(z){this._setCellUnderline(z.x1,z.x2,z.y1,z.y2,z.cols,!1)}_setCellUnderline(z,Y,re,Q,J,K){re<0&&(z=0),Q<0&&(Y=0);const D=this._bufferService.rows-1;re=Math.max(Math.min(re,D),0),Q=Math.max(Math.min(Q,D),0),J=Math.min(J,this._bufferService.cols);const N=this._bufferService.buffer,B=N.ybase+N.y,F=Math.min(N.x,J-1),Z=this._optionsService.rawOptions.cursorBlink,ne=this._optionsService.rawOptions.cursorStyle,he=this._optionsService.rawOptions.cursorInactiveStyle;for(let ae=re;ae<=Q;++ae){const V=ae+N.ydisp,O=this._rowElements[ae],ie=N.lines.get(V);if(!O||!ie)break;O.replaceChildren(...this._rowFactory.createRow(ie,V,V===B,ne,he,F,Z,this.dimensions.css.cell.width,this._widthCache,K?ae===re?z:0:-1,K?(ae===Q?Y:J)-1:-1))}}};o.DomRenderer=U=u([p(7,C.IInstantiationService),p(8,m.ICharSizeService),p(9,C.IOptionsService),p(10,C.IBufferService),p(11,m.ICoreBrowserService),p(12,m.IThemeService)],U)},3787:function(c,o,h){var u=this&&this.__decorate||function(T,R,P,L){var j,$=arguments.length,U=$<3?R:L===null?L=Object.getOwnPropertyDescriptor(R,P):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")U=Reflect.decorate(T,R,P,L);else for(var z=T.length-1;z>=0;z--)(j=T[z])&&(U=($<3?j(U):$>3?j(R,P,U):j(R,P))||U);return $>3&&U&&Object.defineProperty(R,P,U),U},p=this&&this.__param||function(T,R){return function(P,L){R(P,L,T)}};Object.defineProperty(o,"__esModule",{value:!0}),o.DomRendererRowFactory=void 0;const d=h(2223),g=h(643),w=h(511),S=h(2585),y=h(8055),m=h(4725),v=h(4269),x=h(6171),_=h(3734);let C=o.DomRendererRowFactory=class{constructor(T,R,P,L,j,$,U){this._document=T,this._characterJoinerService=R,this._optionsService=P,this._coreBrowserService=L,this._coreService=j,this._decorationService=$,this._themeService=U,this._workCell=new w.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(T,R,P){this._selectionStart=T,this._selectionEnd=R,this._columnSelectMode=P}createRow(T,R,P,L,j,$,U,z,Y,re,Q){const J=[],K=this._characterJoinerService.getJoinedCharacters(R),D=this._themeService.colors;let N,B=T.getNoBgTrimmedLength();P&&B<$+1&&(B=$+1);let F=0,Z="",ne=0,he=0,ae=0,V=!1,O=0,ie=!1,se=0;const pe=[],fe=re!==-1&&Q!==-1;for(let Ee=0;Ee<B;Ee++){T.loadCell(Ee,this._workCell);let Ie=this._workCell.getWidth();if(Ie===0)continue;let je=!1,pt=Ee,Se=this._workCell;if(K.length>0&&Ee===K[0][0]){je=!0;const Ke=K.shift();Se=new v.JoinedCellData(this._workCell,T.translateToString(!0,Ke[0],Ke[1]),Ke[1]-Ke[0]),pt=Ke[1]-1,Ie=Se.getWidth()}const js=this._isCellInSelection(Ee,R),fr=P&&Ee===$,Zs=fe&&Ee>=re&&Ee<=Q;let Ns=!1;this._decorationService.forEachDecorationAtCell(Ee,R,void 0,(Ke=>{Ns=!0}));let pr=Se.getChars()||g.WHITESPACE_CELL_CHAR;if(pr===" "&&(Se.isUnderline()||Se.isOverline())&&(pr=" "),se=Ie*z-Y.get(pr,Se.isBold(),Se.isItalic()),N){if(F&&(js&&ie||!js&&!ie&&Se.bg===ne)&&(js&&ie&&D.selectionForeground||Se.fg===he)&&Se.extended.ext===ae&&Zs===V&&se===O&&!fr&&!je&&!Ns){Se.isInvisible()?Z+=g.WHITESPACE_CELL_CHAR:Z+=pr,F++;continue}F&&(N.textContent=Z),N=this._document.createElement("span"),F=0,Z=""}else N=this._document.createElement("span");if(ne=Se.bg,he=Se.fg,ae=Se.extended.ext,V=Zs,O=se,ie=js,je&&$>=Ee&&$<=pt&&($=Ee),!this._coreService.isCursorHidden&&fr&&this._coreService.isCursorInitialized){if(pe.push("xterm-cursor"),this._coreBrowserService.isFocused)U&&pe.push("xterm-cursor-blink"),pe.push(L==="bar"?"xterm-cursor-bar":L==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(j)switch(j){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(Se.isBold()&&pe.push("xterm-bold"),Se.isItalic()&&pe.push("xterm-italic"),Se.isDim()&&pe.push("xterm-dim"),Z=Se.isInvisible()?g.WHITESPACE_CELL_CHAR:Se.getChars()||g.WHITESPACE_CELL_CHAR,Se.isUnderline()&&(pe.push(`xterm-underline-${Se.extended.underlineStyle}`),Z===" "&&(Z=" "),!Se.isUnderlineColorDefault()))if(Se.isUnderlineColorRGB())N.style.textDecorationColor=`rgb(${_.AttributeData.toColorRGB(Se.getUnderlineColor()).join(",")})`;else{let Ke=Se.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Se.isBold()&&Ke<8&&(Ke+=8),N.style.textDecorationColor=D.ansi[Ke].css}Se.isOverline()&&(pe.push("xterm-overline"),Z===" "&&(Z=" ")),Se.isStrikethrough()&&pe.push("xterm-strikethrough"),Zs&&(N.style.textDecoration="underline");let Ht=Se.getFgColor(),mr=Se.getFgColorMode(),ss=Se.getBgColor(),gr=Se.getBgColorMode();const zr=!!Se.isInverse();if(zr){const Ke=Ht;Ht=ss,ss=Ke;const ta=mr;mr=gr,gr=ta}let rs,Wr,Gt,Cs=!1;switch(this._decorationService.forEachDecorationAtCell(Ee,R,void 0,(Ke=>{Ke.options.layer!=="top"&&Cs||(Ke.backgroundColorRGB&&(gr=50331648,ss=Ke.backgroundColorRGB.rgba>>8&16777215,rs=Ke.backgroundColorRGB),Ke.foregroundColorRGB&&(mr=50331648,Ht=Ke.foregroundColorRGB.rgba>>8&16777215,Wr=Ke.foregroundColorRGB),Cs=Ke.options.layer==="top")})),!Cs&&js&&(rs=this._coreBrowserService.isFocused?D.selectionBackgroundOpaque:D.selectionInactiveBackgroundOpaque,ss=rs.rgba>>8&16777215,gr=50331648,Cs=!0,D.selectionForeground&&(mr=50331648,Ht=D.selectionForeground.rgba>>8&16777215,Wr=D.selectionForeground)),Cs&&pe.push("xterm-decoration-top"),gr){case 16777216:case 33554432:Gt=D.ansi[ss],pe.push(`xterm-bg-${ss}`);break;case 50331648:Gt=y.channels.toColor(ss>>16,ss>>8&255,255&ss),this._addStyle(N,`background-color:#${M((ss>>>0).toString(16),"0",6)}`);break;default:zr?(Gt=D.foreground,pe.push(`xterm-bg-${d.INVERTED_DEFAULT_COLOR}`)):Gt=D.background}switch(rs||Se.isDim()&&(rs=y.color.multiplyOpacity(Gt,.5)),mr){case 16777216:case 33554432:Se.isBold()&&Ht<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Ht+=8),this._applyMinimumContrast(N,Gt,D.ansi[Ht],Se,rs,void 0)||pe.push(`xterm-fg-${Ht}`);break;case 50331648:const Ke=y.channels.toColor(Ht>>16&255,Ht>>8&255,255&Ht);this._applyMinimumContrast(N,Gt,Ke,Se,rs,Wr)||this._addStyle(N,`color:#${M(Ht.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(N,Gt,D.foreground,Se,rs,Wr)||zr&&pe.push(`xterm-fg-${d.INVERTED_DEFAULT_COLOR}`)}pe.length&&(N.className=pe.join(" "),pe.length=0),fr||je||Ns?N.textContent=Z:F++,se!==this.defaultSpacing&&(N.style.letterSpacing=`${se}px`),J.push(N),Ee=pt}return N&&F&&(N.textContent=Z),J}_applyMinimumContrast(T,R,P,L,j,$){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,x.treatGlyphAsBackgroundColor)(L.getCode()))return!1;const U=this._getContrastCache(L);let z;if(j||$||(z=U.getColor(R.rgba,P.rgba)),z===void 0){const Y=this._optionsService.rawOptions.minimumContrastRatio/(L.isDim()?2:1);z=y.color.ensureContrastRatio(j||R,$||P,Y),U.setColor((j||R).rgba,($||P).rgba,z??null)}return!!z&&(this._addStyle(T,`color:${z.css}`),!0)}_getContrastCache(T){return T.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(T,R){T.setAttribute("style",`${T.getAttribute("style")||""}${R};`)}_isCellInSelection(T,R){const P=this._selectionStart,L=this._selectionEnd;return!(!P||!L)&&(this._columnSelectMode?P[0]<=L[0]?T>=P[0]&&R>=P[1]&&T<L[0]&&R<=L[1]:T<P[0]&&R>=P[1]&&T>=L[0]&&R<=L[1]:R>P[1]&&R<L[1]||P[1]===L[1]&&R===P[1]&&T>=P[0]&&T<L[0]||P[1]<L[1]&&R===L[1]&&T<L[0]||P[1]<L[1]&&R===P[1]&&T>=P[0])}};function M(T,R,P){for(;T.length<P;)T=R+T;return T}o.DomRendererRowFactory=C=u([p(1,m.ICharacterJoinerService),p(2,S.IOptionsService),p(3,m.ICoreBrowserService),p(4,S.ICoreService),p(5,S.IDecorationService),p(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 p=h.createElement("span");p.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 w=h.createElement("span");w.classList.add("xterm-char-measure-element"),w.style.fontWeight="bold",w.style.fontStyle="italic",this._measureElements=[p,d,g,w],this._container.appendChild(p),this._container.appendChild(d),this._container.appendChild(g),this._container.appendChild(w),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,p,d){h===this._font&&u===this._fontSize&&p===this._weight&&d===this._weightBold||(this._font=h,this._fontSize=u,this._weight=p,this._weightBold=d,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${p}`,this._measureElements[1].style.fontWeight=`${d}`,this._measureElements[2].style.fontWeight=`${p}`,this._measureElements[3].style.fontWeight=`${d}`,this.clear())}get(h,u,p){let d=0;if(!u&&!p&&h.length===1&&(d=h.charCodeAt(0))<256){if(this._flat[d]!==-9999)return this._flat[d];const S=this._measure(h,0);return S>0&&(this._flat[d]=S),S}let g=h;u&&(g+="B"),p&&(g+="I");let w=this._holey.get(g);if(w===void 0){let S=0;u&&(S|=1),p&&(S|=2),w=this._measure(h,S),w>0&&this._holey.set(g,w)}return w}_measure(h,u){const p=this._measureElements[u];return p.textContent=h.repeat(32),p.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(p){return 57508<=p&&p<=57558}function u(p){return p>=128512&&p<=128591||p>=127744&&p<=128511||p>=128640&&p<=128767||p>=9728&&p<=9983||p>=9984&&p<=10175||p>=65024&&p<=65039||p>=129280&&p<=129535||p>=127462&&p<=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(p){if(!p)throw new Error("value must not be falsy");return p},o.isPowerlineGlyph=h,o.isRestrictedPowerlineGlyph=function(p){return 57520<=p&&p<=57527},o.isEmoji=u,o.allowRescaling=function(p,d,g,w){return d===1&&g>Math.ceil(1.5*w)&&p!==void 0&&p>255&&!u(p)&&!h(p)&&!(function(S){return 57344<=S&&S<=63743})(p)},o.treatGlyphAsBackgroundColor=function(p){return h(p)||(function(d){return 9472<=d&&d<=9631})(p)},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(p,d,g=0){return(p-(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(p,d,g,w=!1){if(this.selectionStart=d,this.selectionEnd=g,!d||!g||d[0]===g[0]&&d[1]===g[1])return void this.clear();const S=p.buffers.active.ydisp,y=d[1]-S,m=g[1]-S,v=Math.max(y,0),x=Math.min(m,p.rows-1);v>=p.rows||x<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=w,this.viewportStartRow=y,this.viewportEndRow=m,this.viewportCappedStartRow=v,this.viewportCappedEndRow=x,this.startCol=d[0],this.endCol=g[0])}isCellSelected(p,d,g){return!!this.hasSelection&&(g-=p.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(x,_,C,M){var T,R=arguments.length,P=R<3?_:M===null?M=Object.getOwnPropertyDescriptor(_,C):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")P=Reflect.decorate(x,_,C,M);else for(var L=x.length-1;L>=0;L--)(T=x[L])&&(P=(R<3?T(P):R>3?T(_,C,P):T(_,C))||P);return R>3&&P&&Object.defineProperty(_,C,P),P},p=this&&this.__param||function(x,_){return function(C,M){_(C,M,x)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CharSizeService=void 0;const d=h(2585),g=h(8460),w=h(844);let S=o.CharSizeService=class extends w.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(x,_,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 v(this._optionsService))}catch{this._measureStrategy=this.register(new m(x,_,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const x=this._measureStrategy.measure();x.width===this.width&&x.height===this.height||(this.width=x.width,this.height=x.height,this._onCharSizeChange.fire())}};o.CharSizeService=S=u([p(2,d.IOptionsService)],S);class y extends w.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(_,C){_!==void 0&&_>0&&C!==void 0&&C>0&&(this._result.width=_,this._result.height=C)}}class m extends y{constructor(_,C,M){super(),this._document=_,this._parentElement=C,this._optionsService=M,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 v extends y{constructor(_){super(),this._optionsService=_,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 _=this._ctx.measureText("W");return this._validateAndSet(_.width,_.fontBoundingBoxAscent+_.fontBoundingBoxDescent),this._result}}},4269:function(c,o,h){var u=this&&this.__decorate||function(v,x,_,C){var M,T=arguments.length,R=T<3?x:C===null?C=Object.getOwnPropertyDescriptor(x,_):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(v,x,_,C);else for(var P=v.length-1;P>=0;P--)(M=v[P])&&(R=(T<3?M(R):T>3?M(x,_,R):M(x,_))||R);return T>3&&R&&Object.defineProperty(x,_,R),R},p=this&&this.__param||function(v,x){return function(_,C){x(_,C,v)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CharacterJoinerService=o.JoinedCellData=void 0;const d=h(3734),g=h(643),w=h(511),S=h(2585);class y extends d.AttributeData{constructor(x,_,C){super(),this.content=0,this.combinedData="",this.fg=x.fg,this.bg=x.bg,this.combinedData=_,this._width=C}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(x){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}o.JoinedCellData=y;let m=o.CharacterJoinerService=class gw{constructor(x){this._bufferService=x,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new w.CellData}register(x){const _={id:this._nextCharacterJoinerId++,handler:x};return this._characterJoiners.push(_),_.id}deregister(x){for(let _=0;_<this._characterJoiners.length;_++)if(this._characterJoiners[_].id===x)return this._characterJoiners.splice(_,1),!0;return!1}getJoinedCharacters(x){if(this._characterJoiners.length===0)return[];const _=this._bufferService.buffer.lines.get(x);if(!_||_.length===0)return[];const C=[],M=_.translateToString(!0);let T=0,R=0,P=0,L=_.getFg(0),j=_.getBg(0);for(let $=0;$<_.getTrimmedLength();$++)if(_.loadCell($,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==L||this._workCell.bg!==j){if($-T>1){const U=this._getJoinedRanges(M,P,R,_,T);for(let z=0;z<U.length;z++)C.push(U[z])}T=$,P=R,L=this._workCell.fg,j=this._workCell.bg}R+=this._workCell.getChars().length||g.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-T>1){const $=this._getJoinedRanges(M,P,R,_,T);for(let U=0;U<$.length;U++)C.push($[U])}return C}_getJoinedRanges(x,_,C,M,T){const R=x.substring(_,C);let P=[];try{P=this._characterJoiners[0].handler(R)}catch(L){console.error(L)}for(let L=1;L<this._characterJoiners.length;L++)try{const j=this._characterJoiners[L].handler(R);for(let $=0;$<j.length;$++)gw._mergeRanges(P,j[$])}catch(j){console.error(j)}return this._stringRangesToCellRanges(P,M,T),P}_stringRangesToCellRanges(x,_,C){let M=0,T=!1,R=0,P=x[M];if(P){for(let L=C;L<this._bufferService.cols;L++){const j=_.getWidth(L),$=_.getString(L).length||g.WHITESPACE_CELL_CHAR.length;if(j!==0){if(!T&&P[0]<=R&&(P[0]=L,T=!0),P[1]<=R){if(P[1]=L,P=x[++M],!P)break;P[0]<=R?(P[0]=L,T=!0):T=!1}R+=$}}P&&(P[1]=this._bufferService.cols)}}static _mergeRanges(x,_){let C=!1;for(let M=0;M<x.length;M++){const T=x[M];if(C){if(_[1]<=T[0])return x[M-1][1]=_[1],x;if(_[1]<=T[1])return x[M-1][1]=Math.max(_[1],T[1]),x.splice(M,1),x;x.splice(M,1),M--}else{if(_[1]<=T[0])return x.splice(M,0,_),x;if(_[1]<=T[1])return T[0]=Math.min(_[0],T[0]),x;_[0]<T[1]&&(T[0]=Math.min(_[0],T[0]),C=!0)}}return C?x[x.length-1][1]=_[1]:x.push(_),x}};o.CharacterJoinerService=m=u([p(0,S.IBufferService)],m)},5114:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CoreBrowserService=void 0;const u=h(844),p=h(8460),d=h(3656);class g extends u.Disposable{constructor(y,m,v){super(),this._textarea=y,this._window=m,this.mainDocument=v,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new w(this._window),this._onDprChange=this.register(new p.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new p.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((x=>this._screenDprMonitor.setWindow(x)))),this.register((0,p.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(y){this._window!==y&&(this._window=y,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 w extends u.Disposable{constructor(y){super(),this._parentWindow=y,this._windowResizeListener=this.register(new u.MutableDisposable),this._onDprChange=this.register(new p.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(y){this._parentWindow=y,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 y;this._outerListener&&((y=this._resolutionMediaMatchList)==null||y.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 p 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 w=this.linkProviders.indexOf(g);w!==-1&&this.linkProviders.splice(w,1)}}}}o.LinkProviderService=p},8934:function(c,o,h){var u=this&&this.__decorate||function(S,y,m,v){var x,_=arguments.length,C=_<3?y:v===null?v=Object.getOwnPropertyDescriptor(y,m):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(S,y,m,v);else for(var M=S.length-1;M>=0;M--)(x=S[M])&&(C=(_<3?x(C):_>3?x(y,m,C):x(y,m))||C);return _>3&&C&&Object.defineProperty(y,m,C),C},p=this&&this.__param||function(S,y){return function(m,v){y(m,v,S)}};Object.defineProperty(o,"__esModule",{value:!0}),o.MouseService=void 0;const d=h(4725),g=h(9806);let w=o.MouseService=class{constructor(S,y){this._renderService=S,this._charSizeService=y}getCoords(S,y,m,v,x){return(0,g.getCoords)(window,S,y,m,v,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,x)}getMouseReportCoords(S,y){const m=(0,g.getCoordsRelativeToElement)(window,S,y);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=w=u([p(0,d.IRenderService),p(1,d.ICharSizeService)],w)},3230:function(c,o,h){var u=this&&this.__decorate||function(x,_,C,M){var T,R=arguments.length,P=R<3?_:M===null?M=Object.getOwnPropertyDescriptor(_,C):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")P=Reflect.decorate(x,_,C,M);else for(var L=x.length-1;L>=0;L--)(T=x[L])&&(P=(R<3?T(P):R>3?T(_,C,P):T(_,C))||P);return R>3&&P&&Object.defineProperty(_,C,P),P},p=this&&this.__param||function(x,_){return function(C,M){_(C,M,x)}};Object.defineProperty(o,"__esModule",{value:!0}),o.RenderService=void 0;const d=h(6193),g=h(4725),w=h(8460),S=h(844),y=h(7226),m=h(2585);let v=o.RenderService=class extends S.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(x,_,C,M,T,R,P,L){super(),this._rowCount=x,this._charSizeService=M,this._renderer=this.register(new S.MutableDisposable),this._pausedResizeTask=new y.DebouncedIdleTask,this._observerDisposable=this.register(new S.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 w.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new w.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new w.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new w.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new d.RenderDebouncer(((j,$)=>this._renderRows(j,$)),P),this.register(this._renderDebouncer),this.register(P.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(R.onResize((()=>this._fullRefresh()))),this.register(R.buffers.onBufferActivate((()=>{var j;return(j=this._renderer.value)==null?void 0:j.clear()}))),this.register(C.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(T.onDecorationRegistered((()=>this._fullRefresh()))),this.register(T.onDecorationRemoved((()=>this._fullRefresh()))),this.register(C.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(R.cols,R.rows),this._fullRefresh()}))),this.register(C.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(R.buffer.y,R.buffer.y,!0)))),this.register(L.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(P.window,_),this.register(P.onWindowChange((j=>this._registerIntersectionObserver(j,_))))}_registerIntersectionObserver(x,_){if("IntersectionObserver"in x){const C=new x.IntersectionObserver((M=>this._handleIntersectionChange(M[M.length-1])),{threshold:0});C.observe(_),this._observerDisposable.value=(0,S.toDisposable)((()=>C.disconnect()))}}_handleIntersectionChange(x){this._isPaused=x.isIntersecting===void 0?x.intersectionRatio===0:!x.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(x,_,C=!1){this._isPaused?this._needsFullRefresh=!0:(C||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(x,_,this._rowCount))}_renderRows(x,_){this._renderer.value&&(x=Math.min(x,this._rowCount-1),_=Math.min(_,this._rowCount-1),this._renderer.value.renderRows(x,_),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:x,end:_}),this._onRender.fire({start:x,end:_}),this._isNextRenderRedrawOnly=!0)}resize(x,_){this._rowCount=_,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(x){this._renderer.value=x,this._renderer.value&&(this._renderer.value.onRequestRedraw((_=>this.refreshRows(_.start,_.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(x){return this._renderDebouncer.addRefreshCallback(x)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var x,_;this._renderer.value&&((_=(x=this._renderer.value).clearTextureAtlas)==null||_.call(x),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(x,_){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var C;return(C=this._renderer.value)==null?void 0:C.handleResize(x,_)})):this._renderer.value.handleResize(x,_),this._fullRefresh())}handleCharSizeChanged(){var x;(x=this._renderer.value)==null||x.handleCharSizeChanged()}handleBlur(){var x;(x=this._renderer.value)==null||x.handleBlur()}handleFocus(){var x;(x=this._renderer.value)==null||x.handleFocus()}handleSelectionChanged(x,_,C){var M;this._selectionState.start=x,this._selectionState.end=_,this._selectionState.columnSelectMode=C,(M=this._renderer.value)==null||M.handleSelectionChanged(x,_,C)}handleCursorMove(){var x;(x=this._renderer.value)==null||x.handleCursorMove()}clear(){var x;(x=this._renderer.value)==null||x.clear()}};o.RenderService=v=u([p(2,m.IOptionsService),p(3,g.ICharSizeService),p(4,m.IDecorationService),p(5,m.IBufferService),p(6,g.ICoreBrowserService),p(7,g.IThemeService)],v)},9312:function(c,o,h){var u=this&&this.__decorate||function(P,L,j,$){var U,z=arguments.length,Y=z<3?L:$===null?$=Object.getOwnPropertyDescriptor(L,j):$;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Y=Reflect.decorate(P,L,j,$);else for(var re=P.length-1;re>=0;re--)(U=P[re])&&(Y=(z<3?U(Y):z>3?U(L,j,Y):U(L,j))||Y);return z>3&&Y&&Object.defineProperty(L,j,Y),Y},p=this&&this.__param||function(P,L){return function(j,$){L(j,$,P)}};Object.defineProperty(o,"__esModule",{value:!0}),o.SelectionService=void 0;const d=h(9806),g=h(9504),w=h(456),S=h(4725),y=h(8460),m=h(844),v=h(6114),x=h(4841),_=h(511),C=h(2585),M=" ",T=new RegExp(M,"g");let R=o.SelectionService=class extends m.Disposable{constructor(P,L,j,$,U,z,Y,re,Q){super(),this._element=P,this._screenElement=L,this._linkifier=j,this._bufferService=$,this._coreService=U,this._mouseService=z,this._optionsService=Y,this._renderService=re,this._coreBrowserService=Q,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new _.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new y.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new y.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new y.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new y.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 w.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 P=this._model.finalSelectionStart,L=this._model.finalSelectionEnd;return!(!P||!L||P[0]===L[0]&&P[1]===L[1])}get selectionText(){const P=this._model.finalSelectionStart,L=this._model.finalSelectionEnd;if(!P||!L)return"";const j=this._bufferService.buffer,$=[];if(this._activeSelectionMode===3){if(P[0]===L[0])return"";const U=P[0]<L[0]?P[0]:L[0],z=P[0]<L[0]?L[0]:P[0];for(let Y=P[1];Y<=L[1];Y++){const re=j.translateBufferLineToString(Y,!0,U,z);$.push(re)}}else{const U=P[1]===L[1]?L[0]:void 0;$.push(j.translateBufferLineToString(P[1],!0,P[0],U));for(let z=P[1]+1;z<=L[1]-1;z++){const Y=j.lines.get(z),re=j.translateBufferLineToString(z,!0);Y!=null&&Y.isWrapped?$[$.length-1]+=re:$.push(re)}if(P[1]!==L[1]){const z=j.lines.get(L[1]),Y=j.translateBufferLineToString(L[1],!0,0,L[0]);z&&z.isWrapped?$[$.length-1]+=Y:$.push(Y)}}return $.map((U=>U.replace(T," "))).join(v.isWindows?`\r
|
|
304
|
+
`:`
|
|
305
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(P){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),v.isLinux&&P&&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(P){const L=this._getMouseBufferCoords(P),j=this._model.finalSelectionStart,$=this._model.finalSelectionEnd;return!!(j&&$&&L)&&this._areCoordsInSelection(L,j,$)}isCellInSelection(P,L){const j=this._model.finalSelectionStart,$=this._model.finalSelectionEnd;return!(!j||!$)&&this._areCoordsInSelection([P,L],j,$)}_areCoordsInSelection(P,L,j){return P[1]>L[1]&&P[1]<j[1]||L[1]===j[1]&&P[1]===L[1]&&P[0]>=L[0]&&P[0]<j[0]||L[1]<j[1]&&P[1]===j[1]&&P[0]<j[0]||L[1]<j[1]&&P[1]===L[1]&&P[0]>=L[0]}_selectWordAtCursor(P,L){var U,z;const j=(z=(U=this._linkifier.currentLink)==null?void 0:U.link)==null?void 0:z.range;if(j)return this._model.selectionStart=[j.start.x-1,j.start.y-1],this._model.selectionStartLength=(0,x.getRangeLength)(j,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const $=this._getMouseBufferCoords(P);return!!$&&(this._selectWordAt($,L),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(P,L){this._model.clearSelection(),P=Math.max(P,0),L=Math.min(L,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,P],this._model.selectionEnd=[this._bufferService.cols,L],this.refresh(),this._onSelectionChange.fire()}_handleTrim(P){this._model.handleTrim(P)&&this.refresh()}_getMouseBufferCoords(P){const L=this._mouseService.getCoords(P,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(L)return L[0]--,L[1]--,L[1]+=this._bufferService.buffer.ydisp,L}_getMouseEventScrollAmount(P){let L=(0,d.getCoordsRelativeToElement)(this._coreBrowserService.window,P,this._screenElement)[1];const j=this._renderService.dimensions.css.canvas.height;return L>=0&&L<=j?0:(L>j&&(L-=j),L=Math.min(Math.max(L,-50),50),L/=50,L/Math.abs(L)+Math.round(14*L))}shouldForceSelection(P){return v.isMac?P.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:P.shiftKey}handleMouseDown(P){if(this._mouseDownTimeStamp=P.timeStamp,(P.button!==2||!this.hasSelection)&&P.button===0){if(!this._enabled){if(!this.shouldForceSelection(P))return;P.stopPropagation()}P.preventDefault(),this._dragScrollAmount=0,this._enabled&&P.shiftKey?this._handleIncrementalClick(P):P.detail===1?this._handleSingleClick(P):P.detail===2?this._handleDoubleClick(P):P.detail===3&&this._handleTripleClick(P),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(P){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(P))}_handleSingleClick(P){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(P)?3:0,this._model.selectionStart=this._getMouseBufferCoords(P),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const L=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);L&&L.length!==this._model.selectionStart[0]&&L.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(P){this._selectWordAtCursor(P,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(P){const L=this._getMouseBufferCoords(P);L&&(this._activeSelectionMode=2,this._selectLineAt(L[1]))}shouldColumnSelect(P){return P.altKey&&!(v.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(P){if(P.stopImmediatePropagation(),!this._model.selectionStart)return;const L=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(P),!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(P),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const j=this._bufferService.buffer;if(this._model.selectionEnd[1]<j.lines.length){const $=j.lines.get(this._model.selectionEnd[1]);$&&$.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}L&&L[0]===this._model.selectionEnd[0]&&L[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 P=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(P.ydisp+this._bufferService.rows,P.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=P.ydisp),this.refresh()}}_handleMouseUp(P){const L=P.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&L<500&&P.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const j=this._mouseService.getCoords(P,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(j&&j[0]!==void 0&&j[1]!==void 0){const $=(0,g.moveToCellSequence)(j[0]-1,j[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent($,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const P=this._model.finalSelectionStart,L=this._model.finalSelectionEnd,j=!(!P||!L||P[0]===L[0]&&P[1]===L[1]);j?P&&L&&(this._oldSelectionStart&&this._oldSelectionEnd&&P[0]===this._oldSelectionStart[0]&&P[1]===this._oldSelectionStart[1]&&L[0]===this._oldSelectionEnd[0]&&L[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(P,L,j)):this._oldHasSelection&&this._fireOnSelectionChange(P,L,j)}_fireOnSelectionChange(P,L,j){this._oldSelectionStart=P,this._oldSelectionEnd=L,this._oldHasSelection=j,this._onSelectionChange.fire()}_handleBufferActivate(P){this.clearSelection(),this._trimListener.dispose(),this._trimListener=P.activeBuffer.lines.onTrim((L=>this._handleTrim(L)))}_convertViewportColToCharacterIndex(P,L){let j=L;for(let $=0;L>=$;$++){const U=P.loadCell($,this._workCell).getChars().length;this._workCell.getWidth()===0?j--:U>1&&L!==$&&(j+=U-1)}return j}setSelection(P,L,j){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[P,L],this._model.selectionStartLength=j,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(P){this._isClickInSelection(P)||(this._selectWordAtCursor(P,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(P,L,j=!0,$=!0){if(P[0]>=this._bufferService.cols)return;const U=this._bufferService.buffer,z=U.lines.get(P[1]);if(!z)return;const Y=U.translateBufferLineToString(P[1],!1);let re=this._convertViewportColToCharacterIndex(z,P[0]),Q=re;const J=P[0]-re;let K=0,D=0,N=0,B=0;if(Y.charAt(re)===" "){for(;re>0&&Y.charAt(re-1)===" ";)re--;for(;Q<Y.length&&Y.charAt(Q+1)===" ";)Q++}else{let ne=P[0],he=P[0];z.getWidth(ne)===0&&(K++,ne--),z.getWidth(he)===2&&(D++,he++);const ae=z.getString(he).length;for(ae>1&&(B+=ae-1,Q+=ae-1);ne>0&&re>0&&!this._isCharWordSeparator(z.loadCell(ne-1,this._workCell));){z.loadCell(ne-1,this._workCell);const V=this._workCell.getChars().length;this._workCell.getWidth()===0?(K++,ne--):V>1&&(N+=V-1,re-=V-1),re--,ne--}for(;he<z.length&&Q+1<Y.length&&!this._isCharWordSeparator(z.loadCell(he+1,this._workCell));){z.loadCell(he+1,this._workCell);const V=this._workCell.getChars().length;this._workCell.getWidth()===2?(D++,he++):V>1&&(B+=V-1,Q+=V-1),Q++,he++}}Q++;let F=re+J-K+N,Z=Math.min(this._bufferService.cols,Q-re+K+D-N-B);if(L||Y.slice(re,Q).trim()!==""){if(j&&F===0&&z.getCodePoint(0)!==32){const ne=U.lines.get(P[1]-1);if(ne&&z.isWrapped&&ne.getCodePoint(this._bufferService.cols-1)!==32){const he=this._getWordAt([this._bufferService.cols-1,P[1]-1],!1,!0,!1);if(he){const ae=this._bufferService.cols-he.start;F-=ae,Z+=ae}}}if($&&F+Z===this._bufferService.cols&&z.getCodePoint(this._bufferService.cols-1)!==32){const ne=U.lines.get(P[1]+1);if(ne!=null&&ne.isWrapped&&ne.getCodePoint(0)!==32){const he=this._getWordAt([0,P[1]+1],!1,!1,!0);he&&(Z+=he.length)}}return{start:F,length:Z}}}_selectWordAt(P,L){const j=this._getWordAt(P,L);if(j){for(;j.start<0;)j.start+=this._bufferService.cols,P[1]--;this._model.selectionStart=[j.start,P[1]],this._model.selectionStartLength=j.length}}_selectToWordAt(P){const L=this._getWordAt(P,!0);if(L){let j=P[1];for(;L.start<0;)L.start+=this._bufferService.cols,j--;if(!this._model.areSelectionValuesReversed())for(;L.start+L.length>this._bufferService.cols;)L.length-=this._bufferService.cols,j++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?L.start:L.start+L.length,j]}}_isCharWordSeparator(P){return P.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(P.getChars())>=0}_selectLineAt(P){const L=this._bufferService.buffer.getWrappedRangeForLine(P),j={start:{x:0,y:L.first},end:{x:this._bufferService.cols-1,y:L.last}};this._model.selectionStart=[0,L.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,x.getRangeLength)(j,this._bufferService.cols)}};o.SelectionService=R=u([p(3,C.IBufferService),p(4,C.ICoreService),p(5,S.IMouseService),p(6,C.IOptionsService),p(7,S.IRenderService),p(8,S.ICoreBrowserService)],R)},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(R,P,L,j){var $,U=arguments.length,z=U<3?P:j===null?j=Object.getOwnPropertyDescriptor(P,L):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")z=Reflect.decorate(R,P,L,j);else for(var Y=R.length-1;Y>=0;Y--)($=R[Y])&&(z=(U<3?$(z):U>3?$(P,L,z):$(P,L))||z);return U>3&&z&&Object.defineProperty(P,L,z),z},p=this&&this.__param||function(R,P){return function(L,j){P(L,j,R)}};Object.defineProperty(o,"__esModule",{value:!0}),o.ThemeService=o.DEFAULT_ANSI_COLORS=void 0;const d=h(7239),g=h(8055),w=h(8460),S=h(844),y=h(2585),m=g.css.toColor("#ffffff"),v=g.css.toColor("#000000"),x=g.css.toColor("#ffffff"),_=g.css.toColor("#000000"),C={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};o.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const R=[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")],P=[0,95,135,175,215,255];for(let L=0;L<216;L++){const j=P[L/36%6|0],$=P[L/6%6|0],U=P[L%6];R.push({css:g.channels.toCss(j,$,U),rgba:g.channels.toRgba(j,$,U)})}for(let L=0;L<24;L++){const j=8+10*L;R.push({css:g.channels.toCss(j,j,j),rgba:g.channels.toRgba(j,j,j)})}return R})());let M=o.ThemeService=class extends S.Disposable{get colors(){return this._colors}constructor(R){super(),this._optionsService=R,this._contrastCache=new d.ColorContrastCache,this._halfContrastCache=new d.ColorContrastCache,this._onChangeColors=this.register(new w.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:m,background:v,cursor:x,cursorAccent:_,selectionForeground:void 0,selectionBackgroundTransparent:C,selectionBackgroundOpaque:g.color.blend(v,C),selectionInactiveBackgroundTransparent:C,selectionInactiveBackgroundOpaque:g.color.blend(v,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(R={}){const P=this._colors;if(P.foreground=T(R.foreground,m),P.background=T(R.background,v),P.cursor=T(R.cursor,x),P.cursorAccent=T(R.cursorAccent,_),P.selectionBackgroundTransparent=T(R.selectionBackground,C),P.selectionBackgroundOpaque=g.color.blend(P.background,P.selectionBackgroundTransparent),P.selectionInactiveBackgroundTransparent=T(R.selectionInactiveBackground,P.selectionBackgroundTransparent),P.selectionInactiveBackgroundOpaque=g.color.blend(P.background,P.selectionInactiveBackgroundTransparent),P.selectionForeground=R.selectionForeground?T(R.selectionForeground,g.NULL_COLOR):void 0,P.selectionForeground===g.NULL_COLOR&&(P.selectionForeground=void 0),g.color.isOpaque(P.selectionBackgroundTransparent)&&(P.selectionBackgroundTransparent=g.color.opacity(P.selectionBackgroundTransparent,.3)),g.color.isOpaque(P.selectionInactiveBackgroundTransparent)&&(P.selectionInactiveBackgroundTransparent=g.color.opacity(P.selectionInactiveBackgroundTransparent,.3)),P.ansi=o.DEFAULT_ANSI_COLORS.slice(),P.ansi[0]=T(R.black,o.DEFAULT_ANSI_COLORS[0]),P.ansi[1]=T(R.red,o.DEFAULT_ANSI_COLORS[1]),P.ansi[2]=T(R.green,o.DEFAULT_ANSI_COLORS[2]),P.ansi[3]=T(R.yellow,o.DEFAULT_ANSI_COLORS[3]),P.ansi[4]=T(R.blue,o.DEFAULT_ANSI_COLORS[4]),P.ansi[5]=T(R.magenta,o.DEFAULT_ANSI_COLORS[5]),P.ansi[6]=T(R.cyan,o.DEFAULT_ANSI_COLORS[6]),P.ansi[7]=T(R.white,o.DEFAULT_ANSI_COLORS[7]),P.ansi[8]=T(R.brightBlack,o.DEFAULT_ANSI_COLORS[8]),P.ansi[9]=T(R.brightRed,o.DEFAULT_ANSI_COLORS[9]),P.ansi[10]=T(R.brightGreen,o.DEFAULT_ANSI_COLORS[10]),P.ansi[11]=T(R.brightYellow,o.DEFAULT_ANSI_COLORS[11]),P.ansi[12]=T(R.brightBlue,o.DEFAULT_ANSI_COLORS[12]),P.ansi[13]=T(R.brightMagenta,o.DEFAULT_ANSI_COLORS[13]),P.ansi[14]=T(R.brightCyan,o.DEFAULT_ANSI_COLORS[14]),P.ansi[15]=T(R.brightWhite,o.DEFAULT_ANSI_COLORS[15]),R.extendedAnsi){const L=Math.min(P.ansi.length-16,R.extendedAnsi.length);for(let j=0;j<L;j++)P.ansi[j+16]=T(R.extendedAnsi[j],o.DEFAULT_ANSI_COLORS[j+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(R){this._restoreColor(R),this._onChangeColors.fire(this.colors)}_restoreColor(R){if(R!==void 0)switch(R){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[R]=this._restoreColors.ansi[R]}else for(let P=0;P<this._restoreColors.ansi.length;++P)this._colors.ansi[P]=this._restoreColors.ansi[P]}modifyColors(R){R(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 T(R,P){if(R!==void 0)try{return g.css.toColor(R)}catch{}return P}o.ThemeService=M=u([p(0,y.IOptionsService)],M)},6349:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CircularList=void 0;const u=h(8460),p=h(844);class d extends p.Disposable{constructor(w){super(),this._maxLength=w,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(w){if(this._maxLength===w)return;const S=new Array(w);for(let y=0;y<Math.min(w,this.length);y++)S[y]=this._array[this._getCyclicIndex(y)];this._array=S,this._maxLength=w,this._startIndex=0}get length(){return this._length}set length(w){if(w>this._length)for(let S=this._length;S<w;S++)this._array[S]=void 0;this._length=w}get(w){return this._array[this._getCyclicIndex(w)]}set(w,S){this._array[this._getCyclicIndex(w)]=S}push(w){this._array[this._getCyclicIndex(this._length)]=w,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(w,S,...y){if(S){for(let m=w;m<this._length-S;m++)this._array[this._getCyclicIndex(m)]=this._array[this._getCyclicIndex(m+S)];this._length-=S,this.onDeleteEmitter.fire({index:w,amount:S})}for(let m=this._length-1;m>=w;m--)this._array[this._getCyclicIndex(m+y.length)]=this._array[this._getCyclicIndex(m)];for(let m=0;m<y.length;m++)this._array[this._getCyclicIndex(w+m)]=y[m];if(y.length&&this.onInsertEmitter.fire({index:w,amount:y.length}),this._length+y.length>this._maxLength){const m=this._length+y.length-this._maxLength;this._startIndex+=m,this._length=this._maxLength,this.onTrimEmitter.fire(m)}else this._length+=y.length}trimStart(w){w>this._length&&(w=this._length),this._startIndex+=w,this._length-=w,this.onTrimEmitter.fire(w)}shiftElements(w,S,y){if(!(S<=0)){if(w<0||w>=this._length)throw new Error("start argument out of range");if(w+y<0)throw new Error("Cannot shift elements in list beyond index 0");if(y>0){for(let v=S-1;v>=0;v--)this.set(w+v+y,this.get(w+v));const m=w+S+y-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<S;m++)this.set(w+m+y,this.get(w+m))}}_getCyclicIndex(w){return(this._startIndex+w)%this._maxLength}}o.CircularList=d},1439:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.clone=void 0,o.clone=function h(u,p=5){if(typeof u!="object")return u;const d=Array.isArray(u)?[]:{};for(const g in u)d[g]=p<=1?u[g]:u[g]&&h(u[g],p-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,p=0,d=0;var g,w,S,y,m;function v(_){const C=_.toString(16);return C.length<2?"0"+C:C}function x(_,C){return _<C?(C+.05)/(_+.05):(_+.05)/(C+.05)}o.NULL_COLOR={css:"#00000000",rgba:0},(function(_){_.toCss=function(C,M,T,R){return R!==void 0?`#${v(C)}${v(M)}${v(T)}${v(R)}`:`#${v(C)}${v(M)}${v(T)}`},_.toRgba=function(C,M,T,R=255){return(C<<24|M<<16|T<<8|R)>>>0},_.toColor=function(C,M,T,R){return{css:_.toCss(C,M,T,R),rgba:_.toRgba(C,M,T,R)}}})(g||(o.channels=g={})),(function(_){function C(M,T){return d=Math.round(255*T),[h,u,p]=m.toChannels(M.rgba),{css:g.toCss(h,u,p,d),rgba:g.toRgba(h,u,p,d)}}_.blend=function(M,T){if(d=(255&T.rgba)/255,d===1)return{css:T.css,rgba:T.rgba};const R=T.rgba>>24&255,P=T.rgba>>16&255,L=T.rgba>>8&255,j=M.rgba>>24&255,$=M.rgba>>16&255,U=M.rgba>>8&255;return h=j+Math.round((R-j)*d),u=$+Math.round((P-$)*d),p=U+Math.round((L-U)*d),{css:g.toCss(h,u,p),rgba:g.toRgba(h,u,p)}},_.isOpaque=function(M){return(255&M.rgba)==255},_.ensureContrastRatio=function(M,T,R){const P=m.ensureContrastRatio(M.rgba,T.rgba,R);if(P)return g.toColor(P>>24&255,P>>16&255,P>>8&255)},_.opaque=function(M){const T=(255|M.rgba)>>>0;return[h,u,p]=m.toChannels(T),{css:g.toCss(h,u,p),rgba:T}},_.opacity=C,_.multiplyOpacity=function(M,T){return d=255&M.rgba,C(M,d*T/255)},_.toColorRGB=function(M){return[M.rgba>>24&255,M.rgba>>16&255,M.rgba>>8&255]}})(w||(o.color=w={})),(function(_){let C,M;try{const T=document.createElement("canvas");T.width=1,T.height=1;const R=T.getContext("2d",{willReadFrequently:!0});R&&(C=R,C.globalCompositeOperation="copy",M=C.createLinearGradient(0,0,1,1))}catch{}_.toColor=function(T){if(T.match(/#[\da-f]{3,8}/i))switch(T.length){case 4:return h=parseInt(T.slice(1,2).repeat(2),16),u=parseInt(T.slice(2,3).repeat(2),16),p=parseInt(T.slice(3,4).repeat(2),16),g.toColor(h,u,p);case 5:return h=parseInt(T.slice(1,2).repeat(2),16),u=parseInt(T.slice(2,3).repeat(2),16),p=parseInt(T.slice(3,4).repeat(2),16),d=parseInt(T.slice(4,5).repeat(2),16),g.toColor(h,u,p,d);case 7:return{css:T,rgba:(parseInt(T.slice(1),16)<<8|255)>>>0};case 9:return{css:T,rgba:parseInt(T.slice(1),16)>>>0}}const R=T.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(R)return h=parseInt(R[1]),u=parseInt(R[2]),p=parseInt(R[3]),d=Math.round(255*(R[5]===void 0?1:parseFloat(R[5]))),g.toColor(h,u,p,d);if(!C||!M)throw new Error("css.toColor: Unsupported css format");if(C.fillStyle=M,C.fillStyle=T,typeof C.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(C.fillRect(0,0,1,1),[h,u,p,d]=C.getImageData(0,0,1,1).data,d!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:g.toRgba(h,u,p,d),css:T}}})(S||(o.css=S={})),(function(_){function C(M,T,R){const P=M/255,L=T/255,j=R/255;return .2126*(P<=.03928?P/12.92:Math.pow((P+.055)/1.055,2.4))+.7152*(L<=.03928?L/12.92:Math.pow((L+.055)/1.055,2.4))+.0722*(j<=.03928?j/12.92:Math.pow((j+.055)/1.055,2.4))}_.relativeLuminance=function(M){return C(M>>16&255,M>>8&255,255&M)},_.relativeLuminance2=C})(y||(o.rgb=y={})),(function(_){function C(T,R,P){const L=T>>24&255,j=T>>16&255,$=T>>8&255;let U=R>>24&255,z=R>>16&255,Y=R>>8&255,re=x(y.relativeLuminance2(U,z,Y),y.relativeLuminance2(L,j,$));for(;re<P&&(U>0||z>0||Y>0);)U-=Math.max(0,Math.ceil(.1*U)),z-=Math.max(0,Math.ceil(.1*z)),Y-=Math.max(0,Math.ceil(.1*Y)),re=x(y.relativeLuminance2(U,z,Y),y.relativeLuminance2(L,j,$));return(U<<24|z<<16|Y<<8|255)>>>0}function M(T,R,P){const L=T>>24&255,j=T>>16&255,$=T>>8&255;let U=R>>24&255,z=R>>16&255,Y=R>>8&255,re=x(y.relativeLuminance2(U,z,Y),y.relativeLuminance2(L,j,$));for(;re<P&&(U<255||z<255||Y<255);)U=Math.min(255,U+Math.ceil(.1*(255-U))),z=Math.min(255,z+Math.ceil(.1*(255-z))),Y=Math.min(255,Y+Math.ceil(.1*(255-Y))),re=x(y.relativeLuminance2(U,z,Y),y.relativeLuminance2(L,j,$));return(U<<24|z<<16|Y<<8|255)>>>0}_.blend=function(T,R){if(d=(255&R)/255,d===1)return R;const P=R>>24&255,L=R>>16&255,j=R>>8&255,$=T>>24&255,U=T>>16&255,z=T>>8&255;return h=$+Math.round((P-$)*d),u=U+Math.round((L-U)*d),p=z+Math.round((j-z)*d),g.toRgba(h,u,p)},_.ensureContrastRatio=function(T,R,P){const L=y.relativeLuminance(T>>8),j=y.relativeLuminance(R>>8);if(x(L,j)<P){if(j<L){const z=C(T,R,P),Y=x(L,y.relativeLuminance(z>>8));if(Y<P){const re=M(T,R,P);return Y>x(L,y.relativeLuminance(re>>8))?z:re}return z}const $=M(T,R,P),U=x(L,y.relativeLuminance($>>8));if(U<P){const z=C(T,R,P);return U>x(L,y.relativeLuminance(z>>8))?$:z}return $}},_.reduceLuminance=C,_.increaseLuminance=M,_.toChannels=function(T){return[T>>24&255,T>>16&255,T>>8&255,255&T]}})(m||(o.rgba=m={})),o.toPaddedHex=v,o.contrastRatio=x},8969:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CoreTerminal=void 0;const u=h(844),p=h(2585),d=h(4348),g=h(7866),w=h(744),S=h(7302),y=h(6975),m=h(8460),v=h(1753),x=h(1480),_=h(7994),C=h(9282),M=h(5435),T=h(5981),R=h(2660);let P=!1;class L extends u.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new m.EventEmitter),this._onScroll.event(($=>{var U;(U=this._onScrollApi)==null||U.fire($.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($){for(const U in $)this.optionsService.options[U]=$[U]}constructor($){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 S.OptionsService($)),this._instantiationService.setService(p.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(w.BufferService)),this._instantiationService.setService(p.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(g.LogService)),this._instantiationService.setService(p.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(y.CoreService)),this._instantiationService.setService(p.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(v.CoreMouseService)),this._instantiationService.setService(p.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(x.UnicodeService)),this._instantiationService.setService(p.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(_.CharsetService),this._instantiationService.setService(p.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(R.OscLinkService),this._instantiationService.setService(p.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new M.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((U=>{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((U=>{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 T.WriteBuffer(((U,z)=>this._inputHandler.parse(U,z)))),this.register((0,m.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write($,U){this._writeBuffer.write($,U)}writeSync($,U){this._logService.logLevel<=p.LogLevelEnum.WARN&&!P&&(this._logService.warn("writeSync is unreliable and will be removed soon."),P=!0),this._writeBuffer.writeSync($,U)}input($,U=!0){this.coreService.triggerDataEvent($,U)}resize($,U){isNaN($)||isNaN(U)||($=Math.max($,w.MINIMUM_COLS),U=Math.max(U,w.MINIMUM_ROWS),this._bufferService.resize($,U))}scroll($,U=!1){this._bufferService.scroll($,U)}scrollLines($,U,z){this._bufferService.scrollLines($,U,z)}scrollPages($){this.scrollLines($*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine($){const U=$-this._bufferService.buffer.ydisp;U!==0&&this.scrollLines(U)}registerEscHandler($,U){return this._inputHandler.registerEscHandler($,U)}registerDcsHandler($,U){return this._inputHandler.registerDcsHandler($,U)}registerCsiHandler($,U){return this._inputHandler.registerCsiHandler($,U)}registerOscHandler($,U){return this._inputHandler.registerOscHandler($,U)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let $=!1;const U=this.optionsService.rawOptions.windowsPty;U&&U.buildNumber!==void 0&&U.buildNumber!==void 0?$=U.backend==="conpty"&&U.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&($=!0),$?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const $=[];$.push(this.onLineFeed(C.updateWindowsModeWrappedState.bind(null,this._bufferService))),$.push(this.registerCsiHandler({final:"H"},(()=>((0,C.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,u.toDisposable)((()=>{for(const U of $)U.dispose()}))}}}o.CoreTerminal=L},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 p=[];for(let d=0;d<this._listeners.length;d++)p.push(this._listeners[d]);for(let d=0;d<p.length;d++)p[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((p=>u.fire(p)))},o.runAndSubscribe=function(h,u){return u(void 0),h((p=>u(p)))}},5435:function(c,o,h){var u=this&&this.__decorate||function(K,D,N,B){var F,Z=arguments.length,ne=Z<3?D:B===null?B=Object.getOwnPropertyDescriptor(D,N):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")ne=Reflect.decorate(K,D,N,B);else for(var he=K.length-1;he>=0;he--)(F=K[he])&&(ne=(Z<3?F(ne):Z>3?F(D,N,ne):F(D,N))||ne);return Z>3&&ne&&Object.defineProperty(D,N,ne),ne},p=this&&this.__param||function(K,D){return function(N,B){D(N,B,K)}};Object.defineProperty(o,"__esModule",{value:!0}),o.InputHandler=o.WindowsOptionsReportType=void 0;const d=h(2584),g=h(7116),w=h(2015),S=h(844),y=h(482),m=h(8437),v=h(8460),x=h(643),_=h(511),C=h(3734),M=h(2585),T=h(1480),R=h(6242),P=h(6351),L=h(5941),j={"(":0,")":1,"*":2,"+":3,"-":1,".":2},$=131072;function U(K,D){if(K>24)return D.setWinLines||!1;switch(K){case 1:return!!D.restoreWin;case 2:return!!D.minimizeWin;case 3:return!!D.setWinPosition;case 4:return!!D.setWinSizePixels;case 5:return!!D.raiseWin;case 6:return!!D.lowerWin;case 7:return!!D.refreshWin;case 8:return!!D.setWinSizeChars;case 9:return!!D.maximizeWin;case 10:return!!D.fullscreenWin;case 11:return!!D.getWinState;case 13:return!!D.getWinPosition;case 14:return!!D.getWinSizePixels;case 15:return!!D.getScreenSizePixels;case 16:return!!D.getCellSizePixels;case 18:return!!D.getWinSizeChars;case 19:return!!D.getScreenSizeChars;case 20:return!!D.getIconTitle;case 21:return!!D.getWinTitle;case 22:return!!D.pushTitle;case 23:return!!D.popTitle;case 24:return!!D.setWinLines}return!1}var z;(function(K){K[K.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",K[K.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(z||(o.WindowsOptionsReportType=z={}));let Y=0;class re extends S.Disposable{getAttrData(){return this._curAttrData}constructor(D,N,B,F,Z,ne,he,ae,V=new w.EscapeSequenceParser){super(),this._bufferService=D,this._charsetService=N,this._coreService=B,this._logService=F,this._optionsService=Z,this._oscLinkService=ne,this._coreMouseService=he,this._unicodeService=ae,this._parser=V,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new y.StringToUtf32,this._utf8Decoder=new y.Utf8ToUtf32,this._workCell=new _.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 v.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new v.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new v.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new v.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new v.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new v.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new v.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new v.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new v.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new v.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new v.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new v.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new v.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((O=>this._activeBuffer=O.activeBuffer))),this._parser.setCsiHandlerFallback(((O,ie)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(O),params:ie.toArray()})})),this._parser.setEscHandlerFallback((O=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(O)})})),this._parser.setExecuteHandlerFallback((O=>{this._logService.debug("Unknown EXECUTE code: ",{code:O})})),this._parser.setOscHandlerFallback(((O,ie,se)=>{this._logService.debug("Unknown OSC code: ",{identifier:O,action:ie,data:se})})),this._parser.setDcsHandlerFallback(((O,ie,se)=>{ie==="HOOK"&&(se=se.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(O),action:ie,payload:se})})),this._parser.setPrintHandler(((O,ie,se)=>this.print(O,ie,se))),this._parser.registerCsiHandler({final:"@"},(O=>this.insertChars(O))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(O=>this.scrollLeft(O))),this._parser.registerCsiHandler({final:"A"},(O=>this.cursorUp(O))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(O=>this.scrollRight(O))),this._parser.registerCsiHandler({final:"B"},(O=>this.cursorDown(O))),this._parser.registerCsiHandler({final:"C"},(O=>this.cursorForward(O))),this._parser.registerCsiHandler({final:"D"},(O=>this.cursorBackward(O))),this._parser.registerCsiHandler({final:"E"},(O=>this.cursorNextLine(O))),this._parser.registerCsiHandler({final:"F"},(O=>this.cursorPrecedingLine(O))),this._parser.registerCsiHandler({final:"G"},(O=>this.cursorCharAbsolute(O))),this._parser.registerCsiHandler({final:"H"},(O=>this.cursorPosition(O))),this._parser.registerCsiHandler({final:"I"},(O=>this.cursorForwardTab(O))),this._parser.registerCsiHandler({final:"J"},(O=>this.eraseInDisplay(O,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(O=>this.eraseInDisplay(O,!0))),this._parser.registerCsiHandler({final:"K"},(O=>this.eraseInLine(O,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(O=>this.eraseInLine(O,!0))),this._parser.registerCsiHandler({final:"L"},(O=>this.insertLines(O))),this._parser.registerCsiHandler({final:"M"},(O=>this.deleteLines(O))),this._parser.registerCsiHandler({final:"P"},(O=>this.deleteChars(O))),this._parser.registerCsiHandler({final:"S"},(O=>this.scrollUp(O))),this._parser.registerCsiHandler({final:"T"},(O=>this.scrollDown(O))),this._parser.registerCsiHandler({final:"X"},(O=>this.eraseChars(O))),this._parser.registerCsiHandler({final:"Z"},(O=>this.cursorBackwardTab(O))),this._parser.registerCsiHandler({final:"`"},(O=>this.charPosAbsolute(O))),this._parser.registerCsiHandler({final:"a"},(O=>this.hPositionRelative(O))),this._parser.registerCsiHandler({final:"b"},(O=>this.repeatPrecedingCharacter(O))),this._parser.registerCsiHandler({final:"c"},(O=>this.sendDeviceAttributesPrimary(O))),this._parser.registerCsiHandler({prefix:">",final:"c"},(O=>this.sendDeviceAttributesSecondary(O))),this._parser.registerCsiHandler({final:"d"},(O=>this.linePosAbsolute(O))),this._parser.registerCsiHandler({final:"e"},(O=>this.vPositionRelative(O))),this._parser.registerCsiHandler({final:"f"},(O=>this.hVPosition(O))),this._parser.registerCsiHandler({final:"g"},(O=>this.tabClear(O))),this._parser.registerCsiHandler({final:"h"},(O=>this.setMode(O))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(O=>this.setModePrivate(O))),this._parser.registerCsiHandler({final:"l"},(O=>this.resetMode(O))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(O=>this.resetModePrivate(O))),this._parser.registerCsiHandler({final:"m"},(O=>this.charAttributes(O))),this._parser.registerCsiHandler({final:"n"},(O=>this.deviceStatus(O))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(O=>this.deviceStatusPrivate(O))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(O=>this.softReset(O))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(O=>this.setCursorStyle(O))),this._parser.registerCsiHandler({final:"r"},(O=>this.setScrollRegion(O))),this._parser.registerCsiHandler({final:"s"},(O=>this.saveCursor(O))),this._parser.registerCsiHandler({final:"t"},(O=>this.windowOptions(O))),this._parser.registerCsiHandler({final:"u"},(O=>this.restoreCursor(O))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(O=>this.insertColumns(O))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(O=>this.deleteColumns(O))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(O=>this.selectProtected(O))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(O=>this.requestMode(O,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(O=>this.requestMode(O,!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 R.OscHandler((O=>(this.setTitle(O),this.setIconName(O),!0)))),this._parser.registerOscHandler(1,new R.OscHandler((O=>this.setIconName(O)))),this._parser.registerOscHandler(2,new R.OscHandler((O=>this.setTitle(O)))),this._parser.registerOscHandler(4,new R.OscHandler((O=>this.setOrReportIndexedColor(O)))),this._parser.registerOscHandler(8,new R.OscHandler((O=>this.setHyperlink(O)))),this._parser.registerOscHandler(10,new R.OscHandler((O=>this.setOrReportFgColor(O)))),this._parser.registerOscHandler(11,new R.OscHandler((O=>this.setOrReportBgColor(O)))),this._parser.registerOscHandler(12,new R.OscHandler((O=>this.setOrReportCursorColor(O)))),this._parser.registerOscHandler(104,new R.OscHandler((O=>this.restoreIndexedColor(O)))),this._parser.registerOscHandler(110,new R.OscHandler((O=>this.restoreFgColor(O)))),this._parser.registerOscHandler(111,new R.OscHandler((O=>this.restoreBgColor(O)))),this._parser.registerOscHandler(112,new R.OscHandler((O=>this.restoreCursorColor(O)))),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 O in g.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:O},(()=>this.selectCharset("("+O))),this._parser.registerEscHandler({intermediates:")",final:O},(()=>this.selectCharset(")"+O))),this._parser.registerEscHandler({intermediates:"*",final:O},(()=>this.selectCharset("*"+O))),this._parser.registerEscHandler({intermediates:"+",final:O},(()=>this.selectCharset("+"+O))),this._parser.registerEscHandler({intermediates:"-",final:O},(()=>this.selectCharset("-"+O))),this._parser.registerEscHandler({intermediates:".",final:O},(()=>this.selectCharset("."+O))),this._parser.registerEscHandler({intermediates:"/",final:O},(()=>this.selectCharset("/"+O)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((O=>(this._logService.error("Parsing error: ",O),O))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new P.DcsHandler(((O,ie)=>this.requestStatusString(O,ie))))}_preserveStack(D,N,B,F){this._parseStack.paused=!0,this._parseStack.cursorStartX=D,this._parseStack.cursorStartY=N,this._parseStack.decodedLength=B,this._parseStack.position=F}_logSlowResolvingAsync(D){this._logService.logLevel<=M.LogLevelEnum.WARN&&Promise.race([D,new Promise(((N,B)=>setTimeout((()=>B("#SLOW_TIMEOUT")),5e3)))]).catch((N=>{if(N!=="#SLOW_TIMEOUT")throw N;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(D,N){let B,F=this._activeBuffer.x,Z=this._activeBuffer.y,ne=0;const he=this._parseStack.paused;if(he){if(B=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,N))return this._logSlowResolvingAsync(B),B;F=this._parseStack.cursorStartX,Z=this._parseStack.cursorStartY,this._parseStack.paused=!1,D.length>$&&(ne=this._parseStack.position+$)}if(this._logService.logLevel<=M.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof D=="string"?` "${D}"`:` "${Array.prototype.map.call(D,(O=>String.fromCharCode(O))).join("")}"`),typeof D=="string"?D.split("").map((O=>O.charCodeAt(0))):D),this._parseBuffer.length<D.length&&this._parseBuffer.length<$&&(this._parseBuffer=new Uint32Array(Math.min(D.length,$))),he||this._dirtyRowTracker.clearRange(),D.length>$)for(let O=ne;O<D.length;O+=$){const ie=O+$<D.length?O+$:D.length,se=typeof D=="string"?this._stringDecoder.decode(D.substring(O,ie),this._parseBuffer):this._utf8Decoder.decode(D.subarray(O,ie),this._parseBuffer);if(B=this._parser.parse(this._parseBuffer,se))return this._preserveStack(F,Z,se,O),this._logSlowResolvingAsync(B),B}else if(!he){const O=typeof D=="string"?this._stringDecoder.decode(D,this._parseBuffer):this._utf8Decoder.decode(D,this._parseBuffer);if(B=this._parser.parse(this._parseBuffer,O))return this._preserveStack(F,Z,O,0),this._logSlowResolvingAsync(B),B}this._activeBuffer.x===F&&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(D,N,B){let F,Z;const ne=this._charsetService.charset,he=this._optionsService.rawOptions.screenReaderMode,ae=this._bufferService.cols,V=this._coreService.decPrivateModes.wraparound,O=this._coreService.modes.insertMode,ie=this._curAttrData;let se=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&B-N>0&&se.getWidth(this._activeBuffer.x-1)===2&&se.setCellFromCodepoint(this._activeBuffer.x-1,0,1,ie);let pe=this._parser.precedingJoinState;for(let fe=N;fe<B;++fe){if(F=D[fe],F<127&&ne){const pt=ne[String.fromCharCode(F)];pt&&(F=pt.charCodeAt(0))}const Ee=this._unicodeService.charProperties(F,pe);Z=T.UnicodeService.extractWidth(Ee);const Ie=T.UnicodeService.extractShouldJoin(Ee),je=Ie?T.UnicodeService.extractWidth(pe):0;if(pe=Ee,he&&this._onA11yChar.fire((0,y.stringFromCodePoint)(F)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+Z-je>ae){if(V){const pt=se;let Se=this._activeBuffer.x-je;for(this._activeBuffer.x=je,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),je>0&&se instanceof m.BufferLine&&se.copyCellsFrom(pt,Se,0,je,!1);Se<ae;)pt.setCellFromCodepoint(Se++,0,1,ie)}else if(this._activeBuffer.x=ae-1,Z===2)continue}if(Ie&&this._activeBuffer.x){const pt=se.getWidth(this._activeBuffer.x-1)?1:2;se.addCodepointToCell(this._activeBuffer.x-pt,F,Z);for(let Se=Z-je;--Se>=0;)se.setCellFromCodepoint(this._activeBuffer.x++,0,0,ie)}else if(O&&(se.insertCells(this._activeBuffer.x,Z-je,this._activeBuffer.getNullCell(ie)),se.getWidth(ae-1)===2&&se.setCellFromCodepoint(ae-1,x.NULL_CELL_CODE,x.NULL_CELL_WIDTH,ie)),se.setCellFromCodepoint(this._activeBuffer.x++,F,Z,ie),Z>0)for(;--Z;)se.setCellFromCodepoint(this._activeBuffer.x++,0,0,ie)}this._parser.precedingJoinState=pe,this._activeBuffer.x<ae&&B-N>0&&se.getWidth(this._activeBuffer.x)===0&&!se.hasContent(this._activeBuffer.x)&&se.setCellFromCodepoint(this._activeBuffer.x,0,1,ie),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(D,N){return D.final!=="t"||D.prefix||D.intermediates?this._parser.registerCsiHandler(D,N):this._parser.registerCsiHandler(D,(B=>!U(B.params[0],this._optionsService.rawOptions.windowOptions)||N(B)))}registerDcsHandler(D,N){return this._parser.registerDcsHandler(D,new P.DcsHandler(N))}registerEscHandler(D,N){return this._parser.registerEscHandler(D,N)}registerOscHandler(D,N){return this._parser.registerOscHandler(D,new R.OscHandler(N))}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 D;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&&((D=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&D.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const N=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);N.hasWidth(this._activeBuffer.x)&&!N.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const D=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-D),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(D=this._bufferService.cols-1){this._activeBuffer.x=Math.min(D,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(D,N){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=D,this._activeBuffer.y=this._activeBuffer.scrollTop+N):(this._activeBuffer.x=D,this._activeBuffer.y=N),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(D,N){this._restrictCursor(),this._setCursor(this._activeBuffer.x+D,this._activeBuffer.y+N)}cursorUp(D){const N=this._activeBuffer.y-this._activeBuffer.scrollTop;return N>=0?this._moveCursor(0,-Math.min(N,D.params[0]||1)):this._moveCursor(0,-(D.params[0]||1)),!0}cursorDown(D){const N=this._activeBuffer.scrollBottom-this._activeBuffer.y;return N>=0?this._moveCursor(0,Math.min(N,D.params[0]||1)):this._moveCursor(0,D.params[0]||1),!0}cursorForward(D){return this._moveCursor(D.params[0]||1,0),!0}cursorBackward(D){return this._moveCursor(-(D.params[0]||1),0),!0}cursorNextLine(D){return this.cursorDown(D),this._activeBuffer.x=0,!0}cursorPrecedingLine(D){return this.cursorUp(D),this._activeBuffer.x=0,!0}cursorCharAbsolute(D){return this._setCursor((D.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(D){return this._setCursor(D.length>=2?(D.params[1]||1)-1:0,(D.params[0]||1)-1),!0}charPosAbsolute(D){return this._setCursor((D.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(D){return this._moveCursor(D.params[0]||1,0),!0}linePosAbsolute(D){return this._setCursor(this._activeBuffer.x,(D.params[0]||1)-1),!0}vPositionRelative(D){return this._moveCursor(0,D.params[0]||1),!0}hVPosition(D){return this.cursorPosition(D),!0}tabClear(D){const N=D.params[0];return N===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:N===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(D){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let N=D.params[0]||1;for(;N--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(D){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let N=D.params[0]||1;for(;N--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(D){const N=D.params[0];return N===1&&(this._curAttrData.bg|=536870912),N!==2&&N!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(D,N,B,F=!1,Z=!1){const ne=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);ne.replaceCells(N,B,this._activeBuffer.getNullCell(this._eraseAttrData()),Z),F&&(ne.isWrapped=!1)}_resetBufferLine(D,N=!1){const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);B&&(B.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),N),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+D),B.isWrapped=!1)}eraseInDisplay(D,N=!1){let B;switch(this._restrictCursor(this._bufferService.cols),D.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,N);B<this._bufferService.rows;B++)this._resetBufferLine(B,N);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,N),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(B+1).isWrapped=!1);B--;)this._resetBufferLine(B,N);this._dirtyRowTracker.markDirty(0);break;case 2:for(B=this._bufferService.rows,this._dirtyRowTracker.markDirty(B-1);B--;)this._resetBufferLine(B,N);this._dirtyRowTracker.markDirty(0);break;case 3:const F=this._activeBuffer.lines.length-this._bufferService.rows;F>0&&(this._activeBuffer.lines.trimStart(F),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-F,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-F,0),this._onScroll.fire(0))}return!0}eraseInLine(D,N=!1){switch(this._restrictCursor(this._bufferService.cols),D.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,N);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,N);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,N)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(D){this._restrictCursor();let N=D.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,F=this._bufferService.rows-1-this._activeBuffer.scrollBottom,Z=this._bufferService.rows-1+this._activeBuffer.ybase-F+1;for(;N--;)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(D){this._restrictCursor();let N=D.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 F;for(F=this._bufferService.rows-1-this._activeBuffer.scrollBottom,F=this._bufferService.rows-1+this._activeBuffer.ybase-F;N--;)this._activeBuffer.lines.splice(B,1),this._activeBuffer.lines.splice(F,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(D){this._restrictCursor();const N=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return N&&(N.insertCells(this._activeBuffer.x,D.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(D){this._restrictCursor();const N=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return N&&(N.deleteCells(this._activeBuffer.x,D.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(D){let N=D.params[0]||1;for(;N--;)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(D){let N=D.params[0]||1;for(;N--;)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(D){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const N=D.params[0]||1;for(let B=this._activeBuffer.scrollTop;B<=this._activeBuffer.scrollBottom;++B){const F=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);F.deleteCells(0,N,this._activeBuffer.getNullCell(this._eraseAttrData())),F.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(D){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const N=D.params[0]||1;for(let B=this._activeBuffer.scrollTop;B<=this._activeBuffer.scrollBottom;++B){const F=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);F.insertCells(0,N,this._activeBuffer.getNullCell(this._eraseAttrData())),F.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(D){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const N=D.params[0]||1;for(let B=this._activeBuffer.scrollTop;B<=this._activeBuffer.scrollBottom;++B){const F=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);F.insertCells(this._activeBuffer.x,N,this._activeBuffer.getNullCell(this._eraseAttrData())),F.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(D){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const N=D.params[0]||1;for(let B=this._activeBuffer.scrollTop;B<=this._activeBuffer.scrollBottom;++B){const F=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);F.deleteCells(this._activeBuffer.x,N,this._activeBuffer.getNullCell(this._eraseAttrData())),F.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(D){this._restrictCursor();const N=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return N&&(N.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(D.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(D){const N=this._parser.precedingJoinState;if(!N)return!0;const B=D.params[0]||1,F=T.UnicodeService.extractWidth(N),Z=this._activeBuffer.x-F,ne=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(Z),he=new Uint32Array(ne.length*B);let ae=0;for(let O=0;O<ne.length;){const ie=ne.codePointAt(O)||0;he[ae++]=ie,O+=ie>65535?2:1}let V=ae;for(let O=1;O<B;++O)he.copyWithin(V,0,ae),V+=ae;return this.print(he,0,V),!0}sendDeviceAttributesPrimary(D){return D.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(D){return D.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(D.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(d.C0.ESC+"[>83;40003;0c")),!0}_is(D){return(this._optionsService.rawOptions.termName+"").indexOf(D)===0}setMode(D){for(let N=0;N<D.length;N++)switch(D.params[N]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(D){for(let N=0;N<D.length;N++)switch(D.params[N]){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(D){for(let N=0;N<D.length;N++)switch(D.params[N]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(D){for(let N=0;N<D.length;N++)switch(D.params[N]){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(),D.params[N]===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(D,N){const B=this._coreService.decPrivateModes,{activeProtocol:F,activeEncoding:Z}=this._coreMouseService,ne=this._coreService,{buffers:he,cols:ae}=this._bufferService,{active:V,alt:O}=he,ie=this._optionsService.rawOptions,se=Ie=>Ie?1:2,pe=D.params[0];return fe=pe,Ee=N?pe===2?4:pe===4?se(ne.modes.insertMode):pe===12?3:pe===20?se(ie.convertEol):0:pe===1?se(B.applicationCursorKeys):pe===3?ie.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(F==="X10"):pe===12?se(ie.cursorBlink):pe===25?se(!ne.isCursorHidden):pe===45?se(B.reverseWraparound):pe===66?se(B.applicationKeypad):pe===67?4:pe===1e3?se(F==="VT200"):pe===1002?se(F==="DRAG"):pe===1003?se(F==="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===O):pe===2004?se(B.bracketedPasteMode):0,ne.triggerDataEvent(`${d.C0.ESC}[${N?"":"?"}${fe};${Ee}$y`),!0;var fe,Ee}_updateAttrColor(D,N,B,F,Z){return N===2?(D|=50331648,D&=-16777216,D|=C.AttributeData.fromColorRGB([B,F,Z])):N===5&&(D&=-50331904,D|=33554432|255&B),D}_extractColor(D,N,B){const F=[0,0,-1,0,0,0];let Z=0,ne=0;do{if(F[ne+Z]=D.params[N+ne],D.hasSubParams(N+ne)){const he=D.getSubParams(N+ne);let ae=0;do F[1]===5&&(Z=1),F[ne+ae+1+Z]=he[ae];while(++ae<he.length&&ae+ne+1+Z<F.length);break}if(F[1]===5&&ne+Z>=2||F[1]===2&&ne+Z>=5)break;F[1]&&(Z=1)}while(++ne+N<D.length&&ne+Z<F.length);for(let he=2;he<F.length;++he)F[he]===-1&&(F[he]=0);switch(F[0]){case 38:B.fg=this._updateAttrColor(B.fg,F[1],F[3],F[4],F[5]);break;case 48:B.bg=this._updateAttrColor(B.bg,F[1],F[3],F[4],F[5]);break;case 58:B.extended=B.extended.clone(),B.extended.underlineColor=this._updateAttrColor(B.extended.underlineColor,F[1],F[3],F[4],F[5])}return ne}_processUnderline(D,N){N.extended=N.extended.clone(),(!~D||D>5)&&(D=1),N.extended.underlineStyle=D,N.fg|=268435456,D===0&&(N.fg&=-268435457),N.updateExtended()}_processSGR0(D){D.fg=m.DEFAULT_ATTR_DATA.fg,D.bg=m.DEFAULT_ATTR_DATA.bg,D.extended=D.extended.clone(),D.extended.underlineStyle=0,D.extended.underlineColor&=-67108864,D.updateExtended()}charAttributes(D){if(D.length===1&&D.params[0]===0)return this._processSGR0(this._curAttrData),!0;const N=D.length;let B;const F=this._curAttrData;for(let Z=0;Z<N;Z++)B=D.params[Z],B>=30&&B<=37?(F.fg&=-50331904,F.fg|=16777216|B-30):B>=40&&B<=47?(F.bg&=-50331904,F.bg|=16777216|B-40):B>=90&&B<=97?(F.fg&=-50331904,F.fg|=16777224|B-90):B>=100&&B<=107?(F.bg&=-50331904,F.bg|=16777224|B-100):B===0?this._processSGR0(F):B===1?F.fg|=134217728:B===3?F.bg|=67108864:B===4?(F.fg|=268435456,this._processUnderline(D.hasSubParams(Z)?D.getSubParams(Z)[0]:1,F)):B===5?F.fg|=536870912:B===7?F.fg|=67108864:B===8?F.fg|=1073741824:B===9?F.fg|=2147483648:B===2?F.bg|=134217728:B===21?this._processUnderline(2,F):B===22?(F.fg&=-134217729,F.bg&=-134217729):B===23?F.bg&=-67108865:B===24?(F.fg&=-268435457,this._processUnderline(0,F)):B===25?F.fg&=-536870913:B===27?F.fg&=-67108865:B===28?F.fg&=-1073741825:B===29?F.fg&=2147483647:B===39?(F.fg&=-67108864,F.fg|=16777215&m.DEFAULT_ATTR_DATA.fg):B===49?(F.bg&=-67108864,F.bg|=16777215&m.DEFAULT_ATTR_DATA.bg):B===38||B===48||B===58?Z+=this._extractColor(D,Z,F):B===53?F.bg|=1073741824:B===55?F.bg&=-1073741825:B===59?(F.extended=F.extended.clone(),F.extended.underlineColor=-1,F.updateExtended()):B===100?(F.fg&=-67108864,F.fg|=16777215&m.DEFAULT_ATTR_DATA.fg,F.bg&=-67108864,F.bg|=16777215&m.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",B);return!0}deviceStatus(D){switch(D.params[0]){case 5:this._coreService.triggerDataEvent(`${d.C0.ESC}[0n`);break;case 6:const N=this._activeBuffer.y+1,B=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${d.C0.ESC}[${N};${B}R`)}return!0}deviceStatusPrivate(D){if(D.params[0]===6){const N=this._activeBuffer.y+1,B=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${d.C0.ESC}[?${N};${B}R`)}return!0}softReset(D){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(D){const N=D.params[0]||1;switch(N){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=N%2==1;return this._optionsService.options.cursorBlink=B,!0}setScrollRegion(D){const N=D.params[0]||1;let B;return(D.length<2||(B=D.params[1])>this._bufferService.rows||B===0)&&(B=this._bufferService.rows),B>N&&(this._activeBuffer.scrollTop=N-1,this._activeBuffer.scrollBottom=B-1,this._setCursor(0,0)),!0}windowOptions(D){if(!U(D.params[0],this._optionsService.rawOptions.windowOptions))return!0;const N=D.length>1?D.params[1]:0;switch(D.params[0]){case 14:N!==2&&this._onRequestWindowsOptionsReport.fire(z.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(z.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:N!==0&&N!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),N!==0&&N!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:N!==0&&N!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),N!==0&&N!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(D){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(D){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(D){return this._windowTitle=D,this._onTitleChange.fire(D),!0}setIconName(D){return this._iconName=D,!0}setOrReportIndexedColor(D){const N=[],B=D.split(";");for(;B.length>1;){const F=B.shift(),Z=B.shift();if(/^\d+$/.exec(F)){const ne=parseInt(F);if(J(ne))if(Z==="?")N.push({type:0,index:ne});else{const he=(0,L.parseColor)(Z);he&&N.push({type:1,index:ne,color:he})}}}return N.length&&this._onColor.fire(N),!0}setHyperlink(D){const N=D.split(";");return!(N.length<2)&&(N[1]?this._createHyperlink(N[0],N[1]):!N[0]&&this._finishHyperlink())}_createHyperlink(D,N){this._getCurrentLinkId()&&this._finishHyperlink();const B=D.split(":");let F;const Z=B.findIndex((ne=>ne.startsWith("id=")));return Z!==-1&&(F=B[Z].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:F,uri:N}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(D,N){const B=D.split(";");for(let F=0;F<B.length&&!(N>=this._specialColors.length);++F,++N)if(B[F]==="?")this._onColor.fire([{type:0,index:this._specialColors[N]}]);else{const Z=(0,L.parseColor)(B[F]);Z&&this._onColor.fire([{type:1,index:this._specialColors[N],color:Z}])}return!0}setOrReportFgColor(D){return this._setOrReportSpecialColor(D,0)}setOrReportBgColor(D){return this._setOrReportSpecialColor(D,1)}setOrReportCursorColor(D){return this._setOrReportSpecialColor(D,2)}restoreIndexedColor(D){if(!D)return this._onColor.fire([{type:2}]),!0;const N=[],B=D.split(";");for(let F=0;F<B.length;++F)if(/^\d+$/.exec(B[F])){const Z=parseInt(B[F]);J(Z)&&N.push({type:2,index:Z})}return N.length&&this._onColor.fire(N),!0}restoreFgColor(D){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(D){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(D){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(D){return D.length!==2?(this.selectDefaultCharset(),!0):(D[0]==="/"||this._charsetService.setgCharset(j[D[0]],g.CHARSETS[D[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 D=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,D,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(D){return this._charsetService.setgLevel(D),!0}screenAlignmentPattern(){const D=new _.CellData;D.content=4194373,D.fg=this._curAttrData.fg,D.bg=this._curAttrData.bg,this._setCursor(0,0);for(let N=0;N<this._bufferService.rows;++N){const B=this._activeBuffer.ybase+this._activeBuffer.y+N,F=this._activeBuffer.lines.get(B);F&&(F.fill(D),F.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(D,N){const B=this._bufferService.buffer,F=this._optionsService.rawOptions;return(Z=>(this._coreService.triggerDataEvent(`${d.C0.ESC}${Z}${d.C0.ESC}\\`),!0))(D==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:D==='"p'?'P1$r61;1"p':D==="r"?`P1$r${B.scrollTop+1};${B.scrollBottom+1}r`:D==="m"?"P1$r0m":D===" q"?`P1$r${{block:2,underline:4,bar:6}[F.cursorStyle]-(F.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(D,N){this._dirtyRowTracker.markRangeDirty(D,N)}}o.InputHandler=re;let Q=class{constructor(K){this._bufferService=K,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(K){K<this.start?this.start=K:K>this.end&&(this.end=K)}markRangeDirty(K,D){K>D&&(Y=K,K=D,D=Y),K<this.start&&(this.start=K),D>this.end&&(this.end=D)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function J(K){return 0<=K&&K<256}Q=u([p(0,M.IBufferService)],Q)},844:(c,o)=>{function h(u){for(const p of u)p.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 p=this._disposables.indexOf(u);p!==-1&&this._disposables.splice(p,1)}},o.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(u){var p;this._isDisposed||u===this._value||((p=this._value)==null||p.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(p,d,g){this._data[p]||(this._data[p]={}),this._data[p][d]=g}get(p,d){return this._data[p]?this._data[p][d]:void 0}clear(){this._data={}}}o.TwoKeyMap=h,o.FourKeyMap=class{constructor(){this._data=new h}set(u,p,d,g,w){this._data.get(u,p)||this._data.set(u,p,new h),this._data.get(u,p).set(d,g,w)}get(u,p,d,g){var w;return(w=this._data.get(u,p))==null?void 0:w.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 p=h.match(/Version\/(\d+)/);return p===null||p.length<2?0:parseInt(p[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 p=this._getKey(u);if(p===void 0||(h=this._search(p),h===-1)||this._getKey(this._array[h])!==p)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])===p);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,p){if(this._array.length!==0&&(h=this._search(u),!(h<0||h>=this._array.length)&&this._getKey(this._array[h])===u))do p(this._array[h]);while(++h<this._array.length&&this._getKey(this._array[h])===u)}values(){return[...this._array].values()}_search(u){let p=0,d=this._array.length-1;for(;d>=p;){let g=p+d>>1;const w=this._getKey(this._array[g]);if(w>u)d=g-1;else{if(!(w<u)){for(;g>0&&this._getKey(this._array[g-1])===u;)g--;return g}p=g+1}}return p}}},7226:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DebouncedIdleTask=o.IdleTaskQueue=o.PriorityTaskQueue=void 0;const u=h(6114);class p{constructor(){this._tasks=[],this._i=0}enqueue(w){this._tasks.push(w),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(w){this._idleCallback=void 0;let S=0,y=0,m=w.timeRemaining(),v=0;for(;this._i<this._tasks.length;){if(S=Date.now(),this._tasks[this._i]()||this._i++,S=Math.max(1,Date.now()-S),y=Math.max(S,y),v=w.timeRemaining(),1.5*y>v)return m-S<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(m-S))}ms`),void this._start();m=v}this.clear()}}class d extends p{_requestCallback(w){return setTimeout((()=>w(this._createDeadline(16))))}_cancelCallback(w){clearTimeout(w)}_createDeadline(w){const S=Date.now()+w;return{timeRemaining:()=>Math.max(0,S-Date.now())}}}o.PriorityTaskQueue=d,o.IdleTaskQueue=!u.isNode&&"requestIdleCallback"in window?class extends p{_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(p){const d=p.buffer.lines.get(p.buffer.ybase+p.buffer.y-1),g=d==null?void 0:d.get(p.cols-1),w=p.buffer.lines.get(p.buffer.ybase+p.buffer.y);w&&g&&(w.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),p=h(7226),d=h(3734),g=h(8437),w=h(4634),S=h(511),y=h(643),m=h(4863),v=h(7116);o.MAX_BUFFER_SIZE=4294967295,o.Buffer=class{constructor(x,_,C){this._hasScrollback=x,this._optionsService=_,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=v.DEFAULT_CHARSET,this.markers=[],this._nullCell=S.CellData.fromCharData([0,y.NULL_CELL_CHAR,y.NULL_CELL_WIDTH,y.NULL_CELL_CODE]),this._whitespaceCell=S.CellData.fromCharData([0,y.WHITESPACE_CELL_CHAR,y.WHITESPACE_CELL_WIDTH,y.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new p.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(x){return x?(this._nullCell.fg=x.fg,this._nullCell.bg=x.bg,this._nullCell.extended=x.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new d.ExtendedAttrs),this._nullCell}getWhitespaceCell(x){return x?(this._whitespaceCell.fg=x.fg,this._whitespaceCell.bg=x.bg,this._whitespaceCell.extended=x.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new d.ExtendedAttrs),this._whitespaceCell}getBlankLine(x,_){return new g.BufferLine(this._bufferService.cols,this.getNullCell(x),_)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const x=this.ybase+this.y-this.ydisp;return x>=0&&x<this._rows}_getCorrectBufferLength(x){if(!this._hasScrollback)return x;const _=x+this._optionsService.rawOptions.scrollback;return _>o.MAX_BUFFER_SIZE?o.MAX_BUFFER_SIZE:_}fillViewportRows(x){if(this.lines.length===0){x===void 0&&(x=g.DEFAULT_ATTR_DATA);let _=this._rows;for(;_--;)this.lines.push(this.getBlankLine(x))}}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(x,_){const C=this.getNullCell(g.DEFAULT_ATTR_DATA);let M=0;const T=this._getCorrectBufferLength(_);if(T>this.lines.maxLength&&(this.lines.maxLength=T),this.lines.length>0){if(this._cols<x)for(let P=0;P<this.lines.length;P++)M+=+this.lines.get(P).resize(x,C);let R=0;if(this._rows<_)for(let P=this._rows;P<_;P++)this.lines.length<_+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(x,C)):this.ybase>0&&this.lines.length<=this.ybase+this.y+R+1?(this.ybase--,R++,this.ydisp>0&&this.ydisp--):this.lines.push(new g.BufferLine(x,C)));else for(let P=this._rows;P>_;P--)this.lines.length>_+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(T<this.lines.maxLength){const P=this.lines.length-T;P>0&&(this.lines.trimStart(P),this.ybase=Math.max(this.ybase-P,0),this.ydisp=Math.max(this.ydisp-P,0),this.savedY=Math.max(this.savedY-P,0)),this.lines.maxLength=T}this.x=Math.min(this.x,x-1),this.y=Math.min(this.y,_-1),R&&(this.y+=R),this.savedX=Math.min(this.savedX,x-1),this.scrollTop=0}if(this.scrollBottom=_-1,this._isReflowEnabled&&(this._reflow(x,_),this._cols>x))for(let R=0;R<this.lines.length;R++)M+=+this.lines.get(R).resize(x,C);this._cols=x,this._rows=_,this._memoryCleanupQueue.clear(),M>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let x=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,x=!1);let _=0;for(;this._memoryCleanupPosition<this.lines.length;)if(_+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),_>100)return!0;return x}get _isReflowEnabled(){const x=this._optionsService.rawOptions.windowsPty;return x&&x.buildNumber?this._hasScrollback&&x.backend==="conpty"&&x.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(x,_){this._cols!==x&&(x>this._cols?this._reflowLarger(x,_):this._reflowSmaller(x,_))}_reflowLarger(x,_){const C=(0,w.reflowLargerGetLinesToRemove)(this.lines,this._cols,x,this.ybase+this.y,this.getNullCell(g.DEFAULT_ATTR_DATA));if(C.length>0){const M=(0,w.reflowLargerCreateNewLayout)(this.lines,C);(0,w.reflowLargerApplyNewLayout)(this.lines,M.layout),this._reflowLargerAdjustViewport(x,_,M.countRemoved)}}_reflowLargerAdjustViewport(x,_,C){const M=this.getNullCell(g.DEFAULT_ATTR_DATA);let T=C;for(;T-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<_&&this.lines.push(new g.BufferLine(x,M))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-C,0)}_reflowSmaller(x,_){const C=this.getNullCell(g.DEFAULT_ATTR_DATA),M=[];let T=0;for(let R=this.lines.length-1;R>=0;R--){let P=this.lines.get(R);if(!P||!P.isWrapped&&P.getTrimmedLength()<=x)continue;const L=[P];for(;P.isWrapped&&R>0;)P=this.lines.get(--R),L.unshift(P);const j=this.ybase+this.y;if(j>=R&&j<R+L.length)continue;const $=L[L.length-1].getTrimmedLength(),U=(0,w.reflowSmallerGetNewLineLengths)(L,this._cols,x),z=U.length-L.length;let Y;Y=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+z):Math.max(0,this.lines.length-this.lines.maxLength+z);const re=[];for(let B=0;B<z;B++){const F=this.getBlankLine(g.DEFAULT_ATTR_DATA,!0);re.push(F)}re.length>0&&(M.push({start:R+L.length+T,newLines:re}),T+=re.length),L.push(...re);let Q=U.length-1,J=U[Q];J===0&&(Q--,J=U[Q]);let K=L.length-z-1,D=$;for(;K>=0;){const B=Math.min(D,J);if(L[Q]===void 0)break;if(L[Q].copyCellsFrom(L[K],D-B,J-B,B,!0),J-=B,J===0&&(Q--,J=U[Q]),D-=B,D===0){K--;const F=Math.max(K,0);D=(0,w.getWrappedLineTrimmedLength)(L,F,this._cols)}}for(let B=0;B<L.length;B++)U[B]<x&&L[B].setCell(U[B],C);let N=z-Y;for(;N-- >0;)this.ybase===0?this.y<_-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+T)-_&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+z,this.ybase+_-1)}if(M.length>0){const R=[],P=[];for(let Q=0;Q<this.lines.length;Q++)P.push(this.lines.get(Q));const L=this.lines.length;let j=L-1,$=0,U=M[$];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+T);let z=0;for(let Q=Math.min(this.lines.maxLength-1,L+T-1);Q>=0;Q--)if(U&&U.start>j+z){for(let J=U.newLines.length-1;J>=0;J--)this.lines.set(Q--,U.newLines[J]);Q++,R.push({index:j+1,amount:U.newLines.length}),z+=U.newLines.length,U=M[++$]}else this.lines.set(Q,P[j--]);let Y=0;for(let Q=R.length-1;Q>=0;Q--)R[Q].index+=Y,this.lines.onInsertEmitter.fire(R[Q]),Y+=R[Q].amount;const re=Math.max(0,L+T-this.lines.maxLength);re>0&&this.lines.onTrimEmitter.fire(re)}}translateBufferLineToString(x,_,C=0,M){const T=this.lines.get(x);return T?T.translateToString(_,C,M):""}getWrappedRangeForLine(x){let _=x,C=x;for(;_>0&&this.lines.get(_).isWrapped;)_--;for(;C+1<this.lines.length&&this.lines.get(C+1).isWrapped;)C++;return{first:_,last:C}}setupTabStops(x){for(x!=null?this.tabs[x]||(x=this.prevStop(x)):(this.tabs={},x=0);x<this._cols;x+=this._optionsService.rawOptions.tabStopWidth)this.tabs[x]=!0}prevStop(x){for(x==null&&(x=this.x);!this.tabs[--x]&&x>0;);return x>=this._cols?this._cols-1:x<0?0:x}nextStop(x){for(x==null&&(x=this.x);!this.tabs[++x]&&x<this._cols;);return x>=this._cols?this._cols-1:x<0?0:x}clearMarkers(x){this._isClearing=!0;for(let _=0;_<this.markers.length;_++)this.markers[_].line===x&&(this.markers[_].dispose(),this.markers.splice(_--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let x=0;x<this.markers.length;x++)this.markers[x].dispose(),this.markers.splice(x--,1);this._isClearing=!1}addMarker(x){const _=new m.Marker(x);return this.markers.push(_),_.register(this.lines.onTrim((C=>{_.line-=C,_.line<0&&_.dispose()}))),_.register(this.lines.onInsert((C=>{_.line>=C.index&&(_.line+=C.amount)}))),_.register(this.lines.onDelete((C=>{_.line>=C.index&&_.line<C.index+C.amount&&_.dispose(),_.line>C.index&&(_.line-=C.amount)}))),_.register(_.onDispose((()=>this._removeMarker(_)))),_}_removeMarker(x){this._isClearing||this.markers.splice(this.markers.indexOf(x),1)}}},8437:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferLine=o.DEFAULT_ATTR_DATA=void 0;const u=h(3734),p=h(511),d=h(643),g=h(482);o.DEFAULT_ATTR_DATA=Object.freeze(new u.AttributeData);let w=0;class S{constructor(m,v,x=!1){this.isWrapped=x,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*m);const _=v||p.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,_);this.length=m}get(m){const v=this._data[3*m+0],x=2097151&v;return[this._data[3*m+1],2097152&v?this._combined[m]:x?(0,g.stringFromCodePoint)(x):"",v>>22,2097152&v?this._combined[m].charCodeAt(this._combined[m].length-1):x]}set(m,v){this._data[3*m+1]=v[d.CHAR_DATA_ATTR_INDEX],v[d.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[m]=v[1],this._data[3*m+0]=2097152|m|v[d.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*m+0]=v[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|v[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 v=this._data[3*m+0];return 2097152&v?this._combined[m].charCodeAt(this._combined[m].length-1):2097151&v}isCombined(m){return 2097152&this._data[3*m+0]}getString(m){const v=this._data[3*m+0];return 2097152&v?this._combined[m]:2097151&v?(0,g.stringFromCodePoint)(2097151&v):""}isProtected(m){return 536870912&this._data[3*m+2]}loadCell(m,v){return w=3*m,v.content=this._data[w+0],v.fg=this._data[w+1],v.bg=this._data[w+2],2097152&v.content&&(v.combinedData=this._combined[m]),268435456&v.bg&&(v.extended=this._extendedAttrs[m]),v}setCell(m,v){2097152&v.content&&(this._combined[m]=v.combinedData),268435456&v.bg&&(this._extendedAttrs[m]=v.extended),this._data[3*m+0]=v.content,this._data[3*m+1]=v.fg,this._data[3*m+2]=v.bg}setCellFromCodepoint(m,v,x,_){268435456&_.bg&&(this._extendedAttrs[m]=_.extended),this._data[3*m+0]=v|x<<22,this._data[3*m+1]=_.fg,this._data[3*m+2]=_.bg}addCodepointToCell(m,v,x){let _=this._data[3*m+0];2097152&_?this._combined[m]+=(0,g.stringFromCodePoint)(v):2097151&_?(this._combined[m]=(0,g.stringFromCodePoint)(2097151&_)+(0,g.stringFromCodePoint)(v),_&=-2097152,_|=2097152):_=v|4194304,x&&(_&=-12582913,_|=x<<22),this._data[3*m+0]=_}insertCells(m,v,x){if((m%=this.length)&&this.getWidth(m-1)===2&&this.setCellFromCodepoint(m-1,0,1,x),v<this.length-m){const _=new p.CellData;for(let C=this.length-m-v-1;C>=0;--C)this.setCell(m+v+C,this.loadCell(m+C,_));for(let C=0;C<v;++C)this.setCell(m+C,x)}else for(let _=m;_<this.length;++_)this.setCell(_,x);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,x)}deleteCells(m,v,x){if(m%=this.length,v<this.length-m){const _=new p.CellData;for(let C=0;C<this.length-m-v;++C)this.setCell(m+C,this.loadCell(m+v+C,_));for(let C=this.length-v;C<this.length;++C)this.setCell(C,x)}else for(let _=m;_<this.length;++_)this.setCell(_,x);m&&this.getWidth(m-1)===2&&this.setCellFromCodepoint(m-1,0,1,x),this.getWidth(m)!==0||this.hasContent(m)||this.setCellFromCodepoint(m,0,1,x)}replaceCells(m,v,x,_=!1){if(_)for(m&&this.getWidth(m-1)===2&&!this.isProtected(m-1)&&this.setCellFromCodepoint(m-1,0,1,x),v<this.length&&this.getWidth(v-1)===2&&!this.isProtected(v)&&this.setCellFromCodepoint(v,0,1,x);m<v&&m<this.length;)this.isProtected(m)||this.setCell(m,x),m++;else for(m&&this.getWidth(m-1)===2&&this.setCellFromCodepoint(m-1,0,1,x),v<this.length&&this.getWidth(v-1)===2&&this.setCellFromCodepoint(v,0,1,x);m<v&&m<this.length;)this.setCell(m++,x)}resize(m,v){if(m===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const x=3*m;if(m>this.length){if(this._data.buffer.byteLength>=4*x)this._data=new Uint32Array(this._data.buffer,0,x);else{const _=new Uint32Array(x);_.set(this._data),this._data=_}for(let _=this.length;_<m;++_)this.setCell(_,v)}else{this._data=this._data.subarray(0,x);const _=Object.keys(this._combined);for(let M=0;M<_.length;M++){const T=parseInt(_[M],10);T>=m&&delete this._combined[T]}const C=Object.keys(this._extendedAttrs);for(let M=0;M<C.length;M++){const T=parseInt(C[M],10);T>=m&&delete this._extendedAttrs[T]}}return this.length=m,4*x*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,v=!1){if(v)for(let x=0;x<this.length;++x)this.isProtected(x)||this.setCell(x,m);else{this._combined={},this._extendedAttrs={};for(let x=0;x<this.length;++x)this.setCell(x,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 v in m._combined)this._combined[v]=m._combined[v];this._extendedAttrs={};for(const v in m._extendedAttrs)this._extendedAttrs[v]=m._extendedAttrs[v];this.isWrapped=m.isWrapped}clone(){const m=new S(0);m._data=new Uint32Array(this._data),m.length=this.length;for(const v in this._combined)m._combined[v]=this._combined[v];for(const v in this._extendedAttrs)m._extendedAttrs[v]=this._extendedAttrs[v];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,v,x,_,C){const M=m._data;if(C)for(let R=_-1;R>=0;R--){for(let P=0;P<3;P++)this._data[3*(x+R)+P]=M[3*(v+R)+P];268435456&M[3*(v+R)+2]&&(this._extendedAttrs[x+R]=m._extendedAttrs[v+R])}else for(let R=0;R<_;R++){for(let P=0;P<3;P++)this._data[3*(x+R)+P]=M[3*(v+R)+P];268435456&M[3*(v+R)+2]&&(this._extendedAttrs[x+R]=m._extendedAttrs[v+R])}const T=Object.keys(m._combined);for(let R=0;R<T.length;R++){const P=parseInt(T[R],10);P>=v&&(this._combined[P-v+x]=m._combined[P])}}translateToString(m,v,x,_){v=v??0,x=x??this.length,m&&(x=Math.min(x,this.getTrimmedLength())),_&&(_.length=0);let C="";for(;v<x;){const M=this._data[3*v+0],T=2097151&M,R=2097152&M?this._combined[v]:T?(0,g.stringFromCodePoint)(T):d.WHITESPACE_CELL_CHAR;if(C+=R,_)for(let P=0;P<R.length;++P)_.push(v);v+=M>>22||1}return _&&_.push(v),C}}o.BufferLine=S},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,p,d){if(p===u.length-1)return u[p].getTrimmedLength();const g=!u[p].hasContent(d-1)&&u[p].getWidth(d-1)===1,w=u[p+1].getWidth(0)===2;return g&&w?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,p,d,g,w){const S=[];for(let y=0;y<u.length-1;y++){let m=y,v=u.get(++m);if(!v.isWrapped)continue;const x=[u.get(y)];for(;m<u.length&&v.isWrapped;)x.push(v),v=u.get(++m);if(g>=y&&g<m){y+=x.length-1;continue}let _=0,C=h(x,_,p),M=1,T=0;for(;M<x.length;){const P=h(x,M,p),L=P-T,j=d-C,$=Math.min(L,j);x[_].copyCellsFrom(x[M],T,C,$,!1),C+=$,C===d&&(_++,C=0),T+=$,T===P&&(M++,T=0),C===0&&_!==0&&x[_-1].getWidth(d-1)===2&&(x[_].copyCellsFrom(x[_-1],d-1,C++,1,!1),x[_-1].setCell(d-1,w))}x[_].replaceCells(C,d,w);let R=0;for(let P=x.length-1;P>0&&(P>_||x[P].getTrimmedLength()===0);P--)R++;R>0&&(S.push(y+x.length-R),S.push(R)),y+=x.length-1}return S},o.reflowLargerCreateNewLayout=function(u,p){const d=[];let g=0,w=p[g],S=0;for(let y=0;y<u.length;y++)if(w===y){const m=p[++g];u.onDeleteEmitter.fire({index:y-S,amount:m}),y+=m-1,S+=m,w=p[++g]}else d.push(y);return{layout:d,countRemoved:S}},o.reflowLargerApplyNewLayout=function(u,p){const d=[];for(let g=0;g<p.length;g++)d.push(u.get(p[g]));for(let g=0;g<d.length;g++)u.set(g,d[g]);u.length=p.length},o.reflowSmallerGetNewLineLengths=function(u,p,d){const g=[],w=u.map(((v,x)=>h(u,x,p))).reduce(((v,x)=>v+x));let S=0,y=0,m=0;for(;m<w;){if(w-m<d){g.push(w-m);break}S+=d;const v=h(u,y,p);S>v&&(S-=v,y++);const x=u[y].getWidth(S-1)===2;x&&S--;const _=x?d-1:d;g.push(_),m+=_}return g},o.getWrappedLineTrimmedLength=h},5295:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferSet=void 0;const u=h(8460),p=h(844),d=h(9092);class g extends p.Disposable{constructor(S,y){super(),this._optionsService=S,this._bufferService=y,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(S){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(S),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(S,y){this._normal.resize(S,y),this._alt.resize(S,y),this.setupTabStops(S)}setupTabStops(S){this._normal.setupTabStops(S),this._alt.setupTabStops(S)}}o.BufferSet=g},511:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CellData=void 0;const u=h(482),p=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(S){const y=new g;return y.setFromCharData(S),y}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(S){this.fg=S[p.CHAR_DATA_ATTR_INDEX],this.bg=0;let y=!1;if(S[p.CHAR_DATA_CHAR_INDEX].length>2)y=!0;else if(S[p.CHAR_DATA_CHAR_INDEX].length===2){const m=S[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=m&&m<=56319){const v=S[p.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=v&&v<=57343?this.content=1024*(m-55296)+v-56320+65536|S[p.CHAR_DATA_WIDTH_INDEX]<<22:y=!0}else y=!0}else this.content=S[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|S[p.CHAR_DATA_WIDTH_INDEX]<<22;y&&(this.combinedData=S[p.CHAR_DATA_CHAR_INDEX],this.content=2097152|S[p.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),p=h(844);class d{get id(){return this._id}constructor(w){this.line=w,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,p.disposeArray)(this._disposables),this._disposables.length=0)}register(w){return this._disposables.push(w),w}}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,p;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=`
|
|
306
|
+
`,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}\\`})(p||(o.C1_ESCAPED=p={}))},7399:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.evaluateKeyboardEvent=void 0;const u=h(2584),p={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,w,S){const y={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"?y.key=g?u.C0.ESC+"OA":u.C0.ESC+"[A":d.key==="UIKeyInputLeftArrow"?y.key=g?u.C0.ESC+"OD":u.C0.ESC+"[D":d.key==="UIKeyInputRightArrow"?y.key=g?u.C0.ESC+"OC":u.C0.ESC+"[C":d.key==="UIKeyInputDownArrow"&&(y.key=g?u.C0.ESC+"OB":u.C0.ESC+"[B");break;case 8:y.key=d.ctrlKey?"\b":u.C0.DEL,d.altKey&&(y.key=u.C0.ESC+y.key);break;case 9:if(d.shiftKey){y.key=u.C0.ESC+"[Z";break}y.key=u.C0.HT,y.cancel=!0;break;case 13:y.key=d.altKey?u.C0.ESC+u.C0.CR:u.C0.CR,y.cancel=!0;break;case 27:y.key=u.C0.ESC,d.altKey&&(y.key=u.C0.ESC+u.C0.ESC),y.cancel=!0;break;case 37:if(d.metaKey)break;m?(y.key=u.C0.ESC+"[1;"+(m+1)+"D",y.key===u.C0.ESC+"[1;3D"&&(y.key=u.C0.ESC+(w?"b":"[1;5D"))):y.key=g?u.C0.ESC+"OD":u.C0.ESC+"[D";break;case 39:if(d.metaKey)break;m?(y.key=u.C0.ESC+"[1;"+(m+1)+"C",y.key===u.C0.ESC+"[1;3C"&&(y.key=u.C0.ESC+(w?"f":"[1;5C"))):y.key=g?u.C0.ESC+"OC":u.C0.ESC+"[C";break;case 38:if(d.metaKey)break;m?(y.key=u.C0.ESC+"[1;"+(m+1)+"A",w||y.key!==u.C0.ESC+"[1;3A"||(y.key=u.C0.ESC+"[1;5A")):y.key=g?u.C0.ESC+"OA":u.C0.ESC+"[A";break;case 40:if(d.metaKey)break;m?(y.key=u.C0.ESC+"[1;"+(m+1)+"B",w||y.key!==u.C0.ESC+"[1;3B"||(y.key=u.C0.ESC+"[1;5B")):y.key=g?u.C0.ESC+"OB":u.C0.ESC+"[B";break;case 45:d.shiftKey||d.ctrlKey||(y.key=u.C0.ESC+"[2~");break;case 46:y.key=m?u.C0.ESC+"[3;"+(m+1)+"~":u.C0.ESC+"[3~";break;case 36:y.key=m?u.C0.ESC+"[1;"+(m+1)+"H":g?u.C0.ESC+"OH":u.C0.ESC+"[H";break;case 35:y.key=m?u.C0.ESC+"[1;"+(m+1)+"F":g?u.C0.ESC+"OF":u.C0.ESC+"[F";break;case 33:d.shiftKey?y.type=2:d.ctrlKey?y.key=u.C0.ESC+"[5;"+(m+1)+"~":y.key=u.C0.ESC+"[5~";break;case 34:d.shiftKey?y.type=3:d.ctrlKey?y.key=u.C0.ESC+"[6;"+(m+1)+"~":y.key=u.C0.ESC+"[6~";break;case 112:y.key=m?u.C0.ESC+"[1;"+(m+1)+"P":u.C0.ESC+"OP";break;case 113:y.key=m?u.C0.ESC+"[1;"+(m+1)+"Q":u.C0.ESC+"OQ";break;case 114:y.key=m?u.C0.ESC+"[1;"+(m+1)+"R":u.C0.ESC+"OR";break;case 115:y.key=m?u.C0.ESC+"[1;"+(m+1)+"S":u.C0.ESC+"OS";break;case 116:y.key=m?u.C0.ESC+"[15;"+(m+1)+"~":u.C0.ESC+"[15~";break;case 117:y.key=m?u.C0.ESC+"[17;"+(m+1)+"~":u.C0.ESC+"[17~";break;case 118:y.key=m?u.C0.ESC+"[18;"+(m+1)+"~":u.C0.ESC+"[18~";break;case 119:y.key=m?u.C0.ESC+"[19;"+(m+1)+"~":u.C0.ESC+"[19~";break;case 120:y.key=m?u.C0.ESC+"[20;"+(m+1)+"~":u.C0.ESC+"[20~";break;case 121:y.key=m?u.C0.ESC+"[21;"+(m+1)+"~":u.C0.ESC+"[21~";break;case 122:y.key=m?u.C0.ESC+"[23;"+(m+1)+"~":u.C0.ESC+"[23~";break;case 123:y.key=m?u.C0.ESC+"[24;"+(m+1)+"~":u.C0.ESC+"[24~";break;default:if(!d.ctrlKey||d.shiftKey||d.altKey||d.metaKey)if(w&&!S||!d.altKey||d.metaKey)!w||d.altKey||d.ctrlKey||d.shiftKey||!d.metaKey?d.key&&!d.ctrlKey&&!d.altKey&&!d.metaKey&&d.keyCode>=48&&d.key.length===1?y.key=d.key:d.key&&d.ctrlKey&&(d.key==="_"&&(y.key=u.C0.US),d.key==="@"&&(y.key=u.C0.NUL)):d.keyCode===65&&(y.type=1);else{const v=p[d.keyCode],x=v==null?void 0:v[d.shiftKey?1:0];if(x)y.key=u.C0.ESC+x;else if(d.keyCode>=65&&d.keyCode<=90){const _=d.ctrlKey?d.keyCode-64:d.keyCode+32;let C=String.fromCharCode(_);d.shiftKey&&(C=C.toUpperCase()),y.key=u.C0.ESC+C}else if(d.keyCode===32)y.key=u.C0.ESC+(d.ctrlKey?u.C0.NUL:" ");else if(d.key==="Dead"&&d.code.startsWith("Key")){let _=d.code.slice(3,4);d.shiftKey||(_=_.toLowerCase()),y.key=u.C0.ESC+_,y.cancel=!0}}else d.keyCode>=65&&d.keyCode<=90?y.key=String.fromCharCode(d.keyCode-64):d.keyCode===32?y.key=u.C0.NUL:d.keyCode>=51&&d.keyCode<=55?y.key=String.fromCharCode(d.keyCode-51+27):d.keyCode===56?y.key=u.C0.DEL:d.keyCode===219?y.key=u.C0.ESC:d.keyCode===220?y.key=u.C0.FS:d.keyCode===221&&(y.key=u.C0.GS)}return y}},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,p=h.length){let d="";for(let g=u;g<p;++g){let w=h[g];w>65535?(w-=65536,d+=String.fromCharCode(55296+(w>>10))+String.fromCharCode(w%1024+56320)):d+=String.fromCharCode(w)}return d},o.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(h,u){const p=h.length;if(!p)return 0;let d=0,g=0;if(this._interim){const w=h.charCodeAt(g++);56320<=w&&w<=57343?u[d++]=1024*(this._interim-55296)+w-56320+65536:(u[d++]=this._interim,u[d++]=w),this._interim=0}for(let w=g;w<p;++w){const S=h.charCodeAt(w);if(55296<=S&&S<=56319){if(++w>=p)return this._interim=S,d;const y=h.charCodeAt(w);56320<=y&&y<=57343?u[d++]=1024*(S-55296)+y-56320+65536:(u[d++]=S,u[d++]=y)}else S!==65279&&(u[d++]=S)}return d}},o.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(h,u){const p=h.length;if(!p)return 0;let d,g,w,S,y=0,m=0,v=0;if(this.interim[0]){let C=!1,M=this.interim[0];M&=(224&M)==192?31:(240&M)==224?15:7;let T,R=0;for(;(T=63&this.interim[++R])&&R<4;)M<<=6,M|=T;const P=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,L=P-R;for(;v<L;){if(v>=p)return 0;if(T=h[v++],(192&T)!=128){v--,C=!0;break}this.interim[R++]=T,M<<=6,M|=63&T}C||(P===2?M<128?v--:u[y++]=M:P===3?M<2048||M>=55296&&M<=57343||M===65279||(u[y++]=M):M<65536||M>1114111||(u[y++]=M)),this.interim.fill(0)}const x=p-4;let _=v;for(;_<p;){for(;!(!(_<x)||128&(d=h[_])||128&(g=h[_+1])||128&(w=h[_+2])||128&(S=h[_+3]));)u[y++]=d,u[y++]=g,u[y++]=w,u[y++]=S,_+=4;if(d=h[_++],d<128)u[y++]=d;else if((224&d)==192){if(_>=p)return this.interim[0]=d,y;if(g=h[_++],(192&g)!=128){_--;continue}if(m=(31&d)<<6|63&g,m<128){_--;continue}u[y++]=m}else if((240&d)==224){if(_>=p)return this.interim[0]=d,y;if(g=h[_++],(192&g)!=128){_--;continue}if(_>=p)return this.interim[0]=d,this.interim[1]=g,y;if(w=h[_++],(192&w)!=128){_--;continue}if(m=(15&d)<<12|(63&g)<<6|63&w,m<2048||m>=55296&&m<=57343||m===65279)continue;u[y++]=m}else if((248&d)==240){if(_>=p)return this.interim[0]=d,y;if(g=h[_++],(192&g)!=128){_--;continue}if(_>=p)return this.interim[0]=d,this.interim[1]=g,y;if(w=h[_++],(192&w)!=128){_--;continue}if(_>=p)return this.interim[0]=d,this.interim[1]=g,this.interim[2]=w,y;if(S=h[_++],(192&S)!=128){_--;continue}if(m=(7&d)<<18|(63&g)<<12|(63&w)<<6|63&S,m<65536||m>1114111)continue;u[y++]=m}}return y}}},225:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeV6=void 0;const u=h(1480),p=[[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 w=0;w<p.length;++w)g.fill(0,p[w][0],p[w][1]+1)}}wcwidth(w){return w<32?0:w<127?1:w<65536?g[w]:(function(S,y){let m,v=0,x=y.length-1;if(S<y[0][0]||S>y[x][1])return!1;for(;x>=v;)if(m=v+x>>1,S>y[m][1])v=m+1;else{if(!(S<y[m][0]))return!0;x=m-1}return!1})(w,d)?0:w>=131072&&w<=196605||w>=196608&&w<=262141?2:1}charProperties(w,S){let y=this.wcwidth(w),m=y===0&&S!==0;if(m){const v=u.UnicodeService.extractWidth(S);v===0?m=!1:v>y&&(y=v)}return u.UnicodeService.createPropertyValue(0,y,m)}}},5981:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.WriteBuffer=void 0;const u=h(8460),p=h(844);class d extends p.Disposable{constructor(w){super(),this._action=w,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(w,S){if(S!==void 0&&this._syncCalls>S)return void(this._syncCalls=0);if(this._pendingData+=w.length,this._writeBuffer.push(w),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let y;for(this._isSyncWriting=!0;y=this._writeBuffer.shift();){this._action(y);const m=this._callbacks.shift();m&&m()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(w,S){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+=w.length,this._writeBuffer.push(w),this._callbacks.push(S),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=w.length,this._writeBuffer.push(w),this._callbacks.push(S)}_innerWrite(w=0,S=!0){const y=w||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const m=this._writeBuffer[this._bufferOffset],v=this._action(m,S);if(v){const _=C=>Date.now()-y>=12?setTimeout((()=>this._innerWrite(0,C))):this._innerWrite(y,C);return void v.catch((C=>(queueMicrotask((()=>{throw C})),Promise.resolve(!1)))).then(_)}const x=this._callbacks[this._bufferOffset];if(x&&x(),this._bufferOffset++,this._pendingData-=m.length,Date.now()-y>=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 p(d,g){const w=d.toString(16),S=w.length<2?"0"+w:w;switch(g){case 4:return w[0];case 8:return S;case 12:return(S+S).slice(0,3);default:return S+S}}o.parseColor=function(d){if(!d)return;let g=d.toLowerCase();if(g.indexOf("rgb:")===0){g=g.slice(4);const w=h.exec(g);if(w){const S=w[1]?15:w[4]?255:w[7]?4095:65535;return[Math.round(parseInt(w[1]||w[4]||w[7]||w[10],16)/S*255),Math.round(parseInt(w[2]||w[5]||w[8]||w[11],16)/S*255),Math.round(parseInt(w[3]||w[6]||w[9]||w[12],16)/S*255)]}}else if(g.indexOf("#")===0&&(g=g.slice(1),u.exec(g)&&[3,6,9,12].includes(g.length))){const w=g.length/3,S=[0,0,0];for(let y=0;y<3;++y){const m=parseInt(g.slice(w*y,w*y+w),16);S[y]=w===1?m<<4:w===2?m:w===3?m>>4:m>>8}return S}},o.toRgbString=function(d,g=16){const[w,S,y]=d;return`rgb:${p(w,g)}/${p(S,g)}/${p(y,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),p=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(S,y){this._handlers[S]===void 0&&(this._handlers[S]=[]);const m=this._handlers[S];return m.push(y),{dispose:()=>{const v=m.indexOf(y);v!==-1&&m.splice(v,1)}}}clearHandler(S){this._handlers[S]&&delete this._handlers[S]}setHandlerFallback(S){this._handlerFb=S}reset(){if(this._active.length)for(let S=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;S>=0;--S)this._active[S].unhook(!1);this._stack.paused=!1,this._active=g,this._ident=0}hook(S,y){if(this.reset(),this._ident=S,this._active=this._handlers[S]||g,this._active.length)for(let m=this._active.length-1;m>=0;m--)this._active[m].hook(y);else this._handlerFb(this._ident,"HOOK",y)}put(S,y,m){if(this._active.length)for(let v=this._active.length-1;v>=0;v--)this._active[v].put(S,y,m);else this._handlerFb(this._ident,"PUT",(0,u.utf32ToString)(S,y,m))}unhook(S,y=!0){if(this._active.length){let m=!1,v=this._active.length-1,x=!1;if(this._stack.paused&&(v=this._stack.loopPosition-1,m=y,x=this._stack.fallThrough,this._stack.paused=!1),!x&&m===!1){for(;v>=0&&(m=this._active[v].unhook(S),m!==!0);v--)if(m instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=v,this._stack.fallThrough=!1,m;v--}for(;v>=0;v--)if(m=this._active[v].unhook(!1),m instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=v,this._stack.fallThrough=!0,m}else this._handlerFb(this._ident,"UNHOOK",S);this._active=g,this._ident=0}};const w=new p.Params;w.addParam(0),o.DcsHandler=class{constructor(S){this._handler=S,this._data="",this._params=w,this._hitLimit=!1}hook(S){this._params=S.length>1||S.params[0]?S.clone():w,this._data="",this._hitLimit=!1}put(S,y,m){this._hitLimit||(this._data+=(0,u.utf32ToString)(S,y,m),this._data.length>d.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(S){let y=!1;if(this._hitLimit)y=!1;else if(S&&(y=this._handler(this._data,this._params),y instanceof Promise))return y.then((m=>(this._params=w,this._data="",this._hitLimit=!1,m)));return this._params=w,this._data="",this._hitLimit=!1,y}}},2015:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.EscapeSequenceParser=o.VT500_TRANSITION_TABLE=o.TransitionTable=void 0;const u=h(844),p=h(8742),d=h(6242),g=h(6351);class w{constructor(v){this.table=new Uint8Array(v)}setDefault(v,x){this.table.fill(v<<4|x)}add(v,x,_,C){this.table[x<<8|v]=_<<4|C}addMany(v,x,_,C){for(let M=0;M<v.length;M++)this.table[x<<8|v[M]]=_<<4|C}}o.TransitionTable=w;const S=160;o.VT500_TRANSITION_TABLE=(function(){const m=new w(4095),v=Array.apply(null,Array(256)).map(((R,P)=>P)),x=(R,P)=>v.slice(R,P),_=x(32,127),C=x(0,24);C.push(25),C.push.apply(C,x(28,32));const M=x(0,14);let T;for(T in m.setDefault(1,0),m.addMany(_,0,2,0),M)m.addMany([24,26,153,154],T,3,0),m.addMany(x(128,144),T,3,0),m.addMany(x(144,152),T,3,0),m.add(156,T,0,0),m.add(27,T,11,1),m.add(157,T,4,8),m.addMany([152,158,159],T,0,7),m.add(155,T,11,3),m.add(144,T,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(_,8,5,8),m.add(127,8,5,8),m.addMany([156,27,24,26,7],8,6,0),m.addMany(x(28,32),8,0,8),m.addMany([88,94,95],1,0,7),m.addMany(_,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(x(64,127),3,7,0),m.addMany(x(48,60),3,8,4),m.addMany([60,61,62,63],3,9,4),m.addMany(x(48,60),4,8,4),m.addMany(x(64,127),4,7,0),m.addMany([60,61,62,63],4,0,6),m.addMany(x(32,64),6,0,6),m.add(127,6,0,6),m.addMany(x(64,127),6,0,0),m.addMany(x(32,48),3,9,5),m.addMany(x(32,48),5,9,5),m.addMany(x(48,64),5,0,6),m.addMany(x(64,127),5,7,0),m.addMany(x(32,48),4,9,5),m.addMany(x(32,48),1,9,2),m.addMany(x(32,48),2,9,2),m.addMany(x(48,127),2,10,0),m.addMany(x(48,80),1,10,0),m.addMany(x(81,88),1,10,0),m.addMany([89,90,92],1,10,0),m.addMany(x(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(x(28,32),9,0,9),m.addMany(x(32,48),9,9,12),m.addMany(x(48,60),9,8,10),m.addMany([60,61,62,63],9,9,10),m.addMany(C,11,0,11),m.addMany(x(32,128),11,0,11),m.addMany(x(28,32),11,0,11),m.addMany(C,10,0,10),m.add(127,10,0,10),m.addMany(x(28,32),10,0,10),m.addMany(x(48,60),10,8,10),m.addMany([60,61,62,63],10,0,11),m.addMany(x(32,48),10,9,12),m.addMany(C,12,0,12),m.add(127,12,0,12),m.addMany(x(28,32),12,0,12),m.addMany(x(32,48),12,9,12),m.addMany(x(48,64),12,0,11),m.addMany(x(64,127),12,12,13),m.addMany(x(64,127),10,12,13),m.addMany(x(64,127),9,12,13),m.addMany(C,13,13,13),m.addMany(_,13,13,13),m.add(127,13,0,13),m.addMany([27,156,24,26],13,14,0),m.add(S,0,2,0),m.add(S,8,5,8),m.add(S,6,0,6),m.add(S,11,0,11),m.add(S,13,13,13),m})();class y extends u.Disposable{constructor(v=o.VT500_TRANSITION_TABLE){super(),this._transitions=v,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new p.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(x,_,C)=>{},this._executeHandlerFb=x=>{},this._csiHandlerFb=(x,_)=>{},this._escHandlerFb=x=>{},this._errorHandlerFb=x=>x,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(v,x=[64,126]){let _=0;if(v.prefix){if(v.prefix.length>1)throw new Error("only one byte as prefix supported");if(_=v.prefix.charCodeAt(0),_&&60>_||_>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(v.intermediates){if(v.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let M=0;M<v.intermediates.length;++M){const T=v.intermediates.charCodeAt(M);if(32>T||T>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");_<<=8,_|=T}}if(v.final.length!==1)throw new Error("final must be a single byte");const C=v.final.charCodeAt(0);if(x[0]>C||C>x[1])throw new Error(`final must be in range ${x[0]} .. ${x[1]}`);return _<<=8,_|=C,_}identToString(v){const x=[];for(;v;)x.push(String.fromCharCode(255&v)),v>>=8;return x.reverse().join("")}setPrintHandler(v){this._printHandler=v}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(v,x){const _=this._identifier(v,[48,126]);this._escHandlers[_]===void 0&&(this._escHandlers[_]=[]);const C=this._escHandlers[_];return C.push(x),{dispose:()=>{const M=C.indexOf(x);M!==-1&&C.splice(M,1)}}}clearEscHandler(v){this._escHandlers[this._identifier(v,[48,126])]&&delete this._escHandlers[this._identifier(v,[48,126])]}setEscHandlerFallback(v){this._escHandlerFb=v}setExecuteHandler(v,x){this._executeHandlers[v.charCodeAt(0)]=x}clearExecuteHandler(v){this._executeHandlers[v.charCodeAt(0)]&&delete this._executeHandlers[v.charCodeAt(0)]}setExecuteHandlerFallback(v){this._executeHandlerFb=v}registerCsiHandler(v,x){const _=this._identifier(v);this._csiHandlers[_]===void 0&&(this._csiHandlers[_]=[]);const C=this._csiHandlers[_];return C.push(x),{dispose:()=>{const M=C.indexOf(x);M!==-1&&C.splice(M,1)}}}clearCsiHandler(v){this._csiHandlers[this._identifier(v)]&&delete this._csiHandlers[this._identifier(v)]}setCsiHandlerFallback(v){this._csiHandlerFb=v}registerDcsHandler(v,x){return this._dcsParser.registerHandler(this._identifier(v),x)}clearDcsHandler(v){this._dcsParser.clearHandler(this._identifier(v))}setDcsHandlerFallback(v){this._dcsParser.setHandlerFallback(v)}registerOscHandler(v,x){return this._oscParser.registerHandler(v,x)}clearOscHandler(v){this._oscParser.clearHandler(v)}setOscHandlerFallback(v){this._oscParser.setHandlerFallback(v)}setErrorHandler(v){this._errorHandler=v}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(v,x,_,C,M){this._parseStack.state=v,this._parseStack.handlers=x,this._parseStack.handlerPos=_,this._parseStack.transition=C,this._parseStack.chunkPos=M}parse(v,x,_){let C,M=0,T=0,R=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,R=this._parseStack.chunkPos+1;else{if(_===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const P=this._parseStack.handlers;let L=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(_===!1&&L>-1){for(;L>=0&&(C=P[L](this._params),C!==!0);L--)if(C instanceof Promise)return this._parseStack.handlerPos=L,C}this._parseStack.handlers=[];break;case 4:if(_===!1&&L>-1){for(;L>=0&&(C=P[L](),C!==!0);L--)if(C instanceof Promise)return this._parseStack.handlerPos=L,C}this._parseStack.handlers=[];break;case 6:if(M=v[this._parseStack.chunkPos],C=this._dcsParser.unhook(M!==24&&M!==26,_),C)return C;M===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(M=v[this._parseStack.chunkPos],C=this._oscParser.end(M!==24&&M!==26,_),C)return C;M===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,R=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let P=R;P<x;++P){switch(M=v[P],T=this._transitions.table[this.currentState<<8|(M<160?M:S)],T>>4){case 2:for(let z=P+1;;++z){if(z>=x||(M=v[z])<32||M>126&&M<S){this._printHandler(v,P,z),P=z-1;break}if(++z>=x||(M=v[z])<32||M>126&&M<S){this._printHandler(v,P,z),P=z-1;break}if(++z>=x||(M=v[z])<32||M>126&&M<S){this._printHandler(v,P,z),P=z-1;break}if(++z>=x||(M=v[z])<32||M>126&&M<S){this._printHandler(v,P,z),P=z-1;break}}break;case 3:this._executeHandlers[M]?this._executeHandlers[M]():this._executeHandlerFb(M),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:P,code:M,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const L=this._csiHandlers[this._collect<<8|M];let j=L?L.length-1:-1;for(;j>=0&&(C=L[j](this._params),C!==!0);j--)if(C instanceof Promise)return this._preserveStack(3,L,j,T,P),C;j<0&&this._csiHandlerFb(this._collect<<8|M,this._params),this.precedingJoinState=0;break;case 8:do switch(M){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(M-48)}while(++P<x&&(M=v[P])>47&&M<60);P--;break;case 9:this._collect<<=8,this._collect|=M;break;case 10:const $=this._escHandlers[this._collect<<8|M];let U=$?$.length-1:-1;for(;U>=0&&(C=$[U](),C!==!0);U--)if(C instanceof Promise)return this._preserveStack(4,$,U,T,P),C;U<0&&this._escHandlerFb(this._collect<<8|M),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|M,this._params);break;case 13:for(let z=P+1;;++z)if(z>=x||(M=v[z])===24||M===26||M===27||M>127&&M<S){this._dcsParser.put(v,P,z),P=z-1;break}break;case 14:if(C=this._dcsParser.unhook(M!==24&&M!==26),C)return this._preserveStack(6,[],0,T,P),C;M===27&&(T|=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 z=P+1;;z++)if(z>=x||(M=v[z])<32||M>127&&M<S){this._oscParser.put(v,P,z),P=z-1;break}break;case 6:if(C=this._oscParser.end(M!==24&&M!==26),C)return this._preserveStack(5,[],0,T,P),C;M===27&&(T|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&T}}}o.EscapeSequenceParser=y},6242:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.OscHandler=o.OscParser=void 0;const u=h(5770),p=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,w){this._handlers[g]===void 0&&(this._handlers[g]=[]);const S=this._handlers[g];return S.push(w),{dispose:()=>{const y=S.indexOf(w);y!==-1&&S.splice(y,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,w,S){if(this._active.length)for(let y=this._active.length-1;y>=0;y--)this._active[y].put(g,w,S);else this._handlerFb(this._id,"PUT",(0,p.utf32ToString)(g,w,S))}start(){this.reset(),this._state=1}put(g,w,S){if(this._state!==3){if(this._state===1)for(;w<S;){const y=g[w++];if(y===59){this._state=2,this._start();break}if(y<48||57<y)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+y-48}this._state===2&&S-w>0&&this._put(g,w,S)}}end(g,w=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let S=!1,y=this._active.length-1,m=!1;if(this._stack.paused&&(y=this._stack.loopPosition-1,S=w,m=this._stack.fallThrough,this._stack.paused=!1),!m&&S===!1){for(;y>=0&&(S=this._active[y].end(g),S!==!0);y--)if(S instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=y,this._stack.fallThrough=!1,S;y--}for(;y>=0;y--)if(S=this._active[y].end(!1),S instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=y,this._stack.fallThrough=!0,S}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,w,S){this._hitLimit||(this._data+=(0,p.utf32ToString)(g,w,S),this._data.length>u.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(g){let w=!1;if(this._hitLimit)w=!1;else if(g&&(w=this._handler(this._data),w instanceof Promise))return w.then((S=>(this._data="",this._hitLimit=!1,S)));return this._data="",this._hitLimit=!1,w}}},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 w=Array.isArray(d[0])?1:0;w<d.length;++w){const S=d[w];if(Array.isArray(S))for(let y=0;y<S.length;++y)g.addSubParam(S[y]);else g.addParam(S)}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 w=this._subParamsIdx[g]>>8,S=255&this._subParamsIdx[g];S-w>0&&d.push(Array.prototype.slice.call(this._subParams,w,S))}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,w=255&this._subParamsIdx[d];return w-g>0?this._subParams.subarray(g,w):null}getSubParamsAll(){const d={};for(let g=0;g<this.length;++g){const w=this._subParamsIdx[g]>>8,S=255&this._subParamsIdx[g];S-w>0&&(d[g]=this._subParams.slice(w,S))}return d}addDigit(d){let g;if(this._rejectDigits||!(g=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const w=this._digitIsSub?this._subParams:this.params,S=w[g-1];w[g-1]=~S?Math.min(10*S+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 p={instance:u,dispose:u.dispose,isDisposed:!1};this._addons.push(p),u.dispose=()=>this._wrappedAddonDispose(p),u.activate(h)}_wrappedAddonDispose(h){if(h.isDisposed)return;let u=-1;for(let p=0;p<this._addons.length;p++)if(this._addons[p]===h){u=p;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),p=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 p.CellData}}},3785:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferLineApiView=void 0;const u=h(511);o.BufferLineApiView=class{constructor(p){this._line=p}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(p,d){if(!(p<0||p>=this._line.length))return d?(this._line.loadCell(p,d),d):this._line.loadCell(p,new u.CellData)}translateToString(p,d,g){return this._line.translateToString(p,d,g)}}},8285:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferNamespaceApi=void 0;const u=h(8771),p=h(8460),d=h(844);class g extends d.Disposable{constructor(S){super(),this._core=S,this._onBufferChange=this.register(new p.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,(p=>u(p.toArray())))}addCsiHandler(h,u){return this.registerCsiHandler(h,u)}registerDcsHandler(h,u){return this._core.registerDcsHandler(h,((p,d)=>u(p,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,v,x,_){var C,M=arguments.length,T=M<3?v:_===null?_=Object.getOwnPropertyDescriptor(v,x):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(m,v,x,_);else for(var R=m.length-1;R>=0;R--)(C=m[R])&&(T=(M<3?C(T):M>3?C(v,x,T):C(v,x))||T);return M>3&&T&&Object.defineProperty(v,x,T),T},p=this&&this.__param||function(m,v){return function(x,_){v(x,_,m)}};Object.defineProperty(o,"__esModule",{value:!0}),o.BufferService=o.MINIMUM_ROWS=o.MINIMUM_COLS=void 0;const d=h(8460),g=h(844),w=h(5295),S=h(2585);o.MINIMUM_COLS=2,o.MINIMUM_ROWS=1;let y=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 w.BufferSet(m,this))}resize(m,v){this.cols=m,this.rows=v,this.buffers.resize(m,v),this._onResize.fire({cols:m,rows:v})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(m,v=!1){const x=this.buffer;let _;_=this._cachedBlankLine,_&&_.length===this.cols&&_.getFg(0)===m.fg&&_.getBg(0)===m.bg||(_=x.getBlankLine(m,v),this._cachedBlankLine=_),_.isWrapped=v;const C=x.ybase+x.scrollTop,M=x.ybase+x.scrollBottom;if(x.scrollTop===0){const T=x.lines.isFull;M===x.lines.length-1?T?x.lines.recycle().copyFrom(_):x.lines.push(_.clone()):x.lines.splice(M+1,0,_.clone()),T?this.isUserScrolling&&(x.ydisp=Math.max(x.ydisp-1,0)):(x.ybase++,this.isUserScrolling||x.ydisp++)}else{const T=M-C+1;x.lines.shiftElements(C+1,T-1,-1),x.lines.set(M,_.clone())}this.isUserScrolling||(x.ydisp=x.ybase),this._onScroll.fire(x.ydisp)}scrollLines(m,v,x){const _=this.buffer;if(m<0){if(_.ydisp===0)return;this.isUserScrolling=!0}else m+_.ydisp>=_.ybase&&(this.isUserScrolling=!1);const C=_.ydisp;_.ydisp=Math.max(Math.min(_.ydisp+m,_.ybase),0),C!==_.ydisp&&(v||this._onScroll.fire(_.ydisp))}};o.BufferService=y=u([p(0,S.IOptionsService)],y)},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(_,C,M,T){var R,P=arguments.length,L=P<3?C:T===null?T=Object.getOwnPropertyDescriptor(C,M):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(_,C,M,T);else for(var j=_.length-1;j>=0;j--)(R=_[j])&&(L=(P<3?R(L):P>3?R(C,M,L):R(C,M))||L);return P>3&&L&&Object.defineProperty(C,M,L),L},p=this&&this.__param||function(_,C){return function(M,T){C(M,T,_)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CoreMouseService=void 0;const d=h(2585),g=h(8460),w=h(844),S={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:_=>_.button!==4&&_.action===1&&(_.ctrl=!1,_.alt=!1,_.shift=!1,!0)},VT200:{events:19,restrict:_=>_.action!==32},DRAG:{events:23,restrict:_=>_.action!==32||_.button!==3},ANY:{events:31,restrict:_=>!0}};function y(_,C){let M=(_.ctrl?16:0)|(_.shift?4:0)|(_.alt?8:0);return _.button===4?(M|=64,M|=_.action):(M|=3&_.button,4&_.button&&(M|=64),8&_.button&&(M|=128),_.action===32?M|=32:_.action!==0||C||(M|=3)),M}const m=String.fromCharCode,v={DEFAULT:_=>{const C=[y(_,!1)+32,_.col+32,_.row+32];return C[0]>255||C[1]>255||C[2]>255?"":`\x1B[M${m(C[0])}${m(C[1])}${m(C[2])}`},SGR:_=>{const C=_.action===0&&_.button!==4?"m":"M";return`\x1B[<${y(_,!0)};${_.col};${_.row}${C}`},SGR_PIXELS:_=>{const C=_.action===0&&_.button!==4?"m":"M";return`\x1B[<${y(_,!0)};${_.x};${_.y}${C}`}};let x=o.CoreMouseService=class extends w.Disposable{constructor(_,C){super(),this._bufferService=_,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 M of Object.keys(S))this.addProtocol(M,S[M]);for(const M of Object.keys(v))this.addEncoding(M,v[M]);this.reset()}addProtocol(_,C){this._protocols[_]=C}addEncoding(_,C){this._encodings[_]=C}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(_){if(!this._protocols[_])throw new Error(`unknown protocol "${_}"`);this._activeProtocol=_,this._onProtocolChange.fire(this._protocols[_].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(_){if(!this._encodings[_])throw new Error(`unknown encoding "${_}"`);this._activeEncoding=_}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(_){if(_.col<0||_.col>=this._bufferService.cols||_.row<0||_.row>=this._bufferService.rows||_.button===4&&_.action===32||_.button===3&&_.action!==32||_.button!==4&&(_.action===2||_.action===3)||(_.col++,_.row++,_.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,_,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(_))return!1;const C=this._encodings[this._activeEncoding](_);return C&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(C):this._coreService.triggerDataEvent(C,!0)),this._lastEvent=_,!0}explainEvents(_){return{down:!!(1&_),up:!!(2&_),drag:!!(4&_),move:!!(8&_),wheel:!!(16&_)}}_equalEvents(_,C,M){if(M){if(_.x!==C.x||_.y!==C.y)return!1}else if(_.col!==C.col||_.row!==C.row)return!1;return _.button===C.button&&_.action===C.action&&_.ctrl===C.ctrl&&_.alt===C.alt&&_.shift===C.shift}};o.CoreMouseService=x=u([p(0,d.IBufferService),p(1,d.ICoreService)],x)},6975:function(c,o,h){var u=this&&this.__decorate||function(x,_,C,M){var T,R=arguments.length,P=R<3?_:M===null?M=Object.getOwnPropertyDescriptor(_,C):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")P=Reflect.decorate(x,_,C,M);else for(var L=x.length-1;L>=0;L--)(T=x[L])&&(P=(R<3?T(P):R>3?T(_,C,P):T(_,C))||P);return R>3&&P&&Object.defineProperty(_,C,P),P},p=this&&this.__param||function(x,_){return function(C,M){_(C,M,x)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CoreService=void 0;const d=h(1439),g=h(8460),w=h(844),S=h(2585),y=Object.freeze({insertMode:!1}),m=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let v=o.CoreService=class extends w.Disposable{constructor(x,_,C){super(),this._bufferService=x,this._logService=_,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)(y),this.decPrivateModes=(0,d.clone)(m)}reset(){this.modes=(0,d.clone)(y),this.decPrivateModes=(0,d.clone)(m)}triggerDataEvent(x,_=!1){if(this._optionsService.rawOptions.disableStdin)return;const C=this._bufferService.buffer;_&&this._optionsService.rawOptions.scrollOnUserInput&&C.ybase!==C.ydisp&&this._onRequestScrollToBottom.fire(),_&&this._onUserInput.fire(),this._logService.debug(`sending data "${x}"`,(()=>x.split("").map((M=>M.charCodeAt(0))))),this._onData.fire(x)}triggerBinaryEvent(x){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${x}"`,(()=>x.split("").map((_=>_.charCodeAt(0))))),this._onBinary.fire(x))}};o.CoreService=v=u([p(0,S.IBufferService),p(1,S.ILogService),p(2,S.IOptionsService)],v)},9074:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DecorationService=void 0;const u=h(8055),p=h(8460),d=h(844),g=h(6106);let w=0,S=0;class y extends d.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new g.SortedList((x=>x==null?void 0:x.marker.line)),this._onDecorationRegistered=this.register(new p.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new p.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,d.toDisposable)((()=>this.reset())))}registerDecoration(x){if(x.marker.isDisposed)return;const _=new m(x);if(_){const C=_.marker.onDispose((()=>_.dispose()));_.onDispose((()=>{_&&(this._decorations.delete(_)&&this._onDecorationRemoved.fire(_),C.dispose())})),this._decorations.insert(_),this._onDecorationRegistered.fire(_)}return _}reset(){for(const x of this._decorations.values())x.dispose();this._decorations.clear()}*getDecorationsAtCell(x,_,C){let M=0,T=0;for(const R of this._decorations.getKeyIterator(_))M=R.options.x??0,T=M+(R.options.width??1),x>=M&&x<T&&(!C||(R.options.layer??"bottom")===C)&&(yield R)}forEachDecorationAtCell(x,_,C,M){this._decorations.forEachByKey(_,(T=>{w=T.options.x??0,S=w+(T.options.width??1),x>=w&&x<S&&(!C||(T.options.layer??"bottom")===C)&&M(T)}))}}o.DecorationService=y;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(x){super(),this.options=x,this.onRenderEmitter=this.register(new p.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new p.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=x.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),p=h(8343);class d{constructor(...w){this._entries=new Map;for(const[S,y]of w)this.set(S,y)}set(w,S){const y=this._entries.get(w);return this._entries.set(w,S),y}forEach(w){for(const[S,y]of this._entries.entries())w(S,y)}has(w){return this._entries.has(w)}get(w){return this._entries.get(w)}}o.ServiceCollection=d,o.InstantiationService=class{constructor(){this._services=new d,this._services.set(u.IInstantiationService,this)}setService(g,w){this._services.set(g,w)}getService(g){return this._services.get(g)}createInstance(g,...w){const S=(0,p.getServiceDependencies)(g).sort(((v,x)=>v.index-x.index)),y=[];for(const v of S){const x=this._services.get(v.id);if(!x)throw new Error(`[createInstance] ${g.name} depends on UNKNOWN service ${v.id}.`);y.push(x)}const m=S.length>0?S[0].index:w.length;if(w.length!==m)throw new Error(`[createInstance] First service dependency of ${g.name} at position ${m+1} conflicts with ${w.length} static arguments`);return new g(...w,...y)}}},7866:function(c,o,h){var u=this&&this.__decorate||function(m,v,x,_){var C,M=arguments.length,T=M<3?v:_===null?_=Object.getOwnPropertyDescriptor(v,x):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(m,v,x,_);else for(var R=m.length-1;R>=0;R--)(C=m[R])&&(T=(M<3?C(T):M>3?C(v,x,T):C(v,x))||T);return M>3&&T&&Object.defineProperty(v,x,T),T},p=this&&this.__param||function(m,v){return function(x,_){v(x,_,m)}};Object.defineProperty(o,"__esModule",{value:!0}),o.traceCall=o.setTraceLogger=o.LogService=void 0;const d=h(844),g=h(2585),w={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 S,y=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()))),S=this}_updateLogLevel(){this._logLevel=w[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(m){for(let v=0;v<m.length;v++)typeof m[v]=="function"&&(m[v]=m[v]())}_log(m,v,x){this._evalLazyOptionalParams(x),m.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+v,...x)}trace(m,...v){var x;this._logLevel<=g.LogLevelEnum.TRACE&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.trace.bind(this._optionsService.options.logger))??console.log,m,v)}debug(m,...v){var x;this._logLevel<=g.LogLevelEnum.DEBUG&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.debug.bind(this._optionsService.options.logger))??console.log,m,v)}info(m,...v){var x;this._logLevel<=g.LogLevelEnum.INFO&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.info.bind(this._optionsService.options.logger))??console.info,m,v)}warn(m,...v){var x;this._logLevel<=g.LogLevelEnum.WARN&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.warn.bind(this._optionsService.options.logger))??console.warn,m,v)}error(m,...v){var x;this._logLevel<=g.LogLevelEnum.ERROR&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.error.bind(this._optionsService.options.logger))??console.error,m,v)}};o.LogService=y=u([p(0,g.IOptionsService)],y),o.setTraceLogger=function(m){S=m},o.traceCall=function(m,v,x){if(typeof x.value!="function")throw new Error("not supported");const _=x.value;x.value=function(...C){if(S.logLevel!==g.LogLevelEnum.TRACE)return _.apply(this,C);S.trace(`GlyphRenderer#${_.name}(${C.map((T=>JSON.stringify(T))).join(", ")})`);const M=_.apply(this,C);return S.trace(`GlyphRenderer#${_.name} return`,M),M}}},7302:(c,o,h)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.OptionsService=o.DEFAULT_OPTIONS=void 0;const u=h(8460),p=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 w extends p.Disposable{constructor(y){super(),this._onOptionChange=this.register(new u.EventEmitter),this.onOptionChange=this._onOptionChange.event;const m={...o.DEFAULT_OPTIONS};for(const v in y)if(v in m)try{const x=y[v];m[v]=this._sanitizeAndValidateOption(v,x)}catch(x){console.error(x)}this.rawOptions=m,this.options={...m},this._setupOptions(),this.register((0,p.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(y,m){return this.onOptionChange((v=>{v===y&&m(this.rawOptions[y])}))}onMultipleOptionChange(y,m){return this.onOptionChange((v=>{y.indexOf(v)!==-1&&m()}))}_setupOptions(){const y=v=>{if(!(v in o.DEFAULT_OPTIONS))throw new Error(`No option with key "${v}"`);return this.rawOptions[v]},m=(v,x)=>{if(!(v in o.DEFAULT_OPTIONS))throw new Error(`No option with key "${v}"`);x=this._sanitizeAndValidateOption(v,x),this.rawOptions[v]!==x&&(this.rawOptions[v]=x,this._onOptionChange.fire(v))};for(const v in this.rawOptions){const x={get:y.bind(this,v),set:m.bind(this,v)};Object.defineProperty(this.options,v,x)}}_sanitizeAndValidateOption(y,m){switch(y){case"cursorStyle":if(m||(m=o.DEFAULT_OPTIONS[y]),!(function(v){return v==="block"||v==="underline"||v==="bar"})(m))throw new Error(`"${m}" is not a valid value for ${y}`);break;case"wordSeparator":m||(m=o.DEFAULT_OPTIONS[y]);break;case"fontWeight":case"fontWeightBold":if(typeof m=="number"&&1<=m&&m<=1e3)break;m=g.includes(m)?m:o.DEFAULT_OPTIONS[y];break;case"cursorWidth":m=Math.floor(m);case"lineHeight":case"tabStopWidth":if(m<1)throw new Error(`${y} 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(`${y} cannot be less than 0, value: ${m}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(m<=0)throw new Error(`${y} cannot be less than or equal to 0, value: ${m}`);break;case"rows":case"cols":if(!m&&m!==0)throw new Error(`${y} must be numeric, value: ${m}`);break;case"windowsPty":m=m??{}}return m}}o.OptionsService=w},2660:function(c,o,h){var u=this&&this.__decorate||function(w,S,y,m){var v,x=arguments.length,_=x<3?S:m===null?m=Object.getOwnPropertyDescriptor(S,y):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(w,S,y,m);else for(var C=w.length-1;C>=0;C--)(v=w[C])&&(_=(x<3?v(_):x>3?v(S,y,_):v(S,y))||_);return x>3&&_&&Object.defineProperty(S,y,_),_},p=this&&this.__param||function(w,S){return function(y,m){S(y,m,w)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OscLinkService=void 0;const d=h(2585);let g=o.OscLinkService=class{constructor(w){this._bufferService=w,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(w){const S=this._bufferService.buffer;if(w.id===void 0){const C=S.addMarker(S.ybase+S.y),M={data:w,id:this._nextId++,lines:[C]};return C.onDispose((()=>this._removeMarkerFromLink(M,C))),this._dataByLinkId.set(M.id,M),M.id}const y=w,m=this._getEntryIdKey(y),v=this._entriesWithId.get(m);if(v)return this.addLineToLink(v.id,S.ybase+S.y),v.id;const x=S.addMarker(S.ybase+S.y),_={id:this._nextId++,key:this._getEntryIdKey(y),data:y,lines:[x]};return x.onDispose((()=>this._removeMarkerFromLink(_,x))),this._entriesWithId.set(_.key,_),this._dataByLinkId.set(_.id,_),_.id}addLineToLink(w,S){const y=this._dataByLinkId.get(w);if(y&&y.lines.every((m=>m.line!==S))){const m=this._bufferService.buffer.addMarker(S);y.lines.push(m),m.onDispose((()=>this._removeMarkerFromLink(y,m)))}}getLinkData(w){var S;return(S=this._dataByLinkId.get(w))==null?void 0:S.data}_getEntryIdKey(w){return`${w.id};;${w.uri}`}_removeMarkerFromLink(w,S){const y=w.lines.indexOf(S);y!==-1&&(w.lines.splice(y,1),w.lines.length===0&&(w.data.id!==void 0&&this._entriesWithId.delete(w.key),this._dataByLinkId.delete(w.id)))}};o.OscLinkService=g=u([p(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(p){return p[u]||[]},o.createDecorator=function(p){if(o.serviceRegistry.has(p))return o.serviceRegistry.get(p);const d=function(g,w,S){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(y,m,v){m[h]===m?m[u].push({id:y,index:v}):(m[u]=[{id:y,index:v}],m[h]=m)})(d,g,S)};return d.toString=()=>p,o.serviceRegistry.set(p,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 p;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"})(p||(o.LogLevelEnum=p={})),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),p=h(225);class d{static extractShouldJoin(w){return(1&w)!=0}static extractWidth(w){return w>>1&3}static extractCharKind(w){return w>>3}static createPropertyValue(w,S,y=!1){return(16777215&w)<<3|(3&S)<<1|(y?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new u.EventEmitter,this.onChange=this._onChange.event;const w=new p.UnicodeV6;this.register(w),this._active=w.version,this._activeProvider=w}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(w){if(!this._providers[w])throw new Error(`unknown Unicode version "${w}"`);this._active=w,this._activeProvider=this._providers[w],this._onChange.fire(w)}register(w){this._providers[w.version]=w}wcwidth(w){return this._activeProvider.wcwidth(w)}getStringCellWidth(w){let S=0,y=0;const m=w.length;for(let v=0;v<m;++v){let x=w.charCodeAt(v);if(55296<=x&&x<=56319){if(++v>=m)return S+this.wcwidth(x);const M=w.charCodeAt(v);56320<=M&&M<=57343?x=1024*(x-55296)+M-56320+65536:S+=this.wcwidth(M)}const _=this.charProperties(x,y);let C=d.extractWidth(_);d.extractShouldJoin(_)&&(C-=d.extractWidth(y)),S+=C,y=_}return S}charProperties(w,S){return this._activeProvider.charProperties(w,S)}}o.UnicodeService=d}},r={};function n(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,n),h.exports}var l={};return(()=>{var c=l;Object.defineProperty(c,"__esModule",{value:!0}),c.Terminal=void 0;const o=n(9042),h=n(3236),u=n(844),p=n(5741),d=n(8285),g=n(7975),w=n(7090),S=["cols","rows"];class y extends u.Disposable{constructor(v){super(),this._core=this.register(new h.Terminal(v)),this._addonManager=this.register(new p.AddonManager),this._publicOptions={...this._core.options};const x=C=>this._core.options[C],_=(C,M)=>{this._checkReadonlyOptions(C),this._core.options[C]=M};for(const C in this._core.options){const M={get:x.bind(this,C),set:_.bind(this,C)};Object.defineProperty(this._publicOptions,C,M)}}_checkReadonlyOptions(v){if(S.includes(v))throw new Error(`Option "${v}" 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 w.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 v=this._core.coreService.decPrivateModes;let x="none";switch(this._core.coreMouseService.activeProtocol){case"X10":x="x10";break;case"VT200":x="vt200";break;case"DRAG":x="drag";break;case"ANY":x="any"}return{applicationCursorKeysMode:v.applicationCursorKeys,applicationKeypadMode:v.applicationKeypad,bracketedPasteMode:v.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:x,originMode:v.origin,reverseWraparoundMode:v.reverseWraparound,sendFocusMode:v.sendFocus,wraparoundMode:v.wraparound}}get options(){return this._publicOptions}set options(v){for(const x in v)this._publicOptions[x]=v[x]}blur(){this._core.blur()}focus(){this._core.focus()}input(v,x=!0){this._core.input(v,x)}resize(v,x){this._verifyIntegers(v,x),this._core.resize(v,x)}open(v){this._core.open(v)}attachCustomKeyEventHandler(v){this._core.attachCustomKeyEventHandler(v)}attachCustomWheelEventHandler(v){this._core.attachCustomWheelEventHandler(v)}registerLinkProvider(v){return this._core.registerLinkProvider(v)}registerCharacterJoiner(v){return this._checkProposedApi(),this._core.registerCharacterJoiner(v)}deregisterCharacterJoiner(v){this._checkProposedApi(),this._core.deregisterCharacterJoiner(v)}registerMarker(v=0){return this._verifyIntegers(v),this._core.registerMarker(v)}registerDecoration(v){return this._checkProposedApi(),this._verifyPositiveIntegers(v.x??0,v.width??0,v.height??0),this._core.registerDecoration(v)}hasSelection(){return this._core.hasSelection()}select(v,x,_){this._verifyIntegers(v,x,_),this._core.select(v,x,_)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(v,x){this._verifyIntegers(v,x),this._core.selectLines(v,x)}dispose(){super.dispose()}scrollLines(v){this._verifyIntegers(v),this._core.scrollLines(v)}scrollPages(v){this._verifyIntegers(v),this._core.scrollPages(v)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(v){this._verifyIntegers(v),this._core.scrollToLine(v)}clear(){this._core.clear()}write(v,x){this._core.write(v,x)}writeln(v,x){this._core.write(v),this._core.write(`\r
|
|
307
|
+
`,x)}paste(v){this._core.paste(v)}refresh(v,x){this._verifyIntegers(v,x),this._core.refresh(v,x)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(v){this._addonManager.loadAddon(this,v)}static get strings(){return o}_verifyIntegers(...v){for(const x of v)if(x===1/0||isNaN(x)||x%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...v){for(const x of v)if(x&&(x===1/0||isNaN(x)||x%1!=0||x<0))throw new Error("This API only accepts positive integers")}}c.Terminal=y})(),l})()))})(md)),md.exports}var cD=lD();const hD={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 _w({agentId:t,autoFocus:e=!0}){const s=oe.useRef(null);return oe.useEffect(()=>{const r=s.current;if(!r)return;let n=!1;const l=new cD.Terminal({theme:hD,fontFamily:'"VT323", ui-monospace, Menlo, monospace',fontSize:19,lineHeight:1.05,cursorBlink:!0,scrollback:3e3,convertEol:!1,allowProposedApi:!1}),c=new aD.FitAddon;l.loadAddon(c);let o=()=>{},h=null;return document.fonts.load('19px "VT323"').finally(()=>{n||(l.open(r),c.fit(),ke.resizeTerminal(t,l.cols,l.rows),l.onResize(({cols:u,rows:p})=>ke.resizeTerminal(t,u,p)),l.write(_M(t)),o=vM(t,u=>l.write(u)),l.onData(u=>ke.sendTerminalInput(t,u)),h=new ResizeObserver(()=>{try{c.fit()}catch{}}),h.observe(r),e&&l.focus())}),()=>{n=!0,o(),h==null||h.disconnect(),l.dispose()}},[t,e]),E.jsx("div",{ref:s,className:"h-full min-h-0 w-full bg-navy-2"})}function uD({id:t,initialTab:e}){const s=Te(h=>h.snap),[r,n]=oe.useState(e??"terminal"),l=s==null?void 0:s.config.team.find(h=>h.id===t),c=s==null?void 0:s.agents.find(h=>h.agentId===t);if(!s||!l||!c)return E.jsx(E.Fragment,{children:E.jsx(Ko,{children:E.jsx("b",{children:"Agent removed"})})});const o=s.messages.filter(h=>h.toId===t).length;return E.jsxs(E.Fragment,{children:[E.jsxs(Ko,{children:[E.jsx(gn,{color:l.color,lead:l.isLead,size:36}),E.jsxs("div",{className:"min-w-0",children:[E.jsxs("div",{className:"flex items-center gap-2",children:[E.jsx("b",{className:"text-[18px]",children:l.name}),E.jsx(pw,{state:c.state})]}),E.jsxs("div",{className:"truncate font-term text-[17px] text-muted",children:[l.role," · ",Ci[l.cli],l.model?` ${l.model}`:""," · ",l.mode==="sandbox"?"Docker Sandbox":"Local mode"]})]})]}),E.jsx(fD,{agent:l,status:c}),c.note&&E.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"&&E.jsx("span",{className:"ml-2 text-muted",children:"— answer in the terminal and press Enter"})]}),E.jsx("div",{className:"border-b-[3px] border-ink px-3 py-2",children:E.jsx(nD,{value:r,onChange:n,tabs:[{id:"terminal",label:"Terminal"},{id:"task",label:"Task"},{id:"sandbox",label:"Sandbox"},{id:"messages",label:`Messages${o?` · ${o}`:""}`}]})}),E.jsxs("div",{className:"min-h-0 flex-1 overflow-hidden",children:[r==="terminal"&&(c.session.state==="running"?E.jsx(_w,{agentId:t}):E.jsx(pD,{agent:l,status:c})),r==="task"&&E.jsx(mD,{snap:s,agent:l,taskId:c.currentTaskId}),r==="sandbox"&&E.jsx(gD,{snap:s,agent:l}),r==="messages"&&E.jsx(_D,{snap:s,agent:l})]})]})}const dD={running:"#00e436",starting:"#29adff",stopped:"#83769c",failed:"#ff004d"};function fD({agent:t,status:e}){const s=e.session,r=Te(n=>n.live);return E.jsxs("div",{className:"flex items-center gap-2 border-b-[3px] border-ink bg-cream px-3 py-1.5 text-[13px]",children:[E.jsx("span",{className:`chip chip-dot ${s.state==="starting"?"blink":""}`,style:{"--c":dD[s.state]},children:s.state==="running"?"Session running":s.state==="starting"?"Starting":s.state==="failed"?"Failed":"Stopped"}),E.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&&E.jsx("button",{className:"btn px-2 text-[12px]",onClick:()=>ke.openWorkspace(t.id),title:"Open the agent's folder",children:"Open folder"}),s.state==="running"||s.state==="starting"?E.jsx("button",{className:"btn px-2 text-[12px]",disabled:s.state==="starting",onClick:()=>ke.stopAgent(t.id),children:"Stop"}):E.jsx("button",{className:"btn px-2 text-[12px]",onClick:()=>ke.startAgent(t.id),children:"Start"})]})}function pD({agent:t,status:e}){const s=e.session,r=Te(l=>{var c;return(c=l.snap)==null?void 0:c.setup}),n=t.mode==="sandbox"?!(r!=null&&r.sandboxReady):!(r!=null&&r.localReady);return E.jsx("div",{className:"grid h-full place-items-center bg-navy-2 p-6 text-center text-[#dfe6ff]",children:E.jsx("div",{className:"max-w-[380px]",children:s.state==="starting"?E.jsx("p",{className:"blink font-term text-[22px]",children:s.detail??"Starting…"}):E.jsxs(E.Fragment,{children:[E.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&&E.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}),E.jsx("p",{className:"mb-4 text-[13px] text-[#9aa6d1]",children:t.mode==="sandbox"?`Start runs ${Ci[t.cli]} in a Docker Sandbox on this agent's own copy of the repo.`:`Start runs ${Ci[t.cli]} locally in this agent's own copy of the repo, with permission prompts on.`}),t.cli==="codex"&&E.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 ",E.jsx("b",{children:"Yes"}),", then ",E.jsx("b",{children:"Trust all and continue"}),", in the terminal."]}),E.jsx("p",{className:"hidden"}),E.jsxs("div",{className:"flex justify-center gap-2",children:[E.jsxs("button",{className:"btn text-ink",onClick:()=>ke.startAgent(t.id),children:["Start ",t.name]}),n&&E.jsx("button",{className:"btn text-ink",onClick:()=>Pe.openSetup(),children:"Setup checklist"})]})]})})})}function mD({snap:t,agent:e,taskId:s}){var u,p;const r=s?t.tasks.find(d=>d.id===s):null,n=r!=null&&r.prNumber?t.pullRequests.find(d=>d.number===r.prNumber):null,l=t.boards.filter(d=>d.status==="active"),c=t.tasks.filter(d=>d.status==="todo"&&l.some(g=>g.id===d.boardId)),[o,h]=oe.useState("");return e.isLead?E.jsxs("div",{className:"scroll-thin h-full overflow-y-auto p-4",children:[E.jsx(Ge,{children:"Planning"}),E.jsx("p",{className:"mb-3 text-[15px]",children:"The lead plans and assigns work through the HQ Team MCP. It writes no app code."}),l.map(d=>{const g=t.tasks.filter(S=>S.boardId===d.id),w=S=>g.filter(y=>y.status===S).length;return E.jsxs("button",{className:"panel mb-2 block w-full px-3 py-2 text-left",onClick:()=>Pe.openBoards(d.id),children:[E.jsx("b",{children:d.title}),E.jsxs("div",{className:"font-term text-[17px] text-muted",children:[w("todo")," to do · ",w("in-progress")," in progress · ",w("in-review")," in review · ",w("done")," done"]})]},d.id)})]}):E.jsxs("div",{className:"scroll-thin h-full overflow-y-auto p-4",children:[E.jsx(Ge,{children:"Current task"}),r?E.jsxs("div",{className:"panel mb-4 px-3 py-2",children:[E.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]}),E.jsx("b",{className:"text-[17px]",children:r.title}),E.jsxs("div",{className:"mt-1 text-[14px]",children:["Status: ",r.status,r.note?` — ${r.note}`:""]}),r.description&&E.jsx("p",{className:"mt-1 whitespace-pre-wrap text-[14px]",children:r.description}),!!((p=r.files)!=null&&p.length)&&E.jsxs("div",{className:"mt-1 text-[13px]",children:["Files: ",r.files.map(d=>E.jsx("code",{className:"mr-1 bg-cream-2 px-1 font-term text-[15px]",children:d},d))]}),r.doneWhen&&E.jsxs("div",{className:"mt-1 text-[13px]",children:[E.jsx("b",{children:"Done when:"})," ",r.doneWhen]}),r.needs.length>0&&E.jsxs("div",{className:"text-[14px]",children:["Needs: ",r.needs.map(d=>{var g;return`${d} (${((g=t.tasks.find(w=>w.id===d))==null?void 0:g.status)??"?"})`}).join(", ")]}),n&&E.jsxs("div",{className:"mt-2 flex items-center gap-2 text-[14px]",children:[E.jsxs("button",{className:"font-semibold underline",onClick:()=>Pe.openPrs(),children:["PR #",n.number]}),E.jsx(mw,{review:n.review,merged:n.merged}),n.openComments>0&&E.jsxs("span",{children:[n.openComments," comments"]})]})]}):E.jsx("p",{className:"mb-4 text-[15px] text-muted",children:"No task right now."}),E.jsx(Ge,{children:"Assign a task"}),E.jsxs("div",{className:"flex gap-2",children:[E.jsxs("select",{className:"field",value:o,onChange:d=>h(d.target.value),"aria-label":"Task to assign",children:[E.jsx("option",{value:"",children:"Pick a to-do task…"}),c.map(d=>E.jsxs("option",{value:d.id,children:[d.id," ",d.title]},d.id))]}),E.jsx("button",{className:"btn",disabled:!o,onClick:()=>(ke.assignTask(o,e.id),h("")),children:"Assign"})]}),E.jsxs("p",{className:"mt-1 text-[12px] text-muted",children:["If ",e.name," is free, the lead tells them to start right away."]})]})}function gD({snap:t,agent:e}){var o,h,u;const s=t.environments.find(p=>p.agentId===e.id),r=wn(5e3),n=e.sandbox,l=(o=t.agents.find(p=>p.agentId===e.id))==null?void 0:o.session.sandbox,c=(p,d)=>E.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:[E.jsx("span",{className:"text-muted",children:p}),E.jsx("span",{className:"min-w-0 break-words",children:d})]});return E.jsxs("div",{className:"scroll-thin h-full overflow-y-auto p-4",children:[E.jsx(Ge,{children:"Sandbox"}),E.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",E.jsxs(E.Fragment,{children:[n.resources.cpus||n.resources.memoryGb?`${n.resources.cpus??"all"} CPUs · ${n.resources.memoryGb??"default"} GB`:"sbx default",l&&E.jsxs("span",{className:"text-muted",children:[" (now ",l.cpus," CPUs · ",l.memoryGb," GB)"]})]})),c("Network",`base: ${t.sbx.basePolicy}`),c("Allowed",n.allow.length?n.allow.join(", "):"—"),c("Blocked",n.deny.length?n.deny.join(", "):"—"),c("HQ access",E.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(p=>`${p} (all)`),...((h=t.sbx.agents[e.id])==null?void 0:h.keys)??[]].map(p=>E.jsx("span",{className:"chip mb-1 mr-1 font-term text-[14px]",children:p},p))),c("App variables",(u=t.sbx.agents[e.id])!=null&&u.envFile.exists?"env file set":"—"),c("Skills",e.skills.join(", ")||"—")]}),s&&E.jsxs(E.Fragment,{children:[E.jsx(Ge,{children:"Environment"}),E.jsxs("button",{className:"panel mb-4 block w-full px-3 py-2 text-left",onClick:()=>Pe.openEnv(s.name),children:[E.jsx("div",{className:"font-term text-[17px]",children:s.url}),E.jsxs("div",{className:"text-[14px] text-muted",children:[s.status," · deployed ",bn(s.lastDeployAt,r)," ago"]})]})]}),E.jsx("button",{className:"btn",onClick:()=>Pe.openSettings("sandbox",e.id),children:"Edit sandbox settings"})]})}function _D({snap:t,agent:e}){var u;const s=wn(1e3),[r,n]=oe.useState(""),l=t.messages.filter(p=>p.fromId===e.id||p.toId===e.id),c=p=>p===iD?{name:"You",color:"#ffec27"}:p==="hq"?{name:"HQ",color:"#3ee0d0"}:t.config.team.find(d=>d.id===p),o=((u=t.agents.find(p=>p.agentId===e.id))==null?void 0:u.session.state)==="running",h=()=>{r.trim()&&(ke.sendMessage(e.id,r.trim()),n(""))};return E.jsxs("div",{className:"flex h-full flex-col",children:[E.jsxs("div",{className:"scroll-thin min-h-0 flex-1 overflow-y-auto p-4",children:[E.jsx(Ge,{children:"Team MCP messages"}),E.jsx("p",{className:"mb-3 text-[13px] text-muted",children:"Agents can't reach each other's sandboxes. Every message goes through HQ."}),l.length===0&&E.jsx("p",{className:"text-[15px] text-muted",children:"No messages yet."}),E.jsx("ul",{className:"flex flex-col gap-2",children:l.map(p=>{const d=p.fromId===e.id,g=c(d?p.toId:p.fromId);return E.jsxs("li",{className:`border-2 border-ink px-2.5 py-1.5 ${d?"ml-8 bg-white":"mr-8 bg-cream-2"}`,children:[E.jsxs("div",{className:"flex items-center gap-1.5 text-[13px] text-muted",children:[g&&E.jsx(Mc,{color:g.color,size:8}),d?`To ${(g==null?void 0:g.name)??"?"}`:`From ${(g==null?void 0:g.name)??"?"}`,E.jsx("span",{className:"ml-auto font-term text-[15px]",children:bn(p.at,s)})]}),E.jsx("div",{className:"text-[15px]",children:p.text})]},p.id)})})]}),E.jsxs("form",{className:"flex gap-2 border-t-[3px] border-ink bg-cream p-2",onSubmit:p=>{p.preventDefault(),h()},children:[E.jsx("input",{className:"field",value:r,onChange:p=>n(p.target.value),placeholder:`Message ${e.name}…`,"aria-label":`Message ${e.name}`}),E.jsx("button",{className:"btn",type:"submit",disabled:!r.trim(),children:"Send"})]}),E.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 vD=[{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"}],Yy={active:"Active",planned:"Planned",done:"Done"};function yD({initialBoardId:t}){var p,d,g;const e=Te(w=>w.snap),s=We(w=>w.planBoardId),r=[...(e==null?void 0:e.boards)??[]].sort((w,S)=>w.order-S.order),[n,l]=oe.useState(t??((p=r.find(w=>w.status==="active"))==null?void 0:p.id)??((d=r[0])==null?void 0:d.id));if(!e)return null;const c=r.find(w=>w.id===n),o=e.tasks.filter(w=>w.boardId===n),h=vD.filter(w=>w.id!=="blocked"||o.some(S=>S.status==="blocked")),u=(s??((g=r.find(w=>w.status==="active"))==null?void 0:g.id))===n;return E.jsxs(E.Fragment,{children:[E.jsxs(Ko,{children:[E.jsx("b",{className:"text-[18px]",children:"Boards"}),E.jsxs("span",{className:"text-[14px] text-muted",children:[r.length," in ",e.config.project.name]})]}),E.jsx("div",{className:"flex flex-wrap gap-1.5 border-b-[3px] border-ink px-3 py-2",children:r.map(w=>E.jsxs("button",{className:"btn px-2 text-[13px]","aria-pressed":w.id===n,onClick:()=>l(w.id),children:[w.status==="active"&&E.jsx("span",{className:"mr-1 text-blue",children:"●"}),w.title]},w.id))}),c&&E.jsxs("div",{className:"flex items-center gap-2 border-b-[3px] border-ink bg-cream-2 px-3 py-1.5 text-[14px]",children:[E.jsx("span",{className:"text-muted",children:"Status"}),E.jsx("select",{className:"field w-[120px] py-0 text-[14px]",value:c.status,onChange:w=>ke.updateBoard(c.id,{status:w.target.value}),children:Object.keys(Yy).map(w=>E.jsx("option",{value:w,children:Yy[w]},w))}),E.jsx("span",{className:"text-[12px] text-muted",children:"Agents only pick tasks from active boards."}),E.jsx("button",{className:"btn ml-auto px-2 text-[13px]",disabled:u,onClick:()=>Pe.showBoardOnWall(c.id),children:u?"On the wall":"Show on wall"})]}),E.jsxs("div",{className:"scroll-thin grid min-h-0 flex-1 auto-cols-[minmax(112px,1fr)] grid-flow-col gap-2 overflow-auto bg-[#f7f3ea] p-3",children:[h.map(w=>{const S=o.filter(y=>y.status===w.id);return w.id==="done"&&S.reverse(),E.jsxs("div",{className:"min-w-0",children:[E.jsxs("h4",{className:"mb-2 flex justify-between border-b-[3px] pb-0.5 text-[14px] font-semibold",style:{borderColor:w.color},children:[w.label," ",E.jsx("span",{className:"font-term text-[17px] text-muted",children:S.length})]}),E.jsx("div",{className:"flex flex-col gap-2",children:S.map(y=>E.jsx(xD,{task:y},y.id))})]},w.id)}),o.length===0&&E.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 xD({task:t}){var l;const e=Te(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))??[],n=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 E.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:[E.jsxs("div",{className:"font-term text-[16px] leading-none text-muted",children:[t.id,t.prNumber&&E.jsxs("span",{className:"ml-1.5",children:["#",t.prNumber]})]}),E.jsx("div",{className:`text-[14px] font-semibold leading-tight ${t.status==="done"?"line-through":""}`,title:[t.description,(l=t.files)!=null&&l.length?`Files: ${t.files.join(", ")}`:"",t.doneWhen?`Done when: ${t.doneWhen}`:""].filter(Boolean).join(`
|
|
308
|
+
|
|
309
|
+
`)||void 0,children:t.title}),t.status==="blocked"&&t.note&&E.jsx("div",{className:"text-[12px] text-red",children:t.note}),E.jsx("div",{className:"mt-1 flex items-center gap-1.5 text-[12px]",children:s?E.jsxs(E.Fragment,{children:[E.jsx(Mc,{color:s.color,size:8})," ",s.name]}):E.jsx("span",{className:"text-muted",children:"Unassigned"})}),n.length>0&&t.status==="todo"&&E.jsxs("div",{className:"text-[12px] text-red",children:["Waits on ",n.join(", ")]}),t.status==="todo"&&E.jsxs("select",{className:"field mt-1 py-0 text-[12px]",value:"",onChange:c=>c.target.value&&ke.assignTask(t.id,c.target.value),"aria-label":`Assign ${t.id}`,children:[E.jsx("option",{value:"",children:"Assign to…"}),r.map(c=>E.jsxs("option",{value:c.id,children:[c.name," (",c.role,")"]},c.id))]})]})}const wD={live:"#00e436",deploying:"#3ee0d0",sleeping:"#83769c"};function bD({name:t}){const e=Te(c=>c.snap),s=wn(1e3);if(!e)return null;const r=e.environments.find(c=>c.name===t),n=r!=null&&r.agentId?e.config.team.find(c=>c.id===r.agentId):null,l=Hl[e.config.workflow.deploy.tool];return E.jsxs(E.Fragment,{children:[E.jsxs(Ko,{children:[E.jsxs("b",{className:"text-[18px]",children:["Environment: ",t]}),r&&E.jsx("span",{className:`chip chip-dot ${r.status==="deploying"?"blink":""}`,style:{"--c":wD[r.status]},children:r.status})]}),E.jsxs("div",{className:"scroll-thin min-h-0 flex-1 overflow-y-auto p-4",children:[r?E.jsxs(E.Fragment,{children:[E.jsxs("div",{className:"panel mb-4 px-3 py-2 text-[14px]",children:[E.jsx("div",{className:"font-term text-[19px]",children:r.url}),E.jsxs("div",{className:"mt-1 text-muted",children:[l," · last deploy ",bn(r.lastDeployAt,s)," ago"]})]}),E.jsx(Ge,{children:"Used by"}),n?E.jsxs("button",{className:"panel mb-4 flex w-full items-center gap-3 px-3 py-2 text-left",onClick:()=>Pe.openAgent(n.id),children:[E.jsx(gn,{color:n.color,lead:n.isLead,size:32}),E.jsxs("div",{children:[E.jsx("b",{children:n.name}),E.jsx("div",{className:"text-[13px] text-muted",children:"Its own copy of the app and database, so agents never share state."})]})]}):E.jsx("p",{className:"mb-4 text-[15px]",children:"Production. Every merged PR deploys here."})]}):E.jsx("p",{className:"text-muted",children:"This environment no longer exists."}),E.jsx(Ge,{children:"All environments"}),E.jsx("div",{className:"flex flex-wrap gap-2",children:e.environments.map(c=>E.jsx("button",{className:"btn text-[13px]","aria-pressed":c.name===t,onClick:()=>Pe.openEnv(c.name),children:c.name},c.name))})]})]})}function SD(){const t=Te(c=>c.snap),e=wn(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),n=t.pullRequests.filter(c=>c.merged).sort((c,o)=>o.number-c.number).slice(0,15),l=({pr:c})=>{const o=t.config.team.find(h=>h.id===c.authorId);return E.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:[E.jsxs("span",{className:"font-term text-[24px] leading-none",children:["#",c.number]}),E.jsxs("div",{className:"min-w-0",children:[E.jsx("div",{className:"truncate text-[15px] font-semibold",children:c.title}),E.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] text-muted",children:[o&&E.jsx(Mc,{color:o.color,size:8}),E.jsx("button",{className:"underline",onClick:()=>o&&Pe.openAgent(o.id),children:(o==null?void 0:o.name)??(c.authorId||"—")}),"· ",bn(c.openedAt,e)," ago",!c.merged&&E.jsxs(E.Fragment,{children:[" · ",c.openComments," open comment",c.openComments===1?"":"s",c.conflict?" · merge conflict":""]})]}),c.reviewNote&&!c.merged&&E.jsx("div",{className:"text-[12px] text-[#a35d00]",children:c.reviewNote})]}),E.jsxs("div",{className:"flex flex-col items-end gap-1",children:[E.jsx(mw,{review:c.review,merged:c.merged}),c.url?E.jsx("a",{className:"btn px-1.5 text-[11px]",href:c.url,target:"_blank",rel:"noreferrer",children:"Open on GitHub ↗"}):E.jsx("button",{className:"btn px-1.5 text-[11px]",disabled:!0,title:"Demo data has no GitHub link",children:"Open on GitHub"})]})]})};return E.jsxs(E.Fragment,{children:[E.jsxs(Ko,{children:[E.jsx("b",{className:"text-[18px]",children:"Pull requests"}),E.jsxs("span",{className:"truncate text-[14px] text-muted",children:["Review: ",s.review.enabled?yi[s.review.tool]:"off"," · Merge: ",s.merge.by==="lead"?"the lead":"you"]})]}),E.jsxs("div",{className:"scroll-thin min-h-0 flex-1 overflow-y-auto p-3",children:[E.jsxs(Ge,{children:["Open · ",r.length]}),r.length===0&&E.jsx("p",{className:"mb-4 text-[15px] text-muted",children:"No open PRs."}),E.jsx("ul",{className:"mb-5 flex flex-col gap-2",children:r.map(c=>E.jsx(l,{pr:c},c.number))}),E.jsx(Ge,{children:"Merged"}),E.jsx("ul",{className:"flex flex-col gap-2",children:n.map(c=>E.jsx(l,{pr:c},c.number))})]})]})}function Ko({children:t}){return E.jsxs("div",{className:"flex items-center gap-2.5 border-b-[3px] border-ink px-3 py-2",children:[E.jsx("div",{className:"flex min-w-0 flex-1 items-center gap-2.5",children:t}),E.jsx("button",{className:"btn px-2.5","aria-label":"Close",onClick:()=>Pe.closeDrawer(),children:"✕"})]})}function CD(){const t=We(r=>r.drawer),e=ip(),s=t?t.kind==="agent"?`agent:${t.id}`:t.kind==="env"?`env:${t.name}`:t.kind:null;return E.jsx(Hx,{mode:"wait",children:t&&E.jsxs(rp.aside,{initial:e?!1:{x:560},animate:{x:0},exit:e?{opacity:0}:{x:560},transition:{duration:e?0:.28,ease:[.3,0,.2,1]},className:"panel fixed bottom-4 right-4 top-[74px] z-20 flex w-[520px] flex-col","aria-label":"Details",children:[t.kind==="agent"&&E.jsx(uD,{id:t.id,initialTab:t.tab}),t.kind==="boards"&&E.jsx(yD,{initialBoardId:t.boardId}),t.kind==="prs"&&E.jsx(SD,{}),t.kind==="env"&&E.jsx(bD,{name:t.name})]},s)})}const kD={"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"]},ED=[];function MD(){const t=Te(n=>{var l;return((l=n.snap)==null?void 0:l.activity)??ED}),e=wn(1e3),s=ip(),r=t.slice(0,7);return E.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:[E.jsxs("div",{className:"mb-1 flex items-center gap-2 text-[13px] uppercase tracking-[0.14em] text-[#b9c3e6]",children:[E.jsx("i",{className:"led"}),"Activity"]}),E.jsx("ul",{className:"m-0 list-none p-0 font-term text-[17px] leading-none","aria-live":"polite",children:E.jsx(Hx,{initial:!1,children:r.map(n=>{const[l,c]=kD[n.type];return E.jsxs(rp.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:[E.jsx("span",{className:"w-3 shrink-0 text-center",style:{color:c},children:l}),E.jsx("span",{className:"min-w-0 flex-1 truncate",title:n.text,children:n.text}),E.jsx("time",{className:"shrink-0 text-[#7f8bb5]",children:bn(n.at,e)})]},n.id)})})})]})}function TD(){const t=Te(n=>n.live),e=Te(n=>n.connection),s=Te(n=>n.snap!==null);if(!t||e==="open"||e==="connecting"&&!s)return null;const r=e==="unauthorized"?"HQ restarted with a new link. Open the URL printed in your terminal.":"Lost connection to HQ. Reconnecting… Agents keep running in tmux.";return E.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:r})}const PD={ok:["✓","#00a83a"],missing:["✗","#ff004d"],unsupported:["✗","#ff004d"],warning:["!","#d48a1a"]},AD={sandbox:"for sandboxes",local:"for Local mode",all:"required",github:"for PRs & reviews"};function RD({c:t,running:e,onRun:s}){const[r,n]=oe.useState(!1),[l,c]=PD[t.status];return E.jsx("li",{className:"border-t-2 border-dashed border-cream-3 py-2.5 first:border-t-0",children:E.jsxs("div",{className:"flex items-start gap-2.5",children:[E.jsx("span",{className:"w-4 shrink-0 text-center text-[18px] font-bold leading-6",style:{color:c},"aria-label":t.status,children:l}),E.jsxs("div",{className:"min-w-0 flex-1",children:[E.jsxs("div",{className:"flex items-baseline gap-2",children:[E.jsx("b",{className:"text-[16px]",children:t.label}),E.jsx("span",{className:"text-[12px] text-muted",children:AD[t.neededFor]})]}),E.jsx("div",{className:"text-[14px] text-muted",children:t.detail}),t.fix&&t.status!=="ok"&&E.jsxs("div",{className:"mt-1.5 flex flex-wrap items-center gap-2",children:[t.fix.command&&E.jsxs(E.Fragment,{children:[E.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}),E.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)??""),n(!0),window.setTimeout(()=>n(!1),1200)},children:r?"Copied":"Copy"}),t.fix.runnable&&E.jsx("button",{className:"btn px-2 text-[12px]",disabled:e,onClick:s,children:e?"Running…":"Run in terminal"})]}),t.fix.docs&&E.jsx("a",{className:"text-[13px] font-semibold underline",href:t.fix.docs,target:"_blank",rel:"noreferrer",children:"Docs ↗"})]})]})]})})}function DD(){const t=Te(r=>{var n;return(n=r.snap)==null?void 0:n.setup}),[e,s]=oe.useState(null);return t?E.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:E.jsxs("div",{className:"panel flex max-h-[calc(100dvh-2rem)] w-[min(760px,100%)] flex-col",children:[E.jsxs("div",{className:"flex items-center gap-3 border-b-[3px] border-ink px-4 py-2",children:[E.jsx("h2",{className:"m-0 flex-1 text-[22px] font-bold",children:"Get JSM HQ ready"}),E.jsx("button",{className:"btn text-[14px]",onClick:()=>ke.recheckSetup(),children:"Check again"})]}),E.jsxs("div",{className:"scroll-thin min-h-0 overflow-y-auto px-4 py-2",children:[E.jsxs("div",{className:"mb-2 flex flex-wrap gap-2 text-[14px]",children:[E.jsxs("span",{className:"chip chip-dot",style:{"--c":t.sandboxReady?"#00e436":"#ff004d"},children:["Sandboxes ",t.sandboxReady?"ready":"not ready"]}),E.jsxs("span",{className:"chip chip-dot",style:{"--c":t.localReady?"#00e436":"#83769c"},children:["Local mode ",t.localReady?"ready":"not ready"]})]}),E.jsx("ul",{children:t.checks.map(r=>E.jsx(RD,{c:r,running:e===r.id,onRun:()=>{s(r.id),ke.runSetupFix(r.id)}},r.id))}),e&&E.jsxs("div",{className:"mb-2 mt-1 border-[3px] border-ink",children:[E.jsxs("div",{className:"flex items-center justify-between bg-navy px-2 py-1 text-[13px] text-cream",children:[E.jsx("span",{children:"Running · type here if it asks for input"}),E.jsx("button",{className:"text-[12px] underline",onClick:()=>s(null),children:"Hide"})]}),E.jsx("div",{className:"h-[220px]",children:E.jsx(_w,{agentId:`setup:${e}`},e)})]}),!t.sandboxReady&&t.localReady&&E.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 ",E.jsx("b",{children:"Local"})," in Settings → Team. They run plain Claude Code in their own folder, with permission prompts on."]})]}),E.jsxs("div",{className:"flex items-center justify-between gap-3 border-t-[3px] border-ink px-4 py-2",children:[E.jsx("span",{className:"text-[12px] text-muted",children:'HQ never runs sudo or install scripts for you. "Run in terminal" shows exactly what runs.'}),E.jsx("button",{className:"btn",onClick:()=>Pe.closeSetup(),children:"Continue to the office"})]})]})}):null}function es({value:t,onCommit:e,multiline:s,...r}){const[n,l]=oe.useState(t);oe.useEffect(()=>l(t),[t]);const c=()=>n!==t&&e(n);return s?E.jsx("textarea",{...r,value:n,onChange:o=>l(o.target.value),onBlur:c}):E.jsx("input",{...r,value:n,onChange:o=>l(o.target.value),onBlur:c,onKeyDown:o=>o.key==="Enter"&&o.currentTarget.blur()})}function Xy({items:t,onChange:e,placeholder:s,validate:r}){const[n,l]=oe.useState(""),[c,o]=oe.useState(null),h=()=>{const u=n.trim().toLowerCase();if(!u)return;const p=(r==null?void 0:r(u))??(t.includes(u)?"Already in the list":null);if(p)return o(p);e([...t,u]),l(""),o(null)};return E.jsxs("div",{children:[E.jsxs("div",{className:"mb-2 flex flex-wrap gap-1.5",children:[t.length===0&&E.jsx("span",{className:"text-[13px] text-muted",children:"None"}),t.map(u=>E.jsxs("span",{className:"chip font-term text-[15px]",children:[u,E.jsx("button",{className:"ml-1 text-[12px] leading-none","aria-label":`Remove ${u}`,onClick:()=>e(t.filter(p=>p!==u)),children:"✕"})]},u))]}),E.jsxs("div",{className:"flex gap-2",children:[E.jsx("input",{className:"field",value:n,placeholder:s,onChange:u=>(l(u.target.value),o(null)),onKeyDown:u=>u.key==="Enter"&&(u.preventDefault(),h())}),E.jsx("button",{className:"btn",onClick:h,disabled:!n.trim(),children:"Add"})]}),c&&E.jsx("div",{className:"mt-1 text-[12px] text-red",children:c})]})}function Ul({checked:t,onChange:e,label:s}){return E.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:[E.jsx("span",{className:"inline-block h-3 w-3 border-2 border-ink",style:{background:t?"#00e436":"#fff"}}),s]})}const Qy=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 LD({agent:t,onClose:e}){const s=Te(g=>g.workspaceInfo[t.id]),[r,n]=oe.useState(!1),[l,c]=oe.useState(!0),[o,h]=oe.useState(!1);oe.useEffect(()=>{Te.setState(g=>{const w={...g.workspaceInfo};return delete w[t.id],{workspaceInfo:w}}),ke.inspectWorkspace(t.id),n(!0)},[t.id]);const u=r&&!s,p=s?s.changedFiles+s.unpushedCommits>0:!1,d=()=>{ke.removeAgent(t.id,{deleteSandbox:l,deleteFolder:o&&!!(s!=null&&s.managed)}),e()};return E.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:E.jsxs("div",{className:"panel w-[min(560px,100%)] p-4",children:[E.jsxs("h3",{className:"mb-1 text-[20px] font-bold",children:["Remove ",t.name," from the team?"]}),E.jsx("p",{className:"mb-3 text-[13px] text-muted",children:"Their session stops, and their unfinished tasks go back to the board."}),u&&E.jsxs("p",{className:"blink mb-3 font-term text-[18px]",children:["Checking ",t.name,"'s folder…"]}),s&&E.jsxs("div",{className:"mb-3 flex flex-col gap-2.5",children:[E.jsxs("label",{className:`flex items-start gap-2 border-2 border-ink bg-white p-2 ${s.sandboxExists?"":"opacity-60"}`,children:[E.jsx("input",{type:"checkbox",className:"mt-1",checked:l&&s.sandboxExists,disabled:!s.sandboxExists,onChange:g=>c(g.target.checked)}),E.jsxs("span",{className:"min-w-0",children:[E.jsxs("b",{className:"text-[15px]",children:["Delete ",t.name,"'s sandbox (the VM)"]}),E.jsx("span",{className:"block font-term text-[16px] text-muted",children:s.sandboxExists?`sbx rm ${s.sandboxName}`:"No sandbox exists"}),E.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."})]})]}),E.jsxs("label",{className:`flex items-start gap-2 border-2 p-2 ${p&&o?"border-red bg-[#ffe1ea]":"border-ink bg-white"} ${s.managed&&s.exists?"":"opacity-60"}`,children:[E.jsx("input",{type:"checkbox",className:"mt-1",checked:o,disabled:!s.managed||!s.exists,onChange:g=>h(g.target.checked)}),E.jsxs("span",{className:"min-w-0",children:[E.jsxs("b",{className:"text-[15px]",children:["Delete ",t.name,"'s folder"]}),E.jsx("span",{className:"block truncate font-term text-[16px] text-muted",title:s.path,children:s.path}),!s.managed&&E.jsx("span",{className:"block text-[12px] text-muted",children:"This is your own folder, so HQ never deletes it."}),s.managed&&!s.exists&&E.jsx("span",{className:"block text-[12px] text-muted",children:"The folder doesn't exist."}),s.managed&&s.exists&&E.jsx("span",{className:`block text-[12px] ${p?"font-semibold text-red":"text-muted"}`,children:p?`⚠ ${[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."})]})]})]}),E.jsxs("div",{className:"flex justify-end gap-2",children:[E.jsx("button",{className:"btn",onClick:e,children:"Cancel"}),E.jsxs("button",{className:"btn text-red",disabled:u,onClick:d,children:["Remove ",t.name]})]})]})})}function fc({value:t,onChange:e}){return E.jsx("select",{className:"field",value:t,onChange:s=>e(s.target.value),"aria-label":"Coding agent",children:Object.keys(Ci).map(s=>E.jsx("option",{value:s,children:Ci[s]},s))})}const vw=["Developer","QA","Designer","Docs","DevOps","Security"];function BD(){const t=Te(l=>{var c;return(c=l.snap)==null?void 0:c.config.team}),[e,s]=oe.useState(null),[r,n]=oe.useState(null);return t?E.jsxs("div",{className:"flex flex-col gap-5",children:[E.jsxs("section",{children:[E.jsxs(Ge,{children:["Team · ",t.length," agents"]}),E.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."}),E.jsx("div",{className:"flex flex-col gap-2",children:t.map(l=>E.jsx(ID,{agent:l,expanded:e===l.id,onToggle:()=>s(e===l.id?null:l.id),onRemove:()=>n(l)},l.id))})]}),E.jsx(OD,{}),r&&E.jsx(LD,{agent:r,onClose:()=>n(null)})]}):null}function ID({agent:t,expanded:e,onToggle:s,onRemove:r}){const n=l=>ke.updateAgent(t.id,l);return E.jsxs("div",{className:"border-[3px] border-ink bg-white",children:[E.jsxs("div",{className:"grid grid-cols-[40px_1fr_1fr_150px_130px_auto] items-end gap-2.5 p-2.5",children:[E.jsx(gn,{color:t.color,lead:t.isLead}),E.jsx(He,{label:"Name",children:E.jsx(es,{className:"field",value:t.name,onCommit:l=>l.trim()&&n({name:l.trim()})})}),E.jsx(He,{label:"Role",children:t.isLead?E.jsx("div",{className:"field flex h-9 items-center bg-cream-2",children:"Lead"}):E.jsx(es,{className:"field",value:t.role,list:"role-suggestions",onCommit:l=>l.trim()&&n({role:l.trim()})})}),E.jsx(He,{label:"Agent",children:E.jsx(fc,{value:t.cli,onChange:l=>n({cli:l})})}),E.jsx(He,{label:"Runs in",children:E.jsxs("select",{className:"field",value:t.mode,onChange:l=>n({mode:l.target.value}),children:[E.jsx("option",{value:"sandbox",children:"Sandbox"}),E.jsx("option",{value:"local",children:"Local"})]})}),E.jsxs("div",{className:"flex gap-1.5",children:[E.jsx("button",{className:"btn px-2 text-[13px]","aria-expanded":e,onClick:s,children:e?"Less":"More"}),!t.isLead&&E.jsx("button",{className:"btn px-2 text-[13px] text-red",onClick:r,children:"Remove"})]})]}),t.mode==="local"&&E.jsxs("div",{className:"border-t-2 border-dashed border-cream-3 px-3 py-1 text-[12px] text-muted",children:["Local mode runs plain ",E.jsx("code",{children:t.cli})," in the agent's own folder. Permission prompts stay on."]}),e&&E.jsxs("div",{className:"grid grid-cols-2 gap-3 border-t-[3px] border-ink bg-cream p-3",children:[E.jsx(He,{label:"Colour",children:E.jsx("div",{className:"flex flex-wrap gap-1.5",children:vi.map(l=>E.jsx("button",{className:"h-6 w-6 border-[3px] border-ink",style:{background:l,outline:l===t.color?"3px solid #241a2e":void 0,outlineOffset:1},"aria-label":`Colour ${l}`,onClick:()=>n({color:l})},l))})}),E.jsx(He,{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:E.jsx(es,{className:"field",value:t.model,placeholder:`${Ci[t.cli]} default`,list:t.cli==="codex"?"codex-models":"claude-models",onCommit:l=>n({model:l.trim()})})}),E.jsx(He,{label:"Skills",hint:"Comma separated. Copied into the agent's .claude/skills.",children:E.jsx(es,{className:"field",value:t.skills.join(", "),onCommit:l=>n({skills:l.split(",").map(c=>c.trim()).filter(Boolean)})})}),E.jsx("div",{className:"col-span-2",children:E.jsx(He,{label:"Folder",hint:"Leave empty and HQ keeps its own clone of the repo for this agent. Or enter an existing git folder.",children:E.jsx(es,{className:"field font-term text-[17px]",value:t.workspacePath??"",placeholder:`HQ-managed: ~/.jsmhq/…/${t.id}`,onCommit:l=>n({workspacePath:l.trim()||null})})})}),E.jsx("div",{className:"col-span-2",children:E.jsx(He,{label:"ROLE.md",hint:"Who this agent is. HQ writes it into the agent's folder (never committed) and loads it when the session starts.",children:E.jsx(es,{multiline:!0,className:"field h-[120px] resize-y font-term text-[17px] leading-tight",value:t.roleMd,onCommit:l=>n({roleMd:l})})})})]})]})}function OD(){const[t,e]=oe.useState(""),[s,r]=oe.useState("Developer"),[n,l]=oe.useState("claude"),[c,o]=oe.useState("sandbox"),h=()=>{t.trim()&&(ke.addAgent({name:t.trim(),role:s,cli:n,mode:c}),e(""))};return E.jsxs("section",{className:"border-[3px] border-dashed border-ink p-3",children:[E.jsx(Ge,{children:"Add an agent"}),E.jsxs("form",{className:"grid grid-cols-[1fr_1fr_150px_130px_auto] items-end gap-2.5",onSubmit:u=>{u.preventDefault(),h()},children:[E.jsx(He,{label:"Name",children:E.jsx("input",{className:"field",value:t,onChange:u=>e(u.target.value),placeholder:"e.g. Kenji"})}),E.jsx(He,{label:"Role",children:E.jsx("input",{className:"field",value:s,list:"role-suggestions",onChange:u=>r(u.target.value)})}),E.jsx(He,{label:"Agent",children:E.jsx(fc,{value:n,onChange:l})}),E.jsx(He,{label:"Runs in",children:E.jsxs("select",{className:"field",value:c,onChange:u=>o(u.target.value),children:[E.jsx("option",{value:"sandbox",children:"Sandbox"}),E.jsx("option",{value:"local",children:"Local"})]})}),E.jsx("button",{className:"btn",type:"submit",disabled:!t.trim(),children:"Add"})]}),E.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."}),E.jsx("datalist",{id:"codex-models",children:E.jsx("option",{value:"gpt-5.6-sol"})}),E.jsxs("datalist",{id:"claude-models",children:[E.jsx("option",{value:"opus"}),E.jsx("option",{value:"sonnet"}),E.jsx("option",{value:"haiku"})]}),E.jsx("datalist",{id:"role-suggestions",children:vw.map(u=>E.jsx("option",{value:u},u))})]})}const jD=11,ND=["Bob","Ana","Kai","Mia","Leo","Zoe","Sam","Ivy","Max","Eve","Jay"];function FD(){const t=Te(v=>v.snap),[e,s]=oe.useState((t==null?void 0:t.config.project.name)??""),[r,n]=oe.useState({name:"John",cli:"claude"}),[l,c]=oe.useState([{name:"Bob",role:"Developer",cli:"claude"}]),[o,h]=oe.useState((t==null?void 0:t.config.workflow.review.enabled)??!0),[u,p]=oe.useState((t==null?void 0:t.config.workflow.review.tool)??"human"),[d,g]=oe.useState(!1);if(!t)return null;const w=(v,x)=>c(_=>_.map((C,M)=>M===v?{...C,...x}:C)),S=()=>c(v=>[...v,{name:ND.find(x=>!v.some(_=>_.name===x))??`Agent ${v.length+1}`,role:"Developer",cli:"claude"}]),y=r.name.trim()&&l.length>0&&l.every(v=>v.name.trim()),m=()=>{y&&(g(!0),ke.completeWelcome({projectName:e.trim(),lead:r,workers:l,reviewTool:u,reviewEnabled:o}))};return E.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 JSM HQ",children:E.jsxs("div",{className:"panel flex max-h-[calc(100dvh-2rem)] w-[min(720px,100%)] flex-col",children:[E.jsxs("div",{className:"border-b-[3px] border-ink px-4 py-2",children:[E.jsx("h2",{className:"m-0 text-[22px] font-bold",children:"Welcome to JSM HQ"}),E.jsxs("p",{className:"m-0 text-[14px] text-muted",children:["Set up the team for ",E.jsx("b",{className:"text-ink",children:t.config.project.repo||t.config.project.name}),". You can change all of this later in Settings."]})]}),E.jsxs("div",{className:"scroll-thin flex min-h-0 flex-col gap-4 overflow-y-auto px-4 py-3",children:[E.jsx(He,{label:"Project name",children:E.jsx("input",{className:"field w-full",value:e,maxLength:80,onChange:v=>s(v.target.value)})}),E.jsxs("section",{children:[E.jsx("h3",{className:"mb-1 text-[16px] font-bold",children:"Lead"}),E.jsx("p",{className:"mb-2 text-[13px] text-muted",children:"Plans the work, creates tasks and assigns them to workers."}),E.jsxs("div",{className:"grid grid-cols-[40px_1fr_150px] items-end gap-2",children:[E.jsx(gn,{color:vi[0],lead:!0}),E.jsx(He,{label:"Name",children:E.jsx("input",{className:"field w-full",value:r.name,maxLength:40,onChange:v=>n({...r,name:v.target.value})})}),E.jsx(He,{label:"Agent",children:E.jsx(fc,{value:r.cli,onChange:v=>n({...r,cli:v})})})]})]}),E.jsxs("section",{children:[E.jsxs("h3",{className:"mb-1 text-[16px] font-bold",children:["Workers · ",l.length]}),E.jsx("p",{className:"mb-2 text-[13px] text-muted",children:"Each worker gets its own desk, copy of the repo and sandbox."}),E.jsx("datalist",{id:"welcome-roles",children:vw.map(v=>E.jsx("option",{value:v},v))}),E.jsx("div",{className:"flex flex-col gap-2",children:l.map((v,x)=>E.jsxs("div",{className:"grid grid-cols-[40px_1fr_1fr_150px_auto] items-end gap-2",children:[E.jsx(gn,{color:vi[(x+1)%vi.length],lead:!1}),E.jsx(He,{label:"Name",children:E.jsx("input",{className:"field w-full",value:v.name,maxLength:40,onChange:_=>w(x,{name:_.target.value})})}),E.jsx(He,{label:"Role",children:E.jsx("input",{className:"field w-full",list:"welcome-roles",value:v.role,maxLength:40,onChange:_=>w(x,{role:_.target.value})})}),E.jsx(He,{label:"Agent",children:E.jsx(fc,{value:v.cli,onChange:_=>w(x,{cli:_})})}),E.jsx("button",{className:"btn px-2 text-[13px]",disabled:l.length===1,"aria-label":`Remove ${v.name||"worker"}`,onClick:()=>c(_=>_.filter((C,M)=>M!==x)),children:"✕"})]},x))}),E.jsx("button",{className:"btn mt-2 text-[13px]",disabled:l.length>=jD,onClick:S,children:"+ Add worker"})]}),E.jsxs("section",{children:[E.jsx("h3",{className:"mb-1 text-[16px] font-bold",children:"Code review"}),E.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[E.jsxs("label",{className:"flex items-center gap-2 text-[14px]",children:[E.jsx("input",{type:"checkbox",checked:o,onChange:v=>h(v.target.checked)}),"Review PRs before merge"]}),E.jsx("select",{className:"field w-[220px]",value:u,disabled:!o,onChange:v=>p(v.target.value),"aria-label":"Review tool",children:Object.keys(yi).map(v=>E.jsx("option",{value:v,children:yi[v]},v))})]})]})]}),E.jsxs("div",{className:"flex items-center justify-between gap-3 border-t-[3px] border-ink px-4 py-2",children:[E.jsx("span",{className:"text-[12px] text-muted",children:"Saved to .jsmhq/config.json in your repo. Agents don't start until you press Start."}),E.jsx("button",{className:"btn",disabled:!y||d,onClick:m,children:d?"Creating…":"Create team"})]})]})})}function HD({a:t,focused:e,n:s,now:r}){const n=Te(h=>h.snap),l=t.status.currentTaskId?n==null?void 0:n.tasks.find(h=>h.id===t.status.currentTaskId):null,c=_n[t.status.state],o=t.status.state==="needs-input";return E.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:()=>Pe.openAgent(t.config.id),"aria-label":`${t.config.name}, ${t.config.role}, ${c.label}`,children:[e&&E.jsx("span",{className:"absolute -left-4 top-4 text-[14px]",children:"▶"}),E.jsx("div",{className:"row-span-2",children:E.jsx(gn,{color:t.config.color,lead:t.config.isLead})}),E.jsxs("div",{className:"flex min-w-0 items-baseline gap-1.5",children:[E.jsx("b",{className:"text-[17px]",children:t.config.name}),E.jsxs("span",{className:"truncate text-[13px] text-muted",children:[t.config.role," · ",Ci[t.config.cli],t.config.model?` · ${t.config.model}`:""]}),E.jsx("span",{className:"kbd ml-auto px-1 text-[13px] leading-none",children:s})]}),E.jsxs("div",{className:"flex items-center gap-2",children:[E.jsx(pw,{state:t.status.state}),E.jsx("span",{className:"font-term text-[16px] text-muted",children:bn(t.status.stateSince,r)}),t.config.mode==="local"&&E.jsx("span",{className:"chip text-[11px]",children:"local"})]}),E.jsx("div",{className:`col-span-2 mt-1 truncate text-[13px] ${l||o?"":"text-muted"}`,children:o?E.jsx("span",{className:"text-red",children:t.status.note}):l?E.jsxs(E.Fragment,{children:[E.jsx("span",{className:"mr-1 font-term text-[16px] text-muted",children:l.id}),l.title]}):t.status.note??"No task"})]})}function $D(){const t=Te(l=>l.snap),e=We(l=>l.drawer),s=wn(1e3),r=Ax(t),n=r.filter(l=>l.status.state==="needs-input").length;return E.jsxs("section",{"aria-label":"Team",className:"fixed bottom-[250px] left-4 top-[74px] z-10 flex w-[280px] flex-col gap-2",children:[E.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:[E.jsxs("span",{children:["Team · ",r.length,n>0&&E.jsxs("span",{className:"ml-2 text-yellow",children:[n," need you"]})]}),E.jsx("button",{className:"btn px-2 text-[12px] normal-case tracking-normal text-ink [text-shadow:none]",onClick:()=>Pe.openSettings("team"),children:"+ Agent"})]}),E.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((l,c)=>E.jsx(HD,{a:l,n:c+1,now:s,focused:(e==null?void 0:e.kind)==="agent"&&e.id===l.config.id},l.config.id))})]})}function zD(){const t=We(e=>e.hover);return t?E.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:[E.jsx("div",{className:"font-semibold",children:t.title}),t.sub&&E.jsx("div",{className:"truncate text-[13px] text-muted",children:t.sub})]}):null}const WD=[1,2,4];function UD(){return E.jsxs("svg",{className:"h-[30px] w-[30px] shrink-0",viewBox:"0 0 10 10",shapeRendering:"crispEdges","aria-hidden":!0,children:[E.jsx("rect",{x:"1",y:"1",width:"8",height:"8",fill:"#241a2e"}),E.jsx("rect",{x:"2",y:"2",width:"6",height:"6",fill:"#29adff"}),E.jsx("rect",{x:"3",y:"3",width:"1",height:"2",fill:"#fff6e9"}),E.jsx("rect",{x:"6",y:"3",width:"1",height:"2",fill:"#fff6e9"}),E.jsx("rect",{x:"3",y:"6",width:"4",height:"1",fill:"#1d2b53"}),E.jsx("rect",{x:"4",y:"0",width:"2",height:"1",fill:"#ffec27"})]})}function VD(){var S;const t=Te(y=>y.snap),e=Te(y=>y.speed),s=Te(y=>y.presets!==null),r=We(y=>y.planBoardId),n=We(y=>y.debugOpen),l=Te(y=>y.live);if(!t)return null;const c=t.setup.checks.filter(y=>y.status!=="ok").length,o=t.agents.filter(y=>y.session.state==="stopped"||y.session.state==="failed"),h=new Set(t.agents.filter(y=>y.session.state==="running").map(y=>y.agentId)),u=t.config.team.filter(y=>y.mode==="sandbox"&&h.has(y.id)).length,p=t.config.team.filter(y=>y.mode==="local"&&h.has(y.id)).length,d=[...t.boards].sort((y,m)=>y.order-m.order),g=d.filter(y=>y.status==="active"),w=t.pullRequests.filter(y=>!y.merged&&!y.closed).length;return E.jsxs("header",{className:"panel fixed left-4 right-4 top-[10px] z-10 flex h-[50px] items-center gap-4 px-3",children:[E.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[E.jsx(UD,{}),E.jsx("b",{className:"whitespace-nowrap text-[22px] font-bold tracking-[0.02em]",children:"JSM HQ"}),!l&&E.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"}),E.jsxs("span",{className:"truncate text-[16px] text-muted",children:["— ",E.jsx("em",{className:"font-semibold not-italic text-ink",children:t.config.project.name})," ",E.jsx("span",{className:"font-term text-[17px]",children:t.config.project.repo})]})]}),E.jsx("div",{className:"flex-1"}),E.jsxs("label",{className:"flex items-center gap-2 text-[14px]",children:[E.jsx("span",{className:"text-muted",children:"Plan wall"}),E.jsxs("select",{className:"field w-[190px] py-0 text-[14px]",value:r??"",onChange:y=>Pe.showBoardOnWall(y.target.value||null),"aria-label":"Board shown on the plan wall",children:[E.jsxs("option",{value:"",children:["First active (",((S=g[0])==null?void 0:S.title)??"none",")"]}),d.map(y=>E.jsxs("option",{value:y.id,children:[y.title," · ",y.status]},y.id))]})]}),s&&E.jsx("div",{className:"flex items-center gap-1.5",role:"group","aria-label":"Simulation speed",children:WD.map(y=>E.jsxs("button",{className:"btn px-2 text-[14px]","aria-pressed":e===y,onClick:()=>ke.setSpeed(y),children:[y,"x"]},y))}),E.jsxs("div",{className:"flex gap-1.5",children:[E.jsx("button",{className:"btn w-8 px-0 text-[18px] leading-none","aria-label":"Zoom out",onClick:()=>Pe.zoom(-1),children:"−"}),E.jsx("button",{className:"btn w-8 px-0 text-[18px] leading-none","aria-label":"Zoom in",onClick:()=>Pe.zoom(1),children:"+"})]}),E.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:[E.jsxs("span",{children:["Sandbox · ",E.jsx("b",{children:u})," running",p?` · ${p} local`:""]}),E.jsx("i",{className:"led",style:h.size?void 0:{background:"#83769c",animation:"none"}})]}),l&&o.length>0&&E.jsxs("button",{className:"btn text-[14px]",onClick:()=>o.forEach(y=>ke.startAgent(y.agentId)),children:["Start ",o.length===t.agents.length?"team":`${o.length} stopped`]}),l&&E.jsxs("button",{className:"btn text-[14px]",onClick:()=>Pe.openSetup(),title:"Setup checklist",children:["Setup",c?` · ${c}`:" ✓"]}),E.jsxs("div",{className:"flex gap-1.5",children:[E.jsx("button",{className:"btn text-[14px]",onClick:()=>Pe.openBoards(r??void 0),children:"Boards"}),E.jsxs("button",{className:"btn text-[14px]",onClick:()=>Pe.openPrs(),children:["PRs",w?` · ${w}`:""]})]}),E.jsx("button",{className:"btn text-[14px]",onClick:()=>Pe.openSettings("team"),children:"Settings"}),E.jsx("button",{className:"btn text-[14px]","aria-pressed":n,onClick:()=>Pe.toggleDebug(),title:"Debug panel (D)",children:"Debug"})]})}function GD(){const t=Te(n=>n.snap),[e,s]=oe.useState("");if(!t)return null;const r=[...t.boards].sort((n,l)=>n.order-l.order);return E.jsxs("div",{className:"flex flex-col gap-5",children:[E.jsxs("section",{children:[E.jsxs(Ge,{children:["Boards · ",r.length]}),E.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."}),E.jsx("div",{className:"flex flex-col gap-2",children:r.map(n=>{const l=t.tasks.filter(o=>o.boardId===n.id),c=l.filter(o=>o.status==="done").length;return E.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:[E.jsx("span",{className:"font-term text-[19px] text-muted",children:n.id}),E.jsx(es,{className:"field",value:n.title,onCommit:o=>o.trim()&&ke.updateBoard(n.id,{title:o.trim()})}),E.jsxs("select",{className:"field",value:n.status,onChange:o=>ke.updateBoard(n.id,{status:o.target.value}),"aria-label":`${n.title} status`,children:[E.jsx("option",{value:"active",children:"Active"}),E.jsx("option",{value:"planned",children:"Planned"}),E.jsx("option",{value:"done",children:"Done"})]}),E.jsxs("span",{className:"text-right font-term text-[17px] text-muted",children:[c,"/",l.length," done"]})]},n.id)})})]}),E.jsxs("form",{className:"flex items-end gap-2 border-[3px] border-dashed border-ink p-3",onSubmit:n=>{n.preventDefault(),e.trim()&&(ke.createBoard(e),s(""))},children:[E.jsxs("label",{className:"flex flex-1 flex-col gap-1",children:[E.jsx("span",{className:"text-[14px] font-semibold",children:"New board"}),E.jsx("input",{className:"field",value:e,onChange:n=>s(n.target.value),placeholder:"e.g. Phase 7 — Mobile"})]}),E.jsx("button",{className:"btn",type:"submit",disabled:!e.trim(),children:"Create"})]})]})}function qD(){const t=Te(e=>{var s;return(s=e.snap)==null?void 0:s.config.project});return t?E.jsxs("div",{className:"flex flex-col gap-5",children:[E.jsxs("section",{className:"grid grid-cols-2 gap-3 border-[3px] border-ink bg-white p-3",children:[E.jsx("div",{className:"col-span-2",children:E.jsx(Ge,{children:"Project"})}),E.jsx(He,{label:"Name",children:E.jsx(es,{className:"field",value:t.name,onCommit:e=>e.trim()&&ke.updateProject({name:e.trim()})})}),E.jsx(He,{label:"GitHub repo",hint:"owner/name. HQ only reads PRs, checks and comments.",children:E.jsx(es,{className:"field font-term text-[17px]",value:t.repo,onCommit:e=>e.trim()&&ke.updateProject({repo:e.trim()})})}),E.jsx(He,{label:"Local path",children:E.jsx(es,{className:"field font-term text-[17px]",value:t.path,onCommit:e=>e.trim()&&ke.updateProject({path:e.trim()})})}),E.jsx(He,{label:"HQ port",hint:"Sandboxes reach HQ at host.docker.internal on this port.",children:E.jsx(es,{className:"field font-term text-[17px]",value:String(t.hqPort),onCommit:e=>{const s=Number(e);Number.isInteger(s)&&s>1023&&s<65536&&ke.updateProject({hqPort:s})}})})]}),E.jsxs("section",{children:[E.jsx(Ge,{children:"Plan"}),E.jsx(Ul,{checked:!!t.exportPlan,onChange:e=>ke.updateProject({exportPlan:e}),label:"Export plan to docs/plan.md"}),E.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."})]}),E.jsxs("section",{className:"text-[13px] text-muted",children:[E.jsx(Ge,{children:"Security"}),E.jsxs("ul",{className:"list-disc pl-5",children:[E.jsx("li",{children:"HQ binds 127.0.0.1 only."}),E.jsx("li",{children:"A random token is created on every start. The browser, hooks and the Team MCP must send it."}),E.jsx("li",{children:"HQ never reads .env files. Sandboxes get keys from Docker's secret store."})]})]})]}):null}function yw(t){return{cpus:t.cpus,memoryGb:Math.min(32,Math.max(.5,t.memoryGb/2))}}function np(t,e){const s=yw(e);return{cpus:t.cpus??s.cpus,memoryGb:t.memoryGb??s.memoryGb}}const KD=t=>Math.max(.5,Math.floor(t.memoryGb*.75*2)/2);function YD(t,e){const s=t.filter(n=>n.mode==="sandbox"),r=s.reduce((n,l)=>{const c=np(l.sandbox.resources,e);return{cpus:n.cpus+c.cpus,memoryGb:n.memoryGb+c.memoryGb}},{cpus:0,memoryGb:0});return{...r,count:s.length,overMemory:r.memoryGb>e.memoryGb}}function XD(t,e,s){if(!e.sandbox)return!1;const r=np(t,s);return r.cpus!==e.sandbox.cpus||Math.abs(r.memoryGb-e.sandbox.memoryGb)>.26}const li=t=>`${Number.isInteger(t)?t:t.toFixed(1)} GB`;function QD({agent:t,status:e,team:s,machine:r}){const n=t.sandbox.resources,l=n.cpus!==null||n.memoryGb!==null,c=yw(r),o=np(n,r),h=KD(r),[u,p]=oe.useState(o);oe.useEffect(()=>p(o),[o.cpus,o.memoryGb]);const d=y=>ke.updateSandbox(t.id,{resources:y}),g=YD(s,r),w=e==null?void 0:e.session,S=w?XD(n,w,r):!1;return E.jsxs("section",{className:"border-[3px] border-ink bg-white p-3",children:[E.jsx(Ge,{children:"Resources"}),E.jsxs("div",{className:"grid grid-cols-2 gap-2",role:"radiogroup","aria-label":"Sandbox size",children:[E.jsxs("button",{className:"btn whitespace-normal px-2.5 py-1.5 text-left",role:"radio","aria-checked":!l,"aria-pressed":!l,onClick:()=>ke.updateSandbox(t.id,{resources:{cpus:null,memoryGb:null}}),children:[E.jsx("div",{children:"sbx default"}),E.jsxs("div",{className:"text-[12px] font-normal text-muted",children:["All ",c.cpus," CPUs · ",li(c.memoryGb)," (half your memory)"]})]}),E.jsxs("button",{className:"btn whitespace-normal px-2.5 py-1.5 text-left",role:"radio","aria-checked":l,"aria-pressed":l,onClick:()=>d({cpus:Math.min(4,r.cpus),memoryGb:Math.min(4,h)}),children:[E.jsx("div",{children:"Custom"}),E.jsx("div",{className:"text-[12px] font-normal text-muted",children:"Pick CPUs and memory for this agent."})]})]}),l&&E.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-4",children:[E.jsxs("label",{className:"flex flex-col gap-1 text-[14px]",children:[E.jsxs("span",{className:"flex justify-between font-semibold",children:["CPUs ",E.jsxs("span",{className:"font-term text-[17px]",children:[u.cpus," of ",r.cpus]})]}),E.jsx("input",{type:"range",min:1,max:r.cpus,step:1,value:u.cpus,className:"accent-[#29adff]",onChange:y=>p({...u,cpus:Number(y.target.value)}),onPointerUp:()=>d(u),onKeyUp:()=>d(u)})]}),E.jsxs("label",{className:"flex flex-col gap-1 text-[14px]",children:[E.jsxs("span",{className:"flex justify-between font-semibold",children:["Memory ",E.jsxs("span",{className:"font-term text-[17px]",children:[li(u.memoryGb)," of ",li(h)," max"]})]}),E.jsx("input",{type:"range",min:.5,max:h,step:.5,value:u.memoryGb,className:"accent-[#29adff]",onChange:y=>p({...u,memoryGb:Number(y.target.value)}),onPointerUp:()=>d(u),onKeyUp:()=>d(u)})]})]}),E.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:[E.jsx("b",{children:"Team:"})," ",g.count," sandbox",g.count===1?"":"es"," · ",g.cpus," CPUs · ",li(g.memoryGb)," of your ",li(r.memoryGb)," memory",g.overMemory&&E.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"&&(w==null?void 0:w.sandbox)&&E.jsxs("div",{className:`mt-3 flex items-center gap-2 text-[13px] ${S?"border-2 border-orange bg-[#fff1d6] px-2.5 py-1.5":"text-muted"}`,children:[E.jsxs("span",{className:"flex-1",children:["The sandbox now has ",w.sandbox.cpus," CPUs · ",li(w.sandbox.memoryGb),".",S&&" Size is fixed when a sandbox is created, so recreate it to apply the new size."]}),S&&E.jsx("button",{className:"btn px-2 text-[12px]",onClick:()=>window.confirm(`Recreate ${t.name}'s sandbox with ${o.cpus} CPUs and ${li(o.memoryGb)}?
|
|
310
|
+
|
|
311
|
+
The agent's folder and code are kept. Anything installed inside the VM is lost, and the current session restarts.`)&&ke.recreateSandbox(t.id),children:"Recreate sandbox"})]}),t.mode==="sandbox"&&!(w!=null&&w.sandbox)&&E.jsxs("p",{className:"mt-2 text-[12px] text-muted",children:["Applied when ",t.name,"'s sandbox is created on first Start."]})]})}const ZD={"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"},Zy={hq:"HQ",kit:"agent kit",org:"your org",cli:"sbx CLI"};function Jy({keys:t,onSet:e,onRemove:s,disabled:r}){const[n,l]=oe.useState(Gy[0]),[c,o]=oe.useState("");return E.jsxs("div",{children:[E.jsxs("ul",{className:"mb-2 flex flex-wrap gap-1.5",children:[t.length===0&&E.jsx("li",{className:"text-[13px] text-muted",children:"None"}),t.map(h=>E.jsxs("li",{className:"chip font-term text-[15px]",children:[h," ",E.jsx("span",{className:"text-muted",children:"••••"}),E.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?E.jsx("p",{className:"text-[12px] text-muted",children:r}):E.jsxs("form",{className:"grid grid-cols-[150px_1fr_auto] items-end gap-2",onSubmit:h=>{h.preventDefault(),c&&(e(n,c),o(""))},children:[E.jsx(He,{label:"Service",children:E.jsx("select",{className:"field",value:n,onChange:h=>l(h.target.value),children:Gy.map(h=>E.jsx("option",{children:h},h))})}),E.jsx(He,{label:"Key / token",children:E.jsx("input",{className:"field",type:"password",autoComplete:"off",value:c,onChange:h=>o(h.target.value)})}),E.jsx("button",{className:"btn",type:"submit",disabled:!c,children:"Store"})]})]})}function JD({initialAgentId:t}){var S;const e=Te(y=>y.snap),s=Te(y=>y.live),[r,n]=oe.useState(t??((S=e==null?void 0:e.config.team[0])==null?void 0:S.id)??"");if(!e)return null;const l=e.config.team.find(y=>y.id===r)??e.config.team[0];if(!l)return null;const c=l.sandbox,o=e.sbx,h=o.agents[l.id],u=e.agents.find(y=>y.agentId===l.id),p=!!(u!=null&&u.session.sandbox)||!!(h!=null&&h.rules.length),d=y=>ke.updateSandbox(l.id,y),g=e.config.project.hqPort,w=()=>{for(const y of e.config.team)y.id!==l.id&&ke.updateSandbox(y.id,{allow:[...c.allow],deny:[...c.deny]})};return E.jsxs("div",{className:"flex flex-col gap-5",children:[E.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.config.team.map(y=>E.jsxs("button",{className:"btn flex items-center gap-1.5 text-[14px]","aria-pressed":y.id===l.id,onClick:()=>n(y.id),children:[E.jsx(Mc,{color:y.color,size:8})," ",y.name]},y.id)),E.jsx("button",{className:"btn ml-auto text-[13px]",onClick:()=>ke.refreshSbx(),title:"Read rules, keys and proxy from sbx again",children:"Refresh from sbx"})]}),l.mode==="local"&&E.jsxs("p",{className:"border-[3px] border-orange bg-[#fff1d6] px-3 py-2 text-[14px]",children:[l.name," runs in Local mode, so sandbox settings don't apply until it's switched back to Sandbox. The env file still applies."]}),E.jsx("h3",{className:"-mb-2 text-[18px] font-bold",children:"This agent"}),E.jsx(QD,{agent:l,status:u,team:e.config.team,machine:e.setup.machine}),E.jsxs("section",{className:"border-[3px] border-ink bg-white p-3",children:[E.jsxs("div",{className:"flex items-center justify-between",children:[E.jsxs(Ge,{children:["Network for ",l.name,"'s sandbox"]}),E.jsx("button",{className:"btn mb-2 px-2 text-[12px]",onClick:w,title:"Copy these allowed and blocked domains to every agent",children:"Copy to all agents"})]}),E.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"," ",E.jsx("code",{className:"font-term text-[15px]",children:"sbx policy allow/deny network --sandbox"}),"."]}),E.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[E.jsx(He,{label:"Allowed domains",children:E.jsx(Xy,{items:c.allow,onChange:y=>d({allow:y}),placeholder:"registry.npmjs.org",validate:Qy})}),E.jsx(He,{label:"Blocked domains",children:E.jsx(Xy,{items:c.deny,onChange:y=>d({deny:y}),placeholder:"*.googleapis.com",validate:Qy})})]}),(h==null?void 0:h.syncError)&&E.jsxs("p",{className:"mt-2 border-2 border-red bg-[#ffe1ea] px-2 py-1 text-[13px] text-red",children:["sbx: ",h.syncError]}),E.jsxs("div",{className:"mt-3",children:[E.jsxs("div",{className:"mb-1 text-[13px] font-semibold",children:["Rules in effect ",s?"(read from sbx)":"(demo)"]}),p?E.jsxs("ul",{className:"flex flex-wrap gap-1.5",children:[(h==null?void 0:h.rules.length)===0&&E.jsx("li",{className:"text-[12px] text-muted",children:"No sandbox-specific rules."}),h==null?void 0:h.rules.map(y=>y.resources.map(m=>E.jsxs("li",{className:"chip font-term text-[14px]",style:{"--c":y.decision==="allow"?"#c8f5d2":"#ffd0dc"},title:`${y.decision} · added by ${Zy[y.source]}`,children:[y.decision==="allow"?"✓":"✗"," ",m," ",E.jsx("span",{className:"text-[11px] text-muted",children:Zy[y.source]})]},`${y.id}-${m}`)))]}):E.jsxs("p",{className:"text-[12px] text-muted",children:[l.name,"'s sandbox doesn't exist yet. The rules above are applied when it's created on first Start."]})]})]}),E.jsxs("section",{className:"border-[3px] border-ink bg-white p-3",children:[E.jsxs(Ge,{children:["Service keys for ",l.name," only"]}),E.jsxs("p",{className:"mb-2 text-[13px] text-muted",children:["The host proxy adds these to ",l.name,"'s requests, so the key never enters the VM. HQ passes the value straight to"," ",E.jsx("code",{className:"font-term text-[15px]",children:"sbx secret set"})," and never stores it."]}),E.jsx(Jy,{keys:(h==null?void 0:h.keys)??[],disabled:p?void 0:`Start ${l.name} once to add keys only for this sandbox. Keys for every sandbox are under This machine.`,onSet:(y,m)=>ke.setSecret(l.id,y,m),onRemove:y=>ke.removeSecret(l.id,y)})]}),E.jsxs("section",{className:"border-[3px] border-ink bg-white p-3",children:[E.jsx(Ge,{children:"App variables (env file)"}),E.jsxs("p",{className:"mb-2 text-[13px] text-muted",children:["For values your app needs to run and test (DATABASE_URL, STRIPE_KEY…). One ",E.jsx("code",{className:"font-term text-[15px]",children:"KEY=value"})," per line. HQ never reads or commits this file. It's passed to the agent when its session starts."]}),E.jsxs("div",{className:"flex items-center gap-2",children:[E.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)??"—"}),E.jsx("button",{className:"btn text-[13px]",onClick:()=>ke.openEnvFile(l.id),children:h!=null&&h.envFile.exists?"Open":"Create & open"})]}),E.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."})]}),E.jsx("h3",{className:"-mb-2 mt-2 text-[18px] font-bold",children:"This machine — all sandboxes"}),E.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."}),E.jsxs("section",{className:"border-[3px] border-ink bg-white p-3",children:[E.jsx(Ge,{children:"Base network policy"}),E.jsx("p",{className:"text-[15px]",children:ZD[o.basePolicy]}),E.jsxs("p",{className:"mt-1 text-[12px] text-muted",children:["Set once with ",E.jsx("code",{className:"font-term text-[14px]",children:"sbx policy init"}),". Changing it means ",E.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 ",E.jsxs("code",{className:"font-term text-[14px]",children:["localhost:",g]})," and"," ",E.jsxs("code",{className:"font-term text-[14px]",children:["host.docker.internal:",g]})," so agents can reach it."," ",E.jsx("a",{className:"underline",href:"https://docs.docker.com/ai/sandboxes/security/",target:"_blank",rel:"noreferrer",children:"Docs ↗"})]})]}),E.jsxs("section",{className:"border-[3px] border-ink bg-white p-3",children:[E.jsx(Ge,{children:"Upstream proxy"}),E.jsx(He,{label:"Proxy URL",hint:"Optional. All sandbox traffic goes through this proxy. Leave empty for none.",children:E.jsx(es,{className:"field font-term text-[17px]",value:o.proxy??"",placeholder:"http://proxy.internal:3128",onCommit:y=>ke.setProxy(y.trim()||null)})})]}),E.jsxs("section",{className:"border-[3px] border-ink bg-white p-3",children:[E.jsx(Ge,{children:"Service keys for every sandbox"}),E.jsx(Jy,{keys:o.globalKeys,onSet:(y,m)=>ke.setSecret(null,y,m),onRemove:y=>ke.removeSecret(null,y)})]})]})}const e5={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 t5(){const t=Te(s=>{var r;return(r=s.snap)==null?void 0:r.config.workflow});if(!t)return null;const e=(s,r,n)=>E.jsxs("span",{className:`border-[3px] border-ink px-2 py-0.5 ${r?"bg-white":"bg-cream-2 text-muted line-through"}`,children:[E.jsx("b",{children:s})," ",E.jsx("span",{className:"text-[12px]",children:n})]});return E.jsxs("div",{className:"flex flex-col gap-6",children:[E.jsxs("section",{children:[E.jsx(Ge,{children:"Pipeline"}),E.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[14px]",children:[e("Build",!0,"agent in its sandbox"),E.jsx("span",{children:"→"}),e("Review",t.review.enabled,yi[t.review.tool]),E.jsx("span",{children:"→"}),e("Merge",!0,t.merge.by==="lead"?"by the lead":"by you"),E.jsx("span",{children:"→"}),e("Deploy",t.deploy.enabled,Hl[t.deploy.tool])]}),E.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."})]}),E.jsxs("section",{className:"border-[3px] border-ink bg-white p-3",children:[E.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[E.jsx(Ge,{children:"Review"}),E.jsx(Ul,{checked:t.review.enabled,onChange:s=>ke.updateWorkflow({review:{enabled:s}}),label:t.review.enabled?"On":"Off"})]}),E.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[E.jsx(He,{label:"Tool",hint:e5[t.review.tool],children:E.jsx("select",{className:"field",disabled:!t.review.enabled,value:t.review.tool,onChange:s=>ke.updateWorkflow({review:{tool:s.target.value}}),children:Object.keys(yi).map(s=>E.jsx("option",{value:s,children:yi[s]},s))})}),t.review.tool==="custom"&&E.jsx(He,{label:"Command",hint:"Runs on the host against the PR branch.",children:E.jsx(es,{className:"field font-term text-[17px]",value:t.review.command,placeholder:"pnpm lint && pnpm test",onCommit:s=>ke.updateWorkflow({review:{command:s}})})})]}),E.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."})]}),E.jsxs("section",{className:"border-[3px] border-ink bg-white p-3",children:[E.jsx(Ge,{children:"Merge"}),E.jsx("div",{className:"flex gap-2",role:"radiogroup","aria-label":"Who merges",children:["human","lead"].map(s=>E.jsx("button",{className:"btn text-[14px]",role:"radio","aria-checked":t.merge.by===s,"aria-pressed":t.merge.by===s,onClick:()=>ke.updateWorkflow({merge:{by:s}}),children:s==="human"?"You merge":"The lead merges"},s))}),E.jsx("p",{className:"mt-2 text-[12px] text-muted",children:"The lead always sets the merge order and handles conflicts between PRs."})]}),E.jsxs("section",{className:"border-[3px] border-ink bg-white p-3",children:[E.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[E.jsx(Ge,{children:"Deploy"}),E.jsx(Ul,{checked:t.deploy.enabled,onChange:s=>ke.updateWorkflow({deploy:{enabled:s}}),label:t.deploy.enabled?"On":"Off"})]}),E.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[E.jsx(He,{label:"Tool",children:E.jsx("select",{className:"field",disabled:!t.deploy.enabled,value:t.deploy.tool,onChange:s=>ke.updateWorkflow({deploy:{tool:s.target.value}}),children:Object.keys(Hl).map(s=>E.jsx("option",{value:s,children:Hl[s]},s))})}),t.deploy.tool==="custom"&&E.jsx(He,{label:"Command",children:E.jsx(es,{className:"field font-term text-[17px]",value:t.deploy.command,placeholder:"./scripts/deploy.sh",onCommit:s=>ke.updateWorkflow({deploy:{command:s}})})}),E.jsx("div",{className:"col-span-2",children:E.jsx(Ul,{checked:t.deploy.perAgentEnvironments,onChange:s=>ke.updateWorkflow({deploy:{perAgentEnvironments:s}}),label:"One environment per agent (own app + database copy)"})})]}),E.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 s5=[{id:"team",label:"Team",hint:"Agents, roles, skills"},{id:"workflow",label:"Workflow",hint:"Review, merge, deploy"},{id:"sandbox",label:"Sandbox",hint:"Network, proxy, secrets"},{id:"boards",label:"Boards",hint:"Progress boards"},{id:"project",label:"Project",hint:"Repo and HQ"}];function r5(){const t=We(s=>s.settings),e=ip();return t?E.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&&Pe.closeSettings(),children:E.jsxs(rp.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:[E.jsxs("div",{className:"flex items-center gap-3 border-b-[3px] border-ink px-4 py-2",children:[E.jsx("h2",{className:"m-0 flex-1 text-[22px] font-bold",children:"Settings"}),E.jsx("span",{className:"text-[13px] text-muted",children:"Changes apply right away."}),E.jsx("button",{className:"btn px-2.5","aria-label":"Close settings",onClick:()=>Pe.closeSettings(),children:"✕"})]}),E.jsxs("div",{className:"flex min-h-0 flex-1",children:[E.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:s5.map(s=>E.jsxs("button",{className:"btn block px-2.5 py-1 text-left","aria-pressed":t.tab===s.id,onClick:()=>Pe.openSettings(s.id,t.agentId),children:[E.jsx("div",{className:"text-[16px]",children:s.label}),E.jsx("div",{className:"text-[11px] font-normal text-muted",children:s.hint})]},s.id))}),E.jsxs("div",{className:"scroll-thin min-w-0 flex-1 overflow-y-auto p-5",children:[t.tab==="team"&&E.jsx(BD,{}),t.tab==="workflow"&&E.jsx(t5,{}),t.tab==="sandbox"&&E.jsx(JD,{initialAgentId:t.agentId}),t.tab==="boards"&&E.jsx(GD,{}),t.tab==="project"&&E.jsx(qD,{})]})]})]})}):null}function i5(){oe.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:n,setupOpen:l}=We.getState();if(e.key==="Escape"){l?Pe.closeSetup():r?Pe.closeSettings():n&&Pe.closeDrawer();return}if(r||l)return;let c=!0;if(e.key==="d"||e.key==="D")Pe.toggleDebug();else if(e.key==="+"||e.key==="=")Pe.zoom(1);else if(e.key==="-")Pe.zoom(-1);else if(/^[1-9]$/.test(e.key)){const u=(((o=Te.getState().snap)==null?void 0:o.config.team)??[])[Number(e.key)-1];u&&Pe.openAgent(u.id)}else c=!1;c&&e.preventDefault()};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[])}function n5(){oe.useEffect(()=>{let t=!1;return Te.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")&&Pe.openSetup()})},[])}function o5(){oe.useEffect(()=>SM(),[]),i5(),n5();const t=Te(r=>r.snap!==null),e=We(r=>r.setupOpen),s=Te(r=>{var n;return r.live&&!!((n=r.snap)!=null&&n.welcome)});return E.jsxs(E.Fragment,{children:[E.jsx(AT,{}),E.jsx(TD,{}),t&&E.jsxs(E.Fragment,{children:[E.jsx(VD,{}),E.jsx($D,{}),E.jsx(MD,{}),E.jsx(CD,{}),E.jsx(DT,{}),E.jsx(r5,{}),s?E.jsx(FD,{}):e&&E.jsx(DD,{}),E.jsx(zD,{})]})]})}kS.createRoot(document.getElementById("root")).render(E.jsx(oe.StrictMode,{children:E.jsx(o5,{})}));export{I2 as $,X0 as A,Ho as B,Ss as C,Nr as D,Qs as E,Yo as F,_c as G,nC as H,Xs as I,Yk as J,vc as K,L_ as L,Be as M,Nl as N,gc as O,jt as P,Kl as Q,Sd as R,lf as S,Ue as T,ql as U,hs as V,q0 as W,Et as X,F0 as Y,E2 as Z,T2 as _,$0 as a,D2 as a0,US as a1,N2 as a2,ts as a3,u0 as a4,Os as a5,_0 as a6,p_ as a7,wi as a8,TC as a9,g_ as aa,Ru as ab,v_ as ac,AC as ad,p0 as ae,WE as af,Q0 as ag,vt as ah,Hk as ai,Ik as aj,l2 as ak,t2 as al,fk as am,HS as an,M2 as ao,P2 as ap,O2 as aq,B2 as ar,j2 as as,I0 as b,xC as c,Le as d,pc as e,rk as f,Ve as g,Zk as h,Vl as i,Jt as j,rt as k,jl as l,f0 as m,s_ as n,Oe as o,gi as p,U2 as q,eE as r,yc as s,DE as t,mk as u,Xi as v,Ft as w,af as x,Mt as y,nn as z};
|