@unotest/viewer 0.43.1 → 0.43.2
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/CHANGELOG.md +10 -0
- package/dist/server/main.js +1 -1
- package/dist/server/session.js +1 -1
- package/dist/server/snapshot.js +1 -1
- package/dist/server/wire.js +1 -1
- package/dist/web/assets/{DslEditor-CapIr366.js → DslEditor-CBAoI3BF.js} +2 -2
- package/dist/web/assets/index-MB6jm1R_.js +55 -0
- package/dist/web/index.html +1 -1
- package/package.json +6 -6
- package/dist/web/assets/index-CFs9jSgu.js +0 -55
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DslEditor-CBAoI3BF.js","assets/DslEditor-DBQtlhBZ.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
var e,t,n,s,i,r,o,a,l,c,h,u,d,f,p,v,g,m,_,x,b,y,w,S,k,C,j,N,M,B,D,L,E,P,R,A,z,T,I,O,H,F,W,U,K,q,$,V,Y,G,X,Z,J,Q,ee,te,ne,se,ie,re,oe,ae,le,ce,he,ue,de,fe,pe,ve,ge,me,_e,xe,be,ye,we,Se,ke,Ce,je,Ne,Me,Be,De,Le,Ee,Pe,Re,Ae,ze,Te,Ie,Oe,He,Fe,We,Ue,Ke,qe,$e,Ve,Ye,Ge,Xe,Ze,Je,Qe,et,tt,nt,st,it,rt,ot,at,lt,ct,ht,ut,dt,ft,pt,vt,gt,mt,_t,xt,bt,yt,wt,St,kt,Ct,jt,Nt,Mt,Bt,Dt,Lt,Et=Object.defineProperty,Pt=(e,t,n)=>((e,t,n)=>t in e?Et(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);function Rt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))t(e);new MutationObserver(e=>{for(const n of e)if("childList"===n.type)for(const e of n.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&t(e)}).observe(document,{childList:!0,subtree:!0})}function t(e){if(e.ep)return;e.ep=!0;const t=function(e){const t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?t.credentials="include":"anonymous"===e.crossOrigin?t.credentials="omit":t.credentials="same-origin",t}(e);fetch(e.href,t)}}();var At={exports:{}},zt={},Tt={exports:{}},It={},Ot=Symbol.for("react.element"),Ht=Symbol.for("react.portal"),Ft=Symbol.for("react.fragment"),Wt=Symbol.for("react.strict_mode"),Ut=Symbol.for("react.profiler"),Kt=Symbol.for("react.provider"),qt=Symbol.for("react.context"),$t=Symbol.for("react.forward_ref"),Vt=Symbol.for("react.suspense"),Yt=Symbol.for("react.memo"),Gt=Symbol.for("react.lazy"),Xt=Symbol.iterator;var Zt={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Jt=Object.assign,Qt={};function en(e,t,n){this.props=e,this.context=t,this.refs=Qt,this.updater=n||Zt}function tn(){}function nn(e,t,n){this.props=e,this.context=t,this.refs=Qt,this.updater=n||Zt}en.prototype.isReactComponent={},en.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)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,e,t,"setState")},en.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},tn.prototype=en.prototype;var sn=nn.prototype=new tn;sn.constructor=nn,Jt(sn,en.prototype),sn.isPureReactComponent=!0;var rn=Array.isArray,on=Object.prototype.hasOwnProperty,an={current:null},ln={key:!0,ref:!0,__self:!0,__source:!0};function cn(e,t,n){var s,i={},r=null,o=null;if(null!=t)for(s in void 0!==t.ref&&(o=t.ref),void 0!==t.key&&(r=""+t.key),t)on.call(t,s)&&!ln.hasOwnProperty(s)&&(i[s]=t[s]);var a=arguments.length-2;if(1===a)i.children=n;else if(1<a){for(var l=Array(a),c=0;c<a;c++)l[c]=arguments[c+2];i.children=l}if(e&&e.defaultProps)for(s in a=e.defaultProps)void 0===i[s]&&(i[s]=a[s]);return{$$typeof:Ot,type:e,key:r,ref:o,props:i,_owner:an.current}}function hn(e){return"object"==typeof e&&null!==e&&e.$$typeof===Ot}var un=/\/+/g;function dn(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(e){return t[e]})}(""+e.key):t.toString(36)}function fn(e,t,n,s,i){var r=typeof e;"undefined"!==r&&"boolean"!==r||(e=null);var o=!1;if(null===e)o=!0;else switch(r){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case Ot:case Ht:o=!0}}if(o)return i=i(o=e),e=""===s?"."+dn(o,0):s,rn(i)?(n="",null!=e&&(n=e.replace(un,"$&/")+"/"),fn(i,t,n,"",function(e){return e})):null!=i&&(hn(i)&&(i=function(e,t){return{$$typeof:Ot,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(i,n+(!i.key||o&&o.key===i.key?"":(""+i.key).replace(un,"$&/")+"/")+e)),t.push(i)),1;if(o=0,s=""===s?".":s+":",rn(e))for(var a=0;a<e.length;a++){var l=s+dn(r=e[a],a);o+=fn(r,t,n,l,i)}else if(l=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=Xt&&e[Xt]||e["@@iterator"])?e:null}(e),"function"==typeof l)for(e=l.call(e),a=0;!(r=e.next()).done;)o+=fn(r=r.value,t,n,l=s+dn(r,a++),i);else if("object"===r)throw t=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return o}function pn(e,t,n){if(null==e)return e;var s=[],i=0;return fn(e,s,"","",function(e){return t.call(n,e,i++)}),s}function vn(e){if(-1===e._status){var t=e._result;(t=t()).then(function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)},function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var gn={current:null},mn={transition:null},_n={ReactCurrentDispatcher:gn,ReactCurrentBatchConfig:mn,ReactCurrentOwner:an};function xn(){throw Error("act(...) is not supported in production builds of React.")}It.Children={map:pn,forEach:function(e,t,n){pn(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return pn(e,function(){t++}),t},toArray:function(e){return pn(e,function(e){return e})||[]},only:function(e){if(!hn(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},It.Component=en,It.Fragment=Ft,It.Profiler=Ut,It.PureComponent=nn,It.StrictMode=Wt,It.Suspense=Vt,It.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=_n,It.act=xn,It.cloneElement=function(e,t,n){if(null==e)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var s=Jt({},e.props),i=e.key,r=e.ref,o=e._owner;if(null!=t){if(void 0!==t.ref&&(r=t.ref,o=an.current),void 0!==t.key&&(i=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(l in t)on.call(t,l)&&!ln.hasOwnProperty(l)&&(s[l]=void 0===t[l]&&void 0!==a?a[l]:t[l])}var l=arguments.length-2;if(1===l)s.children=n;else if(1<l){a=Array(l);for(var c=0;c<l;c++)a[c]=arguments[c+2];s.children=a}return{$$typeof:Ot,type:e.type,key:i,ref:r,props:s,_owner:o}},It.createContext=function(e){return(e={$$typeof:qt,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:Kt,_context:e},e.Consumer=e},It.createElement=cn,It.createFactory=function(e){var t=cn.bind(null,e);return t.type=e,t},It.createRef=function(){return{current:null}},It.forwardRef=function(e){return{$$typeof:$t,render:e}},It.isValidElement=hn,It.lazy=function(e){return{$$typeof:Gt,_payload:{_status:-1,_result:e},_init:vn}},It.memo=function(e,t){return{$$typeof:Yt,type:e,compare:void 0===t?null:t}},It.startTransition=function(e){var t=mn.transition;mn.transition={};try{e()}finally{mn.transition=t}},It.unstable_act=xn,It.useCallback=function(e,t){return gn.current.useCallback(e,t)},It.useContext=function(e){return gn.current.useContext(e)},It.useDebugValue=function(){},It.useDeferredValue=function(e){return gn.current.useDeferredValue(e)},It.useEffect=function(e,t){return gn.current.useEffect(e,t)},It.useId=function(){return gn.current.useId()},It.useImperativeHandle=function(e,t,n){return gn.current.useImperativeHandle(e,t,n)},It.useInsertionEffect=function(e,t){return gn.current.useInsertionEffect(e,t)},It.useLayoutEffect=function(e,t){return gn.current.useLayoutEffect(e,t)},It.useMemo=function(e,t){return gn.current.useMemo(e,t)},It.useReducer=function(e,t,n){return gn.current.useReducer(e,t,n)},It.useRef=function(e){return gn.current.useRef(e)},It.useState=function(e){return gn.current.useState(e)},It.useSyncExternalStore=function(e,t,n){return gn.current.useSyncExternalStore(e,t,n)},It.useTransition=function(){return gn.current.useTransition()},It.version="18.3.1",Tt.exports=It;var bn=Tt.exports;const yn=Rt(bn);
|
|
3
|
+
/**
|
|
4
|
+
* @license React
|
|
5
|
+
* react-jsx-runtime.production.min.js
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the MIT license found in the
|
|
10
|
+
* LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/var wn=bn,Sn=Symbol.for("react.element"),kn=Symbol.for("react.fragment"),Cn=Object.prototype.hasOwnProperty,jn=wn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Nn={key:!0,ref:!0,__self:!0,__source:!0};function Mn(e,t,n){var s,i={},r=null,o=null;for(s in void 0!==n&&(r=""+n),void 0!==t.key&&(r=""+t.key),void 0!==t.ref&&(o=t.ref),t)Cn.call(t,s)&&!Nn.hasOwnProperty(s)&&(i[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps)void 0===i[s]&&(i[s]=t[s]);return{$$typeof:Sn,type:e,key:r,ref:o,props:i,_owner:jn.current}}zt.Fragment=kn,zt.jsx=Mn,zt.jsxs=Mn,At.exports=zt;var Bn=At.exports;function Dn(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),s=1;s<t;s++)n[s-1]=arguments[s];throw new Error("number"==typeof e?"[MobX] minified error nr: "+e+(n.length?" "+n.map(String).join(","):"")+". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts":"[MobX] "+e)}var Ln={};function En(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:Ln}var Pn=Object.assign,Rn=Object.getOwnPropertyDescriptor,An=Object.defineProperty,zn=Object.prototype,Tn=[];Object.freeze(Tn);var In={};Object.freeze(In);var On="undefined"!=typeof Proxy,Hn=Object.toString();function Fn(){On||Dn("Proxy not available")}function Wn(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var Un=function(){};function Kn(e){return"function"==typeof e}function qn(e){switch(typeof e){case"string":case"symbol":case"number":return!0}return!1}function $n(e){return null!==e&&"object"==typeof e}function Vn(e){if(!$n(e))return!1;var t=Object.getPrototypeOf(e);if(null==t)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n.toString()===Hn}function Yn(e){var t=null==e?void 0:e.constructor;return!!t&&("GeneratorFunction"===t.name||"GeneratorFunction"===t.displayName)}function Gn(e,t,n){An(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function Xn(e,t,n){An(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function Zn(e,t){var n="isMobX"+e;return t.prototype[n]=!0,function(e){return $n(e)&&!0===e[n]}}function Jn(e){return null!=e&&"[object Map]"===Object.prototype.toString.call(e)}function Qn(e){return null!=e&&"[object Set]"===Object.prototype.toString.call(e)}var es=void 0!==Object.getOwnPropertySymbols;var ts="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:es?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function ns(e){return null===e?null:"object"==typeof e?""+e:e}function ss(e,t){return zn.hasOwnProperty.call(e,t)}var is=Object.getOwnPropertyDescriptors||function(e){var t={};return ts(e).forEach(function(n){t[n]=Rn(e,n)}),t};function rs(e,t){return!!(e&t)}function os(e,t,n){return n?e|=t:e&=~t,e}function as(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,s=Array(t);n<t;n++)s[n]=e[n];return s}function ls(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,vs(s.key),s)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function cs(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return as(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?as(e,t):void 0}}(e))||t){n&&(e=n);var s=0;return function(){return s>=e.length?{done:!0}:{done:!1,value:e[s++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function hs(){return hs=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)({}).hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},hs.apply(null,arguments)}function us(e){return(us=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ds(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ps(e,t)}function fs(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(fs=function(){return!!e})()}function ps(e,t){return(ps=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function vs(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t);if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:t+""}function gs(e){var t="function"==typeof Map?new Map:void 0;return gs=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return function(e,t,n){if(fs())return Reflect.construct.apply(null,arguments);var s=[null];s.push.apply(s,t);var i=new(e.bind.apply(e,s));return n&&ps(i,n.prototype),i}(e,arguments,us(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),ps(n,e)},gs(e)}var ms=Symbol("mobx-stored-annotations");function _s(e){return Object.assign(function(t,n){if(bs(n))return e.decorate_20223_(t,n);xs(t,n,e)},e)}function xs(e,t,n){ss(e,ms)||Gn(e,ms,hs({},e[ms])),function(e){return e.annotationType_===Ms}(n)||(e[ms][t]=n)}function bs(e){return"object"==typeof e&&"string"==typeof e.kind}var ys=Symbol("mobx administration"),ws=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.flags_=0,this.observers_=new Set,this.lastAccessedBy_=0,this.lowestObserverState_=Ci.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(e){return e()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(e){return e()})},t.reportObserved=function(){return Xi(this)},t.reportChanged=function(){Yi(),Zi(this),Gi()},t.toString=function(){return this.name_},ls(e,[{key:"isBeingObserved",get:function(){return rs(this.flags_,e.isBeingObservedMask_)},set:function(t){this.flags_=os(this.flags_,e.isBeingObservedMask_,t)}},{key:"isPendingUnobservation",get:function(){return rs(this.flags_,e.isPendingUnobservationMask_)},set:function(t){this.flags_=os(this.flags_,e.isPendingUnobservationMask_,t)}},{key:"diffValue",get:function(){return rs(this.flags_,e.diffValueMask_)?1:0},set:function(t){this.flags_=os(this.flags_,e.diffValueMask_,1===t)}}])}();ws.isBeingObservedMask_=1,ws.isPendingUnobservationMask_=2,ws.diffValueMask_=4;var Ss=Zn("Atom",ws);function ks(e,t,n){void 0===t&&(t=Un),void 0===n&&(n=Un);var s,i=new ws(e);return t!==Un&&Sr(br,i,t,s),n!==Un&&wr(i,n),i}var Cs={structural:function(e,t){return Ho(e,t)},default:function(e,t){return Object.is?Object.is(e,t):e===t?0!==e||1/e==1/t:e!=e&&t!=t}};function js(e,t,n){return Ar(e)?e:Array.isArray(e)?hi.array(e,{name:n}):Vn(e)?hi.object(e,void 0,{name:n}):Jn(e)?hi.map(e,{name:n}):Qn(e)?hi.set(e,{name:n}):"function"!=typeof e||vr(e)||Rr(e)?e:Yn(e)?Er(e):fr(n,e)}function Ns(e){return e}var Ms="override";function Bs(e,t){return{annotationType_:e,options_:t,make_:Ds,extend_:Ls,decorate_20223_:Es}}function Ds(e,t,n,s){var i;if(null!=(i=this.options_)&&i.bound)return null===this.extend_(e,t,n,!1)?0:1;if(s===e.target_)return null===this.extend_(e,t,n,!1)?0:2;if(vr(n.value))return 1;var r=Ps(e,this,t,n,!1);return An(s,t,r),2}function Ls(e,t,n,s){var i=Ps(e,this,t,n);return e.defineProperty_(t,i,s)}function Es(e,t){var n,s=t.kind,i=t.name,r=t.addInitializer,o=this,a=function(e){var t,n,s,r;return xi(null!=(t=null==(n=o.options_)?void 0:n.name)?t:i.toString(),e,null!=(s=null==(r=o.options_)?void 0:r.autoAction)&&s)};return"field"==s?function(e){var t,n=e;return vr(n)||(n=a(n)),null!=(t=o.options_)&&t.bound&&((n=n.bind(this)).isMobxAction=!0),n}:"method"==s?(vr(e)||(e=a(e)),null!=(n=this.options_)&&n.bound&&r(function(){var e=this,t=e[i].bind(e);t.isMobxAction=!0,e[i]=t}),e):void Dn("Cannot apply '"+o.annotationType_+"' to '"+String(i)+"' (kind: "+s+"):\n'"+o.annotationType_+"' can only be used on properties with a function value.")}function Ps(e,t,n,s,i){var r,o,a,l,c,h,u,d;void 0===i&&(i=Ki.safeDescriptors),d=s,t.annotationType_,d.value;var f,p=s.value;null!=(r=t.options_)&&r.bound&&(p=p.bind(null!=(f=e.proxy_)?f:e.target_));return{value:xi(null!=(o=null==(a=t.options_)?void 0:a.name)?o:n.toString(),p,null!=(l=null==(c=t.options_)?void 0:c.autoAction)&&l,null!=(h=t.options_)&&h.bound?null!=(u=e.proxy_)?u:e.target_:void 0),configurable:!i||e.isPlainObject_,enumerable:!1,writable:!i}}function Rs(e,t){return{annotationType_:e,options_:t,make_:As,extend_:zs,decorate_20223_:Ts}}function As(e,t,n,s){var i;if(s===e.target_)return null===this.extend_(e,t,n,!1)?0:2;if(null!=(i=this.options_)&&i.bound&&(!ss(e.target_,t)||!Rr(e.target_[t]))&&null===this.extend_(e,t,n,!1))return 0;if(Rr(n.value))return 1;var r=Is(e,this,t,n,!1,!1);return An(s,t,r),2}function zs(e,t,n,s){var i,r=Is(e,this,t,n,null==(i=this.options_)?void 0:i.bound);return e.defineProperty_(t,r,s)}function Ts(e,t){var n,s=t.name,i=t.addInitializer;return Rr(e)||(e=Er(e)),null!=(n=this.options_)&&n.bound&&i(function(){var e=this,t=e[s].bind(e);t.isMobXFlow=!0,e[s]=t}),e}function Is(e,t,n,s,i,r){var o;void 0===r&&(r=Ki.safeDescriptors),o=s,t.annotationType_,o.value;var a,l=s.value;(Rr(l)||(l=Er(l)),i)&&((l=l.bind(null!=(a=e.proxy_)?a:e.target_)).isMobXFlow=!0);return{value:l,configurable:!r||e.isPlainObject_,enumerable:!1,writable:!r}}function Os(e,t){return{annotationType_:e,options_:t,make_:Hs,extend_:Fs,decorate_20223_:Ws}}function Hs(e,t,n){return null===this.extend_(e,t,n,!1)?0:1}function Fs(e,t,n,s){var i;return i=n,this.annotationType_,i.get,e.defineComputedProperty_(t,hs({},this.options_,{get:n.get,set:n.set}),s)}function Ws(e,t){var n,s=this,i=t.name;function r(t,n){var r=hs({},s.options_,{get:e,context:t});return r.name||(r.name="ObservableObject."+i.toString()),new ki(r)}return(0,t.addInitializer)(function(){var t,n=xo(this)[ys],s=this,o=n.values_.get(i);o instanceof ki&&o.derivation!==e&&n.values_.delete(i),(null!=(t=n.lazyComputedKeys_)?t:n.lazyComputedKeys_=new Map).set(i,function(){return r(s)})}),function(){var t=this[ys],s=t.values_.get(i);if(s instanceof ki&&s.derivation!==e){var o,a,l=null==(o=n)?void 0:o.get(this);if(!l)l=r(this),(null!=(a=n)?a:n=new WeakMap).set(this,l);return l.get()}return t.getObservablePropValue_(i)}}function Us(e,t){return{annotationType_:e,options_:t,make_:Ks,extend_:qs,decorate_20223_:$s}}function Ks(e,t,n){return null===this.extend_(e,t,n,!1)?0:1}function qs(e,t,n,s){var i,r;return this.annotationType_,e.defineObservableProperty_(t,n.value,null!=(i=null==(r=this.options_)?void 0:r.enhancer)?i:js,s)}function $s(e,t){var n=this,s=t.kind,i=t.name;if("accessor"===s)return{get:function(){var t;return(null!=(t=this[ys])?t:r(this,e.get.call(this))).getObservablePropValue_(i)},set:function(e){var t;return(null!=(t=this[ys])?t:r(this,e)).setObservablePropValue_(i,e)},init:function(e){return r(this,e),e}};function r(e,t){var s,r=xo(e)[ys];return(null!=(s=r.lazyObservableKeys_)?s:r.lazyObservableKeys_=new Map).set(i,function(){var e,s;return new Si(t,null!=(e=null==(s=n.options_)?void 0:s.enhancer)?e:js,"ObservableObject."+i.toString(),!1)}),r}}var Vs="true",Ys=Gs();function Gs(e){return{annotationType_:Vs,options_:e,make_:Xs,extend_:Zs,decorate_20223_:Js}}function Xs(e,t,n,s){var i,r,o,a;if(n.get)return pi.make_(e,t,n,s);if(n.set){var l=vr(n.set)?n.set:xi(t.toString(),n.set);return s===e.target_?null===e.defineProperty_(t,{configurable:!Ki.safeDescriptors||e.isPlainObject_,set:l})?0:2:(An(s,t,{configurable:!0,set:l}),2)}if(s!==e.target_&&"function"==typeof n.value)return Yn(n.value)?(null!=(a=this.options_)&&a.autoBind?Er.bound:Er).make_(e,t,n,s):(null!=(o=this.options_)&&o.autoBind?fr.bound:fr).make_(e,t,n,s);var c,h=!1===(null==(i=this.options_)?void 0:i.deep)?hi.ref:hi;"function"==typeof n.value&&null!=(r=this.options_)&&r.autoBind&&(n.value=n.value.bind(null!=(c=e.proxy_)?c:e.target_));return h.make_(e,t,n,s)}function Zs(e,t,n,s){var i,r,o;if(n.get)return pi.extend_(e,t,n,s);if(n.set)return e.defineProperty_(t,{configurable:!Ki.safeDescriptors||e.isPlainObject_,set:xi(t.toString(),n.set)},s);"function"==typeof n.value&&null!=(i=this.options_)&&i.autoBind&&(n.value=n.value.bind(null!=(o=e.proxy_)?o:e.target_));return(!1===(null==(r=this.options_)?void 0:r.deep)?hi.ref:hi).extend_(e,t,n,s)}function Js(e,t){Dn("'"+this.annotationType_+"' cannot be used as a decorator")}var Qs={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};function ei(e){return e||Qs}Object.freeze(Qs);var ti=Us("observable"),ni=Us("observable.ref",{enhancer:Ns}),si=Us("observable.shallow",{enhancer:function(e,t,n){return null==e||wo(e)||io(e)||co(e)||po(e)?e:Array.isArray(e)?hi.array(e,{name:n,deep:!1}):Vn(e)?hi.object(e,void 0,{name:n,deep:!1}):Jn(e)?hi.map(e,{name:n,deep:!1}):Qn(e)?hi.set(e,{name:n,deep:!1}):void 0}}),ii=Us("observable.struct",{enhancer:function(e,t){return Ho(e,t)?t:e}}),ri=_s(ti);function oi(e){return!0===e.deep?js:!1===e.deep?Ns:(t=e.defaultDecorator)&&null!=(n=null==(s=t.options_)?void 0:s.enhancer)?n:js;var t,n,s}function ai(e,t,n){return bs(t)?ti.decorate_20223_(e,t):qn(t)?void xs(e,t,ti):Ar(e)?e:Vn(e)?hi.object(e,t,n):Array.isArray(e)?hi.array(e,t):Jn(e)?hi.map(e,t):Qn(e)?hi.set(e,t):"object"==typeof e&&null!==e?e:hi.box(e,t)}Pn(ai,ri);var li,ci,hi=Pn(ai,{box:function(e,t){var n=ei(t);return new Si(e,oi(n),n.name,!0,n.equals)},array:function(e,t){var n=ei(t);return(!1===Ki.useProxies||!1===n.proxy?Ro:Zr)(e,oi(n),n.name)},map:function(e,t){var n=ei(t);return new lo(e,oi(n),n.name)},set:function(e,t){var n=ei(t);return new fo(e,oi(n),n.name)},object:function(e,t,n){return To(function(){return jr(!1===Ki.useProxies||!1===(null==n?void 0:n.proxy)?xo({},n):function(e,t){var n,s;return Fn(),e=xo(e,t),null!=(s=(n=e[ys]).proxy_)?s:n.proxy_=new Proxy(e,Ir)}({},n),e,t)})},ref:_s(ni),shallow:_s(si),deep:ri,struct:_s(ii)}),ui="computed",di=Os(ui),fi=Os("computed.struct",{equals:Cs.structural}),pi=function(e,t){if(bs(t))return di.decorate_20223_(e,t);if(qn(t))return xs(e,t,di);if(Vn(e))return _s(Os(ui,e));var n=Vn(t)?t:{};return n.get=e,n.name||(n.name=e.name||""),new ki(n)};Object.assign(pi,di),pi.struct=_s(fi);var vi=0,gi=1,mi=null!=(li=null==(ci=Rn(function(){},"name"))?void 0:ci.configurable)&&li,_i={value:"action",configurable:!0,writable:!1,enumerable:!1};function xi(e,t,n,s){function i(){return bi(e,n,t,s||this,arguments)}return void 0===n&&(n=!1),i.isMobxAction=!0,i.toString=function(){return t.toString()},mi&&(_i.value=e,An(i,"name",_i)),i}function bi(e,t,n,s,i){var r=function(e,t){var n=!1,s=0,i=Ki.trackingDerivation,r=!t||!i;Yi();var o=Ki.allowStateChanges;r&&(zi(),o=yi(!0));var a=Ii(!0),l={runAsAction_:r,prevDerivation_:i,prevAllowStateChanges_:o,prevAllowStateReads_:a,notifySpy_:n,startTime_:s,actionId_:gi++,parentActionId_:vi};return vi=l.actionId_,l}(0,t);try{return n.apply(s,i)}catch(o){throw r.error_=o,o}finally{!function(e){vi!==e.actionId_&&Dn(30);vi=e.parentActionId_,void 0!==e.error_&&(Ki.suppressReactionErrors=!0);wi(e.prevAllowStateChanges_),Oi(e.prevAllowStateReads_),Gi(),e.runAsAction_&&Ti(e.prevDerivation_);Ki.suppressReactionErrors=!1}(r)}}function yi(e){var t=Ki.allowStateChanges;return Ki.allowStateChanges=e,t}function wi(e){Ki.allowStateChanges=e}var Si=function(e){function t(t,n,s,i,r){var o;return void 0===s&&(s="ObservableValue"),void 0===r&&(r=Cs.default),(o=e.call(this,s)||this).enhancer=void 0,o.name_=void 0,o.equals=void 0,o.hasUnreportedChange_=!1,o.interceptors_=void 0,o.changeListeners_=void 0,o.value_=void 0,o.dehancer=void 0,o.enhancer=n,o.name_=s,o.equals=r,o.value_=n(t,void 0,s),o}ds(t,e);var n=t.prototype;return n.dehanceValue=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.set=function(e){this.value_,(e=this.prepareNewValue_(e))!==Ki.UNCHANGED&&this.setNewValue_(e)},n.prepareNewValue_=function(e){if(Or(this)){var t=Fr(this,{object:this,type:Yr,newValue:e});if(!t)return Ki.UNCHANGED;e=t.newValue}return e=this.enhancer(e,this.value_,this.name_),this.equals(this.value_,e)?Ki.UNCHANGED:e},n.setNewValue_=function(e){var t=this.value_;this.value_=e,this.reportChanged(),Wr(this)&&Kr(this,{type:Yr,object:this,newValue:e,oldValue:t})},n.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},n.intercept_=function(e){return Hr(this,e)},n.observe_=function(e,t){return t&&e({observableKind:"value",debugObjectName:this.name_,object:this,type:Yr,newValue:this.value_,oldValue:void 0}),Ur(this,e)},n.raw=function(){return this.value_},n.toJSON=function(){return this.get()},n.toString=function(){return this.name_+"["+this.value_+"]"},n.valueOf=function(){return ns(this.get())},n[Symbol.toPrimitive]=function(){return this.valueOf()},t}(ws),ki=function(){function e(e){this.dependenciesState_=Ci.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ci.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new Di(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=Ni.NONE,this.scope_=void 0,this.equals_=void 0,this.requiresReaction_=void 0,this.keepAlive_=void 0,this.onBOL=void 0,this.onBUOL=void 0,e.get||Dn(31),this.derivation=e.get,this.name_=e.name||"ComputedValue",e.set&&(this.setter_=xi("ComputedValue-setter",e.set)),this.equals_=e.equals||(e.compareStructural||e.struct?Cs.structural:Cs.default),this.scope_=e.context,this.requiresReaction_=e.requiresReaction,this.keepAlive_=!!e.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){!function(e){if(e.lowestObserverState_!==Ci.UP_TO_DATE_)return;e.lowestObserverState_=Ci.POSSIBLY_STALE_,e.observers_.forEach(function(e){e.dependenciesState_===Ci.UP_TO_DATE_&&(e.dependenciesState_=Ci.POSSIBLY_STALE_,e.onBecomeStale_())})}(this)},t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(e){return e()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(e){return e()})},t.get=function(){if(this.isComputing&&Dn(32,this.name_,this.derivation),0!==Ki.inBatch||0!==this.observers_.size||this.keepAlive_){if(Xi(this),Ei(this)){var e=Ki.trackingContext;this.keepAlive_&&!e&&(Ki.trackingContext=this),this.trackAndCompute()&&function(e){if(e.lowestObserverState_===Ci.STALE_)return;e.lowestObserverState_=Ci.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Ci.POSSIBLY_STALE_?t.dependenciesState_=Ci.STALE_:t.dependenciesState_===Ci.UP_TO_DATE_&&(e.lowestObserverState_=Ci.UP_TO_DATE_)})}(this),Ki.trackingContext=e}}else Ei(this)&&(this.warnAboutUntrackedRead_(),Yi(),this.value_=this.computeValue_(!1),Gi());var t=this.value_;if(Li(t))throw t.cause;return t},t.set=function(e){if(this.setter_){this.isRunningSetter&&Dn(33,this.name_),this.isRunningSetter=!0;try{this.setter_.call(this.scope_,e)}finally{this.isRunningSetter=!1}}else Dn(34,this.name_)},t.trackAndCompute=function(){var e=this.value_,t=this.dependenciesState_===Ci.NOT_TRACKING_,n=this.computeValue_(!0),s=t||Li(e)||Li(n)||!this.equals_(e,n);return s&&(this.value_=n),s},t.computeValue_=function(e){this.isComputing=!0;var t,n=yi(!1);if(e)t=Pi(this,this.derivation,this.scope_);else if(!0===Ki.disableErrorBoundaries)t=this.derivation.call(this.scope_);else try{t=this.derivation.call(this.scope_)}catch(s){t=new Di(s)}return wi(n),this.isComputing=!1,t},t.suspend_=function(){this.keepAlive_||(Ri(this),this.value_=void 0)},t.observe_=function(e,t){var n=this,s=!0,i=void 0;return gr(function(){var r=n.get();if(!s||t){var o=zi();e({observableKind:"computed",debugObjectName:n.name_,type:Yr,object:n,newValue:r,oldValue:i}),Ti(o)}s=!1,i=r})},t.warnAboutUntrackedRead_=function(){},t.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},t.valueOf=function(){return ns(this.get())},t[Symbol.toPrimitive]=function(){return this.valueOf()},ls(e,[{key:"isComputing",get:function(){return rs(this.flags_,e.isComputingMask_)},set:function(t){this.flags_=os(this.flags_,e.isComputingMask_,t)}},{key:"isRunningSetter",get:function(){return rs(this.flags_,e.isRunningSetterMask_)},set:function(t){this.flags_=os(this.flags_,e.isRunningSetterMask_,t)}},{key:"isBeingObserved",get:function(){return rs(this.flags_,e.isBeingObservedMask_)},set:function(t){this.flags_=os(this.flags_,e.isBeingObservedMask_,t)}},{key:"isPendingUnobservation",get:function(){return rs(this.flags_,e.isPendingUnobservationMask_)},set:function(t){this.flags_=os(this.flags_,e.isPendingUnobservationMask_,t)}},{key:"diffValue",get:function(){return rs(this.flags_,e.diffValueMask_)?1:0},set:function(t){this.flags_=os(this.flags_,e.diffValueMask_,1===t)}}])}();ki.isComputingMask_=1,ki.isRunningSetterMask_=2,ki.isBeingObservedMask_=4,ki.isPendingUnobservationMask_=8,ki.diffValueMask_=16;var Ci,ji,Ni,Mi,Bi=Zn("ComputedValue",ki);(ji=Ci||(Ci={}))[ji.NOT_TRACKING_=-1]="NOT_TRACKING_",ji[ji.UP_TO_DATE_=0]="UP_TO_DATE_",ji[ji.POSSIBLY_STALE_=1]="POSSIBLY_STALE_",ji[ji.STALE_=2]="STALE_",(Mi=Ni||(Ni={}))[Mi.NONE=0]="NONE",Mi[Mi.LOG=1]="LOG",Mi[Mi.BREAK=2]="BREAK";var Di=function(e){this.cause=void 0,this.cause=e};function Li(e){return e instanceof Di}function Ei(e){switch(e.dependenciesState_){case Ci.UP_TO_DATE_:return!1;case Ci.NOT_TRACKING_:case Ci.STALE_:return!0;case Ci.POSSIBLY_STALE_:for(var t=Ii(!0),n=zi(),s=e.observing_,i=s.length,r=0;r<i;r++){var o=s[r];if(Bi(o)){if(Ki.disableErrorBoundaries)o.get();else try{o.get()}catch(a){return Ti(n),Oi(t),!0}if(e.dependenciesState_===Ci.STALE_)return Ti(n),Oi(t),!0}}return Hi(e),Ti(n),Oi(t),!1}}function Pi(e,t,n){var s=Ii(!0);Hi(e),e.newObserving_=new Array(0===e.runId_?100:e.observing_.length),e.unboundDepsCount_=0,e.runId_=++Ki.runId;var i,r=Ki.trackingDerivation;if(Ki.trackingDerivation=e,Ki.inBatch++,!0===Ki.disableErrorBoundaries)i=t.call(n);else try{i=t.call(n)}catch(o){i=new Di(o)}return Ki.inBatch--,Ki.trackingDerivation=r,function(e){for(var t=e.observing_,n=e.observing_=e.newObserving_,s=Ci.UP_TO_DATE_,i=0,r=e.unboundDepsCount_,o=0;o<r;o++){var a=n[o];0===a.diffValue&&(a.diffValue=1,i!==o&&(n[i]=a),i++),a.dependenciesState_>s&&(s=a.dependenciesState_)}n.length=i,e.newObserving_=null,r=t.length;for(;r--;){var l=t[r];0===l.diffValue&&$i(l,e),l.diffValue=0}for(;i--;){var c=n[i];1===c.diffValue&&(c.diffValue=0,qi(c,e))}s!==Ci.UP_TO_DATE_&&(e.dependenciesState_=s,e.onBecomeStale_())}(e),Oi(s),i}function Ri(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)$i(t[n],e);e.dependenciesState_=Ci.NOT_TRACKING_}function Ai(e){var t=zi();try{return e()}finally{Ti(t)}}function zi(){var e=Ki.trackingDerivation;return Ki.trackingDerivation=null,e}function Ti(e){Ki.trackingDerivation=e}function Ii(e){var t=Ki.allowStateReads;return Ki.allowStateReads=e,t}function Oi(e){Ki.allowStateReads=e}function Hi(e){if(e.dependenciesState_!==Ci.UP_TO_DATE_){e.dependenciesState_=Ci.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=Ci.UP_TO_DATE_}}var Fi=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0},Wi=!0,Ui=!1,Ki=function(){var e=En();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(Wi=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new Fi).version&&(Wi=!1),Wi?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new Fi):(setTimeout(function(){Ui||Dn(35)},1),new Fi)}();function qi(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function $i(e,t){e.observers_.delete(t),0===e.observers_.size&&Vi(e)}function Vi(e){!1===e.isPendingUnobservation&&(e.isPendingUnobservation=!0,Ki.pendingUnobservations.push(e))}function Yi(){Ki.inBatch++}function Gi(){if(0===--Ki.inBatch){tr();for(var e=Ki.pendingUnobservations,t=0;t<e.length;t++){var n=e[t];n.isPendingUnobservation=!1,0===n.observers_.size&&(n.isBeingObserved&&(n.isBeingObserved=!1,n.onBUO()),n instanceof ki&&n.suspend_())}Ki.pendingUnobservations=[]}}function Xi(e){var t=Ki.trackingDerivation;return null!==t?(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved&&Ki.trackingContext&&(e.isBeingObserved=!0,e.onBO())),e.isBeingObserved):(0===e.observers_.size&&Ki.inBatch>0&&Vi(e),!1)}function Zi(e){e.lowestObserverState_!==Ci.STALE_&&(e.lowestObserverState_=Ci.STALE_,e.observers_.forEach(function(e){e.dependenciesState_===Ci.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ci.STALE_}))}var Ji=function(){function e(e,t,n,s){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ci.NOT_TRACKING_,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.isTracing_=Ni.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=s}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled||(this.isScheduled=!0,Ki.pendingReactions.push(this),tr())},t.runReaction_=function(){if(!this.isDisposed){Yi(),this.isScheduled=!1;var e=Ki.trackingContext;if(Ki.trackingContext=this,Ei(this)){this.isTrackPending=!0;try{this.onInvalidate_()}catch(t){this.reportExceptionInDerivation_(t)}}Ki.trackingContext=e,Gi()}},t.track=function(e){if(!this.isDisposed){Yi(),this.isRunning=!0;var t=Ki.trackingContext;Ki.trackingContext=this;var n=Pi(this,e,void 0);Ki.trackingContext=t,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&Ri(this),Li(n)&&this.reportExceptionInDerivation_(n.cause),Gi()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(Ki.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";Ki.suppressReactionErrors||console.error(n,e),Ki.globalReactionErrorHandlers.forEach(function(n){return n(e,t)})}},t.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(Yi(),Ri(this),Gi()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[ys]=this,"dispose"in Symbol&&"symbol"==typeof Symbol.dispose&&(n[Symbol.dispose]=n),n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){},ls(e,[{key:"isDisposed",get:function(){return rs(this.flags_,e.isDisposedMask_)},set:function(t){this.flags_=os(this.flags_,e.isDisposedMask_,t)}},{key:"isScheduled",get:function(){return rs(this.flags_,e.isScheduledMask_)},set:function(t){this.flags_=os(this.flags_,e.isScheduledMask_,t)}},{key:"isTrackPending",get:function(){return rs(this.flags_,e.isTrackPendingMask_)},set:function(t){this.flags_=os(this.flags_,e.isTrackPendingMask_,t)}},{key:"isRunning",get:function(){return rs(this.flags_,e.isRunningMask_)},set:function(t){this.flags_=os(this.flags_,e.isRunningMask_,t)}},{key:"diffValue",get:function(){return rs(this.flags_,e.diffValueMask_)?1:0},set:function(t){this.flags_=os(this.flags_,e.diffValueMask_,1===t)}}])}();Ji.isDisposedMask_=1,Ji.isScheduledMask_=2,Ji.isTrackPendingMask_=4,Ji.isRunningMask_=8,Ji.diffValueMask_=16;var Qi=100,er=function(e){return e()};function tr(){Ki.inBatch>0||Ki.isRunningReactions||er(nr)}function nr(){Ki.isRunningReactions=!0;for(var e=Ki.pendingReactions,t=0;e.length>0;){++t===Qi&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),s=0,i=n.length;s<i;s++)n[s].runReaction_()}Ki.isRunningReactions=!1}var sr=Zn("Reaction",Ji);var ir="action",rr="autoAction",or="<unnamed action>",ar=Bs(ir),lr=Bs("action.bound",{bound:!0}),cr=Bs(rr,{autoAction:!0}),hr=Bs("autoAction.bound",{autoAction:!0,bound:!0});function ur(e){return function(t,n){return Kn(t)?xi(t.name||or,t,e):Kn(n)?xi(t,n,e):bs(n)?(e?cr:ar).decorate_20223_(t,n):qn(n)?xs(t,n,e?cr:ar):qn(t)?_s(Bs(e?rr:ir,{name:t,autoAction:e})):void 0}}var dr=ur(!1);Object.assign(dr,ar);var fr=ur(!0);function pr(e){return bi(e.name,!1,e,this,void 0)}function vr(e){return Kn(e)&&!0===e.isMobxAction}function gr(e,t){var n,s,i,r;void 0===t&&(t=In);var o,a=null!=(n=null==(s=t)?void 0:s.name)?n:"Autorun";if(!t.scheduler&&!t.delay)o=new Ji(a,function(){this.track(h)},t.onError,t.requiresObservable);else{var l=_r(t),c=!1;o=new Ji(a,function(){c||(c=!0,l(function(){c=!1,o.isDisposed||o.track(h)}))},t.onError,t.requiresObservable)}function h(){e(o)}return null!=(i=t)&&null!=(i=i.signal)&&i.aborted||o.schedule_(),o.getDisposer_(null==(r=t)?void 0:r.signal)}Object.assign(fr,cr),dr.bound=_s(lr),fr.bound=_s(hr);var mr=function(e){return e()};function _r(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:mr}function xr(e,t,n){var s,i,r;void 0===n&&(n=In);var o,a,l,c=null!=(s=n.name)?s:"Reaction",h=dr(c,n.onError?(o=n.onError,a=t,function(){try{return a.apply(this,arguments)}catch(e){o.call(this,e)}}):t),u=!n.scheduler&&!n.delay,d=_r(n),f=!0,p=!1,v=n.compareStructural?Cs.structural:n.equals||Cs.default,g=new Ji(c,function(){f||u?m():p||(p=!0,d(m))},n.onError,n.requiresObservable);function m(){if(p=!1,!g.isDisposed){var t=!1,s=l;g.track(function(){var n=function(e,t){var n=yi(e);try{return t()}finally{wi(n)}}(!1,function(){return e(g)});t=f||!v(l,n),l=n}),(f&&n.fireImmediately||!f&&t)&&h(l,s,g),f=!1}}return null!=(i=n)&&null!=(i=i.signal)&&i.aborted||g.schedule_(),g.getDisposer_(null==(r=n)?void 0:r.signal)}var br="onBO",yr="onBUO";function wr(e,t,n){return Sr(yr,e,t,n)}function Sr(e,t,n,s){var i=Ao(t),r=Kn(s)?s:n,o=e+"L";return i[o]?i[o].add(r):i[o]=new Set([r]),function(){var e=i[o];e&&(e.delete(r),0===e.size&&delete i[o])}}var kr="always";function Cr(e){!0===e.isolateGlobalState&&function(){if((Ki.pendingReactions.length||Ki.inBatch||Ki.isRunningReactions)&&Dn(36),Ui=!0,Wi){var e=En();0===--e.__mobxInstanceCount&&(e.__mobxGlobals=void 0),Ki=new Fi}}();var t,n,s=e.useProxies,i=e.enforceActions;if(void 0!==s&&(Ki.useProxies=s===kr||"never"!==s&&"undefined"!=typeof Proxy),"ifavailable"===s&&(Ki.verifyProxies=!0),void 0!==i){var r=i===kr?kr:"observed"===i;Ki.enforceActions=r,Ki.allowStateChanges=!0!==r&&r!==kr}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(t){t in e&&(Ki[t]=!!e[t])}),Ki.allowStateReads=!Ki.observableRequiresReaction,e.reactionScheduler&&(t=e.reactionScheduler,n=er,er=function(e){return t(function(){return n(e)})})}function jr(e,t,n,s){var i=is(t);return To(function(){var t=xo(e,s)[ys];ts(i).forEach(function(e){t.extend_(e,i[e],!n||(!(e in n)||n[e]))})}),e}function Nr(e){var t,n={name:e.name_};return e.observing_&&e.observing_.length>0&&(n.dependencies=(t=e.observing_,Array.from(new Set(t))).map(Nr)),n}var Mr=0,Br=function(e){function t(){var n;return n=e.call(this,"FLOW_CANCELLED")||this,Object.setPrototypeOf(n,(this instanceof t?this.constructor:void 0).prototype),n.name="FlowCancellationError",n}return ds(t,e),t.prototype.toString=function(){return"Error: "+this.message},t}(gs(Error)),Dr=Rs("flow"),Lr=Rs("flow.bound",{bound:!0}),Er=Object.assign(function(e,t){if(bs(t))return Dr.decorate_20223_(e,t);if(qn(t))return xs(e,t,Dr);var n=e,s=n.name||"<unnamed flow>",i=function(){var e,t=arguments,i=++Mr,r=dr(s+" - runid: "+i+" - init",n).apply(this,t),o=void 0,a=new Promise(function(t,n){var a=0;function l(e){var t;o=void 0;try{t=dr(s+" - runid: "+i+" - yield "+a++,r.next).call(r,e)}catch(l){return n(l)}h(t)}function c(e){var t;o=void 0;try{t=dr(s+" - runid: "+i+" - yield "+a++,r.throw).call(r,e)}catch(l){return n(l)}h(t)}function h(e){if(!Kn(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(l,c);e.then(h,n)}e=n,l(void 0)});return a.cancel=dr(s+" - runid: "+i+" - cancel",function(){try{o&&Pr(o);var t=r.return(void 0),n=Promise.resolve(t.value);n.then(Un,Un),Pr(n),e(new Br)}catch(s){e(s)}}),a};return i.isMobXFlow=!0,i},Dr);function Pr(e){Kn(e.cancel)&&e.cancel()}function Rr(e){return!0===(null==e?void 0:e.isMobXFlow)}function Ar(e){return function(e){return!!e&&(wo(e)||!!e[ys]||Ss(e)||sr(e)||Bi(e))}(e)}function zr(e,t){void 0===t&&(t=void 0),Yi();try{return e.apply(t)}finally{Gi()}}function Tr(e){return e[ys]}Er.bound=_s(Lr);var Ir={has:function(e,t){return Tr(e).has_(t)},get:function(e,t){return Tr(e).get_(t)},set:function(e,t,n){var s;return!!qn(t)&&(null==(s=Tr(e).set_(t,n,!0))||s)},deleteProperty:function(e,t){var n;return!!qn(t)&&(null==(n=Tr(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var s;return null==(s=Tr(e).defineProperty_(t,n))||s},ownKeys:function(e){return Tr(e).ownKeys_()},preventExtensions:function(e){Dn(13)}};function Or(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function Hr(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),Wn(function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)})}function Fr(e,t){var n=zi();try{for(var s=[].concat(e.interceptors_||[]),i=0,r=s.length;i<r&&((t=s[i](t))&&!t.type&&Dn(14),t);i++);return t}finally{Ti(n)}}function Wr(e){return void 0!==e.changeListeners_&&e.changeListeners_.length>0}function Ur(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),Wn(function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)})}function Kr(e,t){var n=zi(),s=e.changeListeners_;if(s){for(var i=0,r=(s=s.slice()).length;i<r;i++)s[i](t);Ti(n)}}var qr=Symbol("mobx-keys");function $r(e,t,n){return Vn(e)?jr(e,e,t,n):(To(function(){var s=xo(e,n)[ys];if(!e[qr]){var i=Object.getPrototypeOf(e),r=new Set([].concat(ts(e),ts(i)));r.delete("constructor"),r.delete(ys),Gn(i,qr,r)}e[qr].forEach(function(e){return s.make_(e,!t||(!(e in t)||t[e]))})}),e)}var Vr="splice",Yr="update",Gr={get:function(e,t){var n=e[ys];return t===ys?n:"length"===t?n.getArrayLength_():"string"!=typeof t||isNaN(t)?ss(Jr,t)?Jr[t]:e[t]:n.get_(parseInt(t))},set:function(e,t,n){var s=e[ys];return"length"===t&&s.setArrayLength_(n),"symbol"==typeof t||isNaN(t)?e[t]=n:s.set_(parseInt(t),n),!0},preventExtensions:function(){Dn(15)}},Xr=function(){function e(e,t,n,s){void 0===e&&(e="ObservableArray"),this.owned_=void 0,this.legacyMode_=void 0,this.atom_=void 0,this.values_=[],this.interceptors_=void 0,this.changeListeners_=void 0,this.enhancer_=void 0,this.dehancer=void 0,this.proxy_=void 0,this.lastKnownLength_=0,this.owned_=n,this.legacyMode_=s,this.atom_=new ws(e),this.enhancer_=function(e,n){return t(e,n,"ObservableArray[..]")}}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.dehanceValues_=function(e){return void 0!==this.dehancer&&e.length>0?e.map(this.dehancer):e},t.intercept_=function(e){return Hr(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),Ur(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&Dn("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),s=0;s<e-t;s++)n[s]=void 0;this.spliceWithArray_(t,0,n)}else this.spliceWithArray_(e,t-e)},t.updateArrayLength_=function(e,t){e!==this.lastKnownLength_&&Dn(16),this.lastKnownLength_+=t,this.legacyMode_&&t>0&&Po(e+t+1)},t.spliceWithArray_=function(e,t,n){var s=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=Tn),Or(this)){var r=Fr(this,{object:this.proxy_,type:Vr,index:e,removedCount:t,added:n});if(!r)return Tn;t=r.removedCount,n=r.added}if(n=0===n.length?n:n.map(function(e){return s.enhancer_(e,void 0)}),this.legacyMode_){var o=n.length-t;this.updateArrayLength_(i,o)}var a=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,a),this.dehanceValues_(a)},t.spliceItemsIntoValues_=function(e,t,n){var s;if(n.length<1e4)return(s=this.values_).splice.apply(s,[e,t].concat(n));var i=this.values_.slice(e,e+t),r=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var o=0;o<n.length;o++)this.values_[e+o]=n[o];for(var a=0;a<r.length;a++)this.values_[e+n.length+a]=r[a];return i},t.notifyArrayChildUpdate_=function(e,t,n){var s=!this.owned_&&!1,i=Wr(this),r=i||s?{observableKind:"array",object:this.proxy_,type:Yr,debugObjectName:this.atom_.name_,index:e,newValue:t,oldValue:n}:null;this.atom_.reportChanged(),i&&Kr(this,r)},t.notifyArraySplice_=function(e,t,n){var s=!this.owned_&&!1,i=Wr(this),r=i||s?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:Vr,index:e,removed:n,added:t,removedCount:n.length,addedCount:t.length}:null;this.atom_.reportChanged(),i&&Kr(this,r)},t.get_=function(e){if(!(this.legacyMode_&&e>=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&Dn(17,e,n.length),e<n.length){this.atom_;var s=n[e];if(Or(this)){var i=Fr(this,{type:Yr,object:this.proxy_,index:e,newValue:t});if(!i)return;t=i.newValue}(t=this.enhancer_(t,s))!==s&&(n[e]=t,this.notifyArrayChildUpdate_(e,t,s))}else{for(var r=new Array(e+1-n.length),o=0;o<r.length-1;o++)r[o]=void 0;r[r.length-1]=t,this.spliceWithArray_(n.length,0,r)}},e}();function Zr(e,t,n,s){return void 0===n&&(n="ObservableArray"),void 0===s&&(s=!1),Fn(),To(function(){var i=new Xr(n,t,s,!1);Xn(i.values_,ys,i);var r=new Proxy(i.values_,Gr);return i.proxy_=r,e&&e.length&&i.spliceWithArray_(0,0,e),r})}var Jr={clear:function(){return this.splice(0)},replace:function(e){var t=this[ys];return t.spliceWithArray_(0,t.values_.length,e)},toJSON:function(){return this.slice()},splice:function(e,t){for(var n=arguments.length,s=new Array(n>2?n-2:0),i=2;i<n;i++)s[i-2]=arguments[i];var r=this[ys];switch(arguments.length){case 0:return[];case 1:return r.spliceWithArray_(e);case 2:return r.spliceWithArray_(e,t)}return r.spliceWithArray_(e,t,s)},spliceWithArray:function(e,t,n){return this[ys].spliceWithArray_(e,t,n)},push:function(){for(var e=this[ys],t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return e.spliceWithArray_(e.values_.length,0,n),e.values_.length},pop:function(){return this.splice(Math.max(this[ys].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var e=this[ys],t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return e.spliceWithArray_(0,0,n),e.values_.length},reverse:function(){return Ki.trackingDerivation&&Dn(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){Ki.trackingDerivation&&Dn(37,"sort");var e=this.slice();return e.sort.apply(e,arguments),this.replace(e),this},remove:function(e){var t=this[ys],n=t.dehanceValues_(t.values_).indexOf(e);return n>-1&&(this.splice(n,1),!0)}};function Qr(e,t){"function"==typeof Array.prototype[e]&&(Jr[e]=t(e))}function eo(e){return function(){var t=this[ys];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function to(e){return function(t,n){var s=this,i=this[ys];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e](function(e,i){return t.call(n,e,i,s)})}}function no(e){return function(){var t=this,n=this[ys];n.atom_.reportObserved();var s=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,s){return i(e,n,s,t)},s[e].apply(s,arguments)}}Qr("at",eo),Qr("concat",eo),Qr("flat",eo),Qr("includes",eo),Qr("indexOf",eo),Qr("join",eo),Qr("lastIndexOf",eo),Qr("slice",eo),Qr("toString",eo),Qr("toLocaleString",eo),Qr("toSorted",eo),Qr("toSpliced",eo),Qr("with",eo),Qr("every",to),Qr("filter",to),Qr("find",to),Qr("findIndex",to),Qr("findLast",to),Qr("findLastIndex",to),Qr("flatMap",to),Qr("forEach",to),Qr("map",to),Qr("some",to),Qr("toReversed",to),Qr("reduce",no),Qr("reduceRight",no);var so=Zn("ObservableArrayAdministration",Xr);function io(e){return $n(e)&&so(e[ys])}var ro={},oo="add",ao="delete",lo=function(){function e(e,t,n){var s=this;void 0===t&&(t=js),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[ys]=ro,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,Kn(Map)||Dn(18),To(function(){s.keysAtom_=ks("ObservableMap.keys()"),s.data_=new Map,s.hasMap_=new Map,e&&s.merge(e)})}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!Ki.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var s=n=new Si(this.has_(e),Ns,"ObservableMap.key?",!1);this.hasMap_.set(e,s),wr(s,function(){return t.hasMap_.delete(e)})}return n.get()},t.set=function(e,t){var n=this.has_(e);if(Or(this)){var s=Fr(this,{type:n?Yr:oo,object:this,newValue:t,name:e});if(!s)return this;t=s.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if((this.keysAtom_,Or(this))&&!Fr(this,{type:ao,object:this,name:e}))return!1;if(this.has_(e)){var n=Wr(this),s=n?{observableKind:"map",debugObjectName:this.name_,type:ao,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return zr(function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)}),n&&Kr(this,s),!0}return!1},t.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==Ki.UNCHANGED){var s=Wr(this),i=s?{observableKind:"map",debugObjectName:this.name_,type:Yr,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),s&&Kr(this,i)}},t.addValue_=function(e,t){var n=this;this.keysAtom_,zr(function(){var s,i=new Si(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(s=n.hasMap_.get(e))||s.setNewValue_(!0),n.keysAtom_.reportChanged()});var s=Wr(this),i=s?{observableKind:"map",debugObjectName:this.name_,type:oo,object:this,name:e,newValue:t}:null;s&&Kr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.getOrInsert=function(e,t){return this.has(e)||this.set(e,t),this.get(e)},t.getOrInsertComputed=function(e,t){return this.has(e)||this.set(e,t(e)),this.get(e)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ho({next:function(){var n=t.next(),s=n.done,i=n.value;return{done:s,value:s?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ho({next:function(){var n=t.next(),s=n.done,i=n.value;return{done:s,value:s?void 0:[i,e.get(i)]}}})},t[Symbol.iterator]=function(){return this.entries()},t.forEach=function(e,t){for(var n,s=cs(this);!(n=s()).done;){var i=n.value,r=i[0],o=i[1];e.call(t,o,r,this)}},t.merge=function(e){var t=this;return co(e)&&(e=new Map(e)),zr(function(){var n,s,i;Vn(e)?function(e){var t=Object.keys(e);if(!es)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter(function(t){return zn.propertyIsEnumerable.call(e,t)})):t}(e).forEach(function(n){return t.set(n,e[n])}):Array.isArray(e)?e.forEach(function(e){var n=e[0],s=e[1];return t.set(n,s)}):Jn(e)?(n=e,s=Object.getPrototypeOf(n),i=Object.getPrototypeOf(s),null!==Object.getPrototypeOf(i)&&Dn(19,e),e.forEach(function(e,n){return t.set(n,e)})):null!=e&&Dn(20,e)}),this},t.clear=function(){var e=this;zr(function(){Ai(function(){for(var t,n=cs(e.keys());!(t=n()).done;){var s=t.value;e.delete(s)}})})},t.replace=function(e){var t=this;return zr(function(){for(var n,s=function(e){if(Jn(e)||co(e))return e;if(Array.isArray(e))return new Map(e);if(Vn(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return Dn(21,e)}(e),i=new Map,r=!1,o=cs(t.data_.keys());!(n=o()).done;){var a=n.value;if(!s.has(a))if(t.delete(a))r=!0;else{var l=t.data_.get(a);i.set(a,l)}}for(var c,h=cs(s.entries());!(c=h()).done;){var u=c.value,d=u[0],f=u[1],p=t.data_.has(d);if(t.set(d,f),t.data_.has(d)){var v=t.data_.get(d);i.set(d,v),p||(r=!0)}}if(!r)if(t.data_.size!==i.size)t.keysAtom_.reportChanged();else for(var g=t.data_.keys(),m=i.keys(),_=g.next(),x=m.next();!_.done;){if(_.value!==x.value){t.keysAtom_.reportChanged();break}_=g.next(),x=m.next()}t.data_=i}),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return Ur(this,e)},t.intercept_=function(e){return Hr(this,e)},ls(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Map"}}])}(),co=Zn("ObservableMap",lo);function ho(e){return e[Symbol.toStringTag]="MapIterator",Ko(e)}var uo={},fo=function(){function e(e,t,n){var s=this;void 0===t&&(t=js),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[ys]=uo,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,Kn(Set)||Dn(22),this.enhancer_=function(e,s){return t(e,s,n)},To(function(){s.atom_=ks(s.name_),e&&s.replace(e)})}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;zr(function(){Ai(function(){for(var t,n=cs(e.data_.values());!(t=n()).done;){var s=t.value;e.delete(s)}})})},t.forEach=function(e,t){for(var n,s=cs(this);!(n=s()).done;){var i=n.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,Or(this)){var n=Fr(this,{type:oo,object:this,newValue:e});if(!n)return this;e=n.newValue}if(!this.has(e)){zr(function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()});var s=Wr(this),i=s?{observableKind:"set",debugObjectName:this.name_,type:oo,object:this,newValue:e}:null;s&&Kr(this,i)}return this},t.delete=function(e){var t=this;if(Or(this)&&!Fr(this,{type:ao,object:this,oldValue:e}))return!1;if(this.has(e)){var n=Wr(this),s=n?{observableKind:"set",debugObjectName:this.name_,type:ao,object:this,oldValue:e}:null;return zr(function(){t.atom_.reportChanged(),t.data_.delete(e)}),n&&Kr(this,s),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=this.values();return vo({next:function(){var t=e.next(),n=t.value,s=t.done;return s?{value:void 0,done:s}:{value:[n,n],done:s}}})},t.keys=function(){return this.values()},t.values=function(){this.atom_.reportObserved();var e=this,t=this.data_.values();return vo({next:function(){var n=t.next(),s=n.value,i=n.done;return i?{value:void 0,done:i}:{value:e.dehanceValue_(s),done:i}}})},t.intersection=function(e){return Qn(e)&&!po(e)?e.intersection(this):new Set(this).intersection(e)},t.union=function(e){return Qn(e)&&!po(e)?e.union(this):new Set(this).union(e)},t.difference=function(e){return new Set(this).difference(e)},t.symmetricDifference=function(e){return Qn(e)&&!po(e)?e.symmetricDifference(this):new Set(this).symmetricDifference(e)},t.isSubsetOf=function(e){return new Set(this).isSubsetOf(e)},t.isSupersetOf=function(e){return new Set(this).isSupersetOf(e)},t.isDisjointFrom=function(e){return Qn(e)&&!po(e)?e.isDisjointFrom(this):new Set(this).isDisjointFrom(e)},t.replace=function(e){var t=this;return po(e)&&(e=new Set(e)),zr(function(){Array.isArray(e)||Qn(e)?(t.clear(),e.forEach(function(e){return t.add(e)})):null!=e&&Dn("Cannot initialize set from "+e)}),this},t.observe_=function(e,t){return Ur(this,e)},t.intercept_=function(e){return Hr(this,e)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[Symbol.iterator]=function(){return this.values()},ls(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Set"}}])}(),po=Zn("ObservableSet",fo);function vo(e){return e[Symbol.toStringTag]="SetIterator",Ko(e)}var go=Object.create(null),mo="remove",_o=function(){function e(e,t,n,s){void 0===t&&(t=new Map),void 0===s&&(s=Ys),this.target_=void 0,this.values_=void 0,this.name_=void 0,this.defaultAnnotation_=void 0,this.keysAtom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.proxy_=void 0,this.isPlainObject_=void 0,this.appliedAnnotations_=void 0,this.pendingKeys_=void 0,this.lazyComputedKeys_=void 0,this.lazyObservableKeys_=void 0,this.target_=e,this.values_=t,this.name_=n,this.defaultAnnotation_=s,this.keysAtom_=new ws("ObservableObject.keys"),this.isPlainObject_=Vn(this.target_)}var t=e.prototype;return t.getObservablePropValue_=function(e){var t,n;return(null!=(t=null!=(n=this.values_.get(e))?n:this.materializeLazyComputed_(e))?t:this.materializeLazyObservable_(e)).get()},t.materializeLazyComputed_=function(e){var t,n=null==(t=this.lazyComputedKeys_)?void 0:t.get(e);if(n){this.lazyComputedKeys_.delete(e),0===this.lazyComputedKeys_.size&&(this.lazyComputedKeys_=void 0);var s=n();return this.values_.set(e,s),s}},t.materializeLazyObservable_=function(e){var t,n=null==(t=this.lazyObservableKeys_)?void 0:t.get(e);if(n){this.lazyObservableKeys_.delete(e),0===this.lazyObservableKeys_.size&&(this.lazyObservableKeys_=void 0);var s=n();return this.values_.set(e,s),s}},t.setObservablePropValue_=function(e,t){var n,s,i=null!=(n=null!=(s=this.values_.get(e))?s:this.materializeLazyComputed_(e))?n:this.materializeLazyObservable_(e);if(i instanceof ki)return i.set(t),!0;if(Or(this)){var r=Fr(this,{type:Yr,object:this.proxy_||this.target_,name:e,newValue:t});if(!r)return null;t=r.newValue}if((t=i.prepareNewValue_(t))!==Ki.UNCHANGED){var o=Wr(this),a=o?{type:Yr,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:i.value_,name:e,newValue:t}:null;i.setNewValue_(t),o&&Kr(this,a)}return!0},t.get_=function(e){return Ki.trackingDerivation&&!ss(this.target_,e)&&this.has_(e),this.target_[e]},t.set_=function(e,t,n){return void 0===n&&(n=!1),ss(this.target_,e)?this.values_.has(e)?this.setObservablePropValue_(e,t):n?Reflect.set(this.target_,e,t):(this.target_[e]=t,!0):this.extend_(e,{value:t,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,n)},t.has_=function(e){if(!Ki.trackingDerivation)return e in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var t=this.pendingKeys_.get(e);return t||(t=new Si(e in this.target_,Ns,"ObservableObject.key?",!1),this.pendingKeys_.set(e,t)),t.get()},t.make_=function(e,t){if(!0===t&&(t=this.defaultAnnotation_),!1!==t){if(!(e in this.target_)){var n;if(null!=(n=this.target_[ms])&&n[e])return;Dn(1,t.annotationType_,this.name_+"."+e.toString())}for(var s=this.target_;s&&s!==zn;){var i=Rn(s,e);if(i){var r=t.make_(this,e,i,s);if(0===r)return;if(1===r)break}s=Object.getPrototypeOf(s)}So(this,t,e)}},t.extend_=function(e,t,n,s){if(void 0===s&&(s=!1),!0===n&&(n=this.defaultAnnotation_),!1===n)return this.defineProperty_(e,t,s);var i=n.extend_(this,e,t,s);return i&&So(this,n,e),i},t.defineProperty_=function(e,t,n){void 0===n&&(n=!1),this.keysAtom_;try{Yi();var s=this.delete_(e);if(!s)return s;if(Or(this)){var i=Fr(this,{object:this.proxy_||this.target_,name:e,type:oo,newValue:t.value});if(!i)return null;var r=i.newValue;t.value!==r&&(t=hs({},t,{value:r}))}if(n){if(!Reflect.defineProperty(this.target_,e,t))return!1}else An(this.target_,e,t);this.notifyPropertyAddition_(e,t.value)}finally{Gi()}return!0},t.defineObservableProperty_=function(e,t,n,s){void 0===s&&(s=!1),this.keysAtom_;try{Yi();var i=this.delete_(e);if(!i)return i;if(Or(this)){var r=Fr(this,{object:this.proxy_||this.target_,name:e,type:oo,newValue:t});if(!r)return null;t=r.newValue}var o=yo(e),a={configurable:!Ki.safeDescriptors||this.isPlainObject_,enumerable:!0,get:o.get,set:o.set};if(s){if(!Reflect.defineProperty(this.target_,e,a))return!1}else An(this.target_,e,a);var l=new Si(t,n,"ObservableObject.key",!1);this.values_.set(e,l),this.notifyPropertyAddition_(e,l.value_)}finally{Gi()}return!0},t.defineComputedProperty_=function(e,t,n){void 0===n&&(n=!1),this.keysAtom_;try{Yi();var s=this.delete_(e);if(!s)return s;if(Or(this))if(!Fr(this,{object:this.proxy_||this.target_,name:e,type:oo,newValue:void 0}))return null;t.name||(t.name="ObservableObject.key"),t.context=this.proxy_||this.target_;var i=yo(e),r={configurable:!Ki.safeDescriptors||this.isPlainObject_,enumerable:!1,get:i.get,set:i.set};if(n){if(!Reflect.defineProperty(this.target_,e,r))return!1}else An(this.target_,e,r);this.values_.set(e,new ki(t)),this.notifyPropertyAddition_(e,void 0)}finally{Gi()}return!0},t.delete_=function(e,t){if(void 0===t&&(t=!1),this.keysAtom_,!ss(this.target_,e))return!0;if(Or(this)&&!Fr(this,{object:this.proxy_||this.target_,name:e,type:mo}))return null;try{var n;Yi();var s,i=Wr(this),r=this.values_.get(e),o=void 0;if(!r&&i)o=null==(s=Rn(this.target_,e))?void 0:s.value;if(t){if(!Reflect.deleteProperty(this.target_,e))return!1}else delete this.target_[e];if(r&&(this.values_.delete(e),r instanceof Si&&(o=r.value_),Zi(r)),this.keysAtom_.reportChanged(),null==(n=this.pendingKeys_)||null==(n=n.get(e))||n.set(e in this.target_),i){var a={type:mo,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:o,name:e};0,i&&Kr(this,a)}}finally{Gi()}return!0},t.observe_=function(e,t){return Ur(this,e)},t.intercept_=function(e){return Hr(this,e)},t.notifyPropertyAddition_=function(e,t){var n,s=Wr(this);if(s){var i=s?{type:oo,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:e,newValue:t}:null;s&&Kr(this,i)}null==(n=this.pendingKeys_)||null==(n=n.get(e))||n.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),ts(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function xo(e,t){var n;if(ss(e,ys))return e;var s=null!=(n=null==t?void 0:t.name)?n:"ObservableObject",i=new _o(e,new Map,String(s),function(e){var t;return e?null!=(t=e.defaultDecorator)?t:Gs(e):void 0}(t));return Gn(e,ys,i),e}var bo=Zn("ObservableObjectAdministration",_o);function yo(e){return go[e]||(go[e]={get:function(){return this[ys].getObservablePropValue_(e)},set:function(t){return this[ys].setObservablePropValue_(e,t)}})}function wo(e){return!!$n(e)&&bo(e[ys])}function So(e,t,n){var s;null==(s=e.target_[ms])||delete s[n]}var ko,Co,jo=Lo(0),No=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,!1===e}(),Mo=0,Bo=function(){};ko=Bo,Co=Array.prototype,Object.setPrototypeOf?Object.setPrototypeOf(ko.prototype,Co):void 0!==ko.prototype.__proto__?ko.prototype.__proto__=Co:ko.prototype=Co;var Do=function(e){function t(t,n,s,i){var r;return void 0===s&&(s="ObservableArray"),void 0===i&&(i=!1),r=e.call(this)||this,To(function(){var e=new Xr(s,n,i,!0);e.proxy_=r,Xn(r,ys,e),t&&t.length&&r.spliceWithArray(0,0,t),No&&Object.defineProperty(r,"0",jo)}),r}ds(t,e);var n=t.prototype;return n.concat=function(){this[ys].atom_.reportObserved();for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Array.prototype.concat.apply(this.slice(),t.map(function(e){return io(e)?e.slice():e}))},n[Symbol.iterator]=function(){var e=this,t=0;return Ko({next:function(){return t<e.length?{value:e[t++],done:!1}:{done:!0,value:void 0}}})},ls(t,[{key:"length",get:function(){return this[ys].getArrayLength_()},set:function(e){this[ys].setArrayLength_(e)}},{key:Symbol.toStringTag,get:function(){return"Array"}}])}(Bo);function Lo(e){return{enumerable:!1,configurable:!0,get:function(){return this[ys].get_(e)},set:function(t){this[ys].set_(e,t)}}}function Eo(e){An(Do.prototype,""+e,Lo(e))}function Po(e){if(e>Mo){for(var t=Mo;t<e+100;t++)Eo(t);Mo=e}}function Ro(e,t,n){return new Do(e,t,n)}function Ao(e,t){if("object"==typeof e&&null!==e){if(io(e))return void 0!==t&&Dn(23),e[ys].atom_;if(po(e))return e.atom_;if(co(e)){if(void 0===t)return e.keysAtom_;var n=e.data_.get(t)||e.hasMap_.get(t);return n||Dn(25,t,zo(e)),n}if(wo(e)){var s,i;if(!t)return Dn(26);var r=e[ys],o=null!=(s=null!=(i=r.values_.get(t))?i:r.materializeLazyComputed_(t))?s:r.materializeLazyObservable_(t);return o||Dn(27,t,zo(e)),o}if(Ss(e)||Bi(e)||sr(e))return e}else if(Kn(e)&&sr(e[ys]))return e[ys];Dn(28)}function zo(e,t){var n;if(void 0!==t)n=Ao(e,t);else{if(vr(e))return e.name;n=wo(e)||co(e)||po(e)?function(e){return e||Dn(29),Ss(e)||Bi(e)||sr(e)||co(e)||po(e)?e:e[ys]?e[ys]:void Dn(24,e)}(e):Ao(e)}return n.name_}function To(e){var t=zi(),n=yi(!0);Yi();try{return e()}finally{Gi(),wi(n),Ti(t)}}Object.entries(Jr).forEach(function(e){var t=e[0],n=e[1];"concat"!==t&&Gn(Do.prototype,t,n)}),Po(1e3);var Io,Oo=zn.toString;function Ho(e,t,n){return void 0===n&&(n=-1),Fo(e,t,n)}function Fo(e,t,n,s,i){if(e===t)return 0!==e||1/e==1/t;if(null==e||null==t)return!1;if(e!=e)return t!=t;var r=typeof e;if("function"!==r&&"object"!==r&&"object"!=typeof t)return!1;var o=Oo.call(e);if(o!==Oo.call(t))return!1;switch(o){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!=+e?+t!=+t:0===+e?1/+e==1/t:+e===+t;case"[object Date]":case"[object Boolean]":return+e===+t;case"[object Symbol]":return"undefined"!=typeof Symbol&&Symbol.valueOf.call(e)===Symbol.valueOf.call(t);case"[object Map]":case"[object Set]":n>=0&&n++}e=Wo(e),t=Wo(t);var a="[object Array]"===o;if(!a){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,c=t.constructor;if(l!==c&&!(Kn(l)&&l instanceof l&&Kn(c)&&c instanceof c)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var h=(s=s||[]).length;h--;)if(s[h]===e)return i[h]===t;if(s.push(e),i.push(t),a){if((h=e.length)!==t.length)return!1;for(;h--;)if(!Fo(e[h],t[h],n-1,s,i))return!1}else{var u=Object.keys(e),d=u.length;if(Object.keys(t).length!==d)return!1;for(var f=0;f<d;f++){var p=u[f];if(!ss(t,p)||!Fo(e[p],t[p],n-1,s,i))return!1}}return s.pop(),i.pop(),!0}function Wo(e){return io(e)?e.slice():Jn(e)||co(e)||Qn(e)||po(e)?Array.from(e.entries()):e}var Uo=(null==(Io=En().Iterator)?void 0:Io.prototype)||{};function Ko(e){return e[Symbol.iterator]=qo,Object.assign(Object.create(Uo),e)}function qo(){return this}["Symbol","Map","Set"].forEach(function(e){void 0===En()[e]&&Dn("MobX requires global '"+e+"' to be available or polyfilled")}),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:zo},$mobx:ys});var $o={exports:{}},Vo={},Yo={exports:{}},Go={};
|
|
12
|
+
/**
|
|
13
|
+
* @license React
|
|
14
|
+
* scheduler.production.min.js
|
|
15
|
+
*
|
|
16
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
17
|
+
*
|
|
18
|
+
* This source code is licensed under the MIT license found in the
|
|
19
|
+
* LICENSE file in the root directory of this source tree.
|
|
20
|
+
*/
|
|
21
|
+
!function(e){function t(e,t){var n=e.length;e.push(t);e:for(;0<n;){var s=n-1>>>1,r=e[s];if(!(0<i(r,t)))break e;e[s]=t,e[n]=r,n=s}}function n(e){return 0===e.length?null:e[0]}function s(e){if(0===e.length)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;e:for(var s=0,r=e.length,o=r>>>1;s<o;){var a=2*(s+1)-1,l=e[a],c=a+1,h=e[c];if(0>i(l,n))c<r&&0>i(h,l)?(e[s]=h,e[c]=n,s=c):(e[s]=l,e[a]=n,s=a);else{if(!(c<r&&0>i(h,n)))break e;e[s]=h,e[c]=n,s=c}}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if("object"==typeof performance&&"function"==typeof performance.now){var r=performance;e.unstable_now=function(){return r.now()}}else{var o=Date,a=o.now();e.unstable_now=function(){return o.now()-a}}var l=[],c=[],h=1,u=null,d=3,f=!1,p=!1,v=!1,g="function"==typeof setTimeout?setTimeout:null,m="function"==typeof clearTimeout?clearTimeout:null,_="undefined"!=typeof setImmediate?setImmediate:null;function x(e){for(var i=n(c);null!==i;){if(null===i.callback)s(c);else{if(!(i.startTime<=e))break;s(c),i.sortIndex=i.expirationTime,t(l,i)}i=n(c)}}function b(e){if(v=!1,x(e),!p)if(null!==n(l))p=!0,E(y);else{var t=n(c);null!==t&&P(b,t.startTime-e)}}function y(t,i){p=!1,v&&(v=!1,m(C),C=-1),f=!0;var r=d;try{for(x(i),u=n(l);null!==u&&(!(u.expirationTime>i)||t&&!M());){var o=u.callback;if("function"==typeof o){u.callback=null,d=u.priorityLevel;var a=o(u.expirationTime<=i);i=e.unstable_now(),"function"==typeof a?u.callback=a:u===n(l)&&s(l),x(i)}else s(l);u=n(l)}if(null!==u)var h=!0;else{var g=n(c);null!==g&&P(b,g.startTime-i),h=!1}return h}finally{u=null,d=r,f=!1}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var w,S=!1,k=null,C=-1,j=5,N=-1;function M(){return!(e.unstable_now()-N<j)}function B(){if(null!==k){var t=e.unstable_now();N=t;var n=!0;try{n=k(!0,t)}finally{n?w():(S=!1,k=null)}}else S=!1}if("function"==typeof _)w=function(){_(B)};else if("undefined"!=typeof MessageChannel){var D=new MessageChannel,L=D.port2;D.port1.onmessage=B,w=function(){L.postMessage(null)}}else w=function(){g(B,0)};function E(e){k=e,S||(S=!0,w())}function P(t,n){C=g(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_continueExecution=function(){p||f||(p=!0,E(y))},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):j=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return d},e.unstable_getFirstCallbackNode=function(){return n(l)},e.unstable_next=function(e){switch(d){case 1:case 2:case 3:var t=3;break;default:t=d}var n=d;d=t;try{return e()}finally{d=n}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=d;d=e;try{return t()}finally{d=n}},e.unstable_scheduleCallback=function(s,i,r){var o=e.unstable_now();switch("object"==typeof r&&null!==r?r="number"==typeof(r=r.delay)&&0<r?o+r:o:r=o,s){case 1:var a=-1;break;case 2:a=250;break;case 5:a=1073741823;break;case 4:a=1e4;break;default:a=5e3}return s={id:h++,callback:i,priorityLevel:s,startTime:r,expirationTime:a=r+a,sortIndex:-1},r>o?(s.sortIndex=r,t(c,s),null===n(l)&&s===n(c)&&(v?(m(C),C=-1):v=!0,P(b,r-o))):(s.sortIndex=a,t(l,s),p||f||(p=!0,E(y))),s},e.unstable_shouldYield=M,e.unstable_wrapCallback=function(e){var t=d;return function(){var n=d;d=t;try{return e.apply(this,arguments)}finally{d=n}}}}(Go),Yo.exports=Go;var Xo=Yo.exports,Zo=bn,Jo=Xo;
|
|
22
|
+
/**
|
|
23
|
+
* @license React
|
|
24
|
+
* react-dom.production.min.js
|
|
25
|
+
*
|
|
26
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
27
|
+
*
|
|
28
|
+
* This source code is licensed under the MIT license found in the
|
|
29
|
+
* LICENSE file in the root directory of this source tree.
|
|
30
|
+
*/function Qo(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var ea=new Set,ta={};function na(e,t){sa(e,t),sa(e+"Capture",t)}function sa(e,t){for(ta[e]=t,e=0;e<t.length;e++)ea.add(t[e])}var ia=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement),ra=Object.prototype.hasOwnProperty,oa=/^[: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]*$/,aa={},la={};function ca(e,t,n,s,i,r,o){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=s,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=r,this.removeEmptyString=o}var ha={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){ha[e]=new ca(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];ha[t]=new ca(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){ha[e]=new ca(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){ha[e]=new ca(e,2,!1,e,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(e){ha[e]=new ca(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){ha[e]=new ca(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){ha[e]=new ca(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){ha[e]=new ca(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){ha[e]=new ca(e,5,!1,e.toLowerCase(),null,!1,!1)});var ua=/[\-:]([a-z])/g;function da(e){return e[1].toUpperCase()}function fa(e,t,n,s){var i=ha.hasOwnProperty(t)?ha[t]:null;(null!==i?0!==i.type:s||!(2<t.length)||"o"!==t[0]&&"O"!==t[0]||"n"!==t[1]&&"N"!==t[1])&&(function(e,t,n,s){if(null==t||function(e,t,n,s){if(null!==n&&0===n.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return!s&&(null!==n?!n.acceptsBooleans:"data-"!==(e=e.toLowerCase().slice(0,5))&&"aria-"!==e);default:return!1}}(e,t,n,s))return!0;if(s)return!1;if(null!==n)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}(t,n,i,s)&&(n=null),s||null===i?function(e){return!!ra.call(la,e)||!ra.call(aa,e)&&(oa.test(e)?la[e]=!0:(aa[e]=!0,!1))}(t)&&(null===n?e.removeAttribute(t):e.setAttribute(t,""+n)):i.mustUseProperty?e[i.propertyName]=null===n?3!==i.type&&"":n:(t=i.attributeName,s=i.attributeNamespace,null===n?e.removeAttribute(t):(n=3===(i=i.type)||4===i&&!0===n?"":""+n,s?e.setAttributeNS(s,t,n):e.setAttribute(t,n))))}"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(e){var t=e.replace(ua,da);ha[t]=new ca(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(ua,da);ha[t]=new ca(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(ua,da);ha[t]=new ca(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){ha[e]=new ca(e,1,!1,e.toLowerCase(),null,!1,!1)}),ha.xlinkHref=new ca("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){ha[e]=new ca(e,1,!1,e.toLowerCase(),null,!0,!0)});var pa=Zo.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,va=Symbol.for("react.element"),ga=Symbol.for("react.portal"),ma=Symbol.for("react.fragment"),_a=Symbol.for("react.strict_mode"),xa=Symbol.for("react.profiler"),ba=Symbol.for("react.provider"),ya=Symbol.for("react.context"),wa=Symbol.for("react.forward_ref"),Sa=Symbol.for("react.suspense"),ka=Symbol.for("react.suspense_list"),Ca=Symbol.for("react.memo"),ja=Symbol.for("react.lazy"),Na=Symbol.for("react.offscreen"),Ma=Symbol.iterator;function Ba(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=Ma&&e[Ma]||e["@@iterator"])?e:null}var Da,La=Object.assign;function Ea(e){if(void 0===Da)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Da=t&&t[1]||""}return"\n"+Da+e}var Pa=!1;function Ra(e,t){if(!e||Pa)return"";Pa=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(t,[])}catch(c){var s=c}Reflect.construct(e,[],t)}else{try{t.call()}catch(c){s=c}e.call(t.prototype)}else{try{throw Error()}catch(c){s=c}e()}}catch(c){if(c&&s&&"string"==typeof c.stack){for(var i=c.stack.split("\n"),r=s.stack.split("\n"),o=i.length-1,a=r.length-1;1<=o&&0<=a&&i[o]!==r[a];)a--;for(;1<=o&&0<=a;o--,a--)if(i[o]!==r[a]){if(1!==o||1!==a)do{if(o--,0>--a||i[o]!==r[a]){var l="\n"+i[o].replace(" at new "," at ");return e.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",e.displayName)),l}}while(1<=o&&0<=a);break}}}finally{Pa=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Ea(e):""}function Aa(e){switch(e.tag){case 5:return Ea(e.type);case 16:return Ea("Lazy");case 13:return Ea("Suspense");case 19:return Ea("SuspenseList");case 0:case 2:case 15:return e=Ra(e.type,!1);case 11:return e=Ra(e.type.render,!1);case 1:return e=Ra(e.type,!0);default:return""}}function za(e){if(null==e)return null;if("function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case ma:return"Fragment";case ga:return"Portal";case xa:return"Profiler";case _a:return"StrictMode";case Sa:return"Suspense";case ka:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case ya:return(e.displayName||"Context")+".Consumer";case ba:return(e._context.displayName||"Context")+".Provider";case wa:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case Ca:return null!==(t=e.displayName||null)?t:za(e.type)||"Memo";case ja:t=e._payload,e=e._init;try{return za(e(t))}catch(n){}}return null}function Ta(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=(e=t.render).displayName||e.name||"",t.displayName||(""!==e?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return za(t);case 8:return t===_a?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if("function"==typeof t)return t.displayName||t.name||null;if("string"==typeof t)return t}return null}function Ia(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":case"object":return e;default:return""}}function Oa(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function Ha(e){e._valueTracker||(e._valueTracker=function(e){var t=Oa(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),s=""+e[t];if(!e.hasOwnProperty(t)&&void 0!==n&&"function"==typeof n.get&&"function"==typeof n.set){var i=n.get,r=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){s=""+e,r.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return s},setValue:function(e){s=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function Fa(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),s="";return e&&(s=Oa(e)?e.checked?"true":"false":e.value),(e=s)!==n&&(t.setValue(e),!0)}function Wa(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}function Ua(e,t){var n=t.checked;return La({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=n?n:e._wrapperState.initialChecked})}function Ka(e,t){var n=null==t.defaultValue?"":t.defaultValue,s=null!=t.checked?t.checked:t.defaultChecked;n=Ia(null!=t.value?t.value:n),e._wrapperState={initialChecked:s,initialValue:n,controlled:"checkbox"===t.type||"radio"===t.type?null!=t.checked:null!=t.value}}function qa(e,t){null!=(t=t.checked)&&fa(e,"checked",t,!1)}function $a(e,t){qa(e,t);var n=Ia(t.value),s=t.type;if(null!=n)"number"===s?(0===n&&""===e.value||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if("submit"===s||"reset"===s)return void e.removeAttribute("value");t.hasOwnProperty("value")?Ya(e,t.type,n):t.hasOwnProperty("defaultValue")&&Ya(e,t.type,Ia(t.defaultValue)),null==t.checked&&null!=t.defaultChecked&&(e.defaultChecked=!!t.defaultChecked)}function Va(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var s=t.type;if(!("submit"!==s&&"reset"!==s||void 0!==t.value&&null!==t.value))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}""!==(n=e.name)&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,""!==n&&(e.name=n)}function Ya(e,t,n){"number"===t&&Wa(e.ownerDocument)===e||(null==n?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Ga=Array.isArray;function Xa(e,t,n,s){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t["$"+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty("$"+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&s&&(e[n].defaultSelected=!0)}else{for(n=""+Ia(n),t=null,i=0;i<e.length;i++){if(e[i].value===n)return e[i].selected=!0,void(s&&(e[i].defaultSelected=!0));null!==t||e[i].disabled||(t=e[i])}null!==t&&(t.selected=!0)}}function Za(e,t){if(null!=t.dangerouslySetInnerHTML)throw Error(Qo(91));return La({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Ja(e,t){var n=t.value;if(null==n){if(n=t.children,t=t.defaultValue,null!=n){if(null!=t)throw Error(Qo(92));if(Ga(n)){if(1<n.length)throw Error(Qo(93));n=n[0]}t=n}null==t&&(t=""),n=t}e._wrapperState={initialValue:Ia(n)}}function Qa(e,t){var n=Ia(t.value),s=Ia(t.defaultValue);null!=n&&((n=""+n)!==e.value&&(e.value=n),null==t.defaultValue&&e.defaultValue!==n&&(e.defaultValue=n)),null!=s&&(e.defaultValue=""+s)}function el(e){var t=e.textContent;t===e._wrapperState.initialValue&&""!==t&&null!==t&&(e.value=t)}function tl(e){switch(e){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 nl(e,t){return null==e||"http://www.w3.org/1999/xhtml"===e?tl(t):"http://www.w3.org/2000/svg"===e&&"foreignObject"===t?"http://www.w3.org/1999/xhtml":e}var sl,il,rl=(il=function(e,t){if("http://www.w3.org/2000/svg"!==e.namespaceURI||"innerHTML"in e)e.innerHTML=t;else{for((sl=sl||document.createElement("div")).innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=sl.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}},"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(e,t,n,s){MSApp.execUnsafeLocalFunction(function(){return il(e,t)})}:il);function ol(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t}var al={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},ll=["Webkit","ms","Moz","O"];function cl(e,t,n){return null==t||"boolean"==typeof t||""===t?"":n||"number"!=typeof t||0===t||al.hasOwnProperty(e)&&al[e]?(""+t).trim():t+"px"}function hl(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var s=0===n.indexOf("--"),i=cl(n,t[n],s);"float"===n&&(n="cssFloat"),s?e.setProperty(n,i):e[n]=i}}Object.keys(al).forEach(function(e){ll.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),al[t]=al[e]})});var ul=La({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 dl(e,t){if(t){if(ul[e]&&(null!=t.children||null!=t.dangerouslySetInnerHTML))throw Error(Qo(137,e));if(null!=t.dangerouslySetInnerHTML){if(null!=t.children)throw Error(Qo(60));if("object"!=typeof t.dangerouslySetInnerHTML||!("__html"in t.dangerouslySetInnerHTML))throw Error(Qo(61))}if(null!=t.style&&"object"!=typeof t.style)throw Error(Qo(62))}}function fl(e,t){if(-1===e.indexOf("-"))return"string"==typeof t.is;switch(e){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 pl=null;function vl(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var gl=null,ml=null,_l=null;function xl(e){if(e=dd(e)){if("function"!=typeof gl)throw Error(Qo(280));var t=e.stateNode;t&&(t=pd(t),gl(e.stateNode,e.type,t))}}function bl(e){ml?_l?_l.push(e):_l=[e]:ml=e}function yl(){if(ml){var e=ml,t=_l;if(_l=ml=null,xl(e),t)for(e=0;e<t.length;e++)xl(t[e])}}function wl(e,t){return e(t)}function Sl(){}var kl=!1;function Cl(e,t,n){if(kl)return e(t,n);kl=!0;try{return wl(e,t,n)}finally{kl=!1,(null!==ml||null!==_l)&&(Sl(),yl())}}function jl(e,t){var n=e.stateNode;if(null===n)return null;var s=pd(n);if(null===s)return null;n=s[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(s=!s.disabled)||(s=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!s;break e;default:e=!1}if(e)return null;if(n&&"function"!=typeof n)throw Error(Qo(231,t,typeof n));return n}var Nl=!1;if(ia)try{var Ml={};Object.defineProperty(Ml,"passive",{get:function(){Nl=!0}}),window.addEventListener("test",Ml,Ml),window.removeEventListener("test",Ml,Ml)}catch(il){Nl=!1}function Bl(e,t,n,s,i,r,o,a,l){var c=Array.prototype.slice.call(arguments,3);try{t.apply(n,c)}catch(h){this.onError(h)}}var Dl=!1,Ll=null,El=!1,Pl=null,Rl={onError:function(e){Dl=!0,Ll=e}};function Al(e,t,n,s,i,r,o,a,l){Dl=!1,Ll=null,Bl.apply(Rl,arguments)}function zl(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{!!(4098&(t=e).flags)&&(n=t.return),e=t.return}while(e)}return 3===t.tag?n:null}function Tl(e){if(13===e.tag){var t=e.memoizedState;if(null===t&&(null!==(e=e.alternate)&&(t=e.memoizedState)),null!==t)return t.dehydrated}return null}function Il(e){if(zl(e)!==e)throw Error(Qo(188))}function Ol(e){return null!==(e=function(e){var t=e.alternate;if(!t){if(null===(t=zl(e)))throw Error(Qo(188));return t!==e?null:e}for(var n=e,s=t;;){var i=n.return;if(null===i)break;var r=i.alternate;if(null===r){if(null!==(s=i.return)){n=s;continue}break}if(i.child===r.child){for(r=i.child;r;){if(r===n)return Il(i),e;if(r===s)return Il(i),t;r=r.sibling}throw Error(Qo(188))}if(n.return!==s.return)n=i,s=r;else{for(var o=!1,a=i.child;a;){if(a===n){o=!0,n=i,s=r;break}if(a===s){o=!0,s=i,n=r;break}a=a.sibling}if(!o){for(a=r.child;a;){if(a===n){o=!0,n=r,s=i;break}if(a===s){o=!0,s=r,n=i;break}a=a.sibling}if(!o)throw Error(Qo(189))}}if(n.alternate!==s)throw Error(Qo(190))}if(3!==n.tag)throw Error(Qo(188));return n.stateNode.current===n?e:t}(e))?Hl(e):null}function Hl(e){if(5===e.tag||6===e.tag)return e;for(e=e.child;null!==e;){var t=Hl(e);if(null!==t)return t;e=e.sibling}return null}var Fl=Jo.unstable_scheduleCallback,Wl=Jo.unstable_cancelCallback,Ul=Jo.unstable_shouldYield,Kl=Jo.unstable_requestPaint,ql=Jo.unstable_now,$l=Jo.unstable_getCurrentPriorityLevel,Vl=Jo.unstable_ImmediatePriority,Yl=Jo.unstable_UserBlockingPriority,Gl=Jo.unstable_NormalPriority,Xl=Jo.unstable_LowPriority,Zl=Jo.unstable_IdlePriority,Jl=null,Ql=null;var ec=Math.clz32?Math.clz32:function(e){return e>>>=0,0===e?32:31-(tc(e)/nc|0)|0},tc=Math.log,nc=Math.LN2;var sc=64,ic=4194304;function rc(e){switch(e&-e){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 4194240&e;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return 130023424&e;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function oc(e,t){var n=e.pendingLanes;if(0===n)return 0;var s=0,i=e.suspendedLanes,r=e.pingedLanes,o=268435455&n;if(0!==o){var a=o&~i;0!==a?s=rc(a):0!==(r&=o)&&(s=rc(r))}else 0!==(o=n&~i)?s=rc(o):0!==r&&(s=rc(r));if(0===s)return 0;if(0!==t&&t!==s&&0===(t&i)&&((i=s&-s)>=(r=t&-t)||16===i&&4194240&r))return t;if(4&s&&(s|=16&n),0!==(t=e.entangledLanes))for(e=e.entanglements,t&=s;0<t;)i=1<<(n=31-ec(t)),s|=e[n],t&=~i;return s}function ac(e,t){switch(e){case 1:case 2:case 4:return t+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 t+5e3;default:return-1}}function lc(e){return 0!==(e=-1073741825&e.pendingLanes)?e:1073741824&e?1073741824:0}function cc(){var e=sc;return!(4194240&(sc<<=1))&&(sc=64),e}function hc(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function uc(e,t,n){e.pendingLanes|=t,536870912!==t&&(e.suspendedLanes=0,e.pingedLanes=0),(e=e.eventTimes)[t=31-ec(t)]=n}function dc(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var s=31-ec(n),i=1<<s;i&t|e[s]&t&&(e[s]|=t),n&=~i}}var fc=0;function pc(e){return 1<(e&=-e)?4<e?268435455&e?16:536870912:4:1}var vc,gc,mc,_c,xc,bc=!1,yc=[],wc=null,Sc=null,kc=null,Cc=new Map,jc=new Map,Nc=[],Mc="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 Bc(e,t){switch(e){case"focusin":case"focusout":wc=null;break;case"dragenter":case"dragleave":Sc=null;break;case"mouseover":case"mouseout":kc=null;break;case"pointerover":case"pointerout":Cc.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":jc.delete(t.pointerId)}}function Dc(e,t,n,s,i,r){return null===e||e.nativeEvent!==r?(e={blockedOn:t,domEventName:n,eventSystemFlags:s,nativeEvent:r,targetContainers:[i]},null!==t&&(null!==(t=dd(t))&&gc(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,null!==i&&-1===t.indexOf(i)&&t.push(i),e)}function Lc(e){var t=ud(e.target);if(null!==t){var n=zl(t);if(null!==n)if(13===(t=n.tag)){if(null!==(t=Tl(n)))return e.blockedOn=t,void xc(e.priority,function(){mc(n)})}else if(3===t&&n.stateNode.current.memoizedState.isDehydrated)return void(e.blockedOn=3===n.tag?n.stateNode.containerInfo:null)}e.blockedOn=null}function Ec(e){if(null!==e.blockedOn)return!1;for(var t=e.targetContainers;0<t.length;){var n=Uc(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(null!==n)return null!==(t=dd(n))&&gc(t),e.blockedOn=n,!1;var s=new(n=e.nativeEvent).constructor(n.type,n);pl=s,n.target.dispatchEvent(s),pl=null,t.shift()}return!0}function Pc(e,t,n){Ec(e)&&n.delete(t)}function Rc(){bc=!1,null!==wc&&Ec(wc)&&(wc=null),null!==Sc&&Ec(Sc)&&(Sc=null),null!==kc&&Ec(kc)&&(kc=null),Cc.forEach(Pc),jc.forEach(Pc)}function Ac(e,t){e.blockedOn===t&&(e.blockedOn=null,bc||(bc=!0,Jo.unstable_scheduleCallback(Jo.unstable_NormalPriority,Rc)))}function zc(e){function t(t){return Ac(t,e)}if(0<yc.length){Ac(yc[0],e);for(var n=1;n<yc.length;n++){var s=yc[n];s.blockedOn===e&&(s.blockedOn=null)}}for(null!==wc&&Ac(wc,e),null!==Sc&&Ac(Sc,e),null!==kc&&Ac(kc,e),Cc.forEach(t),jc.forEach(t),n=0;n<Nc.length;n++)(s=Nc[n]).blockedOn===e&&(s.blockedOn=null);for(;0<Nc.length&&null===(n=Nc[0]).blockedOn;)Lc(n),null===n.blockedOn&&Nc.shift()}var Tc=pa.ReactCurrentBatchConfig,Ic=!0;function Oc(e,t,n,s){var i=fc,r=Tc.transition;Tc.transition=null;try{fc=1,Fc(e,t,n,s)}finally{fc=i,Tc.transition=r}}function Hc(e,t,n,s){var i=fc,r=Tc.transition;Tc.transition=null;try{fc=4,Fc(e,t,n,s)}finally{fc=i,Tc.transition=r}}function Fc(e,t,n,s){if(Ic){var i=Uc(e,t,n,s);if(null===i)Tu(e,t,s,Wc,n),Bc(e,s);else if(function(e,t,n,s,i){switch(t){case"focusin":return wc=Dc(wc,e,t,n,s,i),!0;case"dragenter":return Sc=Dc(Sc,e,t,n,s,i),!0;case"mouseover":return kc=Dc(kc,e,t,n,s,i),!0;case"pointerover":var r=i.pointerId;return Cc.set(r,Dc(Cc.get(r)||null,e,t,n,s,i)),!0;case"gotpointercapture":return r=i.pointerId,jc.set(r,Dc(jc.get(r)||null,e,t,n,s,i)),!0}return!1}(i,e,t,n,s))s.stopPropagation();else if(Bc(e,s),4&t&&-1<Mc.indexOf(e)){for(;null!==i;){var r=dd(i);if(null!==r&&vc(r),null===(r=Uc(e,t,n,s))&&Tu(e,t,s,Wc,n),r===i)break;i=r}null!==i&&s.stopPropagation()}else Tu(e,t,s,null,n)}}var Wc=null;function Uc(e,t,n,s){if(Wc=null,null!==(e=ud(e=vl(s))))if(null===(t=zl(e)))e=null;else if(13===(n=t.tag)){if(null!==(e=Tl(t)))return e;e=null}else if(3===n){if(t.stateNode.current.memoizedState.isDehydrated)return 3===t.tag?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Wc=e,null}function Kc(e){switch(e){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($l()){case Vl:return 1;case Yl:return 4;case Gl:case Xl:return 16;case Zl:return 536870912;default:return 16}default:return 16}}var qc=null,$c=null,Vc=null;function Yc(){if(Vc)return Vc;var e,t,n=$c,s=n.length,i="value"in qc?qc.value:qc.textContent,r=i.length;for(e=0;e<s&&n[e]===i[e];e++);var o=s-e;for(t=1;t<=o&&n[s-t]===i[r-t];t++);return Vc=i.slice(e,1<t?1-t:void 0)}function Gc(e){var t=e.keyCode;return"charCode"in e?0===(e=e.charCode)&&13===t&&(e=13):e=t,10===e&&(e=13),32<=e||13===e?e:0}function Xc(){return!0}function Zc(){return!1}function Jc(e){function t(t,n,s,i,r){for(var o in this._reactName=t,this._targetInst=s,this.type=n,this.nativeEvent=i,this.target=r,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(null!=i.defaultPrevented?i.defaultPrevented:!1===i.returnValue)?Xc:Zc,this.isPropagationStopped=Zc,this}return La(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=Xc)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=Xc)},persist:function(){},isPersistent:Xc}),t}var Qc,eh,th,nh={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},sh=Jc(nh),ih=La({},nh,{view:0,detail:0}),rh=Jc(ih),oh=La({},ih,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:_h,button:0,buttons:0,relatedTarget:function(e){return void 0===e.relatedTarget?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==th&&(th&&"mousemove"===e.type?(Qc=e.screenX-th.screenX,eh=e.screenY-th.screenY):eh=Qc=0,th=e),Qc)},movementY:function(e){return"movementY"in e?e.movementY:eh}}),ah=Jc(oh),lh=Jc(La({},oh,{dataTransfer:0})),ch=Jc(La({},ih,{relatedTarget:0})),hh=Jc(La({},nh,{animationName:0,elapsedTime:0,pseudoElement:0})),uh=La({},nh,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),dh=Jc(uh),fh=Jc(La({},nh,{data:0})),ph={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},vh={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"},gh={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function mh(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=gh[e])&&!!t[e]}function _h(){return mh}var xh=La({},ih,{key:function(e){if(e.key){var t=ph[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=Gc(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?vh[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:_h,charCode:function(e){return"keypress"===e.type?Gc(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?Gc(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}}),bh=Jc(xh),yh=Jc(La({},oh,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),wh=Jc(La({},ih,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:_h})),Sh=Jc(La({},nh,{propertyName:0,elapsedTime:0,pseudoElement:0})),kh=La({},oh,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Ch=Jc(kh),jh=[9,13,27,32],Nh=ia&&"CompositionEvent"in window,Mh=null;ia&&"documentMode"in document&&(Mh=document.documentMode);var Bh=ia&&"TextEvent"in window&&!Mh,Dh=ia&&(!Nh||Mh&&8<Mh&&11>=Mh),Lh=String.fromCharCode(32),Eh=!1;function Ph(e,t){switch(e){case"keyup":return-1!==jh.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Rh(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var Ah=!1;var zh={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 Th(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!zh[e.type]:"textarea"===t}function Ih(e,t,n,s){bl(s),0<(t=Ou(t,"onChange")).length&&(n=new sh("onChange","change",null,n,s),e.push({event:n,listeners:t}))}var Oh=null,Hh=null;function Fh(e){Lu(e,0)}function Wh(e){if(Fa(fd(e)))return e}function Uh(e,t){if("change"===e)return t}var Kh=!1;if(ia){var qh;if(ia){var $h="oninput"in document;if(!$h){var Vh=document.createElement("div");Vh.setAttribute("oninput","return;"),$h="function"==typeof Vh.oninput}qh=$h}else qh=!1;Kh=qh&&(!document.documentMode||9<document.documentMode)}function Yh(){Oh&&(Oh.detachEvent("onpropertychange",Gh),Hh=Oh=null)}function Gh(e){if("value"===e.propertyName&&Wh(Hh)){var t=[];Ih(t,Hh,e,vl(e)),Cl(Fh,t)}}function Xh(e,t,n){"focusin"===e?(Yh(),Hh=n,(Oh=t).attachEvent("onpropertychange",Gh)):"focusout"===e&&Yh()}function Zh(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return Wh(Hh)}function Jh(e,t){if("click"===e)return Wh(t)}function Qh(e,t){if("input"===e||"change"===e)return Wh(t)}var eu="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t};function tu(e,t){if(eu(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;for(s=0;s<n.length;s++){var i=n[s];if(!ra.call(t,i)||!eu(e[i],t[i]))return!1}return!0}function nu(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function su(e,t){var n,s=nu(e);for(e=0;s;){if(3===s.nodeType){if(n=e+s.textContent.length,e<=t&&n>=t)return{node:s,offset:t-e};e=n}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=nu(s)}}function iu(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?iu(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function ru(){for(var e=window,t=Wa();t instanceof e.HTMLIFrameElement;){try{var n="string"==typeof t.contentWindow.location.href}catch(s){n=!1}if(!n)break;t=Wa((e=t.contentWindow).document)}return t}function ou(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}function au(e){var t=ru(),n=e.focusedElem,s=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&iu(n.ownerDocument.documentElement,n)){if(null!==s&&ou(n))if(t=s.start,void 0===(e=s.end)&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if((e=(t=n.ownerDocument||document)&&t.defaultView||window).getSelection){e=e.getSelection();var i=n.textContent.length,r=Math.min(s.start,i);s=void 0===s.end?r:Math.min(s.end,i),!e.extend&&r>s&&(i=s,s=r,r=i),i=su(n,r);var o=su(n,s);i&&o&&(1!==e.rangeCount||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&((t=t.createRange()).setStart(i.node,i.offset),e.removeAllRanges(),r>s?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}for(t=[],e=n;e=e.parentNode;)1===e.nodeType&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for("function"==typeof n.focus&&n.focus(),n=0;n<t.length;n++)(e=t[n]).element.scrollLeft=e.left,e.element.scrollTop=e.top}}var lu=ia&&"documentMode"in document&&11>=document.documentMode,cu=null,hu=null,uu=null,du=!1;function fu(e,t,n){var s=n.window===n?n.document:9===n.nodeType?n:n.ownerDocument;du||null==cu||cu!==Wa(s)||("selectionStart"in(s=cu)&&ou(s)?s={start:s.selectionStart,end:s.selectionEnd}:s={anchorNode:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset},uu&&tu(uu,s)||(uu=s,0<(s=Ou(hu,"onSelect")).length&&(t=new sh("onSelect","select",null,t,n),e.push({event:t,listeners:s}),t.target=cu)))}function pu(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var vu={animationend:pu("Animation","AnimationEnd"),animationiteration:pu("Animation","AnimationIteration"),animationstart:pu("Animation","AnimationStart"),transitionend:pu("Transition","TransitionEnd")},gu={},mu={};function _u(e){if(gu[e])return gu[e];if(!vu[e])return e;var t,n=vu[e];for(t in n)if(n.hasOwnProperty(t)&&t in mu)return gu[e]=n[t];return e}ia&&(mu=document.createElement("div").style,"AnimationEvent"in window||(delete vu.animationend.animation,delete vu.animationiteration.animation,delete vu.animationstart.animation),"TransitionEvent"in window||delete vu.transitionend.transition);var xu=_u("animationend"),bu=_u("animationiteration"),yu=_u("animationstart"),wu=_u("transitionend"),Su=new Map,ku="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 Cu(e,t){Su.set(e,t),na(t,[e])}for(var ju=0;ju<ku.length;ju++){var Nu=ku[ju];Cu(Nu.toLowerCase(),"on"+(Nu[0].toUpperCase()+Nu.slice(1)))}Cu(xu,"onAnimationEnd"),Cu(bu,"onAnimationIteration"),Cu(yu,"onAnimationStart"),Cu("dblclick","onDoubleClick"),Cu("focusin","onFocus"),Cu("focusout","onBlur"),Cu(wu,"onTransitionEnd"),sa("onMouseEnter",["mouseout","mouseover"]),sa("onMouseLeave",["mouseout","mouseover"]),sa("onPointerEnter",["pointerout","pointerover"]),sa("onPointerLeave",["pointerout","pointerover"]),na("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),na("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),na("onBeforeInput",["compositionend","keypress","textInput","paste"]),na("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),na("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),na("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Mu="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(" "),Bu=new Set("cancel close invalid load scroll toggle".split(" ").concat(Mu));function Du(e,t,n){var s=e.type||"unknown-event";e.currentTarget=n,function(e,t,n,s,i,r,o,a,l){if(Al.apply(this,arguments),Dl){if(!Dl)throw Error(Qo(198));var c=Ll;Dl=!1,Ll=null,El||(El=!0,Pl=c)}}(s,t,void 0,e),e.currentTarget=null}function Lu(e,t){t=!!(4&t);for(var n=0;n<e.length;n++){var s=e[n],i=s.event;s=s.listeners;e:{var r=void 0;if(t)for(var o=s.length-1;0<=o;o--){var a=s[o],l=a.instance,c=a.currentTarget;if(a=a.listener,l!==r&&i.isPropagationStopped())break e;Du(i,a,c),r=l}else for(o=0;o<s.length;o++){if(l=(a=s[o]).instance,c=a.currentTarget,a=a.listener,l!==r&&i.isPropagationStopped())break e;Du(i,a,c),r=l}}}if(El)throw e=Pl,El=!1,Pl=null,e}function Eu(e,t){var n=t[ld];void 0===n&&(n=t[ld]=new Set);var s=e+"__bubble";n.has(s)||(zu(t,e,2,!1),n.add(s))}function Pu(e,t,n){var s=0;t&&(s|=4),zu(n,e,s,t)}var Ru="_reactListening"+Math.random().toString(36).slice(2);function Au(e){if(!e[Ru]){e[Ru]=!0,ea.forEach(function(t){"selectionchange"!==t&&(Bu.has(t)||Pu(t,!1,e),Pu(t,!0,e))});var t=9===e.nodeType?e:e.ownerDocument;null===t||t[Ru]||(t[Ru]=!0,Pu("selectionchange",!1,t))}}function zu(e,t,n,s){switch(Kc(t)){case 1:var i=Oc;break;case 4:i=Hc;break;default:i=Fc}n=i.bind(null,t,n,e),i=void 0,!Nl||"touchstart"!==t&&"touchmove"!==t&&"wheel"!==t||(i=!0),s?void 0!==i?e.addEventListener(t,n,{capture:!0,passive:i}):e.addEventListener(t,n,!0):void 0!==i?e.addEventListener(t,n,{passive:i}):e.addEventListener(t,n,!1)}function Tu(e,t,n,s,i){var r=s;if(!(1&t||2&t||null===s))e:for(;;){if(null===s)return;var o=s.tag;if(3===o||4===o){var a=s.stateNode.containerInfo;if(a===i||8===a.nodeType&&a.parentNode===i)break;if(4===o)for(o=s.return;null!==o;){var l=o.tag;if((3===l||4===l)&&((l=o.stateNode.containerInfo)===i||8===l.nodeType&&l.parentNode===i))return;o=o.return}for(;null!==a;){if(null===(o=ud(a)))return;if(5===(l=o.tag)||6===l){s=r=o;continue e}a=a.parentNode}}s=s.return}Cl(function(){var s=r,i=vl(n),o=[];e:{var a=Su.get(e);if(void 0!==a){var l=sh,c=e;switch(e){case"keypress":if(0===Gc(n))break e;case"keydown":case"keyup":l=bh;break;case"focusin":c="focus",l=ch;break;case"focusout":c="blur",l=ch;break;case"beforeblur":case"afterblur":l=ch;break;case"click":if(2===n.button)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":l=ah;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":l=lh;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":l=wh;break;case xu:case bu:case yu:l=hh;break;case wu:l=Sh;break;case"scroll":l=rh;break;case"wheel":l=Ch;break;case"copy":case"cut":case"paste":l=dh;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":l=yh}var h=!!(4&t),u=!h&&"scroll"===e,d=h?null!==a?a+"Capture":null:a;h=[];for(var f,p=s;null!==p;){var v=(f=p).stateNode;if(5===f.tag&&null!==v&&(f=v,null!==d&&(null!=(v=jl(p,d))&&h.push(Iu(p,v,f)))),u)break;p=p.return}0<h.length&&(a=new l(a,c,null,n,i),o.push({event:a,listeners:h}))}}if(!(7&t)){if(l="mouseout"===e||"pointerout"===e,(!(a="mouseover"===e||"pointerover"===e)||n===pl||!(c=n.relatedTarget||n.fromElement)||!ud(c)&&!c[ad])&&(l||a)&&(a=i.window===i?i:(a=i.ownerDocument)?a.defaultView||a.parentWindow:window,l?(l=s,null!==(c=(c=n.relatedTarget||n.toElement)?ud(c):null)&&(c!==(u=zl(c))||5!==c.tag&&6!==c.tag)&&(c=null)):(l=null,c=s),l!==c)){if(h=ah,v="onMouseLeave",d="onMouseEnter",p="mouse","pointerout"!==e&&"pointerover"!==e||(h=yh,v="onPointerLeave",d="onPointerEnter",p="pointer"),u=null==l?a:fd(l),f=null==c?a:fd(c),(a=new h(v,p+"leave",l,n,i)).target=u,a.relatedTarget=f,v=null,ud(i)===s&&((h=new h(d,p+"enter",c,n,i)).target=f,h.relatedTarget=u,v=h),u=v,l&&c)e:{for(d=c,p=0,f=h=l;f;f=Hu(f))p++;for(f=0,v=d;v;v=Hu(v))f++;for(;0<p-f;)h=Hu(h),p--;for(;0<f-p;)d=Hu(d),f--;for(;p--;){if(h===d||null!==d&&h===d.alternate)break e;h=Hu(h),d=Hu(d)}h=null}else h=null;null!==l&&Fu(o,a,l,h,!1),null!==c&&null!==u&&Fu(o,u,c,h,!0)}if("select"===(l=(a=s?fd(s):window).nodeName&&a.nodeName.toLowerCase())||"input"===l&&"file"===a.type)var g=Uh;else if(Th(a))if(Kh)g=Qh;else{g=Zh;var m=Xh}else(l=a.nodeName)&&"input"===l.toLowerCase()&&("checkbox"===a.type||"radio"===a.type)&&(g=Jh);switch(g&&(g=g(e,s))?Ih(o,g,n,i):(m&&m(e,a,s),"focusout"===e&&(m=a._wrapperState)&&m.controlled&&"number"===a.type&&Ya(a,"number",a.value)),m=s?fd(s):window,e){case"focusin":(Th(m)||"true"===m.contentEditable)&&(cu=m,hu=s,uu=null);break;case"focusout":uu=hu=cu=null;break;case"mousedown":du=!0;break;case"contextmenu":case"mouseup":case"dragend":du=!1,fu(o,n,i);break;case"selectionchange":if(lu)break;case"keydown":case"keyup":fu(o,n,i)}var _;if(Nh)e:{switch(e){case"compositionstart":var x="onCompositionStart";break e;case"compositionend":x="onCompositionEnd";break e;case"compositionupdate":x="onCompositionUpdate";break e}x=void 0}else Ah?Ph(e,n)&&(x="onCompositionEnd"):"keydown"===e&&229===n.keyCode&&(x="onCompositionStart");x&&(Dh&&"ko"!==n.locale&&(Ah||"onCompositionStart"!==x?"onCompositionEnd"===x&&Ah&&(_=Yc()):($c="value"in(qc=i)?qc.value:qc.textContent,Ah=!0)),0<(m=Ou(s,x)).length&&(x=new fh(x,e,null,n,i),o.push({event:x,listeners:m}),_?x.data=_:null!==(_=Rh(n))&&(x.data=_))),(_=Bh?function(e,t){switch(e){case"compositionend":return Rh(t);case"keypress":return 32!==t.which?null:(Eh=!0,Lh);case"textInput":return(e=t.data)===Lh&&Eh?null:e;default:return null}}(e,n):function(e,t){if(Ah)return"compositionend"===e||!Nh&&Ph(e,t)?(e=Yc(),Vc=$c=qc=null,Ah=!1,e):null;switch(e){case"paste":default:return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Dh&&"ko"!==t.locale?null:t.data}}(e,n))&&(0<(s=Ou(s,"onBeforeInput")).length&&(i=new fh("onBeforeInput","beforeinput",null,n,i),o.push({event:i,listeners:s}),i.data=_))}Lu(o,t)})}function Iu(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Ou(e,t){for(var n=t+"Capture",s=[];null!==e;){var i=e,r=i.stateNode;5===i.tag&&null!==r&&(i=r,null!=(r=jl(e,n))&&s.unshift(Iu(e,r,i)),null!=(r=jl(e,t))&&s.push(Iu(e,r,i))),e=e.return}return s}function Hu(e){if(null===e)return null;do{e=e.return}while(e&&5!==e.tag);return e||null}function Fu(e,t,n,s,i){for(var r=t._reactName,o=[];null!==n&&n!==s;){var a=n,l=a.alternate,c=a.stateNode;if(null!==l&&l===s)break;5===a.tag&&null!==c&&(a=c,i?null!=(l=jl(n,r))&&o.unshift(Iu(n,l,a)):i||null!=(l=jl(n,r))&&o.push(Iu(n,l,a))),n=n.return}0!==o.length&&e.push({event:t,listeners:o})}var Wu=/\r\n?/g,Uu=/\u0000|\uFFFD/g;function Ku(e){return("string"==typeof e?e:""+e).replace(Wu,"\n").replace(Uu,"")}function qu(e,t,n){if(t=Ku(t),Ku(e)!==t&&n)throw Error(Qo(425))}function $u(){}var Vu=null,Yu=null;function Gu(e,t){return"textarea"===e||"noscript"===e||"string"==typeof t.children||"number"==typeof t.children||"object"==typeof t.dangerouslySetInnerHTML&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}var Xu="function"==typeof setTimeout?setTimeout:void 0,Zu="function"==typeof clearTimeout?clearTimeout:void 0,Ju="function"==typeof Promise?Promise:void 0,Qu="function"==typeof queueMicrotask?queueMicrotask:void 0!==Ju?function(e){return Ju.resolve(null).then(e).catch(ed)}:Xu;function ed(e){setTimeout(function(){throw e})}function td(e,t){var n=t,s=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&8===i.nodeType)if("/$"===(n=i.data)){if(0===s)return e.removeChild(i),void zc(t);s--}else"$"!==n&&"$?"!==n&&"$!"!==n||s++;n=i}while(n);zc(t)}function nd(e){for(;null!=e;e=e.nextSibling){var t=e.nodeType;if(1===t||3===t)break;if(8===t){if("$"===(t=e.data)||"$!"===t||"$?"===t)break;if("/$"===t)return null}}return e}function sd(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var n=e.data;if("$"===n||"$!"===n||"$?"===n){if(0===t)return e;t--}else"/$"===n&&t++}e=e.previousSibling}return null}var id=Math.random().toString(36).slice(2),rd="__reactFiber$"+id,od="__reactProps$"+id,ad="__reactContainer$"+id,ld="__reactEvents$"+id,cd="__reactListeners$"+id,hd="__reactHandles$"+id;function ud(e){var t=e[rd];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ad]||n[rd]){if(n=t.alternate,null!==t.child||null!==n&&null!==n.child)for(e=sd(e);null!==e;){if(n=e[rd])return n;e=sd(e)}return t}n=(e=n).parentNode}return null}function dd(e){return!(e=e[rd]||e[ad])||5!==e.tag&&6!==e.tag&&13!==e.tag&&3!==e.tag?null:e}function fd(e){if(5===e.tag||6===e.tag)return e.stateNode;throw Error(Qo(33))}function pd(e){return e[od]||null}var vd=[],gd=-1;function md(e){return{current:e}}function _d(e){0>gd||(e.current=vd[gd],vd[gd]=null,gd--)}function xd(e,t){gd++,vd[gd]=e.current,e.current=t}var bd={},yd=md(bd),wd=md(!1),Sd=bd;function kd(e,t){var n=e.type.contextTypes;if(!n)return bd;var s=e.stateNode;if(s&&s.__reactInternalMemoizedUnmaskedChildContext===t)return s.__reactInternalMemoizedMaskedChildContext;var i,r={};for(i in n)r[i]=t[i];return s&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=r),r}function Cd(e){return null!=(e=e.childContextTypes)}function jd(){_d(wd),_d(yd)}function Nd(e,t,n){if(yd.current!==bd)throw Error(Qo(168));xd(yd,t),xd(wd,n)}function Md(e,t,n){var s=e.stateNode;if(t=t.childContextTypes,"function"!=typeof s.getChildContext)return n;for(var i in s=s.getChildContext())if(!(i in t))throw Error(Qo(108,Ta(e)||"Unknown",i));return La({},n,s)}function Bd(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||bd,Sd=yd.current,xd(yd,e),xd(wd,wd.current),!0}function Dd(e,t,n){var s=e.stateNode;if(!s)throw Error(Qo(169));n?(e=Md(e,t,Sd),s.__reactInternalMemoizedMergedChildContext=e,_d(wd),_d(yd),xd(yd,e)):_d(wd),xd(wd,n)}var Ld=null,Ed=!1,Pd=!1;function Rd(e){null===Ld?Ld=[e]:Ld.push(e)}function Ad(){if(!Pd&&null!==Ld){Pd=!0;var e=0,t=fc;try{var n=Ld;for(fc=1;e<n.length;e++){var s=n[e];do{s=s(!0)}while(null!==s)}Ld=null,Ed=!1}catch(i){throw null!==Ld&&(Ld=Ld.slice(e+1)),Fl(Vl,Ad),i}finally{fc=t,Pd=!1}}return null}var zd=[],Td=0,Id=null,Od=0,Hd=[],Fd=0,Wd=null,Ud=1,Kd="";function qd(e,t){zd[Td++]=Od,zd[Td++]=Id,Id=e,Od=t}function $d(e,t,n){Hd[Fd++]=Ud,Hd[Fd++]=Kd,Hd[Fd++]=Wd,Wd=e;var s=Ud;e=Kd;var i=32-ec(s)-1;s&=~(1<<i),n+=1;var r=32-ec(t)+i;if(30<r){var o=i-i%5;r=(s&(1<<o)-1).toString(32),s>>=o,i-=o,Ud=1<<32-ec(t)+i|n<<i|s,Kd=r+e}else Ud=1<<r|n<<i|s,Kd=e}function Vd(e){null!==e.return&&(qd(e,1),$d(e,1,0))}function Yd(e){for(;e===Id;)Id=zd[--Td],zd[Td]=null,Od=zd[--Td],zd[Td]=null;for(;e===Wd;)Wd=Hd[--Fd],Hd[Fd]=null,Kd=Hd[--Fd],Hd[Fd]=null,Ud=Hd[--Fd],Hd[Fd]=null}var Gd=null,Xd=null,Zd=!1,Jd=null;function Qd(e,t){var n=km(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,null===(t=e.deletions)?(e.deletions=[n],e.flags|=16):t.push(n)}function ef(e,t){switch(e.tag){case 5:var n=e.type;return null!==(t=1!==t.nodeType||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t)&&(e.stateNode=t,Gd=e,Xd=nd(t.firstChild),!0);case 6:return null!==(t=""===e.pendingProps||3!==t.nodeType?null:t)&&(e.stateNode=t,Gd=e,Xd=null,!0);case 13:return null!==(t=8!==t.nodeType?null:t)&&(n=null!==Wd?{id:Ud,overflow:Kd}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},(n=km(18,null,null,0)).stateNode=t,n.return=e,e.child=n,Gd=e,Xd=null,!0);default:return!1}}function tf(e){return!(!(1&e.mode)||128&e.flags)}function nf(e){if(Zd){var t=Xd;if(t){var n=t;if(!ef(e,t)){if(tf(e))throw Error(Qo(418));t=nd(n.nextSibling);var s=Gd;t&&ef(e,t)?Qd(s,n):(e.flags=-4097&e.flags|2,Zd=!1,Gd=e)}}else{if(tf(e))throw Error(Qo(418));e.flags=-4097&e.flags|2,Zd=!1,Gd=e}}}function sf(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag&&13!==e.tag;)e=e.return;Gd=e}function rf(e){if(e!==Gd)return!1;if(!Zd)return sf(e),Zd=!0,!1;var t;if((t=3!==e.tag)&&!(t=5!==e.tag)&&(t="head"!==(t=e.type)&&"body"!==t&&!Gu(e.type,e.memoizedProps)),t&&(t=Xd)){if(tf(e))throw of(),Error(Qo(418));for(;t;)Qd(e,t),t=nd(t.nextSibling)}if(sf(e),13===e.tag){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(Qo(317));e:{for(e=e.nextSibling,t=0;e;){if(8===e.nodeType){var n=e.data;if("/$"===n){if(0===t){Xd=nd(e.nextSibling);break e}t--}else"$"!==n&&"$!"!==n&&"$?"!==n||t++}e=e.nextSibling}Xd=null}}else Xd=Gd?nd(e.stateNode.nextSibling):null;return!0}function of(){for(var e=Xd;e;)e=nd(e.nextSibling)}function af(){Xd=Gd=null,Zd=!1}function lf(e){null===Jd?Jd=[e]:Jd.push(e)}var cf=pa.ReactCurrentBatchConfig;function hf(e,t,n){if(null!==(e=n.ref)&&"function"!=typeof e&&"object"!=typeof e){if(n._owner){if(n=n._owner){if(1!==n.tag)throw Error(Qo(309));var s=n.stateNode}if(!s)throw Error(Qo(147,e));var i=s,r=""+e;return null!==t&&null!==t.ref&&"function"==typeof t.ref&&t.ref._stringRef===r?t.ref:((t=function(e){var t=i.refs;null===e?delete t[r]:t[r]=e})._stringRef=r,t)}if("string"!=typeof e)throw Error(Qo(284));if(!n._owner)throw Error(Qo(290,e))}return e}function uf(e,t){throw e=Object.prototype.toString.call(t),Error(Qo(31,"[object Object]"===e?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function df(e){return(0,e._init)(e._payload)}function ff(e){function t(t,n){if(e){var s=t.deletions;null===s?(t.deletions=[n],t.flags|=16):s.push(n)}}function n(n,s){if(!e)return null;for(;null!==s;)t(n,s),s=s.sibling;return null}function s(e,t){for(e=new Map;null!==t;)null!==t.key?e.set(t.key,t):e.set(t.index,t),t=t.sibling;return e}function i(e,t){return(e=jm(e,t)).index=0,e.sibling=null,e}function r(t,n,s){return t.index=s,e?null!==(s=t.alternate)?(s=s.index)<n?(t.flags|=2,n):s:(t.flags|=2,n):(t.flags|=1048576,n)}function o(t){return e&&null===t.alternate&&(t.flags|=2),t}function a(e,t,n,s){return null===t||6!==t.tag?((t=Dm(n,e.mode,s)).return=e,t):((t=i(t,n)).return=e,t)}function l(e,t,n,s){var r=n.type;return r===ma?h(e,t,n.props.children,s,n.key):null!==t&&(t.elementType===r||"object"==typeof r&&null!==r&&r.$$typeof===ja&&df(r)===t.type)?((s=i(t,n.props)).ref=hf(e,t,n),s.return=e,s):((s=Nm(n.type,n.key,n.props,null,e.mode,s)).ref=hf(e,t,n),s.return=e,s)}function c(e,t,n,s){return null===t||4!==t.tag||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?((t=Lm(n,e.mode,s)).return=e,t):((t=i(t,n.children||[])).return=e,t)}function h(e,t,n,s,r){return null===t||7!==t.tag?((t=Mm(n,e.mode,s,r)).return=e,t):((t=i(t,n)).return=e,t)}function u(e,t,n){if("string"==typeof t&&""!==t||"number"==typeof t)return(t=Dm(""+t,e.mode,n)).return=e,t;if("object"==typeof t&&null!==t){switch(t.$$typeof){case va:return(n=Nm(t.type,t.key,t.props,null,e.mode,n)).ref=hf(e,null,t),n.return=e,n;case ga:return(t=Lm(t,e.mode,n)).return=e,t;case ja:return u(e,(0,t._init)(t._payload),n)}if(Ga(t)||Ba(t))return(t=Mm(t,e.mode,n,null)).return=e,t;uf(e,t)}return null}function d(e,t,n,s){var i=null!==t?t.key:null;if("string"==typeof n&&""!==n||"number"==typeof n)return null!==i?null:a(e,t,""+n,s);if("object"==typeof n&&null!==n){switch(n.$$typeof){case va:return n.key===i?l(e,t,n,s):null;case ga:return n.key===i?c(e,t,n,s):null;case ja:return d(e,t,(i=n._init)(n._payload),s)}if(Ga(n)||Ba(n))return null!==i?null:h(e,t,n,s,null);uf(e,n)}return null}function f(e,t,n,s,i){if("string"==typeof s&&""!==s||"number"==typeof s)return a(t,e=e.get(n)||null,""+s,i);if("object"==typeof s&&null!==s){switch(s.$$typeof){case va:return l(t,e=e.get(null===s.key?n:s.key)||null,s,i);case ga:return c(t,e=e.get(null===s.key?n:s.key)||null,s,i);case ja:return f(e,t,n,(0,s._init)(s._payload),i)}if(Ga(s)||Ba(s))return h(t,e=e.get(n)||null,s,i,null);uf(t,s)}return null}return function a(l,c,h,p){if("object"==typeof h&&null!==h&&h.type===ma&&null===h.key&&(h=h.props.children),"object"==typeof h&&null!==h){switch(h.$$typeof){case va:e:{for(var v=h.key,g=c;null!==g;){if(g.key===v){if((v=h.type)===ma){if(7===g.tag){n(l,g.sibling),(c=i(g,h.props.children)).return=l,l=c;break e}}else if(g.elementType===v||"object"==typeof v&&null!==v&&v.$$typeof===ja&&df(v)===g.type){n(l,g.sibling),(c=i(g,h.props)).ref=hf(l,g,h),c.return=l,l=c;break e}n(l,g);break}t(l,g),g=g.sibling}h.type===ma?((c=Mm(h.props.children,l.mode,p,h.key)).return=l,l=c):((p=Nm(h.type,h.key,h.props,null,l.mode,p)).ref=hf(l,c,h),p.return=l,l=p)}return o(l);case ga:e:{for(g=h.key;null!==c;){if(c.key===g){if(4===c.tag&&c.stateNode.containerInfo===h.containerInfo&&c.stateNode.implementation===h.implementation){n(l,c.sibling),(c=i(c,h.children||[])).return=l,l=c;break e}n(l,c);break}t(l,c),c=c.sibling}(c=Lm(h,l.mode,p)).return=l,l=c}return o(l);case ja:return a(l,c,(g=h._init)(h._payload),p)}if(Ga(h))return function(i,o,a,l){for(var c=null,h=null,p=o,v=o=0,g=null;null!==p&&v<a.length;v++){p.index>v?(g=p,p=null):g=p.sibling;var m=d(i,p,a[v],l);if(null===m){null===p&&(p=g);break}e&&p&&null===m.alternate&&t(i,p),o=r(m,o,v),null===h?c=m:h.sibling=m,h=m,p=g}if(v===a.length)return n(i,p),Zd&&qd(i,v),c;if(null===p){for(;v<a.length;v++)null!==(p=u(i,a[v],l))&&(o=r(p,o,v),null===h?c=p:h.sibling=p,h=p);return Zd&&qd(i,v),c}for(p=s(i,p);v<a.length;v++)null!==(g=f(p,i,v,a[v],l))&&(e&&null!==g.alternate&&p.delete(null===g.key?v:g.key),o=r(g,o,v),null===h?c=g:h.sibling=g,h=g);return e&&p.forEach(function(e){return t(i,e)}),Zd&&qd(i,v),c}(l,c,h,p);if(Ba(h))return function(i,o,a,l){var c=Ba(a);if("function"!=typeof c)throw Error(Qo(150));if(null==(a=c.call(a)))throw Error(Qo(151));for(var h=c=null,p=o,v=o=0,g=null,m=a.next();null!==p&&!m.done;v++,m=a.next()){p.index>v?(g=p,p=null):g=p.sibling;var _=d(i,p,m.value,l);if(null===_){null===p&&(p=g);break}e&&p&&null===_.alternate&&t(i,p),o=r(_,o,v),null===h?c=_:h.sibling=_,h=_,p=g}if(m.done)return n(i,p),Zd&&qd(i,v),c;if(null===p){for(;!m.done;v++,m=a.next())null!==(m=u(i,m.value,l))&&(o=r(m,o,v),null===h?c=m:h.sibling=m,h=m);return Zd&&qd(i,v),c}for(p=s(i,p);!m.done;v++,m=a.next())null!==(m=f(p,i,v,m.value,l))&&(e&&null!==m.alternate&&p.delete(null===m.key?v:m.key),o=r(m,o,v),null===h?c=m:h.sibling=m,h=m);return e&&p.forEach(function(e){return t(i,e)}),Zd&&qd(i,v),c}(l,c,h,p);uf(l,h)}return"string"==typeof h&&""!==h||"number"==typeof h?(h=""+h,null!==c&&6===c.tag?(n(l,c.sibling),(c=i(c,h)).return=l,l=c):(n(l,c),(c=Dm(h,l.mode,p)).return=l,l=c),o(l)):n(l,c)}}var pf=ff(!0),vf=ff(!1),gf=md(null),mf=null,_f=null,xf=null;function bf(){xf=_f=mf=null}function yf(e){var t=gf.current;_d(gf),e._currentValue=t}function wf(e,t,n){for(;null!==e;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,null!==s&&(s.childLanes|=t)):null!==s&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===n)break;e=e.return}}function Sf(e,t){mf=e,xf=_f=null,null!==(e=e.dependencies)&&null!==e.firstContext&&(0!==(e.lanes&t)&&(dv=!0),e.firstContext=null)}function kf(e){var t=e._currentValue;if(xf!==e)if(e={context:e,memoizedValue:t,next:null},null===_f){if(null===mf)throw Error(Qo(308));_f=e,mf.dependencies={lanes:0,firstContext:e}}else _f=_f.next=e;return t}var Cf=null;function jf(e){null===Cf?Cf=[e]:Cf.push(e)}function Nf(e,t,n,s){var i=t.interleaved;return null===i?(n.next=n,jf(t)):(n.next=i.next,i.next=n),t.interleaved=n,Mf(e,s)}function Mf(e,t){e.lanes|=t;var n=e.alternate;for(null!==n&&(n.lanes|=t),n=e,e=e.return;null!==e;)e.childLanes|=t,null!==(n=e.alternate)&&(n.childLanes|=t),n=e,e=e.return;return 3===n.tag?n.stateNode:null}var Bf=!1;function Df(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Lf(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Ef(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Pf(e,t,n){var s=e.updateQueue;if(null===s)return null;if(s=s.shared,2&yg){var i=s.pending;return null===i?t.next=t:(t.next=i.next,i.next=t),s.pending=t,Mf(e,n)}return null===(i=s.interleaved)?(t.next=t,jf(s)):(t.next=i.next,i.next=t),s.interleaved=t,Mf(e,n)}function Rf(e,t,n){if(null!==(t=t.updateQueue)&&(t=t.shared,4194240&n)){var s=t.lanes;n|=s&=e.pendingLanes,t.lanes=n,dc(e,n)}}function Af(e,t){var n=e.updateQueue,s=e.alternate;if(null!==s&&n===(s=s.updateQueue)){var i=null,r=null;if(null!==(n=n.firstBaseUpdate)){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};null===r?i=r=o:r=r.next=o,n=n.next}while(null!==n);null===r?i=r=t:r=r.next=t}else i=r=t;return n={baseState:s.baseState,firstBaseUpdate:i,lastBaseUpdate:r,shared:s.shared,effects:s.effects},void(e.updateQueue=n)}null===(e=n.lastBaseUpdate)?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function zf(e,t,n,s){var i=e.updateQueue;Bf=!1;var r=i.firstBaseUpdate,o=i.lastBaseUpdate,a=i.shared.pending;if(null!==a){i.shared.pending=null;var l=a,c=l.next;l.next=null,null===o?r=c:o.next=c,o=l;var h=e.alternate;null!==h&&((a=(h=h.updateQueue).lastBaseUpdate)!==o&&(null===a?h.firstBaseUpdate=c:a.next=c,h.lastBaseUpdate=l))}if(null!==r){var u=i.baseState;for(o=0,h=c=l=null,a=r;;){var d=a.lane,f=a.eventTime;if((s&d)===d){null!==h&&(h=h.next={eventTime:f,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var p=e,v=a;switch(d=t,f=n,v.tag){case 1:if("function"==typeof(p=v.payload)){u=p.call(f,u,d);break e}u=p;break e;case 3:p.flags=-65537&p.flags|128;case 0:if(null==(d="function"==typeof(p=v.payload)?p.call(f,u,d):p))break e;u=La({},u,d);break e;case 2:Bf=!0}}null!==a.callback&&0!==a.lane&&(e.flags|=64,null===(d=i.effects)?i.effects=[a]:d.push(a))}else f={eventTime:f,lane:d,tag:a.tag,payload:a.payload,callback:a.callback,next:null},null===h?(c=h=f,l=u):h=h.next=f,o|=d;if(null===(a=a.next)){if(null===(a=i.shared.pending))break;a=(d=a).next,d.next=null,i.lastBaseUpdate=d,i.shared.pending=null}}if(null===h&&(l=u),i.baseState=l,i.firstBaseUpdate=c,i.lastBaseUpdate=h,null!==(t=i.shared.interleaved)){i=t;do{o|=i.lane,i=i.next}while(i!==t)}else null===r&&(i.shared.lanes=0);Bg|=o,e.lanes=o,e.memoizedState=u}}function Tf(e,t,n){if(e=t.effects,t.effects=null,null!==e)for(t=0;t<e.length;t++){var s=e[t],i=s.callback;if(null!==i){if(s.callback=null,s=n,"function"!=typeof i)throw Error(Qo(191,i));i.call(s)}}}var If={},Of=md(If),Hf=md(If),Ff=md(If);function Wf(e){if(e===If)throw Error(Qo(174));return e}function Uf(e,t){switch(xd(Ff,t),xd(Hf,e),xd(Of,If),e=t.nodeType){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:nl(null,"");break;default:t=nl(t=(e=8===e?t.parentNode:t).namespaceURI||null,e=e.tagName)}_d(Of),xd(Of,t)}function Kf(){_d(Of),_d(Hf),_d(Ff)}function qf(e){Wf(Ff.current);var t=Wf(Of.current),n=nl(t,e.type);t!==n&&(xd(Hf,e),xd(Of,n))}function $f(e){Hf.current===e&&(_d(Of),_d(Hf))}var Vf=md(0);function Yf(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||"$?"===n.data||"$!"===n.data))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(128&t.flags)return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Gf=[];function Xf(){for(var e=0;e<Gf.length;e++)Gf[e]._workInProgressVersionPrimary=null;Gf.length=0}var Zf=pa.ReactCurrentDispatcher,Jf=pa.ReactCurrentBatchConfig,Qf=0,ep=null,tp=null,np=null,sp=!1,ip=!1,rp=0,op=0;function ap(){throw Error(Qo(321))}function lp(e,t){if(null===t)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!eu(e[n],t[n]))return!1;return!0}function cp(e,t,n,s,i,r){if(Qf=r,ep=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Zf.current=null===e||null===e.memoizedState?$p:Vp,e=n(s,i),ip){r=0;do{if(ip=!1,rp=0,25<=r)throw Error(Qo(301));r+=1,np=tp=null,t.updateQueue=null,Zf.current=Yp,e=n(s,i)}while(ip)}if(Zf.current=qp,t=null!==tp&&null!==tp.next,Qf=0,np=tp=ep=null,sp=!1,t)throw Error(Qo(300));return e}function hp(){var e=0!==rp;return rp=0,e}function up(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===np?ep.memoizedState=np=e:np=np.next=e,np}function dp(){if(null===tp){var e=ep.alternate;e=null!==e?e.memoizedState:null}else e=tp.next;var t=null===np?ep.memoizedState:np.next;if(null!==t)np=t,tp=e;else{if(null===e)throw Error(Qo(310));e={memoizedState:(tp=e).memoizedState,baseState:tp.baseState,baseQueue:tp.baseQueue,queue:tp.queue,next:null},null===np?ep.memoizedState=np=e:np=np.next=e}return np}function fp(e,t){return"function"==typeof t?t(e):t}function pp(e){var t=dp(),n=t.queue;if(null===n)throw Error(Qo(311));n.lastRenderedReducer=e;var s=tp,i=s.baseQueue,r=n.pending;if(null!==r){if(null!==i){var o=i.next;i.next=r.next,r.next=o}s.baseQueue=i=r,n.pending=null}if(null!==i){r=i.next,s=s.baseState;var a=o=null,l=null,c=r;do{var h=c.lane;if((Qf&h)===h)null!==l&&(l=l.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),s=c.hasEagerState?c.eagerState:e(s,c.action);else{var u={lane:h,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};null===l?(a=l=u,o=s):l=l.next=u,ep.lanes|=h,Bg|=h}c=c.next}while(null!==c&&c!==r);null===l?o=s:l.next=a,eu(s,t.memoizedState)||(dv=!0),t.memoizedState=s,t.baseState=o,t.baseQueue=l,n.lastRenderedState=s}if(null!==(e=n.interleaved)){i=e;do{r=i.lane,ep.lanes|=r,Bg|=r,i=i.next}while(i!==e)}else null===i&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function vp(e){var t=dp(),n=t.queue;if(null===n)throw Error(Qo(311));n.lastRenderedReducer=e;var s=n.dispatch,i=n.pending,r=t.memoizedState;if(null!==i){n.pending=null;var o=i=i.next;do{r=e(r,o.action),o=o.next}while(o!==i);eu(r,t.memoizedState)||(dv=!0),t.memoizedState=r,null===t.baseQueue&&(t.baseState=r),n.lastRenderedState=r}return[r,s]}function gp(){}function mp(e,t){var n=ep,s=dp(),i=t(),r=!eu(s.memoizedState,i);if(r&&(s.memoizedState=i,dv=!0),s=s.queue,Bp(bp.bind(null,n,s,e),[e]),s.getSnapshot!==t||r||null!==np&&1&np.memoizedState.tag){if(n.flags|=2048,kp(9,xp.bind(null,n,s,i,t),void 0,null),null===wg)throw Error(Qo(349));30&Qf||_p(n,t,i)}return i}function _p(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},null===(t=ep.updateQueue)?(t={lastEffect:null,stores:null},ep.updateQueue=t,t.stores=[e]):null===(n=t.stores)?t.stores=[e]:n.push(e)}function xp(e,t,n,s){t.value=n,t.getSnapshot=s,yp(t)&&wp(e)}function bp(e,t,n){return n(function(){yp(t)&&wp(e)})}function yp(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!eu(e,n)}catch(s){return!0}}function wp(e){var t=Mf(e,1);null!==t&&Gg(t,e,1,-1)}function Sp(e){var t=up();return"function"==typeof e&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:fp,lastRenderedState:e},t.queue=e,e=e.dispatch=Fp.bind(null,ep,e),[t.memoizedState,e]}function kp(e,t,n,s){return e={tag:e,create:t,destroy:n,deps:s,next:null},null===(t=ep.updateQueue)?(t={lastEffect:null,stores:null},ep.updateQueue=t,t.lastEffect=e.next=e):null===(n=t.lastEffect)?t.lastEffect=e.next=e:(s=n.next,n.next=e,e.next=s,t.lastEffect=e),e}function Cp(){return dp().memoizedState}function jp(e,t,n,s){var i=up();ep.flags|=e,i.memoizedState=kp(1|t,n,void 0,void 0===s?null:s)}function Np(e,t,n,s){var i=dp();s=void 0===s?null:s;var r=void 0;if(null!==tp){var o=tp.memoizedState;if(r=o.destroy,null!==s&&lp(s,o.deps))return void(i.memoizedState=kp(t,n,r,s))}ep.flags|=e,i.memoizedState=kp(1|t,n,r,s)}function Mp(e,t){return jp(8390656,8,e,t)}function Bp(e,t){return Np(2048,8,e,t)}function Dp(e,t){return Np(4,2,e,t)}function Lp(e,t){return Np(4,4,e,t)}function Ep(e,t){return"function"==typeof t?(e=e(),t(e),function(){t(null)}):null!=t?(e=e(),t.current=e,function(){t.current=null}):void 0}function Pp(e,t,n){return n=null!=n?n.concat([e]):null,Np(4,4,Ep.bind(null,t,e),n)}function Rp(){}function Ap(e,t){var n=dp();t=void 0===t?null:t;var s=n.memoizedState;return null!==s&&null!==t&&lp(t,s[1])?s[0]:(n.memoizedState=[e,t],e)}function zp(e,t){var n=dp();t=void 0===t?null:t;var s=n.memoizedState;return null!==s&&null!==t&&lp(t,s[1])?s[0]:(e=e(),n.memoizedState=[e,t],e)}function Tp(e,t,n){return 21&Qf?(eu(n,t)||(n=cc(),ep.lanes|=n,Bg|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,dv=!0),e.memoizedState=n)}function Ip(e,t){var n=fc;fc=0!==n&&4>n?n:4,e(!0);var s=Jf.transition;Jf.transition={};try{e(!1),t()}finally{fc=n,Jf.transition=s}}function Op(){return dp().memoizedState}function Hp(e,t,n){var s=Yg(e);if(n={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null},Wp(e))Up(t,n);else if(null!==(n=Nf(e,t,n,s))){Gg(n,e,s,Vg()),Kp(n,t,s)}}function Fp(e,t,n){var s=Yg(e),i={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null};if(Wp(e))Up(t,i);else{var r=e.alternate;if(0===e.lanes&&(null===r||0===r.lanes)&&null!==(r=t.lastRenderedReducer))try{var o=t.lastRenderedState,a=r(o,n);if(i.hasEagerState=!0,i.eagerState=a,eu(a,o)){var l=t.interleaved;return null===l?(i.next=i,jf(t)):(i.next=l.next,l.next=i),void(t.interleaved=i)}}catch(c){}null!==(n=Nf(e,t,i,s))&&(Gg(n,e,s,i=Vg()),Kp(n,t,s))}}function Wp(e){var t=e.alternate;return e===ep||null!==t&&t===ep}function Up(e,t){ip=sp=!0;var n=e.pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Kp(e,t,n){if(4194240&n){var s=t.lanes;n|=s&=e.pendingLanes,t.lanes=n,dc(e,n)}}var qp={readContext:kf,useCallback:ap,useContext:ap,useEffect:ap,useImperativeHandle:ap,useInsertionEffect:ap,useLayoutEffect:ap,useMemo:ap,useReducer:ap,useRef:ap,useState:ap,useDebugValue:ap,useDeferredValue:ap,useTransition:ap,useMutableSource:ap,useSyncExternalStore:ap,useId:ap,unstable_isNewReconciler:!1},$p={readContext:kf,useCallback:function(e,t){return up().memoizedState=[e,void 0===t?null:t],e},useContext:kf,useEffect:Mp,useImperativeHandle:function(e,t,n){return n=null!=n?n.concat([e]):null,jp(4194308,4,Ep.bind(null,t,e),n)},useLayoutEffect:function(e,t){return jp(4194308,4,e,t)},useInsertionEffect:function(e,t){return jp(4,2,e,t)},useMemo:function(e,t){var n=up();return t=void 0===t?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var s=up();return t=void 0!==n?n(t):t,s.memoizedState=s.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},s.queue=e,e=e.dispatch=Hp.bind(null,ep,e),[s.memoizedState,e]},useRef:function(e){return e={current:e},up().memoizedState=e},useState:Sp,useDebugValue:Rp,useDeferredValue:function(e){return up().memoizedState=e},useTransition:function(){var e=Sp(!1),t=e[0];return e=Ip.bind(null,e[1]),up().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var s=ep,i=up();if(Zd){if(void 0===n)throw Error(Qo(407));n=n()}else{if(n=t(),null===wg)throw Error(Qo(349));30&Qf||_p(s,t,n)}i.memoizedState=n;var r={value:n,getSnapshot:t};return i.queue=r,Mp(bp.bind(null,s,r,e),[e]),s.flags|=2048,kp(9,xp.bind(null,s,r,n,t),void 0,null),n},useId:function(){var e=up(),t=wg.identifierPrefix;if(Zd){var n=Kd;t=":"+t+"R"+(n=(Ud&~(1<<32-ec(Ud)-1)).toString(32)+n),0<(n=rp++)&&(t+="H"+n.toString(32)),t+=":"}else t=":"+t+"r"+(n=op++).toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Vp={readContext:kf,useCallback:Ap,useContext:kf,useEffect:Bp,useImperativeHandle:Pp,useInsertionEffect:Dp,useLayoutEffect:Lp,useMemo:zp,useReducer:pp,useRef:Cp,useState:function(){return pp(fp)},useDebugValue:Rp,useDeferredValue:function(e){return Tp(dp(),tp.memoizedState,e)},useTransition:function(){return[pp(fp)[0],dp().memoizedState]},useMutableSource:gp,useSyncExternalStore:mp,useId:Op,unstable_isNewReconciler:!1},Yp={readContext:kf,useCallback:Ap,useContext:kf,useEffect:Bp,useImperativeHandle:Pp,useInsertionEffect:Dp,useLayoutEffect:Lp,useMemo:zp,useReducer:vp,useRef:Cp,useState:function(){return vp(fp)},useDebugValue:Rp,useDeferredValue:function(e){var t=dp();return null===tp?t.memoizedState=e:Tp(t,tp.memoizedState,e)},useTransition:function(){return[vp(fp)[0],dp().memoizedState]},useMutableSource:gp,useSyncExternalStore:mp,useId:Op,unstable_isNewReconciler:!1};function Gp(e,t){if(e&&e.defaultProps){for(var n in t=La({},t),e=e.defaultProps)void 0===t[n]&&(t[n]=e[n]);return t}return t}function Xp(e,t,n,s){n=null==(n=n(s,t=e.memoizedState))?t:La({},t,n),e.memoizedState=n,0===e.lanes&&(e.updateQueue.baseState=n)}var Zp={isMounted:function(e){return!!(e=e._reactInternals)&&zl(e)===e},enqueueSetState:function(e,t,n){e=e._reactInternals;var s=Vg(),i=Yg(e),r=Ef(s,i);r.payload=t,null!=n&&(r.callback=n),null!==(t=Pf(e,r,i))&&(Gg(t,e,i,s),Rf(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var s=Vg(),i=Yg(e),r=Ef(s,i);r.tag=1,r.payload=t,null!=n&&(r.callback=n),null!==(t=Pf(e,r,i))&&(Gg(t,e,i,s),Rf(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Vg(),s=Yg(e),i=Ef(n,s);i.tag=2,null!=t&&(i.callback=t),null!==(t=Pf(e,i,s))&&(Gg(t,e,s,n),Rf(t,e,s))}};function Jp(e,t,n,s,i,r,o){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(s,r,o):!t.prototype||!t.prototype.isPureReactComponent||(!tu(n,s)||!tu(i,r))}function Qp(e,t,n){var s=!1,i=bd,r=t.contextType;return"object"==typeof r&&null!==r?r=kf(r):(i=Cd(t)?Sd:yd.current,r=(s=null!=(s=t.contextTypes))?kd(e,i):bd),t=new t(n,r),e.memoizedState=null!==t.state&&void 0!==t.state?t.state:null,t.updater=Zp,e.stateNode=t,t._reactInternals=e,s&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=r),t}function ev(e,t,n,s){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(n,s),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(n,s),t.state!==e&&Zp.enqueueReplaceState(t,t.state,null)}function tv(e,t,n,s){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},Df(e);var r=t.contextType;"object"==typeof r&&null!==r?i.context=kf(r):(r=Cd(t)?Sd:yd.current,i.context=kd(e,r)),i.state=e.memoizedState,"function"==typeof(r=t.getDerivedStateFromProps)&&(Xp(e,t,r,n),i.state=e.memoizedState),"function"==typeof t.getDerivedStateFromProps||"function"==typeof i.getSnapshotBeforeUpdate||"function"!=typeof i.UNSAFE_componentWillMount&&"function"!=typeof i.componentWillMount||(t=i.state,"function"==typeof i.componentWillMount&&i.componentWillMount(),"function"==typeof i.UNSAFE_componentWillMount&&i.UNSAFE_componentWillMount(),t!==i.state&&Zp.enqueueReplaceState(i,i.state,null),zf(e,n,i,s),i.state=e.memoizedState),"function"==typeof i.componentDidMount&&(e.flags|=4194308)}function nv(e,t){try{var n="",s=t;do{n+=Aa(s),s=s.return}while(s);var i=n}catch(r){i="\nError generating stack: "+r.message+"\n"+r.stack}return{value:e,source:t,stack:i,digest:null}}function sv(e,t,n){return{value:e,source:null,stack:null!=n?n:null,digest:null!=t?t:null}}function iv(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var rv="function"==typeof WeakMap?WeakMap:Map;function ov(e,t,n){(n=Ef(-1,n)).tag=3,n.payload={element:null};var s=t.value;return n.callback=function(){Tg||(Tg=!0,Ig=s),iv(0,t)},n}function av(e,t,n){(n=Ef(-1,n)).tag=3;var s=e.type.getDerivedStateFromError;if("function"==typeof s){var i=t.value;n.payload=function(){return s(i)},n.callback=function(){iv(0,t)}}var r=e.stateNode;return null!==r&&"function"==typeof r.componentDidCatch&&(n.callback=function(){iv(0,t),"function"!=typeof s&&(null===Og?Og=new Set([this]):Og.add(this));var e=t.stack;this.componentDidCatch(t.value,{componentStack:null!==e?e:""})}),n}function lv(e,t,n){var s=e.pingCache;if(null===s){s=e.pingCache=new rv;var i=new Set;s.set(t,i)}else void 0===(i=s.get(t))&&(i=new Set,s.set(t,i));i.has(n)||(i.add(n),e=_m.bind(null,e,t,n),t.then(e,e))}function cv(e){do{var t;if((t=13===e.tag)&&(t=null===(t=e.memoizedState)||null!==t.dehydrated),t)return e;e=e.return}while(null!==e);return null}function hv(e,t,n,s,i){return 1&e.mode?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,1===n.tag&&(null===n.alternate?n.tag=17:((t=Ef(-1,1)).tag=2,Pf(n,t,1))),n.lanes|=1),e)}var uv=pa.ReactCurrentOwner,dv=!1;function fv(e,t,n,s){t.child=null===e?vf(t,null,n,s):pf(t,e.child,n,s)}function pv(e,t,n,s,i){n=n.render;var r=t.ref;return Sf(t,i),s=cp(e,t,n,s,r,i),n=hp(),null===e||dv?(Zd&&n&&Vd(t),t.flags|=1,fv(e,t,s,i),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Tv(e,t,i))}function vv(e,t,n,s,i){if(null===e){var r=n.type;return"function"!=typeof r||Cm(r)||void 0!==r.defaultProps||null!==n.compare||void 0!==n.defaultProps?((e=Nm(n.type,null,s,t,t.mode,i)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=r,gv(e,t,r,s,i))}if(r=e.child,0===(e.lanes&i)){var o=r.memoizedProps;if((n=null!==(n=n.compare)?n:tu)(o,s)&&e.ref===t.ref)return Tv(e,t,i)}return t.flags|=1,(e=jm(r,s)).ref=t.ref,e.return=t,t.child=e}function gv(e,t,n,s,i){if(null!==e){var r=e.memoizedProps;if(tu(r,s)&&e.ref===t.ref){if(dv=!1,t.pendingProps=s=r,0===(e.lanes&i))return t.lanes=e.lanes,Tv(e,t,i);131072&e.flags&&(dv=!0)}}return xv(e,t,n,s,i)}function mv(e,t,n){var s=t.pendingProps,i=s.children,r=null!==e?e.memoizedState:null;if("hidden"===s.mode)if(1&t.mode){if(!(1073741824&n))return e=null!==r?r.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,xd(jg,Cg),Cg|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},s=null!==r?r.baseLanes:n,xd(jg,Cg),Cg|=s}else t.memoizedState={baseLanes:0,cachePool:null,transitions:null},xd(jg,Cg),Cg|=n;else null!==r?(s=r.baseLanes|n,t.memoizedState=null):s=n,xd(jg,Cg),Cg|=s;return fv(e,t,i,n),t.child}function _v(e,t){var n=t.ref;(null===e&&null!==n||null!==e&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function xv(e,t,n,s,i){var r=Cd(n)?Sd:yd.current;return r=kd(t,r),Sf(t,i),n=cp(e,t,n,s,r,i),s=hp(),null===e||dv?(Zd&&s&&Vd(t),t.flags|=1,fv(e,t,n,i),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Tv(e,t,i))}function bv(e,t,n,s,i){if(Cd(n)){var r=!0;Bd(t)}else r=!1;if(Sf(t,i),null===t.stateNode)zv(e,t),Qp(t,n,s),tv(t,n,s,i),s=!0;else if(null===e){var o=t.stateNode,a=t.memoizedProps;o.props=a;var l=o.context,c=n.contextType;"object"==typeof c&&null!==c?c=kf(c):c=kd(t,c=Cd(n)?Sd:yd.current);var h=n.getDerivedStateFromProps,u="function"==typeof h||"function"==typeof o.getSnapshotBeforeUpdate;u||"function"!=typeof o.UNSAFE_componentWillReceiveProps&&"function"!=typeof o.componentWillReceiveProps||(a!==s||l!==c)&&ev(t,o,s,c),Bf=!1;var d=t.memoizedState;o.state=d,zf(t,s,o,i),l=t.memoizedState,a!==s||d!==l||wd.current||Bf?("function"==typeof h&&(Xp(t,n,h,s),l=t.memoizedState),(a=Bf||Jp(t,n,a,s,d,l,c))?(u||"function"!=typeof o.UNSAFE_componentWillMount&&"function"!=typeof o.componentWillMount||("function"==typeof o.componentWillMount&&o.componentWillMount(),"function"==typeof o.UNSAFE_componentWillMount&&o.UNSAFE_componentWillMount()),"function"==typeof o.componentDidMount&&(t.flags|=4194308)):("function"==typeof o.componentDidMount&&(t.flags|=4194308),t.memoizedProps=s,t.memoizedState=l),o.props=s,o.state=l,o.context=c,s=a):("function"==typeof o.componentDidMount&&(t.flags|=4194308),s=!1)}else{o=t.stateNode,Lf(e,t),a=t.memoizedProps,c=t.type===t.elementType?a:Gp(t.type,a),o.props=c,u=t.pendingProps,d=o.context,"object"==typeof(l=n.contextType)&&null!==l?l=kf(l):l=kd(t,l=Cd(n)?Sd:yd.current);var f=n.getDerivedStateFromProps;(h="function"==typeof f||"function"==typeof o.getSnapshotBeforeUpdate)||"function"!=typeof o.UNSAFE_componentWillReceiveProps&&"function"!=typeof o.componentWillReceiveProps||(a!==u||d!==l)&&ev(t,o,s,l),Bf=!1,d=t.memoizedState,o.state=d,zf(t,s,o,i);var p=t.memoizedState;a!==u||d!==p||wd.current||Bf?("function"==typeof f&&(Xp(t,n,f,s),p=t.memoizedState),(c=Bf||Jp(t,n,c,s,d,p,l)||!1)?(h||"function"!=typeof o.UNSAFE_componentWillUpdate&&"function"!=typeof o.componentWillUpdate||("function"==typeof o.componentWillUpdate&&o.componentWillUpdate(s,p,l),"function"==typeof o.UNSAFE_componentWillUpdate&&o.UNSAFE_componentWillUpdate(s,p,l)),"function"==typeof o.componentDidUpdate&&(t.flags|=4),"function"==typeof o.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!=typeof o.componentDidUpdate||a===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),"function"!=typeof o.getSnapshotBeforeUpdate||a===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=p),o.props=s,o.state=p,o.context=l,s=c):("function"!=typeof o.componentDidUpdate||a===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),"function"!=typeof o.getSnapshotBeforeUpdate||a===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),s=!1)}return yv(e,t,n,s,r,i)}function yv(e,t,n,s,i,r){_v(e,t);var o=!!(128&t.flags);if(!s&&!o)return i&&Dd(t,n,!1),Tv(e,t,r);s=t.stateNode,uv.current=t;var a=o&&"function"!=typeof n.getDerivedStateFromError?null:s.render();return t.flags|=1,null!==e&&o?(t.child=pf(t,e.child,null,r),t.child=pf(t,null,a,r)):fv(e,t,a,r),t.memoizedState=s.state,i&&Dd(t,n,!0),t.child}function wv(e){var t=e.stateNode;t.pendingContext?Nd(0,t.pendingContext,t.pendingContext!==t.context):t.context&&Nd(0,t.context,!1),Uf(e,t.containerInfo)}function Sv(e,t,n,s,i){return af(),lf(i),t.flags|=256,fv(e,t,n,s),t.child}var kv,Cv,jv,Nv,Mv={dehydrated:null,treeContext:null,retryLane:0};function Bv(e){return{baseLanes:e,cachePool:null,transitions:null}}function Dv(e,t,n){var s,i=t.pendingProps,r=Vf.current,o=!1,a=!!(128&t.flags);if((s=a)||(s=(null===e||null!==e.memoizedState)&&!!(2&r)),s?(o=!0,t.flags&=-129):null!==e&&null===e.memoizedState||(r|=1),xd(Vf,1&r),null===e)return nf(t),null!==(e=t.memoizedState)&&null!==(e=e.dehydrated)?(1&t.mode?"$!"===e.data?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(a=i.children,e=i.fallback,o?(i=t.mode,o=t.child,a={mode:"hidden",children:a},1&i||null===o?o=Bm(a,i,0,null):(o.childLanes=0,o.pendingProps=a),e=Mm(e,i,n,null),o.return=t,e.return=t,o.sibling=e,t.child=o,t.child.memoizedState=Bv(n),t.memoizedState=Mv,e):Lv(t,a));if(null!==(r=e.memoizedState)&&null!==(s=r.dehydrated))return function(e,t,n,s,i,r,o){if(n)return 256&t.flags?(t.flags&=-257,Ev(e,t,o,s=sv(Error(Qo(422))))):null!==t.memoizedState?(t.child=e.child,t.flags|=128,null):(r=s.fallback,i=t.mode,s=Bm({mode:"visible",children:s.children},i,0,null),(r=Mm(r,i,o,null)).flags|=2,s.return=t,r.return=t,s.sibling=r,t.child=s,1&t.mode&&pf(t,e.child,null,o),t.child.memoizedState=Bv(o),t.memoizedState=Mv,r);if(!(1&t.mode))return Ev(e,t,o,null);if("$!"===i.data){if(s=i.nextSibling&&i.nextSibling.dataset)var a=s.dgst;return s=a,Ev(e,t,o,s=sv(r=Error(Qo(419)),s,void 0))}if(a=0!==(o&e.childLanes),dv||a){if(null!==(s=wg)){switch(o&-o){case 4:i=2;break;case 16:i=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:i=32;break;case 536870912:i=268435456;break;default:i=0}0!==(i=0!==(i&(s.suspendedLanes|o))?0:i)&&i!==r.retryLane&&(r.retryLane=i,Mf(e,i),Gg(s,e,i,-1))}return lm(),Ev(e,t,o,s=sv(Error(Qo(421))))}return"$?"===i.data?(t.flags|=128,t.child=e.child,t=bm.bind(null,e),i._reactRetry=t,null):(e=r.treeContext,Xd=nd(i.nextSibling),Gd=t,Zd=!0,Jd=null,null!==e&&(Hd[Fd++]=Ud,Hd[Fd++]=Kd,Hd[Fd++]=Wd,Ud=e.id,Kd=e.overflow,Wd=t),t=Lv(t,s.children),t.flags|=4096,t)}(e,t,a,i,s,r,n);if(o){o=i.fallback,a=t.mode,s=(r=e.child).sibling;var l={mode:"hidden",children:i.children};return 1&a||t.child===r?(i=jm(r,l)).subtreeFlags=14680064&r.subtreeFlags:((i=t.child).childLanes=0,i.pendingProps=l,t.deletions=null),null!==s?o=jm(s,o):(o=Mm(o,a,n,null)).flags|=2,o.return=t,i.return=t,i.sibling=o,t.child=i,i=o,o=t.child,a=null===(a=e.child.memoizedState)?Bv(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},o.memoizedState=a,o.childLanes=e.childLanes&~n,t.memoizedState=Mv,i}return e=(o=e.child).sibling,i=jm(o,{mode:"visible",children:i.children}),!(1&t.mode)&&(i.lanes=n),i.return=t,i.sibling=null,null!==e&&(null===(n=t.deletions)?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=i,t.memoizedState=null,i}function Lv(e,t){return(t=Bm({mode:"visible",children:t},e.mode,0,null)).return=e,e.child=t}function Ev(e,t,n,s){return null!==s&&lf(s),pf(t,e.child,null,n),(e=Lv(t,t.pendingProps.children)).flags|=2,t.memoizedState=null,e}function Pv(e,t,n){e.lanes|=t;var s=e.alternate;null!==s&&(s.lanes|=t),wf(e.return,t,n)}function Rv(e,t,n,s,i){var r=e.memoizedState;null===r?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:n,tailMode:i}:(r.isBackwards=t,r.rendering=null,r.renderingStartTime=0,r.last=s,r.tail=n,r.tailMode=i)}function Av(e,t,n){var s=t.pendingProps,i=s.revealOrder,r=s.tail;if(fv(e,t,s.children,n),2&(s=Vf.current))s=1&s|2,t.flags|=128;else{if(null!==e&&128&e.flags)e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&Pv(e,n,t);else if(19===e.tag)Pv(e,n,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}s&=1}if(xd(Vf,s),1&t.mode)switch(i){case"forwards":for(n=t.child,i=null;null!==n;)null!==(e=n.alternate)&&null===Yf(e)&&(i=n),n=n.sibling;null===(n=i)?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Rv(t,!1,i,n,r);break;case"backwards":for(n=null,i=t.child,t.child=null;null!==i;){if(null!==(e=i.alternate)&&null===Yf(e)){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Rv(t,!0,n,null,r);break;case"together":Rv(t,!1,null,null,void 0);break;default:t.memoizedState=null}else t.memoizedState=null;return t.child}function zv(e,t){!(1&t.mode)&&null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Tv(e,t,n){if(null!==e&&(t.dependencies=e.dependencies),Bg|=t.lanes,0===(n&t.childLanes))return null;if(null!==e&&t.child!==e.child)throw Error(Qo(153));if(null!==t.child){for(n=jm(e=t.child,e.pendingProps),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=jm(e,e.pendingProps)).return=t;n.sibling=null}return t.child}function Iv(e,t){if(!Zd)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var s=null;null!==n;)null!==n.alternate&&(s=n),n=n.sibling;null===s?t||null===e.tail?e.tail=null:e.tail.sibling=null:s.sibling=null}}function Ov(e){var t=null!==e.alternate&&e.alternate.child===e.child,n=0,s=0;if(t)for(var i=e.child;null!==i;)n|=i.lanes|i.childLanes,s|=14680064&i.subtreeFlags,s|=14680064&i.flags,i.return=e,i=i.sibling;else for(i=e.child;null!==i;)n|=i.lanes|i.childLanes,s|=i.subtreeFlags,s|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=s,e.childLanes=n,t}function Hv(e,t,n){var s=t.pendingProps;switch(Yd(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ov(t),null;case 1:case 17:return Cd(t.type)&&jd(),Ov(t),null;case 3:return s=t.stateNode,Kf(),_d(wd),_d(yd),Xf(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),null!==e&&null!==e.child||(rf(t)?t.flags|=4:null===e||e.memoizedState.isDehydrated&&!(256&t.flags)||(t.flags|=1024,null!==Jd&&(Qg(Jd),Jd=null))),Cv(e,t),Ov(t),null;case 5:$f(t);var i=Wf(Ff.current);if(n=t.type,null!==e&&null!=t.stateNode)jv(e,t,n,s,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!s){if(null===t.stateNode)throw Error(Qo(166));return Ov(t),null}if(e=Wf(Of.current),rf(t)){s=t.stateNode,n=t.type;var r=t.memoizedProps;switch(s[rd]=t,s[od]=r,e=!!(1&t.mode),n){case"dialog":Eu("cancel",s),Eu("close",s);break;case"iframe":case"object":case"embed":Eu("load",s);break;case"video":case"audio":for(i=0;i<Mu.length;i++)Eu(Mu[i],s);break;case"source":Eu("error",s);break;case"img":case"image":case"link":Eu("error",s),Eu("load",s);break;case"details":Eu("toggle",s);break;case"input":Ka(s,r),Eu("invalid",s);break;case"select":s._wrapperState={wasMultiple:!!r.multiple},Eu("invalid",s);break;case"textarea":Ja(s,r),Eu("invalid",s)}for(var o in dl(n,r),i=null,r)if(r.hasOwnProperty(o)){var a=r[o];"children"===o?"string"==typeof a?s.textContent!==a&&(!0!==r.suppressHydrationWarning&&qu(s.textContent,a,e),i=["children",a]):"number"==typeof a&&s.textContent!==""+a&&(!0!==r.suppressHydrationWarning&&qu(s.textContent,a,e),i=["children",""+a]):ta.hasOwnProperty(o)&&null!=a&&"onScroll"===o&&Eu("scroll",s)}switch(n){case"input":Ha(s),Va(s,r,!0);break;case"textarea":Ha(s),el(s);break;case"select":case"option":break;default:"function"==typeof r.onClick&&(s.onclick=$u)}s=i,t.updateQueue=s,null!==s&&(t.flags|=4)}else{o=9===i.nodeType?i:i.ownerDocument,"http://www.w3.org/1999/xhtml"===e&&(e=tl(n)),"http://www.w3.org/1999/xhtml"===e?"script"===n?((e=o.createElement("div")).innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):"string"==typeof s.is?e=o.createElement(n,{is:s.is}):(e=o.createElement(n),"select"===n&&(o=e,s.multiple?o.multiple=!0:s.size&&(o.size=s.size))):e=o.createElementNS(e,n),e[rd]=t,e[od]=s,kv(e,t,!1,!1),t.stateNode=e;e:{switch(o=fl(n,s),n){case"dialog":Eu("cancel",e),Eu("close",e),i=s;break;case"iframe":case"object":case"embed":Eu("load",e),i=s;break;case"video":case"audio":for(i=0;i<Mu.length;i++)Eu(Mu[i],e);i=s;break;case"source":Eu("error",e),i=s;break;case"img":case"image":case"link":Eu("error",e),Eu("load",e),i=s;break;case"details":Eu("toggle",e),i=s;break;case"input":Ka(e,s),i=Ua(e,s),Eu("invalid",e);break;case"option":default:i=s;break;case"select":e._wrapperState={wasMultiple:!!s.multiple},i=La({},s,{value:void 0}),Eu("invalid",e);break;case"textarea":Ja(e,s),i=Za(e,s),Eu("invalid",e)}for(r in dl(n,i),a=i)if(a.hasOwnProperty(r)){var l=a[r];"style"===r?hl(e,l):"dangerouslySetInnerHTML"===r?null!=(l=l?l.__html:void 0)&&rl(e,l):"children"===r?"string"==typeof l?("textarea"!==n||""!==l)&&ol(e,l):"number"==typeof l&&ol(e,""+l):"suppressContentEditableWarning"!==r&&"suppressHydrationWarning"!==r&&"autoFocus"!==r&&(ta.hasOwnProperty(r)?null!=l&&"onScroll"===r&&Eu("scroll",e):null!=l&&fa(e,r,l,o))}switch(n){case"input":Ha(e),Va(e,s,!1);break;case"textarea":Ha(e),el(e);break;case"option":null!=s.value&&e.setAttribute("value",""+Ia(s.value));break;case"select":e.multiple=!!s.multiple,null!=(r=s.value)?Xa(e,!!s.multiple,r,!1):null!=s.defaultValue&&Xa(e,!!s.multiple,s.defaultValue,!0);break;default:"function"==typeof i.onClick&&(e.onclick=$u)}switch(n){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}}s&&(t.flags|=4)}null!==t.ref&&(t.flags|=512,t.flags|=2097152)}return Ov(t),null;case 6:if(e&&null!=t.stateNode)Nv(e,t,e.memoizedProps,s);else{if("string"!=typeof s&&null===t.stateNode)throw Error(Qo(166));if(n=Wf(Ff.current),Wf(Of.current),rf(t)){if(s=t.stateNode,n=t.memoizedProps,s[rd]=t,(r=s.nodeValue!==n)&&null!==(e=Gd))switch(e.tag){case 3:qu(s.nodeValue,n,!!(1&e.mode));break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&qu(s.nodeValue,n,!!(1&e.mode))}r&&(t.flags|=4)}else(s=(9===n.nodeType?n:n.ownerDocument).createTextNode(s))[rd]=t,t.stateNode=s}return Ov(t),null;case 13:if(_d(Vf),s=t.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(Zd&&null!==Xd&&1&t.mode&&!(128&t.flags))of(),af(),t.flags|=98560,r=!1;else if(r=rf(t),null!==s&&null!==s.dehydrated){if(null===e){if(!r)throw Error(Qo(318));if(!(r=null!==(r=t.memoizedState)?r.dehydrated:null))throw Error(Qo(317));r[rd]=t}else af(),!(128&t.flags)&&(t.memoizedState=null),t.flags|=4;Ov(t),r=!1}else null!==Jd&&(Qg(Jd),Jd=null),r=!0;if(!r)return 65536&t.flags?t:null}return 128&t.flags?(t.lanes=n,t):((s=null!==s)!==(null!==e&&null!==e.memoizedState)&&s&&(t.child.flags|=8192,1&t.mode&&(null===e||1&Vf.current?0===Ng&&(Ng=3):lm())),null!==t.updateQueue&&(t.flags|=4),Ov(t),null);case 4:return Kf(),Cv(e,t),null===e&&Au(t.stateNode.containerInfo),Ov(t),null;case 10:return yf(t.type._context),Ov(t),null;case 19:if(_d(Vf),null===(r=t.memoizedState))return Ov(t),null;if(s=!!(128&t.flags),null===(o=r.rendering))if(s)Iv(r,!1);else{if(0!==Ng||null!==e&&128&e.flags)for(e=t.child;null!==e;){if(null!==(o=Yf(e))){for(t.flags|=128,Iv(r,!1),null!==(s=o.updateQueue)&&(t.updateQueue=s,t.flags|=4),t.subtreeFlags=0,s=n,n=t.child;null!==n;)e=s,(r=n).flags&=14680066,null===(o=r.alternate)?(r.childLanes=0,r.lanes=e,r.child=null,r.subtreeFlags=0,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null):(r.childLanes=o.childLanes,r.lanes=o.lanes,r.child=o.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=o.memoizedProps,r.memoizedState=o.memoizedState,r.updateQueue=o.updateQueue,r.type=o.type,e=o.dependencies,r.dependencies=null===e?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return xd(Vf,1&Vf.current|2),t.child}e=e.sibling}null!==r.tail&&ql()>Ag&&(t.flags|=128,s=!0,Iv(r,!1),t.lanes=4194304)}else{if(!s)if(null!==(e=Yf(o))){if(t.flags|=128,s=!0,null!==(n=e.updateQueue)&&(t.updateQueue=n,t.flags|=4),Iv(r,!0),null===r.tail&&"hidden"===r.tailMode&&!o.alternate&&!Zd)return Ov(t),null}else 2*ql()-r.renderingStartTime>Ag&&1073741824!==n&&(t.flags|=128,s=!0,Iv(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(null!==(n=r.last)?n.sibling=o:t.child=o,r.last=o)}return null!==r.tail?(t=r.tail,r.rendering=t,r.tail=t.sibling,r.renderingStartTime=ql(),t.sibling=null,n=Vf.current,xd(Vf,s?1&n|2:1&n),t):(Ov(t),null);case 22:case 23:return im(),s=null!==t.memoizedState,null!==e&&null!==e.memoizedState!==s&&(t.flags|=8192),s&&1&t.mode?!!(1073741824&Cg)&&(Ov(t),6&t.subtreeFlags&&(t.flags|=8192)):Ov(t),null;case 24:case 25:return null}throw Error(Qo(156,t.tag))}function Fv(e,t){switch(Yd(t),t.tag){case 1:return Cd(t.type)&&jd(),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return Kf(),_d(wd),_d(yd),Xf(),65536&(e=t.flags)&&!(128&e)?(t.flags=-65537&e|128,t):null;case 5:return $f(t),null;case 13:if(_d(Vf),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(Qo(340));af()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return _d(Vf),null;case 4:return Kf(),null;case 10:return yf(t.type._context),null;case 22:case 23:return im(),null;default:return null}}kv=function(e,t){for(var n=t.child;null!==n;){if(5===n.tag||6===n.tag)e.appendChild(n.stateNode);else if(4!==n.tag&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===t)break;for(;null===n.sibling;){if(null===n.return||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},Cv=function(){},jv=function(e,t,n,s){var i=e.memoizedProps;if(i!==s){e=t.stateNode,Wf(Of.current);var r,o=null;switch(n){case"input":i=Ua(e,i),s=Ua(e,s),o=[];break;case"select":i=La({},i,{value:void 0}),s=La({},s,{value:void 0}),o=[];break;case"textarea":i=Za(e,i),s=Za(e,s),o=[];break;default:"function"!=typeof i.onClick&&"function"==typeof s.onClick&&(e.onclick=$u)}for(c in dl(n,s),n=null,i)if(!s.hasOwnProperty(c)&&i.hasOwnProperty(c)&&null!=i[c])if("style"===c){var a=i[c];for(r in a)a.hasOwnProperty(r)&&(n||(n={}),n[r]="")}else"dangerouslySetInnerHTML"!==c&&"children"!==c&&"suppressContentEditableWarning"!==c&&"suppressHydrationWarning"!==c&&"autoFocus"!==c&&(ta.hasOwnProperty(c)?o||(o=[]):(o=o||[]).push(c,null));for(c in s){var l=s[c];if(a=null!=i?i[c]:void 0,s.hasOwnProperty(c)&&l!==a&&(null!=l||null!=a))if("style"===c)if(a){for(r in a)!a.hasOwnProperty(r)||l&&l.hasOwnProperty(r)||(n||(n={}),n[r]="");for(r in l)l.hasOwnProperty(r)&&a[r]!==l[r]&&(n||(n={}),n[r]=l[r])}else n||(o||(o=[]),o.push(c,n)),n=l;else"dangerouslySetInnerHTML"===c?(l=l?l.__html:void 0,a=a?a.__html:void 0,null!=l&&a!==l&&(o=o||[]).push(c,l)):"children"===c?"string"!=typeof l&&"number"!=typeof l||(o=o||[]).push(c,""+l):"suppressContentEditableWarning"!==c&&"suppressHydrationWarning"!==c&&(ta.hasOwnProperty(c)?(null!=l&&"onScroll"===c&&Eu("scroll",e),o||a===l||(o=[])):(o=o||[]).push(c,l))}n&&(o=o||[]).push("style",n);var c=o;(t.updateQueue=c)&&(t.flags|=4)}},Nv=function(e,t,n,s){n!==s&&(t.flags|=4)};var Wv=!1,Uv=!1,Kv="function"==typeof WeakSet?WeakSet:Set,qv=null;function $v(e,t){var n=e.ref;if(null!==n)if("function"==typeof n)try{n(null)}catch(s){mm(e,t,s)}else n.current=null}function Vv(e,t,n){try{n()}catch(s){mm(e,t,s)}}var Yv=!1;function Gv(e,t,n){var s=t.updateQueue;if(null!==(s=null!==s?s.lastEffect:null)){var i=s=s.next;do{if((i.tag&e)===e){var r=i.destroy;i.destroy=void 0,void 0!==r&&Vv(t,n,r)}i=i.next}while(i!==s)}}function Xv(e,t){if(null!==(t=null!==(t=t.updateQueue)?t.lastEffect:null)){var n=t=t.next;do{if((n.tag&e)===e){var s=n.create;n.destroy=s()}n=n.next}while(n!==t)}}function Zv(e){var t=e.ref;if(null!==t){var n=e.stateNode;e.tag,e=n,"function"==typeof t?t(e):t.current=e}}function Jv(e){var t=e.alternate;null!==t&&(e.alternate=null,Jv(t)),e.child=null,e.deletions=null,e.sibling=null,5===e.tag&&(null!==(t=e.stateNode)&&(delete t[rd],delete t[od],delete t[ld],delete t[cd],delete t[hd])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Qv(e){return 5===e.tag||3===e.tag||4===e.tag}function eg(e){e:for(;;){for(;null===e.sibling;){if(null===e.return||Qv(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;5!==e.tag&&6!==e.tag&&18!==e.tag;){if(2&e.flags)continue e;if(null===e.child||4===e.tag)continue e;e.child.return=e,e=e.child}if(!(2&e.flags))return e.stateNode}}function tg(e,t,n){var s=e.tag;if(5===s||6===s)e=e.stateNode,t?8===n.nodeType?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(8===n.nodeType?(t=n.parentNode).insertBefore(e,n):(t=n).appendChild(e),null!=(n=n._reactRootContainer)||null!==t.onclick||(t.onclick=$u));else if(4!==s&&null!==(e=e.child))for(tg(e,t,n),e=e.sibling;null!==e;)tg(e,t,n),e=e.sibling}function ng(e,t,n){var s=e.tag;if(5===s||6===s)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(4!==s&&null!==(e=e.child))for(ng(e,t,n),e=e.sibling;null!==e;)ng(e,t,n),e=e.sibling}var sg=null,ig=!1;function rg(e,t,n){for(n=n.child;null!==n;)og(e,t,n),n=n.sibling}function og(e,t,n){if(Ql&&"function"==typeof Ql.onCommitFiberUnmount)try{Ql.onCommitFiberUnmount(Jl,n)}catch(a){}switch(n.tag){case 5:Uv||$v(n,t);case 6:var s=sg,i=ig;sg=null,rg(e,t,n),ig=i,null!==(sg=s)&&(ig?(e=sg,n=n.stateNode,8===e.nodeType?e.parentNode.removeChild(n):e.removeChild(n)):sg.removeChild(n.stateNode));break;case 18:null!==sg&&(ig?(e=sg,n=n.stateNode,8===e.nodeType?td(e.parentNode,n):1===e.nodeType&&td(e,n),zc(e)):td(sg,n.stateNode));break;case 4:s=sg,i=ig,sg=n.stateNode.containerInfo,ig=!0,rg(e,t,n),sg=s,ig=i;break;case 0:case 11:case 14:case 15:if(!Uv&&(null!==(s=n.updateQueue)&&null!==(s=s.lastEffect))){i=s=s.next;do{var r=i,o=r.destroy;r=r.tag,void 0!==o&&(2&r||4&r)&&Vv(n,t,o),i=i.next}while(i!==s)}rg(e,t,n);break;case 1:if(!Uv&&($v(n,t),"function"==typeof(s=n.stateNode).componentWillUnmount))try{s.props=n.memoizedProps,s.state=n.memoizedState,s.componentWillUnmount()}catch(a){mm(n,t,a)}rg(e,t,n);break;case 21:rg(e,t,n);break;case 22:1&n.mode?(Uv=(s=Uv)||null!==n.memoizedState,rg(e,t,n),Uv=s):rg(e,t,n);break;default:rg(e,t,n)}}function ag(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var n=e.stateNode;null===n&&(n=e.stateNode=new Kv),t.forEach(function(t){var s=ym.bind(null,e,t);n.has(t)||(n.add(t),t.then(s,s))})}}function lg(e,t){var n=t.deletions;if(null!==n)for(var s=0;s<n.length;s++){var i=n[s];try{var r=e,o=t,a=o;e:for(;null!==a;){switch(a.tag){case 5:sg=a.stateNode,ig=!1;break e;case 3:case 4:sg=a.stateNode.containerInfo,ig=!0;break e}a=a.return}if(null===sg)throw Error(Qo(160));og(r,o,i),sg=null,ig=!1;var l=i.alternate;null!==l&&(l.return=null),i.return=null}catch(c){mm(i,t,c)}}if(12854&t.subtreeFlags)for(t=t.child;null!==t;)cg(t,e),t=t.sibling}function cg(e,t){var n=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(lg(t,e),hg(e),4&s){try{Gv(3,e,e.return),Xv(3,e)}catch(JS){mm(e,e.return,JS)}try{Gv(5,e,e.return)}catch(JS){mm(e,e.return,JS)}}break;case 1:lg(t,e),hg(e),512&s&&null!==n&&$v(n,n.return);break;case 5:if(lg(t,e),hg(e),512&s&&null!==n&&$v(n,n.return),32&e.flags){var i=e.stateNode;try{ol(i,"")}catch(JS){mm(e,e.return,JS)}}if(4&s&&null!=(i=e.stateNode)){var r=e.memoizedProps,o=null!==n?n.memoizedProps:r,a=e.type,l=e.updateQueue;if(e.updateQueue=null,null!==l)try{"input"===a&&"radio"===r.type&&null!=r.name&&qa(i,r),fl(a,o);var c=fl(a,r);for(o=0;o<l.length;o+=2){var h=l[o],u=l[o+1];"style"===h?hl(i,u):"dangerouslySetInnerHTML"===h?rl(i,u):"children"===h?ol(i,u):fa(i,h,u,c)}switch(a){case"input":$a(i,r);break;case"textarea":Qa(i,r);break;case"select":var d=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!r.multiple;var f=r.value;null!=f?Xa(i,!!r.multiple,f,!1):d!==!!r.multiple&&(null!=r.defaultValue?Xa(i,!!r.multiple,r.defaultValue,!0):Xa(i,!!r.multiple,r.multiple?[]:"",!1))}i[od]=r}catch(JS){mm(e,e.return,JS)}}break;case 6:if(lg(t,e),hg(e),4&s){if(null===e.stateNode)throw Error(Qo(162));i=e.stateNode,r=e.memoizedProps;try{i.nodeValue=r}catch(JS){mm(e,e.return,JS)}}break;case 3:if(lg(t,e),hg(e),4&s&&null!==n&&n.memoizedState.isDehydrated)try{zc(t.containerInfo)}catch(JS){mm(e,e.return,JS)}break;case 4:default:lg(t,e),hg(e);break;case 13:lg(t,e),hg(e),8192&(i=e.child).flags&&(r=null!==i.memoizedState,i.stateNode.isHidden=r,!r||null!==i.alternate&&null!==i.alternate.memoizedState||(Rg=ql())),4&s&&ag(e);break;case 22:if(h=null!==n&&null!==n.memoizedState,1&e.mode?(Uv=(c=Uv)||h,lg(t,e),Uv=c):lg(t,e),hg(e),8192&s){if(c=null!==e.memoizedState,(e.stateNode.isHidden=c)&&!h&&1&e.mode)for(qv=e,h=e.child;null!==h;){for(u=qv=h;null!==qv;){switch(f=(d=qv).child,d.tag){case 0:case 11:case 14:case 15:Gv(4,d,d.return);break;case 1:$v(d,d.return);var p=d.stateNode;if("function"==typeof p.componentWillUnmount){s=d,n=d.return;try{t=s,p.props=t.memoizedProps,p.state=t.memoizedState,p.componentWillUnmount()}catch(JS){mm(s,n,JS)}}break;case 5:$v(d,d.return);break;case 22:if(null!==d.memoizedState){pg(u);continue}}null!==f?(f.return=d,qv=f):pg(u)}h=h.sibling}e:for(h=null,u=e;;){if(5===u.tag){if(null===h){h=u;try{i=u.stateNode,c?"function"==typeof(r=i.style).setProperty?r.setProperty("display","none","important"):r.display="none":(a=u.stateNode,o=null!=(l=u.memoizedProps.style)&&l.hasOwnProperty("display")?l.display:null,a.style.display=cl("display",o))}catch(JS){mm(e,e.return,JS)}}}else if(6===u.tag){if(null===h)try{u.stateNode.nodeValue=c?"":u.memoizedProps}catch(JS){mm(e,e.return,JS)}}else if((22!==u.tag&&23!==u.tag||null===u.memoizedState||u===e)&&null!==u.child){u.child.return=u,u=u.child;continue}if(u===e)break e;for(;null===u.sibling;){if(null===u.return||u.return===e)break e;h===u&&(h=null),u=u.return}h===u&&(h=null),u.sibling.return=u.return,u=u.sibling}}break;case 19:lg(t,e),hg(e),4&s&&ag(e);case 21:}}function hg(e){var t=e.flags;if(2&t){try{e:{for(var n=e.return;null!==n;){if(Qv(n)){var s=n;break e}n=n.return}throw Error(Qo(160))}switch(s.tag){case 5:var i=s.stateNode;32&s.flags&&(ol(i,""),s.flags&=-33),ng(e,eg(e),i);break;case 3:case 4:var r=s.stateNode.containerInfo;tg(e,eg(e),r);break;default:throw Error(Qo(161))}}catch(o){mm(e,e.return,o)}e.flags&=-3}4096&t&&(e.flags&=-4097)}function ug(e,t,n){qv=e,dg(e)}function dg(e,t,n){for(var s=!!(1&e.mode);null!==qv;){var i=qv,r=i.child;if(22===i.tag&&s){var o=null!==i.memoizedState||Wv;if(!o){var a=i.alternate,l=null!==a&&null!==a.memoizedState||Uv;a=Wv;var c=Uv;if(Wv=o,(Uv=l)&&!c)for(qv=i;null!==qv;)l=(o=qv).child,22===o.tag&&null!==o.memoizedState?vg(i):null!==l?(l.return=o,qv=l):vg(i);for(;null!==r;)qv=r,dg(r),r=r.sibling;qv=i,Wv=a,Uv=c}fg(e)}else 8772&i.subtreeFlags&&null!==r?(r.return=i,qv=r):fg(e)}}function fg(e){for(;null!==qv;){var t=qv;if(8772&t.flags){var n=t.alternate;try{if(8772&t.flags)switch(t.tag){case 0:case 11:case 15:Uv||Xv(5,t);break;case 1:var s=t.stateNode;if(4&t.flags&&!Uv)if(null===n)s.componentDidMount();else{var i=t.elementType===t.type?n.memoizedProps:Gp(t.type,n.memoizedProps);s.componentDidUpdate(i,n.memoizedState,s.__reactInternalSnapshotBeforeUpdate)}var r=t.updateQueue;null!==r&&Tf(t,r,s);break;case 3:var o=t.updateQueue;if(null!==o){if(n=null,null!==t.child)switch(t.child.tag){case 5:case 1:n=t.child.stateNode}Tf(t,o,n)}break;case 5:var a=t.stateNode;if(null===n&&4&t.flags){n=a;var l=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break;case"img":l.src&&(n.src=l.src)}}break;case 6:case 4:case 12:case 19:case 17:case 21:case 22:case 23:case 25:break;case 13:if(null===t.memoizedState){var c=t.alternate;if(null!==c){var h=c.memoizedState;if(null!==h){var u=h.dehydrated;null!==u&&zc(u)}}}break;default:throw Error(Qo(163))}Uv||512&t.flags&&Zv(t)}catch(yS){mm(t,t.return,yS)}}if(t===e){qv=null;break}if(null!==(n=t.sibling)){n.return=t.return,qv=n;break}qv=t.return}}function pg(e){for(;null!==qv;){var t=qv;if(t===e){qv=null;break}var n=t.sibling;if(null!==n){n.return=t.return,qv=n;break}qv=t.return}}function vg(e){for(;null!==qv;){var t=qv;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Xv(4,t)}catch(l){mm(t,n,l)}break;case 1:var s=t.stateNode;if("function"==typeof s.componentDidMount){var i=t.return;try{s.componentDidMount()}catch(l){mm(t,i,l)}}var r=t.return;try{Zv(t)}catch(l){mm(t,r,l)}break;case 5:var o=t.return;try{Zv(t)}catch(l){mm(t,o,l)}}}catch(l){mm(t,t.return,l)}if(t===e){qv=null;break}var a=t.sibling;if(null!==a){a.return=t.return,qv=a;break}qv=t.return}}var gg,mg=Math.ceil,_g=pa.ReactCurrentDispatcher,xg=pa.ReactCurrentOwner,bg=pa.ReactCurrentBatchConfig,yg=0,wg=null,Sg=null,kg=0,Cg=0,jg=md(0),Ng=0,Mg=null,Bg=0,Dg=0,Lg=0,Eg=null,Pg=null,Rg=0,Ag=1/0,zg=null,Tg=!1,Ig=null,Og=null,Hg=!1,Fg=null,Wg=0,Ug=0,Kg=null,qg=-1,$g=0;function Vg(){return 6&yg?ql():-1!==qg?qg:qg=ql()}function Yg(e){return 1&e.mode?2&yg&&0!==kg?kg&-kg:null!==cf.transition?(0===$g&&($g=cc()),$g):0!==(e=fc)?e:e=void 0===(e=window.event)?16:Kc(e.type):1}function Gg(e,t,n,s){if(50<Ug)throw Ug=0,Kg=null,Error(Qo(185));uc(e,n,s),2&yg&&e===wg||(e===wg&&(!(2&yg)&&(Dg|=n),4===Ng&&em(e,kg)),Xg(e,s),1===n&&0===yg&&!(1&t.mode)&&(Ag=ql()+500,Ed&&Ad()))}function Xg(e,t){var n=e.callbackNode;!function(e,t){for(var n=e.suspendedLanes,s=e.pingedLanes,i=e.expirationTimes,r=e.pendingLanes;0<r;){var o=31-ec(r),a=1<<o,l=i[o];-1===l?0!==(a&n)&&0===(a&s)||(i[o]=ac(a,t)):l<=t&&(e.expiredLanes|=a),r&=~a}}(e,t);var s=oc(e,e===wg?kg:0);if(0===s)null!==n&&Wl(n),e.callbackNode=null,e.callbackPriority=0;else if(t=s&-s,e.callbackPriority!==t){if(null!=n&&Wl(n),1===t)0===e.tag?function(e){Ed=!0,Rd(e)}(tm.bind(null,e)):Rd(tm.bind(null,e)),Qu(function(){!(6&yg)&&Ad()}),n=null;else{switch(pc(s)){case 1:n=Vl;break;case 4:n=Yl;break;case 16:default:n=Gl;break;case 536870912:n=Zl}n=wm(n,Zg.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Zg(e,t){if(qg=-1,$g=0,6&yg)throw Error(Qo(327));var n=e.callbackNode;if(vm()&&e.callbackNode!==n)return null;var s=oc(e,e===wg?kg:0);if(0===s)return null;if(30&s||0!==(s&e.expiredLanes)||t)t=cm(e,s);else{t=s;var i=yg;yg|=2;var r=am();for(wg===e&&kg===t||(zg=null,Ag=ql()+500,rm(e,t));;)try{um();break}catch(a){om(e,a)}bf(),_g.current=r,yg=i,null!==Sg?t=0:(wg=null,kg=0,t=Ng)}if(0!==t){if(2===t&&(0!==(i=lc(e))&&(s=i,t=Jg(e,i))),1===t)throw n=Mg,rm(e,0),em(e,s),Xg(e,ql()),n;if(6===t)em(e,s);else{if(i=e.current.alternate,!(30&s||function(e){for(var t=e;;){if(16384&t.flags){var n=t.updateQueue;if(null!==n&&null!==(n=n.stores))for(var s=0;s<n.length;s++){var i=n[s],r=i.getSnapshot;i=i.value;try{if(!eu(r(),i))return!1}catch(o){return!1}}}if(n=t.child,16384&t.subtreeFlags&&null!==n)n.return=t,t=n;else{if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}(i)||(t=cm(e,s),2===t&&(r=lc(e),0!==r&&(s=r,t=Jg(e,r))),1!==t)))throw n=Mg,rm(e,0),em(e,s),Xg(e,ql()),n;switch(e.finishedWork=i,e.finishedLanes=s,t){case 0:case 1:throw Error(Qo(345));case 2:case 5:pm(e,Pg,zg);break;case 3:if(em(e,s),(130023424&s)===s&&10<(t=Rg+500-ql())){if(0!==oc(e,0))break;if(((i=e.suspendedLanes)&s)!==s){Vg(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=Xu(pm.bind(null,e,Pg,zg),t);break}pm(e,Pg,zg);break;case 4:if(em(e,s),(4194240&s)===s)break;for(t=e.eventTimes,i=-1;0<s;){var o=31-ec(s);r=1<<o,(o=t[o])>i&&(i=o),s&=~r}if(s=i,10<(s=(120>(s=ql()-s)?120:480>s?480:1080>s?1080:1920>s?1920:3e3>s?3e3:4320>s?4320:1960*mg(s/1960))-s)){e.timeoutHandle=Xu(pm.bind(null,e,Pg,zg),s);break}pm(e,Pg,zg);break;default:throw Error(Qo(329))}}}return Xg(e,ql()),e.callbackNode===n?Zg.bind(null,e):null}function Jg(e,t){var n=Eg;return e.current.memoizedState.isDehydrated&&(rm(e,t).flags|=256),2!==(e=cm(e,t))&&(t=Pg,Pg=n,null!==t&&Qg(t)),e}function Qg(e){null===Pg?Pg=e:Pg.push.apply(Pg,e)}function em(e,t){for(t&=~Lg,t&=~Dg,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-ec(t),s=1<<n;e[n]=-1,t&=~s}}function tm(e){if(6&yg)throw Error(Qo(327));vm();var t=oc(e,0);if(!(1&t))return Xg(e,ql()),null;var n=cm(e,t);if(0!==e.tag&&2===n){var s=lc(e);0!==s&&(t=s,n=Jg(e,s))}if(1===n)throw n=Mg,rm(e,0),em(e,t),Xg(e,ql()),n;if(6===n)throw Error(Qo(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,pm(e,Pg,zg),Xg(e,ql()),null}function nm(e,t){var n=yg;yg|=1;try{return e(t)}finally{0===(yg=n)&&(Ag=ql()+500,Ed&&Ad())}}function sm(e){null!==Fg&&0===Fg.tag&&!(6&yg)&&vm();var t=yg;yg|=1;var n=bg.transition,s=fc;try{if(bg.transition=null,fc=1,e)return e()}finally{fc=s,bg.transition=n,!(6&(yg=t))&&Ad()}}function im(){Cg=jg.current,_d(jg)}function rm(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(-1!==n&&(e.timeoutHandle=-1,Zu(n)),null!==Sg)for(n=Sg.return;null!==n;){var s=n;switch(Yd(s),s.tag){case 1:null!=(s=s.type.childContextTypes)&&jd();break;case 3:Kf(),_d(wd),_d(yd),Xf();break;case 5:$f(s);break;case 4:Kf();break;case 13:case 19:_d(Vf);break;case 10:yf(s.type._context);break;case 22:case 23:im()}n=n.return}if(wg=e,Sg=e=jm(e.current,null),kg=Cg=t,Ng=0,Mg=null,Lg=Dg=Bg=0,Pg=Eg=null,null!==Cf){for(t=0;t<Cf.length;t++)if(null!==(s=(n=Cf[t]).interleaved)){n.interleaved=null;var i=s.next,r=n.pending;if(null!==r){var o=r.next;r.next=i,s.next=o}n.pending=s}Cf=null}return e}function om(e,t){for(;;){var n=Sg;try{if(bf(),Zf.current=qp,sp){for(var s=ep.memoizedState;null!==s;){var i=s.queue;null!==i&&(i.pending=null),s=s.next}sp=!1}if(Qf=0,np=tp=ep=null,ip=!1,rp=0,xg.current=null,null===n||null===n.return){Ng=1,Mg=t,Sg=null;break}e:{var r=e,o=n.return,a=n,l=t;if(t=kg,a.flags|=32768,null!==l&&"object"==typeof l&&"function"==typeof l.then){var c=l,h=a,u=h.tag;if(!(1&h.mode||0!==u&&11!==u&&15!==u)){var d=h.alternate;d?(h.updateQueue=d.updateQueue,h.memoizedState=d.memoizedState,h.lanes=d.lanes):(h.updateQueue=null,h.memoizedState=null)}var f=cv(o);if(null!==f){f.flags&=-257,hv(f,o,a,0,t),1&f.mode&&lv(r,c,t),l=c;var p=(t=f).updateQueue;if(null===p){var v=new Set;v.add(l),t.updateQueue=v}else p.add(l);break e}if(!(1&t)){lv(r,c,t),lm();break e}l=Error(Qo(426))}else if(Zd&&1&a.mode){var g=cv(o);if(null!==g){!(65536&g.flags)&&(g.flags|=256),hv(g,o,a,0,t),lf(nv(l,a));break e}}r=l=nv(l,a),4!==Ng&&(Ng=2),null===Eg?Eg=[r]:Eg.push(r),r=o;do{switch(r.tag){case 3:r.flags|=65536,t&=-t,r.lanes|=t,Af(r,ov(0,l,t));break e;case 1:a=l;var m=r.type,_=r.stateNode;if(!(128&r.flags||"function"!=typeof m.getDerivedStateFromError&&(null===_||"function"!=typeof _.componentDidCatch||null!==Og&&Og.has(_)))){r.flags|=65536,t&=-t,r.lanes|=t,Af(r,av(r,a,t));break e}}r=r.return}while(null!==r)}fm(n)}catch(x){t=x,Sg===n&&null!==n&&(Sg=n=n.return);continue}break}}function am(){var e=_g.current;return _g.current=qp,null===e?qp:e}function lm(){0!==Ng&&3!==Ng&&2!==Ng||(Ng=4),null===wg||!(268435455&Bg)&&!(268435455&Dg)||em(wg,kg)}function cm(e,t){var n=yg;yg|=2;var s=am();for(wg===e&&kg===t||(zg=null,rm(e,t));;)try{hm();break}catch(i){om(e,i)}if(bf(),yg=n,_g.current=s,null!==Sg)throw Error(Qo(261));return wg=null,kg=0,Ng}function hm(){for(;null!==Sg;)dm(Sg)}function um(){for(;null!==Sg&&!Ul();)dm(Sg)}function dm(e){var t=gg(e.alternate,e,Cg);e.memoizedProps=e.pendingProps,null===t?fm(e):Sg=t,xg.current=null}function fm(e){var t=e;do{var n=t.alternate;if(e=t.return,32768&t.flags){if(null!==(n=Fv(n,t)))return n.flags&=32767,void(Sg=n);if(null===e)return Ng=6,void(Sg=null);e.flags|=32768,e.subtreeFlags=0,e.deletions=null}else if(null!==(n=Hv(n,t,Cg)))return void(Sg=n);if(null!==(t=t.sibling))return void(Sg=t);Sg=t=e}while(null!==t);0===Ng&&(Ng=5)}function pm(e,t,n){var s=fc,i=bg.transition;try{bg.transition=null,fc=1,function(e,t,n,s){do{vm()}while(null!==Fg);if(6&yg)throw Error(Qo(327));n=e.finishedWork;var i=e.finishedLanes;if(null===n)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(Qo(177));e.callbackNode=null,e.callbackPriority=0;var r=n.lanes|n.childLanes;if(function(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var s=e.eventTimes;for(e=e.expirationTimes;0<n;){var i=31-ec(n),r=1<<i;t[i]=0,s[i]=-1,e[i]=-1,n&=~r}}(e,r),e===wg&&(Sg=wg=null,kg=0),!(2064&n.subtreeFlags)&&!(2064&n.flags)||Hg||(Hg=!0,wm(Gl,function(){return vm(),null})),r=!!(15990&n.flags),!!(15990&n.subtreeFlags)||r){r=bg.transition,bg.transition=null;var o=fc;fc=1;var a=yg;yg|=4,xg.current=null,function(e,t){if(Vu=Ic,ou(e=ru())){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{var s=(n=(n=e.ownerDocument)&&n.defaultView||window).getSelection&&n.getSelection();if(s&&0!==s.rangeCount){n=s.anchorNode;var i=s.anchorOffset,r=s.focusNode;s=s.focusOffset;try{n.nodeType,r.nodeType}catch(b){n=null;break e}var o=0,a=-1,l=-1,c=0,h=0,u=e,d=null;t:for(;;){for(var f;u!==n||0!==i&&3!==u.nodeType||(a=o+i),u!==r||0!==s&&3!==u.nodeType||(l=o+s),3===u.nodeType&&(o+=u.nodeValue.length),null!==(f=u.firstChild);)d=u,u=f;for(;;){if(u===e)break t;if(d===n&&++c===i&&(a=o),d===r&&++h===s&&(l=o),null!==(f=u.nextSibling))break;d=(u=d).parentNode}u=f}n=-1===a||-1===l?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(Yu={focusedElem:e,selectionRange:n},Ic=!1,qv=t;null!==qv;)if(e=(t=qv).child,1028&t.subtreeFlags&&null!==e)e.return=t,qv=e;else for(;null!==qv;){t=qv;try{var p=t.alternate;if(1024&t.flags)switch(t.tag){case 0:case 11:case 15:case 5:case 6:case 4:case 17:break;case 1:if(null!==p){var v=p.memoizedProps,g=p.memoizedState,m=t.stateNode,_=m.getSnapshotBeforeUpdate(t.elementType===t.type?v:Gp(t.type,v),g);m.__reactInternalSnapshotBeforeUpdate=_}break;case 3:var x=t.stateNode.containerInfo;1===x.nodeType?x.textContent="":9===x.nodeType&&x.documentElement&&x.removeChild(x.documentElement);break;default:throw Error(Qo(163))}}catch(b){mm(t,t.return,b)}if(null!==(e=t.sibling)){e.return=t.return,qv=e;break}qv=t.return}p=Yv,Yv=!1}(e,n),cg(n,e),au(Yu),Ic=!!Vu,Yu=Vu=null,e.current=n,ug(n),Kl(),yg=a,fc=o,bg.transition=r}else e.current=n;if(Hg&&(Hg=!1,Fg=e,Wg=i),r=e.pendingLanes,0===r&&(Og=null),function(e){if(Ql&&"function"==typeof Ql.onCommitFiberRoot)try{Ql.onCommitFiberRoot(Jl,e,void 0,!(128&~e.current.flags))}catch(t){}}(n.stateNode),Xg(e,ql()),null!==t)for(s=e.onRecoverableError,n=0;n<t.length;n++)i=t[n],s(i.value,{componentStack:i.stack,digest:i.digest});if(Tg)throw Tg=!1,e=Ig,Ig=null,e;!!(1&Wg)&&0!==e.tag&&vm(),r=e.pendingLanes,1&r?e===Kg?Ug++:(Ug=0,Kg=e):Ug=0,Ad()}(e,t,n,s)}finally{bg.transition=i,fc=s}return null}function vm(){if(null!==Fg){var e=pc(Wg),t=bg.transition,n=fc;try{if(bg.transition=null,fc=16>e?16:e,null===Fg)var s=!1;else{if(e=Fg,Fg=null,Wg=0,6&yg)throw Error(Qo(331));var i=yg;for(yg|=4,qv=e.current;null!==qv;){var r=qv,o=r.child;if(16&qv.flags){var a=r.deletions;if(null!==a){for(var l=0;l<a.length;l++){var c=a[l];for(qv=c;null!==qv;){var h=qv;switch(h.tag){case 0:case 11:case 15:Gv(8,h,r)}var u=h.child;if(null!==u)u.return=h,qv=u;else for(;null!==qv;){var d=(h=qv).sibling,f=h.return;if(Jv(h),h===c){qv=null;break}if(null!==d){d.return=f,qv=d;break}qv=f}}}var p=r.alternate;if(null!==p){var v=p.child;if(null!==v){p.child=null;do{var g=v.sibling;v.sibling=null,v=g}while(null!==v)}}qv=r}}if(2064&r.subtreeFlags&&null!==o)o.return=r,qv=o;else e:for(;null!==qv;){if(2048&(r=qv).flags)switch(r.tag){case 0:case 11:case 15:Gv(9,r,r.return)}var m=r.sibling;if(null!==m){m.return=r.return,qv=m;break e}qv=r.return}}var _=e.current;for(qv=_;null!==qv;){var x=(o=qv).child;if(2064&o.subtreeFlags&&null!==x)x.return=o,qv=x;else e:for(o=_;null!==qv;){if(2048&(a=qv).flags)try{switch(a.tag){case 0:case 11:case 15:Xv(9,a)}}catch(y){mm(a,a.return,y)}if(a===o){qv=null;break e}var b=a.sibling;if(null!==b){b.return=a.return,qv=b;break e}qv=a.return}}if(yg=i,Ad(),Ql&&"function"==typeof Ql.onPostCommitFiberRoot)try{Ql.onPostCommitFiberRoot(Jl,e)}catch(y){}s=!0}return s}finally{fc=n,bg.transition=t}}return!1}function gm(e,t,n){e=Pf(e,t=ov(0,t=nv(n,t),1),1),t=Vg(),null!==e&&(uc(e,1,t),Xg(e,t))}function mm(e,t,n){if(3===e.tag)gm(e,e,n);else for(;null!==t;){if(3===t.tag){gm(t,e,n);break}if(1===t.tag){var s=t.stateNode;if("function"==typeof t.type.getDerivedStateFromError||"function"==typeof s.componentDidCatch&&(null===Og||!Og.has(s))){t=Pf(t,e=av(t,e=nv(n,e),1),1),e=Vg(),null!==t&&(uc(t,1,e),Xg(t,e));break}}t=t.return}}function _m(e,t,n){var s=e.pingCache;null!==s&&s.delete(t),t=Vg(),e.pingedLanes|=e.suspendedLanes&n,wg===e&&(kg&n)===n&&(4===Ng||3===Ng&&(130023424&kg)===kg&&500>ql()-Rg?rm(e,0):Lg|=n),Xg(e,t)}function xm(e,t){0===t&&(1&e.mode?(t=ic,!(130023424&(ic<<=1))&&(ic=4194304)):t=1);var n=Vg();null!==(e=Mf(e,t))&&(uc(e,t,n),Xg(e,n))}function bm(e){var t=e.memoizedState,n=0;null!==t&&(n=t.retryLane),xm(e,n)}function ym(e,t){var n=0;switch(e.tag){case 13:var s=e.stateNode,i=e.memoizedState;null!==i&&(n=i.retryLane);break;case 19:s=e.stateNode;break;default:throw Error(Qo(314))}null!==s&&s.delete(t),xm(e,n)}function wm(e,t){return Fl(e,t)}function Sm(e,t,n,s){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function km(e,t,n,s){return new Sm(e,t,n,s)}function Cm(e){return!(!(e=e.prototype)||!e.isReactComponent)}function jm(e,t){var n=e.alternate;return null===n?((n=km(e.tag,t,e.key,e.mode)).elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=14680064&e.flags,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Nm(e,t,n,s,i,r){var o=2;if(s=e,"function"==typeof e)Cm(e)&&(o=1);else if("string"==typeof e)o=5;else e:switch(e){case ma:return Mm(n.children,i,r,t);case _a:o=8,i|=8;break;case xa:return(e=km(12,n,t,2|i)).elementType=xa,e.lanes=r,e;case Sa:return(e=km(13,n,t,i)).elementType=Sa,e.lanes=r,e;case ka:return(e=km(19,n,t,i)).elementType=ka,e.lanes=r,e;case Na:return Bm(n,i,r,t);default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case ba:o=10;break e;case ya:o=9;break e;case wa:o=11;break e;case Ca:o=14;break e;case ja:o=16,s=null;break e}throw Error(Qo(130,null==e?e:typeof e,""))}return(t=km(o,n,t,i)).elementType=e,t.type=s,t.lanes=r,t}function Mm(e,t,n,s){return(e=km(7,e,s,t)).lanes=n,e}function Bm(e,t,n,s){return(e=km(22,e,s,t)).elementType=Na,e.lanes=n,e.stateNode={isHidden:!1},e}function Dm(e,t,n){return(e=km(6,e,null,t)).lanes=n,e}function Lm(e,t,n){return(t=km(4,null!==e.children?e.children:[],e.key,t)).lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Em(e,t,n,s,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=hc(0),this.expirationTimes=hc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=hc(0),this.identifierPrefix=s,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Pm(e,t,n,s,i,r,o,a,l){return e=new Em(e,t,n,a,l),1===t?(t=1,!0===r&&(t|=8)):t=0,r=km(3,null,null,t),e.current=r,r.stateNode=e,r.memoizedState={element:s,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Df(r),e}function Rm(e){if(!e)return bd;e:{if(zl(e=e._reactInternals)!==e||1!==e.tag)throw Error(Qo(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Cd(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(null!==t);throw Error(Qo(171))}if(1===e.tag){var n=e.type;if(Cd(n))return Md(e,n,t)}return t}function Am(e,t,n,s,i,r,o,a,l){return(e=Pm(n,s,!0,e,0,r,0,a,l)).context=Rm(null),n=e.current,(r=Ef(s=Vg(),i=Yg(n))).callback=null!=t?t:null,Pf(n,r,i),e.current.lanes=i,uc(e,i,s),Xg(e,s),e}function zm(e,t,n,s){var i=t.current,r=Vg(),o=Yg(i);return n=Rm(n),null===t.context?t.context=n:t.pendingContext=n,(t=Ef(r,o)).payload={element:e},null!==(s=void 0===s?null:s)&&(t.callback=s),null!==(e=Pf(i,t,o))&&(Gg(e,i,o,r),Rf(e,i,o)),o}function Tm(e){return(e=e.current).child?(e.child.tag,e.child.stateNode):null}function Im(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n<t?n:t}}function Om(e,t){Im(e,t),(e=e.alternate)&&Im(e,t)}gg=function(e,t,n){if(null!==e)if(e.memoizedProps!==t.pendingProps||wd.current)dv=!0;else{if(0===(e.lanes&n)&&!(128&t.flags))return dv=!1,function(e,t,n){switch(t.tag){case 3:wv(t),af();break;case 5:qf(t);break;case 1:Cd(t.type)&&Bd(t);break;case 4:Uf(t,t.stateNode.containerInfo);break;case 10:var s=t.type._context,i=t.memoizedProps.value;xd(gf,s._currentValue),s._currentValue=i;break;case 13:if(null!==(s=t.memoizedState))return null!==s.dehydrated?(xd(Vf,1&Vf.current),t.flags|=128,null):0!==(n&t.child.childLanes)?Dv(e,t,n):(xd(Vf,1&Vf.current),null!==(e=Tv(e,t,n))?e.sibling:null);xd(Vf,1&Vf.current);break;case 19:if(s=0!==(n&t.childLanes),128&e.flags){if(s)return Av(e,t,n);t.flags|=128}if(null!==(i=t.memoizedState)&&(i.rendering=null,i.tail=null,i.lastEffect=null),xd(Vf,Vf.current),s)break;return null;case 22:case 23:return t.lanes=0,mv(e,t,n)}return Tv(e,t,n)}(e,t,n);dv=!!(131072&e.flags)}else dv=!1,Zd&&1048576&t.flags&&$d(t,Od,t.index);switch(t.lanes=0,t.tag){case 2:var s=t.type;zv(e,t),e=t.pendingProps;var i=kd(t,yd.current);Sf(t,n),i=cp(null,t,s,e,i,n);var r=hp();return t.flags|=1,"object"==typeof i&&null!==i&&"function"==typeof i.render&&void 0===i.$$typeof?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Cd(s)?(r=!0,Bd(t)):r=!1,t.memoizedState=null!==i.state&&void 0!==i.state?i.state:null,Df(t),i.updater=Zp,t.stateNode=i,i._reactInternals=t,tv(t,s,e,n),t=yv(null,t,s,!0,r,n)):(t.tag=0,Zd&&r&&Vd(t),fv(null,t,i,n),t=t.child),t;case 16:s=t.elementType;e:{switch(zv(e,t),e=t.pendingProps,s=(i=s._init)(s._payload),t.type=s,i=t.tag=function(e){if("function"==typeof e)return Cm(e)?1:0;if(null!=e){if((e=e.$$typeof)===wa)return 11;if(e===Ca)return 14}return 2}(s),e=Gp(s,e),i){case 0:t=xv(null,t,s,e,n);break e;case 1:t=bv(null,t,s,e,n);break e;case 11:t=pv(null,t,s,e,n);break e;case 14:t=vv(null,t,s,Gp(s.type,e),n);break e}throw Error(Qo(306,s,""))}return t;case 0:return s=t.type,i=t.pendingProps,xv(e,t,s,i=t.elementType===s?i:Gp(s,i),n);case 1:return s=t.type,i=t.pendingProps,bv(e,t,s,i=t.elementType===s?i:Gp(s,i),n);case 3:e:{if(wv(t),null===e)throw Error(Qo(387));s=t.pendingProps,i=(r=t.memoizedState).element,Lf(e,t),zf(t,s,null,n);var o=t.memoizedState;if(s=o.element,r.isDehydrated){if(r={element:s,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=r,t.memoizedState=r,256&t.flags){t=Sv(e,t,s,n,i=nv(Error(Qo(423)),t));break e}if(s!==i){t=Sv(e,t,s,n,i=nv(Error(Qo(424)),t));break e}for(Xd=nd(t.stateNode.containerInfo.firstChild),Gd=t,Zd=!0,Jd=null,n=vf(t,null,s,n),t.child=n;n;)n.flags=-3&n.flags|4096,n=n.sibling}else{if(af(),s===i){t=Tv(e,t,n);break e}fv(e,t,s,n)}t=t.child}return t;case 5:return qf(t),null===e&&nf(t),s=t.type,i=t.pendingProps,r=null!==e?e.memoizedProps:null,o=i.children,Gu(s,i)?o=null:null!==r&&Gu(s,r)&&(t.flags|=32),_v(e,t),fv(e,t,o,n),t.child;case 6:return null===e&&nf(t),null;case 13:return Dv(e,t,n);case 4:return Uf(t,t.stateNode.containerInfo),s=t.pendingProps,null===e?t.child=pf(t,null,s,n):fv(e,t,s,n),t.child;case 11:return s=t.type,i=t.pendingProps,pv(e,t,s,i=t.elementType===s?i:Gp(s,i),n);case 7:return fv(e,t,t.pendingProps,n),t.child;case 8:case 12:return fv(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(s=t.type._context,i=t.pendingProps,r=t.memoizedProps,o=i.value,xd(gf,s._currentValue),s._currentValue=o,null!==r)if(eu(r.value,o)){if(r.children===i.children&&!wd.current){t=Tv(e,t,n);break e}}else for(null!==(r=t.child)&&(r.return=t);null!==r;){var a=r.dependencies;if(null!==a){o=r.child;for(var l=a.firstContext;null!==l;){if(l.context===s){if(1===r.tag){(l=Ef(-1,n&-n)).tag=2;var c=r.updateQueue;if(null!==c){var h=(c=c.shared).pending;null===h?l.next=l:(l.next=h.next,h.next=l),c.pending=l}}r.lanes|=n,null!==(l=r.alternate)&&(l.lanes|=n),wf(r.return,n,t),a.lanes|=n;break}l=l.next}}else if(10===r.tag)o=r.type===t.type?null:r.child;else if(18===r.tag){if(null===(o=r.return))throw Error(Qo(341));o.lanes|=n,null!==(a=o.alternate)&&(a.lanes|=n),wf(o,n,t),o=r.sibling}else o=r.child;if(null!==o)o.return=r;else for(o=r;null!==o;){if(o===t){o=null;break}if(null!==(r=o.sibling)){r.return=o.return,o=r;break}o=o.return}r=o}fv(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,s=t.pendingProps.children,Sf(t,n),s=s(i=kf(i)),t.flags|=1,fv(e,t,s,n),t.child;case 14:return i=Gp(s=t.type,t.pendingProps),vv(e,t,s,i=Gp(s.type,i),n);case 15:return gv(e,t,t.type,t.pendingProps,n);case 17:return s=t.type,i=t.pendingProps,i=t.elementType===s?i:Gp(s,i),zv(e,t),t.tag=1,Cd(s)?(e=!0,Bd(t)):e=!1,Sf(t,n),Qp(t,s,i),tv(t,s,i,n),yv(null,t,s,!0,e,n);case 19:return Av(e,t,n);case 22:return mv(e,t,n)}throw Error(Qo(156,t.tag))};var Hm="function"==typeof reportError?reportError:function(e){console.error(e)};function Fm(e){this._internalRoot=e}function Wm(e){this._internalRoot=e}function Um(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType)}function Km(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType&&(8!==e.nodeType||" react-mount-point-unstable "!==e.nodeValue))}function qm(){}function $m(e,t,n,s,i){var r=n._reactRootContainer;if(r){var o=r;if("function"==typeof i){var a=i;i=function(){var e=Tm(o);a.call(e)}}zm(t,o,e,i)}else o=function(e,t,n,s,i){if(i){if("function"==typeof s){var r=s;s=function(){var e=Tm(o);r.call(e)}}var o=Am(t,s,e,0,null,!1,0,"",qm);return e._reactRootContainer=o,e[ad]=o.current,Au(8===e.nodeType?e.parentNode:e),sm(),o}for(;i=e.lastChild;)e.removeChild(i);if("function"==typeof s){var a=s;s=function(){var e=Tm(l);a.call(e)}}var l=Pm(e,0,!1,null,0,!1,0,"",qm);return e._reactRootContainer=l,e[ad]=l.current,Au(8===e.nodeType?e.parentNode:e),sm(function(){zm(t,l,n,s)}),l}(n,t,e,i,s);return Tm(o)}Wm.prototype.render=Fm.prototype.render=function(e){var t=this._internalRoot;if(null===t)throw Error(Qo(409));zm(e,t,null,null)},Wm.prototype.unmount=Fm.prototype.unmount=function(){var e=this._internalRoot;if(null!==e){this._internalRoot=null;var t=e.containerInfo;sm(function(){zm(null,e,null,null)}),t[ad]=null}},Wm.prototype.unstable_scheduleHydration=function(e){if(e){var t=_c();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Nc.length&&0!==t&&t<Nc[n].priority;n++);Nc.splice(n,0,e),0===n&&Lc(e)}},vc=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=rc(t.pendingLanes);0!==n&&(dc(t,1|n),Xg(t,ql()),!(6&yg)&&(Ag=ql()+500,Ad()))}break;case 13:sm(function(){var t=Mf(e,1);if(null!==t){var n=Vg();Gg(t,e,1,n)}}),Om(e,1)}},gc=function(e){if(13===e.tag){var t=Mf(e,134217728);if(null!==t)Gg(t,e,134217728,Vg());Om(e,134217728)}},mc=function(e){if(13===e.tag){var t=Yg(e),n=Mf(e,t);if(null!==n)Gg(n,e,t,Vg());Om(e,t)}},_c=function(){return fc},xc=function(e,t){var n=fc;try{return fc=e,t()}finally{fc=n}},gl=function(e,t,n){switch(t){case"input":if($a(e,n),t=n.name,"radio"===n.type&&null!=t){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var s=n[t];if(s!==e&&s.form===e.form){var i=pd(s);if(!i)throw Error(Qo(90));Fa(s),$a(s,i)}}}break;case"textarea":Qa(e,n);break;case"select":null!=(t=n.value)&&Xa(e,!!n.multiple,t,!1)}},wl=nm,Sl=sm;var Vm={usingClientEntryPoint:!1,Events:[dd,fd,pd,bl,yl,nm]},Ym={findFiberByHostInstance:ud,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Gm={bundleType:Ym.bundleType,version:Ym.version,rendererPackageName:Ym.rendererPackageName,rendererConfig:Ym.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:pa.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return null===(e=Ol(e))?null:e.stateNode},findFiberByHostInstance:Ym.findFiberByHostInstance||function(){return null},findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__){var Xm=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Xm.isDisabled&&Xm.supportsFiber)try{Jl=Xm.inject(Gm),Ql=Xm}catch(il){}}Vo.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Vm,Vo.createPortal=function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!Um(t))throw Error(Qo(200));return function(e,t,n){var s=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:ga,key:null==s?null:""+s,children:e,containerInfo:t,implementation:n}}(e,t,null,n)},Vo.createRoot=function(e,t){if(!Um(e))throw Error(Qo(299));var n=!1,s="",i=Hm;return null!=t&&(!0===t.unstable_strictMode&&(n=!0),void 0!==t.identifierPrefix&&(s=t.identifierPrefix),void 0!==t.onRecoverableError&&(i=t.onRecoverableError)),t=Pm(e,1,!1,null,0,n,0,s,i),e[ad]=t.current,Au(8===e.nodeType?e.parentNode:e),new Fm(t)},Vo.findDOMNode=function(e){if(null==e)return null;if(1===e.nodeType)return e;var t=e._reactInternals;if(void 0===t){if("function"==typeof e.render)throw Error(Qo(188));throw e=Object.keys(e).join(","),Error(Qo(268,e))}return e=null===(e=Ol(t))?null:e.stateNode},Vo.flushSync=function(e){return sm(e)},Vo.hydrate=function(e,t,n){if(!Km(t))throw Error(Qo(200));return $m(null,e,t,!0,n)},Vo.hydrateRoot=function(e,t,n){if(!Um(e))throw Error(Qo(405));var s=null!=n&&n.hydratedSources||null,i=!1,r="",o=Hm;if(null!=n&&(!0===n.unstable_strictMode&&(i=!0),void 0!==n.identifierPrefix&&(r=n.identifierPrefix),void 0!==n.onRecoverableError&&(o=n.onRecoverableError)),t=Am(t,null,e,1,null!=n?n:null,i,0,r,o),e[ad]=t.current,Au(e),s)for(e=0;e<s.length;e++)i=(i=(n=s[e])._getVersion)(n._source),null==t.mutableSourceEagerHydrationData?t.mutableSourceEagerHydrationData=[n,i]:t.mutableSourceEagerHydrationData.push(n,i);return new Wm(t)},Vo.render=function(e,t,n){if(!Km(t))throw Error(Qo(200));return $m(null,e,t,!1,n)},Vo.unmountComponentAtNode=function(e){if(!Km(e))throw Error(Qo(40));return!!e._reactRootContainer&&(sm(function(){$m(null,null,e,!1,function(){e._reactRootContainer=null,e[ad]=null})}),!0)},Vo.unstable_batchedUpdates=nm,Vo.unstable_renderSubtreeIntoContainer=function(e,t,n,s){if(!Km(n))throw Error(Qo(200));if(null==e||void 0===e._reactInternals)throw Error(Qo(38));return $m(e,t,n,!1,s)},Vo.version="18.3.1-next-f1338f8080-20240426",function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}(),$o.exports=Vo;var Zm,Jm=$o.exports,Qm=Jm;if(Zm=Qm.createRoot,Qm.hydrateRoot,!bn.useState)throw new Error("mobx-react-lite requires React with Hooks support");if(!function(e,t,n){return To(function(){var s=xo(e,n)[ys];null!=t||(t=function(e){return ss(e,ms)||Gn(e,ms,hs({},e[ms])),e[ms]}(e)),ts(t).forEach(function(e){return s.make_(e,t[e])})}),e})throw new Error("mobx-react-lite@3 requires mobx at least version 6 to be available");function e_(e){e()}function t_(e){return Nr(Ao(e,t));var t}var n_=function(){function e(e){var t=this;Object.defineProperty(this,"finalize",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"registrations",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"sweepTimeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sweep",{enumerable:!0,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=1e4),clearTimeout(t.sweepTimeout),t.sweepTimeout=void 0;var n=Date.now();t.registrations.forEach(function(s,i){n-s.registeredAt>=e&&(t.finalize(s.value),t.registrations.delete(i))}),t.registrations.size>0&&t.scheduleSweep()}}),Object.defineProperty(this,"finalizeAllImmediately",{enumerable:!0,configurable:!0,writable:!0,value:function(){t.sweep(0)}})}return Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){this.registrations.set(n,{value:t,registeredAt:Date.now()}),this.scheduleSweep()}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.registrations.delete(e)}}),Object.defineProperty(e.prototype,"scheduleSweep",{enumerable:!1,configurable:!0,writable:!0,value:function(){void 0===this.sweepTimeout&&(this.sweepTimeout=setTimeout(this.sweep,1e4))}}),e}(),s_=new("undefined"!=typeof FinalizationRegistry?FinalizationRegistry:n_)(function(e){var t;null===(t=e.reaction)||void 0===t||t.dispose(),e.reaction=null}),i_={exports:{}},r_={},o_=bn;var a_="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},l_=o_.useState,c_=o_.useEffect,h_=o_.useLayoutEffect,u_=o_.useDebugValue;function d_(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!a_(e,n)}catch(s){return!0}}var f_="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),s=l_({inst:{value:n,getSnapshot:t}}),i=s[0].inst,r=s[1];return h_(function(){i.value=n,i.getSnapshot=t,d_(i)&&r({inst:i})},[e,n,t]),c_(function(){return d_(i)&&r({inst:i}),e(function(){d_(i)&&r({inst:i})})},[e]),u_(n),n};r_.useSyncExternalStore=void 0!==o_.useSyncExternalStore?o_.useSyncExternalStore:f_,i_.exports=r_;var p_,v_,g_=i_.exports;function m_(e){e.reaction=new Ji("observer".concat(e.name),function(){var t;e.stateVersion=Symbol(),null===(t=e.onStoreChange)||void 0===t||t.call(e)})}var __="function"==typeof Symbol&&Symbol.for,x_=null!==(v_=null===(p_=Object.getOwnPropertyDescriptor(function(){},"name"))||void 0===p_?void 0:p_.configurable)&&void 0!==v_&&v_,b_=__?Symbol.for("react.forward_ref"):"function"==typeof bn.forwardRef&&bn.forwardRef(function(e){return null}).$$typeof,y_=__?Symbol.for("react.memo"):"function"==typeof bn.memo&&bn.memo(function(e){return null}).$$typeof;function w_(e,t){if(y_&&e.$$typeof===y_)throw new Error("[mobx-react-lite] You are trying to use `observer` on a function component wrapped in either another `observer` or `React.memo`. The observer already applies 'React.memo' for you.");var n=!1,s=e,i=e.displayName||e.name;if(b_&&e.$$typeof===b_&&(n=!0,"function"!=typeof(s=e.render)))throw new Error("[mobx-react-lite] `render` property of ForwardRef was not a function");var r,o,a=function(e,t){return function(e,t){void 0===t&&(t="observed");var n=yn.useRef(null);if(!n.current){var s={reaction:null,onStoreChange:null,stateVersion:Symbol(),name:t,subscribe:function(e){return s_.unregister(s),s.onStoreChange=e,s.reaction||(m_(s),s.stateVersion=Symbol()),function(){var e;s.onStoreChange=null,null===(e=s.reaction)||void 0===e||e.dispose(),s.reaction=null}},getSnapshot:function(){return s.stateVersion}};n.current=s}var i,r,o=n.current;if(o.reaction||(m_(o),s_.register(n,o,o)),yn.useDebugValue(o.reaction,t_),g_.useSyncExternalStore(o.subscribe,o.getSnapshot,o.getSnapshot),o.reaction.track(function(){try{i=e()}catch(t){r=t}}),r)throw r;return i}(function(){return s(e,t)},i)};return a.displayName=e.displayName,x_&&Object.defineProperty(a,"name",{value:e.name,writable:!0,configurable:!0}),e.contextTypes&&(a.contextTypes=e.contextTypes),n&&(a=bn.forwardRef(a)),a=bn.memo(a),r=e,o=a,Object.keys(r).forEach(function(e){k_[e]||Object.defineProperty(o,e,Object.getOwnPropertyDescriptor(r,e))}),a}var S_,k_={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};(S_=Jm.unstable_batchedUpdates)||(S_=e_),Cr({reactionScheduler:S_}),s_.finalizeAllImmediately;const C_=bn.createContext(null);function j_(){const e=bn.useContext(C_);if(!e)throw new Error("useRootStore() called outside <StoreContext.Provider> — wrap the tree in main.tsx");return e}const N_=Ux;!function(){const e=450,t=670,n=592,s=583,i=303,r=513,o=382,a=Ux,l=qx();for(;;)try{if(176716===-parseInt(a(737))/1*(-parseInt(a(e))/2)+parseInt(a(t))/3+parseInt(a(n))/4*(-parseInt(a(s))/5)+parseInt(a(i))/6+-parseInt(a(r))/7+parseInt(a(594))/8*(-parseInt(a(o))/9)+-parseInt(a(783))/10*(-parseInt(a(507))/11))break;l.push(l.shift())}catch(c){l.push(l.shift())}}();var M_=Object.defineProperty,B_=(e,t)=>M_(e,"name",{value:t,configurable:!0});function D_(e){return"object"==typeof e&&null!==e&&!Array[N_(455)](e)}B_(function(e){const t=681,n=528,s=532,i=Ux,r=e[i(703)]();if(!r[i(t)]("{"))return null;try{const e=JSON[i(n)](r);return e[i(s)]===i(749)||"app-server:reused"===e[i(532)]||e.kind===i(460)?e:null}catch{return null}},N_(651)),B_(D_,N_(736));var L_=N_(356),E_=N_(572);N_(584);var P_=N_(489),R_=N_(609);function A_(e,t){return""+R_+e+(t?"."+t:"")}N_(298),B_(function(e){return""+E_+e},N_(816)),B_(A_,"runsDirFor"),B_(function(e){const t=N_;return e===R_||e.startsWith(R_+"-")||e[t(681)](R_+".")},"isRunsDirName"),B_(function(e){return".debug"+e},N_(728)),B_(function(e){const t=N_;return L_+t(753)+e+t(483)},N_(467)),N_(380),N_(699),N_(605),N_(593),N_(603),N_(629),N_(722),N_(599),N_(363),N_(553);var z_="unotest/.env",T_="unotest/.secrets";function I_(e,t,n){const s=519,i=N_,r=[e];return t&&r[i(519)](""+e+t),n&&(r[i(s)](e+"."+n),t&&r[i(519)](""+e+t+"."+n)),r}B_(function(e,t){return""+z_+e+(t?"."+t:"")},"envFileFor"),B_(function(e,t){return""+T_+e+(t?"."+t:"")},"secretsFileFor"),B_(function(e,t){return I_(z_,e,t)},N_(675)),B_(function(e,t){return I_(T_,e,t)},N_(323)),B_(I_,N_(671));var O_=N_(620);B_(function(e,t){var n;const s=N_,i=null==(n=e[O_])?void 0:n[s(703)]();return i||t},"artifactsRootFrom");var H_=[N_(352),N_(443)];function F_(e){return[e.replace(/\/+$/,""),...H_].join("/")}B_(F_,"failuresRootUnder");B_(function(e,t){var n;const s=N_,i=null==(n=e.UNOTEST_FAILURES_ROOT)?void 0:n[s(703)]();return i||t},"failuresRootFrom"),B_(function(e){var t;const n=N_,s=null==(t=e.UNOTEST_ENV)?void 0:t[n(703)]();return s||void 0},N_(643));var W_=new Set(["example",N_(428),"template"]);B_(function(e,t){const n=804,s=559,i=458,r=N_,o=[r(721),r(n)][r(618)](e=>t?[e,""+e+t]:[e]),a=new Set;for(const l of e)for(const e of o){const t=e+".";if(!l[r(681)](t))continue;const n=l[r(370)](t[r(s)]);n&&!n.includes("/")&&(W_.has(n)||a[r(i)](n))}return[...a][r(659)]()},"envNamesFromDirListing"),B_(function(e){const t=532,n=326,s=542,i=312,r=N_;return typeof e===r(732)&&null!==e&&e[r(t)]===r(n)&&typeof e[r(s)]===r(312)&&typeof e.flags===r(i)},N_(810)),B_(function(e,t=""){return{kind:"regex",source:e,flags:t}},N_(776));function U_(e){const t=436,n=N_,s=e[n(800)](/[^a-zA-Z0-9_-]+/g,"-")[n(800)](/-+/g,"-")[n(800)](/^-|-$/g,"");return s.length>0?s:n(t)}B_(function(e){const t=347,n=404,s=321,i=N_,r=U_(e),o=Date[i(t)]()[i(792)](36),a=new Uint8Array(6);globalThis[i(n)][i(s)](a);let l="";for(let c=0;c<a.length;c++)l+=a[c].toString(16)[i(714)](2,"0");return r+"-"+o+"-"+l},"makeRunId"),B_(U_,N_(580));var K_=/^[0-9a-f]{6,}$/,q_=Date.UTC(2020,0,1),$_=Date[N_(688)](2100,0,1);function V_(e){const t=N_,n=e.split("-");if(n.length<3)return null;const s=n[n.length-1];if(!K_[t(508)](s))return null;const i=n[n.length-2];if(!/^[0-9a-z]+$/.test(i))return null;const r=parseInt(i,36);return Number[t(715)](r)?r<q_||r>=$_?null:r:null}function Y_(e){const t=714,n=409,s=N_,i=new Date(e);return String(i[s(673)]())[s(t)](4,"0")+"/"+String(i[s(n)]()+1)[s(t)](2,"0")+"/"+String(i.getUTCDate())[s(714)](2,"0")}function G_(e){const t=V_(e);return null===t?null:Y_(t)}function X_(e,t){const n=G_(t);return null===n?null:e+"/"+n+"/"+t}B_(V_,"runIdStartedAt"),B_(Y_,"shardPathForTimestamp"),B_(G_,"shardPathForRunId"),B_(X_,N_(310));var Z_=(B_(e=class extends Error{constructor(e){const t=N_;super(t(297)+e),this.name=t(619)}},N_(619)),e);function J_(e,t){const n=X_(e,t);if(null===n)throw new Z_(t);return n}function Q_(e="",t){return L_+"/"+A_(e,t)}function ex(e,t){return e+"/"+Y_(t)}function tx(e){return"failed"===e||e===N_(414)}B_(J_,N_(570)),B_(Q_,N_(653)),B_(function(e,t){return F_(e[N_(800)](/\/+$/,"")+"/"+Q_("",t))},N_(342)),B_(function(e,t="",n){return J_(Q_(t,n),e)},N_(386)),B_(ex,"shardDirFor"),B_(function*(e,t,n){const s=864e5;let i=Math[N_(501)](t/s)*s;for(let r=0;r<n;r++)yield ex(e,i),i-=s},N_(763)),B_(tx,"isFailingStatus"),B_(function(e,t){const n=429,s=796,i=801,r=370,o=429,a=N_,l={lastRunId:t.runId,lastStatus:t[a(399)],lastAt:t[a(n)],lastDurationMs:t[a(s)],recent:[...(null==e?void 0:e[a(i)])??[],t[a(399)]][a(r)](-12)};if(!tx(t.status))return{...l,failStreak:0,failingSince:null};const c=((null==e?void 0:e[a(405)])??0)+1;return{...l,failStreak:c,failingSince:1===c?t[a(429)]:(null==e?void 0:e[a(349)])??t[a(o)]}},N_(398)),B_(function(e){const t=N_;return encodeURIComponent(e)+t(471)},"scenarioIndexFileName"),B_(function(e){const t=559,n=N_;if(!e[n(777)](n(471)))return null;try{return decodeURIComponent(e[n(370)](0,-".jsonl"[n(t)]))}catch{return null}},"scenarioRefFromFileName"),N_(565);var nx=[N_(372),N_(633),N_(304)],sx=[N_(589),N_(367),N_(813),N_(344),"no-collections","malformed",N_(682),N_(548),N_(707),N_(383),"storage"];function ix(e){return nx[N_(805)](e)?e:null}B_(function(e){const t=455,n=648,s=520,i=312,r=N_;if(!D_(e))return null;const{bundleId:o,environment:a,collections:l,pr:c,branch:h,sha:u}=e;if("string"!=typeof o||0===o.length)return null;if(typeof a!==r(312)||0===a[r(559)])return null;let d=null;if(void 0!==l){if(!Array[r(t)](l))return null;if(l[r(n)](e=>"string"!=typeof e||0===e.length))return null;d=l}if(void 0!==c&&(typeof c!==r(s)||!Number[r(677)](c)))return null;for(const f of[h,u])if(void 0!==f&&typeof f!==r(i))return null;return{bundleId:o,environment:a,...d?{collections:d}:{},..."number"==typeof c?{pr:c}:{},..."string"==typeof h?{branch:h}:{},...typeof u===r(312)?{sha:u}:{}}},"parseCiRunRequest"),B_(function(e){const t=695,n=805,s=312,i=614,r=455,o=312,a=519,l=N_;if(!D_(e))return null;if(D_(e.error)){const{code:i,message:r}=e[l(t)];return sx[l(n)](i)?typeof r!==l(s)?null:{error:{code:i,message:r}}:null}const{status:c,bundleId:h,environment:u,runs:d,superseded:f,environmentPinned:p}=e;if(c!==l(i))return null;if(typeof h!==l(312)||typeof u!==l(s))return null;if(!Array[l(r)](d))return null;const v=[];for(const m of d){if(!D_(m))return null;const{runId:e,collection:t}=m;if(typeof e!==l(312)||typeof t!==l(o))return null;v[l(a)]({runId:e,collection:t})}if(void 0!==f&&typeof f!==l(520))return null;let g=null;return void 0!==p&&D_(p)&&"string"==typeof p[l(734)]&&(g={branch:p[l(734)]}),{status:l(614),bundleId:h,environment:u,runs:v,...typeof f===l(520)?{superseded:f}:{},...g?{environmentPinned:g}:{}}},"parseCiRunResponse"),B_(ix,N_(809));var rx=N_(486);N_(579),N_(608),N_(679),N_(604),N_(510),N_(621);function ox(e,t){return""+rx+e+(t?"."+t:"")}B_(ox,N_(453)),B_(function(e){const t=N_;return e===rx||e[t(681)](rx+"-")||e[t(681)](rx+".")},"isQueueDirName"),B_(function(e="",t){return L_+"/"+ox(e,t)},"projectQueueRoot");var ax=Object[N_(495)]({maintenance:0,interactive:1,ci:2,schedule:3}),lx=[N_(558),"interactive","ci",N_(518)],cx=lx;function hx(e){return ax[e]}function ux(e){return lx[e]??null}function dx(e){const t=358,n=685,s=734,i=559,r=370,o=N_,a=e[o(t)]?"@"+e[o(t)][o(370)](0,7):"";return void 0!==e.pr?o(n)+e.pr+a:void 0!==e[o(s)]?""+e[o(734)]+a:a[o(i)]>0?a[o(r)](1):e[o(488)]}B_(hx,N_(615)),B_(ux,N_(780)),B_(dx,N_(600)),B_(function(e,t,n){const s=N_;return hx(e)+"-"+t[s(792)](36)+"-"+n+s(483)},"makeQueueTicketName");var fx=/^([0-3])-([0-9a-z]+)-([0-9a-f]+)\.json$/;function px(e){const t=N_,n=fx[t(505)](e);if(!n)return null;const s=Number(n[1]),i=ux(s);if(null===i)return null;const r=parseInt(n[2],36);return Number[t(715)](r)?{rank:s,priority:i,createdAt:r,random:n[3]}:null}B_(px,N_(426)),B_(function(e,t){const n=523,s=531,i=531,r=N_,o=px(e),a=px(t);return o&&a?o.rank!==a[r(523)]?o[r(n)]-a[r(523)]:o[r(s)]!==a[r(i)]?o[r(531)]-a[r(531)]:o[r(738)]<a[r(738)]?-1:o[r(738)]>a.random?1:0:e<t?-1:e>t?1:0},"compareQueueTicketNames");var vx=[N_(710),N_(622),N_(650),N_(558)],gx=[N_(434),N_(305),N_(448),N_(518),"ci"];function mx(e){const t=488,n=520,s=312,i=312,r=312,o=N_;if(!D_(e))return null;const a=ix(e[o(t)]);if(null===a)return null;const{repo:l,branch:c,sha:h,pr:u,checkId:d}=e;for(const f of[l,c,h,d])if(void 0!==f&&"string"!=typeof f)return null;return void 0===u||typeof u===o(n)&&Number[o(677)](u)?{provider:a,...typeof l===o(s)?{repo:l}:{},...typeof c===o(i)?{branch:c}:{},...typeof h===o(312)?{sha:h}:{},..."number"==typeof u?{pr:u}:{},...typeof d===o(r)?{checkId:d}:{}}:null}B_(function(e){const t=312,n=559,s=520,i=715,r=805,o=532,a=420,l=535,c=327,h=N_;if(!D_(e))return null;const{schemaVersion:u,runId:d,kind:f,ref:p,env:v,priority:g,weight:m,producer:_,source:x,ci:b,createdAt:y}=e;if(1!==u)return null;if(typeof d!==h(t)||0===d[h(n)])return null;if("string"!=typeof p)return null;if(!vx.includes(f))return null;if(!cx.includes(g))return null;if(typeof m!==h(s)||!Number[h(i)](m)||m<1)return null;if(typeof y!==h(s)||!Number[h(715)](y))return null;if(!D_(_))return null;if(!gx[h(r)](_[h(o)]))return null;if("number"!=typeof _[h(a)]||typeof _[h(l)]!==h(312))return null;if(void 0!==v&&typeof v!==h(312))return null;let w=null;if(void 0!==x){if(!D_(x)||"string"!=typeof x.bundleId||0===x[h(c)][h(559)])return null;w={bundleId:x.bundleId}}let S=null;return void 0!==b&&(S=mx(b),null===S)?null:{schemaVersion:1,runId:d,kind:f,ref:p,priority:g,weight:m,producer:{kind:_.kind,pid:_.pid,host:_[h(535)]},createdAt:y,...typeof v===h(312)?{env:v}:{},...w?{source:w}:{},...S?{ci:S}:{}}},N_(463)),B_(mx,"parseTicketCi");function _x(e){const t=N_;if(!D_(e))return null;const{repo:n,branch:s,sha:i,dirty:r}=e;if(typeof r!==t(406))return null;for(const o of[n,s,i])if(void 0!==o&&typeof o!==t(312))return null;return{dirty:r,...typeof n===t(312)?{repo:n}:{},...typeof s===t(312)?{branch:s}:{},..."string"==typeof i?{sha:i}:{}}}N_(554),N_(725),N_(325),N_(638),N_(540),B_(_x,N_(788)),B_(function(e){const t=312,n=455,s=794,i=N_;if(!D_(e))return null;const{schemaVersion:r,bundleId:o,sha256:a,createdAt:l,webVersion:c,author:h,git:u,fileCount:d,byteSize:f,declaredVariables:p,schedulesFingerprint:v}=e;if(1!==r)return null;if(typeof o!==i(t)||0===o.length)return null;if(void 0!==a&&!/^[0-9a-f]{64}$/.test(String(a)))return null;if(typeof c!==i(t)||0===c[i(559)])return null;if(typeof l!==i(520)||!Number.isFinite(l))return null;if("number"!=typeof d||!Number.isInteger(d))return null;if(typeof f!==i(520)||!Number.isInteger(f))return null;if(void 0!==h&&typeof h!==i(312))return null;let g=null;if(void 0!==u&&(g=_x(u),null===g))return null;const m=Array[i(n)](p)?p[i(s)](e=>typeof e===i(312)):[],_="string"==typeof v&&/^[0-9a-f]{64}$/[i(508)](v)?v:void 0;return{schemaVersion:1,bundleId:o,...typeof a===i(312)?{sha256:a}:{},createdAt:l,webVersion:c,fileCount:d,byteSize:f,...typeof h===i(312)?{author:h}:{},...g?{git:g}:{},...m[i(559)]>0?{declaredVariables:m}:{},...void 0!==_?{schedulesFingerprint:_}:{}}},N_(646)),B_(function(e){const t=358,n=734,s=N_,i=e[s(544)];if(!i||void 0===i.branch&&void 0===i[s(t)])return e.bundleId;const r=i[s(t)]?i[s(358)].slice(0,7):"?";return(i[s(n)]??"?")+"@"+r+(i[s(723)]?" (wip)":"")},"describeBundle");var xx=[N_(589),N_(672),N_(538),"id-mismatch",N_(525),N_(367),"expired",N_(548),N_(707),N_(514)];B_(function(e){const t=312,n=664,s=559,i=360,r=N_;if(!D_(e))return null;if(D_(e[r(695)])){const{code:n,message:s}=e.error;return xx.includes(n)?typeof s!==r(t)?null:{error:{code:n,message:s,...yx(e[r(695)])}}:null}const{status:o,bundleId:a}=e;if(o!==r(667)&&o!==r(n))return null;if(typeof a!==r(312)||0===a[r(s)])return null;const l=wx(e[r(i)]);return null===l?{status:o,bundleId:a}:{status:o,bundleId:a,variableGaps:l}},N_(470));var bx=[N_(339),"repo-project-mismatch"];function yx(e){const t=794,n=312,s=559,i=N_,{scope:r,project:o,projects:a}=e,l=Array[i(455)](a)?a[i(t)](e=>typeof e===i(312)):[];return{...bx[i(805)](r)?{scope:r}:{},...typeof o===i(n)&&o[i(559)]>0?{project:o}:{},...l[i(s)]>0?{projects:l}:{}}}function wx(e){const t=312,n=559,s=N_;if(!Array.isArray(e))return null;const i=[];for(const r of e){if(!D_(r))continue;const{project:e,environment:n,missing:o}=r;if("string"!=typeof e||typeof n!==s(t))continue;if(!Array.isArray(o))continue;const a=o[s(794)](e=>typeof e===s(312));a.length>0&&i[s(519)]({project:e,environment:n,missing:a})}return i[s(n)]>0?i:null}B_(yx,N_(550)),B_(wx,N_(573)),N_(691),N_(534),B_(function(e){return e.join(",")},"encodeNameList"),B_(function(e){const t=N_;return void 0===e?[]:e.split(",")[t(403)](e=>e[t(703)]()).filter(e=>""!==e)},N_(492));var Sx=/^[A-Za-z_][A-Za-z0-9_]*$/,kx=N_(585);function Cx(e){return Sx[N_(508)](e)&&e!==kx}function*jx(e){const t=703,n=370,s=703,i=N_;for(const r of e.split(/\r?\n/)){const e=r[i(703)]();if(""===e||e.startsWith("#"))continue;const o=e[i(423)]("=");if(o<=0)continue;const a=e[i(370)](0,o)[i(t)]();Cx(a)&&(yield[a,e[i(n)](o+1)[i(s)]()])}}function Nx(e){const t=508,n=800,s=N_;if(""===e)return"";if(/[\s#"'=\\]|^[`]/.test(e)||/[\n\r]/[s(t)](e)){return'"'+e[s(800)](/\\/g,"\\\\")[s(n)](/"/g,'\\"')[s(n)](/\n/g,"\\n").replace(/\r/g,"\\r")+'"'}return e}function Mx(e){const t=new Set;for(const[n]of jx(e))t.add(n);return t}function Bx(e){const t=N_,n=e[t(703)]();return n.startsWith("#")&&/---/[t(508)](n)}function Dx(e){const t=681,n=423,s=N_,i=e[s(703)]();if(""===i||i[s(t)]("#"))return!1;const r=i[s(n)]("=");return r>0&&Sx[s(508)](i[s(370)](0,r).trim())}function Lx(e,t){const n=681,s=423,i=N_,r=e[i(703)]();if(""===r||r[i(n)]("#"))return!1;const o=r[i(s)]("=");return!(o<=0)&&r.slice(0,o).trim()===t}function Ex(e){const t=N_,n=e[t(777)]("\n"),s=n?e.slice(0,-1):e;return{lines:""===s?[]:s[t(556)]("\n"),trailingNewline:n}}function Px(e,t){const n=e[N_(498)]("\n");return t||""===n?n+"\n":n}B_(Cx,"isEnvVarName"),B_(jx,N_(752)),B_(function(e){const t=N_,n={};for(const[s,i]of jx(e)){let e=i;if(e[t(559)]>=2){const n=e[0],s=e[e[t(559)]-1];('"'===n||"'"===n)&&n===s&&(e=e.slice(1,-1))}n[s]=e}return n},"parseEnvContent"),B_(Nx,N_(808)),B_(Mx,N_(334)),B_(function(e){const t=556,n=N_,s=new Set;for(const i of e[n(t)](/\r?\n/)){const e=/^\s*(?:#\s*)?([A-Za-z_][A-Za-z0-9_]*)\s*=/.exec(i);e&&s.add(e[1])}return s},"declaredEnvKeys"),B_(Bx,N_(564)),B_(Dx,N_(814)),B_(Lx,N_(782)),B_(Ex,N_(634)),B_(Px,N_(567)),B_(function(e,t,n,s){const i=392,r=559,o=703,a=770,l=519,c=N_,h=t+"="+Nx(n),{lines:u,trailingNewline:d}=Ex(e);if(s){const e=new RegExp("\\b"+s.toLowerCase()+"\\b"),t=u[c(i)](t=>Bx(t)&&e[c(508)](t.toLowerCase()));if(-1!==t){let e=u[c(r)];for(let o=t+1;o<u[c(r)];o++)if(Bx(u[o])){e=o;break}let n=-1,s=-1;for(let r=t+1;r<e;r++)""!==u[r][c(o)]()&&(s=r),Dx(u[r])&&(n=r);const i=n>=0?n:s,a=i>=0?i+1:t+1;return u[c(787)](a,0,h),Px(u,d||u.length>0)}return u.length>0&&u[c(519)](""),u[c(519)](c(a)+s+c(355),h),Px(u,!0)}return u[c(l)](h),Px(u,!0)},N_(480)),B_(function(e,t){const n=N_,{lines:s,trailingNewline:i}=Ex(e),r=s[n(794)](e=>!Lx(e,t)),o=r[n(559)]!==s[n(559)];return{content:Px(r,i),removed:o}},"removeEnvVar"),B_(function(e,t,n){const s=N_,{lines:i,trailingNewline:r}=Ex(e),o=i[s(392)](e=>Lx(e,t));return-1===o?{content:e,replaced:!1}:(i[o]=t+"="+Nx(n),{content:Px(i,r),replaced:!0})},N_(316));var Rx=N_(415),Ax=N_(371);B_(function(e){return e[N_(681)](Ax)},N_(582));var zx=N_(416),Tx=N_(381),Ix=N_(740),Ox={variable:N_(361),secret:"secrets"};function Hx(e){return zx+"/"+encodeURIComponent(e)}function Fx(e,t){return N_(387)+encodeURIComponent(e)+"/"+encodeURIComponent(t)+"/"+Tx}function Wx(e,t,n,s){return Fx(e,t)+"/"+Kx(n,s)}function Ux(e,t){e-=297;const n=qx();let s=n[e];if(void 0===Ux.iMkGEf){Ux.vcxGpF=function(e){let t="",n="";for(let s,i,r=0,o=0;i=e.charAt(o++);~i&&(s=r%4?64*s+i:i,r++%4)?t+=String.fromCharCode(255&s>>(-2*r&6)):0)i="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=".indexOf(i);for(let s=0,i=t.length;s<i;s++)n+="%"+("00"+t.charCodeAt(s).toString(16)).slice(-2);return decodeURIComponent(n)},Ux.kgXHYY={},Ux.iMkGEf=!0}const i=e+n[0],r=Ux.kgXHYY[i];return r?s=r:(s=Ux.vcxGpF(s),Ux.kgXHYY[i]=s),s}function Kx(e,t){const n=364,s=N_;if(e===s(694))return s(694);if(void 0===t)throw new Error("a "+e+s(n));return Ox[e]+"/"+encodeURIComponent(t)}function qx(){const e=["Axntzwn0Aw9UrgL2AwrLCG","l2fWAs9IB3GVy2KVCNvU","x2jSB2jZ","AM9PBKXPBMvZ","CgLJA2vYlw9U","CNvUvhjPz2DLCKvUDG","CMvXDwLYzvj1BKrPCKzVCG","vu5pvevtvf9kvurhrv9nt0rf","ztjL","CgfYC2vwyxjPywjSzuDHChm","CgfYC2vcB3HoB3rPzNLdAgfUz2vK","DgvYBwLUywW","CgfYC2vtzxjPzxnfBNrYEq","C3bLy01HDgnOzxm","yM94rw52u2vJCMv0uMv2zwfSugf0Aa","DgLJA2v0CW","C2fUAxrPEMvsDw5jzfnLz21LBNq","yM94vMfSDwvlAw5Kt2ztzwDTzw50","AxnsDw5Uzxjtzxr0Aw5N","nwXPzNvYCa","x2HLBhbLCNm","x19WCM90B19F","zw50CMLLCW","yMXVyLbHDgHgB3i","zw52q29UDgvUDa","Dw5HDxrOB3jPEMvK","zxzLBNrZ","l3rLC3q","nZKYota4r0D5tejx","x2rHEs5QC29UBa","oeDyz21xvq","Dw5RBM93BI1JAgfUBMvS","AxntDgf0zq","zgf5CW","vu5pvevtvf9kvurhrv9usu1ft1vux01t","C3rKzxjYlMXVzW","zgvZy3jPyMvuAwnRzxrdAq","C2v0twLUDxrLCW","CgfYC2vcB3HsDw5by2nLChrLza","x3nJzw5HCMLVCW","vu5pvevtvf9ot19rvuvvrq","C3rLChmUANnVBMW","CgfYC2vtDhjPBMDszwnVCMq","rNjP","CNvUBMLUzW","lNj1BNm","CgfYC2vtzwnYzxq","uMvUDcbHigjVEcaI","CgfYC2vcB3HsDw5szxf1zxn0","l2HLywX0Aa","CxvLDwvK","CxvLDwvqCMLVCML0EvjHBMS","r0vuic9HChbYB3zHBhm","C3rHCNrpzKrHEq","zMXHDe1HCa","vw5WBgfJzwfIBgvsDw5jzevYCM9Y","vu5pvevtvf9buLrjrKfdvfnFuK9pva","vu5pvevtvf9rvuvvrv9hte9cquXFu0Xpvfm","y29SBgvJDgLVBG","l19NDwfYzc9HCgKVzw52CW","CgXHBKfKzfzHCMLHyMXL","Dw50AwW","zw52AxjVBM1LBNrZ","vu5pvevtvf9kvurhrv9ts0Lqx1bsruzmsuDiva","uNvUBMvY","x2XHDgvZDc5QC29U","z2v0sg91CNm","BwvZC2fNzq","vgHLihn1CMnOyxjNzsbZDgfYDhmGD2L0Acb0AguGyM94j3mGBMv4DcbOB3vYigfUzcbYDw5ZihvUDgLSihrOzsbqAwnRzxiGAxmGDhvYBMvKig9MzI4Gsw50zw50igXVy2f0B3jZigfUzcbNCM91BMrFzwXLBwvUDcbZDgfYDcbYzxnVBhzPBMCGDgHYB3vNAcb0AguGugLJA2vYlG","z2L0BgfI","C3bSAxrmAw5LCW","y2fUBM90igXVywqGCNvUBMvYigfKyxb0zxiGiG","uNvUBMvYtM90q29UzMLNDxjLzevYCM9Y","Ag91CNm","Dw5VC18","y3jVBKzYB21tCgvJ","yM94uNvUC1bHDgG","ue9tvcaVyM94zxmVoM5HBwuVCgLJA2vY","BwL4zwq","ywn0AxzLrw52tMfTzq","u3vU","CNvUBMvYici","CgfYC2vcDw5KBgvnyw5PzMvZDa","C2v0","C29Tzq","CMvJB3zLCMvK","yxv0Ag9YAw5N","CgfYC2vbChbtzxj2zxjfDMvUDa","C2nOzwr1BgvZ","ChjVAMvJDfj1BNnsB290","Ec11BM90zxn0lwfJDg9YlxrPy2TLDa","Ec11BM90zxn0lwvUDMLYB25Tzw50","CgfYC2vcB3HoB3rPzNLtzxjPzxnwAwv3","r0vuic9HChbYB3zHBhmVoMLK","CgLJA2vYsw5JBhvKzwq","C29YDa","C2XHy2S","y2HHBM5LBa","CgfYC2vcB3HwywX1zvnLDfjLCxvLC3q","l3bYzxzPzxC/CNvSzt0","zxHPC3rZ","vu5pvevtvf9ct1HFuKvbrf9ut0TftG","zgfPBhK","y3jLyxrLza","ChvZAcbHmwiYyZnKicHTywLUkq","vu5pvevtvf9svu5Fqunut1i","nda2mZK4DhPKEuv2","Bgf5zxjZrM9Y","Dg9VlwXHCMDL","z2v0vvrdrNvSBfLLyxi","yM94tM90Awz5txv0zvbHDgG","zw52tgf5zxjgAwXLC0zVCG","vhvYBIb0AguGugLJA2vYig9UigzVCIb0AguGyM94ici","AxnjBNrLz2vY","vu5pvevtvf9kvurhrv9dtefvrevFqKLo","lM11Dgv4","BM90zq","C3rHCNrZv2L0Aa","zxHWAxjLza","AdeY","vu5pvevtvf9usu1fwK9orq","ufiGiW","A2v5","igLZig5VDcbHigTUB3DUihj1BM5LCIbZzxr0Aw5NiokaLcbJAg9VC2uGB25LigzYB20GDgHLihj1BM5LCI1JB25MAwCGBgLZDc4","vvrd","vgH1","CgfYC2vlzwvWuMvJB3jK","yNvUzgXLza","Bte1","tK9Fq09mt1i","DgfYz2v0","zxjYB3i","vu5pvevtvf9erujvr19esvi","BNb4ieb1BM90zxn0l3DLyIbIDw5KBguGChvZAcaTlxj1BIaTlwvUDIa","AxnsDw5UzxjdB25MAwDlzxK","lNzPzxDLCI5SB2C","CgfYC2vsDwXL","vu5pvevtvf9erujvr19quKvwsuvxx0jzvevt","vu5pvevtvf9erujvr19lruvqx0nbteXt","DhjPBq","rgvSzxrLihrOzsbIB3GGiG","CgfYC2vty2HLzhvSzxneB2m","xsbYzxbLyxrZia","yw1IAwD1B3vZlxbYB2PLy3q","CgfYC2vcB3HoB3rPzNLwAwv3","yxbWCM92ywXdB25Zzxf1zw5Jzq","C2nLBMfYAw8","yM94tM90Awz5vgvZDfbHDgG","ue9tvcaVywnJB3vUDc9WAwnRzxi","CgfYC2vszxbSywnLuMvXDwvZDa","CgfKu3rHCNq","AxngAw5PDgu","DMfSAwrHDgvgC1nHzMvoyw1L","C3rPBgWTzMfPBgLUzW","iI4G","CgfYC2vty2HLzhvSzxnkC29U","CMf0zs1SAw1PDgvK","lMvUDG","C3rKB3v0lMXVzW","zgLYDhK","CgLJA2vY","vu5pvevtvf9ct1HFvvjm","C3rYAw5NtgLZDa","refuqujbu0vFvvjm","zgvIDwDeAxjgB3i","BgLZDa","CMvWzwf0rxzLCNK","r0vuic9IB3HLCY86BMfTzs9SB2DZ","B2jQzwn0","DgLTzxm","yNjHBMnO","C291CMnLCY5QC29U","AxnszwnVCMq","nhHSvM5xAW","CMfUzg9T","revmrvrfic9IB3HLCY86BMfTzq","CMv2zwfS","CgfYC2vcB3HoB3rPzNLqCM9Qzwn0vMLLDW","y2f0zwDVCML6zvzHCMLHyMXL","vu5pvevtvf9huK9vtKrfuL9nt0rf","revmrvrfic9RzxLZl2n1CNjLBNq","DMfSAwrHDgvtzwDTzw50tMfTzq","yM94lwnYzwf0zq","DhjPz2DLCNm","yM94rw52vMfSDwvqyxrO","yxbWlxnLCNzLCJPYzwfKEq","vu5pvevtvf9eruzbvuXux1rjtuvpvvrFtvm","CNvUBMvY","yxnZAwDUBwvUDevUDhjPzxm","lY5Kzwj1z2DLCG","C3rHDgu","yw1VDw50","Dw5VDgvZDc8Uzw52","BwfUAwzLC3ruCMLNz2vY","zxHWzwn0zwqGysbTyxbWAw5NihDPDgGGysbGC2nOzwr1BgvZoMaGyxjYyxK","zM9YyMLKzgvU","vu5pvevtvf9kvurhrv9mt0DFtevwruW","CgfYC2vcB3HwywX1zxnszxbSywnLuMvXDwvZDa","ChjVAMvJDhm","C2HHCMreyxLZrgvZy2vUzgLUzW","DMfSAwrHDgvdB2XSzwn0Aw9UtMfTzq","icOV","Dw5JAgfUz2vK","Dw5RBM93BI1ZzwnYzxq","Dw5HDMfPBgfIBgu","tw9U","iYaTls0G","Aw5ZDgfSBgvK","zhvWBgLJyxrL","yM94tM90Awz5uhjVAMvJDfbHDgG","y29TCgXLDgvK","C3rYAw5NAwz5","CMvNzxHmAxrLCMfS","zw5KC1DPDgG","D2vIAg9VA1vYBa","C3bLyW","CxvLDwvqCMLVCML0EuzYB21syw5R","zMLYC3rsDw5dB21Tyw5K","AxnbC3nPz25Tzw50t2y","ndi1ndCWDMLNCwPq","DMfSDwu","igf0ia","zNjLCq","C3bSAwnL","CgfYC2vhAxrjBMzV","AxntDhjPBMC","AxnuzxjTAw5HBfj1BNrPBwvtDgf0zq","zgvSzxrLu2HHzg93v2fYBMLUzW","Dg9tDhjPBMC","D2vLA2X5","zMLSDgvY","zw52AxjVBM1LBNq","zhvYyxrPB25nCW","CNvUlwLUlxbYB2DYzxnZ","revmrvrfic9Hy2nVDw50l3bPy2TLCG","yM94tM90Awz5uhjLDMLLD1bHDgG","CMvWBgfJzq","CMvJzw50","vu5pvevtvf9orvrxt1jl","vu5pvevtvf9kvurhrv9quK9wsurfuG","lNnLy3jLDhm","Aw5JBhvKzxm","zM9YBwf0tMv4DfrPy2S","AxnbBM5VDgf0Aw9UtgLUzq","C2vYAwfSAxPLrw52vMfSDwu","CgfYC2vdAvbYB3zPzgvY","AxnszwDLEeXPDgvYywW","AgfZ","yM94vMfSDwvZugf0Aa","Dw5RBM93BI1LBNzPCM9UBwvUDa","AxnbC3nPz25Tzw50tgLUzq","vu5pvevtvf9kvurhrv9ut0TftG","DgvZDerPCKzVCG","BwfUDwfS","CNvUswqGy2fYCMLLCYbUBYb0Aw1LC3rHBxaSignHBM5VDcbWBgfJzsbPDcbPBIbHihnOyxjKoIa","lNnUyxbZAg90CW","Aw5ZDgfSBezPzwXK","C2vYAwvZ","zxzLCNK","vu5pvevtvf9huK9vtKrfuL9sru1pvevFvvjm","mtGWndaYmg9fqvfgDa","yxbP","DMLLD2vY","kI8Xnq","yhnJAgvKDwXLCZPGig11C3qGyMuGyw4GyxjYyxK","BMfTzq","DxjS","CNvUrgLYrM9Y","l2nOyw5UzwXZlW","C3rYAw5N","CgfZC2vK","ig11C3qGyMuGvvbqrvjFu05bs0uGkguUzY4Gqvbqx0jbu0vFvvjmksbZBYbHihnJzw5HCMLVignHBIbYzwzLCMvUy2uGAxqGyNKGBMfTzs4","lNDVCMTZCgfJzs5QC29U","CMvWBgfJzuvUDLzHCG","CgfYC2vxB3jRC3bHy2vgAwXL","zxHWzwn0lwzHAwW","BxvZDcbIzsbHihn0CMLUzW","B3v0y29Tzq","z2v0uMfUzg9TvMfSDwvZ","vu5pvevtvf9kvurhrv9srvrssuvt","C2vJCMv0C0XHEwvYrMLSzxngB3i","DgvSzwDYyw0","Dw5VyL8","CMvNzxG","yNvUzgXLswq","C2nOzwr1BgvZwW","kI8XnsaQicOGkIaQ","BM90lxj1BG","y3jVBG","r0vuic9IB3HLCY86BMfTzq","A2v5CW","zw52s2v5CW","vu5pvevtvf9dt05tt0Xf","yM94tM90Awz5uNvSzvbHDgG","Bwf0y2G","vu5pvevtvf9kvurhrv9it1nu","Dw5RBM93BI1WCM9Qzwn0","CNvUvhjPz2DLCKzYB21fBNy","vu5pvevtvf9erujvrW","zMfPBhvYzxnsB290sw4","Dw5RBM93BI1YDw5UzxiTA2v5","Dw5RBM93BI1IDw5KBgu","zgvJB2rLu2vNBwvUDa","yM94tM90Awz5q2HHBM5LBfbHDgG","BM93","Dw5RBM93BI1ZzxjPzxm","zMfPBgLUz1nPBMnL","ue9tvcaVyM94zxmVoM5HBwuVDxbKyxrL","l3f1Awv0lwHVDxjZ","lNvUB3rLC3q","vu5pvevtvf9svu5Fvfjjr0DfuG","CgfYC2vcB3HwywX1zxnszxnWB25Zzq","ic0Tlq","Dw5VDgvZDa","igLZigfSC28GC2v0igLUihvUB3rLC3qVlMvUDIdIGjqGDgHLihnLy3jLDcb2ywX1zsbUB3CGC2HHzg93CYbPDc4","C2HH","BgfZDe5VDgLMAwvKqxq","DMfYAwfIBgvhyxbZ","DMfYAwfIBgvZ","CgfYC2vcB3HoB3rPzNLqCMv2Awv3","y29TBwfUzhmUANnVBMW","ig5LzwrZigeGBMfTzq","yxbWCM92ywXby3rPB25uzxH0","zMLSzq","C2nVCguTBwLZBwf0y2G","qxbW","Bxv0zq","C2XPy2u","vu5pvevtvf8","z2L0AhvI","Aw5JBhvKzwqGAw4GDgHLigjVEcbWCMLJzsbMB3iGBM93","AxntDhjPBMDbCNjHEq","revmrvrfic9Hy2nVDw50l3bPy2TLCI9Hy2nLC3m","C2vJCMv0C0nVBNrLBNq","AxnfEhrLCM5HBfzHCK5HBwu","CgfYC2vcB3HszwfKrw52AxjVBM1LBNrZ","zgfPBhKGyxqG","lNzPzxDLCI5SB2nR","DMfSDwvZ","mty0mda3ovnWBezmDW","CgLUBMvKlwvUDMLYB25Tzw50lwvTChr5","kI81","yM94rw52vMfSDwvZugf0Aa","ChjVAMvJDfj1BKrPCKzVCG","l2fWAs9IB3GVzw52CY8","jNn0yxrLpq","igLZigfSC28GC2v0igLUihvUB3rLC3qVlNnLy3jLDhmG4OcuihrOzsbZzwnYzxqGDMfSDwuGC2HHzg93CYb0AgLZig9Uzs4","Bwf0y2HdBg91zefWAvjVDxrL","ChjVAMvJDa","zMLUzeLUzgv4","CgfYC2vdAgfUBMvS","CMvHC29U","BM90lwzVDw5K","CgfYC2vcB3HoB3rPzNLnDxrLu2nVCgu","zgvZy3jPyMvdCM9U","zM9SzfnJzw5HCMLVuNvU","C3rHDhvZ","BxvZDcbUB3qGC3rHCNqGD2L0AcaNlIC","Ec11BM90zxn0lwD1yxjKlxnLy3jLDa","CMvTB3zLza","BwfW","y3j5ChrV","zMfPBfn0CMvHAW","yM9VBgvHBG","yxrnAw51DgvZ","zw5HyMXLza","z2v0vvrdtw9UDgG","vu5pvevtvf9mt0nbteu","CgfYC2vcB3HtzwnYzxrszxzLywXszxnWB25Zzq","vu5pvevtvf9kvurhrv9nt0rfta","AxnuCMLNz2vYs2LUza","Aw50zxjYDxb0zwq","qvbqx0jbu0vFvvjm","l2fWAs9IB3GVDMfSDwvZ","C2vUDa","vu5pvevtvf9dqunirv9esvi","igLZigfSC28GC2v0igLUihLVDxiGC2HLBgWGzw52AxjVBM1LBNqG4OcuigL0ihDPBgWGA2vLCcbYzxnVBhzPBMCGzNjVBsb0AgvYzsaODgHLigvUDMLYB25Tzw50ihDPBNmGB3zLCIb0AguGzMLSzsKU","CgLK","yM94tM90Awz5u2vYAwvZuMvZzxrqyxrO","BMv0D29YAW","Aw5KzxHpzG","DgHYzwfKswq","CgfYC2vcB3HoB3rPzNLuzxn0uMvZDwX0","CgfYC2vrDwv1zvrPy2TLDe5HBwu","CMvWBgfJzwq","C2fTCgXL","C3rHCNrLzef0","BxvZDcbUB3qGyMuGzw1WDhK","C2v0sg91CNm","BwLUDxrLCW","z2v0vgLTzq","y2XP","l3jLC2v0","CNvU","u2f0","y2fJAgu","icOGkIaQ","ue9tvcaVyM94zxm","r0vuic9IywXHBMnL","vw5ZDxbWB3j0zwrsDw5lAw5KrxjYB3i","zMfPBhvYzxm","CMvZzxj2zwrcB3HwywX1zu5HBwvZ","zxzLCNKGnsbTAw4","yMXVyLjLBfbHDgHgB3i","C2v0u2vJB25KCW","BwnW","ChjLCgfYzq","nti4mtbjBgLZvfi","l2fWAs9IB3GVBM90Awz5","iokaLcbWAwnRigeGzgLMzMvYzw50ig5HBwuGB3iGzwrPDcb0AguGzxHPC3rPBMCGDMfSDwuU","CxvLDwveAxjgB3i","zw52","AxnbCNjHEq","CgfYC2vcB3HszwfKrxjYB3i","Ag91CMX5","ywrK","rK9sq0vFq09mt1i","yxbWlxnLCNzLCJPLCNjVCG","r0vuic9IB3HLCW","CgfYC2vbBgW","CgfYC2vrDwv1zvrPy2TLDa","Bxv0zxm","Dg9KyxKG","vu5pvevtvf9erujvr19ive1mx01bwf9cwvrfuW","zgvIDwDNzxjgAwXLrM9Y","DgL0Bgu","kI81icOGkIaQicO","CgfYC2vcDw5KBgvvCgXVywrszxnWB25Zzq","lMPZB25S","yxbWCM92ywXqCMLJzuXHyMvS","D29YA2vYCW","vu5pvevtvf9eruzbvuXux05bvKLhqvrjt05FveLnru9vvf9nuW","AxncB3HoB3rPzNLtDgf0zq","u3vYy2HHCMDL","vu5pvevtvf9cuK9xu0vsx0niqu5oruW","ywjVCNrLza","Dw5VDgvZDc8UC2vJCMv0CW","Aw5Zzxj0rw52vMfY","zMfPBgvK","C2vJCMv0","lMPZB24","C2LUy2u","CNvSzxm","lNf1zxvL","BgLUzxm","ChjVDMLKzxi","x2nVBgXLy3rPB25Z","vu5pvevtvf9tvevqx1nduKvftLnit1rt","vhvL","zgvJB2rLtMfTzuXPC3q","zMLUza","Dw5RBM93BI1TDxrL","zNjLzxPL","zxzLCNKGmtuGBwLU","C2vJCMv0CW","AM9PBG","y2HHBM5LBhm","BxvZDcbUB3qGyMuGiI4Iig9YiciUlIi","zMXVB3i","AgvHzgvYCW","yM94tMfTzq","CgfK","zxHLyW","zgvZy3jPyMvtCgvJ","ndrQA0PLA28","DgvZDa","igfSCMvHzhKGzxHPC3rZigLUia","vu5pvevtvf9rvuvvrv9hte9cquXFreLs","CgfYC2vmyxn0rgvSAxzLCNK","BgfZDerLBgL2zxj5","mta4mZm5mfDPsM5HDW","C3rVCMfNzq","CgfYC2voyw1LzfjLy29Yza","y2HHDeLK","ue9tvcaVyM94zxmVoM5HBwuVywnJzxnZ","C2nOzwr1Bgu","ChvZAa","BNvTyMvY","y29UzMLN","BMv4DfrPy2TgCM9Tu3bLyW","CMfUAW","ywz0zxjgywLSDxjLCW","BwLUlxzLCNnPB24","DMfSDwvtDwzMAxG","vu5pvevtvf9kvurhrv9bq0nfu1nFve9lru4","CgfYC2u","lcb3AxrOihrOzsbqAwnRzxi","revmrvrfic9IB3HLCY86BMfTzs9WAwnRzxi","y3jLyxrLzef0","A2LUza","Aw52ywXPzc1Uyw1L","vu5pvevtvf9ct1HFu0vduKvux05btuvt","Ag9ZDa","l3nLCMLLCW","vu5pvevtvf9kvurhrv9wt1rf","BwfSzM9YBwvK","yxbW","vu5pvevtvf9tq0HfrfvmrvnFrKLor0vsufjjtLq","Dw5RBM93BG","C291CMnL","iIdIGjqGB25LihnJAgvKDwXLihbLCIb0yxjNzxq","z2L0","z2v0rgf5","CgfYC2vrDwLLDeHVDxjZ","yM94tM90Awz5u2vYAwvZugf0Aa","CMv2B2nHDgLVBI1SAxn0lxvUyxzHAwXHyMXL","CxvPzxriB3vYCW","CgfYC2vszwz1C2fSrgv0ywLS","CgfYC2voyw1LtgLZDa","vhvYBIb0AguGugLJA2vYig9UigzVCIb0AguGywnJB3vUDa","CNvUDgLTzs5QC29U","yNvUzgXLlMPZB24","z2v0twLUDxrLCW","C3bSAxq","yMXVyNnsB290rM9Y","BwfPBNrLBMfUy2u","BgvUz3rO","Dg9TB3jYB3CG","DhjPz2DLCG","CM91BMq","sw52ywXPzejSB2jiyxnOrxjYB3i"];return(qx=function(){return e})()}function $x(e,t){const n=N_;if(!D_(e))return null;const{target:s,variables:i,secrets:r}=e;if(void 0!==s&&typeof s!==n(312))return null;const o=Yx(i),a=t(r);return null===o||null===a?null:{...typeof s===n(312)?{target:s}:{},variables:o,secrets:a}}function Vx(e){const t=784,n=312,s=N_;return D_(e)&&typeof e[s(t)]===s(n)?{value:e[s(784)]}:null}function Yx(e){return Xx(e,Zx)}function Gx(e){return Xx(e,e=>null===e||Zx(e))}function Xx(e,t){const n=N_;if(!D_(e))return null;const s={};for(const[i,r]of Object[n(586)](e)){if(!Cx(i)||!t(r))return null;s[i]=r}return s}function Zx(e){return typeof e===N_(312)}B_(function(e){const t=N_;for(const[n,s]of Object[t(586)](Ox))if(s===e)return n;return null},N_(581)),B_(Hx,N_(812)),B_(function(e,t,n){return Hx(e)+"/"+Kx(t,n)},"boxValuePath"),B_(Fx,N_(385)),B_(Wx,N_(748)),B_(function(e,t,n){return Wx(e,t,N_(482),n)+"/"+Ix},N_(578)),B_(function(e,t){return Fx(e,t)+"/"+Ix},"boxEnvSecretsRevealPath"),B_(Kx,N_(526)),B_(function(e){return $x(e,Yx)},N_(761)),B_(function(e){return $x(e,Gx)},"parseBoxEnvValuesReplaceRequest"),B_(function(e){return Vx(e)},N_(662)),B_(function(e){const t=361,n=794,s=N_;return[...Object[s(333)](e[s(t)]),...Object.keys(e.secrets)][s(n)](e=>e===Rx)},N_(444)),B_($x,N_(713)),B_(Vx,"parseValueEnvelope"),B_(Yx,N_(606)),B_(Gx,N_(690)),B_(Xx,N_(515)),B_(Zx,N_(789));var Jx=[N_(589),N_(759),N_(367),"unknown-environment",N_(767),"reserved",N_(538),N_(682),N_(548),N_(707),N_(514)],Qx=["target","variable",N_(482)];function eb(e){const t=N_;return Array[t(455)](e)&&e[t(301)](e=>"string"==typeof e)?e:null}B_(function(e){const t=312,n=361,s=402,i=N_;if(!D_(e))return null;if(D_(e[i(695)])){const{code:t,message:n}=e[i(695)];return Jx[i(805)](t)?typeof n!==i(312)?null:{error:{code:t,message:n}}:null}const{status:r,environment:o}=e;if(typeof o!==i(t))return null;if(r===i(427)){const{target:t,variables:s,secrets:a,removed:l}=e;if(typeof t!==i(406))return null;const c=eb(s),h=eb(a);if(null===c||null===h||!D_(l))return null;const u=eb(l[i(n)]),d=eb(l[i(497)]);return"boolean"!=typeof l[i(694)]||null===u||null===d?null:{status:r,environment:o,target:t,variables:c,secrets:h,removed:{target:l[i(694)],variables:u,secrets:d}}}if("set"===r||r===i(s)){const{kind:t,name:n}=e;return Qx[i(805)](t)?void 0!==n&&"string"!=typeof n?null:{status:r,environment:o,kind:t,..."string"==typeof n?{name:n}:{}}:null}return null},N_(354)),B_(eb,N_(551)),B_(function(e){return Vx(e)},N_(411)),B_(function(e){return Yx(e)},"parseBoxSecretsRevealResponse");var tb=N_(451);function nb(e){return tb+"/"+encodeURIComponent(e)}function sb(e,t){const n=N_;return nb(e)+n(311)+encodeURIComponent(t)}function ib(e){const t=N_;return nb(e)+t(536)}B_(nb,N_(773)),B_(sb,N_(346)),B_(function(e,t){const n=N_;return sb(e,t)+n(591)},N_(711)),B_(function(e,t){return nb(e)+"/rules/"+encodeURIComponent(t)},N_(336)),B_(function(e){const t=N_;return nb(e)+t(351)},"boxNotifyQuietHoursPath"),B_(ib,N_(547)),B_(function(e,t){const n=N_;return ib(e)+"/"+encodeURIComponent(t)+n(435)},N_(421)),B_(function(e,t){return nb(e)+"/mutes/"+encodeURIComponent(t)},N_(674)),B_(function(e,t,n){const s=N_;return nb(e)+s(663)+encodeURIComponent(t)+s(388)+n},N_(799)),N_(660);var rb=["schedule","ci","manual",N_(434)],ob=[N_(481),"recovered",N_(330),N_(313)],ab=["failed",N_(649),N_(717),N_(330),N_(313)],lb=[N_(589),N_(339),N_(595),"unknown-rule",N_(494),N_(348),N_(538),N_(514)];function cb(e){const t=464,n=549,s=391,i=N_;if(!D_(e)||typeof e[i(391)]!==i(312))return null;const r=hb(e[i(499)],fb),o=hb(e[i(485)],vb),a=hb(e[i(t)],mb);if(null===r||null===o||null===a)return null;const l=void 0===e[i(n)]?void 0:_b(e.quietHours);return null===l?null:{project:e[i(s)],channels:r,rules:o,mutes:a,...void 0!==l?{quietHours:l}:{}}}function hb(e,t){const n=N_;if(!Array.isArray(e))return null;const s=[];for(const i of e){const e=t(i);if(null===e)return null;s[n(519)](e)}return s}function ub(e){const t=N_;return D_(e)&&typeof e[t(647)]===t(406)?{set:e.set}:null}function db(e){const t=520,n=320,s=417,i=320,r=481,o=695,a=N_;return D_(e)&&typeof e.at===a(t)?e[a(n)]!==a(s)&&e[a(i)]!==a(r)||void 0!==e[a(695)]&&typeof e[a(695)]!==a(312)?null:{at:e.at,outcome:e[a(320)],...void 0!==e.error?{error:e[a(o)]}:{}}:null}function fb(e){const t=312,n=406,s=512,i=660,r=778,o=324,a=516,l=516,c=482,h=309,u=N_;if(!D_(e))return null;const{id:d,name:f,enabled:p,kind:v}=e;if(typeof d!==u(312)||typeof f!==u(t)||typeof p!==u(n))return null;const g=void 0===e.lastDelivery?void 0:db(e[u(s)]);if(null===g)return null;const m={id:d,name:f,enabled:p,...void 0!==g?{lastDelivery:g}:{}};switch(v){case u(i):{const t=ub(e[u(r)]);return null===t?null:{...m,kind:v,webhookUrl:t}}case u(o):{const t=ub(e.botToken);return null===t||"string"!=typeof e[u(a)]||void 0!==e[u(424)]&&typeof e.threadId!==u(312)?null:{...m,kind:v,botToken:t,chatId:e[u(l)],...void 0!==e.threadId?{threadId:e.threadId}:{}}}case"webhook":{const t=ub(e[u(c)]);if(null===t||typeof e[u(309)]!==u(312))return null;const n=void 0===e[u(502)]?void 0:pb(e[u(502)]);return null===n?null:{...m,kind:v,url:e[u(h)],secret:t,...void 0!==n?{headers:n}:{}}}default:return null}}function pb(e){const t=N_;if(!D_(e))return null;const n={};for(const[s,i]of Object[t(586)](e)){const e=ub(i);if(null===e)return null;n[s]=e}return n}function vb(e){const t=408,n=406,s=312,i=626,r=301,o=590,a=590,l=408,c=590,h=524,u=730,d=730,f=N_;return D_(e)&&typeof e.id===f(312)&&typeof e[f(t)]===f(n)?void 0!==e[f(308)]&&typeof e.name!==f(s)?null:(void 0===e[f(626)]||bb(e[f(i)]))&&bb(e[f(747)])&&e.triggers[f(r)](yb)&&bb(e[f(o)])&&e[f(a)][f(301)](wb)&&bb(e.channels)&&typeof e[f(524)]===f(520)?void 0!==e[f(730)]&&"number"!=typeof e[f(730)]?null:{id:e.id,...void 0!==e[f(308)]?{name:e[f(308)]}:{},enabled:e[f(l)],...void 0!==e.environments?{environments:e.environments}:{},triggers:e[f(747)],events:e[f(c)],channels:e[f(499)],afterFailures:e[f(h)],...void 0!==e[f(u)]?{repeatEvery:e[f(d)]}:{}}:null:null}function gb(e){const t=300,n=559,s=N_;return D_(e)?!0===e.project?{project:!0}:typeof e.series===s(312)&&e[s(t)][s(n)]>0?{series:e[s(t)]}:null:null}function mb(e){const t=394,n=394,s=312,i=394,r=394,o=N_;if(!D_(e)||typeof e.id!==o(312)||typeof e.by!==o(312))return null;const a=gb(e.scope);return null===a||"number"!=typeof e.at||void 0!==e.until&&"number"!=typeof e[o(625)]||void 0!==e[o(t)]&&typeof e[o(n)]!==o(s)?null:{id:e.id,scope:a,...void 0!==e.until?{until:e.until}:{},by:e.by,...void 0!==e[o(i)]?{reason:e[o(r)]}:{},at:e.at}}function _b(e){const t=N_;if(!D_(e))return null;const{from:n,to:s,tz:i}=e;return typeof n!==t(312)||"string"!=typeof s||typeof i!==t(312)?null:{from:n,to:s,tz:i}}function xb(e){const t=795,n=312,s=694,i=532,r=710,o=754,a=481,l=484,c=520,h=359,u=369,d=N_;if(!D_(e)||typeof e.key!==d(312)||typeof e[d(t)]!==d(312))return null;if(!D_(e[d(694)])||typeof e.target.name!==d(n))return null;if(e[d(s)][d(532)]!==d(622)&&e.target[d(i)]!==d(r))return null;if("ok"!==e.state&&e[d(o)]!==d(a))return null;if(typeof e.reason!==d(312)||"number"!=typeof e[d(l)]||typeof e[d(443)]!==d(c))return null;if(void 0!==e[d(359)]&&typeof e[d(h)]!==d(520))return null;const f=void 0===e.mute?void 0:mb(e[d(u)]);return null===f?null:{key:e[d(686)],environment:e.environment,target:{kind:e[d(694)][d(532)],name:e[d(694)][d(308)]},state:e[d(o)],reason:e[d(394)],since:e[d(484)],failures:e.failures,...void 0!==e.lastNotifiedAt?{lastNotifiedAt:e[d(359)]}:{},...void 0!==f?{mute:f}:{}}}function bb(e){const t=N_;return Array[t(455)](e)&&e[t(301)](e=>typeof e===t(312))}function yb(e){return rb[N_(805)](e)}function wb(e){return ob[N_(805)](e)}function Sb(e){return typeof e===N_(312)&&ab.includes(e)}function kb(e){const t=Cb(e);return null===t?{}:{install:t}}function Cb(e){const t=766,n=481,s=422,i=541,r=520,o=N_;if(!D_(e))return null;const{startedAt:a,durationMs:l,outcome:c,source:h,packages:u}=e;return typeof a!==o(312)||typeof l!==o(520)||c!==o(771)&&c!==o(t)&&c!==o(n)?null:{startedAt:a,durationMs:l,outcome:c,...h===o(s)||h===o(438)||h===o(642)||h===o(i)?{source:h}:{},...D_(u)&&"number"==typeof u.total&&typeof u.cached===o(r)?{packages:{total:u.total,cached:u.cached}}:{}}}B_(function(e){const t=N_;if(!D_(e)||!Array[t(455)](e[t(762)]))return null;const n=e.projects[t(403)](cb);return n[t(301)](e=>null!==e)?{projects:n}:null},N_(708)),B_(cb,N_(741)),B_(function(e){const t=391,n=N_;if(!D_(e)||"string"!=typeof e[n(t)])return null;const s=hb(e[n(300)],xb);return null===s?null:{project:e[n(t)],series:s}},N_(656)),B_(function(e){const t=312,n=309,s=309,i=N_;return D_(e)&&Sb(e.state)&&typeof e.title===i(t)&&bb(e[i(487)])?void 0!==e[i(309)]&&"string"!=typeof e[i(n)]?null:{state:e.state,title:e[i(468)],lines:e[i(487)],...void 0!==e[i(309)]?{url:e[i(s)]}:{}}:null},N_(362)),B_(function(e){const t=680,n=417,s=680,i=399,r=631,o=312,a=N_;return D_(e)&&typeof e.channel===a(312)?e.status===a(417)?void 0!==e[a(t)]&&typeof e[a(680)]!==a(312)?null:{status:a(n),channel:e.channel,...void 0!==e[a(680)]?{note:e[a(s)]}:{}}:e[a(i)]===a(481)&&typeof e[a(r)]===a(o)?{status:"failed",channel:e[a(661)],message:e[a(631)]}:null:null},N_(425)),B_(function(e){const t=667,n=402,s=N_;if(!D_(e)||typeof e.id!==s(312))return null;const{status:i}=e;return i!==s(t)&&"updated"!==i&&i!==s(n)?null:{status:i,id:e.id}},N_(574)),B_(function(e){const t=N_;if(!D_(e)||!D_(e[t(695)]))return null;const{code:n,message:s}=e[t(695)];return lb.includes(n)&&"string"==typeof s?{error:{code:n,message:s}}:null},"parseBoxNotifyError"),B_(function(e){return Sb(e)},N_(475)),B_(function(e){const t=434,n=N_;switch(e){case"schedule":return{kind:e};case"ci":return{kind:e,by:n(668)};case n(817):return{kind:e,by:"ivan"};case n(t):return{kind:e}}},"boxNotifyPreviewTrigger"),B_(hb,N_(462)),B_(ub,N_(610)),B_(db,N_(511)),B_(fb,N_(393)),B_(pb,"parseHeaderFlags"),B_(vb,N_(700)),B_(gb,N_(396)),B_(mb,"parseMute"),B_(_b,N_(546)),B_(xb,N_(576)),B_(bb,N_(374)),B_(yb,N_(413)),B_(wb,"isEvent"),B_(Sb,N_(596)),N_(665),N_(655),N_(623),B_(kb,N_(299)),B_(Cb,"parseBoxReadInstall");var jb=[N_(589),N_(759),"unknown-environment",N_(395),N_(720),N_(797),N_(768),N_(682),N_(548),N_(538)];B_(function(e){const t=695,n=312,s=N_;if(!D_(e)||!D_(e[s(t)]))return null;const{code:i,message:r,retryAfterSeconds:o}=e[s(695)];return jb[s(805)](i)?typeof r!==s(n)?null:{error:{code:i,message:r,...typeof o===s(520)?{retryAfterSeconds:o}:{}}}:null},N_(456)),B_(function(e){const t=312,n=519,s=N_;if(!Array.isArray(e))return null;const i=[];for(const r of e){if(!D_(r))return null;const{name:e,project:o,environment:a,note:l,bundleId:c,install:h}=r;if(typeof e!==s(312)||typeof a!==s(t))return null;if(void 0!==o&&typeof o!==s(t))return null;if(void 0!==l&&"string"!=typeof l)return null;if(void 0!==c&&typeof c!==s(t))return null;i[s(n)]({name:e,environment:a,...void 0!==o?{project:o}:{},...void 0!==l?{note:l}:{},...void 0!==c?{bundleId:c}:{},...kb(h)})}return i},N_(378));function Nb(e,t){return"/api/box/envs/"+encodeURIComponent(e)+"/"+encodeURIComponent(t)+"/runs"}N_(654),N_(401),B_(Nb,N_(640)),B_(function(e,t,n){return Nb(e,t)+"/"+encodeURIComponent(n)},"boxRunPath"),B_(function(e){const t=N_;if(!D_(e))return null;const{kind:n,ref:s}=e;return n!==t(622)&&n!==t(710)||"string"!=typeof s||0===s.length?null:{kind:n,ref:s}},N_(612)),B_(function(e){const t=312,n=559,s=520,i=N_;if(!D_(e))return null;const{runId:r,acceptedAt:o}=e;return typeof r!==i(t)||0===r[i(n)]||typeof o!==i(s)?null:{runId:r,acceptedAt:o}},N_(602)),B_(function(e){const t=312,n=559,s=520,i=N_;if(!D_(e))return null;const{runId:r,state:o,exitCode:a,startedAt:l,finishedAt:c}=e;return typeof r!==i(t)||0===r[i(n)]||"queued"!==o&&o!==i(608)&&"finished"!==o||null!=a&&typeof a!==i(s)||void 0!==l&&typeof l!==i(520)||void 0!==c&&typeof c!==i(s)?null:{runId:r,state:o,...void 0!==a?{exitCode:a}:{},...void 0!==l?{startedAt:l}:{},...void 0!==c?{finishedAt:c}:{}}},"parseBoxRunStatus");function Mb(e){return Array[N_(455)](e)?e.some(e=>"string"!=typeof e)?null:e:null}function Bb(e){const t=312,n=559,s=406,i=312,r=N_;if(!D_(e))return null;const{bundleId:o,label:a,branch:l,sha:c,dirty:h,author:u,createdAt:d,webVersion:f}=e;if(typeof o!==r(t)||0===o[r(n)])return null;if(typeof a!==r(312)||typeof f!==r(312))return null;if(typeof h!==r(s))return null;if(typeof d!==r(520)||!Number[r(715)](d))return null;for(const p of[l,c,u])if(void 0!==p&&"string"!=typeof p)return null;return{bundleId:o,label:a,dirty:h,createdAt:d,webVersion:f,...typeof l===r(i)?{branch:l}:{},...typeof c===r(i)?{sha:c}:{},...typeof u===r(t)?{author:u}:{}}}function Db(e){const t=622,n=710,s=N_;return void 0!==e[s(622)]?{kind:"collection",name:e[s(t)]}:{kind:"scenario",name:e[s(n)]}}function Lb(e){const t=312,n=703,s=622,i=366,r=N_;if(!D_(e))return null;const{collection:o,scenario:a,cron:l,env:c,prepare:h,workers:u,source:d}=e,f=typeof o===r(t)&&o[r(559)]>0?void 0===a?{collection:o}:null:typeof a===r(312)&&a[r(559)]>0&&void 0===o?{scenario:a}:null;if(null===f)return null;if("string"!=typeof l||0===l[r(n)]().length)return null;if(void 0!==c&&typeof c!==r(312))return null;if(void 0!==h&&typeof h!==r(312))return null;const p=r(s)in f&&"number"==typeof u&&Number.isInteger(u)&&u>=1?u:void 0,v=d===r(521)||d===r(i)?d:void 0;return{...f,cron:l,...void 0!==c?{env:c}:{},...void 0!==h?{prepare:h}:{},...void 0!==p?{workers:p}:{},...void 0!==v?{source:v}:{}}}N_(315),B_(Mb,N_(726)),B_(Bb,"parseBundle"),B_(function(e){const t=312,n=520,s=312,i=N_;if(!D_(e))return null;if(1!==e.schemaVersion)return null;const{workspace:r,environment:o,allowSwitch:a,currentBundleId:l,switchedBy:c,switchedAt:h,bundles:u,variables:d,secrets:f,switchPath:p}=e;if(typeof r!==i(312)||typeof o!==i(312))return null;if(typeof a!==i(406))return null;if(!Array.isArray(u))return null;const v=[];for(const _ of u){const e=Bb(_);if(!e)return null;v[i(519)](e)}const g=Mb(d),m=Mb(f);if(!g||!m)return null;for(const _ of[l,c,p])if(void 0!==_&&typeof _!==i(t))return null;return void 0!==h&&typeof h!==i(n)?null:{schemaVersion:1,workspace:r,environment:o,allowSwitch:a,bundles:v,variables:g,secrets:m,...typeof l===i(s)?{currentBundleId:l}:{},...typeof c===i(312)?{switchedBy:c}:{},...typeof h===i(520)?{switchedAt:h}:{},..."string"==typeof p?{switchPath:p}:{}}},N_(317)),B_(Db,"scheduleTarget"),B_(Lb,"parseScheduleEntry"),B_(function(e){const t=652,n=307,s=532,i=706,r=543,o=N_;if(null==e)return{entries:[]};if(!D_(e))return{error:o(758)};const a=e[o(t)]??[];if(!Array.isArray(a))return{error:o(n)};const l=[],c=new Set;for(const[h,u]of a[o(586)]()){const e=Lb(u);if(!e)return{error:o(328)+h+"] is not a valid entry — it needs exactly one of `collection:` / `scenario:` plus a `cron:` string"};const t=Db(e),n=t[o(s)]+":"+t[o(308)];if(c.has(n))return{error:"schedules["+h+o(i)+t.kind+' "'+t[o(308)]+o(r)};c.add(n),l[o(519)](e)}return{entries:l}},N_(705)),B_(function(e,t){const n=403,s=403,i=811,r=532,o=308,a=N_,l=new Set(t[a(403)](e=>{const t=a,n=Db(e);return n[t(532)]+":"+n.name}));return[...e.filter(e=>{const t=a,n=Db(e);return!l[t(i)](n[t(r)]+":"+n[t(o)])})[a(n)](e=>({...e,source:"config"})),...t[a(s)](e=>({...e,source:"file"}))]},"mergeSchedules"),B_(function(e){const t=532,n=308,s=532,i=331,r=454,o=454,a=N_,l=e.map(e=>{const t=Ux,n=Db(e);return{kind:n[t(s)],name:n[t(308)],cron:e[t(i)],...void 0!==e[t(r)]?{env:e[t(o)]}:{},...void 0!==e[t(449)]?{prepare:e.prepare}:{},...void 0!==e[t(473)]?{workers:e.workers}:{}}}).sort((e,s)=>{const i=Ux,r=e.kind+":"+e[i(308)],o=s[i(t)]+":"+s[i(n)];return r<o?-1:r>o?1:0});return JSON[a(775)](l)},"canonicalScheduleSet"),B_(function(e){const t=455,n=519,s=N_;let i;try{i=JSON.parse(e)}catch{return null}if(!Array[s(t)](i))return null;const r=[];for(const o of i){const e=Lb(o);e&&r[s(n)](e)}return r},N_(719));var Eb={m5:{minutes:!1,hours:!1,days:!1},m15:{minutes:!1,hours:!1,days:!1},h1:{minutes:!0,hours:!1,days:!1},h2:{minutes:!0,hours:!1,days:!1},h4:{minutes:!0,hours:!1,days:!1},h6:{minutes:!0,hours:!1,days:!1},h12:{minutes:!0,hours:!1,days:!1},daily:{minutes:!0,hours:!0,days:!1},weekly:{minutes:!0,hours:!0,days:!0}},Pb={h2:2,h4:4,h6:6,h12:12};function Rb(e){const t=786,n=329,s=683,i=765,r=786,o=637,a=439,l=793,c=637,h=597,u=N_,d=qb(e[u(432)]);switch(e[u(t)]){case"m5":return u(469);case u(692):return u(n);case"h1":return d+" * * * *";case"h2":case"h4":case"h6":case u(s):return d+u(i)+Pb[e[u(r)]]+u(439);case u(666):return d+" "+qb(e[u(o)])+u(a);case u(l):return d+" "+qb(e[u(c)])+" * * "+qb(e[u(h)])}}function Ab(e){const t=556,n=384,s=306,i=505,r=666,o=793,a=N_,l=e[a(703)]()[a(t)](/\s+/);if(5!==l[a(559)])return null;const[c,h,u,d,f]=l;if("*"!==u||"*"!==d)return null;if("*"===h&&"*"===f){if(c===a(n))return Kb("m5");if(c===a(s))return Kb("m15");const e=$b(c);return e&&Kb("h1",e)}const p=$b(c);if(!p)return null;const v=/^\*\/(\d+)$/[a(i)](h);if(v&&"*"===f){const e=Object.keys(Pb)[a(493)](e=>Pb[e]===Number(v[1]));return e?Kb(e,p):null}const g=$b(h);if(!g)return null;if("*"===f)return Kb(a(r),p,g);const m=$b(f);return m&&Kb(a(o),p,g,m)}function zb(e){const t=Ab(e);return t?Tb(t):e}function Tb(e){const t=496,n=793,s=N_;switch(e[s(786)]){case"m5":return s(445);case s(692):return s(t);case"h1":return s(457)+Yb(e[s(432)]);case"h2":case"h4":case"h6":case s(683):return"every "+Pb[e[s(786)]]+"h"+Yb(e.minutes);case"daily":return s(379)+Gb(e);case s(n):return e[s(597)].map(e=>Wb[e]??String(e)).join(", ")+s(785)+Gb(e)}}function Ib(e,t){const n=N_,s=new Date(t);s[n(447)](0,0);for(let i=0;i<11520;i++)if(s[n(601)](s[n(555)]()+1),Ob(e,s))return s[n(433)]();return s[n(433)]()}function Ob(e,t){const n=630,s=786,i=692,r=432,o=805,a=683,l=432,c=N_,h=t[c(555)](),u=t[c(n)]();switch(e[c(s)]){case"m5":return h%5==0;case c(i):return h%15==0;case"h1":return e[c(r)][c(o)](h);case"h2":case"h4":case"h6":case c(a):return e[c(432)][c(805)](h)&&u%(Pb[e.freq]??1)===0;case"daily":return e[c(432)][c(805)](h)&&e.hours[c(805)](u);case c(793):return e[c(l)].includes(h)&&e[c(637)][c(805)](u)&&e[c(597)][c(805)](t[c(545)]())}}function Hb(e,t){const n=630,s=465,i=560,r=545,o=N_,a=new Date(e),l=new Date(t),c=Vb(a[o(n)]())+":"+Vb(a.getMinutes()),h=Math[o(562)]((Fb(a)-Fb(l))/864e5);return 0===h?o(s)+c:1===h?o(i)+c:Wb[a[o(r)]()]+" "+c}function Fb(e){const t=N_,n=new Date(e);return n[t(431)](0,0,0,0),n.getTime()}B_(Rb,N_(639)),B_(Ab,"specFromCron"),B_(zb,N_(397)),B_(Tb,N_(506)),B_(Ib,N_(522)),B_(Ob,N_(577)),B_(Hb,N_(806)),B_(Fb,N_(617));var Wb=[N_(644),N_(769),N_(491),"Wed",N_(689),N_(607),N_(437)],Ub=[1,2,3,4,5,6,0];function Kb(e,t=[0],n=[3],s=[1]){return{freq:e,minutes:t,hours:n,days:s}}function qb(e){const t=N_;return[...e].sort((e,t)=>e-t)[t(498)](",")}function $b(e){return/^\d+(,\d+)*$/[N_(508)](e)?e.split(",").map(Number):null}B_(Kb,N_(779)),B_(qb,N_(729)),B_($b,"numbers");var Vb=B_(e=>String(e).padStart(2,"0"),N_(504));function Yb(e){const t=N_;return 1===e.length&&0===e[0]?"":t(785)+[...e].sort((e,t)=>e-t).map(e=>":"+Vb(e)).join(", ")}function Gb(e){const t=559,n=498,s=N_,i=[...e.hours].sort((e,t)=>e-t)[s(618)](t=>[...e.minutes].sort((e,t)=>e-t).map(e=>Vb(t)+":"+Vb(e))),r=i[s(370)](0,4),o=i[s(t)]-r.length;return r[s(n)](", ")+(o>0?" +"+o:"")}B_(Yb,N_(407)),B_(Gb,N_(733));var Xb=N_(566),Zb=/^[0-9a-f]{8,}$/,Jb=(B_(t=class extends Error{constructor(e){const t=N_;super("blob hash must be lowercase hex, got: "+e),this[t(308)]=t(563)}},"InvalidBlobHashError"),t);function Qb(e,t,n=0){const s=370,i=370,r=N_;if(!Zb.test(e))throw new Jb(e);const o=n>0?"~"+n:"";return[Xb,e[r(s)](0,2),e[r(i)](2,4),""+e+o+"."+t]}function ey(e,t,n=0){const s=N_;return Qb(e,t,n)[s(498)]("/")}B_(function(e,t,n,s=0){return e+"/"+ey(t,n,s)},N_(587)),B_(Qb,"blobRelSegmentsFor"),B_(ey,N_(446)),B_(function(e){return e+"/"+Xb},N_(557));var ty=/[\\/:*?"<>|\x00-\x1f]/;function ny(e,t){const n=703,s=559,i=500,r=681,o=400,a=681,l=N_;if("string"!=typeof e)return l(319);const c=e[l(n)]();return 0===c[l(s)]?l(430):"."===c||".."===c?l(i):c[l(r)](".")?l(o):(null==t?void 0:t.reservedUnderscore)&&c[l(a)]("_")?"must not start with '_' (reserved)":ty[l(508)](c)?'must not contain \\ / : * ? " < > | or control characters':null}function sy(e){return ny(e)}B_(ny,N_(716)),B_(sy,N_(764)),B_(function({environment:e,collection:t}){return N_(697)+e+" --collection "+t},N_(781));var iy=N_(353),ry=N_(669),oy=[N_(518),"ci","manual","cli"];B_(function(e){var t,n;const s=N_,i=null==(t=e[iy])?void 0:t[s(703)]();if(!i||!oy[s(805)](i))return;const r=null==(n=e[ry])?void 0:n[s(703)]();return{kind:i,...r?{by:r}:{}}},N_(340)),B_(function(e){const t=N_;return{[iy]:e[t(532)],...void 0!==e.by?{[ry]:e.by}:{}}},N_(569)),B_(function(e){const t=434,n=N_;return e[n(561)]??{kind:n(t)}},N_(757)),N_(735),B_(class extends Error{constructor(e,t){const n=442,s=N_;super(s(645)+t+'" does not support run kind "'+e+'"'),this[s(308)]=s(n)}},"UnsupportedRunKindError"),B_(class extends Error{constructor(e,t){const n=718,s=308,i=N_;super(i(635)+e+i(n)+t),this[i(s)]="RunnerAdapterNotFoundError"}},"RunnerAdapterNotFoundError"),B_(class extends Error{constructor(e){const t=N_;super(e),this[t(308)]=t(636)}},N_(636));var ay=N_(318),ly=/^\s*\/\/\s*@([a-z0-9-]+)\s*$/;function cy(e){return ny(e,{reservedUnderscore:!0})}B_(function(e){return ly[N_(508)](e)},N_(807)),B_(function(e){const t=556,n=811,s=N_,i=new Set;for(const r of e[s(t)](/\r?\n/)){const e=r[s(703)]();if(""===e)continue;if(!e[s(681)]("//"))break;const t=e[s(337)](ly);t&&i.add(t[1])}return{expectFail:i[s(n)](ay)}},"parseScenarioAnnotations"),B_(cy,N_(745));var hy=N_(575),uy=new Set(["UNOTEST_BROWSER",N_(477),"UNOTEST_HEADED","UNOTEST_SLOW_MO",N_(750),N_(474),"UNOTEST_POPUP_GRACE_MS",N_(410),N_(684),"UNOTEST_LOG_LEVEL",N_(341),N_(696),"UNOTEST_DEBUG_MAX_BYTES",N_(701),N_(466),N_(702),N_(802),N_(335),N_(490),N_(418),N_(725),N_(743),N_(302),N_(693),N_(459),N_(727)]);function dy(e){return uy.has(e)}function fy(e){return/^[A-Z][A-Z0-9_]*$/.test(e)}B_(dy,N_(698)),B_(function(e){const t=N_;return"secrets"===e[t(542)]?t(482):dy(e[t(308)])?t(751):t(539)},N_(742)),B_(fy,N_(377));var py={app:N_(368),runner:N_(628),secret:void 0};B_(function(e){const t=343,n=533,s=588,i=811,r=376,o=497,a=479,l=509,c=519,h=357,u=482,d=519,f=389,p=N_,{name:v,kind:g}=e;if("runner"===g){if(!dy(v))return{ok:!1,code:p(t),message:v+p(687)}}else if(!fy(v))return{ok:!1,code:p(n),message:v+p(314)};const m=Mx(e[p(s)])[p(i)](v),_=Mx(e[p(r)]).has(v),x=g===p(482)?p(497):"env",b=x===p(o)?_:m,y=x===p(o)?p(a):p(756);if(b)return{ok:!1,code:p(772),message:v+p(l)+y+p(452)};const w=[];return g===p(482)&&m&&w[p(c)](v+p(h)),g!==p(u)&&_&&w[p(d)](v+p(f)),{ok:!0,target:x,sectionLabel:py[g],warnings:w}},N_(624)),B_(function(e,t,n){return void 0!==n&&n!==t?[e+N_(419)]:[]},N_(791));var vy=[N_(774),N_(481),N_(478)];B_(function(e){return vy.includes(e)},N_(790)),N_(613),N_(571),N_(815),N_(598),N_(803),N_(412),N_(322),N_(537),N_(527),N_(678),N_(338),N_(760),N_(627),B_(function(e){const t=724,n=568,s=552,i=503,r=N_;if(e[r(532)]===r(746)){const n=e[r(t)]?r(529):"";return r(611)+e[r(503)]+'", size '+e.size+n}return e.kind===r(n)?null===e[r(503)]?r(s):r(676)+e.boxName+'"':r(704)+e[r(i)]+'"'},N_(365)),B_(function(e){const t=568,n=476,s=N_;return e[s(532)]===s(t)?s(n):"Price"},N_(472)),B_(function(e,t){const n=N_;return null===t?null:e.kind===n(568)?e[n(658)]?{kind:"included"}:{kind:n(755),cents:t,surcharge:!0}:{kind:n(755),cents:t,surcharge:!1}},"approvalPrice"),N_(373);B_(function(e){const t=532,n=503,s=632,i=N_;return e.kind===i(746)?"The first hour is charged when you approve, then every started hour until the box is deleted.":e[i(t)]===i(568)?null===e[i(n)]?"There is no hourly charge: the account's monthly ceiling bounds what the Picker can spend. Each project still connects on its own, with npx @unotest/web picker on.":i(s):"The machine and everything on it — runs, screenshots, bundles — are deleted. The rest of the paid hour is not refunded. There is no undo."},N_(709));var gy=["POST /device/code","POST /device/token",N_(744),N_(441),"GET /rates",N_(461),N_(440),N_(332),N_(739),N_(731),N_(517),N_(350),N_(641),N_(530),N_(712),N_(798),"POST /account/picker/access",N_(375),N_(616),N_(657)];function my(e){try{return decodeURIComponent(e)}catch{return}}function _y(...e){return e.filter(Boolean).join(" ")}B_(function(e,t){const n=556,s=370,i=N_,r=t[i(n)]("/");for(const o of gy){const[t,a=""]=o.split(" ");if(t!==e)continue;const l=a[i(n)]("/");if(l[i(559)]!==r[i(559)])continue;const c={};if(l[i(301)]((e,t)=>{const n=i,o=r[t]??"";if(!e[n(681)](":"))return e===o;if(""===o)return!1;const a=my(o);return void 0!==a&&(c[e[n(s)](1)]=a,!0)}))return{route:o,params:c}}},N_(390)),B_(my,N_(345));const xy={clock:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("circle",{cx:"12",cy:"12",r:"9"}),Bn.jsx("path",{d:"M12 7v5l3 2"})]}),user:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("circle",{cx:"12",cy:"8",r:"3.5"}),Bn.jsx("path",{d:"M5.5 20a6.5 6.5 0 0 1 13 0"})]}),search:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("circle",{cx:"11",cy:"11",r:"7"}),Bn.jsx("path",{d:"m20 20-3.5-3.5"})]}),refresh:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("path",{d:"M3 12a9 9 0 0 1 15.5-6.3L21 8"}),Bn.jsx("path",{d:"M21 3v5h-5"}),Bn.jsx("path",{d:"M21 12a9 9 0 0 1-15.5 6.3L3 16"}),Bn.jsx("path",{d:"M3 21v-5h5"})]}),sun:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("circle",{cx:"12",cy:"12",r:"4"}),Bn.jsx("path",{d:"M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"})]}),moon:Bn.jsx("path",{d:"M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8Z"}),monitor:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("rect",{x:"3",y:"4",width:"18",height:"12",rx:"2"}),Bn.jsx("path",{d:"M8 20h8M12 16v4"})]}),chevronR:Bn.jsx("path",{d:"m9 6 6 6-6 6"}),chevronD:Bn.jsx("path",{d:"m6 9 6 6 6-6"}),check:Bn.jsx("path",{d:"M5 12.5 10 17l9-10"}),x:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("path",{d:"M6 6l12 12"}),Bn.jsx("path",{d:"M18 6 6 18"})]}),alert:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("circle",{cx:"12",cy:"12",r:"9"}),Bn.jsx("path",{d:"M12 8v5"}),Bn.jsx("path",{d:"M12 16.5h.01"})]}),play:Bn.jsx("path",{d:"M7 5v14l12-7Z"}),pause:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("rect",{x:"6",y:"5",width:"4",height:"14",rx:"0.5"}),Bn.jsx("rect",{x:"14",y:"5",width:"4",height:"14",rx:"0.5"})]}),square:Bn.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"}),camera:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("path",{d:"M3 8h3l2-2.5h8L18 8h3v11H3Z"}),Bn.jsx("circle",{cx:"12",cy:"13",r:"3.5"})]}),terminal:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("path",{d:"m5 8 4 4-4 4"}),Bn.jsx("path",{d:"M12 18h7"})]}),network:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("circle",{cx:"12",cy:"6",r:"2"}),Bn.jsx("circle",{cx:"6",cy:"18",r:"2"}),Bn.jsx("circle",{cx:"18",cy:"18",r:"2"}),Bn.jsx("path",{d:"M12 8v3M6 16l5-5M18 16l-5-5"})]}),tree:Bn.jsx("path",{d:"M4 5h6M4 12h10M4 19h14"}),home:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("path",{d:"M4 10.5 12 4l8 6.5V19a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1Z"}),Bn.jsx("path",{d:"M9.5 20v-6h5v6"})]}),file:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("path",{d:"M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8Z"}),Bn.jsx("path",{d:"M14 3v5h5"})]}),code:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("path",{d:"m9 8-5 4 5 4"}),Bn.jsx("path",{d:"m15 8 5 4-5 4"})]}),braces:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("path",{d:"M8 4H7a3 3 0 0 0-3 3v3l-1 2 1 2v3a3 3 0 0 0 3 3h1"}),Bn.jsx("path",{d:"M16 4h1a3 3 0 0 1 3 3v3l1 2-1 2v3a3 3 0 0 1-3 3h-1"})]}),variable:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("path",{d:"M5 5c-2 4-2 10 0 14"}),Bn.jsx("path",{d:"M19 5c2 4 2 10 0 14"}),Bn.jsx("path",{d:"m9 15 6-6"}),Bn.jsx("path",{d:"m9 9 6 6"})]}),layers:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("path",{d:"m12 3 9 5-9 5-9-5 9-5Z"}),Bn.jsx("path",{d:"m3 13 9 5 9-5"}),Bn.jsx("path",{d:"m3 18 9 5 9-5"})]}),list:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("path",{d:"M9 6h12M9 12h12M9 18h12"}),Bn.jsx("circle",{cx:"4",cy:"6",r:"1"}),Bn.jsx("circle",{cx:"4",cy:"12",r:"1"}),Bn.jsx("circle",{cx:"4",cy:"18",r:"1"})]}),history:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("path",{d:"M3 12a9 9 0 1 0 3-6.7L3 8"}),Bn.jsx("path",{d:"M3 3v5h5"}),Bn.jsx("path",{d:"M12 7v5l3 2"})]}),activity:Bn.jsx("path",{d:"M3 12h4l3-8 4 16 3-8h4"}),plus:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("path",{d:"M12 5v14"}),Bn.jsx("path",{d:"M5 12h14"})]}),trash:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("path",{d:"M4 7h16"}),Bn.jsx("path",{d:"M9 7V4h6v3"}),Bn.jsx("path",{d:"M6 7v13a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7"}),Bn.jsx("path",{d:"M10 11v7M14 11v7"})]}),grip:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("circle",{cx:"9",cy:"6",r:"1"}),Bn.jsx("circle",{cx:"9",cy:"12",r:"1"}),Bn.jsx("circle",{cx:"9",cy:"18",r:"1"}),Bn.jsx("circle",{cx:"15",cy:"6",r:"1"}),Bn.jsx("circle",{cx:"15",cy:"12",r:"1"}),Bn.jsx("circle",{cx:"15",cy:"18",r:"1"})]}),panel:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1.5"}),Bn.jsx("path",{d:"M9 4v16"})]}),panelRight:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1.5"}),Bn.jsx("path",{d:"M15 4v16"})]}),externalL:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("path",{d:"M14 4h6v6"}),Bn.jsx("path",{d:"m20 4-9 9"}),Bn.jsx("path",{d:"M19 14v5a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h5"})]}),copy:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("rect",{x:"9",y:"9",width:"11",height:"11",rx:"2"}),Bn.jsx("path",{d:"M5 15V5a2 2 0 0 1 2-2h10"})]}),folder:Bn.jsx("path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z"}),folderPlus:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z"}),Bn.jsx("path",{d:"M12 10v6"}),Bn.jsx("path",{d:"M9 13h6"})]}),package:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("path",{d:"M21 8v8a2 2 0 0 1-1 1.73l-7 4a2 2 0 0 1-2 0l-7-4A2 2 0 0 1 3 16V8a2 2 0 0 1 1-1.73l7-4a2 2 0 0 1 2 0l7 4A2 2 0 0 1 21 8Z"}),Bn.jsx("path",{d:"m3.3 7 8.7 5 8.7-5"}),Bn.jsx("path",{d:"M12 22V12"})]}),clipboard:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",ry:"1"}),Bn.jsx("path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"})]}),inspect:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("path",{d:"M3 11V5a2 2 0 0 1 2-2h6"}),Bn.jsx("path",{d:"M21 13V5a2 2 0 0 0-2-2h-4"}),Bn.jsx("path",{d:"M3 13v6a2 2 0 0 0 2 2h6"}),Bn.jsx("path",{d:"m13 13 8 8"}),Bn.jsx("path",{d:"m17 13 4 4"})]}),more:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("circle",{cx:"5",cy:"12",r:"1.2"}),Bn.jsx("circle",{cx:"12",cy:"12",r:"1.2"}),Bn.jsx("circle",{cx:"19",cy:"12",r:"1.2"})]}),spinner:Bn.jsx("path",{d:"M21 12a9 9 0 1 1-6.2-8.55"}),edit:Bn.jsx("path",{d:"M16.5 3.5a2.121 2.121 0 1 1 3 3L7 19l-4 1 1-4 12.5-12.5Z"}),bug:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("path",{d:"M9 8V6a3 3 0 1 1 6 0v2"}),Bn.jsx("rect",{x:"6",y:"8",width:"12",height:"11",rx:"6"}),Bn.jsx("path",{d:"M12 12v7M3 13h3M18 13h3M5 7l3 2M19 7l-3 2M5 19l3-2M19 19l-3-2"})]}),stepOver:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("path",{d:"M4 12a8 8 0 0 1 14-5"}),Bn.jsx("path",{d:"M18 3v5h-5"}),Bn.jsx("circle",{cx:"12",cy:"18",r:"1.6",fill:"currentColor",stroke:"none"})]}),bp:Bn.jsx("circle",{cx:"12",cy:"12",r:"5",fill:"currentColor",stroke:"none"}),arrowR:Bn.jsx("path",{d:"m9 6 8 6-8 6Z",fill:"currentColor",stroke:"none"}),minus:Bn.jsx("path",{d:"M5 12h14"}),claude:Bn.jsx("path",{fill:"currentColor",stroke:"none",d:"m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z"}),codex:Bn.jsx("path",{fill:"currentColor",stroke:"none",d:"M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z"}),eye:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("path",{d:"M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7Z"}),Bn.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),eyeOff:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("path",{d:"M9.9 4.24A9.1 9.1 0 0 1 12 4c6.5 0 10 7 10 7a13.2 13.2 0 0 1-2.16 2.92"}),Bn.jsx("path",{d:"M6.6 6.6A13.3 13.3 0 0 0 2 11s3.5 7 10 7a9.2 9.2 0 0 0 4.4-1.1"}),Bn.jsx("path",{d:"M9.9 9.9a3 3 0 0 0 4.2 4.2"}),Bn.jsx("path",{d:"m2 2 20 20"})]}),target:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("circle",{cx:"12",cy:"12",r:"7"}),Bn.jsx("path",{d:"M12 2v3M12 19v3M2 12h3M19 12h3"}),Bn.jsx("circle",{cx:"12",cy:"12",r:"1.4",fill:"currentColor",stroke:"none"})]}),text:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("path",{d:"M5 19 11 5h2l6 14"}),Bn.jsx("path",{d:"M7.5 14.5h9"})]}),globe:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("circle",{cx:"12",cy:"12",r:"9"}),Bn.jsx("path",{d:"M3 12h18"}),Bn.jsx("path",{d:"M12 3c2.5 2.6 2.5 15.4 0 18M12 3c-2.5 2.6-2.5 15.4 0 18"})]}),phone:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("rect",{x:"7",y:"3",width:"10",height:"18",rx:"2"}),Bn.jsx("path",{d:"M11 18h2"})]}),cube:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("path",{d:"m12 3 8 4.5v9L12 21l-8-4.5v-9Z"}),Bn.jsx("path",{d:"M12 12v9M4 7.5l8 4.5 8-4.5"})]})};function by({name:e,className:t="h-4 w-4",strokeWidth:n=1.75}){return Bn.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:n,strokeLinecap:"round",strokeLinejoin:"round",className:t,"aria-hidden":"true",children:xy[e]})}const yy=[{value:"off",label:"not set"},{value:"m5",label:"every 5 minutes"},{value:"m15",label:"every 15 minutes"},{value:"h1",label:"every hour"},{value:"h2",label:"every 2 hours"},{value:"h4",label:"every 4 hours"},{value:"h6",label:"every 6 hours"},{value:"h12",label:"every 12 hours"},{value:"daily",label:"every day"},{value:"weekly",label:"every week"}],wy=Array.from({length:12},(e,t)=>5*t),Sy=Array.from({length:24},(e,t)=>t),ky=w_(function(){const e=j_(),t=e.schedules.editing;return t?e.schedules.readOnly?Bn.jsx(My,{target:t,deployed:!0},`${t.kind}:${t.name}`):"config"===e.schedules.sourceOf(t.kind,t.name)?Bn.jsx(My,{target:t},`${t.kind}:${t.name}`):Bn.jsx(By,{target:t},`${t.kind}:${t.name}`):null});function Cy({target:e,onClose:t,children:n}){return bn.useEffect(()=>{const e=e=>{"Escape"===e.key&&t()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t]),Bn.jsx("div",{className:"fixed inset-0 z-50 grid place-items-center bg-black/30 backdrop-blur-[1px]",onMouseDown:t,children:Bn.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":`Schedule for ${e.name}`,onMouseDown:e=>e.stopPropagation(),className:_y("w-[min(440px,calc(100vw-2rem))] rounded-lg p-4","border border-edge-soft bg-overlay shadow-xl"),children:[Bn.jsxs("div",{className:"flex items-center gap-2",children:[Bn.jsx(by,{name:"clock",className:"h-3.5 w-3.5 text-fg-4"}),Bn.jsx("span",{className:"font-mono text-[10.5px] uppercase tracking-wider text-fg-4",children:"schedule"}),Bn.jsx("span",{className:"min-w-0 flex-1 truncate text-right font-mono text-[12px] text-fg-2",children:e.name}),Bn.jsx("span",{className:"rounded border border-edge-soft px-1.5 py-px font-mono text-[9.5px] uppercase tracking-wider text-fg-4",children:"scenario"===e.kind?"test":"collection"})]}),n]})})}function jy({spec:e,cron:t}){return Bn.jsxs("div",{className:"mt-1.5 font-mono text-[10.5px] text-fg-4",children:["next: ",Hb(Ib(e,Date.now()),Date.now())," ",Bn.jsx("span",{className:"text-fg-4/70",children:"· your clock"}),Bn.jsxs("span",{className:"float-right text-fg-4/70",children:["cron: ",t]})]})}function Ny({children:e}){return Bn.jsxs("div",{className:"mt-4 flex items-start gap-2 rounded border border-edge-soft bg-raised/50 px-2.5 py-2 text-[11px] leading-relaxed text-fg-4",children:[Bn.jsx(by,{name:"alert",className:"mt-px h-3.5 w-3.5 shrink-0"}),Bn.jsx("span",{children:e})]})}const My=w_(function({target:e,deployed:t=!1}){const n=j_().schedules,s=n.get(e.kind,e.name),i=s?Ab(s.cron):null;return Bn.jsxs(Cy,{target:e,onClose:n.closeEditor,children:[Bn.jsxs("div",{className:"mt-4 font-mono text-[12.5px] text-fg-2",children:[s?zb(s.cron):"not scheduled",(null==s?void 0:s.env)&&Bn.jsxs("span",{className:"text-fg-4",children:[" · env ",s.env]})]}),s&&i&&Bn.jsx(jy,{spec:i,cron:s.cron}),Bn.jsx(Ny,{children:t?Bn.jsxs(Bn.Fragment,{children:["Declared in the repo (",Bn.jsx("span",{className:"font-mono",children:"unotest/schedules.yaml"})," or"," ",Bn.jsx("span",{className:"font-mono",children:"unotest.config"}),") — edit it there and push. This box applies whatever the deployed bundle declares."]}):Bn.jsxs(Bn.Fragment,{children:["Declared in ",Bn.jsx("span",{className:"font-mono",children:"unotest.config"})," — edit it there. This popup edits only"," ",Bn.jsx("span",{className:"font-mono",children:"unotest/schedules.yaml"}),"."]})}),Bn.jsx("div",{className:"mt-4 flex items-center justify-end",children:Bn.jsx("button",{type:"button",onClick:n.closeEditor,className:"h-7 rounded border border-edge-soft bg-canvas px-3 font-mono text-[11.5px] text-fg-2 hover:bg-raised",children:"Close"})})]})}),By=w_(function({target:e}){const t=j_(),n=t.schedules,s=n.get(e.kind,e.name),i=s?Ab(s.cron):null,r=null!==s&&null===i,[o,a]=bn.useState((null==i?void 0:i.freq)??"off"),[l,c]=bn.useState((null==i?void 0:i.minutes)??[0]),[h,u]=bn.useState((null==i?void 0:i.hours)??[3]),[d,f]=bn.useState((null==i?void 0:i.days)??[1]),[p,v]=bn.useState((null==s?void 0:s.env)??""),[g,m]=bn.useState(null),_="off"===o?null:{freq:o,minutes:l,hours:h,days:d},x="off"===o?null:Eb[o];return Bn.jsxs(Cy,{target:e,onClose:n.closeEditor,children:[Bn.jsxs("label",{className:"mt-4 block",children:[Bn.jsx("span",{className:"font-mono text-[10.5px] uppercase tracking-wider text-fg-4",children:"run"}),Bn.jsx("select",{value:o,autoFocus:!0,onChange:e=>a(e.target.value),className:_y("mt-1 h-8 w-full rounded border border-edge-soft bg-canvas px-2","font-mono text-[12.5px] text-fg focus:border-accent focus:outline-none"),children:yy.map(e=>Bn.jsx("option",{value:e.value,children:e.label},e.value))})]}),r&&"off"===o&&Bn.jsxs("div",{className:"mt-2 font-mono text-[10.5px] text-warn",children:["current schedule is a custom cron: ",s.cron]}),(null==x?void 0:x.days)&&Bn.jsx(Ly,{label:"days",children:Ub.map(e=>Bn.jsx(Ey,{label:Wb[e]??String(e),wide:!0,selected:d.includes(e),onToggle:()=>f(Dy(d,e))},e))}),(null==x?void 0:x.hours)&&Bn.jsx(Ly,{label:"hours",children:Sy.map(e=>Bn.jsx(Ey,{label:Py(e),selected:h.includes(e),onToggle:()=>u(Dy(h,e))},e))}),(null==x?void 0:x.minutes)&&Bn.jsx(Ly,{label:"minutes",children:wy.map(e=>Bn.jsx(Ey,{label:Py(e),selected:l.includes(e),onToggle:()=>c(Dy(l,e))},e))}),_&&Bn.jsx(jy,{spec:_,cron:Rb(_)}),Bn.jsxs("label",{className:"mt-4 flex items-center gap-3",children:[Bn.jsx("span",{className:"font-mono text-[10.5px] uppercase tracking-wider text-fg-4",children:"env"}),Bn.jsxs("select",{value:p,onChange:e=>v(e.target.value),className:_y("h-7 flex-1 rounded border border-edge-soft bg-canvas px-2","font-mono text-[12px] text-fg-2 focus:border-accent focus:outline-none"),children:[Bn.jsx("option",{value:"",children:"base"}),t.environments.names.map(e=>Bn.jsx("option",{value:e,children:e},e))]})]}),Bn.jsxs(Ny,{children:["Saved to ",Bn.jsx("span",{className:"font-mono",children:"unotest/schedules.yaml"})," — declared here, and a box runs what you push: the schedule travels with the bundle 1:1."]}),g&&Bn.jsx("div",{className:"mt-3 rounded border border-fail/30 bg-fail/10 px-2.5 py-1.5 font-mono text-[10.5px] text-fail",children:g}),Bn.jsxs("div",{className:"mt-4 flex items-center justify-end gap-2",children:[Bn.jsx("button",{type:"button",onClick:n.closeEditor,className:"h-7 rounded border border-edge-soft bg-canvas px-3 font-mono text-[11.5px] text-fg-2 hover:bg-raised",children:"Cancel"}),Bn.jsx("button",{type:"button",onClick:()=>{(async()=>{let e;if(null===_){if(!s)return void n.closeEditor();e=await n.remove()}else e=await n.save({cron:Rb(_),env:""===p?null:p});null!==e&&m(e)})()},className:"h-7 rounded bg-accent px-3 font-mono text-[11.5px] font-medium text-on-accent hover:bg-accent-hover",children:"Save"})]})]})});function Dy(e,t){return e.includes(t)?1===e.length?e:e.filter(e=>e!==t):[...e,t]}function Ly({label:e,children:t}){return Bn.jsxs("div",{className:"mt-3",children:[Bn.jsx("div",{className:"font-mono text-[10.5px] uppercase tracking-wider text-fg-4",children:e}),Bn.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1",children:t})]})}function Ey({label:e,selected:t,onToggle:n,wide:s=!1}){return Bn.jsx("button",{type:"button","aria-pressed":t,onClick:n,className:_y("h-6 rounded border font-mono text-[10.5px] tabular-nums",s?"px-2.5":"w-8",t?"border-accent/40 bg-accent/15 text-accent":"border-edge-soft bg-canvas text-fg-4 hover:bg-raised hover:text-fg-2"),children:e})}const Py=e=>String(e).padStart(2,"0");function Ry(e){return t=>{t.preventDefault();const n="x"===e.axis?t.clientX:t.clientY,s=e.value,i=t=>{const i="x"===e.axis?t.clientX:t.clientY;e.onChange(Math.min(e.max(),Math.max(e.min,s+(i-n)*e.dir)))},r=()=>{window.removeEventListener("pointermove",i),window.removeEventListener("pointerup",r),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="x"===e.axis?"ew-resize":"ns-resize",document.body.style.userSelect="none",window.addEventListener("pointermove",i),window.addEventListener("pointerup",r)}}function Ay(e,t){bn.useEffect(()=>{const n=n=>{var s;(null==(s=e.current)?void 0:s.contains(n.target))||t()},s=e=>{"Escape"===e.key&&t()},i=()=>t();return window.addEventListener("mousedown",n,!0),window.addEventListener("contextmenu",n,!0),window.addEventListener("keydown",s),window.addEventListener("scroll",i,!0),()=>{window.removeEventListener("mousedown",n,!0),window.removeEventListener("contextmenu",n,!0),window.removeEventListener("keydown",s),window.removeEventListener("scroll",i,!0)}},[e,t])}function zy({x:e,y:t,items:n,onClose:s}){const i=bn.useRef(null),{left:r,top:o,mounted:a}=function(e,t,n){const[s,i]=bn.useState({left:t,top:n}),[r,o]=bn.useState(!1);return bn.useEffect(()=>{const s=e.current;if(!s)return;const{innerWidth:r,innerHeight:a}=window,l=s.getBoundingClientRect();let c=t,h=n;c+l.width>r-6&&(c=Math.max(6,r-l.width-6)),h+l.height>a-6&&(h=Math.max(6,a-l.height-6)),i({left:c,top:h});const u=requestAnimationFrame(()=>o(!0));return()=>cancelAnimationFrame(u)},[e,t,n]),{left:s.left,top:s.top,mounted:r}}(i,e,t);return Ay(i,s),Bn.jsx("div",{ref:i,role:"menu",style:{left:r,top:o,opacity:a?1:0,transform:a?"translateY(0)":"translateY(-2px)",transitionProperty:"opacity, transform",transitionDuration:"90ms",transitionTimingFunction:"ease-out"},className:_y("fixed z-50 min-w-[208px] overflow-hidden rounded-lg p-1","border border-edge-soft bg-overlay/95 backdrop-blur","shadow-lg"),children:n.map((e,t)=>{if("separator"===e.kind)return Bn.jsx("div",{className:"my-1 h-px bg-edge-soft"},t);if("header"===e.kind)return Bn.jsx("div",{className:"select-none truncate px-2 pb-1 pt-1 font-mono text-[10px] font-medium uppercase tracking-wider text-fg-4",children:e.label},t);const n="danger"===e.tone;return Bn.jsxs("button",{type:"button",role:"menuitem",disabled:e.disabled,onClick:()=>{e.disabled||(e.onSelect(),s())},className:_y("group flex h-7 w-full items-center gap-2 rounded-md px-2 text-left font-mono text-[12px]",e.disabled?"cursor-default text-fg-4":n?"text-fg-2 hover:bg-fail/10 hover:text-fail":"text-fg-2 hover:bg-raised hover:text-fg"),children:[Bn.jsx("span",{className:_y("grid h-4 w-4 shrink-0 place-items-center",e.disabled?"text-fg-4":n?"text-fg-3 group-hover:text-fail":"text-fg-3"),children:e.icon&&Bn.jsx(by,{name:e.icon,className:"h-3.5 w-3.5",strokeWidth:1.75})}),Bn.jsx("span",{className:"truncate",children:e.label}),e.shortcut&&Bn.jsx("span",{className:"ml-auto pl-4 font-mono text-[10.5px] tracking-wider text-fg-4",children:e.shortcut})]},t)})})}function Ty({axis:e,onPointerDown:t,className:n}){return Bn.jsx("div",{onPointerDown:t,role:"separator","aria-orientation":"x"===e?"vertical":"horizontal",title:"Drag to resize",className:_y("group/resize absolute z-20 touch-none","x"===e?"inset-y-0 w-[7px] cursor-ew-resize":"inset-x-0 h-[7px] cursor-ns-resize",n),children:Bn.jsx("span",{className:_y("absolute bg-transparent group-hover/resize:bg-accent/60 group-active/resize:bg-accent","x"===e?"inset-y-0 left-1/2 w-[2px] -translate-x-1/2":"inset-x-0 top-1/2 h-[2px] -translate-y-1/2")})})}function Iy({leading:e,label:t,active:n,closable:s=!0,closeLabel:i,onActivate:r,onClose:o,onContextMenu:a}){return Bn.jsxs("div",{role:"tab","aria-selected":n,tabIndex:0,onClick:r,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),r())},onMouseDown:e=>{1===e.button&&s&&o&&(e.preventDefault(),o())},onContextMenu:a,className:_y("group flex h-7 max-w-[260px] shrink-0 cursor-default items-center gap-1.5 rounded-md px-2.5",n?"bg-selection text-fg":"text-fg-3 hover:bg-raised hover:text-fg-2"),children:[e,Bn.jsx("span",{className:"truncate font-mono text-[12px]",children:t}),s&&o&&Bn.jsx("button",{type:"button",onClick:e=>{e.stopPropagation(),o()},className:_y("grid h-4 w-4 shrink-0 place-items-center rounded-sm text-fg-4 opacity-0 hover:bg-fg/10 hover:text-fg group-hover:opacity-100",n&&"opacity-100"),"aria-label":i??`Close ${t}`,children:Bn.jsx(by,{name:"x",className:"h-3 w-3",strokeWidth:2.5})})]})}const Oy={local:{kind:"local",label:"Local",icon:"terminal",tint:"text-fg-4"},claude:{kind:"claude",label:"Claude Code",icon:"claude",tint:"text-orange-500 dark:text-orange-400"},codex:{kind:"codex",label:"Codex",icon:"codex",tint:"text-emerald-500 dark:text-emerald-400"}};function Hy(e){return"dark"===e?{background:"#1e1f22",foreground:"#e4e4e7",cursor:"#a5b4fc",cursorAccent:"#1e1f22",selectionBackground:"#3f3f46",black:"#27272a",red:"#f87171",green:"#4ade80",yellow:"#fbbf24",blue:"#60a5fa",magenta:"#c084fc",cyan:"#22d3ee",white:"#e4e4e7",brightBlack:"#52525b",brightWhite:"#fafafa"}:{background:"#ffffff",foreground:"#3f3f46",cursor:"#6366f1",cursorAccent:"#ffffff",selectionBackground:"#e4e4e7",black:"#3f3f46",red:"#dc2626",green:"#16a34a",yellow:"#d97706",blue:"#2563eb",magenta:"#9333ea",cyan:"#0891b2",white:"#3f3f46",brightBlack:"#a1a1aa",brightWhite:"#18181b"}}
|
|
31
|
+
/**
|
|
32
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
33
|
+
* @license MIT
|
|
34
|
+
*
|
|
35
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
36
|
+
* @license MIT
|
|
37
|
+
*
|
|
38
|
+
* Originally forked from (with the author's permission):
|
|
39
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
40
|
+
* http://bellard.org/jslinux/
|
|
41
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
42
|
+
*/var Fy=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){var e;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let t=this._terminal._core._renderService.dimensions;if(0===t.css.cell.width||0===t.css.cell.height)return;let n=0===this._terminal.options.scrollback?0:(null==(e=this._terminal.options.overviewRuler)?void 0:e.width)||14,s=window.getComputedStyle(this._terminal.element.parentElement),i=parseInt(s.getPropertyValue("height")),r=Math.max(0,parseInt(s.getPropertyValue("width"))),o=window.getComputedStyle(this._terminal.element),a=i-(parseInt(o.getPropertyValue("padding-top"))+parseInt(o.getPropertyValue("padding-bottom"))),l=r-(parseInt(o.getPropertyValue("padding-right"))+parseInt(o.getPropertyValue("padding-left")))-n;return{cols:Math.max(2,Math.floor(l/t.css.cell.width)),rows:Math.max(1,Math.floor(a/t.css.cell.height))}}},Wy=Object.defineProperty,Uy=Object.getOwnPropertyDescriptor,Ky=(e,t,n,s)=>{for(var i,r=s>1?void 0:s?Uy(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(r=(s?i(t,n,r):i(r))||r);return s&&r&&Wy(t,n,r),r},qy=(e,t)=>(n,s)=>t(n,s,e),$y="Terminal input",Vy=()=>$y,Yy=e=>$y=e,Gy="Too much output to announce, navigate to rows manually to read",Xy=()=>Gy,Zy=e=>Gy=e;
|
|
43
|
+
/**
|
|
44
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
45
|
+
* @license MIT
|
|
46
|
+
*
|
|
47
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
48
|
+
* @license MIT
|
|
49
|
+
*
|
|
50
|
+
* Originally forked from (with the author's permission):
|
|
51
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
52
|
+
* http://bellard.org/jslinux/
|
|
53
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
54
|
+
*/function Jy(e,t,n,s){e=function(e,t){return t?`[200~${e.replace(/\x1b/g,"␛")}[201~`:e}(e=function(e){return e.replace(/\r?\n/g,"\r")}(e),n.decPrivateModes.bracketedPasteMode&&!0!==s.rawOptions.ignoreBracketedPasteMode),n.triggerDataEvent(e,!0),t.value=""}function Qy(e,t,n){let s=n.getBoundingClientRect(),i=e.clientX-s.left-10,r=e.clientY-s.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${i}px`,t.style.top=`${r}px`,t.style.zIndex="1000",t.focus()}function ew(e,t,n,s,i){Qy(e,t,n),i&&s.rightClickSelect(e),t.value=s.selectionText,t.select()}function tw(e){return e>65535?(e-=65536,String.fromCharCode(55296+(e>>10))+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function nw(e,t=0,n=e.length){let s="";for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,s+=String.fromCharCode(55296+(t>>10))+String.fromCharCode(t%1024+56320)):s+=String.fromCharCode(t)}return s}var sw=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let s=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[s++]=1024*(this._interim-55296)+n-56320+65536:(t[s++]=this._interim,t[s++]=n),this._interim=0}for(let r=i;r<n;++r){let i=e.charCodeAt(r);if(55296<=i&&i<=56319){if(++r>=n)return this._interim=i,s;let o=e.charCodeAt(r);56320<=o&&o<=57343?t[s++]=1024*(i-55296)+o-56320+65536:(t[s++]=i,t[s++]=o);continue}65279!==i&&(t[s++]=i)}return s}},iw=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let s,i,r,o,a,l=0,c=0;if(this.interim[0]){let s=!1,i=this.interim[0];i&=192==(224&i)?31:224==(240&i)?15:7;let r,o=0;for(;(r=this.interim[++o])&&o<4;)i<<=6,i|=63&r;let a=192==(224&this.interim[0])?2:224==(240&this.interim[0])?3:4,h=a-o;for(;c<h;){if(c>=n)return 0;if(r=e[c++],128!=(192&r)){c--,s=!0;break}this.interim[o++]=r,i<<=6,i|=63&r}s||(2===a?i<128?c--:t[l++]=i:3===a?i<2048||i>=55296&&i<=57343||65279===i||(t[l++]=i):i<65536||i>1114111||(t[l++]=i)),this.interim.fill(0)}let h=n-4,u=c;for(;u<n;){for(;!(!(u<h)||128&(s=e[u])||128&(i=e[u+1])||128&(r=e[u+2])||128&(o=e[u+3]));)t[l++]=s,t[l++]=i,t[l++]=r,t[l++]=o,u+=4;if(s=e[u++],s<128)t[l++]=s;else if(192==(224&s)){if(u>=n)return this.interim[0]=s,l;if(i=e[u++],128!=(192&i)){u--;continue}if(a=(31&s)<<6|63&i,a<128){u--;continue}t[l++]=a}else if(224==(240&s)){if(u>=n)return this.interim[0]=s,l;if(i=e[u++],128!=(192&i)){u--;continue}if(u>=n)return this.interim[0]=s,this.interim[1]=i,l;if(r=e[u++],128!=(192&r)){u--;continue}if(a=(15&s)<<12|(63&i)<<6|63&r,a<2048||a>=55296&&a<=57343||65279===a)continue;t[l++]=a}else if(240==(248&s)){if(u>=n)return this.interim[0]=s,l;if(i=e[u++],128!=(192&i)){u--;continue}if(u>=n)return this.interim[0]=s,this.interim[1]=i,l;if(r=e[u++],128!=(192&r)){u--;continue}if(u>=n)return this.interim[0]=s,this.interim[1]=i,this.interim[2]=r,l;if(o=e[u++],128!=(192&o)){u--;continue}if(a=(7&s)<<18|(63&i)<<12|(63&r)<<6|63&o,a<65536||a>1114111)continue;t[l++]=a}}return l}},rw=class e{constructor(){this.fg=0,this.bg=0,this.extended=new ow}static toColorRGB(e){return[e>>>16&255,e>>>8&255,255&e]}static fromColorRGB(e){return(255&e[0])<<16|(255&e[1])<<8|255&e[2]}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&0!==this.extended.underlineStyle?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)}isBgRGB(){return!(50331648&~this.bg)}isFgPalette(){return 16777216==(50331648&this.fg)||33554432==(50331648&this.fg)}isBgPalette(){return 16777216==(50331648&this.bg)||33554432==(50331648&this.bg)}isFgDefault(){return!(50331648&this.fg)}isBgDefault(){return!(50331648&this.bg)}isAttributeDefault(){return 0===this.fg&&0===this.bg}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):this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?16777216==(50331648&this.extended.underlineColor)||33554432==(50331648&this.extended.underlineColor):this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?!(50331648&this.extended.underlineColor):this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},ow=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(e){this._ext&=-67108864,this._ext|=67108863&e}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(3758096384&this._ext)>>29;return e<0?4294967288^e:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return 0===this.underlineStyle&&0===this._urlId}},aw=class e extends rw{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new ow,this.combinedData=""}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?tw(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(2===e[1].length){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let s=e[1].charCodeAt(1);56320<=s&&s<=57343?this.content=1024*(n-55296)+s-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}attributesEquals(e){if(this.getFgColorMode()!==e.getFgColorMode()||this.getFgColor()!==e.getFgColor()||this.getBgColorMode()!==e.getBgColorMode()||this.getBgColor()!==e.getBgColor()||this.isInverse()!==e.isInverse()||this.isBold()!==e.isBold()||this.isUnderline()!==e.isUnderline())return!1;if(this.isUnderline()){if(this.getUnderlineStyle()!==e.getUnderlineStyle())return!1;let t=this.isUnderlineColorDefault(),n=e.isUnderlineColorDefault();if(!(t&&n||t===n&&this.getUnderlineColor()===e.getUnderlineColor()&&this.getUnderlineColorMode()===e.getUnderlineColorMode()))return!1}return!(this.isOverline()!==e.isOverline()||this.isBlink()!==e.isBlink()||this.isInvisible()!==e.isInvisible()||this.isItalic()!==e.isItalic()||this.isDim()!==e.isDim()||this.isStrikethrough()!==e.isStrikethrough())}},lw=new Map;function cw(e){if(lw.has(e))return lw.get(e);let t=function(e,n,s){if(3!==arguments.length)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");!function(e,t,n){t.di$target===t?t.di$dependencies.push({id:e,index:n}):(t.di$dependencies=[{id:e,index:n}],t.di$target=t)}(t,e,s)};return t._id=e,lw.set(e,t),t}var hw=cw("BufferService"),uw=cw("MouseStateService"),dw=cw("CoreService"),fw=cw("CharsetService"),pw=cw("InstantiationService"),vw=cw("LogService"),gw=cw("OptionsService"),mw=cw("OscLinkService"),_w=cw("UnicodeService"),xw=cw("DecorationService"),bw=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n,this._workCell=new aw}provideLinks(e,t){var n;let s=this._bufferService.buffer.lines.get(e-1);if(!s)return void t(void 0);let i=[],r=this._optionsService.rawOptions.linkHandler,o=this._workCell,a=s.getTrimmedLength(),l=-1,c=-1,h=!1;for(let u=0;u<a;u++)if(-1!==c||s.hasContent(u)){if(s.loadCell(u,o),o.hasExtendedAttrs()&&o.extended.urlId){if(-1===c){c=u,l=o.extended.urlId;continue}h=o.extended.urlId!==l}else-1!==c&&(h=!0);if(h||-1!==c&&u===a-1){let t=null==(n=this._oscLinkService.getLinkData(l))?void 0:n.uri;if(t){let n=u+(h||u!==a-1?0:1),s=this._getRangeWithLineWrap(e,c,n,l),o=!1;if(!(null==r?void 0:r.allowNonHttpProtocols))try{let e=new URL(t);["http:","https:"].includes(e.protocol)||(o=!0)}catch{o=!0}o||i.push({text:t,range:s,activate:(e,t)=>r?r.activate(e,t,s):yw(e,t),hover:(e,t)=>{var n;return null==(n=null==r?void 0:r.hover)?void 0:n.call(r,e,t,s)},leave:(e,t)=>{var n;return null==(n=null==r?void 0:r.leave)?void 0:n.call(r,e,t,s)}})}h=!1,o.hasExtendedAttrs()&&o.extended.urlId?(c=u,l=o.extended.urlId):(c=-1,l=-1)}}t(i)}_getRangeWithLineWrap(e,t,n,s){var i;let r=e,o=t,a=e,l=n;for(;0===o&&(null==(i=this._bufferService.buffer.lines.get(r-1))?void 0:i.isWrapped);){let e=this._bufferService.buffer.lines.get(r-2);if(!e)break;let t=e.getTrimmedLength();if(0===t||!this._hasUrlId(e,t-1,s))break;let n=t-1;for(;n>0&&this._hasUrlId(e,n-1,s);)n--;r--,o=n}for(;;){let e=this._bufferService.buffer.lines.get(a-1);if(!e)break;if(l!==e.getTrimmedLength())break;let t=this._bufferService.buffer.lines.get(a);if(!(null==t?void 0:t.isWrapped))break;let n=t.getTrimmedLength();if(0===n||!this._hasUrlId(t,0,s))break;let i=1;for(;i<n&&this._hasUrlId(t,i,s);)i++;a++,l=i}return{start:{x:o+1,y:r},end:{x:l,y:a}}}_hasUrlId(e,t,n){let s=this._workCell;return e.loadCell(t,s),!!s.hasExtendedAttrs()&&s.extended.urlId===n}};function yw(e,t){if(confirm(`Do you want to navigate to ${t}?\n\nWARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}bw=Ky([qy(0,hw),qy(1,gw),qy(2,mw)],bw);var ww=cw("CharSizeService"),Sw=cw("CoreBrowserService"),kw=cw("MouseCoordsService"),Cw=cw("MouseService"),jw=cw("RenderService"),Nw=cw("SelectionService"),Mw=cw("CharacterJoinerService"),Bw=cw("ThemeService"),Dw=cw("LinkProviderService"),Lw=cw("KeyboardService");function Ew(e){return{dispose:e}}function Pw(e){if(!e)return e;if(Array.isArray(e)){for(let t of e)t.dispose();return[]}return e.dispose(),e}var Rw=class{constructor(){this._disposables=new Set,this._isDisposed=!1}get isDisposed(){return this._isDisposed}add(e){return this._isDisposed?e.dispose():this._disposables.add(e),e}dispose(){if(!this._isDisposed){this._isDisposed=!0;for(let e of this._disposables)e.dispose();this._disposables.clear()}}clear(){for(let e of this._disposables)e.dispose();this._disposables.clear()}},Aw=class{constructor(){this._store=new Rw}dispose(){this._store.dispose()}_register(e){return this._store.add(e)}};Aw.None=Object.freeze({dispose(){}});var zw=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||(null==(t=this._value)||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,null==(e=this._value)||e.dispose(),this._value=void 0}};var Tw=class{constructor(){this._token=-1,this._isDisposed=!1}dispose(){this.cancel(),this._isDisposed=!0}cancel(){-1!==this._token&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new Error("Calling cancelAndSet on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Error("Calling setIfNotSet on a disposed TimeoutTimer");-1===this._token&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},Iw=class{constructor(){this._isScheduled=!1,this._isDisposed=!1}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._isScheduled=!1}set(e){if(this._isDisposed)throw new Error("Calling set on a disposed MicrotaskTimer");this._isScheduled||(this._isScheduled=!0,queueMicrotask(()=>{this._isScheduled&&(this._isScheduled=!1,e())}))}},Ow=class{constructor(){this._isDisposed=!1}cancel(){var e;null==(e=this._disposable)||e.dispose(),this._disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this._isDisposed)throw new Error("Calling cancelAndSet on a disposed IntervalTimer");this.cancel();let s=n.setInterval(()=>{e()},t);this._disposable={dispose:()=>{n.clearInterval(s),this._disposable=void 0}}}dispose(){this.cancel(),this._isDisposed=!0}};function Hw(e){var t;let n=e;if(null==(t=null==n?void 0:n.ownerDocument)?void 0:t.defaultView)return n.ownerDocument.defaultView;let s=e;return(null==s?void 0:s.view)?s.view:window}var Fw=class{constructor(e,t,n,s){this._node=e,this._type=t,this._handler=n,this._options=s,e.addEventListener(t,n,s)}dispose(){!this._node||!this._handler||(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Ww(e,t,n,s){return new Fw(e,t,n,s)}function Uw(e,t,n,s){return Ww(e,t,n,s)}var Kw="click",qw="mouseover",$w="mouseleave",Vw="pointerdown",Yw="pointermove",Gw="pointerup",Xw="wheel";var Zw=class{constructor(e,t){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){console.error(e)}}static sort(e,t){return t.priority-e.priority}},Jw=new Map;function Qw(e){let t=Jw.get(e);return t||(t={next:[],current:[],animFrameRequested:!1,inAnimationFrameRunner:!1},Jw.set(e,t)),t}function eS(e,t,n=0){let s=Qw(e),i=new Zw(t,n);return s.next.push(i),s.animFrameRequested||(s.animFrameRequested=!0,e.requestAnimationFrame(()=>function(e){let t=Qw(e);for(t.animFrameRequested=!1,t.current=t.next,t.next=[],t.inAnimationFrameRunner=!0;t.current.length>0;)t.current.sort(Zw.sort),t.current.shift().execute();t.inAnimationFrameRunner=!1}(e))),i}var tS=class extends Ow{constructor(e){super(),this._defaultTarget=e?Hw(e):void 0}cancelAndSet(e,t,n){super.cancelAndSet(e,t,n??this._defaultTarget??window)}},nS=class{constructor(e){this.domNode=e,this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._className="",this._position="",this._layerHint=!1,this._contain="none"}setWidth(e){let t=sS(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=sS(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=sS(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=sS(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=sS(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=sS(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=e?"translate3d(0px, 0px, 0px)":"")}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}};function sS(e){return"number"==typeof e?`${e}px`:e}var iS={};((e,t)=>{for(var n in t)Wy(e,n,{get:t[n],enumerable:!0})})(iS,{getSafariVersion:()=>fS,getZoomFactor:()=>dS,isChrome:()=>cS,isChromeOS:()=>mS,isFirefox:()=>lS,isLegacyEdge:()=>hS,isLinux:()=>gS,isMac:()=>pS,isNode:()=>rS,isSafari:()=>uS,isWindows:()=>vS});var rS=!!(typeof process<"u"&&"title"in process&&(typeof navigator>"u"||navigator.userAgent.startsWith("Node.js/"))),oS=rS?"node":navigator.userAgent,aS=rS?"node":navigator.platform,lS=oS.includes("Firefox"),cS=oS.includes("Chrome"),hS=oS.includes("Edge"),uS=/^((?!chrome|android).)*safari/i.test(oS);function dS(e){return 1}function fS(){if(!uS)return 0;let e=oS.match(/Version\/(\d+)/);return null===e||e.length<2?0:parseInt(e[1],10)}var pS=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(aS),vS=["Windows","Win16","Win32","WinCE"].includes(aS),gS=aS.indexOf("Linux")>=0,mS=/\bCrOS\b/.test(oS),_S=new WeakMap;function xS(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if("null"!==t.origin&&"null"!==n.origin&&t.origin!==n.origin)return null}catch{return null}return e.parent}var bS,yS,wS=class{static _getSameOriginWindowChain(e){let t=_S.get(e);if(!t){t=[],_S.set(e,t);let n,s=e;do{n=xS(s),n?t.push({window:new WeakRef(s),iframeElement:s.frameElement??null}):t.push({window:new WeakRef(s),iframeElement:null}),s=n}while(s)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,s=0,i=this._getSameOriginWindowChain(e);for(let r of i){let e=r.window.deref();if(n+=(null==e?void 0:e.scrollY)??0,s+=(null==e?void 0:e.scrollX)??0,e===t||!r.iframeElement)break;let i=r.iframeElement.getBoundingClientRect();n+=i.top,s+=i.left}return{top:n,left:s}}},SS=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=0===t.button,this.middleButton=1===t.button,this.rightButton=2===t.button,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail??1,"dblclick"===t.type&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,"number"==typeof t.pageX?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let n=wS.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},kS=class{constructor(e,t=0,n=0){var s;this.browserEvent=e??null,this.target=e?e.target??e.targetNode??e.srcElement??null:null,this.deltaY=n,this.deltaX=t;let i=!1;if(cS){let e=navigator.userAgent.match(/Chrome\/(\d+)/);i=(e?parseInt(e[1],10):123)<=122}if(e){let t=e,n=e,r=(null==(s=e.view)?void 0:s.devicePixelRatio)??1;if(typeof t.wheelDeltaY<"u")this.deltaY=i?t.wheelDeltaY/(120*r):t.wheelDeltaY/120;else if(typeof n.VERTICAL_AXIS<"u"&&n.axis===n.VERTICAL_AXIS)this.deltaY=-n.detail/3;else if("wheel"===e.type){let t=e;t.deltaMode===t.DOM_DELTA_LINE?this.deltaY=lS&&!pS?-e.deltaY/3:-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof t.wheelDeltaX<"u")this.deltaX=uS&&vS?-t.wheelDeltaX/120:i?t.wheelDeltaX/(120*r):t.wheelDeltaX/120;else if(typeof n.HORIZONTAL_AXIS<"u"&&n.axis===n.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if("wheel"===e.type){let t=e;t.deltaMode===t.DOM_DELTA_LINE?this.deltaX=lS&&!pS?-e.deltaX/3:-e.deltaX:this.deltaX=-e.deltaX/40}0===this.deltaY&&0===this.deltaX&&e.wheelDelta&&(this.deltaY=i?e.wheelDelta/(120*r):e.wheelDelta/120)}}preventDefault(){var e;null==(e=this.browserEvent)||e.preventDefault()}stopPropagation(){var e;null==(e=this.browserEvent)||e.stopPropagation()}},CS=class{constructor(){this._hooks=new Rw,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let t=this._onStopCallback;this._onStopCallback=null,e&&t&&t()}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,s,i){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=s,this._onStopCallback=i;let r=e;try{e.setPointerCapture(t),this._hooks.add(Ew(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{r=Hw(e)}this._hooks.add(Ww(r,Yw,e=>{e.buttons===n?(e.preventDefault(),this._pointerMoveCallback(e)):this.stopMonitoring(!0)})),this._hooks.add(Ww(r,Gw,e=>this.stopMonitoring(!0)))}},jS=class extends Aw{_onclick(e,t){this._register(Ww(e,Kw,n=>t(new SS(Hw(e),n))))}_onmouseover(e,t){this._register(Ww(e,qw,n=>t(new SS(Hw(e),n))))}_onmouseleave(e,t){this._register(Ww(e,$w,n=>t(new SS(Hw(e),n))))}},NS=class extends jS{constructor(e){super(),this._handleActivate=e.handleActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="xterm-arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute";let t=Math.min(e.bgWidth,e.bgHeight);this.domNode.style.width=t+"px",this.domNode.style.height=t+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new CS),this._register(Uw(this.bgDomNode,Vw,e=>this._arrowPointerDown(e))),this._register(Uw(this.domNode,Vw,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new tS),this._pointerdownScheduleRepeatTimer=this._register(new Tw)}_arrowPointerDown(e){if(!(e.target&&e.target instanceof Element))return;this._handleActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._handleActivate(),1e3/24,Hw(e))},200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},MS=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=(e,t,n)=>{if(this._disposed)return Ew(()=>{});let s={fn:e,thisArgs:t};this._listeners.push(s);let i=Ew(()=>{let e=this._listeners.indexOf(s);-1!==e&&this._listeners.splice(e,1)});return n&&(Array.isArray(n)?n.push(i):n.add(i)),i}),this._event}fire(e){if(!this._disposed)switch(this._listeners.length){case 0:return;case 1:{let{fn:t,thisArgs:n}=this._listeners[0];return void t.call(n,e)}default:{let t=this._listeners.slice();for(let{fn:n,thisArgs:s}of t)n.call(s,e)}}}dispose(){this._disposed||(this._disposed=!0,this._listeners.length=0)}};(yS=bS||(bS={})).forward=function(e,t){return e(e=>t.fire(e))},yS.map=function(e,t){return(n,s,i)=>e(e=>n.call(s,t(e)),void 0,i)},yS.any=function(...e){return(t,n,s)=>{let i=new Rw;for(let r of e)i.add(r(e=>t.call(n,e)));return s&&(Array.isArray(s)?s.push(i):s.add(i)),i}},yS.runAndSubscribe=function(e,t,n){return t(n),e(e=>t(e))};var BS=class e{constructor(e,t,n,s,i,r,o){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(t|=0,n|=0,s|=0,i|=0,r|=0,o|=0),this.rawScrollLeft=s,this.rawScrollTop=o,t<0&&(t=0),s+t>n&&(s=n-t),s<0&&(s=0),i<0&&(i=0),o+i>r&&(o=r-i),o<0&&(o=0),this.width=t,this.scrollWidth=n,this.scrollLeft=s,this.height=i,this.scrollHeight=r,this.scrollTop=o}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(t,n){return new e(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new e(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(e,t){let n=this.width!==e.width,s=this.scrollWidth!==e.scrollWidth,i=this.scrollLeft!==e.scrollLeft,r=this.height!==e.height,o=this.scrollHeight!==e.scrollHeight,a=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:t,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:n,scrollWidthChanged:s,scrollLeftChanged:i,heightChanged:r,scrollHeightChanged:o,scrollTopChanged:a}}},DS=class extends Aw{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new MS),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new BS(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){var n;let s=this._state.withScrollDimensions(e,t);this._setState(s,!!this._smoothScrolling),null==(n=this._smoothScrolling)||n.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(0!==this._smoothScrollDuration){if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let n,s=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===s.scrollLeft&&this._smoothScrolling.to.scrollTop===s.scrollTop)return;n=t?new PS(this._smoothScrolling.from,s,this._smoothScrolling.startTime,this._smoothScrolling.duration):PS.start(this._state,s,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=n}else{let t=this._state.withScrollPosition(e);this._smoothScrolling=PS.start(this._state,t,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}else this.setScrollPositionNow(e)}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),this._smoothScrolling){if(e.isDone)return this._smoothScrolling.dispose(),void(this._smoothScrolling=null);this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},LS=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function ES(e,t){let n=t-e;return function(t){return e+n*function(e){return 1-function(e){return Math.pow(e,3)}(1-e)}(t)}}var PS=class e{constructor(e,t,n,s){this.from=e,this.to=t,this.duration=s,this.startTime=n,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this._scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this._scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(e,t,n){if(Math.abs(e-t)>2.5*n){let s,i;return e<t?(s=e+.75*n,i=t-.75*n):(s=e-.75*n,i=t+.75*n),function(e,t,n){return function(s){return s<n?e(s/n):t((s-n)/(1-n))}}(ES(e,s),ES(i,t),.33)}return ES(e,t)}dispose(){null!==this.animationFrameDisposable&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(e){this.to=e.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(e){let t=(e-this.startTime)/this.duration;if(t<1){let e=this._scrollLeft(t),n=this._scrollTop(t);return new LS(e,n,!1)}return new LS(this.to.scrollLeft,this.to.scrollTop,!0)}static start(t,n,s){s+=10;let i=Date.now()-10;return new e(t,n,i,s)}};var RS=class extends Aw{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new Tw)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return 2!==this._visibility&&(3===this._visibility||this._rawShouldBeVisible)}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){this._isNeeded?this._shouldBeVisible?this._reveal():this._hide(!0):this._hide(!1)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{var e;null==(e=this._domNode)||e.setClassName(this._visibleClassName)},0))}_hide(e){var t;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,null==(t=this._domNode)||t.setClassName(this._invisibleClassName+(e?" xterm-fade":"")))}},AS=class extends jS{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new RS(e.visibility,"xterm-visible xterm-scrollbar "+e.extraScrollbarClassName,"xterm-invisible xterm-scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new CS),this._shouldRender=!0,this.domNode=new nS(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(Ww(this.domNode.domNode,Vw,e=>this._domNodePointerDown(e)))}_createArrow(e){let t=this._register(new NS(e));return this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode),t}_createSlider(e,t,n,s){this.slider=new nS(document.createElement("div")),this.slider.setClassName("xterm-slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),"number"==typeof n&&this.slider.setWidth(n),"number"==typeof s&&this.slider.setHeight(s),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Ww(this.slider.domNode,Vw,e=>{0===e.button&&(e.preventDefault(),this._sliderPointerDown(e))})),this._onclick(this.slider.domNode,e=>{e.leftButton&&e.stopPropagation()})}_handleElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_handleElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_handleElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._handlePointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),s=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),i=this._sliderPointerPosition(e);n<=i&&i<=s?0===e.button&&(e.preventDefault(),this._sliderPointerDown(e)):this._handlePointerDown(e)}_handlePointerDown(e){let t,n;if(e.target===this.domNode.domNode&&"number"==typeof e.offsetX&&"number"==typeof e.offsetY)t=e.offsetX,n=e.offsetY;else{let s=function(e){let t=e.getBoundingClientRect(),n=Hw(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}(this.domNode.domNode);t=e.pageX-s.left,n=e.pageY-s.top}let s=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(s):this._scrollbarState.getDesiredScrollPositionFromOffset(s)),0===e.button&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!(e.target&&e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),s=this._scrollbarState.clone();this.slider.toggleClassName("xterm-active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{let i=this._sliderOrthogonalPointerPosition(e),r=Math.abs(i-n);if(vS&&r>140)return void this._setDesiredScrollPositionNow(s.getScrollPosition());let o=this._sliderPointerPosition(e)-t;this._setDesiredScrollPositionNow(s.getDesiredScrollPositionFromDelta(o))},()=>{this.slider.toggleClassName("xterm-active",!1),this._host.handleDragEnd()}),this._host.handleDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},zS=class e{constructor(e,t,n,s,i,r){this._scrollbarSize=Math.round(t),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(e),this._visibleSize=s,this._scrollSize=i,this._scrollPosition=r,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new e(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let t=Math.round(e);return this._visibleSize!==t&&(this._visibleSize=t,this._refreshComputedValues(),!0)}setScrollSize(e){let t=Math.round(e);return this._scrollSize!==t&&(this._scrollSize=t,this._refreshComputedValues(),!0)}setScrollPosition(e){let t=Math.round(e);return this._scrollPosition!==t&&(this._scrollPosition=t,this._refreshComputedValues(),!0)}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setArrowSize(e){let t=Math.round(e);this._arrowSize!==t&&(this._arrowSize=t,this._refreshComputedValues())}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,t,n,s,i){let r=Math.max(0,n-e),o=Math.max(0,r-2*t),a=s>0&&s>n;if(!a)return{computedAvailableSize:Math.round(r),computedIsNeeded:a,computedSliderSize:Math.round(o),computedSliderRatio:0,computedSliderPosition:0};let l=Math.round(Math.max(20,Math.floor(n*o/s))),c=(o-l)/(s-n),h=i*c;return{computedAvailableSize:Math.round(r),computedIsNeeded:a,computedSliderSize:Math.round(l),computedSliderRatio:c,computedSliderPosition:Math.round(h)}}_refreshComputedValues(){let t=e._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize-this._computedSliderSize/2;return Math.round(t/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize,n=this._scrollPosition;return t<this._computedSliderPosition?n-=this._visibleSize:n+=this._visibleSize,n}getDesiredScrollPositionFromDelta(e){if(!this._computedIsNeeded)return 0;let t=this._computedSliderPosition+e;return Math.round(t/this._computedSliderRatio)}},TS=class extends AS{constructor(e,t,n){let s=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new zS(t.horizontalHasArrows?t.horizontalScrollbarSize:0,2===t.horizontal?0:t.horizontalScrollbarSize,2===t.vertical?0:t.verticalScrollbarSize,s.width,s.scrollWidth,i.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"xterm-horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}handleScroll(e){return this._shouldRender=this._handleElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._handleElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._handleElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(2===e.horizontal?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(2===e.vertical?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},IS=class extends AS{constructor(e,t,n){let s=e.getScrollDimensions(),i=e.getCurrentScrollPosition(),r=t.verticalHasArrows;super({lazyRender:t.lazyRender,host:n,scrollbarState:new zS(r?t.verticalScrollbarSize:0,2===t.vertical?0:t.verticalScrollbarSize,0,s.height,s.scrollHeight,i.scrollTop),visibility:t.vertical,extraScrollbarClassName:"xterm-vertical",scrollable:e,scrollByPage:t.scrollByPage}),this._arrowScrollDelta=0,this._setArrows(r,t.verticalScrollbarSize),this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}handleScroll(e){return this._shouldRender=this._handleElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._handleElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._handleElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}_arrowScroll(e){let t=this._scrollable.getCurrentScrollPosition();this._scrollable.setScrollPositionNow({scrollTop:t.scrollTop+e})}_setArrows(e,t){if(this._arrowScrollDelta=t,(!this._arrowUp||!this._arrowDown)&&(this._arrowUp=this._createArrow({className:"xterm-scra xterm-arrow-up",top:0,left:0,bgWidth:t,bgHeight:t,handleActivate:()=>this._arrowScroll(-this._arrowScrollDelta)}),this._arrowDown=this._createArrow({className:"xterm-scra xterm-arrow-down",bottom:0,left:0,bgWidth:t,bgHeight:t,handleActivate:()=>this._arrowScroll(this._arrowScrollDelta)})),this._updateArrowSize(this._arrowUp,t),this._updateArrowSize(this._arrowDown,t),!this._arrowUp||!this._arrowDown)return;let n=e?"":"none";this._arrowUp.bgDomNode.style.display=n,this._arrowUp.domNode.style.display=n,this._arrowDown.bgDomNode.style.display=n,this._arrowDown.domNode.style.display=n}_updateArrowSize(e,t){e&&(e.bgDomNode.style.width=`${t}px`,e.bgDomNode.style.height=`${t}px`,e.domNode.style.width=`${t}px`,e.domNode.style.height=`${t}px`)}updateOptions(e){let t=e.verticalHasArrows?e.verticalScrollbarSize:0;this._scrollbarState.setArrowSize(t),this._setArrows(e.verticalHasArrows,e.verticalScrollbarSize),this.updateScrollbarSize(2===e.vertical?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},OS=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},HS=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(-1===this._front&&-1===this._rear)return!1;let e=1,t=0,n=1,s=this._rear;for(;-1!==s;){let i=s===this._front?e:Math.pow(2,-n);if(e-=i,t+=this._memory[s].score*i,s===this._front)break;s=(this._capacity+s-1)%this._capacity,n++}return t<=.5}acceptStandardWheelEvent(e){if(cS){Hw(e.browserEvent);let t=1;this.accept(Date.now(),e.deltaX*t,e.deltaY*t)}else this.accept(Date.now(),e.deltaX,e.deltaY)}accept(e,t,n){let s=null,i=new OS(e,t,n);-1===this._front&&-1===this._rear?(this._memory[0]=i,this._front=0,this._rear=0):(s=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=i),i.score=this._computeScore(i,s)}_computeScore(e,t){if(Math.abs(e.deltaX)>0&&Math.abs(e.deltaY)>0)return 1;let n=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(n+=.25),t){let s=Math.abs(e.deltaX),i=Math.abs(e.deltaY),r=Math.abs(t.deltaX),o=Math.abs(t.deltaY),a=Math.max(Math.min(s,r),1),l=Math.max(Math.min(i,o),1),c=Math.max(s,r),h=Math.max(i,o);c%a===0&&h%l===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};HS.INSTANCE=new HS;var FS=HS,WS=class extends jS{constructor(e,t,n){super(),this._onScroll=this._register(new MS),this.onScroll=this._onScroll.event,t=t??{};let s,i=!n;n?s=n:(t.mouseWheelSmoothScroll=!1,s=new DS({forceIntegerValues:!0,smoothScrollDuration:0,scheduleAtNextAnimationFrame:t=>eS(Hw(e),t)})),this._options=function(e){let t={lazyRender:typeof e.lazyRender<"u"&&e.lazyRender,className:typeof e.className<"u"?e.className:"",useShadows:!(typeof e.useShadows<"u")||e.useShadows,handleMouseWheel:!(typeof e.handleMouseWheel<"u")||e.handleMouseWheel,flipAxes:typeof e.flipAxes<"u"&&e.flipAxes,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"&&e.consumeMouseWheelIfScrollbarIsNeeded,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"&&e.alwaysConsumeMouseWheel,scrollYToX:typeof e.scrollYToX<"u"&&e.scrollYToX,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:!(typeof e.scrollPredominantAxis<"u")||e.scrollPredominantAxis,mouseWheelSmoothScroll:!(typeof e.mouseWheelSmoothScroll<"u")||e.mouseWheelSmoothScroll,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"&&e.horizontalHasArrows,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"&&e.verticalHasArrows,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"&&e.scrollByPage};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,pS&&(t.className+=" xterm-mac"),t}(t),this._scrollable=s,this._register(this._scrollable.onScroll(e=>{this._handleScroll(e),this._onScroll.fire(e)})),i&&this._register(this._scrollable);let r={handleMouseWheel:e=>this._handleMouseWheel(e),handleDragStart:()=>this._handleDragStart(),handleDragEnd:()=>this._handleDragEnd()};this._verticalScrollbar=this._register(new IS(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new TS(this._scrollable,this._options,r)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=new nS(document.createElement("div")),this._leftShadowDomNode.setClassName("xterm-shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=new nS(document.createElement("div")),this._topShadowDomNode.setClassName("xterm-shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=new nS(document.createElement("div")),this._topLeftShadowDomNode.setClassName("xterm-shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode??this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this._onmouseover(this._listenOnDomNode,e=>this._handleMouseOver(e)),this._onmouseleave(this._listenOnDomNode,e=>this._handleMouseLeave(e)),this._hideTimeout=this._register(new Tw),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Pw(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}updateClassName(e){this._options.className=e,pS&&(this._options.className+=" xterm-mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalHasArrows<"u"&&(this._options.horizontalHasArrows=e.horizontalHasArrows),typeof e.verticalHasArrows<"u"&&(this._options.verticalHasArrows=e.verticalHasArrows),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}delegateScrollFromMouseWheelEvent(e){this._handleMouseWheel(new kS(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Pw(this._mouseWheelToDispose),e)){let e=e=>{this._handleMouseWheel(new kS(e))};this._mouseWheelToDispose.push(Ww(this._listenOnDomNode,Xw,e,{passive:!1}))}}_handleMouseWheel(e){var t;if(null==(t=e.browserEvent)?void 0:t.defaultPrevented)return;let n=FS.INSTANCE;n.acceptStandardWheelEvent(e);let s=!1;if(e.deltaY||e.deltaX){let t=e.deltaY*this._options.mouseWheelScrollSensitivity,i=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&i+t===0?i=t=0:Math.abs(t)>=Math.abs(i)?i=0:t=0),this._options.flipAxes&&([t,i]=[i,t]);let r=!pS&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||r)&&!i&&(i=t,t=0),e.browserEvent&&e.browserEvent.altKey&&(i*=this._options.fastScrollSensitivity,t*=this._options.fastScrollSensitivity);let o=this._scrollable.getFutureScrollPosition(),a={};if(t){let e=50*t,n=o.scrollTop-(e<0?Math.floor(e):Math.ceil(e));this._verticalScrollbar.writeScrollPosition(a,n)}if(i){let e=50*i,t=o.scrollLeft-(e<0?Math.floor(e):Math.ceil(e));this._horizontalScrollbar.writeScrollPosition(a,t)}a=this._scrollable.validateScrollPosition(a),(o.scrollLeft!==a.scrollLeft||o.scrollTop!==a.scrollTop)&&(this._options.mouseWheelSmoothScroll&&n.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(a):this._scrollable.setScrollPositionNow(a),s=!0)}let i=s;!i&&this._options.alwaysConsumeMouseWheel&&(i=!0),!i&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(i=!0),i&&(e.preventDefault(),e.stopPropagation())}_handleScroll(e){this._shouldRender=this._horizontalScrollbar.handleScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.handleScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,s=n?" xterm-shadow-left":"",i=t?" xterm-shadow-top":"",r=n||t?" xterm-shadow-top-left-corner":"";this._leftShadowDomNode.setClassName(`xterm-shadow${s}`),this._topShadowDomNode.setClassName(`xterm-shadow${i}`),this._topLeftShadowDomNode.setClassName(`xterm-shadow${r}${i}${s}`)}}_handleDragStart(){this._isDragging=!0,this._reveal()}_handleDragEnd(){this._isDragging=!1,this._hide()}_handleMouseLeave(e){this._mouseIsOver=!1,this._hide()}_handleMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),500)}};var US=class extends Aw{constructor(e,t,n,s,i,r,o,a,l){var c;super(),this._bufferService=n,this._coreService=i,this._optionsService=a,this._renderService=l,this._onRequestScrollLines=this._register(new MS),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1,this._needsSyncOnRender=!1;let h=this._register(new DS({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:e=>eS(s.window,e)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{h.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new WS(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,verticalHasArrows:(null==(c=this._optionsService.rawOptions.scrollbar)?void 0:c.showArrows)??!1,...this._getChangeOptions()},h)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","scrollbar"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(r.onProtocolChange(e=>{this._scrollableElement.updateOptions({handleMouseWheel:!(16&e)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(bS.runAndSubscribe(o.onChangeColors,()=>{e.style.backgroundColor=o.colors.background.css,this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Ew(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=s.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(Ew(()=>this._styleElement.remove())),this._register(bS.runAndSubscribe(o.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .xterm-scrollbar > .xterm-slider {",` background: ${o.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .xterm-scrollbar > .xterm-slider:hover {",` background: ${o.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .xterm-scrollbar > .xterm-slider.xterm-active {",` background: ${o.colors.scrollbarSliderActiveBackground.css};`,"}"].join("\n")})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._renderService.onRender(()=>{this._needsSyncOnRender&&(this._needsSyncOnRender=!1,this._sync())})),this._register(this._scrollableElement.onScroll(e=>this._handleScroll(e)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){var e,t,n;let s=(null==(e=this._optionsService.rawOptions.scrollbar)?void 0:e.showScrollbar)??!0,i=(null==(t=this._optionsService.rawOptions.scrollbar)?void 0:t.showArrows)??!1,r=s?(null==(n=this._optionsService.rawOptions.scrollbar)?void 0:n.width)??14:0;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,vertical:s?1:2,verticalScrollbarSize:r,verticalHasArrows:i}}queueSync(e){void 0!==e&&(this._latestYDisp=e),void 0===this._queuedAnimationFrame&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){if(this._renderService&&!this._isSyncing){if(this._coreService.decPrivateModes.synchronizedOutput)return void(this._needsSyncOnRender=!0);this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1}}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;0!==n&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}handleTouchScroll(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({scrollTop:t.scrollTop-e})}};US=Ky([qy(2,hw),qy(3,Sw),qy(4,dw),qy(5,uw),qy(6,Bw),qy(7,gw),qy(8,jw)],US);var KS=class extends Aw{constructor(e,t,n,s,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=s,this._renderService=i,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(e=>this._removeDecoration(e))),this._register(Ew(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){void 0===this._animationFrame&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var t;let n=this._coreBrowserService.mainDocument.createElement("div");n.classList.add("xterm-decoration"),n.classList.toggle("xterm-decoration-top-layer","top"===(null==(t=null==e?void 0:e.options)?void 0:t.layer)),n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=(e.options.height||1)*this._renderService.dimensions.css.cell.height+"px",n.style.top=(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let s=e.options.x??0;return s&&s>this._bufferService.cols&&(n.style.display="none"),this._refreshXPosition(e,n),n}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=(e.options.height||1)*this._renderService.dimensions.css.cell.height+"px",n.style.top=t*this._renderService.dimensions.css.cell.height+"px",n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;"right"===(e.options.anchor||"left")?t.style.right=n?n*this._renderService.dimensions.css.cell.width+"px":"":t.style.left=n?n*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(e){var t;null==(t=this._decorationElements.get(e))||t.remove(),this._decorationElements.delete(e),e.dispose()}};KS=Ky([qy(1,hw),qy(2,Sw),qy(3,xw),qy(4,jw)],KS);var qS=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(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position))return void this._addLineToZone(t,e.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||"full"]&&t<=e.endBufferLine+this._linePadding[n||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},$S={full:0,left:0,center:0,right:0},VS={full:0,left:0,center:0,right:0},YS={full:0,left:0,center:0,right:0},GS=class extends Aw{constructor(e,t,n,s,i,r,o,a){var l;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=s,this._renderService=i,this._optionsService=r,this._themeService=o,this._coreBrowserService=a,this._colorZoneStore=new qS,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(),null==(l=this._viewportElement.parentElement)||l.insertBefore(this._canvas,this._viewportElement),this._register(Ew(()=>{var e;return null==(e=this._canvas)?void 0:e.remove()}));let c=this._canvas.getContext("2d");if(!c)throw new Error("Ctx cannot be null");this._ctx=c,this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),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())})),this._register(this._renderService.onDimensionsChange(()=>this._queueRefresh(!0))),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("scrollbar",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._register(Ew(()=>{void 0!==this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)})),this._queueRefresh(!0)}get _width(){let e=this._optionsService.rawOptions.scrollbar;return(null==e?void 0:e.showScrollbar)??1?(null==e?void 0:e.width)??0:0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);VS.full=this._canvas.width,VS.left=e,VS.center=t,VS.right=e,this._refreshDrawHeightConstants(),YS.full=1,YS.left=1,YS.center=1+VS.left,YS.right=1+VS.left+VS.center}_refreshDrawHeightConstants(){$S.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);$S.left=t,$S.center=t,$S.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*$S.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*$S.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*$S.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*$S.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){if(this._store.isDisposed||!this._renderService.hasRenderer())return;let e=this._renderService.dimensions.css.canvas.height,t=this._renderService.dimensions.device.canvas.height;this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${e}px`,this._canvas.height=t,this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){if(this._store.isDisposed||!this._renderService.hasRenderer())return;this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)"full"!==t.position&&this._renderColorZone(t);for(let t of e)"full"===t.position&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){var e,t,n,s;this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),(null==(t=null==(e=this._optionsService.rawOptions.scrollbar)?void 0:e.overviewRuler)?void 0:t.showTopBorder)&&this._ctx.fillRect(1,0,this._canvas.width-1,1),(null==(s=null==(n=this._optionsService.rawOptions.scrollbar)?void 0:n.overviewRuler)?void 0:s.showBottomBorder)&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(YS[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-$S[e.position||"full"]/2),VS[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+$S[e.position||"full"]))}_queueRefresh(e,t){this._store.isDisposed||(this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,void 0===this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._store.isDisposed||this._refreshDecorations(),this._animationFrame=void 0})))}};GS=Ky([qy(2,hw),qy(3,xw),qy(4,jw),qy(5,gw),qy(6,Bw),qy(7,Sw)],GS);var XS=class{constructor(e,t,n,s,i,r){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=s,this._coreService=i,this._renderService=r,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._compositionSuffix="",this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0;let e=this._textarea.selectionStart??this._textarea.value.length,t=this._textarea.selectionEnd??e;this._compositionPosition.start=Math.min(e,t),this._compositionPosition.end=Math.max(e,t),this._compositionSuffix=this._textarea.value.substring(this._compositionPosition.end),this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=`${e.data}`,this.updateCompositionElements(),setTimeout(()=>{let e=this._textarea.selectionEnd??this._textarea.value.length;this._compositionPosition.end=Math.max(this._compositionPosition.start,e)},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(20===e.keyCode||229===e.keyCode||16===e.keyCode||17===e.keyCode||18===e.keyCode)return!1;this._finalizeComposition(!1)}return 229!==e.keyCode||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end},t=this._compositionSuffix;this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let n;if(this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,this._isComposing)n=this._textarea.value.substring(e.start,this._compositionPosition.start);else{let s=this._textarea.value,i=t.length>0&&s.endsWith(t)?s.length-t.length:s.length;n=s.substring(e.start,Math.max(e.start,i))}n.length>0&&this._coreService.triggerDataEvent(n,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){if(this._textareaChangeTimer)return;let e=this._textarea.value;this._textareaChangeTimer=window.setTimeout(()=>{if(this._textareaChangeTimer=void 0,!this._isComposing){let t=this._textarea.value,n=t.replace(e,"");this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent("",!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,s=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=s+"px",this._compositionView.style.top=n+"px",this._compositionView.style.height=t+"px",this._compositionView.style.lineHeight=t+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let i=this._bufferService.cols*this._renderService.dimensions.css.cell.width-s;this._compositionView.style.maxWidth=i+"px",this._compositionView.style.overflow="hidden",this._compositionView.style.direction="rtl";let r=this._compositionView.getBoundingClientRect();this._textarea.style.left=s+"px",this._textarea.style.top=n+"px",this._textarea.style.width=Math.max(r.width,1)+"px",this._textarea.style.height=Math.max(r.height,1)+"px",this._textarea.style.lineHeight=r.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};XS=Ky([qy(2,hw),qy(3,gw),qy(4,dw),qy(5,jw)],XS);var ZS,JS,QS,ek,tk,nk,sk=0,ik=0,rk=0,ok=0,ak={css:"#00000000",rgba:0};function lk(e){let t=e.toString(16);return t.length<2?"0"+t:t}function ck(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}(JS=ZS||(ZS={})).toCss=function(e,t,n,s){return void 0!==s?`#${lk(e)}${lk(t)}${lk(n)}${lk(s)}`:`#${lk(e)}${lk(t)}${lk(n)}`},JS.toRgba=function(e,t,n,s=255){return(e<<24|t<<16|n<<8|s)>>>0},JS.toColor=function(e,t,n,s){return{css:JS.toCss(e,t,n,s),rgba:JS.toRgba(e,t,n,s)}},(e=>{function t(e,t){return ok=Math.round(255*t),[sk,ik,rk]=nk.toChannels(e.rgba),{css:ZS.toCss(sk,ik,rk,ok),rgba:ZS.toRgba(sk,ik,rk,ok)}}e.blend=function(e,t){if(1===(ok=(255&t.rgba)/255))return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,s=t.rgba>>16&255,i=t.rgba>>8&255,r=e.rgba>>24&255,o=e.rgba>>16&255,a=e.rgba>>8&255;return sk=r+Math.round((n-r)*ok),ik=o+Math.round((s-o)*ok),rk=a+Math.round((i-a)*ok),{css:ZS.toCss(sk,ik,rk),rgba:ZS.toRgba(sk,ik,rk)}},e.isOpaque=function(e){return!(255&~e.rgba)},e.ensureContrastRatio=function(e,t,n){let s=nk.ensureContrastRatio(e.rgba,t.rgba,n);if(s)return ZS.toColor(s>>24&255,s>>16&255,s>>8&255)},e.opaque=function(e){let t=(255|e.rgba)>>>0;return[sk,ik,rk]=nk.toChannels(t),{css:ZS.toCss(sk,ik,rk),rgba:t}},e.opacity=t,e.multiplyOpacity=function(e,n){return t(e,(ok=255&e.rgba)*n/255)},e.toColorRGB=function(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}})(QS||(QS={})),(e=>{let t,n;try{let e=document.createElement("canvas");e.width=1,e.height=1;let s=e.getContext("2d",{willReadFrequently:!0});s&&(t=s,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}e.toColor=function(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return sk=parseInt(e.slice(1,2).repeat(2),16),ik=parseInt(e.slice(2,3).repeat(2),16),rk=parseInt(e.slice(3,4).repeat(2),16),ZS.toColor(sk,ik,rk);case 5:return sk=parseInt(e.slice(1,2).repeat(2),16),ik=parseInt(e.slice(2,3).repeat(2),16),rk=parseInt(e.slice(3,4).repeat(2),16),ok=parseInt(e.slice(4,5).repeat(2),16),ZS.toColor(sk,ik,rk,ok);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let s=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(s)return sk=parseInt(s[1],10),ik=parseInt(s[2],10),rk=parseInt(s[3],10),ok=Math.round(255*(void 0===s[5]?1:parseFloat(s[5]))),ZS.toColor(sk,ik,rk,ok);if("transparent"===e)return{css:"transparent",rgba:0};if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=e,"string"!=typeof t.fillStyle)throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[sk,ik,rk,ok]=t.getImageData(0,0,1,1).data,255!==ok)throw new Error("css.toColor: Unsupported css format");return{rgba:ZS.toRgba(sk,ik,rk,ok),css:e}}})(ek||(ek={})),(e=>{function t(e,t,n){let s=e/255,i=t/255,r=n/255;return.2126*(s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4))+.7152*(i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4))+.0722*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))}e.relativeLuminance=function(e){return t(e>>16&255,e>>8&255,255&e)},e.relativeLuminance2=t})(tk||(tk={})),(e=>{function t(e,t,n){let s=e>>24&255,i=e>>16&255,r=e>>8&255,o=t>>24&255,a=t>>16&255,l=t>>8&255,c=ck(tk.relativeLuminance2(o,a,l),tk.relativeLuminance2(s,i,r));for(;c<n&&(o>0||a>0||l>0);)o-=Math.max(0,Math.ceil(.1*o)),a-=Math.max(0,Math.ceil(.1*a)),l-=Math.max(0,Math.ceil(.1*l)),c=ck(tk.relativeLuminance2(o,a,l),tk.relativeLuminance2(s,i,r));return(o<<24|a<<16|l<<8|255)>>>0}function n(e,t,n){let s=e>>24&255,i=e>>16&255,r=e>>8&255,o=t>>24&255,a=t>>16&255,l=t>>8&255,c=ck(tk.relativeLuminance2(o,a,l),tk.relativeLuminance2(s,i,r));for(;c<n&&(o<255||a<255||l<255);)o=Math.min(255,o+Math.ceil(.1*(255-o))),a=Math.min(255,a+Math.ceil(.1*(255-a))),l=Math.min(255,l+Math.ceil(.1*(255-l))),c=ck(tk.relativeLuminance2(o,a,l),tk.relativeLuminance2(s,i,r));return(o<<24|a<<16|l<<8|255)>>>0}e.blend=function(e,t){if(1===(ok=(255&t)/255))return t;let n=t>>24&255,s=t>>16&255,i=t>>8&255,r=e>>24&255,o=e>>16&255,a=e>>8&255;return sk=r+Math.round((n-r)*ok),ik=o+Math.round((s-o)*ok),rk=a+Math.round((i-a)*ok),ZS.toRgba(sk,ik,rk)},e.ensureContrastRatio=function(e,s,i){let r=tk.relativeLuminance(e>>8),o=tk.relativeLuminance(s>>8);if(ck(r,o)<i){if(o<r){let o=t(e,s,i),a=ck(r,tk.relativeLuminance(o>>8));if(a<i){let t=n(e,s,i);return a>ck(r,tk.relativeLuminance(t>>8))?o:t}return o}let a=n(e,s,i),l=ck(r,tk.relativeLuminance(a>>8));if(l<i){let n=t(e,s,i);return l>ck(r,tk.relativeLuminance(n>>8))?a:n}return a}},e.reduceLuminance=t,e.increaseLuminance=n,e.toChannels=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]}})(nk||(nk={}));var hk=class extends rw{constructor(e,t,n){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},uk=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new aw}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(0===this._characterJoiners.length)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||0===t.length)return[];let n=[],s=t.translateToString(!0),i=t.getTrimmedLength(),r=0,o=0,a=0,l=t.getFg(0),c=t.getBg(0);for(let h=0;h<i;h++)if(t.loadCell(h,this._workCell),0!==this._workCell.getWidth()){if(this._workCell.fg!==l||this._workCell.bg!==c){if(h-r>1){let e=this._getJoinedRanges(s,a,o,t,r);for(let t=0;t<e.length;t++)n.push(e[t])}r=h,a=o,l=this._workCell.fg,c=this._workCell.bg}o+=this._workCell.getChars().length||1}if(i-r>1){let e=this._getJoinedRanges(s,a,o,t,r);for(let t=0;t<e.length;t++)n.push(e[t])}return n}_getJoinedRanges(e,t,n,s,i){let r=e.substring(t,n),o=[];try{o=this._characterJoiners[0].handler(r)}catch(a){console.error(a)}for(let c=1;c<this._characterJoiners.length;c++)try{let e=this._characterJoiners[c].handler(r);for(let t=0;t<e.length;t++)uk._mergeRanges(o,e[t])}catch(l){console.error(l)}return this._stringRangesToCellRanges(o,s,i),o}_stringRangesToCellRanges(e,t,n){let s=0,i=!1,r=0,o=e[s];if(!o)return;let a=t.getTrimmedLength();for(let l=n;l<a;l++){let n=t.getWidth(l),a=t.getString(l).length||1;if(0!==n){if(!i&&o[0]<=r&&(o[0]=l,i=!0),o[1]<=r){if(o[1]=l,o=e[++s],!o)break;o[0]<=r?(o[0]=l,i=!0):i=!1}r+=a}}o&&(o[1]=a)}static _mergeRanges(e,t){let n=!1;for(let s=0;s<e.length;s++){let i=e[s];if(n){if(t[1]<=i[0])return e[s-1][1]=t[1],e;if(t[1]<=i[1])return e[s-1][1]=Math.max(t[1],i[1]),e.splice(s,1),e;e.splice(s,1),s--}else{if(t[1]<=i[0])return e.splice(s,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),n=!0)}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};function dk(e){if(!e)throw new Error("value must not be falsy");return e}uk=Ky([qy(0,hw)],uk);var fk=class{constructor(e,t,n,s,i,r,o){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=s,this._coreService=i,this._decorationService=r,this._themeService=o,this._workCell=new aw,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,s,i,r,o,a,l,c,h,u,d){let f=[];d&&(d.hasBlinkingCells=!1);let p=this._characterJoinerService.getJoinedCharacters(t),v=this._themeService.colors,g=e.getNoBgTrimmedLength();n&&g<r+1&&(g=r+1);let m,_,x,b=0,y="",w=0,S=0,k=0,C=!1,j=0,N=!1,M=0,B=[],D=-1!==h&&-1!==u;for(let L=0;L<g;L++){e.loadCell(L,this._workCell);let g=this._workCell.getWidth();if(0===g)continue;let E=!1,P=L>=M,R=L,A=this._workCell;if(p.length>0&&L===p[0][0]&&P){let s=p.shift(),i=this._isCellInSelection(s[0],t);for(_=s[0]+1;_<s[1];_++)P&&(P=i===this._isCellInSelection(_,t));P&&(P=!n||r<s[0]||r>=s[1]),P?(E=!0,A=new hk(this._workCell,e.translateToString(!0,s[0],s[1]),s[1]-s[0]),R=s[1]-1,g=A.getWidth()):M=s[1]}let z=this._isCellInSelection(L,t),T=n&&L===r,I=D&&L>=h&&L<=u;d&&A.isBlink()&&(d.hasBlinkingCells=!0),!a&&A.isBlink()&&B.push("xterm-blink-hidden");let O=!1;this._decorationService.forEachDecorationAtCell(L,t,void 0,e=>{O=!0});let H=A.getChars()||" ";if(" "===H&&(A.isUnderline()||A.isOverline())&&(H=" "),x=g*l-c.get(H,A.isBold(),A.isItalic()),m){if(b&&(z&&N||!z&&!N&&A.bg===w)&&(z&&N&&v.selectionForeground||A.fg===S)&&A.extended.ext===k&&I===C&&x===j&&!T&&!E&&!O&&P){A.isInvisible()?y+=" ":y+=H,b++;continue}b&&(m.textContent=y),m=this._document.createElement("span"),b=0,y=""}else m=this._document.createElement("span");if(w=A.bg,S=A.fg,k=A.extended.ext,C=I,j=x,N=z,E&&r>=L&&r<=R&&(r=L),!this._coreService.isCursorHidden&&T&&this._coreService.isCursorInitialized)if(B.push("xterm-cursor"),this._coreBrowserService.isFocused)o&&B.push("xterm-cursor-blink"),B.push("bar"===s?"xterm-cursor-bar":"underline"===s?"xterm-cursor-underline":"xterm-cursor-block");else if(i)switch(i){case"outline":B.push("xterm-cursor-outline");break;case"block":B.push("xterm-cursor-block");break;case"bar":B.push("xterm-cursor-bar");break;case"underline":B.push("xterm-cursor-underline")}if(A.isBold()&&B.push("xterm-bold"),A.isItalic()&&B.push("xterm-italic"),A.isDim()&&B.push("xterm-dim"),y=A.isInvisible()?" ":A.getChars()||" ",A.isUnderline()&&(B.push(`xterm-underline-${A.extended.underlineStyle}`)," "===y&&(y=" "),!A.isUnderlineColorDefault()))if(A.isUnderlineColorRGB())m.style.textDecorationColor=`rgb(${rw.toColorRGB(A.getUnderlineColor()).join(",")})`;else{let e=A.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&A.isBold()&&e<8&&(e+=8),m.style.textDecorationColor=v.ansi[e].css}A.isOverline()&&(B.push("xterm-overline")," "===y&&(y=" ")),A.isStrikethrough()&&B.push("xterm-strikethrough"),I&&(m.style.textDecoration="underline");let F=A.getFgColor(),W=A.getFgColorMode(),U=A.getBgColor(),K=A.getBgColorMode(),q=!!A.isInverse();if(q){let e=F;F=U,U=e;let t=W;W=K,K=t}let $,V,Y,G=!1;switch(this._decorationService.forEachDecorationAtCell(L,t,void 0,e=>{"top"!==e.options.layer&&G||(e.backgroundColorRGB&&(K=50331648,U=e.backgroundColorRGB.rgba>>8&16777215,$=e.backgroundColorRGB),e.foregroundColorRGB&&(W=50331648,F=e.foregroundColorRGB.rgba>>8&16777215,V=e.foregroundColorRGB),G="top"===e.options.layer)}),!G&&z&&($=this._coreBrowserService.isFocused?v.selectionBackgroundOpaque:v.selectionInactiveBackgroundOpaque,U=$.rgba>>8&16777215,K=50331648,G=!0,v.selectionForeground&&(W=50331648,F=v.selectionForeground.rgba>>8&16777215,V=v.selectionForeground)),G&&B.push("xterm-decoration-top"),K){case 16777216:case 33554432:Y=v.ansi[U],B.push(`xterm-bg-${U}`);break;case 50331648:Y=ZS.toColor(U>>16,U>>8&255,255&U),this._addStyle(m,`background-color:#${(U>>>0).toString(16).padStart(6,"0")}`);break;default:q?(Y=v.foreground,B.push("xterm-bg-257")):Y=v.background}switch($||A.isDim()&&($=QS.multiplyOpacity(Y,.5)),W){case 16777216:case 33554432:A.isBold()&&F<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(F+=8),this._applyMinimumContrast(m,Y,v.ansi[F],A,$,void 0)||B.push(`xterm-fg-${F}`);break;case 50331648:let e=ZS.toColor(F>>16&255,F>>8&255,255&F);this._applyMinimumContrast(m,Y,e,A,$,V)||this._addStyle(m,`color:#${F.toString(16).padStart(6,"0")}`);break;default:this._applyMinimumContrast(m,Y,v.foreground,A,$,V)||q&&B.push("xterm-fg-257")}B.length&&(m.className=B.join(" "),B.length=0),T||E||O||!P?m.textContent=y:b++,x!==this.defaultSpacing&&(m.style.letterSpacing=`${x}px`),f.push(m),L=R}return m&&b&&(m.textContent=y),f}_applyMinimumContrast(e,t,n,s,i,r){if(1===this._optionsService.rawOptions.minimumContrastRatio||(function(e){return 57508<=e&&e<=57558}(o=s.getCode())||function(e){return 9472<=e&&e<=9631}(o)))return!1;var o;let a,l=this._getContrastCache(s);if(!i&&!r&&(a=l.getColor(t.rgba,n.rgba)),void 0===a){let e=this._optionsService.rawOptions.minimumContrastRatio/(s.isDim()?2:1);a=QS.ensureContrastRatio(i??t,r??n,e),l.setColor((i??t).rgba,(r??n).rgba,a??null)}return!!a&&(this._addStyle(e,`color:${a.css}`),!0)}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,s=this._selectionEnd;return!(!n||!s)&&(this._columnSelectMode?n[0]<=s[0]?e>=n[0]&&t>=n[1]&&e<s[0]&&t<=s[1]:e<n[0]&&t>=n[1]&&e>=s[0]&&t<=s[1]:t>n[1]&&t<s[1]||n[1]===s[1]&&t===n[1]&&e>=n[0]&&e<s[0]||n[1]<s[1]&&t===s[1]&&e<s[0]||n[1]<s[1]&&t===n[1]&&e>=n[0])}};fk=Ky([qy(1,Mw),qy(2,gw),qy(3,Sw),qy(4,dw),qy(5,xw),qy(6,Bw)],fk);var pk=class{constructor(e=()=>new vk){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._canvasElements=[],this._canvasElements=[e(),e(),e(),e()],this.clear()}dispose(){this._canvasElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,s){e===this._font&&t===this._fontSize&&n===this._weight&&s===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=s,this._canvasElements[0].setFont(e,t,n,!1),this._canvasElements[1].setFont(e,t,s,!1),this._canvasElements[2].setFont(e,t,n,!0),this._canvasElements[3].setFont(e,t,s,!0),this.clear())}get(e,t,n){let s;if(!t&&!n&&1===e.length&&(s=e.charCodeAt(0))<256){if(-9999!==this._flat[s])return this._flat[s];let t=this._measure(e,0);return t>0&&(this._flat[s]=t),t}let i=e;t&&(i+="B"),n&&(i+="I");let r=this._holey.get(i);if(void 0===r){let s=0;t&&(s|=1),n&&(s|=2),r=this._measure(e,s),r>0&&this._holey.set(i,r)}return r}_measure(e,t){return this._canvasElements[t].measure(e)}},vk=class{constructor(){typeof OffscreenCanvas<"u"?(this._canvas=new OffscreenCanvas(1,1),this._ctx=dk(this._canvas.getContext("2d"))):(this._canvas=document.createElement("canvas"),this._canvas.width=1,this._canvas.height=1,this._ctx=dk(this._canvas.getContext("2d")))}setFont(e,t,n,s){let i=s?"italic":"";this._ctx.font=`${i} ${n} ${t}px ${e}`.trim()}measure(e){return this._ctx.measureText(e).width}},gk=class{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(e,t,n,s=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1])return void this.clear();let i=e.buffers.active.ydisp,r=t[1]-i,o=n[1]-i,a=Math.max(r,0),l=Math.min(o,e.rows-1);a>=e.rows||l<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=r,this.viewportEndRow=o,this.viewportCappedStartRow=a,this.viewportCappedEndRow=l,this.startCol=t[0],this.endCol=n[0])}isCellSelected(e,t,n){return!!this.hasSelection&&(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol)}};var mk=class extends Aw{constructor(e,t,n){super(),this._renderCallback=e,this._coreBrowserService=t,this._optionsService=n,this._intervalDuration=0,this._blinkOn=!0,this._needsBlinkInViewport=!1,this._isViewportVisible=!0,this._register(this._optionsService.onSpecificOptionChange("blinkIntervalDuration",e=>{this.setIntervalDuration(e)})),this.setIntervalDuration(this._optionsService.rawOptions.blinkIntervalDuration),this._register(Ew(()=>this._clearInterval()))}get isBlinkOn(){return this._blinkOn}get isEnabled(){return this._intervalDuration>0}setNeedsBlinkInViewport(e){this._needsBlinkInViewport!==e&&(this._needsBlinkInViewport=e,this._updateIntervalState())}setViewportVisible(e){this._isViewportVisible!==e&&(this._isViewportVisible=e,this._updateIntervalState())}setIntervalDuration(e){e!==this._intervalDuration&&(this._intervalDuration=e,this._clearInterval(),this._updateIntervalState())}_updateIntervalState(){if(this._intervalDuration>0&&this._needsBlinkInViewport&&this._isViewportVisible){if(void 0!==this._interval)return;let e=this._blinkOn;return this._blinkOn=!0,this._interval=this._coreBrowserService.window.setInterval(()=>{this._blinkOn=!this._blinkOn,this._renderCallback()},this._intervalDuration),void(e||this._renderCallback())}this._clearInterval(),this._blinkOn||(this._blinkOn=!0,this._renderCallback())}_clearInterval(){void 0!==this._interval&&(this._coreBrowserService.window.clearInterval(this._interval),this._interval=void 0)}},_k=1,xk=class extends Aw{constructor(e,t,n,s,i,r,o,a,l,c,h,u,d,f){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=s,this._viewportElement=i,this._helperContainer=r,this._linkifier2=o,this._charSizeService=l,this._optionsService=c,this._bufferService=h,this._coreService=u,this._coreBrowserService=d,this._themeService=f,this._terminalClass=_k++,this._rowElements=[],this._selectionRenderModel=new gk,this._lastSelectionColumnMode=!1,this._rowHasBlinkingCells=[],this._rowHasBlinkingCellsCount=0,this._onRequestRedraw=this._register(new MS),this.onRequestRedraw=this._onRequestRedraw.event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add("xterm-rows"),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("xterm-selection"),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions={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}}},this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(e=>this._injectCss(e))),this._injectCss(this._themeService.colors),this._rowFactory=a.createInstance(fk,document),this._element.classList.add("xterm-dom-renderer-owner-"+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(e=>this._handleLinkHover(e))),this._register(this._linkifier2.onHideLinkUnderline(e=>this._handleLinkLeave(e))),this._cursorBlinkStateManager=new bk(this._rowContainer,this._coreBrowserService),this._register(Ww(this._document,"mousedown",()=>this._cursorBlinkStateManager.restartBlinkAnimation())),this._register(Ew(()=>this._cursorBlinkStateManager.dispose())),this._textBlinkStateManager=this._register(new mk(()=>this._onRequestRedraw.fire({start:0,end:this._bufferService.rows-1}),this._coreBrowserService,this._optionsService)),this._register(Ew(()=>{this._element.classList.remove("xterm-dom-renderer-owner-"+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new pk,this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),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/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),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(let n of this._rowElements)n.style.width=`${this.dimensions.css.canvas.width}px`,n.style.height=`${this.dimensions.css.cell.height}px`,n.style.lineHeight=`${this.dimensions.css.cell.height}px`,n.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .xterm-rows span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,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(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .xterm-rows { pointer-events: none; color: ${e.foreground.css};}`;t+=`${this._terminalSelector} .xterm-rows, ${this._terminalSelector} .xterm-rows span { font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`,t+=`${this._terminalSelector} .xterm-rows .xterm-dim { color: ${QS.multiplyOpacity(e.foreground,.5).css};}`,t+=`${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;}${this._terminalSelector} span.xterm-blink-hidden { visibility: hidden;}`;let n=`blink_underline_${this._terminalClass}`,s=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${s} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .xterm-rows.xterm-focus .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .xterm-rows.xterm-focus .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .xterm-rows.xterm-focus .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .xterm-rows.xterm-cursor-blink-idle .xterm-cursor.xterm-cursor-blink { animation: none !important;}${this._terminalSelector} .xterm-rows .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .xterm-rows .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .xterm-rows .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .xterm-rows .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .xterm-rows .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .xterm-selection { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .xterm-selection div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .xterm-selection div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[r,o]of e.ansi.entries())t+=`${this._terminalSelector} .xterm-fg-${r} { color: ${o.css}; }${this._terminalSelector} .xterm-fg-${r}.xterm-dim { color: ${QS.multiplyOpacity(o,.5).css}; }${this._terminalSelector} .xterm-bg-${r} { background-color: ${o.css}; }`;t+=`${this._terminalSelector} .xterm-fg-257 { color: ${QS.opaque(e.background).css}; }${this._terminalSelector} .xterm-fg-257.xterm-dim { color: ${QS.multiplyOpacity(QS.opaque(e.background),.5).css}; }${this._terminalSelector} .xterm-bg-257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let n=this._rowElements.length;n<=t;n++){let e=this._document.createElement("div");this._rowContainer.appendChild(e),this._rowElements.push(e),this._rowHasBlinkingCells.push(!1)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop()),this._rowHasBlinkingCells.pop()&&this._rowHasBlinkingCellsCount--}handleResize(e,t){this._refreshRowElements(e,t),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("xterm-focus"),this._cursorBlinkStateManager.pause(),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add("xterm-focus"),this._cursorBlinkStateManager.resume(),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleViewportVisibilityChange(e){this._textBlinkStateManager.setViewportVisible(e)}handleSelectionChanged(e,t,n){let s=this._bufferService.rows;this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n);let i=0,r=-1;this._lastSelectionStart&&this._lastSelectionEnd&&(this._selectionRenderModel.update(this._terminal,this._lastSelectionStart,this._lastSelectionEnd,this._lastSelectionColumnMode),this._selectionRenderModel.hasSelection&&(i=this._selectionRenderModel.viewportCappedStartRow,r=this._selectionRenderModel.viewportCappedEndRow));let o=0,a=-1;if(!e||!t)return;if(this._selectionRenderModel.update(this._terminal,e,t,n),this._selectionRenderModel.hasSelection){let s=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,r=this._selectionRenderModel.viewportCappedStartRow,l=this._selectionRenderModel.viewportCappedEndRow;o=r,a=l;let c=this._document.createDocumentFragment();if(n){let n=e[0]>t[0];c.appendChild(this._createSelectionElement(r,n?t[0]:e[0],n?e[0]:t[0],l-r+1))}else{let n=s===r?e[0]:0,o=r===i?t[0]:this._bufferService.cols;c.appendChild(this._createSelectionElement(r,n,o));let a=l-r-1;if(c.appendChild(this._createSelectionElement(r+1,0,this._bufferService.cols,a)),r!==l){let e=i===l?t[0]:this._bufferService.cols;c.appendChild(this._createSelectionElement(l,0,e))}}this._selectionContainer.appendChild(c)}let l=Math.min(i,o),c=Math.max(r,a);if(c>=0){l=Math.max(l,0),c=Math.min(c,s-1);let e=this._bufferService.buffer.y;this._selectionRenderModel.hasSelection&&e>=0&&e<s&&(l=Math.min(l,e),c=Math.max(c,e)),this.renderRows(l,c)}this._lastSelectionStart=e,this._lastSelectionEnd=t,this._lastSelectionColumnMode=n}_createSelectionElement(e,t,n,s=1){let i=this._document.createElement("div"),r=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return r+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-r),i.style.height=s*this.dimensions.css.cell.height+"px",i.style.top=e*this.dimensions.css.cell.height+"px",i.style.left=`${r}px`,i.style.width=`${o}px`,i}handleCursorMove(){this._cursorBlinkStateManager.restartBlinkAnimation()}_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(let e of this._rowElements)e.replaceChildren();this._rowHasBlinkingCellsCount>0&&(this._rowHasBlinkingCells.fill(!1),this._rowHasBlinkingCellsCount=0,this._textBlinkStateManager.setNeedsBlinkInViewport(!1))}renderRows(e,t){let n=this._bufferService.buffer,s=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),r=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,a=this._optionsService.rawOptions.cursorInactiveStyle,l={hasBlinkingCells:!1};for(let c=e;c<=t;c++){let e=c+n.ydisp,t=this._rowElements[c];if(!t)continue;let h=n.lines.get(e);h?(t.replaceChildren(...this._rowFactory.createRow(h,e,e===s,o,a,i,r,this._textBlinkStateManager.isBlinkOn,this.dimensions.css.cell.width,this._widthCache,-1,-1,l)),this._setRowBlinkState(c,l.hasBlinkingCells)):(t.replaceChildren(),this._setRowBlinkState(c,!1))}this._updateTextBlinkState()}get _terminalSelector(){return`.xterm-dom-renderer-owner-${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,s,i,r){n<0&&(e=0),s<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),s=Math.max(Math.min(s,o),0),i=Math.min(i,this._bufferService.cols);let a=this._bufferService.buffer,l=a.ybase+a.y,c=Math.min(a.x,i-1),h=this._optionsService.rawOptions.cursorBlink,u=this._optionsService.rawOptions.cursorStyle,d=this._optionsService.rawOptions.cursorInactiveStyle,f={hasBlinkingCells:!1};for(let p=n;p<=s;++p){let o=p+a.ydisp,v=this._rowElements[p];if(!v)continue;let g=a.lines.get(o);g?(v.replaceChildren(...this._rowFactory.createRow(g,o,o===l,u,d,c,h,this._textBlinkStateManager.isBlinkOn,this.dimensions.css.cell.width,this._widthCache,r?p===n?e:0:-1,r?(p===s?t:i)-1:-1,f)),this._setRowBlinkState(p,f.hasBlinkingCells)):(v.replaceChildren(),this._setRowBlinkState(p,!1))}this._updateTextBlinkState()}_setRowBlinkState(e,t){this._rowHasBlinkingCells[e]!==t&&(this._rowHasBlinkingCells[e]=t,this._rowHasBlinkingCellsCount+=t?1:-1)}_updateTextBlinkState(){this._textBlinkStateManager.setNeedsBlinkInViewport(this._rowHasBlinkingCellsCount>0)}};xk=Ky([qy(7,pw),qy(8,ww),qy(9,gw),qy(10,hw),qy(11,dw),qy(12,Sw),qy(13,Bw)],xk);var bk=class{constructor(e,t){this._rowContainer=e,this._coreBrowserService=t,this._isIdlePaused=!1,this._coreBrowserService.isFocused&&this._resetIdleTimer()}dispose(){this._clearIdleTimer()}restartBlinkAnimation(){this._isIdlePaused&&this._rowContainer.classList.remove("xterm-cursor-blink-idle"),this._resetIdleTimer()}pause(){this._isIdlePaused=!1,this._clearIdleTimer()}resume(){this._isIdlePaused=!1,this._rowContainer.classList.remove("xterm-cursor-blink-idle"),this._resetIdleTimer()}_resetIdleTimer(){this._isIdlePaused=!1,this._clearIdleTimer(),this._idleTimeout=this._coreBrowserService.window.setTimeout(()=>{this._stopBlinkingDueToIdle()},3e5)}_clearIdleTimer(){void 0!==this._idleTimeout&&(this._coreBrowserService.window.clearTimeout(this._idleTimeout),this._idleTimeout=void 0)}_stopBlinkingDueToIdle(){this._rowContainer.classList.add("xterm-cursor-blink-idle"),this._isIdlePaused=!0,this._idleTimeout=void 0}},yk=class extends Aw{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new MS),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new kk(this._optionsService))}catch{this._measureStrategy=this._register(new Sk(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};yk=Ky([qy(2,gw)],yk);var wk=class extends Aw{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){void 0!==e&&e>0&&void 0!==t&&t>0&&(this._result.width=e,this._result.height=t)}},Sk=class extends wk{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,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}},kk=class extends wk{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let t=this._ctx.measureText("W");if(!("width"in t&&"fontBoundingBoxAscent"in t&&"fontBoundingBoxDescent"in t))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},Ck=class extends Aw{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._onDprChange=this._register(new MS),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new MS),this.onWindowChange=this._onWindowChange.event,this._screenDprMonitor=this._register(new jk(this._window)),this._register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this._register(bS.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Ww(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Ww(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return void 0===this._cachedIsFocused&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},jk=class extends Aw{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new zw),this._onDprChange=this._register(new MS),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Ew(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Ww(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var e;this._outerListener&&(null==(e=this._resolutionMediaMatchList)||e.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)}},Nk=class extends Aw{constructor(){super(),this.linkProviders=[],this._register(Ew(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);-1!==t&&this.linkProviders.splice(t,1)}}}};function Mk(e,t,n){let s=n.getBoundingClientRect(),i=e.getComputedStyle(n),r=parseInt(i.getPropertyValue("padding-left"),10),o=parseInt(i.getPropertyValue("padding-top"),10);return[t.clientX-s.left-r,t.clientY-s.top-o]}var Bk=class{constructor(e,t){this._charSizeService=e,this._renderService=t}getCoords(e,t,n,s,i){return function(e,t,n,s,i,r,o,a,l){if(!r)return;let c=Mk(e,t,n);return c[0]=Math.ceil((c[0]+(l?o/2:0))/o),c[1]=Math.ceil(c[1]/a),c[0]=Math.min(Math.max(c[0],1),s+(l?1:0)),c[1]=Math.min(Math.max(c[1],1),i),c}(Hw(t),e,t,n,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=Mk(Hw(t),e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};Bk=Ky([qy(0,ww),qy(1,jw)],Bk);var Dk="object"==typeof window?window:globalThis;function Lk(e,t=0){return e[e.length-(1+t)]}var Ek=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};Ek.Undefined=new Ek(void 0);var Pk,Rk,Ak=Ek,zk=class{constructor(){this._first=Ak.Undefined,this._last=Ak.Undefined}push(e){return this._insert(e,!0)}_insert(e,t){let n=new Ak(e);if(this._first===Ak.Undefined)this._first=n,this._last=n;else if(t){let e=this._last;this._last=n,n.prev=e,e.next=n}else{let e=this._first;this._first=n,n.next=e,e.prev=n}let s=!1;return()=>{s||(s=!0,this._remove(n))}}_remove(e){if(e.prev!==Ak.Undefined&&e.next!==Ak.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Ak.Undefined&&e.next===Ak.Undefined?(this._first=Ak.Undefined,this._last=Ak.Undefined):e.next===Ak.Undefined?(this._last=this._last.prev,this._last.next=Ak.Undefined):e.prev===Ak.Undefined&&(this._first=this._first.next,this._first.prev=Ak.Undefined)}*[Symbol.iterator](){let e=this._first;for(;e!==Ak.Undefined;)yield e.element,e=e.next}};(Rk=Pk||(Pk={})).TAP="-xterm-gesturetap",Rk.CHANGE="-xterm-gesturechange",Rk.START="-xterm-gesturestart",Rk.END="-xterm-gesturesend",Rk.CONTEXT_MENU="-xterm-gesturecontextmenu";var Tk=class e extends Aw{constructor(){super(),this._dispatched=!1,this._targets=new zk,this._ignoreTargets=new zk,this._activeTouches={},this._handle=null,this._lastSetTapCountTime=0;let e=Dk;this._register(Ww(e.document,"touchstart",e=>this._handleTouchStart(e),{passive:!1})),this._register(Ww(e.document,"touchend",t=>this._handleTouchEnd(e,t))),this._register(Ww(e.document,"touchmove",e=>this._handleTouchMove(e),{passive:!1}))}static addTarget(t){if(!e.isTouchDevice())return Aw.None;return e._instance||(e._instance=new e),Ew(e._instance._targets.push(t))}static ignoreTarget(t){if(!e.isTouchDevice())return Aw.None;return e._instance||(e._instance=new e),Ew(e._instance._ignoreTargets.push(t))}static isTouchDevice(){return"ontouchstart"in Dk||navigator.maxTouchPoints>0}dispose(){this._handle&&(this._handle.dispose(),this._handle=null),super.dispose()}_handleTouchStart(e){let t=Date.now();this._handle&&(this._handle.dispose(),this._handle=null);for(let n=0,s=e.targetTouches.length;n<s;n++){let s=e.targetTouches.item(n);this._activeTouches[s.identifier]={id:s.identifier,initialTarget:s.target,initialTimeStamp:t,initialPageX:s.pageX,initialPageY:s.pageY,rollingTimestamps:[t],rollingPageX:[s.pageX],rollingPageY:[s.pageY]};let i=this._newGestureEvent(Pk.START,s.target);i.pageX=s.pageX,i.pageY=s.pageY,this._dispatchEvent(i)}this._dispatched&&(e.preventDefault(),e.stopPropagation(),this._dispatched=!1)}_handleTouchEnd(t,n){let s=Date.now(),i=Object.keys(this._activeTouches).length;for(let r=0,o=n.changedTouches.length;r<o;r++){let o=n.changedTouches.item(r);if(!this._activeTouches.hasOwnProperty(String(o.identifier))){console.warn("move of an UNKNOWN touch",o);continue}let a=this._activeTouches[o.identifier],l=Date.now()-a.initialTimeStamp;if(l<e._holdDelay&&Math.abs(a.initialPageX-Lk(a.rollingPageX))<30&&Math.abs(a.initialPageY-Lk(a.rollingPageY))<30){let e=this._newGestureEvent(Pk.TAP,a.initialTarget);e.pageX=Lk(a.rollingPageX),e.pageY=Lk(a.rollingPageY),this._dispatchEvent(e)}else if(l>=e._holdDelay&&Math.abs(a.initialPageX-Lk(a.rollingPageX))<30&&Math.abs(a.initialPageY-Lk(a.rollingPageY))<30){let e=this._newGestureEvent(Pk.CONTEXT_MENU,a.initialTarget);e.pageX=Lk(a.rollingPageX),e.pageY=Lk(a.rollingPageY),this._dispatchEvent(e)}else if(1===i){let e=Lk(a.rollingPageX),n=Lk(a.rollingPageY),i=Lk(a.rollingTimestamps)-a.rollingTimestamps[0],r=e-a.rollingPageX[0],o=n-a.rollingPageY[0],l=[...this._targets].filter(e=>a.initialTarget instanceof Node&&e.contains(a.initialTarget));this._inertia(t,l,s,Math.abs(r)/i,r>0?1:-1,e,Math.abs(o)/i,o>0?1:-1,n)}this._dispatchEvent(this._newGestureEvent(Pk.END,a.initialTarget)),delete this._activeTouches[o.identifier]}this._dispatched&&(n.preventDefault(),n.stopPropagation(),this._dispatched=!1)}_newGestureEvent(e,t){let n=document.createEvent("CustomEvent");return n.initEvent(e,!1,!0),n.initialTarget=t,n.tapCount=0,n}_dispatchEvent(t){if(t.type===Pk.TAP){let n,s=(new Date).getTime();n=s-this._lastSetTapCountTime>e._clearTapCountTime?1:2,this._lastSetTapCountTime=s,t.tapCount=n}else(t.type===Pk.CHANGE||t.type===Pk.CONTEXT_MENU)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let n of this._ignoreTargets)if(n.contains(t.initialTarget))return;let e=[];for(let n of this._targets)if(n.contains(t.initialTarget)){let s=0,i=t.initialTarget;for(;i&&i!==n;)s++,i=i.parentElement;e.push([s,n])}e.sort((e,t)=>e[0]-t[0]);for(let[,n]of e)n.dispatchEvent(t),this._dispatched=!0}}_inertia(t,n,s,i,r,o,a,l,c){this._handle=eS(t,()=>{let h=Date.now(),u=h-s,d=0,f=0,p=!0;i+=e._scrollFriction*u,a+=e._scrollFriction*u,i>0&&(p=!1,d=r*i*u),a>0&&(p=!1,f=l*a*u);let v=this._newGestureEvent(Pk.CHANGE);v.translationX=d,v.translationY=f,n.forEach(e=>e.dispatchEvent(v)),p||this._inertia(t,n,h,i,r,o+d,a,l,c+f)})}_handleTouchMove(e){let t=Date.now();for(let n=0,s=e.changedTouches.length;n<s;n++){let s=e.changedTouches.item(n);if(!this._activeTouches.hasOwnProperty(String(s.identifier))){console.warn("end of an UNKNOWN touch",s);continue}let i=this._activeTouches[s.identifier],r=this._newGestureEvent(Pk.CHANGE,i.initialTarget);r.translationX=s.pageX-Lk(i.rollingPageX),r.translationY=s.pageY-Lk(i.rollingPageY),r.pageX=s.pageX,r.pageY=s.pageY,r.clientX=s.clientX,r.clientY=s.clientY,this._dispatchEvent(r),i.rollingPageX.length>3&&(i.rollingPageX.shift(),i.rollingPageY.shift(),i.rollingTimestamps.shift()),i.rollingPageX.push(s.pageX),i.rollingPageY.push(s.pageY),i.rollingTimestamps.push(t)}this._dispatched&&(e.preventDefault(),e.stopPropagation(),this._dispatched=!1)}};Tk._scrollFriction=-.005,Tk._holdDelay=700,Tk._clearTapCountTime=400,Ky([function(e,t,n){let s=null,i=null;if("function"==typeof n.value?(s="value",i=n.value,0!==i.length&&console.warn("Memoize should only be used in functions with zero parameters")):"function"==typeof n.get&&(s="get",i=n.get),!i||!s)throw new Error("not supported");let r=`$memoize$${t}`;n[s]=function(...e){return this.hasOwnProperty(r)||Object.defineProperty(this,r,{configurable:!1,enumerable:!1,writable:!1,value:i.apply(this,e)}),this[r]}}],Tk,"isTouchDevice",1);var Ik=Tk,Ok=class{constructor(e,t,n,s,i,r,o,a,l){this._renderService=e,this._mouseCoordsService=t,this._mouseStateService=n,this._coreService=s,this._bufferService=i,this._optionsService=r,this._selectionService=o,this._logService=a,this._coreBrowserService=l,this._lastEvent=null,this._wheelPartialScroll=0,this._touchScrollAccumulator=0}bindMouse(e,t,n){let{element:s,document:i}=e,r=new zw,o=new zw;t(r),t(o);let a={target:e,focus:n,requestedEvents:{mouseup:null,wheel:null,mousedrag:null,mousemove:null},mouseupListener:r,mousedragListener:o},l={mouseup:e=>this._handleMouseUp(a,e),wheel:e=>this._handleWheel(a,e),mousedrag:e=>this._handleMouseDrag(a,e),mousemove:e=>this._handleMouseMove(a,e)};this._altMouseCursor=new Hk(s,i,()=>this._mouseStateService.areMouseEventsActive&&!!this._optionsService.rawOptions.mouseEventsRequireAlt),t(this._altMouseCursor),t(this._mouseStateService.onProtocolChange(e=>{this._handleProtocolChange(a,l,e)})),t(this._optionsService.onSpecificOptionChange("mouseEventsRequireAlt",()=>{var e;this._syncMouseModeState(s),null==(e=this._altMouseCursor)||e.sync()})),this._mouseStateService.activeProtocol=this._mouseStateService.activeProtocol,t(Ww(s,"mousedown",e=>this._handleMouseDown(a,e))),t(Ww(s,"wheel",e=>this._handlePassiveWheel(a,e),{passive:!1})),t(Ik.addTarget(e.screenElement)),t(Ww(e.screenElement,Pk.START,()=>this._handleTouchStart())),t(Ww(e.screenElement,Pk.CHANGE,e=>this._handleTouchChange(a,e)))}_sendEvent(e,t){var n,s,i,r,o;let a,l,c=this._mouseCoordsService.getMouseReportCoords(t,e.target.screenElement);if(!c)return!1;switch(t.overrideType||t.type){case"mousemove":l=32,void 0===t.buttons?(a=3,void 0!==t.button&&(a=t.button<3?t.button:3)):a=1&t.buttons?0:4&t.buttons?1:2&t.buttons?2:3;break;case"mouseup":l=0,a=t.button<3?t.button:3;break;case"mousedown":l=1,a=t.button<3?t.button:3;break;case"wheel":if(!this._mouseStateService.allowCustomWheelEvent(t))return!1;let e=t.deltaY;if(0===e||0===this._consumeWheelEvent(t,null==(r=null==(i=null==(s=null==(n=this._renderService)?void 0:n.dimensions)?void 0:s.device)?void 0:i.cell)?void 0:r.height,null==(o=this._coreBrowserService)?void 0:o.dpr))return!1;l=e<0?0:1,a=4;break;default:return!1}if(void 0===l||void 0===a||a>4||4!==a&&this._optionsService.rawOptions.mouseEventsRequireAlt&&this._mouseStateService.areMouseEventsActive&&!t.altKey)return!1;let h=4!==a&&this._optionsService.rawOptions.mouseEventsRequireAlt&&this._mouseStateService.areMouseEventsActive;return this._triggerMouseEvent({col:c.col,row:c.row,x:c.x,y:c.y,button:a,action:l,ctrl:t.ctrlKey,alt:!h&&t.altKey,shift:t.shiftKey})}_handleMouseUp(e,t){this._sendEvent(e,t),t.buttons||(e.mouseupListener.clear(),e.mousedragListener.clear())}_handleWheel(e,t){return this._sendEvent(e,t),t.preventDefault(),t.stopPropagation(),!1}_handleMouseDrag(e,t){t.buttons&&this._sendEvent(e,t)}_handleMouseMove(e,t){t.buttons||this._sendEvent(e,t)}_handleMouseDown(e,t){if(t.preventDefault(),e.focus(),!this._mouseStateService.areMouseEventsActive||this._selectionService.shouldForceSelection(t))return;this._sendEvent(e,t);let{element:n,document:s}=e.target,i=n.ownerDocument??s;e.requestedEvents.mouseup&&(e.mouseupListener.value=Ww(i,"mouseup",e.requestedEvents.mouseup)),e.requestedEvents.mousedrag&&(e.mousedragListener.value=Ww(i,"mousemove",e.requestedEvents.mousedrag))}_handlePassiveWheel(e,t){var n,s,i,r,o;if(!e.requestedEvents.wheel){if(!this._mouseStateService.allowCustomWheelEvent(t))return!1;if(!this._bufferService.buffer.hasScrollback){if(0===t.deltaY)return!1;if(0===this._consumeWheelEvent(t,null==(r=null==(i=null==(s=null==(n=this._renderService)?void 0:n.dimensions)?void 0:s.device)?void 0:i.cell)?void 0:r.height,null==(o=this._coreBrowserService)?void 0:o.dpr))return t.preventDefault(),t.stopPropagation(),!1;let e=""+(this._coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(t.deltaY<0?"A":"B");return this._coreService.triggerDataEvent(e,!0),t.preventDefault(),t.stopPropagation(),!1}}}_handleTouchStart(){this._touchScrollAccumulator=0}_handleTouchChange(e,t){var n,s;t.preventDefault(),t.stopPropagation(),e.requestedEvents.wheel?this._handleTouchScrollAsWheel(e,t):this._bufferService.buffer.hasScrollback?null==(s=(n=e.target).handleTouchScroll)||s.call(n,t.translationY):this._handleTouchScrollAsKeys(t)}_handleTouchScrollAsKeys(e){var t;let n=null==(t=this._renderService)?void 0:t.dimensions.css.cell.height;if(!n)return;this._touchScrollAccumulator-=e.translationY;let s=Math.trunc(this._touchScrollAccumulator/n);if(0===s)return;this._touchScrollAccumulator-=s*n;let i=""+(this._coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(s<0?"A":"B");for(let r=0;r<Math.abs(s);r++)this._coreService.triggerDataEvent(i,!0)}_handleTouchScrollAsWheel(e,t){var n;let s=null==(n=this._renderService)?void 0:n.dimensions.css.cell.height;if(!s)return;this._touchScrollAccumulator-=t.translationY;let i=Math.trunc(this._touchScrollAccumulator/s);if(0===i)return;this._touchScrollAccumulator-=i*s;let r=this._mouseCoordsService.getMouseReportCoords(t,e.target.screenElement);if(r)for(let o=0;o<Math.abs(i);o++)this._triggerMouseEvent({col:r.col,row:r.row,x:r.x,y:r.y,button:4,action:i<0?0:1,ctrl:!1,alt:!1,shift:!1})}reset(){this._lastEvent=null,this._wheelPartialScroll=0,this._touchScrollAccumulator=0}_syncMouseModeState(e){var t;this._mouseStateService.areMouseEventsActive?this._optionsService.rawOptions.mouseEventsRequireAlt?(null==(t=this._altMouseCursor)||t.resetClass(),this._selectionService.enable()):(e.classList.add("enable-mouse-events"),this._selectionService.disable()):(e.classList.remove("enable-mouse-events"),this._selectionService.enable())}_handleProtocolChange(e,t,n){var s;let{element:i}=e.target,{requestedEvents:r}=e;n?"debug"===this._optionsService.rawOptions.logLevel&&this._logService.debug("Binding to mouse events:",this._explainEvents(n)):this._logService.debug("Unbinding from mouse events."),this._syncMouseModeState(i),null==(s=this._altMouseCursor)||s.sync(),8&n?r.mousemove||(i.addEventListener("mousemove",t.mousemove),r.mousemove=t.mousemove):(r.mousemove&&i.removeEventListener("mousemove",r.mousemove),r.mousemove=null),16&n?r.wheel||(i.addEventListener("wheel",t.wheel,{passive:!1}),r.wheel=t.wheel):(r.wheel&&i.removeEventListener("wheel",r.wheel),r.wheel=null),2&n?r.mouseup??(r.mouseup=t.mouseup):(e.mouseupListener.clear(),r.mouseup=null),4&n?r.mousedrag??(r.mousedrag=t.mousedrag):(e.mousedragListener.clear(),r.mousedrag=null)}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}_consumeWheelEvent(e,t,n){if(0===e.deltaY||e.shiftKey||void 0===t||void 0===n)return 0;let s=t/n,i=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=s+0,Math.abs(e.deltaY)<50&&(i*=.3),this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||4===e.button&&32===e.action||3===e.button&&32!==e.action||4!==e.button&&(2===e.action||3===e.action)||(e.col++,e.row++,32===e.action&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._mouseStateService.isPixelEncoding))||!this._mouseStateService.restrictMouseEvent(e))return!1;let t=this._mouseStateService.encodeMouseEvent(e);return t&&(this._mouseStateService.isDefaultEncoding?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}_explainEvents(e){return{down:!!(1&e),up:!!(2&e),drag:!!(4&e),move:!!(8&e),wheel:!!(16&e)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};Ok=Ky([qy(0,jw),qy(1,kw),qy(2,uw),qy(3,dw),qy(4,hw),qy(5,gw),qy(6,Nw),qy(7,vw),qy(8,Sw)],Ok);var Hk=class{constructor(e,t,n){this._element=e,this._document=t,this._isActive=n,this._listeners=new zw}dispose(){this._listeners.dispose()}sync(){var e;if(this._listeners.clear(),!this._isActive())return;let t=new Rw,n=e=>this.syncFromModifier(e);t.add(Ww(this._document,"keydown",n)),t.add(Ww(this._document,"keyup",n)),t.add(Ww(this._element,"mousemove",n));let s=null==(e=this._element.ownerDocument)?void 0:e.defaultView;s&&t.add(Ww(s,"blur",()=>{this._isActive()&&this.resetClass()})),this._listeners.value=t}resetClass(){this._updateClass(!1)}syncFromModifier(e){this._isActive()&&this._updateClass(e.getModifierState("Alt"))}_updateClass(e){e?this._element.classList.add("enable-mouse-events"):this._element.classList.remove("enable-mouse-events")}},Fk=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){void 0!==this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame??(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e??0,t=t??this._rowCount-1,this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,e):e,this._rowEnd=void 0!==this._rowEnd?Math.max(this._rowEnd,t):t,void 0===this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,void 0===this._rowStart||void 0===this._rowEnd||void 0===this._rowCount)return void this._runRefreshCallbacks();let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},Wk=class{constructor(e){this._tasks=[],this._i=0,this._logService=e}enqueue(e){this._tasks.push(e),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(e){this._idleCallback=void 0;let t,n,s=0,i=e.timeRemaining();for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),s=Math.max(t,s),n=e.timeRemaining(),1.5*s>n)return i-t<-20&&this._logService.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-t))}ms`),void this._start();i=n}this.clear()}},Uk="requestIdleCallback"in globalThis?class extends Wk{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}}:class extends Wk{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},Kk=class{constructor(e){this._queue=new Uk(e)}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}dispose(){this._queue.clear()}},qk=class extends Aw{constructor(e,t,n,s,i,r,o,a,l,c){super(),this._rowCount=e,this._optionsService=n,this._logService=s,this._charSizeService=i,this._coreService=r,this._coreBrowserService=l,this._renderer=this._register(new zw),this._observerDisposable=this._register(new zw),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 MS),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new MS),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new MS),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new MS),this.onRefreshRequest=this._onRefreshRequest.event,this._pausedResizeTask=this._register(new Kk(this._logService)),this._renderDebouncer=new Fk((e,t)=>this._renderRows(e,t),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new $k(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Ew(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(a.onResize(()=>this._fullRefresh())),this._register(a.buffers.onBufferActivate(()=>{var e;return null==(e=this._renderer.value)?void 0:e.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(o.onDecorationRegistered(()=>this._fullRefresh())),this._register(o.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(a.cols,a.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(a.buffer.y,a.buffer.y,void 0,!0))),this._register(c.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(e=>this._registerIntersectionObserver(e,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let n=new e.IntersectionObserver(e=>this._handleIntersectionChange(e[e.length-1]),{threshold:0});this._observerDisposable.value=Ew(()=>{var e;null==(e=this._intersectionObserver)||e.disconnect(),this._intersectionObserver=void 0}),this._intersectionObserver=n,n.observe(t)}}_handleIntersectionChange(e){var t,n;this._isPaused=void 0===e.isIntersecting?0===e.intersectionRatio:!e.isIntersecting,null==(n=null==(t=this._renderer.value)?void 0:t.handleViewportVisibilityChange)||n.call(t,!this._isPaused),!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(e,t,n=!1,s=!1){if(this._isPaused)return void(this._needsFullRefresh=!0);if(this._coreService.decPrivateModes.synchronizedOutput)return void this._syncOutputHandler.bufferRows(e,t);let i=this._syncOutputHandler.flush();i&&(e=Math.min(e,i.start),t=Math.max(t,i.end)),s||(this._isNextRenderRedrawOnly=!1),n?this._renderRows(e,t):this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput)return void this._syncOutputHandler.bufferRows(e,t);e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,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(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(e=>this.refreshRows(e.start,e.end,e.sync,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,t;this._renderer.value&&(null==(t=(e=this._renderer.value).clearTextureAtlas)||t.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var n;return null==(n=this._renderer.value)?void 0:n.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;null==(e=this._renderer.value)||e.handleCharSizeChanged()}handleBlur(){var e;null==(e=this._renderer.value)||e.handleBlur()}handleFocus(){var e;null==(e=this._renderer.value)||e.handleFocus()}handleSelectionChanged(e,t,n){var s;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,null==(s=this._renderer.value)||s.handleSelectionChanged(e,t,n)}handleCursorMove(){var e;null==(e=this._renderer.value)||e.handleCursorMove()}clear(){var e;null==(e=this._renderer.value)||e.clear()}};qk=Ky([qy(2,gw),qy(3,vw),qy(4,ww),qy(5,dw),qy(6,xw),qy(7,hw),qy(8,Sw),qy(9,Bw)],qk);var $k=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout??(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(void 0!==this._timeout&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){void 0!==this._timeout&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function Vk(e,t,n,s){let i,r=n.buffer.x,o=n.buffer.y;if(!n.buffer.hasScrollback)return function(e,t,n,s,i,r){return 0===Yk(t,s,i,r).length?"":Qk(Zk(e,t,e,t-Gk(t,i),!1,i).length,Jk("D",r))}(r,o,0,t,n,s)+Yk(o,t,n,s)+function(e,t,n,s,i,r){let o;o=Yk(t,s,i,r).length>0?s-Gk(s,i):t;let a=s,l=function(e,t,n,s,i,r){let o;return o=Yk(t,s,i,r).length>0?s-Gk(s,i):t,e<n&&o<=s||e>=n&&o<s?"C":"D"}(e,t,n,s,i,r);return Qk(Zk(e,o,n,a,"C"===l,i).length,Jk(l,r))}(r,o,e,t,n,s);if(o===t)return i=r>e?"D":"C",Qk(Math.abs(r-e),Jk(i,s));i=o>t?"D":"C";let a=Math.abs(o-t),l=function(e,t){return t.cols-e}(o>t?e:r,n)+(a-1)*n.cols+1+function(e){return e-1}(o>t?r:e);return Qk(l,Jk(i,s))}function Yk(e,t,n,s){let i=e-Gk(e,n),r=t-Gk(t,n),o=Math.abs(i-r)-function(e,t,n){var s;let i=0,r=e-Gk(e,n),o=t-Gk(t,n);for(let a=0;a<Math.abs(r-o);a++){let o="A"===Xk(e,t)?-1:1;(null==(s=n.buffer.lines.get(r+o*a))?void 0:s.isWrapped)&&i++}return i}(e,t,n);return Qk(o,Jk(Xk(e,t),s))}function Gk(e,t){let n=0,s=t.buffer.lines.get(e),i=null==s?void 0:s.isWrapped;for(;i&&e>=0&&e<t.rows;)n++,s=t.buffer.lines.get(--e),i=null==s?void 0:s.isWrapped;return n}function Xk(e,t){return e>t?"A":"B"}function Zk(e,t,n,s,i,r){let o=e,a=t,l="";for(;(o!==n||a!==s)&&a>=0&&a<r.buffer.lines.length;)o+=i?1:-1,i&&o>r.cols-1?(l+=r.buffer.translateBufferLineToString(a,!1,e,o),o=0,e=0,a++):!i&&o<0&&(l+=r.buffer.translateBufferLineToString(a,!1,0,e+1),o=r.cols-1,e=o,a--);return l+r.buffer.translateBufferLineToString(a,!1,e,o)}function Jk(e,t){return""+(t?"O":"[")+e}function Qk(e,t){e=Math.floor(e);let n="";for(let s=0;s<e;s++)n+=t;return n}var eC=class{constructor(e){this._bufferService=e,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()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!(!e||!t)&&(e[1]>t[1]||e[1]===t[1]&&e[0]>t[0])}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):!!(this.selectionStart&&this.selectionStart[1]<0)&&(this.selectionStart=[0,0],!0)}};function tC(e,t){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var nC=new RegExp(" ","g"),sC=class extends Aw{constructor(e,t,n,s,i,r,o,a,l,c){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=s,this._coreService=i,this._mouseCoordsService=r,this._optionsService=o,this._mouseStateService=a,this._renderService=l,this._coreBrowserService=c,this._dragScrollAmount=0,this._enabled=!0,this._trimListener=this._register(new zw),this._workCell=new aw,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new MS),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new MS),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new MS),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new MS),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener.value=this._bufferService.buffer.lines.onTrim(e=>this._handleTrim(e)),this._register(this._bufferService.buffers.onBufferActivate(e=>this._handleBufferActivate(e))),this.enable(),this._model=new eC(this._bufferService),this._activeSelectionMode=0,this._register(Ew(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(e=>{e.rowsChanged&&this.clearSelection()}))}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(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!(!e||!t)&&(e[0]!==t[0]||e[1]!==t[1])}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let n=this._bufferService.buffer,s=[];if(3===this._activeSelectionMode){if(e[0]===t[0])return"";let i=e[0]<t[0]?e[0]:t[0],r=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let e=n.translateBufferLineToString(o,!0,i,r);s.push(e)}}else{let i=e[1]===t[1]?t[0]:void 0;s.push(n.translateBufferLineToString(e[1],!0,e[0],i));for(let r=e[1]+1;r<=t[1]-1;r++){let e=n.lines.get(r),t=n.translateBufferLineToString(r,!0);(null==e?void 0:e.isWrapped)?s[s.length-1]+=t:s.push(t)}if(e[1]!==t[1]){let e=n.lines.get(t[1]),i=n.translateBufferLineToString(t[1],!0,0,t[0]);e&&e.isWrapped?s[s.length-1]+=i:s.push(i)}}return s.map(e=>e.replace(nC," ")).join(vS?"\r\n":"\n")}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),gS&&e&&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:3===this._activeSelectionMode})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!!(n&&s&&t)&&this._areCoordsInSelection(t,n,s)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!(!n||!s)&&this._areCoordsInSelection([e,t],n,s)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var n,s;let i=null==(s=null==(n=this._linkifier.currentLink)?void 0:n.link)?void 0:s.range;if(i)return this._model.selectionStart=[i.start.x-1,i.start.y-1],this._model.selectionStartLength=tC(i,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return!!r&&(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseCoordsService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=Mk(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-50),50),t/=50,t/Math.abs(t)+Math.round(14*t))}shouldForceSelection(e){return this._optionsService.rawOptions.mouseEventsRequireAlt&&this._mouseStateService.areMouseEventsActive?!e.altKey:pS?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(2===e.button&&this.hasSelection||0!==e.button||this._optionsService.rawOptions.mouseEventsRequireAlt&&this._mouseStateService.areMouseEventsActive&&e.altKey)){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):1===e.detail?this._handleSingleClick(e):2===e.detail?this._handleDoubleClick(e):3===e.detail&&this._handleTripleClick(e),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(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){let t=this.hasSelection;if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0,t&&this._fireOnSelectionChange(this._model.finalSelectionStart,this._model.finalSelectionEnd,!1);let n=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);n&&n.length!==this._model.selectionStart[0]&&0===n.hasWidth(this._model.selectionStart[0])&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return(!this._optionsService.rawOptions.mouseEventsRequireAlt||!this._mouseStateService.areMouseEventsActive)&&(e.altKey&&!(pS&&this._optionsService.rawOptions.macOptionClickForcesSelection))}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd)return void this.refresh(!0);2===this._activeSelectionMode?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:1===this._activeSelectionMode&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),3!==this._activeSelectionMode&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let e=n.lines.get(this._model.selectionEnd[1]);e&&0===e.hasWidth(this._model.selectionEnd[0])&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[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});let e=this._bufferService.buffer;this._dragScrollAmount>0?(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows-1,e.lines.length-1)):(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<500&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let t=this._mouseCoordsService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(t&&void 0!==t[0]&&void 0!==t[1]){let e=Vk(t[0]-1,t[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!(!e||!t||e[0]===t[0]&&e[1]===t[1]);n?!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,n):this._oldHasSelection&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.value=e.activeBuffer.lines.onTrim(e=>this._handleTrim(e))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let s=0;t>=s;s++){let i=e.loadCell(s,this._workCell).getChars().length;0===this._workCell.getWidth()?n--:i>1&&t!==s&&(n+=i-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,s=!0){if(e[0]>=this._bufferService.cols)return;let i=this._bufferService.buffer,r=i.lines.get(e[1]);if(!r)return;let o=i.translateBufferLineToString(e[1],!1),a=this._convertViewportColToCharacterIndex(r,e[0]),l=a,c=e[0]-a,h=0,u=0,d=0,f=0;if(" "===o.charAt(a)){for(;a>0&&" "===o.charAt(a-1);)a--;for(;l<o.length&&" "===o.charAt(l+1);)l++}else{let t=e[0],n=e[0];0===r.getWidth(t)&&(h++,t--),2===r.getWidth(n)&&(u++,n++);let s=r.getString(n).length;for(s>1&&(f+=s-1,l+=s-1);t>0&&a>0&&!this._isCharWordSeparator(r.loadCell(t-1,this._workCell));){r.loadCell(t-1,this._workCell);let e=this._workCell.getChars().length;0===this._workCell.getWidth()?(h++,t--):e>1&&(d+=e-1,a-=e-1),a--,t--}for(;n<r.length&&l+1<o.length&&!this._isCharWordSeparator(r.loadCell(n+1,this._workCell));){r.loadCell(n+1,this._workCell);let e=this._workCell.getChars().length;2===this._workCell.getWidth()?(u++,n++):e>1&&(f+=e-1,l+=e-1),l++,n++}}l++;let p=a+c-h+d,v=Math.min(this._bufferService.cols,l-a+h+u-d-f);if(t||""!==o.slice(a,l).trim()){if(n&&0===p&&32!==r.getCodePoint(0)){let t=i.lines.get(e[1]-1);if(t&&r.isWrapped&&32!==t.getCodePoint(this._bufferService.cols-1)){let t=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(t){let e=this._bufferService.cols-t.start;p-=e,v+=e}}}if(s&&p+v===this._bufferService.cols&&32!==r.getCodePoint(this._bufferService.cols-1)){let t=i.lines.get(e[1]+1);if((null==t?void 0:t.isWrapped)&&32!==t.getCodePoint(0)){let t=this._getWordAt([0,e[1]+1],!1,!1,!0);t&&(v+=t.length)}}return{start:p,length:v}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return 0!==e.getWidth()&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=tC(n,this._bufferService.cols)}};sC=Ky([qy(3,hw),qy(4,dw),qy(5,kw),qy(6,gw),qy(7,uw),qy(8,jw),qy(9,Sw)],sC);var iC=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},rC=class{constructor(){this._color=new iC,this._css=new iC}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},oC=Object.freeze((()=>{let e=[ek.toColor("#2e3436"),ek.toColor("#cc0000"),ek.toColor("#4e9a06"),ek.toColor("#c4a000"),ek.toColor("#3465a4"),ek.toColor("#75507b"),ek.toColor("#06989a"),ek.toColor("#d3d7cf"),ek.toColor("#555753"),ek.toColor("#ef2929"),ek.toColor("#8ae234"),ek.toColor("#fce94f"),ek.toColor("#729fcf"),ek.toColor("#ad7fa8"),ek.toColor("#34e2e2"),ek.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let s=t[n/36%6|0],i=t[n/6%6|0],r=t[n%6];e.push({css:ZS.toCss(s,i,r),rgba:ZS.toRgba(s,i,r)})}for(let n=0;n<24;n++){let t=8+10*n;e.push({css:ZS.toCss(t,t,t),rgba:ZS.toRgba(t,t,t)})}return e})()),aC=ek.toColor("#ffffff"),lC=ek.toColor("#000000"),cC=ek.toColor("#ffffff"),hC=lC,uC={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},dC=aC,fC=class extends Aw{constructor(e){super(),this._optionsService=e,this._contrastCache=new rC,this._halfContrastCache=new rC,this._onChangeColors=this._register(new MS),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:aC,background:lC,cursor:cC,cursorAccent:hC,selectionForeground:void 0,selectionBackgroundTransparent:uC,selectionBackgroundOpaque:QS.blend(lC,uC),selectionInactiveBackgroundTransparent:uC,selectionInactiveBackgroundOpaque:QS.blend(lC,uC),scrollbarSliderBackground:QS.opacity(aC,.2),scrollbarSliderHoverBackground:QS.opacity(aC,.4),scrollbarSliderActiveBackground:QS.opacity(aC,.5),overviewRulerBorder:aC,ansi:oC.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)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=pC(e.foreground,aC),t.background=pC(e.background,lC),t.cursor=QS.blend(t.background,pC(e.cursor,cC)),t.cursorAccent=QS.blend(t.background,pC(e.cursorAccent,hC)),t.selectionBackgroundTransparent=pC(e.selectionBackground,uC),t.selectionBackgroundOpaque=QS.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=pC(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=QS.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?pC(e.selectionForeground,ak):void 0,t.selectionForeground===ak&&(t.selectionForeground=void 0),QS.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=QS.opacity(t.selectionBackgroundTransparent,.3)),QS.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=QS.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=pC(e.scrollbarSliderBackground,QS.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=pC(e.scrollbarSliderHoverBackground,QS.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=pC(e.scrollbarSliderActiveBackground,QS.opacity(t.foreground,.5)),t.overviewRulerBorder=pC(e.overviewRulerBorder,dC),t.ansi=oC.slice(),t.ansi[0]=pC(e.black,oC[0]),t.ansi[1]=pC(e.red,oC[1]),t.ansi[2]=pC(e.green,oC[2]),t.ansi[3]=pC(e.yellow,oC[3]),t.ansi[4]=pC(e.blue,oC[4]),t.ansi[5]=pC(e.magenta,oC[5]),t.ansi[6]=pC(e.cyan,oC[6]),t.ansi[7]=pC(e.white,oC[7]),t.ansi[8]=pC(e.brightBlack,oC[8]),t.ansi[9]=pC(e.brightRed,oC[9]),t.ansi[10]=pC(e.brightGreen,oC[10]),t.ansi[11]=pC(e.brightYellow,oC[11]),t.ansi[12]=pC(e.brightBlue,oC[12]),t.ansi[13]=pC(e.brightMagenta,oC[13]),t.ansi[14]=pC(e.brightCyan,oC[14]),t.ansi[15]=pC(e.brightWhite,oC[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let s=0;s<n;s++)t.ansi[s+16]=pC(e.extendedAnsi[s],oC[s+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(void 0!==e)switch(e){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[e]=this._restoreColors.ansi[e]}else for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t]}modifyColors(e){e(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 pC(e,t){if(void 0!==e)try{return ek.toColor(e)}catch{}return t}fC=Ky([qy(0,gw)],fC);var vC={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:["'",'"']};var gC=class{constructor(){this._functionalKeyCodes={Escape:27,Enter:13,Tab:9,Backspace:127,CapsLock:57358,ScrollLock:57359,NumLock:57360,PrintScreen:57361,Pause:57362,ContextMenu:57363,F13:57376,F14:57377,F15:57378,F16:57379,F17:57380,F18:57381,F19:57382,F20:57383,F21:57384,F22:57385,F23:57386,F24:57387,F25:57388,KP_0:57399,KP_1:57400,KP_2:57401,KP_3:57402,KP_4:57403,KP_5:57404,KP_6:57405,KP_7:57406,KP_8:57407,KP_9:57408,KP_Decimal:57409,KP_Divide:57410,KP_Multiply:57411,KP_Subtract:57412,KP_Add:57413,KP_Enter:57414,KP_Equal:57415,ShiftLeft:57441,ShiftRight:57447,ControlLeft:57442,ControlRight:57448,AltLeft:57443,AltRight:57449,MetaLeft:57444,MetaRight:57450,MediaPlayPause:57430,MediaStop:57432,MediaTrackNext:57435,MediaTrackPrevious:57436,AudioVolumeDown:57438,AudioVolumeUp:57439,AudioVolumeMute:57440},this._csiTildeKeys={Insert:2,Delete:3,PageUp:5,PageDown:6,F5:15,F6:17,F7:18,F8:19,F9:20,F10:21,F11:23,F12:24},this._csiLetterKeys={ArrowUp:"A",ArrowDown:"B",ArrowRight:"C",ArrowLeft:"D",Home:"H",End:"F"},this._ss3FunctionKeys={F1:"P",F2:"Q",F3:"R",F4:"S"}}_getNumpadKeyCode(e){if(e.code.startsWith("Numpad")){let t=e.code.slice(6);if(t>="0"&&t<="9")return 57399+parseInt(t,10);switch(t){case"Decimal":return 57409;case"Divide":return 57410;case"Multiply":return 57411;case"Subtract":return 57412;case"Add":return 57413;case"Enter":return 57414;case"Equal":return 57415}}}_getModifierKeyCode(e){switch(e.code){case"ShiftLeft":return 57441;case"ShiftRight":return 57447;case"ControlLeft":return 57442;case"ControlRight":return 57448;case"AltLeft":return 57443;case"AltRight":return 57449;case"MetaLeft":return 57444;case"MetaRight":return 57450}}_encodeModifiers(e){let t=0;return e.shiftKey&&(t|=1),e.altKey&&(t|=2),e.ctrlKey&&(t|=4),e.metaKey&&(t|=8),t>0?t+1:0}_getKeyCode(e,t){let n=this._getNumpadKeyCode(e);if(void 0!==n)return n;let s=this._getModifierKeyCode(e);if(void 0!==s)return s;let i=this._functionalKeyCodes[e.key];if(void 0!==i)return i;if((e.shiftKey||t&&e.altKey)&&e.code){if(e.code.startsWith("Digit")&&6===e.code.length){let t=e.code.charAt(5);if(t>="0"&&t<="9")return t.charCodeAt(0)}if(e.code.startsWith("Key")&&4===e.code.length)return e.code.charAt(3).toLowerCase().charCodeAt(0)}if(1===e.key.length){let t=e.key.codePointAt(0);return t>=65&&t<=90?t+32:t}}_isModifierKey(e){return"Shift"===e.key||"Control"===e.key||"Alt"===e.key||"Meta"===e.key}_isLockKey(e){return"CapsLock"===e.key||"NumLock"===e.key||"ScrollLock"===e.key}_buildCsiLetterSequence(e,t,n,s){let i=s&&1!==n;if(t>0||i){let s="[1;"+(t>0?t:"1");return i&&(s+=":"+n),s+=e,s}return"["+e}_buildSs3Sequence(e,t,n,s){let i=s&&1!==n;if(t>0||i){let s="[1;"+(t>0?t:"1");return i&&(s+=":"+n),s+=e,s}return"O"+e}_buildCsiTildeSequence(e,t,n,s){let i=s&&1!==n,r="["+e;return(t>0||i)&&(r+=";"+(t>0?t:"1"),i&&(r+=":"+n)),r+="~",r}_buildCsiUSequence(e,t,n,s,i,r,o){let a,l=!!(2&i),c="["+t;!!(4&i)&&e.shiftKey&&1===e.key.length&&!r&&!o&&(a=e.key.codePointAt(0),c+=":"+a);let h=16&i&&3!==s&&1===e.key.length&&!r&&!o&&!e.ctrlKey?e.key.codePointAt(0):void 0,u=l&&1!==s&&(3===s||void 0===h);return(n>0||u||void 0!==h)&&(c+=";",n>0?c+=n:u&&(c+="1"),u&&(c+=":"+s)),void 0!==h&&(c+=";"+h),c+="u",c}evaluate(e,t,n=1,s=!1){let i={type:0,cancel:!1,key:void 0},r=this._encodeModifiers(e),o=this._isModifierKey(e),a=!!(2&t);if(!a&&3===n||o&&!(8&t)||this._isLockKey(e)&&!(8&t))return i;let l=this._csiLetterKeys[e.key];if(l)return i.key=this._buildCsiLetterSequence(l,r,n,a),i.cancel=!0,i;let c=this._ss3FunctionKeys[e.key];if(c)return i.key=this._buildSs3Sequence(c,r,n,a),i.cancel=!0,i;let h=this._csiTildeKeys[e.key];if(void 0!==h)return i.key=this._buildCsiTildeSequence(h,r,n,a),i.cancel=!0,i;let u=this._getKeyCode(e,s);if(void 0===u)return i;let d=13===u||9===u||127===u;if(d&&3===n&&!(8&t))return i;let f=void 0!==this._functionalKeyCodes[e.key]||void 0!==this._getNumpadKeyCode(e);if(8&t||a&&3===n||(1&t||a)&&(f&&!d||r>0&&1!==e.key.length||r-1>1))i.key=this._buildCsiUSequence(e,u,r,n,t,f,o),i.cancel=!0;else{let t=13===u?"\r":9===u?"\t":127===u?"":void 0;t?i.key=t:1===e.key.length&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&(i.key=e.key)}return i}static shouldUseProtocol(e){return e>0}},mC=class{constructor(){this._codeToVk={KeyA:65,KeyB:66,KeyC:67,KeyD:68,KeyE:69,KeyF:70,KeyG:71,KeyH:72,KeyI:73,KeyJ:74,KeyK:75,KeyL:76,KeyM:77,KeyN:78,KeyO:79,KeyP:80,KeyQ:81,KeyR:82,KeyS:83,KeyT:84,KeyU:85,KeyV:86,KeyW:87,KeyX:88,KeyY:89,KeyZ:90,Digit0:48,Digit1:49,Digit2:50,Digit3:51,Digit4:52,Digit5:53,Digit6:54,Digit7:55,Digit8:56,Digit9:57,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,F13:124,F14:125,F15:126,F16:127,F17:128,F18:129,F19:130,F20:131,F21:132,F22:133,F23:134,F24:135,Numpad0:96,Numpad1:97,Numpad2:98,Numpad3:99,Numpad4:100,Numpad5:101,Numpad6:102,Numpad7:103,Numpad8:104,Numpad9:105,NumpadMultiply:106,NumpadAdd:107,NumpadSeparator:108,NumpadSubtract:109,NumpadDecimal:110,NumpadDivide:111,NumpadEnter:13,NumLock:144,ArrowUp:38,ArrowDown:40,ArrowLeft:37,ArrowRight:39,Home:36,End:35,PageUp:33,PageDown:34,Insert:45,Delete:46,ShiftLeft:16,ShiftRight:16,ControlLeft:17,ControlRight:17,AltLeft:18,AltRight:18,MetaLeft:91,MetaRight:92,CapsLock:20,ScrollLock:145,Escape:27,Enter:13,Tab:9,Space:32,Backspace:8,Pause:19,ContextMenu:93,PrintScreen:44,Semicolon:186,Equal:187,Comma:188,Minus:189,Period:190,Slash:191,Backquote:192,BracketLeft:219,Backslash:220,BracketRight:221,Quote:222,IntlBackslash:226},this._codeToScancode={KeyQ:16,KeyW:17,KeyE:18,KeyR:19,KeyT:20,KeyY:21,KeyU:22,KeyI:23,KeyO:24,KeyP:25,KeyA:30,KeyS:31,KeyD:32,KeyF:33,KeyG:34,KeyH:35,KeyJ:36,KeyK:37,KeyL:38,KeyZ:44,KeyX:45,KeyC:46,KeyV:47,KeyB:48,KeyN:49,KeyM:50,Digit1:2,Digit2:3,Digit3:4,Digit4:5,Digit5:6,Digit6:7,Digit7:8,Digit8:9,Digit9:10,Digit0:11,F1:59,F2:60,F3:61,F4:62,F5:63,F6:64,F7:65,F8:66,F9:67,F10:68,F11:87,F12:88,Numpad0:82,Numpad1:79,Numpad2:80,Numpad3:81,Numpad4:75,Numpad5:76,Numpad6:77,Numpad7:71,Numpad8:72,Numpad9:73,NumpadMultiply:55,NumpadAdd:78,NumpadSubtract:74,NumpadDecimal:83,NumpadDivide:53,NumpadEnter:28,NumLock:69,ArrowUp:72,ArrowDown:80,ArrowLeft:75,ArrowRight:77,Home:71,End:79,PageUp:73,PageDown:81,Insert:82,Delete:83,ShiftLeft:42,ShiftRight:54,ControlLeft:29,ControlRight:29,AltLeft:56,AltRight:56,CapsLock:58,ScrollLock:70,Escape:1,Enter:28,Tab:15,Space:57,Backspace:14,Pause:69,Semicolon:39,Equal:13,Comma:51,Minus:12,Period:52,Slash:53,Backquote:41,BracketLeft:26,Backslash:43,BracketRight:27,Quote:40},this._enhancedKeyCodes=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown","Insert","Delete","NumpadEnter","NumpadDivide","ControlRight","AltRight","PrintScreen","Pause","ContextMenu","MetaLeft","MetaRight"]),this._keyToControlChar={Enter:13,Backspace:8,Tab:9,Escape:27}}_getVirtualKeyCode(e){let t=this._codeToVk[e.code];return void 0!==t?t:e.keyCode||0}_getScanCode(e){return this._codeToScancode[e.code]||0}_getUnicodeChar(e){if(e.ctrlKey&&!e.altKey&&!e.metaKey){if("Enter"===e.key)return 10;if("Backspace"===e.key)return 127}let t=this._keyToControlChar[e.key];if(void 0!==t)return t;if(1===e.key.length){let t=e.key.codePointAt(0)||0;if(e.ctrlKey&&!e.altKey&&!e.metaKey){if(t>=65&&t<=90)return t-64;if(t>=97&&t<=122)return t-96}return t}return 0}_getControlKeyState(e){let t=0;return e.shiftKey&&(t|=16),e.ctrlKey&&("ControlRight"===e.code?t|=4:t|=8),e.altKey&&("AltRight"===e.code?t|=1:t|=2),this._enhancedKeyCodes.has(e.code)&&(t|=256),t}evaluateKeyboardEvent(e,t){return{type:0,cancel:!0,key:`[${this._getVirtualKeyCode(e)};${this._getScanCode(e)};${this._getUnicodeChar(e)};${t?1:0};${this._getControlKeyState(e)};1_`}}},_C=class{constructor(e,t){this._coreService=e,this._optionsService=t}_getWin32InputMode(){return this._win32InputMode??(this._win32InputMode=new mC),this._win32InputMode}_getKittyKeyboard(){return this._kittyKeyboard??(this._kittyKeyboard=new gC),this._kittyKeyboard}evaluateKeyDown(e){if(this.useWin32InputMode)return this._getWin32InputMode().evaluateKeyboardEvent(e,!0);let t=this._coreService.kittyKeyboard.flags;return this.useKitty?this._getKittyKeyboard().evaluate(e,t,e.repeat?2:1,pS&&this._optionsService.rawOptions.macOptionIsMeta):function(e,t,n,s){var i;let r={type:0,cancel:!1,key:void 0},o=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:"UIKeyInputUpArrow"===e.key?r.key=t?"OA":"[A":"UIKeyInputLeftArrow"===e.key?r.key=t?"OD":"[D":"UIKeyInputRightArrow"===e.key?r.key=t?"OC":"[C":"UIKeyInputDownArrow"===e.key&&(r.key=t?"OB":"[B");break;case 8:r.key=e.ctrlKey?"\b":"",e.altKey&&(r.key=""+r.key);break;case 9:if(e.shiftKey){r.key="[Z";break}r.key="\t",r.cancel=!0;break;case 13:"c"===e.key&&e.ctrlKey?r.key="":r.key=e.altKey?"\r":"\r",r.cancel=!0;break;case 27:r.key="",e.altKey&&(r.key=""),r.cancel=!0;break;case 37:if(e.metaKey)break;r.key=o?"[1;"+(o+1)+"D":t?"OD":"[D";break;case 39:if(e.metaKey)break;r.key=o?"[1;"+(o+1)+"C":t?"OC":"[C";break;case 38:if(e.metaKey)break;r.key=o?"[1;"+(o+1)+"A":t?"OA":"[A";break;case 40:if(e.metaKey)break;r.key=o?"[1;"+(o+1)+"B":t?"OB":"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(r.key="[2~");break;case 46:r.key=o?"[3;"+(o+1)+"~":"[3~";break;case 36:r.key=o?"[1;"+(o+1)+"H":t?"OH":"[H";break;case 35:r.key=o?"[1;"+(o+1)+"F":t?"OF":"[F";break;case 33:e.shiftKey?r.type=2:e.ctrlKey?r.key="[5;"+(o+1)+"~":r.key="[5~";break;case 34:e.shiftKey?r.type=3:e.ctrlKey?r.key="[6;"+(o+1)+"~":r.key="[6~";break;case 112:r.key=o?"[1;"+(o+1)+"P":"OP";break;case 113:r.key=o?"[1;"+(o+1)+"Q":"OQ";break;case 114:r.key=o?"[1;"+(o+1)+"R":"OR";break;case 115:r.key=o?"[1;"+(o+1)+"S":"OS";break;case 116:r.key=o?"[15;"+(o+1)+"~":"[15~";break;case 117:r.key=o?"[17;"+(o+1)+"~":"[17~";break;case 118:r.key=o?"[18;"+(o+1)+"~":"[18~";break;case 119:r.key=o?"[19;"+(o+1)+"~":"[19~";break;case 120:r.key=o?"[20;"+(o+1)+"~":"[20~";break;case 121:r.key=o?"[21;"+(o+1)+"~":"[21~";break;case 122:r.key=o?"[23;"+(o+1)+"~":"[23~";break;case 123:r.key=o?"[24;"+(o+1)+"~":"[24~";break;default:if(!e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)if(n&&!s||!e.altKey||e.metaKey)if(!n||e.altKey||e.ctrlKey||e.shiftKey||!e.metaKey){if(e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&1===e.key.length)r.key=e.key;else if(e.key&&e.ctrlKey&&e.shiftKey)switch(e.code){case"Minus":r.key="";break;case"Digit2":r.key="\0";break;case"Digit6":r.key=""}}else 65===e.keyCode&&(r.type=1);else{let t=null==(i=vC[e.keyCode])?void 0:i[e.shiftKey?1:0];if(t)r.key=""+t;else if(e.keyCode>=65&&e.keyCode<=90){let t=e.ctrlKey?e.keyCode-64:e.keyCode+32,n=String.fromCharCode(t);e.shiftKey&&(n=n.toUpperCase()),r.key=""+n}else if(32===e.keyCode)r.key=""+(e.ctrlKey?"\0":" ");else if("Dead"===e.key&&e.code.startsWith("Key")){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),r.key=""+t,r.cancel=!0}}else e.keyCode>=65&&e.keyCode<=90?r.key=String.fromCharCode(e.keyCode-64):32===e.keyCode?r.key="\0":e.keyCode>=51&&e.keyCode<=55?r.key=String.fromCharCode(e.keyCode-51+27):56===e.keyCode?r.key="":"/"===e.key?r.key="":219===e.keyCode?r.key="":220===e.keyCode?r.key="":221===e.keyCode&&(r.key="")}return r}(e,this._coreService.decPrivateModes.applicationCursorKeys,pS,this._optionsService.rawOptions.macOptionIsMeta)}evaluateKeyUp(e){if(this.useWin32InputMode)return this._getWin32InputMode().evaluateKeyboardEvent(e,!1);let t=this._coreService.kittyKeyboard.flags;return this.useKitty&&2&t?this._getKittyKeyboard().evaluate(e,t,3,pS&&this._optionsService.rawOptions.macOptionIsMeta):void 0}get useKitty(){var e;let t=this._coreService.kittyKeyboard.flags;return!(!(null==(e=this._optionsService.rawOptions.vtExtensions)?void 0:e.kittyKeyboard)||!gC.shouldUseProtocol(t))}get useWin32InputMode(){var e;return!(!(null==(e=this._optionsService.rawOptions.vtExtensions)?void 0:e.win32InputMode)||!this._coreService.decPrivateModes.win32InputMode)}};_C=Ky([qy(0,dw),qy(1,gw)],_C);var xC=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},bC=class{constructor(){this._services=new xC,this._services.set(pw,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=(i=e,i.di$dependencies||[]).sort((e,t)=>e.index-t.index),s=[];var i;for(let o of n){let t=this._services.get(o.id);if(!t)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${o.id._id}.`);s.push(t)}let r=n.length>0?n[0].index:t.length;if(t.length!==r)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${r+1} conflicts with ${t.length} static arguments`);return new e(...t,...s)}},yC={trace:0,debug:1,info:2,warn:3,error:4,off:5},wC=class extends Aw{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=yC[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)"function"==typeof e[t]&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+t,...n)}trace(e,...t){var n;this._logLevel<=0&&this._log((null==(n=this._optionsService.options.logger)?void 0:n.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var n;this._logLevel<=1&&this._log((null==(n=this._optionsService.options.logger)?void 0:n.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var n;this._logLevel<=2&&this._log((null==(n=this._optionsService.options.logger)?void 0:n.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var n;this._logLevel<=3&&this._log((null==(n=this._optionsService.options.logger)?void 0:n.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var n;this._logLevel<=4&&this._log((null==(n=this._optionsService.options.logger)?void 0:n.error.bind(this._optionsService.options.logger))??console.error,e,t)}};wC=Ky([qy(0,gw)],wC);var SC=class extends Aw{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new MS),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new MS),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new MS),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,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(e,t,...n){if(t){for(let n=e;n<this._length-t;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let s=this._length-1;s>=e;s--)this._array[this._getCyclicIndex(s+n.length)]=this._array[this._getCyclicIndex(s)];for(let s=0;s<n.length;s++)this._array[this._getCyclicIndex(e+s)]=n[s];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let e=this._length+n.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+n<0)throw new Error("Cannot shift elements in list beyond index 0");if(n>0){for(let i=t-1;i>=0;i--)this.set(e+i+n,this.get(e+i));let s=e+t+n-this._length;if(s>0)for(this._length+=s;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let s=0;s<t;s++)this.set(e+s+n,this.get(e+s))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},kC=class{constructor(){this._chunks=[],this._length=0}get length(){return this._length}reset(){this._chunks.length=0,this._length=0}append(e){this._chunks.push(e),this._length+=e.length}toString(){return this._chunks.join("")}},CC=class{constructor(e){this._limit=e,this._builder=new kC}get length(){return this._builder.length}get limit(){return this._limit}reset(){this._builder.reset()}append(e){return this._builder.append(e),this._builder.length>this._limit&&(this._builder.reset(),!0)}toString(){return this._builder.toString()}},jC=Object.freeze(new rw),NC=0,MC=new aw,BC=new kC,DC=class e{constructor(e,t,n,s=!1){this._stringCache=e,this.isWrapped=s,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*t);let i=n??aw.fromCharData([0,"",1,0]);for(let r=0;r<t;++r)this.setCell(r,i);this.length=t}get(e){let t=this._data[3*e+0],n=2097151&t;return[this._data[3*e+1],2097152&t?this._combined[e]:n?tw(n):"",t>>22,2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,t){this._invalidateStringCache(),this._data[3*e+1]=t[0],t[1].length>1?(this._combined[e]=t[1],this._data[3*e+0]=2097152|e|t[2]<<22):this._data[3*e+0]=t[1].charCodeAt(0)|t[2]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 12582912&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){let t=this._data[3*e+0];return 2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&t}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){let t=this._data[3*e+0];return 2097152&t?this._combined[e]:2097151&t?tw(2097151&t):""}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,t){return NC=3*e,t.content=this._data[NC+0],t.fg=this._data[NC+1],t.bg=this._data[NC+2],2097152&t.content?t.combinedData=this._combined[e]:t.combinedData="",268435456&t.bg?t.extended=this._extendedAttrs[e]:t.extended=jC.extended.clone(),t}setCell(e,t){this._invalidateStringCache(),2097152&t.content&&(this._combined[e]=t.combinedData),268435456&t.bg&&(this._extendedAttrs[e]=t.extended),this._data[3*e+0]=t.content,this._data[3*e+1]=t.fg,this._data[3*e+2]=t.bg}setCellFromCodepoint(e,t,n,s){this._invalidateStringCache(),268435456&s.bg&&(this._extendedAttrs[e]=s.extended),this._data[3*e+0]=t|n<<22,this._data[3*e+1]=s.fg,this._data[3*e+2]=s.bg}addCodepointToCell(e,t,n){this._invalidateStringCache();let s=this._data[3*e+0];2097152&s?this._combined[e]+=tw(t):2097151&s?(this._combined[e]=tw(2097151&s)+tw(t),s&=-2097152,s|=2097152):s=t|1<<22,n&&(s&=-12582913,s|=n<<22),this._data[3*e+0]=s}insertCells(e,t,n){if(this._invalidateStringCache(),(e%=this.length)&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length-e){for(let n=this.length-e-t-1;n>=0;--n)this.setCell(e+t+n,this.loadCell(e+n,MC));for(let s=0;s<t;++s)this.setCell(e+s,n)}else for(let s=e;s<this.length;++s)this.setCell(s,n);2===this.getWidth(this.length-1)&&this.setCellFromCodepoint(this.length-1,0,1,n)}deleteCells(e,t,n){if(this._invalidateStringCache(),e%=this.length,t<this.length-e){for(let n=0;n<this.length-e-t;++n)this.setCell(e+n,this.loadCell(e+t+n,MC));for(let e=this.length-t;e<this.length;++e)this.setCell(e,n)}else for(let s=e;s<this.length;++s)this.setCell(s,n);e&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,n),0===this.getWidth(e)&&!this.hasContent(e)&&this.setCellFromCodepoint(e,0,1,n)}replaceCells(e,t,n,s=!1){if(this._invalidateStringCache(),s)for(e&&2===this.getWidth(e-1)&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&2===this.getWidth(t-1)&&!this.isProtected(t)&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.isProtected(e)||this.setCell(e,n),e++;else for(e&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&2===this.getWidth(t-1)&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.setCell(e++,n)}resize(e,t){if(this._invalidateStringCache(),e===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let n=3*e;if(e>this.length){if(this._data.buffer.byteLength>=4*n)this._data=new Uint32Array(this._data.buffer,0,n);else{let e=new Uint32Array(n);e.set(this._data),this._data=e}for(let n=this.length;n<e;++n)this.setCell(n,t)}else{this._data=this._data.subarray(0,n);let t=Object.keys(this._combined);for(let n=0;n<t.length;n++){let s=parseInt(t[n],10);s>=e&&delete this._combined[s]}let s=Object.keys(this._extendedAttrs);for(let n=0;n<s.length;n++){let t=parseInt(s[n],10);t>=e&&delete this._extendedAttrs[t]}}return this.length=e,4*n*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,t=!1){if(this._invalidateStringCache(),t)for(let n=0;n<this.length;++n)this.isProtected(n)||this.setCell(n,e);else{this._combined={},this._extendedAttrs={};for(let t=0;t<this.length;++t)this.setCell(t,e)}}copyFrom(e){this._invalidateStringCache(),this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._copySparseMapsFrom(e),this.isWrapped=e.isWrapped}clone(){let t=new e(this._stringCache,0,void 0,!1);return t._data=new Uint32Array(this._data),t.length=this.length,t._copySparseMapsFrom(this),t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0]||50331648&this._data[3*e+2])return e+(this._data[3*e+0]>>22);return 0}copyCellsFrom(e,t,n,s,i){this._invalidateStringCache();let r=e._data;if(i)for(let o=s-1;o>=0;o--){for(let e=0;e<3;e++)this._data[3*(n+o)+e]=r[3*(t+o)+e];this._copyCellMapsFrom(e,t+o,n+o)}else for(let o=0;o<s;o++){for(let e=0;e<3;e++)this._data[3*(n+o)+e]=r[3*(t+o)+e];this._copyCellMapsFrom(e,t+o,n+o)}}translateToString(e,t,n,s){var i,r;let o=(void 0===t||0===t)&&void 0===n&&void 0===s;o&&(null==(r=(i=this._stringCache).touch)||r.call(i));let a=o?this._getStringCacheEntry(!1):void 0;if(o&&void 0!==(null==a?void 0:a.value)){if(e)return a.isTrimmed?a.value:a.value.trimEnd();if(!a.isTrimmed)return a.value}for(t=t??0,n=n??this.length,e&&(n=Math.min(n,this.getTrimmedLength())),s&&(s.length=0),BC.reset();t<n;){let e=this._data[3*t+0],n=2097151&e,i=2097152&e?this._combined[t]:n?tw(n):" ";if(BC.append(i),s)for(let r=0;r<i.length;++r)s.push(t);t+=e>>22||1}s&&s.push(t);let l=BC.toString();if(BC.reset(),o){let t=this._getStringCacheEntry(!0);t.value=l,t.isTrimmed=!!e}return l}_getStringCacheEntry(e){var t;let n=null==(t=this._stringCacheEntryRef)?void 0:t.deref();if(n&&n.generation===this._stringCache.generation)return n;if(!e)return;let s=this._stringCache.allocateEntry();return this._stringCacheEntryRef=new WeakRef(s),s}_invalidateStringCache(){let e=this._getStringCacheEntry(!1);e&&(e.value=void 0,e.isTrimmed=!1)}_copyCellMapsFrom(e,t,n){let s=3*t;2097152&e._data[s+0]&&(this._combined[n]=e._combined[t]),268435456&e._data[s+2]&&(this._extendedAttrs[n]=e._extendedAttrs[t])}_copySparseMapsFrom(e){this._combined={},this._extendedAttrs={};for(let t=0;t<e.length;t++)this._copyCellMapsFrom(e,t,t)}},LC=class extends Aw{constructor(){super(),this.generation=0,this.entries=new Set,this._clearTimeout=this._register(new zw),this._lastAccessTimestamp=0,this._register(Ew(()=>this.entries.clear()))}touch(){this._scheduleClear()}allocateEntry(){let e={value:void 0,isTrimmed:!1,generation:this.generation};return this.entries.add(e),this._scheduleClear(),e}clear(){this._clearTimeout.clear(),this._lastAccessTimestamp=0,this.generation++;for(let e of this.entries)e.value=void 0,e.isTrimmed=!1;this.entries.clear()}_scheduleClear(){this._lastAccessTimestamp=Date.now(),!this._clearTimeout.value&&this._scheduleClearTimeout(15e3)}_scheduleClearTimeout(e){this._clearTimeout.value=function(e,t=0){let n=setTimeout(()=>{e()},t);return Ew(()=>{clearTimeout(n)})}(()=>{let e=Date.now()-this._lastAccessTimestamp;e>=15e3?this.clear():this._scheduleClearTimeout(15e3-e)},e)}};function EC(e,t,n){let s=[],i=0;for(let l=0;l<e.length;l++)i+=PC(e,l,t);let r=0,o=0,a=0;for(;a<i;){if(i-a<n){s.push(i-a);break}r+=n;let l=PC(e,o,t);r>l&&(r-=l,o++);let c=2===e[o].getWidth(r-1);c&&r--;let h=c?n-1:n;s.push(h),a+=h}return s}function PC(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let s=!e[t].hasContent(n-1)&&1===e[t].getWidth(n-1),i=2===e[t+1].getWidth(0);return s&&i?n-1:n}var RC=class e{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=e._nextId++,this._onDispose=this.register(new MS),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Pw(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};RC._nextId=1;var AC=RC,zC={},TC=zC.B;zC[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:"≥","{":"π","|":"≠","}":"£","~":"·"},zC.A={"#":"£"},zC.B=void 0,zC[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},zC.C=zC[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},zC.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},zC.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},zC.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},zC.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},zC.E=zC[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},zC.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},zC.H=zC[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},zC["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var IC=4294967295,OC=class extends Aw{constructor(e,t,n,s){super(),this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this._logService=s,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=jC.clone(),this.savedCharset=TC,this.savedCharsets=[],this.savedGlevel=0,this.savedOriginMode=!1,this.savedWraparoundMode=!0,this.markers=[],this._nullCell=aw.fromCharData([0,"",1,0]),this._whitespaceCell=aw.fromCharData([0," ",1,32]),this._isClearing=!1,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new SC(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops(),this._memoryCleanupQueue=new Uk(this._logService),this._register(Ew(()=>this._memoryCleanupQueue.clear())),this._register(Ew(()=>this.clearAllMarkers())),this._stringCache=this._register(new LC)}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new ow),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new ow),this._whitespaceCell}getBlankLine(e,t){return new DC(this._stringCache,this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>IC?IC:t}fillViewportRows(e){if(0===this.lines.length){e??(e=jC);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this._stringCache.clear(),this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new SC(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(jC);this._stringCache.clear();let s=0,i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols<e)for(let t=0;t<this.lines.length;t++)s+=+this.lines.get(t).resize(e,n);let r=0;if(this._rows<t)for(let s=this._rows;s<t;s++)this.lines.length<t+this.ybase&&(void 0!==this._optionsService.rawOptions.windowsPty.backend||void 0!==this._optionsService.rawOptions.windowsPty.buildNumber?this.lines.push(new DC(this._stringCache,e,n,!1)):this.ybase>0&&this.lines.length<=this.ybase+this.y+r+1?(this.ybase--,r++,this.ydisp>0&&this.ydisp--):this.lines.push(new DC(this._stringCache,e,n,!1)));else for(let e=this._rows;e>t;e--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i<this.lines.maxLength){let e=this.lines.length-i;e>0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),r&&(this.y+=r),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let r=0;r<this.lines.length;r++)s+=+this.lines.get(r).resize(e,n);if(this._cols=e,this._rows=t,this.lines.length>0){let e=Math.max(0,this.lines.length-this.ybase-1);this.y=Math.min(this.y,e)}this._memoryCleanupQueue.clear(),s>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&"conpty"===e.backend&&e.buildNumber>=21376:this._hasScrollback}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,s=function(e,t,n,s,i,r){let o=[];for(let a=0;a<e.length-1;a++){let l=a,c=e.get(++l);if(!c.isWrapped)continue;let h=[e.get(a)];for(;l<e.length&&c.isWrapped;)h.push(c),c=e.get(++l);if(!r&&s>=a&&s<l){a+=h.length-1;continue}let u=0,d=PC(h,u,t),f=1,p=0;for(;f<h.length;){let e=PC(h,f,t),s=e-p,r=n-d,o=Math.min(s,r);h[u].copyCellsFrom(h[f],p,d,o,!1),d+=o,d===n&&(u++,d=0),p+=o,p===e&&(f++,p=0),0===d&&0!==u&&2===h[u-1].getWidth(n-1)&&(h[u].copyCellsFrom(h[u-1],n-1,d++,1,!1),h[u-1].setCell(n-1,i))}h[u].replaceCells(d,n,i);let v=0;for(let e=h.length-1;e>0&&(e>u||0===h[e].getTrimmedLength());e--)v++;v>0&&(o.push(a+h.length-v),o.push(v)),a+=h.length-1}return o}(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(jC),n);if(s.length>0){let n=function(e,t){let n=[],s=0,i=t[s],r=0;for(let o=0;o<e.length;o++)if(i===o){let n=t[++s];e.onDeleteEmitter.fire({index:o-r,amount:n}),o+=n-1,r+=n,i=t[++s]}else n.push(o);return{layout:n,countRemoved:r}}(this.lines,s);(function(e,t){let n=[];for(let s=0;s<t.length;s++)n.push(e.get(t[s]));for(let s=0;s<n.length;s++)e.set(s,n[s]);e.length=t.length})(this.lines,n.layout),this._reflowLargerAdjustViewport(e,t,n.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let s=this.getNullCell(jC),i=n;for(;i-- >0;)0===this.ybase?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new DC(this._stringCache,e,s,!1))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,s=this.getNullCell(jC),i=[],r=0;for(let o=this.lines.length-1;o>=0;o--){let a=this.lines.get(o);if(!a||!a.isWrapped&&a.getTrimmedLength()<=e)continue;let l=[a];for(;a.isWrapped&&o>0;)a=this.lines.get(--o),l.unshift(a);if(!n){let e=this.ybase+this.y;if(e>=o&&e<o+l.length)continue}let c,h=l[l.length-1].getTrimmedLength(),u=EC(l,this._cols,e),d=u.length-l.length;c=0===this.ybase&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+d):Math.max(0,this.lines.length-this.lines.maxLength+d);let f=[];for(let e=0;e<d;e++){let e=this.getBlankLine(jC,!0);f.push(e)}f.length>0&&(i.push({start:o+l.length+r,newLines:f}),r+=f.length),l.push(...f);let p=u.length-1,v=u[p];0===v&&(p--,v=u[p]);let g=l.length-d-1,m=h;for(;g>=0;){let e=Math.min(m,v);if(void 0===l[p])break;if(l[p].copyCellsFrom(l[g],m-e,v-e,e,!0),v-=e,0===v&&(p--,v=u[p]),m-=e,0===m){g--,m=PC(l,Math.max(g,0),this._cols)}}for(let t=0;t<l.length;t++)u[t]<e&&l[t].setCell(u[t],s);let _=d-c;for(;_-- >0;)0===this.ybase?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+r)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+d,this.ybase+t-1)}if(i.length>0){let e=[],t=[];for(let i=0;i<this.lines.length;i++)t.push(this.lines.get(i));let n=this.lines.length,s=n-1,o=0,a=i[o];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+r);let l=0;for(let u=Math.min(this.lines.maxLength-1,n+r-1);u>=0;u--)if(a&&a.start>s+l){for(let e=a.newLines.length-1;e>=0;e--)this.lines.set(u--,a.newLines[e]);u++,e.push({index:s+1,amount:a.newLines.length}),l+=a.newLines.length,a=i[++o]}else this.lines.set(u,t[s--]);let c=0;for(let i=e.length-1;i>=0;i--)e[i].index+=c,this.lines.onInsertEmitter.fire(e[i]),c+=e[i].amount;let h=Math.max(0,n+r-this.lines.maxLength);h>0&&this.lines.onTrimEmitter.fire(h)}}translateBufferLineToString(e,t,n=0,s){let i=this.lines.get(e);return i?i.translateToString(t,n,s):""}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(null!=e?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e??(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e??(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new AC(e);return this.markers.push(t),t.register(this.lines.onTrim(e=>{t.line-=e,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(e=>{t.line>=e.index&&(t.line+=e.amount)})),t.register(this.lines.onDelete(e=>{t.line>=e.index&&t.line<e.index+e.amount&&t.dispose(),t.line>e.index&&(t.line-=e.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},HC=class extends Aw{constructor(e,t,n){super(),this._optionsService=e,this._bufferService=t,this._logService=n,this._normalBuffer=this._register(new zw),this._altBuffer=this._register(new zw),this._onBufferActivate=this._register(new MS),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 OC(!0,this._optionsService,this._bufferService,this._logService),this._normalBuffer.value=this._normal,this._normal.fillViewportRows(),this._alt=new OC(!1,this._optionsService,this._bufferService,this._logService),this._altBuffer.value=this._alt,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(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),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(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},FC=class extends Aw{constructor(e,t){super(),this.isUserScrolling=!1,this._onResize=this._register(new MS),this.onResize=this._onResize.event,this._onScroll=this._register(new MS),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,2),this.rows=Math.max(e.rawOptions.rows||0,1),this.buffers=this._register(new HC(e,this,t)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,s=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:s})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n,s=this.buffer;n=this._cachedBlankLine,(!n||n.length!==this.cols||n.getFg(0)!==e.fg||n.getBg(0)!==e.bg)&&(n=s.getBlankLine(e,t),this._cachedBlankLine=n),n.isWrapped=t;let i=s.ybase+s.scrollTop,r=s.ybase+s.scrollBottom;if(0===s.scrollTop){let e=s.lines.isFull;r===s.lines.length-1?e?s.lines.recycle().copyFrom(n):s.lines.push(n.clone()):s.lines.splice(r+1,0,n.clone()),e?this.isUserScrolling&&(s.ydisp=Math.max(s.ydisp-1,0)):(s.ybase++,this.isUserScrolling||s.ydisp++)}else{let e=r-i+1;s.lines.shiftElements(i+1,e-1,-1),s.lines.set(r,n.clone())}this.isUserScrolling||(s.ydisp=s.ybase),this._onScroll.fire(s.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(0===n.ydisp)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let s=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),s!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};FC=Ky([qy(0,gw),qy(1,vw)],FC);var WC={cols:80,rows:24,showCursorImmediately:!1,cursorBlink:!1,blinkIntervalDuration:0,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollbar:{showScrollbar:!0},scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,mouseEventsRequireAlt:!1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:pS,windowOptions:{},windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",quirks:{},vtExtensions:{}},UC=["normal","bold","100","200","300","400","500","600","700","800","900"],KC=class extends Aw{constructor(e){super(),this._onOptionChange=this._register(new MS),this.onOptionChange=this._onOptionChange.event;let t={...WC};for(let n in e)if(n in t)try{let s=e[n];t[n]=this._sanitizeAndValidateOption(n,s)}catch(Rk){console.error(Rk)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(Ew(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{-1!==e.indexOf(n)&&t()})}_setupOptions(){let e=e=>{if(!(e in WC))throw new Error(`No option with key "${e}"`);return this.rawOptions[e]},t=(e,t)=>{if(!(e in WC))throw new Error(`No option with key "${e}"`);t=this._sanitizeAndValidateOption(e,t),this.rawOptions[e]!==t&&(this.rawOptions[e]=t,this._onOptionChange.fire(e))};for(let n in this.rawOptions){let s={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,s)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=WC[e]),"block"!==(n=t)&&"underline"!==n&&"bar"!==n)throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=WC[e]);break;case"fontWeight":case"fontWeightBold":if("number"==typeof t&&1<=t&&t<=1e3)break;t=UC.includes(t)?t:WC[e];break;case"blinkIntervalDuration":if((t=Math.floor(t))<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${e} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(10*t)/10));break;case"scrollback":if((t=Math.min(t,4294967295))<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&0!==t)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{}}var n;return t}};var qC=Object.freeze({insertMode:!1}),$C=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,colorSchemeUpdates:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,win32InputMode:!1,wraparound:!0}),VC=class extends Aw{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorHidden=!1,this._onData=this._register(new MS),this.onData=this._onData.event,this._onUserInput=this._register(new MS),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new MS),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new MS),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.isCursorInitialized=n.rawOptions.showCursorImmediately??!1,this.modes=structuredClone(qC),this.decPrivateModes=structuredClone($C),this.kittyKeyboard={flags:0,mainFlags:0,altFlags:0,mainStack:[],altStack:[]}}reset(){this.modes=structuredClone(qC),this.decPrivateModes=structuredClone($C),this.kittyKeyboard={flags:0,mainFlags:0,altFlags:0,mainStack:[],altStack:[]}}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(e=>e.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(e=>e.charCodeAt(0))),this._onBinary.fire(e))}};VC=Ky([qy(0,hw),qy(1,vw),qy(2,gw)],VC);var YC={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>4!==e.button&&1===e.action&&(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>32!==e.action},DRAG:{events:23,restrict:e=>!(32===e.action&&3===e.button)},ANY:{events:31,restrict:e=>!0}};function GC(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return 4===e.button?(n|=64,n|=e.action):(n|=3&e.button,4&e.button&&(n|=64),8&e.button&&(n|=128),32===e.action?n|=32:0===e.action&&!t&&(n|=3)),n}var XC,ZC=String.fromCharCode,JC={DEFAULT:e=>{let t=[GC(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`[M${ZC(t[0])}${ZC(t[1])}${ZC(t[2])}`},SGR:e=>{let t=0===e.action&&4!==e.button?"m":"M";return`[<${GC(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=0===e.action&&4!==e.button?"m":"M";return`[<${GC(e,!0)};${e.x};${e.y}${t}`}},QC=class extends Aw{constructor(){super(),this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._onProtocolChange=this._register(new MS),this.onProtocolChange=this._onProtocolChange.event;for(let e of Object.keys(YC))this.addProtocol(e,YC[e]);for(let e of Object.keys(JC))this.addEncoding(e,JC[e]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return 0!==this._protocols[this._activeProtocol].events}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT"}setCustomWheelEventHandler(e){this._customWheelEventHandler=e}allowCustomWheelEvent(e){return!this._customWheelEventHandler||!1!==this._customWheelEventHandler(e)}restrictMouseEvent(e){return this._protocols[this._activeProtocol].restrict(e)}encodeMouseEvent(e){return this._encodings[this._activeEncoding](e)}get isDefaultEncoding(){return"DEFAULT"===this._activeEncoding}get isPixelEncoding(){return"SGR_PIXELS"===this._activeEncoding}},ej=class e{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new MS,this.onChange=this._onChange.event}static extractShouldJoin(e){return!!(1&e)}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,n=!1){return(16777215&e)<<3|(3&t)<<1|(n?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw new Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e,this._active||(this.activeVersion=e.version)}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(t){let n=0,s=0,i=t.length;for(let r=0;r<i;++r){let o=t.charCodeAt(r);if(55296<=o&&o<=56319){if(++r>=i)return n+this.wcwidth(o);let e=t.charCodeAt(r);56320<=e&&e<=57343?o=1024*(o-55296)+e-56320+65536:n+=this.wcwidth(e)}let a=this.charProperties(o,s),l=e.extractWidth(a);e.extractShouldJoin(a)&&(l-=e.extractWidth(s)),n+=l,s=a}return n}charProperties(e,t){return this._activeProvider.charProperties(e,t)}},tj=[[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]],nj=[[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]];var sj=class{constructor(){if(this.version="6",!XC){(XC=new Uint8Array(65536)).fill(1),XC[0]=0,XC.fill(0,1,32),XC.fill(0,127,160),XC.fill(2,4352,4448),XC[9001]=2,XC[9002]=2,XC.fill(2,11904,42192),XC[12351]=1,XC.fill(2,44032,55204),XC.fill(2,63744,64256),XC.fill(2,65040,65050),XC.fill(2,65072,65136),XC.fill(2,65280,65377),XC.fill(2,65504,65511);for(let e=0;e<tj.length;++e)XC.fill(0,tj[e][0],tj[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?XC[e]:function(e,t){let n,s=0,i=t.length-1;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=s;)if(n=s+i>>1,e>t[n][1])s=n+1;else{if(!(e<t[n][0]))return!0;i=n-1}return!1}(e,nj)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),s=0===n&&0!==t;if(s){let e=ej.extractWidth(t);0===e?s=!1:e>n&&(n=e)}return ej.createPropertyValue(0,n,s)}},ij=class{constructor(){this.glevel=0,this._charsets=[]}get charsets(){return this._charsets}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function rj(e){var t;let n=null==(t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))?void 0:t.get(e.cols-1),s=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);s&&n&&(s.isWrapped=0!==n[3]&&32!==n[3])}var oj=class e{constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new e;if(!t.length)return n;for(let e=Array.isArray(t[0])?1:0;e<t.length;++e){let s=t[e];if(Array.isArray(s))for(let e=0;e<s.length;++e)n.addSubParam(s[e]);else n.addParam(s)}return n}clone(){let t=new e(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let e=[];for(let t=0;t<this.length;++t){e.push(this.params[t]);let n=this._subParamsIdx[t]>>8,s=255&this._subParamsIdx[t];s-n>0&&e.push(Array.prototype.slice.call(this._subParams,n,s))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}resetZdm(){this.length=1,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1,this._subParamsIdx[0]=0,this.params[0]=0}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(e<-1)throw new Error("values less than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>2147483647?2147483647:e}}addSubParam(e){if(this._digitIsSub=!0,this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)return void(this._rejectSubDigits=!0);if(e<-1)throw new Error("values less than -1 are not allowed");this._subParams[this._subParamsLength++]=e>2147483647?2147483647:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(255&this._subParamsIdx[e])-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let t=this._subParamsIdx[e]>>8,n=255&this._subParamsIdx[e];return n-t>0?this._subParams.subarray(t,n):null}getSubParamsAll(){let e={};for(let t=0;t<this.length;++t){let n=this._subParamsIdx[t]>>8,s=255&this._subParamsIdx[t];s-n>0&&(e[t]=this._subParams.slice(n,s))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let n=this._digitIsSub?this._subParams:this.params,s=n[t-1];n[t-1]=~s?Math.min(10*s+e,2147483647):e}},aj=[],lj=class{constructor(){this._state=0,this._active=aj,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){var n;(n=this._handlers)[e]??(n[e]=[]);let s=this._handlers[e];return s.push(t),{dispose:()=>{let e=s.indexOf(t);-1!==e&&s.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=aj}reset(){if(2===this._state)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=aj,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||aj,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].start();else this._handlerFb(this._id,"START")}_put(e,t,n){if(this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,n);else this._handlerFb(this._id,"PUT",nw(e,t,n))}start(){this.reset(),this._state=1}put(e,t,n){if(3!==this._state){if(1===this._state)for(;t<n;){let n=e[t++];if(59===n){this._state=2,this._start();break}if(n<48||57<n)return void(this._state=3);-1===this._id&&(this._id=0),this._id=10*this._id+n-48}2===this._state&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(0!==this._state){if(3!==this._state)if(1===this._state&&this._start(),this._active.length){let n=!1,s=this._active.length-1,i=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&!1===n){for(;s>=0&&(n=this._active[s].end(e),!0!==n);s--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,n;s--}for(;s>=0;s--)if(n=this._active[s].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,n}else this._handlerFb(this._id,"END",e);this._active=aj,this._id=-1,this._state=0}}},cj=class e{constructor(t){this._handler=t,this._data=new CC(e._payloadLimit),this._hitLimit=!1}start(){this._data.reset(),this._hitLimit=!1}put(e,t,n){this._hitLimit||this._data.append(nw(e,t,n))&&(this._hitLimit=!0)}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data.toString()),t instanceof Promise))return t.then(e=>(this._data.reset(),this._hitLimit=!1,e));return this._data.reset(),this._hitLimit=!1,t}};cj._payloadLimit=1e7;var hj=cj,uj=[],dj=class{constructor(){this._handlers=Object.create(null),this._active=uj,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=uj}registerHandler(e,t){var n;(n=this._handlers)[e]??(n[e]=[]);let s=this._handlers[e];return s.push(t),{dispose:()=>{let e=s.indexOf(t);-1!==e&&s.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=uj,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||uj,this._active.length)for(let n=this._active.length-1;n>=0;n--)this._active[n].hook(t);else this._handlerFb(this._ident,"HOOK",t)}put(e,t,n){if(this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,n);else this._handlerFb(this._ident,"PUT",nw(e,t,n))}unhook(e,t=!0){if(this._active.length){let n=!1,s=this._active.length-1,i=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&!1===n){for(;s>=0&&(n=this._active[s].unhook(e),!0!==n);s--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,n;s--}for(;s>=0;s--)if(n=this._active[s].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,n}else this._handlerFb(this._ident,"UNHOOK",e);this._active=uj,this._ident=0}},fj=new oj;fj.addParam(0);var pj=class e{constructor(t){this._handler=t,this._data=new CC(e._payloadLimit),this._params=fj,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():fj,this._data.reset(),this._hitLimit=!1}put(e,t,n){this._hitLimit||this._data.append(nw(e,t,n))&&(this._hitLimit=!0)}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data.toString(),this._params),t instanceof Promise))return t.then(e=>(this._params=fj,this._data.reset(),this._hitLimit=!1,e));return this._params=fj,this._data.reset(),this._hitLimit=!1,t}};pj._payloadLimit=1e7;var vj=pj,gj=[],mj=class{constructor(){this._handlers=Object.create(null),this._active=gj,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){var n;(n=this._handlers)[e]??(n[e]=[]);let s=this._handlers[e];return s.push(t),{dispose:()=>{let e=s.indexOf(t);-1!==e&&s.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=gj}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=gj,this._ident=0}start(e){if(this.reset(),this._ident=e,this._active=this._handlers[e]||gj,this._active.length)for(let t=this._active.length-1;t>=0;t--)this._active[t].start();else this._handlerFb(this._ident,"START")}put(e,t,n){if(this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,n);else this._handlerFb(this._ident,"PUT",nw(e,t,n))}end(e,t=!0){if(this._active.length){let n=!1,s=this._active.length-1,i=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&!1===n){for(;s>=0&&(n=this._active[s].end(e),!0!==n);s--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,n;s--}for(;s>=0;s--)if(n=this._active[s].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,n}else this._handlerFb(this._ident,"END",e);this._active=gj,this._ident=0}},_j=class e{constructor(t){this._handler=t,this._data=new CC(e._payloadLimit),this._hitLimit=!1}start(){this._data.reset(),this._hitLimit=!1}put(e,t,n){this._hitLimit||this._data.append(nw(e,t,n))&&(this._hitLimit=!0)}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data.toString()),t instanceof Promise))return t.then(e=>(this._data.reset(),this._hitLimit=!1,e));return this._data.reset(),this._hitLimit=!1,t}};_j._payloadLimit=1e7;var xj=_j,bj=class{constructor(e){this.table=new Uint16Array(e)}setDefault(e,t){this.table.fill(e<<8|t)}add(e,t,n,s){this.table[t<<8|e]=n<<8|s}addMany(e,t,n,s){for(let i=0;i<e.length;i++)this.table[t<<8|e[i]]=n<<8|s}},yj=160,wj=function(){let e=new bj(4257),t=Array.apply(null,Array(256)).map((e,t)=>t),n=(e,n)=>t.slice(e,n),s=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));let r=n(0,17);e.setDefault(1,0),e.addMany(s,0,2,0);for(let o of r)e.addMany([24,26,153,154],o,3,0),e.addMany(n(128,144),o,3,0),e.addMany(n(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158],o,0,7),e.add(159,o,11,14),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(s,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94],1,0,7),e.addMany(s,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(95,1,11,14),e.addMany(i,14,0,14),e.add(127,14,0,14),e.addMany(n(32,48),14,9,15),e.addMany(n(48,127),14,15,16),e.addMany(n(48,127),15,15,16),e.addMany(i,15,0,15),e.addMany(n(32,48),15,9,15),e.add(127,15,0,15),e.addMany(s,16,16,16),e.addMany(i,16,0,16),e.addMany(n(8,14),16,16,16),e.add(127,16,0,16),e.addMany([27,156,24,26],16,17,0),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(s,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(yj,0,2,0),e.add(yj,8,5,8),e.add(yj,6,0,6),e.add(yj,11,0,11),e.add(yj,13,13,13),e.add(yj,16,16,16),e}(),Sj=class extends Aw{constructor(e=wj){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new oj,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,n)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._executeHandlersArr=new Array(24).fill(void 0),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(Ew(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._executeHandlersArr=new Array(24).fill(void 0),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new lj),this._dcsParser=this._register(new dj),this._apcParser=this._register(new mj),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(n=e.prefix.charCodeAt(0),n<60||n>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let t=0;t<e.intermediates.length;++t){let s=e.intermediates.charCodeAt(t);if(32>s||s>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=s}}if(1!==e.final.length)throw new Error("final must be a single byte");let s=e.final.charCodeAt(0);if(t[0]>s||s>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=s,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(255&e)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){var n;let s=this._identifier(e,[48,126]);(n=this._escHandlers)[s]??(n[s]=[]);let i=this._escHandlers[s];return i.push(t),{dispose:()=>{let e=i.indexOf(t);-1!==e&&i.splice(e,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){let n=e.charCodeAt(0);this._executeHandlers[n]=t,n<24&&(this._executeHandlersArr[n]=t)}clearExecuteHandler(e){let t=e.charCodeAt(0);this._executeHandlers[t]&&delete this._executeHandlers[t],t<24&&(this._executeHandlersArr[t]=void 0)}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){var n;let s=this._identifier(e);(n=this._csiHandlers)[s]??(n[s]=[]);let i=this._csiHandlers[s];return i.push(t),{dispose:()=>{let e=i.indexOf(t);-1!==e&&i.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}registerApcHandler(e,t){return e.prefix=void 0,this._apcParser.registerHandler(this._identifier(e,[48,126]),t)}clearApcHandler(e){e.prefix=void 0,this._apcParser.clearHandler(this._identifier(e,[48,126]))}setApcHandlerFallback(e){this._apcParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._apcParser.reset(),this._params.resetZdm(),this._collect=0,this.precedingJoinState=0,0!==this._parseStack.state&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,s,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=s,this._parseStack.chunkPos=i}parse(e,t,n){let s,i,r,o=0;if(this._parseStack.state)if(2===this._parseStack.state)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(void 0===n||1===this._parseStack.state)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let t=this._parseStack.handlers,i=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(!1===n&&i>-1)for(;i>=0&&(r=t[i](this._params),!0!==r);i--)if(r instanceof Promise)return this._parseStack.handlerPos=i,r;this._parseStack.handlers=[];break;case 4:if(!1===n&&i>-1)for(;i>=0&&(r=t[i](),!0!==r);i--)if(r instanceof Promise)return this._parseStack.handlerPos=i,r;this._parseStack.handlers=[];break;case 6:if(s=e[this._parseStack.chunkPos],r=this._dcsParser.unhook(24!==s&&26!==s,n),r)return r;27===s&&(this._parseStack.transition|=1),this._params.resetZdm(),this._collect=0;break;case 5:if(s=e[this._parseStack.chunkPos],r=this._oscParser.end(24!==s&&26!==s,n),r)return r;27===s&&(this._parseStack.transition|=1),this._params.resetZdm(),this._collect=0;break;case 7:if(s=e[this._parseStack.chunkPos],r=this._apcParser.end(24!==s&&26!==s,n),r)return r;27===s&&(this._parseStack.transition|=1),this._params.resetZdm(),this._collect=0}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=255&this._parseStack.transition}for(let a=o;a<t;++a)if(s=e[a],s<24&&this.currentState<=6)(this._executeHandlersArr[s]??this._executeHandlerFb)(s),this.precedingJoinState=0;else{if(27===s&&this.currentState<8&&a+2<t&&91===e[a+1]){this._params.resetZdm(),this._collect=0;let n=a+2,s=e[n];s>=60&&s<=63&&(this._collect=s,n++);let o=!1;for(;n<t;n++)if(s=e[n],s>=48&&s<=57)this._params.addDigit(s-48);else if(59===s)this._params.addParam(0);else{if(58!==s){if(s>=64&&s<=126){let e=this._csiHandlers[this._collect<<8|s],t=e?e.length-1:-1;for(;t>=0&&(r=e[t](this._params),!0!==r);t--)if(r instanceof Promise)return i=1792,this._preserveStack(3,e,t,i,n),r;t<0&&this._csiHandlerFb(this._collect<<8|s,this._params),this.precedingJoinState=0,a=n,this.currentState=0,o=!0;break}break}this._params.addSubParam(-1)}o||(a=n-1,this.currentState=4);continue}switch(i=this._transitions.table[this.currentState<<8|(s<yj?s:yj)],i>>8){case 2:let n=a,o=t-4;for(;n<o&&e[++n]>=32&&(e[n]<=126||e[n]>=yj)&&e[++n]>=32&&(e[n]<=126||e[n]>=yj)&&e[++n]>=32&&(e[n]<=126||e[n]>=yj)&&e[++n]>=32&&(e[n]<=126||e[n]>=yj););if(n>=o)for(;n<t&&e[n]>=32&&(e[n]<=126||e[n]>=yj);)n++;this._printHandler(e,a,n),a=n-1;break;case 3:this._executeHandlers[s]?this._executeHandlers[s]():this._executeHandlerFb(s),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:a,code:s,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let l=this._csiHandlers[this._collect<<8|s],c=l?l.length-1:-1;for(;c>=0&&(r=l[c](this._params),!0!==r);c--)if(r instanceof Promise)return this._preserveStack(3,l,c,i,a),r;c<0&&this._csiHandlerFb(this._collect<<8|s,this._params),this.precedingJoinState=0;break;case 8:do{switch(s){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(s-48)}}while(++a<t&&(s=e[a])>47&&s<60);a--;break;case 9:this._collect<<=8,this._collect|=s;break;case 10:let h=this._escHandlers[this._collect<<8|s],u=h?h.length-1:-1;for(;u>=0&&(r=h[u](),!0!==r);u--)if(r instanceof Promise)return this._preserveStack(4,h,u,i,a),r;u<0&&this._escHandlerFb(this._collect<<8|s),this.precedingJoinState=0;break;case 11:this._params.resetZdm(),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|s,this._params);break;case 13:for(let i=a+1;;++i)if(i>=t||24===(s=e[i])||26===s||27===s||s>127&&s<yj){this._dcsParser.put(e,a,i),a=i-1;break}break;case 14:if(r=this._dcsParser.unhook(24!==s&&26!==s),r)return this._preserveStack(6,[],0,i,a),r;27===s&&(i|=1),this._params.resetZdm(),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let i=a+1;;i++)if(i>=t||(s=e[i])<32||s>127&&s<yj){this._oscParser.put(e,a,i),a=i-1;break}break;case 6:if(r=this._oscParser.end(24!==s&&26!==s),r)return this._preserveStack(5,[],0,i,a),r;27===s&&(i|=1),this._params.resetZdm(),this._collect=0,this.precedingJoinState=0;break;case 15:this._apcParser.start(this._collect<<8|s);break;case 16:for(let s=a+1;;++s)if(!(s<t&&(e[s]>=32&&e[s]<127||e[s]>=8&&e[s]<14||e[s]>=yj))){this._apcParser.put(e,a,s),a=s-1;break}break;case 17:if(r=this._apcParser.end(24!==s&&26!==s),r)return this._preserveStack(7,[],0,i,a),r;27===s&&(i|=1),this._params.resetZdm(),this._collect=0,this.precedingJoinState=0}this.currentState=255&i}}},kj=/^([\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})$/,Cj=/^[\da-f]+$/;function jj(e){if(!e)return;let t=e.toLowerCase();if(t.startsWith("rgb:")){t=t.slice(4);let e=kj.exec(t);if(e){let t=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/t*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/t*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/t*255)]}}else if(t.startsWith("#")&&(t=t.slice(1),Cj.exec(t)&&[3,6,9,12].includes(t.length))){let e=t.length/3,n=[0,0,0];for(let s=0;s<3;++s){let i=parseInt(t.slice(e*s,e*s+e),16);n[s]=1===e?i<<4:2===e?i:3===e?i>>4:i>>8}return n}}function Nj(e,t){let n=e.toString(16),s=n.length<2?"0"+n:n;switch(t){case 4:return n[0];case 8:return s;case 12:return(s+s).slice(0,3);default:return s+s}}function Mj(e,t=16){let[n,s,i]=e;return`rgb:${Nj(n,t)}/${Nj(s,t)}/${Nj(i,t)}`}var Bj={"(":0,")":1,"*":2,"+":3,"-":1,".":2};function Dj(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var Lj=0,Ej=class extends Aw{constructor(e,t,n,s,i,r,o,a,l=new Sj){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=s,this._optionsService=i,this._oscLinkService=r,this._mouseStateService=o,this._unicodeService=a,this._parser=l,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new sw,this._utf8Decoder=new iw,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=jC.clone(),this._eraseAttrDataInternal=jC.clone(),this._onRequestBell=this._register(new MS),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new MS),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new MS),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new MS),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new MS),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new MS),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new MS),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new MS),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new MS),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new MS),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new MS),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new MS),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new MS),this.onColor=this._onColor.event,this._onRequestColorSchemeQuery=this._register(new MS),this.onRequestColorSchemeQuery=this._onRequestColorSchemeQuery.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 Pj(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,t)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(e),params:t.toArray()})}),this._parser.setEscHandlerFallback(e=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(e)})}),this._parser.setExecuteHandlerFallback(e=>{this._logService.debug("Unknown EXECUTE code: ",{code:e})}),this._parser.setOscHandlerFallback((e,t,n)=>{this._logService.debug("Unknown OSC code: ",{identifier:e,action:t,data:n})}),this._parser.setDcsHandlerFallback((e,t,n)=>{"HOOK"===t&&(n=n.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(e),action:t,payload:n})}),this._parser.setApcHandlerFallback((e,t,n)=>{this._logService.debug("Unknown APC code: ",{identifier:this._parser.identToString(e),action:t,payload:n})}),this._parser.setPrintHandler((e,t,n)=>this.print(e,t,n)),this._parser.registerCsiHandler({final:"@"},e=>this.insertChars(e)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},e=>this.scrollLeft(e)),this._parser.registerCsiHandler({final:"A"},e=>this.cursorUp(e)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},e=>this.scrollRight(e)),this._parser.registerCsiHandler({final:"B"},e=>this.cursorDown(e)),this._parser.registerCsiHandler({final:"C"},e=>this.cursorForward(e)),this._parser.registerCsiHandler({final:"D"},e=>this.cursorBackward(e)),this._parser.registerCsiHandler({final:"E"},e=>this.cursorNextLine(e)),this._parser.registerCsiHandler({final:"F"},e=>this.cursorPrecedingLine(e)),this._parser.registerCsiHandler({final:"G"},e=>this.cursorCharAbsolute(e)),this._parser.registerCsiHandler({final:"H"},e=>this.cursorPosition(e)),this._parser.registerCsiHandler({final:"I"},e=>this.cursorForwardTab(e)),this._parser.registerCsiHandler({final:"J"},e=>this.eraseInDisplay(e,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},e=>this.eraseInDisplay(e,!0)),this._parser.registerCsiHandler({final:"K"},e=>this.eraseInLine(e,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},e=>this.eraseInLine(e,!0)),this._parser.registerCsiHandler({final:"L"},e=>this.insertLines(e)),this._parser.registerCsiHandler({final:"M"},e=>this.deleteLines(e)),this._parser.registerCsiHandler({final:"P"},e=>this.deleteChars(e)),this._parser.registerCsiHandler({final:"S"},e=>this.scrollUp(e)),this._parser.registerCsiHandler({final:"T"},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:"X"},e=>this.eraseChars(e)),this._parser.registerCsiHandler({final:"Z"},e=>this.cursorBackwardTab(e)),this._parser.registerCsiHandler({final:"^"},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:"`"},e=>this.charPosAbsolute(e)),this._parser.registerCsiHandler({final:"a"},e=>this.hPositionRelative(e)),this._parser.registerCsiHandler({final:"b"},e=>this.repeatPrecedingCharacter(e)),this._parser.registerCsiHandler({final:"c"},e=>this.sendDeviceAttributesPrimary(e)),this._parser.registerCsiHandler({prefix:">",final:"c"},e=>this.sendDeviceAttributesSecondary(e)),this._parser.registerCsiHandler({final:"d"},e=>this.linePosAbsolute(e)),this._parser.registerCsiHandler({final:"e"},e=>this.vPositionRelative(e)),this._parser.registerCsiHandler({final:"f"},e=>this.hVPosition(e)),this._parser.registerCsiHandler({final:"g"},e=>this.tabClear(e)),this._parser.registerCsiHandler({final:"h"},e=>this.setMode(e)),this._parser.registerCsiHandler({prefix:"?",final:"h"},e=>this.setModePrivate(e)),this._parser.registerCsiHandler({final:"l"},e=>this.resetMode(e)),this._parser.registerCsiHandler({prefix:"?",final:"l"},e=>this.resetModePrivate(e)),this._parser.registerCsiHandler({final:"m"},e=>this.charAttributes(e)),this._parser.registerCsiHandler({final:"n"},e=>this.deviceStatus(e)),this._parser.registerCsiHandler({prefix:"?",final:"n"},e=>this.deviceStatusPrivate(e)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},e=>this.softReset(e)),this._parser.registerCsiHandler({prefix:">",final:"q"},e=>this.sendXtVersion(e)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},e=>this.setCursorStyle(e)),this._parser.registerCsiHandler({final:"r"},e=>this.setScrollRegion(e)),this._parser.registerCsiHandler({final:"s"},e=>this.saveCursor(e)),this._parser.registerCsiHandler({final:"t"},e=>this.windowOptions(e)),this._parser.registerCsiHandler({final:"u"},e=>this.restoreCursor(e)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},e=>this.insertColumns(e)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},e=>this.deleteColumns(e)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},e=>this.selectProtected(e)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},e=>this.requestMode(e,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},e=>this.requestMode(e,!1)),this._parser.registerCsiHandler({prefix:"=",final:"u"},e=>this.kittyKeyboardSet(e)),this._parser.registerCsiHandler({prefix:"?",final:"u"},e=>this.kittyKeyboardQuery(e)),this._parser.registerCsiHandler({prefix:">",final:"u"},e=>this.kittyKeyboardPush(e)),this._parser.registerCsiHandler({prefix:"<",final:"u"},e=>this.kittyKeyboardPop(e)),this._parser.setExecuteHandler("",()=>this.bell()),this._parser.setExecuteHandler("\n",()=>this.lineFeed()),this._parser.setExecuteHandler("\v",()=>this.lineFeed()),this._parser.setExecuteHandler("\f",()=>this.lineFeed()),this._parser.setExecuteHandler("\r",()=>this.carriageReturn()),this._parser.setExecuteHandler("\b",()=>this.backspace()),this._parser.setExecuteHandler("\t",()=>this.tab()),this._parser.setExecuteHandler("",()=>this.shiftOut()),this._parser.setExecuteHandler("",()=>this.shiftIn()),this._parser.setExecuteHandler("",()=>this.index()),this._parser.setExecuteHandler("
",()=>this.nextLine()),this._parser.setExecuteHandler("",()=>this.tabSet()),this._parser.registerOscHandler(0,new hj(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new hj(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new hj(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new hj(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new hj(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new hj(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new hj(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new hj(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new hj(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new hj(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new hj(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new hj(e=>this.restoreCursorColor(e))),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(let c in zC)this._parser.registerEscHandler({intermediates:"(",final:c},()=>this.selectCharset("("+c)),this._parser.registerEscHandler({intermediates:")",final:c},()=>this.selectCharset(")"+c)),this._parser.registerEscHandler({intermediates:"*",final:c},()=>this.selectCharset("*"+c)),this._parser.registerEscHandler({intermediates:"+",final:c},()=>this.selectCharset("+"+c)),this._parser.registerEscHandler({intermediates:"-",final:c},()=>this.selectCharset("-"+c)),this._parser.registerEscHandler({intermediates:".",final:c},()=>this.selectCharset("."+c)),this._parser.registerEscHandler({intermediates:"/",final:c},()=>this.selectCharset("/"+c));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(e=>(this._logService.error("Parsing error: ",e),e)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new vj((e,t)=>this.requestStatusString(e,t)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,s){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=s}_logSlowResolvingAsync(e){if(this._logService.logLevel<=3){let t,n=new Promise((e,n)=>{t=setTimeout(()=>n("#SLOW_TIMEOUT"),5e3)});Promise.race([e,n]).then(()=>{void 0!==t&&clearTimeout(t)},e=>{if(void 0!==t&&clearTimeout(t),"#SLOW_TIMEOUT"!==e)throw e;console.warn("async parser handler taking longer than 5000 ms")})}}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,s=this._activeBuffer.x,i=this._activeBuffer.y,r=0,o=this._parseStack.paused;if(o){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;s=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>131072&&(r=this._parseStack.position+131072)}if(this._logService.logLevel<=1&&this._logService.debug("parsing data "+("string"==typeof e?` "${e}"`:` "${Array.prototype.map.call(e,e=>String.fromCharCode(e)).join("")}"`)),0===this._logService.logLevel&&this._logService.trace("parsing data (codes)","string"==typeof e?e.split("").map(e=>e.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<131072&&(this._parseBuffer=new Uint32Array(Math.min(e.length,131072))),o||this._dirtyRowTracker.clearRange(),e.length>131072)for(let c=r;c<e.length;c+=131072){let t=c+131072<e.length?c+131072:e.length,r="string"==typeof e?this._stringDecoder.decode(e.substring(c,t),this._parseBuffer):this._utf8Decoder.decode(e.subarray(c,t),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,r))return this._preserveStack(s,i,r,c),this._logSlowResolvingAsync(n),n}else if(!o){let t="string"==typeof e?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,t))return this._preserveStack(s,i,t,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==s||this._activeBuffer.y!==i)&&this._onCursorMove.fire();let a=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),l=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);l<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(l,this._bufferService.rows-1),end:Math.min(a,this._bufferService.rows-1)})}print(e,t,n){let s,i,r=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,a=this._bufferService.cols,l=this._coreService.decPrivateModes.wraparound,c=this._coreService.modes.insertMode,h=this._curAttrData,u=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);if(!u)return;this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&2===u.getWidth(this._activeBuffer.x-1)&&u.setCellFromCodepoint(this._activeBuffer.x-1,0,1,h);let d=this._parser.precedingJoinState;for(let f=t;f<n;++f){if(s=e[f],173===s)continue;if(s<127&&r){let e=r[String.fromCharCode(s)];e&&(s=e.charCodeAt(0))}let t=this._unicodeService.charProperties(s,d);i=ej.extractWidth(t);let n=ej.extractShouldJoin(t),p=n?ej.extractWidth(d):0;d=t,o&&this._onA11yChar.fire(tw(s));let v=this._getCurrentLinkId();if(v&&this._oscLinkService.addLineToLink(v,this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-p>a)if(l){let e=u,t=this._activeBuffer.x-p;if(this._activeBuffer.x=p,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),u=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),!u)return;for(p>0&&u instanceof DC&&u.copyCellsFrom(e,t,0,p,!1);t<a;)e.setCellFromCodepoint(t++,0,1,h)}else if(this._activeBuffer.x=a-1,2===i)continue;if(n&&this._activeBuffer.x){let e=u.getWidth(this._activeBuffer.x-1)?1:2;u.addCodepointToCell(this._activeBuffer.x-e,s,i);for(let t=i-p;--t>=0;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,h);continue}if(c&&(u.insertCells(this._activeBuffer.x,i-p,this._activeBuffer.getNullCell(h)),2===u.getWidth(a-1)&&u.setCellFromCodepoint(a-1,0,1,h)),u.setCellFromCodepoint(this._activeBuffer.x++,s,i,h),i>0)for(;--i;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,h)}this._parser.precedingJoinState=d,this._activeBuffer.x<a&&n-t>0&&0===u.getWidth(this._activeBuffer.x)&&!u.hasContent(this._activeBuffer.x)&&u.setCellFromCodepoint(this._activeBuffer.x,0,1,h),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return"t"!==e.final||e.prefix||e.intermediates?this._parser.registerCsiHandler(e,t):this._parser.registerCsiHandler(e,e=>!Dj(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e))}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new vj(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new hj(t))}registerApcHandler(e,t){return this._parser.registerApcHandler(e,new xj(t))}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 e;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(0===this._activeBuffer.x&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&(null==(e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))?void 0:e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,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(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return 0===t?delete this._activeBuffer.tabs[this._activeBuffer.x]:3===t&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return 1===t&&(this._curAttrData.bg|=536870912),(2===t||0===t)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,s=!1,i=!1){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r&&(r.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),s&&(r.isWrapped=!1))}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){var n;let s;switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:for(s=this._activeBuffer.y,this._dirtyRowTracker.markDirty(s),this._eraseInBufferLine(s++,this._activeBuffer.x,this._bufferService.cols,0===this._activeBuffer.x,t);s<this._bufferService.rows;s++)this._resetBufferLine(s,t);this._dirtyRowTracker.markDirty(s);break;case 1:if(s=this._activeBuffer.y,this._dirtyRowTracker.markDirty(s),this._eraseInBufferLine(s,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols){let e=this._activeBuffer.lines.get(s+1);e&&(e.isWrapped=!1)}for(;s--;)this._resetBufferLine(s,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(s=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,s-1);s--&&!(null==(n=this._activeBuffer.lines.get(this._activeBuffer.ybase+s))?void 0:n.getTrimmedLength()););for(;s>=0;s--)this._bufferService.scroll(this._eraseAttrData())}else{for(s=this._bufferService.rows,this._dirtyRowTracker.markDirty(s-1);s--;)this._resetBufferLine(s,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,0),this._onScroll.fire(0))}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,0===this._activeBuffer.x,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-s+1;for(;t--;)this._activeBuffer.lines.splice(i-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n,s=this._activeBuffer.ybase+this._activeBuffer.y;for(n=this._bufferService.rows-1-this._activeBuffer.scrollBottom,n=this._bufferService.rows-1+this._activeBuffer.ybase-n;t--;)this._activeBuffer.lines.splice(s,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)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(e){let t=e.params[0]||1;for(;t--;)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(jC));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);e.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),e.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);e.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),e.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);e.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),e.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);e.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),e.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,s=ej.extractWidth(t),i=this._activeBuffer.x-s,r=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),o=new Uint32Array(r.length*n),a=0;for(let c=0;c<r.length;){let e=r.codePointAt(c)||0;o[a++]=e,c+=e>65535?2:1}let l=a;for(let c=1;c<n;++c)o.copyWithin(l,0,a),l+=a;return this.print(o,0,l),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent("[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent("[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent("[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent("[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent("[>83;40003;0c")),!0}sendXtVersion(e){return e.params[0]>0||this._coreService.triggerDataEvent("P>|xterm.js(6.1.0-beta.290)\\"),!0}_is(e){return(this._optionsService.rawOptions.termName+"").startsWith(e)}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(e){var t,n,s,i;for(let r=0;r<e.length;r++)switch(e.params[r]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,TC),this._charsetService.setgCharset(1,TC),this._charsetService.setgCharset(2,TC),this._charsetService.setgCharset(3,TC);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:(null==(t=this._optionsService.rawOptions.quirks)?void 0:t.allowSetCursorBlink)&&(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._mouseStateService.activeProtocol="X10";break;case 1e3:this._mouseStateService.activeProtocol="VT200";break;case 1002:this._mouseStateService.activeProtocol="DRAG";break;case 1003:this._mouseStateService.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._mouseStateService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._mouseStateService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:if(null==(n=this._optionsService.rawOptions.vtExtensions)?void 0:n.kittyKeyboard){let e=this._coreService.kittyKeyboard;e.mainFlags=e.flags,e.flags=e.altFlags}this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break;case 2031:((null==(s=this._optionsService.rawOptions.vtExtensions)?void 0:s.colorSchemeQuery)??1)&&(this._coreService.decPrivateModes.colorSchemeUpdates=!0);break;case 9001:(null==(i=this._optionsService.rawOptions.vtExtensions)?void 0:i.win32InputMode)&&(this._coreService.decPrivateModes.win32InputMode=!0)}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(e){var t,n,s,i;for(let r=0;r<e.length;r++)switch(e.params[r]){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:(null==(t=this._optionsService.rawOptions.quirks)?void 0:t.allowSetCursorBlink)&&(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._mouseStateService.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._mouseStateService.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:if(null==(n=this._optionsService.rawOptions.vtExtensions)?void 0:n.kittyKeyboard){let e=this._coreService.kittyKeyboard;e.altFlags=e.flags,e.flags=e.mainFlags}this._bufferService.buffers.activateNormalBuffer(),1049===e.params[r]&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break;case 2031:((null==(s=this._optionsService.rawOptions.vtExtensions)?void 0:s.colorSchemeQuery)??1)&&(this._coreService.decPrivateModes.colorSchemeUpdates=!1);break;case 9001:(null==(i=this._optionsService.rawOptions.vtExtensions)?void 0:i.win32InputMode)&&(this._coreService.decPrivateModes.win32InputMode=!1)}return!0}requestMode(e,t){var n;let s;var i;(i=s||(s={}))[i.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",i[i.SET=1]="SET",i[i.RESET=2]="RESET",i[i.PERMANENTLY_SET=3]="PERMANENTLY_SET",i[i.PERMANENTLY_RESET=4]="PERMANENTLY_RESET";let r=this._coreService.decPrivateModes,{activeProtocol:o,activeEncoding:a}=this._mouseStateService,l=this._coreService,{buffers:c,cols:h}=this._bufferService,{active:u,alt:d}=c,f=this._optionsService.rawOptions,p=(e,n)=>(l.triggerDataEvent(`[${t?"":"?"}${e};${n}$y`),!0),v=e=>e?1:2,g=e.params[0];return t?p(g,2===g?4:4===g?v(l.modes.insertMode):12===g?3:20===g?v(f.convertEol):0):1===g?p(g,v(r.applicationCursorKeys)):3===g?p(g,f.windowOptions.setWinLines?80===h?2:132===h?1:0:0):6===g?p(g,v(r.origin)):7===g?p(g,v(r.wraparound)):8===g?p(g,3):9===g?p(g,v("X10"===o)):12===g?p(g,v(f.cursorBlink)):25===g?p(g,v(!l.isCursorHidden)):45===g?p(g,v(r.reverseWraparound)):66===g?p(g,v(r.applicationKeypad)):67===g?p(g,4):1e3===g?p(g,v("VT200"===o)):1002===g?p(g,v("DRAG"===o)):1003===g?p(g,v("ANY"===o)):1004===g?p(g,v(r.sendFocus)):1005===g?p(g,4):1006===g?p(g,v("SGR"===a)):1015===g?p(g,4):1016===g?p(g,v("SGR_PIXELS"===a)):1048===g?p(g,1):47===g||1047===g||1049===g?p(g,v(u===d)):2004===g?p(g,v(r.bracketedPasteMode)):2026===g?p(g,v(r.synchronizedOutput)):9001===g&&(null==(n=this._optionsService.rawOptions.vtExtensions)?void 0:n.win32InputMode)?p(g,v(r.win32InputMode)):p(g,0)}_updateAttrColor(e,t,n,s,i){return 2===t?(e|=50331648,e&=-16777216,e|=rw.fromColorRGB([n,s,i])):5===t&&(e&=-67108864,e|=33554432|255&n),e}_extractColor(e,t,n){let s=[0,0,-1,0,0,0],i=0,r=0;do{if(s[r+i]=e.params[t+r],e.hasSubParams(t+r)){let n=e.getSubParams(t+r),o=0;do{5===s[1]&&(i=1),s[r+o+1+i]=n[o]}while(++o<n.length&&o+r+1+i<s.length);break}if(5===s[1]&&r+i>=2||2===s[1]&&r+i>=5)break;s[1]&&(i=1)}while(++r+t<e.length&&r+i<s.length);for(let o=2;o<s.length;++o)-1===s[o]&&(s[o]=0);switch(s[0]){case 38:n.fg=this._updateAttrColor(n.fg,s[1],s[3],s[4],s[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,s[1],s[3],s[4],s[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,s[1],s[3],s[4],s[5])}return r}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,0===e&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=jC.fg,e.bg=jC.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){var t,n;if(1===e.length&&0===e.params[0])return this._processSGR0(this._curAttrData),!0;let s,i=e.length,r=this._curAttrData;for(let o=0;o<i;o++)s=e.params[o],s>=30&&s<=37?(r.fg&=-67108864,r.fg|=16777216|s-30):s>=40&&s<=47?(r.bg&=-67108864,r.bg|=16777216|s-40):s>=90&&s<=97?(r.fg&=-67108864,r.fg|=16777224|s-90):s>=100&&s<=107?(r.bg&=-67108864,r.bg|=16777224|s-100):0===s?this._processSGR0(r):1===s?r.fg|=134217728:3===s?r.bg|=67108864:4===s?(r.fg|=268435456,this._processUnderline(e.hasSubParams(o)?e.getSubParams(o)[0]:1,r)):5===s?r.fg|=536870912:7===s?r.fg|=67108864:8===s?r.fg|=1073741824:9===s?r.fg|=2147483648:2===s?r.bg|=134217728:21===s?this._processUnderline(2,r):22===s?(r.fg&=-134217729,r.bg&=-134217729):23===s?r.bg&=-67108865:24===s?(r.fg&=-268435457,this._processUnderline(0,r)):25===s?r.fg&=-536870913:27===s?r.fg&=-67108865:28===s?r.fg&=-1073741825:29===s?r.fg&=2147483647:39===s?(r.fg&=-67108864,r.fg|=16777215&jC.fg):49===s?(r.bg&=-67108864,r.bg|=16777215&jC.bg):38===s||48===s||58===s?o+=this._extractColor(e,o,r):53===s?r.bg|=1073741824:55===s?r.bg&=-1073741825:221===s&&((null==(t=this._optionsService.rawOptions.vtExtensions)?void 0:t.kittySgrBoldFaintControl)??1)?r.fg&=-134217729:222===s&&((null==(n=this._optionsService.rawOptions.vtExtensions)?void 0:n.kittySgrBoldFaintControl)??1)?r.bg&=-134217729:59===s?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):this._logService.debug("Unknown SGR attribute: %d.",s);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent("[0n");break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`[${e};${t}R`)}return!0}deviceStatusPrivate(e){var t;switch(e.params[0]){case 6:let e=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`[?${e};${n}R`);break;case 15:case 25:case 26:case 53:break;case 996:((null==(t=this._optionsService.rawOptions.vtExtensions)?void 0:t.colorSchemeQuery)??1)&&this._onRequestColorSchemeQuery.fire()}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=jC.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(e){let t=0===e.length?1:e.params[0];if(0===t)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar"}let e=t%2==1;this._coreService.decPrivateModes.cursorBlink=e}return!0}setScrollRegion(e){let t,n=e.params[0]||1;return(e.length<2||(t=e.params[1])>this._bufferService.rows||0===t)&&(t=this._bufferService.rows),t>n&&(this._activeBuffer.scrollTop=n-1,this._activeBuffer.scrollBottom=t-1,this._setCursor(0,0)),!0}windowOptions(e){if(!Dj(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:2!==t&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(0===t||2===t)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),(0===t||1===t)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:(0===t||2===t)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(0===t||1===t)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(e){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,this._activeBuffer.savedCharsets=this._charsetService.charsets.slice(),this._activeBuffer.savedGlevel=this._charsetService.glevel,this._activeBuffer.savedOriginMode=this._coreService.decPrivateModes.origin,this._activeBuffer.savedWraparoundMode=this._coreService.decPrivateModes.wraparound,!0}restoreCursor(e){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;for(let t=0;t<this._activeBuffer.savedCharsets.length;t++)this._charsetService.setgCharset(t,this._activeBuffer.savedCharsets[t]);return this._charsetService.setgLevel(this._activeBuffer.savedGlevel),this._coreService.decPrivateModes.origin=this._activeBuffer.savedOriginMode,this._coreService.decPrivateModes.wraparound=this._activeBuffer.savedWraparoundMode,this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(";");for(;n.length>1;){let e=n.shift(),s=n.shift();if(/^\d+$/.exec(e)){let n=parseInt(e,10);if(Rj(n))if("?"===s)t.push({type:0,index:n});else{let e=jj(s);e&&t.push({type:1,index:n,color:e})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(-1===t)return!0;let n=e.slice(0,t).trim(),s=e.slice(t+1);return s?this._createHyperlink(n,s):!n.trim()&&this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n,s=e.split(":"),i=s.findIndex(e=>e.startsWith("id="));return-1!==i&&(n=s[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:n,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(";");for(let s=0;s<n.length&&!(t>=this._specialColors.length);++s,++t)if("?"===n[s])this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let e=jj(n[s]);e&&this._onColor.fire([{type:1,index:this._specialColors[t],color:e}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(";");for(let s=0;s<n.length;++s)if(/^\d+$/.exec(n[s])){let e=parseInt(n[s],10);Rj(e)&&t.push({type:2,index:e})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){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,TC),!0}selectCharset(e){return 2!==e.length?(this.selectDefaultCharset(),!0):("/"===e[0]||this._charsetService.setgCharset(Bj[e[0]],zC[e[1]]??TC),!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){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,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=jC.clone(),this._eraseAttrDataInternal=jC.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new aw;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,s=this._activeBuffer.lines.get(n);s&&(s.fill(e),s.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=this._bufferService.buffer,s=this._optionsService.rawOptions;return(e=>(this._coreService.triggerDataEvent(`${e}\\`),!0))('"q'===e?`P1$r${this._curAttrData.isProtected()?1:0}"q`:'"p'===e?'P1$r61;1"p':"r"===e?`P1$r${n.scrollTop+1};${n.scrollBottom+1}r`:"m"===e?"P1$r0m":" q"===e?`P1$r${{block:2,underline:4,bar:6}[s.cursorStyle]-(s.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}kittyKeyboardSet(e){var t;if(!(null==(t=this._optionsService.rawOptions.vtExtensions)?void 0:t.kittyKeyboard))return!0;let n=e.params[0]||0,s=e.length>1&&e.params[1]||1,i=this._coreService.kittyKeyboard;switch(s){case 1:i.flags=n;break;case 2:i.flags|=n;break;case 3:i.flags&=~n}return!0}kittyKeyboardQuery(e){var t;if(!(null==(t=this._optionsService.rawOptions.vtExtensions)?void 0:t.kittyKeyboard))return!0;let n=this._coreService.kittyKeyboard.flags;return this._coreService.triggerDataEvent(`[?${n}u`),!0}kittyKeyboardPush(e){var t;if(!(null==(t=this._optionsService.rawOptions.vtExtensions)?void 0:t.kittyKeyboard))return!0;let n=e.params[0]||0,s=this._coreService.kittyKeyboard,i=this._bufferService.buffer===this._bufferService.buffers.alt?s.altStack:s.mainStack;return i.length>=16&&i.shift(),i.push(s.flags),s.flags=n,!0}kittyKeyboardPop(e){var t;if(!(null==(t=this._optionsService.rawOptions.vtExtensions)?void 0:t.kittyKeyboard))return!0;let n=Math.max(1,e.params[0]||1),s=this._coreService.kittyKeyboard,i=this._bufferService.buffer===this._bufferService.buffers.alt?s.altStack:s.mainStack;for(let r=0;r<n&&i.length>0;r++)s.flags=i.pop();return 0===i.length&&n>0&&(s.flags=0),!0}},Pj=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(Lj=e,e=t,t=Lj),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function Rj(e){return 0<=e&&e<256}Pj=Ky([qy(0,hw)],Pj);var Aj=class extends Aw{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._innerWriteTimer=this._register(new Tw),this._onWriteParsed=this._register(new MS),this.onWriteParsed=this._onWriteParsed.event,this._register(Ew(()=>{this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0}))}handleUserInput(){this._didUserInput=!0}flushSync(){if(this._store.isDisposed||this._isSyncWriting)return;this._isSyncWriting=!0;let e,t=!1;for(;e=this._writeBuffer.shift();){t=!0,this._action(e);let n=this._callbacks.shift();n&&n()}this._pendingData=0,this._bufferOffset=2147483647,this._writeBuffer.length=0,this._callbacks.length=0,this._isSyncWriting=!1,t&&this._onWriteParsed.fire()}writeSync(e,t){if(this._store.isDisposed)return;if(void 0!==t&&this._syncCalls>t)return void(this._syncCalls=0);if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let n;for(this._isSyncWriting=!0;n=this._writeBuffer.shift();){this._action(n);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(!this._store.isDisposed){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+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),void this._innerWrite();this._scheduleInnerWrite()}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}}_scheduleInnerWrite(e=0,t=!0){this._store.isDisposed||this._innerWriteTimer.cancelAndSet(()=>this._innerWrite(e,t),0)}_innerWrite(e=0,t=!0){if(this._store.isDisposed)return;let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],s=this._action(e,t);if(s){let e=e=>{this._store.isDisposed||(performance.now()-n>=12?this._scheduleInnerWrite(0,e):this._innerWrite(n,e))};return void s.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e)}let i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,performance.now()-n>=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),this._scheduleInnerWrite()):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},zj=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(void 0===e.id){let n=t.addMarker(t.ybase+t.y),s={data:e,id:this._nextId++,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(s,n)),this._dataByLinkId.set(s.id,s),s.id}let n=e,s=this._getEntryIdKey(n),i=this._entriesWithId.get(s);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let r=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[r]};return r.onDispose(()=>this._removeMarkerFromLink(o,r)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(e=>e.line!==t)){let e=this._bufferService.buffer.addMarker(t);n.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(n,e))}}getLinkData(e){var t;return null==(t=this._dataByLinkId.get(e))?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);-1!==n&&(e.lines.splice(n,1),0===e.lines.length&&(void 0!==e.data.id&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};zj=Ky([qy(0,hw)],zj);var Tj=!1,Ij=class extends Aw{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new zw),this._onBinary=this._register(new MS),this.onBinary=this._onBinary.event,this._onData=this._register(new MS),this.onData=this._onData.event,this._onLineFeed=this._register(new MS),this.onLineFeed=this._onLineFeed.event,this._onRender=this._register(new MS),this.onRender=this._onRender.event,this._onResize=this._register(new MS),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new MS),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new MS),this._instantiationService=new bC,this.optionsService=this._register(new KC(e)),this._instantiationService.setService(gw,this.optionsService),this._logService=this._register(this._instantiationService.createInstance(wC)),this._instantiationService.setService(vw,this._logService),this._bufferService=this._register(this._instantiationService.createInstance(FC)),this._instantiationService.setService(hw,this._bufferService),this.coreService=this._register(this._instantiationService.createInstance(VC)),this._instantiationService.setService(dw,this.coreService),this.mouseStateService=this._register(this._instantiationService.createInstance(QC)),this._instantiationService.setService(uw,this.mouseStateService),this.unicodeService=this._register(this._instantiationService.createInstance(ej)),this.unicodeService.register(new sj),this._instantiationService.setService(_w,this.unicodeService),this._charsetService=this._instantiationService.createInstance(ij),this._instantiationService.setService(fw,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(zj),this._instantiationService.setService(mw,this._oscLinkService),this._inputHandler=this._register(new Ej(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.mouseStateService,this.unicodeService)),this._register(bS.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(bS.forward(this._bufferService.onResize,this._onResize)),this._register(bS.forward(this.coreService.onData,this._onData)),this._register(bS.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new Aj((e,t)=>this._inputHandler.parse(e,t))),this._register(bS.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new MS),this._onScroll.event(e=>{var t;null==(t=this._onScrollApi)||t.fire(e.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(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!Tj&&(this._logService.warn("writeSync is unreliable and will be removed soon."),Tj=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,2),t=Math.max(t,1),this._writeBuffer.flushSync(),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;0!==t&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}registerApcHandler(e,t){return this._inputHandler.registerApcHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.mouseStateService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&void 0!==t.backend&&void 0!==t.buildNumber&&(e="conpty"===t.backend&&t.buildNumber<21376),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(rj.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(rj(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Ew(()=>{for(let t of e)t.dispose()})}}},Oj=0,Hj=class{constructor(e,t){this._getKey=e,this._array=[],this._insertedValues=[],this._isFlushingInserted=!1,this._deletedIndices=[],this._isFlushingDeleted=!1,this._flushInsertedTask=new Uk(t),this._flushDeletedTask=new Uk(t)}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),0===this._insertedValues.length&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((e,t)=>this._getKey(e)-this._getKey(t)),t=0,n=0,s=new Array(this._array.length+this._insertedValues.length);for(let i=0;i<s.length;i++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(s[i]=e[t],t++):s[i]=this._array[n++];this._array=s,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),0===this._array.length)return!1;let t=this._getKey(e);if(void 0===t||-1===(Oj=this._search(t))||this._getKey(this._array[Oj])!==t)return!1;do{if(this._array[Oj]===e)return 0===this._deletedIndices.length&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Oj),!0}while(++Oj<this._array.length&&this._getKey(this._array[Oj])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((e,t)=>e-t),t=0,n=new Array(this._array.length-e.length),s=0;for(let i=0;i<this._array.length;i++)e[t]===i?t++:n[s++]=this._array[i];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),0!==this._array.length&&(!((Oj=this._search(e))<0||Oj>=this._array.length)&&this._getKey(this._array[Oj])===e))do{yield this._array[Oj]}while(++Oj<this._array.length&&this._getKey(this._array[Oj])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),0!==this._array.length&&(!((Oj=this._search(e))<0||Oj>=this._array.length)&&this._getKey(this._array[Oj])===e))do{t(this._array[Oj])}while(++Oj<this._array.length&&this._getKey(this._array[Oj])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let s=t+n>>1,i=this._getKey(this._array[s]);if(i>e)n=s-1;else{if(!(i<e)){for(;s>0&&this._getKey(this._array[s-1])===e;)s--;return s}t=s+1}}return t}},Fj=0,Wj=0,Uj=class extends Aw{constructor(e,t){super(),this._logService=e,this._bufferService=t,this._lineCache=this._register(new Kj),this._onDecorationRegistered=this._register(new MS),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new MS),this.onDecorationRemoved=this._onDecorationRemoved.event,this._decorations=new Hj(e=>null==e?void 0:e.marker.line,this._logService),this._register(Ew(()=>this.reset())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._lineCache.attachToBufferLines(this._bufferService.buffer.lines)})),this._lineCache.attachToBufferLines(this._bufferService.buffer.lines)}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new qj(e);if(t){let e=t.marker.onDispose(()=>t.dispose()),n=t.onDispose(()=>{n.dispose(),t&&(this._decorations.delete(t)&&(this._lineCache.remove(t),this._onDecorationRemoved.fire(t)),e.dispose())});this._decorations.insert(t),this._lineCache.add(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear(),this._lineCache.clear()}*getDecorationsAtCell(e,t,n){let s=this._lineCache.getDecorationsOnLine(t);if(s)for(let i of s)Fj=i.options.x??0,Wj=Fj+(i.options.width??1),e>=Fj&&e<Wj&&(!n||(i.options.layer??"bottom")===n)&&(yield i)}forEachDecorationAtCell(e,t,n,s){let i=this._lineCache.getDecorationsOnLine(t);if(i)for(let r of i)Fj=r.options.x??0,Wj=Fj+(r.options.width??1),e>=Fj&&e<Wj&&(!n||(r.options.layer??"bottom")===n)&&s(r)}};Uj=Ky([qy(0,vw),qy(1,hw)],Uj);var Kj=class extends Aw{constructor(){super(...arguments),this._decorationsByLine=new Map,this._decorations=new Set,this._bufferLineListeners=this._register(new zw),this._lineIndexSyncTimer=this._register(new Iw),this._lineIndexSyncCallbacks=[]}clear(){this._lineIndexSyncCallbacks.length=0,this._lineIndexSyncTimer.cancel(),this._decorationsByLine.clear(),this._decorations.clear()}add(e){this._decorations.add(e),this._addToLineBuckets(e)}remove(e){this._decorations.delete(e),this._removeFromLineBuckets(e)}getDecorationsOnLine(e){return this._decorationsByLine.get(e)}attachToBufferLines(e){let t=new Rw;this._bufferLineListeners.value=t,t.add(e.onTrim(e=>this._handleBufferLinesTrim(e))),t.add(e.onInsert(e=>this._handleBufferLinesInsert(e))),t.add(e.onDelete(e=>this._handleBufferLinesDelete(e)))}_getDecorationHeight(e){return e.options.height??1}_addToLineBuckets(e){let t=e.marker.line;if(t<0)return;e._indexedStartLine=t;let n=this._getDecorationHeight(e);for(let s=t;s<t+n;s++){let t=this._decorationsByLine.get(s);t||(t=[],this._decorationsByLine.set(s,t)),t.push(e)}}_removeFromLineBuckets(e){let t=e._indexedStartLine,n=this._getDecorationHeight(e);for(let s=t;s<t+n;s++){let t=this._decorationsByLine.get(s);if(!t)continue;let n=t.indexOf(e);-1!==n&&t.splice(n,1),0===t.length&&this._decorationsByLine.delete(s)}}_reindexDecoration(e){this._removeFromLineBuckets(e),!e.marker.isDisposed&&e.marker.line>=0&&this._addToLineBuckets(e)}_scheduleLineIndexSync(e){this._lineIndexSyncCallbacks.push(e),this._lineIndexSyncTimer.set(()=>{let e=this._lineIndexSyncCallbacks;this._lineIndexSyncCallbacks=[];for(let t of e)t()})}_handleBufferLinesTrim(e){if(e<=0)return;let t=new Map;for(let[n,s]of this._decorationsByLine){let i=n-e;i<0||this._mergeLineBucket(t,i,s)}this._decorationsByLine.clear();for(let[n,s]of t)this._decorationsByLine.set(n,s);for(let n of this._decorations)n.marker.isDisposed||(n._indexedStartLine-=e)}_handleBufferLinesInsert(e){this._scheduleLineIndexSync(()=>this._applyBufferLinesInsert(e))}_handleBufferLinesDelete(e){this._scheduleLineIndexSync(()=>this._applyBufferLinesDelete(e))}_mergeLineBucket(e,t,n){let s=e.get(t);if(s)for(let i=0,r=n.length;i<r;i++)s.push(n[i]);else e.set(t,n.slice())}_applyBufferLinesInsert(e){let{index:t,amount:n}=e,s=[];for(let r of this._decorations){if(r.marker.isDisposed)continue;let e=r._indexedStartLine;e<t&&e+this._getDecorationHeight(r)>t&&(s.push(r),this._removeFromLineBuckets(r))}let i=new Map;for(let[r,o]of this._decorationsByLine){let e=r>=t?r+n:r;this._mergeLineBucket(i,e,o)}this._decorationsByLine.clear();for(let[r,o]of i)this._decorationsByLine.set(r,o);for(let r of this._decorations)r.marker.isDisposed||r._indexedStartLine>=t&&(r._indexedStartLine=r.marker.line);for(let r of s)this._addToLineBuckets(r)}_applyBufferLinesDelete(e){let t=e.index+e.amount,n=new Map;for(let[i,r]of this._decorationsByLine){if(i>=e.index&&i<t)continue;let s=i>=t?i-e.amount:i;this._mergeLineBucket(n,s,r)}this._decorationsByLine.clear();for(let[i,r]of n)this._decorationsByLine.set(i,r);let s=[];for(let i of this._decorations){if(i.marker.isDisposed)continue;let n=i._indexedStartLine,r=this._getDecorationHeight(i);n>=t?i._indexedStartLine=i.marker.line:n<e.index&&n+r>t&&s.push(i)}for(let i of s)this._reindexDecoration(i)}},qj=class extends Rw{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new MS),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new MS),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this._indexedStartLine=e.marker.line,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return null===this._cachedBg&&(this.options.backgroundColor?this._cachedBg=ek.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return null===this._cachedFg&&(this.options.foregroundColor?this._cachedFg=ek.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},$j=class{constructor(e,t=1e3){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&(clearTimeout(this._refreshTimeoutID),this._refreshTimeoutID=void 0),this._additionalRefreshRequested=!1}refresh(e,t,n){this._rowCount=n,e=e??0,t=t??this._rowCount-1,this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,e):e,this._rowEnd=void 0!==this._rowEnd?Math.max(this._rowEnd,t):t;let s=performance.now();if(s-this._lastRefreshMs>=this._debounceThresholdMS)void 0!==this._refreshTimeoutID&&(clearTimeout(this._refreshTimeoutID),this._refreshTimeoutID=void 0,this._additionalRefreshRequested=!1),this._lastRefreshMs=s,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=s-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},t)}}_innerRefresh(){if(void 0===this._rowStart||void 0===this._rowEnd||void 0===this._rowCount)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},Vj=class extends Aw{constructor(e,t,n,s){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=s,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let i=this._coreBrowserService.mainDocument;this._accessibilityContainer=i.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=i.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let r=0;r<this._terminal.rows;r++)this._rowElements[r]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[r]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=i.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new $j(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(e=>this._handleResize(e.rows))),this._register(this._terminal.onRender(e=>this._refreshRows(e.start,e.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(e=>this._handleChar(e))),this._register(this._terminal.onLineFeed(()=>this._handleChar("\n"))),this._register(this._terminal.onA11yTab(e=>this._handleTab(e))),this._register(this._terminal.onKey(e=>this._handleKey(e.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Ww(i,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Ew(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,"\n"===e&&(this._liveRegionLineCount++,21===this._liveRegionLineCount&&(this._liveRegion.textContent=Xy())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,s=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],r=(null==e?void 0:e.translateToString(!0,void 0,void 0,t))||"",o=(n.ydisp+i+1).toString(),a=this._rowElements[i];a&&(0===r.length?(a.textContent=" ",this._rowColumns.set(a,[0,1])):(a.textContent=r,this._rowColumns.set(a,t)),a.setAttribute("aria-posinset",o),a.setAttribute("aria-setsize",s),this._alignRowWidth(a))}this._announceCharacters()}_announceCharacters(){0!==this._charsToAnnounce.length&&(this._liveRegion.textContent===Xy()&&this._clearLiveRegion(),this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let n,s,i=e.target,r=this._rowElements[0===t?1:this._rowElements.length-2];if(i.getAttribute("aria-posinset")!==(0===t?"1":`${this._terminal.buffer.lines.length}`)&&e.relatedTarget===r){if(0===t?(n=i,s=this._rowElements.pop(),this._rowContainer.removeChild(s)):(n=this._rowElements.shift(),s=i,this._rowContainer.removeChild(n)),n.removeEventListener("focus",this._topBoundaryFocusListener),s.removeEventListener("focus",this._bottomBoundaryFocusListener),0===t){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement("afterbegin",e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(0===t?-1:1),this._rowElements[0===t?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}}_handleSelectionChange(){var e;if(0===this._rowElements.length)return;let t=this._coreBrowserService.mainDocument.getSelection();if(!t)return;if(t.isCollapsed)return void(this._rowContainer.contains(t.anchorNode)&&this._terminal.clearSelection());if(!t.anchorNode||!t.focusNode)return void console.error("anchorNode and/or focusNode are null");let n={node:t.anchorNode,offset:t.anchorOffset},s={node:t.focusNode,offset:t.focusOffset};if((n.node.compareDocumentPosition(s.node)&Node.DOCUMENT_POSITION_PRECEDING||n.node===s.node&&n.offset>s.offset)&&([n,s]=[s,n]),n.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(n={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(n.node))return;let i=this._rowElements.slice(-1)[0];if(s.node.compareDocumentPosition(i)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(s={node:i,offset:(null==(e=i.textContent)?void 0:e.length)??0}),!this._rowContainer.contains(s.node))return;let r=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,s=parseInt(null==n?void 0:n.getAttribute("aria-posinset"),10)-1;if(isNaN(s))return console.warn("row is invalid. Race condition?"),null;let i=this._rowColumns.get(n);if(!i)return console.warn("columns is null. Race condition?"),null;let r=t<i.length?i[t]:i.slice(-1)[0]+1;return r>=this._terminal.cols&&(++s,r=0),{row:s,column:r}},o=r(n),a=r(s);if(o&&a){if(o.row>a.row||o.row===a.row&&o.column>=a.column)throw new Error("invalid range");this._terminal.select(o.column,o.row,(a.row-o.row)*this._terminal.cols-o.column+a.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){var t,n;e.style.transform="";let s=e.getBoundingClientRect().width,i=null==(n=null==(t=this._rowColumns.get(e))?void 0:t.slice(-1))?void 0:n[0];if(!i)return;let r=i*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/s})`}};Vj=Ky([qy(1,pw),qy(2,Sw),qy(3,jw)],Vj);var Yj=class extends Aw{constructor(e,t,n,s,i){super(),this._element=e,this._mouseCoordsService=t,this._renderService=n,this._bufferService=s,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new MS),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new MS),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Ew(()=>{var e;Pw(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,null==(e=this._activeProviderReplies)||e.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Ww(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Ww(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Ww(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Ww(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let s=0;s<n.length;s++){let e=n[s];if(e.classList.contains("xterm"))break;if(e.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(e,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){var n,s;(!this._activeProviderReplies||!t)&&(null==(n=this._activeProviderReplies)||n.forEach(e=>{null==e||e.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let i=!1;for(let[r,o]of this._linkProviderService.linkProviders.entries())t?(null==(s=this._activeProviderReplies)?void 0:s.get(r))&&(i=this._checkLinkProviderResult(r,e,i)):o.provideLinks(e.y,t=>{var n,s;if(this._isMouseOut)return;let o=null==t?void 0:t.map(e=>({link:e}));null==(n=this._activeProviderReplies)||n.set(r,o),i=this._checkLinkProviderResult(r,e,i),(null==(s=this._activeProviderReplies)?void 0:s.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let s=0;s<t.size;s++){let i=t.get(s);if(i)for(let t=0;t<i.length;t++){let s=i[t],r=s.link.range.start.y<e?0:s.link.range.start.x,o=s.link.range.end.y>e?this._bufferService.cols:s.link.range.end.x;for(let e=r;e<=o;e++){if(n.has(e)){i.splice(t--,1);break}n.add(e)}}}}_checkLinkProviderResult(e,t,n){var s;if(!this._activeProviderReplies)return n;let i=this._activeProviderReplies.get(e),r=!1;for(let o=0;o<e;o++)(!this._activeProviderReplies.has(o)||this._activeProviderReplies.get(o))&&(r=!0);if(!r&&i){let e=i.find(e=>this._linkAtPosition(e.link,t));e&&(n=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let o=0;o<this._activeProviderReplies.size;o++){let e=null==(s=this._activeProviderReplies.get(o))?void 0:s.find(e=>this._linkAtPosition(e.link,t));if(e){n=!0,this._handleNewLink(e);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element);var n,s;t&&this._mouseDownLink&&(n=this._mouseDownLink.link,s=this._currentLink.link,n.text===s.text&&n.range.start.x===s.range.start.x&&n.range.start.y===s.range.start.y&&n.range.end.x===s.range.end.x&&n.range.end.y===s.range.end.y)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,Pw(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:void 0===e.link.decorations||e.link.decorations.underline,pointerCursor:void 0===e.link.decorations||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var e,t;return null==(t=null==(e=this._currentLink)?void 0:e.state)?void 0:t.decorations.pointerCursor},set:e=>{var t;(null==(t=this._currentLink)?void 0:t.state)&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",e))}},underline:{get:()=>{var e,t;return null==(t=null==(e=this._currentLink)?void 0:e.state)?void 0:t.decorations.underline},set:t=>{var n,s,i;(null==(n=this._currentLink)?void 0:n.state)&&(null==(i=null==(s=this._currentLink)?void 0:s.state)?void 0:i.decorations.underline)!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e=>{if(!this._currentLink)return;let t=0===e.start?0:e.start+1+this._bufferService.buffer.ydisp,n=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=n&&(this._clearCurrentLink(t,n),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element);e&&this._askForLink(e,!1)}})))}_linkHover(e,t,n){var s;(null==(s=this._currentLink)?void 0:s.state)&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,s=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-s-1,n.end.x,n.end.y-s-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){var s;(null==(s=this._currentLink)?void 0:s.state)&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,s=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=s}_positionFromMouseEvent(e,t){let n=this._mouseCoordsService.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(n)return{x:n[0],y:n[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,s,i){return{x1:e,y1:t,x2:n,y2:s,cols:this._bufferService.cols,fg:i}}};Yj=Ky([qy(1,kw),qy(2,jw),qy(3,hw),qy(4,Dw)],Yj);var Gj=class extends Ij{constructor(e={}){super(e),this._linkifier=this._register(new zw),this.browser=iS,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new zw),this._onCursorMove=this._register(new MS),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new MS),this.onKey=this._onKey.event,this._onSelectionChange=this._register(new MS),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new MS),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new MS),this.onBell=this._onBell.event,this._onFocus=this._register(new MS),this._onBlur=this._register(new MS),this._onA11yCharEmitter=this._register(new MS),this._onA11yTabEmitter=this._register(new MS),this._onWillOpen=this._register(new MS),this._onDimensionsChange=this._register(new MS),this.onDimensionsChange=this._onDimensionsChange.event,this._setup(),this._decorationService=this._instantiationService.createInstance(Uj),this._instantiationService.setService(xw,this._decorationService),this._keyboardService=this._instantiationService.createInstance(_C),this._instantiationService.setService(Lw,this._keyboardService),this._linkProviderService=this._instantiationService.createInstance(Nk),this._instantiationService.setService(Dw,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(bw)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(e=>this.refresh((null==e?void 0:e.start)??0,(null==e?void 0:e.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(e=>this._reportWindowsOptions(e))),this._register(this._inputHandler.onColor(e=>this._handleColorEvent(e))),this._register(bS.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(bS.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(bS.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(bS.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(Ew(()=>{var e,t;this._customKeyEventHandler=void 0,null==(t=null==(e=this.element)?void 0:e.parentNode)||t.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}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}get dimensions(){if(!this._renderService)return;let e=this._renderService.dimensions;return{css:{canvas:{...e.css.canvas},cell:{...e.css.cell}},device:{canvas:{...e.device.canvas},cell:{...e.device.cell},char:{...e.device.char}}}}_handleColorEvent(e){if(this._themeService)for(let t of e){let e,n;switch(t.index){case 256:e="foreground",n="10";break;case 257:e="background",n="11";break;case 258:e="cursor",n="12";break;default:e="ansi",n="4;"+t.index}switch(t.type){case 0:let s=QS.toColorRGB("ansi"===e?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`]${n};${Mj(s)}\\`);break;case 1:if("ansi"===e)this._themeService.modifyColors(e=>e.ansi[t.index]=ZS.toColor(...t.color));else{let n=e;this._themeService.modifyColors(e=>e[n]=ZS.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index)}}}_reportColorScheme(){if(!this._themeService)return;let e=tk.relativeLuminance(this._themeService.colors.background.rgba>>8)<tk.relativeLuminance(this._themeService.colors.foreground.rgba>>8)?1:2;this.coreService.triggerDataEvent(`[?997;${e}n`)}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Vj,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent("[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return null==(e=this.textarea)?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent("[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),s=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),r=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,a=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=a+"px",this.textarea.style.top=o+"px",this.textarea.style.width=r+"px",this.textarea.style.height=s+"px",this.textarea.style.lineHeight=s+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Ww(this.element,"copy",e=>{var t,n;this.hasSelection()&&(t=e,n=this._selectionService,t.clipboardData&&t.clipboardData.setData("text/plain",n.selectionText),t.preventDefault())}));let e=e=>function(e,t,n,s){e.stopPropagation(),e.clipboardData&&Jy(e.clipboardData.getData("text/plain"),t,n,s)}(e,this.textarea,this.coreService,this.optionsService);this._register(Ww(this.textarea,"paste",e)),this._register(Ww(this.element,"paste",e)),lS?this._register(Ww(this.element,"mousedown",e=>{2===e.button&&ew(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Ww(this.element,"contextmenu",e=>{ew(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),gS&&this._register(Ww(this.element,"auxclick",e=>{1===e.button&&Qy(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Ww(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Ww(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Ww(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Ww(this.textarea,"compositionstart",()=>{this._syncTextArea(),this._compositionHelper.compositionstart(),this._compositionHelper.updateCompositionElements()})),this._register(Ww(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Ww(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Ww(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var t,n,s;if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),(null==(t=this.element)?void 0:t.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=e.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"),this.element.classList.toggle("allow-transparency",this.options.allowTransparency),this._register(this.optionsService.onSpecificOptionChange("allowTransparency",e=>this.element.classList.toggle("allow-transparency",e))),e.appendChild(this.element);let i=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),i.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(Ww(this.screenElement,"mousemove",e=>this.updateCursorStyle(e))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),i.appendChild(this.screenElement);let r=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",Vy()),mS||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._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>r.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(Ck,this.textarea,e.ownerDocument.defaultView??window,this._document??(typeof window<"u"?window.document:null))),this._instantiationService.setService(Sw,this._coreBrowserService),this._register(Ww(this.textarea,"focus",e=>this._handleTextAreaFocus(e))),this._register(Ww(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(yk,this._document,this._helperContainer),this._instantiationService.setService(ww,this._charSizeService),this._themeService=this._instantiationService.createInstance(fC),this._instantiationService.setService(Bw,this._themeService),this._register(this._inputHandler.onRequestColorSchemeQuery(()=>this._reportColorScheme())),this._register(this._themeService.onChangeColors(()=>{this.coreService.decPrivateModes.colorSchemeUpdates&&this._reportColorScheme()})),this._characterJoinerService=this._instantiationService.createInstance(uk),this._instantiationService.setService(Mw,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(qk,this.rows,this.screenElement)),this._instantiationService.setService(jw,this._renderService),this._register(this._renderService.onRenderedViewportChange(e=>this._onRender.fire(e))),this._register(this._renderService.onDimensionsChange(e=>this._onDimensionsChange.fire({css:{canvas:{...e.css.canvas},cell:{...e.css.cell}},device:{canvas:{...e.device.canvas},cell:{...e.device.cell},char:{...e.device.char}}}))),this.onResize(e=>this._renderService.resize(e.cols,e.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(XS,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseCoordsService=this._instantiationService.createInstance(Bk),this._instantiationService.setService(kw,this._mouseCoordsService);let o=this._linkifier.value=this._register(this._instantiationService.createInstance(Yj,this.screenElement));this.element.appendChild(i);try{this._onWillOpen.fire(this.element)}catch(c){this._logService.error("onWillOpen handler threw an exception",c)}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>{this._renderService.handleResize(this.cols,this.rows),this._syncTextArea()})),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(US,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(e=>{super.scrollLines(e,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(sC,this.element,this.screenElement,o)),this._instantiationService.setService(Nw,this._selectionService),this._mouseService=this._instantiationService.createInstance(Ok),this._instantiationService.setService(Cw,this._mouseService),this._register(this._selectionService.onRequestScrollLines(e=>this.scrollLines(e.amount,e.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()})),this._register(bS.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var e;this._selectionService.refresh(),null==(e=this._viewport)||e.queueSync()})),this._register(this._instantiationService.createInstance(KS,this.screenElement)),this._register(Ww(this.element,"mousedown",e=>this._selectionService.handleMouseDown(e))),this.mouseStateService.areMouseEventsActive&&!this.options.mouseEventsRequireAlt?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):(this._selectionService.enable(),this.element.classList.remove("enable-mouse-events")),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(Vj,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",e=>this._handleScreenReaderModeOptionChange(e)));let a=(null==(n=this.options.scrollbar)?void 0:n.showScrollbar)??!0,l=null==(s=this.options.scrollbar)?void 0:s.width;a&&l&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(GS,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("scrollbar",e=>{let t=((null==e?void 0:e.showScrollbar)??!0)&&!!(null==e?void 0:e.width);!this._overviewRulerRenderer&&t&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(GS,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this._mouseService.bindMouse({element:this.element,screenElement:this.screenElement,document:this._document,handleTouchScroll:e=>{var t;return null==(t=this._viewport)?void 0:t.handleTouchScroll(e)}},e=>this._register(e),()=>this.focus())}_createRenderer(){return this._instantiationService.createInstance(xk,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}refresh(e,t,n=!1){var s;null==(s=this._renderService)||s.refreshRows(e,t,n)}updateCursorStyle(e){var t;(null==(t=this._selectionService)?void 0:t.shouldColumnSelect(e))?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(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;0!==t&&this.scrollLines(t)}paste(e){Jy(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this.mouseStateService.setCustomWheelEventHandler(e)}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(e,t,n){this._selectionService.setSelection(e,t,n)}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 e;null==(e=this._selectionService)||e.clearSelection()}selectAll(){var e;null==(e=this._selectionService)||e.selectAll()}selectLines(e,t){var n;null==(n=this._selectionService)||n.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&("Dead"===e.key||"AltGraph"===e.key)&&(this._unprocessedDeadKey=!0);let n=this._keyboardService.evaluateKeyDown(e);if(this.updateCursorStyle(e),3===n.type||2===n.type){let t=this.rows-1;return this.scrollLines(2===n.type?-t:t),e.preventDefault(),e.stopPropagation(),!1}if(1===n.type&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&(e.preventDefault(),e.stopPropagation()),!n.key)||!this._keyboardService.useKitty&&!this._keyboardService.useWin32InputMode&&e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&1===e.key.length&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;(""===n.key||"\r"===n.key)&&(this.textarea.value="");let s=this._keyboardService.useWin32InputMode&&Xj(e);if(this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!s),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return e.preventDefault(),e.stopPropagation(),!1;this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return"keypress"===t.type?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){if(this._keyDownSeen=!1,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return;Xj(e)||this.focus();let t=this._keyboardService.evaluateKeyUp(e);if(null==t?void 0:t.key){let n=this._keyboardService.useWin32InputMode&&Xj(e);this.coreService.triggerDataEvent(t.key,!n)}this.updateCursorStyle(e),this._keyPressHandled=!1}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;if(e.charCode)t=e.charCode;else if(null===e.which||void 0===e.which)t=e.keyCode;else{if(0===e.which||0===e.charCode)return!1;t=e.which}return!(!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e))&&(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&"insertText"===e.inputType&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),!0}return!1}resize(e,t){e!==this.cols||t!==this.rows?super.resize(e,t):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(e,t){var n;null==(n=this._charSizeService)||n.measure()}clear(){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 e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(jC));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}reset(){var e,t;this.options.rows=this.rows,this.options.cols=this.cols;let n=this._customKeyEventHandler;this._setup(),super.reset(),null==(e=this._mouseService)||e.reset(),null==(t=this._selectionService)||t.reset(),this._decorationService.reset(),this._customKeyEventHandler=n,this.refresh(0,this.rows-1,!0)}clearTextureAtlas(){var e;null==(e=this._renderService)||e.clearTextureAtlas()}_reportFocus(){var e;(null==(e=this.element)?void 0:e.classList.contains("focus"))?this.coreService.triggerDataEvent("[I"):this.coreService.triggerDataEvent("[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`[4;${t};${e}t`);break;case 1:let n=this._renderService.dimensions.css.cell.width.toFixed(0),s=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`[6;${s};${n}t`)}}};function Xj(e){return 16===e.keyCode||17===e.keyCode||18===e.keyCode||91===e.keyCode||92===e.keyCode||93===e.keyCode||224===e.keyCode||"Meta"===e.key}var Zj=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(-1===t)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},Jj=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new aw)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},Qj=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,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(e){let t=this._buffer.lines.get(e);if(t)return new Jj(t)}getNullCell(){return new aw}},eN=class extends Aw{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new MS),this.onBufferChange=this._onBufferChange.event,this._normal=new Qj(this._core.buffers.normal,"normal"),this._alternate=new Qj(this._core.buffers.alt,"alternate"),this._register(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)}},tN=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,e=>t(e.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(e,n)=>t(e,n.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}registerApcHandler(e,t){return this._core.registerApcHandler(e,t)}},nN=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},sN=["cols","rows"],iN=0,rN=class extends Aw{constructor(e){super(),this._core=this._register(new Gj(e)),this._addonManager=this._register(new Zj),this._publicOptions={...this._core.options};let t=e=>this._core.options[e],n=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(let s in this._core.options){let e={get:t.bind(this,s),set:n.bind(this,s)};Object.defineProperty(this._publicOptions,s,e)}}_checkReadonlyOptions(e){if(sN.includes(e))throw new Error(`Option "${e}" 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 onDimensionsChange(){return this._core.onDimensionsChange}get element(){return this._core.element}get screenElement(){return this._core.screenElement}get parser(){return this._parser??(this._parser=new tN(this._core))}get unicode(){return this._checkProposedApi(),new nN(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 eN(this._core)))}get markers(){return this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.mouseStateService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any"}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,showCursor:!this._core.coreService.isCursorHidden,synchronizedOutputMode:e.synchronizedOutput,win32InputMode:e.win32InputMode,wraparoundMode:e.wraparound}}get dimensions(){return this._core.dimensions}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write("\r\n",t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return Vy()},set promptLabel(e){Yy(e)},get tooMuchOutput(){return Xy()},set tooMuchOutput(e){Zy(e)}}}_verifyIntegers(...e){for(iN of e)if(iN===1/0||isNaN(iN)||iN%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(iN of e)if(iN&&(iN===1/0||isNaN(iN)||iN%1!=0||iN<0))throw new Error("This API only accepts positive integers")}};function oN({id:e,kind:t,theme:n,active:s,transport:i,register:r}){var o;const a=bn.useRef(null),l=bn.useRef(null),c=bn.useRef(null),[h,u]=bn.useState(null),d=bn.useCallback(()=>{var e;const t=null==(e=l.current)?void 0:e.getSelection();t&&navigator.clipboard.writeText(t).catch(()=>{})},[]),f=bn.useCallback(()=>{const e=l.current;e&&navigator.clipboard.readText().then(t=>{t&&e.paste(t)}).catch(()=>{})},[]);bn.useEffect(()=>{const s=a.current;if(!s)return;const o=new rN({fontFamily:'"JetBrains Mono", ui-monospace, SFMono-Regular, monospace',fontSize:12.5,lineHeight:1.25,cursorBlink:!0,scrollback:5e3,theme:Hy(n),vtExtensions:{kittyKeyboard:!0}}),h=new Fy;o.loadAddon(h),o.open(s);try{h.fit()}catch{}l.current=o,c.current=h,r(o),i.spawn(e,t,o.cols,o.rows);const p=i.subscribe(e,e=>{if("output"===e.type)o.write(e.data);else if("error"===e.type)o.write(`\r\n[31m${e.message}[0m\r\n`);else if("exit"===e.type){const t=null===e.exitCode?"":` (${e.exitCode})`;o.write(`\r\n[2m[process exited${t}][0m\r\n`)}}),v=o.onData(t=>i.sendData(e,t)),g=/Mac|iPhone|iPad/i.test(navigator.platform||navigator.userAgent);o.attachCustomKeyEventHandler(e=>{if("keydown"!==e.type)return!0;const t=e.key.toLowerCase();return g&&e.metaKey&&!e.ctrlKey&&!e.altKey?"v"===t?(f(),!1):"c"!==t||!o.hasSelection()||(d(),!1):!(!g&&e.ctrlKey&&!e.metaKey&&!e.altKey)||("v"===t?(f(),!1):"c"!==t||!e.shiftKey&&!o.hasSelection()||(d(),!1))});const m=e=>{e.preventDefault(),u({x:e.clientX,y:e.clientY})};s.addEventListener("contextmenu",m);const _=o.onResize(({cols:t,rows:n})=>i.resize(e,t,n));let x;const b=new ResizeObserver(()=>{void 0!==x&&window.clearTimeout(x),x=window.setTimeout(()=>{x=void 0,(()=>{const e=a.current;if(e&&0!==e.offsetWidth&&0!==e.offsetHeight)try{h.fit()}catch{}})()},120)});return b.observe(s),()=>{void 0!==x&&window.clearTimeout(x),b.disconnect(),s.removeEventListener("contextmenu",m),v.dispose(),_.dispose(),p(),i.close(e),r(null),o.dispose()}},[]),bn.useEffect(()=>{l.current&&(l.current.options.theme=Hy(n))},[n]),bn.useEffect(()=>{if(!s)return;const e=requestAnimationFrame(()=>{var e,t;try{null==(e=c.current)||e.fit(),null==(t=l.current)||t.focus()}catch{}});return()=>cancelAnimationFrame(e)},[s]);const p=[{kind:"item",icon:"copy",label:"Copy",disabled:!(null==(o=l.current)?void 0:o.hasSelection()),onSelect:d},{kind:"item",label:"Paste",onSelect:f},{kind:"separator"},{kind:"item",label:"Select all",onSelect:()=>{var e;return null==(e=l.current)?void 0:e.selectAll()}},{kind:"item",label:"Clear",onSelect:()=>{var e;return null==(e=l.current)?void 0:e.clear()}}];return Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("div",{ref:a,className:"h-full w-full"}),h&&Bn.jsx(zy,{x:h.x,y:h.y,onClose:()=>u(null),items:p})]})}const aN=["local","claude","codex"],lN=w_(function(){const e=j_(),t=e.terminal,n=e.theme.theme,s=bn.useRef(new Map),i=bn.useCallback((e,t)=>{t?s.current.set(e,t):s.current.delete(e)},[]),[r,o]=bn.useState(null),a=Ry({value:t.height,onChange:e=>t.setHeight(e),axis:"y",dir:-1,min:t.heightMin,max:()=>t.heightMax}),l=t.activeKind?Oy[t.activeKind]:null,c=[{kind:"header",label:"New session"},...aN.map(e=>({kind:"item",icon:Oy[e].icon,label:Oy[e].label,onSelect:()=>t.newTerm(e)}))],h=[{kind:"item",icon:"refresh",label:"Clear buffer",disabled:!t.activeId,onSelect:()=>{var e;t.activeId&&(null==(e=s.current.get(t.activeId))||e.clear())}},{kind:"separator"},{kind:"item",icon:"x",label:"Close session",tone:"danger",disabled:!t.activeId,onSelect:()=>{t.activeId&&t.closeTerm(t.activeId)}}];return Bn.jsxs("div",{className:_y("relative shrink-0",t.open?"flex":"hidden"),style:{height:t.height},children:[Bn.jsx(Ty,{axis:"y",onPointerDown:a,className:"-top-[6px]"}),Bn.jsxs("div",{className:"uno-island flex min-h-0 flex-1 flex-col",children:[Bn.jsxs("div",{className:"flex h-9 shrink-0 items-stretch gap-1 border-b border-edge bg-panel pl-3 pr-1",children:[Bn.jsx("div",{className:"flex items-center pr-1 text-[12px] font-semibold text-fg-3",children:"Terminal"}),Bn.jsxs("div",{className:"uno-thin-scroll flex min-w-0 flex-1 items-stretch gap-1 overflow-x-auto py-1",children:[t.tabs.map(e=>{const n=Oy[e.kind],s=e.id===t.activeId;return Bn.jsx(Iy,{label:n.label,active:s,closeLabel:`Close ${n.label} session`,onActivate:()=>t.activate(e.id),onClose:()=>t.closeTerm(e.id),leading:Bn.jsx(by,{name:n.icon,className:_y("h-3.5 w-3.5 shrink-0",s?"":n.tint)})},e.id)}),Bn.jsxs("div",{className:"flex shrink-0 items-center self-center",children:[Bn.jsx("button",{type:"button",onClick:()=>t.newTerm("local"),title:"New Local terminal",className:"grid h-7 w-7 place-items-center rounded-md text-fg-3 hover:bg-raised hover:text-fg",children:Bn.jsx(by,{name:"plus",className:"h-4 w-4"})}),Bn.jsx("button",{type:"button",onClick:e=>{const t=e.currentTarget.getBoundingClientRect();o({x:t.left,y:t.bottom+4,mode:"new"})},title:"New session…",className:"grid h-7 w-5 place-items-center rounded-md text-fg-4 hover:bg-raised hover:text-fg-2",children:Bn.jsx(by,{name:"chevronD",className:"h-3.5 w-3.5"})})]})]}),Bn.jsxs("div",{className:"flex items-center gap-0.5 self-center",children:[l&&Bn.jsxs("button",{type:"button",onClick:e=>{const t=e.currentTarget.getBoundingClientRect();o({x:Math.max(6,t.right-208),y:t.bottom+4,mode:"new"})},className:"flex h-7 items-center gap-1.5 rounded-md px-2 text-fg-3 hover:bg-raised hover:text-fg",title:"Start a new session",children:[Bn.jsx(by,{name:l.icon,className:_y("h-3.5 w-3.5",l.tint)}),Bn.jsx("span",{className:"font-mono text-[11.5px]",children:l.label}),Bn.jsx(by,{name:"chevronD",className:"h-3.5 w-3.5 opacity-60"})]}),Bn.jsx("button",{type:"button",onClick:e=>{const t=e.currentTarget.getBoundingClientRect();o({x:Math.max(6,t.right-208),y:t.bottom+4,mode:"more"})},title:"More",className:"grid h-7 w-7 place-items-center rounded-md text-fg-3 hover:bg-raised hover:text-fg",children:Bn.jsx(by,{name:"more",className:"h-4 w-4"})}),Bn.jsx("button",{type:"button",onClick:()=>t.hide(),title:"Hide terminal (⌃`)",className:"grid h-7 w-7 place-items-center rounded-md text-fg-3 hover:bg-raised hover:text-fg",children:Bn.jsx(by,{name:"minus",className:"h-4 w-4"})})]})]}),Bn.jsxs("div",{className:"relative min-h-0 flex-1 overflow-hidden bg-canvas px-2 pt-1",children:[0===t.tabs.length&&Bn.jsx("div",{className:"flex h-full items-center justify-center font-mono text-[11.5px] text-fg-4",children:"no sessions · click + to start one"}),t.tabs.map(s=>Bn.jsx("div",{className:_y("absolute inset-0 px-2 pt-1",s.id===t.activeId?"block":"hidden"),children:Bn.jsx(oN,{id:s.id,kind:s.kind,theme:n,active:t.open&&s.id===t.activeId,transport:e.terminalTransport,register:e=>i(s.id,e)})},s.id))]})]}),r&&Bn.jsx(zy,{x:r.x,y:r.y,onClose:()=>o(null),items:"new"===r.mode?c:h})]})}),cN=w_(function(){return j_().session.capabilities.canTerminal?Bn.jsx(lN,{}):null});function hN({id:e}){return Bn.jsx("div",{className:"grid h-full place-items-center px-6",children:Bn.jsxs("div",{className:"text-center",children:[Bn.jsx(by,{name:"alert",className:"mx-auto h-5 w-5 text-fg-4"}),Bn.jsxs("div",{className:"mt-2 font-mono text-[12.5px] text-fg-3",children:["not found: ",e]})]})})}const uN={neutral:"border-edge-soft bg-raised text-fg-3",pass:"border-pass/30 bg-pass/10 text-pass",fail:"border-fail/30 bg-fail/10 text-fail",run:"border-warn/30 bg-warn/10 text-warn",warn:"border-warn/30 bg-warn/10 text-warn",info:"border-accent/30 bg-accent/10 text-accent",purple:"border-accent/30 bg-accent/10 text-accent"};function dN({children:e,tone:t="neutral",size:n="sm"}){return Bn.jsx("span",{className:_y("inline-flex items-center gap-1 rounded border font-mono font-medium uppercase tracking-wider","xs"===n?"h-[14px] px-1 text-[9.5px]":"h-5 px-1.5 text-[10.5px]",uN[t]),children:e})}const fN={passed:"bg-pass",failed:"bg-fail",running:"bg-warn",paused:"bg-warn",pending:"bg-fg-4",aborted:"bg-fg-4",expected:"bg-expected",never:"border border-fg-4"},pN={passed:"ring-pass/15",failed:"ring-fail/15",running:"ring-warn/15",paused:"ring-warn/25",pending:"ring-fg-4/10",aborted:"ring-fg-4/10",expected:"ring-expected/15",never:"ring-transparent"};function vN({status:e,large:t=!1,pulse:n=!0}){const s=t?"h-2.5 w-2.5":"h-2 w-2";return Bn.jsx("span",{className:_y("inline-block shrink-0 rounded-full ring-2",s,fN[e],"running"===e&&n&&"uno-pulse",pN[e])})}function gN(e){return null==e?"—":e<1e3?`${e}ms`:e<6e4?`${(e/1e3).toFixed(2)}s`:`${Math.floor(e/6e4)}m ${Math.round(e%6e4/1e3)}s`}function mN(e){if(null==e)return"never run";const t="string"==typeof e?new Date(e).getTime():e;if(!Number.isFinite(t))return"—";const n=Math.max(0,Math.round((Date.now()-t)/1e3));return n<60?`${n}s ago`:n<3600?`${Math.round(n/60)}m ago`:n<86400?`${Math.round(n/3600)}h ago`:n<604800?`${Math.round(n/86400)}d ago`:new Date(t).toISOString().slice(0,10)}function _N(e,t){return null===e?"never":tx(e)?t?"expected":"failed":t&&"passed"===e?"failed":bN(e)}function xN(e){return e?bN(e.status):"never"}function bN(e){switch(e){case"running":return"running";case"passed":return"passed";case"failed":return"failed";case"aborted":case"interrupted":return"aborted"}}function yN(e){switch(e){case"passed":return"pass";case"failed":return"fail";case"running":return"run";case"paused":case"aborted":return"warn";default:return"neutral"}}const wN=w_(function({runId:e}){const t=j_(),n=t.activeRuns.collectionByRunId.get(e),s=t.runs.items.find(t=>t.runId===e),i=!n&&s?t.historicRuns.get(e):null;bn.useEffect(()=>{!n&&s&&t.historicRuns.loadIfNeeded(e)},[e,n,s,t.historicRuns]);const r=function(e,t,n,s){if(n)return function(e,t){var n;const s=new Map,i=new Map;for(const u of t.events)"collection-run:scenario-started"===u.kind?s.set(u.scenario,u.t):"collection-run:scenario-finished"===u.kind&&i.set(u.scenario,u.t);const r=t.scenarios.map(n=>{const r=t.childRunIds.get(n)??null,o=t.childOutcomes.get(n)??null,a=r?e.activeRuns.byRunId.get(r):null,l=e.scenarios.items.find(e=>e.name===n),{status:c,skipReason:h}=SN({hasChildRunId:null!==r,childOutcome:o,childLiveStatus:(null==a?void 0:a.status)??null});return{scenario:n,status:c,durationMs:kN(s.get(n)??null,i.get(n)??null),childRunId:r,scenarioPath:(null==l?void 0:l.path)??null,skipReason:h}}),o=r.filter(e=>"passed"===e.status).length,a=r.filter(e=>"failed"===e.status).length,l=r.filter(e=>"running"===e.status||"paused"===e.status).length,c=t.startedAt,h=null!==t.outcome?(null==(n=t.events[t.events.length-1])?void 0:n.t)??null:null;return{headerStatus:CN(t),ref:t.collection||"—",durationMs:null!==h?h-c:null,rows:r,passed:o,failed:a,running:l,total:r.length||t.scenarios.length,abortable:"starting"===t.status||"running"===t.status}}(t,n);if(s&&"collection"===s.meta.kind)return function(e,t){let n=[];const s=new Map,i=new Map,r=new Map,o=new Map;for(const h of t.events)"collection-run:started"===h.kind?n=[...h.scenarios]:"collection-run:scenario-started"===h.kind?(s.set(h.scenario,h.scenarioRunId),r.set(h.scenario,h.t)):"collection-run:scenario-finished"===h.kind&&(i.set(h.scenario,h.outcome),o.set(h.scenario,h.t));const a=n.map(t=>{const n=s.get(t)??null,a=i.get(t)??null,l=e.scenarios.items.find(e=>e.name===t),{status:c,skipReason:h}=SN({hasChildRunId:null!==n,childOutcome:a,childLiveStatus:null});return{scenario:t,status:c,durationMs:kN(r.get(t)??null,o.get(t)??null),childRunId:n,scenarioPath:(null==l?void 0:l.path)??null,skipReason:h}}),l=a.filter(e=>"passed"===e.status).length,c=a.filter(e=>"failed"===e.status).length;return{headerStatus:bN(t.meta.status),ref:t.meta.ref,durationMs:t.meta.durationMs,rows:a,passed:l,failed:c,running:0,total:a.length,abortable:!1}}(t,{meta:s.meta,events:s.events});const i=t.runs.items.find(t=>t.runId===e);if(i&&"collection"===i.kind)return{headerStatus:bN(i.status),ref:i.ref,durationMs:i.durationMs,rows:[],passed:0,failed:0,running:0,total:0,abortable:!1};return null}(e,t,n,i);if(!r)return Bn.jsx(hN,{id:e});const{headerStatus:o,ref:a,durationMs:l,rows:c,passed:h,failed:u,running:d,total:f,abortable:p}=r;return Bn.jsxs("div",{className:"flex h-full min-w-0 flex-col",children:[Bn.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-3 border-b border-edge bg-canvas px-4",children:[Bn.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[Bn.jsx(by,{name:"layers",className:"h-4 w-4 shrink-0 text-fg-3"}),Bn.jsx(vN,{status:o,large:!0}),Bn.jsx("span",{className:"truncate font-mono text-[13px] text-fg",children:a}),Bn.jsx(dN,{tone:yN(o),children:o}),Bn.jsx(dN,{tone:"info",children:"collection"})]}),Bn.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-2 whitespace-nowrap font-mono text-[11.5px] text-fg-2 sm:gap-3",children:[Bn.jsxs("span",{className:"hidden tabular-nums sm:inline",children:[h,"/",f," passed"]}),u>0&&Bn.jsxs("span",{className:"tabular-nums text-fail",children:[u," failed"]}),Bn.jsx("span",{className:"tabular-nums",children:gN(l)}),p&&t.session.capabilities.canRun&&Bn.jsxs("button",{type:"button",onClick:()=>{t.activeRuns.abort(e)},title:"Stop the collection — sends SIGTERM to all in-flight scenarios",className:"flex h-6 items-center gap-1 rounded border border-fail/40 px-2 font-mono text-[11px] text-fail hover:bg-fail/10",children:[Bn.jsx(by,{name:"square",className:"h-3 w-3",strokeWidth:2.5})," Stop"]})]})]}),Bn.jsxs("div",{className:"flex h-2 shrink-0 overflow-hidden bg-raised",children:[Bn.jsx("div",{className:"h-full bg-pass",style:{width:h/Math.max(1,f)*100+"%"}}),Bn.jsx("div",{className:"h-full bg-fail",style:{width:u/Math.max(1,f)*100+"%"}}),Bn.jsx("div",{className:_y("h-full bg-warn",d>0&&"uno-pulse"),style:{width:d/Math.max(1,f)*100+"%"}})]}),Bn.jsxs("div",{className:"flex-1 overflow-auto",children:[Bn.jsxs("div",{className:"flex h-7 items-center gap-2 border-b border-edge-soft px-4 font-mono text-[10.5px] uppercase tracking-wider text-fg-4",children:[Bn.jsx("span",{className:"w-4"}),Bn.jsx("span",{className:"flex-1",children:"scenario"}),Bn.jsx("span",{className:"w-20 text-right",children:"time"})]}),c.map(e=>Bn.jsxs("button",{type:"button",onClick:()=>{e.childRunId?t.tabs.open({kind:"scenario-run",runId:e.childRunId}):e.scenarioPath&&t.tabs.open({kind:"scenario",path:e.scenarioPath})},className:"group flex h-10 w-full items-center gap-2 border-b border-edge-soft px-4 text-left hover:bg-raised/60",children:[Bn.jsx(vN,{status:e.status,large:!0}),Bn.jsxs("div",{className:"min-w-0 flex-1",children:[Bn.jsx("div",{className:"truncate font-mono text-[12.5px] text-fg",children:e.scenario}),e.skipReason&&Bn.jsxs("div",{className:"mt-0.5 truncate font-mono text-[10px] text-fg-4",children:["skipped — ",e.skipReason]})]}),Bn.jsx("span",{className:"w-20 text-right font-mono text-[11px] tabular-nums text-fg-2",children:gN(e.durationMs)}),Bn.jsx(by,{name:"chevronR",className:"h-3.5 w-3.5 text-fg-4 group-hover:text-fg-3"})]},e.scenario)),0===c.length&&Bn.jsx("div",{className:"px-4 py-6 text-center font-mono text-[11.5px] text-fg-4",children:"collection has no scenarios"})]})]})});function SN(e){return null!==e.childOutcome?{status:NN(e.childOutcome),skipReason:null}:null!==e.childLiveStatus?{status:jN(e.childLiveStatus),skipReason:null}:e.hasChildRunId?{status:"running",skipReason:null}:{status:"pending",skipReason:"skipped"}}function kN(e,t){return null===e||null===t?null:Math.max(0,t-e)}function CN(e){switch(e.status){case"queued":return"pending";case"starting":case"running":return"running";case"completed":return"passed";case"failed":return"failed";case"aborted":return"aborted"}}function jN(e){switch(e){case"queued":return"pending";case"starting":case"running":return"running";case"paused":return"paused";case"completed":return"passed";case"failed":return"failed";case"aborted":return"aborted"}}function NN(e){switch(e){case"completed":return"passed";case"failed":return"failed";case"aborted":case"interrupted":return"aborted"}}function MN({anchor:e,candidates:t,onPick:n,onClose:s}){const i=bn.useRef(null),r=bn.useRef(null),o=bn.useRef(null),[a,l]=bn.useState(""),[c,h]=bn.useState(0),[u,d]=bn.useState(!1),f=e.top-12,p=window.innerHeight-e.bottom-12,v=p>f?"down":"up",g=bn.useMemo(()=>{const e=a.trim().toLowerCase();return e?t.filter(t=>t.name.toLowerCase().includes(e)):t},[a,t]);bn.useEffect(()=>{h(0)},[a,g.length]),bn.useEffect(()=>{var e;null==(e=r.current)||e.focus();const t=requestAnimationFrame(()=>d(!0));return()=>cancelAnimationFrame(t)},[]),bn.useEffect(()=>{const e=e=>{var t;(null==(t=i.current)?void 0:t.contains(e.target))||s()},t=e=>{"Escape"===e.key&&s()},n=e=>{var t;(null==(t=i.current)?void 0:t.contains(e.target))||s()};return window.addEventListener("mousedown",e,!0),window.addEventListener("contextmenu",e,!0),window.addEventListener("keydown",t),window.addEventListener("scroll",n,!0),()=>{window.removeEventListener("mousedown",e,!0),window.removeEventListener("contextmenu",e,!0),window.removeEventListener("keydown",t),window.removeEventListener("scroll",n,!0)}},[s]),bn.useEffect(()=>{0===t.length&&s()},[t.length,s]);const m=e=>{var t;const n=null==(t=o.current)?void 0:t.children[e];null==n||n.scrollIntoView({block:"nearest"})},_=e=>{var t;const s=g[e];s&&(n(s.name),l(""),null==(t=r.current)||t.focus())},x={position:"fixed",left:e.left,width:e.width,maxHeight:Math.max(180,"up"===v?f:p),opacity:u?1:0,transform:u?"translateY(0)":"up"===v?"translateY(2px)":"translateY(-2px)",transitionProperty:"opacity, transform",transitionDuration:"90ms",transitionTimingFunction:"ease-out",..."up"===v?{bottom:window.innerHeight-e.top+6}:{top:e.bottom+6}};return Bn.jsxs("div",{ref:i,role:"dialog",style:x,className:_y("z-50 flex flex-col overflow-hidden rounded-lg p-1","border border-edge-soft bg-overlay/95 backdrop-blur","shadow-lg"),children:[Bn.jsxs("div",{className:"flex h-7 shrink-0 items-center gap-1.5 rounded-md px-2",children:[Bn.jsx(by,{name:"search",className:"h-3.5 w-3.5 text-fg-3"}),Bn.jsx("input",{ref:r,value:a,onChange:e=>l(e.target.value),onKeyDown:e=>{if("ArrowDown"===e.key)e.preventDefault(),h(e=>{const t=Math.min(g.length-1,e+1);return m(t),t});else if("ArrowUp"===e.key)e.preventDefault(),h(e=>{const t=Math.max(0,e-1);return m(t),t});else if("Enter"===e.key)e.preventDefault(),_(c);else if("Home"===e.key)e.preventDefault(),h(0),m(0);else if("End"===e.key){e.preventDefault();const t=g.length-1;h(t),m(t)}},spellCheck:!1,autoComplete:"off",placeholder:"filter scenarios…",className:"min-w-0 flex-1 bg-transparent font-mono text-[12px] text-fg placeholder-fg-4 outline-none"}),Bn.jsxs("span",{className:"font-mono text-[10px] tracking-wider text-fg-4",children:[g.length,"/",t.length]})]}),Bn.jsx("div",{className:"my-1 h-px shrink-0 bg-edge-soft"}),Bn.jsx("div",{ref:o,className:"min-h-0 flex-1 overflow-auto",children:0===g.length?Bn.jsxs("div",{className:"px-2 py-3 text-center font-mono text-[11.5px] text-fg-4",children:['no match for "',a.trim(),'"']}):g.map((e,t)=>{const n=t===c;return Bn.jsxs("button",{type:"button",onMouseEnter:()=>h(t),onMouseDown:e=>e.preventDefault(),onClick:()=>_(t),className:_y("flex h-7 w-full items-center gap-2 rounded-md px-2 text-left",n?"bg-selection text-fg":"text-fg-2 hover:bg-raised/60"),children:[Bn.jsx(by,{name:"file",className:_y("h-3.5 w-3.5 shrink-0",n?"text-accent":"text-fg-4")}),Bn.jsx("span",{className:"truncate font-mono text-[12px]",children:e.name})]},e.name)})}),Bn.jsx("div",{className:"my-1 h-px shrink-0 bg-edge-soft"}),Bn.jsxs("div",{className:"flex shrink-0 items-center gap-2 px-2 py-0.5 font-mono text-[10px] text-fg-4",children:[Bn.jsx("span",{children:"↑↓ navigate"}),Bn.jsx("span",{children:"·"}),Bn.jsx("span",{children:"↵ add"}),Bn.jsx("span",{children:"·"}),Bn.jsx("span",{children:"esc done"})]})]})}const BN="Not available in a read-only session",DN="cursor-not-allowed opacity-40",LN=w_(function({path:e}){const t=j_(),[n,s]=bn.useState(null),[i,r]=bn.useState(null),[o,a]=bn.useState(null),[l,c]=bn.useState(!1),[h,u]=bn.useState(!1),[d,f]=bn.useState(!1),p=bn.useRef(null),v=bn.useRef([]),g=t.collections.byPath(e),m=bn.useMemo(()=>{if(!g)return[];const e=new Set(g.scenarios);return t.scenarios.items.filter(t=>!e.has(t.name))},[g,t.scenarios.items]);if(bn.useEffect(()=>{if(!i||!g)return;document.body.style.userSelect="none",document.body.style.cursor="grabbing";const n=g.scenarios.slice();a(n);const s=e=>{const t=e.clientY;let n=-1,s=1/0;for(let i=0;i<v.current.length;i++){const e=v.current[i];if(!e)continue;const r=e.getBoundingClientRect(),o=r.top+r.height/2,a=Math.abs(t-o);a<s&&(s=a,n=i)}a(e=>{if(!e)return e;const t=e.indexOf(i.name);if(t<0||n<0||n===t)return e;const s=e.slice();return s.splice(t,1),s.splice(n,0,i.name),s}),r(n=>n?{...n,pointerX:e.clientX,pointerY:t}:null)},o=s=>{r(null),a(i=>(s&&i&&!function(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}(i,n)&&t.collections.reorderScenarios(e,i),null))},l=()=>o(!0),c=()=>o(!1),h=e=>{"Escape"===e.key&&o(!1)};return window.addEventListener("pointermove",s),window.addEventListener("pointerup",l),window.addEventListener("pointercancel",c),window.addEventListener("keydown",h),()=>{document.body.style.userSelect="",document.body.style.cursor="",window.removeEventListener("pointermove",s),window.removeEventListener("pointerup",l),window.removeEventListener("pointercancel",c),window.removeEventListener("keydown",h)}},[null==i?void 0:i.name,g,e,t.collections]),!g)return Bn.jsx(hN,{id:e});const _=t.runs.lastRunByRef("collection",g.name),x=(o??g.scenarios).map(e=>{const n=t.scenarios.items.find(t=>t.name===e),s=t.runs.lastRunByRef("scenario",e);return{name:e,found:n,last:s}}),b=(e,t)=>{if(0!==e.button)return;e.preventDefault();const n=e.currentTarget.closest("[data-scenario-row]");if(!n)return;const s=n.getBoundingClientRect();r({name:t,left:s.left,width:s.width,offsetY:e.clientY-s.top,pointerX:e.clientX,pointerY:e.clientY})},y=t.session.capabilities.canRun,w=!y||0===g.scenarios.length;return Bn.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[Bn.jsxs("header",{className:"flex shrink-0 items-start gap-4 border-b border-edge px-4 py-3",children:[Bn.jsxs("div",{className:"min-w-0 flex-1",children:[Bn.jsxs("div",{className:"flex items-center gap-2",children:[Bn.jsx(by,{name:"layers",className:"h-4 w-4 text-fg-3"}),l?Bn.jsx(PN,{initial:g.name,duplicateCheck:n=>t.collections.nameTaken(n,e),onCommit:async n=>{const s=await t.collections.rename(e,n);s&&(s.path!==e&&t.tabs.renameCollectionTab(e,s.path),c(!1))},onCancel:()=>c(!1)}):Bn.jsxs("button",{type:"button",onClick:()=>c(!0),className:"group flex min-w-0 items-center gap-1.5 truncate font-mono text-[15px] font-medium text-fg",title:"Rename",children:[Bn.jsx("span",{className:"truncate",children:g.name}),Bn.jsx("span",{className:"text-fg-4 opacity-0 group-hover:opacity-100",children:Bn.jsx(by,{name:"edit",className:"h-3 w-3"})})]}),Bn.jsx(dN,{tone:"info",children:"collection"})]}),h?Bn.jsx(AN,{initial:g.description??"",onCommit:n=>{t.collections.setDescription(e,0===n.trim().length?null:n.trim()),u(!1)},onCancel:()=>u(!1)}):Bn.jsx("button",{type:"button",onClick:()=>u(!0),className:"mt-1 block max-w-[640px] text-left text-[12.5px] leading-relaxed text-fg-2 hover:text-fg",title:"Edit description",children:g.description??Bn.jsx("span",{className:"italic text-fg-4",children:"+ add description"})}),Bn.jsxs("div",{className:"mt-1.5 flex items-center gap-3 font-mono text-[11px] text-fg-3",children:[Bn.jsxs("span",{children:[g.scenarios.length," scenarios"]}),Bn.jsx("span",{children:"·"}),d?Bn.jsx(RN,{initial:g.workers??1,onCommit:n=>{t.collections.setWorkers(e,n<=1?null:n),f(!1)},onCancel:()=>f(!1)}):Bn.jsxs("button",{type:"button",onClick:()=>f(!0),className:"hover:text-fg",title:"How many scenarios of this collection run concurrently (1 = sequential). Click to edit",children:["workers: ",g.workers??1]}),Bn.jsx("span",{children:"·"}),Bn.jsx("span",{children:_?`last run ${mN(_.startedAt)}`:"never run"})]})]}),Bn.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[Bn.jsx("button",{type:"button",onClick:async()=>{const n=`collection:${e}`;await t.collections.delete(e)&&t.tabs.close(n)},className:"grid h-7 w-7 place-items-center rounded text-fg-4 hover:bg-raised hover:text-fail",title:"Delete collection",children:Bn.jsx(by,{name:"trash",className:"h-3.5 w-3.5"})}),Bn.jsxs("button",{type:"button",disabled:w,onClick:w?void 0:async()=>{try{const e=await t.activeRuns.startCollection(g.name);t.tabs.open({kind:"collection-run",runId:e.runId})}catch(e){t.collections.setError(e instanceof Error?e.message:String(e))}},title:y?0===g.scenarios.length?"add at least one scenario before running":t.queue.waitingCount>0||t.queue.running.length>0?"the machine is busy — this run joins the queue":(g.workers??1)>1?`Run every scenario in this collection, ${g.workers} in parallel`:"Run every scenario in this collection sequentially":BN,className:_y("flex h-7 items-center gap-1.5 rounded px-2.5 font-mono text-[11.5px] font-medium",w?"cursor-not-allowed bg-raised text-fg-4":"bg-accent text-on-accent hover:bg-accent-hover"),children:[Bn.jsx(by,{name:"play",className:"h-3.5 w-3.5",strokeWidth:2.5})," Run all"]})]})]}),t.collections.error&&Bn.jsxs("div",{className:"flex shrink-0 items-start gap-2 border-b border-fail/30 bg-fail/10 px-4 py-2 font-mono text-[11.5px] text-fail",children:[Bn.jsx(by,{name:"alert",className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),Bn.jsx("span",{className:"flex-1",children:t.collections.error}),Bn.jsx("button",{type:"button",onClick:()=>t.collections.clearError(),title:"Dismiss",className:"grid h-4 w-4 shrink-0 place-items-center rounded hover:bg-fail/20",children:Bn.jsx(by,{name:"x",className:"h-3 w-3",strokeWidth:2.25})})]}),Bn.jsxs("div",{className:"min-h-0 flex-1 overflow-auto",children:[Bn.jsxs("div",{className:"flex h-7 items-center gap-2 border-b border-edge-soft px-4 font-mono text-[10.5px] uppercase tracking-wider text-fg-4",children:[Bn.jsx("span",{className:"w-4"}),Bn.jsx("span",{className:"w-3"}),Bn.jsx("span",{className:"flex-1",children:"scenario"}),Bn.jsx("span",{className:"w-24 text-right",children:"last run"}),Bn.jsx("span",{className:"w-6"})]}),Bn.jsx("div",{className:"relative",children:x.map((n,s)=>{const r=e=>{v.current[s]=e};if((null==i?void 0:i.name)===n.name)return Bn.jsx("div",{ref:r,"data-scenario-row":!0,className:"h-9 px-4",children:Bn.jsx("div",{className:"h-full rounded border-2 border-dashed border-accent/50 bg-accent/10"})},n.name);if(!n.found)return Bn.jsxs("div",{ref:r,"data-scenario-row":!0,className:"group flex h-9 items-center gap-2 px-4 hover:bg-raised/60",children:[Bn.jsx(EN,{onPointerDown:e=>b(e,n.name)}),Bn.jsx(vN,{status:"never"}),Bn.jsx("span",{className:"flex-1 truncate font-mono text-[12.5px] text-fail line-through",title:"file not found",children:n.name}),Bn.jsx(dN,{tone:"fail",size:"xs",children:"orphan"}),Bn.jsx("button",{type:"button",onClick:()=>{t.collections.removeScenario(e,n.name)},className:"grid h-6 w-6 place-items-center rounded text-fg-4 hover:bg-raised hover:text-fail",title:"Remove from collection",children:Bn.jsx(by,{name:"x",className:"h-3.5 w-3.5",strokeWidth:2.5})})]},n.name);const o=n.found;return Bn.jsxs("div",{ref:r,"data-scenario-row":!0,className:"group flex h-9 items-center gap-2 px-4 hover:bg-raised/60",children:[Bn.jsx(EN,{onPointerDown:e=>b(e,n.name),hoverGroup:!0}),Bn.jsx(vN,{status:xN(n.last)}),Bn.jsx("button",{type:"button",onClick:()=>t.tabs.open({kind:"scenario",path:o.path}),className:"flex-1 truncate text-left font-mono text-[12.5px] text-fg hover:text-accent",children:o.name}),Bn.jsx("span",{className:"w-24 text-right font-mono text-[11px] text-fg-2",children:n.last?mN(n.last.startedAt):"—"}),Bn.jsx("button",{type:"button",onClick:()=>t.collections.removeScenario(e,n.name),className:"grid h-6 w-6 place-items-center rounded text-fg-4 opacity-0 hover:bg-raised hover:text-fail group-hover:opacity-100",title:"Remove",children:Bn.jsx(by,{name:"x",className:"h-3.5 w-3.5",strokeWidth:2.5})})]},n.name)})}),Bn.jsx("div",{className:"px-4 py-2",children:Bn.jsxs("button",{ref:p,type:"button",onClick:()=>{var e;const t=null==(e=p.current)?void 0:e.getBoundingClientRect();t&&s(t)},disabled:0===m.length,className:_y("flex w-full items-center justify-center gap-1.5 rounded border border-dashed px-2 py-1.5 font-mono text-[11.5px]",0===m.length?"cursor-default border-edge-soft text-fg-4":n?"border-accent bg-accent/10 text-accent":"border-edge-soft text-fg-3 hover:border-accent hover:bg-accent/10 hover:text-accent"),children:[Bn.jsx(by,{name:"plus",className:"h-3.5 w-3.5"}),0===m.length?"all scenarios added":"add scenario"]})})]}),n&&Bn.jsx(MN,{anchor:n,candidates:m,onPick:n=>{t.collections.addScenario(e,n)},onClose:()=>s(null)}),i&&(()=>{const e=x.find(e=>e.name===i.name);if(!e)return null;const t=Math.max(4,i.pointerY-i.offsetY);return Bn.jsxs("div",{style:{position:"fixed",left:i.left,width:i.width,top:t,zIndex:60,pointerEvents:"none",transform:"scale(1.01)",transformOrigin:"left center"},className:_y("flex h-9 items-center gap-2 rounded-md px-4 font-mono","border border-accent/50 bg-overlay/95 backdrop-blur ring-1 ring-accent/15","shadow-[0_14px_36px_-10px_rgba(15,15,20,0.28),0_4px_10px_-3px_rgba(15,15,20,0.12)]","dark:shadow-[0_14px_36px_-10px_rgba(0,0,0,0.7),0_4px_10px_-3px_rgba(0,0,0,0.5)]"),children:[Bn.jsx(by,{name:"grip",className:"h-3.5 w-3.5 text-accent"}),Bn.jsx(vN,{status:e.found?xN(e.last):"never"}),Bn.jsx("span",{className:_y("flex-1 truncate text-[12.5px]",e.found?"text-fg":"text-fail line-through"),children:e.name}),!e.found&&Bn.jsx(dN,{tone:"fail",size:"xs",children:"orphan"}),e.found&&Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("span",{className:"w-24 text-right text-[11px] text-fg-2",children:e.last?mN(e.last.startedAt):"—"}),Bn.jsx("span",{className:"w-6"})]})]})})()]})});function EN({onPointerDown:e,hoverGroup:t=!1}){return Bn.jsx("span",{onPointerDown:e,role:"button","aria-label":"Reorder",title:"Drag to reorder",className:_y("grid h-5 w-3.5 shrink-0 cursor-grab touch-none place-items-center text-fg-4 active:cursor-grabbing",t&&"group-hover:text-fg-3"),children:Bn.jsx(by,{name:"grip",className:"h-3.5 w-3.5"})})}function PN({initial:e,duplicateCheck:t,onCommit:n,onCancel:s}){const[i,r]=bn.useState(e),o=bn.useRef(null);bn.useEffect(()=>{var e,t;null==(e=o.current)||e.focus(),null==(t=o.current)||t.select()},[]);const a=i.trim(),l=a.length>0&&a!==e?sy(a):null,c=a.length>0&&t(a),h=c||null!==l,u=a.length>0&&!h&&a!==e;return Bn.jsx("form",{onSubmit:t=>{t.preventDefault(),u?n(a):a===e&&s()},className:"min-w-0 flex-1",children:Bn.jsx("input",{ref:o,value:i,onChange:e=>r(e.target.value),onKeyDown:e=>{"Escape"===e.key&&(e.preventDefault(),s())},onBlur:()=>{u?n(a):s()},spellCheck:!1,autoComplete:"off",className:_y("w-full min-w-0 rounded border bg-canvas px-1.5 py-0.5 font-mono text-[15px] font-medium text-fg outline-none ring-2",h?"border-fail ring-fail/20":"border-accent ring-accent/20"),title:c?`"${a}" already exists`:l??void 0})})}function RN({initial:e,onCommit:t,onCancel:n}){const[s,i]=bn.useState(String(e)),r=bn.useRef(null);bn.useEffect(()=>{var e,t;null==(e=r.current)||e.focus(),null==(t=r.current)||t.select()},[]);const o=Number(s),a=Number.isInteger(o)&&o>=1,l=()=>{a?t(o):n()};return Bn.jsxs("span",{className:"flex items-center gap-1",children:[Bn.jsx("span",{children:"workers:"}),Bn.jsx("input",{ref:r,value:s,onChange:e=>i(e.target.value),onKeyDown:e=>{"Escape"===e.key?(e.preventDefault(),n()):"Enter"===e.key&&(e.preventDefault(),l())},onBlur:l,inputMode:"numeric",spellCheck:!1,autoComplete:"off",className:_y("w-10 rounded border bg-canvas px-1 py-0 font-mono text-[11px] text-fg outline-none ring-2",a?"border-accent ring-accent/20":"border-fail ring-fail/20"),title:a?void 0:"integer >= 1"})]})}function AN({initial:e,onCommit:t,onCancel:n}){const[s,i]=bn.useState(e),r=bn.useRef(null);return bn.useEffect(()=>{var e,t;null==(e=r.current)||e.focus(),null==(t=r.current)||t.select()},[]),Bn.jsxs("form",{onSubmit:e=>{e.preventDefault(),t(s)},className:"mt-1 max-w-[640px]",children:[Bn.jsx("textarea",{ref:r,value:s,onChange:e=>i(e.target.value),onKeyDown:e=>{"Escape"===e.key?(e.preventDefault(),n()):"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),t(s))},onBlur:()=>t(s),rows:2,placeholder:"describe what this collection covers…",className:"w-full resize-none rounded border border-accent bg-canvas px-1.5 py-0.5 text-[12.5px] leading-relaxed text-fg-2 outline-none ring-2 ring-accent/20 placeholder:text-fg-4"}),Bn.jsx("div",{className:"mt-1 px-1 font-mono text-[10px] text-fg-4",children:"⌘↵ save · esc cancel"})]})}const zN={},TN=function(e,t,n){let s=Promise.resolve();if(t&&t.length>0){document.getElementsByTagName("link");const e=document.querySelector("meta[property=csp-nonce]"),n=(null==e?void 0:e.nonce)||(null==e?void 0:e.getAttribute("nonce"));s=Promise.allSettled(t.map(e=>{if((e=function(e){return"/"+e}(e))in zN)return;zN[e]=!0;const t=e.endsWith(".css"),s=t?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${e}"]${s}`))return;const i=document.createElement("link");return i.rel=t?"stylesheet":"modulepreload",t||(i.as="script"),i.crossOrigin="",i.href=e,n&&i.setAttribute("nonce",n),document.head.appendChild(i),t?new Promise((t,n)=>{i.addEventListener("load",t),i.addEventListener("error",()=>n(new Error(`Unable to preload CSS for ${e}`)))}):void 0}))}function i(e){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return s.then(t=>{for(const e of t||[])"rejected"===e.status&&i(e.reason);return e().catch(i)})};function IN({label:e,hint:t,placement:n="bottom"}){return Bn.jsxs("span",{role:"tooltip",className:_y("pointer-events-none absolute z-50 hidden items-center gap-1.5 whitespace-nowrap rounded-md border border-edge-soft bg-overlay px-2 py-1 font-mono text-[10.5px] font-normal normal-case tracking-normal text-fg-2 shadow-md group-hover:flex",{right:"left-full top-1/2 ml-2 -translate-y-1/2",bottom:"left-1/2 top-full mt-1.5 -translate-x-1/2","bottom-start":"left-0 top-full mt-1.5","bottom-end":"right-0 top-full mt-1.5"}[n]),children:[e,t&&Bn.jsx("span",{className:"font-mono text-[9.5px] text-fg-3",children:t})]})}function ON({value:e,onChange:t,options:n}){return Bn.jsx("div",{className:"inline-flex rounded-md border border-edge-soft bg-raised p-0.5",children:n.map(n=>Bn.jsxs("button",{type:"button",onClick:()=>t(n.value),"aria-pressed":e===n.value,className:_y("group relative flex items-center gap-1 rounded px-2.5 py-1 font-mono text-[11px] transition-colors",e===n.value?"bg-canvas text-fg shadow-sm":"text-fg-3 hover:text-fg-2"),children:[n.icon&&Bn.jsx(by,{name:n.icon,className:"h-3.5 w-3.5",strokeWidth:1.75}),Bn.jsx("span",{children:n.label}),n.title&&Bn.jsx(IN,{label:n.title})]},n.value))})}function HN(e){const t=[],n=/('[^']*'|"[^"]*"|`[^`]*`|\/\/[^\n]*|[A-Za-z_][\w$]*|\d+|[(){}[\],:.;]|\s+|[^A-Za-z0-9_'"`(){}\[\],:.;\s]+)/g,s=new Set(["true","false","null","undefined","await","async","const","let","var","return","export","import","from","if","else","function"]);let i;for(;i=n.exec(e);){const r=i[0];if(r.startsWith("//"))t.push({t:r,cls:"text-fg-4 italic"});else if(/^['"`]/.test(r))t.push({t:r,cls:"text-syn-string"});else if(/^\d+$/.test(r))t.push({t:r,cls:"text-syn-number"});else if(s.has(r))t.push({t:r,cls:"text-syn-keyword"});else if(/^[A-Za-z_][\w$]*$/.test(r)){const s=e.slice(n.lastIndex);/^\s*\(/.test(s)?t.push({t:r,cls:"text-accent"}):t.push({t:r,cls:"text-fg"})}else/^[(){}[\],:.;]/.test(r)?t.push({t:r,cls:"text-fg-4"}):t.push({t:r,cls:""})}return Bn.jsx(Bn.Fragment,{children:t.map((e,t)=>Bn.jsx(bn.Fragment,{children:Bn.jsx("span",{className:e.cls,children:e.t})},t))})}function FN({src:e,file:t,focusLine:n,focusSeq:s}){const i=e.split("\n"),r=bn.useRef(null);return bn.useEffect(()=>{var e,t;null!=n&&(null==(t=null==(e=r.current)?void 0:e.scrollIntoView)||t.call(e,{block:"center"}))},[n,s]),Bn.jsxs("div",{className:"flex h-full flex-col",children:[Bn.jsxs("div",{className:"flex h-8 shrink-0 items-center gap-2 border-b border-edge bg-panel px-3",children:[Bn.jsx(by,{name:"file",className:"h-3.5 w-3.5 text-fg-4"}),Bn.jsx("span",{className:"font-mono text-[11.5px] text-fg-3",children:t}),Bn.jsx("span",{className:"font-mono text-[10.5px] text-fg-4",children:"· read-only"}),Bn.jsx("div",{className:"ml-auto flex items-center gap-1",children:Bn.jsx("button",{type:"button",className:"grid h-6 w-6 place-items-center rounded text-fg-4 hover:bg-raised hover:text-fg-2",title:"Copy",onClick:()=>{var t;null==(t=navigator.clipboard)||t.writeText(e)},children:Bn.jsx(by,{name:"copy",className:"h-3.5 w-3.5"})})})]}),Bn.jsx("div",{className:"flex-1 overflow-auto bg-canvas",children:Bn.jsx("pre",{className:"grid grid-cols-[auto_1fr] font-mono text-[12.5px] leading-[1.55]",children:i.map((e,t)=>{const s=n===t+1;return Bn.jsxs(bn.Fragment,{children:[Bn.jsx("span",{className:"select-none border-r border-edge-soft px-3 text-right tabular-nums "+(s?"bg-accent/15 text-fg-2":"text-fg-4"),children:t+1}),Bn.jsx("span",{ref:s?r:void 0,className:"px-3 "+(s?"bg-accent/10":""),children:e?HN(e):" "})]},t)})})})]})}const WN=bn.lazy(()=>TN(()=>import("./DslEditor-CBAoI3BF.js"),__vite__mapDeps([0,1])).then(e=>({default:e.DslEditor}))),UN=w_(function({path:e}){const t=j_(),n=t.helpers.items.find(t=>t.path===e),[s,i]=bn.useState("view");bn.useEffect(()=>{n&&t.source.getOrLoad(n.path)},[t,n]);const r=t.editorBridge.pendingReveal(e),[o,a]=bn.useState(null);if(bn.useEffect(()=>{r&&(a(r),t.editorBridge.consumeReveal(e,r.seq))},[r,t,e]),!n)return Bn.jsx(hN,{id:e});const l=t.source.get(n.path),c=l?l.split("\n").length:0;return Bn.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[Bn.jsxs("header",{className:"flex shrink-0 items-start gap-4 border-b border-edge px-4 py-3",children:[Bn.jsxs("div",{className:"min-w-0 flex-1",children:[Bn.jsxs("div",{className:"flex items-center gap-2",children:[Bn.jsx(by,{name:"braces",className:"h-4 w-4 text-fg-3"}),Bn.jsxs("h1",{className:"truncate font-mono text-[15px] font-medium text-fg",children:[n.name,".js"]}),Bn.jsx(dN,{tone:"neutral",children:"helper"})]}),Bn.jsxs("div",{className:"mt-1 flex items-center gap-3 font-mono text-[11.5px] text-fg-2",children:[Bn.jsx("span",{className:"truncate",children:n.path}),c>0&&Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("span",{className:"text-fg-4",children:"·"}),Bn.jsxs("span",{children:[c," lines"]})]})]})]}),Bn.jsx(ON,{value:s,onChange:i,options:[{value:"view",label:"View"},{value:"edit",label:"Edit"}]})]}),Bn.jsx("div",{className:"min-h-0 flex-1",children:"edit"===s?Bn.jsx(bn.Suspense,{fallback:Bn.jsx("div",{className:"px-4 py-3 font-mono text-[12px] text-fg-4",children:"loading editor…"}),children:Bn.jsx(WN,{path:n.path,fileKind:"helper",highlightLine:null==o?void 0:o.line})}):void 0!==l?Bn.jsx(FN,{src:l,file:n.path,focusLine:null==o?void 0:o.line,focusSeq:null==o?void 0:o.seq}):Bn.jsx("div",{className:"px-4 py-3 font-mono text-[12px] text-fg-4",children:"loading source…"})})]})}),KN=36e5,qN=24*KN,$N={fresh:46,today:30,week:19,stale:11};function VN(e,t){if(null===e)return"fresh";const n=t-e;return n<KN?"fresh":n<qN?"today":n<7*qN?"week":"stale"}class YN{constructor(e){this.rest=e,this.records=[],this.editing=null,this.readOnly=!1,this.driftedFromPush=!1,this.loadError=null,$r(this,{},{autoBind:!0})}async load(){try{this.apply(await this.rest.schedules())}catch(e){pr(()=>{this.loadError=e instanceof Error?e.message:String(e)})}}get(e,t){const n=this.records.find(n=>n.target.kind===e&&n.target.name===t);return n?{cron:n.cron,env:n.env}:null}sourceOf(e,t){const n=this.records.find(n=>n.target.kind===e&&n.target.name===t);return n?n.source:null}get list(){return this.records}openEditor(e){this.editing=e}closeEditor(){this.editing=null}async save(e){if(!this.editing)return null;const t=this.editing,n=this.fileRecords().filter(e=>!GN(e.target,t)).concat([{target:t,cron:e.cron.trim(),env:e.env,source:"file"}]);return this.replace(n)}async remove(){if(!this.editing)return null;const e=this.editing;return this.replace(this.fileRecords().filter(t=>!GN(t.target,e)))}fileRecords(){return this.records.filter(e=>"file"===e.source)}async replace(e){try{const t=await this.rest.putSchedules(e.map(ZN));return pr(()=>{this.apply(t),this.editing=null}),null}catch(t){return t instanceof Error?t.message:String(t)}}apply(e){pr(()=>{this.records=e.schedules.map(XN),this.readOnly=e.readOnly,this.driftedFromPush=e.driftedFromPush,this.loadError=null})}}function GN(e,t){return e.kind===t.kind&&e.name===t.name}function XN(e){return{target:Db(e),cron:e.cron,env:e.env??null,source:e.source??"file"}}function ZN(e){const t={cron:e.cron,...null!==e.env?{env:e.env}:{}};return"collection"===e.target.kind?{collection:e.target.name,...t}:{scenario:e.target.name,...t}}function JN(e){const t=zb(e.cron);return e.env?`${t} · ${e.env}`:t}const QN=w_(function(){const e=j_(),[t,n]=bn.useState("all"),[s,i]=bn.useState("runs"),[r,o]=bn.useState({w:0,h:0}),[a,l]=bn.useState(null),[c,h]=bn.useState(()=>Date.now());bn.useEffect(()=>{const e=setInterval(()=>h(Date.now()),6e4);return()=>clearInterval(e)},[]),bn.useLayoutEffect(()=>{if(!a)return;const e=new ResizeObserver(()=>{o({w:a.clientWidth,h:a.clientHeight})});return e.observe(a),()=>e.disconnect()},[a]);const u=e.overview.counts,d=e.overview.indexReady,f=e.overview.rows,p=function(e,t){const n=new Map;for(const s of e){if("collection"!==s.target.kind)continue;const e=t.find(e=>e.name===s.target.name);for(const t of(null==e?void 0:e.scenarios)??[])n.set(t,{cron:s.cron,env:s.env,via:s.target.name})}for(const s of e)"scenario"===s.target.kind&&n.set(s.target.name,{cron:s.cron,env:s.env,via:null});return n}(e.schedules.list,e.collections.items),v=f.filter(e=>"all"===t||("scheduled"===t?p.has(e.ref):"unscheduled"===t?!p.has(e.ref):e.status===t)),g=function(e,t,n){let s={cols:1,size:0};for(let i=1;i<=e;i++){const r=Math.ceil(e/i),o=Math.min((t-lM*(i-1))/i,(n-lM*(r-1))/r);o>s.size&&(s={cols:i,size:o})}return{cols:s.cols,size:Math.min(s.size,uM)}}(f.length,r.w-2*cM,r.h-2*cM),m=Math.max(g.size,hM),_=r.w>0,x=Math.max(1,Math.min(g.cols,v.length)),b=g.cols*m+(g.cols-1)*lM,y={width:_?Math.max(b,Math.min(dM,r.w)):void 0};if(0===u.all)return Bn.jsx(iM,{});const w=f.filter(e=>p.has(e.ref)).length,S="runs"===s?function(e){const t=[{filter:"all",label:"scenarios",name:"Show all tests",value:e.all,dot:null},{filter:"passed",label:"passed",name:"Show passing tests",value:e.passed,dot:"passed"},{filter:"failed",label:"failed",name:"Show failing tests",value:e.failed,dot:"failed"}];e.expected>0&&t.push({filter:"expected",label:"expected",name:"Show tests that failed on purpose",value:e.expected,dot:"expected"});return t.push({filter:"never",label:"never run",name:"Show tests that never ran",value:e.never,dot:"never"}),t}(u):[{filter:"all",label:"scenarios",name:"Show all tests",value:k=u.all,dot:null},{filter:"scheduled",label:"scheduled",name:"Show tests that run on a schedule",value:C=w,dot:null,icon:"clock"},{filter:"unscheduled",label:"no schedule",name:"Show tests no schedule covers",value:k-C,dot:null}];var k,C;return Bn.jsxs("div",{className:"flex h-full flex-col overflow-hidden px-6 py-6",children:[Bn.jsxs("div",{className:_y("mx-auto w-full shrink-0",aM),style:y,children:[Bn.jsxs("div",{className:"mb-1.5 flex items-center gap-2",children:[Bn.jsx(by,{name:"activity",className:"h-4 w-4 text-fg-4"}),Bn.jsx("span",{className:"font-mono text-[11px] uppercase tracking-wider text-fg-4",children:"overview"}),Bn.jsx("div",{className:"ml-auto",children:Bn.jsx(ON,{value:s,onChange:e=>{i(e),n("all")},options:[{value:"runs",label:"last run",icon:"activity"},{value:"schedule",label:"schedule",icon:"clock"}]})})]}),Bn.jsx("h1",{className:"mb-5 truncate font-mono text-[18px] font-medium tracking-tight text-fg-2",children:"runs"===s?sM(u.failed,d):eM(w,u.all)}),Bn.jsx("div",{className:"grid gap-px overflow-hidden rounded border border-edge-soft bg-edge-soft",style:{gridTemplateColumns:`repeat(${S.length}, minmax(0, 1fr))`},children:S.map(e=>Bn.jsx(BM,{label:e.label,name:e.name,value:e.value,dot:e.dot,icon:e.icon,active:t===e.filter,onClick:()=>n(e.filter)},e.filter))}),"schedule"===s&&Bn.jsxs("div",{className:"mt-2 flex items-center gap-1.5 truncate font-mono text-[10.5px] text-fg-4",children:[Bn.jsx(by,{name:"package",className:"h-3 w-3 shrink-0"}),e.schedules.readOnly?"declared in the repo — this box runs whatever the deployed bundle declares; edit there and push":"declared here — a box runs what you push"]}),"schedule"===s&&e.schedules.driftedFromPush&&Bn.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5 truncate font-mono text-[10.5px] text-warn",children:[Bn.jsx(by,{name:"alert",className:"h-3 w-3 shrink-0"}),"this set differs from the one recorded at push — the project's config likely computes schedules from this environment"]}),"schedule"===s&&e.schedules.list.length>0&&Bn.jsx(oM,{records:e.schedules.list,collections:e.collections.items,now:c})]}),Bn.jsx(vM,{tiles:v,attach:l,field:a,cols:x,size:m,ready:_,now:c,mode:s,schedules:p}),Bn.jsx("div",{className:_y("mx-auto mt-3 flex w-full shrink-0 items-center gap-4 whitespace-nowrap font-mono text-[10.5px] text-fg-4",aM),style:y,children:"runs"===s?Bn.jsxs(Bn.Fragment,{children:[Bn.jsxs("span",{className:"flex items-center gap-1.5",children:[Bn.jsx(vN,{status:"passed",pulse:!1})," passed"]}),Bn.jsxs("span",{className:"flex items-center gap-1.5",children:[Bn.jsx(vN,{status:"failed",pulse:!1})," failed"]}),u.expected>0&&Bn.jsxs("span",{className:"flex items-center gap-1.5",children:[Bn.jsx(vN,{status:"expected",pulse:!1})," failed on purpose"]}),Bn.jsxs("span",{className:"flex items-center gap-1.5",children:[Bn.jsx(vN,{status:"never",pulse:!1})," never run"]}),f.some(e=>e.live)&&Bn.jsxs("span",{className:"flex items-center gap-1.5",children:[Bn.jsx("span",{className:"uno-tile-live h-2 w-2 rounded-[2px] bg-warn/40"}),"running now"]}),Bn.jsx(tM,{}),Bn.jsx("span",{className:"ml-auto",children:d?"hover for history · click to open the last run":"reading run history…"})]}):Bn.jsxs(Bn.Fragment,{children:[Bn.jsx(nM,{}),Bn.jsx("span",{className:"ml-auto",children:"hover for the schedule · click to open the test"})]})})]})});function eM(e,t){return 0===e?"Nothing runs on a schedule.":`${e} of ${t} ${1===t?"test runs":"tests run"} on a schedule.`}function tM(){return Bn.jsxs("span",{className:"flex items-center gap-1.5","aria-label":"Colour fades as a result ages",children:[Bn.jsx("span",{className:"flex items-center gap-[2px]",children:["fresh","today","week","stale"].map(e=>Bn.jsx("span",{className:"h-2 w-2 rounded-[1px]",style:{background:`color-mix(in srgb, var(--u-fg-3) ${$N[e]}%, transparent)`}},e))}),"just ran → older"]})}function nM(){return Bn.jsxs(Bn.Fragment,{children:[Bn.jsxs("span",{className:"flex items-center gap-1.5","aria-label":"Brighter means the test runs more often",children:[Bn.jsx("span",{className:"flex items-center gap-[2px]",children:[95,65,38,22].map(e=>Bn.jsx("span",{className:"h-2 w-2 rounded-[1px]",style:{background:`color-mix(in srgb, var(--u-accent) ${e}%, transparent)`}},e))}),"often → rare"]}),Bn.jsxs("span",{className:"flex items-center gap-1.5",children:[Bn.jsx("span",{className:"h-2 w-2 rounded-[1px]",style:{background:`color-mix(in srgb, var(--u-fg-4) ${_M}%, transparent)`}}),"no schedule"]})]})}function sM(e,t){return t?0===e?"Everything is green.":`${e} ${1===e?"test is":"tests are"} failing.`:"Reading run history…"}function iM(){return Bn.jsx("div",{className:"grid h-full place-items-center px-6 py-10",children:Bn.jsxs("div",{className:"w-full max-w-[520px]",children:[Bn.jsxs("div",{className:"mb-6 flex items-center gap-2",children:[Bn.jsx(by,{name:"inspect",className:"h-4 w-4 text-fg-4"}),Bn.jsx("span",{className:"font-mono text-[11px] uppercase tracking-wider text-fg-4",children:"workspace"})]}),Bn.jsx("h1",{className:"font-mono text-[18px] font-medium tracking-tight text-fg-2",children:"No scenarios yet."}),Bn.jsx("p",{className:"mt-2 text-[13px] leading-relaxed text-fg-4",children:"Add one under the scenarios tree on the left, or record it from the command line. Every test you add shows up here as a tile."}),Bn.jsxs("div",{className:"mt-8 rounded border border-edge-soft bg-raised/50 p-3",children:[Bn.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-fg-4",children:[Bn.jsx(by,{name:"terminal",className:"h-3.5 w-3.5"}),Bn.jsx("span",{children:"Run from CLI:"})]}),Bn.jsxs("pre",{className:"mt-2 overflow-x-auto rounded bg-canvas p-2.5 font-mono text-[12px] text-fg-2",children:[Bn.jsx("span",{className:"text-fg-4",children:"$ "}),Bn.jsx("span",{className:"text-accent",children:"npx @unotest/web"})," e2e"," ",Bn.jsx("span",{className:"text-fg-2",children:"<scenario>"})]})]})]})})}function rM(e,t){const n=Ab(e);return n?Hb(Ib(n,t),t):"—"}function oM({records:e,collections:t,now:n}){const s=e.map(e=>{const t=Ab(e.cron);return{rec:e,tick:t?Ib(t,n):null}}).sort((e,t)=>(e.tick??1/0)-(t.tick??1/0));return Bn.jsxs("div",{className:"mt-2 rounded border border-edge-soft bg-raised/40 px-3 py-2",children:[Bn.jsxs("div",{className:"flex items-center gap-1.5 font-mono text-[10px] uppercase tracking-wider text-fg-4",children:[Bn.jsx(by,{name:"clock",className:"h-3 w-3"}),"upcoming ",Bn.jsx("span",{className:"normal-case tracking-normal",children:"· your clock"})]}),Bn.jsx("div",{className:"mt-1.5 flex flex-col gap-1",children:s.map(({rec:e,tick:s})=>{var i;const r="collection"===e.target.kind?(null==(i=t.find(t=>t.name===e.target.name))?void 0:i.scenarios.length)??0:null;return Bn.jsxs("div",{className:"flex items-baseline gap-2 font-mono text-[11px]",children:[Bn.jsx("span",{className:"shrink-0 tabular-nums text-fg-2",children:null===s?"—":Hb(s,n)}),Bn.jsx("span",{className:"truncate text-fg-2",children:e.target.name}),Bn.jsxs("span",{className:"truncate text-fg-4",children:["collection"===e.target.kind?"collection":"test"," ·"," ",JN(e),null!==r&&Bn.jsxs(Bn.Fragment,{children:[" → ",r," tests"]})]})]},`${e.target.kind}:${e.target.name}`)})})]})}const aM="min-w-max",lM=8,cM=3,hM=26,uM=104,dM=560,fM=250,pM=120;function vM({tiles:e,attach:t,field:n,cols:s,size:i,ready:r,now:o,mode:a,schedules:l}){const[c,h]=bn.useState(null),u=j_(),d=(e,t)=>{const s=e.currentTarget;if(!n)return;const i=fM/2,r=s.offsetLeft+s.offsetWidth/2,o=Math.max(i,n.clientWidth-i),a=s.offsetTop+s.offsetHeight,l=n.clientHeight-a<pM;h({row:t,x:Math.min(Math.max(r,i),o),y:l?n.clientHeight-s.offsetTop+lM:a+lM,above:l})};return Bn.jsxs("div",{ref:t,className:"relative mt-5 min-h-0 flex-1 overflow-y-auto",onMouseLeave:()=>h(null),children:[0===e.length?Bn.jsx("div",{className:"grid h-full place-items-center font-mono text-[11.5px] text-fg-4",children:"nothing matches"}):Bn.jsx("div",{className:"grid justify-center",style:{gridTemplateColumns:`repeat(${s}, ${i}px)`,gap:lM,padding:cM,visibility:r?"visible":"hidden"},children:e.map(e=>{const t=l.get(e.ref)??null;return Bn.jsx("button",{type:"button","aria-label":"schedule"===a?`${e.ref} — ${t?JN(t):"no schedule"}`:e.live?`${e.ref} — ${e.status}, ${"paused"===e.live?"paused":"running now"}`:`${e.ref} — ${e.status}, ${mN(e.lastAt)}`,"data-age":null===e.lastAt?void 0:VN(e.lastAt,o),onMouseEnter:t=>d(t,e),onFocus:t=>d(t,e),onClick:()=>function(e,t,n){"runs"===n&&null!==t.lastRunId?e.open({kind:"scenario-run",runId:t.lastRunId,ref:t.ref}):e.openScenario(t.path)}(u.tabs,e,a),style:{height:i,..."schedule"===a?SM(t,(null==c?void 0:c.row.ref)===e.ref):bM(e.status,VN(e.lastAt,o),(null==c?void 0:c.row.ref)===e.ref)},className:_y("rounded-md border transition-colors focus:outline-none","runs"===a&&"running"===e.live&&"uno-tile-live","runs"===a&&"paused"===e.live&&"uno-tile-still",(null==c?void 0:c.row.ref)===e.ref&&"ring-2 ring-accent")},e.ref)})}),c&&Bn.jsx(jM,{hover:c,mode:a,now:o,schedule:l.get(c.row.ref)??null})]})}const gM={passed:"--u-pass",failed:"--u-fail",expected:"--u-expected",running:"--u-warn",paused:"--u-warn",aborted:"--u-fg-4",pending:"--u-fg-4",never:"--u-fg-4"},mM=new Set(["never","pending","aborted"]),_M=12,xM=14;function bM(e,t,n){const s=mM.has(e)?_M:$N[t];return kM(gM[e],s,n)}const yM={m5:95,m15:85,h1:75,h2:65,h4:55,h6:45,h12:38,daily:30,weekly:22},wM=50;function SM(e,t){if(!e)return kM("--u-fg-4",_M,t);const n=Ab(e.cron);return kM("--u-accent",n?yM[n.freq]:wM,t)}function kM(e,t,n){const s=Math.min(t+(n?xM:0),100);return{background:`color-mix(in srgb, var(${e}) ${s}%, transparent)`,borderColor:`color-mix(in srgb, var(${e}) ${Math.min(Math.round(1.7*s),75)}%, transparent)`}}function CM({recent:e,expectFail:t}){const n=e=>{const n=tx(e);return n||"passed"===e?n===t?t?"bg-expected":"bg-pass":"bg-fail":"bg-fg-4/30"};return Bn.jsx("span",{className:"flex h-3.5 items-end gap-[3px]",children:e.map((e,t)=>Bn.jsx("span",{className:_y("h-full w-[5px] shrink-0 rounded-[1px]",n(e))},t))})}function jM({hover:e,mode:t,now:n,schedule:s}){const{row:i}=e,r=i.ref.lastIndexOf("/"),o=-1===r?"":i.ref.slice(0,r+1),a=-1===r?i.ref:i.ref.slice(r+1),l="passed"===i.status&&i.recent.some(tx),c=i.expectFail&&"failed"===i.status;return Bn.jsxs("div",{className:"pointer-events-none absolute z-20 -translate-x-1/2 rounded-md border border-edge-soft bg-overlay px-2.5 py-2 shadow-md",style:{left:e.x,width:fM,...e.above?{bottom:e.y}:{top:e.y}},children:[Bn.jsxs("div",{className:"flex items-center gap-1.5",children:["schedule"===t?Bn.jsx(by,{name:"clock",className:"h-3 w-3 shrink-0 text-fg-4"}):Bn.jsx(vN,{status:i.status,pulse:!1}),Bn.jsxs("span",{className:"truncate font-mono text-[11.5px] text-fg",children:[Bn.jsx("span",{className:"text-fg-4",children:o}),a]})]}),"schedule"===t?Bn.jsx(NM,{schedule:s,now:n}):Bn.jsx(MM,{r:i,flaky:l,unexpectedPass:c,schedule:s,now:n})]})}function NM({schedule:e,now:t}){return e?Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("div",{className:"mt-1 font-mono text-[10px] text-fg-2",children:JN(e)}),Bn.jsxs("div",{className:"mt-0.5 font-mono text-[10px] text-fg-4",children:[e.via&&Bn.jsxs(Bn.Fragment,{children:["via ",e.via," · "]}),"next ",rM(e.cron,t)," · your clock"]})]}):Bn.jsx("div",{className:"mt-1 font-mono text-[10px] text-fg-4",children:"no schedule — right-click the test to add one"})}function MM({r:e,flaky:t,unexpectedPass:n,schedule:s,now:i}){return Bn.jsxs(Bn.Fragment,{children:[Bn.jsxs("div",{className:"mt-1 flex items-center gap-1.5 font-mono text-[10px] text-fg-4",children:[e.live?Bn.jsx("span",{className:"text-warn",children:"paused"===e.live?"paused":"running now"}):Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("span",{children:null===e.lastAt?"never run":mN(e.lastAt)}),Bn.jsx("span",{children:"·"}),Bn.jsx("span",{children:gN(e.durationMs)})]}),e.failStreak>0&&"expected"!==e.status&&Bn.jsxs("span",{className:"text-fail",children:["· red ",e.failStreak," ",1===e.failStreak?"run":"runs"]}),t&&Bn.jsx("span",{className:"text-warn",children:"· flaky"})]}),s&&Bn.jsxs("div",{className:"mt-1 flex items-center gap-1 font-mono text-[10px] text-fg-4",children:[Bn.jsx(by,{name:"clock",className:"h-2.5 w-2.5"}),Bn.jsxs("span",{className:"truncate",children:[JN(s),s.via&&Bn.jsxs(Bn.Fragment,{children:[" · via ",s.via]}),` · next ${rM(s.cron,i)}`]})]}),"expected"===e.status&&Bn.jsx("div",{className:"mt-1 font-mono text-[10px] text-expected",children:"expected to fail · @expect-fail"}),n&&Bn.jsx("div",{className:"mt-1 font-mono text-[10px] text-fail",children:"passed, but it is marked @expect-fail"}),e.recent.length>0&&Bn.jsxs("div",{className:"mt-2 border-t border-edge-soft pt-2",children:[Bn.jsx(CM,{recent:e.recent,expectFail:e.expectFail}),Bn.jsxs("div",{className:"mt-1 font-mono text-[9.5px] text-fg-4",children:["last ",e.recent.length," runs · newest right"]})]})]})}function BM({label:e,name:t,value:n,dot:s,icon:i,active:r,onClick:o}){return Bn.jsxs("button",{type:"button",onClick:o,"aria-label":t,"aria-pressed":r,className:_y("px-4 py-3 text-left",r?"bg-selection/40":"bg-canvas hover:bg-raised/50"),children:[Bn.jsxs("div",{className:"flex items-center gap-1.5 font-mono text-[10.5px] uppercase tracking-wider text-fg-4",children:[s&&Bn.jsx(vN,{status:s,pulse:!1}),i&&Bn.jsx(by,{name:i,className:"h-3 w-3"}),Bn.jsx("span",{children:e})]}),Bn.jsx("div",{className:"mt-1 font-mono text-[22px] font-medium tabular-nums text-fg-2",children:n})]})}class DM extends bn.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`[viewer] ${this.props.label} failed to render`,e,t.componentStack)}componentDidUpdate(e){this.state.error&&e.resetKey!==this.props.resetKey&&this.setState({error:null})}render(){return this.state.error?Bn.jsxs("div",{className:"m-4 rounded border border-fail/30 bg-fail/5 px-3 py-2 font-mono text-[12px]","data-testid":"error-boundary",children:[Bn.jsxs("div",{className:"text-fail",children:[this.props.label," could not be shown"]}),Bn.jsx("pre",{className:"mt-1 whitespace-pre-wrap break-words text-fg-2",children:this.state.error.message})]}):this.props.children}}const LM="unotest.viewer.";function EM(e,t){var n;try{const s=null==(n=globalThis.localStorage)?void 0:n.getItem(LM+e);return null==s?t:JSON.parse(s)}catch{return t}}function PM(e,t){return t?`${e}.${t}`:e}function RM(e,t){var n;try{null==(n=globalThis.localStorage)||n.setItem(LM+e,JSON.stringify(t))}catch{}}const AM="annotations";class zM{constructor(){this.storageKey=AM;const e=EM(AM,{});this.open="object"!=typeof e||null===e||Array.isArray(e)?{}:{...e},$r(this,{storageKey:!1},{autoBind:!0})}isOpen(e){return this.open[e]}toggle(e,t){this.open={...this.open,[e]:!t}}toPersisted(){return{...this.open}}}function TM(e,t){return`${e}#${t}`}function IM(e){const t=[],n=e=>{for(const s of e)"step"===s.kind?t.push(s):"control"===s.kind?(t.push(s),n(s.children),s.elseChildren&&n(s.elseChildren)):n(s.children)};return n(e),t}function OM({annotations:e,depth:t,indentPx:n}){return Bn.jsx("div",{className:"border-l-2 border-edge-soft bg-raised/30 py-1 pr-4 font-mono text-[11.5px] leading-[1.5]",style:{marginLeft:n+14*Math.min(t,1),paddingLeft:10},"data-testid":"step-annotations",children:e.map((e,t)=>Bn.jsx(HM,{annotation:e},t))})}function HM({annotation:e}){return"note"===e.kind?Bn.jsxs("div",{className:"flex gap-2",children:[Bn.jsx("span",{className:"shrink-0 text-fg-3",children:e.label}),Bn.jsx("span",{className:"text-fg-4",children:"→"}),Bn.jsxs("span",{className:"min-w-0 whitespace-pre-wrap break-words text-fg",children:[e.text,e.truncated&&Bn.jsx("span",{className:"text-fg-4",children:" … (truncated)"})]})]}):"log"===e.kind?Bn.jsxs("div",{className:"flex gap-2",children:[Bn.jsx("span",{className:"shrink-0 text-fg-4",children:"log"}),Bn.jsxs("span",{className:"min-w-0 whitespace-pre-wrap break-words text-fg-2",children:[e.text,e.truncated&&Bn.jsx("span",{className:"text-fg-4",children:" … (truncated)"})]})]}):Bn.jsxs("div",{className:"flex gap-2","data-testid":"judge-verdict",children:[Bn.jsxs(dN,{tone:"pass"===e.verdict?"pass":"fail",size:"xs",children:["judge ","pass"===e.verdict?"✓":"✗"]}),Bn.jsx("span",{className:_y("min-w-0 truncate","fail"===e.verdict?"text-fail":"text-fg-2"),children:e.rubric}),Bn.jsx("span",{className:"text-fg-4",children:"·"}),Bn.jsx("span",{className:"min-w-0 truncate text-fg",title:e.reasoning,children:e.text})]})}function FM({status:e}){return"passed"===e?Bn.jsx("span",{className:"inline-flex h-4 w-4 items-center justify-center rounded-full bg-pass/10 text-pass",children:Bn.jsx(by,{name:"check",className:"h-3 w-3",strokeWidth:2.5})}):"failed"===e?Bn.jsx("span",{className:"inline-flex h-4 w-4 items-center justify-center rounded-full bg-fail/10 text-fail",children:Bn.jsx(by,{name:"x",className:"h-3 w-3",strokeWidth:2.5})}):"running"===e?Bn.jsx("span",{className:"inline-flex h-4 w-4 items-center justify-center rounded-full bg-warn/10 text-warn",children:Bn.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-current uno-pulse"})}):"aborted"===e?Bn.jsx("span",{className:"inline-flex h-4 w-4 items-center justify-center rounded-full bg-fg-4/10 text-fg-4",children:Bn.jsx(by,{name:"square",className:"h-3 w-3",strokeWidth:2.5})}):"paused"===e?Bn.jsx("span",{className:"inline-flex h-4 w-4 items-center justify-center rounded-full bg-warn/10 text-warn",children:Bn.jsx(by,{name:"pause",className:"h-2.5 w-2.5",strokeWidth:2.5})}):Bn.jsx("span",{className:"inline-flex h-4 w-4 items-center justify-center text-fg-4",children:Bn.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-current"})})}const WM=22;function UM(e){return Bn.jsxs("div",{className:"min-h-full bg-canvas py-1",children:[Bn.jsxs("div",{className:"flex items-center gap-3 py-1.5 pr-4 font-mono text-[10.5px] uppercase tracking-wider text-fg-4",style:{paddingLeft:34},children:[Bn.jsx("span",{className:"w-6 text-right",children:"#"}),Bn.jsx("span",{className:"w-4"}),Bn.jsx("span",{className:"flex-1",children:"step"}),Bn.jsx("span",{className:"w-12 text-right",children:"time"})]}),Bn.jsx("div",{className:"border-t border-edge-soft",children:e.body.map((t,n)=>Bn.jsx(KM,{node:t,depth:0,trace:e.trace,failedIndex:e.failedIndex,pausedIndex:e.pausedIndex,onFailedStepRender:e.onFailedStepRender,bpKeys:e.bpKeys,onToggleBp:e.onToggleBp,screenshots:e.screenshots,onOpenScreenshot:e.onOpenScreenshot,activeScreenshotIndex:e.activeScreenshotIndex,blocks:e.blocks,annotations:e.annotations,annotationsOpen:e.annotationsOpen,onToggleAnnotations:e.onToggleAnnotations},n))})]})}function KM(e){return"step"===e.node.kind?Bn.jsx(qM,{...e,node:e.node}):"control"===e.node.kind?Bn.jsx($M,{...e,node:e.node}):Bn.jsx(YM,{block:e.node,depth:e.depth,trace:e.trace,failedIndex:e.failedIndex,pausedIndex:e.pausedIndex,onFailedStepRender:e.onFailedStepRender,bpKeys:e.bpKeys,onToggleBp:e.onToggleBp,screenshots:e.screenshots,onOpenScreenshot:e.onOpenScreenshot,activeScreenshotIndex:e.activeScreenshotIndex,blocks:e.blocks,annotations:e.annotations,annotationsOpen:e.annotationsOpen,onToggleAnnotations:e.onToggleAnnotations})}function qM(e){var t,n,s,i;const r=e.node,o=null==(t=e.trace)?void 0:t[r.index],a=e.failedIndex===r.index,l=(null==(n=e.annotations)?void 0:n.get(r.index))??[],c=l.some(e=>"judge"===e.kind&&"fail"===e.verdict),h=a||c,[u,d]=bn.useState(h),f=(null==(s=e.annotationsOpen)?void 0:s.call(e,r.index))??(e.onToggleAnnotations?h:u);return Bn.jsxs(Bn.Fragment,{children:[Bn.jsx(GM,{step:r,depth:e.depth,status:(null==o?void 0:o.status)??(e.trace?"pending":void 0),durationMs:(null==o?void 0:o.durationMs)??null,isFailed:a,isPaused:e.pausedIndex===r.index,bpKeys:e.bpKeys,onToggleBp:e.onToggleBp,screenshotUrl:null==(i=e.screenshots)?void 0:i.get(r.index),onOpenScreenshot:e.onOpenScreenshot,isScreenshotActive:e.activeScreenshotIndex===r.index,annotationCount:l.length,annotationsOpen:f,onToggleAnnotations:()=>{e.onToggleAnnotations?e.onToggleAnnotations(r.index,f):d(e=>!e)}}),f&&l.length>0&&Bn.jsx(OM,{annotations:l,depth:e.depth,indentPx:34+14*e.depth}),a&&e.onFailedStepRender&&e.onFailedStepRender(r)]})}function $M({node:e,depth:t,trace:n,failedIndex:s,pausedIndex:i,onFailedStepRender:r,bpKeys:o,onToggleBp:a,screenshots:l,onOpenScreenshot:c,activeScreenshotIndex:h,blocks:u,annotations:d,annotationsOpen:f,onToggleAnnotations:p}){const v=null==n?void 0:n[e.index],g=e=>e.map((e,v)=>Bn.jsx(KM,{node:e,depth:t+1,trace:n,failedIndex:s,pausedIndex:i,onFailedStepRender:r,bpKeys:o,onToggleBp:a,screenshots:l,onOpenScreenshot:c,activeScreenshotIndex:h,blocks:u,annotations:d,annotationsOpen:f,onToggleAnnotations:p},v));return Bn.jsxs(Bn.Fragment,{children:[Bn.jsx(GM,{step:e,depth:t,status:(null==v?void 0:v.status)??(n?"pending":void 0),durationMs:(null==v?void 0:v.durationMs)??null,isFailed:s===e.index,isPaused:i===e.index,bpKeys:o,onToggleBp:a,screenshotUrl:null==l?void 0:l.get(e.index),onOpenScreenshot:c,isScreenshotActive:h===e.index}),s===e.index&&r&&r(e),g(e.children),e.elseChildren&&Bn.jsxs(Bn.Fragment,{children:[Bn.jsx(VM,{depth:t}),g(e.elseChildren)]})]})}function VM({depth:e}){return Bn.jsx("div",{className:"flex items-center py-1 font-mono text-[11px] italic text-fg-4",style:{paddingLeft:34+14*e},children:"else"})}function YM({block:e,depth:t,trace:n,failedIndex:s,pausedIndex:i,onFailedStepRender:r,bpKeys:o,onToggleBp:a,screenshots:l,onOpenScreenshot:c,activeScreenshotIndex:h,blocks:u,annotations:d,annotationsOpen:f,onToggleAnnotations:p}){const v=null==u?void 0:u.get(`${e.line}:${e.col}`),g=function(e,t){var n;if(!t)return"never";let s=!1,i=!1,r=!1,o=!1,a=!1;for(const l of IM(e)){const e=(null==(n=t[l.index])?void 0:n.status)??"pending";"failed"===e?s=!0:"running"===e?i=!0:"passed"===e?r=!0:"aborted"===e?a=!0:o=!0}return s?"failed":i?"running":a?"aborted":o&&r?"running":o?"pending":"passed"}(e.children,n),m="failed"!==(null==v?void 0:v.status)||"passed"!==g&&"pending"!==g?g:"failed",_=(null==v?void 0:v.durationMs)??function(e,t){var n;if(!t)return null;let s=0,i=!1;for(const r of IM(e)){const e=null==(n=t[r.index])?void 0:n.durationMs;null!=e&&(s+=e,i=!0)}return i?s:null}(e.children,n),x=(null==v?void 0:v.tag)??e.tagSource,b=!!n&&("failed"===m||"running"===m||"paused"===m),[y,w]=bn.useState(b),S=34+14*t;return Bn.jsxs(Bn.Fragment,{children:[Bn.jsxs("button",{type:"button",onClick:()=>w(e=>!e),className:_y("group relative flex w-full items-center gap-3 py-1.5 pr-4 text-left font-mono text-[12.5px] leading-[1.4]","failed"===m&&"bg-fail/5",("running"===m||"paused"===m)&&"bg-warn/5","failed"!==m&&"running"!==m&&"paused"!==m&&"hover:bg-raised/60"),style:{paddingLeft:S},children:[Bn.jsx("span",{"aria-hidden":!0,className:"pointer-events-none absolute inset-y-0 left-0 border-r border-edge-soft",style:{width:WM}}),Bn.jsx(XM,{depth:t,offset:WM}),Bn.jsx(by,{name:y?"chevronD":"chevronR",className:"h-3.5 w-3.5 shrink-0 text-fg-4",strokeWidth:2}),Bn.jsx("span",{className:"w-4 shrink-0",children:n?Bn.jsx(FM,{status:m}):Bn.jsx("span",{className:"block h-1.5 w-1.5 rounded-full bg-fg-4"})}),Bn.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-2",children:[Bn.jsx("span",{className:"truncate text-fg",children:e.title}),void 0!==x&&Bn.jsx(dN,{tone:"neutral",size:"xs",children:x}),e.soft&&Bn.jsx(dN,{tone:"failed"===m?"fail":"neutral",size:"xs",children:"soft"}),v&&v.softFailed>0&&Bn.jsxs("span",{className:"shrink-0 whitespace-nowrap text-[10.5px] tabular-nums text-fail","data-testid":"soft-rollup",children:[v.softFailed," of ",v.softTotal," soft failed"]})]}),Bn.jsx("span",{className:"w-12 shrink-0 text-right text-[11px] tabular-nums text-fg-2",children:gN(_)})]}),y&&e.children.map((e,v)=>Bn.jsx(KM,{node:e,depth:t+1,trace:n,failedIndex:s,pausedIndex:i,onFailedStepRender:r,bpKeys:o,onToggleBp:a,screenshots:l,onOpenScreenshot:c,activeScreenshotIndex:h,blocks:u,annotations:d,annotationsOpen:f,onToggleAnnotations:p},v))]})}function GM({step:e,depth:t,status:n,durationMs:s,isFailed:i,isPaused:r,bpKeys:o,onToggleBp:a,screenshotUrl:l,onOpenScreenshot:c,isScreenshotActive:h,annotationCount:u=0,annotationsOpen:d=!1,onToggleAnnotations:f,trailing:p}){const v="running"===n,g=34+14*t,m=`${e.line}:${e.col}`,_=!!(null==o?void 0:o.has(m)),x=!!a,b=bn.useRef(null);bn.useEffect(()=>{var e,t;h&&(null==(t=null==(e=b.current)?void 0:e.scrollIntoView)||t.call(e,{block:"nearest"}))},[h]);const y=!!l&&!!c;return Bn.jsx(Bn.Fragment,{children:Bn.jsxs("div",{ref:b,onClick:y?()=>c(e.index):void 0,className:_y("group relative flex items-center gap-3 py-1.5 pr-4 font-mono text-[12.5px] leading-[1.4]",y&&"cursor-pointer",h&&"bg-accent/10",v&&"bg-warn/10",r&&"bg-warn/15",i&&"bg-fail/10",!v&&!i&&!r&&"hover:bg-raised/60"),style:{paddingLeft:g},children:[Bn.jsx(XM,{depth:t,offset:WM}),Bn.jsx("span",{"aria-hidden":!0,className:"pointer-events-none absolute inset-y-0 left-0 border-r border-edge-soft",style:{width:WM}}),Bn.jsxs("button",{type:"button","aria-label":_?"Remove breakpoint":"Add breakpoint",disabled:!x,onClick:t=>{t.stopPropagation(),x&&a(e.line,e.col)},className:"absolute inset-y-0 left-0 grid place-items-center disabled:cursor-default",style:{width:WM},children:[r&&Bn.jsx(by,{name:"arrowR",className:"absolute h-3 w-3 text-warn"}),_?Bn.jsx(by,{name:"bp",className:_y("h-2.5 w-2.5",r?"text-fail/80":"text-fail")}):x&&!r&&Bn.jsx("span",{className:"hidden h-2.5 w-2.5 rounded-full ring-1 ring-fg-4 group-hover:block"})]}),Bn.jsx("span",{className:_y("absolute inset-y-0 w-[2px]",r||v?"bg-warn":i?"bg-fail":"bg-transparent"),style:{left:WM}}),Bn.jsxs("span",{className:"w-6 shrink-0 text-right text-[10.5px] tabular-nums text-fg-4",children:["#",e.index]}),Bn.jsx("span",{className:"w-4 shrink-0",children:n?Bn.jsx(FM,{status:n}):Bn.jsx("span",{className:"block h-1.5 w-1.5 rounded-full bg-fg-4"})}),Bn.jsxs("span",{className:"flex min-w-0 flex-1 items-baseline gap-2 overflow-hidden",children:[Bn.jsx("span",{className:"truncate",children:HN(e.source)}),Bn.jsxs("span",{className:"hidden shrink-0 text-[10.5px] tabular-nums text-fg-4 md:inline",children:["L",e.line]})]}),u>0&&Bn.jsxs("button",{type:"button","data-testid":"annotations-chip",title:d?"Hide notes":"Show notes",onClick:e=>{e.stopPropagation(),null==f||f()},className:_y("shrink-0 rounded border px-1 text-[10px] tabular-nums",d?"border-accent/40 bg-accent/10 text-accent":"border-edge-soft bg-raised text-fg-3 group-hover:text-fg-2"),children:["ⓘ ",u]}),p,l&&Bn.jsx(by,{name:"camera",className:_y("h-3.5 w-3.5 shrink-0",h?"text-accent":"text-fg-4 group-hover:text-fg-2")}),Bn.jsx("span",{className:"w-12 shrink-0 text-right text-[11px] tabular-nums text-fg-2",children:gN(s)})]})})}function XM({depth:e,offset:t=0}){return 0===e?null:Bn.jsx(Bn.Fragment,{children:Array.from({length:e}).map((e,n)=>Bn.jsx("span",{"aria-hidden":!0,className:"pointer-events-none absolute inset-y-0 w-px bg-edge-soft",style:{left:t+18+14*n}},n))})}const ZM=w_(function({store:e,scope:t,...n}){const s=e.open;return Bn.jsx(UM,{...n,annotationsOpen:e=>s[TM(t,e)],onToggleAnnotations:(n,s)=>e.toggle(TM(t,n),s)})});function JM(e,t){for(let n=e.length-1;n>=0;n--){const s=e[n],i=JM(s.children,t);if(i)return i;if("statement"===s.kind&&s.file===t.file&&s.line===t.line&&s.col===t.col)return s}return null}function QM(e,t,n){const s=null==e?void 0:e.files[t];return void 0===s?"":(s.split(/\r?\n/)[n-1]??"").trim()}function eB(e){for(let t=e.length-1;t>=0;t--){const n=e[t],s=eB(n.children);if(s)return s;if("statement"===n.kind&&"running"!==n.status)return n}return null}function tB(e){for(const t of e){if("failed"!==t.status)continue;const e=tB(t.children);if(e)return e;if("statement"===t.kind)return t}return null}function nB(e){return Bn.jsxs("div",{className:"min-h-full bg-canvas py-1",children:[Bn.jsxs("div",{className:"flex items-center gap-3 py-1.5 pr-4 font-mono text-[10.5px] uppercase tracking-wider text-fg-4",style:{paddingLeft:34},children:[Bn.jsx("span",{className:"w-6 text-right",children:"#"}),Bn.jsx("span",{className:"w-4"}),Bn.jsx("span",{className:"flex-1",children:"trace"}),Bn.jsx("span",{className:"w-12 text-right",children:"time"})]}),Bn.jsx("div",{className:"border-t border-edge-soft",children:e.nodes.map(t=>Bn.jsx(sB,{node:t,depth:0,...e},t.id))})]})}function sB({node:e,depth:t,...n}){return"statement"===e.kind?Bn.jsx(iB,{node:e,depth:t,...n}):Bn.jsx(rB,{node:e,depth:t,...n})}function iB({node:e,depth:t,...n}){var s;const i=function(e){return"statement"===e.kind&&e.children.some(t=>"iteration"!==t.kind&&t.file!==e.file)}(e),[r,o]=bn.useState("failed"===e.status||"running"===e.status),[a,l]=bn.useState("failed"===e.status||e.annotations.some(e=>"judge"===e.kind&&"fail"===e.verdict)),c=34+14*t,h={index:e.id,line:e.line,col:e.col,source:e.source||`${e.file}:${e.line}`};return Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("div",{className:"group","data-testid":"trace-statement",onDoubleClick:n.onOpenCode?()=>n.onOpenCode(e.file,e.line):void 0,title:n.onOpenCode?`${e.file}:${e.line} — double-click to open in Code`:void 0,children:Bn.jsx(GM,{step:h,depth:t,status:e.status,durationMs:e.durationMs,isFailed:n.failedId===e.id,screenshotUrl:null==(s=n.screenshots)?void 0:s.get(e.id),onOpenScreenshot:n.onOpenScreenshot,isScreenshotActive:n.activeScreenshotId===e.id,annotationCount:e.annotations.length,annotationsOpen:a,onToggleAnnotations:()=>l(e=>!e),trailing:Bn.jsxs(Bn.Fragment,{children:[i?Bn.jsxs("button",{type:"button","data-testid":"trace-fold",onClick:e=>{e.stopPropagation(),o(e=>!e)},className:"flex shrink-0 items-center gap-1 whitespace-nowrap rounded border border-edge-soft bg-raised px-1 font-mono text-[10px] text-fg-3 hover:text-fg",children:[Bn.jsx(by,{name:r?"chevronD":"chevronR",className:"h-3 w-3"}),Bn.jsx(oB,{node:e})]}):e.children.length>0&&Bn.jsx(oB,{node:e}),!e.isEntry&&Bn.jsx("span",{className:"max-w-[10rem] shrink-0 truncate font-mono text-[9.5px] text-fg-4","data-testid":"trace-file",children:aB(e.file)})]})})}),a&&e.annotations.length>0&&Bn.jsx(OM,{annotations:e.annotations,depth:t,indentPx:c}),n.failedId===e.id&&n.onFailedRender&&n.onFailedRender(e),i&&r&&e.children.map(e=>Bn.jsx(sB,{node:e,depth:t+1,...n},e.id)),!i&&e.children.map(e=>Bn.jsx(sB,{node:e,depth:t+1,...n},e.id))]})}function rB({node:e,depth:t,...n}){const[s,i]=bn.useState("block"===e.kind||"failed"===e.status||"running"===e.status),r=34+14*t,o="block"===e.kind?e.label:`iteration ${e.index+1}`;return Bn.jsxs(Bn.Fragment,{children:[Bn.jsxs("button",{type:"button",onClick:()=>i(e=>!e),"data-testid":"block"===e.kind?"trace-block":"trace-iteration",className:_y("group relative flex w-full items-center gap-3 py-1.5 pr-4 text-left font-mono text-[12.5px] leading-[1.4]","failed"===e.status&&"bg-fail/5","running"===e.status&&"bg-warn/5","failed"!==e.status&&"running"!==e.status&&"hover:bg-raised/60"),style:{paddingLeft:r},children:[Bn.jsx("span",{"aria-hidden":!0,className:"pointer-events-none absolute inset-y-0 left-0 border-r border-edge-soft",style:{width:WM}}),Bn.jsx(XM,{depth:t,offset:WM}),Bn.jsx(by,{name:s?"chevronD":"chevronR",className:"h-3.5 w-3.5 shrink-0 text-fg-4",strokeWidth:2}),Bn.jsx("span",{className:"w-4 shrink-0",children:Bn.jsx(FM,{status:e.status})}),Bn.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-2",children:[Bn.jsx("span",{className:_y("truncate","iteration"===e.kind?"text-fg-2":"text-fg"),children:o}),"block"===e.kind&&void 0!==e.tag&&Bn.jsx(dN,{tone:"neutral",size:"xs",children:e.tag}),"block"===e.kind&&e.soft&&Bn.jsx(dN,{tone:"failed"===e.status?"fail":"neutral",size:"xs",children:"soft"}),!s&&Bn.jsx(oB,{node:e})]}),Bn.jsx("span",{className:"w-12 shrink-0 text-right text-[11px] tabular-nums text-fg-2",children:gN(e.durationMs)})]}),s&&e.children.map(e=>Bn.jsx(sB,{node:e,depth:t+1,...n},e.id))]})}function oB({node:e}){const{total:t,failed:n,unit:s}=function(e){const t=e.children.filter(e=>"iteration"===e.kind);if(t.length>0)return{total:t.length,failed:t.filter(e=>"failed"===e.status).length,unit:"iteration"};const n=e.children.filter(e=>"block"===e.kind),s=n.length>0?n:e.children;return{total:s.length,failed:s.filter(e=>"failed"===e.status).length,unit:n.length>0?"step":"statement"}}(e);return 0===t?null:Bn.jsxs("span",{className:_y("shrink-0 whitespace-nowrap text-[10.5px] tabular-nums",n>0?"text-fail":"text-fg-3"),"data-testid":"trace-summary",children:[t," ",s,1===t?"":"s",n>0?` · ${n} failed`:""]})}function aB(e){return e.split("/").slice(-2).join("/")}function lB({strip:e,position:t,onNavigate:n,onClose:s}){const i=e[t],r=t>0,o=t<e.length-1;return bn.useEffect(()=>{const e=e=>{if("Escape"===e.key)s();else if("ArrowLeft"===e.key&&r)n(t-1);else{if("ArrowRight"!==e.key||!o)return;n(t+1)}e.preventDefault()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[s,n,t,r,o]),i?Bn.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Step screenshot",className:"fixed inset-0 z-50 flex flex-col bg-black/30 backdrop-blur-[3px]",onMouseDown:s,children:[Bn.jsxs("div",{className:"flex shrink-0 items-center justify-between px-4 py-3",children:[Bn.jsxs("span",{className:"rounded-full bg-black/60 px-2.5 py-1 font-mono text-[11.5px] tabular-nums text-white/80",children:[t+1," / ",e.length]}),Bn.jsx("button",{type:"button","aria-label":"Close",onMouseDown:e=>e.stopPropagation(),onClick:s,className:"grid h-8 w-8 place-items-center rounded-full bg-black/60 text-white/80 hover:bg-black/80 hover:text-white",children:Bn.jsx(by,{name:"x",className:"h-4 w-4"})})]}),Bn.jsxs("div",{className:"flex min-h-0 flex-1 items-center gap-3 px-3 sm:gap-5 sm:px-5",children:[Bn.jsx(cB,{direction:"prev",disabled:!r,onClick:()=>n(t-1)}),Bn.jsxs("figure",{className:"flex min-h-0 flex-1 flex-col items-center gap-4",onMouseDown:e=>e.stopPropagation(),children:[Bn.jsx("img",{src:i.url,alt:`step #${i.stepIndex} screenshot`,className:"min-h-0 max-w-full flex-1 rounded-lg object-contain shadow-2xl ring-1 ring-white/25"}),Bn.jsxs("figcaption",{className:"w-full max-w-3xl shrink-0 rounded-lg bg-black/65 px-4 py-2 text-center",children:[i.blockTitle&&Bn.jsx("div",{className:"truncate text-[13px] font-medium text-white",children:i.blockTitle}),Bn.jsxs("div",{className:"mt-1 flex items-baseline justify-center gap-2 font-mono text-[12px] text-white/80",children:[Bn.jsx("span",{className:"truncate",children:i.source}),Bn.jsxs("span",{className:"shrink-0 text-[10.5px] tabular-nums text-white/55",children:["L",i.line]})]})]})]}),Bn.jsx(cB,{direction:"next",disabled:!o,onClick:()=>n(t+1)})]}),Bn.jsx("div",{className:"shrink-0 pb-4 pt-3 text-center",children:Bn.jsx("span",{className:"rounded-full bg-black/60 px-3 py-1 font-mono text-[10.5px] uppercase tracking-wider text-white/70",children:"← → to move · esc to close"})})]}):null}function cB({direction:e,disabled:t,onClick:n}){return Bn.jsx("button",{type:"button","aria-label":"prev"===e?"Previous screenshot":"Next screenshot",disabled:t,onMouseDown:e=>e.stopPropagation(),onClick:n,className:_y("grid h-11 w-11 shrink-0 place-items-center rounded-full transition",t?"cursor-default bg-black/25 text-white/30":"bg-black/60 text-white/90 hover:bg-black/85 hover:text-white"),children:Bn.jsx(by,{name:"chevronR",className:_y("h-5 w-5","prev"===e&&"rotate-180"),strokeWidth:2})})}async function hB(e){var t;try{if(null==(t=navigator.clipboard)?void 0:t.writeText)return await navigator.clipboard.writeText(e),!0}catch{}return function(e){const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.top="-9999px",t.style.opacity="0",document.body.appendChild(t);const n=document.getSelection(),s=n&&n.rangeCount>0?n.getRangeAt(0):null;t.select();let i=!1;try{i=document.execCommand("copy")}catch{i=!1}document.body.removeChild(t),s&&n&&(n.removeAllRanges(),n.addRange(s));return i}(e)}function uB(e){const[t,n]=bn.useState("idle"),s=bn.useRef(void 0);bn.useEffect(()=>()=>clearTimeout(s.current),[]);return Bn.jsxs("div",{className:"mx-4 my-2 overflow-hidden rounded border border-fail/30 bg-fail/10",children:[Bn.jsxs("div",{className:"border-b border-fail/30 px-3 py-1.5",children:[Bn.jsxs("div",{className:"flex items-center gap-2",children:[Bn.jsx(by,{name:"alert",className:"h-3.5 w-3.5 text-fail"}),Bn.jsx(dN,{tone:"fail",children:e.errorName.toUpperCase()}),Bn.jsxs("span",{className:"ml-auto font-mono text-[10.5px] text-fg-2",children:["step #",e.index]})]}),e.url&&Bn.jsxs("button",{type:"button",title:"fail"===t?"Copy failed":"Copy URL",className:"mt-1 flex max-w-full cursor-pointer items-center gap-1.5 truncate font-mono text-[11.5px] font-medium text-fg underline decoration-fail/50 decoration-dotted hover:decoration-fail",onClick:()=>{const t=e.url;t&&hB(t).then(e=>{n(e?"ok":"fail"),clearTimeout(s.current),s.current=setTimeout(()=>n("idle"),1600)})},children:[Bn.jsx(by,{name:"ok"===t?"check":"fail"===t?"alert":"copy",className:"ok"===t?"h-3.5 w-3.5 shrink-0 text-pass":"h-3.5 w-3.5 shrink-0"}),Bn.jsx("span",{className:"truncate",children:e.url}),"idle"!==t&&Bn.jsx("span",{className:"ok"===t?"shrink-0 text-pass no-underline":"shrink-0 text-fail no-underline",children:"ok"===t?"Copied!":"Copy failed"})]})]}),Bn.jsxs("div",{className:"px-3 py-2",children:[Bn.jsx("pre",{className:"whitespace-pre-wrap break-words font-mono text-[12px] leading-relaxed text-fg",children:e.message}),e.verdict&&Bn.jsxs("dl",{className:"mt-2 grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 font-mono text-[11.5px]","data-testid":"error-verdict",children:[Bn.jsx("dt",{className:"text-fg-3",children:"rubric"}),Bn.jsx("dd",{className:"whitespace-pre-wrap break-words text-fg",children:e.verdict.rubric}),Bn.jsx("dt",{className:"text-fg-3",children:"text"}),Bn.jsx("dd",{className:"whitespace-pre-wrap break-words text-fg",children:e.verdict.text}),Bn.jsx("dt",{className:"text-fg-3",children:"judge"}),Bn.jsx("dd",{className:"whitespace-pre-wrap break-words text-fail",children:e.verdict.reasoning}),Bn.jsx("dt",{className:"text-fg-3",children:"model"}),Bn.jsx("dd",{className:"text-fg-2",children:e.verdict.model})]}),Bn.jsxs("div",{className:"mt-2 flex items-center gap-2 truncate font-mono text-[11px] text-fg-2",children:[Bn.jsx(by,{name:"file",className:"h-3.5 w-3.5"}),Bn.jsxs("span",{children:[e.file,":",e.line]}),Bn.jsx("span",{className:"text-fg-4",children:"·"}),Bn.jsx("span",{className:"truncate",children:e.source})]})]})]})}const dB=/\x1b\[[\d;]*[a-zA-Z]/g;class fB{constructor(e){this.rest=e,this.byRunId=new Map,this.collectionByRunId=new Map,$r(this,{},{autoBind:!0})}get list(){return[...this.byRunId.values()]}get activeList(){return[...this.byRunId.values()].filter(e=>"starting"===e.status||"running"===e.status||"paused"===e.status)}get queuedList(){return[...this.byRunId.values()].filter(e=>"queued"===e.status)}get liveRefs(){const e=new Map;for(const t of this.activeList)t.scenario&&("paused"===t.status?e.set(t.scenario,"paused"):e.has(t.scenario)||e.set(t.scenario,"running"));return e}get activeCollectionList(){return[...this.collectionByRunId.values()].filter(e=>"starting"===e.status||"running"===e.status)}get queuedCollectionList(){return[...this.collectionByRunId.values()].filter(e=>"queued"===e.status)}get hasActive(){return this.activeList.length>0||this.activeCollectionList.length>0}reconcileWithRuns(e){for(const t of e)if("running"!==t.status&&null!==t.outcome)if("collection"===t.kind){const e=this.collectionByRunId.get(t.runId);!e||"queued"!==e.status&&"starting"!==e.status&&"running"!==e.status||(e.status=this.statusFromOutcome(t.outcome),e.outcome=t.outcome)}else{const e=this.byRunId.get(t.runId);!e||"queued"!==e.status&&"starting"!==e.status&&"running"!==e.status||(e.status=this.statusFromOutcome(t.outcome),e.outcome=t.outcome)}}async hydrateRunning(){let e;try{e=await this.rest.runsRunning()}catch{return}await Promise.all(e.map(e=>this.hydrateRun(e)))}isHydrated(e){if("collection"===e.kind){const t=this.collectionByRunId.get(e.runId);return void 0!==t&&""!==t.collection}const t=this.byRunId.get(e.runId);return void 0!==t&&""!==t.scenario}async hydrateRun(e){if(this.isHydrated(e))return;let t;try{t=await this.rest.runDetail(e.runId)}catch{return}pr(()=>{var n,s;if(this.isHydrated(e))return;const i=t.events,r=e=>i.some(t=>t.kind===e.kind&&t.t===e.t);if(function(e){return"collection"===e.meta.kind}(t)){const s=(null==(n=this.collectionByRunId.get(e.runId))?void 0:n.events)??[];this.collectionByRunId.delete(e.runId);for(const n of t.events)this.applyCollectionStep(e.runId,n);for(const t of s)r(t)||this.applyCollectionStep(e.runId,t);this.ensureCollection(e.runId,t.meta.ref).startedAt=e.startedAt}else{const n=(null==(s=this.byRunId.get(e.runId))?void 0:s.events)??[];this.byRunId.delete(e.runId);for(const s of t.events)this.applyStep(e.runId,s);for(const t of n)r(t)||this.applyStep(e.runId,t);this.ensure(e.runId,t.meta.ref).startedAt=e.startedAt}})}applyWsMessage(e){switch(e.kind){case"fs:run-started":if(this.collectionByRunId.has(e.runId))return;return void this.ensure(e.runId,e.scenario);case"fs:run-step":return void this.applyStep(e.runId,e.event);case"fs:collection-run-step":return void this.applyCollectionStep(e.runId,e.event);case"fs:run-finished":return void this.applyFinished(e.runId,e.outcome);case"log:line":if(this.collectionByRunId.has(e.runId))return;return void function(e,t,n){const s=(r=n,r.replace(dB,"")),i=Date.now();var r;if(""===s.trim())return void(e.logs.length>0&&(e.logs[e.logs.length-1].receivedAt=0));const o=function(e,t){return"stderr"===e?"error":/^(warn|warning|⚠)\b/i.test(t)?"warn":"log"}(t,s),a=e.logs[e.logs.length-1];if(a&&a.stream===t&&a.level===o&&i-a.receivedAt<100)return a.text+="\n"+s,void(a.receivedAt=i);e.logs.push({stream:t,level:o,text:s,at:pB(i),receivedAt:i})}(this.ensure(e.runId,""),e.stream,e.line);default:return}}async startScenario(e,t={}){const n=await this.rest.startRun({kind:"scenario",scenario:e,...void 0!==t.headed?{headed:t.headed}:{},...void 0!==t.debug?{debug:t.debug}:{},...t.breakpoints&&t.breakpoints.length>0?{breakpoints:t.breakpoints}:{}}),s=this.ensure(n.runId,n.ref);return s.status="queued"===n.status?"queued":"starting",s.plainRun=!t.debug,{runId:n.runId,scenario:n.ref}}async startAuthoring(e){const t=await this.rest.startRun({kind:"authoring",scenario:e,headed:!0}),n=this.ensure(t.runId,t.ref);return n.status="queued"===t.status?"queued":"starting",n.mode="authoring",{runId:t.runId,scenario:t.ref}}async startCollection(e,t={}){const n=await this.rest.startRun({kind:"collection",collection:e,...void 0!==t.headed?{headed:t.headed}:{},...void 0!==t.workers?{workers:t.workers}:{},...void 0!==t.bail?{bail:t.bail}:{}});return this.ensureCollection(n.runId,n.ref).status="queued"===n.status?"queued":"starting",{runId:n.runId,collection:n.ref}}async abort(e){try{await this.rest.abortRun(e)}catch{try{await this.rest.dbgCommand(e,{cmd:"abort"})}catch{}}}async step(e){await this.rest.dbgCommand(e,{cmd:"step"})}async continueRun(e){await this.stopPicker(e),await this.rest.dbgCommand(e,{cmd:"continue"})}async togglePicker(e,t){const n=this.byRunId.get(e);(null==n?void 0:n.picker.active)&&n.picker.mode===t?await this.stopPicker(e):await this.startPicker(e,t)}async startPicker(e,t){const n=this.byRunId.get(e),s=(null==n?void 0:n.picker.execute)??!1;n&&(n.picker={active:!0,mode:t,execute:s}),await this.rest.dbgCommand(e,{cmd:"picker:start",mode:t,execute:s})}async setPickerExecute(e,t){const n=this.byRunId.get(e);n&&(n.picker={...n.picker,execute:t},n.picker.active&&await this.rest.dbgCommand(e,{cmd:"picker:start",mode:n.picker.mode,execute:t}))}async stopPicker(e){const t=this.byRunId.get(e);t&&t.picker.active&&(t.picker={active:!1,mode:t.picker.mode,execute:t.picker.execute},await this.rest.dbgCommand(e,{cmd:"picker:stop"}))}async pauseRun(e){await this.rest.dbgCommand(e,{cmd:"pause"})}async setWheel(e,t){const n=this.byRunId.get(e);n&&(n.wheel=t),await this.rest.dbgCommand(e,{cmd:"wheel",owner:t})}async requestSnapshot(e){await this.rest.dbgCommand(e,{cmd:"snapshot"})}async probe(e,t){const n=this.byRunId.get(e);if(!n)return;const s=crypto.randomUUID();n.consoleEntries.push({id:s,at:pB(Date.now()),input:t,status:"pending"}),setTimeout(()=>this.markProbeStale(e,s),1e4);try{await this.rest.dbgCommand(e,{cmd:"probe",locator:t,id:s})}catch{this.markProbeStale(e,s)}}markProbeStale(e,t){var n;const s=null==(n=this.byRunId.get(e))?void 0:n.consoleEntries.find(e=>e.id===t);s&&"pending"===s.status&&(s.status="stale")}async setBreakpoint(e,t,n){await this.rest.dbgCommand(e,{cmd:"set-bp",line:t,col:n})}async clearBreakpoint(e,t,n){await this.rest.dbgCommand(e,{cmd:"clear-bp",line:t,col:n})}findActiveByScenario(e){for(const t of this.byRunId.values())if(t.scenario===e&&("starting"===t.status||"running"===t.status||"paused"===t.status))return t;return null}async syncRuntime(e){let t=null;try{t=await this.rest.runtime(e)}catch{return}pr(()=>{var n;const s=this.ensure(e,t.scenario);if(s.vars=t.vars,s.callStack=t.callStack,s.wheel=t.wheel??"human",s.mode=t.mode??"debug",s.breakpoints=t.breakpoints??[],"completed"===(i=s.status)||"failed"===i||"aborted"===i)return;var i;const r=t.state;"paused-step"!==r&&"paused-failure"!==r&&"paused-breakpoint"!==r||(s.status="paused",t.current&&(s.pausedAt={reason:"paused-breakpoint"===r?"breakpoint":"paused-failure"===r?"failure":"step",file:(null==(n=t.callStack.at(-1))?void 0:n.file)??null,line:t.current.line,col:t.current.col}))})}ensureCollection(e,t){let n=this.collectionByRunId.get(e);if(n)t&&!n.collection&&(n.collection=t);else{this.byRunId.delete(e);const s={runId:e,collection:t,startedAt:Date.now(),status:"starting",scenarios:[],childRunIds:new Map,childOutcomes:new Map,outcome:null,events:[]};this.collectionByRunId.set(e,s),n=this.collectionByRunId.get(e)}return n}ensure(e,t){let n=this.byRunId.get(e);if(n)t&&!n.scenario&&(n.scenario=t);else{const s={runId:e,scenario:t,startedAt:Date.now(),status:"starting",events:[],logs:[],outcome:null,pausedAt:null,vars:{},callStack:[],picker:{active:!1,mode:"locator",execute:!1},wheel:"human",mode:"debug",breakpoints:[],plainRun:!1,consoleEntries:[],toolCalls:[]};this.byRunId.set(e,s),n=this.byRunId.get(e)}return n}applyStep(e,t){const n=this.ensure(e,"");if("locator:picked"!==t.kind)if("wheel:changed"!==t.kind){if("probe:result"===t.kind){const e=n.consoleEntries.find(e=>e.id===t.id);return void(e&&(e.status="done",e.result=t.result))}if("tool:call"!==t.kind){if("tool:result"===t.kind){const e=n.toolCalls.find(e=>e.callId===t.callId),s={status:t.ok?"ok":"error",durationMs:t.durationMs,preview:t.preview,...t.error?{error:t.error}:{}};return void(e?Object.assign(e,s):n.toolCalls.push({callId:t.callId,at:pB(t.t),tool:t.tool,args:"",...s}))}n.events.push(t),"run:started"===t.kind?(n.status="running",t.scenario&&(n.scenario=t.scenario)):"run:finished"===t.kind?(n.status=this.statusFromOutcome(t.outcome),n.outcome=t.outcome,n.pausedAt=null,n.picker={active:!1,mode:n.picker.mode,execute:n.picker.execute}):"paused"===t.kind?(n.status="paused",n.pausedAt={reason:t.reason,file:t.file,line:t.line,col:t.col},t.snapshot&&(n.vars=t.snapshot.vars,n.callStack=t.snapshot.callStack)):"resumed"!==t.kind&&"step:started"!==t.kind||("paused"===n.status&&(n.status="running"),n.pausedAt=null)}else n.toolCalls.push({callId:t.callId,at:pB(t.t),tool:t.tool,args:t.args,status:"running"})}else n.wheel=t.owner}applyCollectionStep(e,t){pr(()=>{const n=this.ensureCollection(e,"");switch(n.events.push(t),t.kind){case"collection-run:started":return n.status="running",n.collection=t.collection,void(n.scenarios=[...t.scenarios]);case"collection-run:scenario-started":return void n.childRunIds.set(t.scenario,t.scenarioRunId);case"collection-run:scenario-finished":return void n.childOutcomes.set(t.scenario,t.outcome);case"collection-run:finished":return n.status=this.statusFromOutcome(t.outcome),void(n.outcome=t.outcome)}})}applyFinished(e,t){const n=this.collectionByRunId.get(e);if(n)return n.status=this.statusFromOutcome(t),void(n.outcome=t);const s=this.byRunId.get(e);s&&(s.status=this.statusFromOutcome(t),s.outcome=t)}statusFromOutcome(e){switch(e){case"completed":return"completed";case"failed":return"failed";case"aborted":case"interrupted":return"aborted"}}}function pB(e){return new Date(e).toISOString().slice(11,23)}function vB(e,t){for(let n=e.length-1;n>=0;n--){const s=e[n];if(s.kind===t)return s}return null}class gB{constructor(e){this.runId=e}url(e){const[t,n]="event"===e.kind?["path",e.path]:["file",e.file];return`/api/runs/${encodeURIComponent(this.runId)}/asset?${t}=${encodeURIComponent(n)}`}resolveUrl(e){return this.url(e)}async loadText(e){return mB(this.url(e))}}async function mB(e){try{const t=await fetch(e);return t.ok?{ok:!0,text:await t.text()}:{ok:!1}}catch{return{ok:!1}}}class _B{constructor(e){this.snapshotId=e}url(e){return`/api/snapshots/${encodeURIComponent(this.snapshotId)}/asset?key=${encodeURIComponent(function(e){const t="event"===e.kind?e.path:e.file;return t.split("/").pop()??t}(e))}`}resolveUrl(e){return this.url(e)}async loadText(e){return mB(this.url(e))}}const xB=bn.createContext(null);function bB(e){const t=bn.useContext(xB);return bn.useMemo(()=>t??new gB(e),[t,e])}function yB({children:e}){return Bn.jsx("div",{className:"px-3 py-6 text-center font-mono text-[11.5px] text-fg-4",children:e})}const wB=[{id:"screenshot",label:"Screenshot",icon:"camera"},{id:"dom",label:"Semantic DOM",icon:"tree"}],SB=w_(function({runId:e,active:t,events:n,isFailed:s,runFinished:i,varsOverride:r,fill:o=!1}){const a=j_(),l=vB(n,"failure-bundle:written"),c=null!=t&&("paused"===t.status||"running"===t.status||"starting"===t.status);bn.useEffect(()=>{c||r||a.runtimeSnapshots.loadIfNeeded(e)},[a,e,c,r]);const h=a.runtimeSnapshots.get(e),u=r??(c&&t?t.vars:(null==h?void 0:h.vars)??(null==t?void 0:t.vars)??{}),d=Object.keys(u).length>0,f=bn.useMemo(()=>{const e=[];if((null!=t||d)&&e.push({id:"vars",label:"Vars",icon:"variable"}),s?e.push(...wB):(t&&t.callStack.length>0&&e.push({id:"callstack",label:"Call stack",icon:"layers"}),null!=t&&e.push({id:"snapshot",label:"Snapshot",icon:"tree"})),e.push({id:"system",label:"System",icon:"activity"}),e.push({id:"console",label:"Console",icon:"terminal"}),e.push({id:"network",label:"Network",icon:"network"}),e.push({id:"trace",label:"Events",icon:"code"}),!s&&null!=t){const t=a.breakpoints.all().reduce((e,t)=>e+t.keys.length,0);e.push({id:"breakpoints",label:"Breakpoints",icon:"bp",count:t})}return e},[d,s,t,null==t?void 0:t.callStack,a.breakpoints]),[p,v]=bn.useState(f[0].id);bn.useEffect(()=>{f.some(e=>e.id===p)||v(f[0].id)},[f,p]);const g=a.layout,m=Ry({value:g.inspectorWidth,onChange:g.setInspectorWidth,axis:"x",dir:-1,min:g.inspectorMin,max:()=>Math.round(.6*window.innerWidth)}),_=Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("div",{className:"uno-thin-scroll flex h-9 shrink-0 items-center gap-0.5 overflow-x-auto border-b border-edge px-1",children:f.map(e=>{const t=e.id===p;return Bn.jsxs("button",{type:"button",onClick:()=>v(e.id),className:_y("relative flex h-8 shrink-0 items-center gap-1.5 rounded px-2 text-[12px]",t?"text-fg":"text-fg-3 hover:bg-raised/60 hover:text-fg"),children:[Bn.jsx(by,{name:e.icon,className:"h-3.5 w-3.5"}),e.label,null!=e.count&&e.count>0&&Bn.jsx("span",{className:"grid h-[15px] min-w-[15px] place-items-center rounded-full bg-raised px-1 font-mono text-[9.5px] text-fg-3",children:e.count}),t&&Bn.jsx("span",{className:"absolute inset-x-1.5 bottom-0 h-0.5 rounded-full bg-accent"})]},e.id)})}),Bn.jsxs("div",{className:"flex-1 overflow-y-auto bg-canvas",children:["vars"===p&&Bn.jsx(kB,{vars:u}),"callstack"===p&&t&&Bn.jsx(CB,{frames:t.callStack}),"breakpoints"===p&&Bn.jsx(jB,{}),"screenshot"===p&&Bn.jsx(DB,{runId:e,bundle:l}),"system"===p&&Bn.jsx(AB,{active:t,events:n}),"console"===p&&Bn.jsx(HB,{runId:e,runFinished:i}),"snapshot"===p&&Bn.jsx(UB,{runId:e}),"dom"===p&&Bn.jsx(WB,{runId:e,bundle:l}),"network"===p&&Bn.jsx(KB,{runId:e,runFinished:i}),"trace"===p&&Bn.jsx(XB,{events:n})]})]});return o?Bn.jsx("div",{className:"relative flex h-full min-w-0 flex-1 flex-col bg-panel",children:_}):Bn.jsxs("aside",{className:"relative flex shrink-0",style:{width:g.inspectorWidth},children:[Bn.jsx(Ty,{axis:"x",onPointerDown:m,className:"-left-[6px]"}),Bn.jsx("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden rounded-l-lg bg-panel",children:_})]})});function kB({vars:e}){const t=Object.entries(e);return 0===t.length?Bn.jsx(yB,{children:"no vars in scope yet"}):Bn.jsxs("div",{className:"divide-y divide-edge-soft",children:[Bn.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5",children:[Bn.jsx("span",{className:"font-mono text-[10.5px] uppercase tracking-wider text-fg-4",children:"runtime vars"}),Bn.jsx("span",{className:"font-mono text-[10.5px] text-fg-4",children:t.length})]}),t.map(([e,t])=>{const n=t.startsWith("<Locator")?"Locator":t.startsWith("{")?"Object":t.startsWith("[")?"Array":t.startsWith('"')?"string":/^-?\d/.test(t)?"number":"value";return Bn.jsxs("div",{className:"flex items-baseline gap-2 px-3 py-1.5",children:[Bn.jsx("span",{className:"shrink-0 font-mono text-[12.5px] text-fg",children:e}),Bn.jsx("span",{className:"min-w-0 flex-1 break-all font-mono text-[12px] text-fg-2",children:t}),Bn.jsx("span",{className:"shrink-0 font-mono text-[10.5px] text-fg-4",children:n})]},e)})]})}function CB({frames:e}){return 0===e.length?Bn.jsx(yB,{children:"not inside a helper · top-level frame"}):Bn.jsxs("div",{className:"divide-y divide-edge-soft",children:[Bn.jsxs("div",{className:"flex items-center justify-between border-b border-edge-soft px-3 py-1.5",children:[Bn.jsx("span",{className:"font-mono text-[10.5px] uppercase tracking-wider text-fg-4",children:"call stack"}),Bn.jsx("span",{className:"font-mono text-[10.5px] text-fg-4",children:e.length})]}),e.map((e,t)=>Bn.jsxs("div",{className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-raised/60",children:[Bn.jsx("span",{className:"grid h-4 w-4 shrink-0 place-items-center font-mono text-[10px] text-fg-4 tabular-nums",children:t}),Bn.jsx("span",{className:"flex-1 truncate font-mono text-[12px] text-fg",children:e.fn}),e.file&&Bn.jsxs("span",{className:"truncate font-mono text-[10.5px] text-fg-4",children:[e.file,":",e.line]})]},t))]})}const jB=w_(function(){const e=j_(),t=e.breakpoints.all().filter(e=>e.keys.length>0);return Bn.jsxs("div",{className:"flex h-full flex-col",children:[Bn.jsxs("div",{className:"flex items-center justify-between border-b border-edge-soft px-3 py-1.5",children:[Bn.jsx("span",{className:"font-mono text-[10.5px] uppercase tracking-wider text-fg-4",children:"breakpoints"}),t.length>0&&Bn.jsx("button",{type:"button",onClick:()=>e.breakpoints.clear(),className:"font-mono text-[10.5px] text-fg-4 hover:text-fail",title:"Clear all",children:"clear all"})]}),0===t.length?Bn.jsx(yB,{children:"no breakpoints set · click the gutter on any step to add one"}):Bn.jsx("div",{className:"divide-y divide-edge-soft",children:t.map(t=>Bn.jsxs("div",{children:[Bn.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5",children:[Bn.jsx("span",{className:"truncate font-mono text-[11.5px] text-fg",children:t.scenario}),Bn.jsx("button",{type:"button",onClick:()=>e.breakpoints.clear(t.scenario),className:"font-mono text-[10px] text-fg-4 hover:text-fail",title:"Clear in this scenario",children:"clear"})]}),t.keys.slice().sort().map(n=>{const[s,i]=n.split(":").map(Number);return Bn.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 hover:bg-raised/60",children:[Bn.jsx(by,{name:"bp",className:"h-2.5 w-2.5 shrink-0 text-fail"}),Bn.jsx("span",{className:"min-w-0 flex-1 font-mono text-[11.5px] text-fg",children:n}),Bn.jsx("button",{type:"button",onClick:()=>e.breakpoints.remove(t.scenario,s,i),className:"grid h-4 w-4 shrink-0 place-items-center rounded text-fg-4 hover:bg-raised hover:text-fail",title:"Remove",children:Bn.jsx(by,{name:"x",className:"h-3 w-3",strokeWidth:2.5})})]},n)})]},t.scenario))})]})});function NB(e){return{kind:"runFile",file:e}}function MB(e){const t=bB(e),n=bn.useMemo(()=>NB("manifest.json"),[]),[s,i]=bn.useState(void 0);return bn.useEffect(()=>{let e=!1;return i(void 0),t.loadText(n).then(t=>{if(!e)if(t.ok)try{const e=JSON.parse(t.text);i(e.capture??null)}catch{i(null)}else i(null)}),()=>{e=!0}},[t,n]),s}function BB(e,t,n){return!1===e?n.disabled:!0===e?t?n.emptyForRun:n.pending:t?n.disabled:`${n.pending} (opt-in via ${n.flag}=1)`}function DB({runId:e,bundle:t}){const n=bB(e),s=(null==t?void 0:t.screenshotPath)?n.resolveUrl({kind:"event",path:t.screenshotPath}):null;return s?Bn.jsxs("div",{className:"flex h-full flex-col",children:[Bn.jsx(ZB,{label:"page snapshot"}),Bn.jsx("div",{className:"flex-1 overflow-auto bg-panel p-2",children:Bn.jsx("img",{alt:"page snapshot at failure",src:s,className:"max-w-full rounded border border-edge shadow-sm"})})]}):Bn.jsxs("div",{className:"flex h-full flex-col",children:[Bn.jsx(ZB,{label:"page snapshot"}),Bn.jsx(yB,{children:"no screenshot captured"})]})}function LB({marker:e,tone:t,trailing:n,onClick:s,children:i}){const r=_y("flex w-full items-start gap-2 px-3 py-1.5 text-left font-mono","error"===t?"bg-fail/10":"warn"===t?"bg-warn/10":"",s&&"hover:bg-raised/60"),o=Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("span",{className:"mt-[3px] flex h-3 w-3 shrink-0 items-center justify-center",children:e}),Bn.jsx("span",{className:"min-w-0 flex-1 break-all",children:i}),n&&Bn.jsx("span",{className:"flex shrink-0 items-center gap-1.5",children:n})]});return s?Bn.jsx("button",{type:"button",onClick:s,className:r,children:o}):Bn.jsx("div",{className:r,children:o})}function EB(e){return Bn.jsx("span",{className:_y("h-2 w-2 rounded-full","error"===e?"bg-fail":"warn"===e?"bg-warn":"bg-fg-4")})}function PB({level:e,text:t}){return Bn.jsx(LB,{marker:EB(e),tone:"error"===e?"error":"warn"===e?"warn":void 0,children:Bn.jsx("span",{className:_y("whitespace-pre-wrap","error"===e?"text-fail":"warn"===e?"text-warn":"text-fg"),children:t})})}function RB({rows:e,empty:t}){return 0===e.length?Bn.jsx(yB,{children:t}):Bn.jsx("div",{className:"divide-y divide-edge-soft font-mono text-[11.5px]",children:e.map((e,t)=>Bn.jsx(PB,{...e},t))})}const AB=w_(function({active:e,events:t}){const n=j_(),[s,i]=bn.useState(""),[r,o]=bn.useState([]),[a,l]=bn.useState(null),c=function(e){return!!e&&!e.plainRun&&"completed"!==e.status&&"failed"!==e.status&&"aborted"!==e.status}(e),h=[];e?(e.logs.forEach((e,t)=>{h.push({at:e.at,key:`log-${t}`,node:Bn.jsx(PB,{level:e.level,text:e.text})})}),e.consoleEntries.forEach(e=>{h.push({at:e.at,key:`probe-${e.id}`,node:Bn.jsx(zB,{entry:e})})}),e.toolCalls.forEach(e=>{h.push({at:e.at,key:`tool-${e.callId}`,node:Bn.jsx(TB,{entry:e})})}),h.sort((e,t)=>e.at<t.at?-1:e.at>t.at?1:0)):t.forEach((e,t)=>{"log"===e.kind&&h.push({at:pB(e.t),key:`journal-log-${t}`,node:Bn.jsx(PB,{level:"log",text:`${pB(e.t)} ${e.text}`})})});return Bn.jsxs("div",{className:"flex h-full flex-col",children:[Bn.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:0===h.length?Bn.jsx(yB,{children:"no system output"}):Bn.jsx("div",{className:"divide-y divide-edge-soft font-mono text-[11.5px]",children:h.map(e=>Bn.jsx("div",{children:e.node},e.key))})}),Bn.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-t border-edge-soft px-3 py-1.5",children:[Bn.jsx(by,{name:"chevronR",className:"h-3.5 w-3.5 shrink-0 text-accent"}),Bn.jsx("input",{type:"text",value:s,onChange:e=>i(e.target.value),onKeyDown:t=>{if("Enter"===t.key)t.preventDefault(),(()=>{const t=s.trim();t&&c&&(n.activeRuns.probe(e.runId,t),o(e=>e[e.length-1]===t?e:[...e,t]),l(null),i(""))})();else if("ArrowUp"===t.key&&r.length>0){t.preventDefault();const e=null===a?r.length-1:Math.max(0,a-1);l(e),i(r[e])}else if("ArrowDown"===t.key&&null!==a){t.preventDefault();const e=a+1;e>=r.length?(l(null),i("")):(l(e),i(r[e]))}},disabled:!c,spellCheck:!1,autoComplete:"off",placeholder:c?"probe a locator — e.g. getByRole('row').first()":"probe needs a live debug session",className:"min-w-0 flex-1 bg-transparent font-mono text-[11.5px] text-fg placeholder:text-fg-4 focus:outline-none disabled:cursor-not-allowed"})]})]})}),zB=w_(function({entry:e}){const[t,n]=bn.useState(!1),s=e.result,i=s?1===s.count?"pass":"warn":"neutral";return Bn.jsxs("div",{className:"text-[11.5px]",children:[Bn.jsx(LB,{marker:Bn.jsx(by,{name:"chevronR",className:"h-3 w-3 text-accent"}),children:Bn.jsx("span",{className:"text-fg",children:e.input})}),Bn.jsxs("div",{className:"pb-1.5 pl-8 pr-3 font-mono",children:["pending"===e.status&&Bn.jsx("span",{className:"text-fg-4",children:"probing…"}),"stale"===e.status&&Bn.jsx("span",{className:"text-warn",children:"no reply — page may be navigating, or this run has no debug session"}),"done"===e.status&&s&&Bn.jsxs("div",{className:"flex flex-col gap-1",children:[Bn.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[Bn.jsxs(dN,{tone:i,children:[s.count," match",1===s.count?"":"es"]}),s.pinned&&s.pinned.ofCount>1&&Bn.jsxs(dN,{tone:"warn",children:[".",s.pinned.op,"() of ",s.pinned.ofCount]}),s.matches.length>0&&Bn.jsxs("button",{type:"button",onClick:()=>n(e=>!e),className:"inline-flex items-center gap-1 text-fg-2 hover:text-fg",children:[Bn.jsx(by,{name:t?"chevronD":"chevronR",className:"h-3 w-3"}),t?"hide":"show"," matches",s.truncated?` (first ${s.matches.length})`:""]})]}),Bn.jsx("span",{className:"break-all text-fg-4",children:s.chain}),s.warnings.map((e,t)=>Bn.jsxs("span",{className:"text-warn",children:["⚠ ",e]},t)),t&&Bn.jsx("div",{className:"mt-0.5 flex flex-col gap-0.5",children:s.matches.map(e=>Bn.jsxs("div",{className:"flex items-start gap-2",children:[Bn.jsxs("span",{className:"shrink-0 text-fg-4 tabular-nums",children:["#",e.index]}),Bn.jsxs("span",{className:"min-w-0 flex-1 break-all text-fg-2",children:[e.role&&Bn.jsx("span",{className:"text-fg",children:e.role}),e.name?` "${e.name}"`:e.text?` ${e.text}`:"",e.testId?` [testId=${e.testId}]`:"",!e.visible&&Bn.jsx("span",{className:"text-fg-4",children:" · hidden"})]})]},e.index))})]})]})]})}),TB=w_(function({entry:e}){var t;const[n,s]=bn.useState(!1),i=e.args.length>0||((null==(t=e.preview)?void 0:t.length)??0)>0;return Bn.jsxs("div",{className:"text-[11.5px]",children:[Bn.jsx(LB,{marker:Bn.jsx(by,{name:"play",className:"h-3 w-3 text-fg-3"}),onClick:i?()=>s(e=>!e):void 0,trailing:"running"===e.status?Bn.jsx("span",{className:"text-fg-4",children:"running…"}):Bn.jsxs(Bn.Fragment,{children:[null!=e.durationMs&&Bn.jsxs("span",{className:"text-fg-4 tabular-nums",children:[e.durationMs,"ms"]}),"error"===e.status?Bn.jsx(dN,{tone:"fail",children:"err"}):Bn.jsx("span",{className:"text-pass",children:"ok"})]}),children:Bn.jsxs("span",{className:"flex min-w-0 items-baseline gap-2",children:[Bn.jsx("span",{className:"shrink-0 text-fg",children:e.tool}),Bn.jsx("span",{className:"min-w-0 flex-1 truncate text-fg-2",children:e.args})]})}),n&&Bn.jsxs("div",{className:"flex flex-col gap-1 pb-1.5 pl-8 pr-3 font-mono",children:[Bn.jsxs("div",{className:"text-fg-4",children:[e.at," · ",e.tool,"running"!==e.status&&` · ${e.status}`]}),e.args&&Bn.jsx(IB,{text:e.args,tone:"dim"}),e.error?Bn.jsxs("div",{className:"whitespace-pre-wrap break-all text-fail",children:[e.error.class,": ",e.error.message]}):e.preview&&Bn.jsx(IB,{text:e.preview,tone:"normal"})]})]})});function IB({text:e,tone:t}){let n;try{n=JSON.parse(e)}catch{n=void 0}return null===n||!Array.isArray(n)&&"object"!=typeof n?Bn.jsx("div",{className:_y("whitespace-pre-wrap break-all","dim"===t?"text-fg-2":"text-fg"),children:e}):Bn.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap break-all text-[11px] leading-snug",children:Bn.jsx(OB,{value:n,indent:0})})}function OB({value:e,indent:t}){const n=" ".repeat(t),s=" ".repeat(t+1);if(null===e)return Bn.jsx("span",{className:"text-syn-keyword",children:"null"});if("string"==typeof e)return Bn.jsx("span",{className:"text-syn-string",children:JSON.stringify(e)});if("number"==typeof e||"boolean"==typeof e)return Bn.jsx("span",{className:"text-syn-number",children:String(e)});if(Array.isArray(e))return 0===e.length?Bn.jsx("span",{children:"[]"}):Bn.jsxs(Bn.Fragment,{children:["[\n",e.map((n,i)=>Bn.jsxs("span",{children:[s,Bn.jsx(OB,{value:n,indent:t+1}),i<e.length-1?",":"","\n"]},i)),n,"]"]});if("object"==typeof e){const i=Object.entries(e);return 0===i.length?Bn.jsx("span",{children:"{}"}):Bn.jsxs(Bn.Fragment,{children:["{\n",i.map(([e,n],r)=>Bn.jsxs("span",{children:[s,Bn.jsx("span",{className:"text-syn-key",children:JSON.stringify(e)}),": ",Bn.jsx(OB,{value:n,indent:t+1}),r<i.length-1?",":"","\n"]},e)),n,"}"]})}return Bn.jsx("span",{children:String(e)})}function HB({runId:e,runFinished:t}){const[n,s]=bn.useState({kind:"loading"}),i=bB(e),r=bn.useMemo(()=>NB("console.json"),[]),o=MB(e);return bn.useEffect(()=>{let e=!1;return s({kind:"loading"}),i.loadText(r).then(t=>{if(!e)if(t.ok)try{const e=JSON.parse(t.text);s({kind:"loaded",rows:e.map(e=>({level:e.level,text:e.text}))})}catch{s({kind:"error",message:"could not parse console.json"})}else s({kind:"missing"})}),()=>{e=!0}},[i,r,t]),"loading"===n.kind?Bn.jsx("div",{className:"px-3 py-2 font-mono text-[11.5px] text-fg-4",children:"loading…"}):"error"===n.kind?Bn.jsx(yB,{children:n.message}):"missing"===n.kind?Bn.jsx(yB,{children:BB(null==o?void 0:o.console,t,FB)}):Bn.jsx(RB,{rows:n.rows,empty:"no console output"})}const FB={flag:"UNOTEST_CONSOLE",disabled:"no console captured — set UNOTEST_CONSOLE=1 to record the browser console",emptyForRun:"no console captured for this run",pending:"browser console appears here when the run finishes"};function WB({runId:e,bundle:t}){return Bn.jsxs("div",{children:[Bn.jsx(ZB,{label:"semantic dom"}),t?Bn.jsx(JB,{runId:e,asset:{kind:"event",path:`${t.bundlePath}/outline.txt`}}):Bn.jsx(yB,{children:"no failure bundle for this run"})]})}const UB=w_(function({runId:e}){const t=j_(),n=bn.useMemo(()=>NB("picker-snapshot.txt"),[]),[s,i]=bn.useState(0),r=bn.useCallback(()=>{t.activeRuns.requestSnapshot(e);const n=setTimeout(()=>i(e=>e+1),600),s=setTimeout(()=>i(e=>e+1),1700);return()=>{clearTimeout(n),clearTimeout(s)}},[t,e]),o=t.activeRuns.byRunId.get(e),a="paused"===(null==o?void 0:o.status)&&o.pausedAt?`${o.pausedAt.file}:${o.pausedAt.line}:${o.pausedAt.col}`:null;return bn.useEffect(()=>{if(null!==a)return r()},[r,a]),Bn.jsxs("div",{children:[Bn.jsxs("div",{className:"flex items-center justify-between border-b border-edge-soft px-3 py-1.5",children:[Bn.jsx("span",{className:"font-mono text-[10.5px] uppercase tracking-wider text-fg-4",children:"picker snapshot"}),Bn.jsx("button",{type:"button",onClick:r,className:"font-mono text-[10.5px] text-fg-4 hover:text-fg",title:"Recapture the page outline",children:"refresh"})]}),Bn.jsx(JB,{runId:e,asset:n,reloadKey:s})]})});function KB({runId:e,runFinished:t}){const[n,s]=bn.useState({kind:"loading"}),i=bB(e),r=bn.useMemo(()=>NB("network.json"),[]),o=MB(e);return bn.useEffect(()=>{let e=!1;return s({kind:"loading"}),i.loadText(r).then(t=>{if(!e)if(t.ok)try{s({kind:"loaded",rows:JSON.parse(t.text)})}catch{s({kind:"error",message:"could not parse network.json"})}else s({kind:"missing"})}),()=>{e=!0}},[i,r,t]),"loading"===n.kind?Bn.jsx("div",{className:"px-3 py-2 font-mono text-[11.5px] text-fg-4",children:"loading…"}):"error"===n.kind?Bn.jsx(yB,{children:n.message}):"missing"===n.kind?Bn.jsx(yB,{children:BB(null==o?void 0:o.network,t,qB)}):0===n.rows.length?Bn.jsx(yB,{children:"no requests captured"}):Bn.jsx(VB,{rows:n.rows})}const qB={flag:"UNOTEST_NETWORK",disabled:"no network captured — set UNOTEST_NETWORK=1 to capture",emptyForRun:"no network captured for this run",pending:"network requests appear here when the run finishes"},$B="grid-cols-[1fr_52px_84px_72px_60px]";function VB({rows:e}){return Bn.jsxs("div",{className:"font-mono text-[11px]",children:[Bn.jsxs("div",{className:_y("sticky top-0 grid gap-2 border-b border-edge-soft bg-panel px-3 py-1.5 text-[10px] uppercase tracking-wider text-fg-4",$B),children:[Bn.jsx("span",{children:"Name"}),Bn.jsx("span",{className:"text-right",children:"Status"}),Bn.jsx("span",{children:"Type"}),Bn.jsx("span",{className:"text-right",children:"Size"}),Bn.jsx("span",{className:"text-right",children:"Time"})]}),e.map((e,t)=>{const n=!!e.failureText||null!=e.status&&e.status>=400;return Bn.jsxs("div",{className:_y("grid items-center gap-2 border-b border-edge-soft px-3 py-1",n&&"bg-fail/10",$B),children:[Bn.jsxs("span",{className:"truncate",title:e.url,children:[Bn.jsxs("span",{className:"text-fg-4",children:[e.method," "]}),YB(e.url)]}),Bn.jsx("span",{className:_y("text-right tabular-nums",n?"text-fail":null!=e.status&&e.status>=200&&e.status<300?"text-pass":"text-fg"),children:e.failureText?"fail":e.status??"—"}),Bn.jsx("span",{className:"truncate text-fg-2",children:e.resourceType}),Bn.jsx("span",{className:"text-right tabular-nums text-fg-2",children:GB(e.sizeBytes)}),Bn.jsx("span",{className:"text-right tabular-nums text-fg-2",children:null!=e.durationMs?`${e.durationMs} ms`:"—"})]},t)})]})}function YB(e){try{const t=new URL(e);return t.pathname.split("/").filter(Boolean).pop()||t.host}catch{return e}}function GB(e){return null==e?"—":e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} kB`:`${(e/1048576).toFixed(1)} MB`}function XB({events:e}){return 0===e.length?Bn.jsx(yB,{children:"no trace events"}):Bn.jsx("div",{className:"divide-y divide-edge-soft font-mono text-[11.5px]",children:e.map((e,t)=>Bn.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5",children:[Bn.jsx("span",{className:"w-24 shrink-0 truncate text-fg-2",children:e.kind}),Bn.jsx("span",{className:"min-w-0 flex-1 truncate text-fg",children:tD(e)})]},t))})}function ZB({label:e}){return Bn.jsx("div",{className:"flex items-center justify-between border-b border-edge-soft px-3 py-1.5",children:Bn.jsx("span",{className:"font-mono text-[10.5px] uppercase tracking-wider text-fg-4",children:e})})}function JB({runId:e,asset:t,reloadKey:n}){return Bn.jsx(QB,{runId:e,asset:t,transform:eD,reloadKey:n})}function QB({runId:e,asset:t,transform:n,reloadKey:s=0}){const[i,r]=bn.useState({kind:"loading"});return function(e,t,n,s,i){const r=bB(e);bn.useEffect(()=>{let e=!1;return s({kind:"loading"}),r.loadText(t).then(t=>{e||(t.ok?s({kind:"loaded",text:n(t.text)}):s({kind:"error",message:"not available"}))}),()=>{e=!0}},[r,t,n,s,i])}(e,t,n,r,s),"loading"===i.kind?Bn.jsx("div",{className:"px-3 py-2 font-mono text-[11.5px] text-fg-4",children:"loading…"}):"error"===i.kind?Bn.jsx(yB,{children:i.message}):Bn.jsx("pre",{className:"overflow-auto whitespace-pre-wrap break-all p-3 font-mono text-[11.5px] text-fg",children:i.text})}function eD(e){return e}function tD(e){switch(e.kind){case"step:started":return`${e.file}:${e.line}:${e.col}`;case"step:ok":return`${e.durationMs}ms`;case"step:fail":return e.error;case"screenshot":return e.path;case"failure-bundle:written":return e.bundlePath;case"run:started":return e.scenario;case"run:finished":return e.outcome;case"note":return`${e.label}: ${e.text}`;case"log":return e.text;case"judge:verdict":return`${e.verdict} · ${e.rubric}`;default:return""}}const nD={default:"border border-edge-soft bg-canvas text-fg-2 hover:bg-raised",primary:"bg-accent text-on-accent hover:bg-accent-hover",accent:"border border-accent/30 bg-accent/10 text-accent hover:bg-accent/20",danger:"border border-fail/30 bg-fail/10 text-fail hover:bg-fail/20"};function sD({children:e,onClick:t,icon:n,variant:s="default",tooltip:i,tooltipHint:r,tooltipPlacement:o="bottom-start",className:a}){return Bn.jsxs("button",{type:"button",onClick:t,className:_y("group relative flex h-6 items-center gap-1 rounded px-2 font-mono text-[11px] font-medium",nD[s],a),children:[n&&Bn.jsx(by,{name:n,className:"h-3 w-3",strokeWidth:2.5}),e,i&&Bn.jsx(IN,{label:i,hint:r,placement:o})]})}function iD(e){return new Map(IM(e).map(e=>[`${e.line}:${e.col}`,e.index]))}function rD(e,t,n){const s=e.get(`${t}:${n}`);if(null!=s)return s;for(const[i,r]of e)if(i.startsWith(`${t}:`))return r;return null}function oD(e,t,n){const s=iD(t),i=[],r=new Map,o=[];for(const a of e)if("step:started"===a.kind){const e=a.file===n?rD(s,a.line,a.col):null;if(o.push({idx:e}),null==e)continue;const t=r.get(e);if(t)t.status="running",t.durationMs=null;else{const t={index:e,line:a.line,col:a.col,status:"running",durationMs:null};r.set(e,t),i.push(t)}}else if("step:ok"===a.kind){const e=o.pop();if(null!=(null==e?void 0:e.idx)){const t=r.get(e.idx);t&&(t.status="passed",t.durationMs=a.durationMs)}}else if("step:fail"===a.kind){const e=o.pop();if(null!=(null==e?void 0:e.idx)){const t=r.get(e.idx);t&&(t.status="failed")}}else if("run:finished"===a.kind)for(const e of i)"running"===e.status&&(e.status="aborted");return function(e){const t={};for(const n of e)t[n.index]={status:n.status,durationMs:n.durationMs};return t}(i)}function aD(e,t){return e.file===t?`${e.line}:${e.col}`:null}function lD(e,t,n){var s;return(null==(s=cD(e,t,n))?void 0:s.index)??null}function cD(e,t,n){const s=iD(t),i=[];for(const r of e)if("step:started"===r.kind){const e=r.file===n?rD(s,r.line,r.col):null;i.push({idx:e})}else if("step:ok"===r.kind)i.pop();else if("step:fail"===r.kind){const e=i.pop();if(null!=(null==e?void 0:e.idx))return{index:e.idx,event:r}}return null}const hD=gD;!function(){const e=361,t=464,n=222,s=347,i=337,r=331,o=352,a=263,l=gD,c=vD();for(;;)try{if(372696===-parseInt(l(e))/1*(parseInt(l(452))/2)+parseInt(l(t))/3*(-parseInt(l(490))/4)+parseInt(l(279))/5*(-parseInt(l(n))/6)+parseInt(l(s))/7*(parseInt(l(573))/8)+-parseInt(l(i))/9*(parseInt(l(r))/10)+parseInt(l(o))/11*(-parseInt(l(484))/12)+-parseInt(l(369))/13*(-parseInt(l(a))/14))break;c.push(c.shift())}catch(h){c.push(c.shift())}}();var uD=Object[hD(427)],dD=(e,t)=>uD(e,hD(420),{value:t,configurable:!0});function fD(e){const t=hD;return'"'+e[t(183)](/\\/g,"\\\\")[t(183)](/"/g,'\\"')+'"'}function pD(e,t){const n=183,s=341,i=370,r=hD,o=e[r(183)](/\\/g,"\\\\")[r(n)](/'/g,"\\'");return void 0!==t?r(341)+o+r(572)+t+r(374):r(s)+o+r(i)}function vD(){const e=["tKvr","C3rLCfn0yxrLBwvUDa","B3bLBG","q09ntue","sw52ywXPzcb0B2TLBJOGDw5LEhbLy3rLzca","qMXVy2TtDgf0zw1LBNq","zgvMAw5LuhjVCgvYDhK","Aw5KzxHLCW","Aw5JCMvTzw50","Dg9Rzw5PEMvnDwX0AwXPBMvdB21Tzw50","uMvNrxHWrMXHz0vYCM9Y","y29Z","yxnZzxj0ugfNzvjLywr5ka","cI8VqgvUzc0","Dgv4Da","j3zHCICGAw4GzM9YlwXVB3aGAw5PDgLHBgL6yxrPB24GAxmGBM90ihn1ChbVCNrLzcbIEsb0AguGqMXVy2TSEsbJB252zxj0zxiUifvZzsbWBgfPBIbHC3nPz25Tzw50oIaNzM9YicHRid0GmtSGAYa8psbooYbRid0GAYaRidePjY4","yxjYyxLfEhbYzxnZAw9U","Bwf4","BwLU","ueXvuW","yNvPBgrxywL0rM9YrhnS","qxjYyxLbC3nPz25Tzw50u3rHDgvTzw50","yxnZzxj0u2vJDgLVBLrPDgXLka","igrVzxmGBM90igv4Axn0iq","pt09","qxjYyxLfEhbYzxnZAw9U","CMvNzxHdB250zxH0qwXSB3DLza","ru9g","zNvUy3rPB25Z","CMvWzwf0","iIWG","mKfmugP2qq","BwfW","ChvZAa","DhLWzq","D2L0Aa","z2v0q29SDw1U","qKfsqKfs","y2fZzq","Dhj1zq","DMfSAwrHDgvfCZvgBgfNCW","CMvNzxGGzMXHzYaN","CMv0DxjU","mtvuC2vTzKG","vw50zxjTAw5HDgvKihjLz2v4igXPDgvYywWGkgrHBMDSAw5NigjHy2TZBgfZAcKU","BgLUzq","AgfZ","uMv0DxjUu3rHDgvTzw50","z2v0tMfTzq","C3rYAw5NAwz5","yxnZzxj0vg9HC3rwAxnPyMXLka","z2v0qxjNC0nVDw50","tLvnqKvs","wKvstW","zwXLBwvUDfzPC2LIAwXPDhLbC3nLCNqOiLzju0LcteuIlca","AM9PBG","qxjYyxLby2nLC3nfEhbYzxnZAw9U","yxnZzxj0uM91DgvjCYG","tejsqunlrvq","DgvZDa","it09","icaGia","sw52ywXPzcbMBg9HDcbUDw1Izxi","mZe4mg5PCwjTrW","yNvPBgruExbLvgv4DerZBa","ywz0zxjcBg9JAW","tfbbuKvo","zwXLBwvUDefZC2vYDcGIsvmIlca","B3b0Aw9UCW","mJmYnJC2t2vkC2jh","twLZC2LUzYbJBg9ZzsbIywnRDgLJAYbPBIbYyxCGC3rYAw5NigXPDgvYywW","yxjYyxK","C2nYB2XSvg9uB3aO","sw5JCMvTzw50u3rHDgvTzw50","C3rHDgvTzw50","rM9Yu3rHDgvTzw50","rvHdtevr","vevyva","DMfSDwu","qu5e","zMLUywXSEq","ica+ia","ruXtrq","zxHWCJe","zhvWBgLJyxrLihjLz2v4igzSywCGjW","Dg9Rzw5PEMvuzxH0","lcaIiZy2y2nJyYiPoW","CgvLA0DYB3vW","C2nYB2XSvg9cB3r0B20O","D2fPDezVCLrLEhqO","sw52ywXPzcb0B2TLBML6zu9WzxjHDg9YoIb1BMv4CgvJDgvKigvUzcbVzIbPBNb1Da","uhjVCgvYDhLby2nLC3nfEhbYzxnZAw9U","Aw5PDa","Aw5KzxHfEhbYzxnZAw9UCW","ufjjtLq","r1rfuq","Bg9NAwnHBefUza","uhjVCgvYDhLby2nLC3nfEhbYzxnZAw9UlMv2ywWOksbPCYbUB3qGAw1WBgvTzw50zwqGAw4GDgHLigLUlxbYB2nLC3mGAw50zxjWCMv0zxiG4OcuihvZzsbbC3rfEgvJDxrVCIaOC3jJl2rZBc9HC3qTzxHLy3v0B3iUDhmPigLUC3rLywqU","Bgv0","q29UDgLUDwvtDgf0zw1LBNq","q2fUBM90ignHC3qGyxjYyxKGDg8GBNvTyMvY","rNvUy3rPB25ezwzPBMvtDgf0zw1LBNq","C2XPy2u","uhjVCgvYDhKTCMvHzcbLEhbYzxnZAw9UihvZzwqGyxmGysbZDgf0zw1LBNqGkg5VihnPzguGzwzMzwn0ks4GrwL0AgvYigfZC2LNBIbPDcaOyhGGpsbYB3CUzM9VycKGB3iGy2fSBcbHig1LDgHVzcaOyhjVDY5MB28OkwaPlG","rxHWzwn0zwqGAwrLBNrPzMLLCIbHzNrLCIaNlIC","vxnLCKrLzMLUzuz1BMn0Aw9U","qu1qqu1q","yMXVy2TnzxrHqMXVy2S","zM9Yu3rHDgvTzw50","vMfYAwfIBgvZihn0ywnRihvUzgvMAw5Lza","zNvUy3rPB24G","z2v0tgLUzq","D2fPDezVCLvstcG","dqOa","vMfYAwfIBguGBMfTzsaN","D2fPDezVCK5HDMLNyxrPB24O","AxnxB3jKu3rHCNq","Dg9Rzw5PEMvszwDLEa","zw50CMLLCW","tvvmveLqtfK","twLZC2LUzYbJBg9ZzsbXDw90zsbPBIbZDhjPBMCGBgL0zxjHBa","yxDHAxq","C291CMnL","zM9YBwf0q29KzuzYyw1L","zwXLBwvUDefZC2vYDcGIq09ovefjtLmIlca","C2vSzwn0q29TyM9IB3HwywX1zsG","D2HPBgu","q29UC3rHBNqG","B2jQzwn0rxHWCMvZC2LVBG","zNjVBq","AxnfEgLZDhm","tejsqunf","DMfYAwfIBgu","yNvPBgrdBgLJA0rZBa","y29UC3vTzvDVCMq","jY4Grvm1igfSBg93CYbNlcbPlcbTlG","z2v0uhjVCgvYDgLLCW","tuvuqv9cte9dsW","t2jQzwn0vMfSDwu","tgv4zxi","id0G","y29SDw1U","C29MDa","y29UzgL0Aw9UywW","ue9tvezjwf9jtKnsru1ftLq","zM9YrwfJAa","zxzHBa","yNvPBgrmB2DPBKfZrhnS","uKjsqunf","oYbUB3qGAw4Grvm1ihn1yNnLDc4Gu2vLigrVy3mVzhnSl3jLz2v4lwXPDgvYywWTzxm1lM1KigzVCIb0AguGC3vWCg9YDgvKigzSywCGC2v0lG","y2XPy2SO","jYKSig50AcG","mtzqzwTNBeC","rvmYmdiYigHHC0LUzgLJzxm","t1bfuKfut1jFq0HbuLm","y29UC3vTzq","zMXHz3m","BMv3","ugfYC2vfCNjVCG","uKvhrvG","B3bLBLrHyIG","C2v0","yxnZzxj0sw5WDxrwywX1zsG","qLjfquS","C3DPDgnOvg9nywLUrNjHBwuO","kqP7cG","rLvoq1rjt04","reLwsurf","v0Hjteu","yNvPBgrbC3nLCNruB2fZDfzPC2LIBgveC2W","qxjYyxLwywX1zq","kcKGpt4GEWO","AxnszwDLEefSBg93zwrbzNrLCG","D2fPDezVCIG","yNvPBgrbC3nLCNrdB3vUDevXDwfSC0rZBa","Cg9Z","Aw5KzxG","u0Xbu0G","zwXZzq","rvm2ihvUAwnVzgu","Dg9Rzw5PEMu","yNvPBgrbC3nLCNroB3rwAxnPyMXLrhnS","CMvWBgfJzq","BNvTyMvY","t25LigfYz3vTzw50igv4CgvJDgvK","AxnoDw1Izxi","C3rHDgvTzw50t3jcBg9JAW","yNvPBgrxywL0rM9Yvgv4DerZBa","z2v0vhLWzq","t2jQzwn0rxHWCMvZC2LVBG","Dg9tDhjPBMC","zxHWCJi","kY0QlYGPE31Bxt08pIeMFcW6oY4","uKjsqunlrvq","lcb0zxH0oIaI","DgHPCW","vw5LEhbLy3rLzcbJAgfYywn0zxiG","y2XVC2veAwfSB2CO","DxjSqxnZzxj0kcjdt05uquLouYiSia","ufjfrKLyx0rfq1jftuvova","zwXLBwvUDhm","jYbPCYbHihjLC2vYDMvKiePHDMfty3jPChqGA2v5D29Yzc4GvxnLigeGzgLMzMvYzw50ig5HBwuU","ywrK","DMfYAwfIBgvZ","B3bLCMfUza","ChjVCgvYDgLLCW","zg9xAgLSzvn0yxrLBwvUDa","uKvuvvjo","q2fUBM90igLUy3jLBwvUDc9KzwnYzw1LBNqGBM9Ulw51BwvYAwmGDMfSDwu","yxnZzxj0rgLHBg9Nt3bLBIG","cN0kD2HPBguGka","yNvPBgrdBgLWyM9HCMrqyxn0zurZBa","qu1q","y29UC3vTzufYCMf5","C3rLCc5ZB2z0","Bg9NAw5bCYG","zwXZzvn0yxrLBwvUDa","Dg9Rzw5PEMvoDw1Izxi","vu5eruzjtKve","twvTyMvYq2fSBev4ChjLC3nPB24","rvmYmdi0ihvUAwnVzgvtzxrZ","mZeZnJGWmffWzfbxzq","Bg9NAwnHBe9Y","y2XVBMu","ChjPBNqG","DgHYB3C","C3DPDgnOvg9gCMfTzsG","zwnOBW","sw5KzxGGywnJzxnZig9UigeGBwvTyMvYigv4ChjLC3nPB24GkguUzY4Gyhn0yxrLlM1HDgnOzxnBmf1GksbPCYbUB3qGC3vWCg9YDgvKiokaLcbPBMrLEgLUzYb3B3jRCYbVBIbHigjHCMuGDMfYAwfIBguGB25SEs4GqxnZAwDUihrOzsbTzw1IzxiGDg8Gysb2yxjPywjSzsbMAxjZDdOGyg0GpsbZDgf0zs5TyxrJAgvZoYbSyxn0id0GBvTTlMXLBMD0AcaTidfDo2a","lY9a","yNvPBgrpCgvUtwvUDuL0zw1eC2W","ihWG","rvffuuvr","yMXVy2S","B3bLCMf0Aw9U","BxvSDgLWBgLJyxrL","DgfNrxHWCMvZC2LVBG","zhjHz0fUzerYB3aO","yxnoDw1Izxi","uLbbuKvo","tfrf","yxntDhjPBMC","swztDgf0zw1LBNq","ywrKAxrPDMu","twvTyMvYq2fSBev4ChjLC3nPB24UzxzHBcGPigLZig5VDcbPBxbSzw1LBNrLzcbPBIb0AguGAw4TChjVy2vZCYbPBNrLCNbYzxrLCIdIGjqGDxnLiefZDev4zwn1Dg9YicHZCMmVzhnSl2fZDc1LEgvJDxrVCI50CYKGAw5ZDgvHzc4","D2fPDezVCKHPzgrLBIG","yxnZzxj0vgfIBgvoB3rfBxb0EsG","rNvUy3rPB25Z","rxHWzwn0zwqGChjVCgvYDhKGA2v5icH3B3jKig9Yihn0CMLUzYK","y2HHCKf0","rvmYmde4igrVDefSBa","zM9Yy2vdBgLJAYG","yNvPBgrtD2L0y2HuB0zYyw1LrhnS","sw5JCMvTzw50rxHWCMvZC2LVBG","C2L6zq","yNvPBgrlzxLWCMvZC0rZBa","Dg9Rzw5PEMvxB3jK","Dhj5","zNvUy3rPB25HBev4ChjLC3nPB24","ChjLC3mO","vg9Rzw4","t1bfuKfut1jt","mJi0Ae1Tu21S","qxnZAwDUBwvUDfn0yxrLBwvUDa","AwztDgf0zw1LBNq","Aw5KzxHpzG","Dw5KzwzPBMvK","y29UzgL0Aw9U","ufjfrKLyx0Loq1jftuvova","Dw5HCNK","z2v0qxjNC05HBwu","zM9YicG","yxjNtMfTzxm","yM9KEq","y29TBwvUDhm","r1rf","zgvSzxrL","BgfZDeLUzgv4","nuDKBNHLyG","zwXLBwvUDenVDw50qxnZzxj0kcjfuvvbtciSia","vMfYAwfIBgvfEhbYzxnZAw9U","DMfYAwfIBgvoyw1L","vg9Rzw4ODhLWztOG","D2HPBgvtDgf0zw1LBNq","C3rLCa","qNjLywTtDgf0zw1LBNq","vw5HCNLfEhbYzxnZAw9U","q29UzgL0Aw9UywXfEhbYzxnZAw9U","Dg9Rzw5Z","twv0yujSB2nRu3rHDgvTzw50","zMLSBezVCM0OiG","tuLovvm","DMfYia","C3bSAxq","Bg9JywXLq29TCgfYzq","ugfYC2vY","yNvPBgrxywL0rM9YsgLKzgvUrhnS","u3rYAw5N","AgLNAgXPz2H0qMXVy2S","C3rHy2S","zwXLBwvUDev4ChjLC3nPB24","Bwv0yujSB2nR","uMvNrxHWrxHWCMvZC2LVBG","zxHWCMvZC2LVBG","tuLovvnnsu5vuW","yNvPBgrtD2L0y2HuB01HAw5gCMfTzurZBa","Aw5ZDgfUy2vVzG","B3bLCMf0B3i","CMvJzwL2zxi","lcbJB2X1Bw46ia","yNvPBgrbC3nLCNrqywDLuMvHzhLeC2W","C3rHDgvTzw50CW","uMvNrxHWvMfSDwu","yNvPBgrbC3nLCNroB1zPC2LIBgvfCNjVCKrZBa","ueXvu1bmvvm","AxnbCNjHEq","zNvUy3rPB25ezwzPBMu","zxf1ywXPDhK","uhjPBNrtDgf0zw1LBNq","rK9s","tNvTyMvYvMfSDwu","DMfYu3rHDgvTzw50","y29UDgLUDwu","CMvZDwX0","rNvUy3rPB25tDgf0zw1LBNq","C3DPDgnO","rvHdtevrrve","rvffuq","vgvTCgXHDguGAw50zxjWB2XHDgLVBIbGjhSUlI59ycbPCYbUB3qGywXSB3DLzcbPBIb1BM90zxn0ierttcbZDhjPBMDZlIbvC2uGCg9ZAxrPB25HBcbHCMDZigLUC3rLywq6igv2ywX1yxrLkcDYzxr1CM4GyxjNlNGNlcb7yxjNoIb2ywX1zx0PlG","yNvPBgrgBg93rhnS","mZqZnteWs1jtr1Pr","v2HPBgvtDgf0zw1LBNq","zgvJBgfYyxrVCNm","sw52ywXPzcbHCMD1BwvUDcbJB3vUDcbMB3iGzNvUy3rPB24G","zxHLy3v0zq","yNvPBgrbC3nLCNrjBNb1DfzHBhvLrhnS","mtm1r1bNDKjv","vKfs","Dg9Rzw4","lcbLEhbLy3rLzca","Dg9mB2nHDg9YkfTSB2nHDg9YkcC","re9u","iIWGBgLUztOG","z2v0","uKvtrvjwrurFv09srfm","ChjPBNq","mte0mdqZm0fMCfP6uq","BwvZC2fNzq","Dg9Rzw5PEMvpCgvYyxrVCG","u1rbuG","zwXLBwvUDfzPC2LIAwXPDhLbC3nLCNqOiK5pvf9wsvnjqKXfiIWG","mZaZmtzUvNfUBfC","u3rLCfn0yxrLBwvUDa","y2f0y2G","CgvLAW","DgvYBwLUyxrPB24","DhjPBq","BNvSBa","yNvPBgrgB3jJzunSAwnRrhnS","u1rfua","ndu0mJHTDKz1quS","Bg9VA01HDgnO","yNvPBgrdBg9ZzurPywXVz0rZBa","ChjPBwfYEq","z2v0qxjYyxK","ue9tvezjwf9erunsru1ftLq","qKfs","zMXVD18","mtC0odeYm2rXshjpvG","jYLDkq","yM9VBgvHBG","ywrKvg9Rzw4","yxnZzxj0tM9wAxnPyMXLrxjYB3iO","kv0P","rg9xAgLSzvn0yxrLBwvUDa","yNvPBgrxywL0rM9YtMf2AwDHDgLVBKrZBa","qvjst1C","yNvPBgrbC3nLCNrsB3v0zuLZrhnS","yxnZAwDUBwvUDfn0yxrLBwvUDa","vw5KzwzPBMvKvMfSDwu","Dw5RBM93BIbYzwDLEcbMBgfNicC","Bwf0y2G","yNvPBgrbC3nLCNrbDxrOzw50AwnHDgvKrhnS","jYbYzxf1AxjLCYa","Aw5PDgLHBgL6yxrPB24","yNvPBgrgAwXSrhnS","rvHdta","BMv4Da","zNvUy3rPB24","Axnmzxr0zxjjBLDVCMq","rNvUy3rPB25HBev4ChjLC3nPB24","vMfYu3rHDgvTzw50","CgfYC2u","Cg9W","zg8GEWO","DM9Pza","zNvUy3rPB25fEhbYzxnZAw9U","ywrKqxjNDw1LBNq","zMLSBa","z2v0vgv4Da","B3bLBK1LBNvjDgvTka","u05fuq","Aw5WDxq","zgvMyxvSDa","yxnZzxj0tgLZDe5VDevTChr5ka","BgvUz3rO","BgfIzwW","v09sra","Bg9N","y2fSBfDPDgHqB3n0zML4","q09oveLovuu","D2HPBguGka","zMLSBcG","vw5RBM93BIbMDw5JDgLVBJOG","Dg9Rzw5PEMvsyxDuzxH0","yNjLywS","C3rHCNrZv2L0Aa","yNvPBgrtzwXLy3rdB21IB2jVEfzHBhvLrhnS","yxjNDw1LBNrZ","BMfTzq"];return(vD=function(){return e})()}function gD(e,t){e-=161;const n=vD();let s=n[e];if(void 0===gD.mFCXGt){gD.joyhkY=function(e){let t="",n="";for(let s,i,r=0,o=0;i=e.charAt(o++);~i&&(s=r%4?64*s+i:i,r++%4)?t+=String.fromCharCode(255&s>>(-2*r&6)):0)i="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=".indexOf(i);for(let s=0,i=t.length;s<i;s++)n+="%"+("00"+t.charCodeAt(s).toString(16)).slice(-2);return decodeURIComponent(n)},gD.oKUmFn={},gD.mFCXGt=!0}const i=e+n[0],r=gD.oKUmFn[i];return r?s=r:(s=gD.joyhkY(s),gD.oKUmFn[i]=s),s}dD(fD,"escapeDslString"),dD(pD,"locator"),dD(function(e,t,n=""){return hD(571)+pD(e,t)+", "+fD(n)+");"},hD(554)),dD(function(e,t,n,s=""){return hD(413)+pD(e,n)+", "+fD(t)+", "+fD(s)+");"},hD(386)),dD(function(e,t,n=""){return"typeText("+pD(e)+", "+fD(t)+", "+fD(n)+");"},hD(485)),dD(function(e,t="0",n=""){return"open("+fD(e)+", "+fD(t)+", "+fD(n)+");"},"buildOpenDsl"),dD(function(e,t=""){return hD(475)+pD(e)+", "+fD(t)+");"},"buildAssertVisibleDsl"),dD(function(e,t=""){return hD(199)+fD(e)+", "+fD(t)+");"},"buildAssertUrlContainsDsl"),dD(function(e=""){return hD(433)+fD(e)+");"},hD(311)),dD(function(e=""){return"assertAuthenticated("+fD(e)+");"},hD(383)),dD(function(e,t=""){return hD(247)+pD(e)+", "+fD(t)+");"},"buildAssertTableNotEmptyDsl"),dD(function(e,t=""){return hD(405)+pD(e)+", "+fD(t)+");"},"buildAssertListNotEmptyDsl"),dD(function(e=""){return hD(373)+fD(e)+");"},hD(314)),dD(function(e,t=""){return hD(443)+fD(e)+", "+fD(t)+");"},"buildAssertSectionTitleDsl"),dD(function(e,t=""){return hD(471)+fD(e)+", "+fD(t)+");"},hD(170)),dD(function(e,t=""){return hD(210)+fD(e)+", "+fD(t)+");"},"buildAssertDialogOpenDsl"),dD(function(e,t=""){return hD(478)+fD(e)+", "+fD(t)+");"},hD(378)),dD(function(e,t,n=""){return hD(546)+pD(e)+", "+fD(t)+", "+fD(n)+");"},hD(418)),dD(function(e,t,n=""){return hD(216)+fD(e)+", "+fD(t)+", "+fD(n)+");"},hD(568)),dD(function(e,t=""){return hD(401)+fD(e)+", "+fD(t)+");"},hD(231)),dD(function(e,t=""){return hD(161)+fD(e)+", "+fD(t)+");"},"buildOpenTabDsl"),dD(function(e,t=""){return hD(198)+fD(e)+", "+fD(t)+");"},hD(363)),dD(function(e,t=""){const n=291,s=451,i=hD,r=JSON[i(470)](e).replace(/\\/g,"\\\\")[i(183)](/"/g,'\\"');return i(n)+r+i(s)+fD(t)+");"},"buildFillFormDsl"),dD(function(e,t=""){return"saveForm("+fD(e)+", "+fD(t)+");"},"buildSaveFormDsl"),dD(function(e,t="",n){const s=n?", "+n:"";return hD(174)+pD(e)+", "+fD(t)+s+");"},hD(441)),dD(function(e,t,n="",s){const i=s?", "+s:"";return hD(510)+pD(e)+", "+fD(t)+", "+fD(n)+i+");"},hD(188)),dD(function(e,t="",n){const s=n?", "+n:"";return hD(246)+pD(e)+", "+fD(t)+s+");"},hD(297)),dD(function(e,t="",n){const s=n?", "+n:"";return hD(533)+fD(e)+", "+fD(t)+s+");"},"buildWaitForURLDsl"),dD(function(e="",t){const n=t?", "+t:"";return hD(536)+fD(e)+n+");"},hD(376)),dD(function(e,t,n="",s){const i=hD,r=s&&"IS"!==s?", "+fD(s):"";return i(163)+pD(e)+", "+fD(t)+", "+fD(n)+r+");"},hD(336)),dD(function(e,t=""){return"scrollIntoView("+pD(e)+", "+fD(t)+");"},"buildScrollIntoViewDsl"),dD(function(e,t=""){return hD(509)+pD(e)+", "+fD(t)+");"},"buildScrollToBottomDsl"),dD(function(e,t=""){return hD(493)+pD(e)+", "+fD(t)+");"},"buildScrollToTopDsl"),dD(function(e,t=""){return hD(252)+pD(e)+", "+fD(t)+");"},hD(359)),dD(function(e,t,n=""){return hD(238)+pD(e)+", "+pD(t)+", "+fD(n)+");"},"buildDragAndDropDsl"),dD(function(e,t,n=""){return"clipboardPaste("+pD(e)+", "+fD(t)+", "+fD(n)+");"},hD(212)),dD(function(e,t=hD(274),n=""){return hD(260)+pD(t)+", "+fD(e)+", "+fD(n)+");"},hD(256)),dD(function(e,t=""){return hD(227)+pD(e)+", "+fD(t)+");"},hD(253)),dD(function(e=""){return hD(165)+fD(e)+");"},hD(306)),dD(function(e,t=""){return hD(351)+pD(e)+", "+fD(t)+");"},hD(182)),dD(function(e,t,n=""){return hD(545)+pD(e)+", "+fD(t)+", "+fD(n)+");"},"buildAssertTextContainsDsl"),dD(function(e,t,n=""){return hD(488)+pD(e)+", "+fD(t)+", "+fD(n)+");"},"buildAssertTextEqualsDsl"),dD(function(e,t=""){return'urlAssert("IS", '+fD(e)+", "+fD(t)+");"},"buildAssertUrlEqualsDsl"),dD(function(e,t,n=""){return hD(280)+pD(e)+", "+t+", "+fD(n)+");"},hD(175)),dD(function(e,t){const n=hD,s=e[n(183)](/-/g,"_");return n(368)+s+"("+fD(e)+", "+fD(t)+n(507)},hD(330));var mD=(dD(s=class{constructor(e){Pt(this,n);const t=399,s=201,i=hD;typeof e===i(184)?this.elements=new Array(e)[i(t)](void 0):Array[i(316)](e)?this.elements=[...e]:this[i(s)]=[...e[i(201)]]}get(e){return this[hD(201)][e]}[(n=hD(201),hD(162))](e,t){this[hD(201)][e]=t}[hD(239)](){throw new Error(hD(521))}[hD(224)](){const e=453,t=hD;return new s(this[t(201)][t(e)](e=>e.clone()))}[hD(242)](){const e=hD;return"["+this.elements[e(453)](t=>t[e(242)]())[e(476)](", ")+"]"}[hD(191)](){return this.asString()}},hD(171)),s),_D=(dD(o=class{constructor(e){Pt(this,i);const t=hD;typeof e===t(371)?this.value=e?1:0:this[t(499)]=e}clone(){return new o(this[hD(499)])}[(r=hD(474),i=hD(499),hD(239))](){return this[hD(499)]}asString(){return this[hD(499)].toString()}[hD(191)](){return this[hD(242)]()}},hD(321)),Pt(o,r,new o(0)),o),xD=(dD(l=class{static isExists(e){const t=hD;return this[t(449)][t(467)](e)}static[(a=hD(449),hD(344))](e){const t=414,n=hD,s=this[n(449)].get(e);if(!s)throw new TypeError(n(t)+e);return s}static set(e,t){const n=hD;this[n(449)][n(162)](e,t)}},hD(248)),Pt(l,a,new Map([["cos",{execute(...e){const t=hD;if(1!==e[t(406)])throw new Error(t(185));return new _D(Math[t(432)](e[0][t(239)]()))}}],[hD(228),{execute(...e){const t=242,n=hD;for(const s of e)console.log(s[n(t)]());return _D.ZERO}}],[hD(299),{execute:(...e)=>_D.ZERO}],["setPage",{execute:(...e)=>_D.ZERO}],[hD(486),{execute:(...e)=>_D.ZERO}],[hD(423),{execute:(...e)=>_D[hD(474)]}],[hD(298),{execute:(...e)=>_D[hD(474)]}]])),l),bD=(dD(h=class{constructor(e=new Map){Pt(this,c);this[hD(206)]=e}[(c=hD(206),hD(344))](e){const t=hD;return this[t(206)][t(344)](e)}[hD(162)](e,t){const n=hD;this.properties[n(162)](e,t)}[hD(239)](){const e=hD;return this.properties[e(255)]}[hD(242)](){const e=206,t=539,n=476,s=hD;return"{"+Array[s(550)](this[s(e)][s(t)]())[s(453)](([e,t])=>e+": "+t.asString())[s(n)](", ")+"}"}[hD(224)](){const e=224,t=hD,n=new Map;return this[t(206)][t(566)]((s,i)=>{const r=t;n.set(i,s[r(e)]())}),new h(n)}[hD(557)](){return this[hD(206)]}},hD(559)),h),yD=(dD(f=class{constructor(e,t){Pt(this,d),Pt(this,u);const n=hD;kD(t),this[n(543)]=e,this[n(577)]=t}[(d=hD(543),u=hD(577),hD(224))](){const e=hD;return new f(this.source,this[e(577)])}[hD(239)](){return NaN}[hD(242)](){const e=hD;return"/"+this[e(543)]+"/"+this[e(577)]}[hD(191)](){return this[hD(242)]()}},hD(313)),f),wD=new Set(["g","i","m"]),SD={s:hD(251),u:hD(180),y:"ES6 sticky",d:hD(574),v:hD(221)};function kD(e){const t=384,n=570,s=467,i=556,r=hD,o=new Set;for(const a of e){if(SD[a])throw new CD(r(462)+a+r(t)+SD[a]+r(n));if(!wD[r(s)](a))throw new CD(r(381)+a+r(i));if(o[r(467)](a))throw new CD(r(505)+a+"'.");o[r(203)](a)}}dD(kD,hD(461));var CD=(dD(p=class extends Error{constructor(e){const t=hD;super(e),this[t(420)]=t(431)}},hD(431)),p),jD=(dD(g=class{constructor(e){Pt(this,v);this[hD(499)]=e}[(v=hD(499),hD(224))](){return new g(this.value)}[hD(239)](){try{return parseFloat(this.value)}catch(e){return 0}}[hD(242)](){return this[hD(499)]}[hD(191)](){return this[hD(242)]()}},"StringValue"),g),ND=(dD(x=class{constructor(e,t){Pt(this,_),Pt(this,m);const n=hD;this.argNames=e,this[n(274)]=t}[(_=hD(273),m=hD(274),hD(472))](){const e=hD;return this.argNames[e(406)]}[hD(271)](e){const t=hD;return e<0||e>=this.argNames[t(406)]?"":this[t(273)][e]}[hD(335)](...e){const t=274,n=hD;try{return this[n(t)][n(335)](),_D[n(474)]}catch(s){if(s instanceof eL)return s.getResult();throw s}}},hD(526)),x),MD=(dD(y=class{static[(b=hD(300),hD(454))](){const e=539,t=300,n=hD,s=new Map([]);for(const[i,r]of this.variables[n(e)]())s[n(162)](i,r);this[n(t)].push(s)}static[hD(394)](){const e=204,t=hD,n=this[t(300)][t(394)]();if(!n)throw new Error(t(530));this[t(e)]=n}static[hD(551)](e){return this[hD(204)].has(e)}static[hD(344)](e){const t=hD;return this[t(204)][t(344)](e)||_D[t(474)]}static set(e,t){const n=hD;this[n(204)][n(162)](e,t)}},"Variables"),Pt(y,b,[]),Pt(y,"variables",new Map([["PI",new _D(Math.PI)],["E",new _D(Math.E)]])),y),BD=(dD(k=class{constructor(e,t,n){Pt(this,"variable"),Pt(this,S),Pt(this,w);const s=hD;this[s(553)]=e,this[s(428)]=t,this[s(339)]=n}get[(S=hD(428),w=hD(339),hD(282))](){return this.variable}get[hD(514)](){return this[hD(428)]}[hD(567)](){const e=hD,t=this.lastIndex();return this[e(365)]().get(t)}[hD(278)](){const e=406,t=hD;return this[t(177)](this[t(428)][t(e)]-1)}[hD(177)](e){const t=239,n=hD;return this[n(428)][e][n(567)]()[n(t)]()}getArray(){const e=553,t=428,n=344,s=177,i=hD;let r=this[i(214)](MD[i(344)](this[i(e)]));const o=this[i(t)].length-1;for(let a=0;a<o;a++)r=this.consumeArray(r[i(n)](this[i(s)](a)));return r}[hD(214)](e){if(e instanceof mD)return e;throw new Error("Array expected")}[hD(191)](){const e=428,t=hD;return""+(this[t(553)]+this[t(e)])}},hD(477)),k),DD=(dD(M=class{constructor(e,t,n){Pt(this,N),Pt(this,j),Pt(this,C);const s=hD;this[s(492)]=e,this[s(304)]=t,this[s(339)]=n}[(N=hD(492),j=hD(304),C=hD(339),hD(335))](){const e=365,t=162,n=278,s=hD;this.array[s(e)]()[s(t)](this[s(492)][s(n)](),this[s(304)].eval())}[hD(191)](){const e=561,t=304,n=hD;return this.array+n(e)+this[n(t)]}},hD(442)),M),LD=(dD(L=class{constructor(e,t){Pt(this,D),Pt(this,B),this.elements=e,this.token=t}[(D=hD(201),B=hD(339),hD(567))](){const e=hD,t=this[e(201)].map(t=>t[e(567)]());return new mD(t)}[hD(191)](){const e=191,t=hD;return""+this[t(201)][t(e)]()}},hD(446)),L),ED=(dD(A=class{constructor(e,t,n){Pt(this,R),Pt(this,P),Pt(this,E);const s=hD;this.variable=e,this[s(304)]=t,this[s(339)]=n}[(R=hD(553),P=hD(304),E=hD(339),hD(335))](){const e=567,t=162,n=553,s=hD,i=this[s(304)][s(e)]();MD[s(t)](this[s(n)],i)}[hD(191)](){const e=hD;return this.variable+e(561)+this.expression}},hD(264)),A),PD=(dD(H=class{constructor(e,t,n,s){Pt(this,O),Pt(this,I),Pt(this,T),Pt(this,z);const i=hD;this.operation=e,this[i(504)]=t,this[i(192)]=n,this[i(339)]=s}eval(){const e=504,t=567,n=235,s=hD,i=this[s(504)].eval();if(i instanceof jD||i instanceof mD){const e=i[s(242)](),t=this[s(192)][s(567)]()[s(242)]();if("+"===this.operation)return new jD(e+t);throw new Error("Unrecognized operator for string value")}const r=this[s(e)][s(t)]()[s(239)](),o=this[s(192)].eval()[s(239)]();switch(this[s(n)]){case"-":return new _D(r-o);case"+":return new _D(r+o);case"/":return new _D(r/o);default:return new _D(r*o)}}[(O=hD(235),I=hD(504),T=hD(192),z=hD(339),hD(191))](){const e=hD;return this.expr1+" "+this[e(235)]+" "+this[e(192)]}},"BinaryExpression"),H),RD=(dD(W=class{constructor(e){Pt(this,F,[]),Pt(this,"token");this[hD(339)]=e}add(e){const t=hD;this[t(312)][t(454)](e)}[(F=hD(312),hD(335))](){const e=hD;for(const t of this[e(312)])t.execute()}[hD(191)](){const e=hD;return""+this[e(312)][e(476)]("\n")}},hD(426)),W),AD=(dD(U=class extends Error{constructor(e){const t=hD;super(t(286)),Pt(this,"token"),this[t(339)]=e}[hD(335)](){throw this}[hD(191)](){return hD(416)}},hD(286)),U),zD=(e=>{const t=292,n=168,s=402,i=241,r=hD;return e[r(440)]="+",e[r(t)]="-",e[r(540)]="*",e[r(n)]="/",e.EQ="==",e[r(421)]="!=",e.SEQ="===",e[r(s)]=r(481),e.LT="<",e[r(i)]="<=",e.GT=">",e[r(276)]=">=",e[r(500)]="&&",e.OR="||",e})(zD||{});dD(function(e){const t=hD;for(const[n,s]of Object[t(539)](zD))if(s===e)return n;return"EQ"},"getOperatorName");var TD=(dD(Y=class{constructor(e,t,n,s){Pt(this,V),Pt(this,$),Pt(this,q),Pt(this,K);const i=hD;this[i(235)]=e,this[i(504)]=t,this[i(192)]=n,this[i(339)]=s}[(V=hD(235),$=hD(504),q=hD(192),K=hD(339),hD(567))](){const e=567,t=481,n=242,s=235,i=242,r=242,o=567,a=235,l=hD,c=this[l(504)][l(e)](),h=this.expr2[l(e)]();if(this[l(235)]===l(445)||this.operation===l(t)){let e;return e=c instanceof jD&&h instanceof jD?c[l(n)]()===h[l(242)]():c instanceof _D&&h instanceof _D&&c[l(239)]()===h[l(239)](),new _D(this[l(s)]===l(445)?e:!e)}let u,d,f;switch(c instanceof jD?(u=u=c[l(i)]()[l(295)](h[l(r)]()),d=0):(u=this[l(504)][l(567)]()[l(239)](),d=this[l(192)][l(o)]()[l(239)]()),this[l(a)]){case"<":f=u<d;break;case"<=":f=u<=d;break;case">":f=u>d;break;case">=":f=u>=d;break;case"!=":f=u!=d;break;case"&&":f=0!=u&&0!=d;break;case"||":f=0!=u||0!=d;break;default:f=u===d}return new _D(f)}[hD(191)](){const e=192,t=hD;return this[t(504)]+" "+this[t(235)]+" "+this[t(e)]}},hD(288)),Y),ID=(dD(X=class extends Error{constructor(e){const t=hD;super(t(520)),Pt(this,G),this[t(339)]=e}[(G=hD(339),hD(335))](){throw this}[hD(191)](){return"continue"}},"ContinueStatement"),X),OD=(dD(Q=class{constructor(e,t,n){Pt(this,J),Pt(this,"statement"),Pt(this,Z);const s=hD;this[s(268)]=e,this[s(495)]=t,this.token=n}[(J=hD(268),Z=hD(339),hD(335))](){const e=268,t=239,n=hD;do{try{this.statement.execute()}catch(s){if(s instanceof AD)break;if(!(s instanceof ID))throw s}}while(0!=this[n(e)][n(567)]()[n(t)]())}[hD(191)](){const e=hD;return e(395)+this[e(495)]+e(211)+this[e(268)]+")\n"}},hD(375)),Q),HD=(dD(se=class{constructor(e,t,n,s,i){Pt(this,ne),Pt(this,te),Pt(this,"increment"),Pt(this,"block"),Pt(this,ee);const r=356,o=429,a=hD;this[a(385)]=e,this[a(r)]=t,this[a(o)]=n,this[a(234)]=s,this[a(339)]=i}execute(){const e=335,t=567,n=335,s=234,i=hD;for(this[i(385)][i(e)]();0!=this[i(356)][i(t)]()[i(239)]();this[i(429)][i(n)]())try{this[i(s)][i(335)]()}catch(r){if(r instanceof AD)break;if(!(r instanceof ID))throw r}}[(ne=hD(385),te=hD(356),ee=hD(339),hD(191))](){const e=385,t=166,n=234,s=hD;return s(272)+this[s(e)]+"; "+this.termination+"; "+this[s(429)]+s(t)+this[s(n)]+"\n}"}},hD(496)),se),FD=(dD(ae=class{constructor(e,t,n,s){Pt(this,oe),Pt(this,re),Pt(this,"body"),Pt(this,ie);const i=273,r=274,o=339,a=hD;this.name=e,this[a(i)]=t,this[a(r)]=n,this[a(o)]=s}[(oe=hD(420),re=hD(273),ie=hD(339),hD(335))](){const e=420,t=273,n=hD;xD[n(162)](this[n(e)],new ND(this[n(t)],this[n(274)]))}[hD(191)](){const e=476,t=531,n=hD,s=this[n(273)][n(453)](e=>e[n(191)]())[n(e)](", ");return n(t)+this.name+"("+s+")"}},hD(522)),ae),WD=(dD(he=class{constructor(e,t){Pt(this,ce),Pt(this,le),this.functionalExpression=e,this.token=t}[(ce=hD(259),le=hD(339),hD(335))](){this[hD(259)].eval()}[hD(191)](){const e=hD;return""+this[e(259)][e(191)]()}},hD(325)),he),UD=(dD(pe=class{constructor(e,t,n){Pt(this,fe),Pt(this,de),Pt(this,ue);this[hD(420)]=e,this.arguments=t,this.token=n}addArgument(e){const t=hD;return this[t(419)][t(454)](e)}eval(){const e=406,t=344,n=334,s=162,i=335,r=hD,o=this[r(419)][r(453)](e=>e[r(567)]()),a=o[r(e)],l=xD[r(t)](this[r(420)]);if(l instanceof ND){const e=l;if(o[r(406)]!==e[r(472)]())throw new Error(r(n)+this[r(420)]+": expected "+a);MD.push();for(let n=0;n<a;n++)MD[r(s)](e[r(271)](n),o[n]);const t=e.execute(...o);return MD.pop(),t}return l[r(i)](...o)}[(fe=hD(420),de=hD(419),ue=hD(339),hD(191))](){const e=453,t=476,n=420,s=hD,i=this[s(419)][s(e)](e=>e.toString())[s(t)](", ");return this[s(n)]+"("+i+")"}},hD(391)),pe),KD=(dD(_e=class{constructor(e,t,n,s){Pt(this,me),Pt(this,"ifStatement"),Pt(this,ge),Pt(this,ve);const i=hD;this[i(304)]=e,this[i(265)]=t,this.elseStatement=n,this[i(339)]=s}[(me=hD(304),ge=hD(217),ve=hD(339),hD(335))](){const e=335,t=hD;0!=this[t(304)][t(567)]()[t(239)]()?this[t(265)][t(e)]():null!=this[t(217)]&&this[t(217)].execute()}[hD(191)](){const e=265,t=217,n=hD;let s="if "+this[n(304)]+" "+this[n(e)];return null!=this[n(217)]&&(s+=" else "+this[n(t)]),s.toString()}},hD(243)),_e),qD=(e=>{const t=366,n=366,s=hD;return e[e[s(269)]=0]=s(269),e[e[s(200)]=1]=s(200),e[e[s(565)]=2]="POSTFIX_INCREMENT",e[e[s(t)]=3]=s(n),e})(qD||{}),$D=(dD(we=class{constructor(e,t,n){Pt(this,ye),Pt(this,be),Pt(this,xe);const s=455,i=339,r=hD;this.variable=e,this[r(s)]=t,this[r(i)]=n}[(ye=hD(553),be=hD(455),xe=hD(339),hD(567))](){const e=239,t=162,n=hD,s=this[n(553)][n(469)](),i=MD.get(s);if(!(i instanceof _D))throw new Error(n(209));const r=i[n(e)]();let o;switch(this[n(455)]){case 0:return o=r+1,MD[n(t)](s,new _D(o)),new _D(o);case 1:return o=r-1,MD[n(162)](s,new _D(o)),new _D(o);case 2:return MD[n(t)](s,new _D(r+1)),new _D(r);case 3:return MD[n(162)](s,new _D(r-1)),new _D(r)}}},hD(254)),we),VD=(dD(ke=class{constructor(e,t){Pt(this,Se),Pt(this,"token");const n=hD;this[n(304)]=e,this[n(339)]=t}[(Se=hD(304),hD(335))](){this.expression.eval()}},hD(494)),ke),YD=(dD(Me=class{constructor(e,t,n,s){Pt(this,Ne),Pt(this,"name"),Pt(this,je),Pt(this,Ce);const i=420,r=hD;this[r(309)]=e,this[r(i)]=t,this.arguments=n,this.token=s}[(Ne=hD(309),je=hD(419),Ce=hD(339),hD(567))](){throw new Error(hD(245))}toString(){const e=453,t=476,n=191,s=hD,i=this[s(419)][s(e)](e=>e[s(191)]())[s(t)](", ");return this[s(309)][s(n)]()+"."+this.name+"("+i+")"}},hD(220)),Me),GD=(dD(Ee=class{constructor(e,t,n,s){Pt(this,Le),Pt(this,"argNames"),Pt(this,De),Pt(this,Be);const i=hD;this[i(420)]=e,this[i(273)]=t,this[i(274)]=n,this[i(339)]=s}[(Le=hD(420),De=hD(274),Be=hD(339),hD(335))](){}[hD(191)](){const e=420,t=434,n=hD,s=this.argNames.map(e=>e[n(191)]())[n(476)](", ");return"//@"+this[n(e)]+"("+s+")\n"+this[n(274)]+n(t)+this[n(420)]}},hD(290)),Ee),XD=(dD(Ae=class{constructor(e=new Map,t){Pt(this,Re),Pt(this,Pe);const n=339,s=hD;this[s(206)]=e,this[s(n)]=t}[(Re=hD(206),Pe=hD(339),hD(567))](){const e=206,t=566,n=162,s=567,i=hD,r=new Map;return this[i(e)][i(t)]((e,t)=>{const o=i;r[o(n)](t,e[o(s)]())}),new bD(r)}[hD(191)](){const e=206,t=539,n=453,s=hD;return"{"+Array.from(this[s(e)][s(t)]())[s(n)](([e,t])=>e+": "+t[s(191)]())[s(476)](", ")+"}"}},hD(190)),Ae),ZD=(dD(Te=class{constructor(e,t){Pt(this,"expression"),Pt(this,ze);const n=hD;this[n(304)]=e,this[n(339)]=t}[(ze=hD(339),hD(335))](){const e=567,t=hD,n=this[t(304)][t(e)]()[t(242)]();console[t(409)](""+n)}[hD(191)](){const e=hD;return e(225)+this[e(304)]}},hD(319)),Te),JD=(dD(He=class{constructor(e,t,n){Pt(this,Oe),Pt(this,Ie),Pt(this,"token");const s=hD;this[s(309)]=e,this[s(420)]=t,this[s(339)]=n}[(Oe=hD(309),Ie=hD(420),hD(567))](){throw new Error(hD(518))}[hD(191)](){const e=420,t=hD;return this[t(309)].toString()+"."+this[t(e)]}},hD(512)),He),QD=(dD(Ke=class{constructor(e,t,n){Pt(this,Ue),Pt(this,"source"),Pt(this,We),Pt(this,Fe);const s=hD;this[s(339)]=n,this[s(543)]=e,this.flags=t,this[s(499)]=new yD(e,t)}[(Ue=hD(339),We=hD(577),Fe=hD(499),hD(567))](){return this[hD(499)]}toString(){return this.value.asString()}},hD(303)),Ke),eL=(dD(Ye=class extends Error{constructor(e,t){const n=hD;super(n(520)),Pt(this,Ve),Pt(this,$e),Pt(this,qe),this[n(304)]=e,this[n(339)]=t}getResult(){const e=hD;if(!this[e(324)])throw new Error("Not execute ReturnStatement");return this[e(324)]}[(Ve=hD(304),$e=hD(324),qe=hD(339),hD(335))](){const e=hD;throw this.result=this[e(304)][e(567)](),this}toString(){return"return"}},hD(468)),Ye),tL=(e=>{const t=473,n=408,s=580,i=338,r=515,o=503,a=169,l=320,c=411,h=411,u=167,d=208,f=360,p=440,v=315,g=292,m=292,_=305,x=350,b=178,y=328,w=233,S=387,k=497,C=458,j=213,N=527,M=552,B=569,D=479,L=194,E=424,P=377,R=448,A=hD;return e[e[A(473)]=0]=A(t),e[e[A(n)]=1]=A(n),e[e[A(498)]=2]=A(498),e[e.REGEX=3]=A(s),e[e[A(338)]=4]=A(i),e[e[A(515)]=5]=A(r),e[e.IF=6]="IF",e[e[A(o)]=7]="ELSE",e[e[A(a)]=8]=A(169),e[e[A(320)]=9]=A(l),e[e.DO=10]="DO",e[e.BREAK=11]=A(164),e[e[A(c)]=12]=A(h),e[e[A(u)]=13]="FUNCTION",e[e[A(d)]=14]=A(208),e[e[A(f)]=15]=A(f),e[e[A(440)]=16]=A(p),e[e[A(v)]=17]=A(v),e[e[A(g)]=18]=A(m),e[e[A(_)]=19]=A(305),e[e[A(x)]=20]="STAR",e[e[A(b)]=21]=A(b),e[e.EQ=22]="EQ",e[e.EQEQ=23]=A(y),e[e[A(w)]=24]=A(233),e[e[A(S)]=25]=A(S),e[e[A(k)]=26]=A(k),e[e.EXCLEQEQ=27]=A(327),e[e.LT=28]="LT",e[e.LTEQ=29]="LTEQ",e[e.GT=30]="GT",e[e[A(516)]=31]=A(516),e[e[A(367)]=32]=A(367),e[e[A(C)]=33]=A(458),e[e[A(213)]=34]=A(j),e[e[A(527)]=35]=A(N),e[e[A(487)]=36]="LPAREN",e[e[A(240)]=37]=A(240),e[e[A(M)]=38]=A(552),e[e[A(569)]=39]=A(B),e[e[A(D)]=40]=A(D),e[e.RBRACKET=41]=A(L),e[e[A(424)]=42]=A(E),e[e.COLON=43]="COLON",e[e.SEMICOLON=44]="SEMICOLON",e[e.DOT=45]=A(342),e[e[A(P)]=46]=A(377),e[e.META_BLOCK=47]=A(558),e[e.CLOSE_META_BLOCK=48]="CLOSE_META_BLOCK",e[e[A(R)]=49]="EOF",e})(tL||{}),nL=(dD(Ze=class{constructor(e,t){Pt(this,Xe),Pt(this,Ge);const n=hD;if(this[n(339)]=t,0!==t[n(189)]()){if(2!==t.getType())throw new Error("Unrecognized value. "+t);this.value=new jD(e)}else this.value=new _D(parseFloat(e))}[(Xe=hD(499),Ge=hD(339),hD(567))](){return this[hD(499)]}[hD(191)](){const e=hD;return""+this.value[e(242)]()}},"ValueExpression"),Ze),sL=(dD(tt=class{constructor(e,t,n,s={}){Pt(this,"label"),Pt(this,et),Pt(this,Qe),Pt(this,Je),Pt(this,"options");const i=hD;this.label=e,this.body=t,this[i(339)]=n,this[i(563)]=s[i(563)]??!1,this[i(489)]=s[i(489)]??null}[(et=hD(274),Qe=hD(339),Je=hD(563),hD(237))](){const e=hD;return this[e(489)]instanceof XD?this.options.properties[e(344)]("tag"):void 0}[hD(335)](){}labelText(){const e=407,t=499,n=hD;return this.label instanceof nL?this[n(e)][n(t)][n(242)]():""}[hD(191)](){const e=285,t=489,n=407,s=172,i=274,r=hD,o=this[r(563)]?r(215):r(e),a=this[r(t)]?this[r(489)]+", ":"";return o+"("+this[r(n)]+", "+a+r(s)+this[r(i)]+"\n})"}},hD(353)),tt),iL=(dD(rt=class{constructor(e,t,n){Pt(this,it),Pt(this,st),Pt(this,nt);const s=hD;this[s(308)]=e,this.operand=t,this[s(339)]=n}eval(){const e=239,t=239,n=hD;return"-"===this[n(308)]?new _D(-this[n(205)][n(567)]()[n(e)]()):new _D(this[n(205)].eval()[n(t)]())}[(it=hD(205),st=hD(308),nt=hD(339),hD(191))](){const e=205,t=hD;return""+this[t(308)]+this[t(e)]}},hD(287)),rt),rL=(dD(at=class{[(ot=hD(219),hD(224))](){return at[hD(219)]}asNumber(){return NaN}asString(){return"undefined"}[hD(191)](){return this[hD(242)]()}},hD(380)),Pt(at,ot,new at),at),oL=(dD(lt=class{constructor(e,t){Pt(this,"declarators"),Pt(this,"token");this[hD(333)]=e,this.token=t}[hD(335)](){const e=hD;for(const t of this[e(333)])if(t.init){const n=t.init[e(567)]();MD[e(162)](t[e(420)],n)}else MD.set(t[e(420)],rL[e(219)])}[hD(191)](){const e=476,t=293,n=hD,s=this[n(333)].map(e=>e[n(513)]?e[n(420)]+" = "+e[n(513)]:e[n(420)])[n(e)](", ");return n(t)+s}},hD(392)),lt),aL=(dD(ut=class{constructor(e,t){Pt(this,ht),Pt(this,ct);const n=339,s=hD;this[s(420)]=e,this[s(n)]=t}[(ht=hD(420),ct=hD(339),hD(567))](){const e=344,t=hD;if(!MD[t(551)](this[t(420)]))throw new Error(t(548)+this[t(420)]+t(444));return MD[t(e)](this[t(420)])}[hD(469)](){return this[hD(420)]}[hD(191)](){return""+this.name}},hD(281)),ut),lL=(dD(ft=class{constructor(e,t,n){Pt(this,dt),Pt(this,"statement"),Pt(this,"token");const s=495,i=hD;this[i(268)]=e,this[i(s)]=t,this.token=n}[(dt=hD(268),hD(335))](){const e=hD;for(;0!=this[e(268)][e(567)]().asNumber();)try{this[e(495)].execute()}catch(t){if(t instanceof AD)break;if(!(t instanceof ID))throw t}}[hD(191)](){const e=268,t=495,n=hD;return n(412)+this[n(e)]+n(166)+this[n(t)]+"\n}"}},hD(332)),ft),cL=(dD(mt=class extends(gt=Error,vt=hD(466),pt=hD(562),gt){constructor(e,t,n){const s=hD;super(e),Pt(this,vt),Pt(this,pt),this.name=s(579),this[s(466)]=t,this[s(562)]=n}static at(e,t){const n=hD;return new mt(t,e[n(532)](),e[n(457)]())}},hD(579)),mt),hL=(dD(bt=class{constructor(e,t,n,s){Pt(this,xt),Pt(this,_t),Pt(this,"column"),Pt(this,"line");const i=hD;this.type=e,this[i(435)]=t,this[i(562)]=n,this[i(466)]=s}[(xt=hD(435),_t=hD(455),hD(400))](){return this[hD(435)]}[hD(189)](){return this[hD(455)]}[hD(532)](){return this[hD(466)]}[hD(457)](){return this[hD(562)]}[hD(191)](){const e=195,t=435,n=343,s=310,i=562,r=hD;return r(283)+tL[this[r(455)]]+r(e)+this[r(t)]+r(n)+this[r(466)]+r(s)+this[r(i)]+")"}},hD(261)),bt);function uL(e){const t=hD,n=Number(e);return!isNaN(n)&&e[t(357)]()===n[t(191)]()}function dL(e){return/^[a-zA-Zа-яА-ЯёЁ_$]$/[hD(480)](e)}function fL(e){return/^[a-zA-Zа-яА-ЯёЁ0-9_$]$/.test(e)}dD(uL,hD(186)),dD(dL,hD(537)),dD(fL,hD(390));var pL=new Set([0,1,2,4,37,41,17,19]);function vL(e){return!pL[hD(467)](e)}dD(vL,hD(173));var gL=(dD(jt=class{constructor(e){Pt(this,Ct,hD(193)),Pt(this,kt,new Map([["+",16],["++",17],["-",18],["--",19],["*",20],["/",21],["(",36],[")",37],["{",38],["}",39],["[",40],["]",41],["=",22],["<",28],[">",30],[",",42],[":",43],[";",44],[".",45],["!",25],["&",34],["|",32],["==",23],[hD(445),24],["!=",26],[hD(481),27],["<=",29],[">=",31],["=>",46],["&&",35],["||",33]])),Pt(this,"input"),Pt(this,"length"),Pt(this,St,[]),Pt(this,"pos",0),Pt(this,wt,1),Pt(this,yt,1),Pt(this,"comments",[]);const t=hD;this[t(403)]=e,this[t(406)]=e.length}[(Ct=hD(575),kt=hD(262),St=hD(289),wt=hD(562),yt=hD(466),hD(181))](){const e=257,t=508,n=230,s=266,i=349,r=562,o=289,a=hD;for(;this[a(176)]<this.length;){const o=this[a(355)](0);if(uL(o))this[a(218)]();else if(dL(o))this[a(e)]();else if('"'===o||"'"===o)this[a(506)](o);else if("`"===o)this[a(415)]();else if(this[a(t)](3)===a(n))this.tokenizeMetaWord();else if("/"===o&&this.regexContextAllowed())this.tokenizeRegex();else if(-1!==this[a(575)][a(s)](o))this[a(i)]();else{if(" "!==o&&"\t"!==o&&"\r"!==o&&"\n"!==o&&"\ufeff"!==o)throw" "===o?new cL("Unexpected non-breaking space (U+00A0) — replace it with a regular space",this.line,this[a(562)]):new cL(a(197)+JSON[a(470)](o),this[a(466)],this[a(r)]);this[a(388)]()}}return this[a(o)]}[hD(447)](){const e=hD;if("/"===this[e(355)](1)||"*"===this.peek(1))return!1;const t=0===this[e(289)][e(406)]?null:this[e(289)][this.tokens[e(406)]-1];return null===t||vL(t[e(189)]())}[hD(538)](){const e=355,t=465,n=388,s=454,i=388,r=388,o=476,a=hD,l=this[a(562)],c=this[a(466)];this[a(388)]();const h=[];let u=!1,d=this[a(e)](0);for(;"\0"!==d;){if("\n"===d||"\r"===d)throw new cL("Unterminated regex literal (line break inside body).",c,l);if("\\"!==d)if("["!==d||u)if("]"===d&&u)u=!1,h[a(s)](d),d=this[a(i)]();else{if("/"===d&&!u)break;h.push(d),d=this[a(r)]()}else u=!0,h.push(d),d=this[a(388)]();else{if(h[a(454)](d),d=this[a(388)](),"\0"===d||"\n"===d||"\r"===d)throw new cL(a(t),c,l);h.push(d),d=this[a(n)]()}}if("/"!==d)throw new cL("Unterminated regex literal (missing closing /).",c,l);this[a(i)]();const f=[];for(d=this.peek(0);"\0"!==d&&fL(d);)f.push(d),d=this.next();this.addToken(3,h[a(o)]("")+"\0"+f.join(""),l,c)}[hD(388)](){const e=176,t=562,n=hD,s=this[n(403)][n(250)](this[n(176)]);return this[n(e)]++,"\n"==s?(this.line++,this[n(t)]=1):this.column++,this[n(355)](0)}peek(e){const t=403,n=hD,s=this[n(176)]+e;return s>=this.length?"\0":this[n(t)][n(250)](s)}[hD(508)](e){const t=355,n=hD,s=[];for(let i=0;i<e;i++)s[n(454)](this[n(t)](i));return s[n(476)]("")}[hD(372)](e,t,n,s){this[hD(289)].push(new hL(e,t,n,s))}tokenizeNumber(){const e=466,t=466,n=454,s=372,i=476,r=hD,o=this.column,a=this[r(e)],l=[];let c=this[r(355)](0);for(;"\0"!==c;){if("."==c){if(-1!==l.indexOf("."))throw new cL(r(483),this[r(t)],this[r(562)])}else if(!uL(c))break;l[r(n)](c),c=this[r(388)]()}this[r(s)](0,l[r(i)](""),o,a)}consumeWord(){const e=388,t=hD,n=[];let s=this.peek(0);for(;"\0"!==s&&fL(s);)n[t(454)](s),s=this[t(e)]();return n.join("")}tokenizeMetaWord(){const e=466,t=388,n=388,s=555,i=372,r=hD,o=this[r(562)],a=this[r(e)];this[r(t)](),this[r(n)](),this.next();const l=this[r(s)]();l[r(417)]("end")?this[r(i)](48,l,o,a):this[r(372)](47,l,o,a)}[hD(257)](){const e=466,t=372,n=346,s=179,i=372,r=463,o=372,a=hD,l=this[a(562)],c=this[a(e)],h=this.consumeWord();switch(h){case"var":this[a(t)](4,"",l,c);break;case a(n):this[a(372)](5,"",l,c);break;case"if":this.addToken(6,"",l,c);break;case a(s):this.addToken(7,"",l,c);break;case"for":this[a(t)](9,"",l,c);break;case a(547):this[a(i)](8,"",l,c);break;case"do":this[a(t)](10,"",l,c);break;case"break":this[a(t)](11,"",l,c);break;case a(323):this[a(t)](12,"",l,c);break;case a(389):this[a(372)](13,"",l,c);break;case a(r):this[a(372)](14,"",l,c);break;case a(285):this[a(o)](15,"",l,c);break;default:this[a(372)](1,h,l,c)}}[hD(506)](e){const t=388,n=388,s=454,i=454,r=454,o=541,a=hD,l=this[a(562)],c=this.line;this[a(388)]();const h=[];let u=this[a(355)](0);for(;"\0"!==u;)if("\\"!=u){if(u==e)break;h[a(r)](u),u=this[a(388)]()}else{switch(u=this[a(t)](),u){case e:u=this[a(n)](),h[a(s)](e);continue;case"n":u=this[a(n)](),h[a(s)]("\n");continue;case"t":u=this.next(),h[a(s)]("\t");continue;case"\\":u=this.next(),h[a(i)]("\\");continue}h[a(454)]("\\"),"\0"!==u&&(h[a(454)](u),u=this[a(388)]())}if("\0"===u)throw new cL(a(o),c,l);this.next();const d=h.join("");this[a(372)](2,d,l,c)}[hD(415)](){const e=355,t=454,n=hD,s=this[n(562)],i=this[n(466)];this.next();const r=[];let o=this[n(e)](0);for(;"\0"!==o&&"`"!==o;){if("$"===o&&"{"===this[n(355)](1))throw new cL(n(329),this.line,this[n(562)]);r[n(t)](o),o=this.next()}if("\0"===o)throw new cL(n(491),i,s);this.next(),this[n(372)](2,r[n(476)](""),s,i)}tokenizeComment(e,t){const n=534,s=454,i=476,r=357,o=hD,a=[];let l=this.peek(0);for(;-1==o(n)[o(266)](l);)a[o(s)](l),l=this[o(388)]();this[o(275)][o(s)]({line:e,column:t,text:a[o(i)]("")[o(r)]()})}[hD(430)](e,t){const n=355,s=454,i=388,r=275,o=hD,a=[];let l=this[o(355)](0);for(;"\0"!=l&&("*"!=l||"/"!=this[o(n)](1));)a[o(s)](l),l=this[o(i)]();if("\0"==l)throw new cL("Missing close tag in comment",e,t);this.next(),this[o(388)](),this[o(r)].push({line:e,column:t,text:a[o(476)]("")[o(357)]()})}[hD(349)](){const e=388,t=388,n=430,s=562,i=466,r=262,o=467,a=344,l=388,c=476,h=hD;let u=this[h(355)](0);if("/"==u){const s=this.line,i=this[h(562)];if("/"==this[h(355)](1))return this[h(e)](),this[h(t)](),void this.tokenizeComment(s,i);if("*"==this[h(355)](1))return this[h(388)](),this.next(),void this[h(n)](s,i)}const d=this[h(s)],f=this[h(i)],p=[];for(;"\0"!==u;){const e=p.join("");if(!this[h(r)][h(o)](e+u)&&""!=e){const t=this[h(262)][h(a)](e);if(!t)throw new cL("Invalid tokenizeOperator "+e,f,d);return void this[h(372)](t,"",d,f)}p[h(454)](u),u=this[h(l)]()}const v=p[h(c)]("");if(""!==v){const e=this.OPERATORS[h(a)](v);if(e)return void this.addToken(e,"",d,f)}throw new cL(h(511),f,d)}},hD(560)),jt);function mL(e,t,n,s=2){const i=438,r=439,o=406,a=406,l=454,c=438,h=482,u=hD,d=e[u(294)](/\r\n|\n|\r/),f=Math.min(Math[u(i)](t,1),d[u(406)]),p=Math[u(i)](1,f-s),v=Math[u(r)](d[u(o)],f+s),g=String(v)[u(a)],m=[];for(let _=p;_<=v;_++){const e=d[_-1]??"",t=String(_).padStart(g);if(_!==f){m[u(l)](u(482)+t+u(232)+e);continue}m[u(454)](u(502)+t+" | "+e);const s=Math.min(Math[u(c)](n,1),e[u(a)]+1)-1;m[u(l)](u(h)+" "[u(450)](g)+u(232)+" "[u(450)](s)+"^")}return m[u(476)]("\n")}dD(mL,hD(544)),dD(function(e,t){const n=hD;return t[n(348)]+" (line "+t[n(466)]+", column "+t.column+")\n"+mL(e,t.line,t[n(562)])},"formatParseError");var _L=(dD(Lt=class{constructor(e){Pt(this,"EOF",new hL(49,"",-1,-1)),Pt(this,Dt,[]),Pt(this,Bt,0),Pt(this,Mt);const t=hD;this[t(289)]=e,this[t(255)]=e.length}[(Dt=hD(289),Bt=hD(176),Mt=hD(255),hD(393))](){const e=203,t=hD,n=this[t(344)](0),s=new RD(n);for(;!this.match(49);)s[t(e)](this.statement()),this.match(44);return s}[hD(187)](){const e=189,t=hD;return 38===this[t(344)](0)[t(e)]()?this[t(234)]():this.statement()}[hD(528)](e){const t=495,n=382,s=hD,i=this[s(344)](0),r=new RD(i);for(;!this.match(48);)r.add(this[s(t)]()),this[s(n)](44);return r}metaBlock(){const e=400,t=576,n=454,s=hD,i=this.get(0),r=this.consume(47)[s(e)]();this[s(t)](36);const o=[];for(;!this[s(382)](37);)o[s(n)](this[s(t)](2)[s(e)]()),this.match(42);const a=this.blockMetaBlock(r);return new GD(r,o,a,i)}[hD(422)](e){const t=400,n=304,s=576,i=576,r=hD;let o=!1;if(this.match(45)){const e=this[r(576)](1);if("soft"!==e[r(t)]())throw cL.at(e,'Unknown step modifier "'+e[r(t)]()+'" — the only one is step.soft(...).');o=!0}this[r(576)](36);const a=this[r(304)]();this.consume(42);let l=null;this[r(362)](0,38)&&(l=this[r(n)](),this.consume(42)),this.consume(36),this.consume(37),this[r(s)](46);const c=this.block();return this[r(i)](37),new sL(a,c,e,{soft:o,options:l})}block(){const e=576,t=382,n=382,s=hD,i=this[s(344)](0),r=new RD(i);for(this[s(e)](38);!this[s(t)](39);)r[s(203)](this[s(495)]()),this[s(n)](44);return r}statement(){const e=382,t=207,n=317,s=362,i=410,r=576,o=400,a=hD,l=this[a(344)](0);if(this[a(e)](4))return this.varStatement(l);if(this.match(5))return new ZD(this.expression(),l);if(this[a(382)](6))return this.ifElse(l);if(this.match(8))return this[a(284)](l);if(this[a(e)](10))return this[a(t)](l);if(this.match(11))return new AD(l);if(this[a(382)](12))return new ID(l);if(this[a(382)](14))return new eL(this[a(304)](),l);if(this[a(e)](9))return this[a(529)](l);if(this[a(382)](13))return this[a(n)](l);if(this[a(382)](15))return this.stepStatement(l);if(this[a(s)](0,47))return this[a(302)]();if(this[a(362)](0,1)&&this[a(362)](1,36)){const e=this[a(i)](this.functionExpression(l));return new WD(e,l)}if(this[a(s)](0,1)&&this[a(362)](1,45)){const e=new aL(this.consume(1).getText(),l),t=this[a(i)](e);if(!(t instanceof YD))throw cL.at(l,a(524));return new WD(t,l)}if(this[a(382)](17)){const e=new aL(this[a(r)](1).getText(),l);return new VD(new $D(e,0,l),l)}if(this.match(19)){const e=new aL(this[a(576)](1)[a(o)](),l);return new VD(new $D(e,1,l),l)}if(this.lookMatch(0,1)&&(this.lookMatch(1,17)||this[a(362)](1,19))){const e=this.consume(1),t=new aL(e[a(400)](),e);return this[a(382)](17)?new VD(new $D(t,2,e),e):(this.consume(19),new VD(new $D(t,3,e),e))}return this[a(379)]()}[(Nt=hD(345),hD(322))](e){const t=345,n=535,s=304,i=hD,r=[];do{const e=this[i(576)](1),o=e[i(400)]();if(Lt[i(t)].has(o))throw cL.at(e,i(n)+o+i(202));let a=null;this[i(382)](22)&&(a=this[i(s)]()),r[i(454)]({name:o,init:a})}while(this[i(382)](42));return new oL(r,e)}[hD(379)](){const e=344,t=362,n=362,s=400,i=362,r=301,o=189,a=hD,l=this[a(e)](0);if(this[a(t)](0,1)&&this[a(n)](1,22)){const e=this[a(576)](1)[a(s)]();return this[a(576)](22),new ED(e,this[a(304)](),l)}if(this[a(t)](0,1)&&this[a(i)](1,40)){const e=this[a(r)](l);return this[a(576)](22),new DD(e,this[a(304)](),l)}throw cL.at(this.get(0),"Unknown statement: unexpected "+tL[this[a(e)](0)[a(o)]()])}ifElse(e){const t=hD,n=this[t(304)](),s=this.statementOrBlock();let i;return i=this[t(382)](7)?this.statementOrBlock():null,new KD(n,s,i,e)}[hD(207)](e){const t=this.statementOrBlock();this.consume(8);const n=this.expression();return new OD(n,t,e)}whileStatement(e){const t=this[hD(304)](),n=this.statementOrBlock();return new lL(t,n,e)}[hD(529)](e){const t=382,n=436,s=304,i=576,r=576,o=187,a=hD;let l;if(this[a(576)](36),this[a(t)](4))throw cL.at(this[a(344)](-1),a(n));l=this[a(379)](),this[a(576)](44);const c=this[a(s)]();this[a(i)](44);const h=this[a(495)]();this[a(r)](37);const u=this[a(o)]();return new HD(l,c,h,u,e)}[hD(317)](e){const t=400,n=454,s=576,i=382,r=hD,o=this[r(576)](1)[r(t)]();this[r(576)](36);const a=[];for(;!this[r(382)](37);)a[r(n)](this[r(s)](1)[r(400)]()),this[r(i)](42);const l=this[r(187)]();return new FD(o,a,l,e)}[hD(397)](e){const t=382,n=382,s=hD,i=this[s(576)](1)[s(400)]();this[s(576)](36);const r=new UD(i,[],e);for(;!this[s(t)](37);)r[s(398)](this[s(304)]()),this[s(n)](42);return r}[hD(301)](e){const t=304,n=hD,s=this[n(576)](1)[n(400)](),i=[];do{this[n(576)](40),i[n(454)](this[n(t)]()),this[n(576)](41)}while(this[n(362)](0,40));return new BD(s,i,e)}[hD(437)](e){const t=454,n=382,s=hD;this[s(576)](40);const i=[];for(;!this[s(382)](41);)i[s(t)](this[s(304)]()),this[s(n)](42);return new LD(i,e)}objectExpression(e){const t=382,n=362,s=304,i=hD;this[i(576)](38);const r=new Map;for(;!this[i(t)](39);){let e;if(this[i(362)](0,1))e=this[i(576)](1).getText();else{if(!this[i(n)](0,2))throw cL.at(this.get(0),i(249));e=this.consume(2)[i(400)]()}this.consume(43);const t=this[i(s)]();r.set(e,t),this.match(42)}return new XD(r,e)}[hD(304)](){return this[hD(223)]()}[hD(223)](){const e=hD;let t=this[e(517)]();for(;this[e(382)](33);){const n=this[e(344)](0);t=new TD("||",t,this.logicalAnd(),n)}return t}logicalAnd(){const e=318,t=hD;let n=this.equality();for(;this[t(382)](35);){const s=this[t(344)](0);n=new TD("&&",n,this[t(e)](),s)}return n}[hD(318)](){const e=382,t=564,n=382,s=hD,i=this[s(344)](0),r=this.conditional();return this[s(e)](23)?new TD("==",r,this[s(564)](),i):this.match(24)?new TD(s(445),r,this[s(t)](),i):this[s(n)](26)?new TD("!=",r,this[s(564)](),i):this[s(382)](27)?new TD("!==",r,this[s(t)](),i):r}[hD(564)](){const e=362,t=382,n=244,s=382,i=hD;let r=this[i(244)]();for(;this[i(e)](0,28)||this.lookMatch(0,29)||this[i(e)](0,30)||this[i(362)](0,31);){const e=this[i(344)](0);this[i(t)](28)?r=new TD("<",r,this[i(n)](),e):this.match(29)?r=new TD("<=",r,this.additive(),e):this[i(t)](30)?r=new TD(">",r,this.additive(),e):this[i(s)](31)&&(r=new TD(">=",r,this[i(244)](),e))}return r}[hD(244)](){const e=382,t=344,n=236,s=hD;let i=this.multiplicate();for(;this[s(362)](0,16)||this.lookMatch(0,18);){if(this[s(e)](16)){const e=this.get(-1);i=new PD("+",i,this[s(236)](),e);continue}this.consume(18);const r=this[s(t)](-1);i=new PD("-",i,this[s(n)](),r)}return i}[hD(236)](){const e=270,t=hD;let n=this[t(270)]();for(;this.lookMatch(0,20)||this[t(362)](0,21);){if(this.match(20)){const e=this[t(344)](-1);n=new PD("*",n,this.unary(),e);continue}this.consume(21);const s=this[t(344)](-1);n=new PD("/",n,this[t(e)](),s)}return n}[hD(270)](){const e=576,t=382,n=364,s=hD,i=this[s(344)](0);if(this[s(382)](18))return new iL("-",this.primary(),i);if(this.match(17)){const t=new aL(this[s(e)](1).getText(),i);return new $D(t,0,i)}if(this[s(t)](19)){const e=new aL(this.consume(1)[s(400)](),i);return new $D(e,1,i)}return this[s(n)]()}[hD(364)](){const e=382,t=400,n=266,s=362,i=362,r=400,o=304,a=410,l=hD,c=this[l(344)](0);let h;if(this[l(e)](0))h=new nL(c[l(t)](),c);else if(this[l(382)](3)){const e=c[l(400)](),t=e[l(n)]("\0"),s=t<0?e:e[l(523)](0,t),i=t<0?"":e[l(523)](t+1);h=new QD(s,i,c)}else if(this[l(362)](0,1)&&this.lookMatch(1,36))h=this.functionExpression(c);else if(this.lookMatch(0,1)&&this[l(s)](1,40))h=this.elementExpression(c);else if(this[l(362)](0,40))h=this[l(437)](c);else if(this[l(i)](0,38))h=this[l(549)](c);else if(this.match(1)){const t=new aL(c[l(r)](),c);h=t,this.match(17)?h=new $D(t,2,c):this[l(e)](19)&&(h=new $D(t,3,c))}else if(this[l(382)](2))h=new nL(c.getText(),c);else{if(!this.match(36))throw cL.at(c,l(425)+tL[c[l(189)]()]);h=this[l(o)](),this.match(37)}return this[l(a)](h)}callWithPostfix(e){const t=344,n=189,s=400,i=382,r=454,o=304,a=382,l=362,c=hD;let h=e;for(;this.match(45);){const e=this[c(t)](0);if(1!==e[c(n)]())throw cL.at(e,c(525));const l=this.consume(1)[c(s)]();if(this[c(382)](36)){const t=[];for(;!this[c(i)](37);)t[c(r)](this[c(o)]()),this[c(a)](42);h=new YD(h,l,t,e)}else h=new JD(h,l,e)}if(this[c(l)](0,40)&&!(h instanceof aL))throw cL.at(this[c(t)](0),c(229));return h}[hD(576)](e){const t=189,n=340,s=hD,i=this.get(0);if(e!=i[s(t)]())throw cL.at(i,"Unexpected "+tL[i[s(189)]()]+s(n)+tL[e]);return this[s(176)]++,i}[hD(382)](e){const t=hD;return e==this[t(344)](0)[t(189)]()&&(this.pos++,!0)}[hD(362)](e,t){return this.get(e).getType()==t}[hD(344)](e){const t=255,n=hD,s=this[n(176)]+e;return s>=this[n(t)]?this[n(448)]:this[n(289)][s]}},hD(296)),Pt(Lt,Nt,new Set([hD(460),"false",hD(358),hD(267),hD(519),"const","class",hD(578),hD(277),"typeof",hD(307),"in","of","import","export",hD(404),"extends","super",hD(196),hD(396),hD(226),hD(258),hD(354),hD(501),hD(326),hD(459),hD(456),"debugger","yield",hD(542)])),Lt);function xL(){var e=["mvbVzuTqzG","oduWode3uffXCLH0","mZi5mMH6EhDdrW","nZy3nJuXmeD4yNvhBa","mZqYm3nir29MuW","nZe5nti2nKHSuuL2yq","ndyYmJy5nLveDe5uCW","n1jwANPztq","mJa1mtm4A09WCwjM","mZa3odm4nurvuNHZra","nLjOzvLKqW"];return(xL=function(){return e})()}function bL(e,t){e-=436;var n=xL(),s=n[e];if(void 0===bL.FgIjdF){bL.GSvRGJ=function(e){for(var t,n,s="",i="",r=0,o=0;n=e.charAt(o++);~n&&(t=r%4?64*t+n:n,r++%4)?s+=String.fromCharCode(255&t>>(-2*r&6)):0)n="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=".indexOf(n);for(var a=0,l=s.length;a<l;a++)i+="%"+("00"+s.charCodeAt(a).toString(16)).slice(-2);return decodeURIComponent(i)},bL.xpERuA={},bL.FgIjdF=!0}var i=e+n[0],r=bL.xpERuA[i];return r?s=r:(s=bL.GSvRGJ(s),bL.xpERuA[i]=s),s}!function(){for(var e=439,t=441,n=446,s=445,i=444,r=440,o=bL,a=xL();;)try{if(765144===parseInt(o(e))/1*(-parseInt(o(436))/2)+parseInt(o(443))/3*(parseInt(o(t))/4)+parseInt(o(437))/5*(parseInt(o(438))/6)+parseInt(o(n))/7*(-parseInt(o(s))/8)+-parseInt(o(i))/9+parseInt(o(442))/10+-parseInt(o(r))/11)break;a.push(a.shift())}catch(l){a.push(a.shift())}}();class yL extends Error{constructor(e){super(e),this.name="ScenarioBodyParseError"}}function wL(e){let t;try{t=new _L(new gL(e).tokenize()).parse()}catch(i){throw new yL(i instanceof Error?i.message:String(i))}const n=t.statements.find(e=>e instanceof FD&&(e.name.startsWith("test_")||e.name.startsWith("flow_")));if(!n)throw new yL("no 'function test_*()' declaration found");if(!(n.body instanceof RD))throw new yL("function body is not a block");const s=e.split(/\r?\n/);return SL(n.body.statements,s,{n:0})}function SL(e,t,n){const s=[];for(const i of e){if(i instanceof sL){const{line:e,col:r}=NL(i),o=i.tagExpression();s.push({kind:"block",title:kL(i.label),children:SL(i.body.statements,t,n),line:e,col:r,soft:i.soft,...void 0!==o?{tagSource:o.toString()}:{}});continue}if(i instanceof GD)s.push({kind:"block",title:i.argNames[0]??"",children:SL(CL(i.body),t,n),line:0,col:0,soft:!1});else{if(i instanceof KD){const e={kind:"control",...jL(i,t,n,i.ifStatement),children:SL(CL(i.ifStatement),t,n)};i.elseStatement&&(e.elseChildren=SL(CL(i.elseStatement),t,n)),s.push(e);continue}if(i instanceof HD||i instanceof lL||i instanceof OD){const e=i instanceof HD?i.block:i.statement;s.push({kind:"control",...jL(i,t,n,e),children:SL(CL(e),t,n)});continue}s.push({kind:"step",...jL(i,t,n)})}}return s}function kL(e){var t;const n=e.value;return(null==(t=null==n?void 0:n.asString)?void 0:t.call(n))??""}function CL(e){return e instanceof RD?e.statements:[e]}function jL(e,t,n,s){const{line:i,col:r}=NL(e),o=s instanceof RD?NL(s).line:i,a=t.slice(i-1,Math.max(i,o)).map(e=>e.trim()).filter(e=>e.length>0).join(" ");return{index:n.n++,line:i,col:r,source:a}}function NL(e){const t=e.token;return{line:(null==t?void 0:t.getLine)?t.getLine():0,col:(null==t?void 0:t.getColumn)?t.getColumn():0}}const ML=bn.lazy(()=>TN(()=>import("./DslEditor-CBAoI3BF.js"),__vite__mapDeps([0,1])).then(e=>({default:e.DslEditor}))),BL=w_(function({runId:e}){var t,n,s;const i=j_(),r=i.activeRuns.byRunId.get(e)??null,o=i.historicRuns.get(e),a=i.layout.runViewMode,[l,c]=bn.useState(r&&!r.plainRun?"code":a??"steps"),h=bn.useCallback(e=>{c(e),i.layout.setRunViewMode(e)},[i.layout]),[u,d]=bn.useState(null),f=bn.useCallback((e,t)=>{d({path:e,line:t}),h("code")},[h]);bn.useEffect(()=>{r||i.historicRuns.loadIfNeeded(e)},[i,e,r]),bn.useEffect(()=>{let t,n=!1;const s=async()=>{if(n)return;if(await i.runSources.loadIfNeeded(e),n)return;void 0===i.runSources.get(e)&&i.activeRuns.byRunId.has(e)&&(t=setTimeout(()=>{s()},300))};return s(),()=>{n=!0,t&&clearTimeout(t)}},[i,e]),bn.useEffect(()=>{r&&i.activeRuns.syncRuntime(e)},[i,e,r]);const p=r?function(e){return{events:e.events,status:TL(e.status),scenario:e.scenario,startedAt:e.startedAt,durationMs:null,abortable:"starting"===e.status||"running"===e.status||"paused"===e.status,outcome:e.outcome}}(r):o?function(e){const t="scenario"===e.meta.kind?e.events:[];return{events:t,status:xN(e.meta),scenario:e.meta.ref,startedAt:e.meta.startedAt,durationMs:e.meta.durationMs,abortable:!1,outcome:e.meta.outcome}}(o):null,v=(null==p?void 0:p.scenario)||(null==o?void 0:o.meta.ref)||(null==r?void 0:r.scenario)||"",g=i.scenarios.items.find(e=>e.name===v),m=i.runSources.get(e),_="authoring"===(null==r?void 0:r.mode),x=_?(null==g?void 0:g.path)??(null==m?void 0:m.entry)??null:null;bn.useEffect(()=>{x&&i.source.getOrLoad(x)},[i,x]);const b=x?i.source.draft(x)??null:null,y=x??(null==m?void 0:m.entry)??"",w=_?b:m?m.files[m.entry]??null:null,S=_?null!==b:void 0!==m,k=bn.useMemo(()=>{if(null==w)return null;try{return wL(w)}catch{return null}},[w]),C=bB(e),j=bn.useMemo(()=>{if(!k||!p)return;const e=function(e,t,n){const s=iD(t),i=[];let r=null;const o=new Map;for(const a of e)if("step:started"===a.kind){const e=a.file===n?rD(s,a.line,a.col):null;i.push({idx:e})}else if("step:ok"===a.kind||"step:fail"===a.kind){const e=i.pop();null!=(null==e?void 0:e.idx)&&(r=e.idx)}else if("screenshot"===a.kind){if(null!=a.line&&null!=a.col&&(null==a.file||a.file===n)){const e=rD(s,a.line,a.col);if(null!=e){o.set(e,a.path);continue}}const e=[...i].reverse().find(e=>null!=e.idx),t=(null==e?void 0:e.idx)??r;null!=t&&o.set(t,a.path)}return o}(p.events,k,y);if(0===e.size)return;const t=new Map;for(const[n,s]of e){const e=C.resolveUrl({kind:"event",path:s});e&&t.set(n,e)}return t.size>0?t:void 0},[k,p,y,C]),N=bn.useMemo(()=>k&&j?function(e,t){const n=[],s=(e,i)=>{for(const r of e){if("block"===r.kind){s(r.children,r.title);continue}const e=t.get(r.index);null!=e&&n.push({stepIndex:r.index,url:e,blockTitle:i,source:r.source,line:r.line}),"control"===r.kind&&(s(r.children,i),r.elseChildren&&s(r.elseChildren,i))}};return s(e,null),n}(k,j):[],[k,j]),[M,B]=bn.useState(null),[D,L]=bn.useState(null),E=bn.useMemo(()=>p?function(e,t,n){const s=[],i=[];let r=0;const o=()=>0===i.length?s:i[i.length-1].children,a=()=>{for(let e=i.length-1;e>=0;e--){const t=i[e];if("statement"===t.kind)return t}return null},l=()=>{const e=i[i.length-1];if("iteration"===(null==e?void 0:e.kind)){e.status=function(e){let t="passed";for(const n of e){if("failed"===n.status)return"failed";"running"===n.status?t="running":"aborted"===n.status&&"running"!==t?t="aborted":"pending"===n.status&&"passed"===t&&(t="pending")}return 0===e.length?"pending":t}(e.children);const t=e.children.filter(e=>null!==e.durationMs);e.durationMs=t.length>0?t.reduce((e,t)=>e+(t.durationMs??0),0):null,i.pop()}},c=()=>{l();const e=i[i.length-1];return"statement"!==(null==e?void 0:e.kind)?null:(i.pop(),e)};for(const h of e)switch(h.kind){case"step:started":{const e={kind:"statement",id:r++,file:h.file,line:h.line,col:h.col,source:QM(t,h.file,h.line),isEntry:h.file===n,...void 0!==h.stepTag?{stepTag:h.stepTag}:{},status:"running",durationMs:null,children:[],annotations:[]};o().push(e),i.push(e);break}case"step:ok":{const e=c();e&&(e.status="passed",e.durationMs=h.durationMs);break}case"step:fail":{const e=c();e&&(e.status="failed",e.error={message:h.error,...void 0!==h.errorName?{name:h.errorName}:{}});break}case"step-block:started":{const e={kind:"block",id:r++,file:h.file,line:h.line,col:h.col,label:h.label,...void 0!==h.tag?{tag:h.tag}:{},soft:h.soft,status:"running",durationMs:null,children:[]};o().push(e),i.push(e);break}case"step-block:finished":{l();const e=i[i.length-1];"block"===(null==e?void 0:e.kind)&&(i.pop(),e.status=h.ok?"passed":"failed",e.durationMs=h.durationMs,h.ok||(e.error={message:h.error??"",...void 0!==h.errorName?{name:h.errorName}:{}}));break}case"loop:iteration":{l();const e={kind:"iteration",id:r++,index:h.index,status:"running",durationMs:null,children:[]};o().push(e),i.push(e);break}case"note":case"log":case"judge:verdict":{const e=a();if(!e)break;"note"===h.kind?e.annotations.push({kind:"note",t:h.t,label:h.label,text:h.text,...h.truncated?{truncated:!0}:{}}):"log"===h.kind?e.annotations.push({kind:"log",t:h.t,text:h.text,...h.truncated?{truncated:!0}:{}}):e.annotations.push({kind:"judge",t:h.t,verdict:h.verdict,rubric:h.rubric,...void 0!==h.preamble?{preamble:h.preamble}:{},text:h.text,reasoning:h.reasoning,model:h.model});break}case"screenshot":{const e=(void 0!==h.file&&void 0!==h.line&&void 0!==h.col?JM(s,{file:h.file,line:h.line,col:h.col}):null)??a()??eB(s);e&&(e.screenshot=h.path);break}case"run:finished":for(;i.length>0;){const e=i.pop();"running"===e.status&&(e.status="aborted")}}for(;i.length>0;)i.pop();return s}(p.events,m??null,y):[],[p,m,y]),P=bn.useMemo(()=>tB(E),[E]),R=bn.useMemo(()=>{const e=new Map,t=n=>{for(const s of n){if("statement"===s.kind&&s.screenshot){const t=C.resolveUrl({kind:"event",path:s.screenshot});t&&e.set(s.id,t)}t(s.children)}};return t(E),e.size>0?e:void 0},[E,C]),[A,z]=bn.useState(null),T=bn.useCallback(e=>{var t;B(e),z((null==(t=N[e])?void 0:t.stepIndex)??null)},[N]),I=bn.useCallback(e=>{const t=function(e,t){return e.findIndex(e=>e.stepIndex===t)}(N,e);t>=0&&T(t)},[N,T]);if(!p)return i.historicRuns.errors.has(e)?Bn.jsx(hN,{id:e}):Bn.jsx("div",{className:"px-4 py-3 font-mono text-[12px] text-fg-4",children:"loading run…"});const O="failed"===p.status,H="passed"===p.status||"failed"===p.status||"aborted"===p.status,F=k?oD(p.events,k,y):null,W=function(e,t){const n=new Map,s=[],i=(e,t)=>{const s=n.get(e);if(s)return s;const i={status:"pending",durationMs:null,soft:t,softTotal:0,softFailed:0};return n.set(e,i),i};for(const r of e)if("step-block:started"===r.kind){const e=aD(r,t);if(s.push({key:e}),null===e)continue;const n=i(e,r.soft);n.status="running",n.durationMs=null,void 0!==r.tag&&(n.tag=r.tag)}else if("step-block:finished"===r.kind){s.pop();const e=aD(r,t);if(null!==e){const t=i(e,r.soft);t.status=r.ok?"passed":"failed",t.durationMs=r.durationMs,void 0!==r.tag&&(t.tag=r.tag)}if(r.soft)for(const t of s){if(null===t.key)continue;const e=n.get(t.key);e&&(e.softTotal++,r.ok||e.softFailed++)}}else if("run:finished"===r.kind)for(const e of n.values())"running"===e.status&&(e.status="aborted");for(const r of n.values())r.softFailed>0&&"passed"===r.status&&(r.status="failed");return n}(p.events,y),U=function(e){const t=[];for(const n of e)"step-block:finished"===n.kind&&n.soft&&!n.ok&&t.push({label:n.label,...void 0!==n.tag?{tag:n.tag}:{},file:n.file,line:n.line,col:n.col,error:n.error??"",...void 0!==n.errorName?{errorName:n.errorName}:{}});return t}(p.events),K=function(e){let t=0,n=0;for(const s of e)"step-block:finished"===s.kind&&s.soft&&(t++,s.ok||n++);return{total:t,failed:n}}(p.events),q=k?function(e,t,n){const s=iD(t),i=[];let r=null;const o=new Map,a=(e,t)=>{let a=null;if(null!=e.entryLine&&null!=e.entryCol?a=rD(s,e.entryLine,e.entryCol):null==e.line||null==e.col||null!=e.file&&e.file!==n||(a=rD(s,e.line,e.col)),null==a){const e=[...i].reverse().find(e=>null!=e.idx);a=(null==e?void 0:e.idx)??r}if(null==a)return;const l=o.get(a);l?l.push(t):o.set(a,[t])};for(const l of e)if("step:started"===l.kind){const e=l.file===n?rD(s,l.line,l.col):null;i.push({idx:e})}else if("step:ok"===l.kind||"step:fail"===l.kind){const e=i.pop();null!=(null==e?void 0:e.idx)&&(r=e.idx)}else"note"===l.kind?a(l,{kind:"note",t:l.t,label:l.label,text:l.text,...l.truncated?{truncated:!0}:{}}):"log"===l.kind?a(l,{kind:"log",t:l.t,text:l.text,...l.truncated?{truncated:!0}:{}}):"judge:verdict"===l.kind&&a(l,{kind:"judge",t:l.t,verdict:l.verdict,rubric:l.rubric,...void 0!==l.preamble?{preamble:l.preamble}:{},text:l.text,reasoning:l.reasoning,model:l.model});return o}(p.events,k,y):null,$=(null==g?void 0:g.name)??v??e,V=F?Object.values(F).reduce((e,t)=>("passed"===t.status?e.passed++:"failed"===t.status?e.failed++:"running"===t.status?e.running++:e.pending++,e),{passed:0,failed:0,running:0,pending:0}):{passed:0,failed:0,running:0,pending:0},Y="paused"===(null==r?void 0:r.status),G="starting"===(null==r?void 0:r.status)||"running"===(null==r?void 0:r.status),X=i.session.capabilities.canRun,Z=i.targets.activeDebugCaps,J=X&&Z.picker&&(Y||_&&G),Q=X&&Y&&("failure"!==(null==(t=null==r?void 0:r.pausedAt)?void 0:t.reason)||Z.resumeFromFailure),ee=null!=(null==r?void 0:r.pausedAt)&&(null===r.pausedAt.file||r.pausedAt.file===y),te=Y&&(null==r?void 0:r.pausedAt)&&ee?function(e,t,n){var s;if(!e)return;const i=IM(e),r=i.find(e=>e.line===t&&e.col===n);return r?r.index:null==(s=i.find(e=>e.line===t))?void 0:s.index}(k,r.pausedAt.line,r.pausedAt.col):void 0,ne=(null==g?void 0:g.path)??y,se=Y&&(null==(n=null==r?void 0:r.pausedAt)?void 0:n.file)?r.pausedAt.file:(null==u?void 0:u.path)??ne,ie=se===ne||se===y,re=O&&k?function(e,t){var n;return e&&null!=t?null==(n=IM(e).find(e=>e.index===t))?void 0:n.line:void 0}(k,lD(p.events,k,y)):void 0;let oe,ae;Y&&(null==r?void 0:r.pausedAt)?"failure"===r.pausedAt.reason?ae=r.pausedAt.line:oe=r.pausedAt.line:u?oe=u.line:ie&&(ae=re);const le=null==g?void 0:g.name,ce=le?i.breakpoints.get(le):void 0,he=new Set;if(ce)for(const pe of ce)he.add(Number(pe.split(":")[0]));if(ie&&r)for(const pe of r.breakpoints)he.add(Number(pe.split(":")[0]));const ue=(t,n)=>{if(!le)return;i.breakpoints.toggle(le,t,n)?i.activeRuns.setBreakpoint(e,t,n):i.activeRuns.clearBreakpoint(e,t,n)},de=(null==g?void 0:g.name)||v,fe=X&&!G&&!Y&&!p.abortable&&!!de?()=>{i.activeRuns.startScenario(de,{headed:!1,debug:!1}).then(e=>{i.tabs.open({kind:"scenario-run",runId:e.runId})})}:null;return Bn.jsxs("div",{className:"flex h-full min-w-0 gap-1.5 bg-shell",children:[Bn.jsxs("section",{className:_y("flex min-w-0 flex-1 flex-col overflow-hidden bg-canvas",i.layout.inspectorOpen&&"rounded-r-lg"),children:[Bn.jsx(LL,{title:(null==g?void 0:g.title)??v??e,onOpenScenario:g?()=>i.tabs.open({kind:"scenario",path:g.path}):null,color:(null==g?void 0:g.color)??null,status:p.status,softSummary:K,viewMode:l,onViewMode:h,onRunAgain:fe,onAbort:p.abortable&&X?()=>{i.activeRuns.abort(e)}:null,onContinue:Q?()=>{i.activeRuns.continueRun(e)}:null,onStep:Q?()=>{i.activeRuns.step(e)}:null,onPause:G&&!_&&X?()=>{i.activeRuns.pauseRun(e)}:null,picker:J?(null==r?void 0:r.picker)??null:null,onPick:J?t=>{i.activeRuns.togglePicker(e,t)}:null,execute:!!J&&((null==(s=null==r?void 0:r.picker)?void 0:s.execute)??!1),onSetExecute:J?t=>{i.activeRuns.setPickerExecute(e,t)}:null,wheel:(null==r?void 0:r.wheel)??"human",isAuthoring:_,onSetWheel:X&&Z.attach&&(G||Y)?t=>{i.activeRuns.setWheel(e,t)}:null,onExport:G?null:()=>function(e){if(!window.confirm("Export this run as a .unotest.zip snapshot?\n\nThe bundle is a verbatim capture — it can include secrets from fill() values, console output and network request headers. Share it only with people you trust."))return;const t=document.createElement("a");t.href=`/api/runs/${encodeURIComponent(e)}/export`,t.rel="noopener",document.body.appendChild(t),t.click(),t.remove()}(e),inspectorOpen:i.layout.inspectorOpen,onToggleInspector:i.layout.toggleInspector}),Y&&(null==r?void 0:r.pausedAt)&&Bn.jsx(AL,{reason:r.pausedAt.reason,stepIndex:te??-1,file:r.pausedAt.file??y??v??e,line:r.pausedAt.line,col:r.pausedAt.col}),Bn.jsx(zL,{counts:V}),Bn.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:Bn.jsx(DM,{label:"trace"===l?"Trace":"code"===l?"Code":"Steps",resetKey:`${e}:${l}`,children:"trace"===l?Bn.jsx("div",{className:"h-full overflow-y-auto",children:Bn.jsx(nB,{nodes:E,onOpenCode:f,...R?{screenshots:R,onOpenScreenshot:e=>{const t=R.get(e);t&&L({id:e,url:t})},...D?{activeScreenshotId:D.id}:{}}:{},...P?{failedId:P.id,onFailedRender:e=>{var t,n;return Bn.jsx(uB,{errorName:(null==(t=e.error)?void 0:t.name)??"Error",message:(null==(n=e.error)?void 0:n.message)??"",file:e.file,line:e.line,source:e.source,index:e.id})}}:{}})}):"code"===l?Bn.jsx(bn.Suspense,{fallback:Bn.jsx("div",{className:"px-4 py-3 font-mono text-[12px] text-fg-4",children:"loading editor…"}),children:Bn.jsx(ML,{path:se,fileKind:ie?"scenario":"helper",...null!=oe?{highlightLine:oe}:{},...null!=ae?{errorLine:ae}:{},...ie&&le?{breakpointLines:he,onToggleBreakpoint:e=>{const t=k?IM(k).find(t=>t.line===e):void 0;t&&ue(e,t.col)}}:{}})}):Bn.jsxs("div",{className:"h-full overflow-y-auto",children:[U.length>0&&Bn.jsxs("div",{className:"mx-4 mt-3 rounded border border-fail/30 bg-fail/5 px-3 py-2 font-mono text-[12px]","data-testid":"soft-failures",children:[Bn.jsxs("div",{className:"mb-1 flex items-center gap-2 text-fail",children:[Bn.jsx(dN,{tone:"fail",size:"xs",children:"soft"}),Bn.jsxs("span",{children:[U.length," soft step",1===U.length?"":"s"," failed — the run went on past each one"]})]}),Bn.jsx("ul",{className:"space-y-0.5 text-fg-2",children:U.map((e,t)=>Bn.jsxs("li",{className:"truncate",children:[Bn.jsx("span",{className:"text-fg",children:e.label}),void 0!==e.tag&&Bn.jsxs("span",{className:"text-fg-3",children:[" [",e.tag,"]"]}),Bn.jsxs("span",{className:"text-fg-3",children:[" · L",e.line," · "]}),e.error]},t))})]}),k?Bn.jsx(ZM,{store:i.annotations,scope:$,body:k,blocks:W,...q?{annotations:q}:{},...F?{trace:F}:{},...j?{screenshots:j,onOpenScreenshot:I,...null!=A?{activeScreenshotIndex:A}:{}}:{},...null!=te?{pausedIndex:te}:{},bpKeys:ce,onToggleBp:le?ue:void 0,...O?{failedIndex:lD(p.events,k,y)??void 0}:{},...O?{onFailedStepRender:t=>{var n,s;const i=(null==(n=cD(p.events,k,y))?void 0:n.event)??null;if(!i)return null;const r=vB(p.events,"failure-bundle:written"),o=null==(s=null==q?void 0:q.get(t.index))?void 0:s.find(e=>"judge"===e.kind&&"fail"===e.verdict);return Bn.jsx(uB,{errorName:i.errorName??"Error",message:i.error,...o&&"judge"===o.kind?{verdict:{rubric:o.rubric,text:o.text,reasoning:o.reasoning,model:o.model}}:{},file:(null==g?void 0:g.path)??v??e,line:t.line,source:t.source,index:t.index,...(null==r?void 0:r.url)?{url:r.url}:{}})}}:{}}):Bn.jsx("div",{className:"px-4 py-3 font-mono text-[12px] text-fg-4",children:S?null===m?"No source snapshot for this run — a collection keeps them on its scenarios, and a run that never started a step has none.":"could not parse source snapshot":"loading run…"})]})})})]}),D&&Bn.jsx(lB,{strip:[{stepIndex:D.id,url:D.url,blockTitle:null,source:"",line:0}],position:0,onNavigate:()=>{},onClose:()=>L(null)}),null!=M&&N[M]&&Bn.jsx(lB,{strip:N,position:M,onNavigate:T,onClose:()=>B(null)}),i.layout.inspectorOpen&&Bn.jsx(SB,{runId:e,active:r,events:p.events,isFailed:O,runFinished:H})]})});const DL={locator:{icon:"target",label:"Locator",hint:"click an element to insert its locator"},text:{icon:"text",label:"Text",hint:"click an element to insert a text assertion"},visibility:{icon:"eye",label:"Visibility",hint:"click an element to insert a visibility assertion"}};function LL({title:e,color:t,status:n,viewMode:s,onViewMode:i,onRunAgain:r,onAbort:o,onContinue:a,onStep:l,onPause:c,picker:h,onPick:u,execute:d,onSetExecute:f,wheel:p,onSetWheel:v,isAuthoring:g,softSummary:m,onExport:_,inspectorOpen:x,onToggleInspector:b,onOpenScenario:y}){const w="paused"===n;return Bn.jsxs("div",{className:"shrink-0 border-b border-edge bg-canvas",children:[Bn.jsxs("div",{className:"flex h-10 items-center gap-3 px-4",children:[Bn.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[t&&Bn.jsx("span",{"aria-hidden":!0,className:"h-4 w-1 shrink-0 rounded-sm",style:{backgroundColor:t}}),Bn.jsx("div",{className:"truncate text-[13px] font-medium text-fg",children:e}),y&&Bn.jsxs("button",{type:"button","aria-label":"Open the test",onClick:y,className:"group relative grid h-5 w-5 shrink-0 place-items-center rounded text-fg-4 hover:bg-raised hover:text-fg-2",children:[Bn.jsx(by,{name:"file",className:"h-3.5 w-3.5"}),Bn.jsx(IN,{label:"Open the test"})]}),g?Bn.jsx(dN,{tone:"info",children:"authoring"}):!w&&Bn.jsx(dN,{tone:yN(n),children:n}),m.failed>0&&Bn.jsxs("span",{className:"shrink-0 whitespace-nowrap font-mono text-[11px] tabular-nums text-fail","data-testid":"soft-summary",children:[m.failed," of ",m.total," soft failed"]})]}),Bn.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[v&&Bn.jsx(EL,{wheel:p,onSet:v}),Bn.jsx(ON,{value:s,onChange:i,options:[{value:"steps",label:"Steps",icon:"list",title:"Show the step tree"},{value:"trace",label:"Trace",icon:"tree",title:"Show the execution tree — helper frames and loop iterations"},{value:"code",label:"Code",icon:"braces",title:"Show the test source"}]}),Bn.jsx("div",{className:"h-4 w-px bg-edge-soft"}),Bn.jsxs("button",{type:"button",onClick:b,"aria-pressed":x,className:_y("group relative grid h-6 w-6 place-items-center rounded",x?"bg-raised text-fg":"text-fg-4 hover:bg-raised hover:text-fg-2"),children:[Bn.jsx(by,{name:"panelRight",className:"h-4 w-4"}),Bn.jsx(IN,{label:x?"Hide inspector":"Show inspector"})]})]})]}),Bn.jsxs("div",{className:"flex h-10 items-center gap-3 border-t border-edge-soft px-4",children:[Bn.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:[r&&Bn.jsx(sD,{icon:"play",tooltip:"Run this scenario again",onClick:r,children:Bn.jsx("span",{className:"hidden sm:inline",children:"Run again"})}),a&&Bn.jsx(sD,{variant:"primary",icon:"play",tooltip:"Resume execution",tooltipHint:"F8",onClick:a,children:Bn.jsx("span",{className:"hidden sm:inline",children:"Continue"})}),l&&Bn.jsx(sD,{icon:"stepOver",tooltip:"Step over",tooltipHint:"F10",onClick:l,children:Bn.jsx("span",{className:"hidden sm:inline",children:"Step"})}),c&&Bn.jsx(sD,{icon:"pause",tooltip:"Pause the run",tooltipHint:"F6",onClick:c,children:Bn.jsx("span",{className:"hidden sm:inline",children:"Pause"})}),o&&Bn.jsx(sD,{variant:"danger",icon:"square",tooltip:w?"Stop the run":"Abort the run",onClick:o,children:Bn.jsx("span",{className:"hidden sm:inline",children:w?"Stop":"Abort"})})]}),Bn.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[u&&Bn.jsxs(Bn.Fragment,{children:[f&&Bn.jsx(PL,{execute:d,onChange:f}),Bn.jsx(RL,{picker:h,onPick:u})]}),_&&Bn.jsxs(Bn.Fragment,{children:[u&&Bn.jsx("div",{className:"h-4 w-px bg-edge-soft"}),Bn.jsx(sD,{icon:"externalL",tooltip:"Export this run as a portable .unotest.zip to share",tooltipPlacement:"bottom-end",onClick:_,children:Bn.jsx("span",{className:"hidden sm:inline",children:"Export"})})]})]})]})]})}function EL({wheel:e,onSet:t}){const n="agent"===e;return Bn.jsxs("button",{type:"button",onClick:()=>t(n?"human":"agent"),className:_y("group relative flex h-6 items-center gap-1.5 rounded border px-2 font-mono text-[11px]",n?"border-warn/40 bg-warn/10 text-warn hover:bg-warn/20":"border-edge-soft bg-canvas text-fg-2 hover:bg-raised"),children:[Bn.jsx("span",{"aria-hidden":!0,className:_y("h-1.5 w-1.5 rounded-full",n?"bg-warn uno-pulse":"bg-pass")}),n?"Agent driving":"You're driving",Bn.jsx(IN,{label:n?"Take control back from the agent":"Let the agent drive"})]})}function PL({execute:e,onChange:t}){return Bn.jsx("div",{className:"flex items-center rounded-md border border-edge-soft bg-panel p-0.5",children:[{v:!1,label:"Capture",title:"Capture-only — record a locator/assertion, don't touch the page"},{v:!0,label:"Execute",title:"Execute — run actions on the page and record them"}].map(n=>{const s=n.v===e;return Bn.jsxs("button",{type:"button","aria-pressed":s,onClick:()=>t(n.v),className:_y("group relative h-5 rounded px-2 font-mono text-[11px] transition-colors",s?"bg-canvas text-fg shadow-sm":"text-fg-3 hover:text-fg"),children:[n.label,Bn.jsx(IN,{label:n.title})]},n.label)})})}function RL({picker:e,onPick:t}){return Bn.jsx("div",{className:"flex shrink-0 items-center gap-0.5",role:"group","aria-label":"Locator picker",children:Object.keys(DL).map(n=>{const s=DL[n],i=!0===(null==e?void 0:e.active)&&e.mode===n;return Bn.jsxs("button",{type:"button","aria-pressed":i,"aria-label":s.label,onClick:()=>t(n),className:_y("group relative grid h-6 w-7 place-items-center rounded border",i?"border-accent bg-accent text-on-accent":"border-accent/30 bg-canvas text-fg-3 hover:bg-raised hover:text-fg"),children:[Bn.jsx(by,{name:s.icon,className:"h-3.5 w-3.5",strokeWidth:1.75}),Bn.jsx(IN,{label:s.label,hint:s.hint})]},n)})})}function AL({reason:e,stepIndex:t,file:n,line:s,col:i}){const r="breakpoint"===e?"breakpoint hit":"step"===e?"step pause":"paused on failure";return Bn.jsxs("div",{className:"flex h-7 shrink-0 items-center gap-2 border-b border-warn/40 bg-warn/10 px-4",children:[Bn.jsx(by,{name:"pause",className:"h-3 w-3 text-warn",strokeWidth:2.5}),Bn.jsx("span",{className:"font-mono text-[11px] uppercase tracking-wider text-warn",children:"paused"}),Bn.jsx("span",{className:"text-warn/40",children:"·"}),Bn.jsxs("span",{className:"font-mono text-[11.5px] text-warn",children:[t>=0?`#${t} `:"",Bn.jsxs("span",{className:"text-warn/70",children:["— ",r]})]}),Bn.jsxs("span",{className:"ml-auto truncate font-mono text-[11px] text-warn/70",children:[n,":",s,":",i]})]})}function zL({counts:e}){const t=e.passed+e.failed+e.running+e.pending;return 0===t?Bn.jsx("div",{className:"h-1 shrink-0 bg-raised"}):Bn.jsxs("div",{className:"flex h-1 shrink-0 overflow-hidden bg-raised",children:[Bn.jsx("div",{className:"h-full bg-pass",style:{width:e.passed/t*100+"%"}}),Bn.jsx("div",{className:"h-full bg-fail",style:{width:e.failed/t*100+"%"}}),Bn.jsx("div",{className:_y("h-full bg-warn",e.running>0&&"uno-pulse"),style:{width:e.running/t*100+"%"}})]})}function TL(e){switch(e){case"queued":return"pending";case"starting":case"running":return"running";case"paused":return"paused";case"completed":return"passed";case"failed":return"failed";case"aborted":return"aborted"}}function IL({runId:e}){return Bn.jsx(DM,{label:`Run ${e}`,resetKey:e,children:Bn.jsx(BL,{runId:e})})}const OL=bn.lazy(()=>TN(()=>import("./DslEditor-CBAoI3BF.js"),__vite__mapDeps([0,1])).then(e=>({default:e.DslEditor}))),HL=w_(function({path:e}){const t=j_(),n=t.scenarios.items.find(t=>t.path===e),s=t.session.capabilities.canRun,[i,r]=bn.useState("steps");bn.useEffect(()=>{t.source.getOrLoad(e)},[t,e]);const o=t.source.draft(e),a=t.source.error(e),l=bn.useMemo(()=>{if(void 0===o)return null;try{return{ok:!0,body:wL(o)}}catch(e){return{ok:!1,message:e instanceof yL||e instanceof Error?e.message:String(e)}}},[o]),c=async e=>{if(!n)return;const s=await t.activeRuns.startScenario(n.name,{headed:e,debug:e});t.tabs.open({kind:"scenario-run",runId:s.runId})};if(!n)return Bn.jsx(hN,{id:e});if(a)return Bn.jsx(FL,{children:Bn.jsx("div",{className:"p-4 font-mono text-[12px] text-fail",children:a})});const h=xN(t.runs.lastRunByRef("scenario",n.name)),u=t.breakpoints.get(n.name),d=new Set;for(const p of u)d.add(Number(p.split(":")[0]));const f=(e,s)=>{const i=t.breakpoints.toggle(n.name,e,s),r=t.activeRuns.findActiveByScenario(n.name);r&&(i?t.activeRuns.setBreakpoint(r.runId,e,s):t.activeRuns.clearBreakpoint(r.runId,e,s))};return Bn.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[Bn.jsxs("header",{className:"shrink-0 border-b border-edge",children:[Bn.jsxs("div",{className:"flex h-10 items-center gap-3 px-4",children:[Bn.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[Bn.jsx("span",{"aria-hidden":!0,className:"h-4 w-1 shrink-0 rounded-sm",style:{backgroundColor:n.color}}),Bn.jsx("h1",{className:"truncate text-[13px] font-medium text-fg",children:n.title}),Bn.jsx(dN,{tone:yN(h),children:h})]}),Bn.jsx("div",{className:"flex shrink-0 items-center",children:Bn.jsx(ON,{value:i,onChange:r,options:[{value:"steps",label:"Steps",icon:"list",title:"Show the step tree"},{value:"code",label:"Code",icon:"braces",title:"Edit the test source"}]})})]}),Bn.jsxs("div",{className:"flex h-10 items-center gap-1.5 border-t border-edge-soft px-4",children:[Bn.jsxs("button",{type:"button",disabled:!s,className:_y("group relative flex h-6 items-center gap-1.5 rounded bg-accent px-2.5 font-mono text-[11px] font-medium text-on-accent",s?"hover:bg-accent-hover":DN),onClick:()=>{c(!1)},children:[Bn.jsx(by,{name:"play",className:"h-3.5 w-3.5",strokeWidth:2.5})," Run",Bn.jsx(IN,{label:s?"Run headless":BN})]}),Bn.jsxs("button",{type:"button",disabled:!s,className:_y("group relative flex h-6 items-center gap-1.5 rounded border border-warn/40 bg-warn/10 px-2.5 font-mono text-[11px] text-warn",s?"hover:bg-warn/20":DN),onClick:()=>{c(!0)},children:[Bn.jsx(by,{name:"bug",className:"h-3.5 w-3.5",strokeWidth:2})," Debug",Bn.jsx(IN,{label:s?"Headed browser · stop on breakpoints · pause on failure":BN})]}),Bn.jsxs("button",{type:"button",className:"group relative ml-auto flex h-6 items-center gap-1.5 rounded border border-edge-soft px-2.5 font-mono text-[11px] text-fg-3 hover:bg-raised/60 hover:text-fg-2",onClick:()=>t.showScenarioHistory(n.name),children:[Bn.jsx(by,{name:"history",className:"h-3.5 w-3.5",strokeWidth:2}),"History",Bn.jsx(IN,{label:`Past runs of ${n.name}`})]})]})]}),Bn.jsx("div",{className:"min-h-0 flex-1",children:"code"===i?Bn.jsx(bn.Suspense,{fallback:Bn.jsx("div",{className:"px-4 py-3 font-mono text-[12px] text-fg-4",children:"loading editor…"}),children:Bn.jsx(OL,{path:e,fileKind:"scenario",breakpointLines:d,onToggleBreakpoint:e=>{const t=(null==l?void 0:l.ok)?IM(l.body).find(t=>t.line===e):void 0;t&&f(e,t.col)}})}):Bn.jsxs("div",{className:"h-full overflow-y-auto",children:[null===l&&Bn.jsx("div",{className:"px-4 py-3 font-mono text-[12px] text-fg-4",children:"loading source…"}),!1===(null==l?void 0:l.ok)&&Bn.jsxs("div",{className:"px-4 py-3 font-mono text-[12px] text-fail",children:["parse error: ",l.message]}),(null==l?void 0:l.ok)&&Bn.jsx(UM,{body:l.body,bpKeys:u,onToggleBp:f})]})})]})});function FL({children:e}){return Bn.jsx("div",{className:"h-full",children:e})}const WL=w_(function({snapshotId:e}){var t;const n=j_(),s=n.snapshots.manifestOf(e),[i,r]=bn.useState("steps"),o=bn.useMemo(()=>new _B(e),[e]),[a,l]=bn.useState(null);bn.useEffect(()=>{let e=!1;return l(null),Promise.all([o.loadText({kind:"runFile",file:"steps.jsonl"}),o.loadText({kind:"runFile",file:"runtime.json"}),o.loadText({kind:"runFile",file:"sources.json"})]).then(([t,n,s])=>{e||l({events:t.ok?KL(t.text):[],vars:n.ok?qL(n.text):{},sources:s.ok?$L(s.text):null})}),()=>{e=!0}},[o]);const c=(null==(t=null==a?void 0:a.sources)?void 0:t.entry)??"",h=(null==a?void 0:a.sources)?a.sources.files[a.sources.entry]??null:null,u=bn.useMemo(()=>{if(null==h)return null;try{return wL(h)}catch{return null}},[h]);if(!s)return n.snapshots.loaded?Bn.jsx(hN,{id:e}):Bn.jsx(UL,{});const d=function(e){return"interrupted"===e?"aborted":e}(s.status),f="failed"===s.status,p=(null==a?void 0:a.events)??[],v=u?oD(p,u,c):null,g=f&&u?lD(p,u,c)??void 0:void 0,m=function(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if("step:fail"===n.kind)return n}return null}(p);return Bn.jsx(xB.Provider,{value:o,children:Bn.jsxs("div",{className:"flex h-full min-w-0 gap-1.5 bg-shell",children:[Bn.jsxs("section",{className:_y("flex min-w-0 flex-1 flex-col overflow-hidden bg-canvas",n.layout.inspectorOpen&&"rounded-r-lg"),children:[Bn.jsxs("div",{className:"shrink-0 border-b border-edge bg-canvas",children:[Bn.jsxs("div",{className:"flex h-10 items-center gap-3 px-4",children:[Bn.jsx("span",{"aria-hidden":!0,className:"h-4 w-1 shrink-0 rounded-sm bg-accent"}),Bn.jsx("div",{className:"truncate text-[13px] font-medium text-fg",children:s.scenario}),Bn.jsx(dN,{tone:yN(d),children:d}),Bn.jsx("div",{className:"flex-1"}),Bn.jsx(dN,{tone:"warn",children:"frozen · read-only"}),Bn.jsx(ON,{value:i,onChange:r,options:[{value:"steps",label:"Steps",icon:"list",title:"Show the step tree"},{value:"code",label:"Code",icon:"braces",title:"Show the test source"}]}),Bn.jsx("div",{className:"h-4 w-px bg-edge-soft"}),Bn.jsxs("button",{type:"button",onClick:n.layout.toggleInspector,"aria-pressed":n.layout.inspectorOpen,className:_y("group relative grid h-6 w-6 place-items-center rounded",n.layout.inspectorOpen?"bg-accent/10 text-accent":"text-fg-4 hover:bg-raised hover:text-fg-2"),children:[Bn.jsx(by,{name:"panelRight",className:"h-4 w-4"}),Bn.jsx(IN,{label:n.layout.inspectorOpen?"Hide inspector":"Show inspector",placement:"bottom-end"})]})]}),Bn.jsxs("div",{className:"flex h-8 items-center gap-3 border-t border-edge-soft px-4 font-mono text-[11px] text-fg-3",children:[Bn.jsxs("span",{className:"flex items-center gap-1",children:[Bn.jsx(by,{name:"camera",className:"h-3 w-3"})," snapshot"]}),Bn.jsx("span",{children:"·"}),Bn.jsxs("span",{children:["captured ",s.capturedAt.slice(0,16).replace("T"," ")]}),s.git.author&&Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("span",{children:"·"}),Bn.jsxs("span",{children:[s.git.author,s.git.branch&&` @ ${s.git.branch}`]})]})]})]}),Bn.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:null==a?Bn.jsx(UL,{}):"code"===i?Bn.jsx("pre",{className:"h-full overflow-auto whitespace-pre bg-canvas p-4 font-mono text-[12px] leading-relaxed text-fg",children:h??"no source snapshot in this bundle"}):Bn.jsx("div",{className:"h-full overflow-y-auto",children:u?Bn.jsx(UM,{body:u,...v?{trace:v}:{},...null!=g?{failedIndex:g}:{},...m?{onFailedStepRender:e=>Bn.jsx(uB,{errorName:m.errorName??"Error",message:m.error,file:c||s.scenario,line:e.line,source:e.source,index:e.index})}:{}}):Bn.jsx("div",{className:"px-4 py-3 font-mono text-[12px] text-fg-4",children:"no source snapshot in this bundle — steps can't be rendered"})})})]}),n.layout.inspectorOpen&&Bn.jsx(SB,{runId:e,active:null,events:p,isFailed:f,runFinished:!0,varsOverride:(null==a?void 0:a.vars)??{}})]})})});function UL(){return Bn.jsx("div",{className:"px-4 py-3 font-mono text-[12px] text-fg-4",children:"loading snapshot…"})}function KL(e){const t=[];for(const n of e.split("\n")){const e=n.trim();if(e)try{t.push(JSON.parse(e))}catch{}}return t}function qL(e){try{return JSON.parse(e).vars??{}}catch{return{}}}function $L(e){try{return JSON.parse(e)}catch{return null}}const VL=w_(function(){const e=j_().tabs.activeTab;switch(e.kind){case"overview":return Bn.jsx(QN,{});case"scenario":return Bn.jsx(HL,{path:e.path});case"helper":return Bn.jsx(UN,{path:e.path});case"collection":return Bn.jsx(LN,{path:e.path});case"scenario-run":return Bn.jsx(IL,{runId:e.runId});case"collection-run":return Bn.jsx(wN,{runId:e.runId});case"snapshot":return Bn.jsx(WL,{snapshotId:e.snapshotId})}}),YL={overview:"home",scenario:"file",helper:"braces",collection:"layers","scenario-run":"play","collection-run":"play",snapshot:"camera"},GL=w_(function(){const e=j_(),[t,n]=bn.useState(null),s=e.tabs.tabs.map(t=>{const n=e.tabs.keyFor(t);return{key:n,tab:t,label:ZL(e,t),status:JL(e,t),active:e.tabs.activeKey===n,closable:"overview"!==t.kind}});return Bn.jsxs("div",{className:"relative shrink-0 border-b border-edge bg-panel",children:[Bn.jsx("div",{role:"tablist",className:"uno-tab-rows uno-thin-scroll flex flex-wrap content-start gap-x-1 gap-y-1 overflow-y-auto py-0.5 pl-0.5 pr-8",style:{maxHeight:96},children:s.map(t=>Bn.jsx(Iy,{label:t.label,active:t.active,closable:t.closable,closeLabel:`Close ${t.label}`,onActivate:()=>e.tabs.activate(t.key),onClose:()=>e.tabs.close(t.key),onContextMenu:e=>{e.preventDefault(),n({x:e.clientX,y:e.clientY,key:t.key})},leading:"scenario-run"===t.tab.kind||"collection-run"===t.tab.kind?Bn.jsx(vN,{status:t.status??"pending"}):Bn.jsx(by,{name:YL[t.tab.kind],className:_y("h-3.5 w-3.5 shrink-0",t.active?"text-fg-2":"text-fg-4")})},t.key))}),Bn.jsx("button",{type:"button",onClick:t=>{const s=t.currentTarget.getBoundingClientRect();n({x:Math.max(6,s.right-208),y:s.bottom+4,key:e.tabs.activeKey})},"aria-label":"Tab actions",className:"absolute right-1 top-0.5 grid h-7 w-6 place-items-center rounded-md text-fg-4 hover:bg-raised hover:text-fg-2",children:Bn.jsx(by,{name:"more",className:"h-4 w-4 rotate-90"})}),t&&Bn.jsx(zy,{x:t.x,y:t.y,onClose:()=>n(null),items:XL(s,t.key,e.tabs)})]})});function XL(e,t,n){const s=e.find(e=>e.key===t),i=e.filter(e=>e.key!==t&&e.closable),r=[];return s&&r.push({kind:"header",label:s.label}),r.push({kind:"item",icon:"x",label:"Close",shortcut:"⌘W",disabled:!(null==s?void 0:s.closable),onSelect:()=>n.close(t)}),r.push({kind:"item",icon:"x",label:"Close Others",disabled:0===i.length,onSelect:()=>n.closeOthers(t)}),r.push({kind:"separator"}),r.push({kind:"item",icon:"trash",label:"Close All",tone:"danger",disabled:e.every(e=>!e.closable),onSelect:()=>n.closeAll()}),r}function ZL(e,t){var n;switch(t.kind){case"overview":return"Home";case"scenario":{const n=e.scenarios.items.find(e=>e.path===t.path);return(null==n?void 0:n.name)??t.path}case"helper":{const n=e.helpers.items.find(e=>e.path===t.path);return n?`${n.name}.js`:t.path}case"collection":{const n=e.collections.items.find(e=>e.path===t.path);return(null==n?void 0:n.name)??t.path}case"scenario-run":case"collection-run":{const n=e.runs.items.find(e=>e.runId===t.runId);if(n)return n.ref;const s=e.activeRuns.byRunId.get(t.runId);return(null==s?void 0:s.scenario)||("scenario-run"===t.kind?t.ref:void 0)||t.runId}case"snapshot":return(null==(n=e.snapshots.manifestOf(t.snapshotId))?void 0:n.scenario)??t.snapshotId}}function JL(e,t){if("scenario-run"===t.kind||"collection-run"===t.kind){const n=e.activeRuns.byRunId.get(t.runId);if(n)switch(n.status){case"starting":case"running":return"running";case"completed":return"passed";case"failed":return"failed";case"aborted":return"aborted"}const s=e.runs.items.find(e=>e.runId===t.runId);return xN(s??null)}return null}const QL="activityBar.section";class eE{constructor(){this.section=EM(QL,"scenarios"),$r(this,{},{autoBind:!0})}setSection(e){this.section=e}get storageKey(){return QL}}const tE={fail:"bg-fail text-on-accent",run:"bg-warn text-on-accent",info:"bg-accent text-on-accent"};function nE({children:e,tone:t,pulse:n}){return Bn.jsx("span",{className:_y("inline-flex h-[14px] min-w-[14px] items-center justify-center rounded-full px-[3px] font-mono text-[9px] font-semibold tabular-nums",tE[t],n&&"uno-pulse"),children:e})}const sE=[{id:"scenarios",icon:"file",label:"Scenarios",hint:"⌘1"},{id:"helpers",icon:"braces",label:"Helpers",hint:"⌘2"},{id:"collections",icon:"layers",label:"Collections",hint:"⌘3"},{id:"runs",icon:"history",label:"Runs",hint:"⌘4"},{id:"active",icon:"activity",label:"Active",hint:"⌘5"},{id:"variables",icon:"variable",label:"Variables",hint:"⌘6"},{id:"app",icon:"play",label:"App",hint:"⌘7"},{id:"snapshots",icon:"camera",label:"Snapshots",hint:"⌘8"}],iE=w_(function(){const e=j_(),t=e.session.capabilities.canTerminal,n=e.overview.failing.length,s=e.activeRuns.activeList.length+e.queue.waiting.length;return Bn.jsxs("nav",{className:"relative z-30 flex w-[40px] shrink-0 flex-col items-stretch py-1",children:[sE.map(t=>{const i=t.id===e.activityBar.section&&e.layout.treeOpen,r="runs"===t.id&&n>0?Bn.jsx(nE,{tone:"fail",children:n}):"active"===t.id&&s>0?Bn.jsx(nE,{tone:"run",pulse:!0,children:s}):null;return Bn.jsxs("button",{type:"button","aria-label":"runs"===t.id&&n>0?`${t.label} — ${n} ${1===n?"test":"tests"} failing now`:t.label,onClick:()=>{t.id===e.activityBar.section&&e.layout.treeOpen?e.layout.toggleTree():(e.activityBar.setSection(t.id),e.layout.openTree())},className:_y("group relative mx-1 my-0.5 grid place-items-center rounded py-2",i?"bg-panel text-fg":"text-fg-3 hover:bg-panel/70 hover:text-fg-2"),children:[Bn.jsxs("span",{className:"relative",children:[Bn.jsx(by,{name:t.icon,className:"h-[18px] w-[18px]"}),r&&Bn.jsx("span",{className:"absolute -right-2 -top-1.5",children:r})]}),Bn.jsx(IN,{label:t.label,hint:t.hint,placement:"right"})]},t.id)}),t&&Bn.jsxs("button",{type:"button","aria-label":"Terminal",onClick:()=>e.terminal.toggle(),className:_y("group relative mx-1 mt-auto my-0.5 grid place-items-center rounded py-2",e.terminal.open?"bg-panel text-fg":"text-fg-3 hover:bg-panel/70 hover:text-fg-2"),children:[Bn.jsx(by,{name:"terminal",className:"h-[18px] w-[18px]"}),Bn.jsx(IN,{label:"Terminal",hint:"⌃`",placement:"right"})]})]})}),rE=bn.createContext(()=>{});function oE({trigger:e,header:t,children:n,align:s="left",direction:i="up",disabled:r=!1,title:o,menuWidth:a="w-72",triggerClass:l,onOpen:c}){const[h,u]=bn.useState(!1),d=bn.useRef(null);return Ay(d,()=>u(!1)),Bn.jsxs("div",{ref:d,className:"relative flex items-stretch",children:[Bn.jsx("button",{type:"button",onClick:()=>{r||u(e=>(e||null==c||c(),!e))},title:o,className:_y("flex min-w-0 items-center gap-1 rounded-sm px-1 font-mono text-[11px] transition-colors",!r&&"hover:bg-raised hover:text-fg",h&&"bg-raised text-fg",l),children:e}),h&&Bn.jsxs("div",{className:_y("absolute z-50 overflow-hidden rounded-md border border-edge-soft bg-overlay shadow-lg","up"===i?"bottom-full mb-1":"top-full mt-1","right"===s?"right-0":"left-0",a),children:[Bn.jsx("div",{className:"border-b border-edge-soft px-3 py-1.5 font-mono text-[10px] uppercase tracking-wider text-fg-4",children:t}),Bn.jsx(rE.Provider,{value:()=>u(!1),children:n})]})]})}function aE({icon:e,leadingDot:t,label:n,sublabel:s,note:i,active:r,disabled:o=!1,title:a,onSelect:l}){const c=bn.useContext(rE);return Bn.jsxs("button",{type:"button",disabled:o,title:a,onClick:o?void 0:()=>{l(),c()},className:_y("flex w-full items-center gap-2.5 px-3 py-2 text-left transition-colors",o?"cursor-not-allowed opacity-60":r?"bg-raised/60":"hover:bg-raised/60"),children:[e&&Bn.jsx(by,{name:e,className:"h-4 w-4 shrink-0 text-fg-3"}),Bn.jsxs("div",{className:"min-w-0 flex-1",children:[Bn.jsxs("div",{className:"flex items-center gap-1.5",children:[t&&Bn.jsx("span",{className:_y("h-1.5 w-1.5 rounded-full",t)}),Bn.jsx("span",{className:"font-mono text-[13px] text-fg",children:n})]}),s&&Bn.jsx("div",{className:"truncate text-[11px] text-fg-4",children:s}),i&&Bn.jsx("div",{className:"mt-1 text-[10.5px] leading-snug text-warn",children:i})]}),r&&!o&&Bn.jsx("span",{className:"font-mono text-[10px] uppercase tracking-wider text-accent",children:"current"})]})}const lE="gap-1.5 px-2",cE={web:{icon:"globe",dot:"bg-accent",blurb:"Playwright via @unotest/web"},mobile:{icon:"phone",dot:"bg-accent",blurb:"iOS + Android via @unotest/mobile"},unity:{icon:"cube",dot:"bg-accent",blurb:"Unity in-editor via @unotest/unity"}};function hE(e){return cE[e]??{icon:"target",dot:"bg-fg-4",blurb:""}}const uE=w_(function(){return Bn.jsxs("div",{className:"flex h-5 shrink-0 items-stretch px-2 text-fg-3",children:[Bn.jsx(dE,{}),Bn.jsx(fE,{}),Bn.jsx(pE,{}),Bn.jsxs("div",{className:"ml-auto flex items-stretch gap-1",children:[Bn.jsx(vE,{}),Bn.jsx(_E,{}),Bn.jsxs("span",{className:"flex items-center px-1 font-mono text-[10px] text-fg-4",children:["v","0.43.2"]})]})]})}),dE=w_(function(){const{targets:e}=j_();if(0===e.available.length)return null;const t=e.active,n=hE(t);return Bn.jsx(oE,{header:"test target",align:"left",triggerClass:lE,disabled:!e.hasMultiple,title:n.blurb?`Target: ${t} — ${n.blurb}`:`Target: ${t}`,trigger:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("span",{className:_y("h-1.5 w-1.5 rounded-full",n.dot)}),Bn.jsx(by,{name:n.icon,className:"h-3.5 w-3.5",strokeWidth:1.75}),Bn.jsx("span",{className:"truncate",children:t||"—"})]}),children:e.available.map(t=>Bn.jsx(gE,{info:t,active:t.target===e.active,onSelect:()=>{e.setActive(t.target)}},t.target))})}),fE=w_(function(){const{environments:e}=j_();if(!e.hasAny)return null;const t=e.active??"base";return Bn.jsxs(oE,{header:"env overlay",align:"left",triggerClass:lE,title:e.active?`Env overlay: ${e.active} — .env.${e.active} overlay + .runs.${e.active} history`:"Env overlay: base — unotest/.env, unotest/.runs",trigger:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx(by,{name:"layers",className:"h-3.5 w-3.5",strokeWidth:1.75}),Bn.jsx("span",{className:"truncate",children:t})]}),children:[Bn.jsx(aE,{label:"base",sublabel:"unotest/.env — no overlay",active:null===e.active,onSelect:()=>{e.setActive(null)}}),e.names.map(t=>Bn.jsx(aE,{label:t,sublabel:`.env.${t} overlay · .runs.${t} history`,active:e.active===t,onSelect:()=>{e.setActive(t)}},t))]})}),pE=w_(function(){const{workspace:e}=j_(),t=e.file;if(!t)return null;const n=e.current,s=t.switchedBy?` · switched by ${t.switchedBy}`:"";return Bn.jsxs(oE,{header:"test bundle",align:"left",triggerClass:lE,menuWidth:"w-80",disabled:e.switching,title:n?`Bundle ${n.label} — pushed ${n.author?`by ${n.author}`:"to this box"}, running @unotest/web ${n.webVersion}${s}`:`${t.workspace}: nothing has been pushed to this environment yet`,trigger:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx(by,{name:"package",className:"h-3.5 w-3.5",strokeWidth:1.75}),Bn.jsx("span",{className:"truncate",children:e.label}),(null==n?void 0:n.dirty)&&Bn.jsx("span",{className:"text-warn",children:"wip"}),e.switching&&Bn.jsx("span",{className:"text-fg-4",children:"switching…"})]}),children:[0===t.bundles.length&&Bn.jsxs("div",{className:"px-2 py-1.5 text-[11px] text-fg-4",children:["Nothing pushed yet — send this suite with",Bn.jsx("span",{className:"font-mono",children:" npx @unotest/web bundle push"}),"."]}),t.bundles.map(n=>Bn.jsx(aE,{label:n.label,sublabel:[n.author,`web ${n.webVersion}`,new Date(n.createdAt).toLocaleString()].filter(Boolean).join(" · "),active:n.bundleId===t.currentBundleId,onSelect:()=>{e.canSwitch&&e.switchTo(n.bundleId)}},n.bundleId)),!t.allowSwitch&&Bn.jsx("div",{className:"px-2 py-1.5 text-[11px] text-fg-4",children:"This environment follows its branch — switching is disabled for it."}),e.error&&Bn.jsx("div",{className:"px-2 py-1.5 text-[11px] text-danger",children:e.error})]})}),vE=w_(function(){const{session:e}=j_(),t=e.identity;if(!t)return null;const n=t.env?`${t.role} · ${t.env}`:t.role;return Bn.jsxs(oE,{header:"session",align:"right",triggerClass:lE,menuWidth:"w-60",disabled:!t.logoutUrl&&!t.hostPagesUrl,title:`Signed in as ${t.user} (${n})`,trigger:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx(by,{name:"user",className:"h-3.5 w-3.5",strokeWidth:1.75}),Bn.jsx("span",{className:"truncate",children:t.user}),Bn.jsx("span",{className:"text-fg-4",children:n})]}),children:[t.hostPagesUrl&&Bn.jsx(aE,{icon:"externalL",label:"box pages",sublabel:"Environments, read tokens and administration",active:!1,onSelect:()=>window.location.assign(t.hostPagesUrl??"")}),t.logoutUrl&&Bn.jsx(aE,{icon:"externalL",label:"log out",sublabel:"End this session and return to the login page",active:!1,onSelect:()=>e.logout()})]})});function gE({info:e,active:t,onSelect:n}){var s,i;const r=hE(e.target),o=!!e.host&&!e.host.ok;return Bn.jsx(aE,{icon:r.icon,leadingDot:r.dot,label:e.target,sublabel:r.blurb||e.name,note:o?null==(s=e.host)?void 0:s.reason:void 0,active:t,disabled:o,title:o?null==(i=e.host)?void 0:i.reason:void 0,onSelect:n})}const mE=[{mode:"light",icon:"sun",label:"light",blurb:"Always light"},{mode:"dark",icon:"moon",label:"dark",blurb:"Always dark"},{mode:"system",icon:"monitor",label:"system",blurb:"Follow OS appearance"}],_E=w_(function(){const{theme:e}=j_(),t=mE.find(t=>t.mode===e.mode)??mE[2];return Bn.jsx(oE,{header:"theme",align:"right",triggerClass:lE,menuWidth:"w-60",title:`Theme: ${t.label}`,trigger:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx(by,{name:t.icon,className:"h-3.5 w-3.5",strokeWidth:1.75}),Bn.jsx("span",{className:"truncate",children:t.label})]}),children:mE.map(t=>Bn.jsx(aE,{icon:t.icon,label:t.label,sublabel:t.blurb,active:t.mode===e.mode,onSelect:()=>e.set(t.mode)},t.mode))})}),xE=w_(function(){const e=j_(),t=e.targets.current,n=null==t?void 0:t.host;if(!t||!n)return null;if(!n.ok)return Bn.jsx(wE,{tone:"block",icon:"alert",title:`${t.target} isn’t available on this OS`,children:n.reason&&Bn.jsx("p",{className:"text-fg-2",children:n.reason})});const s=e.targetDoctor,i=s.checkedTarget===t.target?s.checks:null,r=null!==i&&!s.hasErrors;return Bn.jsxs(wE,{tone:r?"ok":"setup",icon:r?"check":"inspect",title:r?`${t.target} environment ready`:`Set up ${t.target}`,action:Bn.jsx("button",{type:"button",onClick:()=>{s.run(t.target)},disabled:s.busy,className:_y("shrink-0 rounded border px-3 py-1 font-mono text-[11px] transition-colors","border-edge-soft hover:bg-raised",s.busy&&"cursor-wait opacity-60"),children:s.busy?"Checking…":i?"Re-check":"Check"}),children:[Bn.jsx("p",{className:"text-fg-2",children:r?"All checks passed — you can run scenarios for this target.":`${t.name} needs a local toolchain it can't bundle. Install it, then verify here.`}),s.error&&Bn.jsx("p",{className:"mt-2 font-mono text-[11px] text-fail",children:s.error}),i&&i.length>0&&Bn.jsx("ul",{className:"mt-2 space-y-1.5",children:i.map(e=>Bn.jsxs("li",{className:"flex items-start gap-2 text-[12px]",children:[Bn.jsx("span",{className:_y("mt-[5px] h-1.5 w-1.5 shrink-0 rounded-full",bE(e.severity))}),Bn.jsxs("span",{className:"min-w-0",children:[Bn.jsx("span",{className:"text-fg",children:e.name}),Bn.jsxs("span",{className:"text-fg-2",children:[" — ",e.message]}),e.detail&&Bn.jsx("span",{className:"mt-0.5 block text-[11px] text-fg-3",children:e.detail})]})]},e.name))})]})});function bE(e){return"ok"===e?"bg-pass":"warning"===e?"bg-warn":"bg-fail"}const yE={setup:"border-warn/40 bg-warn/5",ok:"border-pass/40 bg-pass/5",block:"border-fail/40 bg-fail/5"};function wE({tone:e,icon:t,title:n,action:s,children:i}){return Bn.jsx("div",{className:_y("shrink-0 border-b px-4 py-3 text-[13px]",yE[e]),children:Bn.jsxs("div",{className:"flex items-start justify-between gap-3",children:[Bn.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[Bn.jsx(by,{name:t,className:"mt-0.5 h-4 w-4 shrink-0 text-fg-2"}),Bn.jsxs("div",{className:"min-w-0",children:[Bn.jsx("div",{className:"font-medium text-fg",children:n}),i]})]}),s]})})}function SE({children:e}){return Bn.jsx("kbd",{className:"inline-flex h-[18px] min-w-[18px] items-center justify-center rounded border border-edge-soft bg-raised px-1 font-mono text-[10px] font-medium uppercase tracking-wider text-fg-3",children:e})}const kE="text-[11.5px] text-fg-3",CE=w_(function(){var e,t;const{session:n}=j_();if(!n.canSwitchEnvironment)return null;const s=n.currentEnvironment,i=function(e){const t=[];for(const n of e)void 0===n.project||t.includes(n.project)||t.push(n.project);return t}(n.environments),r=null==s?void 0:s.project,o=n.environments.filter(e=>e.project===r);return Bn.jsxs("div",{className:"flex min-w-0 flex-1 items-center",children:[i.length>0&&Bn.jsxs(Bn.Fragment,{children:[Bn.jsx(oE,{header:"project",direction:"down",menuWidth:"w-64",triggerClass:kE,disabled:i.length<2,title:r?`Project: ${r}`:void 0,trigger:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("span",{className:"truncate",children:r??"—"}),Bn.jsx(jE,{hidden:i.length<2})]}),onOpen:()=>{n.loadEnvironments()},children:i.map(e=>Bn.jsx(aE,{label:e,sublabel:NE(n.environments,e),active:e===r,onSelect:()=>{const t=function(e,t,n){const s=e.filter(e=>e.project===t);return s.find(e=>e.environment===(null==n?void 0:n.environment))??s[0]}(n.environments,e,s);t&&n.switchEnvironment(t.name)}},e))}),Bn.jsx("span",{className:"shrink-0 text-fg-4",children:"/"})]}),Bn.jsxs(oE,{header:"environment",direction:"down",menuWidth:"w-64",triggerClass:kE,title:(null==s?void 0:s.note)?`Environment: ${s.environment} — running ${s.note}`:`Environment: ${(null==(e=n.identity)?void 0:e.env)??"—"}`,trigger:Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("span",{className:"truncate",children:(null==s?void 0:s.environment)??(null==(t=n.identity)?void 0:t.env)??"—"}),Bn.jsx(jE,{})]}),onOpen:()=>{n.loadEnvironments()},children:[0===o.length&&Bn.jsx("div",{className:"px-3 py-2 text-[11px] text-fg-4",children:n.loadingEnvironments?"Loading…":"This host serves no other environment right now."}),o.map(e=>{var t;return Bn.jsx(aE,{label:e.environment,sublabel:e.note??"nothing pushed yet",active:e.name===(null==(t=n.identity)?void 0:t.env),onSelect:()=>n.switchEnvironment(e.name)},e.name)})]})]})});function jE({hidden:e=!1}){return e?null:Bn.jsx(by,{name:"chevronD",className:"h-3 w-3 shrink-0 opacity-0 transition-opacity group-hover/pane:opacity-100"})}function NE(e,t){return e.filter(e=>e.project===t).map(e=>e.environment).join(" · ")}function ME(e){return{paddingLeft:8+22*e}}function BE(e){return{paddingLeft:8+22*e+22}}function DE({children:e,onClick:t,onContextMenu:n,active:s,indent:i=!1,depth:r,leaf:o=!1,danger:a=!1,ariaLabel:l}){const c=void 0===r?void 0:o?BE(r):ME(r);return Bn.jsx("button",{type:"button","aria-label":l,onClick:t,onContextMenu:n,style:c,className:_y("flex w-full items-center gap-2 px-2 py-1 text-left",void 0===r&&i&&"pl-7",s?"bg-selection text-fg":"hover:bg-raised/60",a&&"text-fail"),children:e})}const LE=w_(function({query:e}){const t=j_(),n=bn.useMemo(()=>{const n=e.trim().toLowerCase(),s=(e,t)=>!n||e.toLowerCase().includes(n)||t.toLowerCase().includes(n),i=t.activeRuns.activeList.filter(e=>s(e.scenario,e.runId)).map(e=>{const t=e.events.filter(e=>"step:started"===e.kind).length,n=e.events.filter(e=>"step:ok"===e.kind||"step:fail"===e.kind).length,s=0===t?.05:Math.min(.95,n/Math.max(t,1));return{kind:"scenario",runId:e.runId,ref:e.scenario||e.runId,startedAt:e.startedAt,progress:s}}),r=t.activeRuns.activeCollectionList.filter(e=>s(e.collection,e.runId)).map(e=>{const t=e.scenarios.length||1,n=e.childOutcomes.size,s=Math.min(.95,n/t);return{kind:"collection",runId:e.runId,ref:e.collection||e.runId,startedAt:e.startedAt,progress:Math.max(.05,s),done:n,total:e.scenarios.length}});return r.sort((e,t)=>t.startedAt-e.startedAt),i.sort((e,t)=>t.startedAt-e.startedAt),[...r,...i]},[t.activeRuns.activeList,t.activeRuns.activeCollectionList,e]),s=t.queue.waiting.filter(t=>!e.trim()||t.ticket.ref.toLowerCase().includes(e.trim().toLowerCase()));return Bn.jsxs("div",{className:"py-1",children:[s.length>0&&Bn.jsxs("div",{className:"mb-1 border-b border-edge pb-1",children:[Bn.jsxs("div",{className:"px-2 py-1 font-mono text-[10.5px] uppercase tracking-wide text-fg-4",children:["queued · ",t.queue.slots.used,"/",t.queue.slots.total," slot",1===t.queue.slots.total?"":"s"," busy"]}),s.map(e=>Bn.jsxs("div",{className:"flex w-full items-center gap-2 px-2 py-1 hover:bg-raised/60",children:[Bn.jsx(vN,{status:"pending"}),Bn.jsxs("div",{className:"min-w-0 flex-1",children:[Bn.jsx("div",{className:"truncate font-mono text-[12.5px] text-fg-2",children:e.ticket.ref}),Bn.jsxs("div",{className:"mt-0.5 truncate font-mono text-[10.5px] text-fg-4",children:["collection"===e.ticket.kind?"collection · ":"",e.ticket.ci?`${dx(e.ticket.ci)} · `:"",e.ticket.producer.kind," · waiting since"," ",mN(e.ticket.createdAt)]})]}),Bn.jsx("button",{type:"button",title:"take this run out of the queue","aria-label":`cancel queued ${e.ticket.ref}`,onClick:()=>{t.queue.cancel(e.name)},className:"rounded p-1 text-fg-4 hover:bg-raised hover:text-fail",children:Bn.jsx(by,{name:"x",className:"h-3.5 w-3.5"})})]},e.name))]}),n.map(e=>Bn.jsxs(DE,{onClick:()=>t.tabs.open("collection"===e.kind?{kind:"collection-run",runId:e.runId}:{kind:"scenario-run",runId:e.runId}),children:["collection"===e.kind?Bn.jsx(by,{name:"layers",className:"h-3.5 w-3.5 text-fg-3"}):Bn.jsx(vN,{status:"running"}),Bn.jsxs("div",{className:"min-w-0 flex-1",children:[Bn.jsxs("div",{className:"flex items-center gap-1.5",children:[Bn.jsx("span",{className:"truncate font-mono text-[12.5px] text-fg-2",children:e.ref}),"collection"===e.kind&&Bn.jsx(dN,{size:"xs",tone:"info",children:"col"})]}),Bn.jsx("div",{className:_y("mt-1 h-1 overflow-hidden rounded bg-raised"),children:Bn.jsx("div",{className:"h-full bg-warn uno-pulse",style:{width:100*e.progress+"%"}})}),Bn.jsx("div",{className:"mt-0.5 truncate font-mono text-[10.5px] text-fg-4",children:"collection"===e.kind?`${e.done}/${e.total} done · started ${mN(e.startedAt)}`:`started ${mN(e.startedAt)}`})]})]},e.runId)),0===n.length&&0===s.length&&Bn.jsx(yB,{children:"nothing running"})]})}),EE=w_(function({title:e,extensions:t,onPick:n,onClose:s}){const i=j_(),[r,o]=bn.useState(null),[a,l]=bn.useState(null),c=e=>{i.appServer.browse(e,t).then(e=>{o(e),l(null)}).catch(e=>{l(e instanceof Error?e.message:String(e))})};bn.useEffect(()=>{c()},[]);return Bn.jsx("div",{className:"fixed inset-0 z-50 grid place-items-center bg-black/40",onClick:s,children:Bn.jsxs("div",{className:"flex h-[420px] w-[520px] flex-col rounded-lg border border-edge-soft bg-overlay shadow-xl",onClick:e=>e.stopPropagation(),children:[Bn.jsxs("div",{className:"flex items-center gap-2 border-b border-edge-soft px-3 py-2",children:[Bn.jsx("span",{className:"font-mono text-[12px] text-fg",children:e}),Bn.jsx("span",{className:"truncate font-mono text-[10.5px] text-fg-4",children:(null==r?void 0:r.path)||"select a location"}),Bn.jsx("button",{type:"button",onClick:s,className:"ml-auto grid h-5 w-5 place-items-center rounded text-fg-4 hover:bg-raised hover:text-fg-2",children:Bn.jsx(by,{name:"x",className:"h-3.5 w-3.5"})})]}),Bn.jsxs("div",{className:"flex-1 overflow-y-auto py-1",children:[a&&Bn.jsx("div",{className:"px-3 py-1 font-mono text-[11px] text-fail",children:a}),r&&""!==r.path&&Bn.jsxs("button",{type:"button",onClick:()=>c(r.parent??void 0),className:"flex h-7 w-full items-center gap-2 px-3 font-mono text-[11.5px] text-fg-3 hover:bg-raised/60",children:[Bn.jsx(by,{name:"chevronR",className:"h-3.5 w-3.5 rotate-180"}),".."]}),null==r?void 0:r.entries.map(e=>Bn.jsxs("button",{type:"button",onClick:()=>(e=>{"dir"===e.kind?c(e.path):n(e.path)})(e),className:_y("flex h-7 w-full items-center gap-2 truncate px-3 font-mono text-[11.5px] hover:bg-raised/60","dir"===e.kind?"text-fg":"text-accent"),children:[Bn.jsx(by,{name:"dir"===e.kind?"folder":"file",className:"h-3.5 w-3.5 shrink-0 text-fg-4"}),Bn.jsx("span",{className:"truncate",children:e.name}),"dir"!==e.kind&&Bn.jsx("span",{className:"ml-auto rounded bg-accent/10 px-1 font-mono text-[9px] uppercase text-accent",children:"select"})]},e.path)),r&&0===r.entries.length&&!a&&Bn.jsx("div",{className:"px-3 py-2 font-mono text-[11px] text-fg-4",children:"nothing matching here"})]})]})})}),PE={stopped:{label:"stopped",dot:"bg-fg-4"},starting:{label:"starting…",dot:"bg-warn animate-pulse"},running:{label:"running",dot:"bg-pass"},external:{label:"running (external)",dot:"bg-pass"},error:{label:"error",dot:"bg-fail"}},RE=w_(function({query:e}){var t;const n=j_(),s=n.appServer;bn.useEffect(()=>{s.load(),n.variables.load()},[s,n.variables]);const{status:i}=s;if(!i.available&&"stopped"===i.state)return Bn.jsxs(yB,{children:['target "',n.targets.active,'" has no app-server capability']});const r=PE[i.state],o=i.available&&("stopped"===i.state||"error"===i.state),a="running"===i.state||"starting"===i.state,l=n.session.capabilities.canRun,c=e.trim().toLowerCase(),h=c?i.log.filter(e=>e.toLowerCase().includes(c)):i.log;return Bn.jsxs("div",{className:"flex h-full flex-col",children:[Bn.jsxs("div",{className:"border-b border-edge-soft px-3 py-2",children:[Bn.jsxs("div",{className:"flex items-center gap-2",children:[Bn.jsx("span",{className:_y("h-2 w-2 shrink-0 rounded-full",r.dot)}),Bn.jsx("span",{className:"font-mono text-[11.5px] text-fg-2",children:r.label}),i.target&&i.target!==n.targets.active&&Bn.jsx("span",{className:"rounded bg-raised px-1 font-mono text-[9px] uppercase tracking-wide text-fg-3",children:i.target}),Bn.jsxs("span",{className:"ml-auto flex gap-1",children:[o&&l&&Bn.jsx("button",{type:"button",disabled:s.busy,onClick:()=>{s.start()},className:"rounded bg-accent px-2 py-0.5 font-mono text-[11px] text-on-accent hover:bg-accent-hover disabled:opacity-50",children:"Start"}),a&&l&&Bn.jsx("button",{type:"button",disabled:s.busy,onClick:()=>{s.stop()},className:"rounded bg-raised px-2 py-0.5 font-mono text-[11px] text-fg-2 hover:text-fg",children:"Stop"})]})]}),i.url&&Bn.jsx("a",{href:i.url,target:"_blank",rel:"noreferrer",className:"mt-1 block truncate font-mono text-[11px] text-accent hover:underline",children:i.url}),i.detail&&Bn.jsx("div",{className:"mt-1 font-mono text-[10.5px] text-fg-3",children:i.detail}),"external"===i.state&&Bn.jsx("div",{className:"mt-1 font-mono text-[10.5px] text-fg-4",children:"already served by another process — runs reuse it"}),(s.error??i.message)&&Bn.jsx("div",{className:"mt-1 font-mono text-[11px] text-fail",children:s.error??i.message}),null==(t=i.pickers)?void 0:t.map(e=>Bn.jsx(AE,{picker:e},e.envKey))]}),Bn.jsx("div",{className:"flex-1 overflow-y-auto px-3 py-1",children:0===h.length?Bn.jsx(yB,{children:"no output yet"}):h.map((e,t)=>Bn.jsx("div",{className:"whitespace-pre-wrap break-all font-mono text-[10.5px] leading-4 text-fg-2",children:e},t))})]})}),AE=w_(function({picker:e}){const t=j_().variables,n=t.rows.find(t=>"env"===t.source&&t.key===e.envKey),s=n?t.effectiveValue(n):"",[i,r]=bn.useState(null),[o,a]=bn.useState(!1),[l,c]=bn.useState(!1),h=i??s,u=null!==i&&i!==s,d=async()=>{if(u&&!l){c(!0);try{n?(t.setValue(n,h),await t.save()):await t.addVariable(e.envKey,h,"app"),r(null)}finally{c(!1)}}};return Bn.jsxs("div",{className:"mt-2",children:[Bn.jsxs("div",{className:"mb-0.5 flex items-center gap-1 font-mono text-[10.5px] text-fg-3",children:[e.label,Bn.jsx("span",{className:"text-fg-4",children:e.envKey})]}),Bn.jsxs("div",{className:"flex items-center gap-1",children:[Bn.jsx("input",{type:"text",value:h,spellCheck:!1,placeholder:`/path/to/your${e.extensions[0]??""}`,onChange:e=>r(e.target.value),onKeyDown:e=>"Enter"===e.key&&void d(),className:"h-6 w-full rounded border border-edge-soft bg-canvas px-1.5 font-mono text-[11px] text-fg placeholder:text-fg-4 focus:border-accent focus:outline-none focus:ring-2 focus:ring-accent/20"}),Bn.jsx("button",{type:"button",title:"Browse…",onClick:()=>a(!0),className:"grid h-6 w-7 shrink-0 place-items-center rounded border border-edge-soft text-fg-4 hover:bg-raised hover:text-fg",children:Bn.jsx(by,{name:"folder",className:"h-3.5 w-3.5"})}),u&&Bn.jsx("button",{type:"button",disabled:l,onClick:()=>{d()},className:"rounded bg-accent px-2 py-0.5 font-mono text-[11px] text-on-accent hover:bg-accent-hover disabled:opacity-50",children:"Save"})]}),o&&Bn.jsx(EE,{title:e.label,extensions:e.extensions,onPick:e=>{r(e),a(!1)},onClose:()=>a(!1)})]})}),zE=w_(function({query:e}){const t=j_(),n=t.collections.items,[s,i]=bn.useState(!1),[r,o]=bn.useState(null),a=t.session.capabilities.canEditFiles,l=bn.useMemo(()=>{const t=e.trim().toLowerCase();return n.filter(e=>!t||e.name.toLowerCase().includes(t))},[n,e]);return Bn.jsxs("div",{className:"py-1",children:[s?Bn.jsx(TE,{existingNames:n.map(e=>e.name.toLowerCase()),onCommit:async e=>{const n=await t.collections.create(e);n&&(i(!1),t.tabs.open({kind:"collection",path:n.path}))},onCancel:()=>i(!1)}):a?Bn.jsxs("button",{type:"button",onClick:()=>i(!0),className:"mx-2 my-1 flex w-[calc(100%-1rem)] items-center justify-center gap-1.5 rounded border border-dashed border-edge-soft px-2 py-1.5 font-mono text-[11.5px] text-fg-4 hover:border-accent hover:bg-accent/10 hover:text-accent",children:[Bn.jsx(by,{name:"plus",className:"h-3.5 w-3.5"})," new collection"]}):null,l.map(e=>{const n=t.runs.lastRunByRef("collection",e.name),s=t.schedules.get("collection",e.name);return Bn.jsxs(DE,{onClick:()=>t.tabs.open({kind:"collection",path:e.path}),onContextMenu:t=>{t.preventDefault(),o({x:t.clientX,y:t.clientY,name:e.name})},children:[Bn.jsx(by,{name:"layers",className:"h-3.5 w-3.5 text-fg-3"}),Bn.jsxs("div",{className:"min-w-0 flex-1",children:[Bn.jsxs("div",{className:"flex items-center gap-1.5",children:[Bn.jsx("span",{className:"truncate font-mono text-[12.5px] text-fg-2",children:e.name}),s&&Bn.jsx("span",{title:JN(s),children:Bn.jsx(by,{name:"clock",className:"h-3 w-3 shrink-0 text-fg-4"})})]}),Bn.jsxs("div",{className:"mt-0.5 truncate font-mono text-[10.5px] text-fg-4",children:[e.scenarios.length," scenarios ·"," ",n?mN(n.startedAt):"never run"]})]})]},e.path)}),0===l.length&&!s&&Bn.jsx(yB,{children:"no collections match"}),r&&Bn.jsx(zy,{x:r.x,y:r.y,items:[{kind:"header",label:r.name},{kind:"item",icon:"clock",label:(()=>{const e=t.schedules.get("collection",r.name);return e?`Schedule · ${zb(e.cron)}`:"Schedule…"})(),disabled:!a,onSelect:()=>t.schedules.openEditor({kind:"collection",name:r.name})}],onClose:()=>o(null)})]})});function TE({existingNames:e,onCommit:t,onCancel:n}){const[s,i]=bn.useState(""),r=bn.useRef(null),o=bn.useRef(null);bn.useEffect(()=>{var e;null==(e=r.current)||e.focus()},[]);const a=s.trim(),l=a.length>0?sy(a):null,c=a.length>0&&e.includes(a.toLowerCase())?`"${a}" already exists`:l||null,h=a.length>0&&!c;return Bn.jsxs("form",{ref:o,onSubmit:e=>{e.preventDefault(),h&&t(a)},className:"mx-2 my-1",children:[Bn.jsxs("div",{className:_y("flex h-[30px] items-center gap-1.5 rounded border bg-canvas px-2 ring-2",c?"border-fail ring-fail/20":"border-accent ring-accent/20"),children:[Bn.jsx(by,{name:"layers",className:"h-3.5 w-3.5 shrink-0 text-accent"}),Bn.jsx("input",{ref:r,value:s,onChange:e=>i(e.target.value),onKeyDown:e=>{"Escape"===e.key&&(e.preventDefault(),n())},onBlur:e=>{o.current&&e.relatedTarget&&o.current.contains(e.relatedTarget)||a||n()},spellCheck:!1,autoComplete:"off",placeholder:"collection name…",className:"min-w-0 flex-1 bg-transparent font-mono text-[12.5px] text-fg placeholder-fg-4 outline-none"}),Bn.jsx("button",{type:"button",onMouseDown:e=>e.preventDefault(),onClick:n,title:"Cancel (esc)",className:"grid h-5 w-5 shrink-0 place-items-center rounded text-fg-4 hover:bg-raised hover:text-fg-2",children:Bn.jsx(by,{name:"x",className:"h-3 w-3",strokeWidth:2.25})}),Bn.jsx("button",{type:"submit",disabled:!h,onMouseDown:e=>e.preventDefault(),title:"Create (↵)",className:_y("grid h-5 w-5 shrink-0 place-items-center rounded",h?"text-accent hover:bg-accent/10 hover:text-accent-hover":"cursor-default text-fg-4"),children:Bn.jsx(by,{name:"check",className:"h-3.5 w-3.5",strokeWidth:2.5})})]}),Bn.jsx("div",{className:_y("mt-1 flex items-center gap-1 px-1 font-mono text-[10px]",c?"text-fail":"text-fg-4"),children:c?Bn.jsxs(Bn.Fragment,{children:[Bn.jsx(by,{name:"alert",className:"h-3 w-3"})," ",c]}):Bn.jsx(Bn.Fragment,{children:"↵ create · esc cancel"})})]})}const IE=w_(function({query:e}){const t=j_(),n=t.helpers.items,s=bn.useMemo(()=>{const t=e.trim().toLowerCase();return n.filter(e=>!t||e.name.toLowerCase().includes(t))},[n,e]);return Bn.jsxs("div",{className:"py-1",children:[Bn.jsxs("div",{className:"flex h-7 items-center gap-1 px-2 text-fg-4",children:[Bn.jsx(by,{name:"chevronD",className:"h-3.5 w-3.5 text-fg-4"}),Bn.jsx("span",{className:"font-mono text-[11px] uppercase tracking-wider",children:"_helpers"}),Bn.jsx("span",{className:"ml-auto font-mono text-[10.5px] text-fg-4",children:s.length})]}),s.map(e=>Bn.jsxs(DE,{indent:!0,onClick:()=>t.tabs.open({kind:"helper",path:e.path}),children:[Bn.jsx(by,{name:"braces",className:"h-3.5 w-3.5 text-fg-3"}),Bn.jsxs("div",{className:"min-w-0 flex-1",children:[Bn.jsxs("div",{className:"truncate font-mono text-[12.5px] text-fg-2",children:[e.name,".js"]}),Bn.jsx("div",{className:"mt-0.5 truncate font-mono text-[10.5px] text-fg-4",children:e.path})]})]},e.path)),0===s.length&&Bn.jsx(yB,{children:"no helpers match"})]})});function OE(e){switch(e.kind){case"collection":return`col:${e.run.runId}`;case"repeats":return`rep:${e.runs[0].runId}`;case"run":return`run:${e.run.runId}`}}function HE(e,t={}){const n=t.now??Date.now(),s=t.flat?e.map(e=>({kind:"run",run:e})):function(e){const t=new Map;for(const s of e)"collection"===s.kind&&t.set(s.runId,{kind:"collection",run:s,children:[],passed:0,failed:0});const n=[];for(const s of e){if("collection"===s.kind){n.push(t.get(s.runId));continue}const e=s.parentRunId?t.get(s.parentRunId):void 0;e?(e.children.push(s),"passed"===s.status?e.passed++:"failed"!==s.status&&"interrupted"!==s.status||e.failed++):n.push({kind:"run",run:s})}return n}(e),i=[];let r=null;for(const o of s){const{startedAt:e}=o.run,s=WE(e);r&&r.key===s||(r={key:s,label:UE(e,n,t.locale),entries:[]},i.push(r)),FE(r.entries,o,!0===t.flat)}return i}function FE(e,t,n){if(n||"run"!==t.kind)return void e.push(t);const s=e[e.length-1];"repeats"!==(null==s?void 0:s.kind)||s.ref!==t.run.ref?"run"!==(null==s?void 0:s.kind)||s.run.ref!==t.run.ref?e.push(t):e[e.length-1]={kind:"repeats",ref:t.run.ref,runs:[s.run,t.run]}:s.runs.push(t.run)}function WE(e){const t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}function UE(e,t,n){const s=WE(e);return s===WE(t)?"Today":s===WE(t-864e5)?"Yesterday":new Date(e).toLocaleDateString(n,{month:"short",day:"numeric",...new Date(e).getFullYear()===new Date(t).getFullYear()?{}:{year:"numeric"}})}const KE="scenario";function qE({chevron:e,status:t,icon:n}){return Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("span",{className:"flex h-3.5 w-3.5 shrink-0 items-center justify-center",children:void 0!==e&&Bn.jsx(by,{name:"open"===e?"chevronD":"chevronR",className:"h-3.5 w-3.5 text-fg-4"})}),Bn.jsx("span",{className:"flex h-3.5 w-3.5 shrink-0 items-center justify-center",children:void 0!==t?Bn.jsx(vN,{status:t}):void 0!==n&&Bn.jsx(by,{name:n,className:"h-3.5 w-3.5 text-fg-4"})})]})}const $E=w_(function(){const e=j_(),t=e.overview.failing;return 0===t.length?null:Bn.jsxs("div",{className:"mb-1 border-b border-edge-soft pb-1",children:[Bn.jsxs("div",{className:"flex items-center gap-1.5 px-3 pb-0.5 pt-2",children:[Bn.jsx("span",{className:"font-mono text-[10.5px] uppercase tracking-wider text-fail",children:"Failing now"}),Bn.jsxs("span",{className:"font-mono text-[10.5px] text-fg-4",children:["· ",t.length," ",1===t.length?"test":"tests"]})]}),t.map(t=>Bn.jsxs(DE,{depth:0,ariaLabel:`${t.ref} — failing, ${VE(t.failStreak)}, last run ${mN(t.lastAt)}`,onClick:()=>{e.runs.setScenarioFilter(t.ref)},children:[Bn.jsx(qE,{status:"failed"}),Bn.jsx("span",{className:"truncate font-mono text-[11px] text-fg-2",children:t.ref}),Bn.jsxs("span",{className:"ml-auto shrink-0 font-mono text-[10px] text-fg-4",children:[mN(t.lastAt)," · ",VE(t.failStreak)]})]},t.ref))]})});function VE(e){return 1===e?"red 1 run":`red ${e} runs`}function YE({runs:e}){const t=e.slice(0,20).slice().reverse();if(t.length<2)return null;const n=t.map(e=>e.durationMs??0),s=Math.max(...n,1),i=t.filter(e=>"failed"===e.status||"interrupted"===e.status).length;return Bn.jsxs("div",{className:"mx-2 mb-1 rounded border border-edge-soft px-2 py-1.5",children:[Bn.jsx("div",{className:"flex items-end gap-[2px]","aria-label":`Last ${t.length} runs: ${t.length-i} passed, ${i} failed`,role:"img",children:t.map(e=>Bn.jsx("span",{title:`${e.status} · ${gN(e.durationMs)}`,style:{height:`${Math.max(3,Math.round((e.durationMs??0)/s*18))}px`},className:_y("w-[5px] shrink-0 rounded-[1px]","passed"===e.status?"bg-pass":"failed"===e.status||"interrupted"===e.status?"bg-fail":"bg-fg-4")},e.runId))}),Bn.jsxs("div",{className:"mt-1 flex items-center justify-between font-mono text-[9.5px] text-fg-4",children:[Bn.jsxs("span",{children:["last ",t.length," · ",i," failed"]}),Bn.jsxs("span",{children:["up to ",gN(s)]})]})]})}const GE=w_(function({query:e}){var t;const n=j_(),[s,i]=bn.useState("all"),[r,o]=bn.useState(new Set),a=n.runs.scenarioFilter,l=bn.useRef(!1);bn.useEffect(()=>{const e=function(e){const t=new URLSearchParams(e).get(KE);return t&&""!==t.trim()?t:null}(window.location.search);e&&n.runs.setScenarioFilter(e),l.current=!0},[n]),bn.useEffect(()=>{l.current&&window.history.replaceState(null,"",function(e,t){const n=new URL(e,"http://localhost");return t?n.searchParams.set(KE,t):n.searchParams.delete(KE),`${n.pathname}${n.search}${n.hash}`}(`${window.location.pathname}${window.location.search}${window.location.hash}`,a))},[a]);const c=e=>{n.runs.setScenarioFilter(e)},h=n.workspace.hosted?(null==(t=n.workspace.file)?void 0:t.currentBundleId)??null:null,[u,d]=bn.useState(!1),f=bn.useMemo(()=>{const t=e.trim().toLowerCase();return n.runs.items.filter(e=>("failed"!==s||"failed"===e.status)&&(("passed"!==s||"passed"===e.status)&&((!u||null===h||e.bundleId===h)&&(!t||e.ref.toLowerCase().includes(t)))))},[n.runs.items,e,s,u,h]),p=bn.useMemo(()=>HE(f,{flat:null!==a}),[f,a]),v=e=>n.tabs.open("collection"===e.kind?{kind:"collection-run",runId:e.runId}:{kind:"scenario-run",runId:e.runId});return Bn.jsxs("div",{className:"py-1",children:[a?Bn.jsx(XE,{ref_:a,onClear:()=>c(null)}):Bn.jsx("div",{className:"mx-2 mb-1 grid grid-cols-3 overflow-hidden rounded border border-edge-soft",children:["all","failed","passed"].map(e=>Bn.jsx("button",{type:"button",onClick:()=>i(e),className:_y("py-1 font-mono text-[10.5px] uppercase tracking-wider",s===e?"bg-raised text-fg":"text-fg-3 hover:bg-raised/60"),children:"failed"===e?"failed runs":e},e))}),null!==h&&Bn.jsx("button",{type:"button",onClick:()=>d(e=>!e),"aria-pressed":u,title:`Show only runs of bundle ${h}, the one this environment is on now`,className:_y("mx-2 mb-1 w-[calc(100%-1rem)] rounded border px-2 py-1 font-mono text-[10.5px] uppercase tracking-wider",u?"border-edge bg-raised text-fg":"border-edge-soft text-fg-3 hover:bg-raised/60"),children:"this bundle only"}),a?Bn.jsx(YE,{runs:f}):Bn.jsx($E,{}),p.map(e=>Bn.jsxs("div",{children:[Bn.jsx("div",{className:"px-3 pb-0.5 pt-2 font-mono text-[10px] uppercase tracking-wider text-fg-4",children:e.label}),e.entries.map(e=>Bn.jsx(ZE,{entry:e,expanded:r.has(OE(e)),onToggle:()=>{return t=OE(e),o(e=>{const n=new Set(e);return n.delete(t)||n.add(t),n});var t},onOpen:v,onScenario:c,showRef:null===a},OE(e)))]},e.key)),0===f.length&&(n.runs.indexReady?Bn.jsx(yB,{children:"no runs match"}):Bn.jsx(yB,{children:"history is still loading…"})),n.runs.hasMore&&Bn.jsx("button",{type:"button",onClick:()=>{n.runs.loadMore()},disabled:n.runs.loadingMore,className:"mx-2 mt-1 w-[calc(100%-1rem)] rounded border border-edge-soft py-1 font-mono text-[10.5px] text-fg-3 hover:bg-raised/60 disabled:opacity-50",children:n.runs.loadingMore?"loading…":"load older runs"})]})});function XE({ref_:e,onClear:t}){return Bn.jsxs("div",{className:"mx-2 mb-1 flex items-center gap-1 rounded border border-accent/30 bg-accent/10 px-1.5 py-1",children:[Bn.jsx("span",{className:"shrink-0 font-mono text-[9.5px] uppercase tracking-wider text-fg-4",children:"test"}),Bn.jsx("span",{className:"truncate font-mono text-[11px] text-fg-2",children:e}),Bn.jsx("button",{type:"button","aria-label":"Clear test filter",onClick:t,className:"ml-auto shrink-0 rounded p-0.5 text-fg-3 hover:bg-raised/60 hover:text-fg",children:Bn.jsx(by,{name:"x",className:"h-3 w-3"})})]})}function ZE({entry:e,expanded:t,onToggle:n,onOpen:s,onScenario:i,showRef:r}){if("run"===e.kind)return Bn.jsx(JE,{run:e.run,showRef:r,onOpen:s,depth:0});const o="collection"===e.kind?e.run:e.runs[0],a="collection"===e.kind?e.run.ref:e.ref,l=function(e){switch(e.kind){case"collection":return e.children.length;case"repeats":return e.runs.length;case"run":return 1}}(e);return Bn.jsxs(Bn.Fragment,{children:[Bn.jsxs(DE,{depth:0,ariaLabel:"collection"===e.kind?`Collection ${a} — ${e.passed} passed, ${e.failed} failed, ${mN(o.startedAt)}`:`${a} — ${l} runs, ${mN(o.startedAt)}`,onClick:n,children:[Bn.jsx(qE,{chevron:t?"open":"closed",status:bN(o.status)}),Bn.jsx("span",{className:"truncate font-mono text-[11px] text-fg-2",onClick:t=>{t.stopPropagation(),"repeats"===e.kind&&i(a)},children:a}),"collection"===e.kind&&Bn.jsx(dN,{size:"xs",tone:"info",children:"col"}),Bn.jsx("span",{className:"ml-auto shrink-0 font-mono text-[10px] text-fg-4",children:"collection"===e.kind?`${e.passed} ✓${e.failed?` ${e.failed} ✗`:""}`:l}),Bn.jsx("span",{className:"shrink-0 font-mono text-[10px] text-fg-4",children:mN(o.startedAt)})]}),t&&("collection"===e.kind?Bn.jsxs(Bn.Fragment,{children:[Bn.jsxs(DE,{depth:1,ariaLabel:`Open collection run ${a}`,onClick:()=>s(e.run),children:[Bn.jsx(qE,{icon:"layers"}),Bn.jsx("span",{className:"truncate font-mono text-[10.5px] text-fg-3",children:"open collection run"})]}),e.children.map(e=>Bn.jsx(JE,{run:e,showRef:!0,onOpen:s,depth:1},e.runId))]}):e.runs.map(e=>Bn.jsx(JE,{run:e,showRef:!1,onOpen:s,depth:1},e.runId)))]})}function JE({run:e,showRef:t,onOpen:n,depth:s}){var i;const{workspace:r}=j_(),o=r.hosted&&void 0!==e.bundleId&&e.bundleId!==(null==(i=r.file)?void 0:i.currentBundleId)?e.bundleId:null;return Bn.jsxs(DE,{depth:s,ariaLabel:`${"collection"===e.kind?"Collection":"Run"} ${e.ref} — ${e.status}, ${mN(e.startedAt)}`,onClick:()=>n(e),children:[Bn.jsx(qE,{status:bN(e.status)}),t?Bn.jsx("span",{className:"truncate font-mono text-[11px] text-fg-3",children:e.ref}):Bn.jsx("span",{className:"truncate font-mono text-[11px] text-fg-3",children:mN(e.startedAt)}),t&&Bn.jsx("span",{className:"shrink-0 font-mono text-[10px] text-fg-4",children:mN(e.startedAt)}),o&&Bn.jsx("span",{className:"shrink-0 font-mono text-[10px] text-fg-4",title:`Ran on another test bundle (${o}), not the one this environment is on now`,children:"other bundle"}),null!=e.durationMs&&Bn.jsx("span",{className:"ml-auto shrink-0 font-mono text-[10.5px] text-fg-4",children:gN(e.durationMs)})]})}function QE(e){const t=e.lastIndexOf("/");return t<0?e:e.slice(t+1)}function eP(e){const t=e.lastIndexOf("/");return t<0?"":e.slice(0,t)}function tP(e){return e.endsWith(".js")?e.slice(0,-3):e}function nP({title:e,message:t,confirmLabel:n="Delete",cancelLabel:s="Cancel",danger:i=!0,onConfirm:r,onCancel:o}){const a=bn.useRef(null);return bn.useEffect(()=>{var e;null==(e=a.current)||e.focus();const t=e=>{"Escape"===e.key&&o()};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[o]),Bn.jsx("div",{className:"fixed inset-0 z-50 grid place-items-center bg-black/30 backdrop-blur-[1px]",onMouseDown:o,children:Bn.jsxs("div",{role:"dialog","aria-modal":"true",onMouseDown:e=>e.stopPropagation(),className:_y("w-[min(380px,calc(100vw-2rem))] rounded-lg p-4","border border-edge-soft bg-overlay shadow-xl"),children:[Bn.jsx("div",{className:"text-[13px] font-medium text-fg",children:e}),Bn.jsx("div",{className:"mt-1.5 text-[12px] leading-relaxed text-fg-2",children:t}),Bn.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[Bn.jsx("button",{type:"button",onClick:o,className:"h-7 rounded border border-edge-soft bg-canvas px-3 font-mono text-[11.5px] text-fg-2 hover:bg-raised",children:s}),Bn.jsx("button",{ref:a,type:"button",onClick:r,className:_y("h-7 rounded px-3 font-mono text-[11.5px] font-medium text-on-accent",i?"bg-fail hover:bg-fail/80":"bg-accent hover:bg-accent-hover"),children:n})]})]})})}function sP(e,{validate:t,onCommit:n,onCancel:s}){const[i,r]=bn.useState(e),o=bn.useRef(null),a=bn.useRef(!1);bn.useEffect(()=>{var e,t;null==(e=o.current)||e.focus(),null==(t=o.current)||t.select()},[]);const l=i.trim(),c=l?(null==t?void 0:t(l))??null:null,h=l.length>0&&!c,u=()=>{a.current||(a.current=!0,h?n(l):s())};return{err:c,ringClass:c?"ring-1 ring-fail":"ring-1 ring-accent",onSubmit:e=>{e.preventDefault(),u()},inputProps:{ref:o,value:i,onChange:e=>r(e.target.value),onKeyDown:e=>{"Escape"===e.key&&(e.preventDefault(),a.current||(a.current=!0,s()))},onBlur:u,spellCheck:!1,autoComplete:"off"}}}const iP=w_(function({query:e}){var t;const n=j_(),s=n.scenarios,i=n.session.capabilities.canEditFiles,r=s.buildTree(e),o=0===r.folders.length&&0===r.scenarios.length&&null===s.creating;return Bn.jsxs("div",{className:"min-h-full py-1",onContextMenu:e=>{e.preventDefault(),s.openMenu(e.clientX,e.clientY,{kind:"blank"})},onKeyDown:e=>function(e,t,n){if("INPUT"===e.target.tagName)return;const s=t.selected,i=e.metaKey||e.ctrlKey,r=!!s&&"blank"!==s.kind;"F2"===e.key&&r&&n?(e.preventDefault(),t.startRename(s)):i&&("c"===e.key||"C"===e.key)&&r?(e.preventDefault(),t.copy(s)):i&&("v"===e.key||"V"===e.key)&&n&&(e.preventDefault(),t.paste(hP(s)))}(e,s,i),children:[s.actionError&&Bn.jsx("button",{type:"button",onClick:()=>s.clearActionError(),className:"mx-2 my-1 block w-[calc(100%-1rem)] truncate rounded border border-fail/30 bg-fail/10 px-2 py-1 text-left font-mono text-[11px] text-fail",children:s.actionError}),""===(null==(t=s.creating)?void 0:t.parent)&&Bn.jsx(cP,{store:s,depth:0,kind:s.creating.kind}),r.folders.map(e=>Bn.jsx(rP,{node:e,depth:0},e.rel)),r.scenarios.map(e=>Bn.jsx(oP,{s:e,depth:0},e.path)),o&&Bn.jsx(yB,{children:"no scenarios match"}),s.menu&&Bn.jsx(zy,{x:s.menu.x,y:s.menu.y,items:uP(s,n.schedules,s.menu.target,i),onClose:()=>s.closeMenu()}),s.pendingDelete&&"blank"!==s.pendingDelete.kind&&Bn.jsx(nP,{title:"folder"===s.pendingDelete.kind?`Delete folder "${QE(s.pendingDelete.rel)}"?`:`Delete "${tP(QE(s.pendingDelete.rel))}"?`,message:"folder"===s.pendingDelete.kind?"This permanently deletes the folder and everything inside it.":"This permanently deletes the scenario file.",onConfirm:()=>{s.confirmDelete()},onCancel:()=>s.cancelDelete()})]})}),rP=w_(function e({node:t,depth:n}){var s,i;const r=j_().scenarios,o=r.isExpanded(t.rel);if("folder"===(null==(s=r.renaming)?void 0:s.kind)&&r.renaming.rel===t.rel)return Bn.jsx(aP,{depth:n,initial:t.name,open:o,onCommit:e=>{r.commitRename(e)},onCancel:()=>r.cancelRename()});return Bn.jsxs("div",{children:[Bn.jsxs("button",{type:"button",onClick:()=>{r.select({kind:"folder",rel:t.rel}),r.toggle(t.rel)},onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),r.openMenu(e.clientX,e.clientY,{kind:"folder",rel:t.rel})},style:ME(n),className:"flex h-7 w-full items-center gap-2 pr-2 text-left text-fg-2 hover:text-fg",children:[Bn.jsx(by,{name:o?"chevronD":"chevronR",className:"h-3.5 w-3.5 shrink-0 text-fg-4"}),Bn.jsx(by,{name:"folder",className:"h-3.5 w-3.5 shrink-0 text-fg-4"}),Bn.jsx("span",{className:"truncate font-mono text-[12.5px]",children:t.name}),Bn.jsx("span",{className:"ml-auto shrink-0 font-mono text-[10.5px] text-fg-4",children:t.scenarios.length})]}),o&&Bn.jsxs(Bn.Fragment,{children:[(null==(i=r.creating)?void 0:i.parent)===t.rel&&Bn.jsx(cP,{store:r,depth:n+1,kind:r.creating.kind}),t.folders.map(t=>Bn.jsx(e,{node:t,depth:n+1},t.rel)),t.scenarios.map(e=>Bn.jsx(oP,{s:e,depth:n+1},e.path))]})]})}),oP=w_(function({s:e,depth:t}){var n;const s=j_(),i=s.scenarios,r=s.runs.lastRunByRef("scenario",e.name),o=s.schedules.get("scenario",e.name),a=`${e.name}.js`,l={kind:"scenario",rel:a},c=s.tabs.activeTab,h="scenario"===(null==c?void 0:c.kind)&&c.path===e.path;return"scenario"===(null==(n=i.renaming)?void 0:n.kind)&&i.renaming.rel===a?Bn.jsx(lP,{depth:t,initial:QE(e.name),onCommit:e=>{i.commitRename(e)},onCancel:()=>i.cancelRename()}):Bn.jsx(DE,{depth:t,leaf:!0,active:h,onClick:()=>{i.select(l),s.tabs.open({kind:"scenario",path:e.path})},onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),i.openMenu(e.clientX,e.clientY,l)},children:Bn.jsxs("span",{className:"flex min-w-0 items-center gap-[5px]",children:[Bn.jsx("span",{className:"grid h-3.5 w-3.5 shrink-0 place-items-center",children:Bn.jsx(vN,{status:_N((null==r?void 0:r.status)??null,e.expectFail)})}),Bn.jsx("span",{className:"truncate font-mono text-[12.5px] text-fg-2",children:QE(e.name)}),o&&Bn.jsx("span",{title:JN(o),children:Bn.jsx(by,{name:"clock",className:"h-3 w-3 shrink-0 text-fg-4"})})]})})});function aP({depth:e,initial:t,open:n=!0,onCommit:s,onCancel:i}){const{ringClass:r,onSubmit:o,inputProps:a}=sP(t,{validate:cy,onCommit:s,onCancel:i});return Bn.jsxs("form",{onSubmit:o,style:ME(e),className:"flex h-7 w-full items-center gap-2 pr-2",children:[Bn.jsx(by,{name:n?"chevronD":"chevronR",className:"h-3.5 w-3.5 shrink-0 text-fg-4"}),Bn.jsx(by,{name:"folder",className:"h-3.5 w-3.5 shrink-0 text-fg-4"}),Bn.jsx("input",{...a,className:_y("min-w-0 flex-1 rounded-sm bg-canvas px-1 font-mono text-[12.5px] text-fg outline-none",r)})]})}function lP({depth:e,initial:t,onCommit:n,onCancel:s}){const{ringClass:i,onSubmit:r,inputProps:o}=sP(t,{validate:cy,onCommit:n,onCancel:s});return Bn.jsx("form",{onSubmit:r,style:BE(e),className:"flex w-full items-center py-1 pr-2",children:Bn.jsx("input",{...o,placeholder:"scenario-name",className:_y("min-w-0 flex-1 rounded-sm bg-canvas px-1 font-mono text-[12.5px] leading-[1.5] text-fg outline-none",i)})})}function cP({store:e,depth:t,kind:n}){const s=t=>{e.commitCreate(t)},i=()=>e.cancelCreate();return"folder"===n?Bn.jsx(aP,{depth:t,initial:"",onCommit:s,onCancel:i}):Bn.jsx(lP,{depth:t,initial:"",onCommit:s,onCancel:i})}function hP(e){return e?"folder"===e.kind?e.rel:"scenario"===e.kind?eP(e.rel):"":""}function uP(e,t,n,s){const i=e.clipboard,r=i?"folder"===i.kind?`Paste folder "${i.label}"`:`Paste "${i.label}"`:"Paste",o=hP(n),a={kind:"item",icon:"file",label:"New scenario",disabled:!s,onSelect:()=>e.startCreate(o,"scenario")},l={kind:"item",icon:"folderPlus",label:"New folder",disabled:!s,onSelect:()=>e.startCreate(o,"folder")},c={kind:"item",icon:"clipboard",label:r,disabled:!i||!s,onSelect:()=>{e.paste(o)}};if("blank"===n.kind)return[a,l,c];return[{kind:"header",label:"folder"===n.kind?QE(n.rel):tP(QE(n.rel))},a,l,{kind:"item",icon:"copy",label:"Copy",onSelect:()=>e.copy(n)},{kind:"item",icon:"externalL",label:"Copy link",onSelect:()=>e.copyPath(n)},c,{kind:"item",icon:"edit",label:"Rename",shortcut:"F2",disabled:!s,onSelect:()=>e.startRename(n)},...dP(t,n,s),{kind:"separator"},{kind:"item",icon:"trash",label:"Delete",tone:"danger",disabled:!s,onSelect:()=>e.requestDelete(n)}]}function dP(e,t,n){if("scenario"!==t.kind)return[];const s=tP(t.rel),i=e.get("scenario",s);return[{kind:"item",icon:"clock",label:i?`Schedule · ${zb(i.cron)}`:"Schedule…",disabled:!n,onSelect:()=>e.openEditor({kind:"scenario",name:s})}]}const fP=w_(function({query:e}){const t=j_(),[n,s]=bn.useState(!1),[i,r]=bn.useState(null),o=bn.useRef(null),a=t.session.capabilities.canEditFiles,l=e.trim().toLowerCase(),c=t.snapshots.list.filter(e=>!l||e.manifest.scenario.toLowerCase().includes(l)),h=e=>{e&&a&&t.snapshots.importFile(e).then(e=>t.tabs.open({kind:"snapshot",snapshotId:e})).catch(e=>window.alert(`Import failed: ${(null==e?void 0:e.message)??e}`))};return Bn.jsxs("div",{onDragOver:e=>{e.preventDefault(),s(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||s(!1)},onDrop:e=>{e.preventDefault(),s(!1),h(e.dataTransfer.files[0])},className:_y("relative flex min-h-full flex-col py-1",n&&"bg-accent/10 ring-2 ring-inset ring-accent/60"),children:[Bn.jsx("input",{ref:o,type:"file",accept:".zip,.unotest.zip",className:"hidden",onChange:e=>{var t;h(null==(t=e.target.files)?void 0:t[0]),e.target.value=""}}),Bn.jsx("div",{className:"px-2 pb-2",children:Bn.jsx(sD,{icon:"camera",tooltip:"Open a teammate's .unotest.zip snapshot",onClick:()=>{var e;return null==(e=o.current)?void 0:e.click()},className:"w-full justify-center",children:"Open .unotest.zip"})}),0===c.length?Bn.jsx(yB,{children:"no snapshots — open or drop a .unotest.zip"}):c.map(e=>{return Bn.jsxs(DE,{active:t.tabs.activeKey===`snapshot:${e.snapshotId}`,onClick:()=>t.tabs.open({kind:"snapshot",snapshotId:e.snapshotId}),onContextMenu:t=>{t.preventDefault(),r({x:t.clientX,y:t.clientY,id:e.snapshotId,label:e.manifest.scenario})},children:[Bn.jsx(vN,{status:(n=e.manifest.status,"interrupted"===n?"aborted":n)}),Bn.jsxs("span",{className:"min-w-0 flex-1",children:[Bn.jsx("span",{className:"block truncate font-mono text-[12px] text-fg-2",children:e.manifest.scenario}),Bn.jsxs("span",{className:"block truncate font-mono text-[10px] text-fg-4",children:[e.manifest.capturedAt.slice(0,16).replace("T"," "),e.manifest.git.author&&` · ${e.manifest.git.author}`]})]})]},e.snapshotId);var n}),n&&Bn.jsx("div",{className:"pointer-events-none absolute inset-0 grid place-items-center",children:Bn.jsxs("div",{className:"flex flex-col items-center gap-1 text-accent",children:[Bn.jsx(by,{name:"camera",className:"h-5 w-5"}),Bn.jsx("span",{className:"font-mono text-[11px]",children:"Drop to open snapshot"})]})}),i&&Bn.jsx(zy,{x:i.x,y:i.y,onClose:()=>r(null),items:(u=i.label,d=()=>{return e=i.id,n=i.label,void(a&&window.confirm(`Delete snapshot "${n}"?`)&&(t.tabs.close(`snapshot:${e}`),t.snapshots.remove(e).catch(e=>window.alert(`Delete failed: ${(null==e?void 0:e.message)??e}`))));var e,n},[{kind:"header",label:u},{kind:"item",icon:"trash",label:"Delete snapshot",tone:"danger",onSelect:d}])})]});var u,d});const pP={secret:{label:"Secrets",file:".secrets",badge:!0},app:{label:"App variables",file:".env"},runner:{label:"Runner config",file:".env"}},vP=["app","secret","runner"];function gP({on:e,onChange:t,title:n}){return Bn.jsx("button",{type:"button",role:"switch","aria-checked":e,onClick:t,title:n,className:_y("relative inline-flex h-[18px] w-[30px] shrink-0 items-center rounded-full",e?"bg-accent":"bg-raised"),children:Bn.jsx("span",{className:_y("inline-block h-[14px] w-[14px] rounded-full bg-on-accent shadow-sm transition-transform duration-150",e?"translate-x-[14px]":"translate-x-[2px]")})})}const mP=w_(function({query:e}){const t=j_().variables;bn.useEffect(()=>{t.load()},[t]);const n=t.filtered(e),s=e.trim().length>0,[i,r]=bn.useState({secret:!1,app:!1,runner:!0}),[o,a]=bn.useState(null),l=t.edits.size+t.activated.size;return Bn.jsxs("div",{className:"flex h-full flex-col",children:[Bn.jsx(_P,{}),t.dirty&&Bn.jsxs("div",{className:"flex items-center gap-2 border-b border-accent/30 bg-accent/10 px-3 py-1.5",children:[Bn.jsxs("span",{className:"font-mono text-[11px] text-accent",children:[l," change",1===l?"":"s"]}),Bn.jsx("button",{type:"button",disabled:t.saving,onClick:()=>{t.save()},className:"ml-auto rounded bg-accent px-2 py-0.5 font-mono text-[11px] text-on-accent hover:bg-accent-hover disabled:opacity-50",children:t.saving?"Saving…":"Save"}),Bn.jsx("button",{type:"button",disabled:t.saving,onClick:()=>{t.load()},className:"rounded px-2 py-0.5 font-mono text-[11px] text-fg-3 hover:bg-raised",children:"Discard"})]}),t.error&&Bn.jsx("div",{className:"border-b border-fail/30 bg-fail/10 px-3 py-1.5 font-mono text-[11px] text-fail",children:t.error}),t.warnings.length>0&&Bn.jsxs("div",{className:"flex items-start gap-2 border-b border-warn/30 bg-warn/10 px-3 py-1.5",children:[Bn.jsx("div",{className:"flex-1 space-y-0.5 font-mono text-[11px] text-warn",children:t.warnings.map((e,t)=>Bn.jsxs("div",{children:["⚠ ",e]},t))}),Bn.jsx("button",{type:"button",title:"Dismiss",onClick:()=>t.dismissWarnings(),className:"grid h-4 w-4 shrink-0 place-items-center rounded text-warn hover:bg-warn/20",children:Bn.jsx(by,{name:"x",className:"h-3 w-3"})})]}),Bn.jsxs("div",{className:"flex-1 overflow-y-auto py-1",children:[vP.map(e=>{const t=n.filter(t=>t.category===e),l=pP[e],c=o===e;if(0===t.length&&!c&&!s)return Bn.jsxs("button",{type:"button",onClick:()=>a(e),className:"flex h-7 w-full items-center gap-1 px-2 font-mono text-[11px] text-fg-4 hover:text-fg-2",children:[Bn.jsx(by,{name:"plus",className:"h-3.5 w-3.5"}),"Add ",l.label.toLowerCase()]},e);const h=i[e]&&!s;return Bn.jsxs("div",{className:"mb-1",children:[Bn.jsxs("div",{className:"group/header flex h-7 w-full items-center gap-1 px-2 text-fg-4",children:[Bn.jsxs("button",{type:"button",onClick:()=>r(t=>({...t,[e]:!t[e]})),className:"flex flex-1 items-center gap-1 truncate hover:text-fg-2",children:[Bn.jsx(by,{name:h?"chevronR":"chevronD",className:"h-3.5 w-3.5 shrink-0 text-fg-4"}),Bn.jsx("span",{className:"font-mono text-[11px] uppercase tracking-wider",children:l.label}),l.badge&&Bn.jsx("span",{className:"rounded bg-warn/15 px-1 font-mono text-[9px] uppercase tracking-wide text-warn",children:"secret"}),Bn.jsx("span",{className:"font-mono text-[10px] text-fg-4",children:l.file})]}),Bn.jsx("button",{type:"button",title:`Add ${l.label.toLowerCase()}`,onClick:()=>{a(e),r(t=>({...t,[e]:!1}))},className:"grid h-5 w-5 place-items-center rounded text-fg-4 opacity-0 hover:bg-raised hover:text-fg group-hover/header:opacity-100",children:Bn.jsx(by,{name:"plus",className:"h-3.5 w-3.5"})}),Bn.jsx("span",{className:"font-mono text-[10.5px] text-fg-4",children:t.length})]}),!h&&Bn.jsxs(Bn.Fragment,{children:[c&&Bn.jsx(xP,{category:e,onClose:()=>a(null)}),t.map(e=>Bn.jsx(bP,{v:e},`${e.source} ${e.key}`))]})]},e)}),0===n.length&&s&&Bn.jsx(yB,{children:"no variables match"})]})]})}),_P=w_(function(){const e=j_(),{environments:t,variables:n}=e;if(!t.hasAny)return null;const s=n.dirty,i=[{label:"base",value:null},...t.names.map(e=>({label:e,value:e}))];return Bn.jsxs("div",{className:"flex flex-wrap items-center gap-1 border-b border-edge-soft px-3 py-1.5",title:s?"Save or discard changes before switching environments":void 0,children:[Bn.jsx("span",{className:"mr-1 font-mono text-[10px] uppercase tracking-wider text-fg-4",children:"env"}),i.map(e=>{const n=t.active===e.value;return Bn.jsx("button",{type:"button",disabled:s&&!n,onClick:()=>{t.setActive(e.value)},className:_y("rounded px-1.5 py-0.5 font-mono text-[11px] transition-colors",n?"bg-accent text-on-accent":"text-fg-3 hover:bg-raised hover:text-fg",s&&!n&&"opacity-40 hover:bg-transparent"),children:e.label},e.label)})]})}),xP=w_(function({category:e,onClose:t}){const n=j_().variables,s=bn.useMemo(()=>new Set(n.rows.map(e=>e.key)),[n.rows]),i=bn.useMemo(()=>[...uy].filter(e=>!s.has(e)).sort(),[s]),[r,o]=bn.useState("runner"===e?i[0]??"":""),[a,l]=bn.useState(""),c=r.trim().length>0&&!n.saving,h=async()=>{if(!c)return;await n.addVariable(r.trim(),a,e)&&t()};return Bn.jsxs("div",{className:"mx-3 mb-1 flex flex-col gap-1 rounded border border-accent/30 bg-accent/10 p-2",children:["runner"===e?Bn.jsxs("select",{value:r,onChange:e=>o(e.target.value),className:"h-6 rounded border border-edge-soft bg-canvas px-1 font-mono text-[11.5px] text-fg",children:[0===i.length&&Bn.jsx("option",{value:"",children:"all runner keys set"}),i.map(e=>Bn.jsx("option",{value:e,children:e},e))]}):Bn.jsx("input",{type:"text",value:r,autoFocus:!0,spellCheck:!1,placeholder:"NAME (UPPER_SNAKE)",onChange:e=>o(e.target.value.toUpperCase()),onKeyDown:e=>"Enter"===e.key&&void h(),className:"h-6 rounded border border-edge-soft bg-canvas px-1.5 font-mono text-[11.5px] text-fg placeholder:text-fg-4"}),Bn.jsxs("div",{className:"flex items-center gap-1",children:[Bn.jsx("input",{type:"secret"===e?"password":"text",value:a,spellCheck:!1,placeholder:"value",onChange:e=>l(e.target.value),onKeyDown:e=>"Enter"===e.key&&void h(),className:"h-6 flex-1 rounded border border-edge-soft bg-canvas px-1.5 font-mono text-[11.5px] text-fg placeholder:text-fg-4"}),Bn.jsx("button",{type:"button",disabled:!c,onClick:()=>{h()},className:"rounded bg-accent px-2 py-0.5 font-mono text-[11px] text-on-accent hover:bg-accent-hover disabled:opacity-50",children:"Add"}),Bn.jsx("button",{type:"button",onClick:t,className:"rounded px-1.5 py-0.5 font-mono text-[11px] text-fg-3 hover:bg-raised",children:"Cancel"})]})]})}),bP=w_(function({v:e}){const t=j_().variables,n=e.commented&&!t.isActivated(e),s="1"===t.effectiveValue(e),i=e.secret&&!t.isRevealed(e),r=t.isEdited(e)||t.isActivated(e);return Bn.jsxs("div",{className:_y("group/row flex h-[44px] flex-col justify-center gap-0.5 px-3",n&&"opacity-45 hover:opacity-70 dark:opacity-70 dark:hover:opacity-100"),children:[Bn.jsxs("div",{className:"flex items-center gap-1 truncate font-mono text-[11.5px]",children:[n&&Bn.jsx("span",{className:"text-fg-4",children:"#"}),Bn.jsx("span",{className:_y("truncate",n?"text-fg-3":"text-fg-2"),title:e.key,children:e.key}),e.shared&&Bn.jsx("span",{className:"shrink-0 rounded bg-raised px-1 font-mono text-[9px] uppercase tracking-wide text-fg-3",title:"from the shared base file — value applies to every target",children:"shared"}),e.envOverlay&&Bn.jsx("span",{className:"shrink-0 rounded bg-accent/15 px-1 font-mono text-[9px] uppercase tracking-wide text-accent",title:`from the .${"secrets"===e.source?"secrets":"env"}.${e.envOverlay} overlay — value applies in this environment only`,children:e.envOverlay}),e.boxInjected&&Bn.jsx("span",{className:"shrink-0 rounded bg-raised px-1 font-mono text-[9px] uppercase tracking-wide text-fg-3",title:e.secret?"a secret the box holds for this environment — set with `unotest-web env set --secret` or on the admin page; the value never leaves the box":"set by the box for every run in this environment (its config, or `unotest-web env push`) — read-only here",children:"box"}),r&&Bn.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-accent",title:"edited"}),!e.boxInjected&&Bn.jsx("button",{type:"button",title:"Delete variable",onClick:()=>{t.deleteVariable(e)},className:"ml-auto grid h-5 w-5 shrink-0 place-items-center rounded text-fg-4 opacity-0 hover:bg-fail/10 hover:text-fail group-hover/row:opacity-100",children:Bn.jsx(by,{name:"trash",className:"h-3.5 w-3.5"})})]}),Bn.jsx("div",{className:"flex h-6 items-center gap-1",children:e.boxInjected?Bn.jsx("span",{className:"w-full truncate rounded px-1.5 font-mono text-[11.5px] leading-6 text-fg-3",title:e.secret?"value held by the box":e.value,children:e.secret?"••••••••••":e.value||Bn.jsx("span",{className:"text-fg-4",children:"empty"})}):n?Bn.jsx("button",{type:"button",onClick:()=>t.activate(e),title:"commented out — click to enable & edit",className:"w-full cursor-text truncate rounded px-1.5 text-left font-mono text-[11.5px] leading-6 text-fg-3 line-through decoration-fg-4 hover:bg-raised/60 hover:no-underline",children:e.secret?"••••••••••":e.value||" "}):e.bool?Bn.jsxs(Bn.Fragment,{children:[Bn.jsx(gP,{on:s,onChange:()=>t.toggleBool(e),title:s?"On (1) — click to set 0":"Off (0) — click to set 1"}),Bn.jsx("span",{className:_y("font-mono text-[11px] tabular-nums",s?"text-accent":"text-fg-4"),children:s?"1":"0"})]}):Bn.jsxs(Bn.Fragment,{children:[Bn.jsx("input",{type:i?"password":"text",value:t.effectiveValue(e),spellCheck:!1,autoFocus:t.isActivated(e),placeholder:"empty",onChange:n=>t.setValue(e,n.target.value),className:"h-6 w-full rounded border border-edge-soft bg-canvas px-1.5 font-mono text-[11.5px] text-fg placeholder:text-fg-4 focus:border-accent focus:outline-none focus:ring-2 focus:ring-accent/20"}),e.secret&&Bn.jsx("button",{type:"button",title:i?"Reveal":"Hide",onClick:()=>t.toggleReveal(e),className:"grid h-6 w-6 shrink-0 place-items-center rounded text-fg-4 hover:bg-raised hover:text-fg-2",children:Bn.jsx(by,{name:i?"eye":"eyeOff",className:"h-3.5 w-3.5"})})]})})]})}),yP={scenarios:[{keys:["↑","↓"],label:"navigate"},{keys:["↵"],label:"open"},{keys:["R"],label:"run"}],helpers:[{keys:["↑","↓"],label:"navigate"},{keys:["↵"],label:"open"}],collections:[{keys:["↑","↓"],label:"navigate"},{keys:["↵"],label:"open"},{keys:["N"],label:"new collection"}],runs:[{keys:["↑","↓"],label:"navigate"},{keys:["↵"],label:"inspect"}],active:[{keys:["↵"],label:"attach"},{keys:["⌃C"],label:"abort"}],variables:[{keys:["↵"],label:"save"},{keys:["⌥"],label:"reveal secret"}],app:[{keys:["⌘K"],label:"filter log"}],snapshots:[{keys:["↵"],label:"open"},{keys:["O"],label:"open .zip"}]};function wP({section:e}){return Bn.jsx("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 border-t border-edge-soft px-3 py-1.5 opacity-0 transition-opacity group-hover/pane:opacity-100",children:yP[e].map((e,t)=>Bn.jsxs("span",{className:"flex items-center gap-1",children:[e.keys.map(e=>Bn.jsx(SE,{children:e},e)),Bn.jsx("span",{className:"font-mono text-[10px] text-fg-4",children:e.label})]},t))})}const SP={scenarios:"Filter scenarios…",helpers:"Filter helpers…",collections:"Filter collections…",runs:"Filter runs…",active:"Filter active runs…",variables:"Filter variables…",app:"Filter app log…",snapshots:"Filter snapshots…"},kP={scenarios:"scenarios",helpers:"helpers",collections:"collections",runs:"history",active:"active",variables:"variables",app:"app under test",snapshots:"snapshots"},CP=w_(function(){const e=j_(),t=e.layout,n=e.activityBar.section,[s,i]=bn.useState(""),[r,o]=bn.useState(!1),a=bn.useRef(null),l=e.session.canSwitchEnvironment,c=e.targets.projectRoot,h=c.split("/").filter(Boolean).pop()??"",u=Ry({value:t.treeWidth,onChange:t.setTreeWidth,axis:"x",dir:1,min:t.treeMin,max:()=>Math.round(.5*window.innerWidth)});return bn.useEffect(()=>{const e=e=>{var t;(e.metaKey||e.ctrlKey)&&"k"===e.key.toLowerCase()&&(e.preventDefault(),null==(t=a.current)||t.focus())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]),Bn.jsxs("aside",{className:"group/pane relative flex shrink-0",style:{width:t.treeWidth},children:[Bn.jsx(Ty,{axis:"x",onPointerDown:u,className:"-right-[6px]"}),Bn.jsxs("div",{className:"uno-island flex min-w-0 flex-1 flex-col",children:[Bn.jsxs("div",{className:"flex h-[33px] items-center gap-2 border-b border-edge-soft px-3",children:[Bn.jsx(by,{name:"folder",className:"h-3.5 w-3.5 shrink-0 text-fg-4"}),l?Bn.jsx(CE,{}):Bn.jsxs("span",{className:"group relative flex min-w-0 flex-1",children:[Bn.jsx("span",{className:"truncate font-mono text-[11.5px] text-fg-3",children:h||"loading…"}),c&&Bn.jsx(IN,{label:c,placement:"bottom-start"})]}),Bn.jsx("button",{type:"button",disabled:r,className:_y("ml-auto grid h-6 w-6 shrink-0 place-items-center rounded text-fg-4 opacity-0 transition-opacity hover:bg-raised hover:text-fg-2 focus-visible:opacity-100 disabled:hover:bg-transparent group-hover/pane:opacity-100",r&&"opacity-100"),title:"Refresh",onClick:()=>{(async()=>{if(!r){o(!0);try{await Promise.all([e.scenarios.load(),e.helpers.load(),e.collections.load(),e.runs.load(),new Promise(e=>setTimeout(e,500))])}finally{o(!1)}}})()},children:Bn.jsx(by,{name:"refresh",className:_y("h-3.5 w-3.5",r&&"animate-spin")})})]}),Bn.jsxs("div",{className:"flex h-7 items-center gap-2 px-3 pt-1",children:[Bn.jsx("span",{className:"font-mono text-[10px] uppercase tracking-wider text-fg-4",children:kP[n]}),"scenarios"===n&&e.session.capabilities.canRun&&Bn.jsxs("button",{type:"button",title:"New test — open a live authoring session (you + the agent co-author)",onClick:()=>{const t=window.prompt("New test to author live (feature/name, e.g. auth/login):"),n=null==t?void 0:t.trim();n&&e.activeRuns.startAuthoring(n).then(t=>{e.tabs.open({kind:"scenario-run",runId:t.runId})})},className:"ml-auto flex h-5 items-center gap-1 rounded px-1.5 font-mono text-[10px] text-fg-3 opacity-0 transition-opacity hover:bg-raised hover:text-fg focus-visible:opacity-100 group-hover/pane:opacity-100",children:[Bn.jsx(by,{name:"plus",className:"h-3 w-3"})," author"]})]}),Bn.jsx("div",{className:"px-2 pb-2",children:Bn.jsxs("label",{className:"flex h-7 items-center gap-1.5 rounded border border-edge-soft bg-canvas px-2 focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/20",children:[Bn.jsx(by,{name:"search",className:"h-3.5 w-3.5 text-fg-4"}),Bn.jsx("input",{ref:a,value:s,onChange:e=>i(e.target.value),placeholder:SP[n],className:"h-full w-full bg-transparent text-[12.5px] text-fg placeholder:text-fg-4 focus:outline-none"}),Bn.jsx(SE,{children:"⌘K"})]})}),Bn.jsxs("div",{className:"flex-1 overflow-y-auto",children:["scenarios"===n&&Bn.jsx(iP,{query:s}),"helpers"===n&&Bn.jsx(IE,{query:s}),"collections"===n&&Bn.jsx(zE,{query:s}),"runs"===n&&Bn.jsx(GE,{query:s}),"active"===n&&Bn.jsx(LE,{query:s}),"variables"===n&&Bn.jsx(mP,{query:s}),"app"===n&&Bn.jsx(RE,{query:s}),"snapshots"===n&&Bn.jsx(fP,{query:s})]}),Bn.jsx(wP,{section:n})]})]})}),jP=w_(function(){const e=j_();return bn.useEffect(()=>{const t=t=>{if(t.ctrlKey&&!t.metaKey&&!t.altKey&&("`"===t.key||"Backquote"===t.code))return t.preventDefault(),void(e.session.capabilities.canTerminal&&e.terminal.toggle());if(!t.metaKey&&!t.ctrlKey)return;const n={1:"scenarios",2:"helpers",3:"collections",4:"runs",5:"active",6:"variables",7:"app",8:"snapshots"}[t.key];if(n)return t.preventDefault(),e.activityBar.setSection(n),void e.layout.openTree();"w"===t.key.toLowerCase()&&(t.preventDefault(),e.tabs.close(e.tabs.activeKey))};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e]),Bn.jsxs("div",{className:"flex h-full flex-col bg-shell pb-[3px] text-fg",children:[Bn.jsxs("div",{className:"flex min-h-0 flex-1",children:[Bn.jsx(iE,{}),Bn.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5 p-1.5 pb-[3px] pl-0",children:[Bn.jsxs("div",{className:"flex min-h-0 flex-1 gap-1.5",children:[e.layout.treeOpen&&Bn.jsx(CP,{}),Bn.jsxs("main",{className:"uno-island flex min-w-0 flex-1 flex-col",children:[Bn.jsx(xE,{}),Bn.jsx(GL,{}),Bn.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:Bn.jsx(VL,{})})]})]}),Bn.jsx(cN,{})]})]}),Bn.jsx(uE,{}),Bn.jsx(ky,{})]})});class NP{constructor(e){this.rest=e,this.status={available:!1,state:"stopped",log:[]},this.error=null,this.busy=!1,this.pollTimer=null,$r(this,{},{autoBind:!0})}async load(){try{const e=await this.rest.appServerStatus();pr(()=>{this.status=e,this.error=null}),this.syncPolling()}catch(e){pr(()=>{this.error=e instanceof Error?e.message:String(e)})}}async start(){await this.act(()=>this.rest.appServerStart())}async stop(){await this.act(()=>this.rest.appServerStop())}browse(e,t){return this.rest.fsBrowse(e,t)}async act(e){this.busy=!0,this.error=null;try{const t=await e();pr(()=>{this.status=t}),this.syncPolling()}catch(t){pr(()=>{this.error=t instanceof Error?t.message:String(t)})}finally{pr(()=>{this.busy=!1})}}syncPolling(){const e="starting"===this.status.state;e&&null===this.pollTimer?this.pollTimer=setInterval(()=>{this.load()},1e3):e||null===this.pollTimer||(clearInterval(this.pollTimer),this.pollTimer=null)}destroy(){null!==this.pollTimer&&clearInterval(this.pollTimer),this.pollTimer=null}}class MP{constructor(e,t={}){this.rest=e,this.byScenario=new Map,this.saveTimer=null,this.saveDebounceMs=t.saveDebounceMs??200,$r(this,{},{autoBind:!0})}async load(){let e;try{e=await this.rest.getBreakpoints()}catch{e={version:1,scenarios:{}}}pr(()=>{this.byScenario.clear();for(const[t,n]of Object.entries(e.scenarios))this.byScenario.set(t,new Set(n.map(BP)))})}get(e){return this.byScenario.get(e)??new Set}has(e,t,n){var s;return(null==(s=this.byScenario.get(e))?void 0:s.has(`${t}:${n}`))??!1}toggle(e,t,n){const s=`${t}:${n}`;this.byScenario.has(e)||this.byScenario.set(e,new Set);const i=this.byScenario.get(e),r=i.has(s);return r?i.delete(s):i.add(s),0===i.size&&this.byScenario.delete(e),this.scheduleSave(),!r}remove(e,t,n){const s=this.byScenario.get(e);s&&(s.delete(`${t}:${n}`),0===s.size&&this.byScenario.delete(e),this.scheduleSave())}clear(e){e?this.byScenario.delete(e):this.byScenario.clear(),this.scheduleSave()}all(){return[...this.byScenario.entries()].map(([e,t])=>({scenario:e,keys:[...t].sort()}))}scheduleSave(){var e,t;this.saveTimer&&clearTimeout(this.saveTimer),this.saveTimer=setTimeout(()=>{this.saveTimer=null,this.save()},this.saveDebounceMs),null==(t=(e=this.saveTimer).unref)||t.call(e)}async save(){const e={version:1,scenarios:Object.fromEntries([...this.byScenario.entries()].map(([e,t])=>[e,[...t].map(DP)]))};try{await this.rest.putBreakpoints(e)}catch{console.warn("[breakpoints] save failed")}}}function BP(e){return`${e.line}:${e.col}`}function DP(e){const[t,n]=e.split(":");return{line:Number(t),col:Number(n)}}function LP(e){return`${e.source}\0${e.key}`}class EP{constructor(e){this.rest=e,this.loading=!1,this.saving=!1,this.error=null,this.warnings=[],this.base=[],this.edits=new Map,this.revealed=new Set,this.activated=new Set,$r(this,{},{autoBind:!0})}async load(){this.loading=!0,this.error=null;try{const e=await this.rest.getVariables();pr(()=>{this.base=e.vars,this.edits.clear(),this.activated.clear(),this.warnings=[]})}catch(e){pr(()=>{this.error=e instanceof Error?e.message:String(e),this.base=[]})}finally{pr(()=>{this.loading=!1})}}get count(){return this.base.length}get rows(){return this.base.map(e=>{const t=LP(e);return this.edits.has(t)?{...e,value:this.edits.get(t)}:e})}filtered(e){const t=e.trim().toLowerCase();return t?this.rows.filter(e=>e.key.toLowerCase().includes(t)):this.rows}effectiveValue(e){var t;const n=LP(e);return this.edits.has(n)?this.edits.get(n):(null==(t=this.base.find(e=>LP(e)===n))?void 0:t.value)??""}setValue(e,t){var n;const s=LP(e);t===((null==(n=this.base.find(e=>LP(e)===s))?void 0:n.value)??"")?this.edits.delete(s):this.edits.set(s,t)}toggleBool(e){this.setValue(e,"1"===this.effectiveValue(e)?"0":"1")}toggleReveal(e){const t=LP(e);this.revealed.has(t)?this.revealed.delete(t):this.revealed.add(t)}isRevealed(e){return this.revealed.has(LP(e))}isEdited(e){return this.edits.has(LP(e))}activate(e){e.commented&&this.activated.add(LP(e))}isActivated(e){return this.activated.has(LP(e))}get dirty(){return this.edits.size>0||this.activated.size>0}async save(){if(this.dirty&&!this.saving){this.saving=!0,this.error=null;try{const e={env:{},secrets:{}};for(const t of this.base){const n=LP(t);(this.edits.has(n)||this.activated.has(n))&&(e[t.source][t.key]=this.effectiveValue(t))}for(const t of["env","secrets"]){const n=e[t];0!==Object.keys(n).length&&await this.rest.putVariables({version:1,source:t,values:n})}await this.load()}catch(e){pr(()=>{this.error=e instanceof Error?e.message:String(e)})}finally{pr(()=>{this.saving=!1})}}}dismissWarnings(){this.warnings=[]}async addVariable(e,t,n){this.saving=!0,this.error=null;try{const s=await this.rest.addVariable({version:1,name:e,value:t,kind:n});return await this.load(),pr(()=>{this.warnings=s.warnings}),!0}catch(s){return pr(()=>{this.error=s instanceof Error?s.message:String(s)}),!1}finally{pr(()=>{this.saving=!1})}}async deleteVariable(e){this.saving=!0,this.error=null;try{const t=await this.rest.deleteVariable({version:1,name:e.key,source:e.source});await this.load(),pr(()=>{this.warnings=t.warnings})}catch(t){pr(()=>{this.error=t instanceof Error?t.message:String(t)})}finally{pr(()=>{this.saving=!1})}}}class PP{constructor(e,t){this.rest=e,this.active=t,this.items=[],this.loading=!1,this.error=null,$r(this,{},{autoBind:!0})}pathFor(e){return`${L_}/${this.active.activeTestDir}/${P_}/${e}.yaml`}get count(){return this.items.length}async load(){this.loading=!0,this.error=null;try{const e=await this.rest.collections();pr(()=>{this.items=e,this.loading=!1})}catch(e){pr(()=>{this.error=e instanceof Error?e.message:String(e),this.loading=!1})}}clearError(){this.error=null}setError(e){this.error=e}byPath(e){return this.items.find(t=>t.path===e)}nameTaken(e,t){const n=e.toLowerCase();return this.items.some(e=>e.name.toLowerCase()===n&&e.path!==t)}async create(e,t=null){const n=e.trim();if(!n||this.nameTaken(n))return null;const s=this.items,i={name:n,path:this.pathFor(n),description:t,scenarios:[],workers:null,prepare:null};this.items=[i,...s],this.error=null;try{const e=await this.rest.createCollection({name:n,description:t});return pr(()=>{this.items=this.items.map(t=>t.path===i.path?e:t)}),e}catch(r){return pr(()=>{this.items=s,this.error=RP(r)}),null}}async rename(e,t){const n=t.trim();if(!n)return null;if(this.nameTaken(n,e))return null;const s=this.byPath(e);if(!s)return null;if(s.name===n)return s;const i=this.items,r={...s,name:n,path:this.pathFor(n)};this.items=i.map(t=>t.path===e?r:t),this.error=null;try{const e=await this.rest.renameCollection(s.name,n);return pr(()=>{this.items=this.items.map(t=>t.path===r.path?e:t)}),e}catch(o){return pr(()=>{this.items=i,this.error=RP(o)}),null}}async delete(e){const t=this.byPath(e);if(!t)return!1;const n=this.items;this.items=n.filter(t=>t.path!==e),this.error=null;try{return await this.rest.deleteCollection(t.name),!0}catch(s){return pr(()=>{this.items=n,this.error=RP(s)}),!1}}async setDescription(e,t){await this.patch(e,{description:t})}async setWorkers(e,t){await this.patch(e,{workers:t})}async addScenario(e,t){const n=this.byPath(e);n&&!n.scenarios.includes(t)&&await this.patch(e,{scenarios:[...n.scenarios,t]})}async removeScenario(e,t){const n=this.byPath(e);n&&await this.patch(e,{scenarios:n.scenarios.filter(e=>e!==t)})}async reorderScenarios(e,t){await this.patch(e,{scenarios:[...t]})}async patch(e,t){const n=this.byPath(e);if(!n)return;const s=this.items,i={...n,description:void 0===t.description?n.description:t.description,scenarios:void 0===t.scenarios?n.scenarios:t.scenarios,workers:void 0===t.workers?n.workers:t.workers};this.items=s.map(t=>t.path===e?i:t),this.error=null;try{const s=await this.rest.patchCollection(n.name,t);pr(()=>{this.items=this.items.map(t=>t.path===e?s:t)})}catch(r){pr(()=>{this.items=s,this.error=RP(r)})}}}function RP(e){return e instanceof Error?e.message:String(e)}class AP{constructor(e){this.rest=e,this.vocab=[],this.helpers=[],this.loaded=!1,$r(this,{},{autoBind:!0})}async load(){if(!this.loaded){this.loaded=!0;try{const[e,t]=await Promise.all([this.rest.dslVocab(),this.rest.dslHelpers()]);pr(()=>{this.vocab=e,this.helpers=t})}catch{this.loaded=!1}}}async reload(){this.loaded=!1,await this.load()}async refreshHelpers(){if(this.loaded)try{const e=await this.rest.dslHelpers();pr(()=>{this.helpers=e})}catch{}}get entries(){return[...this.vocab,...this.helpers]}validate(e,t){return this.rest.validateDsl(e,t)}}class zP{constructor(){this.handles=new Map,this.reveals=hi.map(),this.revealSeq=0}requestReveal(e,t){pr(()=>this.reveals.set(e,{line:t,seq:++this.revealSeq}))}pendingReveal(e){return this.reveals.get(e)}consumeReveal(e,t){pr(()=>{var n;(null==(n=this.reveals.get(e))?void 0:n.seq)===t&&this.reveals.delete(e)})}register(e,t){return this.handles.set(e,t),()=>{this.handles.get(e)===t&&this.handles.delete(e)}}insertAtCursor(e,t){const n=this.handles.get(e);return!!n&&(n.insertAtCursor(t),!0)}}class TP{constructor(e,t){this.rest=e,this.onSwitched=t,this.names=[],this.active=null,this.switching=!1,$r(this,{},{autoBind:!0})}async load(){try{const e=await this.rest.environments();pr(()=>{this.names=e.names,this.active=e.active})}catch{}}async setActive(e){if(e!==this.active&&!this.switching){pr(()=>{this.switching=!0});try{const t=await this.rest.setActiveEnvironment(e);pr(()=>{this.names=t.names,this.active=t.active}),this.onSwitched()}catch{}finally{pr(()=>{this.switching=!1})}}}get hasAny(){return this.names.length>0}}class IP{constructor(e){this.rest=e,this.items=[],this.loading=!1,this.error=null,$r(this,{},{autoBind:!0})}get count(){return this.items.length}async load(){this.loading=!0,this.error=null;try{const e=await this.rest.helpers();pr(()=>{this.items=e,this.loading=!1})}catch(e){pr(()=>{this.error=e instanceof Error?e.message:String(e),this.loading=!1})}}}class OP{constructor(e){this.rest=e,this.byRunId=new Map,this.pending=new Set,this.errors=new Map,$r(this,{},{autoBind:!0})}get(e){return this.byRunId.get(e)??null}async loadIfNeeded(e){if(!this.byRunId.has(e)&&!this.pending.has(e)){this.pending.add(e),this.errors.delete(e);try{const t=await this.rest.runDetail(e);pr(()=>{this.byRunId.set(e,t),this.pending.delete(e)})}catch(t){pr(()=>{this.errors.set(e,t instanceof Error?t.message:String(t)),this.pending.delete(e)})}}}invalidate(e){this.byRunId.delete(e),this.errors.delete(e)}}const HP="layout",FP={treeOpen:!0,treeWidth:280,inspectorOpen:!0,inspectorWidth:380,runViewMode:null},WP=["steps","trace","code"];class UP{constructor(){const e=EM(HP,FP);this.treeOpen=e.treeOpen,this.treeWidth=Math.max(200,e.treeWidth),this.inspectorOpen=e.inspectorOpen,this.inspectorWidth=Math.max(240,e.inspectorWidth),this.runViewMode=WP.includes(e.runViewMode)?e.runViewMode:null,$r(this,{},{autoBind:!0})}setRunViewMode(e){this.runViewMode=e}toggleTree(){this.treeOpen=!this.treeOpen}openTree(){this.treeOpen=!0}setTreeWidth(e){this.treeWidth=Math.max(200,e)}toggleInspector(){this.inspectorOpen=!this.inspectorOpen}setInspectorWidth(e){this.inspectorWidth=Math.max(240,e)}get treeMin(){return 200}get inspectorMin(){return 240}get storageKey(){return HP}toPersisted(){return{runViewMode:this.runViewMode,treeOpen:this.treeOpen,treeWidth:this.treeWidth,inspectorOpen:this.inspectorOpen,inspectorWidth:this.inspectorWidth}}}class KP{constructor(e,t,n){this.scenarios=e,this.runs=t,this.active=n,$r(this,{},{autoBind:!0})}get rows(){const e=this.active.liveRefs;return this.scenarios.items.map(t=>{const n=this.runs.latest[t.name];return n?{ref:t.name,path:t.path,status:_N(n.lastStatus,t.expectFail),live:e.get(t.name)??null,expectFail:t.expectFail,lastRunId:n.lastRunId,lastAt:n.lastAt,durationMs:n.lastDurationMs,failStreak:n.failStreak,recent:n.recent}:{ref:t.name,path:t.path,status:"never",live:e.get(t.name)??null,expectFail:t.expectFail,lastRunId:null,lastAt:null,durationMs:null,failStreak:0,recent:[]}}).sort((e,t)=>e.ref.localeCompare(t.ref))}get counts(){const e=this.rows;return{all:e.length,passed:e.filter(e=>"passed"===e.status).length,failed:e.filter(e=>"failed"===e.status).length,expected:e.filter(e=>"expected"===e.status).length,never:e.filter(e=>"never"===e.status).length}}get failing(){return this.rows.filter(e=>"failed"===e.status).sort((e,t)=>(t.lastAt??0)-(e.lastAt??0))}get indexReady(){return this.runs.indexReady}}class qP{constructor(e){this.rest=e,this.waiting=[],this.running=[],this.slots={total:0,used:0},this.enabled=!0,this.loading=!1,$r(this,{},{autoBind:!0})}get waitingCount(){return this.waiting.length}async load(){let e;this.loading=!0;try{e=await this.rest.queue()}catch{return void pr(()=>{this.loading=!1})}pr(()=>{this.waiting=e.waiting,this.running=e.running,this.slots=e.slots,this.enabled=e.enabled,this.loading=!1})}async cancel(e){try{await this.rest.cancelQueued(e)}finally{await this.load()}}}const $P=[500,1e3,2e3,5e3,1e4,3e4];class VP{constructor(e){this.rest=e,this.items=[],this.latest={},this.loading=!1,this.loadingMore=!1,this.error=null,this.indexReady=!0,this.exhausted=!1,this.scenarioFilter=null,this.indexRetryStep=0,this.indexRetryTimer=null,$r(this,{},{autoBind:!0})}lastRunByRef(e,t){if("scenario"===e){const e=this.latest[t];if(e)return function(e,t){return{runId:t.lastRunId,kind:"scenario",ref:e,startedAt:t.lastAt,finishedAt:null,durationMs:t.lastDurationMs,status:t.lastStatus,outcome:null}}(t,e)}let n=null;for(const s of this.items)s.kind===e&&s.ref===t&&(!n||s.startedAt>n.startedAt)&&(n=s);return n}get failed(){return this.items.filter(e=>"failed"===e.status)}get passed(){return this.items.filter(e=>"passed"===e.status)}get running(){return this.items.filter(e=>"running"===e.status)}get hasMore(){return!this.exhausted&&this.items.length>0}async setScenarioFilter(e){this.scenarioFilter!==e&&(this.scenarioFilter=e,await this.load())}async load(){this.clearIndexRetry(),this.loading=!0,this.error=null;try{const[e,t]=await Promise.all([this.rest.runs({limit:50,...this.scenarioFilter?{scenario:this.scenarioFilter}:{}}),this.loadLatest()]);pr(()=>{this.items=e.runs,this.exhausted=e.exhausted,this.indexReady=e.indexReady,this.latest=t,this.loading=!1}),e.indexReady?this.indexRetryStep=0:this.scheduleIndexRetry()}catch(e){pr(()=>{this.error=e instanceof Error?e.message:String(e),this.loading=!1})}}scheduleIndexRetry(){const e=$P[Math.min(this.indexRetryStep,$P.length-1)];this.indexRetryStep++,this.indexRetryTimer=setTimeout(()=>{this.indexRetryTimer=null,this.load()},e)}clearIndexRetry(){null!==this.indexRetryTimer&&(clearTimeout(this.indexRetryTimer),this.indexRetryTimer=null)}async loadMore(){if(this.loadingMore||this.loading||this.exhausted)return;const e=this.items[this.items.length-1];if(e){this.loadingMore=!0;try{const t=await this.rest.runs({limit:50,before:e.startedAt,...this.scenarioFilter?{scenario:this.scenarioFilter}:{}});pr(()=>{const e=new Set(this.items.map(e=>e.runId));this.items=[...this.items,...t.runs.filter(t=>!e.has(t.runId))],this.exhausted=t.exhausted,this.indexReady=t.indexReady,this.loadingMore=!1})}catch(t){pr(()=>{this.error=t instanceof Error?t.message:String(t),this.loadingMore=!1})}}}async loadLatest(){try{return await this.rest.runsLatest()}catch{return{}}}}class YP{constructor(e){this.rest=e,this.byRunId=new Map,this.pending=new Set,$r(this,{},{autoBind:!0})}get(e){return this.byRunId.get(e)}async loadIfNeeded(e){if(!this.byRunId.has(e)&&!this.pending.has(e)){this.pending.add(e);try{const t=await this.rest.runDetail(e),n="sources"in t?t.sources:null;pr(()=>{this.byRunId.set(e,n),this.pending.delete(e)})}catch{pr(()=>{this.pending.delete(e)})}}}}class GP{constructor(e){this.rest=e,this.byRunId=new Map,this.pending=new Set,$r(this,{},{autoBind:!0})}get(e){return this.byRunId.get(e)}async loadIfNeeded(e){if(!this.byRunId.has(e)&&!this.pending.has(e)){this.pending.add(e);try{const t=await this.rest.runtime(e);pr(()=>{this.byRunId.set(e,t),this.pending.delete(e)})}catch{pr(()=>{this.byRunId.set(e,null),this.pending.delete(e)})}}}invalidate(e){this.byRunId.delete(e)}}const XP="scenarios.expanded";class ZP{constructor(e,t,n,s=""){this.rest=e,this.tabs=t,this.active=n,this.items=[],this.folders=[],this.loading=!1,this.error=null,this.clipboard=null,this.creating=null,this.renaming=null,this.menu=null,this.selected=null,this.pendingDelete=null,this.actionError=null,this.scope=s,this.expanded=EM(PM(XP,s),{}),$r(this,{},{autoBind:!0})}setScope(e){e!==this.scope&&(this.scope=e,this.expanded=EM(this.storageKey,{}))}get storageKey(){return PM(XP,this.scope)}get count(){return this.items.length}async load(){this.loading=!0,this.error=null;try{const e=await this.rest.scenarios();pr(()=>{this.items=e.scenarios,this.folders=e.folders,this.loading=!1})}catch(e){pr(()=>{this.error=e instanceof Error?e.message:String(e),this.loading=!1})}}buildTree(e){var t,n;const s=e.trim().toLowerCase(),i=new Set(this.folders);for(const a of this.items){let e=eP(a.name);for(;e;)i.add(e),e=eP(e)}const r=new Map;for(const a of i)r.set(a,{rel:a,name:QE(a),folders:[],scenarios:[]});const o={folders:[],scenarios:[]};for(const a of[...i].sort()){const e=r.get(a),n=eP(a);""===n?o.folders.push(e):null==(t=r.get(n))||t.folders.push(e)}for(const a of this.items){const e=eP(a.name),t=""===e?o.scenarios:null==(n=r.get(e))?void 0:n.scenarios;null==t||t.push(a)}return function(e,t,n){const s=e=>{const i=e.folders.map(s).filter(e=>null!==e).sort((e,t)=>e.name.localeCompare(t.name)),r=!!t&&e.name.toLowerCase().includes(t),o=(r?e.scenarios:e.scenarios.filter(n)).slice().sort((e,t)=>e.name.localeCompare(t.name));return t&&0===i.length&&0===o.length&&!r?null:{...e,folders:i,scenarios:o}};return{folders:e.folders.map(s).filter(e=>null!==e).sort((e,t)=>e.name.localeCompare(t.name)),scenarios:e.scenarios.filter(n).slice().sort((e,t)=>e.name.localeCompare(t.name))}}(o,s,e=>!s||e.name.toLowerCase().includes(s)||e.path.toLowerCase().includes(s)||e.title.toLowerCase().includes(s))}isExpanded(e){return this.expanded[e]??!0}toggle(e){this.expanded[e]=!this.isExpanded(e)}select(e){this.selected=e}openMenu(e,t,n){this.selected=n,this.menu={x:e,y:t,target:n}}closeMenu(){this.menu=null}startCreate(e,t){this.creating={parent:e,kind:t},""!==e&&(this.expanded[e]=!0),this.closeMenu()}cancelCreate(){this.creating=null}startRename(e){"blank"!==e.kind&&(this.renaming=e),this.closeMenu()}cancelRename(){this.renaming=null}copy(e){"scenario"===e.kind?this.clipboard={kind:"scenario",rel:e.rel,label:tP(QE(e.rel))}:"folder"===e.kind&&(this.clipboard={kind:"folder",rel:e.rel,label:QE(e.rel)}),this.closeMenu()}copyPath(e){var t;if("blank"===e.kind)return;const n=`${L_}/${E_}/${e.rel}`;null==(t=navigator.clipboard)||t.writeText(n),this.closeMenu()}requestDelete(e){"blank"!==e.kind&&(this.pendingDelete=e),this.closeMenu()}cancelDelete(){this.pendingDelete=null}clearActionError(){this.actionError=null}async commitCreate(e){const t=this.creating;this.creating=null,t&&await this.run(async()=>{if("folder"===t.kind){const{folder:n}=await this.rest.createFolder(t.parent,e);pr(()=>{this.expanded[n]=!0}),await this.load()}else{const{scenario:n}=await this.rest.createScenario(t.parent,e);await this.load(),this.tabs.openScenario(this.proj(n)),pr(()=>{this.selected={kind:"scenario",rel:n}})}})}async commitRename(e){const t=this.renaming;this.renaming=null,t&&"blank"!==t.kind&&await this.run(async()=>{const{from:n,to:s}=await this.rest.renameScenarioNode(t.rel,e);"scenario"===t.kind?this.tabs.retargetScenarioPath(this.proj(n),this.proj(s)):(this.tabs.retargetScenarioPrefix(this.proj(n),this.proj(s)),pr(()=>{this.expanded[s]=this.expanded[n]??!0,delete this.expanded[n]})),await this.load()})}async paste(e){const t=this.clipboard;this.closeMenu(),t&&await this.run(async()=>{const{created:n}=await this.rest.copyScenarioNode(t.rel,e);pr(()=>{""!==e&&(this.expanded[e]=!0)}),await this.load(),pr(()=>{this.renaming="folder"===t.kind?{kind:"folder",rel:n}:{kind:"scenario",rel:n},this.selected=this.renaming})})}async confirmDelete(){const e=this.pendingDelete;this.pendingDelete=null,e&&"blank"!==e.kind&&await this.run(async()=>{await this.rest.deleteScenarioNode(e.rel),"scenario"===e.kind?this.tabs.closeScenarioPath(this.proj(e.rel)):this.tabs.closeScenarioPrefix(this.proj(e.rel)),await this.load()})}async run(e){this.actionError=null;try{await e()}catch(t){pr(()=>{this.actionError=t instanceof Error?t.message:String(t)})}}proj(e){return`${L_}/${this.active.activeTestDir}/${e}`}}const JP={canRun:!0,canEditFiles:!0,canTerminal:!0,canBrowseFs:!0};class QP{constructor(e){this.rest=e,this.capabilities=JP,this.identity=null,this.environments=[],this.loadingEnvironments=!1,$r(this,{},{autoBind:!0})}async load(){try{const e=await this.rest.session();pr(()=>{this.capabilities=e.capabilities,this.identity=e.identity})}catch{}}get restricted(){const e=this.capabilities;return!(e.canRun&&e.canEditFiles&&e.canTerminal&&e.canBrowseFs)}get canSwitchEnvironment(){var e;return void 0!==(null==(e=this.identity)?void 0:e.environmentsUrl)&&void 0!==this.identity.switchEnvUrl}get currentEnvironment(){var e;const t=null==(e=this.identity)?void 0:e.env;return void 0===t?null:this.environments.find(e=>e.name===t)??null}async loadEnvironments(){var e;const t=null==(e=this.identity)?void 0:e.environmentsUrl;if(void 0!==t){pr(()=>{this.loadingEnvironments=!0});try{const e=await this.rest.hostedEnvironments(t);pr(()=>{this.environments=e})}catch{}finally{pr(()=>{this.loadingEnvironments=!1})}}}switchEnvironment(e){var t;const n=null==(t=this.identity)?void 0:t.switchEnvUrl;void 0!==n&&eR(n,{env:e})}logout(){var e;const t=null==(e=this.identity)?void 0:e.logoutUrl;void 0!==t&&eR(t)}}function eR(e,t={}){const n=document.createElement("form");n.method="post",n.action=e;for(const[s,i]of Object.entries(t)){const e=document.createElement("input");e.type="hidden",e.name=s,e.value=i,n.appendChild(e)}document.body.appendChild(n),n.submit()}class tR{constructor(e){this.rest=e,this.list=[],this.loaded=!1,$r(this,{},{autoBind:!0})}manifestOf(e){var t;return null==(t=this.list.find(t=>t.snapshotId===e))?void 0:t.manifest}async load(){try{const e=await this.rest.snapshots();pr(()=>{this.list=e})}catch{}finally{pr(()=>{this.loaded=!0})}}async importFile(e){const t=await this.rest.importSnapshot(e);return pr(()=>{const e=this.list.findIndex(e=>e.snapshotId===t.snapshotId);e>=0?this.list[e]=t:this.list.unshift(t)}),t.snapshotId}async remove(e){await this.rest.deleteSnapshot(e),pr(()=>{this.list=this.list.filter(t=>t.snapshotId!==e)})}}class nR{constructor(e){this.rest=e,this.cache=new Map,this.inflight=new Map,this.loading=new Set,this.errors=new Map,this.drafts=new Map,this.conflicts=new Set,this.saving=new Set,$r(this,{},{autoBind:!0})}get(e){return this.cache.get(e)}draft(e){return this.drafts.has(e)?this.drafts.get(e):this.cache.get(e)}setDraft(e,t){if(this.cache.get(e)===t?this.drafts.delete(e):this.drafts.set(e,t),this.conflicts.has(e)){const t=new Set(this.conflicts);t.delete(e),this.conflicts=t}}insertAfterLine(e,t,n){var s;const i=this.draft(e);if(void 0===i)return;const r=i.split("\n"),o=Math.max(0,Math.min(t,r.length)),a=r[o-1]??r[r.length-1]??"",l=(null==(s=/^[ \t]*/.exec(a))?void 0:s[0])??"";r.splice(o,0,`${l}${n}`),this.setDraft(e,r.join("\n"))}insertBeforeLastLine(e,t){var n;const s=this.draft(e);if(void 0===s)return;const i=s.split("\n");let r=i.length;for(;r>0&&""===i[r-1].trim();)r--;const o=Math.max(0,r-1),a=(null==(n=/^[ \t]*/.exec(i[o]??""))?void 0:n[0])??"";i.splice(o,0,`${a} ${t}`),this.setDraft(e,i.join("\n"))}isDirty(e){return this.drafts.has(e)}isSaving(e){return this.saving.has(e)}hasConflict(e){return this.conflicts.has(e)}discardDraft(e){this.drafts.delete(e);const t=new Set(this.conflicts);t.delete(e),this.conflicts=t}async save(e){const t=this.drafts.get(e);if(void 0!==t){pr(()=>{const t=new Set(this.saving);t.add(e),this.saving=t});try{await this.rest.writeSource(e,t),pr(()=>{this.cache.set(e,t),this.drafts.delete(e);const n=new Set(this.conflicts);n.delete(e),this.conflicts=n,this.errors.delete(e)})}catch(n){throw pr(()=>{this.errors.set(e,n instanceof Error?n.message:String(n))}),n}finally{pr(()=>{const t=new Set(this.saving);t.delete(e),this.saving=t})}}}isLoading(e){return this.loading.has(e)}error(e){return this.errors.get(e)??null}async getOrLoad(e){const t=this.cache.get(e);if(void 0!==t)return t;const n=this.inflight.get(e);if(n)return n;const s=this.fetch(e);this.inflight.set(e,s),pr(()=>{const t=new Set(this.loading);t.add(e),this.loading=t});try{return await s}finally{this.inflight.delete(e),pr(()=>{const t=new Set(this.loading);t.delete(e),this.loading=t})}}invalidate(e){const t=void 0!==e?[e]:Array.from(this.cache.keys());for(const n of t)this.errors.delete(n),this.refresh(n)}async refresh(e){if(this.inflight.has(e))return;const t=this.fetch(e);this.inflight.set(e,t);try{await t}catch{}finally{this.inflight.delete(e)}}async fetch(e){try{const t=this.cache.get(e),{content:n}=await this.rest.source(e);return pr(()=>{this.cache.set(e,n),this.errors.delete(e);const s=this.drafts.get(e);if(void 0!==s&&s!==n&&t!==n){const t=new Set(this.conflicts);t.add(e),this.conflicts=t}}),n}catch(t){const n=t instanceof Error?t.message:String(t);throw pr(()=>{this.errors.set(e,n),this.cache.delete(e)}),t}}}const sR="tabs.openTabs",iR="overview";class rR{constructor(e=""){this.scope=e;const t=EM(PM(sR,e),{tabs:[],activeKey:null});this.hydrate(t),$r(this,{},{autoBind:!0})}hydrate(e){const t=e.tabs.filter(e=>"overview"!==e.kind);this.tabs=[{kind:"overview"},...t];const n=e.activeKey,s=null!=n&&this.tabs.some(e=>this.keyFor(e)===n);this.activeKey=s?n:t.length?this.keyFor(t[t.length-1]):iR}setScope(e){if(e===this.scope)return;this.scope=e;const t=EM(this.storageKey,{tabs:[],activeKey:null});this.hydrate(t)}open(e){const t=this.keyFor(e);this.tabs.some(e=>this.keyFor(e)===t)||this.tabs.push(e),this.activeKey=t}close(e){if(e===iR)return;const t=this.tabs.findIndex(t=>this.keyFor(t)===e);if(!(t<0)&&(this.tabs.splice(t,1),this.activeKey===e)){const e=this.tabs[t]??this.tabs[t-1]??this.tabs[0];this.activeKey=this.keyFor(e)}}activate(e){this.tabs.some(t=>this.keyFor(t)===e)&&(this.activeKey=e)}closeOthers(e){const t=this.tabs.find(t=>this.keyFor(t)===e);if(!t)return;const n=this.tabs[0];this.tabs=t===n?[n]:[n,t],this.activeKey=e}closeAll(){this.tabs=[this.tabs[0]],this.activeKey=iR}renameCollectionTab(e,t){this.swapPath("collection",e,t)}retargetScenarioPath(e,t){this.swapPath("scenario",e,t)}retargetScenarioPrefix(e,t){const n=oR(e),s=oR(t);let i=null;this.tabs=this.tabs.map(e=>{if("scenario"===e.kind&&e.path.startsWith(n)){const t=s+e.path.slice(n.length);return this.activeKey===`scenario:${e.path}`&&(i=t),{kind:"scenario",path:t}}return e}),i&&(this.activeKey=`scenario:${i}`)}closeScenarioPath(e){this.close(`scenario:${e}`)}closeScenarioPrefix(e){const t=oR(e);for(const n of[...this.tabs])"scenario"===n.kind&&n.path.startsWith(t)&&this.close(`scenario:${n.path}`)}openScenario(e){this.open({kind:"scenario",path:e})}swapPath(e,t,n){if(t===n)return;const s=this.tabs.findIndex(n=>n.kind===e&&n.path===t);if(s<0)return;const i=this.activeKey===`${e}:${t}`;this.tabs.splice(s,1,{kind:e,path:n}),i&&(this.activeKey=`${e}:${n}`)}get activeTab(){return this.tabs.find(e=>this.keyFor(e)===this.activeKey)??this.tabs[0]}keyFor(e){switch(e.kind){case"overview":return iR;case"scenario":case"helper":case"collection":return`${e.kind}:${e.path}`;case"scenario-run":case"collection-run":return`${e.kind}:${e.runId}`;case"snapshot":return`snapshot:${e.snapshotId}`}}toPersisted(){return{tabs:this.tabs.filter(e=>"overview"!==e.kind),activeKey:this.activeKey}}get storageKey(){return PM(sR,this.scope)}}function oR(e){return e.endsWith("/")?e:`${e}/`}class aR{constructor(e){this.rest=e,this.checks=null,this.error=null,this.busy=!1,this.checkedTarget=null,$r(this,{},{autoBind:!0})}async run(e){this.busy=!0,this.error=null;try{const{checks:t}=await this.rest.targetDoctor(e);pr(()=>{this.checks=t,this.checkedTarget=e})}catch(t){pr(()=>{this.error=t instanceof Error?t.message:String(t),this.checks=null,this.checkedTarget=null})}finally{pr(()=>{this.busy=!1})}}reset(){this.checks=null,this.error=null,this.checkedTarget=null}get hasErrors(){var e;return(null==(e=this.checks)?void 0:e.some(e=>"error"===e.severity))??!1}}const lR="target.active";class cR{constructor(e,t){this.rest=e,this.onSwitched=t,this.available=[],this.active="",this.projectRoot="",this.switching=!1,$r(this,{},{autoBind:!0})}async load(){try{const e=await this.rest.targets(),t=EM(lR,null),n=e.targets.find(e=>e.target===t);if(t&&t!==e.active&&n&&(!n.host||n.host.ok)){const e=await this.rest.setActiveTarget(t);return pr(()=>{this.available=e.targets,this.active=e.active,this.projectRoot=e.projectRoot??""}),void this.onSwitched()}pr(()=>{this.available=e.targets,this.active=e.active,this.projectRoot=e.projectRoot??""})}catch{}}async setActive(e){if(e===this.active||this.switching)return;const t=this.available.find(t=>t.target===e);if(!(null==t?void 0:t.host)||t.host.ok){pr(()=>{this.switching=!0});try{const t=await this.rest.setActiveTarget(e);pr(()=>{this.available=t.targets,this.active=t.active,this.projectRoot=t.projectRoot??""}),RM(lR,this.active),this.onSwitched()}catch{}finally{pr(()=>{this.switching=!1})}}}get current(){return this.available.find(e=>e.target===this.active)}get activeTestDir(){var e;return(null==(e=this.current)?void 0:e.testDir)??E_}get activeSuffix(){var e;return(null==(e=this.current)?void 0:e.suffix)??""}get activeDebugCaps(){var e;return(null==(e=this.current)?void 0:e.debug)??{picker:!0,attach:!0,resumeFromFailure:!1}}get hasMultiple(){return this.available.length>1}}class hR{constructor(e,t){this.rest=e,this.onSwitched=t,this.file=null,this.posting=!1,this.pendingBundleId=null,this.error=null,this.timer=null,this.fastTimer=null,$r(this,{},{autoBind:!0})}get switching(){return this.posting||null!==this.pendingBundleId}get hosted(){return null!==this.file}get current(){const e=this.file;return(null==e?void 0:e.currentBundleId)?e.bundles.find(t=>t.bundleId===e.currentBundleId)??null:null}get label(){var e;return this.file?(null==(e=this.current)?void 0:e.label)??"no bundle yet":null}get canSwitch(){return null!==this.file&&this.file.allowSwitch&&void 0!==this.file.switchPath&&this.file.bundles.length>0}async load(){try{const e=await this.rest.workspace();pr(()=>{this.file=e,null!==this.pendingBundleId&&(null==e?void 0:e.currentBundleId)===this.pendingBundleId&&(this.pendingBundleId=null,this.stopFastPoll(),this.onSwitched())})}catch{pr(()=>{this.file=null})}}start(){this.load(),null===this.timer&&(this.timer=setInterval(()=>{this.load()},3e4))}stop(){null!==this.timer&&clearInterval(this.timer),this.timer=null,this.stopFastPoll()}async switchTo(e){var t;const n=null==(t=this.file)?void 0:t.switchPath;if(void 0!==n&&!this.switching){pr(()=>{this.posting=!0,this.error=null});try{if("switching"===await this.rest.switchBundle(n,e))return pr(()=>{this.pendingBundleId=e}),void this.startFastPoll();await this.load(),this.onSwitched()}catch(s){pr(()=>{this.error=s instanceof Error?s.message:String(s)})}finally{pr(()=>{this.posting=!1})}}}startFastPoll(){null===this.fastTimer&&(this.fastTimer=setInterval(()=>{this.load()},uR))}stopFastPoll(){null!==this.fastTimer&&clearInterval(this.fastTimer),this.fastTimer=null}}const uR=3e3,dR="terminal",fR={open:!1,height:300},pR=()=>Math.round(.75*("undefined"!=typeof window?window.innerHeight:900));class vR{constructor(){this.tabs=[],this.activeId=null,this.seq=0;const e=EM(dR,fR);this.open=e.open,this.height=Math.max(140,e.height),$r(this,{},{autoBind:!0}),this.open&&this.newTerm("local")}toggle(){this.open?this.open=!1:this.show()}show(){this.open=!0,0===this.tabs.length&&this.newTerm("local")}hide(){this.open=!1}setHeight(e){this.height=Math.min(pR(),Math.max(140,e))}newTerm(e){this.seq+=1;const t=`term_${this.seq}`;return this.tabs.push({id:t,kind:e}),this.activeId=t,this.open=!0,t}activate(e){this.tabs.some(t=>t.id===e)&&(this.activeId=e)}closeTerm(e){const t=this.tabs.findIndex(t=>t.id===e);t<0||(this.tabs.splice(t,1),this.activeId===e&&(this.activeId=this.tabs.length?this.tabs[Math.min(t,this.tabs.length-1)].id:null))}get heightMin(){return 140}get heightMax(){return pR()}get activeKind(){var e;return(null==(e=this.tabs.find(e=>e.id===this.activeId))?void 0:e.kind)??null}get storageKey(){return dR}toPersisted(){return{open:this.open,height:this.height}}}const gR="theme.theme";class mR{constructor(){this.system=this.systemPreference(),this.mode=EM(gR,"system"),$r(this,{},{autoBind:!0}),this.watchSystem()}get theme(){return"system"===this.mode?this.system:this.mode}cycle(){this.mode="light"===this.mode?"dark":"dark"===this.mode?"system":"light"}set(e){this.mode=e}get storageKey(){return gR}setSystem(e){this.system=e}watchSystem(){if("undefined"==typeof window||!window.matchMedia)return;window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",e=>{this.setSystem(e.matches?"dark":"light")})}systemPreference(){return"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}}class _R extends Error{constructor(e,t,n){super(e),this.status=t,this.body=n,this.name="RestClientError"}}Cr({enforceActions:"observed",computedRequiresReaction:!1,reactionRequiresObservable:!0,observableRequiresReaction:!1});const xR=document.getElementById("root");if(!xR)throw new Error("missing #root");const bR=new class{constructor(e=""){this.base=e}targets(){return this.getJson("/api/targets")}setActiveTarget(e){return this.postJson("/api/targets/active",{target:e})}targetDoctor(e){return this.postJson(`/api/targets/${encodeURIComponent(e)}/doctor`,{})}environments(){return this.getJson("/api/environments")}setActiveEnvironment(e){return this.postJson("/api/environments/active",{env:e})}schedules(){return this.getJson("/api/schedules")}putSchedules(e){return this.putJson("/api/schedules",{schedules:e})}workspace(){return this.getJson("/api/workspace")}async switchBundle(e,t){const n=await this.postJson(e,{bundleId:t});return"switching"===(null==n?void 0:n.status)?"switching":"done"}scenarios(){return this.getJson("/api/scenarios")}createFolder(e,t){return this.postJson("/api/scenarios/folder",{parent:e,name:t})}createScenario(e,t){return this.postJson("/api/scenarios/scenario",{parent:e,name:t})}renameScenarioNode(e,t){return this.postJson("/api/scenarios/rename",{path:e,newName:t})}copyScenarioNode(e,t){return this.postJson("/api/scenarios/copy",{from:e,destParent:t})}async deleteScenarioNode(e){await this.postJson("/api/scenarios/delete",{path:e})}helpers(){return this.getJson("/api/helpers")}collections(){return this.getJson("/api/collections")}createCollection(e){return this.postJson("/api/collections",e)}patchCollection(e,t){return this.sendJson("PATCH",`/api/collections/${encodeURIComponent(e)}`,t)}renameCollection(e,t){return this.postJson(`/api/collections/${encodeURIComponent(e)}/rename`,{newName:t})}async deleteCollection(e){await this.sendJson("DELETE",`/api/collections/${encodeURIComponent(e)}`,void 0)}runs(e={}){const t=new URLSearchParams;void 0!==e.limit&&t.set("limit",String(e.limit)),void 0!==e.before&&t.set("before",String(e.before)),e.scenario&&t.set("scenario",e.scenario);const n=t.toString();return this.getJson("/api/runs"+(n?`?${n}`:""))}runsRunning(){return this.getJson("/api/runs/running")}runsLatest(){return this.getJson("/api/runs/latest")}runDetail(e){return this.getJson(`/api/runs/${encodeURIComponent(e)}`)}runChildren(e){return this.getJson(`/api/runs/${encodeURIComponent(e)}/children`)}source(e){return this.getJson(`/api/source?path=${encodeURIComponent(e)}`)}async writeSource(e,t){await this.putJson("/api/source",{path:e,content:t})}dslVocab(){return this.getJson("/api/dsl/vocab")}dslHelpers(){return this.getJson("/api/dsl/helpers")}validateDsl(e,t){return this.postJson("/api/dsl/validate",{source:e,fileKind:t})}startRun(e){return this.postJson("/api/run",e)}async abortRun(e){await this.postJson(`/api/runs/${encodeURIComponent(e)}/abort`,{})}queue(){return this.getJson("/api/queue")}cancelQueued(e){return this.sendJson("DELETE",`/api/queue/${encodeURIComponent(e)}`,void 0)}dbgCommand(e,t){return this.postJson(`/api/runs/${encodeURIComponent(e)}/dbg/command`,t)}runtime(e){return this.getJson(`/api/runs/${encodeURIComponent(e)}/runtime`)}getBreakpoints(){return this.getJson("/api/breakpoints")}async putBreakpoints(e){await this.putJson("/api/breakpoints",e)}getVariables(){return this.getJson("/api/variables")}async putVariables(e){await this.putJson("/api/variables",e)}addVariable(e){return this.postJson("/api/variables",e)}deleteVariable(e){return this.sendJson("DELETE","/api/variables",e)}appServerStatus(){return this.getJson("/api/app-server")}appServerStart(){return this.postJson("/api/app-server/start",{})}appServerStop(){return this.postJson("/api/app-server/stop",{})}fsBrowse(e,t){const n=new URLSearchParams;e&&n.set("path",e),t&&t.length>0&&n.set("exts",t.join(","));const s=n.toString();return this.getJson("/api/fs/browse"+(s?`?${s}`:""))}session(){return this.getJson("/api/session")}hostedEnvironments(e){return this.getJson(e)}snapshots(){return this.getJson("/api/snapshots")}async importSnapshot(e){const t=await fetch(this.base+"/api/snapshots/import",{method:"POST",headers:{"content-type":"application/zip"},body:e});return this.parseOrThrow(t)}async deleteSnapshot(e){const t=await fetch(this.base+`/api/snapshots/${encodeURIComponent(e)}`,{method:"DELETE"});await this.parseOrThrow(t)}async getJson(e){const t=await fetch(this.base+e);return this.parseOrThrow(t)}postJson(e,t){return this.sendJson("POST",e,t)}putJson(e,t){return this.sendJson("PUT",e,t)}async sendJson(e,t,n){const s=await fetch(this.base+t,{method:e,headers:void 0===n?void 0:{"content-type":"application/json"},body:void 0===n?void 0:JSON.stringify(n)});return this.parseOrThrow(s)}async parseOrThrow(e){let t=null;const n=await e.text();try{t=n?JSON.parse(n):null}catch{t=n}if(!e.ok)throw new _R(function(e){if(!e||"object"!=typeof e)return null;const t=e.message;if("string"==typeof t&&t.length>0)return t;const n=e.error;if(n&&"object"==typeof n){const e=n.message;if("string"==typeof e&&e.length>0)return e}return null}(t)??`HTTP ${e.status}`,e.status,t);return t}},yR=new class{constructor(e={}){this.state="idle",this.socket=null,this.handlers=new Set,this.reconnectTimer=null,this.explicitlyClosed=!1,this.url=e.url??function(){const e="https:"===window.location.protocol?"wss:":"ws:";return`${e}//${window.location.host}/ws`}(),this.minBackoff=e.minBackoffMs??500,this.maxBackoff=e.maxBackoffMs??3e4,this.currentBackoff=this.minBackoff}connect(){this.socket&&this.socket.readyState<=WebSocket.OPEN||(this.explicitlyClosed=!1,this.openSocket())}disconnect(){this.explicitlyClosed=!0,null!==this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.socket&&(this.socket.close(),this.socket=null),this.state="closed"}onMessage(e){return this.handlers.add(e),()=>{this.handlers.delete(e)}}openSocket(){this.state="connecting";const e=new WebSocket(this.url);this.socket=e,e.addEventListener("open",()=>{this.state="open",this.currentBackoff=this.minBackoff}),e.addEventListener("message",e=>{this.deliver(e.data)}),e.addEventListener("close",()=>{this.state="closed",this.socket=null,this.explicitlyClosed||this.scheduleReconnect()}),e.addEventListener("error",()=>{})}deliver(e){if("string"!=typeof e)return;let t;try{t=JSON.parse(e)}catch{return}for(const n of this.handlers)n(t)}scheduleReconnect(){if(null!==this.reconnectTimer)return;const e=this.currentBackoff;this.currentBackoff=Math.min(this.maxBackoff,2*this.currentBackoff),this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.explicitlyClosed||this.openSocket()},e)}},wR=new class{constructor(e={}){this.socket=null,this.outbox=[],this.subscribers=new Map,this.reconnectTimer=null,this.url=e.url??function(){const e="https:"===window.location.protocol?"wss:":"ws:";return`${e}//${window.location.host}/ws/terminal`}(),this.minBackoff=e.minBackoffMs??500,this.maxBackoff=e.maxBackoffMs??1e4,this.currentBackoff=this.minBackoff}spawn(e,t,n,s){this.send({type:"spawn",id:e,kind:t,cols:n,rows:s})}sendData(e,t){this.send({type:"data",id:e,data:t})}resize(e,t,n){this.send({type:"resize",id:e,cols:t,rows:n})}close(e){this.send({type:"close",id:e})}subscribe(e,t){let n=this.subscribers.get(e);return n||(n=new Set,this.subscribers.set(e,n)),n.add(t),()=>{const n=this.subscribers.get(e);n&&(n.delete(t),0===n.size&&this.subscribers.delete(e))}}send(e){const t=JSON.stringify({event:hy,data:e});this.ensureSocket(),this.socket&&this.socket.readyState===WebSocket.OPEN?this.socket.send(t):this.outbox.push(t)}ensureSocket(){if(this.socket&&this.socket.readyState<=WebSocket.OPEN)return;const e=new WebSocket(this.url);this.socket=e,e.addEventListener("open",()=>{for(this.currentBackoff=this.minBackoff;this.outbox.length>0&&e.readyState===WebSocket.OPEN;)e.send(this.outbox.shift())}),e.addEventListener("message",e=>this.deliver(e.data)),e.addEventListener("close",()=>{this.socket=null,this.notifyAllExited(),this.scheduleReconnect()}),e.addEventListener("error",()=>{})}deliver(e){if("string"!=typeof e)return;let t;try{t=JSON.parse(e)}catch{return}const n=function(e){if(!e||"object"!=typeof e)return null;const t=e;if(t.event===hy&&t.data&&"object"==typeof t.data)return t.data;if("string"==typeof t.type&&"string"==typeof t.id)return t;return null}(t);if(!n)return;const s=this.subscribers.get(n.id);if(s)for(const i of s)i(n)}notifyAllExited(){for(const[e,t]of this.subscribers)for(const n of t)n({type:"exit",id:e,exitCode:null})}scheduleReconnect(){if(null!==this.reconnectTimer||0===this.subscribers.size)return;const e=this.currentBackoff;this.currentBackoff=Math.min(this.maxBackoff,2*this.currentBackoff),this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.subscribers.size>0&&this.ensureSocket()},e)}},SR=new class{constructor(e,t,n){this.rest=e,this.ws=t,this.terminalTransport=n,this.wsUnsubscribe=null,this.persistDisposers=[],this.appendCursor=new Map;const s=EM(lR,null)??"";this.tabs=new rR(s),this.targets=new cR(e,()=>this.refreshAfterTargetSwitch()),this.environments=new TP(e,()=>this.refreshAfterEnvSwitch()),this.workspace=new hR(e,()=>this.refreshAfterBundleSwitch()),this.scenarios=new ZP(e,this.tabs,this.targets,s),this.helpers=new IP(e),this.collections=new PP(e,this.targets),this.runs=new VP(e),this.historicRuns=new OP(e),this.runSources=new YP(e),this.runtimeSnapshots=new GP(e),this.activeRuns=new fB(e),this.queue=new qP(e),this.source=new nR(e),this.editorBridge=new zP,this.dsl=new AP(e),this.activityBar=new eE,this.theme=new mR,this.layout=new UP,this.annotations=new zM,this.terminal=new vR,this.breakpoints=new MP(e),this.variables=new EP(e),this.appServer=new NP(e),this.targetDoctor=new aR(e),this.snapshots=new tR(e),this.session=new QP(e),this.schedules=new YN(e),this.overview=new KP(this.scenarios,this.runs,this.activeRuns),$r(this,{},{autoBind:!0})}applyWorkspaceScope(){this.tabs.setScope(this.targets.active),this.scenarios.setScope(this.targets.active)}refreshAfterTargetSwitch(){this.applyWorkspaceScope(),this.source.invalidate(),this.scenarios.load(),this.helpers.load(),this.collections.load(),this.runs.load(),this.activeRuns.hydrateRunning(),this.breakpoints.load(),this.variables.load(),this.appServer.load(),this.dsl.reload(),this.targetDoctor.reset(),this.environments.load(),this.queue.load()}refreshAfterEnvSwitch(){this.variables.load(),this.runs.load(),this.activeRuns.hydrateRunning(),this.queue.load()}refreshAfterBundleSwitch(){this.scenarios.load(),this.helpers.load(),this.collections.load(),this.runs.load()}showScenarioHistory(e){this.activityBar.setSection("runs"),this.layout.openTree(),this.runs.setScenarioFilter(e)}init(){this.wsUnsubscribe=this.ws.onMessage(e=>this.dispatchWsMessage(e)),this.ws.connect(),this.targets.load().then(()=>this.applyWorkspaceScope()),this.scenarios.load(),this.helpers.load(),this.collections.load(),this.runs.load(),this.activeRuns.hydrateRunning(),this.breakpoints.load(),this.variables.load(),this.environments.load(),this.snapshots.load(),this.session.load().then(()=>this.session.loadEnvironments()),this.queue.load(),this.schedules.load(),this.workspace.start(),this.persistDisposers.push(gr(()=>{this.activeRuns.reconcileWithRuns(this.runs.items)}),gr(()=>{RM(this.activityBar.storageKey,this.activityBar.section)}),gr(()=>{RM(this.tabs.storageKey,this.tabs.toPersisted())}),gr(()=>{RM(this.scenarios.storageKey,{...this.scenarios.expanded})}),gr(()=>{RM(this.theme.storageKey,this.theme.mode)}),gr(()=>{RM(this.layout.storageKey,this.layout.toPersisted())}),gr(()=>{RM(this.annotations.storageKey,this.annotations.toPersisted())}),gr(()=>{RM(this.terminal.storageKey,this.terminal.toPersisted())}),gr(()=>{"undefined"!=typeof document&&document.documentElement.classList.toggle("dark","dark"===this.theme.theme)}))}insertPickedSnippet(e,t){const n=this.activeRuns.byRunId.get(e),s=null==n?void 0:n.pausedAt;let i,r;if(s&&null!==s.file)i=s.file,r=s.line;else{if("authoring"!==(null==n?void 0:n.mode)||!n.scenario)return;i=`${L_}/${this.targets.activeTestDir}/${n.scenario}.js`,r=null}this.source.getOrLoad(i).then(()=>{if(null===r)return void(this.editorBridge.insertAtCursor(i,t.snippet)||this.source.insertBeforeLastLine(i,t.snippet));if("cursor"===t.placement){if(this.editorBridge.insertAtCursor(i,t.snippet))return;return void this.source.insertAfterLine(i,r,t.snippet)}const e=this.appendCursor.get(i)??r;this.source.insertAfterLine(i,e,t.snippet),this.appendCursor.set(i,e+1)})}destroy(){var e;null==(e=this.wsUnsubscribe)||e.call(this),this.wsUnsubscribe=null,this.ws.disconnect(),this.appServer.destroy();for(const t of this.persistDisposers)t();this.persistDisposers=[]}dispatchWsMessage(e){switch(e.kind){case"fs:scenarios-changed":return this.source.invalidate(),void this.scenarios.load();case"fs:helpers-changed":return this.source.invalidate(),this.helpers.load(),void this.dsl.refreshHelpers();case"fs:collections-changed":return void this.collections.load();case"fs:bp-changed":return void this.breakpoints.load();case"queue:changed":return void this.queue.load();case"env:changed":return this.environments.load(),void this.refreshAfterEnvSwitch();case"fs:run-started":return this.activeRuns.applyWsMessage(e),void this.runs.load();case"fs:run-finished":return this.activeRuns.applyWsMessage(e),this.historicRuns.invalidate(e.runId),this.runtimeSnapshots.invalidate(e.runId),void this.runs.load();case"fs:run-step":return this.activeRuns.applyWsMessage(e),void("locator:picked"===e.event.kind&&this.insertPickedSnippet(e.runId,e.event));case"fs:collection-run-step":case"log:line":return void this.activeRuns.applyWsMessage(e);case"error":return void console.error("[viewer] server error:",e.message)}}}(bR,yR,wR);SR.init(),Zm(xR).render(Bn.jsx(C_.Provider,{value:SR,children:Bn.jsx(jP,{})}));export{by as I,BN as R,TN as _,xr as a,Bn as j,w_ as o,bn as r,j_ as u};
|
|
55
|
+
//# sourceMappingURL=index-MB6jm1R_.js.map
|