panopticon-cli 0.3.3 → 0.3.6

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.
@@ -0,0 +1,423 @@
1
+ var Vp=e=>{throw TypeError(e)};var iu=(e,t,r)=>t.has(e)||Vp("Cannot "+r);var N=(e,t,r)=>(iu(e,t,"read from private field"),r?r.call(e):t.get(e)),G=(e,t,r)=>t.has(e)?Vp("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Y=(e,t,r,i)=>(iu(e,t,"write to private field"),i?i.call(e,r):t.set(e,r),r),ae=(e,t,r)=>(iu(e,t,"access private method"),r);var Oa=(e,t,r,i)=>({set _(n){Y(e,t,n,r)},get _(){return N(e,t,i)}});(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))i(n);new MutationObserver(n=>{for(const s of n)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function r(n){const s={};return n.integrity&&(s.integrity=n.integrity),n.referrerPolicy&&(s.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?s.credentials="include":n.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(n){if(n.ep)return;n.ep=!0;const s=r(n);fetch(n.href,s)}})();var Fl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function bc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function aS(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var r=function i(){return this instanceof i?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(i){var n=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(r,i,n.get?n:{enumerable:!0,get:function(){return e[i]}})}),r}var R0={exports:{}},Cc={},D0={exports:{}},ue={};/**
2
+ * @license React
3
+ * react.production.min.js
4
+ *
5
+ * Copyright (c) Facebook, Inc. and its affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var ba=Symbol.for("react.element"),lS=Symbol.for("react.portal"),cS=Symbol.for("react.fragment"),uS=Symbol.for("react.strict_mode"),hS=Symbol.for("react.profiler"),dS=Symbol.for("react.provider"),fS=Symbol.for("react.context"),pS=Symbol.for("react.forward_ref"),mS=Symbol.for("react.suspense"),gS=Symbol.for("react.memo"),_S=Symbol.for("react.lazy"),Yp=Symbol.iterator;function vS(e){return e===null||typeof e!="object"?null:(e=Yp&&e[Yp]||e["@@iterator"],typeof e=="function"?e:null)}var L0={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},A0=Object.assign,O0={};function Gs(e,t,r){this.props=e,this.context=t,this.refs=O0,this.updater=r||L0}Gs.prototype.isReactComponent={};Gs.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Gs.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function B0(){}B0.prototype=Gs.prototype;function df(e,t,r){this.props=e,this.context=t,this.refs=O0,this.updater=r||L0}var ff=df.prototype=new B0;ff.constructor=df;A0(ff,Gs.prototype);ff.isPureReactComponent=!0;var Xp=Array.isArray,z0=Object.prototype.hasOwnProperty,pf={current:null},I0={key:!0,ref:!0,__self:!0,__source:!0};function F0(e,t,r){var i,n={},s=null,o=null;if(t!=null)for(i in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(s=""+t.key),t)z0.call(t,i)&&!I0.hasOwnProperty(i)&&(n[i]=t[i]);var a=arguments.length-2;if(a===1)n.children=r;else if(1<a){for(var u=Array(a),c=0;c<a;c++)u[c]=arguments[c+2];n.children=u}if(e&&e.defaultProps)for(i in a=e.defaultProps,a)n[i]===void 0&&(n[i]=a[i]);return{$$typeof:ba,type:e,key:s,ref:o,props:n,_owner:pf.current}}function yS(e,t){return{$$typeof:ba,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function mf(e){return typeof e=="object"&&e!==null&&e.$$typeof===ba}function xS(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(r){return t[r]})}var Qp=/\/+/g;function nu(e,t){return typeof e=="object"&&e!==null&&e.key!=null?xS(""+e.key):t.toString(36)}function _l(e,t,r,i,n){var s=typeof e;(s==="undefined"||s==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(s){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case ba:case lS:o=!0}}if(o)return o=e,n=n(o),e=i===""?"."+nu(o,0):i,Xp(n)?(r="",e!=null&&(r=e.replace(Qp,"$&/")+"/"),_l(n,t,r,"",function(c){return c})):n!=null&&(mf(n)&&(n=yS(n,r+(!n.key||o&&o.key===n.key?"":(""+n.key).replace(Qp,"$&/")+"/")+e)),t.push(n)),1;if(o=0,i=i===""?".":i+":",Xp(e))for(var a=0;a<e.length;a++){s=e[a];var u=i+nu(s,a);o+=_l(s,t,r,u,n)}else if(u=vS(e),typeof u=="function")for(e=u.call(e),a=0;!(s=e.next()).done;)s=s.value,u=i+nu(s,a++),o+=_l(s,t,r,u,n);else if(s==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return o}function Ba(e,t,r){if(e==null)return e;var i=[],n=0;return _l(e,i,"","",function(s){return t.call(r,s,n++)}),i}function wS(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(r){(e._status===0||e._status===-1)&&(e._status=1,e._result=r)},function(r){(e._status===0||e._status===-1)&&(e._status=2,e._result=r)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Mt={current:null},vl={transition:null},SS={ReactCurrentDispatcher:Mt,ReactCurrentBatchConfig:vl,ReactCurrentOwner:pf};function H0(){throw Error("act(...) is not supported in production builds of React.")}ue.Children={map:Ba,forEach:function(e,t,r){Ba(e,function(){t.apply(this,arguments)},r)},count:function(e){var t=0;return Ba(e,function(){t++}),t},toArray:function(e){return Ba(e,function(t){return t})||[]},only:function(e){if(!mf(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};ue.Component=Gs;ue.Fragment=cS;ue.Profiler=hS;ue.PureComponent=df;ue.StrictMode=uS;ue.Suspense=mS;ue.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=SS;ue.act=H0;ue.cloneElement=function(e,t,r){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var i=A0({},e.props),n=e.key,s=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(s=t.ref,o=pf.current),t.key!==void 0&&(n=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(u in t)z0.call(t,u)&&!I0.hasOwnProperty(u)&&(i[u]=t[u]===void 0&&a!==void 0?a[u]:t[u])}var u=arguments.length-2;if(u===1)i.children=r;else if(1<u){a=Array(u);for(var c=0;c<u;c++)a[c]=arguments[c+2];i.children=a}return{$$typeof:ba,type:e.type,key:n,ref:s,props:i,_owner:o}};ue.createContext=function(e){return e={$$typeof:fS,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:dS,_context:e},e.Consumer=e};ue.createElement=F0;ue.createFactory=function(e){var t=F0.bind(null,e);return t.type=e,t};ue.createRef=function(){return{current:null}};ue.forwardRef=function(e){return{$$typeof:pS,render:e}};ue.isValidElement=mf;ue.lazy=function(e){return{$$typeof:_S,_payload:{_status:-1,_result:e},_init:wS}};ue.memo=function(e,t){return{$$typeof:gS,type:e,compare:t===void 0?null:t}};ue.startTransition=function(e){var t=vl.transition;vl.transition={};try{e()}finally{vl.transition=t}};ue.unstable_act=H0;ue.useCallback=function(e,t){return Mt.current.useCallback(e,t)};ue.useContext=function(e){return Mt.current.useContext(e)};ue.useDebugValue=function(){};ue.useDeferredValue=function(e){return Mt.current.useDeferredValue(e)};ue.useEffect=function(e,t){return Mt.current.useEffect(e,t)};ue.useId=function(){return Mt.current.useId()};ue.useImperativeHandle=function(e,t,r){return Mt.current.useImperativeHandle(e,t,r)};ue.useInsertionEffect=function(e,t){return Mt.current.useInsertionEffect(e,t)};ue.useLayoutEffect=function(e,t){return Mt.current.useLayoutEffect(e,t)};ue.useMemo=function(e,t){return Mt.current.useMemo(e,t)};ue.useReducer=function(e,t,r){return Mt.current.useReducer(e,t,r)};ue.useRef=function(e){return Mt.current.useRef(e)};ue.useState=function(e){return Mt.current.useState(e)};ue.useSyncExternalStore=function(e,t,r){return Mt.current.useSyncExternalStore(e,t,r)};ue.useTransition=function(){return Mt.current.useTransition()};ue.version="18.3.1";D0.exports=ue;var F=D0.exports;const bS=bc(F);/**
10
+ * @license React
11
+ * react-jsx-runtime.production.min.js
12
+ *
13
+ * Copyright (c) Facebook, Inc. and its affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var CS=F,kS=Symbol.for("react.element"),NS=Symbol.for("react.fragment"),ES=Object.prototype.hasOwnProperty,jS=CS.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,PS={key:!0,ref:!0,__self:!0,__source:!0};function $0(e,t,r){var i,n={},s=null,o=null;r!==void 0&&(s=""+r),t.key!==void 0&&(s=""+t.key),t.ref!==void 0&&(o=t.ref);for(i in t)ES.call(t,i)&&!PS.hasOwnProperty(i)&&(n[i]=t[i]);if(e&&e.defaultProps)for(i in t=e.defaultProps,t)n[i]===void 0&&(n[i]=t[i]);return{$$typeof:kS,type:e,key:s,ref:o,props:n,_owner:jS.current}}Cc.Fragment=NS;Cc.jsx=$0;Cc.jsxs=$0;R0.exports=Cc;var l=R0.exports,sh={},W0={exports:{}},ir={},U0={exports:{}},K0={};/**
18
+ * @license React
19
+ * scheduler.production.min.js
20
+ *
21
+ * Copyright (c) Facebook, Inc. and its affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */(function(e){function t(T,$){var w=T.length;T.push($);e:for(;0<w;){var Z=w-1>>>1,ne=T[Z];if(0<n(ne,$))T[Z]=$,T[w]=ne,w=Z;else break e}}function r(T){return T.length===0?null:T[0]}function i(T){if(T.length===0)return null;var $=T[0],w=T.pop();if(w!==$){T[0]=w;e:for(var Z=0,ne=T.length,S=ne>>>1;Z<S;){var H=2*(Z+1)-1,ee=T[H],ie=H+1,We=T[ie];if(0>n(ee,w))ie<ne&&0>n(We,ee)?(T[Z]=We,T[ie]=w,Z=ie):(T[Z]=ee,T[H]=w,Z=H);else if(ie<ne&&0>n(We,w))T[Z]=We,T[ie]=w,Z=ie;else break e}}return $}function n(T,$){var w=T.sortIndex-$.sortIndex;return w!==0?w:T.id-$.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();e.unstable_now=function(){return o.now()-a}}var u=[],c=[],h=1,d=null,f=3,p=!1,m=!1,y=!1,C=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function v(T){for(var $=r(c);$!==null;){if($.callback===null)i(c);else if($.startTime<=T)i(c),$.sortIndex=$.expirationTime,t(u,$);else break;$=r(c)}}function x(T){if(y=!1,v(T),!m)if(r(u)!==null)m=!0,A(k);else{var $=r(c);$!==null&&U(x,$.startTime-T)}}function k(T,$){m=!1,y&&(y=!1,g(L),L=-1),p=!0;var w=f;try{for(v($),d=r(u);d!==null&&(!(d.expirationTime>$)||T&&!D());){var Z=d.callback;if(typeof Z=="function"){d.callback=null,f=d.priorityLevel;var ne=Z(d.expirationTime<=$);$=e.unstable_now(),typeof ne=="function"?d.callback=ne:d===r(u)&&i(u),v($)}else i(u);d=r(u)}if(d!==null)var S=!0;else{var H=r(c);H!==null&&U(x,H.startTime-$),S=!1}return S}finally{d=null,f=w,p=!1}}var b=!1,j=null,L=-1,I=5,P=-1;function D(){return!(e.unstable_now()-P<I)}function M(){if(j!==null){var T=e.unstable_now();P=T;var $=!0;try{$=j(!0,T)}finally{$?R():(b=!1,j=null)}}else b=!1}var R;if(typeof _=="function")R=function(){_(M)};else if(typeof MessageChannel<"u"){var O=new MessageChannel,E=O.port2;O.port1.onmessage=M,R=function(){E.postMessage(null)}}else R=function(){C(M,0)};function A(T){j=T,b||(b=!0,R())}function U(T,$){L=C(function(){T(e.unstable_now())},$)}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(T){T.callback=null},e.unstable_continueExecution=function(){m||p||(m=!0,A(k))},e.unstable_forceFrameRate=function(T){0>T||125<T?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<T?Math.floor(1e3/T):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return r(u)},e.unstable_next=function(T){switch(f){case 1:case 2:case 3:var $=3;break;default:$=f}var w=f;f=$;try{return T()}finally{f=w}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(T,$){switch(T){case 1:case 2:case 3:case 4:case 5:break;default:T=3}var w=f;f=T;try{return $()}finally{f=w}},e.unstable_scheduleCallback=function(T,$,w){var Z=e.unstable_now();switch(typeof w=="object"&&w!==null?(w=w.delay,w=typeof w=="number"&&0<w?Z+w:Z):w=Z,T){case 1:var ne=-1;break;case 2:ne=250;break;case 5:ne=1073741823;break;case 4:ne=1e4;break;default:ne=5e3}return ne=w+ne,T={id:h++,callback:$,priorityLevel:T,startTime:w,expirationTime:ne,sortIndex:-1},w>Z?(T.sortIndex=w,t(c,T),r(u)===null&&T===r(c)&&(y?(g(L),L=-1):y=!0,U(x,w-Z))):(T.sortIndex=ne,t(u,T),m||p||(m=!0,A(k))),T},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(T){var $=f;return function(){var w=f;f=$;try{return T.apply(this,arguments)}finally{f=w}}}})(K0);U0.exports=K0;var MS=U0.exports;/**
26
+ * @license React
27
+ * react-dom.production.min.js
28
+ *
29
+ * Copyright (c) Facebook, Inc. and its affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */var TS=F,rr=MS;function W(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r]);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 q0=new Set,Qo={};function Qn(e,t){$s(e,t),$s(e+"Capture",t)}function $s(e,t){for(Qo[e]=t,e=0;e<t.length;e++)q0.add(t[e])}var vi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),oh=Object.prototype.hasOwnProperty,RS=/^[: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]*$/,Gp={},Jp={};function DS(e){return oh.call(Jp,e)?!0:oh.call(Gp,e)?!1:RS.test(e)?Jp[e]=!0:(Gp[e]=!0,!1)}function LS(e,t,r,i){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return i?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function AS(e,t,r,i){if(t===null||typeof t>"u"||LS(e,t,r,i))return!0;if(i)return!1;if(r!==null)switch(r.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Tt(e,t,r,i,n,s,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=i,this.attributeNamespace=n,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=o}var pt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){pt[e]=new Tt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];pt[t]=new Tt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){pt[e]=new Tt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){pt[e]=new Tt(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){pt[e]=new Tt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){pt[e]=new Tt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){pt[e]=new Tt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){pt[e]=new Tt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){pt[e]=new Tt(e,5,!1,e.toLowerCase(),null,!1,!1)});var gf=/[\-:]([a-z])/g;function _f(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(gf,_f);pt[t]=new Tt(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(gf,_f);pt[t]=new Tt(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(gf,_f);pt[t]=new Tt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){pt[e]=new Tt(e,1,!1,e.toLowerCase(),null,!1,!1)});pt.xlinkHref=new Tt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){pt[e]=new Tt(e,1,!1,e.toLowerCase(),null,!0,!0)});function vf(e,t,r,i){var n=pt.hasOwnProperty(t)?pt[t]:null;(n!==null?n.type!==0:i||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(AS(t,r,n,i)&&(r=null),i||n===null?DS(t)&&(r===null?e.removeAttribute(t):e.setAttribute(t,""+r)):n.mustUseProperty?e[n.propertyName]=r===null?n.type===3?!1:"":r:(t=n.attributeName,i=n.attributeNamespace,r===null?e.removeAttribute(t):(n=n.type,r=n===3||n===4&&r===!0?"":""+r,i?e.setAttributeNS(i,t,r):e.setAttribute(t,r))))}var Si=TS.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,za=Symbol.for("react.element"),as=Symbol.for("react.portal"),ls=Symbol.for("react.fragment"),yf=Symbol.for("react.strict_mode"),ah=Symbol.for("react.profiler"),V0=Symbol.for("react.provider"),Y0=Symbol.for("react.context"),xf=Symbol.for("react.forward_ref"),lh=Symbol.for("react.suspense"),ch=Symbol.for("react.suspense_list"),wf=Symbol.for("react.memo"),Di=Symbol.for("react.lazy"),X0=Symbol.for("react.offscreen"),Zp=Symbol.iterator;function lo(e){return e===null||typeof e!="object"?null:(e=Zp&&e[Zp]||e["@@iterator"],typeof e=="function"?e:null)}var Ae=Object.assign,su;function Eo(e){if(su===void 0)try{throw Error()}catch(r){var t=r.stack.trim().match(/\n( *(at )?)/);su=t&&t[1]||""}return`
34
+ `+su+e}var ou=!1;function au(e,t){if(!e||ou)return"";ou=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(c){var i=c}Reflect.construct(e,[],t)}else{try{t.call()}catch(c){i=c}e.call(t.prototype)}else{try{throw Error()}catch(c){i=c}e()}}catch(c){if(c&&i&&typeof c.stack=="string"){for(var n=c.stack.split(`
35
+ `),s=i.stack.split(`
36
+ `),o=n.length-1,a=s.length-1;1<=o&&0<=a&&n[o]!==s[a];)a--;for(;1<=o&&0<=a;o--,a--)if(n[o]!==s[a]){if(o!==1||a!==1)do if(o--,a--,0>a||n[o]!==s[a]){var u=`
37
+ `+n[o].replace(" at new "," at ");return e.displayName&&u.includes("<anonymous>")&&(u=u.replace("<anonymous>",e.displayName)),u}while(1<=o&&0<=a);break}}}finally{ou=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?Eo(e):""}function OS(e){switch(e.tag){case 5:return Eo(e.type);case 16:return Eo("Lazy");case 13:return Eo("Suspense");case 19:return Eo("SuspenseList");case 0:case 2:case 15:return e=au(e.type,!1),e;case 11:return e=au(e.type.render,!1),e;case 1:return e=au(e.type,!0),e;default:return""}}function uh(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case ls:return"Fragment";case as:return"Portal";case ah:return"Profiler";case yf:return"StrictMode";case lh:return"Suspense";case ch:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Y0:return(e.displayName||"Context")+".Consumer";case V0:return(e._context.displayName||"Context")+".Provider";case xf:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case wf:return t=e.displayName||null,t!==null?t:uh(e.type)||"Memo";case Di:t=e._payload,e=e._init;try{return uh(e(t))}catch{}}return null}function BS(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=t.render,e=e.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 uh(t);case 8:return t===yf?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function an(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Q0(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function zS(e){var t=Q0(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),i=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var n=r.get,s=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return n.call(this)},set:function(o){i=""+o,s.call(this,o)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return i},setValue:function(o){i=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ia(e){e._valueTracker||(e._valueTracker=zS(e))}function G0(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),i="";return e&&(i=Q0(e)?e.checked?"true":"false":e.value),e=i,e!==r?(t.setValue(e),!0):!1}function Hl(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function hh(e,t){var r=t.checked;return Ae({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function em(e,t){var r=t.defaultValue==null?"":t.defaultValue,i=t.checked!=null?t.checked:t.defaultChecked;r=an(t.value!=null?t.value:r),e._wrapperState={initialChecked:i,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function J0(e,t){t=t.checked,t!=null&&vf(e,"checked",t,!1)}function dh(e,t){J0(e,t);var r=an(t.value),i=t.type;if(r!=null)i==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(i==="submit"||i==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?fh(e,t.type,r):t.hasOwnProperty("defaultValue")&&fh(e,t.type,an(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function tm(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var i=t.type;if(!(i!=="submit"&&i!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function fh(e,t,r){(t!=="number"||Hl(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var jo=Array.isArray;function Ss(e,t,r,i){if(e=e.options,t){t={};for(var n=0;n<r.length;n++)t["$"+r[n]]=!0;for(r=0;r<e.length;r++)n=t.hasOwnProperty("$"+e[r].value),e[r].selected!==n&&(e[r].selected=n),n&&i&&(e[r].defaultSelected=!0)}else{for(r=""+an(r),t=null,n=0;n<e.length;n++){if(e[n].value===r){e[n].selected=!0,i&&(e[n].defaultSelected=!0);return}t!==null||e[n].disabled||(t=e[n])}t!==null&&(t.selected=!0)}}function ph(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(W(91));return Ae({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function rm(e,t){var r=t.value;if(r==null){if(r=t.children,t=t.defaultValue,r!=null){if(t!=null)throw Error(W(92));if(jo(r)){if(1<r.length)throw Error(W(93));r=r[0]}t=r}t==null&&(t=""),r=t}e._wrapperState={initialValue:an(r)}}function Z0(e,t){var r=an(t.value),i=an(t.defaultValue);r!=null&&(r=""+r,r!==e.value&&(e.value=r),t.defaultValue==null&&e.defaultValue!==r&&(e.defaultValue=r)),i!=null&&(e.defaultValue=""+i)}function im(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function ev(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 mh(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?ev(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Fa,tv=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,r,i,n){MSApp.execUnsafeLocalFunction(function(){return e(t,r,i,n)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Fa=Fa||document.createElement("div"),Fa.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Fa.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Go(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var Bo={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},IS=["Webkit","ms","Moz","O"];Object.keys(Bo).forEach(function(e){IS.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Bo[t]=Bo[e]})});function rv(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||Bo.hasOwnProperty(e)&&Bo[e]?(""+t).trim():t+"px"}function iv(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var i=r.indexOf("--")===0,n=rv(r,t[r],i);r==="float"&&(r="cssFloat"),i?e.setProperty(r,n):e[r]=n}}var FS=Ae({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 gh(e,t){if(t){if(FS[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(W(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(W(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(W(61))}if(t.style!=null&&typeof t.style!="object")throw Error(W(62))}}function _h(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";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 vh=null;function Sf(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var yh=null,bs=null,Cs=null;function nm(e){if(e=Na(e)){if(typeof yh!="function")throw Error(W(280));var t=e.stateNode;t&&(t=Pc(t),yh(e.stateNode,e.type,t))}}function nv(e){bs?Cs?Cs.push(e):Cs=[e]:bs=e}function sv(){if(bs){var e=bs,t=Cs;if(Cs=bs=null,nm(e),t)for(e=0;e<t.length;e++)nm(t[e])}}function ov(e,t){return e(t)}function av(){}var lu=!1;function lv(e,t,r){if(lu)return e(t,r);lu=!0;try{return ov(e,t,r)}finally{lu=!1,(bs!==null||Cs!==null)&&(av(),sv())}}function Jo(e,t){var r=e.stateNode;if(r===null)return null;var i=Pc(r);if(i===null)return null;r=i[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":(i=!i.disabled)||(e=e.type,i=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!i;break e;default:e=!1}if(e)return null;if(r&&typeof r!="function")throw Error(W(231,t,typeof r));return r}var xh=!1;if(vi)try{var co={};Object.defineProperty(co,"passive",{get:function(){xh=!0}}),window.addEventListener("test",co,co),window.removeEventListener("test",co,co)}catch{xh=!1}function HS(e,t,r,i,n,s,o,a,u){var c=Array.prototype.slice.call(arguments,3);try{t.apply(r,c)}catch(h){this.onError(h)}}var zo=!1,$l=null,Wl=!1,wh=null,$S={onError:function(e){zo=!0,$l=e}};function WS(e,t,r,i,n,s,o,a,u){zo=!1,$l=null,HS.apply($S,arguments)}function US(e,t,r,i,n,s,o,a,u){if(WS.apply(this,arguments),zo){if(zo){var c=$l;zo=!1,$l=null}else throw Error(W(198));Wl||(Wl=!0,wh=c)}}function Gn(e){var t=e,r=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(r=t.return),e=t.return;while(e)}return t.tag===3?r:null}function cv(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function sm(e){if(Gn(e)!==e)throw Error(W(188))}function KS(e){var t=e.alternate;if(!t){if(t=Gn(e),t===null)throw Error(W(188));return t!==e?null:e}for(var r=e,i=t;;){var n=r.return;if(n===null)break;var s=n.alternate;if(s===null){if(i=n.return,i!==null){r=i;continue}break}if(n.child===s.child){for(s=n.child;s;){if(s===r)return sm(n),e;if(s===i)return sm(n),t;s=s.sibling}throw Error(W(188))}if(r.return!==i.return)r=n,i=s;else{for(var o=!1,a=n.child;a;){if(a===r){o=!0,r=n,i=s;break}if(a===i){o=!0,i=n,r=s;break}a=a.sibling}if(!o){for(a=s.child;a;){if(a===r){o=!0,r=s,i=n;break}if(a===i){o=!0,i=s,r=n;break}a=a.sibling}if(!o)throw Error(W(189))}}if(r.alternate!==i)throw Error(W(190))}if(r.tag!==3)throw Error(W(188));return r.stateNode.current===r?e:t}function uv(e){return e=KS(e),e!==null?hv(e):null}function hv(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=hv(e);if(t!==null)return t;e=e.sibling}return null}var dv=rr.unstable_scheduleCallback,om=rr.unstable_cancelCallback,qS=rr.unstable_shouldYield,VS=rr.unstable_requestPaint,$e=rr.unstable_now,YS=rr.unstable_getCurrentPriorityLevel,bf=rr.unstable_ImmediatePriority,fv=rr.unstable_UserBlockingPriority,Ul=rr.unstable_NormalPriority,XS=rr.unstable_LowPriority,pv=rr.unstable_IdlePriority,kc=null,Qr=null;function QS(e){if(Qr&&typeof Qr.onCommitFiberRoot=="function")try{Qr.onCommitFiberRoot(kc,e,void 0,(e.current.flags&128)===128)}catch{}}var Tr=Math.clz32?Math.clz32:ZS,GS=Math.log,JS=Math.LN2;function ZS(e){return e>>>=0,e===0?32:31-(GS(e)/JS|0)|0}var Ha=64,$a=4194304;function Po(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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Kl(e,t){var r=e.pendingLanes;if(r===0)return 0;var i=0,n=e.suspendedLanes,s=e.pingedLanes,o=r&268435455;if(o!==0){var a=o&~n;a!==0?i=Po(a):(s&=o,s!==0&&(i=Po(s)))}else o=r&~n,o!==0?i=Po(o):s!==0&&(i=Po(s));if(i===0)return 0;if(t!==0&&t!==i&&!(t&n)&&(n=i&-i,s=t&-t,n>=s||n===16&&(s&4194240)!==0))return t;if(i&4&&(i|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=i;0<t;)r=31-Tr(t),n=1<<r,i|=e[r],t&=~n;return i}function e1(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;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function t1(e,t){for(var r=e.suspendedLanes,i=e.pingedLanes,n=e.expirationTimes,s=e.pendingLanes;0<s;){var o=31-Tr(s),a=1<<o,u=n[o];u===-1?(!(a&r)||a&i)&&(n[o]=e1(a,t)):u<=t&&(e.expiredLanes|=a),s&=~a}}function Sh(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function mv(){var e=Ha;return Ha<<=1,!(Ha&4194240)&&(Ha=64),e}function cu(e){for(var t=[],r=0;31>r;r++)t.push(e);return t}function Ca(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Tr(t),e[t]=r}function r1(e,t){var r=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 i=e.eventTimes;for(e=e.expirationTimes;0<r;){var n=31-Tr(r),s=1<<n;t[n]=0,i[n]=-1,e[n]=-1,r&=~s}}function Cf(e,t){var r=e.entangledLanes|=t;for(e=e.entanglements;r;){var i=31-Tr(r),n=1<<i;n&t|e[i]&t&&(e[i]|=t),r&=~n}}var _e=0;function gv(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var _v,kf,vv,yv,xv,bh=!1,Wa=[],Qi=null,Gi=null,Ji=null,Zo=new Map,ea=new Map,Oi=[],i1="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 am(e,t){switch(e){case"focusin":case"focusout":Qi=null;break;case"dragenter":case"dragleave":Gi=null;break;case"mouseover":case"mouseout":Ji=null;break;case"pointerover":case"pointerout":Zo.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ea.delete(t.pointerId)}}function uo(e,t,r,i,n,s){return e===null||e.nativeEvent!==s?(e={blockedOn:t,domEventName:r,eventSystemFlags:i,nativeEvent:s,targetContainers:[n]},t!==null&&(t=Na(t),t!==null&&kf(t)),e):(e.eventSystemFlags|=i,t=e.targetContainers,n!==null&&t.indexOf(n)===-1&&t.push(n),e)}function n1(e,t,r,i,n){switch(t){case"focusin":return Qi=uo(Qi,e,t,r,i,n),!0;case"dragenter":return Gi=uo(Gi,e,t,r,i,n),!0;case"mouseover":return Ji=uo(Ji,e,t,r,i,n),!0;case"pointerover":var s=n.pointerId;return Zo.set(s,uo(Zo.get(s)||null,e,t,r,i,n)),!0;case"gotpointercapture":return s=n.pointerId,ea.set(s,uo(ea.get(s)||null,e,t,r,i,n)),!0}return!1}function wv(e){var t=bn(e.target);if(t!==null){var r=Gn(t);if(r!==null){if(t=r.tag,t===13){if(t=cv(r),t!==null){e.blockedOn=t,xv(e.priority,function(){vv(r)});return}}else if(t===3&&r.stateNode.current.memoizedState.isDehydrated){e.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}e.blockedOn=null}function yl(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var r=Ch(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(r===null){r=e.nativeEvent;var i=new r.constructor(r.type,r);vh=i,r.target.dispatchEvent(i),vh=null}else return t=Na(r),t!==null&&kf(t),e.blockedOn=r,!1;t.shift()}return!0}function lm(e,t,r){yl(e)&&r.delete(t)}function s1(){bh=!1,Qi!==null&&yl(Qi)&&(Qi=null),Gi!==null&&yl(Gi)&&(Gi=null),Ji!==null&&yl(Ji)&&(Ji=null),Zo.forEach(lm),ea.forEach(lm)}function ho(e,t){e.blockedOn===t&&(e.blockedOn=null,bh||(bh=!0,rr.unstable_scheduleCallback(rr.unstable_NormalPriority,s1)))}function ta(e){function t(n){return ho(n,e)}if(0<Wa.length){ho(Wa[0],e);for(var r=1;r<Wa.length;r++){var i=Wa[r];i.blockedOn===e&&(i.blockedOn=null)}}for(Qi!==null&&ho(Qi,e),Gi!==null&&ho(Gi,e),Ji!==null&&ho(Ji,e),Zo.forEach(t),ea.forEach(t),r=0;r<Oi.length;r++)i=Oi[r],i.blockedOn===e&&(i.blockedOn=null);for(;0<Oi.length&&(r=Oi[0],r.blockedOn===null);)wv(r),r.blockedOn===null&&Oi.shift()}var ks=Si.ReactCurrentBatchConfig,ql=!0;function o1(e,t,r,i){var n=_e,s=ks.transition;ks.transition=null;try{_e=1,Nf(e,t,r,i)}finally{_e=n,ks.transition=s}}function a1(e,t,r,i){var n=_e,s=ks.transition;ks.transition=null;try{_e=4,Nf(e,t,r,i)}finally{_e=n,ks.transition=s}}function Nf(e,t,r,i){if(ql){var n=Ch(e,t,r,i);if(n===null)yu(e,t,i,Vl,r),am(e,i);else if(n1(n,e,t,r,i))i.stopPropagation();else if(am(e,i),t&4&&-1<i1.indexOf(e)){for(;n!==null;){var s=Na(n);if(s!==null&&_v(s),s=Ch(e,t,r,i),s===null&&yu(e,t,i,Vl,r),s===n)break;n=s}n!==null&&i.stopPropagation()}else yu(e,t,i,null,r)}}var Vl=null;function Ch(e,t,r,i){if(Vl=null,e=Sf(i),e=bn(e),e!==null)if(t=Gn(e),t===null)e=null;else if(r=t.tag,r===13){if(e=cv(t),e!==null)return e;e=null}else if(r===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Vl=e,null}function Sv(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(YS()){case bf:return 1;case fv:return 4;case Ul:case XS:return 16;case pv:return 536870912;default:return 16}default:return 16}}var Vi=null,Ef=null,xl=null;function bv(){if(xl)return xl;var e,t=Ef,r=t.length,i,n="value"in Vi?Vi.value:Vi.textContent,s=n.length;for(e=0;e<r&&t[e]===n[e];e++);var o=r-e;for(i=1;i<=o&&t[r-i]===n[s-i];i++);return xl=n.slice(e,1<i?1-i:void 0)}function wl(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Ua(){return!0}function cm(){return!1}function nr(e){function t(r,i,n,s,o){this._reactName=r,this._targetInst=n,this.type=i,this.nativeEvent=s,this.target=o,this.currentTarget=null;for(var a in e)e.hasOwnProperty(a)&&(r=e[a],this[a]=r?r(s):s[a]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?Ua:cm,this.isPropagationStopped=cm,this}return Ae(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=Ua)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=Ua)},persist:function(){},isPersistent:Ua}),t}var Js={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},jf=nr(Js),ka=Ae({},Js,{view:0,detail:0}),l1=nr(ka),uu,hu,fo,Nc=Ae({},ka,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Pf,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==fo&&(fo&&e.type==="mousemove"?(uu=e.screenX-fo.screenX,hu=e.screenY-fo.screenY):hu=uu=0,fo=e),uu)},movementY:function(e){return"movementY"in e?e.movementY:hu}}),um=nr(Nc),c1=Ae({},Nc,{dataTransfer:0}),u1=nr(c1),h1=Ae({},ka,{relatedTarget:0}),du=nr(h1),d1=Ae({},Js,{animationName:0,elapsedTime:0,pseudoElement:0}),f1=nr(d1),p1=Ae({},Js,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),m1=nr(p1),g1=Ae({},Js,{data:0}),hm=nr(g1),_1={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},v1={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"},y1={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function x1(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=y1[e])?!!t[e]:!1}function Pf(){return x1}var w1=Ae({},ka,{key:function(e){if(e.key){var t=_1[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=wl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?v1[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Pf,charCode:function(e){return e.type==="keypress"?wl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?wl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),S1=nr(w1),b1=Ae({},Nc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),dm=nr(b1),C1=Ae({},ka,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Pf}),k1=nr(C1),N1=Ae({},Js,{propertyName:0,elapsedTime:0,pseudoElement:0}),E1=nr(N1),j1=Ae({},Nc,{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}),P1=nr(j1),M1=[9,13,27,32],Mf=vi&&"CompositionEvent"in window,Io=null;vi&&"documentMode"in document&&(Io=document.documentMode);var T1=vi&&"TextEvent"in window&&!Io,Cv=vi&&(!Mf||Io&&8<Io&&11>=Io),fm=" ",pm=!1;function kv(e,t){switch(e){case"keyup":return M1.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Nv(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var cs=!1;function R1(e,t){switch(e){case"compositionend":return Nv(t);case"keypress":return t.which!==32?null:(pm=!0,fm);case"textInput":return e=t.data,e===fm&&pm?null:e;default:return null}}function D1(e,t){if(cs)return e==="compositionend"||!Mf&&kv(e,t)?(e=bv(),xl=Ef=Vi=null,cs=!1,e):null;switch(e){case"paste":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 Cv&&t.locale!=="ko"?null:t.data;default:return null}}var L1={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 mm(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!L1[e.type]:t==="textarea"}function Ev(e,t,r,i){nv(i),t=Yl(t,"onChange"),0<t.length&&(r=new jf("onChange","change",null,r,i),e.push({event:r,listeners:t}))}var Fo=null,ra=null;function A1(e){zv(e,0)}function Ec(e){var t=ds(e);if(G0(t))return e}function O1(e,t){if(e==="change")return t}var jv=!1;if(vi){var fu;if(vi){var pu="oninput"in document;if(!pu){var gm=document.createElement("div");gm.setAttribute("oninput","return;"),pu=typeof gm.oninput=="function"}fu=pu}else fu=!1;jv=fu&&(!document.documentMode||9<document.documentMode)}function _m(){Fo&&(Fo.detachEvent("onpropertychange",Pv),ra=Fo=null)}function Pv(e){if(e.propertyName==="value"&&Ec(ra)){var t=[];Ev(t,ra,e,Sf(e)),lv(A1,t)}}function B1(e,t,r){e==="focusin"?(_m(),Fo=t,ra=r,Fo.attachEvent("onpropertychange",Pv)):e==="focusout"&&_m()}function z1(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ec(ra)}function I1(e,t){if(e==="click")return Ec(t)}function F1(e,t){if(e==="input"||e==="change")return Ec(t)}function H1(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Dr=typeof Object.is=="function"?Object.is:H1;function ia(e,t){if(Dr(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;for(i=0;i<r.length;i++){var n=r[i];if(!oh.call(t,n)||!Dr(e[n],t[n]))return!1}return!0}function vm(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function ym(e,t){var r=vm(e);e=0;for(var i;r;){if(r.nodeType===3){if(i=e+r.textContent.length,e<=t&&i>=t)return{node:r,offset:t-e};e=i}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=vm(r)}}function Mv(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Mv(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Tv(){for(var e=window,t=Hl();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=Hl(e.document)}return t}function Tf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function $1(e){var t=Tv(),r=e.focusedElem,i=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&Mv(r.ownerDocument.documentElement,r)){if(i!==null&&Tf(r)){if(t=i.start,e=i.end,e===void 0&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var n=r.textContent.length,s=Math.min(i.start,n);i=i.end===void 0?s:Math.min(i.end,n),!e.extend&&s>i&&(n=i,i=s,s=n),n=ym(r,s);var o=ym(r,i);n&&o&&(e.rangeCount!==1||e.anchorNode!==n.node||e.anchorOffset!==n.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(n.node,n.offset),e.removeAllRanges(),s>i?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r<t.length;r++)e=t[r],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var W1=vi&&"documentMode"in document&&11>=document.documentMode,us=null,kh=null,Ho=null,Nh=!1;function xm(e,t,r){var i=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Nh||us==null||us!==Hl(i)||(i=us,"selectionStart"in i&&Tf(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),Ho&&ia(Ho,i)||(Ho=i,i=Yl(kh,"onSelect"),0<i.length&&(t=new jf("onSelect","select",null,t,r),e.push({event:t,listeners:i}),t.target=us)))}function Ka(e,t){var r={};return r[e.toLowerCase()]=t.toLowerCase(),r["Webkit"+e]="webkit"+t,r["Moz"+e]="moz"+t,r}var hs={animationend:Ka("Animation","AnimationEnd"),animationiteration:Ka("Animation","AnimationIteration"),animationstart:Ka("Animation","AnimationStart"),transitionend:Ka("Transition","TransitionEnd")},mu={},Rv={};vi&&(Rv=document.createElement("div").style,"AnimationEvent"in window||(delete hs.animationend.animation,delete hs.animationiteration.animation,delete hs.animationstart.animation),"TransitionEvent"in window||delete hs.transitionend.transition);function jc(e){if(mu[e])return mu[e];if(!hs[e])return e;var t=hs[e],r;for(r in t)if(t.hasOwnProperty(r)&&r in Rv)return mu[e]=t[r];return e}var Dv=jc("animationend"),Lv=jc("animationiteration"),Av=jc("animationstart"),Ov=jc("transitionend"),Bv=new Map,wm="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 un(e,t){Bv.set(e,t),Qn(t,[e])}for(var gu=0;gu<wm.length;gu++){var _u=wm[gu],U1=_u.toLowerCase(),K1=_u[0].toUpperCase()+_u.slice(1);un(U1,"on"+K1)}un(Dv,"onAnimationEnd");un(Lv,"onAnimationIteration");un(Av,"onAnimationStart");un("dblclick","onDoubleClick");un("focusin","onFocus");un("focusout","onBlur");un(Ov,"onTransitionEnd");$s("onMouseEnter",["mouseout","mouseover"]);$s("onMouseLeave",["mouseout","mouseover"]);$s("onPointerEnter",["pointerout","pointerover"]);$s("onPointerLeave",["pointerout","pointerover"]);Qn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Qn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Qn("onBeforeInput",["compositionend","keypress","textInput","paste"]);Qn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Qn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Qn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Mo="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(" "),q1=new Set("cancel close invalid load scroll toggle".split(" ").concat(Mo));function Sm(e,t,r){var i=e.type||"unknown-event";e.currentTarget=r,US(i,t,void 0,e),e.currentTarget=null}function zv(e,t){t=(t&4)!==0;for(var r=0;r<e.length;r++){var i=e[r],n=i.event;i=i.listeners;e:{var s=void 0;if(t)for(var o=i.length-1;0<=o;o--){var a=i[o],u=a.instance,c=a.currentTarget;if(a=a.listener,u!==s&&n.isPropagationStopped())break e;Sm(n,a,c),s=u}else for(o=0;o<i.length;o++){if(a=i[o],u=a.instance,c=a.currentTarget,a=a.listener,u!==s&&n.isPropagationStopped())break e;Sm(n,a,c),s=u}}}if(Wl)throw e=wh,Wl=!1,wh=null,e}function Ce(e,t){var r=t[Th];r===void 0&&(r=t[Th]=new Set);var i=e+"__bubble";r.has(i)||(Iv(t,e,2,!1),r.add(i))}function vu(e,t,r){var i=0;t&&(i|=4),Iv(r,e,i,t)}var qa="_reactListening"+Math.random().toString(36).slice(2);function na(e){if(!e[qa]){e[qa]=!0,q0.forEach(function(r){r!=="selectionchange"&&(q1.has(r)||vu(r,!1,e),vu(r,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[qa]||(t[qa]=!0,vu("selectionchange",!1,t))}}function Iv(e,t,r,i){switch(Sv(t)){case 1:var n=o1;break;case 4:n=a1;break;default:n=Nf}r=n.bind(null,t,r,e),n=void 0,!xh||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(n=!0),i?n!==void 0?e.addEventListener(t,r,{capture:!0,passive:n}):e.addEventListener(t,r,!0):n!==void 0?e.addEventListener(t,r,{passive:n}):e.addEventListener(t,r,!1)}function yu(e,t,r,i,n){var s=i;if(!(t&1)&&!(t&2)&&i!==null)e:for(;;){if(i===null)return;var o=i.tag;if(o===3||o===4){var a=i.stateNode.containerInfo;if(a===n||a.nodeType===8&&a.parentNode===n)break;if(o===4)for(o=i.return;o!==null;){var u=o.tag;if((u===3||u===4)&&(u=o.stateNode.containerInfo,u===n||u.nodeType===8&&u.parentNode===n))return;o=o.return}for(;a!==null;){if(o=bn(a),o===null)return;if(u=o.tag,u===5||u===6){i=s=o;continue e}a=a.parentNode}}i=i.return}lv(function(){var c=s,h=Sf(r),d=[];e:{var f=Bv.get(e);if(f!==void 0){var p=jf,m=e;switch(e){case"keypress":if(wl(r)===0)break e;case"keydown":case"keyup":p=S1;break;case"focusin":m="focus",p=du;break;case"focusout":m="blur",p=du;break;case"beforeblur":case"afterblur":p=du;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=um;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=u1;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=k1;break;case Dv:case Lv:case Av:p=f1;break;case Ov:p=E1;break;case"scroll":p=l1;break;case"wheel":p=P1;break;case"copy":case"cut":case"paste":p=m1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=dm}var y=(t&4)!==0,C=!y&&e==="scroll",g=y?f!==null?f+"Capture":null:f;y=[];for(var _=c,v;_!==null;){v=_;var x=v.stateNode;if(v.tag===5&&x!==null&&(v=x,g!==null&&(x=Jo(_,g),x!=null&&y.push(sa(_,x,v)))),C)break;_=_.return}0<y.length&&(f=new p(f,m,null,r,h),d.push({event:f,listeners:y}))}}if(!(t&7)){e:{if(f=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",f&&r!==vh&&(m=r.relatedTarget||r.fromElement)&&(bn(m)||m[yi]))break e;if((p||f)&&(f=h.window===h?h:(f=h.ownerDocument)?f.defaultView||f.parentWindow:window,p?(m=r.relatedTarget||r.toElement,p=c,m=m?bn(m):null,m!==null&&(C=Gn(m),m!==C||m.tag!==5&&m.tag!==6)&&(m=null)):(p=null,m=c),p!==m)){if(y=um,x="onMouseLeave",g="onMouseEnter",_="mouse",(e==="pointerout"||e==="pointerover")&&(y=dm,x="onPointerLeave",g="onPointerEnter",_="pointer"),C=p==null?f:ds(p),v=m==null?f:ds(m),f=new y(x,_+"leave",p,r,h),f.target=C,f.relatedTarget=v,x=null,bn(h)===c&&(y=new y(g,_+"enter",m,r,h),y.target=v,y.relatedTarget=C,x=y),C=x,p&&m)t:{for(y=p,g=m,_=0,v=y;v;v=rs(v))_++;for(v=0,x=g;x;x=rs(x))v++;for(;0<_-v;)y=rs(y),_--;for(;0<v-_;)g=rs(g),v--;for(;_--;){if(y===g||g!==null&&y===g.alternate)break t;y=rs(y),g=rs(g)}y=null}else y=null;p!==null&&bm(d,f,p,y,!1),m!==null&&C!==null&&bm(d,C,m,y,!0)}}e:{if(f=c?ds(c):window,p=f.nodeName&&f.nodeName.toLowerCase(),p==="select"||p==="input"&&f.type==="file")var k=O1;else if(mm(f))if(jv)k=F1;else{k=z1;var b=B1}else(p=f.nodeName)&&p.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(k=I1);if(k&&(k=k(e,c))){Ev(d,k,r,h);break e}b&&b(e,f,c),e==="focusout"&&(b=f._wrapperState)&&b.controlled&&f.type==="number"&&fh(f,"number",f.value)}switch(b=c?ds(c):window,e){case"focusin":(mm(b)||b.contentEditable==="true")&&(us=b,kh=c,Ho=null);break;case"focusout":Ho=kh=us=null;break;case"mousedown":Nh=!0;break;case"contextmenu":case"mouseup":case"dragend":Nh=!1,xm(d,r,h);break;case"selectionchange":if(W1)break;case"keydown":case"keyup":xm(d,r,h)}var j;if(Mf)e:{switch(e){case"compositionstart":var L="onCompositionStart";break e;case"compositionend":L="onCompositionEnd";break e;case"compositionupdate":L="onCompositionUpdate";break e}L=void 0}else cs?kv(e,r)&&(L="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(L="onCompositionStart");L&&(Cv&&r.locale!=="ko"&&(cs||L!=="onCompositionStart"?L==="onCompositionEnd"&&cs&&(j=bv()):(Vi=h,Ef="value"in Vi?Vi.value:Vi.textContent,cs=!0)),b=Yl(c,L),0<b.length&&(L=new hm(L,e,null,r,h),d.push({event:L,listeners:b}),j?L.data=j:(j=Nv(r),j!==null&&(L.data=j)))),(j=T1?R1(e,r):D1(e,r))&&(c=Yl(c,"onBeforeInput"),0<c.length&&(h=new hm("onBeforeInput","beforeinput",null,r,h),d.push({event:h,listeners:c}),h.data=j))}zv(d,t)})}function sa(e,t,r){return{instance:e,listener:t,currentTarget:r}}function Yl(e,t){for(var r=t+"Capture",i=[];e!==null;){var n=e,s=n.stateNode;n.tag===5&&s!==null&&(n=s,s=Jo(e,r),s!=null&&i.unshift(sa(e,s,n)),s=Jo(e,t),s!=null&&i.push(sa(e,s,n))),e=e.return}return i}function rs(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function bm(e,t,r,i,n){for(var s=t._reactName,o=[];r!==null&&r!==i;){var a=r,u=a.alternate,c=a.stateNode;if(u!==null&&u===i)break;a.tag===5&&c!==null&&(a=c,n?(u=Jo(r,s),u!=null&&o.unshift(sa(r,u,a))):n||(u=Jo(r,s),u!=null&&o.push(sa(r,u,a)))),r=r.return}o.length!==0&&e.push({event:t,listeners:o})}var V1=/\r\n?/g,Y1=/\u0000|\uFFFD/g;function Cm(e){return(typeof e=="string"?e:""+e).replace(V1,`
38
+ `).replace(Y1,"")}function Va(e,t,r){if(t=Cm(t),Cm(e)!==t&&r)throw Error(W(425))}function Xl(){}var Eh=null,jh=null;function Ph(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Mh=typeof setTimeout=="function"?setTimeout:void 0,X1=typeof clearTimeout=="function"?clearTimeout:void 0,km=typeof Promise=="function"?Promise:void 0,Q1=typeof queueMicrotask=="function"?queueMicrotask:typeof km<"u"?function(e){return km.resolve(null).then(e).catch(G1)}:Mh;function G1(e){setTimeout(function(){throw e})}function xu(e,t){var r=t,i=0;do{var n=r.nextSibling;if(e.removeChild(r),n&&n.nodeType===8)if(r=n.data,r==="/$"){if(i===0){e.removeChild(n),ta(t);return}i--}else r!=="$"&&r!=="$?"&&r!=="$!"||i++;r=n}while(r);ta(t)}function Zi(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function Nm(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="$"||r==="$!"||r==="$?"){if(t===0)return e;t--}else r==="/$"&&t++}e=e.previousSibling}return null}var Zs=Math.random().toString(36).slice(2),Vr="__reactFiber$"+Zs,oa="__reactProps$"+Zs,yi="__reactContainer$"+Zs,Th="__reactEvents$"+Zs,J1="__reactListeners$"+Zs,Z1="__reactHandles$"+Zs;function bn(e){var t=e[Vr];if(t)return t;for(var r=e.parentNode;r;){if(t=r[yi]||r[Vr]){if(r=t.alternate,t.child!==null||r!==null&&r.child!==null)for(e=Nm(e);e!==null;){if(r=e[Vr])return r;e=Nm(e)}return t}e=r,r=e.parentNode}return null}function Na(e){return e=e[Vr]||e[yi],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function ds(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(W(33))}function Pc(e){return e[oa]||null}var Rh=[],fs=-1;function hn(e){return{current:e}}function Ee(e){0>fs||(e.current=Rh[fs],Rh[fs]=null,fs--)}function Se(e,t){fs++,Rh[fs]=e.current,e.current=t}var ln={},xt=hn(ln),Ht=hn(!1),Fn=ln;function Ws(e,t){var r=e.type.contextTypes;if(!r)return ln;var i=e.stateNode;if(i&&i.__reactInternalMemoizedUnmaskedChildContext===t)return i.__reactInternalMemoizedMaskedChildContext;var n={},s;for(s in r)n[s]=t[s];return i&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=n),n}function $t(e){return e=e.childContextTypes,e!=null}function Ql(){Ee(Ht),Ee(xt)}function Em(e,t,r){if(xt.current!==ln)throw Error(W(168));Se(xt,t),Se(Ht,r)}function Fv(e,t,r){var i=e.stateNode;if(t=t.childContextTypes,typeof i.getChildContext!="function")return r;i=i.getChildContext();for(var n in i)if(!(n in t))throw Error(W(108,BS(e)||"Unknown",n));return Ae({},r,i)}function Gl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ln,Fn=xt.current,Se(xt,e),Se(Ht,Ht.current),!0}function jm(e,t,r){var i=e.stateNode;if(!i)throw Error(W(169));r?(e=Fv(e,t,Fn),i.__reactInternalMemoizedMergedChildContext=e,Ee(Ht),Ee(xt),Se(xt,e)):Ee(Ht),Se(Ht,r)}var li=null,Mc=!1,wu=!1;function Hv(e){li===null?li=[e]:li.push(e)}function eb(e){Mc=!0,Hv(e)}function dn(){if(!wu&&li!==null){wu=!0;var e=0,t=_e;try{var r=li;for(_e=1;e<r.length;e++){var i=r[e];do i=i(!0);while(i!==null)}li=null,Mc=!1}catch(n){throw li!==null&&(li=li.slice(e+1)),dv(bf,dn),n}finally{_e=t,wu=!1}}return null}var ps=[],ms=0,Jl=null,Zl=0,hr=[],dr=0,Hn=null,fi=1,pi="";function _n(e,t){ps[ms++]=Zl,ps[ms++]=Jl,Jl=e,Zl=t}function $v(e,t,r){hr[dr++]=fi,hr[dr++]=pi,hr[dr++]=Hn,Hn=e;var i=fi;e=pi;var n=32-Tr(i)-1;i&=~(1<<n),r+=1;var s=32-Tr(t)+n;if(30<s){var o=n-n%5;s=(i&(1<<o)-1).toString(32),i>>=o,n-=o,fi=1<<32-Tr(t)+n|r<<n|i,pi=s+e}else fi=1<<s|r<<n|i,pi=e}function Rf(e){e.return!==null&&(_n(e,1),$v(e,1,0))}function Df(e){for(;e===Jl;)Jl=ps[--ms],ps[ms]=null,Zl=ps[--ms],ps[ms]=null;for(;e===Hn;)Hn=hr[--dr],hr[dr]=null,pi=hr[--dr],hr[dr]=null,fi=hr[--dr],hr[dr]=null}var er=null,Jt=null,je=!1,jr=null;function Wv(e,t){var r=pr(5,null,null,0);r.elementType="DELETED",r.stateNode=t,r.return=e,t=e.deletions,t===null?(e.deletions=[r],e.flags|=16):t.push(r)}function Pm(e,t){switch(e.tag){case 5:var r=e.type;return t=t.nodeType!==1||r.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,er=e,Jt=Zi(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,er=e,Jt=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(r=Hn!==null?{id:fi,overflow:pi}:null,e.memoizedState={dehydrated:t,treeContext:r,retryLane:1073741824},r=pr(18,null,null,0),r.stateNode=t,r.return=e,e.child=r,er=e,Jt=null,!0):!1;default:return!1}}function Dh(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Lh(e){if(je){var t=Jt;if(t){var r=t;if(!Pm(e,t)){if(Dh(e))throw Error(W(418));t=Zi(r.nextSibling);var i=er;t&&Pm(e,t)?Wv(i,r):(e.flags=e.flags&-4097|2,je=!1,er=e)}}else{if(Dh(e))throw Error(W(418));e.flags=e.flags&-4097|2,je=!1,er=e}}}function Mm(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;er=e}function Ya(e){if(e!==er)return!1;if(!je)return Mm(e),je=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Ph(e.type,e.memoizedProps)),t&&(t=Jt)){if(Dh(e))throw Uv(),Error(W(418));for(;t;)Wv(e,t),t=Zi(t.nextSibling)}if(Mm(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(W(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"){if(t===0){Jt=Zi(e.nextSibling);break e}t--}else r!=="$"&&r!=="$!"&&r!=="$?"||t++}e=e.nextSibling}Jt=null}}else Jt=er?Zi(e.stateNode.nextSibling):null;return!0}function Uv(){for(var e=Jt;e;)e=Zi(e.nextSibling)}function Us(){Jt=er=null,je=!1}function Lf(e){jr===null?jr=[e]:jr.push(e)}var tb=Si.ReactCurrentBatchConfig;function po(e,t,r){if(e=r.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(r._owner){if(r=r._owner,r){if(r.tag!==1)throw Error(W(309));var i=r.stateNode}if(!i)throw Error(W(147,e));var n=i,s=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===s?t.ref:(t=function(o){var a=n.refs;o===null?delete a[s]:a[s]=o},t._stringRef=s,t)}if(typeof e!="string")throw Error(W(284));if(!r._owner)throw Error(W(290,e))}return e}function Xa(e,t){throw e=Object.prototype.toString.call(t),Error(W(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Tm(e){var t=e._init;return t(e._payload)}function Kv(e){function t(g,_){if(e){var v=g.deletions;v===null?(g.deletions=[_],g.flags|=16):v.push(_)}}function r(g,_){if(!e)return null;for(;_!==null;)t(g,_),_=_.sibling;return null}function i(g,_){for(g=new Map;_!==null;)_.key!==null?g.set(_.key,_):g.set(_.index,_),_=_.sibling;return g}function n(g,_){return g=nn(g,_),g.index=0,g.sibling=null,g}function s(g,_,v){return g.index=v,e?(v=g.alternate,v!==null?(v=v.index,v<_?(g.flags|=2,_):v):(g.flags|=2,_)):(g.flags|=1048576,_)}function o(g){return e&&g.alternate===null&&(g.flags|=2),g}function a(g,_,v,x){return _===null||_.tag!==6?(_=ju(v,g.mode,x),_.return=g,_):(_=n(_,v),_.return=g,_)}function u(g,_,v,x){var k=v.type;return k===ls?h(g,_,v.props.children,x,v.key):_!==null&&(_.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===Di&&Tm(k)===_.type)?(x=n(_,v.props),x.ref=po(g,_,v),x.return=g,x):(x=jl(v.type,v.key,v.props,null,g.mode,x),x.ref=po(g,_,v),x.return=g,x)}function c(g,_,v,x){return _===null||_.tag!==4||_.stateNode.containerInfo!==v.containerInfo||_.stateNode.implementation!==v.implementation?(_=Pu(v,g.mode,x),_.return=g,_):(_=n(_,v.children||[]),_.return=g,_)}function h(g,_,v,x,k){return _===null||_.tag!==7?(_=zn(v,g.mode,x,k),_.return=g,_):(_=n(_,v),_.return=g,_)}function d(g,_,v){if(typeof _=="string"&&_!==""||typeof _=="number")return _=ju(""+_,g.mode,v),_.return=g,_;if(typeof _=="object"&&_!==null){switch(_.$$typeof){case za:return v=jl(_.type,_.key,_.props,null,g.mode,v),v.ref=po(g,null,_),v.return=g,v;case as:return _=Pu(_,g.mode,v),_.return=g,_;case Di:var x=_._init;return d(g,x(_._payload),v)}if(jo(_)||lo(_))return _=zn(_,g.mode,v,null),_.return=g,_;Xa(g,_)}return null}function f(g,_,v,x){var k=_!==null?_.key:null;if(typeof v=="string"&&v!==""||typeof v=="number")return k!==null?null:a(g,_,""+v,x);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case za:return v.key===k?u(g,_,v,x):null;case as:return v.key===k?c(g,_,v,x):null;case Di:return k=v._init,f(g,_,k(v._payload),x)}if(jo(v)||lo(v))return k!==null?null:h(g,_,v,x,null);Xa(g,v)}return null}function p(g,_,v,x,k){if(typeof x=="string"&&x!==""||typeof x=="number")return g=g.get(v)||null,a(_,g,""+x,k);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case za:return g=g.get(x.key===null?v:x.key)||null,u(_,g,x,k);case as:return g=g.get(x.key===null?v:x.key)||null,c(_,g,x,k);case Di:var b=x._init;return p(g,_,v,b(x._payload),k)}if(jo(x)||lo(x))return g=g.get(v)||null,h(_,g,x,k,null);Xa(_,x)}return null}function m(g,_,v,x){for(var k=null,b=null,j=_,L=_=0,I=null;j!==null&&L<v.length;L++){j.index>L?(I=j,j=null):I=j.sibling;var P=f(g,j,v[L],x);if(P===null){j===null&&(j=I);break}e&&j&&P.alternate===null&&t(g,j),_=s(P,_,L),b===null?k=P:b.sibling=P,b=P,j=I}if(L===v.length)return r(g,j),je&&_n(g,L),k;if(j===null){for(;L<v.length;L++)j=d(g,v[L],x),j!==null&&(_=s(j,_,L),b===null?k=j:b.sibling=j,b=j);return je&&_n(g,L),k}for(j=i(g,j);L<v.length;L++)I=p(j,g,L,v[L],x),I!==null&&(e&&I.alternate!==null&&j.delete(I.key===null?L:I.key),_=s(I,_,L),b===null?k=I:b.sibling=I,b=I);return e&&j.forEach(function(D){return t(g,D)}),je&&_n(g,L),k}function y(g,_,v,x){var k=lo(v);if(typeof k!="function")throw Error(W(150));if(v=k.call(v),v==null)throw Error(W(151));for(var b=k=null,j=_,L=_=0,I=null,P=v.next();j!==null&&!P.done;L++,P=v.next()){j.index>L?(I=j,j=null):I=j.sibling;var D=f(g,j,P.value,x);if(D===null){j===null&&(j=I);break}e&&j&&D.alternate===null&&t(g,j),_=s(D,_,L),b===null?k=D:b.sibling=D,b=D,j=I}if(P.done)return r(g,j),je&&_n(g,L),k;if(j===null){for(;!P.done;L++,P=v.next())P=d(g,P.value,x),P!==null&&(_=s(P,_,L),b===null?k=P:b.sibling=P,b=P);return je&&_n(g,L),k}for(j=i(g,j);!P.done;L++,P=v.next())P=p(j,g,L,P.value,x),P!==null&&(e&&P.alternate!==null&&j.delete(P.key===null?L:P.key),_=s(P,_,L),b===null?k=P:b.sibling=P,b=P);return e&&j.forEach(function(M){return t(g,M)}),je&&_n(g,L),k}function C(g,_,v,x){if(typeof v=="object"&&v!==null&&v.type===ls&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case za:e:{for(var k=v.key,b=_;b!==null;){if(b.key===k){if(k=v.type,k===ls){if(b.tag===7){r(g,b.sibling),_=n(b,v.props.children),_.return=g,g=_;break e}}else if(b.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===Di&&Tm(k)===b.type){r(g,b.sibling),_=n(b,v.props),_.ref=po(g,b,v),_.return=g,g=_;break e}r(g,b);break}else t(g,b);b=b.sibling}v.type===ls?(_=zn(v.props.children,g.mode,x,v.key),_.return=g,g=_):(x=jl(v.type,v.key,v.props,null,g.mode,x),x.ref=po(g,_,v),x.return=g,g=x)}return o(g);case as:e:{for(b=v.key;_!==null;){if(_.key===b)if(_.tag===4&&_.stateNode.containerInfo===v.containerInfo&&_.stateNode.implementation===v.implementation){r(g,_.sibling),_=n(_,v.children||[]),_.return=g,g=_;break e}else{r(g,_);break}else t(g,_);_=_.sibling}_=Pu(v,g.mode,x),_.return=g,g=_}return o(g);case Di:return b=v._init,C(g,_,b(v._payload),x)}if(jo(v))return m(g,_,v,x);if(lo(v))return y(g,_,v,x);Xa(g,v)}return typeof v=="string"&&v!==""||typeof v=="number"?(v=""+v,_!==null&&_.tag===6?(r(g,_.sibling),_=n(_,v),_.return=g,g=_):(r(g,_),_=ju(v,g.mode,x),_.return=g,g=_),o(g)):r(g,_)}return C}var Ks=Kv(!0),qv=Kv(!1),ec=hn(null),tc=null,gs=null,Af=null;function Of(){Af=gs=tc=null}function Bf(e){var t=ec.current;Ee(ec),e._currentValue=t}function Ah(e,t,r){for(;e!==null;){var i=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,i!==null&&(i.childLanes|=t)):i!==null&&(i.childLanes&t)!==t&&(i.childLanes|=t),e===r)break;e=e.return}}function Ns(e,t){tc=e,Af=gs=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Ft=!0),e.firstContext=null)}function _r(e){var t=e._currentValue;if(Af!==e)if(e={context:e,memoizedValue:t,next:null},gs===null){if(tc===null)throw Error(W(308));gs=e,tc.dependencies={lanes:0,firstContext:e}}else gs=gs.next=e;return t}var Cn=null;function zf(e){Cn===null?Cn=[e]:Cn.push(e)}function Vv(e,t,r,i){var n=t.interleaved;return n===null?(r.next=r,zf(t)):(r.next=n.next,n.next=r),t.interleaved=r,xi(e,i)}function xi(e,t){e.lanes|=t;var r=e.alternate;for(r!==null&&(r.lanes|=t),r=e,e=e.return;e!==null;)e.childLanes|=t,r=e.alternate,r!==null&&(r.childLanes|=t),r=e,e=e.return;return r.tag===3?r.stateNode:null}var Li=!1;function If(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Yv(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 gi(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function en(e,t,r){var i=e.updateQueue;if(i===null)return null;if(i=i.shared,fe&2){var n=i.pending;return n===null?t.next=t:(t.next=n.next,n.next=t),i.pending=t,xi(e,r)}return n=i.interleaved,n===null?(t.next=t,zf(i)):(t.next=n.next,n.next=t),i.interleaved=t,xi(e,r)}function Sl(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194240)!==0)){var i=t.lanes;i&=e.pendingLanes,r|=i,t.lanes=r,Cf(e,r)}}function Rm(e,t){var r=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,r===i)){var n=null,s=null;if(r=r.firstBaseUpdate,r!==null){do{var o={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};s===null?n=s=o:s=s.next=o,r=r.next}while(r!==null);s===null?n=s=t:s=s.next=t}else n=s=t;r={baseState:i.baseState,firstBaseUpdate:n,lastBaseUpdate:s,shared:i.shared,effects:i.effects},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function rc(e,t,r,i){var n=e.updateQueue;Li=!1;var s=n.firstBaseUpdate,o=n.lastBaseUpdate,a=n.shared.pending;if(a!==null){n.shared.pending=null;var u=a,c=u.next;u.next=null,o===null?s=c:o.next=c,o=u;var h=e.alternate;h!==null&&(h=h.updateQueue,a=h.lastBaseUpdate,a!==o&&(a===null?h.firstBaseUpdate=c:a.next=c,h.lastBaseUpdate=u))}if(s!==null){var d=n.baseState;o=0,h=c=u=null,a=s;do{var f=a.lane,p=a.eventTime;if((i&f)===f){h!==null&&(h=h.next={eventTime:p,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var m=e,y=a;switch(f=t,p=r,y.tag){case 1:if(m=y.payload,typeof m=="function"){d=m.call(p,d,f);break e}d=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=y.payload,f=typeof m=="function"?m.call(p,d,f):m,f==null)break e;d=Ae({},d,f);break e;case 2:Li=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,f=n.effects,f===null?n.effects=[a]:f.push(a))}else p={eventTime:p,lane:f,tag:a.tag,payload:a.payload,callback:a.callback,next:null},h===null?(c=h=p,u=d):h=h.next=p,o|=f;if(a=a.next,a===null){if(a=n.shared.pending,a===null)break;f=a,a=f.next,f.next=null,n.lastBaseUpdate=f,n.shared.pending=null}}while(!0);if(h===null&&(u=d),n.baseState=u,n.firstBaseUpdate=c,n.lastBaseUpdate=h,t=n.shared.interleaved,t!==null){n=t;do o|=n.lane,n=n.next;while(n!==t)}else s===null&&(n.shared.lanes=0);Wn|=o,e.lanes=o,e.memoizedState=d}}function Dm(e,t,r){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var i=e[t],n=i.callback;if(n!==null){if(i.callback=null,i=r,typeof n!="function")throw Error(W(191,n));n.call(i)}}}var Ea={},Gr=hn(Ea),aa=hn(Ea),la=hn(Ea);function kn(e){if(e===Ea)throw Error(W(174));return e}function Ff(e,t){switch(Se(la,t),Se(aa,e),Se(Gr,Ea),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:mh(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=mh(t,e)}Ee(Gr),Se(Gr,t)}function qs(){Ee(Gr),Ee(aa),Ee(la)}function Xv(e){kn(la.current);var t=kn(Gr.current),r=mh(t,e.type);t!==r&&(Se(aa,e),Se(Gr,r))}function Hf(e){aa.current===e&&(Ee(Gr),Ee(aa))}var De=hn(0);function ic(e){for(var t=e;t!==null;){if(t.tag===13){var r=t.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Su=[];function $f(){for(var e=0;e<Su.length;e++)Su[e]._workInProgressVersionPrimary=null;Su.length=0}var bl=Si.ReactCurrentDispatcher,bu=Si.ReactCurrentBatchConfig,$n=0,Le=null,Je=null,nt=null,nc=!1,$o=!1,ca=0,rb=0;function mt(){throw Error(W(321))}function Wf(e,t){if(t===null)return!1;for(var r=0;r<t.length&&r<e.length;r++)if(!Dr(e[r],t[r]))return!1;return!0}function Uf(e,t,r,i,n,s){if($n=s,Le=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,bl.current=e===null||e.memoizedState===null?ob:ab,e=r(i,n),$o){s=0;do{if($o=!1,ca=0,25<=s)throw Error(W(301));s+=1,nt=Je=null,t.updateQueue=null,bl.current=lb,e=r(i,n)}while($o)}if(bl.current=sc,t=Je!==null&&Je.next!==null,$n=0,nt=Je=Le=null,nc=!1,t)throw Error(W(300));return e}function Kf(){var e=ca!==0;return ca=0,e}function Hr(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return nt===null?Le.memoizedState=nt=e:nt=nt.next=e,nt}function vr(){if(Je===null){var e=Le.alternate;e=e!==null?e.memoizedState:null}else e=Je.next;var t=nt===null?Le.memoizedState:nt.next;if(t!==null)nt=t,Je=e;else{if(e===null)throw Error(W(310));Je=e,e={memoizedState:Je.memoizedState,baseState:Je.baseState,baseQueue:Je.baseQueue,queue:Je.queue,next:null},nt===null?Le.memoizedState=nt=e:nt=nt.next=e}return nt}function ua(e,t){return typeof t=="function"?t(e):t}function Cu(e){var t=vr(),r=t.queue;if(r===null)throw Error(W(311));r.lastRenderedReducer=e;var i=Je,n=i.baseQueue,s=r.pending;if(s!==null){if(n!==null){var o=n.next;n.next=s.next,s.next=o}i.baseQueue=n=s,r.pending=null}if(n!==null){s=n.next,i=i.baseState;var a=o=null,u=null,c=s;do{var h=c.lane;if(($n&h)===h)u!==null&&(u=u.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),i=c.hasEagerState?c.eagerState:e(i,c.action);else{var d={lane:h,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};u===null?(a=u=d,o=i):u=u.next=d,Le.lanes|=h,Wn|=h}c=c.next}while(c!==null&&c!==s);u===null?o=i:u.next=a,Dr(i,t.memoizedState)||(Ft=!0),t.memoizedState=i,t.baseState=o,t.baseQueue=u,r.lastRenderedState=i}if(e=r.interleaved,e!==null){n=e;do s=n.lane,Le.lanes|=s,Wn|=s,n=n.next;while(n!==e)}else n===null&&(r.lanes=0);return[t.memoizedState,r.dispatch]}function ku(e){var t=vr(),r=t.queue;if(r===null)throw Error(W(311));r.lastRenderedReducer=e;var i=r.dispatch,n=r.pending,s=t.memoizedState;if(n!==null){r.pending=null;var o=n=n.next;do s=e(s,o.action),o=o.next;while(o!==n);Dr(s,t.memoizedState)||(Ft=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),r.lastRenderedState=s}return[s,i]}function Qv(){}function Gv(e,t){var r=Le,i=vr(),n=t(),s=!Dr(i.memoizedState,n);if(s&&(i.memoizedState=n,Ft=!0),i=i.queue,qf(ey.bind(null,r,i,e),[e]),i.getSnapshot!==t||s||nt!==null&&nt.memoizedState.tag&1){if(r.flags|=2048,ha(9,Zv.bind(null,r,i,n,t),void 0,null),lt===null)throw Error(W(349));$n&30||Jv(r,t,n)}return n}function Jv(e,t,r){e.flags|=16384,e={getSnapshot:t,value:r},t=Le.updateQueue,t===null?(t={lastEffect:null,stores:null},Le.updateQueue=t,t.stores=[e]):(r=t.stores,r===null?t.stores=[e]:r.push(e))}function Zv(e,t,r,i){t.value=r,t.getSnapshot=i,ty(t)&&ry(e)}function ey(e,t,r){return r(function(){ty(t)&&ry(e)})}function ty(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!Dr(e,r)}catch{return!0}}function ry(e){var t=xi(e,1);t!==null&&Rr(t,e,1,-1)}function Lm(e){var t=Hr();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ua,lastRenderedState:e},t.queue=e,e=e.dispatch=sb.bind(null,Le,e),[t.memoizedState,e]}function ha(e,t,r,i){return e={tag:e,create:t,destroy:r,deps:i,next:null},t=Le.updateQueue,t===null?(t={lastEffect:null,stores:null},Le.updateQueue=t,t.lastEffect=e.next=e):(r=t.lastEffect,r===null?t.lastEffect=e.next=e:(i=r.next,r.next=e,e.next=i,t.lastEffect=e)),e}function iy(){return vr().memoizedState}function Cl(e,t,r,i){var n=Hr();Le.flags|=e,n.memoizedState=ha(1|t,r,void 0,i===void 0?null:i)}function Tc(e,t,r,i){var n=vr();i=i===void 0?null:i;var s=void 0;if(Je!==null){var o=Je.memoizedState;if(s=o.destroy,i!==null&&Wf(i,o.deps)){n.memoizedState=ha(t,r,s,i);return}}Le.flags|=e,n.memoizedState=ha(1|t,r,s,i)}function Am(e,t){return Cl(8390656,8,e,t)}function qf(e,t){return Tc(2048,8,e,t)}function ny(e,t){return Tc(4,2,e,t)}function sy(e,t){return Tc(4,4,e,t)}function oy(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function ay(e,t,r){return r=r!=null?r.concat([e]):null,Tc(4,4,oy.bind(null,t,e),r)}function Vf(){}function ly(e,t){var r=vr();t=t===void 0?null:t;var i=r.memoizedState;return i!==null&&t!==null&&Wf(t,i[1])?i[0]:(r.memoizedState=[e,t],e)}function cy(e,t){var r=vr();t=t===void 0?null:t;var i=r.memoizedState;return i!==null&&t!==null&&Wf(t,i[1])?i[0]:(e=e(),r.memoizedState=[e,t],e)}function uy(e,t,r){return $n&21?(Dr(r,t)||(r=mv(),Le.lanes|=r,Wn|=r,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Ft=!0),e.memoizedState=r)}function ib(e,t){var r=_e;_e=r!==0&&4>r?r:4,e(!0);var i=bu.transition;bu.transition={};try{e(!1),t()}finally{_e=r,bu.transition=i}}function hy(){return vr().memoizedState}function nb(e,t,r){var i=rn(e);if(r={lane:i,action:r,hasEagerState:!1,eagerState:null,next:null},dy(e))fy(t,r);else if(r=Vv(e,t,r,i),r!==null){var n=Pt();Rr(r,e,i,n),py(r,t,i)}}function sb(e,t,r){var i=rn(e),n={lane:i,action:r,hasEagerState:!1,eagerState:null,next:null};if(dy(e))fy(t,n);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var o=t.lastRenderedState,a=s(o,r);if(n.hasEagerState=!0,n.eagerState=a,Dr(a,o)){var u=t.interleaved;u===null?(n.next=n,zf(t)):(n.next=u.next,u.next=n),t.interleaved=n;return}}catch{}finally{}r=Vv(e,t,n,i),r!==null&&(n=Pt(),Rr(r,e,i,n),py(r,t,i))}}function dy(e){var t=e.alternate;return e===Le||t!==null&&t===Le}function fy(e,t){$o=nc=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function py(e,t,r){if(r&4194240){var i=t.lanes;i&=e.pendingLanes,r|=i,t.lanes=r,Cf(e,r)}}var sc={readContext:_r,useCallback:mt,useContext:mt,useEffect:mt,useImperativeHandle:mt,useInsertionEffect:mt,useLayoutEffect:mt,useMemo:mt,useReducer:mt,useRef:mt,useState:mt,useDebugValue:mt,useDeferredValue:mt,useTransition:mt,useMutableSource:mt,useSyncExternalStore:mt,useId:mt,unstable_isNewReconciler:!1},ob={readContext:_r,useCallback:function(e,t){return Hr().memoizedState=[e,t===void 0?null:t],e},useContext:_r,useEffect:Am,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,Cl(4194308,4,oy.bind(null,t,e),r)},useLayoutEffect:function(e,t){return Cl(4194308,4,e,t)},useInsertionEffect:function(e,t){return Cl(4,2,e,t)},useMemo:function(e,t){var r=Hr();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var i=Hr();return t=r!==void 0?r(t):t,i.memoizedState=i.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},i.queue=e,e=e.dispatch=nb.bind(null,Le,e),[i.memoizedState,e]},useRef:function(e){var t=Hr();return e={current:e},t.memoizedState=e},useState:Lm,useDebugValue:Vf,useDeferredValue:function(e){return Hr().memoizedState=e},useTransition:function(){var e=Lm(!1),t=e[0];return e=ib.bind(null,e[1]),Hr().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var i=Le,n=Hr();if(je){if(r===void 0)throw Error(W(407));r=r()}else{if(r=t(),lt===null)throw Error(W(349));$n&30||Jv(i,t,r)}n.memoizedState=r;var s={value:r,getSnapshot:t};return n.queue=s,Am(ey.bind(null,i,s,e),[e]),i.flags|=2048,ha(9,Zv.bind(null,i,s,r,t),void 0,null),r},useId:function(){var e=Hr(),t=lt.identifierPrefix;if(je){var r=pi,i=fi;r=(i&~(1<<32-Tr(i)-1)).toString(32)+r,t=":"+t+"R"+r,r=ca++,0<r&&(t+="H"+r.toString(32)),t+=":"}else r=rb++,t=":"+t+"r"+r.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},ab={readContext:_r,useCallback:ly,useContext:_r,useEffect:qf,useImperativeHandle:ay,useInsertionEffect:ny,useLayoutEffect:sy,useMemo:cy,useReducer:Cu,useRef:iy,useState:function(){return Cu(ua)},useDebugValue:Vf,useDeferredValue:function(e){var t=vr();return uy(t,Je.memoizedState,e)},useTransition:function(){var e=Cu(ua)[0],t=vr().memoizedState;return[e,t]},useMutableSource:Qv,useSyncExternalStore:Gv,useId:hy,unstable_isNewReconciler:!1},lb={readContext:_r,useCallback:ly,useContext:_r,useEffect:qf,useImperativeHandle:ay,useInsertionEffect:ny,useLayoutEffect:sy,useMemo:cy,useReducer:ku,useRef:iy,useState:function(){return ku(ua)},useDebugValue:Vf,useDeferredValue:function(e){var t=vr();return Je===null?t.memoizedState=e:uy(t,Je.memoizedState,e)},useTransition:function(){var e=ku(ua)[0],t=vr().memoizedState;return[e,t]},useMutableSource:Qv,useSyncExternalStore:Gv,useId:hy,unstable_isNewReconciler:!1};function Cr(e,t){if(e&&e.defaultProps){t=Ae({},t),e=e.defaultProps;for(var r in e)t[r]===void 0&&(t[r]=e[r]);return t}return t}function Oh(e,t,r,i){t=e.memoizedState,r=r(i,t),r=r==null?t:Ae({},t,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var Rc={isMounted:function(e){return(e=e._reactInternals)?Gn(e)===e:!1},enqueueSetState:function(e,t,r){e=e._reactInternals;var i=Pt(),n=rn(e),s=gi(i,n);s.payload=t,r!=null&&(s.callback=r),t=en(e,s,n),t!==null&&(Rr(t,e,n,i),Sl(t,e,n))},enqueueReplaceState:function(e,t,r){e=e._reactInternals;var i=Pt(),n=rn(e),s=gi(i,n);s.tag=1,s.payload=t,r!=null&&(s.callback=r),t=en(e,s,n),t!==null&&(Rr(t,e,n,i),Sl(t,e,n))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var r=Pt(),i=rn(e),n=gi(r,i);n.tag=2,t!=null&&(n.callback=t),t=en(e,n,i),t!==null&&(Rr(t,e,i,r),Sl(t,e,i))}};function Om(e,t,r,i,n,s,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(i,s,o):t.prototype&&t.prototype.isPureReactComponent?!ia(r,i)||!ia(n,s):!0}function my(e,t,r){var i=!1,n=ln,s=t.contextType;return typeof s=="object"&&s!==null?s=_r(s):(n=$t(t)?Fn:xt.current,i=t.contextTypes,s=(i=i!=null)?Ws(e,n):ln),t=new t(r,s),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Rc,e.stateNode=t,t._reactInternals=e,i&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=n,e.__reactInternalMemoizedMaskedChildContext=s),t}function Bm(e,t,r,i){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(r,i),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(r,i),t.state!==e&&Rc.enqueueReplaceState(t,t.state,null)}function Bh(e,t,r,i){var n=e.stateNode;n.props=r,n.state=e.memoizedState,n.refs={},If(e);var s=t.contextType;typeof s=="object"&&s!==null?n.context=_r(s):(s=$t(t)?Fn:xt.current,n.context=Ws(e,s)),n.state=e.memoizedState,s=t.getDerivedStateFromProps,typeof s=="function"&&(Oh(e,t,s,r),n.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof n.getSnapshotBeforeUpdate=="function"||typeof n.UNSAFE_componentWillMount!="function"&&typeof n.componentWillMount!="function"||(t=n.state,typeof n.componentWillMount=="function"&&n.componentWillMount(),typeof n.UNSAFE_componentWillMount=="function"&&n.UNSAFE_componentWillMount(),t!==n.state&&Rc.enqueueReplaceState(n,n.state,null),rc(e,r,n,i),n.state=e.memoizedState),typeof n.componentDidMount=="function"&&(e.flags|=4194308)}function Vs(e,t){try{var r="",i=t;do r+=OS(i),i=i.return;while(i);var n=r}catch(s){n=`
39
+ Error generating stack: `+s.message+`
40
+ `+s.stack}return{value:e,source:t,stack:n,digest:null}}function Nu(e,t,r){return{value:e,source:null,stack:r??null,digest:t??null}}function zh(e,t){try{console.error(t.value)}catch(r){setTimeout(function(){throw r})}}var cb=typeof WeakMap=="function"?WeakMap:Map;function gy(e,t,r){r=gi(-1,r),r.tag=3,r.payload={element:null};var i=t.value;return r.callback=function(){ac||(ac=!0,Yh=i),zh(e,t)},r}function _y(e,t,r){r=gi(-1,r),r.tag=3;var i=e.type.getDerivedStateFromError;if(typeof i=="function"){var n=t.value;r.payload=function(){return i(n)},r.callback=function(){zh(e,t)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(r.callback=function(){zh(e,t),typeof i!="function"&&(tn===null?tn=new Set([this]):tn.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),r}function zm(e,t,r){var i=e.pingCache;if(i===null){i=e.pingCache=new cb;var n=new Set;i.set(t,n)}else n=i.get(t),n===void 0&&(n=new Set,i.set(t,n));n.has(r)||(n.add(r),e=bb.bind(null,e,t,r),t.then(e,e))}function Im(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function Fm(e,t,r,i,n){return e.mode&1?(e.flags|=65536,e.lanes=n,e):(e===t?e.flags|=65536:(e.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(t=gi(-1,1),t.tag=2,en(r,t,1))),r.lanes|=1),e)}var ub=Si.ReactCurrentOwner,Ft=!1;function Et(e,t,r,i){t.child=e===null?qv(t,null,r,i):Ks(t,e.child,r,i)}function Hm(e,t,r,i,n){r=r.render;var s=t.ref;return Ns(t,n),i=Uf(e,t,r,i,s,n),r=Kf(),e!==null&&!Ft?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n,wi(e,t,n)):(je&&r&&Rf(t),t.flags|=1,Et(e,t,i,n),t.child)}function $m(e,t,r,i,n){if(e===null){var s=r.type;return typeof s=="function"&&!tp(s)&&s.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(t.tag=15,t.type=s,vy(e,t,s,i,n)):(e=jl(r.type,null,i,t,t.mode,n),e.ref=t.ref,e.return=t,t.child=e)}if(s=e.child,!(e.lanes&n)){var o=s.memoizedProps;if(r=r.compare,r=r!==null?r:ia,r(o,i)&&e.ref===t.ref)return wi(e,t,n)}return t.flags|=1,e=nn(s,i),e.ref=t.ref,e.return=t,t.child=e}function vy(e,t,r,i,n){if(e!==null){var s=e.memoizedProps;if(ia(s,i)&&e.ref===t.ref)if(Ft=!1,t.pendingProps=i=s,(e.lanes&n)!==0)e.flags&131072&&(Ft=!0);else return t.lanes=e.lanes,wi(e,t,n)}return Ih(e,t,r,i,n)}function yy(e,t,r){var i=t.pendingProps,n=i.children,s=e!==null?e.memoizedState:null;if(i.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Se(vs,Gt),Gt|=r;else{if(!(r&1073741824))return e=s!==null?s.baseLanes|r:r,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Se(vs,Gt),Gt|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},i=s!==null?s.baseLanes:r,Se(vs,Gt),Gt|=i}else s!==null?(i=s.baseLanes|r,t.memoizedState=null):i=r,Se(vs,Gt),Gt|=i;return Et(e,t,n,r),t.child}function xy(e,t){var r=t.ref;(e===null&&r!==null||e!==null&&e.ref!==r)&&(t.flags|=512,t.flags|=2097152)}function Ih(e,t,r,i,n){var s=$t(r)?Fn:xt.current;return s=Ws(t,s),Ns(t,n),r=Uf(e,t,r,i,s,n),i=Kf(),e!==null&&!Ft?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n,wi(e,t,n)):(je&&i&&Rf(t),t.flags|=1,Et(e,t,r,n),t.child)}function Wm(e,t,r,i,n){if($t(r)){var s=!0;Gl(t)}else s=!1;if(Ns(t,n),t.stateNode===null)kl(e,t),my(t,r,i),Bh(t,r,i,n),i=!0;else if(e===null){var o=t.stateNode,a=t.memoizedProps;o.props=a;var u=o.context,c=r.contextType;typeof c=="object"&&c!==null?c=_r(c):(c=$t(r)?Fn:xt.current,c=Ws(t,c));var h=r.getDerivedStateFromProps,d=typeof h=="function"||typeof o.getSnapshotBeforeUpdate=="function";d||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==i||u!==c)&&Bm(t,o,i,c),Li=!1;var f=t.memoizedState;o.state=f,rc(t,i,o,n),u=t.memoizedState,a!==i||f!==u||Ht.current||Li?(typeof h=="function"&&(Oh(t,r,h,i),u=t.memoizedState),(a=Li||Om(t,r,a,i,f,u,c))?(d||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=i,t.memoizedState=u),o.props=i,o.state=u,o.context=c,i=a):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),i=!1)}else{o=t.stateNode,Yv(e,t),a=t.memoizedProps,c=t.type===t.elementType?a:Cr(t.type,a),o.props=c,d=t.pendingProps,f=o.context,u=r.contextType,typeof u=="object"&&u!==null?u=_r(u):(u=$t(r)?Fn:xt.current,u=Ws(t,u));var p=r.getDerivedStateFromProps;(h=typeof p=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==d||f!==u)&&Bm(t,o,i,u),Li=!1,f=t.memoizedState,o.state=f,rc(t,i,o,n);var m=t.memoizedState;a!==d||f!==m||Ht.current||Li?(typeof p=="function"&&(Oh(t,r,p,i),m=t.memoizedState),(c=Li||Om(t,r,c,i,f,m,u)||!1)?(h||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(i,m,u),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(i,m,u)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=i,t.memoizedState=m),o.props=i,o.state=m,o.context=u,i=c):(typeof o.componentDidUpdate!="function"||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),i=!1)}return Fh(e,t,r,i,s,n)}function Fh(e,t,r,i,n,s){xy(e,t);var o=(t.flags&128)!==0;if(!i&&!o)return n&&jm(t,r,!1),wi(e,t,s);i=t.stateNode,ub.current=t;var a=o&&typeof r.getDerivedStateFromError!="function"?null:i.render();return t.flags|=1,e!==null&&o?(t.child=Ks(t,e.child,null,s),t.child=Ks(t,null,a,s)):Et(e,t,a,s),t.memoizedState=i.state,n&&jm(t,r,!0),t.child}function wy(e){var t=e.stateNode;t.pendingContext?Em(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Em(e,t.context,!1),Ff(e,t.containerInfo)}function Um(e,t,r,i,n){return Us(),Lf(n),t.flags|=256,Et(e,t,r,i),t.child}var Hh={dehydrated:null,treeContext:null,retryLane:0};function $h(e){return{baseLanes:e,cachePool:null,transitions:null}}function Sy(e,t,r){var i=t.pendingProps,n=De.current,s=!1,o=(t.flags&128)!==0,a;if((a=o)||(a=e!==null&&e.memoizedState===null?!1:(n&2)!==0),a?(s=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(n|=1),Se(De,n&1),e===null)return Lh(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=i.children,e=i.fallback,s?(i=t.mode,s=t.child,o={mode:"hidden",children:o},!(i&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=Ac(o,i,0,null),e=zn(e,i,r,null),s.return=t,e.return=t,s.sibling=e,t.child=s,t.child.memoizedState=$h(r),t.memoizedState=Hh,e):Yf(t,o));if(n=e.memoizedState,n!==null&&(a=n.dehydrated,a!==null))return hb(e,t,o,i,a,n,r);if(s){s=i.fallback,o=t.mode,n=e.child,a=n.sibling;var u={mode:"hidden",children:i.children};return!(o&1)&&t.child!==n?(i=t.child,i.childLanes=0,i.pendingProps=u,t.deletions=null):(i=nn(n,u),i.subtreeFlags=n.subtreeFlags&14680064),a!==null?s=nn(a,s):(s=zn(s,o,r,null),s.flags|=2),s.return=t,i.return=t,i.sibling=s,t.child=i,i=s,s=t.child,o=e.child.memoizedState,o=o===null?$h(r):{baseLanes:o.baseLanes|r,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=e.childLanes&~r,t.memoizedState=Hh,i}return s=e.child,e=s.sibling,i=nn(s,{mode:"visible",children:i.children}),!(t.mode&1)&&(i.lanes=r),i.return=t,i.sibling=null,e!==null&&(r=t.deletions,r===null?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=i,t.memoizedState=null,i}function Yf(e,t){return t=Ac({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Qa(e,t,r,i){return i!==null&&Lf(i),Ks(t,e.child,null,r),e=Yf(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function hb(e,t,r,i,n,s,o){if(r)return t.flags&256?(t.flags&=-257,i=Nu(Error(W(422))),Qa(e,t,o,i)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(s=i.fallback,n=t.mode,i=Ac({mode:"visible",children:i.children},n,0,null),s=zn(s,n,o,null),s.flags|=2,i.return=t,s.return=t,i.sibling=s,t.child=i,t.mode&1&&Ks(t,e.child,null,o),t.child.memoizedState=$h(o),t.memoizedState=Hh,s);if(!(t.mode&1))return Qa(e,t,o,null);if(n.data==="$!"){if(i=n.nextSibling&&n.nextSibling.dataset,i)var a=i.dgst;return i=a,s=Error(W(419)),i=Nu(s,i,void 0),Qa(e,t,o,i)}if(a=(o&e.childLanes)!==0,Ft||a){if(i=lt,i!==null){switch(o&-o){case 4:n=2;break;case 16:n=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:n=32;break;case 536870912:n=268435456;break;default:n=0}n=n&(i.suspendedLanes|o)?0:n,n!==0&&n!==s.retryLane&&(s.retryLane=n,xi(e,n),Rr(i,e,n,-1))}return ep(),i=Nu(Error(W(421))),Qa(e,t,o,i)}return n.data==="$?"?(t.flags|=128,t.child=e.child,t=Cb.bind(null,e),n._reactRetry=t,null):(e=s.treeContext,Jt=Zi(n.nextSibling),er=t,je=!0,jr=null,e!==null&&(hr[dr++]=fi,hr[dr++]=pi,hr[dr++]=Hn,fi=e.id,pi=e.overflow,Hn=t),t=Yf(t,i.children),t.flags|=4096,t)}function Km(e,t,r){e.lanes|=t;var i=e.alternate;i!==null&&(i.lanes|=t),Ah(e.return,t,r)}function Eu(e,t,r,i,n){var s=e.memoizedState;s===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:i,tail:r,tailMode:n}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=i,s.tail=r,s.tailMode=n)}function by(e,t,r){var i=t.pendingProps,n=i.revealOrder,s=i.tail;if(Et(e,t,i.children,r),i=De.current,i&2)i=i&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Km(e,r,t);else if(e.tag===19)Km(e,r,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}i&=1}if(Se(De,i),!(t.mode&1))t.memoizedState=null;else switch(n){case"forwards":for(r=t.child,n=null;r!==null;)e=r.alternate,e!==null&&ic(e)===null&&(n=r),r=r.sibling;r=n,r===null?(n=t.child,t.child=null):(n=r.sibling,r.sibling=null),Eu(t,!1,n,r,s);break;case"backwards":for(r=null,n=t.child,t.child=null;n!==null;){if(e=n.alternate,e!==null&&ic(e)===null){t.child=n;break}e=n.sibling,n.sibling=r,r=n,n=e}Eu(t,!0,r,null,s);break;case"together":Eu(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function kl(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function wi(e,t,r){if(e!==null&&(t.dependencies=e.dependencies),Wn|=t.lanes,!(r&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(W(153));if(t.child!==null){for(e=t.child,r=nn(e,e.pendingProps),t.child=r,r.return=t;e.sibling!==null;)e=e.sibling,r=r.sibling=nn(e,e.pendingProps),r.return=t;r.sibling=null}return t.child}function db(e,t,r){switch(t.tag){case 3:wy(t),Us();break;case 5:Xv(t);break;case 1:$t(t.type)&&Gl(t);break;case 4:Ff(t,t.stateNode.containerInfo);break;case 10:var i=t.type._context,n=t.memoizedProps.value;Se(ec,i._currentValue),i._currentValue=n;break;case 13:if(i=t.memoizedState,i!==null)return i.dehydrated!==null?(Se(De,De.current&1),t.flags|=128,null):r&t.child.childLanes?Sy(e,t,r):(Se(De,De.current&1),e=wi(e,t,r),e!==null?e.sibling:null);Se(De,De.current&1);break;case 19:if(i=(r&t.childLanes)!==0,e.flags&128){if(i)return by(e,t,r);t.flags|=128}if(n=t.memoizedState,n!==null&&(n.rendering=null,n.tail=null,n.lastEffect=null),Se(De,De.current),i)break;return null;case 22:case 23:return t.lanes=0,yy(e,t,r)}return wi(e,t,r)}var Cy,Wh,ky,Ny;Cy=function(e,t){for(var r=t.child;r!==null;){if(r.tag===5||r.tag===6)e.appendChild(r.stateNode);else if(r.tag!==4&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break;for(;r.sibling===null;){if(r.return===null||r.return===t)return;r=r.return}r.sibling.return=r.return,r=r.sibling}};Wh=function(){};ky=function(e,t,r,i){var n=e.memoizedProps;if(n!==i){e=t.stateNode,kn(Gr.current);var s=null;switch(r){case"input":n=hh(e,n),i=hh(e,i),s=[];break;case"select":n=Ae({},n,{value:void 0}),i=Ae({},i,{value:void 0}),s=[];break;case"textarea":n=ph(e,n),i=ph(e,i),s=[];break;default:typeof n.onClick!="function"&&typeof i.onClick=="function"&&(e.onclick=Xl)}gh(r,i);var o;r=null;for(c in n)if(!i.hasOwnProperty(c)&&n.hasOwnProperty(c)&&n[c]!=null)if(c==="style"){var a=n[c];for(o in a)a.hasOwnProperty(o)&&(r||(r={}),r[o]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(Qo.hasOwnProperty(c)?s||(s=[]):(s=s||[]).push(c,null));for(c in i){var u=i[c];if(a=n!=null?n[c]:void 0,i.hasOwnProperty(c)&&u!==a&&(u!=null||a!=null))if(c==="style")if(a){for(o in a)!a.hasOwnProperty(o)||u&&u.hasOwnProperty(o)||(r||(r={}),r[o]="");for(o in u)u.hasOwnProperty(o)&&a[o]!==u[o]&&(r||(r={}),r[o]=u[o])}else r||(s||(s=[]),s.push(c,r)),r=u;else c==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,a=a?a.__html:void 0,u!=null&&a!==u&&(s=s||[]).push(c,u)):c==="children"?typeof u!="string"&&typeof u!="number"||(s=s||[]).push(c,""+u):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(Qo.hasOwnProperty(c)?(u!=null&&c==="onScroll"&&Ce("scroll",e),s||a===u||(s=[])):(s=s||[]).push(c,u))}r&&(s=s||[]).push("style",r);var c=s;(t.updateQueue=c)&&(t.flags|=4)}};Ny=function(e,t,r,i){r!==i&&(t.flags|=4)};function mo(e,t){if(!je)switch(e.tailMode){case"hidden":t=e.tail;for(var r=null;t!==null;)t.alternate!==null&&(r=t),t=t.sibling;r===null?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var i=null;r!==null;)r.alternate!==null&&(i=r),r=r.sibling;i===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:i.sibling=null}}function gt(e){var t=e.alternate!==null&&e.alternate.child===e.child,r=0,i=0;if(t)for(var n=e.child;n!==null;)r|=n.lanes|n.childLanes,i|=n.subtreeFlags&14680064,i|=n.flags&14680064,n.return=e,n=n.sibling;else for(n=e.child;n!==null;)r|=n.lanes|n.childLanes,i|=n.subtreeFlags,i|=n.flags,n.return=e,n=n.sibling;return e.subtreeFlags|=i,e.childLanes=r,t}function fb(e,t,r){var i=t.pendingProps;switch(Df(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return gt(t),null;case 1:return $t(t.type)&&Ql(),gt(t),null;case 3:return i=t.stateNode,qs(),Ee(Ht),Ee(xt),$f(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(Ya(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,jr!==null&&(Gh(jr),jr=null))),Wh(e,t),gt(t),null;case 5:Hf(t);var n=kn(la.current);if(r=t.type,e!==null&&t.stateNode!=null)ky(e,t,r,i,n),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!i){if(t.stateNode===null)throw Error(W(166));return gt(t),null}if(e=kn(Gr.current),Ya(t)){i=t.stateNode,r=t.type;var s=t.memoizedProps;switch(i[Vr]=t,i[oa]=s,e=(t.mode&1)!==0,r){case"dialog":Ce("cancel",i),Ce("close",i);break;case"iframe":case"object":case"embed":Ce("load",i);break;case"video":case"audio":for(n=0;n<Mo.length;n++)Ce(Mo[n],i);break;case"source":Ce("error",i);break;case"img":case"image":case"link":Ce("error",i),Ce("load",i);break;case"details":Ce("toggle",i);break;case"input":em(i,s),Ce("invalid",i);break;case"select":i._wrapperState={wasMultiple:!!s.multiple},Ce("invalid",i);break;case"textarea":rm(i,s),Ce("invalid",i)}gh(r,s),n=null;for(var o in s)if(s.hasOwnProperty(o)){var a=s[o];o==="children"?typeof a=="string"?i.textContent!==a&&(s.suppressHydrationWarning!==!0&&Va(i.textContent,a,e),n=["children",a]):typeof a=="number"&&i.textContent!==""+a&&(s.suppressHydrationWarning!==!0&&Va(i.textContent,a,e),n=["children",""+a]):Qo.hasOwnProperty(o)&&a!=null&&o==="onScroll"&&Ce("scroll",i)}switch(r){case"input":Ia(i),tm(i,s,!0);break;case"textarea":Ia(i),im(i);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(i.onclick=Xl)}i=n,t.updateQueue=i,i!==null&&(t.flags|=4)}else{o=n.nodeType===9?n:n.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=ev(r)),e==="http://www.w3.org/1999/xhtml"?r==="script"?(e=o.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof i.is=="string"?e=o.createElement(r,{is:i.is}):(e=o.createElement(r),r==="select"&&(o=e,i.multiple?o.multiple=!0:i.size&&(o.size=i.size))):e=o.createElementNS(e,r),e[Vr]=t,e[oa]=i,Cy(e,t,!1,!1),t.stateNode=e;e:{switch(o=_h(r,i),r){case"dialog":Ce("cancel",e),Ce("close",e),n=i;break;case"iframe":case"object":case"embed":Ce("load",e),n=i;break;case"video":case"audio":for(n=0;n<Mo.length;n++)Ce(Mo[n],e);n=i;break;case"source":Ce("error",e),n=i;break;case"img":case"image":case"link":Ce("error",e),Ce("load",e),n=i;break;case"details":Ce("toggle",e),n=i;break;case"input":em(e,i),n=hh(e,i),Ce("invalid",e);break;case"option":n=i;break;case"select":e._wrapperState={wasMultiple:!!i.multiple},n=Ae({},i,{value:void 0}),Ce("invalid",e);break;case"textarea":rm(e,i),n=ph(e,i),Ce("invalid",e);break;default:n=i}gh(r,n),a=n;for(s in a)if(a.hasOwnProperty(s)){var u=a[s];s==="style"?iv(e,u):s==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,u!=null&&tv(e,u)):s==="children"?typeof u=="string"?(r!=="textarea"||u!=="")&&Go(e,u):typeof u=="number"&&Go(e,""+u):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(Qo.hasOwnProperty(s)?u!=null&&s==="onScroll"&&Ce("scroll",e):u!=null&&vf(e,s,u,o))}switch(r){case"input":Ia(e),tm(e,i,!1);break;case"textarea":Ia(e),im(e);break;case"option":i.value!=null&&e.setAttribute("value",""+an(i.value));break;case"select":e.multiple=!!i.multiple,s=i.value,s!=null?Ss(e,!!i.multiple,s,!1):i.defaultValue!=null&&Ss(e,!!i.multiple,i.defaultValue,!0);break;default:typeof n.onClick=="function"&&(e.onclick=Xl)}switch(r){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}}i&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return gt(t),null;case 6:if(e&&t.stateNode!=null)Ny(e,t,e.memoizedProps,i);else{if(typeof i!="string"&&t.stateNode===null)throw Error(W(166));if(r=kn(la.current),kn(Gr.current),Ya(t)){if(i=t.stateNode,r=t.memoizedProps,i[Vr]=t,(s=i.nodeValue!==r)&&(e=er,e!==null))switch(e.tag){case 3:Va(i.nodeValue,r,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Va(i.nodeValue,r,(e.mode&1)!==0)}s&&(t.flags|=4)}else i=(r.nodeType===9?r:r.ownerDocument).createTextNode(i),i[Vr]=t,t.stateNode=i}return gt(t),null;case 13:if(Ee(De),i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(je&&Jt!==null&&t.mode&1&&!(t.flags&128))Uv(),Us(),t.flags|=98560,s=!1;else if(s=Ya(t),i!==null&&i.dehydrated!==null){if(e===null){if(!s)throw Error(W(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(W(317));s[Vr]=t}else Us(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;gt(t),s=!1}else jr!==null&&(Gh(jr),jr=null),s=!0;if(!s)return t.flags&65536?t:null}return t.flags&128?(t.lanes=r,t):(i=i!==null,i!==(e!==null&&e.memoizedState!==null)&&i&&(t.child.flags|=8192,t.mode&1&&(e===null||De.current&1?et===0&&(et=3):ep())),t.updateQueue!==null&&(t.flags|=4),gt(t),null);case 4:return qs(),Wh(e,t),e===null&&na(t.stateNode.containerInfo),gt(t),null;case 10:return Bf(t.type._context),gt(t),null;case 17:return $t(t.type)&&Ql(),gt(t),null;case 19:if(Ee(De),s=t.memoizedState,s===null)return gt(t),null;if(i=(t.flags&128)!==0,o=s.rendering,o===null)if(i)mo(s,!1);else{if(et!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=ic(e),o!==null){for(t.flags|=128,mo(s,!1),i=o.updateQueue,i!==null&&(t.updateQueue=i,t.flags|=4),t.subtreeFlags=0,i=r,r=t.child;r!==null;)s=r,e=i,s.flags&=14680066,o=s.alternate,o===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=o.childLanes,s.lanes=o.lanes,s.child=o.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=o.memoizedProps,s.memoizedState=o.memoizedState,s.updateQueue=o.updateQueue,s.type=o.type,e=o.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),r=r.sibling;return Se(De,De.current&1|2),t.child}e=e.sibling}s.tail!==null&&$e()>Ys&&(t.flags|=128,i=!0,mo(s,!1),t.lanes=4194304)}else{if(!i)if(e=ic(o),e!==null){if(t.flags|=128,i=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),mo(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!je)return gt(t),null}else 2*$e()-s.renderingStartTime>Ys&&r!==1073741824&&(t.flags|=128,i=!0,mo(s,!1),t.lanes=4194304);s.isBackwards?(o.sibling=t.child,t.child=o):(r=s.last,r!==null?r.sibling=o:t.child=o,s.last=o)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=$e(),t.sibling=null,r=De.current,Se(De,i?r&1|2:r&1),t):(gt(t),null);case 22:case 23:return Zf(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?Gt&1073741824&&(gt(t),t.subtreeFlags&6&&(t.flags|=8192)):gt(t),null;case 24:return null;case 25:return null}throw Error(W(156,t.tag))}function pb(e,t){switch(Df(t),t.tag){case 1:return $t(t.type)&&Ql(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return qs(),Ee(Ht),Ee(xt),$f(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Hf(t),null;case 13:if(Ee(De),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(W(340));Us()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ee(De),null;case 4:return qs(),null;case 10:return Bf(t.type._context),null;case 22:case 23:return Zf(),null;case 24:return null;default:return null}}var Ga=!1,yt=!1,mb=typeof WeakSet=="function"?WeakSet:Set,Q=null;function _s(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(i){ze(e,t,i)}else r.current=null}function Uh(e,t,r){try{r()}catch(i){ze(e,t,i)}}var qm=!1;function gb(e,t){if(Eh=ql,e=Tv(),Tf(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var i=r.getSelection&&r.getSelection();if(i&&i.rangeCount!==0){r=i.anchorNode;var n=i.anchorOffset,s=i.focusNode;i=i.focusOffset;try{r.nodeType,s.nodeType}catch{r=null;break e}var o=0,a=-1,u=-1,c=0,h=0,d=e,f=null;t:for(;;){for(var p;d!==r||n!==0&&d.nodeType!==3||(a=o+n),d!==s||i!==0&&d.nodeType!==3||(u=o+i),d.nodeType===3&&(o+=d.nodeValue.length),(p=d.firstChild)!==null;)f=d,d=p;for(;;){if(d===e)break t;if(f===r&&++c===n&&(a=o),f===s&&++h===i&&(u=o),(p=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=p}r=a===-1||u===-1?null:{start:a,end:u}}else r=null}r=r||{start:0,end:0}}else r=null;for(jh={focusedElem:e,selectionRange:r},ql=!1,Q=t;Q!==null;)if(t=Q,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Q=e;else for(;Q!==null;){t=Q;try{var m=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var y=m.memoizedProps,C=m.memoizedState,g=t.stateNode,_=g.getSnapshotBeforeUpdate(t.elementType===t.type?y:Cr(t.type,y),C);g.__reactInternalSnapshotBeforeUpdate=_}break;case 3:var v=t.stateNode.containerInfo;v.nodeType===1?v.textContent="":v.nodeType===9&&v.documentElement&&v.removeChild(v.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(W(163))}}catch(x){ze(t,t.return,x)}if(e=t.sibling,e!==null){e.return=t.return,Q=e;break}Q=t.return}return m=qm,qm=!1,m}function Wo(e,t,r){var i=t.updateQueue;if(i=i!==null?i.lastEffect:null,i!==null){var n=i=i.next;do{if((n.tag&e)===e){var s=n.destroy;n.destroy=void 0,s!==void 0&&Uh(t,r,s)}n=n.next}while(n!==i)}}function Dc(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var i=r.create;r.destroy=i()}r=r.next}while(r!==t)}}function Kh(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function Ey(e){var t=e.alternate;t!==null&&(e.alternate=null,Ey(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Vr],delete t[oa],delete t[Th],delete t[J1],delete t[Z1])),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 jy(e){return e.tag===5||e.tag===3||e.tag===4}function Vm(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||jy(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function qh(e,t,r){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=Xl));else if(i!==4&&(e=e.child,e!==null))for(qh(e,t,r),e=e.sibling;e!==null;)qh(e,t,r),e=e.sibling}function Vh(e,t,r){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(i!==4&&(e=e.child,e!==null))for(Vh(e,t,r),e=e.sibling;e!==null;)Vh(e,t,r),e=e.sibling}var ut=null,Er=!1;function ki(e,t,r){for(r=r.child;r!==null;)Py(e,t,r),r=r.sibling}function Py(e,t,r){if(Qr&&typeof Qr.onCommitFiberUnmount=="function")try{Qr.onCommitFiberUnmount(kc,r)}catch{}switch(r.tag){case 5:yt||_s(r,t);case 6:var i=ut,n=Er;ut=null,ki(e,t,r),ut=i,Er=n,ut!==null&&(Er?(e=ut,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):ut.removeChild(r.stateNode));break;case 18:ut!==null&&(Er?(e=ut,r=r.stateNode,e.nodeType===8?xu(e.parentNode,r):e.nodeType===1&&xu(e,r),ta(e)):xu(ut,r.stateNode));break;case 4:i=ut,n=Er,ut=r.stateNode.containerInfo,Er=!0,ki(e,t,r),ut=i,Er=n;break;case 0:case 11:case 14:case 15:if(!yt&&(i=r.updateQueue,i!==null&&(i=i.lastEffect,i!==null))){n=i=i.next;do{var s=n,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&Uh(r,t,o),n=n.next}while(n!==i)}ki(e,t,r);break;case 1:if(!yt&&(_s(r,t),i=r.stateNode,typeof i.componentWillUnmount=="function"))try{i.props=r.memoizedProps,i.state=r.memoizedState,i.componentWillUnmount()}catch(a){ze(r,t,a)}ki(e,t,r);break;case 21:ki(e,t,r);break;case 22:r.mode&1?(yt=(i=yt)||r.memoizedState!==null,ki(e,t,r),yt=i):ki(e,t,r);break;default:ki(e,t,r)}}function Ym(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new mb),t.forEach(function(i){var n=kb.bind(null,e,i);r.has(i)||(r.add(i),i.then(n,n))})}}function wr(e,t){var r=t.deletions;if(r!==null)for(var i=0;i<r.length;i++){var n=r[i];try{var s=e,o=t,a=o;e:for(;a!==null;){switch(a.tag){case 5:ut=a.stateNode,Er=!1;break e;case 3:ut=a.stateNode.containerInfo,Er=!0;break e;case 4:ut=a.stateNode.containerInfo,Er=!0;break e}a=a.return}if(ut===null)throw Error(W(160));Py(s,o,n),ut=null,Er=!1;var u=n.alternate;u!==null&&(u.return=null),n.return=null}catch(c){ze(n,t,c)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)My(t,e),t=t.sibling}function My(e,t){var r=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(wr(t,e),Br(e),i&4){try{Wo(3,e,e.return),Dc(3,e)}catch(y){ze(e,e.return,y)}try{Wo(5,e,e.return)}catch(y){ze(e,e.return,y)}}break;case 1:wr(t,e),Br(e),i&512&&r!==null&&_s(r,r.return);break;case 5:if(wr(t,e),Br(e),i&512&&r!==null&&_s(r,r.return),e.flags&32){var n=e.stateNode;try{Go(n,"")}catch(y){ze(e,e.return,y)}}if(i&4&&(n=e.stateNode,n!=null)){var s=e.memoizedProps,o=r!==null?r.memoizedProps:s,a=e.type,u=e.updateQueue;if(e.updateQueue=null,u!==null)try{a==="input"&&s.type==="radio"&&s.name!=null&&J0(n,s),_h(a,o);var c=_h(a,s);for(o=0;o<u.length;o+=2){var h=u[o],d=u[o+1];h==="style"?iv(n,d):h==="dangerouslySetInnerHTML"?tv(n,d):h==="children"?Go(n,d):vf(n,h,d,c)}switch(a){case"input":dh(n,s);break;case"textarea":Z0(n,s);break;case"select":var f=n._wrapperState.wasMultiple;n._wrapperState.wasMultiple=!!s.multiple;var p=s.value;p!=null?Ss(n,!!s.multiple,p,!1):f!==!!s.multiple&&(s.defaultValue!=null?Ss(n,!!s.multiple,s.defaultValue,!0):Ss(n,!!s.multiple,s.multiple?[]:"",!1))}n[oa]=s}catch(y){ze(e,e.return,y)}}break;case 6:if(wr(t,e),Br(e),i&4){if(e.stateNode===null)throw Error(W(162));n=e.stateNode,s=e.memoizedProps;try{n.nodeValue=s}catch(y){ze(e,e.return,y)}}break;case 3:if(wr(t,e),Br(e),i&4&&r!==null&&r.memoizedState.isDehydrated)try{ta(t.containerInfo)}catch(y){ze(e,e.return,y)}break;case 4:wr(t,e),Br(e);break;case 13:wr(t,e),Br(e),n=e.child,n.flags&8192&&(s=n.memoizedState!==null,n.stateNode.isHidden=s,!s||n.alternate!==null&&n.alternate.memoizedState!==null||(Gf=$e())),i&4&&Ym(e);break;case 22:if(h=r!==null&&r.memoizedState!==null,e.mode&1?(yt=(c=yt)||h,wr(t,e),yt=c):wr(t,e),Br(e),i&8192){if(c=e.memoizedState!==null,(e.stateNode.isHidden=c)&&!h&&e.mode&1)for(Q=e,h=e.child;h!==null;){for(d=Q=h;Q!==null;){switch(f=Q,p=f.child,f.tag){case 0:case 11:case 14:case 15:Wo(4,f,f.return);break;case 1:_s(f,f.return);var m=f.stateNode;if(typeof m.componentWillUnmount=="function"){i=f,r=f.return;try{t=i,m.props=t.memoizedProps,m.state=t.memoizedState,m.componentWillUnmount()}catch(y){ze(i,r,y)}}break;case 5:_s(f,f.return);break;case 22:if(f.memoizedState!==null){Qm(d);continue}}p!==null?(p.return=f,Q=p):Qm(d)}h=h.sibling}e:for(h=null,d=e;;){if(d.tag===5){if(h===null){h=d;try{n=d.stateNode,c?(s=n.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(a=d.stateNode,u=d.memoizedProps.style,o=u!=null&&u.hasOwnProperty("display")?u.display:null,a.style.display=rv("display",o))}catch(y){ze(e,e.return,y)}}}else if(d.tag===6){if(h===null)try{d.stateNode.nodeValue=c?"":d.memoizedProps}catch(y){ze(e,e.return,y)}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===e)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===e)break e;for(;d.sibling===null;){if(d.return===null||d.return===e)break e;h===d&&(h=null),d=d.return}h===d&&(h=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:wr(t,e),Br(e),i&4&&Ym(e);break;case 21:break;default:wr(t,e),Br(e)}}function Br(e){var t=e.flags;if(t&2){try{e:{for(var r=e.return;r!==null;){if(jy(r)){var i=r;break e}r=r.return}throw Error(W(160))}switch(i.tag){case 5:var n=i.stateNode;i.flags&32&&(Go(n,""),i.flags&=-33);var s=Vm(e);Vh(e,s,n);break;case 3:case 4:var o=i.stateNode.containerInfo,a=Vm(e);qh(e,a,o);break;default:throw Error(W(161))}}catch(u){ze(e,e.return,u)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function _b(e,t,r){Q=e,Ty(e)}function Ty(e,t,r){for(var i=(e.mode&1)!==0;Q!==null;){var n=Q,s=n.child;if(n.tag===22&&i){var o=n.memoizedState!==null||Ga;if(!o){var a=n.alternate,u=a!==null&&a.memoizedState!==null||yt;a=Ga;var c=yt;if(Ga=o,(yt=u)&&!c)for(Q=n;Q!==null;)o=Q,u=o.child,o.tag===22&&o.memoizedState!==null?Gm(n):u!==null?(u.return=o,Q=u):Gm(n);for(;s!==null;)Q=s,Ty(s),s=s.sibling;Q=n,Ga=a,yt=c}Xm(e)}else n.subtreeFlags&8772&&s!==null?(s.return=n,Q=s):Xm(e)}}function Xm(e){for(;Q!==null;){var t=Q;if(t.flags&8772){var r=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:yt||Dc(5,t);break;case 1:var i=t.stateNode;if(t.flags&4&&!yt)if(r===null)i.componentDidMount();else{var n=t.elementType===t.type?r.memoizedProps:Cr(t.type,r.memoizedProps);i.componentDidUpdate(n,r.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}var s=t.updateQueue;s!==null&&Dm(t,s,i);break;case 3:var o=t.updateQueue;if(o!==null){if(r=null,t.child!==null)switch(t.child.tag){case 5:r=t.child.stateNode;break;case 1:r=t.child.stateNode}Dm(t,o,r)}break;case 5:var a=t.stateNode;if(r===null&&t.flags&4){r=a;var u=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":u.autoFocus&&r.focus();break;case"img":u.src&&(r.src=u.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var c=t.alternate;if(c!==null){var h=c.memoizedState;if(h!==null){var d=h.dehydrated;d!==null&&ta(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(W(163))}yt||t.flags&512&&Kh(t)}catch(f){ze(t,t.return,f)}}if(t===e){Q=null;break}if(r=t.sibling,r!==null){r.return=t.return,Q=r;break}Q=t.return}}function Qm(e){for(;Q!==null;){var t=Q;if(t===e){Q=null;break}var r=t.sibling;if(r!==null){r.return=t.return,Q=r;break}Q=t.return}}function Gm(e){for(;Q!==null;){var t=Q;try{switch(t.tag){case 0:case 11:case 15:var r=t.return;try{Dc(4,t)}catch(u){ze(t,r,u)}break;case 1:var i=t.stateNode;if(typeof i.componentDidMount=="function"){var n=t.return;try{i.componentDidMount()}catch(u){ze(t,n,u)}}var s=t.return;try{Kh(t)}catch(u){ze(t,s,u)}break;case 5:var o=t.return;try{Kh(t)}catch(u){ze(t,o,u)}}}catch(u){ze(t,t.return,u)}if(t===e){Q=null;break}var a=t.sibling;if(a!==null){a.return=t.return,Q=a;break}Q=t.return}}var vb=Math.ceil,oc=Si.ReactCurrentDispatcher,Xf=Si.ReactCurrentOwner,mr=Si.ReactCurrentBatchConfig,fe=0,lt=null,Ye=null,ft=0,Gt=0,vs=hn(0),et=0,da=null,Wn=0,Lc=0,Qf=0,Uo=null,It=null,Gf=0,Ys=1/0,ai=null,ac=!1,Yh=null,tn=null,Ja=!1,Yi=null,lc=0,Ko=0,Xh=null,Nl=-1,El=0;function Pt(){return fe&6?$e():Nl!==-1?Nl:Nl=$e()}function rn(e){return e.mode&1?fe&2&&ft!==0?ft&-ft:tb.transition!==null?(El===0&&(El=mv()),El):(e=_e,e!==0||(e=window.event,e=e===void 0?16:Sv(e.type)),e):1}function Rr(e,t,r,i){if(50<Ko)throw Ko=0,Xh=null,Error(W(185));Ca(e,r,i),(!(fe&2)||e!==lt)&&(e===lt&&(!(fe&2)&&(Lc|=r),et===4&&Bi(e,ft)),Wt(e,i),r===1&&fe===0&&!(t.mode&1)&&(Ys=$e()+500,Mc&&dn()))}function Wt(e,t){var r=e.callbackNode;t1(e,t);var i=Kl(e,e===lt?ft:0);if(i===0)r!==null&&om(r),e.callbackNode=null,e.callbackPriority=0;else if(t=i&-i,e.callbackPriority!==t){if(r!=null&&om(r),t===1)e.tag===0?eb(Jm.bind(null,e)):Hv(Jm.bind(null,e)),Q1(function(){!(fe&6)&&dn()}),r=null;else{switch(gv(i)){case 1:r=bf;break;case 4:r=fv;break;case 16:r=Ul;break;case 536870912:r=pv;break;default:r=Ul}r=Iy(r,Ry.bind(null,e))}e.callbackPriority=t,e.callbackNode=r}}function Ry(e,t){if(Nl=-1,El=0,fe&6)throw Error(W(327));var r=e.callbackNode;if(Es()&&e.callbackNode!==r)return null;var i=Kl(e,e===lt?ft:0);if(i===0)return null;if(i&30||i&e.expiredLanes||t)t=cc(e,i);else{t=i;var n=fe;fe|=2;var s=Ly();(lt!==e||ft!==t)&&(ai=null,Ys=$e()+500,Bn(e,t));do try{wb();break}catch(a){Dy(e,a)}while(!0);Of(),oc.current=s,fe=n,Ye!==null?t=0:(lt=null,ft=0,t=et)}if(t!==0){if(t===2&&(n=Sh(e),n!==0&&(i=n,t=Qh(e,n))),t===1)throw r=da,Bn(e,0),Bi(e,i),Wt(e,$e()),r;if(t===6)Bi(e,i);else{if(n=e.current.alternate,!(i&30)&&!yb(n)&&(t=cc(e,i),t===2&&(s=Sh(e),s!==0&&(i=s,t=Qh(e,s))),t===1))throw r=da,Bn(e,0),Bi(e,i),Wt(e,$e()),r;switch(e.finishedWork=n,e.finishedLanes=i,t){case 0:case 1:throw Error(W(345));case 2:vn(e,It,ai);break;case 3:if(Bi(e,i),(i&130023424)===i&&(t=Gf+500-$e(),10<t)){if(Kl(e,0)!==0)break;if(n=e.suspendedLanes,(n&i)!==i){Pt(),e.pingedLanes|=e.suspendedLanes&n;break}e.timeoutHandle=Mh(vn.bind(null,e,It,ai),t);break}vn(e,It,ai);break;case 4:if(Bi(e,i),(i&4194240)===i)break;for(t=e.eventTimes,n=-1;0<i;){var o=31-Tr(i);s=1<<o,o=t[o],o>n&&(n=o),i&=~s}if(i=n,i=$e()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*vb(i/1960))-i,10<i){e.timeoutHandle=Mh(vn.bind(null,e,It,ai),i);break}vn(e,It,ai);break;case 5:vn(e,It,ai);break;default:throw Error(W(329))}}}return Wt(e,$e()),e.callbackNode===r?Ry.bind(null,e):null}function Qh(e,t){var r=Uo;return e.current.memoizedState.isDehydrated&&(Bn(e,t).flags|=256),e=cc(e,t),e!==2&&(t=It,It=r,t!==null&&Gh(t)),e}function Gh(e){It===null?It=e:It.push.apply(It,e)}function yb(e){for(var t=e;;){if(t.flags&16384){var r=t.updateQueue;if(r!==null&&(r=r.stores,r!==null))for(var i=0;i<r.length;i++){var n=r[i],s=n.getSnapshot;n=n.value;try{if(!Dr(s(),n))return!1}catch{return!1}}}if(r=t.child,t.subtreeFlags&16384&&r!==null)r.return=t,t=r;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Bi(e,t){for(t&=~Qf,t&=~Lc,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var r=31-Tr(t),i=1<<r;e[r]=-1,t&=~i}}function Jm(e){if(fe&6)throw Error(W(327));Es();var t=Kl(e,0);if(!(t&1))return Wt(e,$e()),null;var r=cc(e,t);if(e.tag!==0&&r===2){var i=Sh(e);i!==0&&(t=i,r=Qh(e,i))}if(r===1)throw r=da,Bn(e,0),Bi(e,t),Wt(e,$e()),r;if(r===6)throw Error(W(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,vn(e,It,ai),Wt(e,$e()),null}function Jf(e,t){var r=fe;fe|=1;try{return e(t)}finally{fe=r,fe===0&&(Ys=$e()+500,Mc&&dn())}}function Un(e){Yi!==null&&Yi.tag===0&&!(fe&6)&&Es();var t=fe;fe|=1;var r=mr.transition,i=_e;try{if(mr.transition=null,_e=1,e)return e()}finally{_e=i,mr.transition=r,fe=t,!(fe&6)&&dn()}}function Zf(){Gt=vs.current,Ee(vs)}function Bn(e,t){e.finishedWork=null,e.finishedLanes=0;var r=e.timeoutHandle;if(r!==-1&&(e.timeoutHandle=-1,X1(r)),Ye!==null)for(r=Ye.return;r!==null;){var i=r;switch(Df(i),i.tag){case 1:i=i.type.childContextTypes,i!=null&&Ql();break;case 3:qs(),Ee(Ht),Ee(xt),$f();break;case 5:Hf(i);break;case 4:qs();break;case 13:Ee(De);break;case 19:Ee(De);break;case 10:Bf(i.type._context);break;case 22:case 23:Zf()}r=r.return}if(lt=e,Ye=e=nn(e.current,null),ft=Gt=t,et=0,da=null,Qf=Lc=Wn=0,It=Uo=null,Cn!==null){for(t=0;t<Cn.length;t++)if(r=Cn[t],i=r.interleaved,i!==null){r.interleaved=null;var n=i.next,s=r.pending;if(s!==null){var o=s.next;s.next=n,i.next=o}r.pending=i}Cn=null}return e}function Dy(e,t){do{var r=Ye;try{if(Of(),bl.current=sc,nc){for(var i=Le.memoizedState;i!==null;){var n=i.queue;n!==null&&(n.pending=null),i=i.next}nc=!1}if($n=0,nt=Je=Le=null,$o=!1,ca=0,Xf.current=null,r===null||r.return===null){et=1,da=t,Ye=null;break}e:{var s=e,o=r.return,a=r,u=t;if(t=ft,a.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){var c=u,h=a,d=h.tag;if(!(h.mode&1)&&(d===0||d===11||d===15)){var f=h.alternate;f?(h.updateQueue=f.updateQueue,h.memoizedState=f.memoizedState,h.lanes=f.lanes):(h.updateQueue=null,h.memoizedState=null)}var p=Im(o);if(p!==null){p.flags&=-257,Fm(p,o,a,s,t),p.mode&1&&zm(s,c,t),t=p,u=c;var m=t.updateQueue;if(m===null){var y=new Set;y.add(u),t.updateQueue=y}else m.add(u);break e}else{if(!(t&1)){zm(s,c,t),ep();break e}u=Error(W(426))}}else if(je&&a.mode&1){var C=Im(o);if(C!==null){!(C.flags&65536)&&(C.flags|=256),Fm(C,o,a,s,t),Lf(Vs(u,a));break e}}s=u=Vs(u,a),et!==4&&(et=2),Uo===null?Uo=[s]:Uo.push(s),s=o;do{switch(s.tag){case 3:s.flags|=65536,t&=-t,s.lanes|=t;var g=gy(s,u,t);Rm(s,g);break e;case 1:a=u;var _=s.type,v=s.stateNode;if(!(s.flags&128)&&(typeof _.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(tn===null||!tn.has(v)))){s.flags|=65536,t&=-t,s.lanes|=t;var x=_y(s,a,t);Rm(s,x);break e}}s=s.return}while(s!==null)}Oy(r)}catch(k){t=k,Ye===r&&r!==null&&(Ye=r=r.return);continue}break}while(!0)}function Ly(){var e=oc.current;return oc.current=sc,e===null?sc:e}function ep(){(et===0||et===3||et===2)&&(et=4),lt===null||!(Wn&268435455)&&!(Lc&268435455)||Bi(lt,ft)}function cc(e,t){var r=fe;fe|=2;var i=Ly();(lt!==e||ft!==t)&&(ai=null,Bn(e,t));do try{xb();break}catch(n){Dy(e,n)}while(!0);if(Of(),fe=r,oc.current=i,Ye!==null)throw Error(W(261));return lt=null,ft=0,et}function xb(){for(;Ye!==null;)Ay(Ye)}function wb(){for(;Ye!==null&&!qS();)Ay(Ye)}function Ay(e){var t=zy(e.alternate,e,Gt);e.memoizedProps=e.pendingProps,t===null?Oy(e):Ye=t,Xf.current=null}function Oy(e){var t=e;do{var r=t.alternate;if(e=t.return,t.flags&32768){if(r=pb(r,t),r!==null){r.flags&=32767,Ye=r;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{et=6,Ye=null;return}}else if(r=fb(r,t,Gt),r!==null){Ye=r;return}if(t=t.sibling,t!==null){Ye=t;return}Ye=t=e}while(t!==null);et===0&&(et=5)}function vn(e,t,r){var i=_e,n=mr.transition;try{mr.transition=null,_e=1,Sb(e,t,r,i)}finally{mr.transition=n,_e=i}return null}function Sb(e,t,r,i){do Es();while(Yi!==null);if(fe&6)throw Error(W(327));r=e.finishedWork;var n=e.finishedLanes;if(r===null)return null;if(e.finishedWork=null,e.finishedLanes=0,r===e.current)throw Error(W(177));e.callbackNode=null,e.callbackPriority=0;var s=r.lanes|r.childLanes;if(r1(e,s),e===lt&&(Ye=lt=null,ft=0),!(r.subtreeFlags&2064)&&!(r.flags&2064)||Ja||(Ja=!0,Iy(Ul,function(){return Es(),null})),s=(r.flags&15990)!==0,r.subtreeFlags&15990||s){s=mr.transition,mr.transition=null;var o=_e;_e=1;var a=fe;fe|=4,Xf.current=null,gb(e,r),My(r,e),$1(jh),ql=!!Eh,jh=Eh=null,e.current=r,_b(r),VS(),fe=a,_e=o,mr.transition=s}else e.current=r;if(Ja&&(Ja=!1,Yi=e,lc=n),s=e.pendingLanes,s===0&&(tn=null),QS(r.stateNode),Wt(e,$e()),t!==null)for(i=e.onRecoverableError,r=0;r<t.length;r++)n=t[r],i(n.value,{componentStack:n.stack,digest:n.digest});if(ac)throw ac=!1,e=Yh,Yh=null,e;return lc&1&&e.tag!==0&&Es(),s=e.pendingLanes,s&1?e===Xh?Ko++:(Ko=0,Xh=e):Ko=0,dn(),null}function Es(){if(Yi!==null){var e=gv(lc),t=mr.transition,r=_e;try{if(mr.transition=null,_e=16>e?16:e,Yi===null)var i=!1;else{if(e=Yi,Yi=null,lc=0,fe&6)throw Error(W(331));var n=fe;for(fe|=4,Q=e.current;Q!==null;){var s=Q,o=s.child;if(Q.flags&16){var a=s.deletions;if(a!==null){for(var u=0;u<a.length;u++){var c=a[u];for(Q=c;Q!==null;){var h=Q;switch(h.tag){case 0:case 11:case 15:Wo(8,h,s)}var d=h.child;if(d!==null)d.return=h,Q=d;else for(;Q!==null;){h=Q;var f=h.sibling,p=h.return;if(Ey(h),h===c){Q=null;break}if(f!==null){f.return=p,Q=f;break}Q=p}}}var m=s.alternate;if(m!==null){var y=m.child;if(y!==null){m.child=null;do{var C=y.sibling;y.sibling=null,y=C}while(y!==null)}}Q=s}}if(s.subtreeFlags&2064&&o!==null)o.return=s,Q=o;else e:for(;Q!==null;){if(s=Q,s.flags&2048)switch(s.tag){case 0:case 11:case 15:Wo(9,s,s.return)}var g=s.sibling;if(g!==null){g.return=s.return,Q=g;break e}Q=s.return}}var _=e.current;for(Q=_;Q!==null;){o=Q;var v=o.child;if(o.subtreeFlags&2064&&v!==null)v.return=o,Q=v;else e:for(o=_;Q!==null;){if(a=Q,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:Dc(9,a)}}catch(k){ze(a,a.return,k)}if(a===o){Q=null;break e}var x=a.sibling;if(x!==null){x.return=a.return,Q=x;break e}Q=a.return}}if(fe=n,dn(),Qr&&typeof Qr.onPostCommitFiberRoot=="function")try{Qr.onPostCommitFiberRoot(kc,e)}catch{}i=!0}return i}finally{_e=r,mr.transition=t}}return!1}function Zm(e,t,r){t=Vs(r,t),t=gy(e,t,1),e=en(e,t,1),t=Pt(),e!==null&&(Ca(e,1,t),Wt(e,t))}function ze(e,t,r){if(e.tag===3)Zm(e,e,r);else for(;t!==null;){if(t.tag===3){Zm(t,e,r);break}else if(t.tag===1){var i=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(tn===null||!tn.has(i))){e=Vs(r,e),e=_y(t,e,1),t=en(t,e,1),e=Pt(),t!==null&&(Ca(t,1,e),Wt(t,e));break}}t=t.return}}function bb(e,t,r){var i=e.pingCache;i!==null&&i.delete(t),t=Pt(),e.pingedLanes|=e.suspendedLanes&r,lt===e&&(ft&r)===r&&(et===4||et===3&&(ft&130023424)===ft&&500>$e()-Gf?Bn(e,0):Qf|=r),Wt(e,t)}function By(e,t){t===0&&(e.mode&1?(t=$a,$a<<=1,!($a&130023424)&&($a=4194304)):t=1);var r=Pt();e=xi(e,t),e!==null&&(Ca(e,t,r),Wt(e,r))}function Cb(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),By(e,r)}function kb(e,t){var r=0;switch(e.tag){case 13:var i=e.stateNode,n=e.memoizedState;n!==null&&(r=n.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(W(314))}i!==null&&i.delete(t),By(e,r)}var zy;zy=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||Ht.current)Ft=!0;else{if(!(e.lanes&r)&&!(t.flags&128))return Ft=!1,db(e,t,r);Ft=!!(e.flags&131072)}else Ft=!1,je&&t.flags&1048576&&$v(t,Zl,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;kl(e,t),e=t.pendingProps;var n=Ws(t,xt.current);Ns(t,r),n=Uf(null,t,i,e,n,r);var s=Kf();return t.flags|=1,typeof n=="object"&&n!==null&&typeof n.render=="function"&&n.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,$t(i)?(s=!0,Gl(t)):s=!1,t.memoizedState=n.state!==null&&n.state!==void 0?n.state:null,If(t),n.updater=Rc,t.stateNode=n,n._reactInternals=t,Bh(t,i,e,r),t=Fh(null,t,i,!0,s,r)):(t.tag=0,je&&s&&Rf(t),Et(null,t,n,r),t=t.child),t;case 16:i=t.elementType;e:{switch(kl(e,t),e=t.pendingProps,n=i._init,i=n(i._payload),t.type=i,n=t.tag=Eb(i),e=Cr(i,e),n){case 0:t=Ih(null,t,i,e,r);break e;case 1:t=Wm(null,t,i,e,r);break e;case 11:t=Hm(null,t,i,e,r);break e;case 14:t=$m(null,t,i,Cr(i.type,e),r);break e}throw Error(W(306,i,""))}return t;case 0:return i=t.type,n=t.pendingProps,n=t.elementType===i?n:Cr(i,n),Ih(e,t,i,n,r);case 1:return i=t.type,n=t.pendingProps,n=t.elementType===i?n:Cr(i,n),Wm(e,t,i,n,r);case 3:e:{if(wy(t),e===null)throw Error(W(387));i=t.pendingProps,s=t.memoizedState,n=s.element,Yv(e,t),rc(t,i,null,r);var o=t.memoizedState;if(i=o.element,s.isDehydrated)if(s={element:i,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){n=Vs(Error(W(423)),t),t=Um(e,t,i,r,n);break e}else if(i!==n){n=Vs(Error(W(424)),t),t=Um(e,t,i,r,n);break e}else for(Jt=Zi(t.stateNode.containerInfo.firstChild),er=t,je=!0,jr=null,r=qv(t,null,i,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Us(),i===n){t=wi(e,t,r);break e}Et(e,t,i,r)}t=t.child}return t;case 5:return Xv(t),e===null&&Lh(t),i=t.type,n=t.pendingProps,s=e!==null?e.memoizedProps:null,o=n.children,Ph(i,n)?o=null:s!==null&&Ph(i,s)&&(t.flags|=32),xy(e,t),Et(e,t,o,r),t.child;case 6:return e===null&&Lh(t),null;case 13:return Sy(e,t,r);case 4:return Ff(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Ks(t,null,i,r):Et(e,t,i,r),t.child;case 11:return i=t.type,n=t.pendingProps,n=t.elementType===i?n:Cr(i,n),Hm(e,t,i,n,r);case 7:return Et(e,t,t.pendingProps,r),t.child;case 8:return Et(e,t,t.pendingProps.children,r),t.child;case 12:return Et(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(i=t.type._context,n=t.pendingProps,s=t.memoizedProps,o=n.value,Se(ec,i._currentValue),i._currentValue=o,s!==null)if(Dr(s.value,o)){if(s.children===n.children&&!Ht.current){t=wi(e,t,r);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var u=a.firstContext;u!==null;){if(u.context===i){if(s.tag===1){u=gi(-1,r&-r),u.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var h=c.pending;h===null?u.next=u:(u.next=h.next,h.next=u),c.pending=u}}s.lanes|=r,u=s.alternate,u!==null&&(u.lanes|=r),Ah(s.return,r,t),a.lanes|=r;break}u=u.next}}else if(s.tag===10)o=s.type===t.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(W(341));o.lanes|=r,a=o.alternate,a!==null&&(a.lanes|=r),Ah(o,r,t),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===t){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}Et(e,t,n.children,r),t=t.child}return t;case 9:return n=t.type,i=t.pendingProps.children,Ns(t,r),n=_r(n),i=i(n),t.flags|=1,Et(e,t,i,r),t.child;case 14:return i=t.type,n=Cr(i,t.pendingProps),n=Cr(i.type,n),$m(e,t,i,n,r);case 15:return vy(e,t,t.type,t.pendingProps,r);case 17:return i=t.type,n=t.pendingProps,n=t.elementType===i?n:Cr(i,n),kl(e,t),t.tag=1,$t(i)?(e=!0,Gl(t)):e=!1,Ns(t,r),my(t,i,n),Bh(t,i,n,r),Fh(null,t,i,!0,e,r);case 19:return by(e,t,r);case 22:return yy(e,t,r)}throw Error(W(156,t.tag))};function Iy(e,t){return dv(e,t)}function Nb(e,t,r,i){this.tag=e,this.key=r,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=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function pr(e,t,r,i){return new Nb(e,t,r,i)}function tp(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Eb(e){if(typeof e=="function")return tp(e)?1:0;if(e!=null){if(e=e.$$typeof,e===xf)return 11;if(e===wf)return 14}return 2}function nn(e,t){var r=e.alternate;return r===null?(r=pr(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function jl(e,t,r,i,n,s){var o=2;if(i=e,typeof e=="function")tp(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case ls:return zn(r.children,n,s,t);case yf:o=8,n|=8;break;case ah:return e=pr(12,r,t,n|2),e.elementType=ah,e.lanes=s,e;case lh:return e=pr(13,r,t,n),e.elementType=lh,e.lanes=s,e;case ch:return e=pr(19,r,t,n),e.elementType=ch,e.lanes=s,e;case X0:return Ac(r,n,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case V0:o=10;break e;case Y0:o=9;break e;case xf:o=11;break e;case wf:o=14;break e;case Di:o=16,i=null;break e}throw Error(W(130,e==null?e:typeof e,""))}return t=pr(o,r,t,n),t.elementType=e,t.type=i,t.lanes=s,t}function zn(e,t,r,i){return e=pr(7,e,i,t),e.lanes=r,e}function Ac(e,t,r,i){return e=pr(22,e,i,t),e.elementType=X0,e.lanes=r,e.stateNode={isHidden:!1},e}function ju(e,t,r){return e=pr(6,e,null,t),e.lanes=r,e}function Pu(e,t,r){return t=pr(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function jb(e,t,r,i,n){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=cu(0),this.expirationTimes=cu(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=cu(0),this.identifierPrefix=i,this.onRecoverableError=n,this.mutableSourceEagerHydrationData=null}function rp(e,t,r,i,n,s,o,a,u){return e=new jb(e,t,r,a,u),t===1?(t=1,s===!0&&(t|=8)):t=0,s=pr(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:i,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},If(s),e}function Pb(e,t,r){var i=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:as,key:i==null?null:""+i,children:e,containerInfo:t,implementation:r}}function Fy(e){if(!e)return ln;e=e._reactInternals;e:{if(Gn(e)!==e||e.tag!==1)throw Error(W(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if($t(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(W(171))}if(e.tag===1){var r=e.type;if($t(r))return Fv(e,r,t)}return t}function Hy(e,t,r,i,n,s,o,a,u){return e=rp(r,i,!0,e,n,s,o,a,u),e.context=Fy(null),r=e.current,i=Pt(),n=rn(r),s=gi(i,n),s.callback=t??null,en(r,s,n),e.current.lanes=n,Ca(e,n,i),Wt(e,i),e}function Oc(e,t,r,i){var n=t.current,s=Pt(),o=rn(n);return r=Fy(r),t.context===null?t.context=r:t.pendingContext=r,t=gi(s,o),t.payload={element:e},i=i===void 0?null:i,i!==null&&(t.callback=i),e=en(n,t,o),e!==null&&(Rr(e,n,o,s),Sl(e,n,o)),o}function uc(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function eg(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<t?r:t}}function ip(e,t){eg(e,t),(e=e.alternate)&&eg(e,t)}function Mb(){return null}var $y=typeof reportError=="function"?reportError:function(e){console.error(e)};function np(e){this._internalRoot=e}Bc.prototype.render=np.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(W(409));Oc(e,t,null,null)};Bc.prototype.unmount=np.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Un(function(){Oc(null,e,null,null)}),t[yi]=null}};function Bc(e){this._internalRoot=e}Bc.prototype.unstable_scheduleHydration=function(e){if(e){var t=yv();e={blockedOn:null,target:e,priority:t};for(var r=0;r<Oi.length&&t!==0&&t<Oi[r].priority;r++);Oi.splice(r,0,e),r===0&&wv(e)}};function sp(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function zc(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function tg(){}function Tb(e,t,r,i,n){if(n){if(typeof i=="function"){var s=i;i=function(){var c=uc(o);s.call(c)}}var o=Hy(t,i,e,0,null,!1,!1,"",tg);return e._reactRootContainer=o,e[yi]=o.current,na(e.nodeType===8?e.parentNode:e),Un(),o}for(;n=e.lastChild;)e.removeChild(n);if(typeof i=="function"){var a=i;i=function(){var c=uc(u);a.call(c)}}var u=rp(e,0,!1,null,null,!1,!1,"",tg);return e._reactRootContainer=u,e[yi]=u.current,na(e.nodeType===8?e.parentNode:e),Un(function(){Oc(t,u,r,i)}),u}function Ic(e,t,r,i,n){var s=r._reactRootContainer;if(s){var o=s;if(typeof n=="function"){var a=n;n=function(){var u=uc(o);a.call(u)}}Oc(t,o,e,n)}else o=Tb(r,t,e,n,i);return uc(o)}_v=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var r=Po(t.pendingLanes);r!==0&&(Cf(t,r|1),Wt(t,$e()),!(fe&6)&&(Ys=$e()+500,dn()))}break;case 13:Un(function(){var i=xi(e,1);if(i!==null){var n=Pt();Rr(i,e,1,n)}}),ip(e,1)}};kf=function(e){if(e.tag===13){var t=xi(e,134217728);if(t!==null){var r=Pt();Rr(t,e,134217728,r)}ip(e,134217728)}};vv=function(e){if(e.tag===13){var t=rn(e),r=xi(e,t);if(r!==null){var i=Pt();Rr(r,e,t,i)}ip(e,t)}};yv=function(){return _e};xv=function(e,t){var r=_e;try{return _e=e,t()}finally{_e=r}};yh=function(e,t,r){switch(t){case"input":if(dh(e,r),t=r.name,r.type==="radio"&&t!=null){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<r.length;t++){var i=r[t];if(i!==e&&i.form===e.form){var n=Pc(i);if(!n)throw Error(W(90));G0(i),dh(i,n)}}}break;case"textarea":Z0(e,r);break;case"select":t=r.value,t!=null&&Ss(e,!!r.multiple,t,!1)}};ov=Jf;av=Un;var Rb={usingClientEntryPoint:!1,Events:[Na,ds,Pc,nv,sv,Jf]},go={findFiberByHostInstance:bn,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Db={bundleType:go.bundleType,version:go.version,rendererPackageName:go.rendererPackageName,rendererConfig:go.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Si.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=uv(e),e===null?null:e.stateNode},findFiberByHostInstance:go.findFiberByHostInstance||Mb,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Za=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Za.isDisabled&&Za.supportsFiber)try{kc=Za.inject(Db),Qr=Za}catch{}}ir.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Rb;ir.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!sp(t))throw Error(W(200));return Pb(e,t,null,r)};ir.createRoot=function(e,t){if(!sp(e))throw Error(W(299));var r=!1,i="",n=$y;return t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onRecoverableError!==void 0&&(n=t.onRecoverableError)),t=rp(e,1,!1,null,null,r,!1,i,n),e[yi]=t.current,na(e.nodeType===8?e.parentNode:e),new np(t)};ir.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(W(188)):(e=Object.keys(e).join(","),Error(W(268,e)));return e=uv(t),e=e===null?null:e.stateNode,e};ir.flushSync=function(e){return Un(e)};ir.hydrate=function(e,t,r){if(!zc(t))throw Error(W(200));return Ic(null,e,t,!0,r)};ir.hydrateRoot=function(e,t,r){if(!sp(e))throw Error(W(405));var i=r!=null&&r.hydratedSources||null,n=!1,s="",o=$y;if(r!=null&&(r.unstable_strictMode===!0&&(n=!0),r.identifierPrefix!==void 0&&(s=r.identifierPrefix),r.onRecoverableError!==void 0&&(o=r.onRecoverableError)),t=Hy(t,null,e,1,r??null,n,!1,s,o),e[yi]=t.current,na(e),i)for(e=0;e<i.length;e++)r=i[e],n=r._getVersion,n=n(r._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[r,n]:t.mutableSourceEagerHydrationData.push(r,n);return new Bc(t)};ir.render=function(e,t,r){if(!zc(t))throw Error(W(200));return Ic(null,e,t,!1,r)};ir.unmountComponentAtNode=function(e){if(!zc(e))throw Error(W(40));return e._reactRootContainer?(Un(function(){Ic(null,null,e,!1,function(){e._reactRootContainer=null,e[yi]=null})}),!0):!1};ir.unstable_batchedUpdates=Jf;ir.unstable_renderSubtreeIntoContainer=function(e,t,r,i){if(!zc(r))throw Error(W(200));if(e==null||e._reactInternals===void 0)throw Error(W(38));return Ic(e,t,r,!1,i)};ir.version="18.3.1-next-f1338f8080-20240426";function Wy(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Wy)}catch(e){console.error(e)}}Wy(),W0.exports=ir;var ja=W0.exports,rg=ja;sh.createRoot=rg.createRoot,sh.hydrateRoot=rg.hydrateRoot;var eo=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Lb={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},zi,hf,v0,Ab=(v0=class{constructor(){G(this,zi,Lb);G(this,hf,!1)}setTimeoutProvider(e){Y(this,zi,e)}setTimeout(e,t){return N(this,zi).setTimeout(e,t)}clearTimeout(e){N(this,zi).clearTimeout(e)}setInterval(e,t){return N(this,zi).setInterval(e,t)}clearInterval(e){N(this,zi).clearInterval(e)}},zi=new WeakMap,hf=new WeakMap,v0),Nn=new Ab;function Ob(e){setTimeout(e,0)}var Kn=typeof window>"u"||"Deno"in globalThis;function jt(){}function Bb(e,t){return typeof e=="function"?e(t):e}function Jh(e){return typeof e=="number"&&e>=0&&e!==1/0}function Uy(e,t){return Math.max(e+(t||0)-Date.now(),0)}function sn(e,t){return typeof e=="function"?e(t):e}function cr(e,t){return typeof e=="function"?e(t):e}function ig(e,t){const{type:r="all",exact:i,fetchStatus:n,predicate:s,queryKey:o,stale:a}=e;if(o){if(i){if(t.queryHash!==op(o,t.options))return!1}else if(!fa(t.queryKey,o))return!1}if(r!=="all"){const u=t.isActive();if(r==="active"&&!u||r==="inactive"&&u)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||n&&n!==t.state.fetchStatus||s&&!s(t))}function ng(e,t){const{exact:r,status:i,predicate:n,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return!1;if(r){if(qn(t.options.mutationKey)!==qn(s))return!1}else if(!fa(t.options.mutationKey,s))return!1}return!(i&&t.state.status!==i||n&&!n(t))}function op(e,t){return((t==null?void 0:t.queryKeyHashFn)||qn)(e)}function qn(e){return JSON.stringify(e,(t,r)=>Zh(r)?Object.keys(r).sort().reduce((i,n)=>(i[n]=r[n],i),{}):r)}function fa(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>fa(e[r],t[r])):!1}var zb=Object.prototype.hasOwnProperty;function Ky(e,t,r=0){if(e===t)return e;if(r>500)return t;const i=sg(e)&&sg(t);if(!i&&!(Zh(e)&&Zh(t)))return t;const s=(i?e:Object.keys(e)).length,o=i?t:Object.keys(t),a=o.length,u=i?new Array(a):{};let c=0;for(let h=0;h<a;h++){const d=i?h:o[h],f=e[d],p=t[d];if(f===p){u[d]=f,(i?h<s:zb.call(e,d))&&c++;continue}if(f===null||p===null||typeof f!="object"||typeof p!="object"){u[d]=p;continue}const m=Ky(f,p,r+1);u[d]=m,m===f&&c++}return s===a&&c===s?e:u}function hc(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function sg(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Zh(e){if(!og(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!og(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function og(e){return Object.prototype.toString.call(e)==="[object Object]"}function Ib(e){return new Promise(t=>{Nn.setTimeout(t,e)})}function ed(e,t,r){return typeof r.structuralSharing=="function"?r.structuralSharing(e,t):r.structuralSharing!==!1?Ky(e,t):t}function Fb(e,t,r=0){const i=[...e,t];return r&&i.length>r?i.slice(1):i}function Hb(e,t,r=0){const i=[t,...e];return r&&i.length>r?i.slice(0,-1):i}var ap=Symbol();function qy(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===ap?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function lp(e,t){return typeof e=="function"?e(...t):!!e}function $b(e,t,r){let i=!1,n;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(n??(n=t()),i||(i=!0,n.aborted?r():n.addEventListener("abort",r,{once:!0})),n)}),e}var jn,Ii,Ms,y0,Wb=(y0=class extends eo{constructor(){super();G(this,jn);G(this,Ii);G(this,Ms);Y(this,Ms,t=>{if(!Kn&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){N(this,Ii)||this.setEventListener(N(this,Ms))}onUnsubscribe(){var t;this.hasListeners()||((t=N(this,Ii))==null||t.call(this),Y(this,Ii,void 0))}setEventListener(t){var r;Y(this,Ms,t),(r=N(this,Ii))==null||r.call(this),Y(this,Ii,t(i=>{typeof i=="boolean"?this.setFocused(i):this.onFocus()}))}setFocused(t){N(this,jn)!==t&&(Y(this,jn,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof N(this,jn)=="boolean"?N(this,jn):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},jn=new WeakMap,Ii=new WeakMap,Ms=new WeakMap,y0),cp=new Wb;function td(){let e,t;const r=new Promise((n,s)=>{e=n,t=s});r.status="pending",r.catch(()=>{});function i(n){Object.assign(r,n),delete r.resolve,delete r.reject}return r.resolve=n=>{i({status:"fulfilled",value:n}),e(n)},r.reject=n=>{i({status:"rejected",reason:n}),t(n)},r}var Ub=Ob;function Kb(){let e=[],t=0,r=a=>{a()},i=a=>{a()},n=Ub;const s=a=>{t?e.push(a):n(()=>{r(a)})},o=()=>{const a=e;e=[],a.length&&n(()=>{i(()=>{a.forEach(u=>{r(u)})})})};return{batch:a=>{let u;t++;try{u=a()}finally{t--,t||o()}return u},batchCalls:a=>(...u)=>{s(()=>{a(...u)})},schedule:s,setNotifyFunction:a=>{r=a},setBatchNotifyFunction:a=>{i=a},setScheduler:a=>{n=a}}}var Ze=Kb(),Ts,Fi,Rs,x0,qb=(x0=class extends eo{constructor(){super();G(this,Ts,!0);G(this,Fi);G(this,Rs);Y(this,Rs,t=>{if(!Kn&&window.addEventListener){const r=()=>t(!0),i=()=>t(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",i,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",i)}}})}onSubscribe(){N(this,Fi)||this.setEventListener(N(this,Rs))}onUnsubscribe(){var t;this.hasListeners()||((t=N(this,Fi))==null||t.call(this),Y(this,Fi,void 0))}setEventListener(t){var r;Y(this,Rs,t),(r=N(this,Fi))==null||r.call(this),Y(this,Fi,t(this.setOnline.bind(this)))}setOnline(t){N(this,Ts)!==t&&(Y(this,Ts,t),this.listeners.forEach(i=>{i(t)}))}isOnline(){return N(this,Ts)}},Ts=new WeakMap,Fi=new WeakMap,Rs=new WeakMap,x0),dc=new qb;function Vb(e){return Math.min(1e3*2**e,3e4)}function Vy(e){return(e??"online")==="online"?dc.isOnline():!0}var rd=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Yy(e){let t=!1,r=0,i;const n=td(),s=()=>n.status!=="pending",o=y=>{var C;if(!s()){const g=new rd(y);f(g),(C=e.onCancel)==null||C.call(e,g)}},a=()=>{t=!0},u=()=>{t=!1},c=()=>cp.isFocused()&&(e.networkMode==="always"||dc.isOnline())&&e.canRun(),h=()=>Vy(e.networkMode)&&e.canRun(),d=y=>{s()||(i==null||i(),n.resolve(y))},f=y=>{s()||(i==null||i(),n.reject(y))},p=()=>new Promise(y=>{var C;i=g=>{(s()||c())&&y(g)},(C=e.onPause)==null||C.call(e)}).then(()=>{var y;i=void 0,s()||(y=e.onContinue)==null||y.call(e)}),m=()=>{if(s())return;let y;const C=r===0?e.initialPromise:void 0;try{y=C??e.fn()}catch(g){y=Promise.reject(g)}Promise.resolve(y).then(d).catch(g=>{var b;if(s())return;const _=e.retry??(Kn?0:3),v=e.retryDelay??Vb,x=typeof v=="function"?v(r,g):v,k=_===!0||typeof _=="number"&&r<_||typeof _=="function"&&_(r,g);if(t||!k){f(g);return}r++,(b=e.onFail)==null||b.call(e,r,g),Ib(x).then(()=>c()?void 0:p()).then(()=>{t?f(g):m()})})};return{promise:n,status:()=>n.status,cancel:o,continue:()=>(i==null||i(),n),cancelRetry:a,continueRetry:u,canStart:h,start:()=>(h()?m():p().then(m),n)}}var Pn,w0,Xy=(w0=class{constructor(){G(this,Pn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Jh(this.gcTime)&&Y(this,Pn,Nn.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Kn?1/0:5*60*1e3))}clearGcTimeout(){N(this,Pn)&&(Nn.clearTimeout(N(this,Pn)),Y(this,Pn,void 0))}},Pn=new WeakMap,w0),Mn,Ds,lr,Tn,rt,va,Rn,kr,oi,S0,Yb=(S0=class extends Xy{constructor(t){super();G(this,kr);G(this,Mn);G(this,Ds);G(this,lr);G(this,Tn);G(this,rt);G(this,va);G(this,Rn);Y(this,Rn,!1),Y(this,va,t.defaultOptions),this.setOptions(t.options),this.observers=[],Y(this,Tn,t.client),Y(this,lr,N(this,Tn).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Y(this,Mn,lg(this.options)),this.state=t.state??N(this,Mn),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=N(this,rt))==null?void 0:t.promise}setOptions(t){if(this.options={...N(this,va),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=lg(this.options);r.data!==void 0&&(this.setState(ag(r.data,r.dataUpdatedAt)),Y(this,Mn,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&N(this,lr).remove(this)}setData(t,r){const i=ed(this.state.data,t,this.options);return ae(this,kr,oi).call(this,{data:i,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),i}setState(t,r){ae(this,kr,oi).call(this,{type:"setState",state:t,setStateOptions:r})}cancel(t){var i,n;const r=(i=N(this,rt))==null?void 0:i.promise;return(n=N(this,rt))==null||n.cancel(t),r?r.then(jt).catch(jt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(N(this,Mn))}isActive(){return this.observers.some(t=>cr(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ap||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>sn(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!Uy(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(i=>i.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=N(this,rt))==null||r.continue()}onOnline(){var r;const t=this.observers.find(i=>i.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=N(this,rt))==null||r.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),N(this,lr).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(N(this,rt)&&(N(this,Rn)?N(this,rt).cancel({revert:!0}):N(this,rt).cancelRetry()),this.scheduleGc()),N(this,lr).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||ae(this,kr,oi).call(this,{type:"invalidate"})}async fetch(t,r){var u,c,h,d,f,p,m,y,C,g,_,v;if(this.state.fetchStatus!=="idle"&&((u=N(this,rt))==null?void 0:u.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(N(this,rt))return N(this,rt).continueRetry(),N(this,rt).promise}if(t&&this.setOptions(t),!this.options.queryFn){const x=this.observers.find(k=>k.options.queryFn);x&&this.setOptions(x.options)}const i=new AbortController,n=x=>{Object.defineProperty(x,"signal",{enumerable:!0,get:()=>(Y(this,Rn,!0),i.signal)})},s=()=>{const x=qy(this.options,r),b=(()=>{const j={client:N(this,Tn),queryKey:this.queryKey,meta:this.meta};return n(j),j})();return Y(this,Rn,!1),this.options.persister?this.options.persister(x,b,this):x(b)},a=(()=>{const x={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:N(this,Tn),state:this.state,fetchFn:s};return n(x),x})();(c=this.options.behavior)==null||c.onFetch(a,this),Y(this,Ds,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((h=a.fetchOptions)==null?void 0:h.meta))&&ae(this,kr,oi).call(this,{type:"fetch",meta:(d=a.fetchOptions)==null?void 0:d.meta}),Y(this,rt,Yy({initialPromise:r==null?void 0:r.initialPromise,fn:a.fetchFn,onCancel:x=>{x instanceof rd&&x.revert&&this.setState({...N(this,Ds),fetchStatus:"idle"}),i.abort()},onFail:(x,k)=>{ae(this,kr,oi).call(this,{type:"failed",failureCount:x,error:k})},onPause:()=>{ae(this,kr,oi).call(this,{type:"pause"})},onContinue:()=>{ae(this,kr,oi).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const x=await N(this,rt).start();if(x===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(x),(p=(f=N(this,lr).config).onSuccess)==null||p.call(f,x,this),(y=(m=N(this,lr).config).onSettled)==null||y.call(m,x,this.state.error,this),x}catch(x){if(x instanceof rd){if(x.silent)return N(this,rt).promise;if(x.revert){if(this.state.data===void 0)throw x;return this.state.data}}throw ae(this,kr,oi).call(this,{type:"error",error:x}),(g=(C=N(this,lr).config).onError)==null||g.call(C,x,this),(v=(_=N(this,lr).config).onSettled)==null||v.call(_,this.state.data,x,this),x}finally{this.scheduleGc()}}},Mn=new WeakMap,Ds=new WeakMap,lr=new WeakMap,Tn=new WeakMap,rt=new WeakMap,va=new WeakMap,Rn=new WeakMap,kr=new WeakSet,oi=function(t){const r=i=>{switch(t.type){case"failed":return{...i,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...i,fetchStatus:"paused"};case"continue":return{...i,fetchStatus:"fetching"};case"fetch":return{...i,...Qy(i.data,this.options),fetchMeta:t.meta??null};case"success":const n={...i,...ag(t.data,t.dataUpdatedAt),dataUpdateCount:i.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Y(this,Ds,t.manual?n:void 0),n;case"error":const s=t.error;return{...i,error:s,errorUpdateCount:i.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:i.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...i,isInvalidated:!0};case"setState":return{...i,...t.state}}};this.state=r(this.state),Ze.batch(()=>{this.observers.forEach(i=>{i.onQueryUpdate()}),N(this,lr).notify({query:this,type:"updated",action:t})})},S0);function Qy(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Vy(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function ag(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function lg(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,i=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?i??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var Bt,de,ya,kt,Dn,Ls,ci,Hi,xa,As,Os,Ln,An,$i,Bs,ge,To,id,nd,sd,od,ad,ld,cd,Gy,b0,Xb=(b0=class extends eo{constructor(t,r){super();G(this,ge);G(this,Bt);G(this,de);G(this,ya);G(this,kt);G(this,Dn);G(this,Ls);G(this,ci);G(this,Hi);G(this,xa);G(this,As);G(this,Os);G(this,Ln);G(this,An);G(this,$i);G(this,Bs,new Set);this.options=r,Y(this,Bt,t),Y(this,Hi,null),Y(this,ci,td()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(N(this,de).addObserver(this),cg(N(this,de),this.options)?ae(this,ge,To).call(this):this.updateResult(),ae(this,ge,od).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ud(N(this,de),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ud(N(this,de),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,ae(this,ge,ad).call(this),ae(this,ge,ld).call(this),N(this,de).removeObserver(this)}setOptions(t){const r=this.options,i=N(this,de);if(this.options=N(this,Bt).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof cr(this.options.enabled,N(this,de))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");ae(this,ge,cd).call(this),N(this,de).setOptions(this.options),r._defaulted&&!hc(this.options,r)&&N(this,Bt).getQueryCache().notify({type:"observerOptionsUpdated",query:N(this,de),observer:this});const n=this.hasListeners();n&&ug(N(this,de),i,this.options,r)&&ae(this,ge,To).call(this),this.updateResult(),n&&(N(this,de)!==i||cr(this.options.enabled,N(this,de))!==cr(r.enabled,N(this,de))||sn(this.options.staleTime,N(this,de))!==sn(r.staleTime,N(this,de)))&&ae(this,ge,id).call(this);const s=ae(this,ge,nd).call(this);n&&(N(this,de)!==i||cr(this.options.enabled,N(this,de))!==cr(r.enabled,N(this,de))||s!==N(this,$i))&&ae(this,ge,sd).call(this,s)}getOptimisticResult(t){const r=N(this,Bt).getQueryCache().build(N(this,Bt),t),i=this.createResult(r,t);return Gb(this,i)&&(Y(this,kt,i),Y(this,Ls,this.options),Y(this,Dn,N(this,de).state)),i}getCurrentResult(){return N(this,kt)}trackResult(t,r){return new Proxy(t,{get:(i,n)=>(this.trackProp(n),r==null||r(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&N(this,ci).status==="pending"&&N(this,ci).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(i,n))})}trackProp(t){N(this,Bs).add(t)}getCurrentQuery(){return N(this,de)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const r=N(this,Bt).defaultQueryOptions(t),i=N(this,Bt).getQueryCache().build(N(this,Bt),r);return i.fetch().then(()=>this.createResult(i,r))}fetch(t){return ae(this,ge,To).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),N(this,kt)))}createResult(t,r){var I;const i=N(this,de),n=this.options,s=N(this,kt),o=N(this,Dn),a=N(this,Ls),c=t!==i?t.state:N(this,ya),{state:h}=t;let d={...h},f=!1,p;if(r._optimisticResults){const P=this.hasListeners(),D=!P&&cg(t,r),M=P&&ug(t,i,r,n);(D||M)&&(d={...d,...Qy(h.data,t.options)}),r._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:m,errorUpdatedAt:y,status:C}=d;p=d.data;let g=!1;if(r.placeholderData!==void 0&&p===void 0&&C==="pending"){let P;s!=null&&s.isPlaceholderData&&r.placeholderData===(a==null?void 0:a.placeholderData)?(P=s.data,g=!0):P=typeof r.placeholderData=="function"?r.placeholderData((I=N(this,Os))==null?void 0:I.state.data,N(this,Os)):r.placeholderData,P!==void 0&&(C="success",p=ed(s==null?void 0:s.data,P,r),f=!0)}if(r.select&&p!==void 0&&!g)if(s&&p===(o==null?void 0:o.data)&&r.select===N(this,xa))p=N(this,As);else try{Y(this,xa,r.select),p=r.select(p),p=ed(s==null?void 0:s.data,p,r),Y(this,As,p),Y(this,Hi,null)}catch(P){Y(this,Hi,P)}N(this,Hi)&&(m=N(this,Hi),p=N(this,As),y=Date.now(),C="error");const _=d.fetchStatus==="fetching",v=C==="pending",x=C==="error",k=v&&_,b=p!==void 0,L={status:C,fetchStatus:d.fetchStatus,isPending:v,isSuccess:C==="success",isError:x,isInitialLoading:k,isLoading:k,data:p,dataUpdatedAt:d.dataUpdatedAt,error:m,errorUpdatedAt:y,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>c.dataUpdateCount||d.errorUpdateCount>c.errorUpdateCount,isFetching:_,isRefetching:_&&!v,isLoadingError:x&&!b,isPaused:d.fetchStatus==="paused",isPlaceholderData:f,isRefetchError:x&&b,isStale:up(t,r),refetch:this.refetch,promise:N(this,ci),isEnabled:cr(r.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const P=L.data!==void 0,D=L.status==="error"&&!P,M=E=>{D?E.reject(L.error):P&&E.resolve(L.data)},R=()=>{const E=Y(this,ci,L.promise=td());M(E)},O=N(this,ci);switch(O.status){case"pending":t.queryHash===i.queryHash&&M(O);break;case"fulfilled":(D||L.data!==O.value)&&R();break;case"rejected":(!D||L.error!==O.reason)&&R();break}}return L}updateResult(){const t=N(this,kt),r=this.createResult(N(this,de),this.options);if(Y(this,Dn,N(this,de).state),Y(this,Ls,this.options),N(this,Dn).data!==void 0&&Y(this,Os,N(this,de)),hc(r,t))return;Y(this,kt,r);const i=()=>{if(!t)return!0;const{notifyOnChangeProps:n}=this.options,s=typeof n=="function"?n():n;if(s==="all"||!s&&!N(this,Bs).size)return!0;const o=new Set(s??N(this,Bs));return this.options.throwOnError&&o.add("error"),Object.keys(N(this,kt)).some(a=>{const u=a;return N(this,kt)[u]!==t[u]&&o.has(u)})};ae(this,ge,Gy).call(this,{listeners:i()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&ae(this,ge,od).call(this)}},Bt=new WeakMap,de=new WeakMap,ya=new WeakMap,kt=new WeakMap,Dn=new WeakMap,Ls=new WeakMap,ci=new WeakMap,Hi=new WeakMap,xa=new WeakMap,As=new WeakMap,Os=new WeakMap,Ln=new WeakMap,An=new WeakMap,$i=new WeakMap,Bs=new WeakMap,ge=new WeakSet,To=function(t){ae(this,ge,cd).call(this);let r=N(this,de).fetch(this.options,t);return t!=null&&t.throwOnError||(r=r.catch(jt)),r},id=function(){ae(this,ge,ad).call(this);const t=sn(this.options.staleTime,N(this,de));if(Kn||N(this,kt).isStale||!Jh(t))return;const i=Uy(N(this,kt).dataUpdatedAt,t)+1;Y(this,Ln,Nn.setTimeout(()=>{N(this,kt).isStale||this.updateResult()},i))},nd=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(N(this,de)):this.options.refetchInterval)??!1},sd=function(t){ae(this,ge,ld).call(this),Y(this,$i,t),!(Kn||cr(this.options.enabled,N(this,de))===!1||!Jh(N(this,$i))||N(this,$i)===0)&&Y(this,An,Nn.setInterval(()=>{(this.options.refetchIntervalInBackground||cp.isFocused())&&ae(this,ge,To).call(this)},N(this,$i)))},od=function(){ae(this,ge,id).call(this),ae(this,ge,sd).call(this,ae(this,ge,nd).call(this))},ad=function(){N(this,Ln)&&(Nn.clearTimeout(N(this,Ln)),Y(this,Ln,void 0))},ld=function(){N(this,An)&&(Nn.clearInterval(N(this,An)),Y(this,An,void 0))},cd=function(){const t=N(this,Bt).getQueryCache().build(N(this,Bt),this.options);if(t===N(this,de))return;const r=N(this,de);Y(this,de,t),Y(this,ya,t.state),this.hasListeners()&&(r==null||r.removeObserver(this),t.addObserver(this))},Gy=function(t){Ze.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(N(this,kt))}),N(this,Bt).getQueryCache().notify({query:N(this,de),type:"observerResultsUpdated"})})},b0);function Qb(e,t){return cr(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function cg(e,t){return Qb(e,t)||e.state.data!==void 0&&ud(e,t,t.refetchOnMount)}function ud(e,t,r){if(cr(t.enabled,e)!==!1&&sn(t.staleTime,e)!=="static"){const i=typeof r=="function"?r(e):r;return i==="always"||i!==!1&&up(e,t)}return!1}function ug(e,t,r,i){return(e!==t||cr(i.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&up(e,r)}function up(e,t){return cr(t.enabled,e)!==!1&&e.isStaleByTime(sn(t.staleTime,e))}function Gb(e,t){return!hc(e.getCurrentResult(),t)}function hg(e){return{onFetch:(t,r)=>{var h,d,f,p,m;const i=t.options,n=(f=(d=(h=t.fetchOptions)==null?void 0:h.meta)==null?void 0:d.fetchMore)==null?void 0:f.direction,s=((p=t.state.data)==null?void 0:p.pages)||[],o=((m=t.state.data)==null?void 0:m.pageParams)||[];let a={pages:[],pageParams:[]},u=0;const c=async()=>{let y=!1;const C=v=>{$b(v,()=>t.signal,()=>y=!0)},g=qy(t.options,t.fetchOptions),_=async(v,x,k)=>{if(y)return Promise.reject();if(x==null&&v.pages.length)return Promise.resolve(v);const j=(()=>{const D={client:t.client,queryKey:t.queryKey,pageParam:x,direction:k?"backward":"forward",meta:t.options.meta};return C(D),D})(),L=await g(j),{maxPages:I}=t.options,P=k?Hb:Fb;return{pages:P(v.pages,L,I),pageParams:P(v.pageParams,x,I)}};if(n&&s.length){const v=n==="backward",x=v?Jb:dg,k={pages:s,pageParams:o},b=x(i,k);a=await _(k,b,v)}else{const v=e??s.length;do{const x=u===0?o[0]??i.initialPageParam:dg(i,a);if(u>0&&x==null)break;a=await _(a,x),u++}while(u<v)}return a};t.options.persister?t.fetchFn=()=>{var y,C;return(C=(y=t.options).persister)==null?void 0:C.call(y,c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=c}}}function dg(e,{pages:t,pageParams:r}){const i=t.length-1;return t.length>0?e.getNextPageParam(t[i],t,r[i],r):void 0}function Jb(e,{pages:t,pageParams:r}){var i;return t.length>0?(i=e.getPreviousPageParam)==null?void 0:i.call(e,t[0],t,r[0],r):void 0}var wa,Ur,Nt,On,Kr,Ri,C0,Zb=(C0=class extends Xy{constructor(t){super();G(this,Kr);G(this,wa);G(this,Ur);G(this,Nt);G(this,On);Y(this,wa,t.client),this.mutationId=t.mutationId,Y(this,Nt,t.mutationCache),Y(this,Ur,[]),this.state=t.state||Jy(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){N(this,Ur).includes(t)||(N(this,Ur).push(t),this.clearGcTimeout(),N(this,Nt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Y(this,Ur,N(this,Ur).filter(r=>r!==t)),this.scheduleGc(),N(this,Nt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){N(this,Ur).length||(this.state.status==="pending"?this.scheduleGc():N(this,Nt).remove(this))}continue(){var t;return((t=N(this,On))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,a,u,c,h,d,f,p,m,y,C,g,_,v,x,k,b,j,L,I;const r=()=>{ae(this,Kr,Ri).call(this,{type:"continue"})},i={client:N(this,wa),meta:this.options.meta,mutationKey:this.options.mutationKey};Y(this,On,Yy({fn:()=>this.options.mutationFn?this.options.mutationFn(t,i):Promise.reject(new Error("No mutationFn found")),onFail:(P,D)=>{ae(this,Kr,Ri).call(this,{type:"failed",failureCount:P,error:D})},onPause:()=>{ae(this,Kr,Ri).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>N(this,Nt).canRun(this)}));const n=this.state.status==="pending",s=!N(this,On).canStart();try{if(n)r();else{ae(this,Kr,Ri).call(this,{type:"pending",variables:t,isPaused:s}),await((a=(o=N(this,Nt).config).onMutate)==null?void 0:a.call(o,t,this,i));const D=await((c=(u=this.options).onMutate)==null?void 0:c.call(u,t,i));D!==this.state.context&&ae(this,Kr,Ri).call(this,{type:"pending",context:D,variables:t,isPaused:s})}const P=await N(this,On).start();return await((d=(h=N(this,Nt).config).onSuccess)==null?void 0:d.call(h,P,t,this.state.context,this,i)),await((p=(f=this.options).onSuccess)==null?void 0:p.call(f,P,t,this.state.context,i)),await((y=(m=N(this,Nt).config).onSettled)==null?void 0:y.call(m,P,null,this.state.variables,this.state.context,this,i)),await((g=(C=this.options).onSettled)==null?void 0:g.call(C,P,null,t,this.state.context,i)),ae(this,Kr,Ri).call(this,{type:"success",data:P}),P}catch(P){try{await((v=(_=N(this,Nt).config).onError)==null?void 0:v.call(_,P,t,this.state.context,this,i))}catch(D){Promise.reject(D)}try{await((k=(x=this.options).onError)==null?void 0:k.call(x,P,t,this.state.context,i))}catch(D){Promise.reject(D)}try{await((j=(b=N(this,Nt).config).onSettled)==null?void 0:j.call(b,void 0,P,this.state.variables,this.state.context,this,i))}catch(D){Promise.reject(D)}try{await((I=(L=this.options).onSettled)==null?void 0:I.call(L,void 0,P,t,this.state.context,i))}catch(D){Promise.reject(D)}throw ae(this,Kr,Ri).call(this,{type:"error",error:P}),P}finally{N(this,Nt).runNext(this)}}},wa=new WeakMap,Ur=new WeakMap,Nt=new WeakMap,On=new WeakMap,Kr=new WeakSet,Ri=function(t){const r=i=>{switch(t.type){case"failed":return{...i,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...i,isPaused:!0};case"continue":return{...i,isPaused:!1};case"pending":return{...i,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...i,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...i,data:void 0,error:t.error,failureCount:i.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=r(this.state),Ze.batch(()=>{N(this,Ur).forEach(i=>{i.onMutationUpdate(t)}),N(this,Nt).notify({mutation:this,type:"updated",action:t})})},C0);function Jy(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ui,Nr,Sa,k0,eC=(k0=class extends eo{constructor(t={}){super();G(this,ui);G(this,Nr);G(this,Sa);this.config=t,Y(this,ui,new Set),Y(this,Nr,new Map),Y(this,Sa,0)}build(t,r,i){const n=new Zb({client:t,mutationCache:this,mutationId:++Oa(this,Sa)._,options:t.defaultMutationOptions(r),state:i});return this.add(n),n}add(t){N(this,ui).add(t);const r=el(t);if(typeof r=="string"){const i=N(this,Nr).get(r);i?i.push(t):N(this,Nr).set(r,[t])}this.notify({type:"added",mutation:t})}remove(t){if(N(this,ui).delete(t)){const r=el(t);if(typeof r=="string"){const i=N(this,Nr).get(r);if(i)if(i.length>1){const n=i.indexOf(t);n!==-1&&i.splice(n,1)}else i[0]===t&&N(this,Nr).delete(r)}}this.notify({type:"removed",mutation:t})}canRun(t){const r=el(t);if(typeof r=="string"){const i=N(this,Nr).get(r),n=i==null?void 0:i.find(s=>s.state.status==="pending");return!n||n===t}else return!0}runNext(t){var i;const r=el(t);if(typeof r=="string"){const n=(i=N(this,Nr).get(r))==null?void 0:i.find(s=>s!==t&&s.state.isPaused);return(n==null?void 0:n.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Ze.batch(()=>{N(this,ui).forEach(t=>{this.notify({type:"removed",mutation:t})}),N(this,ui).clear(),N(this,Nr).clear()})}getAll(){return Array.from(N(this,ui))}find(t){const r={exact:!0,...t};return this.getAll().find(i=>ng(r,i))}findAll(t={}){return this.getAll().filter(r=>ng(t,r))}notify(t){Ze.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>r.state.isPaused);return Ze.batch(()=>Promise.all(t.map(r=>r.continue().catch(jt))))}},ui=new WeakMap,Nr=new WeakMap,Sa=new WeakMap,k0);function el(e){var t;return(t=e.options.scope)==null?void 0:t.id}var hi,Wi,zt,di,_i,Pl,hd,N0,tC=(N0=class extends eo{constructor(r,i){super();G(this,_i);G(this,hi);G(this,Wi);G(this,zt);G(this,di);Y(this,hi,r),this.setOptions(i),this.bindMethods(),ae(this,_i,Pl).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(r){var n;const i=this.options;this.options=N(this,hi).defaultMutationOptions(r),hc(this.options,i)||N(this,hi).getMutationCache().notify({type:"observerOptionsUpdated",mutation:N(this,zt),observer:this}),i!=null&&i.mutationKey&&this.options.mutationKey&&qn(i.mutationKey)!==qn(this.options.mutationKey)?this.reset():((n=N(this,zt))==null?void 0:n.state.status)==="pending"&&N(this,zt).setOptions(this.options)}onUnsubscribe(){var r;this.hasListeners()||(r=N(this,zt))==null||r.removeObserver(this)}onMutationUpdate(r){ae(this,_i,Pl).call(this),ae(this,_i,hd).call(this,r)}getCurrentResult(){return N(this,Wi)}reset(){var r;(r=N(this,zt))==null||r.removeObserver(this),Y(this,zt,void 0),ae(this,_i,Pl).call(this),ae(this,_i,hd).call(this)}mutate(r,i){var n;return Y(this,di,i),(n=N(this,zt))==null||n.removeObserver(this),Y(this,zt,N(this,hi).getMutationCache().build(N(this,hi),this.options)),N(this,zt).addObserver(this),N(this,zt).execute(r)}},hi=new WeakMap,Wi=new WeakMap,zt=new WeakMap,di=new WeakMap,_i=new WeakSet,Pl=function(){var i;const r=((i=N(this,zt))==null?void 0:i.state)??Jy();Y(this,Wi,{...r,isPending:r.status==="pending",isSuccess:r.status==="success",isError:r.status==="error",isIdle:r.status==="idle",mutate:this.mutate,reset:this.reset})},hd=function(r){Ze.batch(()=>{var i,n,s,o,a,u,c,h;if(N(this,di)&&this.hasListeners()){const d=N(this,Wi).variables,f=N(this,Wi).context,p={client:N(this,hi),meta:this.options.meta,mutationKey:this.options.mutationKey};if((r==null?void 0:r.type)==="success"){try{(n=(i=N(this,di)).onSuccess)==null||n.call(i,r.data,d,f,p)}catch(m){Promise.reject(m)}try{(o=(s=N(this,di)).onSettled)==null||o.call(s,r.data,null,d,f,p)}catch(m){Promise.reject(m)}}else if((r==null?void 0:r.type)==="error"){try{(u=(a=N(this,di)).onError)==null||u.call(a,r.error,d,f,p)}catch(m){Promise.reject(m)}try{(h=(c=N(this,di)).onSettled)==null||h.call(c,void 0,r.error,d,f,p)}catch(m){Promise.reject(m)}}}this.listeners.forEach(d=>{d(N(this,Wi))})})},N0),qr,E0,rC=(E0=class extends eo{constructor(t={}){super();G(this,qr);this.config=t,Y(this,qr,new Map)}build(t,r,i){const n=r.queryKey,s=r.queryHash??op(n,r);let o=this.get(s);return o||(o=new Yb({client:t,queryKey:n,queryHash:s,options:t.defaultQueryOptions(r),state:i,defaultOptions:t.getQueryDefaults(n)}),this.add(o)),o}add(t){N(this,qr).has(t.queryHash)||(N(this,qr).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const r=N(this,qr).get(t.queryHash);r&&(t.destroy(),r===t&&N(this,qr).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Ze.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return N(this,qr).get(t)}getAll(){return[...N(this,qr).values()]}find(t){const r={exact:!0,...t};return this.getAll().find(i=>ig(r,i))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(i=>ig(t,i)):r}notify(t){Ze.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){Ze.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Ze.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},qr=new WeakMap,E0),Oe,Ui,Ki,zs,Is,qi,Fs,Hs,j0,iC=(j0=class{constructor(e={}){G(this,Oe);G(this,Ui);G(this,Ki);G(this,zs);G(this,Is);G(this,qi);G(this,Fs);G(this,Hs);Y(this,Oe,e.queryCache||new rC),Y(this,Ui,e.mutationCache||new eC),Y(this,Ki,e.defaultOptions||{}),Y(this,zs,new Map),Y(this,Is,new Map),Y(this,qi,0)}mount(){Oa(this,qi)._++,N(this,qi)===1&&(Y(this,Fs,cp.subscribe(async e=>{e&&(await this.resumePausedMutations(),N(this,Oe).onFocus())})),Y(this,Hs,dc.subscribe(async e=>{e&&(await this.resumePausedMutations(),N(this,Oe).onOnline())})))}unmount(){var e,t;Oa(this,qi)._--,N(this,qi)===0&&((e=N(this,Fs))==null||e.call(this),Y(this,Fs,void 0),(t=N(this,Hs))==null||t.call(this),Y(this,Hs,void 0))}isFetching(e){return N(this,Oe).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return N(this,Ui).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=N(this,Oe).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=N(this,Oe).build(this,t),i=r.state.data;return i===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(sn(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(i))}getQueriesData(e){return N(this,Oe).findAll(e).map(({queryKey:t,state:r})=>{const i=r.data;return[t,i]})}setQueryData(e,t,r){const i=this.defaultQueryOptions({queryKey:e}),n=N(this,Oe).get(i.queryHash),s=n==null?void 0:n.state.data,o=Bb(t,s);if(o!==void 0)return N(this,Oe).build(this,i).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return Ze.batch(()=>N(this,Oe).findAll(e).map(({queryKey:i})=>[i,this.setQueryData(i,t,r)]))}getQueryState(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=N(this,Oe).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=N(this,Oe);Ze.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=N(this,Oe);return Ze.batch(()=>(r.findAll(e).forEach(i=>{i.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},i=Ze.batch(()=>N(this,Oe).findAll(e).map(n=>n.cancel(r)));return Promise.all(i).then(jt).catch(jt)}invalidateQueries(e,t={}){return Ze.batch(()=>(N(this,Oe).findAll(e).forEach(r=>{r.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const r={...t,cancelRefetch:t.cancelRefetch??!0},i=Ze.batch(()=>N(this,Oe).findAll(e).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let s=n.fetch(void 0,r);return r.throwOnError||(s=s.catch(jt)),n.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(i).then(jt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=N(this,Oe).build(this,t);return r.isStaleByTime(sn(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(jt).catch(jt)}fetchInfiniteQuery(e){return e.behavior=hg(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(jt).catch(jt)}ensureInfiniteQueryData(e){return e.behavior=hg(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return dc.isOnline()?N(this,Ui).resumePausedMutations():Promise.resolve()}getQueryCache(){return N(this,Oe)}getMutationCache(){return N(this,Ui)}getDefaultOptions(){return N(this,Ki)}setDefaultOptions(e){Y(this,Ki,e)}setQueryDefaults(e,t){N(this,zs).set(qn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...N(this,zs).values()],r={};return t.forEach(i=>{fa(e,i.queryKey)&&Object.assign(r,i.defaultOptions)}),r}setMutationDefaults(e,t){N(this,Is).set(qn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...N(this,Is).values()],r={};return t.forEach(i=>{fa(e,i.mutationKey)&&Object.assign(r,i.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...N(this,Ki).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=op(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===ap&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...N(this,Ki).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){N(this,Oe).clear(),N(this,Ui).clear()}},Oe=new WeakMap,Ui=new WeakMap,Ki=new WeakMap,zs=new WeakMap,Is=new WeakMap,qi=new WeakMap,Fs=new WeakMap,Hs=new WeakMap,j0),Zy=F.createContext(void 0),Lr=e=>{const t=F.useContext(Zy);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},nC=({client:e,children:t})=>(F.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(Zy.Provider,{value:e,children:t})),ex=F.createContext(!1),sC=()=>F.useContext(ex);ex.Provider;function oC(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var aC=F.createContext(oC()),lC=()=>F.useContext(aC),cC=(e,t,r)=>{const i=r!=null&&r.state.error&&typeof e.throwOnError=="function"?lp(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||i)&&(t.isReset()||(e.retryOnMount=!1))},uC=e=>{F.useEffect(()=>{e.clearReset()},[e])},hC=({result:e,errorResetBoundary:t,throwOnError:r,query:i,suspense:n})=>e.isError&&!t.isReset()&&!e.isFetching&&i&&(n&&e.data===void 0||lp(r,[e.error,i])),dC=e=>{if(e.suspense){const r=n=>n==="static"?n:Math.max(n??1e3,1e3),i=e.staleTime;e.staleTime=typeof i=="function"?(...n)=>r(i(...n)):r(i),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},fC=(e,t)=>e.isLoading&&e.isFetching&&!t,pC=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,fg=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function mC(e,t,r){var f,p,m,y;const i=sC(),n=lC(),s=Lr(),o=s.defaultQueryOptions(e);(p=(f=s.getDefaultOptions().queries)==null?void 0:f._experimental_beforeQuery)==null||p.call(f,o);const a=s.getQueryCache().get(o.queryHash);o._optimisticResults=i?"isRestoring":"optimistic",dC(o),cC(o,n,a),uC(n);const u=!s.getQueryCache().get(o.queryHash),[c]=F.useState(()=>new t(s,o)),h=c.getOptimisticResult(o),d=!i&&e.subscribed!==!1;if(F.useSyncExternalStore(F.useCallback(C=>{const g=d?c.subscribe(Ze.batchCalls(C)):jt;return c.updateResult(),g},[c,d]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),F.useEffect(()=>{c.setOptions(o)},[o,c]),pC(o,h))throw fg(o,c,n);if(hC({result:h,errorResetBoundary:n,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw h.error;if((y=(m=s.getDefaultOptions().queries)==null?void 0:m._experimental_afterQuery)==null||y.call(m,o,h),o.experimental_prefetchInRender&&!Kn&&fC(h,i)){const C=u?fg(o,c,n):a==null?void 0:a.promise;C==null||C.catch(jt).finally(()=>{c.updateResult()})}return o.notifyOnChangeProps?h:c.trackResult(h)}function Pe(e,t){return mC(e,Xb)}function ye(e,t){const r=Lr(),[i]=F.useState(()=>new tC(r,e));F.useEffect(()=>{i.setOptions(e)},[i,e]);const n=F.useSyncExternalStore(F.useCallback(o=>i.subscribe(Ze.batchCalls(o)),[i]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),s=F.useCallback((o,a)=>{i.mutate(o,a).catch(jt)},[i]);if(n.error&&lp(i.options.throwOnError,[n.error]))throw n.error;return{...n,mutate:s,mutateAsync:n.mutate}}const pg=["backlog","todo","planning","in_progress","in_review","done"],yn={Backlog:"backlog",Triage:"backlog",Unknown:"backlog",Todo:"todo","To Do":"todo",Ready:"todo",Unstarted:"todo","In Planning":"planning",Planning:"planning",Planned:"planning",Discovery:"planning","In Progress":"in_progress",Started:"in_progress",Active:"in_progress","In Review":"in_review",Review:"in_review",QA:"in_review",Testing:"in_review",Done:"done",Completed:"done",Closed:"done",Canceled:"canceled",Cancelled:"canceled",Duplicate:"canceled","Won't Do":"canceled",Wontfix:"canceled"};/**
41
+ * @license lucide-react v0.400.0 - ISC
42
+ *
43
+ * This source code is licensed under the ISC license.
44
+ * See the LICENSE file in the root directory of this source tree.
45
+ */const gC=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),tx=(...e)=>e.filter((t,r,i)=>!!t&&i.indexOf(t)===r).join(" ");/**
46
+ * @license lucide-react v0.400.0 - ISC
47
+ *
48
+ * This source code is licensed under the ISC license.
49
+ * See the LICENSE file in the root directory of this source tree.
50
+ */var _C={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
51
+ * @license lucide-react v0.400.0 - ISC
52
+ *
53
+ * This source code is licensed under the ISC license.
54
+ * See the LICENSE file in the root directory of this source tree.
55
+ */const vC=F.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:i,className:n="",children:s,iconNode:o,...a},u)=>F.createElement("svg",{ref:u,..._C,width:t,height:t,stroke:e,strokeWidth:i?Number(r)*24/Number(t):r,className:tx("lucide",n),...a},[...o.map(([c,h])=>F.createElement(c,h)),...Array.isArray(s)?s:[s]]));/**
56
+ * @license lucide-react v0.400.0 - ISC
57
+ *
58
+ * This source code is licensed under the ISC license.
59
+ * See the LICENSE file in the root directory of this source tree.
60
+ */const J=(e,t)=>{const r=F.forwardRef(({className:i,...n},s)=>F.createElement(vC,{ref:s,iconNode:t,className:tx(`lucide-${gC(e)}`,i),...n}));return r.displayName=`${e}`,r};/**
61
+ * @license lucide-react v0.400.0 - ISC
62
+ *
63
+ * This source code is licensed under the ISC license.
64
+ * See the LICENSE file in the root directory of this source tree.
65
+ */const hp=J("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
66
+ * @license lucide-react v0.400.0 - ISC
67
+ *
68
+ * This source code is licensed under the ISC license.
69
+ * See the LICENSE file in the root directory of this source tree.
70
+ */const rx=J("ArrowRightLeft",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);/**
71
+ * @license lucide-react v0.400.0 - ISC
72
+ *
73
+ * This source code is licensed under the ISC license.
74
+ * See the LICENSE file in the root directory of this source tree.
75
+ */const ix=J("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
76
+ * @license lucide-react v0.400.0 - ISC
77
+ *
78
+ * This source code is licensed under the ISC license.
79
+ * See the LICENSE file in the root directory of this source tree.
80
+ */const dd=J("BarChart3",[["path",{d:"M3 3v18h18",key:"1s2lah"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/**
81
+ * @license lucide-react v0.400.0 - ISC
82
+ *
83
+ * This source code is licensed under the ISC license.
84
+ * See the LICENSE file in the root directory of this source tree.
85
+ */const yC=J("BellOff",[["path",{d:"M8.7 3A6 6 0 0 1 18 8a21.3 21.3 0 0 0 .6 5",key:"o7mx20"}],["path",{d:"M17 17H3s3-2 3-9a4.67 4.67 0 0 1 .3-1.7",key:"16f1lm"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
86
+ * @license lucide-react v0.400.0 - ISC
87
+ *
88
+ * This source code is licensed under the ISC license.
89
+ * See the LICENSE file in the root directory of this source tree.
90
+ */const nx=J("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);/**
91
+ * @license lucide-react v0.400.0 - ISC
92
+ *
93
+ * This source code is licensed under the ISC license.
94
+ * See the LICENSE file in the root directory of this source tree.
95
+ */const sx=J("BookOpen",[["path",{d:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z",key:"vv98re"}],["path",{d:"M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z",key:"1cyq3y"}]]);/**
96
+ * @license lucide-react v0.400.0 - ISC
97
+ *
98
+ * This source code is licensed under the ISC license.
99
+ * See the LICENSE file in the root directory of this source tree.
100
+ */const xC=J("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/**
101
+ * @license lucide-react v0.400.0 - ISC
102
+ *
103
+ * This source code is licensed under the ISC license.
104
+ * See the LICENSE file in the root directory of this source tree.
105
+ */const fc=J("Box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);/**
106
+ * @license lucide-react v0.400.0 - ISC
107
+ *
108
+ * This source code is licensed under the ISC license.
109
+ * See the LICENSE file in the root directory of this source tree.
110
+ */const ox=J("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/**
111
+ * @license lucide-react v0.400.0 - ISC
112
+ *
113
+ * This source code is licensed under the ISC license.
114
+ * See the LICENSE file in the root directory of this source tree.
115
+ */const wC=J("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/**
116
+ * @license lucide-react v0.400.0 - ISC
117
+ *
118
+ * This source code is licensed under the ISC license.
119
+ * See the LICENSE file in the root directory of this source tree.
120
+ */const ys=J("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
121
+ * @license lucide-react v0.400.0 - ISC
122
+ *
123
+ * This source code is licensed under the ISC license.
124
+ * See the LICENSE file in the root directory of this source tree.
125
+ */const Fc=J("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
126
+ * @license lucide-react v0.400.0 - ISC
127
+ *
128
+ * This source code is licensed under the ISC license.
129
+ * See the LICENSE file in the root directory of this source tree.
130
+ */const Pa=J("CircleCheckBig",[["path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14",key:"g774vq"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
131
+ * @license lucide-react v0.400.0 - ISC
132
+ *
133
+ * This source code is licensed under the ISC license.
134
+ * See the LICENSE file in the root directory of this source tree.
135
+ */const _o=J("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
136
+ * @license lucide-react v0.400.0 - ISC
137
+ *
138
+ * This source code is licensed under the ISC license.
139
+ * See the LICENSE file in the root directory of this source tree.
140
+ */const SC=J("CircleStop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{width:"6",height:"6",x:"9",y:"9",key:"1wrtvo"}]]);/**
141
+ * @license lucide-react v0.400.0 - ISC
142
+ *
143
+ * This source code is licensed under the ISC license.
144
+ * See the LICENSE file in the root directory of this source tree.
145
+ */const dp=J("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
146
+ * @license lucide-react v0.400.0 - ISC
147
+ *
148
+ * This source code is licensed under the ISC license.
149
+ * See the LICENSE file in the root directory of this source tree.
150
+ */const Hc=J("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
151
+ * @license lucide-react v0.400.0 - ISC
152
+ *
153
+ * This source code is licensed under the ISC license.
154
+ * See the LICENSE file in the root directory of this source tree.
155
+ */const ax=J("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
156
+ * @license lucide-react v0.400.0 - ISC
157
+ *
158
+ * This source code is licensed under the ISC license.
159
+ * See the LICENSE file in the root directory of this source tree.
160
+ */const pc=J("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/**
161
+ * @license lucide-react v0.400.0 - ISC
162
+ *
163
+ * This source code is licensed under the ISC license.
164
+ * See the LICENSE file in the root directory of this source tree.
165
+ */const lx=J("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/**
166
+ * @license lucide-react v0.400.0 - ISC
167
+ *
168
+ * This source code is licensed under the ISC license.
169
+ * See the LICENSE file in the root directory of this source tree.
170
+ */const $c=J("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);/**
171
+ * @license lucide-react v0.400.0 - ISC
172
+ *
173
+ * This source code is licensed under the ISC license.
174
+ * See the LICENSE file in the root directory of this source tree.
175
+ */const Wc=J("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
176
+ * @license lucide-react v0.400.0 - ISC
177
+ *
178
+ * This source code is licensed under the ISC license.
179
+ * See the LICENSE file in the root directory of this source tree.
180
+ */const cx=J("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
181
+ * @license lucide-react v0.400.0 - ISC
182
+ *
183
+ * This source code is licensed under the ISC license.
184
+ * See the LICENSE file in the root directory of this source tree.
185
+ */const Ml=J("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
186
+ * @license lucide-react v0.400.0 - ISC
187
+ *
188
+ * This source code is licensed under the ISC license.
189
+ * See the LICENSE file in the root directory of this source tree.
190
+ */const bC=J("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/**
191
+ * @license lucide-react v0.400.0 - ISC
192
+ *
193
+ * This source code is licensed under the ISC license.
194
+ * See the LICENSE file in the root directory of this source tree.
195
+ */const CC=J("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
196
+ * @license lucide-react v0.400.0 - ISC
197
+ *
198
+ * This source code is licensed under the ISC license.
199
+ * See the LICENSE file in the root directory of this source tree.
200
+ */const fp=J("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
201
+ * @license lucide-react v0.400.0 - ISC
202
+ *
203
+ * This source code is licensed under the ISC license.
204
+ * See the LICENSE file in the root directory of this source tree.
205
+ */const Tl=J("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/**
206
+ * @license lucide-react v0.400.0 - ISC
207
+ *
208
+ * This source code is licensed under the ISC license.
209
+ * See the LICENSE file in the root directory of this source tree.
210
+ */const kC=J("GitMerge",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]]);/**
211
+ * @license lucide-react v0.400.0 - ISC
212
+ *
213
+ * This source code is licensed under the ISC license.
214
+ * See the LICENSE file in the root directory of this source tree.
215
+ */const NC=J("Github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);/**
216
+ * @license lucide-react v0.400.0 - ISC
217
+ *
218
+ * This source code is licensed under the ISC license.
219
+ * See the LICENSE file in the root directory of this source tree.
220
+ */const fd=J("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**
221
+ * @license lucide-react v0.400.0 - ISC
222
+ *
223
+ * This source code is licensed under the ISC license.
224
+ * See the LICENSE file in the root directory of this source tree.
225
+ */const EC=J("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/**
226
+ * @license lucide-react v0.400.0 - ISC
227
+ *
228
+ * This source code is licensed under the ISC license.
229
+ * See the LICENSE file in the root directory of this source tree.
230
+ */const ux=J("List",[["line",{x1:"8",x2:"21",y1:"6",y2:"6",key:"7ey8pc"}],["line",{x1:"8",x2:"21",y1:"12",y2:"12",key:"rjfblc"}],["line",{x1:"8",x2:"21",y1:"18",y2:"18",key:"c3b1m8"}],["line",{x1:"3",x2:"3.01",y1:"6",y2:"6",key:"1g7gq3"}],["line",{x1:"3",x2:"3.01",y1:"12",y2:"12",key:"1pjlvk"}],["line",{x1:"3",x2:"3.01",y1:"18",y2:"18",key:"28t2mc"}]]);/**
231
+ * @license lucide-react v0.400.0 - ISC
232
+ *
233
+ * This source code is licensed under the ISC license.
234
+ * See the LICENSE file in the root directory of this source tree.
235
+ */const Ne=J("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
236
+ * @license lucide-react v0.400.0 - ISC
237
+ *
238
+ * This source code is licensed under the ISC license.
239
+ * See the LICENSE file in the root directory of this source tree.
240
+ */const jC=J("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
241
+ * @license lucide-react v0.400.0 - ISC
242
+ *
243
+ * This source code is licensed under the ISC license.
244
+ * See the LICENSE file in the root directory of this source tree.
245
+ */const PC=J("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/**
246
+ * @license lucide-react v0.400.0 - ISC
247
+ *
248
+ * This source code is licensed under the ISC license.
249
+ * See the LICENSE file in the root directory of this source tree.
250
+ */const MC=J("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
251
+ * @license lucide-react v0.400.0 - ISC
252
+ *
253
+ * This source code is licensed under the ISC license.
254
+ * See the LICENSE file in the root directory of this source tree.
255
+ */const TC=J("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/**
256
+ * @license lucide-react v0.400.0 - ISC
257
+ *
258
+ * This source code is licensed under the ISC license.
259
+ * See the LICENSE file in the root directory of this source tree.
260
+ */const Pr=J("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
261
+ * @license lucide-react v0.400.0 - ISC
262
+ *
263
+ * This source code is licensed under the ISC license.
264
+ * See the LICENSE file in the root directory of this source tree.
265
+ */const RC=J("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/**
266
+ * @license lucide-react v0.400.0 - ISC
267
+ *
268
+ * This source code is licensed under the ISC license.
269
+ * See the LICENSE file in the root directory of this source tree.
270
+ */const Vn=J("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
271
+ * @license lucide-react v0.400.0 - ISC
272
+ *
273
+ * This source code is licensed under the ISC license.
274
+ * See the LICENSE file in the root directory of this source tree.
275
+ */const hx=J("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
276
+ * @license lucide-react v0.400.0 - ISC
277
+ *
278
+ * This source code is licensed under the ISC license.
279
+ * See the LICENSE file in the root directory of this source tree.
280
+ */const dx=J("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]);/**
281
+ * @license lucide-react v0.400.0 - ISC
282
+ *
283
+ * This source code is licensed under the ISC license.
284
+ * See the LICENSE file in the root directory of this source tree.
285
+ */const DC=J("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/**
286
+ * @license lucide-react v0.400.0 - ISC
287
+ *
288
+ * This source code is licensed under the ISC license.
289
+ * See the LICENSE file in the root directory of this source tree.
290
+ */const pd=J("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
291
+ * @license lucide-react v0.400.0 - ISC
292
+ *
293
+ * This source code is licensed under the ISC license.
294
+ * See the LICENSE file in the root directory of this source tree.
295
+ */const Uc=J("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
296
+ * @license lucide-react v0.400.0 - ISC
297
+ *
298
+ * This source code is licensed under the ISC license.
299
+ * See the LICENSE file in the root directory of this source tree.
300
+ */const fx=J("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/**
301
+ * @license lucide-react v0.400.0 - ISC
302
+ *
303
+ * This source code is licensed under the ISC license.
304
+ * See the LICENSE file in the root directory of this source tree.
305
+ */const cn=J("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
306
+ * @license lucide-react v0.400.0 - ISC
307
+ *
308
+ * This source code is licensed under the ISC license.
309
+ * See the LICENSE file in the root directory of this source tree.
310
+ */const mg=J("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/**
311
+ * @license lucide-react v0.400.0 - ISC
312
+ *
313
+ * This source code is licensed under the ISC license.
314
+ * See the LICENSE file in the root directory of this source tree.
315
+ */const Xs=J("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
316
+ * @license lucide-react v0.400.0 - ISC
317
+ *
318
+ * This source code is licensed under the ISC license.
319
+ * See the LICENSE file in the root directory of this source tree.
320
+ */const px=J("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
321
+ * @license lucide-react v0.400.0 - ISC
322
+ *
323
+ * This source code is licensed under the ISC license.
324
+ * See the LICENSE file in the root directory of this source tree.
325
+ */const LC=J("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
326
+ * @license lucide-react v0.400.0 - ISC
327
+ *
328
+ * This source code is licensed under the ISC license.
329
+ * See the LICENSE file in the root directory of this source tree.
330
+ */const Mr=J("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);var Kc={exports:{}},mx={},gx={exports:{}},AC="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",OC=AC,BC=OC;function _x(){}function vx(){}vx.resetWarningCache=_x;var zC=function(){function e(i,n,s,o,a,u){if(u!==BC){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}}e.isRequired=e;function t(){return e}var r={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:vx,resetWarningCache:_x};return r.PropTypes=r,r};gx.exports=zC();var yx=gx.exports;function xx(e){var t,r,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(r=xx(e[t]))&&(i&&(i+=" "),i+=r);else for(t in e)e[t]&&(i&&(i+=" "),i+=t);return i}function gg(){for(var e,t,r=0,i="";r<arguments.length;)(e=arguments[r++])&&(t=xx(e))&&(i&&(i+=" "),i+=t);return i}const IC=Object.freeze(Object.defineProperty({__proto__:null,clsx:gg,default:gg},Symbol.toStringTag,{value:"Module"})),FC=aS(IC);var Ie={},ti={};Object.defineProperty(ti,"__esModule",{value:!0});ti.dontSetMe=KC;ti.findInArray=HC;ti.int=UC;ti.isFunction=$C;ti.isNum=WC;function HC(e,t){for(let r=0,i=e.length;r<i;r++)if(t.apply(t,[e[r],r,e]))return e[r]}function $C(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Function]"}function WC(e){return typeof e=="number"&&!isNaN(e)}function UC(e){return parseInt(e,10)}function KC(e,t,r){if(e[t])return new Error("Invalid prop ".concat(t," passed to ").concat(r," - do not set this, set it on the child."))}var Jn={};Object.defineProperty(Jn,"__esModule",{value:!0});Jn.browserPrefixToKey=Sx;Jn.browserPrefixToStyle=qC;Jn.default=void 0;Jn.getPrefix=wx;const Mu=["Moz","Webkit","O","ms"];function wx(){var e;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"transform";if(typeof window>"u")return"";const r=(e=window.document)===null||e===void 0||(e=e.documentElement)===null||e===void 0?void 0:e.style;if(!r||t in r)return"";for(let i=0;i<Mu.length;i++)if(Sx(t,Mu[i])in r)return Mu[i];return""}function Sx(e,t){return t?"".concat(t).concat(VC(e)):e}function qC(e,t){return t?"-".concat(t.toLowerCase(),"-").concat(e):e}function VC(e){let t="",r=!0;for(let i=0;i<e.length;i++)r?(t+=e[i].toUpperCase(),r=!1):e[i]==="-"?r=!0:t+=e[i];return t}Jn.default=wx();Object.defineProperty(Ie,"__esModule",{value:!0});Ie.addClassName=kx;Ie.addEvent=QC;Ie.addUserSelectStyles=ak;Ie.createCSSTransform=ik;Ie.createSVGTransform=nk;Ie.getTouch=sk;Ie.getTouchIdentifier=ok;Ie.getTranslation=pp;Ie.innerHeight=ek;Ie.innerWidth=tk;Ie.matchesSelector=Cx;Ie.matchesSelectorAndParentsTo=XC;Ie.offsetXYFromParent=rk;Ie.outerHeight=JC;Ie.outerWidth=ZC;Ie.removeClassName=Nx;Ie.removeEvent=GC;Ie.removeUserSelectStyles=lk;var tr=ti,_g=YC(Jn);function bx(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,r=new WeakMap;return(bx=function(i){return i?r:t})(e)}function YC(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var r=bx(t);if(r&&r.has(e))return r.get(e);var i={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if(s!=="default"&&Object.prototype.hasOwnProperty.call(e,s)){var o=n?Object.getOwnPropertyDescriptor(e,s):null;o&&(o.get||o.set)?Object.defineProperty(i,s,o):i[s]=e[s]}return i.default=e,r&&r.set(e,i),i}let tl="";function Cx(e,t){return tl||(tl=(0,tr.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(r){return(0,tr.isFunction)(e[r])})),(0,tr.isFunction)(e[tl])?e[tl](t):!1}function XC(e,t,r){let i=e;do{if(Cx(i,t))return!0;if(i===r)return!1;i=i.parentNode}while(i);return!1}function QC(e,t,r,i){if(!e)return;const n={capture:!0,...i};e.addEventListener?e.addEventListener(t,r,n):e.attachEvent?e.attachEvent("on"+t,r):e["on"+t]=r}function GC(e,t,r,i){if(!e)return;const n={capture:!0,...i};e.removeEventListener?e.removeEventListener(t,r,n):e.detachEvent?e.detachEvent("on"+t,r):e["on"+t]=null}function JC(e){let t=e.clientHeight;const r=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,tr.int)(r.borderTopWidth),t+=(0,tr.int)(r.borderBottomWidth),t}function ZC(e){let t=e.clientWidth;const r=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,tr.int)(r.borderLeftWidth),t+=(0,tr.int)(r.borderRightWidth),t}function ek(e){let t=e.clientHeight;const r=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,tr.int)(r.paddingTop),t-=(0,tr.int)(r.paddingBottom),t}function tk(e){let t=e.clientWidth;const r=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,tr.int)(r.paddingLeft),t-=(0,tr.int)(r.paddingRight),t}function rk(e,t,r){const n=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect(),s=(e.clientX+t.scrollLeft-n.left)/r,o=(e.clientY+t.scrollTop-n.top)/r;return{x:s,y:o}}function ik(e,t){const r=pp(e,t,"px");return{[(0,_g.browserPrefixToKey)("transform",_g.default)]:r}}function nk(e,t){return pp(e,t,"")}function pp(e,t,r){let{x:i,y:n}=e,s="translate(".concat(i).concat(r,",").concat(n).concat(r,")");if(t){const o="".concat(typeof t.x=="string"?t.x:t.x+r),a="".concat(typeof t.y=="string"?t.y:t.y+r);s="translate(".concat(o,", ").concat(a,")")+s}return s}function sk(e,t){return e.targetTouches&&(0,tr.findInArray)(e.targetTouches,r=>t===r.identifier)||e.changedTouches&&(0,tr.findInArray)(e.changedTouches,r=>t===r.identifier)}function ok(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function ak(e){if(!e)return;let t=e.getElementById("react-draggable-style-el");t||(t=e.createElement("style"),t.type="text/css",t.id="react-draggable-style-el",t.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
331
+ `,t.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
332
+ `,e.getElementsByTagName("head")[0].appendChild(t)),e.body&&kx(e.body,"react-draggable-transparent-selection")}function lk(e){if(e)try{if(e.body&&Nx(e.body,"react-draggable-transparent-selection"),e.selection)e.selection.empty();else{const t=(e.defaultView||window).getSelection();t&&t.type!=="Caret"&&t.removeAllRanges()}}catch{}}function kx(e,t){e.classList?e.classList.add(t):e.className.match(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)")))||(e.className+=" ".concat(t))}function Nx(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)"),"g"),"")}var ri={};Object.defineProperty(ri,"__esModule",{value:!0});ri.canDragX=hk;ri.canDragY=dk;ri.createCoreData=pk;ri.createDraggableData=mk;ri.getBoundPosition=ck;ri.getControlPosition=fk;ri.snapToGrid=uk;var Xt=ti,xs=Ie;function ck(e,t,r){if(!e.props.bounds)return[t,r];let{bounds:i}=e.props;i=typeof i=="string"?i:gk(i);const n=mp(e);if(typeof i=="string"){const{ownerDocument:s}=n,o=s.defaultView;let a;if(i==="parent"?a=n.parentNode:a=s.querySelector(i),!(a instanceof o.HTMLElement))throw new Error('Bounds selector "'+i+'" could not find an element.');const u=a,c=o.getComputedStyle(n),h=o.getComputedStyle(u);i={left:-n.offsetLeft+(0,Xt.int)(h.paddingLeft)+(0,Xt.int)(c.marginLeft),top:-n.offsetTop+(0,Xt.int)(h.paddingTop)+(0,Xt.int)(c.marginTop),right:(0,xs.innerWidth)(u)-(0,xs.outerWidth)(n)-n.offsetLeft+(0,Xt.int)(h.paddingRight)-(0,Xt.int)(c.marginRight),bottom:(0,xs.innerHeight)(u)-(0,xs.outerHeight)(n)-n.offsetTop+(0,Xt.int)(h.paddingBottom)-(0,Xt.int)(c.marginBottom)}}return(0,Xt.isNum)(i.right)&&(t=Math.min(t,i.right)),(0,Xt.isNum)(i.bottom)&&(r=Math.min(r,i.bottom)),(0,Xt.isNum)(i.left)&&(t=Math.max(t,i.left)),(0,Xt.isNum)(i.top)&&(r=Math.max(r,i.top)),[t,r]}function uk(e,t,r){const i=Math.round(t/e[0])*e[0],n=Math.round(r/e[1])*e[1];return[i,n]}function hk(e){return e.props.axis==="both"||e.props.axis==="x"}function dk(e){return e.props.axis==="both"||e.props.axis==="y"}function fk(e,t,r){const i=typeof t=="number"?(0,xs.getTouch)(e,t):null;if(typeof t=="number"&&!i)return null;const n=mp(r),s=r.props.offsetParent||n.offsetParent||n.ownerDocument.body;return(0,xs.offsetXYFromParent)(i||e,s,r.props.scale)}function pk(e,t,r){const i=!(0,Xt.isNum)(e.lastX),n=mp(e);return i?{node:n,deltaX:0,deltaY:0,lastX:t,lastY:r,x:t,y:r}:{node:n,deltaX:t-e.lastX,deltaY:r-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:r}}function mk(e,t){const r=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/r,y:e.state.y+t.deltaY/r,deltaX:t.deltaX/r,deltaY:t.deltaY/r,lastX:e.state.x,lastY:e.state.y}}function gk(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function mp(e){const t=e.findDOMNode();if(!t)throw new Error("<DraggableCore>: Unmounted during event!");return t}var qc={},Vc={};Object.defineProperty(Vc,"__esModule",{value:!0});Vc.default=_k;function _k(){}Object.defineProperty(qc,"__esModule",{value:!0});qc.default=void 0;var Tu=yk(F),Lt=gp(yx),vk=gp(ja),_t=Ie,Ni=ri,Ru=ti,vo=gp(Vc);function gp(e){return e&&e.__esModule?e:{default:e}}function Ex(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,r=new WeakMap;return(Ex=function(i){return i?r:t})(e)}function yk(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var r=Ex(t);if(r&&r.has(e))return r.get(e);var i={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if(s!=="default"&&Object.prototype.hasOwnProperty.call(e,s)){var o=n?Object.getOwnPropertyDescriptor(e,s):null;o&&(o.get||o.set)?Object.defineProperty(i,s,o):i[s]=e[s]}return i.default=e,r&&r.set(e,i),i}function Ct(e,t,r){return t=xk(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function xk(e){var t=wk(e,"string");return typeof t=="symbol"?t:String(t)}function wk(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}const Sr={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let Ei=Sr.mouse,Yc=class extends Tu.Component{constructor(){super(...arguments),Ct(this,"dragging",!1),Ct(this,"lastX",NaN),Ct(this,"lastY",NaN),Ct(this,"touchIdentifier",null),Ct(this,"mounted",!1),Ct(this,"handleDragStart",t=>{if(this.props.onMouseDown(t),!this.props.allowAnyClick&&typeof t.button=="number"&&t.button!==0)return!1;const r=this.findDOMNode();if(!r||!r.ownerDocument||!r.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:i}=r;if(this.props.disabled||!(t.target instanceof i.defaultView.Node)||this.props.handle&&!(0,_t.matchesSelectorAndParentsTo)(t.target,this.props.handle,r)||this.props.cancel&&(0,_t.matchesSelectorAndParentsTo)(t.target,this.props.cancel,r))return;t.type==="touchstart"&&t.preventDefault();const n=(0,_t.getTouchIdentifier)(t);this.touchIdentifier=n;const s=(0,Ni.getControlPosition)(t,n,this);if(s==null)return;const{x:o,y:a}=s,u=(0,Ni.createCoreData)(this,o,a);(0,vo.default)("DraggableCore: handleDragStart: %j",u),(0,vo.default)("calling",this.props.onStart),!(this.props.onStart(t,u)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,_t.addUserSelectStyles)(i),this.dragging=!0,this.lastX=o,this.lastY=a,(0,_t.addEvent)(i,Ei.move,this.handleDrag),(0,_t.addEvent)(i,Ei.stop,this.handleDragStop))}),Ct(this,"handleDrag",t=>{const r=(0,Ni.getControlPosition)(t,this.touchIdentifier,this);if(r==null)return;let{x:i,y:n}=r;if(Array.isArray(this.props.grid)){let a=i-this.lastX,u=n-this.lastY;if([a,u]=(0,Ni.snapToGrid)(this.props.grid,a,u),!a&&!u)return;i=this.lastX+a,n=this.lastY+u}const s=(0,Ni.createCoreData)(this,i,n);if((0,vo.default)("DraggableCore: handleDrag: %j",s),this.props.onDrag(t,s)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const u=document.createEvent("MouseEvents");u.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(u)}return}this.lastX=i,this.lastY=n}),Ct(this,"handleDragStop",t=>{if(!this.dragging)return;const r=(0,Ni.getControlPosition)(t,this.touchIdentifier,this);if(r==null)return;let{x:i,y:n}=r;if(Array.isArray(this.props.grid)){let u=i-this.lastX||0,c=n-this.lastY||0;[u,c]=(0,Ni.snapToGrid)(this.props.grid,u,c),i=this.lastX+u,n=this.lastY+c}const s=(0,Ni.createCoreData)(this,i,n);if(this.props.onStop(t,s)===!1||this.mounted===!1)return!1;const a=this.findDOMNode();a&&this.props.enableUserSelectHack&&(0,_t.removeUserSelectStyles)(a.ownerDocument),(0,vo.default)("DraggableCore: handleDragStop: %j",s),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,a&&((0,vo.default)("DraggableCore: Removing handlers"),(0,_t.removeEvent)(a.ownerDocument,Ei.move,this.handleDrag),(0,_t.removeEvent)(a.ownerDocument,Ei.stop,this.handleDragStop))}),Ct(this,"onMouseDown",t=>(Ei=Sr.mouse,this.handleDragStart(t))),Ct(this,"onMouseUp",t=>(Ei=Sr.mouse,this.handleDragStop(t))),Ct(this,"onTouchStart",t=>(Ei=Sr.touch,this.handleDragStart(t))),Ct(this,"onTouchEnd",t=>(Ei=Sr.touch,this.handleDragStop(t)))}componentDidMount(){this.mounted=!0;const t=this.findDOMNode();t&&(0,_t.addEvent)(t,Sr.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const t=this.findDOMNode();if(t){const{ownerDocument:r}=t;(0,_t.removeEvent)(r,Sr.mouse.move,this.handleDrag),(0,_t.removeEvent)(r,Sr.touch.move,this.handleDrag),(0,_t.removeEvent)(r,Sr.mouse.stop,this.handleDragStop),(0,_t.removeEvent)(r,Sr.touch.stop,this.handleDragStop),(0,_t.removeEvent)(t,Sr.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,_t.removeUserSelectStyles)(r)}}findDOMNode(){var t,r;return(t=this.props)!==null&&t!==void 0&&t.nodeRef?(r=this.props)===null||r===void 0||(r=r.nodeRef)===null||r===void 0?void 0:r.current:vk.default.findDOMNode(this)}render(){return Tu.cloneElement(Tu.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};qc.default=Yc;Ct(Yc,"displayName","DraggableCore");Ct(Yc,"propTypes",{allowAnyClick:Lt.default.bool,children:Lt.default.node.isRequired,disabled:Lt.default.bool,enableUserSelectHack:Lt.default.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:Lt.default.arrayOf(Lt.default.number),handle:Lt.default.string,cancel:Lt.default.string,nodeRef:Lt.default.object,onStart:Lt.default.func,onDrag:Lt.default.func,onStop:Lt.default.func,onMouseDown:Lt.default.func,scale:Lt.default.number,className:Ru.dontSetMe,style:Ru.dontSetMe,transform:Ru.dontSetMe});Ct(Yc,"defaultProps",{allowAnyClick:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1});(function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"DraggableCore",{enumerable:!0,get:function(){return u.default}}),e.default=void 0;var t=f(F),r=h(yx),i=h(ja),n=h(FC),s=Ie,o=ri,a=ti,u=h(qc),c=h(Vc);function h(_){return _&&_.__esModule?_:{default:_}}function d(_){if(typeof WeakMap!="function")return null;var v=new WeakMap,x=new WeakMap;return(d=function(k){return k?x:v})(_)}function f(_,v){if(_&&_.__esModule)return _;if(_===null||typeof _!="object"&&typeof _!="function")return{default:_};var x=d(v);if(x&&x.has(_))return x.get(_);var k={},b=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var j in _)if(j!=="default"&&Object.prototype.hasOwnProperty.call(_,j)){var L=b?Object.getOwnPropertyDescriptor(_,j):null;L&&(L.get||L.set)?Object.defineProperty(k,j,L):k[j]=_[j]}return k.default=_,x&&x.set(_,k),k}function p(){return p=Object.assign?Object.assign.bind():function(_){for(var v=1;v<arguments.length;v++){var x=arguments[v];for(var k in x)Object.prototype.hasOwnProperty.call(x,k)&&(_[k]=x[k])}return _},p.apply(this,arguments)}function m(_,v,x){return v=y(v),v in _?Object.defineProperty(_,v,{value:x,enumerable:!0,configurable:!0,writable:!0}):_[v]=x,_}function y(_){var v=C(_,"string");return typeof v=="symbol"?v:String(v)}function C(_,v){if(typeof _!="object"||_===null)return _;var x=_[Symbol.toPrimitive];if(x!==void 0){var k=x.call(_,v);if(typeof k!="object")return k;throw new TypeError("@@toPrimitive must return a primitive value.")}return(v==="string"?String:Number)(_)}class g extends t.Component{static getDerivedStateFromProps(v,x){let{position:k}=v,{prevPropsPosition:b}=x;return k&&(!b||k.x!==b.x||k.y!==b.y)?((0,c.default)("Draggable: getDerivedStateFromProps %j",{position:k,prevPropsPosition:b}),{x:k.x,y:k.y,prevPropsPosition:{...k}}):null}constructor(v){super(v),m(this,"onDragStart",(x,k)=>{if((0,c.default)("Draggable: onDragStart: %j",k),this.props.onStart(x,(0,o.createDraggableData)(this,k))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),m(this,"onDrag",(x,k)=>{if(!this.state.dragging)return!1;(0,c.default)("Draggable: onDrag: %j",k);const b=(0,o.createDraggableData)(this,k),j={x:b.x,y:b.y,slackX:0,slackY:0};if(this.props.bounds){const{x:I,y:P}=j;j.x+=this.state.slackX,j.y+=this.state.slackY;const[D,M]=(0,o.getBoundPosition)(this,j.x,j.y);j.x=D,j.y=M,j.slackX=this.state.slackX+(I-j.x),j.slackY=this.state.slackY+(P-j.y),b.x=j.x,b.y=j.y,b.deltaX=j.x-this.state.x,b.deltaY=j.y-this.state.y}if(this.props.onDrag(x,b)===!1)return!1;this.setState(j)}),m(this,"onDragStop",(x,k)=>{if(!this.state.dragging||this.props.onStop(x,(0,o.createDraggableData)(this,k))===!1)return!1;(0,c.default)("Draggable: onDragStop: %j",k);const j={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:I,y:P}=this.props.position;j.x=I,j.y=P}this.setState(j)}),this.state={dragging:!1,dragged:!1,x:v.position?v.position.x:v.defaultPosition.x,y:v.position?v.position.y:v.defaultPosition.y,prevPropsPosition:{...v.position},slackX:0,slackY:0,isElementSVG:!1},v.position&&!(v.onDrag||v.onStop)&&console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}componentDidMount(){typeof window.SVGElement<"u"&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.setState({dragging:!1})}findDOMNode(){var v,x;return(v=(x=this.props)===null||x===void 0||(x=x.nodeRef)===null||x===void 0?void 0:x.current)!==null&&v!==void 0?v:i.default.findDOMNode(this)}render(){const{axis:v,bounds:x,children:k,defaultPosition:b,defaultClassName:j,defaultClassNameDragging:L,defaultClassNameDragged:I,position:P,positionOffset:D,scale:M,...R}=this.props;let O={},E=null;const U=!!!P||this.state.dragging,T=P||b,$={x:(0,o.canDragX)(this)&&U?this.state.x:T.x,y:(0,o.canDragY)(this)&&U?this.state.y:T.y};this.state.isElementSVG?E=(0,s.createSVGTransform)($,D):O=(0,s.createCSSTransform)($,D);const w=(0,n.default)(k.props.className||"",j,{[L]:this.state.dragging,[I]:this.state.dragged});return t.createElement(u.default,p({},R,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),t.cloneElement(t.Children.only(k),{className:w,style:{...k.props.style,...O},transform:E}))}}e.default=g,m(g,"displayName","Draggable"),m(g,"propTypes",{...u.default.propTypes,axis:r.default.oneOf(["both","x","y","none"]),bounds:r.default.oneOfType([r.default.shape({left:r.default.number,right:r.default.number,top:r.default.number,bottom:r.default.number}),r.default.string,r.default.oneOf([!1])]),defaultClassName:r.default.string,defaultClassNameDragging:r.default.string,defaultClassNameDragged:r.default.string,defaultPosition:r.default.shape({x:r.default.number,y:r.default.number}),positionOffset:r.default.shape({x:r.default.oneOfType([r.default.number,r.default.string]),y:r.default.oneOfType([r.default.number,r.default.string])}),position:r.default.shape({x:r.default.number,y:r.default.number}),className:a.dontSetMe,style:a.dontSetMe,transform:a.dontSetMe}),m(g,"defaultProps",{...u.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})})(mx);const{default:jx,DraggableCore:Sk}=mx;Kc.exports=jx;Kc.exports.default=jx;Kc.exports.DraggableCore=Sk;var bk=Kc.exports;const Ck=bc(bk);var Ue=function(){return Ue=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++){t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},Ue.apply(this,arguments)},vg={width:"100%",height:"10px",top:"0px",left:"0px",cursor:"row-resize"},yg={width:"10px",height:"100%",top:"0px",left:"0px",cursor:"col-resize"},rl={width:"20px",height:"20px",position:"absolute",zIndex:1},kk={top:Ue(Ue({},vg),{top:"-5px"}),right:Ue(Ue({},yg),{left:void 0,right:"-5px"}),bottom:Ue(Ue({},vg),{top:void 0,bottom:"-5px"}),left:Ue(Ue({},yg),{left:"-5px"}),topRight:Ue(Ue({},rl),{right:"-10px",top:"-10px",cursor:"ne-resize"}),bottomRight:Ue(Ue({},rl),{right:"-10px",bottom:"-10px",cursor:"se-resize"}),bottomLeft:Ue(Ue({},rl),{left:"-10px",bottom:"-10px",cursor:"sw-resize"}),topLeft:Ue(Ue({},rl),{left:"-10px",top:"-10px",cursor:"nw-resize"})},Nk=F.memo(function(e){var t=e.onResizeStart,r=e.direction,i=e.children,n=e.replaceStyles,s=e.className,o=F.useCallback(function(c){t(c,r)},[t,r]),a=F.useCallback(function(c){t(c,r)},[t,r]),u=F.useMemo(function(){return Ue(Ue({position:"absolute",userSelect:"none"},kk[r]),n??{})},[n,r]);return l.jsx("div",{className:s||void 0,style:u,onMouseDown:o,onTouchStart:a,children:i})}),Ek=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function i(){this.constructor=t}t.prototype=r===null?Object.create(r):(i.prototype=r.prototype,new i)}}(),$r=function(){return $r=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++){t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},$r.apply(this,arguments)},jk={width:"auto",height:"auto"},il=function(e,t,r){return Math.max(Math.min(e,r),t)},xg=function(e,t,r){var i=Math.round(e/t);return i*t+r*(i-1)},is=function(e,t){return new RegExp(e,"i").test(t)},nl=function(e){return!!(e.touches&&e.touches.length)},Pk=function(e){return!!((e.clientX||e.clientX===0)&&(e.clientY||e.clientY===0))},wg=function(e,t,r){r===void 0&&(r=0);var i=t.reduce(function(s,o,a){return Math.abs(o-e)<Math.abs(t[s]-e)?a:s},0),n=Math.abs(t[i]-e);return r===0||n<r?t[i]:e},Du=function(e){return e=e.toString(),e==="auto"||e.endsWith("px")||e.endsWith("%")||e.endsWith("vh")||e.endsWith("vw")||e.endsWith("vmax")||e.endsWith("vmin")?e:"".concat(e,"px")},sl=function(e,t,r,i){if(e&&typeof e=="string"){if(e.endsWith("px"))return Number(e.replace("px",""));if(e.endsWith("%")){var n=Number(e.replace("%",""))/100;return t*n}if(e.endsWith("vw")){var n=Number(e.replace("vw",""))/100;return r*n}if(e.endsWith("vh")){var n=Number(e.replace("vh",""))/100;return i*n}}return e},Mk=function(e,t,r,i,n,s,o){return i=sl(i,e.width,t,r),n=sl(n,e.height,t,r),s=sl(s,e.width,t,r),o=sl(o,e.height,t,r),{maxWidth:typeof i>"u"?void 0:Number(i),maxHeight:typeof n>"u"?void 0:Number(n),minWidth:typeof s>"u"?void 0:Number(s),minHeight:typeof o>"u"?void 0:Number(o)}},Tk=function(e){return Array.isArray(e)?e:[e,e]},Rk=["as","ref","style","className","grid","gridGap","snap","bounds","boundsByDirection","size","defaultSize","minWidth","minHeight","maxWidth","maxHeight","lockAspectRatio","lockAspectRatioExtraWidth","lockAspectRatioExtraHeight","enable","handleStyles","handleClasses","handleWrapperStyle","handleWrapperClass","children","onResizeStart","onResize","onResizeStop","handleComponent","scale","resizeRatio","snapGap"],Sg="__resizable_base__",Dk=function(e){Ek(t,e);function t(r){var i,n,s,o,a=e.call(this,r)||this;return a.ratio=1,a.resizable=null,a.parentLeft=0,a.parentTop=0,a.resizableLeft=0,a.resizableRight=0,a.resizableTop=0,a.resizableBottom=0,a.targetLeft=0,a.targetTop=0,a.delta={width:0,height:0},a.appendBase=function(){if(!a.resizable||!a.window)return null;var u=a.parentNode;if(!u)return null;var c=a.window.document.createElement("div");return c.style.width="100%",c.style.height="100%",c.style.position="absolute",c.style.transform="scale(0, 0)",c.style.left="0",c.style.flex="0 0 100%",c.classList?c.classList.add(Sg):c.className+=Sg,u.appendChild(c),c},a.removeBase=function(u){var c=a.parentNode;c&&c.removeChild(u)},a.state={isResizing:!1,width:(n=(i=a.propsSize)===null||i===void 0?void 0:i.width)!==null&&n!==void 0?n:"auto",height:(o=(s=a.propsSize)===null||s===void 0?void 0:s.height)!==null&&o!==void 0?o:"auto",direction:"right",original:{x:0,y:0,width:0,height:0},backgroundStyle:{height:"100%",width:"100%",backgroundColor:"rgba(0,0,0,0)",cursor:"auto",opacity:0,position:"fixed",zIndex:9999,top:"0",left:"0",bottom:"0",right:"0"},flexBasis:void 0},a.onResizeStart=a.onResizeStart.bind(a),a.onMouseMove=a.onMouseMove.bind(a),a.onMouseUp=a.onMouseUp.bind(a),a}return Object.defineProperty(t.prototype,"parentNode",{get:function(){return this.resizable?this.resizable.parentNode:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"window",{get:function(){return!this.resizable||!this.resizable.ownerDocument?null:this.resizable.ownerDocument.defaultView},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"propsSize",{get:function(){return this.props.size||this.props.defaultSize||jk},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var r=0,i=0;if(this.resizable&&this.window){var n=this.resizable.offsetWidth,s=this.resizable.offsetHeight,o=this.resizable.style.position;o!=="relative"&&(this.resizable.style.position="relative"),r=this.resizable.style.width!=="auto"?this.resizable.offsetWidth:n,i=this.resizable.style.height!=="auto"?this.resizable.offsetHeight:s,this.resizable.style.position=o}return{width:r,height:i}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sizeStyle",{get:function(){var r=this,i=this.props.size,n=function(a){var u;if(typeof r.state[a]>"u"||r.state[a]==="auto")return"auto";if(r.propsSize&&r.propsSize[a]&&(!((u=r.propsSize[a])===null||u===void 0)&&u.toString().endsWith("%"))){if(r.state[a].toString().endsWith("%"))return r.state[a].toString();var c=r.getParentSize(),h=Number(r.state[a].toString().replace("px","")),d=h/c[a]*100;return"".concat(d,"%")}return Du(r.state[a])},s=i&&typeof i.width<"u"&&!this.state.isResizing?Du(i.width):n("width"),o=i&&typeof i.height<"u"&&!this.state.isResizing?Du(i.height):n("height");return{width:s,height:o}},enumerable:!1,configurable:!0}),t.prototype.getParentSize=function(){if(!this.parentNode)return this.window?{width:this.window.innerWidth,height:this.window.innerHeight}:{width:0,height:0};var r=this.appendBase();if(!r)return{width:0,height:0};var i=!1,n=this.parentNode.style.flexWrap;n!=="wrap"&&(i=!0,this.parentNode.style.flexWrap="wrap"),r.style.position="relative",r.style.minWidth="100%",r.style.minHeight="100%";var s={width:r.offsetWidth,height:r.offsetHeight};return i&&(this.parentNode.style.flexWrap=n),this.removeBase(r),s},t.prototype.bindEvents=function(){this.window&&(this.window.addEventListener("mouseup",this.onMouseUp),this.window.addEventListener("mousemove",this.onMouseMove),this.window.addEventListener("mouseleave",this.onMouseUp),this.window.addEventListener("touchmove",this.onMouseMove,{capture:!0,passive:!1}),this.window.addEventListener("touchend",this.onMouseUp))},t.prototype.unbindEvents=function(){this.window&&(this.window.removeEventListener("mouseup",this.onMouseUp),this.window.removeEventListener("mousemove",this.onMouseMove),this.window.removeEventListener("mouseleave",this.onMouseUp),this.window.removeEventListener("touchmove",this.onMouseMove,!0),this.window.removeEventListener("touchend",this.onMouseUp))},t.prototype.componentDidMount=function(){if(!(!this.resizable||!this.window)){var r=this.window.getComputedStyle(this.resizable);this.setState({width:this.state.width||this.size.width,height:this.state.height||this.size.height,flexBasis:r.flexBasis!=="auto"?r.flexBasis:void 0})}},t.prototype.componentWillUnmount=function(){this.window&&this.unbindEvents()},t.prototype.createSizeForCssProperty=function(r,i){var n=this.propsSize&&this.propsSize[i];return this.state[i]==="auto"&&this.state.original[i]===r&&(typeof n>"u"||n==="auto")?"auto":r},t.prototype.calculateNewMaxFromBoundary=function(r,i){var n=this.props.boundsByDirection,s=this.state.direction,o=n&&is("left",s),a=n&&is("top",s),u,c;if(this.props.bounds==="parent"){var h=this.parentNode;h&&(u=o?this.resizableRight-this.parentLeft:h.offsetWidth+(this.parentLeft-this.resizableLeft),c=a?this.resizableBottom-this.parentTop:h.offsetHeight+(this.parentTop-this.resizableTop))}else this.props.bounds==="window"?this.window&&(u=o?this.resizableRight:this.window.innerWidth-this.resizableLeft,c=a?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(u=o?this.resizableRight-this.targetLeft:this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),c=a?this.resizableBottom-this.targetTop:this.props.bounds.offsetHeight+(this.targetTop-this.resizableTop));return u&&Number.isFinite(u)&&(r=r&&r<u?r:u),c&&Number.isFinite(c)&&(i=i&&i<c?i:c),{maxWidth:r,maxHeight:i}},t.prototype.calculateNewSizeFromDirection=function(r,i){var n=this.props.scale||1,s=Tk(this.props.resizeRatio||1),o=s[0],a=s[1],u=this.state,c=u.direction,h=u.original,d=this.props,f=d.lockAspectRatio,p=d.lockAspectRatioExtraHeight,m=d.lockAspectRatioExtraWidth,y=h.width,C=h.height,g=p||0,_=m||0;return is("right",c)&&(y=h.width+(r-h.x)*o/n,f&&(C=(y-_)/this.ratio+g)),is("left",c)&&(y=h.width-(r-h.x)*o/n,f&&(C=(y-_)/this.ratio+g)),is("bottom",c)&&(C=h.height+(i-h.y)*a/n,f&&(y=(C-g)*this.ratio+_)),is("top",c)&&(C=h.height-(i-h.y)*a/n,f&&(y=(C-g)*this.ratio+_)),{newWidth:y,newHeight:C}},t.prototype.calculateNewSizeFromAspectRatio=function(r,i,n,s){var o=this.props,a=o.lockAspectRatio,u=o.lockAspectRatioExtraHeight,c=o.lockAspectRatioExtraWidth,h=typeof s.width>"u"?10:s.width,d=typeof n.width>"u"||n.width<0?r:n.width,f=typeof s.height>"u"?10:s.height,p=typeof n.height>"u"||n.height<0?i:n.height,m=u||0,y=c||0;if(a){var C=(f-m)*this.ratio+y,g=(p-m)*this.ratio+y,_=(h-y)/this.ratio+m,v=(d-y)/this.ratio+m,x=Math.max(h,C),k=Math.min(d,g),b=Math.max(f,_),j=Math.min(p,v);r=il(r,x,k),i=il(i,b,j)}else r=il(r,h,d),i=il(i,f,p);return{newWidth:r,newHeight:i}},t.prototype.setBoundingClientRect=function(){var r=1/(this.props.scale||1);if(this.props.bounds==="parent"){var i=this.parentNode;if(i){var n=i.getBoundingClientRect();this.parentLeft=n.left*r,this.parentTop=n.top*r}}if(this.props.bounds&&typeof this.props.bounds!="string"){var s=this.props.bounds.getBoundingClientRect();this.targetLeft=s.left*r,this.targetTop=s.top*r}if(this.resizable){var o=this.resizable.getBoundingClientRect(),a=o.left,u=o.top,c=o.right,h=o.bottom;this.resizableLeft=a*r,this.resizableRight=c*r,this.resizableTop=u*r,this.resizableBottom=h*r}},t.prototype.onResizeStart=function(r,i){if(!(!this.resizable||!this.window)){var n=0,s=0;if(r.nativeEvent&&Pk(r.nativeEvent)?(n=r.nativeEvent.clientX,s=r.nativeEvent.clientY):r.nativeEvent&&nl(r.nativeEvent)&&(n=r.nativeEvent.touches[0].clientX,s=r.nativeEvent.touches[0].clientY),this.props.onResizeStart&&this.resizable){var o=this.props.onResizeStart(r,i,this.resizable);if(o===!1)return}this.props.size&&(typeof this.props.size.height<"u"&&this.props.size.height!==this.state.height&&this.setState({height:this.props.size.height}),typeof this.props.size.width<"u"&&this.props.size.width!==this.state.width&&this.setState({width:this.props.size.width})),this.ratio=typeof this.props.lockAspectRatio=="number"?this.props.lockAspectRatio:this.size.width/this.size.height;var a,u=this.window.getComputedStyle(this.resizable);if(u.flexBasis!=="auto"){var c=this.parentNode;if(c){var h=this.window.getComputedStyle(c).flexDirection;this.flexDir=h.startsWith("row")?"row":"column",a=u.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var d={original:{x:n,y:s,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:$r($r({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(r.target).cursor||"auto"}),direction:i,flexBasis:a};this.setState(d)}},t.prototype.onMouseMove=function(r){var i=this;if(!(!this.state.isResizing||!this.resizable||!this.window)){if(this.window.TouchEvent&&nl(r))try{r.preventDefault(),r.stopPropagation()}catch{}var n=this.props,s=n.maxWidth,o=n.maxHeight,a=n.minWidth,u=n.minHeight,c=nl(r)?r.touches[0].clientX:r.clientX,h=nl(r)?r.touches[0].clientY:r.clientY,d=this.state,f=d.direction,p=d.original,m=d.width,y=d.height,C=this.getParentSize(),g=Mk(C,this.window.innerWidth,this.window.innerHeight,s,o,a,u);s=g.maxWidth,o=g.maxHeight,a=g.minWidth,u=g.minHeight;var _=this.calculateNewSizeFromDirection(c,h),v=_.newHeight,x=_.newWidth,k=this.calculateNewMaxFromBoundary(s,o);this.props.snap&&this.props.snap.x&&(x=wg(x,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(v=wg(v,this.props.snap.y,this.props.snapGap));var b=this.calculateNewSizeFromAspectRatio(x,v,{width:k.maxWidth,height:k.maxHeight},{width:a,height:u});if(x=b.newWidth,v=b.newHeight,this.props.grid){var j=xg(x,this.props.grid[0],this.props.gridGap?this.props.gridGap[0]:0),L=xg(v,this.props.grid[1],this.props.gridGap?this.props.gridGap[1]:0),I=this.props.snapGap||0,P=I===0||Math.abs(j-x)<=I?j:x,D=I===0||Math.abs(L-v)<=I?L:v;x=P,v=D}var M={width:x-p.width,height:v-p.height};if(this.delta=M,m&&typeof m=="string"){if(m.endsWith("%")){var R=x/C.width*100;x="".concat(R,"%")}else if(m.endsWith("vw")){var O=x/this.window.innerWidth*100;x="".concat(O,"vw")}else if(m.endsWith("vh")){var E=x/this.window.innerHeight*100;x="".concat(E,"vh")}}if(y&&typeof y=="string"){if(y.endsWith("%")){var R=v/C.height*100;v="".concat(R,"%")}else if(y.endsWith("vw")){var O=v/this.window.innerWidth*100;v="".concat(O,"vw")}else if(y.endsWith("vh")){var E=v/this.window.innerHeight*100;v="".concat(E,"vh")}}var A={width:this.createSizeForCssProperty(x,"width"),height:this.createSizeForCssProperty(v,"height")};this.flexDir==="row"?A.flexBasis=A.width:this.flexDir==="column"&&(A.flexBasis=A.height);var U=this.state.width!==A.width,T=this.state.height!==A.height,$=this.state.flexBasis!==A.flexBasis,w=U||T||$;w&&ja.flushSync(function(){i.setState(A)}),this.props.onResize&&w&&this.props.onResize(r,f,this.resizable,M)}},t.prototype.onMouseUp=function(r){var i,n,s=this.state,o=s.isResizing,a=s.direction;s.original,!(!o||!this.resizable)&&(this.props.onResizeStop&&this.props.onResizeStop(r,a,this.resizable,this.delta),this.props.size&&this.setState({width:(i=this.props.size.width)!==null&&i!==void 0?i:"auto",height:(n=this.props.size.height)!==null&&n!==void 0?n:"auto"}),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:$r($r({},this.state.backgroundStyle),{cursor:"auto"})}))},t.prototype.updateSize=function(r){var i,n;this.setState({width:(i=r.width)!==null&&i!==void 0?i:"auto",height:(n=r.height)!==null&&n!==void 0?n:"auto"})},t.prototype.renderResizer=function(){var r=this,i=this.props,n=i.enable,s=i.handleStyles,o=i.handleClasses,a=i.handleWrapperStyle,u=i.handleWrapperClass,c=i.handleComponent;if(!n)return null;var h=Object.keys(n).map(function(d){return n[d]!==!1?l.jsx(Nk,{direction:d,onResizeStart:r.onResizeStart,replaceStyles:s&&s[d],className:o&&o[d],children:c&&c[d]?c[d]:null},d):null});return l.jsx("div",{className:u,style:a,children:h})},t.prototype.render=function(){var r=this,i=Object.keys(this.props).reduce(function(o,a){return Rk.indexOf(a)!==-1||(o[a]=r.props[a]),o},{}),n=$r($r($r({position:"relative",userSelect:this.state.isResizing?"none":"auto"},this.props.style),this.sizeStyle),{maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight,minWidth:this.props.minWidth,minHeight:this.props.minHeight,boxSizing:"border-box",flexShrink:0});this.state.flexBasis&&(n.flexBasis=this.state.flexBasis);var s=this.props.as||"div";return l.jsxs(s,$r({style:n,className:this.props.className},i,{ref:function(o){o&&(r.resizable=o)},children:[this.state.isResizing&&l.jsx("div",{style:this.state.backgroundStyle}),this.props.children,this.renderResizer()]}))},t.defaultProps={as:"div",onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},enable:{top:!0,right:!0,bottom:!0,left:!0,topRight:!0,bottomRight:!0,bottomLeft:!0,topLeft:!0},style:{},grid:[1,1],gridGap:[0,0],lockAspectRatio:!1,lockAspectRatioExtraWidth:0,lockAspectRatioExtraHeight:0,scale:1,resizeRatio:1,snapGap:0},t}(F.PureComponent);/*! *****************************************************************************
333
+ Copyright (c) Microsoft Corporation. All rights reserved.
334
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
335
+ this file except in compliance with the License. You may obtain a copy of the
336
+ License at http://www.apache.org/licenses/LICENSE-2.0
337
+
338
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
339
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
340
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
341
+ MERCHANTABLITY OR NON-INFRINGEMENT.
342
+
343
+ See the Apache Version 2.0 License for specific language governing permissions
344
+ and limitations under the License.
345
+ ***************************************************************************** */var md=function(e,t){return md=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var n in i)i.hasOwnProperty(n)&&(r[n]=i[n])},md(e,t)};function Lk(e,t){md(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}var Ge=function(){return Ge=Object.assign||function(t){for(var r,i=1,n=arguments.length;i<n;i++){r=arguments[i];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=r[s])}return t},Ge.apply(this,arguments)};function Ak(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]]);return r}var Ok={width:"auto",height:"auto",display:"inline-block",position:"absolute",top:0,left:0},Bk=function(e){return{bottom:e,bottomLeft:e,bottomRight:e,left:e,right:e,top:e,topLeft:e,topRight:e}},zk=function(e){Lk(t,e);function t(r){var i=e.call(this,r)||this;return i.resizingPosition={x:0,y:0},i.offsetFromParent={left:0,top:0},i.resizableElement={current:null},i.originalPosition={x:0,y:0},i.state={resizing:!1,bounds:{top:0,right:0,bottom:0,left:0},maxWidth:r.maxWidth,maxHeight:r.maxHeight},i.onResizeStart=i.onResizeStart.bind(i),i.onResize=i.onResize.bind(i),i.onResizeStop=i.onResizeStop.bind(i),i.onDragStart=i.onDragStart.bind(i),i.onDrag=i.onDrag.bind(i),i.onDragStop=i.onDragStop.bind(i),i.getMaxSizesFromProps=i.getMaxSizesFromProps.bind(i),i}return t.prototype.componentDidMount=function(){this.updateOffsetFromParent();var r=this.offsetFromParent,i=r.left,n=r.top,s=this.getDraggablePosition(),o=s.x,a=s.y;this.draggable.setState({x:o-i,y:a-n}),this.forceUpdate()},t.prototype.getDraggablePosition=function(){var r=this.draggable.state,i=r.x,n=r.y;return{x:i,y:n}},t.prototype.getParent=function(){return this.resizable&&this.resizable.parentNode},t.prototype.getParentSize=function(){return this.resizable.getParentSize()},t.prototype.getMaxSizesFromProps=function(){var r=typeof this.props.maxWidth>"u"?Number.MAX_SAFE_INTEGER:this.props.maxWidth,i=typeof this.props.maxHeight>"u"?Number.MAX_SAFE_INTEGER:this.props.maxHeight;return{maxWidth:r,maxHeight:i}},t.prototype.getSelfElement=function(){return this.resizable&&this.resizable.resizable},t.prototype.getOffsetHeight=function(r){var i=this.props.scale;switch(this.props.bounds){case"window":return window.innerHeight/i;case"body":return document.body.offsetHeight/i;default:return r.offsetHeight}},t.prototype.getOffsetWidth=function(r){var i=this.props.scale;switch(this.props.bounds){case"window":return window.innerWidth/i;case"body":return document.body.offsetWidth/i;default:return r.offsetWidth}},t.prototype.onDragStart=function(r,i){this.props.onDragStart&&this.props.onDragStart(r,i);var n=this.getDraggablePosition();if(this.originalPosition=n,!!this.props.bounds){var s=this.getParent(),o=this.props.scale,a;if(this.props.bounds==="parent")a=s;else if(this.props.bounds==="body"){var u=s.getBoundingClientRect(),c=u.left,h=u.top,d=document.body.getBoundingClientRect(),f=-(c-s.offsetLeft*o-d.left)/o,p=-(h-s.offsetTop*o-d.top)/o,m=(document.body.offsetWidth-this.resizable.size.width*o)/o+f,y=(document.body.offsetHeight-this.resizable.size.height*o)/o+p;return this.setState({bounds:{top:p,right:m,bottom:y,left:f}})}else if(this.props.bounds==="window"){if(!this.resizable)return;var C=s.getBoundingClientRect(),g=C.left,_=C.top,v=-(g-s.offsetLeft*o)/o,x=-(_-s.offsetTop*o)/o,m=(window.innerWidth-this.resizable.size.width*o)/o+v,y=(window.innerHeight-this.resizable.size.height*o)/o+x;return this.setState({bounds:{top:x,right:m,bottom:y,left:v}})}else typeof this.props.bounds=="string"?a=document.querySelector(this.props.bounds):this.props.bounds instanceof HTMLElement&&(a=this.props.bounds);if(!(!(a instanceof HTMLElement)||!(s instanceof HTMLElement))){var k=a.getBoundingClientRect(),b=k.left,j=k.top,L=s.getBoundingClientRect(),I=L.left,P=L.top,D=(b-I)/o,M=j-P;if(this.resizable){this.updateOffsetFromParent();var R=this.offsetFromParent;this.setState({bounds:{top:M-R.top,right:D+(a.offsetWidth-this.resizable.size.width)-R.left/o,bottom:M+(a.offsetHeight-this.resizable.size.height)-R.top,left:D-R.left/o}})}}}},t.prototype.onDrag=function(r,i){if(this.props.onDrag){var n=this.offsetFromParent,s=n.left,o=n.top;if(!this.props.dragAxis||this.props.dragAxis==="both")return this.props.onDrag(r,Ge(Ge({},i),{x:i.x+s,y:i.y+o}));if(this.props.dragAxis==="x")return this.props.onDrag(r,Ge(Ge({},i),{x:i.x+s,y:this.originalPosition.y+o,deltaY:0}));if(this.props.dragAxis==="y")return this.props.onDrag(r,Ge(Ge({},i),{x:this.originalPosition.x+s,y:i.y+o,deltaX:0}))}},t.prototype.onDragStop=function(r,i){if(this.props.onDragStop){var n=this.offsetFromParent,s=n.left,o=n.top;if(!this.props.dragAxis||this.props.dragAxis==="both")return this.props.onDragStop(r,Ge(Ge({},i),{x:i.x+s,y:i.y+o}));if(this.props.dragAxis==="x")return this.props.onDragStop(r,Ge(Ge({},i),{x:i.x+s,y:this.originalPosition.y+o,deltaY:0}));if(this.props.dragAxis==="y")return this.props.onDragStop(r,Ge(Ge({},i),{x:this.originalPosition.x+s,y:i.y+o,deltaX:0}))}},t.prototype.onResizeStart=function(r,i,n){r.stopPropagation(),this.setState({resizing:!0});var s=this.props.scale,o=this.offsetFromParent,a=this.getDraggablePosition();if(this.resizingPosition={x:a.x+o.left,y:a.y+o.top},this.originalPosition=a,this.props.bounds){var u=this.getParent(),c=void 0;this.props.bounds==="parent"?c=u:this.props.bounds==="body"?c=document.body:this.props.bounds==="window"?c=window:typeof this.props.bounds=="string"?c=document.querySelector(this.props.bounds):this.props.bounds instanceof HTMLElement&&(c=this.props.bounds);var h=this.getSelfElement();if(h instanceof Element&&(c instanceof HTMLElement||c===window)&&u instanceof HTMLElement){var d=this.getMaxSizesFromProps(),f=d.maxWidth,p=d.maxHeight,m=this.getParentSize();if(f&&typeof f=="string")if(f.endsWith("%")){var y=Number(f.replace("%",""))/100;f=m.width*y}else f.endsWith("px")&&(f=Number(f.replace("px","")));if(p&&typeof p=="string")if(p.endsWith("%")){var y=Number(p.replace("%",""))/100;p=m.height*y}else p.endsWith("px")&&(p=Number(p.replace("px","")));var C=h.getBoundingClientRect(),g=C.left,_=C.top,v=this.props.bounds==="window"?{left:0,top:0}:c.getBoundingClientRect(),x=v.left,k=v.top,b=this.getOffsetWidth(c),j=this.getOffsetHeight(c),L=i.toLowerCase().endsWith("left"),I=i.toLowerCase().endsWith("right"),P=i.startsWith("top"),D=i.startsWith("bottom");if((L||P)&&this.resizable){var M=(g-x)/s+this.resizable.size.width;this.setState({maxWidth:M>Number(f)?f:M})}if(I||this.props.lockAspectRatio&&!L&&!P){var M=b+(x-g)/s;this.setState({maxWidth:M>Number(f)?f:M})}if((P||L)&&this.resizable){var M=(_-k)/s+this.resizable.size.height;this.setState({maxHeight:M>Number(p)?p:M})}if(D||this.props.lockAspectRatio&&!P&&!L){var M=j+(k-_)/s;this.setState({maxHeight:M>Number(p)?p:M})}}}else this.setState({maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight});this.props.onResizeStart&&this.props.onResizeStart(r,i,n)},t.prototype.onResize=function(r,i,n,s){var o=this,a={x:this.originalPosition.x,y:this.originalPosition.y},u=-s.width,c=-s.height,h=["top","left","topLeft","bottomLeft","topRight"];h.includes(i)&&(i==="bottomLeft"?a.x+=u:(i==="topRight"||(a.x+=u),a.y+=c));var d=this.draggable.state;(a.x!==d.x||a.y!==d.y)&&ja.flushSync(function(){o.draggable.setState(a)}),this.updateOffsetFromParent();var f=this.offsetFromParent,p=this.getDraggablePosition().x+f.left,m=this.getDraggablePosition().y+f.top;this.resizingPosition={x:p,y:m},this.props.onResize&&this.props.onResize(r,i,n,s,{x:p,y:m})},t.prototype.onResizeStop=function(r,i,n,s){this.setState({resizing:!1});var o=this.getMaxSizesFromProps(),a=o.maxWidth,u=o.maxHeight;this.setState({maxWidth:a,maxHeight:u}),this.props.onResizeStop&&this.props.onResizeStop(r,i,n,s,this.resizingPosition)},t.prototype.updateSize=function(r){this.resizable&&this.resizable.updateSize({width:r.width,height:r.height})},t.prototype.updatePosition=function(r){this.draggable.setState(r)},t.prototype.updateOffsetFromParent=function(){var r=this.props.scale,i=this.getParent(),n=this.getSelfElement();if(!i||n===null)return{top:0,left:0};var s=i.getBoundingClientRect(),o=s.left,a=s.top,u=n.getBoundingClientRect(),c=this.getDraggablePosition(),h=i.scrollLeft,d=i.scrollTop;this.offsetFromParent={left:u.left-o+h-c.x*r,top:u.top-a+d-c.y*r}},t.prototype.render=function(){var r=this,i=this.props,n=i.disableDragging,s=i.style,o=i.dragHandleClassName,a=i.position,u=i.onMouseDown,c=i.onMouseUp,h=i.dragAxis,d=i.dragGrid,f=i.bounds,p=i.enableUserSelectHack,m=i.cancel,y=i.children;i.onResizeStart,i.onResize,i.onResizeStop,i.onDragStart,i.onDrag,i.onDragStop;var C=i.resizeHandleStyles,g=i.resizeHandleClasses,_=i.resizeHandleComponent,v=i.enableResizing,x=i.resizeGrid,k=i.resizeHandleWrapperClass,b=i.resizeHandleWrapperStyle,j=i.scale,L=i.allowAnyClick,I=i.dragPositionOffset,P=Ak(i,["disableDragging","style","dragHandleClassName","position","onMouseDown","onMouseUp","dragAxis","dragGrid","bounds","enableUserSelectHack","cancel","children","onResizeStart","onResize","onResizeStop","onDragStart","onDrag","onDragStop","resizeHandleStyles","resizeHandleClasses","resizeHandleComponent","enableResizing","resizeGrid","resizeHandleWrapperClass","resizeHandleWrapperStyle","scale","allowAnyClick","dragPositionOffset"]),D=this.props.default?Ge({},this.props.default):void 0;delete P.default;var M=n||o?{cursor:"auto"}:{cursor:"move"},R=Ge(Ge(Ge({},Ok),M),s),O=this.offsetFromParent,E=O.left,A=O.top,U;a&&(U={x:a.x-E,y:a.y-A});var T=this.state.resizing?void 0:U,$=this.state.resizing?"both":h;return F.createElement(Ck,{ref:function(w){w&&(r.draggable=w)},handle:o?".".concat(o):void 0,defaultPosition:D,onMouseDown:u,onMouseUp:c,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop,axis:$,disabled:n,grid:d,bounds:f?this.state.bounds:void 0,position:T,enableUserSelectHack:p,cancel:m,scale:j,allowAnyClick:L,nodeRef:this.resizableElement,positionOffset:I},F.createElement(Dk,Ge({},P,{ref:function(w){w&&(r.resizable=w,r.resizableElement.current=w.resizable)},defaultSize:D,size:this.props.size,enable:typeof v=="boolean"?Bk(v):v,onResizeStart:this.onResizeStart,onResize:this.onResize,onResizeStop:this.onResizeStop,style:R,minWidth:this.props.minWidth,minHeight:this.props.minHeight,maxWidth:this.state.resizing?this.state.maxWidth:this.props.maxWidth,maxHeight:this.state.resizing?this.state.maxHeight:this.props.maxHeight,grid:x,handleWrapperClass:k,handleWrapperStyle:b,lockAspectRatio:this.props.lockAspectRatio,lockAspectRatioExtraWidth:this.props.lockAspectRatioExtraWidth,lockAspectRatioExtraHeight:this.props.lockAspectRatioExtraHeight,handleStyles:C,handleClasses:g,handleComponent:_,scale:this.props.scale}),y))},t.defaultProps={maxWidth:Number.MAX_SAFE_INTEGER,maxHeight:Number.MAX_SAFE_INTEGER,scale:1,onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},onDragStart:function(){},onDrag:function(){},onDragStop:function(){}},t}(F.PureComponent);/**
346
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
347
+ * @license MIT
348
+ *
349
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
350
+ * @license MIT
351
+ *
352
+ * Originally forked from (with the author's permission):
353
+ * Fabrice Bellard's javascript vt100 for jslinux:
354
+ * http://bellard.org/jslinux/
355
+ * Copyright (c) 2011 Fabrice Bellard
356
+ */var Px=Object.defineProperty,Ik=Object.getOwnPropertyDescriptor,Fk=(e,t)=>{for(var r in t)Px(e,r,{get:t[r],enumerable:!0})},Fe=(e,t,r,i)=>{for(var n=i>1?void 0:i?Ik(t,r):t,s=e.length-1,o;s>=0;s--)(o=e[s])&&(n=(i?o(t,r,n):o(n))||n);return i&&n&&Px(t,r,n),n},X=(e,t)=>(r,i)=>t(r,i,e),bg="Terminal input",gd={get:()=>bg,set:e=>bg=e},Cg="Too much output to announce, navigate to rows manually to read",_d={get:()=>Cg,set:e=>Cg=e};function Hk(e){return e.replace(/\r?\n/g,"\r")}function $k(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function Wk(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function Uk(e,t,r,i){if(e.stopPropagation(),e.clipboardData){let n=e.clipboardData.getData("text/plain");Mx(n,t,r,i)}}function Mx(e,t,r,i){e=Hk(e),e=$k(e,r.decPrivateModes.bracketedPasteMode&&i.rawOptions.ignoreBracketedPasteMode!==!0),r.triggerDataEvent(e,!0),t.value=""}function Tx(e,t,r){let i=r.getBoundingClientRect(),n=e.clientX-i.left-10,s=e.clientY-i.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${n}px`,t.style.top=`${s}px`,t.style.zIndex="1000",t.focus()}function kg(e,t,r,i,n){Tx(e,t,r),n&&i.rightClickSelect(e),t.value=i.selectionText,t.select()}function Ai(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Xc(e,t=0,r=e.length){let i="";for(let n=t;n<r;++n){let s=e[n];s>65535?(s-=65536,i+=String.fromCharCode((s>>10)+55296)+String.fromCharCode(s%1024+56320)):i+=String.fromCharCode(s)}return i}var Kk=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let r=e.length;if(!r)return 0;let i=0,n=0;if(this._interim){let s=e.charCodeAt(n++);56320<=s&&s<=57343?t[i++]=(this._interim-55296)*1024+s-56320+65536:(t[i++]=this._interim,t[i++]=s),this._interim=0}for(let s=n;s<r;++s){let o=e.charCodeAt(s);if(55296<=o&&o<=56319){if(++s>=r)return this._interim=o,i;let a=e.charCodeAt(s);56320<=a&&a<=57343?t[i++]=(o-55296)*1024+a-56320+65536:(t[i++]=o,t[i++]=a);continue}o!==65279&&(t[i++]=o)}return i}},qk=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let r=e.length;if(!r)return 0;let i=0,n,s,o,a,u=0,c=0;if(this.interim[0]){let f=!1,p=this.interim[0];p&=(p&224)===192?31:(p&240)===224?15:7;let m=0,y;for(;(y=this.interim[++m]&63)&&m<4;)p<<=6,p|=y;let C=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,g=C-m;for(;c<g;){if(c>=r)return 0;if(y=e[c++],(y&192)!==128){c--,f=!0;break}else this.interim[m++]=y,p<<=6,p|=y&63}f||(C===2?p<128?c--:t[i++]=p:C===3?p<2048||p>=55296&&p<=57343||p===65279||(t[i++]=p):p<65536||p>1114111||(t[i++]=p)),this.interim.fill(0)}let h=r-4,d=c;for(;d<r;){for(;d<h&&!((n=e[d])&128)&&!((s=e[d+1])&128)&&!((o=e[d+2])&128)&&!((a=e[d+3])&128);)t[i++]=n,t[i++]=s,t[i++]=o,t[i++]=a,d+=4;if(n=e[d++],n<128)t[i++]=n;else if((n&224)===192){if(d>=r)return this.interim[0]=n,i;if(s=e[d++],(s&192)!==128){d--;continue}if(u=(n&31)<<6|s&63,u<128){d--;continue}t[i++]=u}else if((n&240)===224){if(d>=r)return this.interim[0]=n,i;if(s=e[d++],(s&192)!==128){d--;continue}if(d>=r)return this.interim[0]=n,this.interim[1]=s,i;if(o=e[d++],(o&192)!==128){d--;continue}if(u=(n&15)<<12|(s&63)<<6|o&63,u<2048||u>=55296&&u<=57343||u===65279)continue;t[i++]=u}else if((n&248)===240){if(d>=r)return this.interim[0]=n,i;if(s=e[d++],(s&192)!==128){d--;continue}if(d>=r)return this.interim[0]=n,this.interim[1]=s,i;if(o=e[d++],(o&192)!==128){d--;continue}if(d>=r)return this.interim[0]=n,this.interim[1]=s,this.interim[2]=o,i;if(a=e[d++],(a&192)!==128){d--;continue}if(u=(n&7)<<18|(s&63)<<12|(o&63)<<6|a&63,u<65536||u>1114111)continue;t[i++]=u}}return i}},Rx="",Xi=" ",Ma=class Dx{constructor(){this.fg=0,this.bg=0,this.extended=new mc}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new Dx;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},mc=class Lx{constructor(t=0,r=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=r}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new Lx(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},gr=class Ax extends Ma{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new mc,this.combinedData=""}static fromCharData(t){let r=new Ax;return r.setFromCharData(t),r}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Ai(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let r=!1;if(t[1].length>2)r=!0;else if(t[1].length===2){let i=t[1].charCodeAt(0);if(55296<=i&&i<=56319){let n=t[1].charCodeAt(1);56320<=n&&n<=57343?this.content=(i-55296)*1024+n-56320+65536|t[2]<<22:r=!0}else r=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;r&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Ng="di$target",vd="di$dependencies",Lu=new Map;function Vk(e){return e[vd]||[]}function ct(e){if(Lu.has(e))return Lu.get(e);let t=function(r,i,n){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Yk(t,r,n)};return t._id=e,Lu.set(e,t),t}function Yk(e,t,r){t[Ng]===t?t[vd].push({id:e,index:r}):(t[vd]=[{id:e,index:r}],t[Ng]=t)}var Rt=ct("BufferService"),Ox=ct("CoreMouseService"),Zn=ct("CoreService"),Xk=ct("CharsetService"),_p=ct("InstantiationService"),Bx=ct("LogService"),Dt=ct("OptionsService"),zx=ct("OscLinkService"),Qk=ct("UnicodeService"),Ta=ct("DecorationService"),yd=class{constructor(e,t,r){this._bufferService=e,this._optionsService=t,this._oscLinkService=r}provideLinks(e,t){var h;let r=this._bufferService.buffer.lines.get(e-1);if(!r){t(void 0);return}let i=[],n=this._optionsService.rawOptions.linkHandler,s=new gr,o=r.getTrimmedLength(),a=-1,u=-1,c=!1;for(let d=0;d<o;d++)if(!(u===-1&&!r.hasContent(d))){if(r.loadCell(d,s),s.hasExtendedAttrs()&&s.extended.urlId)if(u===-1){u=d,a=s.extended.urlId;continue}else c=s.extended.urlId!==a;else u!==-1&&(c=!0);if(c||u!==-1&&d===o-1){let f=(h=this._oscLinkService.getLinkData(a))==null?void 0:h.uri;if(f){let p={start:{x:u+1,y:e},end:{x:d+(!c&&d===o-1?1:0),y:e}},m=!1;if(!(n!=null&&n.allowNonHttpProtocols))try{let y=new URL(f);["http:","https:"].includes(y.protocol)||(m=!0)}catch{m=!0}m||i.push({text:f,range:p,activate:(y,C)=>n?n.activate(y,C,p):Gk(y,C),hover:(y,C)=>{var g;return(g=n==null?void 0:n.hover)==null?void 0:g.call(n,y,C,p)},leave:(y,C)=>{var g;return(g=n==null?void 0:n.leave)==null?void 0:g.call(n,y,C,p)}})}c=!1,s.hasExtendedAttrs()&&s.extended.urlId?(u=d,a=s.extended.urlId):(u=-1,a=-1)}}t(i)}};yd=Fe([X(0,Rt),X(1,Dt),X(2,zx)],yd);function Gk(e,t){if(confirm(`Do you want to navigate to ${t}?
357
+
358
+ WARNING: This link could potentially be dangerous`)){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var Qc=ct("CharSizeService"),bi=ct("CoreBrowserService"),vp=ct("MouseService"),Ci=ct("RenderService"),Jk=ct("SelectionService"),Ix=ct("CharacterJoinerService"),to=ct("ThemeService"),Fx=ct("LinkProviderService"),Zk=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Eg.isErrorNoTelemetry(e)?new Eg(e.message+`
359
+
360
+ `+e.stack):new Error(e.message+`
361
+
362
+ `+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},e2=new Zk;function Rl(e){t2(e)||e2.onUnexpectedError(e)}var xd="Canceled";function t2(e){return e instanceof r2?!0:e instanceof Error&&e.name===xd&&e.message===xd}var r2=class extends Error{constructor(){super(xd),this.name=this.message}};function i2(e){return new Error(`Illegal argument: ${e}`)}var Eg=class wd extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof wd)return t;let r=new wd;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Sd=class Hx extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,Hx.prototype)}};function Vt(e,t=0){return e[e.length-(1+t)]}var n2;(e=>{function t(s){return s<0}e.isLessThan=t;function r(s){return s<=0}e.isLessThanOrEqual=r;function i(s){return s>0}e.isGreaterThan=i;function n(s){return s===0}e.isNeitherLessOrGreaterThan=n,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(n2||(n2={}));function s2(e,t){let r=this,i=!1,n;return function(){return i||(i=!0,t||(n=e.apply(r,arguments))),n}}var $x;(e=>{function t(x){return x&&typeof x=="object"&&typeof x[Symbol.iterator]=="function"}e.is=t;let r=Object.freeze([]);function i(){return r}e.empty=i;function*n(x){yield x}e.single=n;function s(x){return t(x)?x:n(x)}e.wrap=s;function o(x){return x||r}e.from=o;function*a(x){for(let k=x.length-1;k>=0;k--)yield x[k]}e.reverse=a;function u(x){return!x||x[Symbol.iterator]().next().done===!0}e.isEmpty=u;function c(x){return x[Symbol.iterator]().next().value}e.first=c;function h(x,k){let b=0;for(let j of x)if(k(j,b++))return!0;return!1}e.some=h;function d(x,k){for(let b of x)if(k(b))return b}e.find=d;function*f(x,k){for(let b of x)k(b)&&(yield b)}e.filter=f;function*p(x,k){let b=0;for(let j of x)yield k(j,b++)}e.map=p;function*m(x,k){let b=0;for(let j of x)yield*k(j,b++)}e.flatMap=m;function*y(...x){for(let k of x)yield*k}e.concat=y;function C(x,k,b){let j=b;for(let L of x)j=k(j,L);return j}e.reduce=C;function*g(x,k,b=x.length){for(k<0&&(k+=x.length),b<0?b+=x.length:b>x.length&&(b=x.length);k<b;k++)yield x[k]}e.slice=g;function _(x,k=Number.POSITIVE_INFINITY){let b=[];if(k===0)return[b,x];let j=x[Symbol.iterator]();for(let L=0;L<k;L++){let I=j.next();if(I.done)return[b,e.empty()];b.push(I.value)}return[b,{[Symbol.iterator](){return j}}]}e.consume=_;async function v(x){let k=[];for await(let b of x)k.push(b);return Promise.resolve(k)}e.asyncToArray=v})($x||($x={}));function Yn(e){if($x.is(e)){let t=[];for(let r of e)if(r)try{r.dispose()}catch(i){t.push(i)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function o2(...e){return Me(()=>Yn(e))}function Me(e){return{dispose:s2(()=>{e()})}}var Wx=class Ux{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Yn(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?Ux.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};Wx.DISABLE_DISPOSED_WARNING=!1;var on=Wx,ce=class{constructor(){this._store=new on,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};ce.None=Object.freeze({dispose(){}});var Qs=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,(e=this._value)==null||e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},mi=typeof window=="object"?window:globalThis,bd=class Cd{constructor(t){this.element=t,this.next=Cd.Undefined,this.prev=Cd.Undefined}};bd.Undefined=new bd(void 0);var Te=bd,jg=class{constructor(){this._first=Te.Undefined,this._last=Te.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Te.Undefined}clear(){let e=this._first;for(;e!==Te.Undefined;){let t=e.next;e.prev=Te.Undefined,e.next=Te.Undefined,e=t}this._first=Te.Undefined,this._last=Te.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new Te(e);if(this._first===Te.Undefined)this._first=r,this._last=r;else if(t){let n=this._last;this._last=r,r.prev=n,n.next=r}else{let n=this._first;this._first=r,r.next=n,n.prev=r}this._size+=1;let i=!1;return()=>{i||(i=!0,this._remove(r))}}shift(){if(this._first!==Te.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Te.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Te.Undefined&&e.next!==Te.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Te.Undefined&&e.next===Te.Undefined?(this._first=Te.Undefined,this._last=Te.Undefined):e.next===Te.Undefined?(this._last=this._last.prev,this._last.next=Te.Undefined):e.prev===Te.Undefined&&(this._first=this._first.next,this._first.prev=Te.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Te.Undefined;)yield e.element,e=e.next}},a2=globalThis.performance&&typeof globalThis.performance.now=="function",l2=class Kx{static create(t){return new Kx(t)}constructor(t){this._now=a2&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},dt;(e=>{e.None=()=>ce.None;function t(M,R){return d(M,()=>{},0,void 0,!0,void 0,R)}e.defer=t;function r(M){return(R,O=null,E)=>{let A=!1,U;return U=M(T=>{if(!A)return U?U.dispose():A=!0,R.call(O,T)},null,E),A&&U.dispose(),U}}e.once=r;function i(M,R,O){return c((E,A=null,U)=>M(T=>E.call(A,R(T)),null,U),O)}e.map=i;function n(M,R,O){return c((E,A=null,U)=>M(T=>{R(T),E.call(A,T)},null,U),O)}e.forEach=n;function s(M,R,O){return c((E,A=null,U)=>M(T=>R(T)&&E.call(A,T),null,U),O)}e.filter=s;function o(M){return M}e.signal=o;function a(...M){return(R,O=null,E)=>{let A=o2(...M.map(U=>U(T=>R.call(O,T))));return h(A,E)}}e.any=a;function u(M,R,O,E){let A=O;return i(M,U=>(A=R(A,U),A),E)}e.reduce=u;function c(M,R){let O,E={onWillAddFirstListener(){O=M(A.fire,A)},onDidRemoveLastListener(){O==null||O.dispose()}},A=new q(E);return R==null||R.add(A),A.event}function h(M,R){return R instanceof Array?R.push(M):R&&R.add(M),M}function d(M,R,O=100,E=!1,A=!1,U,T){let $,w,Z,ne=0,S,H={leakWarningThreshold:U,onWillAddFirstListener(){$=M(ie=>{ne++,w=R(w,ie),E&&!Z&&(ee.fire(w),w=void 0),S=()=>{let We=w;w=void 0,Z=void 0,(!E||ne>1)&&ee.fire(We),ne=0},typeof O=="number"?(clearTimeout(Z),Z=setTimeout(S,O)):Z===void 0&&(Z=0,queueMicrotask(S))})},onWillRemoveListener(){A&&ne>0&&(S==null||S())},onDidRemoveLastListener(){S=void 0,$.dispose()}},ee=new q(H);return T==null||T.add(ee),ee.event}e.debounce=d;function f(M,R=0,O){return e.debounce(M,(E,A)=>E?(E.push(A),E):[A],R,void 0,!0,void 0,O)}e.accumulate=f;function p(M,R=(E,A)=>E===A,O){let E=!0,A;return s(M,U=>{let T=E||!R(U,A);return E=!1,A=U,T},O)}e.latch=p;function m(M,R,O){return[e.filter(M,R,O),e.filter(M,E=>!R(E),O)]}e.split=m;function y(M,R=!1,O=[],E){let A=O.slice(),U=M(w=>{A?A.push(w):$.fire(w)});E&&E.add(U);let T=()=>{A==null||A.forEach(w=>$.fire(w)),A=null},$=new q({onWillAddFirstListener(){U||(U=M(w=>$.fire(w)),E&&E.add(U))},onDidAddFirstListener(){A&&(R?setTimeout(T):T())},onDidRemoveLastListener(){U&&U.dispose(),U=null}});return E&&E.add($),$.event}e.buffer=y;function C(M,R){return(O,E,A)=>{let U=R(new _);return M(function(T){let $=U.evaluate(T);$!==g&&O.call(E,$)},void 0,A)}}e.chain=C;let g=Symbol("HaltChainable");class _{constructor(){this.steps=[]}map(R){return this.steps.push(R),this}forEach(R){return this.steps.push(O=>(R(O),O)),this}filter(R){return this.steps.push(O=>R(O)?O:g),this}reduce(R,O){let E=O;return this.steps.push(A=>(E=R(E,A),E)),this}latch(R=(O,E)=>O===E){let O=!0,E;return this.steps.push(A=>{let U=O||!R(A,E);return O=!1,E=A,U?A:g}),this}evaluate(R){for(let O of this.steps)if(R=O(R),R===g)break;return R}}function v(M,R,O=E=>E){let E=(...$)=>T.fire(O(...$)),A=()=>M.on(R,E),U=()=>M.removeListener(R,E),T=new q({onWillAddFirstListener:A,onDidRemoveLastListener:U});return T.event}e.fromNodeEventEmitter=v;function x(M,R,O=E=>E){let E=(...$)=>T.fire(O(...$)),A=()=>M.addEventListener(R,E),U=()=>M.removeEventListener(R,E),T=new q({onWillAddFirstListener:A,onDidRemoveLastListener:U});return T.event}e.fromDOMEventEmitter=x;function k(M){return new Promise(R=>r(M)(R))}e.toPromise=k;function b(M){let R=new q;return M.then(O=>{R.fire(O)},()=>{R.fire(void 0)}).finally(()=>{R.dispose()}),R.event}e.fromPromise=b;function j(M,R){return M(O=>R.fire(O))}e.forward=j;function L(M,R,O){return R(O),M(E=>R(E))}e.runAndSubscribe=L;class I{constructor(R,O){this._observable=R,this._counter=0,this._hasChanged=!1;let E={onWillAddFirstListener:()=>{R.addObserver(this)},onDidRemoveLastListener:()=>{R.removeObserver(this)}};this.emitter=new q(E),O&&O.add(this.emitter)}beginUpdate(R){this._counter++}handlePossibleChange(R){}handleChange(R,O){this._hasChanged=!0}endUpdate(R){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function P(M,R){return new I(M,R).emitter.event}e.fromObservable=P;function D(M){return(R,O,E)=>{let A=0,U=!1,T={beginUpdate(){A++},endUpdate(){A--,A===0&&(M.reportChanges(),U&&(U=!1,R.call(O)))},handlePossibleChange(){},handleChange(){U=!0}};M.addObserver(T),M.reportChanges();let $={dispose(){M.removeObserver(T)}};return E instanceof on?E.add($):Array.isArray(E)&&E.push($),$}}e.fromObservableLight=D})(dt||(dt={}));var kd=class Nd{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Nd._idPool++}`,Nd.all.add(this)}start(t){this._stopWatch=new l2,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};kd.all=new Set,kd._idPool=0;var c2=kd,u2=-1,qx=class Vx{constructor(t,r,i=(Vx._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=r,this.name=i,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,r){let i=this.threshold;if(i<=0||r<i)return;this._stacks||(this._stacks=new Map);let n=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,n+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[s,o]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${r} listeners already. MOST frequent listener (${o}):`;console.warn(a),console.warn(s);let u=new f2(a,s);this._errorHandler(u)}return()=>{let s=this._stacks.get(t.value)||0;this._stacks.set(t.value,s-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,r=0;for(let[i,n]of this._stacks)(!t||r<n)&&(t=[i,n],r=n);return t}};qx._idPool=1;var h2=qx,d2=class Yx{constructor(t){this.value=t}static create(){let t=new Error;return new Yx(t.stack??"")}print(){console.warn(this.value.split(`
363
+ `).slice(2).join(`
364
+ `))}},f2=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},p2=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},m2=0,Au=class{constructor(e){this.value=e,this.id=m2++}},g2=2,_2,q=class{constructor(e){var t,r,i,n;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new h2((e==null?void 0:e.onListenerError)??Rl,((r=this._options)==null?void 0:r.leakWarningThreshold)??u2):void 0,this._perfMon=(i=this._options)!=null&&i._profName?new c2(this._options._profName):void 0,this._deliveryQueue=(n=this._options)==null?void 0:n.deliveryQueue}dispose(){var e,t,r,i;this._disposed||(this._disposed=!0,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(r=(t=this._options)==null?void 0:t.onDidRemoveLastListener)==null||r.call(t),(i=this._leakageMon)==null||i.dispose())}get event(){return this._event??(this._event=(e,t,r)=>{var o,a,u,c,h;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let d=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(d);let f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],p=new p2(`${d}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(((o=this._options)==null?void 0:o.onListenerError)||Rl)(p),ce.None}if(this._disposed)return ce.None;t&&(e=e.bind(t));let i=new Au(e),n;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(i.stack=d2.create(),n=this._leakageMon.check(i.stack,this._size+1)),this._listeners?this._listeners instanceof Au?(this._deliveryQueue??(this._deliveryQueue=new v2),this._listeners=[this._listeners,i]):this._listeners.push(i):((u=(a=this._options)==null?void 0:a.onWillAddFirstListener)==null||u.call(a,this),this._listeners=i,(h=(c=this._options)==null?void 0:c.onDidAddFirstListener)==null||h.call(c,this)),this._size++;let s=Me(()=>{n==null||n(),this._removeListener(i)});return r instanceof on?r.add(s):Array.isArray(r)&&r.push(s),s}),this._event}_removeListener(e){var n,s,o,a;if((s=(n=this._options)==null?void 0:n.onWillRemoveListener)==null||s.call(n,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(a=(o=this._options)==null?void 0:o.onDidRemoveLastListener)==null||a.call(o,this),this._size=0;return}let t=this._listeners,r=t.indexOf(e);if(r===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[r]=void 0;let i=this._deliveryQueue.current===this;if(this._size*g2<=t.length){let u=0;for(let c=0;c<t.length;c++)t[c]?t[u++]=t[c]:i&&(this._deliveryQueue.end--,u<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=u}}_deliver(e,t){var i;if(!e)return;let r=((i=this._options)==null?void 0:i.onListenerError)||Rl;if(!r){e.value(t);return}try{e.value(t)}catch(n){r(n)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){var t,r,i,n;if((t=this._deliveryQueue)!=null&&t.current&&(this._deliverQueue(this._deliveryQueue),(r=this._perfMon)==null||r.stop()),(i=this._perfMon)==null||i.start(this._size),this._listeners)if(this._listeners instanceof Au)this._deliver(this._listeners,e);else{let s=this._deliveryQueue;s.enqueue(this,e,this._listeners.length),this._deliverQueue(s)}(n=this._perfMon)==null||n.stop()}hasListeners(){return this._size>0}},v2=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,r){this.i=0,this.end=r,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Ed=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new q,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new q,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,r){if(this.getZoomLevel(r)===t)return;let i=this.getWindowId(r);this.mapWindowIdToZoomLevel.set(i,t),this._onDidChangeZoomLevel.fire(i)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,r){this.mapWindowIdToZoomFactor.set(this.getWindowId(r),t)}setFullscreen(t,r){if(this.isFullscreen(r)===t)return;let i=this.getWindowId(r);this.mapWindowIdToFullScreen.set(i,t),this._onDidChangeFullscreen.fire(i)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Ed.INSTANCE=new Ed;var yp=Ed;function y2(e,t,r){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",r)}yp.INSTANCE.onDidChangeZoomLevel;function x2(e){return yp.INSTANCE.getZoomFactor(e)}yp.INSTANCE.onDidChangeFullscreen;var ro=typeof navigator=="object"?navigator.userAgent:"",jd=ro.indexOf("Firefox")>=0,w2=ro.indexOf("AppleWebKit")>=0,xp=ro.indexOf("Chrome")>=0,S2=!xp&&ro.indexOf("Safari")>=0;ro.indexOf("Electron/")>=0;ro.indexOf("Android")>=0;var Ou=!1;if(typeof mi.matchMedia=="function"){let e=mi.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=mi.matchMedia("(display-mode: fullscreen)");Ou=e.matches,y2(mi,e,({matches:r})=>{Ou&&t.matches||(Ou=r)})}var ws="en",Pd=!1,Md=!1,Dl=!1,Xx=!1,ol,Ll=ws,Pg=ws,b2,br,In=globalThis,ht,P0;typeof In.vscode<"u"&&typeof In.vscode.process<"u"?ht=In.vscode.process:typeof process<"u"&&typeof((P0=process==null?void 0:process.versions)==null?void 0:P0.node)=="string"&&(ht=process);var M0,C2=typeof((M0=ht==null?void 0:ht.versions)==null?void 0:M0.electron)=="string",k2=C2&&(ht==null?void 0:ht.type)==="renderer",T0;if(typeof ht=="object"){Pd=ht.platform==="win32",Md=ht.platform==="darwin",Dl=ht.platform==="linux",Dl&&ht.env.SNAP&&ht.env.SNAP_REVISION,ht.env.CI||ht.env.BUILD_ARTIFACTSTAGINGDIRECTORY,ol=ws,Ll=ws;let e=ht.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);ol=t.userLocale,Pg=t.osLocale,Ll=t.resolvedLanguage||ws,b2=(T0=t.languagePack)==null?void 0:T0.translationsConfigFile}catch{}Xx=!0}else typeof navigator=="object"&&!k2?(br=navigator.userAgent,Pd=br.indexOf("Windows")>=0,Md=br.indexOf("Macintosh")>=0,(br.indexOf("Macintosh")>=0||br.indexOf("iPad")>=0||br.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Dl=br.indexOf("Linux")>=0,(br==null?void 0:br.indexOf("Mobi"))>=0,Ll=globalThis._VSCODE_NLS_LANGUAGE||ws,ol=navigator.language.toLowerCase(),Pg=ol):console.error("Unable to resolve platform.");var Qx=Pd,Jr=Md,N2=Dl,Mg=Xx,Zr=br,ji=Ll,E2;(e=>{function t(){return ji}e.value=t;function r(){return ji.length===2?ji==="en":ji.length>=3?ji[0]==="e"&&ji[1]==="n"&&ji[2]==="-":!1}e.isDefaultVariant=r;function i(){return ji==="en"}e.isDefault=i})(E2||(E2={}));var j2=typeof In.postMessage=="function"&&!In.importScripts;(()=>{if(j2){let e=[];In.addEventListener("message",r=>{if(r.data&&r.data.vscodeScheduleAsyncWork)for(let i=0,n=e.length;i<n;i++){let s=e[i];if(s.id===r.data.vscodeScheduleAsyncWork){e.splice(i,1),s.callback();return}}});let t=0;return r=>{let i=++t;e.push({id:i,callback:r}),In.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})();var P2=!!(Zr&&Zr.indexOf("Chrome")>=0);Zr&&Zr.indexOf("Firefox")>=0;!P2&&Zr&&Zr.indexOf("Safari")>=0;Zr&&Zr.indexOf("Edg/")>=0;Zr&&Zr.indexOf("Android")>=0;var ns=typeof navigator=="object"?navigator:{};Mg||document.queryCommandSupported&&document.queryCommandSupported("copy")||ns&&ns.clipboard&&ns.clipboard.writeText,Mg||ns&&ns.clipboard&&ns.clipboard.readText;var wp=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},Bu=new wp,Tg=new wp,Rg=new wp,M2=new Array(230),Gx;(e=>{function t(a){return Bu.keyCodeToStr(a)}e.toString=t;function r(a){return Bu.strToKeyCode(a)}e.fromString=r;function i(a){return Tg.keyCodeToStr(a)}e.toUserSettingsUS=i;function n(a){return Rg.keyCodeToStr(a)}e.toUserSettingsGeneral=n;function s(a){return Tg.strToKeyCode(a)||Rg.strToKeyCode(a)}e.fromUserSettings=s;function o(a){if(a>=98&&a<=113)return null;switch(a){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Bu.keyCodeToStr(a)}e.toElectronAccelerator=o})(Gx||(Gx={}));var T2=class Jx{constructor(t,r,i,n,s){this.ctrlKey=t,this.shiftKey=r,this.altKey=i,this.metaKey=n,this.keyCode=s}equals(t){return t instanceof Jx&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",r=this.shiftKey?"1":"0",i=this.altKey?"1":"0",n=this.metaKey?"1":"0";return`K${t}${r}${i}${n}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new R2([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},R2=class{constructor(e){if(e.length===0)throw i2("chords");this.chords=e}getHashCode(){let e="";for(let t=0,r=this.chords.length;t<r;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function D2(e){if(e.charCode){let r=String.fromCharCode(e.charCode).toUpperCase();return Gx.fromString(r)}let t=e.keyCode;if(t===3)return 7;if(jd)switch(t){case 59:return 85;case 60:if(N2)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Jr)return 57;break}else if(w2&&(Jr&&t===93||!Jr&&t===92))return 57;return M2[t]||0}var L2=Jr?256:2048,A2=512,O2=1024,B2=Jr?2048:256,Dg=class{constructor(e){var r;this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=(r=t.getModifierState)==null?void 0:r.call(t,"AltGraph"),this.keyCode=D2(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=L2),this.altKey&&(t|=A2),this.shiftKey&&(t|=O2),this.metaKey&&(t|=B2),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new T2(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},Lg=new WeakMap;function z2(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,r=e.parent.location;if(t.origin!=="null"&&r.origin!=="null"&&t.origin!==r.origin)return null}catch{return null}return e.parent}var I2=class{static getSameOriginWindowChain(e){let t=Lg.get(e);if(!t){t=[],Lg.set(e,t);let r=e,i;do i=z2(r),i?t.push({window:new WeakRef(r),iframeElement:r.frameElement||null}):t.push({window:new WeakRef(r),iframeElement:null}),r=i;while(r)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let r=0,i=0,n=this.getSameOriginWindowChain(e);for(let s of n){let o=s.window.deref();if(r+=(o==null?void 0:o.scrollY)??0,i+=(o==null?void 0:o.scrollX)??0,o===t||!s.iframeElement)break;let a=s.iframeElement.getBoundingClientRect();r+=a.top,i+=a.left}return{top:r,left:i}}},al=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(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 r=I2.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=r.left,this.posy-=r.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},Ag=class{constructor(e,t=0,r=0){var n;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=r,this.deltaX=t;let i=!1;if(xp){let s=navigator.userAgent.match(/Chrome\/(\d+)/);i=(s?parseInt(s[1]):123)<=122}if(e){let s=e,o=e,a=((n=e.view)==null?void 0:n.devicePixelRatio)||1;if(typeof s.wheelDeltaY<"u")i?this.deltaY=s.wheelDeltaY/(120*a):this.deltaY=s.wheelDeltaY/120;else if(typeof o.VERTICAL_AXIS<"u"&&o.axis===o.VERTICAL_AXIS)this.deltaY=-o.detail/3;else if(e.type==="wheel"){let u=e;u.deltaMode===u.DOM_DELTA_LINE?jd&&!Jr?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof s.wheelDeltaX<"u")S2&&Qx?this.deltaX=-(s.wheelDeltaX/120):i?this.deltaX=s.wheelDeltaX/(120*a):this.deltaX=s.wheelDeltaX/120;else if(typeof o.HORIZONTAL_AXIS<"u"&&o.axis===o.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let u=e;u.deltaMode===u.DOM_DELTA_LINE?jd&&!Jr?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(i?this.deltaY=e.wheelDelta/(120*a):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},Zx=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),F2;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof H2?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:dt.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Zx})})(F2||(F2={}));var H2=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?Zx:(this._emitter||(this._emitter=new q),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Sp=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof t=="number"&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new Sd("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Sd("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},$2=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;(e=this.disposable)==null||e.dispose(),this.disposable=void 0}cancelAndSet(e,t,r=globalThis){if(this.isDisposed)throw new Sd("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let i=r.setInterval(()=>{e()},t);this.disposable=Me(()=>{r.clearInterval(i),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},W2;(e=>{async function t(i){let n,s=await Promise.all(i.map(o=>o.then(a=>a,a=>{n||(n=a)})));if(typeof n<"u")throw n;return s}e.settled=t;function r(i){return new Promise(async(n,s)=>{try{await i(n,s)}catch(o){s(o)}})}e.withAsyncBody=r})(W2||(W2={}));var Og=class ar{static fromArray(t){return new ar(r=>{r.emitMany(t)})}static fromPromise(t){return new ar(async r=>{r.emitMany(await t)})}static fromPromises(t){return new ar(async r=>{await Promise.all(t.map(async i=>r.emitOne(await i)))})}static merge(t){return new ar(async r=>{await Promise.all(t.map(async i=>{for await(let n of i)r.emitOne(n)}))})}constructor(t,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new q,queueMicrotask(async()=>{let i={emitOne:n=>this.emitOne(n),emitMany:n=>this.emitMany(n),reject:n=>this.reject(n)};try{await Promise.resolve(t(i)),this.resolve()}catch(n){this.reject(n)}finally{i.emitOne=void 0,i.emitMany=void 0,i.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await dt.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var r;return(r=this._onReturn)==null||r.call(this),{done:!0,value:void 0}}}}static map(t,r){return new ar(async i=>{for await(let n of t)i.emitOne(r(n))})}map(t){return ar.map(this,t)}static filter(t,r){return new ar(async i=>{for await(let n of t)r(n)&&i.emitOne(n)})}filter(t){return ar.filter(this,t)}static coalesce(t){return ar.filter(t,r=>!!r)}coalesce(){return ar.coalesce(this)}static async toPromise(t){let r=[];for await(let i of t)r.push(i);return r}toPromise(){return ar.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};Og.EMPTY=Og.fromArray([]);var{getWindow:Xr,getWindowId:U2,onDidRegisterWindow:K2}=function(){let e=new Map,t={window:mi,disposables:new on};e.set(mi.vscodeWindowId,t);let r=new q,i=new q,n=new q;function s(o,a){return(typeof o=="number"?e.get(o):void 0)??(a?t:void 0)}return{onDidRegisterWindow:r.event,onWillUnregisterWindow:n.event,onDidUnregisterWindow:i.event,registerWindow(o){if(e.has(o.vscodeWindowId))return ce.None;let a=new on,u={window:o,disposables:a.add(new on)};return e.set(o.vscodeWindowId,u),a.add(Me(()=>{e.delete(o.vscodeWindowId),i.fire(o)})),a.add(te(o,it.BEFORE_UNLOAD,()=>{n.fire(o)})),r.fire(u),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return e.has(o)},getWindowById:s,getWindow(o){var c;let a=o;if((c=a==null?void 0:a.ownerDocument)!=null&&c.defaultView)return a.ownerDocument.defaultView.window;let u=o;return u!=null&&u.view?u.view.window:mi},getDocument(o){return Xr(o).document}}}(),q2=class{constructor(e,t,r,i){this._node=e,this._type=t,this._handler=r,this._options=i||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function te(e,t,r,i){return new q2(e,t,r,i)}var Bg=function(e,t,r,i){return te(e,t,r,i)},bp,V2=class extends $2{constructor(e){super(),this.defaultTarget=e&&Xr(e)}cancelAndSet(e,t,r){return super.cancelAndSet(e,t,r??this.defaultTarget)}},zg=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){Rl(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,r=new Map,i=new Map,n=s=>{r.set(s,!1);let o=e.get(s)??[];for(t.set(s,o),e.set(s,[]),i.set(s,!0);o.length>0;)o.sort(zg.sort),o.shift().execute();i.set(s,!1)};bp=(s,o,a=0)=>{let u=U2(s),c=new zg(o,a),h=e.get(u);return h||(h=[],e.set(u,h)),h.push(c),r.get(u)||(r.set(u,!0),s.requestAnimationFrame(()=>n(u))),c}})();function Y2(e){let t=e.getBoundingClientRect(),r=Xr(e);return{left:t.left+r.scrollX,top:t.top+r.scrollY,width:t.width,height:t.height}}var it={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},X2=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let t=At(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=At(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=At(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=At(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=At(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=At(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=At(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=At(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=At(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=At(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=At(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=At(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=At(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=At(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}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}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function At(e){return typeof e=="number"?`${e}px`:e}function qo(e){return new X2(e)}var ew=class{constructor(){this._hooks=new on,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let r=this._onStopCallback;this._onStopCallback=null,e&&r&&r(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,r,i,n){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=i,this._onStopCallback=n;let s=e;try{e.setPointerCapture(t),this._hooks.add(Me(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{s=Xr(e)}this._hooks.add(te(s,it.POINTER_MOVE,o=>{if(o.buttons!==r){this.stopMonitoring(!0);return}o.preventDefault(),this._pointerMoveCallback(o)})),this._hooks.add(te(s,it.POINTER_UP,o=>this.stopMonitoring(!0)))}};function Q2(e,t,r){let i=null,n=null;if(typeof r.value=="function"?(i="value",n=r.value,n.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof r.get=="function"&&(i="get",n=r.get),!n)throw new Error("not supported");let s=`$memoize$${t}`;r[i]=function(...o){return this.hasOwnProperty(s)||Object.defineProperty(this,s,{configurable:!1,enumerable:!1,writable:!1,value:n.apply(this,o)}),this[s]}}var Fr;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Fr||(Fr={}));var Ro=class vt extends ce{constructor(){super(),this.dispatched=!1,this.targets=new jg,this.ignoreTargets=new jg,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(dt.runAndSubscribe(K2,({window:t,disposables:r})=>{r.add(te(t.document,"touchstart",i=>this.onTouchStart(i),{passive:!1})),r.add(te(t.document,"touchend",i=>this.onTouchEnd(t,i))),r.add(te(t.document,"touchmove",i=>this.onTouchMove(i),{passive:!1}))},{window:mi,disposables:this._store}))}static addTarget(t){if(!vt.isTouchDevice())return ce.None;vt.INSTANCE||(vt.INSTANCE=new vt);let r=vt.INSTANCE.targets.push(t);return Me(r)}static ignoreTarget(t){if(!vt.isTouchDevice())return ce.None;vt.INSTANCE||(vt.INSTANCE=new vt);let r=vt.INSTANCE.ignoreTargets.push(t);return Me(r)}static isTouchDevice(){return"ontouchstart"in mi||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let r=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let i=0,n=t.targetTouches.length;i<n;i++){let s=t.targetTouches.item(i);this.activeTouches[s.identifier]={id:s.identifier,initialTarget:s.target,initialTimeStamp:r,initialPageX:s.pageX,initialPageY:s.pageY,rollingTimestamps:[r],rollingPageX:[s.pageX],rollingPageY:[s.pageY]};let o=this.newGestureEvent(Fr.Start,s.target);o.pageX=s.pageX,o.pageY=s.pageY,this.dispatchEvent(o)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,r){let i=Date.now(),n=Object.keys(this.activeTouches).length;for(let s=0,o=r.changedTouches.length;s<o;s++){let a=r.changedTouches.item(s);if(!this.activeTouches.hasOwnProperty(String(a.identifier))){console.warn("move of an UNKNOWN touch",a);continue}let u=this.activeTouches[a.identifier],c=Date.now()-u.initialTimeStamp;if(c<vt.HOLD_DELAY&&Math.abs(u.initialPageX-Vt(u.rollingPageX))<30&&Math.abs(u.initialPageY-Vt(u.rollingPageY))<30){let h=this.newGestureEvent(Fr.Tap,u.initialTarget);h.pageX=Vt(u.rollingPageX),h.pageY=Vt(u.rollingPageY),this.dispatchEvent(h)}else if(c>=vt.HOLD_DELAY&&Math.abs(u.initialPageX-Vt(u.rollingPageX))<30&&Math.abs(u.initialPageY-Vt(u.rollingPageY))<30){let h=this.newGestureEvent(Fr.Contextmenu,u.initialTarget);h.pageX=Vt(u.rollingPageX),h.pageY=Vt(u.rollingPageY),this.dispatchEvent(h)}else if(n===1){let h=Vt(u.rollingPageX),d=Vt(u.rollingPageY),f=Vt(u.rollingTimestamps)-u.rollingTimestamps[0],p=h-u.rollingPageX[0],m=d-u.rollingPageY[0],y=[...this.targets].filter(C=>u.initialTarget instanceof Node&&C.contains(u.initialTarget));this.inertia(t,y,i,Math.abs(p)/f,p>0?1:-1,h,Math.abs(m)/f,m>0?1:-1,d)}this.dispatchEvent(this.newGestureEvent(Fr.End,u.initialTarget)),delete this.activeTouches[a.identifier]}this.dispatched&&(r.preventDefault(),r.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,r){let i=document.createEvent("CustomEvent");return i.initEvent(t,!1,!0),i.initialTarget=r,i.tapCount=0,i}dispatchEvent(t){if(t.type===Fr.Tap){let r=new Date().getTime(),i=0;r-this._lastSetTapCountTime>vt.CLEAR_TAP_COUNT_TIME?i=1:i=2,this._lastSetTapCountTime=r,t.tapCount=i}else(t.type===Fr.Change||t.type===Fr.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let i of this.ignoreTargets)if(i.contains(t.initialTarget))return;let r=[];for(let i of this.targets)if(i.contains(t.initialTarget)){let n=0,s=t.initialTarget;for(;s&&s!==i;)n++,s=s.parentElement;r.push([n,i])}r.sort((i,n)=>i[0]-n[0]);for(let[i,n]of r)n.dispatchEvent(t),this.dispatched=!0}}inertia(t,r,i,n,s,o,a,u,c){this.handle=bp(t,()=>{let h=Date.now(),d=h-i,f=0,p=0,m=!0;n+=vt.SCROLL_FRICTION*d,a+=vt.SCROLL_FRICTION*d,n>0&&(m=!1,f=s*n*d),a>0&&(m=!1,p=u*a*d);let y=this.newGestureEvent(Fr.Change);y.translationX=f,y.translationY=p,r.forEach(C=>C.dispatchEvent(y)),m||this.inertia(t,r,h,n,s,o+f,a,u,c+p)})}onTouchMove(t){let r=Date.now();for(let i=0,n=t.changedTouches.length;i<n;i++){let s=t.changedTouches.item(i);if(!this.activeTouches.hasOwnProperty(String(s.identifier))){console.warn("end of an UNKNOWN touch",s);continue}let o=this.activeTouches[s.identifier],a=this.newGestureEvent(Fr.Change,o.initialTarget);a.translationX=s.pageX-Vt(o.rollingPageX),a.translationY=s.pageY-Vt(o.rollingPageY),a.pageX=s.pageX,a.pageY=s.pageY,this.dispatchEvent(a),o.rollingPageX.length>3&&(o.rollingPageX.shift(),o.rollingPageY.shift(),o.rollingTimestamps.shift()),o.rollingPageX.push(s.pageX),o.rollingPageY.push(s.pageY),o.rollingTimestamps.push(r)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};Ro.SCROLL_FRICTION=-.005,Ro.HOLD_DELAY=700,Ro.CLEAR_TAP_COUNT_TIME=400,Fe([Q2],Ro,"isTouchDevice",1);var G2=Ro,Cp=class extends ce{onclick(e,t){this._register(te(e,it.CLICK,r=>t(new al(Xr(e),r))))}onmousedown(e,t){this._register(te(e,it.MOUSE_DOWN,r=>t(new al(Xr(e),r))))}onmouseover(e,t){this._register(te(e,it.MOUSE_OVER,r=>t(new al(Xr(e),r))))}onmouseleave(e,t){this._register(te(e,it.MOUSE_LEAVE,r=>t(new al(Xr(e),r))))}onkeydown(e,t){this._register(te(e,it.KEY_DOWN,r=>t(new Dg(r))))}onkeyup(e,t){this._register(te(e,it.KEY_UP,r=>t(new Dg(r))))}oninput(e,t){this._register(te(e,it.INPUT,t))}onblur(e,t){this._register(te(e,it.BLUR,t))}onfocus(e,t){this._register(te(e,it.FOCUS,t))}onchange(e,t){this._register(te(e,it.CHANGE,t))}ignoreGesture(e){return G2.ignoreTarget(e)}},Ig=11,J2=class extends Cp{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="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",this.domNode.style.width=Ig+"px",this.domNode.style.height=Ig+"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 ew),this._register(Bg(this.bgDomNode,it.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(Bg(this.domNode,it.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new V2),this._pointerdownScheduleRepeatTimer=this._register(new Sp)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Xr(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,r=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},Z2=class Td{constructor(t,r,i,n,s,o,a){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(r=r|0,i=i|0,n=n|0,s=s|0,o=o|0,a=a|0),this.rawScrollLeft=n,this.rawScrollTop=a,r<0&&(r=0),n+r>i&&(n=i-r),n<0&&(n=0),s<0&&(s=0),a+s>o&&(a=o-s),a<0&&(a=0),this.width=r,this.scrollWidth=i,this.scrollLeft=n,this.height=s,this.scrollHeight=o,this.scrollTop=a}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,r){return new Td(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,r?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,r?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new Td(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(t,r){let i=this.width!==t.width,n=this.scrollWidth!==t.scrollWidth,s=this.scrollLeft!==t.scrollLeft,o=this.height!==t.height,a=this.scrollHeight!==t.scrollHeight,u=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:r,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:i,scrollWidthChanged:n,scrollLeftChanged:s,heightChanged:o,scrollHeightChanged:a,scrollTopChanged:u}}},eN=class extends ce{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new q),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new Z2(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 i;let r=this._state.withScrollDimensions(e,t);this._setState(r,!!this._smoothScrolling),(i=this._smoothScrolling)==null||i.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(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);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 r=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===r.scrollLeft&&this._smoothScrolling.to.scrollTop===r.scrollTop)return;let i;t?i=new Hg(this._smoothScrolling.from,r,this._smoothScrolling.startTime,this._smoothScrolling.duration):i=this._smoothScrolling.combine(this._state,r,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=i}else{let r=this._state.withScrollPosition(e);this._smoothScrolling=Hg.start(this._state,r,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}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){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let r=this._state;r.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(r,t)))}},Fg=class{constructor(e,t,r){this.scrollLeft=e,this.scrollTop=t,this.isDone=r}};function zu(e,t){let r=t-e;return function(i){return e+r*iN(i)}}function tN(e,t,r){return function(i){return i<r?e(i/r):t((i-r)/(1-r))}}var Hg=class Rd{constructor(t,r,i,n){this.from=t,this.to=r,this.duration=n,this.startTime=i,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(t,r,i){if(Math.abs(t-r)>2.5*i){let n,s;return t<r?(n=t+.75*i,s=r-.75*i):(n=t-.75*i,s=r+.75*i),tN(zu(t,n),zu(s,r),.33)}return zu(t,r)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let r=(t-this.startTime)/this.duration;if(r<1){let i=this.scrollLeft(r),n=this.scrollTop(r);return new Fg(i,n,!1)}return new Fg(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,r,i){return Rd.start(t,r,i)}static start(t,r,i){i=i+10;let n=Date.now()-10;return new Rd(t,r,n,i)}};function rN(e){return Math.pow(e,3)}function iN(e){return 1-rN(1-e)}var nN=class extends ce{constructor(e,t,r){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=r,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new Sp)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0: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(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{var e;(e=this._domNode)==null||e.setClassName(this._visibleClassName)},0))}_hide(e){var t;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,(t=this._domNode)==null||t.setClassName(this._invisibleClassName+(e?" fade":"")))}},sN=140,tw=class extends Cp{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 nN(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new ew),this._shouldRender=!0,this.domNode=qo(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(te(this.domNode.domNode,it.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new J2(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,r,i){this.slider=qo(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof r=="number"&&this.slider.setWidth(r),typeof i=="number"&&this.slider.setHeight(i),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(te(this.slider.domNode,it.POINTER_DOWN,n=>{n.button===0&&(n.preventDefault(),this._sliderPointerDown(n))})),this.onclick(this.slider.domNode,n=>{n.leftButton&&n.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(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._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,r=t+this._scrollbarState.getSliderPosition(),i=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),n=this._sliderPointerPosition(e);r<=n&&n<=i?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,r;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,r=e.offsetY;else{let n=Y2(this.domNode.domNode);t=e.pageX-n.left,r=e.pageY-n.top}let i=this._pointerDownRelativePosition(t,r);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(i):this._scrollbarState.getDesiredScrollPositionFromOffset(i)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),r=this._sliderOrthogonalPointerPosition(e),i=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{let s=this._sliderOrthogonalPointerPosition(n),o=Math.abs(s-r);if(Qx&&o>sN){this._setDesiredScrollPositionNow(i.getScrollPosition());return}let a=this._sliderPointerPosition(n)-t;this._setDesiredScrollPositionNow(i.getDesiredScrollPositionFromDelta(a))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_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()}},rw=class Dd{constructor(t,r,i,n,s,o){this._scrollbarSize=Math.round(r),this._oppositeScrollbarSize=Math.round(i),this._arrowSize=Math.round(t),this._visibleSize=n,this._scrollSize=s,this._scrollPosition=o,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new Dd(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let r=Math.round(t);return this._visibleSize!==r?(this._visibleSize=r,this._refreshComputedValues(),!0):!1}setScrollSize(t){let r=Math.round(t);return this._scrollSize!==r?(this._scrollSize=r,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let r=Math.round(t);return this._scrollPosition!==r?(this._scrollPosition=r,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,r,i,n,s){let o=Math.max(0,i-t),a=Math.max(0,o-2*r),u=n>0&&n>i;if(!u)return{computedAvailableSize:Math.round(o),computedIsNeeded:u,computedSliderSize:Math.round(a),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(i*a/n))),h=(a-c)/(n-i),d=s*h;return{computedAvailableSize:Math.round(o),computedIsNeeded:u,computedSliderSize:Math.round(c),computedSliderRatio:h,computedSliderPosition:Math.round(d)}}_refreshComputedValues(){let t=Dd._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(t){if(!this._computedIsNeeded)return 0;let r=t-this._arrowSize-this._computedSliderSize/2;return Math.round(r/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let r=t-this._arrowSize,i=this._scrollPosition;return r<this._computedSliderPosition?i-=this._visibleSize:i+=this._visibleSize,i}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let r=this._computedSliderPosition+t;return Math.round(r/this._computedSliderRatio)}},oN=class extends tw{constructor(e,t,r){let i=e.getScrollDimensions(),n=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new rw(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,i.width,i.scrollWidth,n.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"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)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(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(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},aN=class extends tw{constructor(e,t,r){let i=e.getScrollDimensions(),n=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new rw(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,i.height,i.scrollHeight,n.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");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)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(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}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},lN=500,$g=50,cN=class{constructor(e,t,r){this.timestamp=e,this.deltaX=t,this.deltaY=r,this.score=0}},Ld=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,r=0,i=1,n=this._rear;do{let s=n===this._front?t:Math.pow(2,-i);if(t-=s,r+=this._memory[n].score*s,n===this._front)break;n=(this._capacity+n-1)%this._capacity,i++}while(!0);return r<=.5}acceptStandardWheelEvent(t){if(xp){let r=Xr(t.browserEvent),i=x2(r);this.accept(Date.now(),t.deltaX*i,t.deltaY*i)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,r,i){let n=null,s=new cN(t,r,i);this._front===-1&&this._rear===-1?(this._memory[0]=s,this._front=0,this._rear=0):(n=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]=s),s.score=this._computeScore(s,n)}_computeScore(t,r){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let i=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(i+=.25),r){let n=Math.abs(t.deltaX),s=Math.abs(t.deltaY),o=Math.abs(r.deltaX),a=Math.abs(r.deltaY),u=Math.max(Math.min(n,o),1),c=Math.max(Math.min(s,a),1),h=Math.max(n,o),d=Math.max(s,a);h%u===0&&d%c===0&&(i-=.5)}return Math.min(Math.max(i,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};Ld.INSTANCE=new Ld;var uN=Ld,hN=class extends Cp{constructor(e,t,r){super(),this._onScroll=this._register(new q),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new q),this.onWillScroll=this._onWillScroll.event,this._options=fN(t),this._scrollable=r,this._register(this._scrollable.onScroll(n=>{this._onWillScroll.fire(n),this._onDidScroll(n),this._onScroll.fire(n)}));let i={onMouseWheel:n=>this._onMouseWheel(n),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new aN(this._scrollable,this._options,i)),this._horizontalScrollbar=this._register(new oN(this._scrollable,this._options,i)),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=qo(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=qo(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=qo(document.createElement("div")),this._topLeftShadowDomNode.setClassName("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,n=>this._onMouseOver(n)),this.onmouseleave(this._listenOnDomNode,n=>this._onMouseLeave(n)),this._hideTimeout=this._register(new Sp),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Yn(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,Jr&&(this._options.className+=" 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.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()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new Ag(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Yn(this._mouseWheelToDispose),e)){let t=r=>{this._onMouseWheel(new Ag(r))};this._mouseWheelToDispose.push(te(this._listenOnDomNode,it.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var n;if((n=e.browserEvent)!=null&&n.defaultPrevented)return;let t=uN.INSTANCE;t.acceptStandardWheelEvent(e);let r=!1;if(e.deltaY||e.deltaX){let s=e.deltaY*this._options.mouseWheelScrollSensitivity,o=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&o+s===0?o=s=0:Math.abs(s)>=Math.abs(o)?o=0:s=0),this._options.flipAxes&&([s,o]=[o,s]);let a=!Jr&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!o&&(o=s,s=0),e.browserEvent&&e.browserEvent.altKey&&(o=o*this._options.fastScrollSensitivity,s=s*this._options.fastScrollSensitivity);let u=this._scrollable.getFutureScrollPosition(),c={};if(s){let h=$g*s,d=u.scrollTop-(h<0?Math.floor(h):Math.ceil(h));this._verticalScrollbar.writeScrollPosition(c,d)}if(o){let h=$g*o,d=u.scrollLeft-(h<0?Math.floor(h):Math.ceil(h));this._horizontalScrollbar.writeScrollPosition(c,d)}c=this._scrollable.validateScrollPosition(c),(u.scrollLeft!==c.scrollLeft||u.scrollTop!==c.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(c):this._scrollable.setScrollPositionNow(c),r=!0)}let i=r;!i&&this._options.alwaysConsumeMouseWheel&&(i=!0),!i&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(i=!0),i&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(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,r=e.scrollLeft>0,i=r?" left":"",n=t?" top":"",s=r||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${i}`),this._topShadowDomNode.setClassName(`shadow${n}`),this._topLeftShadowDomNode.setClassName(`shadow${s}${n}${i}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(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(),lN)}},dN=class extends hN{constructor(e,t,r){super(e,t,r)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function fN(e){let t={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,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:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,Jr&&(t.className+=" mac"),t}var Ad=class extends ce{constructor(e,t,r,i,n,s,o,a){super(),this._bufferService=r,this._optionsService=o,this._renderService=a,this._onRequestScrollLines=this._register(new q),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let u=this._register(new eN({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:c=>bp(i.window,c)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{u.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new dN(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},u)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(n.onProtocolChange(c=>{this._scrollableElement.updateOptions({handleMouseWheel:!(c&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(dt.runAndSubscribe(s.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=s.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Me(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=i.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(Me(()=>this._styleElement.remove())),this._register(dt.runAndSubscribe(s.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${s.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${s.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${s.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
365
+ `)})),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._scrollableElement.onScroll(c=>this._handleScroll(c)))}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;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.width)||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(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),r=t-this._bufferService.buffer.ydisp;r!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(r)),this._isHandlingScroll=!1}};Ad=Fe([X(2,Rt),X(3,bi),X(4,Ox),X(5,to),X(6,Dt),X(7,Ci)],Ad);var Od=class extends ce{constructor(e,t,r,i,n){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=r,this._decorationService=i,this._renderService=n,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(s=>this._removeDecoration(s))),this._register(Me(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(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 i;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((i=e==null?void 0:e.options)==null?void 0:i.layer)==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let r=e.options.x??0;return r&&r>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_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 r=this._decorationElements.get(e);r||(r=this._createElement(e),e.element=r,this._decorationElements.set(e,r),this._container.appendChild(r),e.onDispose(()=>{this._decorationElements.delete(e),r.remove()})),r.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(r.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,r.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,r.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,r.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(r)}}_refreshXPosition(e,t=e.element){if(!t)return;let r=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=r?`${r*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=r?`${r*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var t;(t=this._decorationElements.get(e))==null||t.remove(),this._decorationElements.delete(e),e.dispose()}};Od=Fe([X(1,Rt),X(2,bi),X(3,Ta),X(4,Ci)],Od);var pN=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)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){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,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}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,r){return t>=e.startBufferLine-this._linePadding[r||"full"]&&t<=e.endBufferLine+this._linePadding[r||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},zr={full:0,left:0,center:0,right:0},Pi={full:0,left:0,center:0,right:0},yo={full:0,left:0,center:0,right:0},gc=class extends ce{constructor(e,t,r,i,n,s,o,a){var c;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=r,this._decorationService=i,this._renderService=n,this._optionsService=s,this._themeService=o,this._coreBrowserService=a,this._colorZoneStore=new pN,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(),(c=this._viewportElement.parentElement)==null||c.insertBefore(this._canvas,this._viewportElement),this._register(Me(()=>{var h;return(h=this._canvas)==null?void 0:h.remove()}));let u=this._canvas.getContext("2d");if(u)this._ctx=u;else throw new Error("Ctx cannot be null");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.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){var e;return((e=this._optionsService.options.overviewRuler)==null?void 0:e.width)||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);Pi.full=this._canvas.width,Pi.left=e,Pi.center=t,Pi.right=e,this._refreshDrawHeightConstants(),yo.full=1,yo.left=1,yo.center=1+Pi.left,yo.right=1+Pi.left+Pi.center}_refreshDrawHeightConstants(){zr.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);zr.left=t,zr.center=t,zr.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*zr.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*zr.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*zr.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*zr.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(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)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.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(yo[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-zr[e.position||"full"]/2),Pi[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+zr[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};gc=Fe([X(2,Rt),X(3,Ta),X(4,Ci),X(5,Dt),X(6,to),X(7,bi)],gc);var z;(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT=" ",e.LF=`
366
+ `,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""))(z||(z={}));var Al;(e=>(e.PAD="€",e.HOP="",e.BPH="‚",e.NBH="ƒ",e.IND="„",e.NEL="…",e.SSA="†",e.ESA="‡",e.HTS="ˆ",e.HTJ="‰",e.VTS="Š",e.PLD="‹",e.PLU="Œ",e.RI="",e.SS2="Ž",e.SS3="",e.DCS="",e.PU1="‘",e.PU2="’",e.STS="“",e.CCH="”",e.MW="•",e.SPA="–",e.EPA="—",e.SOS="˜",e.SGCI="™",e.SCI="š",e.CSI="›",e.ST="œ",e.OSC="",e.PM="ž",e.APC="Ÿ"))(Al||(Al={}));var iw;(e=>e.ST=`${z.ESC}\\`)(iw||(iw={}));var Bd=class{constructor(e,t,r,i,n,s){this._textarea=e,this._compositionView=t,this._bufferService=r,this._optionsService=i,this._coreService=n,this._renderService=s,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let r;t.start+=this._dataAlreadySent.length,this._isComposing?r=this._textarea.value.substring(t.start,this._compositionPosition.start):r=this._textarea.value.substring(t.start),r.length>0&&this._coreService.triggerDataEvent(r,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,r=t.replace(e,"");this._dataAlreadySent=r,t.length>e.length?this._coreService.triggerDataEvent(r,!0):t.length<e.length?this._coreService.triggerDataEvent(`${z.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),r=this._renderService.dimensions.css.cell.height,i=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,n=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=n+"px",this._compositionView.style.top=i+"px",this._compositionView.style.height=r+"px",this._compositionView.style.lineHeight=r+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let s=this._compositionView.getBoundingClientRect();this._textarea.style.left=n+"px",this._textarea.style.top=i+"px",this._textarea.style.width=Math.max(s.width,1)+"px",this._textarea.style.height=Math.max(s.height,1)+"px",this._textarea.style.lineHeight=s.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};Bd=Fe([X(2,Rt),X(3,Dt),X(4,Zn),X(5,Ci)],Bd);var st=0,ot=0,at=0,Be=0,Wg={css:"#00000000",rgba:0},Ve;(e=>{function t(n,s,o,a){return a!==void 0?`#${mn(n)}${mn(s)}${mn(o)}${mn(a)}`:`#${mn(n)}${mn(s)}${mn(o)}`}e.toCss=t;function r(n,s,o,a=255){return(n<<24|s<<16|o<<8|a)>>>0}e.toRgba=r;function i(n,s,o,a){return{css:e.toCss(n,s,o,a),rgba:e.toRgba(n,s,o,a)}}e.toColor=i})(Ve||(Ve={}));var ke;(e=>{function t(u,c){if(Be=(c.rgba&255)/255,Be===1)return{css:c.css,rgba:c.rgba};let h=c.rgba>>24&255,d=c.rgba>>16&255,f=c.rgba>>8&255,p=u.rgba>>24&255,m=u.rgba>>16&255,y=u.rgba>>8&255;st=p+Math.round((h-p)*Be),ot=m+Math.round((d-m)*Be),at=y+Math.round((f-y)*Be);let C=Ve.toCss(st,ot,at),g=Ve.toRgba(st,ot,at);return{css:C,rgba:g}}e.blend=t;function r(u){return(u.rgba&255)===255}e.isOpaque=r;function i(u,c,h){let d=Ol.ensureContrastRatio(u.rgba,c.rgba,h);if(d)return Ve.toColor(d>>24&255,d>>16&255,d>>8&255)}e.ensureContrastRatio=i;function n(u){let c=(u.rgba|255)>>>0;return[st,ot,at]=Ol.toChannels(c),{css:Ve.toCss(st,ot,at),rgba:c}}e.opaque=n;function s(u,c){return Be=Math.round(c*255),[st,ot,at]=Ol.toChannels(u.rgba),{css:Ve.toCss(st,ot,at,Be),rgba:Ve.toRgba(st,ot,at,Be)}}e.opacity=s;function o(u,c){return Be=u.rgba&255,s(u,Be*c/255)}e.multiplyOpacity=o;function a(u){return[u.rgba>>24&255,u.rgba>>16&255,u.rgba>>8&255]}e.toColorRGB=a})(ke||(ke={}));var Re;(e=>{let t,r;try{let n=document.createElement("canvas");n.width=1,n.height=1;let s=n.getContext("2d",{willReadFrequently:!0});s&&(t=s,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function i(n){if(n.match(/#[\da-f]{3,8}/i))switch(n.length){case 4:return st=parseInt(n.slice(1,2).repeat(2),16),ot=parseInt(n.slice(2,3).repeat(2),16),at=parseInt(n.slice(3,4).repeat(2),16),Ve.toColor(st,ot,at);case 5:return st=parseInt(n.slice(1,2).repeat(2),16),ot=parseInt(n.slice(2,3).repeat(2),16),at=parseInt(n.slice(3,4).repeat(2),16),Be=parseInt(n.slice(4,5).repeat(2),16),Ve.toColor(st,ot,at,Be);case 7:return{css:n,rgba:(parseInt(n.slice(1),16)<<8|255)>>>0};case 9:return{css:n,rgba:parseInt(n.slice(1),16)>>>0}}let s=n.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 st=parseInt(s[1]),ot=parseInt(s[2]),at=parseInt(s[3]),Be=Math.round((s[5]===void 0?1:parseFloat(s[5]))*255),Ve.toColor(st,ot,at,Be);if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=n,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[st,ot,at,Be]=t.getImageData(0,0,1,1).data,Be!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Ve.toRgba(st,ot,at,Be),css:n}}e.toColor=i})(Re||(Re={}));var bt;(e=>{function t(i){return r(i>>16&255,i>>8&255,i&255)}e.relativeLuminance=t;function r(i,n,s){let o=i/255,a=n/255,u=s/255,c=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),h=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),d=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4);return c*.2126+h*.7152+d*.0722}e.relativeLuminance2=r})(bt||(bt={}));var Ol;(e=>{function t(o,a){if(Be=(a&255)/255,Be===1)return a;let u=a>>24&255,c=a>>16&255,h=a>>8&255,d=o>>24&255,f=o>>16&255,p=o>>8&255;return st=d+Math.round((u-d)*Be),ot=f+Math.round((c-f)*Be),at=p+Math.round((h-p)*Be),Ve.toRgba(st,ot,at)}e.blend=t;function r(o,a,u){let c=bt.relativeLuminance(o>>8),h=bt.relativeLuminance(a>>8);if(si(c,h)<u){if(h<c){let p=i(o,a,u),m=si(c,bt.relativeLuminance(p>>8));if(m<u){let y=n(o,a,u),C=si(c,bt.relativeLuminance(y>>8));return m>C?p:y}return p}let d=n(o,a,u),f=si(c,bt.relativeLuminance(d>>8));if(f<u){let p=i(o,a,u),m=si(c,bt.relativeLuminance(p>>8));return f>m?d:p}return d}}e.ensureContrastRatio=r;function i(o,a,u){let c=o>>24&255,h=o>>16&255,d=o>>8&255,f=a>>24&255,p=a>>16&255,m=a>>8&255,y=si(bt.relativeLuminance2(f,p,m),bt.relativeLuminance2(c,h,d));for(;y<u&&(f>0||p>0||m>0);)f-=Math.max(0,Math.ceil(f*.1)),p-=Math.max(0,Math.ceil(p*.1)),m-=Math.max(0,Math.ceil(m*.1)),y=si(bt.relativeLuminance2(f,p,m),bt.relativeLuminance2(c,h,d));return(f<<24|p<<16|m<<8|255)>>>0}e.reduceLuminance=i;function n(o,a,u){let c=o>>24&255,h=o>>16&255,d=o>>8&255,f=a>>24&255,p=a>>16&255,m=a>>8&255,y=si(bt.relativeLuminance2(f,p,m),bt.relativeLuminance2(c,h,d));for(;y<u&&(f<255||p<255||m<255);)f=Math.min(255,f+Math.ceil((255-f)*.1)),p=Math.min(255,p+Math.ceil((255-p)*.1)),m=Math.min(255,m+Math.ceil((255-m)*.1)),y=si(bt.relativeLuminance2(f,p,m),bt.relativeLuminance2(c,h,d));return(f<<24|p<<16|m<<8|255)>>>0}e.increaseLuminance=n;function s(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}e.toChannels=s})(Ol||(Ol={}));function mn(e){let t=e.toString(16);return t.length<2?"0"+t:t}function si(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var mN=class extends Ma{constructor(e,t,r){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=r}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()]}},_c=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new gr}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(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let r=[],i=t.translateToString(!0),n=0,s=0,o=0,a=t.getFg(0),u=t.getBg(0);for(let c=0;c<t.getTrimmedLength();c++)if(t.loadCell(c,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==a||this._workCell.bg!==u){if(c-n>1){let h=this._getJoinedRanges(i,o,s,t,n);for(let d=0;d<h.length;d++)r.push(h[d])}n=c,o=s,a=this._workCell.fg,u=this._workCell.bg}s+=this._workCell.getChars().length||Xi.length}if(this._bufferService.cols-n>1){let c=this._getJoinedRanges(i,o,s,t,n);for(let h=0;h<c.length;h++)r.push(c[h])}return r}_getJoinedRanges(e,t,r,i,n){let s=e.substring(t,r),o=[];try{o=this._characterJoiners[0].handler(s)}catch(a){console.error(a)}for(let a=1;a<this._characterJoiners.length;a++)try{let u=this._characterJoiners[a].handler(s);for(let c=0;c<u.length;c++)_c._mergeRanges(o,u[c])}catch(u){console.error(u)}return this._stringRangesToCellRanges(o,i,n),o}_stringRangesToCellRanges(e,t,r){let i=0,n=!1,s=0,o=e[i];if(o){for(let a=r;a<this._bufferService.cols;a++){let u=t.getWidth(a),c=t.getString(a).length||Xi.length;if(u!==0){if(!n&&o[0]<=s&&(o[0]=a,n=!0),o[1]<=s){if(o[1]=a,o=e[++i],!o)break;o[0]<=s?(o[0]=a,n=!0):n=!1}s+=c}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let r=!1;for(let i=0;i<e.length;i++){let n=e[i];if(r){if(t[1]<=n[0])return e[i-1][1]=t[1],e;if(t[1]<=n[1])return e[i-1][1]=Math.max(t[1],n[1]),e.splice(i,1),e;e.splice(i,1),i--}else{if(t[1]<=n[0])return e.splice(i,0,t),e;if(t[1]<=n[1])return n[0]=Math.min(t[0],n[0]),e;t[0]<n[1]&&(n[0]=Math.min(t[0],n[0]),r=!0);continue}}return r?e[e.length-1][1]=t[1]:e.push(t),e}};_c=Fe([X(0,Rt)],_c);function gN(e){return 57508<=e&&e<=57558}function _N(e){return 9472<=e&&e<=9631}function vN(e){return gN(e)||_N(e)}function yN(){return{css:{canvas:ll(),cell:ll()},device:{canvas:ll(),cell:ll(),char:{width:0,height:0,left:0,top:0}}}}function ll(){return{width:0,height:0}}var zd=class{constructor(e,t,r,i,n,s,o){this._document=e,this._characterJoinerService=t,this._optionsService=r,this._coreBrowserService=i,this._coreService=n,this._decorationService=s,this._themeService=o,this._workCell=new gr,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,r){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=r}createRow(e,t,r,i,n,s,o,a,u,c,h){let d=[],f=this._characterJoinerService.getJoinedCharacters(t),p=this._themeService.colors,m=e.getNoBgTrimmedLength();r&&m<s+1&&(m=s+1);let y,C=0,g="",_=0,v=0,x=0,k=0,b=!1,j=0,L=!1,I=0,P=0,D=[],M=c!==-1&&h!==-1;for(let R=0;R<m;R++){e.loadCell(R,this._workCell);let O=this._workCell.getWidth();if(O===0)continue;let E=!1,A=R>=P,U=R,T=this._workCell;if(f.length>0&&R===f[0][0]&&A){let pe=f.shift(),so=this._isCellInSelection(pe[0],t);for(_=pe[0]+1;_<pe[1];_++)A&&(A=so===this._isCellInSelection(_,t));A&&(A=!r||s<pe[0]||s>=pe[1]),A?(E=!0,T=new mN(this._workCell,e.translateToString(!0,pe[0],pe[1]),pe[1]-pe[0]),U=pe[1]-1,O=T.getWidth()):P=pe[1]}let $=this._isCellInSelection(R,t),w=r&&R===s,Z=M&&R>=c&&R<=h,ne=!1;this._decorationService.forEachDecorationAtCell(R,t,void 0,pe=>{ne=!0});let S=T.getChars()||Xi;if(S===" "&&(T.isUnderline()||T.isOverline())&&(S=" "),I=O*a-u.get(S,T.isBold(),T.isItalic()),!y)y=this._document.createElement("span");else if(C&&($&&L||!$&&!L&&T.bg===v)&&($&&L&&p.selectionForeground||T.fg===x)&&T.extended.ext===k&&Z===b&&I===j&&!w&&!E&&!ne&&A){T.isInvisible()?g+=Xi:g+=S,C++;continue}else C&&(y.textContent=g),y=this._document.createElement("span"),C=0,g="";if(v=T.bg,x=T.fg,k=T.extended.ext,b=Z,j=I,L=$,E&&s>=R&&s<=U&&(s=R),!this._coreService.isCursorHidden&&w&&this._coreService.isCursorInitialized){if(D.push("xterm-cursor"),this._coreBrowserService.isFocused)o&&D.push("xterm-cursor-blink"),D.push(i==="bar"?"xterm-cursor-bar":i==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(n)switch(n){case"outline":D.push("xterm-cursor-outline");break;case"block":D.push("xterm-cursor-block");break;case"bar":D.push("xterm-cursor-bar");break;case"underline":D.push("xterm-cursor-underline");break}}if(T.isBold()&&D.push("xterm-bold"),T.isItalic()&&D.push("xterm-italic"),T.isDim()&&D.push("xterm-dim"),T.isInvisible()?g=Xi:g=T.getChars()||Xi,T.isUnderline()&&(D.push(`xterm-underline-${T.extended.underlineStyle}`),g===" "&&(g=" "),!T.isUnderlineColorDefault()))if(T.isUnderlineColorRGB())y.style.textDecorationColor=`rgb(${Ma.toColorRGB(T.getUnderlineColor()).join(",")})`;else{let pe=T.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&T.isBold()&&pe<8&&(pe+=8),y.style.textDecorationColor=p.ansi[pe].css}T.isOverline()&&(D.push("xterm-overline"),g===" "&&(g=" ")),T.isStrikethrough()&&D.push("xterm-strikethrough"),Z&&(y.style.textDecoration="underline");let H=T.getFgColor(),ee=T.getFgColorMode(),ie=T.getBgColor(),We=T.getBgColorMode(),sr=!!T.isInverse();if(sr){let pe=H;H=ie,ie=pe;let so=ee;ee=We,We=so}let St,yr,Ar=!1;this._decorationService.forEachDecorationAtCell(R,t,void 0,pe=>{pe.options.layer!=="top"&&Ar||(pe.backgroundColorRGB&&(We=50331648,ie=pe.backgroundColorRGB.rgba>>8&16777215,St=pe.backgroundColorRGB),pe.foregroundColorRGB&&(ee=50331648,H=pe.foregroundColorRGB.rgba>>8&16777215,yr=pe.foregroundColorRGB),Ar=pe.options.layer==="top")}),!Ar&&$&&(St=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,ie=St.rgba>>8&16777215,We=50331648,Ar=!0,p.selectionForeground&&(ee=50331648,H=p.selectionForeground.rgba>>8&16777215,yr=p.selectionForeground)),Ar&&D.push("xterm-decoration-top");let Or;switch(We){case 16777216:case 33554432:Or=p.ansi[ie],D.push(`xterm-bg-${ie}`);break;case 50331648:Or=Ve.toColor(ie>>16,ie>>8&255,ie&255),this._addStyle(y,`background-color:#${Ug((ie>>>0).toString(16),"0",6)}`);break;case 0:default:sr?(Or=p.foreground,D.push("xterm-bg-257")):Or=p.background}switch(St||T.isDim()&&(St=ke.multiplyOpacity(Or,.5)),ee){case 16777216:case 33554432:T.isBold()&&H<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(H+=8),this._applyMinimumContrast(y,Or,p.ansi[H],T,St,void 0)||D.push(`xterm-fg-${H}`);break;case 50331648:let pe=Ve.toColor(H>>16&255,H>>8&255,H&255);this._applyMinimumContrast(y,Or,pe,T,St,yr)||this._addStyle(y,`color:#${Ug(H.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(y,Or,p.foreground,T,St,yr)||sr&&D.push("xterm-fg-257")}D.length&&(y.className=D.join(" "),D.length=0),!w&&!E&&!ne&&A?C++:y.textContent=g,I!==this.defaultSpacing&&(y.style.letterSpacing=`${I}px`),d.push(y),R=U}return y&&C&&(y.textContent=g),d}_applyMinimumContrast(e,t,r,i,n,s){if(this._optionsService.rawOptions.minimumContrastRatio===1||vN(i.getCode()))return!1;let o=this._getContrastCache(i),a;if(!n&&!s&&(a=o.getColor(t.rgba,r.rgba)),a===void 0){let u=this._optionsService.rawOptions.minimumContrastRatio/(i.isDim()?2:1);a=ke.ensureContrastRatio(n||t,s||r,u),o.setColor((n||t).rgba,(s||r).rgba,a??null)}return a?(this._addStyle(e,`color:${a.css}`),!0):!1}_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 r=this._selectionStart,i=this._selectionEnd;return!r||!i?!1:this._columnSelectMode?r[0]<=i[0]?e>=r[0]&&t>=r[1]&&e<i[0]&&t<=i[1]:e<r[0]&&t>=r[1]&&e>=i[0]&&t<=i[1]:t>r[1]&&t<i[1]||r[1]===i[1]&&t===r[1]&&e>=r[0]&&e<i[0]||r[1]<i[1]&&t===i[1]&&e<i[0]||r[1]<i[1]&&t===r[1]&&e>=r[0]}};zd=Fe([X(1,Ix),X(2,Dt),X(3,bi),X(4,Zn),X(5,Ta),X(6,to)],zd);function Ug(e,t,r){for(;e.length<r;)e=t+e;return e}var xN=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let r=e.createElement("span");r.classList.add("xterm-char-measure-element");let i=e.createElement("span");i.classList.add("xterm-char-measure-element"),i.style.fontWeight="bold";let n=e.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontStyle="italic";let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold",s.style.fontStyle="italic",this._measureElements=[r,i,n,s],this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(n),this._container.appendChild(s),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,r,i){e===this._font&&t===this._fontSize&&r===this._weight&&i===this._weightBold||(this._font=e,this._fontSize=t,this._weight=r,this._weightBold=i,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${r}`,this._measureElements[1].style.fontWeight=`${i}`,this._measureElements[2].style.fontWeight=`${r}`,this._measureElements[3].style.fontWeight=`${i}`,this.clear())}get(e,t,r){let i=0;if(!t&&!r&&e.length===1&&(i=e.charCodeAt(0))<256){if(this._flat[i]!==-9999)return this._flat[i];let o=this._measure(e,0);return o>0&&(this._flat[i]=o),o}let n=e;t&&(n+="B"),r&&(n+="I");let s=this._holey.get(n);if(s===void 0){let o=0;t&&(o|=1),r&&(o|=2),s=this._measure(e,o),s>0&&this._holey.set(n,s)}return s}_measure(e,t){let r=this._measureElements[t];return r.textContent=e.repeat(32),r.offsetWidth/32}},wN=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,r,i=!1){if(this.selectionStart=t,this.selectionEnd=r,!t||!r||t[0]===r[0]&&t[1]===r[1]){this.clear();return}let n=e.buffers.active.ydisp,s=t[1]-n,o=r[1]-n,a=Math.max(s,0),u=Math.min(o,e.rows-1);if(a>=e.rows||u<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=i,this.viewportStartRow=s,this.viewportEndRow=o,this.viewportCappedStartRow=a,this.viewportCappedEndRow=u,this.startCol=t[0],this.endCol=r[0]}isCellSelected(e,t,r){return this.hasSelection?(r-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&r>=this.viewportCappedStartRow&&t<this.endCol&&r<=this.viewportCappedEndRow:t<this.startCol&&r>=this.viewportCappedStartRow&&t>=this.endCol&&r<=this.viewportCappedEndRow:r>this.viewportStartRow&&r<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol):!1}};function SN(){return new wN}var Iu="xterm-dom-renderer-owner-",or="xterm-rows",cl="xterm-fg-",Kg="xterm-bg-",xo="xterm-focus",ul="xterm-selection",bN=1,Id=class extends ce{constructor(e,t,r,i,n,s,o,a,u,c,h,d,f,p){super(),this._terminal=e,this._document=t,this._element=r,this._screenElement=i,this._viewportElement=n,this._helperContainer=s,this._linkifier2=o,this._charSizeService=u,this._optionsService=c,this._bufferService=h,this._coreService=d,this._coreBrowserService=f,this._themeService=p,this._terminalClass=bN++,this._rowElements=[],this._selectionRenderModel=SN(),this.onRequestRedraw=this._register(new q).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(or),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(ul),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=yN(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(m=>this._injectCss(m))),this._injectCss(this._themeService.colors),this._rowFactory=a.createInstance(zd,document),this._element.classList.add(Iu+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(m=>this._handleLinkHover(m))),this._register(this._linkifier2.onHideLinkUnderline(m=>this._handleLinkLeave(m))),this._register(Me(()=>{this._element.classList.remove(Iu+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new xN(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){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 r of this._rowElements)r.style.width=`${this.dimensions.css.canvas.width}px`,r.style.height=`${this.dimensions.css.cell.height}px`,r.style.lineHeight=`${this.dimensions.css.cell.height}px`,r.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${or} 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} .${or} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${or} .xterm-dim { color: ${ke.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;}`;let r=`blink_underline_${this._terminalClass}`,i=`blink_bar_${this._terminalClass}`,n=`blink_block_${this._terminalClass}`;t+=`@keyframes ${r} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${i} { 50% { box-shadow: none; }}`,t+=`@keyframes ${n} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${or}.${xo} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${or}.${xo} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${or}.${xo} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${or} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${or} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${or} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${or} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${or} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${ul} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${ul} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${ul} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[s,o]of e.ansi.entries())t+=`${this._terminalSelector} .${cl}${s} { color: ${o.css}; }${this._terminalSelector} .${cl}${s}.xterm-dim { color: ${ke.multiplyOpacity(o,.5).css}; }${this._terminalSelector} .${Kg}${s} { background-color: ${o.css}; }`;t+=`${this._terminalSelector} .${cl}257 { color: ${ke.opaque(e.background).css}; }${this._terminalSelector} .${cl}257.xterm-dim { color: ${ke.multiplyOpacity(ke.opaque(e.background),.5).css}; }${this._terminalSelector} .${Kg}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 r=this._rowElements.length;r<=t;r++){let i=this._document.createElement("div");this._rowContainer.appendChild(i),this._rowElements.push(i)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}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(xo),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(xo),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,r){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,r),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,r),!this._selectionRenderModel.hasSelection))return;let i=this._selectionRenderModel.viewportStartRow,n=this._selectionRenderModel.viewportEndRow,s=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,a=this._document.createDocumentFragment();if(r){let u=e[0]>t[0];a.appendChild(this._createSelectionElement(s,u?t[0]:e[0],u?e[0]:t[0],o-s+1))}else{let u=i===s?e[0]:0,c=s===n?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(s,u,c));let h=o-s-1;if(a.appendChild(this._createSelectionElement(s+1,0,this._bufferService.cols,h)),s!==o){let d=n===o?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(o,0,d))}}this._selectionContainer.appendChild(a)}_createSelectionElement(e,t,r,i=1){let n=this._document.createElement("div"),s=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(r-t);return s+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-s),n.style.height=`${i*this.dimensions.css.cell.height}px`,n.style.top=`${e*this.dimensions.css.cell.height}px`,n.style.left=`${s}px`,n.style.width=`${o}px`,n}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let r=this._bufferService.buffer,i=r.ybase+r.y,n=Math.min(r.x,this._bufferService.cols-1),s=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,a=this._optionsService.rawOptions.cursorInactiveStyle;for(let u=e;u<=t;u++){let c=u+r.ydisp,h=this._rowElements[u],d=r.lines.get(c);if(!h||!d)break;h.replaceChildren(...this._rowFactory.createRow(d,c,c===i,o,a,n,s,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Iu}${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,r,i,n,s){r<0&&(e=0),i<0&&(t=0);let o=this._bufferService.rows-1;r=Math.max(Math.min(r,o),0),i=Math.max(Math.min(i,o),0),n=Math.min(n,this._bufferService.cols);let a=this._bufferService.buffer,u=a.ybase+a.y,c=Math.min(a.x,n-1),h=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let p=r;p<=i;++p){let m=p+a.ydisp,y=this._rowElements[p],C=a.lines.get(m);if(!y||!C)break;y.replaceChildren(...this._rowFactory.createRow(C,m,m===u,d,f,c,h,this.dimensions.css.cell.width,this._widthCache,s?p===r?e:0:-1,s?(p===i?t:n)-1:-1))}}};Id=Fe([X(7,_p),X(8,Qc),X(9,Dt),X(10,Rt),X(11,Zn),X(12,bi),X(13,to)],Id);var Fd=class extends ce{constructor(e,t,r){super(),this._optionsService=r,this.width=0,this.height=0,this._onCharSizeChange=this._register(new q),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new kN(this._optionsService))}catch{this._measureStrategy=this._register(new CN(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())}};Fd=Fe([X(2,Dt)],Fd);var nw=class extends ce{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},CN=class extends nw{constructor(e,t,r){super(),this._document=e,this._parentElement=t,this._optionsService=r,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}},kN=class extends nw{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}},NN=class extends ce{constructor(e,t,r){super(),this._textarea=e,this._window=t,this.mainDocument=r,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new EN(this._window)),this._onDprChange=this._register(new q),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new q),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(i=>this._screenDprMonitor.setWindow(i))),this._register(dt.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(te(this._textarea,"focus",()=>this._isFocused=!0)),this._register(te(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 this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},EN=class extends ce{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Qs),this._onDprChange=this._register(new q),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Me(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=te(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var e;this._outerListener&&((e=this._resolutionMediaMatchList)==null||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)}},jN=class extends ce{constructor(){super(),this.linkProviders=[],this._register(Me(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function kp(e,t,r){let i=r.getBoundingClientRect(),n=e.getComputedStyle(r),s=parseInt(n.getPropertyValue("padding-left")),o=parseInt(n.getPropertyValue("padding-top"));return[t.clientX-i.left-s,t.clientY-i.top-o]}function PN(e,t,r,i,n,s,o,a,u){if(!s)return;let c=kp(e,t,r);if(c)return c[0]=Math.ceil((c[0]+(u?o/2:0))/o),c[1]=Math.ceil(c[1]/a),c[0]=Math.min(Math.max(c[0],1),i+(u?1:0)),c[1]=Math.min(Math.max(c[1],1),n),c}var Hd=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,r,i,n){return PN(window,e,t,r,i,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,n)}getMouseReportCoords(e,t){let r=kp(window,e,t);if(this._charSizeService.hasValidSize)return r[0]=Math.min(Math.max(r[0],0),this._renderService.dimensions.css.canvas.width-1),r[1]=Math.min(Math.max(r[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(r[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(r[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(r[0]),y:Math.floor(r[1])}}};Hd=Fe([X(0,Ci),X(1,Qc)],Hd);var MN=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){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,r){this._rowCount=r,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();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),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},sw={};Fk(sw,{getSafariVersion:()=>RN,isChromeOS:()=>cw,isFirefox:()=>ow,isIpad:()=>DN,isIphone:()=>LN,isLegacyEdge:()=>TN,isLinux:()=>Np,isMac:()=>vc,isNode:()=>Gc,isSafari:()=>aw,isWindows:()=>lw});var Gc=typeof process<"u"&&"title"in process,Ra=Gc?"node":navigator.userAgent,Da=Gc?"node":navigator.platform,ow=Ra.includes("Firefox"),TN=Ra.includes("Edge"),aw=/^((?!chrome|android).)*safari/i.test(Ra);function RN(){if(!aw)return 0;let e=Ra.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var vc=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Da),DN=Da==="iPad",LN=Da==="iPhone",lw=["Windows","Win16","Win32","WinCE"].includes(Da),Np=Da.indexOf("Linux")>=0,cw=/\bCrOS\b/.test(Ra),uw=class{constructor(){this._tasks=[],this._i=0}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=0,r=0,i=e.timeRemaining(),n=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),r=Math.max(t,r),n=e.timeRemaining(),r*1.5>n){i-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-t))}ms`),this._start();return}i=n}this.clear()}},AN=class extends uw{_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())}}},ON=class extends uw{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},yc=!Gc&&"requestIdleCallback"in window?ON:AN,BN=class{constructor(){this._queue=new yc}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},$d=class extends ce{constructor(e,t,r,i,n,s,o,a,u){super(),this._rowCount=e,this._optionsService=r,this._charSizeService=i,this._coreService=n,this._coreBrowserService=a,this._renderer=this._register(new Qs),this._pausedResizeTask=new BN,this._observerDisposable=this._register(new Qs),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 q),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new q),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new q),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new q),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new MN((c,h)=>this._renderRows(c,h),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new zN(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Me(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>{var c;return(c=this._renderer.value)==null?void 0:c.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(s.onDecorationRegistered(()=>this._fullRefresh())),this._register(s.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(u.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(c=>this._registerIntersectionObserver(c,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let r=new e.IntersectionObserver(i=>this._handleIntersectionChange(i[i.length-1]),{threshold:0});r.observe(t),this._observerDisposable.value=Me(()=>r.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,r=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let i=this._syncOutputHandler.flush();i&&(e=Math.min(e,i.start),t=Math.max(t,i.end)),r||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}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(t=>this.refreshRows(t.start,t.end,!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&&((t=(e=this._renderer.value).clearTextureAtlas)==null||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 r;return(r=this._renderer.value)==null?void 0:r.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,t,r){var i;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=r,(i=this._renderer.value)==null||i.handleSelectionChanged(e,t,r)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};$d=Fe([X(2,Dt),X(3,Qc),X(4,Zn),X(5,Ta),X(6,Rt),X(7,bi),X(8,to)],$d);var zN=class{constructor(e,t,r){this._coreBrowserService=e,this._coreService=t,this._onTimeout=r,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===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(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(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function IN(e,t,r,i){let n=r.buffer.x,s=r.buffer.y;if(!r.buffer.hasScrollback)return $N(n,s,e,t,r,i)+Jc(s,t,r,i)+WN(n,s,e,t,r,i);let o;if(s===t)return o=n>e?"D":"C",ma(Math.abs(n-e),pa(o,i));o=s>t?"D":"C";let a=Math.abs(s-t),u=HN(s>t?e:n,r)+(a-1)*r.cols+1+FN(s>t?n:e);return ma(u,pa(o,i))}function FN(e,t){return e-1}function HN(e,t){return t.cols-e}function $N(e,t,r,i,n,s){return Jc(t,i,n,s).length===0?"":ma(dw(e,t,e,t-Xn(t,n),!1,n).length,pa("D",s))}function Jc(e,t,r,i){let n=e-Xn(e,r),s=t-Xn(t,r),o=Math.abs(n-s)-UN(e,t,r);return ma(o,pa(hw(e,t),i))}function WN(e,t,r,i,n,s){let o;Jc(t,i,n,s).length>0?o=i-Xn(i,n):o=t;let a=i,u=KN(e,t,r,i,n,s);return ma(dw(e,o,r,a,u==="C",n).length,pa(u,s))}function UN(e,t,r){var o;let i=0,n=e-Xn(e,r),s=t-Xn(t,r);for(let a=0;a<Math.abs(n-s);a++){let u=hw(e,t)==="A"?-1:1;(o=r.buffer.lines.get(n+u*a))!=null&&o.isWrapped&&i++}return i}function Xn(e,t){let r=0,i=t.buffer.lines.get(e),n=i==null?void 0:i.isWrapped;for(;n&&e>=0&&e<t.rows;)r++,i=t.buffer.lines.get(--e),n=i==null?void 0:i.isWrapped;return r}function KN(e,t,r,i,n,s){let o;return Jc(r,i,n,s).length>0?o=i-Xn(i,n):o=t,e<r&&o<=i||e>=r&&o<i?"C":"D"}function hw(e,t){return e>t?"A":"B"}function dw(e,t,r,i,n,s){let o=e,a=t,u="";for(;(o!==r||a!==i)&&a>=0&&a<s.buffer.lines.length;)o+=n?1:-1,n&&o>s.cols-1?(u+=s.buffer.translateBufferLineToString(a,!1,e,o),o=0,e=0,a++):!n&&o<0&&(u+=s.buffer.translateBufferLineToString(a,!1,0,e+1),o=s.cols-1,e=o,a--);return u+s.buffer.translateBufferLineToString(a,!1,e,o)}function pa(e,t){let r=t?"O":"[";return z.ESC+r+e}function ma(e,t){e=Math.floor(e);let r="";for(let i=0;i<e;i++)r+=t;return r}var qN=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.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?!1: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[1]=0),!1)}};function qg(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 Fu=50,VN=15,YN=50,XN=500,QN=" ",GN=new RegExp(QN,"g"),Wd=class extends ce{constructor(e,t,r,i,n,s,o,a,u){super(),this._element=e,this._screenElement=t,this._linkifier=r,this._bufferService=i,this._coreService=n,this._mouseService=s,this._optionsService=o,this._renderService=a,this._coreBrowserService=u,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new gr,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new q),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new q),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new q),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new q),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=c=>this._handleMouseMove(c),this._mouseUpListener=c=>this._handleMouseUp(c),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(c=>this._handleTrim(c)),this._register(this._bufferService.buffers.onBufferActivate(c=>this._handleBufferActivate(c))),this.enable(),this._model=new qN(this._bufferService),this._activeSelectionMode=0,this._register(Me(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(c=>{c.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?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let r=this._bufferService.buffer,i=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let n=e[0]<t[0]?e[0]:t[0],s=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let a=r.translateBufferLineToString(o,!0,n,s);i.push(a)}}else{let n=e[1]===t[1]?t[0]:void 0;i.push(r.translateBufferLineToString(e[1],!0,e[0],n));for(let s=e[1]+1;s<=t[1]-1;s++){let o=r.lines.get(s),a=r.translateBufferLineToString(s,!0);o!=null&&o.isWrapped?i[i.length-1]+=a:i.push(a)}if(e[1]!==t[1]){let s=r.lines.get(t[1]),o=r.translateBufferLineToString(t[1],!0,0,t[0]);s&&s.isWrapped?i[i.length-1]+=o:i.push(o)}}return i.map(n=>n.replace(GN," ")).join(lw?`\r
367
+ `:`
368
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Np&&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:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),r=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!r||!i||!t?!1:this._areCoordsInSelection(t,r,i)}isCellInSelection(e,t){let r=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!r||!i?!1:this._areCoordsInSelection([e,t],r,i)}_areCoordsInSelection(e,t,r){return e[1]>t[1]&&e[1]<r[1]||t[1]===r[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<r[0]||t[1]<r[1]&&e[1]===r[1]&&e[0]<r[0]||t[1]<r[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var n,s;let r=(s=(n=this._linkifier.currentLink)==null?void 0:n.link)==null?void 0:s.range;if(r)return this._model.selectionStart=[r.start.x-1,r.start.y-1],this._model.selectionStartLength=qg(r,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let i=this._getMouseBufferCoords(e);return i?(this._selectWordAt(i,t),this._model.selectionEnd=void 0,!0):!1}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._mouseService.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=kp(this._coreBrowserService.window,e,this._screenElement)[1],r=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=r?0:(t>r&&(t-=r),t=Math.min(Math.max(t,-Fu),Fu),t/=Fu,t/Math.abs(t)+Math.round(t*(VN-1)))}shouldForceSelection(e){return vc?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&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(),YN)}_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){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;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===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 e.altKey&&!(vc&&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){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let r=this._bufferService.buffer;if(this._model.selectionEnd[1]<r.lines.length){let i=r.lines.get(this._model.selectionEnd[1]);i&&i.hasWidth(this._model.selectionEnd[0])===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?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(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<XN&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let r=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(r&&r[0]!==void 0&&r[1]!==void 0){let i=IN(r[0]-1,r[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(i,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,r=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!r){this._oldHasSelection&&this._fireOnSelectionChange(e,t,r);return}!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,r)}_fireOnSelectionChange(e,t,r){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=r,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let r=t;for(let i=0;t>=i;i++){let n=e.loadCell(i,this._workCell).getChars().length;this._workCell.getWidth()===0?r--:n>1&&t!==i&&(r+=n-1)}return r}setSelection(e,t,r){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=r,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,r=!0,i=!0){if(e[0]>=this._bufferService.cols)return;let n=this._bufferService.buffer,s=n.lines.get(e[1]);if(!s)return;let o=n.translateBufferLineToString(e[1],!1),a=this._convertViewportColToCharacterIndex(s,e[0]),u=a,c=e[0]-a,h=0,d=0,f=0,p=0;if(o.charAt(a)===" "){for(;a>0&&o.charAt(a-1)===" ";)a--;for(;u<o.length&&o.charAt(u+1)===" ";)u++}else{let C=e[0],g=e[0];s.getWidth(C)===0&&(h++,C--),s.getWidth(g)===2&&(d++,g++);let _=s.getString(g).length;for(_>1&&(p+=_-1,u+=_-1);C>0&&a>0&&!this._isCharWordSeparator(s.loadCell(C-1,this._workCell));){s.loadCell(C-1,this._workCell);let v=this._workCell.getChars().length;this._workCell.getWidth()===0?(h++,C--):v>1&&(f+=v-1,a-=v-1),a--,C--}for(;g<s.length&&u+1<o.length&&!this._isCharWordSeparator(s.loadCell(g+1,this._workCell));){s.loadCell(g+1,this._workCell);let v=this._workCell.getChars().length;this._workCell.getWidth()===2?(d++,g++):v>1&&(p+=v-1,u+=v-1),u++,g++}}u++;let m=a+c-h+f,y=Math.min(this._bufferService.cols,u-a+h+d-f-p);if(!(!t&&o.slice(a,u).trim()==="")){if(r&&m===0&&s.getCodePoint(0)!==32){let C=n.lines.get(e[1]-1);if(C&&s.isWrapped&&C.getCodePoint(this._bufferService.cols-1)!==32){let g=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(g){let _=this._bufferService.cols-g.start;m-=_,y+=_}}}if(i&&m+y===this._bufferService.cols&&s.getCodePoint(this._bufferService.cols-1)!==32){let C=n.lines.get(e[1]+1);if(C!=null&&C.isWrapped&&C.getCodePoint(0)!==32){let g=this._getWordAt([0,e[1]+1],!1,!1,!0);g&&(y+=g.length)}}return{start:m,length:y}}}_selectWordAt(e,t){let r=this._getWordAt(e,t);if(r){for(;r.start<0;)r.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[r.start,e[1]],this._model.selectionStartLength=r.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let r=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,r--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,r++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,r]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),r={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=qg(r,this._bufferService.cols)}};Wd=Fe([X(3,Rt),X(4,Zn),X(5,vp),X(6,Dt),X(7,Ci),X(8,bi)],Wd);var Vg=class{constructor(){this._data={}}set(e,t,r){this._data[e]||(this._data[e]={}),this._data[e][t]=r}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},Yg=class{constructor(){this._color=new Vg,this._css=new Vg}setCss(e,t,r){this._css.set(e,t,r)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,r){this._color.set(e,t,r)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},Xe=Object.freeze((()=>{let e=[Re.toColor("#2e3436"),Re.toColor("#cc0000"),Re.toColor("#4e9a06"),Re.toColor("#c4a000"),Re.toColor("#3465a4"),Re.toColor("#75507b"),Re.toColor("#06989a"),Re.toColor("#d3d7cf"),Re.toColor("#555753"),Re.toColor("#ef2929"),Re.toColor("#8ae234"),Re.toColor("#fce94f"),Re.toColor("#729fcf"),Re.toColor("#ad7fa8"),Re.toColor("#34e2e2"),Re.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let r=0;r<216;r++){let i=t[r/36%6|0],n=t[r/6%6|0],s=t[r%6];e.push({css:Ve.toCss(i,n,s),rgba:Ve.toRgba(i,n,s)})}for(let r=0;r<24;r++){let i=8+r*10;e.push({css:Ve.toCss(i,i,i),rgba:Ve.toRgba(i,i,i)})}return e})()),xn=Re.toColor("#ffffff"),Do=Re.toColor("#000000"),Xg=Re.toColor("#ffffff"),Qg=Do,wo={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},JN=xn,Ud=class extends ce{constructor(e){super(),this._optionsService=e,this._contrastCache=new Yg,this._halfContrastCache=new Yg,this._onChangeColors=this._register(new q),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:xn,background:Do,cursor:Xg,cursorAccent:Qg,selectionForeground:void 0,selectionBackgroundTransparent:wo,selectionBackgroundOpaque:ke.blend(Do,wo),selectionInactiveBackgroundTransparent:wo,selectionInactiveBackgroundOpaque:ke.blend(Do,wo),scrollbarSliderBackground:ke.opacity(xn,.2),scrollbarSliderHoverBackground:ke.opacity(xn,.4),scrollbarSliderActiveBackground:ke.opacity(xn,.5),overviewRulerBorder:xn,ansi:Xe.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=ve(e.foreground,xn),t.background=ve(e.background,Do),t.cursor=ke.blend(t.background,ve(e.cursor,Xg)),t.cursorAccent=ke.blend(t.background,ve(e.cursorAccent,Qg)),t.selectionBackgroundTransparent=ve(e.selectionBackground,wo),t.selectionBackgroundOpaque=ke.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=ve(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=ke.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?ve(e.selectionForeground,Wg):void 0,t.selectionForeground===Wg&&(t.selectionForeground=void 0),ke.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=ke.opacity(t.selectionBackgroundTransparent,.3)),ke.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=ke.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=ve(e.scrollbarSliderBackground,ke.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=ve(e.scrollbarSliderHoverBackground,ke.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=ve(e.scrollbarSliderActiveBackground,ke.opacity(t.foreground,.5)),t.overviewRulerBorder=ve(e.overviewRulerBorder,JN),t.ansi=Xe.slice(),t.ansi[0]=ve(e.black,Xe[0]),t.ansi[1]=ve(e.red,Xe[1]),t.ansi[2]=ve(e.green,Xe[2]),t.ansi[3]=ve(e.yellow,Xe[3]),t.ansi[4]=ve(e.blue,Xe[4]),t.ansi[5]=ve(e.magenta,Xe[5]),t.ansi[6]=ve(e.cyan,Xe[6]),t.ansi[7]=ve(e.white,Xe[7]),t.ansi[8]=ve(e.brightBlack,Xe[8]),t.ansi[9]=ve(e.brightRed,Xe[9]),t.ansi[10]=ve(e.brightGreen,Xe[10]),t.ansi[11]=ve(e.brightYellow,Xe[11]),t.ansi[12]=ve(e.brightBlue,Xe[12]),t.ansi[13]=ve(e.brightMagenta,Xe[13]),t.ansi[14]=ve(e.brightCyan,Xe[14]),t.ansi[15]=ve(e.brightWhite,Xe[15]),e.extendedAnsi){let r=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let i=0;i<r;i++)t.ansi[i+16]=ve(e.extendedAnsi[i],Xe[i+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(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}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]}}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()}}};Ud=Fe([X(0,Dt)],Ud);function ve(e,t){if(e!==void 0)try{return Re.toColor(e)}catch{}return t}var ZN=class{constructor(...e){this._entries=new Map;for(let[t,r]of e)this.set(t,r)}set(e,t){let r=this._entries.get(e);return this._entries.set(e,t),r}forEach(e){for(let[t,r]of this._entries.entries())e(t,r)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},eE=class{constructor(){this._services=new ZN,this._services.set(_p,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let r=Vk(e).sort((s,o)=>s.index-o.index),i=[];for(let s of r){let o=this._services.get(s.id);if(!o)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${s.id._id}.`);i.push(o)}let n=r.length>0?r[0].index:t.length;if(t.length!==n)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${n+1} conflicts with ${t.length} static arguments`);return new e(...t,...i)}},tE={trace:0,debug:1,info:2,warn:3,error:4,off:5},rE="xterm.js: ",Kd=class extends ce{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=tE[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,r){this._evalLazyOptionalParams(r),e.call(console,(this._optionsService.options.logger?"":rE)+t,...r)}trace(e,...t){var r;this._logLevel<=0&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var r;this._logLevel<=1&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var r;this._logLevel<=2&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var r;this._logLevel<=3&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var r;this._logLevel<=4&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.error.bind(this._optionsService.options.logger))??console.error,e,t)}};Kd=Fe([X(0,Dt)],Kd);var Gg=class extends ce{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new q),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new q),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new q),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 r=0;r<Math.min(e,this.length);r++)t[r]=this._array[this._getCyclicIndex(r)];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,...r){if(t){for(let i=e;i<this._length-t;i++)this._array[this._getCyclicIndex(i)]=this._array[this._getCyclicIndex(i+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let i=this._length-1;i>=e;i--)this._array[this._getCyclicIndex(i+r.length)]=this._array[this._getCyclicIndex(i)];for(let i=0;i<r.length;i++)this._array[this._getCyclicIndex(e+i)]=r[i];if(r.length&&this.onInsertEmitter.fire({index:e,amount:r.length}),this._length+r.length>this._maxLength){let i=this._length+r.length-this._maxLength;this._startIndex+=i,this._length=this._maxLength,this.onTrimEmitter.fire(i)}else this._length+=r.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,r){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+r<0)throw new Error("Cannot shift elements in list beyond index 0");if(r>0){for(let n=t-1;n>=0;n--)this.set(e+n+r,this.get(e+n));let i=e+t+r-this._length;if(i>0)for(this._length+=i;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let i=0;i<t;i++)this.set(e+i+r,this.get(e+i))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},le=3,qe=Object.freeze(new Ma),hl=0,Hu=2,Lo=class fw{constructor(t,r,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*le);let n=r||gr.fromCharData([0,Rx,1,0]);for(let s=0;s<t;++s)this.setCell(s,n);this.length=t}get(t){let r=this._data[t*le+0],i=r&2097151;return[this._data[t*le+1],r&2097152?this._combined[t]:i?Ai(i):"",r>>22,r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):i]}set(t,r){this._data[t*le+1]=r[0],r[1].length>1?(this._combined[t]=r[1],this._data[t*le+0]=t|2097152|r[2]<<22):this._data[t*le+0]=r[1].charCodeAt(0)|r[2]<<22}getWidth(t){return this._data[t*le+0]>>22}hasWidth(t){return this._data[t*le+0]&12582912}getFg(t){return this._data[t*le+1]}getBg(t){return this._data[t*le+2]}hasContent(t){return this._data[t*le+0]&4194303}getCodePoint(t){let r=this._data[t*le+0];return r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r&2097151}isCombined(t){return this._data[t*le+0]&2097152}getString(t){let r=this._data[t*le+0];return r&2097152?this._combined[t]:r&2097151?Ai(r&2097151):""}isProtected(t){return this._data[t*le+2]&536870912}loadCell(t,r){return hl=t*le,r.content=this._data[hl+0],r.fg=this._data[hl+1],r.bg=this._data[hl+2],r.content&2097152&&(r.combinedData=this._combined[t]),r.bg&268435456&&(r.extended=this._extendedAttrs[t]),r}setCell(t,r){r.content&2097152&&(this._combined[t]=r.combinedData),r.bg&268435456&&(this._extendedAttrs[t]=r.extended),this._data[t*le+0]=r.content,this._data[t*le+1]=r.fg,this._data[t*le+2]=r.bg}setCellFromCodepoint(t,r,i,n){n.bg&268435456&&(this._extendedAttrs[t]=n.extended),this._data[t*le+0]=r|i<<22,this._data[t*le+1]=n.fg,this._data[t*le+2]=n.bg}addCodepointToCell(t,r,i){let n=this._data[t*le+0];n&2097152?this._combined[t]+=Ai(r):n&2097151?(this._combined[t]=Ai(n&2097151)+Ai(r),n&=-2097152,n|=2097152):n=r|1<<22,i&&(n&=-12582913,n|=i<<22),this._data[t*le+0]=n}insertCells(t,r,i){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),r<this.length-t){let n=new gr;for(let s=this.length-t-r-1;s>=0;--s)this.setCell(t+r+s,this.loadCell(t+s,n));for(let s=0;s<r;++s)this.setCell(t+s,i)}else for(let n=t;n<this.length;++n)this.setCell(n,i);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,i)}deleteCells(t,r,i){if(t%=this.length,r<this.length-t){let n=new gr;for(let s=0;s<this.length-t-r;++s)this.setCell(t+s,this.loadCell(t+r+s,n));for(let s=this.length-r;s<this.length;++s)this.setCell(s,i)}else for(let n=t;n<this.length;++n)this.setCell(n,i);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,i)}replaceCells(t,r,i,n=!1){if(n){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,i),r<this.length&&this.getWidth(r-1)===2&&!this.isProtected(r)&&this.setCellFromCodepoint(r,0,1,i);t<r&&t<this.length;)this.isProtected(t)||this.setCell(t,i),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),r<this.length&&this.getWidth(r-1)===2&&this.setCellFromCodepoint(r,0,1,i);t<r&&t<this.length;)this.setCell(t++,i)}resize(t,r){if(t===this.length)return this._data.length*4*Hu<this._data.buffer.byteLength;let i=t*le;if(t>this.length){if(this._data.buffer.byteLength>=i*4)this._data=new Uint32Array(this._data.buffer,0,i);else{let n=new Uint32Array(i);n.set(this._data),this._data=n}for(let n=this.length;n<t;++n)this.setCell(n,r)}else{this._data=this._data.subarray(0,i);let n=Object.keys(this._combined);for(let o=0;o<n.length;o++){let a=parseInt(n[o],10);a>=t&&delete this._combined[a]}let s=Object.keys(this._extendedAttrs);for(let o=0;o<s.length;o++){let a=parseInt(s[o],10);a>=t&&delete this._extendedAttrs[a]}}return this.length=t,i*4*Hu<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Hu<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,r=!1){if(r){for(let i=0;i<this.length;++i)this.isProtected(i)||this.setCell(i,t);return}this._combined={},this._extendedAttrs={};for(let i=0;i<this.length;++i)this.setCell(i,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let r in t._combined)this._combined[r]=t._combined[r];this._extendedAttrs={};for(let r in t._extendedAttrs)this._extendedAttrs[r]=t._extendedAttrs[r];this.isWrapped=t.isWrapped}clone(){let t=new fw(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let r in this._combined)t._combined[r]=this._combined[r];for(let r in this._extendedAttrs)t._extendedAttrs[r]=this._extendedAttrs[r];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*le+0]&4194303)return t+(this._data[t*le+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*le+0]&4194303||this._data[t*le+2]&50331648)return t+(this._data[t*le+0]>>22);return 0}copyCellsFrom(t,r,i,n,s){let o=t._data;if(s)for(let u=n-1;u>=0;u--){for(let c=0;c<le;c++)this._data[(i+u)*le+c]=o[(r+u)*le+c];o[(r+u)*le+2]&268435456&&(this._extendedAttrs[i+u]=t._extendedAttrs[r+u])}else for(let u=0;u<n;u++){for(let c=0;c<le;c++)this._data[(i+u)*le+c]=o[(r+u)*le+c];o[(r+u)*le+2]&268435456&&(this._extendedAttrs[i+u]=t._extendedAttrs[r+u])}let a=Object.keys(t._combined);for(let u=0;u<a.length;u++){let c=parseInt(a[u],10);c>=r&&(this._combined[c-r+i]=t._combined[c])}}translateToString(t,r,i,n){r=r??0,i=i??this.length,t&&(i=Math.min(i,this.getTrimmedLength())),n&&(n.length=0);let s="";for(;r<i;){let o=this._data[r*le+0],a=o&2097151,u=o&2097152?this._combined[r]:a?Ai(a):Xi;if(s+=u,n)for(let c=0;c<u.length;++c)n.push(r);r+=o>>22||1}return n&&n.push(r),s}};function iE(e,t,r,i,n,s){let o=[];for(let a=0;a<e.length-1;a++){let u=a,c=e.get(++u);if(!c.isWrapped)continue;let h=[e.get(a)];for(;u<e.length&&c.isWrapped;)h.push(c),c=e.get(++u);if(!s&&i>=a&&i<u){a+=h.length-1;continue}let d=0,f=ga(h,d,t),p=1,m=0;for(;p<h.length;){let C=ga(h,p,t),g=C-m,_=r-f,v=Math.min(g,_);h[d].copyCellsFrom(h[p],m,f,v,!1),f+=v,f===r&&(d++,f=0),m+=v,m===C&&(p++,m=0),f===0&&d!==0&&h[d-1].getWidth(r-1)===2&&(h[d].copyCellsFrom(h[d-1],r-1,f++,1,!1),h[d-1].setCell(r-1,n))}h[d].replaceCells(f,r,n);let y=0;for(let C=h.length-1;C>0&&(C>d||h[C].getTrimmedLength()===0);C--)y++;y>0&&(o.push(a+h.length-y),o.push(y)),a+=h.length-1}return o}function nE(e,t){let r=[],i=0,n=t[i],s=0;for(let o=0;o<e.length;o++)if(n===o){let a=t[++i];e.onDeleteEmitter.fire({index:o-s,amount:a}),o+=a-1,s+=a,n=t[++i]}else r.push(o);return{layout:r,countRemoved:s}}function sE(e,t){let r=[];for(let i=0;i<t.length;i++)r.push(e.get(t[i]));for(let i=0;i<r.length;i++)e.set(i,r[i]);e.length=t.length}function oE(e,t,r){let i=[],n=e.map((u,c)=>ga(e,c,t)).reduce((u,c)=>u+c),s=0,o=0,a=0;for(;a<n;){if(n-a<r){i.push(n-a);break}s+=r;let u=ga(e,o,t);s>u&&(s-=u,o++);let c=e[o].getWidth(s-1)===2;c&&s--;let h=c?r-1:r;i.push(h),a+=h}return i}function ga(e,t,r){if(t===e.length-1)return e[t].getTrimmedLength();let i=!e[t].hasContent(r-1)&&e[t].getWidth(r-1)===1,n=e[t+1].getWidth(0)===2;return i&&n?r-1:r}var pw=class mw{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=mw._nextId++,this._onDispose=this.register(new q),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Yn(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};pw._nextId=1;var aE=pw,tt={},wn=tt.B;tt[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:"≥","{":"π","|":"≠","}":"£","~":"·"};tt.A={"#":"£"};tt.B=void 0;tt[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};tt.C=tt[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};tt.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};tt.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};tt.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};tt.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};tt.E=tt[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};tt.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};tt.H=tt[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};tt["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var Jg=4294967295,Zg=class{constructor(e,t,r){this._hasScrollback=e,this._optionsService=t,this._bufferService=r,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=qe.clone(),this.savedCharset=wn,this.markers=[],this._nullCell=gr.fromCharData([0,Rx,1,0]),this._whitespaceCell=gr.fromCharData([0,Xi,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new yc,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Gg(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}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 mc),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 mc),this._whitespaceCell}getBlankLine(e,t){return new Lo(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>Jg?Jg:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=qe);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new Gg(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let r=this.getNullCell(qe),i=0,n=this._getCorrectBufferLength(t);if(n>this.lines.maxLength&&(this.lines.maxLength=n),this.lines.length>0){if(this._cols<e)for(let o=0;o<this.lines.length;o++)i+=+this.lines.get(o).resize(e,r);let s=0;if(this._rows<t)for(let o=this._rows;o<t;o++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new Lo(e,r)):this.ybase>0&&this.lines.length<=this.ybase+this.y+s+1?(this.ybase--,s++,this.ydisp>0&&this.ydisp--):this.lines.push(new Lo(e,r)));else for(let o=this._rows;o>t;o--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(n<this.lines.maxLength){let o=this.lines.length-n;o>0&&(this.lines.trimStart(o),this.ybase=Math.max(this.ybase-o,0),this.ydisp=Math.max(this.ydisp-o,0),this.savedY=Math.max(this.savedY-o,0)),this.lines.maxLength=n}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),s&&(this.y+=s),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 s=0;s<this.lines.length;s++)i+=+this.lines.get(s).resize(e,r);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),i>.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&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let r=this._optionsService.rawOptions.reflowCursorLine,i=iE(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(qe),r);if(i.length>0){let n=nE(this.lines,i);sE(this.lines,n.layout),this._reflowLargerAdjustViewport(e,t,n.countRemoved)}}_reflowLargerAdjustViewport(e,t,r){let i=this.getNullCell(qe),n=r;for(;n-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Lo(e,i))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-r,0)}_reflowSmaller(e,t){let r=this._optionsService.rawOptions.reflowCursorLine,i=this.getNullCell(qe),n=[],s=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 u=[a];for(;a.isWrapped&&o>0;)a=this.lines.get(--o),u.unshift(a);if(!r){let v=this.ybase+this.y;if(v>=o&&v<o+u.length)continue}let c=u[u.length-1].getTrimmedLength(),h=oE(u,this._cols,e),d=h.length-u.length,f;this.ybase===0&&this.y!==this.lines.length-1?f=Math.max(0,this.y-this.lines.maxLength+d):f=Math.max(0,this.lines.length-this.lines.maxLength+d);let p=[];for(let v=0;v<d;v++){let x=this.getBlankLine(qe,!0);p.push(x)}p.length>0&&(n.push({start:o+u.length+s,newLines:p}),s+=p.length),u.push(...p);let m=h.length-1,y=h[m];y===0&&(m--,y=h[m]);let C=u.length-d-1,g=c;for(;C>=0;){let v=Math.min(g,y);if(u[m]===void 0)break;if(u[m].copyCellsFrom(u[C],g-v,y-v,v,!0),y-=v,y===0&&(m--,y=h[m]),g-=v,g===0){C--;let x=Math.max(C,0);g=ga(u,x,this._cols)}}for(let v=0;v<u.length;v++)h[v]<e&&u[v].setCell(h[v],i);let _=d-f;for(;_-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+s)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+d,this.ybase+t-1)}if(n.length>0){let o=[],a=[];for(let y=0;y<this.lines.length;y++)a.push(this.lines.get(y));let u=this.lines.length,c=u-1,h=0,d=n[h];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+s);let f=0;for(let y=Math.min(this.lines.maxLength-1,u+s-1);y>=0;y--)if(d&&d.start>c+f){for(let C=d.newLines.length-1;C>=0;C--)this.lines.set(y--,d.newLines[C]);y++,o.push({index:c+1,amount:d.newLines.length}),f+=d.newLines.length,d=n[++h]}else this.lines.set(y,a[c--]);let p=0;for(let y=o.length-1;y>=0;y--)o[y].index+=p,this.lines.onInsertEmitter.fire(o[y]),p+=o[y].amount;let m=Math.max(0,u+s-this.lines.maxLength);m>0&&this.lines.onTrimEmitter.fire(m)}}translateBufferLineToString(e,t,r=0,i){let n=this.lines.get(e);return n?n.translateToString(t,r,i):""}getWrappedRangeForLine(e){let t=e,r=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;r+1<this.lines.length&&this.lines.get(r+1).isWrapped;)r++;return{first:t,last:r}}setupTabStops(e){for(e!=null?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==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(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 aE(e);return this.markers.push(t),t.register(this.lines.onTrim(r=>{t.line-=r,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(r=>{t.line>=r.index&&(t.line+=r.amount)})),t.register(this.lines.onDelete(r=>{t.line>=r.index&&t.line<r.index+r.amount&&t.dispose(),t.line>r.index&&(t.line-=r.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},lE=class extends ce{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new q),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 Zg(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new Zg(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(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)}},gw=2,_w=1,qd=class extends ce{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new q),this.onResize=this._onResize.event,this._onScroll=this._register(new q),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,gw),this.rows=Math.max(e.rawOptions.rows||0,_w),this.buffers=this._register(new lE(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let r=this.cols!==e,i=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:r,rowsChanged:i})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let r=this.buffer,i;i=this._cachedBlankLine,(!i||i.length!==this.cols||i.getFg(0)!==e.fg||i.getBg(0)!==e.bg)&&(i=r.getBlankLine(e,t),this._cachedBlankLine=i),i.isWrapped=t;let n=r.ybase+r.scrollTop,s=r.ybase+r.scrollBottom;if(r.scrollTop===0){let o=r.lines.isFull;s===r.lines.length-1?o?r.lines.recycle().copyFrom(i):r.lines.push(i.clone()):r.lines.splice(s+1,0,i.clone()),o?this.isUserScrolling&&(r.ydisp=Math.max(r.ydisp-1,0)):(r.ybase++,this.isUserScrolling||r.ydisp++)}else{let o=s-n+1;r.lines.shiftElements(n+1,o-1,-1),r.lines.set(s,i.clone())}this.isUserScrolling||(r.ydisp=r.ybase),this._onScroll.fire(r.ydisp)}scrollLines(e,t){let r=this.buffer;if(e<0){if(r.ydisp===0)return;this.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this.isUserScrolling=!1);let i=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),i!==r.ydisp&&(t||this._onScroll.fire(r.ydisp))}};qd=Fe([X(0,Dt)],qd);var ss={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:vc,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},cE=["normal","bold","100","200","300","400","500","600","700","800","900"],uE=class extends ce{constructor(e){super(),this._onOptionChange=this._register(new q),this.onOptionChange=this._onOptionChange.event;let t={...ss};for(let r in e)if(r in t)try{let i=e[r];t[r]=this._sanitizeAndValidateOption(r,i)}catch(i){console.error(i)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(Me(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(r=>{r===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(r=>{e.indexOf(r)!==-1&&t()})}_setupOptions(){let e=r=>{if(!(r in ss))throw new Error(`No option with key "${r}"`);return this.rawOptions[r]},t=(r,i)=>{if(!(r in ss))throw new Error(`No option with key "${r}"`);i=this._sanitizeAndValidateOption(r,i),this.rawOptions[r]!==i&&(this.rawOptions[r]=i,this._onOptionChange.fire(r))};for(let r in this.rawOptions){let i={get:e.bind(this,r),set:t.bind(this,r)};Object.defineProperty(this.options,r,i)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=ss[e]),!hE(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=ss[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=cE.includes(t)?t:ss[e];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(t*10)/10));break;case"scrollback":if(t=Math.min(t,4294967295),t<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&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function hE(e){return e==="block"||e==="underline"||e==="bar"}function Ao(e,t=5){if(typeof e!="object")return e;let r=Array.isArray(e)?[]:{};for(let i in e)r[i]=t<=1?e[i]:e[i]&&Ao(e[i],t-1);return r}var e_=Object.freeze({insertMode:!1}),t_=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Vd=class extends ce{constructor(e,t,r){super(),this._bufferService=e,this._logService=t,this._optionsService=r,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new q),this.onData=this._onData.event,this._onUserInput=this._register(new q),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new q),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new q),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Ao(e_),this.decPrivateModes=Ao(t_)}reset(){this.modes=Ao(e_),this.decPrivateModes=Ao(t_)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let r=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&r.ybase!==r.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(i=>i.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(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};Vd=Fe([X(0,Rt),X(1,Bx),X(2,Dt)],Vd);var r_={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function $u(e,t){let r=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(r|=64,r|=e.action):(r|=e.button&3,e.button&4&&(r|=64),e.button&8&&(r|=128),e.action===32?r|=32:e.action===0&&!t&&(r|=3)),r}var Wu=String.fromCharCode,i_={DEFAULT:e=>{let t=[$u(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${Wu(t[0])}${Wu(t[1])}${Wu(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${$u(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${$u(e,!0)};${e.x};${e.y}${t}`}},Yd=class extends ce{constructor(e,t,r){super(),this._bufferService=e,this._coreService=t,this._optionsService=r,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new q),this.onProtocolChange=this._onProtocolChange.event;for(let i of Object.keys(r_))this.addProtocol(i,r_[i]);for(let i of Object.keys(i_))this.addEncoding(i,i_[i]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}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",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,r){if(e.deltaY===0||e.shiftKey||t===void 0||r===void 0)return 0;let i=t/r,n=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(n/=i+0,Math.abs(e.deltaY)<50&&(n*=.3),this._wheelPartialScroll+=n,n=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(n*=this._bufferService.rows),n}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,r){if(r){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)}};Yd=Fe([X(0,Rt),X(1,Zn),X(2,Dt)],Yd);var Uu=[[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]],dE=[[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]],Qe;function fE(e,t){let r=0,i=t.length-1,n;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=r;)if(n=r+i>>1,e>t[n][1])r=n+1;else if(e<t[n][0])i=n-1;else return!0;return!1}var pE=class{constructor(){if(this.version="6",!Qe){Qe=new Uint8Array(65536),Qe.fill(1),Qe[0]=0,Qe.fill(0,1,32),Qe.fill(0,127,160),Qe.fill(2,4352,4448),Qe[9001]=2,Qe[9002]=2,Qe.fill(2,11904,42192),Qe[12351]=1,Qe.fill(2,44032,55204),Qe.fill(2,63744,64256),Qe.fill(2,65040,65050),Qe.fill(2,65072,65136),Qe.fill(2,65280,65377),Qe.fill(2,65504,65511);for(let e=0;e<Uu.length;++e)Qe.fill(0,Uu[e][0],Uu[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Qe[e]:fE(e,dE)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let r=this.wcwidth(e),i=r===0&&t!==0;if(i){let n=En.extractWidth(t);n===0?i=!1:n>r&&(r=n)}return En.createPropertyValue(0,r,i)}},En=class Bl{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new q,this.onChange=this._onChange.event;let t=new pE;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,r,i=!1){return(t&16777215)<<3|(r&3)<<1|(i?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let r=0,i=0,n=t.length;for(let s=0;s<n;++s){let o=t.charCodeAt(s);if(55296<=o&&o<=56319){if(++s>=n)return r+this.wcwidth(o);let c=t.charCodeAt(s);56320<=c&&c<=57343?o=(o-55296)*1024+c-56320+65536:r+=this.wcwidth(c)}let a=this.charProperties(o,i),u=Bl.extractWidth(a);Bl.extractShouldJoin(a)&&(u-=Bl.extractWidth(i)),r+=u,i=a}return r}charProperties(t,r){return this._activeProvider.charProperties(t,r)}},mE=class{constructor(){this.glevel=0,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 n_(e){var i;let t=(i=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:i.get(e.cols-1),r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);r&&t&&(r.isWrapped=t[3]!==0&&t[3]!==32)}var So=2147483647,gE=256,vw=class Xd{constructor(t=32,r=32){if(this.maxLength=t,this.maxSubParamsLength=r,r>gE)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(r),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let r=new Xd;if(!t.length)return r;for(let i=Array.isArray(t[0])?1:0;i<t.length;++i){let n=t[i];if(Array.isArray(n))for(let s=0;s<n.length;++s)r.addSubParam(n[s]);else r.addParam(n)}return r}clone(){let t=new Xd(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 t=[];for(let r=0;r<this.length;++r){t.push(this.params[r]);let i=this._subParamsIdx[r]>>8,n=this._subParamsIdx[r]&255;n-i>0&&t.push(Array.prototype.slice.call(this._subParams,i,n))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>So?So:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>So?So:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let r=this._subParamsIdx[t]>>8,i=this._subParamsIdx[t]&255;return i-r>0?this._subParams.subarray(r,i):null}getSubParamsAll(){let t={};for(let r=0;r<this.length;++r){let i=this._subParamsIdx[r]>>8,n=this._subParamsIdx[r]&255;n-i>0&&(t[r]=this._subParams.slice(i,n))}return t}addDigit(t){let r;if(this._rejectDigits||!(r=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let i=this._digitIsSub?this._subParams:this.params,n=i[r-1];i[r-1]=~n?Math.min(n*10+t,So):t}},bo=[],_E=class{constructor(){this._state=0,this._active=bo,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(t),{dispose:()=>{let i=r.indexOf(t);i!==-1&&r.splice(i,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=bo}reset(){if(this._state===2)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=bo,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||bo,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,r){if(!this._active.length)this._handlerFb(this._id,"PUT",Xc(e,t,r));else for(let i=this._active.length-1;i>=0;i--)this._active[i].put(e,t,r)}start(){this.reset(),this._state=1}put(e,t,r){if(this._state!==3){if(this._state===1)for(;t<r;){let i=e[t++];if(i===59){this._state=2,this._start();break}if(i<48||57<i){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+i-48}this._state===2&&r-t>0&&this._put(e,t,r)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let r=!1,i=this._active.length-1,n=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,r=t,n=this._stack.fallThrough,this._stack.paused=!1),!n&&r===!1){for(;i>=0&&(r=this._active[i].end(e),r!==!0);i--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,r;i--}for(;i>=0;i--)if(r=this._active[i].end(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,r}this._active=bo,this._id=-1,this._state=0}}},Yt=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,r){this._hitLimit||(this._data+=Xc(e,t,r),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(r=>(this._data="",this._hitLimit=!1,r));return this._data="",this._hitLimit=!1,t}},Co=[],vE=class{constructor(){this._handlers=Object.create(null),this._active=Co,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Co}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(t),{dispose:()=>{let i=r.indexOf(t);i!==-1&&r.splice(i,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=Co,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Co,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let r=this._active.length-1;r>=0;r--)this._active[r].hook(t)}put(e,t,r){if(!this._active.length)this._handlerFb(this._ident,"PUT",Xc(e,t,r));else for(let i=this._active.length-1;i>=0;i--)this._active[i].put(e,t,r)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let r=!1,i=this._active.length-1,n=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,r=t,n=this._stack.fallThrough,this._stack.paused=!1),!n&&r===!1){for(;i>=0&&(r=this._active[i].unhook(e),r!==!0);i--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,r;i--}for(;i>=0;i--)if(r=this._active[i].unhook(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,r}this._active=Co,this._ident=0}},Oo=new vw;Oo.addParam(0);var s_=class{constructor(e){this._handler=e,this._data="",this._params=Oo,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Oo,this._data="",this._hitLimit=!1}put(e,t,r){this._hitLimit||(this._data+=Xc(e,t,r),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(r=>(this._params=Oo,this._data="",this._hitLimit=!1,r));return this._params=Oo,this._data="",this._hitLimit=!1,t}},yE=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,r,i){this.table[t<<8|e]=r<<4|i}addMany(e,t,r,i){for(let n=0;n<e.length;n++)this.table[t<<8|e[n]]=r<<4|i}},ur=160,xE=function(){let e=new yE(4095),t=Array.apply(null,Array(256)).map((a,u)=>u),r=(a,u)=>t.slice(a,u),i=r(32,127),n=r(0,24);n.push(25),n.push.apply(n,r(28,32));let s=r(0,14),o;e.setDefault(1,0),e.addMany(i,0,2,0);for(o in s)e.addMany([24,26,153,154],o,3,0),e.addMany(r(128,144),o,3,0),e.addMany(r(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,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(n,0,3,0),e.addMany(n,1,3,1),e.add(127,1,0,1),e.addMany(n,8,0,8),e.addMany(n,3,3,3),e.add(127,3,0,3),e.addMany(n,4,3,4),e.add(127,4,0,4),e.addMany(n,6,3,6),e.addMany(n,5,3,5),e.add(127,5,0,5),e.addMany(n,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(i,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(r(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(i,7,0,7),e.addMany(n,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(r(64,127),3,7,0),e.addMany(r(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(r(48,60),4,8,4),e.addMany(r(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(r(32,64),6,0,6),e.add(127,6,0,6),e.addMany(r(64,127),6,0,0),e.addMany(r(32,48),3,9,5),e.addMany(r(32,48),5,9,5),e.addMany(r(48,64),5,0,6),e.addMany(r(64,127),5,7,0),e.addMany(r(32,48),4,9,5),e.addMany(r(32,48),1,9,2),e.addMany(r(32,48),2,9,2),e.addMany(r(48,127),2,10,0),e.addMany(r(48,80),1,10,0),e.addMany(r(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(r(96,127),1,10,0),e.add(80,1,11,9),e.addMany(n,9,0,9),e.add(127,9,0,9),e.addMany(r(28,32),9,0,9),e.addMany(r(32,48),9,9,12),e.addMany(r(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(n,11,0,11),e.addMany(r(32,128),11,0,11),e.addMany(r(28,32),11,0,11),e.addMany(n,10,0,10),e.add(127,10,0,10),e.addMany(r(28,32),10,0,10),e.addMany(r(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(r(32,48),10,9,12),e.addMany(n,12,0,12),e.add(127,12,0,12),e.addMany(r(28,32),12,0,12),e.addMany(r(32,48),12,9,12),e.addMany(r(48,64),12,0,11),e.addMany(r(64,127),12,12,13),e.addMany(r(64,127),10,12,13),e.addMany(r(64,127),9,12,13),e.addMany(n,13,13,13),e.addMany(i,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(ur,0,2,0),e.add(ur,8,5,8),e.add(ur,6,0,6),e.add(ur,11,0,11),e.add(ur,13,13,13),e}(),wE=class extends ce{constructor(e=xE){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 vw,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,r,i)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,r)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(Me(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new _E),this._dcsParser=this._register(new vE),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let r=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(r=e.prefix.charCodeAt(0),r&&60>r||r>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 n=0;n<e.intermediates.length;++n){let s=e.intermediates.charCodeAt(n);if(32>s||s>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=s}}if(e.final.length!==1)throw new Error("final must be a single byte");let i=e.final.charCodeAt(0);if(t[0]>i||i>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return r<<=8,r|=i,r}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let r=this._identifier(e,[48,126]);this._escHandlers[r]===void 0&&(this._escHandlers[r]=[]);let i=this._escHandlers[r];return i.push(t),{dispose:()=>{let n=i.indexOf(t);n!==-1&&i.splice(n,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){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let r=this._identifier(e);this._csiHandlers[r]===void 0&&(this._csiHandlers[r]=[]);let i=this._csiHandlers[r];return i.push(t),{dispose:()=>{let n=i.indexOf(t);n!==-1&&i.splice(n,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)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,r,i,n){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=r,this._parseStack.transition=i,this._parseStack.chunkPos=n}parse(e,t,r){let i=0,n=0,s=0,o;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,s=this._parseStack.chunkPos+1;else{if(r===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let a=this._parseStack.handlers,u=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(r===!1&&u>-1){for(;u>=0&&(o=a[u](this._params),o!==!0);u--)if(o instanceof Promise)return this._parseStack.handlerPos=u,o}this._parseStack.handlers=[];break;case 4:if(r===!1&&u>-1){for(;u>=0&&(o=a[u](),o!==!0);u--)if(o instanceof Promise)return this._parseStack.handlerPos=u,o}this._parseStack.handlers=[];break;case 6:if(i=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(i!==24&&i!==26,r),o)return o;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(i=e[this._parseStack.chunkPos],o=this._oscParser.end(i!==24&&i!==26,r),o)return o;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,s=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let a=s;a<t;++a){switch(i=e[a],n=this._transitions.table[this.currentState<<8|(i<160?i:ur)],n>>4){case 2:for(let f=a+1;;++f){if(f>=t||(i=e[f])<32||i>126&&i<ur){this._printHandler(e,a,f),a=f-1;break}if(++f>=t||(i=e[f])<32||i>126&&i<ur){this._printHandler(e,a,f),a=f-1;break}if(++f>=t||(i=e[f])<32||i>126&&i<ur){this._printHandler(e,a,f),a=f-1;break}if(++f>=t||(i=e[f])<32||i>126&&i<ur){this._printHandler(e,a,f),a=f-1;break}}break;case 3:this._executeHandlers[i]?this._executeHandlers[i]():this._executeHandlerFb(i),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:a,code:i,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let u=this._csiHandlers[this._collect<<8|i],c=u?u.length-1:-1;for(;c>=0&&(o=u[c](this._params),o!==!0);c--)if(o instanceof Promise)return this._preserveStack(3,u,c,n,a),o;c<0&&this._csiHandlerFb(this._collect<<8|i,this._params),this.precedingJoinState=0;break;case 8:do switch(i){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(i-48)}while(++a<t&&(i=e[a])>47&&i<60);a--;break;case 9:this._collect<<=8,this._collect|=i;break;case 10:let h=this._escHandlers[this._collect<<8|i],d=h?h.length-1:-1;for(;d>=0&&(o=h[d](),o!==!0);d--)if(o instanceof Promise)return this._preserveStack(4,h,d,n,a),o;d<0&&this._escHandlerFb(this._collect<<8|i),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|i,this._params);break;case 13:for(let f=a+1;;++f)if(f>=t||(i=e[f])===24||i===26||i===27||i>127&&i<ur){this._dcsParser.put(e,a,f),a=f-1;break}break;case 14:if(o=this._dcsParser.unhook(i!==24&&i!==26),o)return this._preserveStack(6,[],0,n,a),o;i===27&&(n|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let f=a+1;;f++)if(f>=t||(i=e[f])<32||i>127&&i<ur){this._oscParser.put(e,a,f),a=f-1;break}break;case 6:if(o=this._oscParser.end(i!==24&&i!==26),o)return this._preserveStack(5,[],0,n,a),o;i===27&&(n|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=n&15}}},SE=/^([\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})$/,bE=/^[\da-f]+$/;function o_(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let r=SE.exec(t);if(r){let i=r[1]?15:r[4]?255:r[7]?4095:65535;return[Math.round(parseInt(r[1]||r[4]||r[7]||r[10],16)/i*255),Math.round(parseInt(r[2]||r[5]||r[8]||r[11],16)/i*255),Math.round(parseInt(r[3]||r[6]||r[9]||r[12],16)/i*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),bE.exec(t)&&[3,6,9,12].includes(t.length))){let r=t.length/3,i=[0,0,0];for(let n=0;n<3;++n){let s=parseInt(t.slice(r*n,r*n+r),16);i[n]=r===1?s<<4:r===2?s:r===3?s>>4:s>>8}return i}}function Ku(e,t){let r=e.toString(16),i=r.length<2?"0"+r:r;switch(t){case 4:return r[0];case 8:return i;case 12:return(i+i).slice(0,3);default:return i+i}}function CE(e,t=16){let[r,i,n]=e;return`rgb:${Ku(r,t)}/${Ku(i,t)}/${Ku(n,t)}`}var kE={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Mi=131072,a_=10;function l_(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 c_=5e3,u_=0,NE=class extends ce{constructor(e,t,r,i,n,s,o,a,u=new wE){super(),this._bufferService=e,this._charsetService=t,this._coreService=r,this._logService=i,this._optionsService=n,this._oscLinkService=s,this._coreMouseService=o,this._unicodeService=a,this._parser=u,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new Kk,this._utf8Decoder=new qk,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=qe.clone(),this._eraseAttrDataInternal=qe.clone(),this._onRequestBell=this._register(new q),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new q),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new q),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new q),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new q),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new q),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new q),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new q),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new q),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new q),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new q),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new q),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new q),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new Qd(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(c=>this._activeBuffer=c.activeBuffer)),this._parser.setCsiHandlerFallback((c,h)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(c),params:h.toArray()})}),this._parser.setEscHandlerFallback(c=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(c)})}),this._parser.setExecuteHandlerFallback(c=>{this._logService.debug("Unknown EXECUTE code: ",{code:c})}),this._parser.setOscHandlerFallback((c,h,d)=>{this._logService.debug("Unknown OSC code: ",{identifier:c,action:h,data:d})}),this._parser.setDcsHandlerFallback((c,h,d)=>{h==="HOOK"&&(d=d.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(c),action:h,payload:d})}),this._parser.setPrintHandler((c,h,d)=>this.print(c,h,d)),this._parser.registerCsiHandler({final:"@"},c=>this.insertChars(c)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},c=>this.scrollLeft(c)),this._parser.registerCsiHandler({final:"A"},c=>this.cursorUp(c)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},c=>this.scrollRight(c)),this._parser.registerCsiHandler({final:"B"},c=>this.cursorDown(c)),this._parser.registerCsiHandler({final:"C"},c=>this.cursorForward(c)),this._parser.registerCsiHandler({final:"D"},c=>this.cursorBackward(c)),this._parser.registerCsiHandler({final:"E"},c=>this.cursorNextLine(c)),this._parser.registerCsiHandler({final:"F"},c=>this.cursorPrecedingLine(c)),this._parser.registerCsiHandler({final:"G"},c=>this.cursorCharAbsolute(c)),this._parser.registerCsiHandler({final:"H"},c=>this.cursorPosition(c)),this._parser.registerCsiHandler({final:"I"},c=>this.cursorForwardTab(c)),this._parser.registerCsiHandler({final:"J"},c=>this.eraseInDisplay(c,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},c=>this.eraseInDisplay(c,!0)),this._parser.registerCsiHandler({final:"K"},c=>this.eraseInLine(c,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},c=>this.eraseInLine(c,!0)),this._parser.registerCsiHandler({final:"L"},c=>this.insertLines(c)),this._parser.registerCsiHandler({final:"M"},c=>this.deleteLines(c)),this._parser.registerCsiHandler({final:"P"},c=>this.deleteChars(c)),this._parser.registerCsiHandler({final:"S"},c=>this.scrollUp(c)),this._parser.registerCsiHandler({final:"T"},c=>this.scrollDown(c)),this._parser.registerCsiHandler({final:"X"},c=>this.eraseChars(c)),this._parser.registerCsiHandler({final:"Z"},c=>this.cursorBackwardTab(c)),this._parser.registerCsiHandler({final:"`"},c=>this.charPosAbsolute(c)),this._parser.registerCsiHandler({final:"a"},c=>this.hPositionRelative(c)),this._parser.registerCsiHandler({final:"b"},c=>this.repeatPrecedingCharacter(c)),this._parser.registerCsiHandler({final:"c"},c=>this.sendDeviceAttributesPrimary(c)),this._parser.registerCsiHandler({prefix:">",final:"c"},c=>this.sendDeviceAttributesSecondary(c)),this._parser.registerCsiHandler({final:"d"},c=>this.linePosAbsolute(c)),this._parser.registerCsiHandler({final:"e"},c=>this.vPositionRelative(c)),this._parser.registerCsiHandler({final:"f"},c=>this.hVPosition(c)),this._parser.registerCsiHandler({final:"g"},c=>this.tabClear(c)),this._parser.registerCsiHandler({final:"h"},c=>this.setMode(c)),this._parser.registerCsiHandler({prefix:"?",final:"h"},c=>this.setModePrivate(c)),this._parser.registerCsiHandler({final:"l"},c=>this.resetMode(c)),this._parser.registerCsiHandler({prefix:"?",final:"l"},c=>this.resetModePrivate(c)),this._parser.registerCsiHandler({final:"m"},c=>this.charAttributes(c)),this._parser.registerCsiHandler({final:"n"},c=>this.deviceStatus(c)),this._parser.registerCsiHandler({prefix:"?",final:"n"},c=>this.deviceStatusPrivate(c)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},c=>this.softReset(c)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},c=>this.setCursorStyle(c)),this._parser.registerCsiHandler({final:"r"},c=>this.setScrollRegion(c)),this._parser.registerCsiHandler({final:"s"},c=>this.saveCursor(c)),this._parser.registerCsiHandler({final:"t"},c=>this.windowOptions(c)),this._parser.registerCsiHandler({final:"u"},c=>this.restoreCursor(c)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},c=>this.insertColumns(c)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},c=>this.deleteColumns(c)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},c=>this.selectProtected(c)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},c=>this.requestMode(c,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},c=>this.requestMode(c,!1)),this._parser.setExecuteHandler(z.BEL,()=>this.bell()),this._parser.setExecuteHandler(z.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(z.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(z.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(z.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(z.BS,()=>this.backspace()),this._parser.setExecuteHandler(z.HT,()=>this.tab()),this._parser.setExecuteHandler(z.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(z.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Al.IND,()=>this.index()),this._parser.setExecuteHandler(Al.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Al.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Yt(c=>(this.setTitle(c),this.setIconName(c),!0))),this._parser.registerOscHandler(1,new Yt(c=>this.setIconName(c))),this._parser.registerOscHandler(2,new Yt(c=>this.setTitle(c))),this._parser.registerOscHandler(4,new Yt(c=>this.setOrReportIndexedColor(c))),this._parser.registerOscHandler(8,new Yt(c=>this.setHyperlink(c))),this._parser.registerOscHandler(10,new Yt(c=>this.setOrReportFgColor(c))),this._parser.registerOscHandler(11,new Yt(c=>this.setOrReportBgColor(c))),this._parser.registerOscHandler(12,new Yt(c=>this.setOrReportCursorColor(c))),this._parser.registerOscHandler(104,new Yt(c=>this.restoreIndexedColor(c))),this._parser.registerOscHandler(110,new Yt(c=>this.restoreFgColor(c))),this._parser.registerOscHandler(111,new Yt(c=>this.restoreBgColor(c))),this._parser.registerOscHandler(112,new Yt(c=>this.restoreCursorColor(c))),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 tt)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(c=>(this._logService.error("Parsing error: ",c),c)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new s_((c,h)=>this.requestStatusString(c,h)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,r,i){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=r,this._parseStack.position=i}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,r)=>setTimeout(()=>r("#SLOW_TIMEOUT"),c_))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${c_} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let r,i=this._activeBuffer.x,n=this._activeBuffer.y,s=0,o=this._parseStack.paused;if(o){if(r=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(r),r;i=this._parseStack.cursorStartX,n=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Mi&&(s=this._parseStack.position+Mi)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,c=>String.fromCharCode(c)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(c=>c.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Mi&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Mi))),o||this._dirtyRowTracker.clearRange(),e.length>Mi)for(let c=s;c<e.length;c+=Mi){let h=c+Mi<e.length?c+Mi:e.length,d=typeof e=="string"?this._stringDecoder.decode(e.substring(c,h),this._parseBuffer):this._utf8Decoder.decode(e.subarray(c,h),this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,d))return this._preserveStack(i,n,d,c),this._logSlowResolvingAsync(r),r}else if(!o){let c=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,c))return this._preserveStack(i,n,c,0),this._logSlowResolvingAsync(r),r}(this._activeBuffer.x!==i||this._activeBuffer.y!==n)&&this._onCursorMove.fire();let a=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),u=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);u<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(u,this._bufferService.rows-1),end:Math.min(a,this._bufferService.rows-1)})}print(e,t,r){let i,n,s=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,a=this._bufferService.cols,u=this._coreService.decPrivateModes.wraparound,c=this._coreService.modes.insertMode,h=this._curAttrData,d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&r-t>0&&d.getWidth(this._activeBuffer.x-1)===2&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,h);let f=this._parser.precedingJoinState;for(let p=t;p<r;++p){if(i=e[p],i<127&&s){let g=s[String.fromCharCode(i)];g&&(i=g.charCodeAt(0))}let m=this._unicodeService.charProperties(i,f);n=En.extractWidth(m);let y=En.extractShouldJoin(m),C=y?En.extractWidth(f):0;if(f=m,o&&this._onA11yChar.fire(Ai(i)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+n-C>a){if(u){let g=d,_=this._activeBuffer.x-C;for(this._activeBuffer.x=C,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),d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),C>0&&d instanceof Lo&&d.copyCellsFrom(g,_,0,C,!1);_<a;)g.setCellFromCodepoint(_++,0,1,h)}else if(this._activeBuffer.x=a-1,n===2)continue}if(y&&this._activeBuffer.x){let g=d.getWidth(this._activeBuffer.x-1)?1:2;d.addCodepointToCell(this._activeBuffer.x-g,i,n);for(let _=n-C;--_>=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,h);continue}if(c&&(d.insertCells(this._activeBuffer.x,n-C,this._activeBuffer.getNullCell(h)),d.getWidth(a-1)===2&&d.setCellFromCodepoint(a-1,0,1,h)),d.setCellFromCodepoint(this._activeBuffer.x++,i,n,h),n>0)for(;--n;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,h)}this._parser.precedingJoinState=f,this._activeBuffer.x<a&&r-t>0&&d.getWidth(this._activeBuffer.x)===0&&!d.hasContent(this._activeBuffer.x)&&d.setCellFromCodepoint(this._activeBuffer.x,0,1,h),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,r=>l_(r.params[0],this._optionsService.rawOptions.windowOptions)?t(r):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new s_(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Yt(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(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&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 t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.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 t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(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 t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,r,i=!1,n=!1){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);s.replaceCells(t,r,this._activeBuffer.getNullCell(this._eraseAttrData()),n),i&&(s.isWrapped=!1)}_resetBufferLine(e,t=!1){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r&&(r.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),r.isWrapped=!1)}eraseInDisplay(e,t=!1){var i;this._restrictCursor(this._bufferService.cols);let r;switch(e.params[0]){case 0:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);r<this._bufferService.rows;r++)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(r);break;case 1:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(r+1).isWrapped=!1);r--;)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(r=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,r-1);r--&&!((i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r))!=null&&i.getTrimmedLength()););for(;r>=0;r--)this._bufferService.scroll(this._eraseAttrData())}else{for(r=this._bufferService.rows,this._dirtyRowTracker.markDirty(r-1);r--;)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let n=this._activeBuffer.lines.length-this._bufferService.rows;n>0&&(this._activeBuffer.lines.trimStart(n),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-n,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-n,0),this._onScroll.fire(0));break}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,this._activeBuffer.x===0,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);break}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 r=this._activeBuffer.ybase+this._activeBuffer.y,i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,n=this._bufferService.rows-1+this._activeBuffer.ybase-i+1;for(;t--;)this._activeBuffer.lines.splice(n-1,1),this._activeBuffer.lines.splice(r,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 r=this._activeBuffer.ybase+this._activeBuffer.y,i;for(i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-i;t--;)this._activeBuffer.lines.splice(r,1),this._activeBuffer.lines.splice(i,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(qe));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 r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);i.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.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 r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);i.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.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 r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);i.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.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 r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);i.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.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 r=e.params[0]||1,i=En.extractWidth(t),n=this._activeBuffer.x-i,s=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(n),o=new Uint32Array(s.length*r),a=0;for(let c=0;c<s.length;){let h=s.codePointAt(c)||0;o[a++]=h,c+=h>65535?2:1}let u=a;for(let c=1;c<r;++c)o.copyWithin(u,0,a),u+=a;return this.print(o,0,u),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(z.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(z.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(z.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(z.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(z.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}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;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,wn),this._charsetService.setgCharset(1,wn),this._charsetService.setgCharset(2,wn),this._charsetService.setgCharset(3,wn);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}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;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&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}return!0}requestMode(e,t){(y=>(y[y.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",y[y.SET=1]="SET",y[y.RESET=2]="RESET",y[y.PERMANENTLY_SET=3]="PERMANENTLY_SET",y[y.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(r={}));let i=this._coreService.decPrivateModes,{activeProtocol:n,activeEncoding:s}=this._coreMouseService,o=this._coreService,{buffers:a,cols:u}=this._bufferService,{active:c,alt:h}=a,d=this._optionsService.rawOptions,f=(y,C)=>(o.triggerDataEvent(`${z.ESC}[${t?"":"?"}${y};${C}$y`),!0),p=y=>y?1:2,m=e.params[0];return t?m===2?f(m,4):m===4?f(m,p(o.modes.insertMode)):m===12?f(m,3):m===20?f(m,p(d.convertEol)):f(m,0):m===1?f(m,p(i.applicationCursorKeys)):m===3?f(m,d.windowOptions.setWinLines?u===80?2:u===132?1:0:0):m===6?f(m,p(i.origin)):m===7?f(m,p(i.wraparound)):m===8?f(m,3):m===9?f(m,p(n==="X10")):m===12?f(m,p(d.cursorBlink)):m===25?f(m,p(!o.isCursorHidden)):m===45?f(m,p(i.reverseWraparound)):m===66?f(m,p(i.applicationKeypad)):m===67?f(m,4):m===1e3?f(m,p(n==="VT200")):m===1002?f(m,p(n==="DRAG")):m===1003?f(m,p(n==="ANY")):m===1004?f(m,p(i.sendFocus)):m===1005?f(m,4):m===1006?f(m,p(s==="SGR")):m===1015?f(m,4):m===1016?f(m,p(s==="SGR_PIXELS")):m===1048?f(m,1):m===47||m===1047||m===1049?f(m,p(c===h)):m===2004?f(m,p(i.bracketedPasteMode)):m===2026?f(m,p(i.synchronizedOutput)):f(m,0)}_updateAttrColor(e,t,r,i,n){return t===2?(e|=50331648,e&=-16777216,e|=Ma.fromColorRGB([r,i,n])):t===5&&(e&=-50331904,e|=33554432|r&255),e}_extractColor(e,t,r){let i=[0,0,-1,0,0,0],n=0,s=0;do{if(i[s+n]=e.params[t+s],e.hasSubParams(t+s)){let o=e.getSubParams(t+s),a=0;do i[1]===5&&(n=1),i[s+a+1+n]=o[a];while(++a<o.length&&a+s+1+n<i.length);break}if(i[1]===5&&s+n>=2||i[1]===2&&s+n>=5)break;i[1]&&(n=1)}while(++s+t<e.length&&s+n<i.length);for(let o=2;o<i.length;++o)i[o]===-1&&(i[o]=0);switch(i[0]){case 38:r.fg=this._updateAttrColor(r.fg,i[1],i[3],i[4],i[5]);break;case 48:r.bg=this._updateAttrColor(r.bg,i[1],i[3],i[4],i[5]);break;case 58:r.extended=r.extended.clone(),r.extended.underlineColor=this._updateAttrColor(r.extended.underlineColor,i[1],i[3],i[4],i[5])}return s}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=qe.fg,e.bg=qe.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,r,i=this._curAttrData;for(let n=0;n<t;n++)r=e.params[n],r>=30&&r<=37?(i.fg&=-50331904,i.fg|=16777216|r-30):r>=40&&r<=47?(i.bg&=-50331904,i.bg|=16777216|r-40):r>=90&&r<=97?(i.fg&=-50331904,i.fg|=16777216|r-90|8):r>=100&&r<=107?(i.bg&=-50331904,i.bg|=16777216|r-100|8):r===0?this._processSGR0(i):r===1?i.fg|=134217728:r===3?i.bg|=67108864:r===4?(i.fg|=268435456,this._processUnderline(e.hasSubParams(n)?e.getSubParams(n)[0]:1,i)):r===5?i.fg|=536870912:r===7?i.fg|=67108864:r===8?i.fg|=1073741824:r===9?i.fg|=2147483648:r===2?i.bg|=134217728:r===21?this._processUnderline(2,i):r===22?(i.fg&=-134217729,i.bg&=-134217729):r===23?i.bg&=-67108865:r===24?(i.fg&=-268435457,this._processUnderline(0,i)):r===25?i.fg&=-536870913:r===27?i.fg&=-67108865:r===28?i.fg&=-1073741825:r===29?i.fg&=2147483647:r===39?(i.fg&=-67108864,i.fg|=qe.fg&16777215):r===49?(i.bg&=-67108864,i.bg|=qe.bg&16777215):r===38||r===48||r===58?n+=this._extractColor(e,n,i):r===53?i.bg|=1073741824:r===55?i.bg&=-1073741825:r===59?(i.extended=i.extended.clone(),i.extended.underlineColor=-1,i.updateExtended()):r===100?(i.fg&=-67108864,i.fg|=qe.fg&16777215,i.bg&=-67108864,i.bg|=qe.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",r);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${z.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${z.ESC}[${t};${r}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${z.ESC}[?${t};${r}R`);break}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=qe.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=e.length===0?1:e.params[0];if(t===0)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";break}let r=t%2===1;this._coreService.decPrivateModes.cursorBlink=r}return!0}setScrollRegion(e){let t=e.params[0]||1,r;return(e.length<2||(r=e.params[1])>this._bufferService.rows||r===0)&&(r=this._bufferService.rows),r>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=r-1,this._setCursor(0,0)),!0}windowOptions(e){if(!l_(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${z.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>a_&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>a_&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}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,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],r=e.split(";");for(;r.length>1;){let i=r.shift(),n=r.shift();if(/^\d+$/.exec(i)){let s=parseInt(i);if(h_(s))if(n==="?")t.push({type:0,index:s});else{let o=o_(n);o&&t.push({type:1,index:s,color:o})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let r=e.slice(0,t).trim(),i=e.slice(t+1);return i?this._createHyperlink(r,i):r.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let r=e.split(":"),i,n=r.findIndex(s=>s.startsWith("id="));return n!==-1&&(i=r[n].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:i,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 r=e.split(";");for(let i=0;i<r.length&&!(t>=this._specialColors.length);++i,++t)if(r[i]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let n=o_(r[i]);n&&this._onColor.fire([{type:1,index:this._specialColors[t],color:n}])}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=[],r=e.split(";");for(let i=0;i<r.length;++i)if(/^\d+$/.exec(r[i])){let n=parseInt(r[i]);h_(n)&&t.push({type:2,index:n})}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,wn),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(kE[e[0]],tt[e[1]]||wn),!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=qe.clone(),this._eraseAttrDataInternal=qe.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new gr;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let r=this._activeBuffer.ybase+this._activeBuffer.y+t,i=this._activeBuffer.lines.get(r);i&&(i.fill(e),i.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let r=o=>(this._coreService.triggerDataEvent(`${z.ESC}${o}${z.ESC}\\`),!0),i=this._bufferService.buffer,n=this._optionsService.rawOptions;return r(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${i.scrollTop+1};${i.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[n.cursorStyle]-(n.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},Qd=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&&(u_=e,e=t,t=u_),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Qd=Fe([X(0,Rt)],Qd);function h_(e){return 0<=e&&e<256}var EE=5e7,d_=12,jE=50,PE=class extends ce{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._onWriteParsed=this._register(new q),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let r;for(;r=this._writeBuffer.shift();){this._action(r);let i=this._callbacks.shift();i&&i()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>EE)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let r=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let i=this._writeBuffer[this._bufferOffset],n=this._action(i,t);if(n){let o=a=>performance.now()-r>=d_?setTimeout(()=>this._innerWrite(0,a)):this._innerWrite(r,a);n.catch(a=>(queueMicrotask(()=>{throw a}),Promise.resolve(!1))).then(o);return}let s=this._callbacks[this._bufferOffset];if(s&&s(),this._bufferOffset++,this._pendingData-=i.length,performance.now()-r>=d_)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>jE&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},Gd=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(e.id===void 0){let a=t.addMarker(t.ybase+t.y),u={data:e,id:this._nextId++,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(u,a)),this._dataByLinkId.set(u.id,u),u.id}let r=e,i=this._getEntryIdKey(r),n=this._entriesWithId.get(i);if(n)return this.addLineToLink(n.id,t.ybase+t.y),n.id;let s=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(r),data:r,lines:[s]};return s.onDispose(()=>this._removeMarkerFromLink(o,s)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let r=this._dataByLinkId.get(e);if(r&&r.lines.every(i=>i.line!==t)){let i=this._bufferService.buffer.addMarker(t);r.lines.push(i),i.onDispose(()=>this._removeMarkerFromLink(r,i))}}getLinkData(e){var t;return(t=this._dataByLinkId.get(e))==null?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let r=e.lines.indexOf(t);r!==-1&&(e.lines.splice(r,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};Gd=Fe([X(0,Rt)],Gd);var f_=!1,ME=class extends ce{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Qs),this._onBinary=this._register(new q),this.onBinary=this._onBinary.event,this._onData=this._register(new q),this.onData=this._onData.event,this._onLineFeed=this._register(new q),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new q),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new q),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new q),this._instantiationService=new eE,this.optionsService=this._register(new uE(e)),this._instantiationService.setService(Dt,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(qd)),this._instantiationService.setService(Rt,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Kd)),this._instantiationService.setService(Bx,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Vd)),this._instantiationService.setService(Zn,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Yd)),this._instantiationService.setService(Ox,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(En)),this._instantiationService.setService(Qk,this.unicodeService),this._charsetService=this._instantiationService.createInstance(mE),this._instantiationService.setService(Xk,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Gd),this._instantiationService.setService(zx,this._oscLinkService),this._inputHandler=this._register(new NE(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(dt.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(dt.forward(this._bufferService.onResize,this._onResize)),this._register(dt.forward(this.coreService.onData,this._onData)),this._register(dt.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(["windowsMode","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 PE((t,r)=>this._inputHandler.parse(t,r))),this._register(dt.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new q),this._onScroll.event(e=>{var t;(t=this._onScrollApi)==null||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&&!f_&&(this._logService.warn("writeSync is unreliable and will be removed soon."),f_=!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,gw),t=Math.max(t,_w),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;t!==0&&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)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend==="conpty"&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(n_.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(n_(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Me(()=>{for(let t of e)t.dispose()})}}},TE={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:["'",'"']};function RE(e,t,r,i){var o;let n={type:0,cancel:!1,key:void 0},s=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?n.key=z.ESC+"OA":n.key=z.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?n.key=z.ESC+"OD":n.key=z.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?n.key=z.ESC+"OC":n.key=z.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?n.key=z.ESC+"OB":n.key=z.ESC+"[B");break;case 8:n.key=e.ctrlKey?"\b":z.DEL,e.altKey&&(n.key=z.ESC+n.key);break;case 9:if(e.shiftKey){n.key=z.ESC+"[Z";break}n.key=z.HT,n.cancel=!0;break;case 13:n.key=e.altKey?z.ESC+z.CR:z.CR,n.cancel=!0;break;case 27:n.key=z.ESC,e.altKey&&(n.key=z.ESC+z.ESC),n.cancel=!0;break;case 37:if(e.metaKey)break;s?n.key=z.ESC+"[1;"+(s+1)+"D":t?n.key=z.ESC+"OD":n.key=z.ESC+"[D";break;case 39:if(e.metaKey)break;s?n.key=z.ESC+"[1;"+(s+1)+"C":t?n.key=z.ESC+"OC":n.key=z.ESC+"[C";break;case 38:if(e.metaKey)break;s?n.key=z.ESC+"[1;"+(s+1)+"A":t?n.key=z.ESC+"OA":n.key=z.ESC+"[A";break;case 40:if(e.metaKey)break;s?n.key=z.ESC+"[1;"+(s+1)+"B":t?n.key=z.ESC+"OB":n.key=z.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(n.key=z.ESC+"[2~");break;case 46:s?n.key=z.ESC+"[3;"+(s+1)+"~":n.key=z.ESC+"[3~";break;case 36:s?n.key=z.ESC+"[1;"+(s+1)+"H":t?n.key=z.ESC+"OH":n.key=z.ESC+"[H";break;case 35:s?n.key=z.ESC+"[1;"+(s+1)+"F":t?n.key=z.ESC+"OF":n.key=z.ESC+"[F";break;case 33:e.shiftKey?n.type=2:e.ctrlKey?n.key=z.ESC+"[5;"+(s+1)+"~":n.key=z.ESC+"[5~";break;case 34:e.shiftKey?n.type=3:e.ctrlKey?n.key=z.ESC+"[6;"+(s+1)+"~":n.key=z.ESC+"[6~";break;case 112:s?n.key=z.ESC+"[1;"+(s+1)+"P":n.key=z.ESC+"OP";break;case 113:s?n.key=z.ESC+"[1;"+(s+1)+"Q":n.key=z.ESC+"OQ";break;case 114:s?n.key=z.ESC+"[1;"+(s+1)+"R":n.key=z.ESC+"OR";break;case 115:s?n.key=z.ESC+"[1;"+(s+1)+"S":n.key=z.ESC+"OS";break;case 116:s?n.key=z.ESC+"[15;"+(s+1)+"~":n.key=z.ESC+"[15~";break;case 117:s?n.key=z.ESC+"[17;"+(s+1)+"~":n.key=z.ESC+"[17~";break;case 118:s?n.key=z.ESC+"[18;"+(s+1)+"~":n.key=z.ESC+"[18~";break;case 119:s?n.key=z.ESC+"[19;"+(s+1)+"~":n.key=z.ESC+"[19~";break;case 120:s?n.key=z.ESC+"[20;"+(s+1)+"~":n.key=z.ESC+"[20~";break;case 121:s?n.key=z.ESC+"[21;"+(s+1)+"~":n.key=z.ESC+"[21~";break;case 122:s?n.key=z.ESC+"[23;"+(s+1)+"~":n.key=z.ESC+"[23~";break;case 123:s?n.key=z.ESC+"[24;"+(s+1)+"~":n.key=z.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?n.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?n.key=z.NUL:e.keyCode>=51&&e.keyCode<=55?n.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?n.key=z.DEL:e.keyCode===219?n.key=z.ESC:e.keyCode===220?n.key=z.FS:e.keyCode===221&&(n.key=z.GS);else if((!r||i)&&e.altKey&&!e.metaKey){let a=(o=TE[e.keyCode])==null?void 0:o[e.shiftKey?1:0];if(a)n.key=z.ESC+a;else if(e.keyCode>=65&&e.keyCode<=90){let u=e.ctrlKey?e.keyCode-64:e.keyCode+32,c=String.fromCharCode(u);e.shiftKey&&(c=c.toUpperCase()),n.key=z.ESC+c}else if(e.keyCode===32)n.key=z.ESC+(e.ctrlKey?z.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let u=e.code.slice(3,4);e.shiftKey||(u=u.toLowerCase()),n.key=z.ESC+u,n.cancel=!0}}else r&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(n.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?n.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(n.key=z.US),e.key==="@"&&(n.key=z.NUL));break}return n}var He=0,DE=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new yc,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new yc,this._isFlushingDeleted=!1}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(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((n,s)=>this._getKey(n)-this._getKey(s)),t=0,r=0,i=new Array(this._array.length+this._insertedValues.length);for(let n=0;n<i.length;n++)r>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[r])?(i[n]=e[t],t++):i[n]=this._array[r++];this._array=i,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(He=this._search(t),He===-1)||this._getKey(this._array[He])!==t)return!1;do if(this._array[He]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(He),!0;while(++He<this._array.length&&this._getKey(this._array[He])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((n,s)=>n-s),t=0,r=new Array(this._array.length-e.length),i=0;for(let n=0;n<this._array.length;n++)e[t]===n?t++:r[i++]=this._array[n];this._array=r,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(He=this._search(e),!(He<0||He>=this._array.length)&&this._getKey(this._array[He])===e))do yield this._array[He];while(++He<this._array.length&&this._getKey(this._array[He])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(He=this._search(e),!(He<0||He>=this._array.length)&&this._getKey(this._array[He])===e))do t(this._array[He]);while(++He<this._array.length&&this._getKey(this._array[He])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,r=this._array.length-1;for(;r>=t;){let i=t+r>>1,n=this._getKey(this._array[i]);if(n>e)r=i-1;else if(n<e)t=i+1;else{for(;i>0&&this._getKey(this._array[i-1])===e;)i--;return i}}return t}},qu=0,p_=0,LE=class extends ce{constructor(){super(),this._decorations=new DE(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new q),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new q),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Me(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new AE(e);if(t){let r=t.marker.onDispose(()=>t.dispose()),i=t.onDispose(()=>{i.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),r.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,r){let i=0,n=0;for(let s of this._decorations.getKeyIterator(t))i=s.options.x??0,n=i+(s.options.width??1),e>=i&&e<n&&(!r||(s.options.layer??"bottom")===r)&&(yield s)}forEachDecorationAtCell(e,t,r,i){this._decorations.forEachByKey(t,n=>{qu=n.options.x??0,p_=qu+(n.options.width??1),e>=qu&&e<p_&&(!r||(n.options.layer??"bottom")===r)&&i(n)})}},AE=class extends on{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new q),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new q),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=Re.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Re.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},OE=1e3,BE=class{constructor(e,t=OE){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,r){this._rowCount=r,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let i=performance.now();if(i-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=i,this._innerRefresh();else if(!this._additionalRefreshRequested){let n=i-this._lastRefreshMs,s=this._debounceThresholdMS-n;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},s)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)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)}},m_=20,xc=class extends ce{constructor(e,t,r,i){super(),this._terminal=e,this._coreBrowserService=r,this._renderService=i,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let n=this._coreBrowserService.mainDocument;this._accessibilityContainer=n.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=n.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let s=0;s<this._terminal.rows;s++)this._rowElements[s]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[s]);if(this._topBoundaryFocusListener=s=>this._handleBoundaryFocus(s,0),this._bottomBoundaryFocusListener=s=>this._handleBoundaryFocus(s,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=n.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new BE(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(s=>this._handleResize(s.rows))),this._register(this._terminal.onRender(s=>this._refreshRows(s.start,s.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(s=>this._handleChar(s))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
369
+ `))),this._register(this._terminal.onA11yTab(s=>this._handleTab(s))),this._register(this._terminal.onKey(s=>this._handleKey(s.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(te(n,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Me(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<m_+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
370
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===m_+1&&(this._liveRegion.textContent+=_d.get())))}_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 r=this._terminal.buffer,i=r.lines.length.toString();for(let n=e;n<=t;n++){let s=r.lines.get(r.ydisp+n),o=[],a=(s==null?void 0:s.translateToString(!0,void 0,void 0,o))||"",u=(r.ydisp+n+1).toString(),c=this._rowElements[n];c&&(a.length===0?(c.textContent=" ",this._rowColumns.set(c,[0,1])):(c.textContent=a,this._rowColumns.set(c,o)),c.setAttribute("aria-posinset",u),c.setAttribute("aria-setsize",i),this._alignRowWidth(c))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let r=e.target,i=this._rowElements[t===0?1:this._rowElements.length-2],n=r.getAttribute("aria-posinset"),s=t===0?"1":`${this._terminal.buffer.lines.length}`;if(n===s||e.relatedTarget!==i)return;let o,a;if(t===0?(o=r,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(o=this._rowElements.shift(),a=r,this._rowContainer.removeChild(o)),o.removeEventListener("focus",this._topBoundaryFocusListener),a.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let u=this._createAccessibilityTreeNode();this._rowElements.unshift(u),this._rowContainer.insertAdjacentElement("afterbegin",u)}else{let u=this._createAccessibilityTreeNode();this._rowElements.push(u),this._rowContainer.appendChild(u)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){var a;if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},r={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(r.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===r.node&&t.offset>r.offset)&&([t,r]=[r,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let i=this._rowElements.slice(-1)[0];if(r.node.compareDocumentPosition(i)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(r={node:i,offset:((a=i.textContent)==null?void 0:a.length)??0}),!this._rowContainer.contains(r.node))return;let n=({node:u,offset:c})=>{let h=u instanceof Text?u.parentNode:u,d=parseInt(h==null?void 0:h.getAttribute("aria-posinset"),10)-1;if(isNaN(d))return console.warn("row is invalid. Race condition?"),null;let f=this._rowColumns.get(h);if(!f)return console.warn("columns is null. Race condition?"),null;let p=c<f.length?f[c]:f.slice(-1)[0]+1;return p>=this._terminal.cols&&(++d,p=0),{row:d,column:p}},s=n(t),o=n(r);if(!(!s||!o)){if(s.row>o.row||s.row===o.row&&s.column>=o.column)throw new Error("invalid range");this._terminal.select(s.column,s.row,(o.row-s.row)*this._terminal.cols-s.column+o.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 n,s;e.style.transform="";let t=e.getBoundingClientRect().width,r=(s=(n=this._rowColumns.get(e))==null?void 0:n.slice(-1))==null?void 0:s[0];if(!r)return;let i=r*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${i/t})`}};xc=Fe([X(1,_p),X(2,bi),X(3,Ci)],xc);var Jd=class extends ce{constructor(e,t,r,i,n){super(),this._element=e,this._mouseService=t,this._renderService=r,this._bufferService=i,this._linkProviderService=n,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new q),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new q),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Me(()=>{var s;Yn(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(s=this._activeProviderReplies)==null||s.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(te(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(te(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(te(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(te(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let r=e.composedPath();for(let i=0;i<r.length;i++){let n=r[i];if(n.classList.contains("xterm"))break;if(n.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){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){var i,n;(!this._activeProviderReplies||!t)&&((i=this._activeProviderReplies)==null||i.forEach(s=>{s==null||s.forEach(o=>{o.link.dispose&&o.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let r=!1;for(let[s,o]of this._linkProviderService.linkProviders.entries())t?(n=this._activeProviderReplies)!=null&&n.get(s)&&(r=this._checkLinkProviderResult(s,e,r)):o.provideLinks(e.y,a=>{var c,h;if(this._isMouseOut)return;let u=a==null?void 0:a.map(d=>({link:d}));(c=this._activeProviderReplies)==null||c.set(s,u),r=this._checkLinkProviderResult(s,e,r),((h=this._activeProviderReplies)==null?void 0:h.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let r=new Set;for(let i=0;i<t.size;i++){let n=t.get(i);if(n)for(let s=0;s<n.length;s++){let o=n[s],a=o.link.range.start.y<e?0:o.link.range.start.x,u=o.link.range.end.y>e?this._bufferService.cols:o.link.range.end.x;for(let c=a;c<=u;c++){if(r.has(c)){n.splice(s--,1);break}r.add(c)}}}}_checkLinkProviderResult(e,t,r){var s;if(!this._activeProviderReplies)return r;let i=this._activeProviderReplies.get(e),n=!1;for(let o=0;o<e;o++)(!this._activeProviderReplies.has(o)||this._activeProviderReplies.get(o))&&(n=!0);if(!n&&i){let o=i.find(a=>this._linkAtPosition(a.link,t));o&&(r=!0,this._handleNewLink(o))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!r)for(let o=0;o<this._activeProviderReplies.size;o++){let a=(s=this._activeProviderReplies.get(o))==null?void 0:s.find(u=>this._linkAtPosition(u.link,t));if(a){r=!0,this._handleNewLink(a);break}}return r}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&zE(this._mouseDownLink.link,this._currentLink.link)&&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,Yn(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0: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 r,i;return(i=(r=this._currentLink)==null?void 0:r.state)==null?void 0:i.decorations.pointerCursor},set:r=>{var i;(i=this._currentLink)!=null&&i.state&&this._currentLink.state.decorations.pointerCursor!==r&&(this._currentLink.state.decorations.pointerCursor=r,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",r))}},underline:{get:()=>{var r,i;return(i=(r=this._currentLink)==null?void 0:r.state)==null?void 0:i.decorations.underline},set:r=>{var i,n,s;(i=this._currentLink)!=null&&i.state&&((s=(n=this._currentLink)==null?void 0:n.state)==null?void 0:s.decorations.underline)!==r&&(this._currentLink.state.decorations.underline=r,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,r))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(r=>{if(!this._currentLink)return;let i=r.start===0?0:r.start+1+this._bufferService.buffer.ydisp,n=this._bufferService.buffer.ydisp+1+r.end;if(this._currentLink.link.range.start.y>=i&&this._currentLink.link.range.end.y<=n&&(this._clearCurrentLink(i,n),this._lastMouseEvent)){let s=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);s&&this._askForLink(s,!1)}})))}_linkHover(e,t,r){var i;(i=this._currentLink)!=null&&i.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(r,t.text)}_fireUnderlineEvent(e,t){let r=e.range,i=this._bufferService.buffer.ydisp,n=this._createLinkUnderlineEvent(r.start.x-1,r.start.y-i-1,r.end.x,r.end.y-i-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(n)}_linkLeave(e,t,r){var i;(i=this._currentLink)!=null&&i.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(r,t.text)}_linkAtPosition(e,t){let r=e.range.start.y*this._bufferService.cols+e.range.start.x,i=e.range.end.y*this._bufferService.cols+e.range.end.x,n=t.y*this._bufferService.cols+t.x;return r<=n&&n<=i}_positionFromMouseEvent(e,t,r){let i=r.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(i)return{x:i[0],y:i[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,r,i,n){return{x1:e,y1:t,x2:r,y2:i,cols:this._bufferService.cols,fg:n}}};Jd=Fe([X(1,vp),X(2,Ci),X(3,Rt),X(4,Fx)],Jd);function zE(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var IE=class extends ME{constructor(e={}){super(e),this._linkifier=this._register(new Qs),this.browser=sw,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Qs),this._onCursorMove=this._register(new q),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new q),this.onKey=this._onKey.event,this._onRender=this._register(new q),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new q),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new q),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new q),this.onBell=this._onBell.event,this._onFocus=this._register(new q),this._onBlur=this._register(new q),this._onA11yCharEmitter=this._register(new q),this._onA11yTabEmitter=this._register(new q),this._onWillOpen=this._register(new q),this._setup(),this._decorationService=this._instantiationService.createInstance(LE),this._instantiationService.setService(Ta,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(jN),this._instantiationService.setService(Fx,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(yd)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh((t==null?void 0:t.start)??0,(t==null?void 0:t.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(dt.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(dt.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(dt.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(dt.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(Me(()=>{var t,r;this._customKeyEventHandler=void 0,(r=(t=this.element)==null?void 0:t.parentNode)==null||r.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}_handleColorEvent(e){if(this._themeService)for(let t of e){let r,i="";switch(t.index){case 256:r="foreground",i="10";break;case 257:r="background",i="11";break;case 258:r="cursor",i="12";break;default:r="ansi",i="4;"+t.index}switch(t.type){case 0:let n=ke.toColorRGB(r==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[r]);this.coreService.triggerDataEvent(`${z.ESC}]${i};${CE(n)}${iw.ST}`);break;case 1:if(r==="ansi")this._themeService.modifyColors(s=>s.ansi[t.index]=Ve.toColor(...t.color));else{let s=r;this._themeService.modifyColors(o=>o[s]=Ve.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_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(xc,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(z.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return(e=this.textarea)==null?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(z.ESC+"[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 r=Math.min(this.buffer.x,this.cols-1),i=this._renderService.dimensions.css.cell.height,n=t.getWidth(r),s=this._renderService.dimensions.css.cell.width*n,o=this.buffer.y*this._renderService.dimensions.css.cell.height,a=r*this._renderService.dimensions.css.cell.width;this.textarea.style.left=a+"px",this.textarea.style.top=o+"px",this.textarea.style.width=s+"px",this.textarea.style.height=i+"px",this.textarea.style.lineHeight=i+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(te(this.element,"copy",t=>{this.hasSelection()&&Wk(t,this._selectionService)}));let e=t=>Uk(t,this.textarea,this.coreService,this.optionsService);this._register(te(this.textarea,"paste",e)),this._register(te(this.element,"paste",e)),ow?this._register(te(this.element,"mousedown",t=>{t.button===2&&kg(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(te(this.element,"contextmenu",t=>{kg(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Np&&this._register(te(this.element,"auxclick",t=>{t.button===1&&Tx(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(te(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(te(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(te(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(te(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(te(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(te(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(te(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var n;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"),((n=this.element)==null?void 0:n.ownerDocument.defaultView)&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}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"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(te(this.screenElement,"mousemove",s=>this.updateCursorStyle(s))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let r=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",gd.get()),cw||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(NN,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(bi,this._coreBrowserService),this._register(te(this.textarea,"focus",s=>this._handleTextAreaFocus(s))),this._register(te(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Fd,this._document,this._helperContainer),this._instantiationService.setService(Qc,this._charSizeService),this._themeService=this._instantiationService.createInstance(Ud),this._instantiationService.setService(to,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(_c),this._instantiationService.setService(Ix,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance($d,this.rows,this.screenElement)),this._instantiationService.setService(Ci,this._renderService),this._register(this._renderService.onRenderedViewportChange(s=>this._onRender.fire(s))),this.onResize(s=>this._renderService.resize(s.cols,s.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(Bd,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Hd),this._instantiationService.setService(vp,this._mouseService);let i=this._linkifier.value=this._register(this._instantiationService.createInstance(Jd,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}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._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(Ad,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(s=>{super.scrollLines(s,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Wd,this.element,this.screenElement,i)),this._instantiationService.setService(Jk,this._selectionService),this._register(this._selectionService.onRequestScrollLines(s=>this.scrollLines(s.amount,s.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(s=>this._renderService.handleSelectionChanged(s.start,s.end,s.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(s=>{this.textarea.value=s,this.textarea.focus(),this.textarea.select()})),this._register(dt.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var s;this._selectionService.refresh(),(s=this._viewport)==null||s.queueSync()})),this._register(this._instantiationService.createInstance(Od,this.screenElement)),this._register(te(this.element,"mousedown",s=>this._selectionService.handleMouseDown(s))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(xc,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",s=>this._handleScreenReaderModeOptionChange(s))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(gc,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",s=>{!this._overviewRulerRenderer&&s&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(gc,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Id,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function r(s){var c,h,d,f,p;let o=e._mouseService.getMouseReportCoords(s,e.screenElement);if(!o)return!1;let a,u;switch(s.overrideType||s.type){case"mousemove":u=32,s.buttons===void 0?(a=3,s.button!==void 0&&(a=s.button<3?s.button:3)):a=s.buttons&1?0:s.buttons&4?1:s.buttons&2?2:3;break;case"mouseup":u=0,a=s.button<3?s.button:3;break;case"mousedown":u=1,a=s.button<3?s.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(s)===!1)return!1;let m=s.deltaY;if(m===0||e.coreMouseService.consumeWheelEvent(s,(f=(d=(h=(c=e._renderService)==null?void 0:c.dimensions)==null?void 0:h.device)==null?void 0:d.cell)==null?void 0:f.height,(p=e._coreBrowserService)==null?void 0:p.dpr)===0)return!1;u=m<0?0:1,a=4;break;default:return!1}return u===void 0||a===void 0||a>4?!1:e.coreMouseService.triggerMouseEvent({col:o.col,row:o.row,x:o.x,y:o.y,button:a,action:u,ctrl:s.ctrlKey,alt:s.altKey,shift:s.shiftKey})}let i={mouseup:null,wheel:null,mousedrag:null,mousemove:null},n={mouseup:s=>(r(s),s.buttons||(this._document.removeEventListener("mouseup",i.mouseup),i.mousedrag&&this._document.removeEventListener("mousemove",i.mousedrag)),this.cancel(s)),wheel:s=>(r(s),this.cancel(s,!0)),mousedrag:s=>{s.buttons&&r(s)},mousemove:s=>{s.buttons||r(s)}};this._register(this.coreMouseService.onProtocolChange(s=>{s?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(s)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),s&8?i.mousemove||(t.addEventListener("mousemove",n.mousemove),i.mousemove=n.mousemove):(t.removeEventListener("mousemove",i.mousemove),i.mousemove=null),s&16?i.wheel||(t.addEventListener("wheel",n.wheel,{passive:!1}),i.wheel=n.wheel):(t.removeEventListener("wheel",i.wheel),i.wheel=null),s&2?i.mouseup||(i.mouseup=n.mouseup):(this._document.removeEventListener("mouseup",i.mouseup),i.mouseup=null),s&4?i.mousedrag||(i.mousedrag=n.mousedrag):(this._document.removeEventListener("mousemove",i.mousedrag),i.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(te(t,"mousedown",s=>{if(s.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(s)))return r(s),i.mouseup&&this._document.addEventListener("mouseup",i.mouseup),i.mousedrag&&this._document.addEventListener("mousemove",i.mousedrag),this.cancel(s)})),this._register(te(t,"wheel",s=>{var o,a,u,c,h;if(!i.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(s)===!1)return!1;if(!this.buffer.hasScrollback){if(s.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(s,(c=(u=(a=(o=e._renderService)==null?void 0:o.dimensions)==null?void 0:a.device)==null?void 0:u.cell)==null?void 0:c.height,(h=e._coreBrowserService)==null?void 0:h.dpr)===0)return this.cancel(s,!0);let d=z.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(s.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(d,!0),this.cancel(s,!0)}}},{passive:!1}))}refresh(e,t){var r;(r=this._renderService)==null||r.refreshRows(e,t)}updateCursorStyle(e){var t;(t=this._selectionService)!=null&&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;t!==0&&this.scrollLines(t)}paste(e){Mx(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=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:!1}select(e,t,r){this._selectionService.setSelection(e,t,r)}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;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,t){var r;(r=this._selectionService)==null||r.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)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&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let r=RE(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),r.type===3||r.type===2){let i=this.rows-1;return this.scrollLines(r.type===2?-i:i),this.cancel(e,!0)}if(r.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(r.cancel&&this.cancel(e,!0),!r.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((r.key===z.ETX||r.key===z.CR)&&(this.textarea.value=""),this._onKey.fire({key:r.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(r.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let r=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 t.type==="keypress"?r:r&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(FE(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(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&&e.inputType==="insertText"&&(!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),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){var r;(r=this._charSizeService)==null||r.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(qe));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var t;this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),(t=this._selectionService)==null||t.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;(e=this._renderService)==null||e.clearTextureAtlas()}_reportFocus(){var e;(e=this.element)!=null&&e.classList.contains("focus")?this.coreService.triggerDataEvent(z.ESC+"[I"):this.coreService.triggerDataEvent(z.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),r=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${z.ESC}[4;${r};${t}t`);break;case 1:let i=this._renderService.dimensions.css.cell.width.toFixed(0),n=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${z.ESC}[6;${n};${i}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function FE(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var HE=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let r={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(r),t.dispose=()=>this._wrappedAddonDispose(r),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let r=0;r<this._addons.length;r++)if(this._addons[r]===e){t=r;break}if(t===-1)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)}},$E=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 gr)}translateToString(e,t,r){return this._line.translateToString(e,t,r)}},g_=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 $E(t)}getNullCell(){return new gr}},WE=class extends ce{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new q),this.onBufferChange=this._onBufferChange.event,this._normal=new g_(this._core.buffers.normal,"normal"),this._alternate=new g_(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},UE=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,r=>t(r.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(r,i)=>t(r,i.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)}},KE=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}},qE=["cols","rows"],Ir=0,VE=class extends ce{constructor(e){super(),this._core=this._register(new IE(e)),this._addonManager=this._register(new HE),this._publicOptions={...this._core.options};let t=i=>this._core.options[i],r=(i,n)=>{this._checkReadonlyOptions(i),this._core.options[i]=n};for(let i in this._core.options){let n={get:t.bind(this,i),set:r.bind(this,i)};Object.defineProperty(this._publicOptions,i,n)}}_checkReadonlyOptions(e){if(qE.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 element(){return this._core.element}get parser(){return this._parser||(this._parser=new UE(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new KE(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 WE(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}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,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}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._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,r){this._verifyIntegers(e,t,r),this._core.select(e,t,r)}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
371
+ `,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 gd.get()},set promptLabel(e){gd.set(e)},get tooMuchOutput(){return _d.get()},set tooMuchOutput(e){_d.set(e)}}}_verifyIntegers(...e){for(Ir of e)if(Ir===1/0||isNaN(Ir)||Ir%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Ir of e)if(Ir&&(Ir===1/0||isNaN(Ir)||Ir%1!==0||Ir<0))throw new Error("This API only accepts positive integers")}};/**
372
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
373
+ * @license MIT
374
+ *
375
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
376
+ * @license MIT
377
+ *
378
+ * Originally forked from (with the author's permission):
379
+ * Fabrice Bellard's javascript vt100 for jslinux:
380
+ * http://bellard.org/jslinux/
381
+ * Copyright (c) 2011 Fabrice Bellard
382
+ */var YE=2,XE=1,QE=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 d;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:((d=this._terminal.options.overviewRuler)==null?void 0:d.width)||14,r=window.getComputedStyle(this._terminal.element.parentElement),i=parseInt(r.getPropertyValue("height")),n=Math.max(0,parseInt(r.getPropertyValue("width"))),s=window.getComputedStyle(this._terminal.element),o={top:parseInt(s.getPropertyValue("padding-top")),bottom:parseInt(s.getPropertyValue("padding-bottom")),right:parseInt(s.getPropertyValue("padding-right")),left:parseInt(s.getPropertyValue("padding-left"))},a=o.top+o.bottom,u=o.right+o.left,c=i-a,h=n-u-t;return{cols:Math.max(YE,Math.floor(h/e.css.cell.width)),rows:Math.max(XE,Math.floor(c/e.css.cell.height))}}};function __(e,t){let r;return(...i)=>{r&&clearTimeout(r),r=setTimeout(()=>e(...i),t)}}function v_({sessionName:e,onDisconnect:t}){const r=F.useRef(null),i=F.useRef(null),n=F.useRef(null),s=F.useRef(null),o=F.useRef(0),a=F.useRef(null),u=5,[c,h]=F.useState(!0),d=F.useRef(t);d.current=t;const f=y=>Math.min(1e3*Math.pow(2,y),3e4),p=F.useCallback(()=>{if(!r.current||!e)return;a.current&&(clearTimeout(a.current),a.current=null);const y=r.current;if(y.clientWidth===0||y.clientHeight===0){console.warn("XTerminal: Container has no size, retrying in 100ms"),setTimeout(()=>p(),100);return}console.log("XTerminal: Creating terminal, container size:",y.clientWidth,"x",y.clientHeight);let C=i.current,g=n.current;C||(C=new VE({cursorBlink:!0,cursorStyle:"block",fontSize:14,fontFamily:'Menlo, Monaco, "Courier New", monospace',cols:120,rows:30,scrollback:1e4,convertEol:!0,scrollOnUserInput:!0,allowProposedApi:!0,theme:{background:"#1a1a2e",foreground:"#eaeaea",cursor:"#eaeaea",cursorAccent:"#1a1a2e",selectionBackground:"#3a3a5e",black:"#1a1a2e",red:"#ff5555",green:"#50fa7b",yellow:"#f1fa8c",blue:"#6272a4",magenta:"#ff79c6",cyan:"#8be9fd",white:"#f8f8f2",brightBlack:"#6272a4",brightRed:"#ff6e6e",brightGreen:"#69ff94",brightYellow:"#ffffa5",brightBlue:"#d6acff",brightMagenta:"#ff92df",brightCyan:"#a4ffff",brightWhite:"#ffffff"}}),g=new QE,C.loadAddon(g),C.open(r.current),g.fit(),i.current=C,n.current=g);const x=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.hostname}:3011/ws/terminal?session=${encodeURIComponent(e)}`,k=new WebSocket(x);s.current=k,k.onopen=()=>{console.log("XTerminal: WebSocket opened"),o.current=0,C.clear(),setTimeout(()=>{k.readyState===WebSocket.OPEN&&(g==null||g.fit(),console.log("XTerminal: After fit, size:",C.cols,"x",C.rows),k.send(JSON.stringify({type:"resize",cols:C.cols,rows:C.rows})))},100)},k.onmessage=j=>{const L=I=>{C.write(I),C.scrollToBottom()};typeof j.data=="string"?L(j.data):j.data instanceof ArrayBuffer?L(new Uint8Array(j.data)):j.data instanceof Blob&&j.data.text().then(I=>L(I))},k.onclose=j=>{var L,I;if(console.log("XTerminal: WebSocket closed",j.code,j.reason),!c||j.code===1e3){C.writeln(`\r
383
+ \x1B[33m● Session disconnected\x1B[0m`),(L=d.current)==null||L.call(d);return}if(o.current<u){const P=f(o.current);o.current+=1,C.writeln(`\r
384
+ \x1B[33m● Connection lost. Reconnecting in ${P/1e3}s (attempt ${o.current}/${u})...\x1B[0m`),a.current=setTimeout(()=>{p()},P)}else C.writeln(`\r
385
+ \x1B[31m● Connection lost after multiple attempts.\x1B[0m`),(I=d.current)==null||I.call(d)},k.onerror=j=>{console.error("WebSocket error:",j)},C.onData(j=>{k.readyState===WebSocket.OPEN&&k.send(j)}),C.onResize(({cols:j,rows:L})=>{k.readyState===WebSocket.OPEN&&k.send(JSON.stringify({type:"resize",cols:j,rows:L}))});const b=__(()=>{k.readyState===WebSocket.OPEN&&(g==null||g.fit())},200);return window.addEventListener("resize",b),()=>{window.removeEventListener("resize",b),h(!1),a.current&&clearTimeout(a.current),k.close(),C.dispose(),i.current=null,n.current=null}},[e,c]);F.useEffect(()=>{let y=!1,C;const g=setTimeout(()=>{y||(C=p())},50);return()=>{y=!0,clearTimeout(g),C==null||C()}},[p]),F.useEffect(()=>{const y=__(()=>{var g,_;((g=s.current)==null?void 0:g.readyState)===WebSocket.OPEN&&((_=n.current)==null||_.fit())},200),C=new ResizeObserver(y);return r.current&&C.observe(r.current),()=>{C.disconnect()}},[]);const m=()=>{var y;(y=i.current)==null||y.focus()};return l.jsx("div",{ref:r,className:"absolute inset-0",onClick:m,tabIndex:0,style:{padding:"8px",backgroundColor:"#1a1a2e",overflow:"hidden",outline:"none"}})}function GE({issue:e,isOpen:t,onClose:r,onComplete:i}){var O;const[n,s]=F.useState("checking"),[o,a]=F.useState(null),[u,c]=F.useState(null),[h,d]=F.useState(!1),[f,p]=F.useState({x:-1,y:-1}),[m,y]=F.useState({width:900,height:600}),C=F.useRef(!1),g=Lr(),_=ye({mutationFn:async()=>{const E=await fetch(`/api/issues/${e.identifier}/start-planning`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})});if(!E.ok){const A=await E.json();throw new Error(A.error||"Failed to start planning")}return E.json()},onSuccess:E=>{a(E),E.planningAgent.started?(C.current=!0,s("planning")):E.planningAgent.error&&(c(E.planningAgent.error),s("error"))},onError:E=>{c(E.message),s("error")}}),v=Pe({queryKey:["planningStatus",e.identifier],queryFn:async()=>{const E=await fetch(`/api/planning/${e.identifier}/status`);if(!E.ok)throw new Error("Failed to get status");return E.json()},enabled:n==="planning",refetchInterval:n==="planning"?2e3:!1}),x=ye({mutationFn:async()=>{const E=await fetch(`/api/planning/${e.identifier}`,{method:"DELETE"});if(!E.ok)throw new Error("Failed to stop planning");return E.json()},onSuccess:()=>{s("complete")}}),k=ye({mutationFn:async()=>{const E=await fetch(`/api/issues/${e.identifier}/abort-planning`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deleteWorkspace:!1})});if(!E.ok){const A=await E.json();throw new Error(A.error||"Failed to abort planning")}return E.json()},onSuccess:()=>{i(),r()},onError:E=>{c(E.message)}}),b=ye({mutationFn:async()=>{const E=await fetch("/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({issueId:e.identifier})});if(!E.ok){const A=await E.json();throw new Error(A.error||"Failed to start agent")}return E.json()},onSuccess:()=>{g.invalidateQueries({queryKey:["agents"]}),g.invalidateQueries({queryKey:["issues"]}),i(),r()},onError:E=>{c(`Failed to start agent: ${E.message}`)}});F.useEffect(()=>{t?(g.invalidateQueries({queryKey:["planningStatus",e.identifier]}),C.current=!1):(s("checking"),a(null),c(null),d(!1),C.current=!1)},[t,e.identifier,g]),F.useEffect(()=>{t&&n==="checking"&&fetch(`/api/planning/${e.identifier}/status`).then(E=>E.json()).then(E=>{E.active?(C.current=!0,s("planning")):s("ready")}).catch(()=>{s("ready")})},[t,e.identifier,n]),F.useEffect(()=>{n==="planning"&&v.data&&!v.data.active&&C.current&&s("complete")},[n,v.data]);const j=()=>{s("starting"),_.mutate()},L=()=>{x.mutate()},I=()=>{confirm(`Abort planning and return to Todo?
386
+
387
+ This will:
388
+ • Stop the planning agent
389
+ • Move the issue back to "Todo"
390
+ • Keep the workspace (can be deleted separately)
391
+
392
+ Any planning artifacts in the workspace will be preserved.`)&&k.mutate()},P=()=>{b.mutate()};if(!t)return null;const D=f.x===-1?(window.innerWidth-m.width)/2:f.x,M=f.y===-1?(window.innerHeight-m.height)/2:f.y,R=()=>{var A,U;const E=((A=o==null?void 0:o.workspace)==null?void 0:A.path)||((U=v.data)==null?void 0:U.workspacePath);return E?`${E}/docs/${e.identifier}-plan.md`:null};return l.jsxs("div",{className:"fixed inset-0 z-50",children:[!h&&l.jsx("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm",onClick:r}),h?l.jsxs("div",{className:"fixed bottom-4 right-4 bg-gray-800 rounded-lg shadow-2xl border border-gray-700 px-4 py-2 flex items-center gap-3 cursor-pointer hover:bg-gray-700 transition-colors",onClick:()=>d(!1),children:[l.jsx("div",{className:"w-6 h-6 rounded bg-gradient-to-br from-purple-500 to-blue-500 flex items-center justify-center",children:l.jsx(pd,{className:"w-3 h-3 text-white"})}),l.jsxs("span",{className:"text-sm text-white font-medium",children:["Plan: ",e.identifier]}),n==="planning"&&l.jsx("span",{className:"w-2 h-2 bg-purple-400 rounded-full animate-pulse"})]}):l.jsx(zk,{position:{x:D,y:M},size:m,onDragStop:(E,A)=>p({x:A.x,y:A.y}),onResizeStop:(E,A,U,T,$)=>{y({width:U.offsetWidth,height:U.offsetHeight}),p({x:$.x,y:$.y})},minWidth:600,minHeight:400,bounds:"window",dragHandleClassName:"drag-handle",enableResizing:{top:!0,right:!0,bottom:!0,left:!0,topRight:!0,bottomRight:!0,bottomLeft:!0,topLeft:!0},children:l.jsxs("div",{className:"w-full h-full bg-gray-800 rounded-xl shadow-2xl border border-gray-700 overflow-hidden flex flex-col",children:[l.jsxs("div",{className:"drag-handle flex items-center justify-between px-6 py-4 border-b border-gray-700 cursor-move",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("div",{className:"w-10 h-10 rounded-lg bg-gradient-to-br from-purple-500 to-blue-500 flex items-center justify-center",children:l.jsx(pd,{className:"w-5 h-5 text-white"})}),l.jsxs("div",{children:[l.jsxs("h2",{className:"text-lg font-semibold text-white",children:["Plan: ",e.identifier]}),l.jsx("p",{className:"text-sm text-gray-400 line-clamp-1",children:e.title})]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[n==="planning"&&l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:"flex items-center gap-1.5 px-2 py-1 bg-purple-500/20 text-purple-400 text-xs rounded-full",children:[l.jsx("span",{className:"w-2 h-2 bg-purple-400 rounded-full animate-pulse"}),"Planning Active"]}),l.jsxs("button",{onClick:L,disabled:x.isPending,className:"flex items-center gap-1 px-3 py-1.5 bg-red-600 hover:bg-red-500 text-white text-sm font-medium rounded-lg transition-colors disabled:opacity-50",title:"Stop the planning agent",children:[l.jsx(Uc,{className:"w-4 h-4"}),"Stop"]})]}),l.jsx("button",{onClick:()=>d(!0),className:"p-2 text-gray-400 hover:text-white hover:bg-gray-700 rounded-lg transition-colors",title:"Minimize",children:l.jsx(TC,{className:"w-5 h-5"})}),l.jsx("button",{onClick:r,className:"p-2 text-gray-400 hover:text-white hover:bg-gray-700 rounded-lg transition-colors",title:"Close",children:l.jsx(Mr,{className:"w-5 h-5"})})]})]}),l.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[n==="checking"&&l.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-8",children:[l.jsx(Ne,{className:"w-12 h-12 text-purple-400 animate-spin mb-4"}),l.jsx("p",{className:"text-gray-300",children:"Checking session status..."})]}),n==="ready"&&l.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-8",children:[l.jsx("div",{className:"w-20 h-20 rounded-2xl bg-gradient-to-br from-purple-500/20 to-blue-500/20 border border-purple-500/30 flex items-center justify-center mb-6",children:l.jsx(cn,{className:"w-10 h-10 text-purple-400"})}),["In Planning","Planning","Planned","Discovery"].includes(e.status)?l.jsxs(l.Fragment,{children:[l.jsx("h3",{className:"text-xl font-semibold text-white mb-2",children:"Resume Planning Session"}),l.jsxs("p",{className:"text-gray-400 text-center max-w-md mb-6",children:["This issue is in ",l.jsx("span",{className:"text-purple-400 font-medium",children:'"In Planning"'})," state. You can resume planning or abort to return to Todo."]}),l.jsxs("div",{className:"bg-gray-700/50 rounded-lg p-4 mb-6 max-w-md w-full",children:[l.jsx("h4",{className:"text-sm font-medium text-gray-300 mb-2",children:"Options:"}),l.jsxs("ul",{className:"space-y-2 text-sm text-gray-400",children:[l.jsxs("li",{className:"flex items-center gap-2",children:[l.jsx(Pr,{className:"w-4 h-4 text-purple-400"}),l.jsxs("span",{children:[l.jsx("strong",{className:"text-purple-400",children:"Resume"})," - Start a new planning agent session"]})]}),l.jsxs("li",{className:"flex items-center gap-2",children:[l.jsx(Mr,{className:"w-4 h-4 text-orange-400"}),l.jsxs("span",{children:[l.jsx("strong",{className:"text-orange-400",children:"Abort"})," - Return issue to Todo (keeps workspace)"]})]})]})]}),l.jsxs("div",{className:"flex gap-3",children:[l.jsxs("button",{onClick:I,disabled:k.isPending,className:"flex items-center gap-2 px-5 py-3 bg-orange-600/20 hover:bg-orange-600/30 text-orange-400 rounded-lg transition-colors font-medium disabled:opacity-50",children:[l.jsx(Mr,{className:"w-5 h-5"}),k.isPending?"Aborting...":"Abort Planning"]}),l.jsxs("button",{onClick:j,className:"flex items-center gap-2 px-6 py-3 bg-purple-600 hover:bg-purple-500 text-white rounded-lg transition-colors font-medium",children:[l.jsx(Pr,{className:"w-5 h-5"}),"Resume Planning"]})]})]}):l.jsxs(l.Fragment,{children:[l.jsx("h3",{className:"text-xl font-semibold text-white mb-2",children:"Start Planning Session"}),l.jsxs("p",{className:"text-gray-400 text-center max-w-md mb-6",children:["This will move the issue to ",l.jsx("span",{className:"text-purple-400 font-medium",children:'"In Planning"'}),", create a workspace, and start an AI discovery session to help define the implementation plan."]}),l.jsxs("div",{className:"bg-gray-700/50 rounded-lg p-4 mb-6 max-w-md w-full",children:[l.jsx("h4",{className:"text-sm font-medium text-gray-300 mb-2",children:"What happens:"}),l.jsxs("ul",{className:"space-y-2 text-sm text-gray-400",children:[l.jsxs("li",{className:"flex items-center gap-2",children:[l.jsx(_o,{className:"w-4 h-4 text-green-400"}),'Issue moves to "In Planning" in Linear']}),l.jsxs("li",{className:"flex items-center gap-2",children:[l.jsx(_o,{className:"w-4 h-4 text-green-400"}),"Git worktree created for feature branch"]}),l.jsxs("li",{className:"flex items-center gap-2",children:[l.jsx(_o,{className:"w-4 h-4 text-green-400"}),"Opus agent starts discovery conversation"]})]})]}),l.jsxs("button",{onClick:j,className:"flex items-center gap-2 px-6 py-3 bg-purple-600 hover:bg-purple-500 text-white rounded-lg transition-colors font-medium",children:[l.jsx(Pr,{className:"w-5 h-5"}),"Start Planning"]})]})]}),n==="starting"&&l.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-8",children:[l.jsx(Ne,{className:"w-12 h-12 text-purple-400 animate-spin mb-4"}),l.jsx("p",{className:"text-gray-300",children:"Starting planning session..."}),l.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"Moving to In Planning, creating workspace, spawning agent"})]}),n==="planning"&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"flex-1 bg-black relative overflow-hidden",style:{minHeight:"400px"},children:o!=null&&o.planningAgent.sessionName?l.jsx(v_,{sessionName:o.planningAgent.sessionName,onDisconnect:()=>{v.refetch().then(({data:E})=>{E!=null&&E.active||s("complete")})}}):(O=v.data)!=null&&O.sessionName?l.jsx(v_,{sessionName:v.data.sessionName,onDisconnect:()=>{v.refetch().then(({data:E})=>{E!=null&&E.active||s("complete")})}}):l.jsx("div",{className:"flex items-center justify-center h-full",children:l.jsxs("div",{className:"flex items-center gap-2 text-gray-500",children:[l.jsx(Ne,{className:"w-4 h-4 animate-spin"}),"Connecting to terminal..."]})})}),l.jsxs("div",{className:"border-t border-gray-700 px-4 py-2 flex items-center justify-between bg-gray-800",children:[l.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-400",children:[l.jsx(cn,{className:"w-4 h-4"}),"Interactive planning session"]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("button",{onClick:I,disabled:k.isPending,className:"flex items-center gap-1 px-3 py-1 bg-orange-600/20 hover:bg-orange-600/30 text-orange-400 text-sm rounded transition-colors disabled:opacity-50",title:"Stop planning and return to Todo",children:[l.jsx(Mr,{className:"w-4 h-4"}),"Abort"]}),l.jsxs("button",{onClick:()=>{x.mutate(),v.refetch()},disabled:x.isPending,className:"flex items-center gap-1 px-3 py-1 bg-green-600/20 hover:bg-green-600/30 text-green-400 text-sm rounded transition-colors disabled:opacity-50",title:"Done - mark planning complete",children:[l.jsx(_o,{className:"w-4 h-4"}),"Done"]})]})]})]}),n==="complete"&&l.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-8",children:[l.jsx("div",{className:"w-16 h-16 rounded-full bg-green-500/20 flex items-center justify-center mb-4",children:l.jsx(_o,{className:"w-10 h-10 text-green-400"})}),l.jsx("h3",{className:"text-xl font-semibold text-white mb-2",children:"Planning Complete"}),l.jsx("p",{className:"text-gray-400 text-center max-w-md mb-6",children:"The planning session has ended. Review the plan and start the execution agent."}),R()&&l.jsx("div",{className:"bg-purple-500/10 border border-purple-500/30 rounded-lg p-4 mb-6 max-w-md w-full",children:l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(Ml,{className:"w-8 h-8 text-purple-400"}),l.jsxs("div",{className:"flex-1",children:[l.jsx("p",{className:"text-sm text-gray-300 font-medium",children:"Feature Plan"}),l.jsx("p",{className:"text-xs text-gray-500 font-mono truncate",children:R()})]}),l.jsxs("a",{href:`vscode://file${R()}`,className:"flex items-center gap-1 px-3 py-1.5 bg-purple-600 hover:bg-purple-500 text-white text-sm rounded-lg transition-colors",title:"Open in VS Code",children:[l.jsx(Wc,{className:"w-4 h-4"}),"Open"]})]})}),o&&l.jsxs("div",{className:"bg-gray-700/50 rounded-lg p-4 mb-6 max-w-md w-full",children:[l.jsx("p",{className:"text-sm text-gray-400 mb-2",children:"Summary:"}),l.jsxs("ul",{className:"space-y-1 text-sm",children:[l.jsxs("li",{className:"text-gray-300",children:[l.jsx("span",{className:"text-gray-500",children:"Issue:"})," ",o.issue.identifier]}),l.jsxs("li",{className:"text-gray-300",children:[l.jsx("span",{className:"text-gray-500",children:"State:"})," ",l.jsx("span",{className:"text-purple-400",children:o.issue.newState})]}),o.workspace.created&&l.jsxs("li",{className:"text-gray-300",children:[l.jsx("span",{className:"text-gray-500",children:"Workspace:"})," ",l.jsx("span",{className:"text-blue-400 font-mono text-xs",children:o.workspace.path})]})]})]}),l.jsxs("div",{className:"flex gap-3",children:[l.jsx("button",{onClick:r,disabled:b.isPending,className:"px-4 py-2 bg-gray-700 hover:bg-gray-600 text-white rounded-lg transition-colors disabled:opacity-50",children:"Close"}),l.jsxs("button",{onClick:P,disabled:b.isPending,className:"flex items-center gap-2 px-4 py-2 bg-blue-600 hover:bg-blue-500 text-white rounded-lg transition-colors disabled:opacity-50",children:[b.isPending?l.jsx(Ne,{className:"w-5 h-5 animate-spin"}):l.jsx(Pr,{className:"w-5 h-5"}),b.isPending?"Starting Agent...":"Start Agent"]})]})]}),n==="error"&&l.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-8",children:[l.jsx("div",{className:"w-16 h-16 rounded-full bg-red-500/20 flex items-center justify-center mb-4",children:l.jsx(Fc,{className:"w-10 h-10 text-red-400"})}),l.jsx("h3",{className:"text-xl font-semibold text-white mb-2",children:"Planning Failed"}),l.jsx("p",{className:"text-red-400 text-center max-w-md mb-6",children:u}),l.jsxs("div",{className:"flex gap-3",children:[l.jsx("button",{onClick:r,className:"px-4 py-2 bg-gray-700 hover:bg-gray-600 text-white rounded-lg transition-colors",children:"Close"}),l.jsx("button",{onClick:()=>{s("ready"),c(null)},className:"px-4 py-2 bg-purple-600 hover:bg-purple-500 text-white rounded-lg transition-colors",children:"Try Again"})]})]})]})]})})]})}async function JE(){try{const e=await fetch("/api/costs/by-issue");if(!e.ok)return{};const t=await e.json(),r={};for(const i of t.issues||[])r[i.issueId.toLowerCase()]=i;return r}catch{return{}}}function ZE(e){return e>=100?`$${e.toFixed(0)}`:e>=10?`$${e.toFixed(1)}`:e>=1?`$${e.toFixed(2)}`:e>0?`$${e.toFixed(2)}`:""}function e4(e){return e>=50?"bg-red-900/50 text-red-400":e>=20?"bg-orange-900/50 text-orange-400":e>=5?"bg-yellow-900/50 text-yellow-400":"bg-green-900/50 text-green-400"}async function t4(e="current",t=!1){const r=new URLSearchParams;r.set("cycle",e),t&&r.set("includeCompleted","true");const i=await fetch(`/api/issues?${r}`);if(!i.ok)throw new Error("Failed to fetch issues");return i.json()}async function r4(){const e=await fetch("/api/agents");if(!e.ok)throw new Error("Failed to fetch agents");return e.json()}function i4(e){const t={backlog:[],todo:[],planning:[],in_progress:[],in_review:[],done:[]};for(const r of e){const i=yn[r.status]||"backlog";i==="canceled"?t.done.push(r):t[i]?t[i].push(r):t.backlog.push(r)}return t}const y_={backlog:"border-gray-600",todo:"border-blue-600",planning:"border-purple-600",in_progress:"border-yellow-500",in_review:"border-pink-500",done:"border-green-500"},n4={backlog:"Backlog",todo:"To Do",planning:"Planning",in_progress:"In Progress",in_review:"In Review",done:"Done"};function s4({selectedIssue:e,onSelectIssue:t}){const r=Lr(),[i,n]=F.useState(null),[s,o]=F.useState(new Set),[a,u]=F.useState(null),[c,h]=F.useState(null),[d,f]=F.useState("current"),[p,m]=F.useState(!1),y=e!==void 0?e:i,C=t||n,{data:g,isLoading:_,error:v}=Pe({queryKey:["issues",d,p],queryFn:()=>t4(d,p)}),{data:x=[]}=Pe({queryKey:["agents"],queryFn:r4,refetchInterval:5e3}),{data:k={}}=Pe({queryKey:["issueCosts"],queryFn:JE,refetchInterval:3e4,staleTime:1e4}),b=F.useMemo(()=>{if(!g)return[];const P=new Map;for(const D of g)D.project&&!P.has(D.project.id)&&P.set(D.project.id,D.project);return Array.from(P.values()).sort((D,M)=>D.name.localeCompare(M.name))},[g]),j=F.useMemo(()=>g?s.size===0?g:g.filter(P=>P.project&&s.has(P.project.id)):[],[g,s]),L=P=>{o(D=>{const M=new Set(D);return M.has(P)?M.delete(P):M.add(P),M})};if(_)return l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center gap-2 animate-pulse",children:[l.jsx("div",{className:"w-4 h-4 bg-gray-700 rounded"}),l.jsx("div",{className:"w-16 h-4 bg-gray-700 rounded"}),l.jsx("div",{className:"w-24 h-6 bg-gray-700 rounded"}),l.jsx("div",{className:"w-20 h-6 bg-gray-700 rounded"}),l.jsx("div",{className:"w-28 h-6 bg-gray-700 rounded"})]}),l.jsx("div",{className:"flex gap-4 overflow-x-auto pb-4",children:pg.map(P=>l.jsx("div",{className:"flex-shrink-0 w-80",children:l.jsxs("div",{className:`border-t-4 ${y_[P]} bg-gray-800 rounded-lg`,children:[l.jsx("div",{className:"px-4 py-3 border-b border-gray-700",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("div",{className:"h-5 bg-gray-700 rounded w-24 animate-pulse"}),l.jsx("div",{className:"h-4 bg-gray-700 rounded w-6 animate-pulse"})]})}),l.jsx("div",{className:"p-2 space-y-2",children:[1,2,3].map(D=>l.jsxs("div",{className:"bg-gray-700 rounded-lg p-3 border-l-4 border-l-gray-600 animate-pulse",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx("div",{className:"w-2 h-2 bg-gray-600 rounded-full"}),l.jsx("div",{className:"h-4 bg-gray-600 rounded w-16"})]}),l.jsx("div",{className:"h-4 bg-gray-600 rounded w-full mb-1"}),l.jsx("div",{className:"h-4 bg-gray-600 rounded w-3/4"}),l.jsxs("div",{className:"flex gap-2 mt-3",children:[l.jsx("div",{className:"h-5 bg-gray-600 rounded w-16"}),l.jsx("div",{className:"h-5 bg-gray-600 rounded w-12"})]})]},D))})]})},P))})]});if(v)return l.jsx("div",{className:"flex items-center justify-center h-64",children:l.jsxs("div",{className:"text-red-400",children:["Error loading issues: ",v.message]})});const I=i4(j);return l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center gap-4 flex-wrap",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(bC,{className:"w-4 h-4 text-gray-400"}),l.jsx("span",{className:"text-sm text-gray-400",children:"Cycle:"}),l.jsx("div",{className:"flex rounded-lg overflow-hidden border border-gray-600",children:["current","all","backlog"].map(P=>l.jsx("button",{onClick:()=>f(P),className:`px-3 py-1 text-xs transition-colors ${d===P?"bg-blue-600 text-white":"bg-gray-800 text-gray-400 hover:text-white hover:bg-gray-700"}`,children:P==="current"?"Current":P==="all"?"All":"Backlog"},P))})]}),l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:p,onChange:P=>m(P.target.checked),className:"w-4 h-4 rounded border-gray-600 bg-gray-800 text-blue-600 focus:ring-blue-500 focus:ring-offset-gray-900"}),l.jsx("span",{className:"text-sm text-gray-400",children:"Include completed"})]}),l.jsxs("span",{className:"text-sm text-gray-500",children:[(g==null?void 0:g.length)||0," issues"]}),b.length>1&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"w-px h-6 bg-gray-700"}),l.jsx("span",{className:"text-sm text-gray-400",children:"Projects:"}),b.map(P=>l.jsxs("button",{onClick:()=>L(P.id),className:`flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors ${s.size===0||s.has(P.id)?"bg-gray-700 text-white":"bg-gray-800 text-gray-500 hover:text-gray-300"}`,children:[l.jsx("span",{className:"w-2.5 h-2.5 rounded-full",style:{backgroundColor:P.color||"#6b7280"}}),P.name]},P.id)),s.size>0&&l.jsx("button",{onClick:()=>o(new Set),className:"text-xs text-gray-400 hover:text-white",children:"Clear"})]})]}),l.jsx("div",{className:"flex gap-4 overflow-x-auto pb-4",children:pg.map(P=>l.jsx("div",{className:"flex-shrink-0 w-80",children:l.jsxs("div",{className:`border-t-4 ${y_[P]} bg-gray-800 rounded-lg`,children:[l.jsx("div",{className:"px-4 py-3 border-b border-gray-700",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("h3",{className:"font-semibold text-white",children:n4[P]}),l.jsx("span",{className:"text-sm text-gray-400",children:I[P].length})]})}),l.jsxs("div",{className:"p-2 space-y-2 max-h-[calc(100vh-220px)] overflow-y-auto",children:[I[P].map(D=>{const M=x.find(R=>{var O;return((O=R.issueId)==null?void 0:O.toLowerCase())===D.identifier.toLowerCase()});return l.jsx(a4,{issue:D,agent:M,cost:k[D.identifier.toLowerCase()],isSelected:y===D.identifier,onSelect:()=>C(y===D.identifier?null:D.identifier),onPlan:()=>u(D),onViewBeads:R=>h(R)},D.id)}),I[P].length===0&&l.jsx("div",{className:"text-center text-gray-500 py-8 text-sm",children:"No issues"})]})]})},P))}),a&&l.jsx(GE,{issue:a,isOpen:!0,onClose:()=>u(null),onComplete:()=>{u(null),r.invalidateQueries({queryKey:["issues"]})}}),c&&l.jsx(o4,{issue:c,onClose:()=>h(null)})]})}function o4({issue:e,onClose:t}){var s,o;const{data:r,isLoading:i,error:n}=Pe({queryKey:["beads",e.identifier],queryFn:async()=>{const a=await fetch(`/api/issues/${e.identifier}/beads`);if(!a.ok)throw new Error("Failed to fetch tasks");return a.json()}});return l.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[l.jsx("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm",onClick:t}),l.jsxs("div",{className:"relative bg-gray-800 rounded-xl shadow-2xl w-full max-w-lg mx-4 max-h-[70vh] overflow-hidden flex flex-col",children:[l.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-700",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(ux,{className:"w-5 h-5 text-green-400"}),l.jsxs("h2",{className:"font-semibold text-white",children:["Tasks: ",e.identifier]})]}),l.jsx("button",{onClick:t,className:"p-1 text-gray-400 hover:text-white hover:bg-gray-700 rounded transition-colors",children:l.jsx(Mr,{className:"w-5 h-5"})})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[i&&l.jsxs("div",{className:"flex items-center justify-center py-8 text-gray-400",children:[l.jsx(Ne,{className:"w-5 h-5 animate-spin mr-2"}),"Loading tasks..."]}),n&&l.jsx("div",{className:"text-red-400 text-center py-8",children:"Failed to load tasks"}),r&&((s=r.tasks)==null?void 0:s.length)===0&&l.jsx("div",{className:"text-gray-500 text-center py-8",children:"No tasks created yet"}),r&&((o=r.tasks)==null?void 0:o.length)>0&&l.jsx("div",{className:"space-y-2",children:r.tasks.map(a=>l.jsxs("div",{className:`flex items-start gap-3 p-3 rounded-lg ${a.status==="closed"?"bg-green-900/20":a.status==="in_progress"?"bg-blue-900/20":"bg-gray-700/50"}`,children:[l.jsx("div",{className:`mt-0.5 ${a.status==="closed"?"text-green-400":a.status==="in_progress"?"text-blue-400":"text-gray-400"}`,children:a.status==="closed"?l.jsx(Pa,{className:"w-4 h-4"}):a.status==="in_progress"?l.jsx(Ne,{className:"w-4 h-4 animate-spin"}):l.jsx("div",{className:"w-4 h-4 border-2 border-current rounded-full"})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-sm text-white",children:a.title}),l.jsxs("div",{className:"text-xs text-gray-500 mt-1",children:[a.id," · ",a.status]})]})]},a.id))})]}),l.jsxs("div",{className:"px-4 py-3 border-t border-gray-700 text-xs text-gray-500",children:[(r==null?void 0:r.count)||0," task",(r==null?void 0:r.count)!==1?"s":""," · Beads"]})]})]})}function a4({issue:e,agent:t,cost:r,isSelected:i,onSelect:n,onPlan:s,onViewBeads:o}){const a=Lr(),u=t&&t.status!=="dead",[c,h]=F.useState(!1),[d,f]=F.useState(!1),p={0:"border-l-gray-500",1:"border-l-red-500",2:"border-l-orange-500",3:"border-l-yellow-500",4:"border-l-blue-500"},m=ye({mutationFn:async E=>{const A=await fetch(`/api/agents/${E}`,{method:"DELETE"});if(!A.ok)throw new Error("Failed to kill agent");return A.json()},onSuccess:()=>{a.invalidateQueries({queryKey:["agents"]})}}),[y,C]=F.useState(""),[g,_]=F.useState(!1),v=ye({mutationFn:async({agentId:E,message:A})=>{const U=await fetch(`/api/agents/${E}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:A})});if(!U.ok)throw new Error("Failed to send message");return U.json()},onSuccess:()=>{C(""),_(!1)}}),x=E=>{E.stopPropagation(),t&&confirm(`Kill agent ${t.id}?`)&&m.mutate(t.id)},k=E=>{E.stopPropagation(),n()},b=E=>{E.stopPropagation(),_(!g)},j=E=>{E.preventDefault(),E.stopPropagation(),t&&y.trim()&&v.mutate({agentId:t.id,message:y.trim()})},L=ye({mutationFn:async()=>{const E=await fetch("/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({issueId:e.identifier})});if(!E.ok){const A=await E.json();throw new Error(A.error||"Failed to start agent")}return E.json()},onSuccess:()=>{a.invalidateQueries({queryKey:["agents"]}),a.invalidateQueries({queryKey:["issues"]})},onError:E=>{alert(`Failed to start agent: ${E.message}`)}}),I=E=>{E.stopPropagation(),confirm(`Start agent for ${e.identifier}?`)&&L.mutate()},P=E=>{E.stopPropagation(),s()},D=ye({mutationFn:async E=>{const A=await fetch(`/api/issues/${e.identifier}/abort-planning`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deleteWorkspace:E.deleteWorkspace})});if(!A.ok){const U=await A.json();throw new Error(U.error||"Failed to abort planning")}return A.json()},onSuccess:()=>{h(!1),f(!1),a.invalidateQueries({queryKey:["issues"]})}}),M=E=>{E.stopPropagation(),h(!0)},R=E=>{E.stopPropagation(),D.mutate({deleteWorkspace:d})},O=E=>{E.stopPropagation(),h(!1),f(!1)};return l.jsxs("div",{onClick:n,className:`bg-gray-700 rounded-lg p-3 border-l-4 cursor-pointer transition-all ${p[e.priority]||"border-l-gray-500"} ${i?"ring-2 ring-blue-500 bg-gray-650":"hover:bg-gray-650"} ${u?"bg-blue-900/20":""}`,children:[l.jsx("div",{className:"flex items-start justify-between gap-2",children:l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[e.project&&l.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:e.project.color||"#6b7280"},title:e.project.name}),u&&l.jsxs("div",{className:"flex gap-0.5",children:[l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-blue-400 animate-pulse",style:{animationDelay:"0ms"}}),l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-blue-400 animate-pulse",style:{animationDelay:"150ms"}}),l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-blue-400 animate-pulse",style:{animationDelay:"300ms"}})]}),l.jsxs("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",onClick:E=>E.stopPropagation(),className:"text-sm font-medium text-white hover:text-blue-400 flex items-center gap-1",children:[e.source==="github"&&l.jsx("span",{title:"GitHub Issue",children:l.jsx(NC,{className:"w-3 h-3 text-gray-400"})}),l.jsx("span",{className:"text-gray-400",children:e.identifier}),l.jsx(Wc,{className:"w-3 h-3 opacity-50"})]}),t&&l.jsx("span",{className:"text-xs text-blue-400",children:t.model}),r&&r.totalCost>0&&l.jsxs("span",{className:`ml-auto px-1.5 py-0.5 rounded text-xs font-medium ${e4(r.totalCost)}`,title:`${(r.tokenCount/1e6).toFixed(2)}M tokens${r.model?` • ${r.model.replace("claude-","").replace(/-20[0-9]{6}$/,"")}`:""}${r.durationMinutes?` • ${Math.round(r.durationMinutes)}min`:""}`,children:[l.jsx($c,{className:"w-3 h-3 inline -mt-0.5"}),ZE(r.totalCost).slice(1)]})]}),l.jsx("p",{className:"text-sm text-gray-300 mt-1 line-clamp-2",children:e.title})]})}),l.jsxs("div",{className:"flex items-center gap-2 mt-2 flex-wrap",children:[e.assignee&&l.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-gray-400",children:[l.jsx(px,{className:"w-3 h-3"}),e.assignee.name.split(" ")[0]]}),e.labels.slice(0,2).map(E=>l.jsxs("span",{className:"inline-flex items-center gap-1 text-xs bg-gray-600 text-gray-300 px-2 py-0.5 rounded",children:[l.jsx(fx,{className:"w-3 h-3"}),E]},E))]}),u&&l.jsxs("div",{className:`flex items-center gap-3 mt-3 pt-3 border-t ${(t==null?void 0:t.type)==="planning"?"border-purple-600/50":"border-gray-600"}`,children:[l.jsxs("button",{onClick:(t==null?void 0:t.type)==="planning"?P:k,className:`flex items-center gap-1 text-xs transition-colors ${(t==null?void 0:t.type)==="planning"?"text-purple-400 hover:text-purple-300":i?"text-blue-400":"text-gray-400 hover:text-white"}`,children:[(t==null?void 0:t.type)==="planning"?l.jsx(pd,{className:"w-3.5 h-3.5"}):l.jsx(cx,{className:"w-3.5 h-3.5"}),(t==null?void 0:t.type)==="planning"?"Continue Planning":"Watch"]}),l.jsxs("button",{onClick:b,className:`flex items-center gap-1 text-xs transition-colors ${g?"text-blue-400":"text-gray-400 hover:text-white"}`,children:[l.jsx(PC,{className:"w-3.5 h-3.5"}),"Tell"]}),l.jsxs("button",{onClick:x,disabled:m.isPending,className:"flex items-center gap-1 text-xs text-red-400 hover:text-red-300 transition-colors ml-auto",children:[m.isPending?l.jsx(Ne,{className:"w-3.5 h-3.5 animate-spin"}):l.jsx(Mr,{className:"w-3.5 h-3.5"}),"Kill"]})]}),g&&t&&l.jsx("form",{onSubmit:j,className:"mt-2",onClick:E=>E.stopPropagation(),children:l.jsxs("div",{className:"flex gap-2",children:[l.jsx("input",{type:"text",value:y,onChange:E=>C(E.target.value),placeholder:"Type a message...",className:"flex-1 bg-gray-800 text-white text-sm px-3 py-1.5 rounded border border-gray-600 focus:border-blue-500 focus:outline-none",autoFocus:!0}),l.jsx("button",{type:"submit",disabled:!y.trim()||v.isPending,className:"px-3 py-1.5 bg-blue-600 text-white text-sm rounded hover:bg-blue-500 disabled:opacity-50 disabled:cursor-not-allowed",children:v.isPending?"...":"Send"})]})}),!u&&(yn[e.status]==="backlog"||yn[e.status]==="todo")&&l.jsxs("div",{className:"flex items-center gap-3 mt-3 pt-3 border-t border-gray-600",children:[l.jsxs("button",{onClick:P,className:"flex items-center gap-1 text-xs text-purple-400 hover:text-purple-300 transition-colors",children:[l.jsx(Ml,{className:"w-3.5 h-3.5"}),"Plan"]}),l.jsxs("button",{onClick:I,disabled:L.isPending,className:"flex items-center gap-1 text-xs text-gray-500 hover:text-gray-400 transition-colors disabled:opacity-50",title:"Plan first recommended",children:[L.isPending?l.jsx(Ne,{className:"w-3.5 h-3.5 animate-spin"}):l.jsx(Pr,{className:"w-3.5 h-3.5"}),L.isPending?"Starting...":"Start Agent"]})]}),!u&&yn[e.status]==="planning"&&l.jsxs("div",{className:"flex items-center gap-3 mt-3 pt-3 border-t border-purple-600/50 flex-wrap",children:[l.jsxs("button",{onClick:P,className:"flex items-center gap-1 text-xs text-purple-400 hover:text-purple-300 transition-colors",children:[l.jsx(Ml,{className:"w-3.5 h-3.5"}),"Resume Planning"]}),l.jsxs("button",{onClick:()=>o&&o(e),className:"flex items-center gap-1 text-xs text-green-400 hover:text-green-300 transition-colors",title:"View tasks created during planning",children:[l.jsx(ux,{className:"w-3.5 h-3.5"}),"Tasks"]}),l.jsxs("button",{onClick:I,className:"flex items-center gap-1 text-xs text-blue-400 hover:text-blue-300 transition-colors",children:[l.jsx(Pr,{className:"w-3.5 h-3.5"}),"Start Agent"]}),l.jsxs("button",{onClick:M,disabled:D.isPending,className:"flex items-center gap-1 text-xs text-orange-400 hover:text-orange-300 transition-colors disabled:opacity-50",title:"Return to Todo",children:[l.jsx(Mr,{className:"w-3.5 h-3.5"}),D.isPending?"Aborting...":"Abort"]})]}),c&&l.jsxs("div",{className:"mt-3 pt-3 border-t border-orange-600/50 bg-orange-950/30 -mx-3 -mb-3 px-3 pb-3 rounded-b-lg",children:[l.jsx("p",{className:"text-xs text-orange-300 mb-2",children:"Abort planning and return to Todo?"}),l.jsxs("label",{className:"flex items-center gap-2 text-xs text-gray-400 mb-3 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:d,onChange:E=>f(E.target.checked),onClick:E=>E.stopPropagation(),className:"rounded border-gray-600 bg-gray-700 text-orange-500 focus:ring-orange-500"}),"Also delete workspace (git worktree)"]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{onClick:O,className:"px-2 py-1 text-xs text-gray-400 hover:text-white transition-colors",children:"Cancel"}),l.jsx("button",{onClick:R,disabled:D.isPending,className:"px-2 py-1 text-xs bg-orange-600 hover:bg-orange-500 text-white rounded transition-colors disabled:opacity-50",children:D.isPending?"Aborting...":"Confirm Abort"})]})]}),!u&&yn[e.status]==="in_progress"&&l.jsxs("div",{className:"flex items-center gap-3 mt-3 pt-3 border-t border-gray-600",children:[l.jsxs("button",{onClick:P,className:"flex items-center gap-1 text-xs text-purple-400 hover:text-purple-300 transition-colors",children:[l.jsx(Ml,{className:"w-3.5 h-3.5"}),"Re-plan"]}),l.jsxs("button",{onClick:I,className:"flex items-center gap-1 text-xs text-blue-400 hover:text-blue-300 transition-colors",children:[l.jsx(Pr,{className:"w-3.5 h-3.5"}),"Resume Agent"]})]}),!u&&(yn[e.status]==="done"||yn[e.status]==="in_review")&&l.jsx(l4,{issue:e})]})}function l4({issue:e}){const t=Lr(),r=ye({mutationFn:async()=>{const n=await fetch(`/api/issues/${e.identifier}/reopen`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!n.ok){const s=await n.json();throw new Error(s.error||"Failed to reopen issue")}return n.json()},onSuccess:()=>{t.invalidateQueries({queryKey:["issues"]})}}),i=n=>{n.stopPropagation(),confirm(`Reopen ${e.identifier} and start planning?`)&&r.mutate()};return l.jsxs("div",{className:"flex items-center gap-3 mt-3 pt-3 border-t border-green-600/30",children:[l.jsxs("button",{onClick:i,disabled:r.isPending,className:"flex items-center gap-1 text-xs text-orange-400 hover:text-orange-300 transition-colors disabled:opacity-50",children:[r.isPending?l.jsx(Ne,{className:"w-3.5 h-3.5 animate-spin"}):l.jsx(hx,{className:"w-3.5 h-3.5"}),r.isPending?"Reopening...":"Reopen"]}),r.isError&&l.jsx("span",{className:"text-xs text-red-400",children:r.error.message})]})}const c4={sleeping:"😴",active:"🟢",uninitialized:"⚪"},u4={sleeping:"Sleeping",active:"Active",uninitialized:"Not Initialized"},h4={sleeping:"text-blue-400",active:"text-green-400",uninitialized:"text-gray-500"};async function d4(e){const t=await fetch(`/api/specialists/${e}/wake`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!t.ok){const r=await t.json();throw new Error(r.error||"Failed to wake specialist")}}async function f4(e){const t=await fetch(`/api/specialists/${e}/reset`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reinitialize:!1})});if(!t.ok){const r=await t.json();throw new Error(r.error||"Failed to reset specialist")}}async function p4(e){if(!(await fetch(`/api/agents/${e}`,{method:"DELETE"})).ok)throw new Error("Failed to kill specialist")}function m4(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toString()}function g4(e){if(!e)return"Never";const t=new Date(e),i=new Date().getTime()-t.getTime(),n=Math.floor(i/6e4),s=Math.floor(n/60),o=Math.floor(s/24);return o>0?`${o}d ago`:s>0?`${s}h ago`:n>0?`${n}m ago`:"Just now"}function _4({specialist:e,onSelect:t,isSelected:r}){const i=Lr(),n=ye({mutationFn:()=>d4(e.name),onSuccess:()=>{i.invalidateQueries({queryKey:["specialists"]}),i.invalidateQueries({queryKey:["agents"]})},onError:h=>{alert(`Failed to wake ${e.displayName}: ${h.message}`)}}),s=ye({mutationFn:()=>f4(e.name),onSuccess:()=>{i.invalidateQueries({queryKey:["specialists"]})},onError:h=>{alert(`Failed to reset ${e.displayName}: ${h.message}`)}}),o=ye({mutationFn:()=>p4(e.tmuxSession),onSuccess:()=>{i.invalidateQueries({queryKey:["specialists"]}),i.invalidateQueries({queryKey:["agents"]})}}),a=h=>{h.stopPropagation(),n.mutate()},u=h=>{h.stopPropagation(),confirm(`Reset ${e.displayName}? This will clear the session file and context.`)&&s.mutate()},c=h=>{h.stopPropagation(),confirm(`Kill ${e.displayName}?`)&&o.mutate()};return l.jsx("div",{onClick:t,className:`p-4 cursor-pointer transition-colors ${r?"bg-gray-700":"hover:bg-gray-750"}`,children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(ox,{className:"w-5 h-5 text-purple-400"}),l.jsxs("div",{children:[l.jsxs("div",{className:"font-medium text-white flex items-center gap-2",children:[e.displayName,l.jsx("span",{className:`text-xs ${h4[e.state]}`,children:c4[e.state]})]}),l.jsx("div",{className:"text-sm text-gray-400",children:e.description}),e.sessionId&&l.jsxs("div",{className:"text-xs text-gray-500 font-mono mt-1",children:["Session: ",e.sessionId.slice(0,8),"..."]})]})]}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsxs("div",{className:"text-right",children:[l.jsx("div",{className:"text-sm text-gray-400",children:u4[e.state]}),e.contextTokens&&l.jsxs("div",{className:"text-xs text-gray-500",children:[m4(e.contextTokens)," tokens"]}),e.lastWake&&l.jsxs("div",{className:"text-xs text-gray-500",children:["Last wake: ",g4(e.lastWake)]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[(e.state==="sleeping"||e.state==="uninitialized")&&l.jsx("button",{onClick:a,disabled:n.isPending||e.state==="uninitialized",className:"p-2 text-gray-400 hover:text-green-400 hover:bg-gray-600 rounded disabled:opacity-50 disabled:cursor-not-allowed",title:e.state==="uninitialized"?"Specialist not initialized - needs session ID":"Wake specialist",children:l.jsx(RC,{className:"w-4 h-4"})}),e.state==="active"&&l.jsx("button",{onClick:c,disabled:o.isPending,className:"p-2 text-gray-400 hover:text-red-400 hover:bg-gray-600 rounded",title:"Kill specialist",children:l.jsx(Uc,{className:"w-4 h-4"})}),(e.state==="sleeping"||e.state==="uninitialized")&&l.jsx("button",{onClick:u,disabled:s.isPending,className:"p-2 text-gray-400 hover:text-yellow-400 hover:bg-gray-600 rounded",title:"Reset specialist (clear session)",children:l.jsx(hx,{className:"w-4 h-4"})})]})]})]})})}async function v4(e){const t=await fetch(`/api/agents/${e}/handoff/suggestion`);if(!t.ok)throw new Error("Failed to fetch handoff suggestion");return t.json()}async function y4(e){const t=await fetch(`/api/agents/${e}/cost`);if(!t.ok)throw new Error("Failed to fetch agent cost");return t.json()}function x4(e){return Pe({queryKey:["handoff-suggestion",e],queryFn:()=>v4(e),refetchInterval:3e4})}function w4(e){return Pe({queryKey:["agent-cost",e],queryFn:()=>y4(e),refetchInterval:6e4})}async function S4(e,t,r){const i=await fetch(`/api/agents/${e}/handoff`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({toModel:t,reason:r})});if(!i.ok){const n=await i.json();throw new Error(n.error||"Failed to execute handoff")}}const b4={opus:"text-purple-400 bg-purple-900/20 border-purple-500/30",sonnet:"text-blue-400 bg-blue-900/20 border-blue-500/30",haiku:"text-green-400 bg-green-900/20 border-green-500/30"};function C4({agentId:e}){const{data:t,isLoading:r}=x4(e),i=Lr(),n=ye({mutationFn:({toModel:a,reason:u})=>S4(e,a,u),onSuccess:()=>{i.invalidateQueries({queryKey:["agents"]}),i.invalidateQueries({queryKey:["handoff-suggestion",e]}),alert("Handoff completed successfully")},onError:a=>{alert(`Handoff failed: ${a.message}`)}}),s=a=>{confirm(`Hand off ${e} to ${a}?`)&&n.mutate({toModel:a,reason:"Manual handoff from dashboard"})},o=()=>{t!=null&&t.suggestedModel&&confirm(`${t.reason}
393
+
394
+ Proceed with handoff to ${t.suggestedModel}?`)&&n.mutate({toModel:t.suggestedModel,reason:t.reason})};return r?l.jsx("div",{className:"p-3 bg-gray-800 rounded border border-gray-700",children:l.jsx("div",{className:"text-sm text-gray-400",children:"Loading handoff data..."})}):t?l.jsxs("div",{className:"p-3 bg-gray-800 rounded border border-gray-700 space-y-3",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-xs text-gray-400",children:"Current Model:"}),l.jsx("span",{className:`px-2 py-1 text-xs font-medium rounded border ${b4[t.currentModel]||"text-gray-400 bg-gray-700 border-gray-600"}`,children:t.currentModel})]}),t.suggested&&t.suggestedModel&&l.jsxs("div",{className:"flex items-start gap-2 p-2 bg-orange-900/20 border border-orange-500/30 rounded",children:[l.jsx(Fc,{className:"w-4 h-4 text-orange-400 mt-0.5 flex-shrink-0"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-sm font-medium text-orange-400 mb-1",children:"Handoff Suggested"}),l.jsx("div",{className:"text-xs text-gray-300 mb-2",children:t.reason}),l.jsxs("button",{onClick:o,disabled:n.isPending,className:"flex items-center gap-2 px-3 py-1.5 text-xs font-medium text-white bg-orange-600 hover:bg-orange-500 rounded disabled:opacity-50 disabled:cursor-not-allowed",children:[l.jsx(ix,{className:"w-3 h-3"}),"Hand off to ",t.suggestedModel]})]})]}),l.jsxs("div",{children:[l.jsx("div",{className:"text-xs text-gray-400 mb-2",children:"Manual Handoff:"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{onClick:()=>s("haiku"),disabled:n.isPending||t.currentModel==="haiku",className:"flex-1 px-2 py-1.5 text-xs font-medium text-green-400 bg-green-900/20 hover:bg-green-900/40 border border-green-500/30 rounded disabled:opacity-50 disabled:cursor-not-allowed",children:"Haiku"}),l.jsx("button",{onClick:()=>s("sonnet"),disabled:n.isPending||t.currentModel==="sonnet",className:"flex-1 px-2 py-1.5 text-xs font-medium text-blue-400 bg-blue-900/20 hover:bg-blue-900/40 border border-blue-500/30 rounded disabled:opacity-50 disabled:cursor-not-allowed",children:"Sonnet"}),l.jsx("button",{onClick:()=>s("opus"),disabled:n.isPending||t.currentModel==="opus",className:"flex-1 px-2 py-1.5 text-xs font-medium text-purple-400 bg-purple-900/20 hover:bg-purple-900/40 border border-purple-500/30 rounded disabled:opacity-50 disabled:cursor-not-allowed",children:"Opus"})]})]})]}):null}const k4={healthy:"bg-status-healthy",warning:"bg-status-warning",stuck:"bg-status-stuck",dead:"bg-status-dead"},N4={active:"🟢",stale:"🟡",warning:"🟠",stuck:"🔴"},E4={active:"Active",stale:"Stale",warning:"Warning",stuck:"Stuck"},j4={active:"text-green-400",stale:"text-yellow-400",warning:"text-orange-400",stuck:"text-red-400"};async function P4(e){if(!(await fetch(`/api/agents/${e}`,{method:"DELETE"})).ok)throw new Error("Failed to kill agent")}async function M4(e){const t=await fetch(`/api/agents/${e}/poke`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!t.ok){const r=await t.json();throw new Error(r.error||"Failed to poke agent")}}function T4(e){const t=new Date(e),i=new Date().getTime()-t.getTime(),n=Math.floor(i/6e4),s=Math.floor(n/60);return s>0?`${s}h ${n%60}m`:`${n}m`}function R4(e){if(e===null)return"unknown";const t=Math.floor(e/1e3),r=Math.floor(t/60),i=Math.floor(r/60);return i>0?`${i}h ago`:r>0?`${r}m ago`:`${t}s ago`}function D4({agent:e,health:t,onSelect:r,isSelected:i}){const n=Lr(),[s,o]=F.useState(!1),{data:a}=w4(e.id),u=ye({mutationFn:()=>P4(e.id),onSuccess:()=>{n.invalidateQueries({queryKey:["agents"]})}}),c=ye({mutationFn:()=>M4(e.id),onSuccess:()=>{alert(`Poked ${e.id} successfully`)},onError:m=>{alert(`Failed to poke ${e.id}: ${m.message}`)}}),h=m=>{m.stopPropagation(),confirm(`Kill agent ${e.id}?`)&&u.mutate()},d=m=>{m.stopPropagation(),c.mutate()},f=(t==null?void 0:t.state)==="warning"||(t==null?void 0:t.state)==="stuck",p=m=>{m.stopPropagation(),o(!s)};return l.jsxs("div",{onClick:r,className:`p-4 cursor-pointer transition-colors ${i?"bg-gray-700":"hover:bg-gray-750"}`,children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("div",{className:`w-3 h-3 rounded-full ${k4[e.status]}`}),l.jsxs("div",{children:[l.jsxs("div",{className:"font-medium text-white flex items-center gap-2",children:[e.id,t&&l.jsx("span",{className:`text-xs ${j4[t.state]}`,title:`Cloister: ${E4[t.state]}`,children:N4[t.state]})]}),l.jsxs("div",{className:"text-sm text-gray-400 flex items-center gap-2",children:[e.runtime," / ",e.model,a&&a.cost>0&&l.jsxs("span",{className:"flex items-center gap-1 text-xs text-emerald-400",title:"Agent cost so far",children:[l.jsx($c,{className:"w-3 h-3"}),"$",a.cost.toFixed(4)]})]})]})]}),l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsxs("div",{className:"text-right",children:[l.jsxs("div",{className:"flex items-center gap-1 text-sm text-gray-400",children:[l.jsx(Hc,{className:"w-4 h-4"}),T4(e.startedAt)]}),t&&t.timeSinceActivity!==null&&l.jsxs("div",{className:"flex items-center gap-1 text-xs text-gray-500",children:[l.jsx(hp,{className:"w-3 h-3"}),R4(t.timeSinceActivity)]}),e.consecutiveFailures>0&&l.jsxs("div",{className:"flex items-center gap-1 text-sm text-orange-400",children:[l.jsx(Xs,{className:"w-4 h-4"}),e.consecutiveFailures," failures"]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("button",{onClick:p,className:`p-2 hover:bg-gray-600 rounded ${s?"text-blue-400":"text-gray-400 hover:text-blue-400"}`,title:"Model handoff controls",children:l.jsx(rx,{className:"w-4 h-4"})}),f&&l.jsx("button",{onClick:d,disabled:c.isPending,className:"p-2 text-gray-400 hover:text-yellow-400 hover:bg-gray-600 rounded",title:"Poke agent (send nudge message)",children:l.jsx(nx,{className:"w-4 h-4"})}),l.jsx("button",{onClick:h,disabled:u.isPending,className:"p-2 text-gray-400 hover:text-red-400 hover:bg-gray-600 rounded",title:"Kill agent",children:l.jsx(Uc,{className:"w-4 h-4"})})]})]})]}),s&&l.jsx("div",{className:"mt-3 pt-3 border-t border-gray-700",children:l.jsx(C4,{agentId:e.id})})]})}async function L4(){const e=await fetch("/api/agents");if(!e.ok)throw new Error("Failed to fetch agents");return e.json()}async function A4(){const e=await fetch("/api/specialists");if(!e.ok)throw new Error("Failed to fetch specialists");return e.json()}async function O4(){const e=await fetch("/api/cloister/agents/health");if(!e.ok)throw new Error("Failed to fetch Cloister health");return e.json()}function B4({selectedAgent:e,onSelectAgent:t}){const{data:r,isLoading:i,error:n}=Pe({queryKey:["agents"],queryFn:L4,refetchInterval:3e3}),{data:s,isLoading:o}=Pe({queryKey:["specialists"],queryFn:A4,refetchInterval:5e3}),{data:a}=Pe({queryKey:["cloister-health"],queryFn:O4,refetchInterval:5e3});if(i||o)return l.jsx("div",{className:"bg-gray-800 rounded-lg p-6",children:l.jsx("div",{className:"text-gray-400",children:"Loading agents..."})});if(n)return l.jsx("div",{className:"bg-gray-800 rounded-lg p-6",children:l.jsxs("div",{className:"text-red-400",children:["Error: ",n.message]})});const u=(r==null?void 0:r.filter(h=>h.status!=="dead"))||[],c=(s==null?void 0:s.filter(h=>h.enabled))||[];return l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"bg-gray-800 rounded-lg",children:[l.jsx("div",{className:"px-4 py-3 border-b border-gray-700",children:l.jsxs("h2",{className:"font-semibold text-white flex items-center gap-2",children:[l.jsx(ox,{className:"w-5 h-5 text-purple-400"}),"Specialist Agents (",c.length,")"]})}),l.jsx("div",{className:"divide-y divide-gray-700",children:c.length===0?l.jsx("div",{className:"p-8 text-center text-gray-500",children:"No specialist agents configured."}):c.map(h=>l.jsx(_4,{specialist:h,onSelect:()=>t(h.tmuxSession===e?null:h.tmuxSession),isSelected:h.tmuxSession===e},h.name))})]}),l.jsxs("div",{className:"bg-gray-800 rounded-lg",children:[l.jsx("div",{className:"px-4 py-3 border-b border-gray-700",children:l.jsxs("h2",{className:"font-semibold text-white flex items-center gap-2",children:[l.jsx(pc,{className:"w-5 h-5"}),"Issue Agents (",u.length,")"]})}),l.jsx("div",{className:"divide-y divide-gray-700",children:u.length===0?l.jsxs("div",{className:"p-8 text-center text-gray-500",children:["No agents running. Use"," ",l.jsx("code",{className:"bg-gray-700 px-2 py-1 rounded",children:"/work-issue"})," to spawn one."]}):u.map(h=>{const d=a==null?void 0:a.agents.find(f=>f.agentId===h.id);return l.jsx(D4,{agent:h,health:d,onSelect:()=>t(h.id===e?null:h.id),isSelected:h.id===e},h.id)})})]})]})}async function z4(e){const t=await fetch(`/api/agents/${e}/output`);if(!t.ok)throw new Error("Failed to fetch output");return(await t.json()).output||""}async function I4(e,t){if(!(await fetch(`/api/agents/${e}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:t})})).ok)throw new Error("Failed to send message")}function x_({agentId:e}){const[t,r]=F.useState(""),i=F.useRef(null),{data:n,isLoading:s,refetch:o}=Pe({queryKey:["agent-output",e],queryFn:()=>z4(e),refetchInterval:2e3}),a=ye({mutationFn:c=>I4(e,c),onSuccess:()=>{r(""),setTimeout(()=>o(),500)}});F.useEffect(()=>{i.current&&(i.current.scrollTop=i.current.scrollHeight)},[n]);const u=c=>{c.preventDefault(),t.trim()&&a.mutate(t.trim())};return l.jsxs("div",{className:"bg-gray-800 rounded-lg flex flex-col h-[600px]",children:[l.jsxs("div",{className:"px-4 py-3 border-b border-gray-700 flex items-center justify-between",children:[l.jsxs("h2",{className:"font-semibold text-white flex items-center gap-2",children:[l.jsx(cn,{className:"w-5 h-5"}),e]}),l.jsx("button",{onClick:()=>o(),className:"p-2 text-gray-400 hover:text-white hover:bg-gray-700 rounded",title:"Refresh",children:l.jsx(Vn,{className:"w-4 h-4"})})]}),l.jsx("pre",{ref:i,className:"flex-1 overflow-auto p-4 terminal-output text-gray-300 bg-gray-900",children:s?l.jsx("span",{className:"text-gray-500",children:"Loading..."}):n||l.jsx("span",{className:"text-gray-500",children:"No output yet"})}),l.jsx("form",{onSubmit:u,className:"p-3 border-t border-gray-700",children:l.jsxs("div",{className:"flex gap-2",children:[l.jsx("input",{type:"text",value:t,onChange:c=>r(c.target.value),placeholder:"Send message to agent...",className:"flex-1 bg-gray-700 border border-gray-600 rounded px-3 py-2 text-white placeholder-gray-400 focus:outline-none focus:border-blue-500"}),l.jsxs("button",{type:"submit",disabled:!t.trim()||a.isPending,className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:[l.jsx(dx,{className:"w-4 h-4"}),"Send"]})]})})]})}async function F4(){const e=await fetch("/api/health/agents");if(!e.ok)throw new Error("Failed to fetch health");return e.json()}const w_={healthy:{icon:Pa,color:"text-green-400",bg:"bg-green-900/30"},warning:{icon:Xs,color:"text-yellow-400",bg:"bg-yellow-900/30"},stuck:{icon:Hc,color:"text-orange-400",bg:"bg-orange-900/30"},dead:{icon:dp,color:"text-red-400",bg:"bg-red-900/30"}};function H4(){const{data:e,isLoading:t,error:r}=Pe({queryKey:["health"],queryFn:F4,refetchInterval:5e3});if(t)return l.jsx("div",{className:"flex items-center justify-center h-64",children:l.jsx("div",{className:"text-gray-400",children:"Loading health data..."})});if(r)return l.jsx("div",{className:"flex items-center justify-center h-64",children:l.jsxs("div",{className:"text-red-400",children:["Error: ",r.message]})});if(!e||e.length===0)return l.jsxs("div",{className:"bg-gray-800 rounded-lg p-8 text-center",children:[l.jsx(hp,{className:"w-12 h-12 text-gray-600 mx-auto mb-4"}),l.jsx("h3",{className:"text-lg font-medium text-gray-400",children:"No agents to monitor"}),l.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"Health data will appear here when agents are running"})]});const i=e.reduce((n,s)=>(n[s.status]=(n[s.status]||0)+1,n),{});return l.jsxs("div",{className:"space-y-6",children:[l.jsx("div",{className:"grid grid-cols-4 gap-4",children:["healthy","warning","stuck","dead"].map(n=>{const s=w_[n],o=s.icon;return l.jsx("div",{className:`${s.bg} rounded-lg p-4 border border-gray-700`,children:l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(o,{className:`w-8 h-8 ${s.color}`}),l.jsxs("div",{children:[l.jsx("div",{className:"text-2xl font-bold text-white",children:i[n]||0}),l.jsx("div",{className:"text-sm text-gray-400 capitalize",children:n})]})]})},n)})}),l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:e.map(n=>{const s=w_[n.status],o=s.icon;return l.jsxs("div",{className:`${s.bg} rounded-lg p-4 border border-gray-700`,children:[l.jsx("div",{className:"flex items-start justify-between",children:l.jsxs("div",{children:[l.jsx("div",{className:"font-medium text-white",children:n.agentId}),l.jsxs("div",{className:`flex items-center gap-1 text-sm ${s.color} mt-1`,children:[l.jsx(o,{className:"w-4 h-4"}),l.jsx("span",{className:"capitalize",children:n.status})]})]})}),n.reason&&l.jsx("div",{className:"mt-2 text-sm text-gray-400 italic",children:n.reason}),l.jsxs("div",{className:"mt-4 space-y-2 text-sm",children:[n.lastPing&&l.jsxs("div",{className:"flex justify-between text-gray-400",children:[l.jsx("span",{children:"Last ping:"}),l.jsx("span",{children:new Date(n.lastPing).toLocaleTimeString()})]}),l.jsxs("div",{className:"flex justify-between text-gray-400",children:[l.jsx("span",{children:"Failures:"}),l.jsx("span",{className:n.consecutiveFailures>0?"text-orange-400":"",children:n.consecutiveFailures})]}),l.jsxs("div",{className:"flex justify-between text-gray-400",children:[l.jsx("span",{children:"Kill count:"}),l.jsx("span",{className:n.killCount>0?"text-red-400":"",children:n.killCount})]})]})]},n.agentId)})})]})}function $4(){const[e,t]=F.useState([]),[r,i]=F.useState(!0),[n,s]=F.useState(null),o=async()=>{try{i(!0);const c=await fetch("/api/skills");if(!c.ok)throw new Error("Failed to fetch skills");const h=await c.json();t(h),s(null)}catch(c){s(c instanceof Error?c.message:"Unknown error")}finally{i(!1)}};if(F.useEffect(()=>{o()},[]),r)return l.jsx("div",{className:"flex items-center justify-center h-64",children:l.jsx(Vn,{className:"w-6 h-6 text-gray-400 animate-spin"})});if(n)return l.jsxs("div",{className:"bg-red-900/20 border border-red-800 rounded-lg p-4 text-red-400",children:[l.jsx(Fc,{className:"w-5 h-5 inline mr-2"}),n]});const a=e.filter(c=>c.source==="panopticon"),u=e.filter(c=>c.source==="claude");return l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("h2",{className:"text-lg font-semibold text-white",children:"Skills"}),l.jsxs("button",{onClick:o,className:"flex items-center gap-2 px-3 py-1.5 text-sm text-gray-400 hover:text-white hover:bg-gray-700 rounded-lg transition-colors",children:[l.jsx(Vn,{className:"w-4 h-4"}),"Refresh"]})]}),e.length===0?l.jsxs("div",{className:"bg-gray-800 rounded-lg p-8 text-center text-gray-400",children:[l.jsx(fp,{className:"w-12 h-12 mx-auto mb-3 opacity-50"}),l.jsx("p",{children:"No skills found"}),l.jsx("p",{className:"text-sm mt-2",children:"Add skills to ~/.panopticon/skills/ or ~/.claude/skills/"})]}):l.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[l.jsxs("div",{className:"bg-gray-800 rounded-lg p-4",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[l.jsx("div",{className:"w-2 h-2 rounded-full bg-blue-500"}),l.jsxs("h3",{className:"font-medium text-white",children:["Panopticon (",a.length,")"]})]}),l.jsxs("div",{className:"space-y-2",children:[a.map(c=>l.jsx(S_,{skill:c},c.path)),a.length===0&&l.jsx("p",{className:"text-gray-500 text-sm",children:"No Panopticon skills"})]})]}),l.jsxs("div",{className:"bg-gray-800 rounded-lg p-4",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[l.jsx("div",{className:"w-2 h-2 rounded-full bg-purple-500"}),l.jsxs("h3",{className:"font-medium text-white",children:["Claude (",u.length,")"]})]}),l.jsxs("div",{className:"space-y-2",children:[u.map(c=>l.jsx(S_,{skill:c},c.path)),u.length===0&&l.jsx("p",{className:"text-gray-500 text-sm",children:"No Claude skills"})]})]})]}),l.jsxs("div",{className:"bg-gray-800 rounded-lg p-4",children:[l.jsx("h3",{className:"font-medium text-white mb-2",children:"Skill Locations"}),l.jsxs("div",{className:"text-sm text-gray-400 space-y-1",children:[l.jsxs("p",{children:[l.jsx("span",{className:"text-blue-400",children:"Panopticon:"})," ","~/.panopticon/skills/"]}),l.jsxs("p",{children:[l.jsx("span",{className:"text-purple-400",children:"Claude:"})," ~/.claude/skills/"]})]})]})]})}function S_({skill:e}){return l.jsxs("div",{className:"bg-gray-700/50 rounded-lg p-3 hover:bg-gray-700 transition-colors",children:[l.jsxs("div",{className:"flex items-start justify-between",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(sx,{className:"w-4 h-4 text-gray-400"}),l.jsx("span",{className:"font-medium text-white",children:e.name})]}),e.hasSkillMd?l.jsxs("span",{className:"flex items-center gap-1 text-xs text-green-400",children:[l.jsx(ys,{className:"w-3 h-3"}),"SKILL.md"]}):l.jsxs("span",{className:"flex items-center gap-1 text-xs text-yellow-400",children:[l.jsx(Fc,{className:"w-3 h-3"}),"No SKILL.md"]})]}),e.description&&l.jsx("p",{className:"mt-2 text-sm text-gray-400 line-clamp-2",children:e.description}),l.jsx("p",{className:"mt-2 text-xs text-gray-500 truncate",children:e.path})]})}function W4(e){if(navigator.clipboard&&window.isSecureContext)return navigator.clipboard.writeText(e),!0;const t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.left="-999999px",t.style.top="-999999px",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),document.body.removeChild(t),!0}catch{return document.body.removeChild(t),!1}}async function U4(e){const t=await fetch(`/api/agents/${e}/output?lines=200`);if(!t.ok)throw new Error("Failed to fetch output");return(await t.json()).output||""}function K4({agent:e,issueId:t,issueUrl:r,onClose:i}){const n=Lr(),[s,o]=F.useState(""),[a,u]=F.useState(!1),[c,h]=F.useState("logs"),d=F.useRef(null),f=F.useRef(null),[p,m]=F.useState(!0),y=`tmux attach -t ${e.id}`,{data:C,refetch:g}=Pe({queryKey:["agent-output",e.id],queryFn:()=>U4(e.id),refetchInterval:1e3}),{data:_}=Pe({queryKey:["workspace",t],queryFn:async()=>{const H=await fetch(`/api/workspaces/${t}`);if(!H.ok)throw new Error("Failed to fetch workspace info");return H.json()},refetchInterval:5e3}),v=ye({mutationFn:async()=>{const H=await fetch(`/api/workspaces/${t}/start`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!H.ok){const ee=await H.json();throw new Error(ee.error||"Failed to start containers")}return H.json()},onSuccess:()=>{setTimeout(()=>{n.invalidateQueries({queryKey:["workspace",t]})},5e3)}}),x=ye({mutationFn:async()=>{const H=await fetch(`/api/workspaces/${t}/containerize`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!H.ok){const ee=await H.json();throw new Error(ee.error||"Failed to containerize workspace")}return H.json()},onSuccess:()=>{setTimeout(()=>{n.invalidateQueries({queryKey:["workspace",t]})},3e3)}}),k=ye({mutationFn:async()=>{const H=await fetch(`/api/workspaces/${t}/approve`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!H.ok){const ee=await H.json();throw new Error(ee.error||"Failed to approve workspace")}return H.json()},onSuccess:()=>{n.invalidateQueries({queryKey:["workspace",t]}),n.invalidateQueries({queryKey:["agents"]}),n.invalidateQueries({queryKey:["issues"]}),i()}}),b=ye({mutationFn:async()=>{const H=await fetch(`/api/issues/${t}/close`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:"Closed manually"})});if(!H.ok){const ee=await H.json();throw new Error(ee.error||"Failed to close issue")}return H.json()},onSuccess:()=>{n.invalidateQueries({queryKey:["workspace",t]}),n.invalidateQueries({queryKey:["agents"]}),n.invalidateQueries({queryKey:["issues"]}),i()}}),j=ye({mutationFn:async()=>{const H=await fetch(`/api/workspaces/${t}/clean`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!H.ok){const ee=await H.json();throw new Error(ee.error||"Failed to clean workspace")}return H.json()},onSuccess:()=>{n.invalidateQueries({queryKey:["workspace",t]}),n.invalidateQueries({queryKey:["agents"]})}}),L=()=>{confirm(`Clean and recreate corrupted workspace for ${t}?
395
+
396
+ This will:
397
+ - Remove the corrupted workspace directory
398
+ - Create a fresh workspace`)&&j.mutate()},I=()=>{v.mutate()},P=()=>{x.mutate()},D=()=>{confirm(`Approve and clean up workspace for ${t}? This will:
399
+ - Merge the feature branch
400
+ - Update issue to Done
401
+ - Remove the workspace
402
+ - Delete the feature branch`)&&k.mutate()},M=()=>{confirm(`Close ${t} without merging? This will:
403
+ - Close the issue (no merge)
404
+ - Stop any running agent
405
+ - Remove the workspace
406
+ - Delete the feature branch`)&&b.mutate()},R=ye({mutationFn:async H=>{if(!(await fetch(`/api/agents/${e.id}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:H})})).ok)throw new Error("Failed to send")},onSuccess:()=>{o(""),setTimeout(()=>g(),500)}}),O=ye({mutationFn:async()=>{if(!(await fetch(`/api/agents/${e.id}`,{method:"DELETE"})).ok)throw new Error("Failed to kill")},onSuccess:()=>{n.invalidateQueries({queryKey:["agents"]}),i()}}),E=F.useCallback(()=>{W4(y),u(!0),setTimeout(()=>u(!1),2e3)},[y]);F.useEffect(()=>{p&&f.current&&f.current.scrollIntoView({behavior:"auto"})},[C,p]);const A=F.useCallback(()=>{if(d.current){const{scrollTop:H,scrollHeight:ee,clientHeight:ie}=d.current,We=ee-H-ie<50;m(We)}},[]),U=()=>{s.trim()&&R.mutate(s.trim())},T=()=>{confirm(`Kill agent ${e.id}?`)&&O.mutate()},$=new Date(e.startedAt),w=Date.now()-$.getTime(),Z=Math.floor(w/6e4),ne=Math.floor(Z/60),S=ne>0?`${ne}h ${Z%60}m`:`${Z}m`;return l.jsx(l.Fragment,{children:l.jsxs("div",{className:"flex h-full bg-gray-800 border-l border-gray-700",children:[l.jsxs("div",{className:"w-64 border-r border-gray-700 flex flex-col overflow-y-auto",children:[l.jsxs("div",{className:"px-3 py-2 border-b border-gray-700",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("div",{className:"flex gap-0.5",children:[l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-blue-400 animate-pulse",style:{animationDelay:"0ms"}}),l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-blue-400 animate-pulse",style:{animationDelay:"150ms"}}),l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-blue-400 animate-pulse",style:{animationDelay:"300ms"}})]}),l.jsx("span",{className:"text-xs text-gray-400",children:"Agent Running"})]}),l.jsx("h2",{className:"font-mono text-sm text-white font-medium mt-1",children:e.issueId})]}),l.jsxs("div",{className:"px-3 py-2 border-b border-gray-700 text-xs",children:[l.jsx("div",{className:"text-gray-500 uppercase tracking-wider mb-2",children:"Agent"}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-gray-400",children:"Model"}),l.jsx("span",{className:"text-white",children:e.model})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-gray-400",children:"Runtime"}),l.jsx("span",{className:"text-white",children:e.runtime})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-gray-400",children:"Uptime"}),l.jsx("span",{className:"text-white",children:S})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-gray-400",children:"Session"}),l.jsx("span",{className:"text-white font-mono text-[10px]",children:e.id})]})]})]}),e.git&&l.jsxs("div",{className:"px-3 py-2 border-b border-gray-700 text-xs",children:[l.jsx("div",{className:"text-gray-500 uppercase tracking-wider mb-2",children:"Git Status"}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs("div",{className:"flex items-center gap-1.5 text-white",children:[l.jsx(Tl,{className:"w-3 h-3"}),l.jsx("span",{className:"font-mono",children:e.git.branch})]}),e.git.uncommittedFiles>0&&l.jsxs("div",{className:"text-yellow-400 text-[10px] ml-4",children:[e.git.uncommittedFiles," uncommitted files"]}),l.jsx("div",{className:"text-gray-400 text-[10px] mt-1 truncate",title:e.git.latestCommit,children:e.git.latestCommit})]})]}),e.workspace&&l.jsx("div",{className:"px-3 py-2 border-b border-gray-700 text-xs",children:l.jsxs("div",{className:"flex items-center gap-1.5 text-gray-400",children:[l.jsx(fp,{className:"w-3 h-3"}),l.jsx("span",{className:"font-mono truncate text-[10px]",title:e.workspace,children:e.workspace})]})}),l.jsxs("div",{className:"px-3 py-2 border-b border-gray-700 text-xs",children:[l.jsx("div",{className:"text-gray-500 uppercase tracking-wider mb-2",children:"Links"}),l.jsx("div",{className:"space-y-1.5",children:r&&l.jsxs("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 text-blue-400 hover:text-blue-300",children:[l.jsx(Wc,{className:"w-3 h-3"}),l.jsx("span",{children:"Linear Issue"})]})})]}),(_==null?void 0:_.corrupted)&&l.jsxs("div",{className:"px-3 py-2 border-b border-gray-700",children:[l.jsxs("div",{className:"flex items-center gap-2 text-yellow-500 mb-2",children:[l.jsx(Xs,{className:"w-4 h-4"}),l.jsx("span",{className:"text-xs font-medium",children:"Workspace Corrupted"})]}),l.jsx("p",{className:"text-xs text-gray-400 mb-2",children:_.message||"The workspace exists but is not a valid git worktree."}),l.jsx("button",{onClick:L,disabled:j.isPending,className:"flex items-center gap-1 px-2 py-1 bg-yellow-600 hover:bg-yellow-500 disabled:bg-yellow-800 text-white text-xs rounded transition-colors w-full justify-center",children:j.isPending?l.jsxs(l.Fragment,{children:[l.jsx(Ne,{className:"w-3 h-3 animate-spin"}),"Cleaning..."]}):l.jsxs(l.Fragment,{children:[l.jsx(Vn,{className:"w-3 h-3"}),"Clean & Recreate"]})}),j.isError&&l.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 px-2 py-1 rounded mt-2",children:j.error instanceof Error?j.error.message:"Failed to clean workspace"}),j.isSuccess&&l.jsx("div",{className:"text-xs text-green-400 bg-green-900/20 px-2 py-1 rounded mt-2",children:"Workspace cleaned! Recreating..."})]}),(_==null?void 0:_.hasDocker)&&((_==null?void 0:_.frontendUrl)||(_==null?void 0:_.apiUrl))&&l.jsxs("div",{className:"px-3 py-2 border-b border-gray-700 text-xs",children:[l.jsx("div",{className:"text-gray-500 uppercase tracking-wider mb-2",children:"Services"}),l.jsxs("div",{className:"space-y-1.5",children:[_.frontendUrl&&l.jsxs("a",{href:_.frontendUrl,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 text-blue-400 hover:text-blue-300",children:[l.jsx(fd,{className:"w-3 h-3"}),l.jsx("span",{children:"Frontend"})]}),_.apiUrl&&l.jsxs("a",{href:_.apiUrl,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 text-blue-400 hover:text-blue-300",children:[l.jsx(fd,{className:"w-3 h-3"}),l.jsx("span",{children:"API"})]})]})]}),(_==null?void 0:_.hasDocker)&&(!_.containers||!Object.values(_.containers).some(H=>H.running))&&l.jsxs("div",{className:"px-3 py-2 border-b border-gray-700",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-xs text-yellow-500",children:"Containers not running"}),l.jsx("button",{onClick:I,disabled:v.isPending,className:"flex items-center gap-1 px-2 py-1 bg-green-600 hover:bg-green-500 disabled:bg-green-800 text-white text-xs rounded transition-colors",children:v.isPending?l.jsxs(l.Fragment,{children:[l.jsx(Ne,{className:"w-3 h-3 animate-spin"}),"Starting..."]}):l.jsxs(l.Fragment,{children:[l.jsx(Pr,{className:"w-3 h-3"}),"Start Containers"]})})]}),v.isError&&l.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 px-2 py-1 rounded mt-2",children:v.error instanceof Error?v.error.message:"Failed to start containers"})]}),(_==null?void 0:_.exists)&&!_.hasDocker&&l.jsxs("div",{className:"px-3 py-2 border-b border-gray-700",children:[l.jsx("div",{className:"text-gray-500 uppercase tracking-wider text-xs mb-2",children:"Containers"}),_.canContainerize?l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-xs text-gray-500",children:"Git-only workspace"}),l.jsx("button",{onClick:P,disabled:x.isPending,className:"flex items-center gap-1 px-2 py-1 bg-purple-600 hover:bg-purple-500 disabled:bg-purple-800 text-white text-xs rounded transition-colors",children:x.isPending?l.jsxs(l.Fragment,{children:[l.jsx(Ne,{className:"w-3 h-3 animate-spin"}),"Setting up..."]}):l.jsxs(l.Fragment,{children:[l.jsx(fc,{className:"w-3 h-3"}),"Containerize"]})})]}),x.isError&&l.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 px-2 py-1 rounded",children:x.error instanceof Error?x.error.message:"Failed to containerize workspace"})]}):l.jsxs("div",{className:"text-xs text-gray-400 bg-gray-800 px-2 py-2 rounded",children:[l.jsx("span",{className:"text-gray-500",children:"No Docker support."})," This workspace doesn't have container infrastructure set up yet."]})]}),(_==null?void 0:_.containers)&&Object.keys(_.containers).length>0&&l.jsxs("div",{className:"px-3 py-2 border-b border-gray-700 text-xs",children:[l.jsx("div",{className:"text-gray-500 uppercase tracking-wider mb-2",children:"Containers"}),l.jsx("div",{className:"flex flex-wrap gap-1.5",children:Object.entries(_.containers).map(([H,ee])=>{const ie=v.isPending&&!ee.running;return l.jsxs("span",{className:`flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] ${ee.running?"bg-green-900/30 text-green-400":ie?"bg-yellow-900/30 text-yellow-400 animate-pulse":"bg-gray-700 text-gray-500"}`,children:[ie?l.jsx(Ne,{className:"w-2.5 h-2.5 animate-spin"}):H==="postgres"||H==="redis"?l.jsx(lx,{className:"w-2.5 h-2.5"}):l.jsx(fc,{className:"w-2.5 h-2.5"}),H,ee.running&&ee.uptime&&l.jsx("span",{className:"text-gray-400 ml-1",children:ee.uptime}),ie&&l.jsx("span",{className:"text-yellow-500 ml-1",children:"starting..."})]},H)})})]}),l.jsxs("div",{className:"px-3 py-2 border-b border-gray-700 text-xs",children:[l.jsx("div",{className:"text-gray-500 uppercase tracking-wider mb-2",children:"Attach Command"}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("div",{className:"flex-1 flex items-center gap-1.5 px-2 py-1.5 bg-gray-900 rounded font-mono text-[11px] text-gray-300 overflow-hidden",children:[l.jsx(cn,{className:"w-3 h-3 shrink-0 text-blue-400"}),l.jsx("span",{className:"truncate",children:y})]}),l.jsx("button",{onClick:E,className:`p-1.5 rounded transition-colors ${a?"bg-green-900/30 text-green-400":"bg-gray-700 hover:bg-gray-600 text-gray-400 hover:text-white"}`,title:"Copy to clipboard",children:a?l.jsx(ys,{className:"w-3.5 h-3.5"}):l.jsx(ax,{className:"w-3.5 h-3.5"})})]})]}),l.jsxs("div",{className:"px-3 py-2 border-b border-gray-700",children:[l.jsx("div",{className:"text-xs text-gray-500 uppercase tracking-wider mb-2",children:"Actions"}),l.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[l.jsxs("button",{onClick:D,disabled:k.isPending,className:"flex items-center gap-1 px-2 py-1 text-xs bg-green-900/30 text-green-400 rounded hover:bg-green-900/50 disabled:opacity-50",children:[k.isPending?l.jsx(Ne,{className:"w-3 h-3 animate-spin"}):l.jsx(Pa,{className:"w-3 h-3"}),"Approve & Merge"]}),l.jsxs("button",{onClick:T,disabled:O.isPending,className:"flex items-center gap-1 px-2 py-1 text-xs bg-red-900/30 text-red-400 rounded hover:bg-red-900/50",children:[l.jsx(Uc,{className:"w-3 h-3"}),"Stop Agent"]}),l.jsxs("button",{onClick:M,disabled:b.isPending,className:"flex items-center gap-1 px-2 py-1 text-xs bg-orange-900/30 text-orange-400 rounded hover:bg-orange-900/50 disabled:opacity-50",children:[b.isPending?l.jsx(Ne,{className:"w-3 h-3 animate-spin"}):l.jsx(dp,{className:"w-3 h-3"}),"Close (No Merge)"]})]}),k.isError&&l.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 px-2 py-1 rounded mt-2",children:k.error instanceof Error?k.error.message:"Failed to approve"}),b.isError&&l.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 px-2 py-1 rounded mt-2",children:b.error instanceof Error?b.error.message:"Failed to close"})]}),l.jsx("div",{className:"flex-1"})]}),l.jsxs("div",{className:"flex-1 flex flex-col min-w-0 min-h-0 overflow-hidden",children:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-gray-700",children:[l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("button",{onClick:()=>h("logs"),className:`px-2 py-1 text-xs rounded transition-colors ${c==="logs"?"bg-gray-700 text-white":"text-gray-400 hover:text-white"}`,children:"Logs"}),l.jsx("button",{onClick:()=>h("status"),className:`px-2 py-1 text-xs rounded transition-colors ${c==="status"?"bg-gray-700 text-white":"text-gray-400 hover:text-white"}`,children:"Status"})]}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("button",{onClick:()=>g(),className:"p-1 text-gray-400 hover:text-white",title:"Refresh",children:l.jsx(Vn,{className:"w-3.5 h-3.5"})}),l.jsx("button",{onClick:i,className:"p-1 text-gray-400 hover:text-white",children:l.jsx(Mr,{className:"w-3.5 h-3.5"})})]})]}),c==="logs"?l.jsxs(l.Fragment,{children:[l.jsxs("pre",{ref:d,onScroll:A,className:"flex-1 min-h-0 overflow-auto p-3 bg-gray-900 text-gray-200 font-mono text-xs leading-relaxed m-0 whitespace-pre",children:[C||"Connecting to agent...",l.jsx("div",{ref:f})]}),l.jsx("div",{className:"p-2 border-t border-gray-700 bg-gray-800",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("input",{type:"text",value:s,onChange:H=>o(H.target.value),onKeyDown:H=>H.key==="Enter"&&U(),placeholder:"Send message to agent...",className:"flex-1 px-3 py-2 bg-gray-700 border border-gray-600 rounded text-sm text-white placeholder-gray-400 focus:outline-none focus:ring-1 focus:ring-blue-500"}),l.jsxs("button",{onClick:U,disabled:!s.trim()||R.isPending,className:"px-3 py-2 bg-blue-600 text-white rounded text-sm font-medium hover:bg-blue-500 disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:[l.jsx(dx,{className:"w-4 h-4"}),"Send"]})]})})]}):l.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 bg-gray-900",children:l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-medium text-white mb-2",children:"Agent Summary"}),l.jsxs("div",{className:"text-xs text-gray-300 space-y-1",children:[l.jsxs("p",{children:[l.jsx("strong",{children:"Issue:"})," ",e.issueId]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Session:"})," ",l.jsx("span",{className:"font-mono text-[10px]",children:e.id})]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Model:"})," ",e.model]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Runtime:"})," ",e.runtime]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Started:"})," ",$.toLocaleString()]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Uptime:"})," ",S]})]})]}),e.workspace&&l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-medium text-white mb-2",children:"Workspace"}),l.jsx("div",{className:"text-xs text-gray-300 space-y-1",children:l.jsx("p",{className:"font-mono text-[10px] break-all",children:e.workspace})})]}),e.git&&l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-medium text-white mb-2",children:"Git Status"}),l.jsxs("div",{className:"text-xs text-gray-300 space-y-1",children:[l.jsxs("p",{children:[l.jsx("strong",{children:"Branch:"})," ",l.jsx("span",{className:"font-mono",children:e.git.branch})]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Uncommitted:"})," ",e.git.uncommittedFiles," files"]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Latest:"})," ",e.git.latestCommit]})]})]}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-medium text-white mb-2",children:"Health"}),l.jsxs("div",{className:"text-xs text-gray-300 space-y-1",children:[l.jsxs("p",{children:[l.jsx("strong",{children:"Status:"})," ",l.jsx("span",{className:"text-green-400",children:e.status})]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Consecutive Failures:"})," ",e.consecutiveFailures]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Total Restarts:"})," ",e.killCount]})]})]})]})})]})]})})}function q4(e,t){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const V4=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Y4=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,X4={};function b_(e,t){return(X4.jsx?Y4:V4).test(e)}const Q4=/[ \t\n\f\r]/g;function G4(e){return typeof e=="object"?e.type==="text"?C_(e.value):!1:C_(e)}function C_(e){return e.replace(Q4,"")===""}class La{constructor(t,r,i){this.normal=r,this.property=t,i&&(this.space=i)}}La.prototype.normal={};La.prototype.property={};La.prototype.space=void 0;function yw(e,t){const r={},i={};for(const n of e)Object.assign(r,n.property),Object.assign(i,n.normal);return new La(r,i,t)}function Zd(e){return e.toLowerCase()}class Kt{constructor(t,r){this.attribute=r,this.property=t}}Kt.prototype.attribute="";Kt.prototype.booleanish=!1;Kt.prototype.boolean=!1;Kt.prototype.commaOrSpaceSeparated=!1;Kt.prototype.commaSeparated=!1;Kt.prototype.defined=!1;Kt.prototype.mustUseProperty=!1;Kt.prototype.number=!1;Kt.prototype.overloadedBoolean=!1;Kt.prototype.property="";Kt.prototype.spaceSeparated=!1;Kt.prototype.space=void 0;let J4=0;const oe=es(),Ke=es(),ef=es(),K=es(),we=es(),js=es(),Qt=es();function es(){return 2**++J4}const tf=Object.freeze(Object.defineProperty({__proto__:null,boolean:oe,booleanish:Ke,commaOrSpaceSeparated:Qt,commaSeparated:js,number:K,overloadedBoolean:ef,spaceSeparated:we},Symbol.toStringTag,{value:"Module"})),Vu=Object.keys(tf);class Ep extends Kt{constructor(t,r,i,n){let s=-1;if(super(t,r),k_(this,"space",n),typeof i=="number")for(;++s<Vu.length;){const o=Vu[s];k_(this,Vu[s],(i&tf[o])===tf[o])}}}Ep.prototype.defined=!0;function k_(e,t,r){r&&(e[t]=r)}function io(e){const t={},r={};for(const[i,n]of Object.entries(e.properties)){const s=new Ep(i,e.transform(e.attributes||{},i),n,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(s.mustUseProperty=!0),t[i]=s,r[Zd(i)]=i,r[Zd(s.attribute)]=i}return new La(t,r,e.space)}const xw=io({properties:{ariaActiveDescendant:null,ariaAtomic:Ke,ariaAutoComplete:null,ariaBusy:Ke,ariaChecked:Ke,ariaColCount:K,ariaColIndex:K,ariaColSpan:K,ariaControls:we,ariaCurrent:null,ariaDescribedBy:we,ariaDetails:null,ariaDisabled:Ke,ariaDropEffect:we,ariaErrorMessage:null,ariaExpanded:Ke,ariaFlowTo:we,ariaGrabbed:Ke,ariaHasPopup:null,ariaHidden:Ke,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:we,ariaLevel:K,ariaLive:null,ariaModal:Ke,ariaMultiLine:Ke,ariaMultiSelectable:Ke,ariaOrientation:null,ariaOwns:we,ariaPlaceholder:null,ariaPosInSet:K,ariaPressed:Ke,ariaReadOnly:Ke,ariaRelevant:null,ariaRequired:Ke,ariaRoleDescription:we,ariaRowCount:K,ariaRowIndex:K,ariaRowSpan:K,ariaSelected:Ke,ariaSetSize:K,ariaSort:null,ariaValueMax:K,ariaValueMin:K,ariaValueNow:K,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function ww(e,t){return t in e?e[t]:t}function Sw(e,t){return ww(e,t.toLowerCase())}const Z4=io({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:js,acceptCharset:we,accessKey:we,action:null,allow:null,allowFullScreen:oe,allowPaymentRequest:oe,allowUserMedia:oe,alt:null,as:null,async:oe,autoCapitalize:null,autoComplete:we,autoFocus:oe,autoPlay:oe,blocking:we,capture:null,charSet:null,checked:oe,cite:null,className:we,cols:K,colSpan:null,content:null,contentEditable:Ke,controls:oe,controlsList:we,coords:K|js,crossOrigin:null,data:null,dateTime:null,decoding:null,default:oe,defer:oe,dir:null,dirName:null,disabled:oe,download:ef,draggable:Ke,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:oe,formTarget:null,headers:we,height:K,hidden:ef,high:K,href:null,hrefLang:null,htmlFor:we,httpEquiv:we,id:null,imageSizes:null,imageSrcSet:null,inert:oe,inputMode:null,integrity:null,is:null,isMap:oe,itemId:null,itemProp:we,itemRef:we,itemScope:oe,itemType:we,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:oe,low:K,manifest:null,max:null,maxLength:K,media:null,method:null,min:null,minLength:K,multiple:oe,muted:oe,name:null,nonce:null,noModule:oe,noValidate:oe,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:oe,optimum:K,pattern:null,ping:we,placeholder:null,playsInline:oe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:oe,referrerPolicy:null,rel:we,required:oe,reversed:oe,rows:K,rowSpan:K,sandbox:we,scope:null,scoped:oe,seamless:oe,selected:oe,shadowRootClonable:oe,shadowRootDelegatesFocus:oe,shadowRootMode:null,shape:null,size:K,sizes:null,slot:null,span:K,spellCheck:Ke,src:null,srcDoc:null,srcLang:null,srcSet:null,start:K,step:null,style:null,tabIndex:K,target:null,title:null,translate:null,type:null,typeMustMatch:oe,useMap:null,value:Ke,width:K,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:we,axis:null,background:null,bgColor:null,border:K,borderColor:null,bottomMargin:K,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:oe,declare:oe,event:null,face:null,frame:null,frameBorder:null,hSpace:K,leftMargin:K,link:null,longDesc:null,lowSrc:null,marginHeight:K,marginWidth:K,noResize:oe,noHref:oe,noShade:oe,noWrap:oe,object:null,profile:null,prompt:null,rev:null,rightMargin:K,rules:null,scheme:null,scrolling:Ke,standby:null,summary:null,text:null,topMargin:K,valueType:null,version:null,vAlign:null,vLink:null,vSpace:K,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:oe,disableRemotePlayback:oe,prefix:null,property:null,results:K,security:null,unselectable:null},space:"html",transform:Sw}),e3=io({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Qt,accentHeight:K,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:K,amplitude:K,arabicForm:null,ascent:K,attributeName:null,attributeType:null,azimuth:K,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:K,by:null,calcMode:null,capHeight:K,className:we,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:K,diffuseConstant:K,direction:null,display:null,dur:null,divisor:K,dominantBaseline:null,download:oe,dx:null,dy:null,edgeMode:null,editable:null,elevation:K,enableBackground:null,end:null,event:null,exponent:K,externalResourcesRequired:null,fill:null,fillOpacity:K,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:js,g2:js,glyphName:js,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:K,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:K,horizOriginX:K,horizOriginY:K,id:null,ideographic:K,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:K,k:K,k1:K,k2:K,k3:K,k4:K,kernelMatrix:Qt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:K,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:K,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:K,overlineThickness:K,paintOrder:null,panose1:null,path:null,pathLength:K,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:we,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:K,pointsAtY:K,pointsAtZ:K,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Qt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Qt,rev:Qt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Qt,requiredFeatures:Qt,requiredFonts:Qt,requiredFormats:Qt,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:K,specularExponent:K,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:K,strikethroughThickness:K,string:null,stroke:null,strokeDashArray:Qt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:K,strokeOpacity:K,strokeWidth:null,style:null,surfaceScale:K,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Qt,tabIndex:K,tableValues:null,target:null,targetX:K,targetY:K,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Qt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:K,underlineThickness:K,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:K,values:null,vAlphabetic:K,vMathematical:K,vectorEffect:null,vHanging:K,vIdeographic:K,version:null,vertAdvY:K,vertOriginX:K,vertOriginY:K,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:K,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:ww}),bw=io({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Cw=io({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Sw}),kw=io({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),t3={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},r3=/[A-Z]/g,N_=/-[a-z]/g,i3=/^data[-\w.:]+$/i;function n3(e,t){const r=Zd(t);let i=t,n=Kt;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&i3.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(N_,o3);i="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!N_.test(s)){let o=s.replace(r3,s3);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}n=Ep}return new n(i,t)}function s3(e){return"-"+e.toLowerCase()}function o3(e){return e.charAt(1).toUpperCase()}const a3=yw([xw,Z4,bw,Cw,kw],"html"),jp=yw([xw,e3,bw,Cw,kw],"svg");function l3(e){return e.join(" ").trim()}var Pp={},E_=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,c3=/\n/g,u3=/^\s*/,h3=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,d3=/^:\s*/,f3=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,p3=/^[;\s]*/,m3=/^\s+|\s+$/g,g3=`
407
+ `,j_="/",P_="*",Sn="",_3="comment",v3="declaration";function y3(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var r=1,i=1;function n(m){var y=m.match(c3);y&&(r+=y.length);var C=m.lastIndexOf(g3);i=~C?m.length-C:i+m.length}function s(){var m={line:r,column:i};return function(y){return y.position=new o(m),c(),y}}function o(m){this.start=m,this.end={line:r,column:i},this.source=t.source}o.prototype.content=e;function a(m){var y=new Error(t.source+":"+r+":"+i+": "+m);if(y.reason=m,y.filename=t.source,y.line=r,y.column=i,y.source=e,!t.silent)throw y}function u(m){var y=m.exec(e);if(y){var C=y[0];return n(C),e=e.slice(C.length),y}}function c(){u(u3)}function h(m){var y;for(m=m||[];y=d();)y!==!1&&m.push(y);return m}function d(){var m=s();if(!(j_!=e.charAt(0)||P_!=e.charAt(1))){for(var y=2;Sn!=e.charAt(y)&&(P_!=e.charAt(y)||j_!=e.charAt(y+1));)++y;if(y+=2,Sn===e.charAt(y-1))return a("End of comment missing");var C=e.slice(2,y-2);return i+=2,n(C),e=e.slice(y),i+=2,m({type:_3,comment:C})}}function f(){var m=s(),y=u(h3);if(y){if(d(),!u(d3))return a("property missing ':'");var C=u(f3),g=m({type:v3,property:M_(y[0].replace(E_,Sn)),value:C?M_(C[0].replace(E_,Sn)):Sn});return u(p3),g}}function p(){var m=[];h(m);for(var y;y=f();)y!==!1&&(m.push(y),h(m));return m}return c(),p()}function M_(e){return e?e.replace(m3,Sn):Sn}var x3=y3,w3=Fl&&Fl.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Pp,"__esModule",{value:!0});Pp.default=b3;const S3=w3(x3);function b3(e,t){let r=null;if(!e||typeof e!="string")return r;const i=(0,S3.default)(e),n=typeof t=="function";return i.forEach(s=>{if(s.type!=="declaration")return;const{property:o,value:a}=s;n?t(o,a,s):a&&(r=r||{},r[o]=a)}),r}var Zc={};Object.defineProperty(Zc,"__esModule",{value:!0});Zc.camelCase=void 0;var C3=/^--[a-zA-Z0-9_-]+$/,k3=/-([a-z])/g,N3=/^[^-]+$/,E3=/^-(webkit|moz|ms|o|khtml)-/,j3=/^-(ms)-/,P3=function(e){return!e||N3.test(e)||C3.test(e)},M3=function(e,t){return t.toUpperCase()},T_=function(e,t){return"".concat(t,"-")},T3=function(e,t){return t===void 0&&(t={}),P3(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(j3,T_):e=e.replace(E3,T_),e.replace(k3,M3))};Zc.camelCase=T3;var R3=Fl&&Fl.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},D3=R3(Pp),L3=Zc;function rf(e,t){var r={};return!e||typeof e!="string"||(0,D3.default)(e,function(i,n){i&&n&&(r[(0,L3.camelCase)(i,t)]=n)}),r}rf.default=rf;var A3=rf;const O3=bc(A3),Nw=Ew("end"),Mp=Ew("start");function Ew(e){return t;function t(r){const i=r&&r.position&&r.position[e]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function B3(e){const t=Mp(e),r=Nw(e);if(t&&r)return{start:t,end:r}}function Vo(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?R_(e.position):"start"in e||"end"in e?R_(e):"line"in e||"column"in e?nf(e):""}function nf(e){return D_(e&&e.line)+":"+D_(e&&e.column)}function R_(e){return nf(e&&e.start)+"-"+nf(e&&e.end)}function D_(e){return e&&typeof e=="number"?e:1}class wt extends Error{constructor(t,r,i){super(),typeof r=="string"&&(i=r,r=void 0);let n="",s={},o=!1;if(r&&("line"in r&&"column"in r?s={place:r}:"start"in r&&"end"in r?s={place:r}:"type"in r?s={ancestors:[r],place:r.position}:s={...r}),typeof t=="string"?n=t:!s.cause&&t&&(o=!0,n=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof i=="string"){const u=i.indexOf(":");u===-1?s.ruleId=i:(s.source=i.slice(0,u),s.ruleId=i.slice(u+1))}if(!s.place&&s.ancestors&&s.ancestors){const u=s.ancestors[s.ancestors.length-1];u&&(s.place=u.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=n,this.line=a?a.line:void 0,this.name=Vo(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}wt.prototype.file="";wt.prototype.name="";wt.prototype.reason="";wt.prototype.message="";wt.prototype.stack="";wt.prototype.column=void 0;wt.prototype.line=void 0;wt.prototype.ancestors=void 0;wt.prototype.cause=void 0;wt.prototype.fatal=void 0;wt.prototype.place=void 0;wt.prototype.ruleId=void 0;wt.prototype.source=void 0;const Tp={}.hasOwnProperty,z3=new Map,I3=/[A-Z]/g,F3=new Set(["table","tbody","thead","tfoot","tr"]),H3=new Set(["td","th"]),jw="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function $3(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=t.filePath||void 0;let i;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");i=Q3(r,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");i=X3(r,t.jsx,t.jsxs)}const n={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:i,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?jp:a3,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=Pw(n,e,void 0);return s&&typeof s!="string"?s:n.create(e,n.Fragment,{children:s||void 0},void 0)}function Pw(e,t,r){if(t.type==="element")return W3(e,t,r);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return U3(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return q3(e,t,r);if(t.type==="mdxjsEsm")return K3(e,t);if(t.type==="root")return V3(e,t,r);if(t.type==="text")return Y3(e,t)}function W3(e,t,r){const i=e.schema;let n=i;t.tagName.toLowerCase()==="svg"&&i.space==="html"&&(n=jp,e.schema=n),e.ancestors.push(t);const s=Tw(e,t.tagName,!1),o=G3(e,t);let a=Dp(e,t);return F3.has(t.tagName)&&(a=a.filter(function(u){return typeof u=="string"?!G4(u):!0})),Mw(e,o,s,t),Rp(o,a),e.ancestors.pop(),e.schema=i,e.create(t,s,o,r)}function U3(e,t){if(t.data&&t.data.estree&&e.evaluater){const i=t.data.estree.body[0];return i.type,e.evaluater.evaluateExpression(i.expression)}_a(e,t.position)}function K3(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);_a(e,t.position)}function q3(e,t,r){const i=e.schema;let n=i;t.name==="svg"&&i.space==="html"&&(n=jp,e.schema=n),e.ancestors.push(t);const s=t.name===null?e.Fragment:Tw(e,t.name,!0),o=J3(e,t),a=Dp(e,t);return Mw(e,o,s,t),Rp(o,a),e.ancestors.pop(),e.schema=i,e.create(t,s,o,r)}function V3(e,t,r){const i={};return Rp(i,Dp(e,t)),e.create(t,e.Fragment,i,r)}function Y3(e,t){return t.value}function Mw(e,t,r,i){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(t.node=i)}function Rp(e,t){if(t.length>0){const r=t.length>1?t:t[0];r&&(e.children=r)}}function X3(e,t,r){return i;function i(n,s,o,a){const c=Array.isArray(o.children)?r:t;return a?c(s,o,a):c(s,o)}}function Q3(e,t){return r;function r(i,n,s,o){const a=Array.isArray(s.children),u=Mp(i);return t(n,s,o,a,{columnNumber:u?u.column-1:void 0,fileName:e,lineNumber:u?u.line:void 0},void 0)}}function G3(e,t){const r={};let i,n;for(n in t.properties)if(n!=="children"&&Tp.call(t.properties,n)){const s=Z3(e,n,t.properties[n]);if(s){const[o,a]=s;e.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&H3.has(t.tagName)?i=a:r[o]=a}}if(i){const s=r.style||(r.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return r}function J3(e,t){const r={};for(const i of t.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&e.evaluater){const s=i.data.estree.body[0];s.type;const o=s.expression;o.type;const a=o.properties[0];a.type,Object.assign(r,e.evaluater.evaluateExpression(a.argument))}else _a(e,t.position);else{const n=i.name;let s;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&e.evaluater){const a=i.value.data.estree.body[0];a.type,s=e.evaluater.evaluateExpression(a.expression)}else _a(e,t.position);else s=i.value===null?!0:i.value;r[n]=s}return r}function Dp(e,t){const r=[];let i=-1;const n=e.passKeys?new Map:z3;for(;++i<t.children.length;){const s=t.children[i];let o;if(e.passKeys){const u=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(u){const c=n.get(u)||0;o=u+"-"+c,n.set(u,c+1)}}const a=Pw(e,s,o);a!==void 0&&r.push(a)}return r}function Z3(e,t,r){const i=n3(e.schema,t);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=i.commaSeparated?q4(r):l3(r)),i.property==="style"){let n=typeof r=="object"?r:ej(e,String(r));return e.stylePropertyNameCase==="css"&&(n=tj(n)),["style",n]}return[e.elementAttributeNameCase==="react"&&i.space?t3[i.property]||i.property:i.attribute,r]}}function ej(e,t){try{return O3(t,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const i=r,n=new wt("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=jw+"#cannot-parse-style-attribute",n}}function Tw(e,t,r){let i;if(!r)i={type:"Literal",value:t};else if(t.includes(".")){const n=t.split(".");let s=-1,o;for(;++s<n.length;){const a=b_(n[s])?{type:"Identifier",name:n[s]}:{type:"Literal",value:n[s]};o=o?{type:"MemberExpression",object:o,property:a,computed:!!(s&&a.type==="Literal"),optional:!1}:a}i=o}else i=b_(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(i.type==="Literal"){const n=i.value;return Tp.call(e.components,n)?e.components[n]:n}if(e.evaluater)return e.evaluater.evaluateExpression(i);_a(e)}function _a(e,t){const r=new wt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=jw+"#cannot-handle-mdx-estrees-without-createevaluater",r}function tj(e){const t={};let r;for(r in e)Tp.call(e,r)&&(t[rj(r)]=e[r]);return t}function rj(e){let t=e.replace(I3,ij);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function ij(e){return"-"+e.toLowerCase()}const Yu={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},nj={};function sj(e,t){const r=nj,i=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,n=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return Rw(e,i,n)}function Rw(e,t,r){if(oj(e)){if("value"in e)return e.type==="html"&&!r?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return L_(e.children,t,r)}return Array.isArray(e)?L_(e,t,r):""}function L_(e,t,r){const i=[];let n=-1;for(;++n<e.length;)i[n]=Rw(e[n],t,r);return i.join("")}function oj(e){return!!(e&&typeof e=="object")}const A_=document.createElement("i");function Lp(e){const t="&"+e+";";A_.innerHTML=t;const r=A_.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===t?!1:r}function ei(e,t,r,i){const n=e.length;let s=0,o;if(t<0?t=-t>n?0:n+t:t=t>n?n:t,r=r>0?r:0,i.length<1e4)o=Array.from(i),o.unshift(t,r),e.splice(...o);else for(r&&e.splice(t,r);s<i.length;)o=i.slice(s,s+1e4),o.unshift(t,0),e.splice(...o),s+=1e4,t+=1e4}function fr(e,t){return e.length>0?(ei(e,e.length,0,t),e):t}const O_={}.hasOwnProperty;function aj(e){const t={};let r=-1;for(;++r<e.length;)lj(t,e[r]);return t}function lj(e,t){let r;for(r in t){const n=(O_.call(e,r)?e[r]:void 0)||(e[r]={}),s=t[r];let o;if(s)for(o in s){O_.call(n,o)||(n[o]=[]);const a=s[o];cj(n[o],Array.isArray(a)?a:a?[a]:[])}}}function cj(e,t){let r=-1;const i=[];for(;++r<t.length;)(t[r].add==="after"?e:i).push(t[r]);ei(e,0,0,i)}function Dw(e,t){const r=Number.parseInt(e,t);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function Ps(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Yr=fn(/[A-Za-z]/),Zt=fn(/[\dA-Za-z]/),uj=fn(/[#-'*+\--9=?A-Z^-~]/);function sf(e){return e!==null&&(e<32||e===127)}const of=fn(/\d/),hj=fn(/[\dA-Fa-f]/),dj=fn(/[!-/:-@[-`{-~]/);function re(e){return e!==null&&e<-2}function Ut(e){return e!==null&&(e<0||e===32)}function me(e){return e===-2||e===-1||e===32}const fj=fn(new RegExp("\\p{P}|\\p{S}","u")),pj=fn(/\s/);function fn(e){return t;function t(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function no(e){const t=[];let r=-1,i=0,n=0;for(;++r<e.length;){const s=e.charCodeAt(r);let o="";if(s===37&&Zt(e.charCodeAt(r+1))&&Zt(e.charCodeAt(r+2)))n=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(o=String.fromCharCode(s));else if(s>55295&&s<57344){const a=e.charCodeAt(r+1);s<56320&&a>56319&&a<57344?(o=String.fromCharCode(s,a),n=1):o="�"}else o=String.fromCharCode(s);o&&(t.push(e.slice(i,r),encodeURIComponent(o)),i=r+n+1,o=""),n&&(r+=n,n=0)}return t.join("")+e.slice(i)}function be(e,t,r,i){const n=i?i-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(u){return me(u)?(e.enter(r),a(u)):t(u)}function a(u){return me(u)&&s++<n?(e.consume(u),a):(e.exit(r),t(u))}}const mj={tokenize:gj};function gj(e){const t=e.attempt(this.parser.constructs.contentInitial,i,n);let r;return t;function i(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),be(e,t,"linePrefix")}function n(a){return e.enter("paragraph"),s(a)}function s(a){const u=e.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=u),r=u,o(a)}function o(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return re(a)?(e.consume(a),e.exit("chunkText"),s):(e.consume(a),o)}}const _j={tokenize:vj},B_={tokenize:yj};function vj(e){const t=this,r=[];let i=0,n,s,o;return a;function a(v){if(i<r.length){const x=r[i];return t.containerState=x[1],e.attempt(x[0].continuation,u,c)(v)}return c(v)}function u(v){if(i++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,n&&_();const x=t.events.length;let k=x,b;for(;k--;)if(t.events[k][0]==="exit"&&t.events[k][1].type==="chunkFlow"){b=t.events[k][1].end;break}g(i);let j=x;for(;j<t.events.length;)t.events[j][1].end={...b},j++;return ei(t.events,k+1,0,t.events.slice(x)),t.events.length=j,c(v)}return a(v)}function c(v){if(i===r.length){if(!n)return f(v);if(n.currentConstruct&&n.currentConstruct.concrete)return m(v);t.interrupt=!!(n.currentConstruct&&!n._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(B_,h,d)(v)}function h(v){return n&&_(),g(i),f(v)}function d(v){return t.parser.lazy[t.now().line]=i!==r.length,o=t.now().offset,m(v)}function f(v){return t.containerState={},e.attempt(B_,p,m)(v)}function p(v){return i++,r.push([t.currentConstruct,t.containerState]),f(v)}function m(v){if(v===null){n&&_(),g(0),e.consume(v);return}return n=n||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:n,contentType:"flow",previous:s}),y(v)}function y(v){if(v===null){C(e.exit("chunkFlow"),!0),g(0),e.consume(v);return}return re(v)?(e.consume(v),C(e.exit("chunkFlow")),i=0,t.interrupt=void 0,a):(e.consume(v),y)}function C(v,x){const k=t.sliceStream(v);if(x&&k.push(null),v.previous=s,s&&(s.next=v),s=v,n.defineSkip(v.start),n.write(k),t.parser.lazy[v.start.line]){let b=n.events.length;for(;b--;)if(n.events[b][1].start.offset<o&&(!n.events[b][1].end||n.events[b][1].end.offset>o))return;const j=t.events.length;let L=j,I,P;for(;L--;)if(t.events[L][0]==="exit"&&t.events[L][1].type==="chunkFlow"){if(I){P=t.events[L][1].end;break}I=!0}for(g(i),b=j;b<t.events.length;)t.events[b][1].end={...P},b++;ei(t.events,L+1,0,t.events.slice(j)),t.events.length=b}}function g(v){let x=r.length;for(;x-- >v;){const k=r[x];t.containerState=k[1],k[0].exit.call(t,e)}r.length=v}function _(){n.write([null]),s=void 0,n=void 0,t.containerState._closeFlow=void 0}}function yj(e,t,r){return be(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function z_(e){if(e===null||Ut(e)||pj(e))return 1;if(fj(e))return 2}function Ap(e,t,r){const i=[];let n=-1;for(;++n<e.length;){const s=e[n].resolveAll;s&&!i.includes(s)&&(t=s(t,r),i.push(s))}return t}const af={name:"attention",resolveAll:xj,tokenize:wj};function xj(e,t){let r=-1,i,n,s,o,a,u,c,h;for(;++r<e.length;)if(e[r][0]==="enter"&&e[r][1].type==="attentionSequence"&&e[r][1]._close){for(i=r;i--;)if(e[i][0]==="exit"&&e[i][1].type==="attentionSequence"&&e[i][1]._open&&t.sliceSerialize(e[i][1]).charCodeAt(0)===t.sliceSerialize(e[r][1]).charCodeAt(0)){if((e[i][1]._close||e[r][1]._open)&&(e[r][1].end.offset-e[r][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[r][1].end.offset-e[r][1].start.offset)%3))continue;u=e[i][1].end.offset-e[i][1].start.offset>1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const d={...e[i][1].end},f={...e[r][1].start};I_(d,-u),I_(f,u),o={type:u>1?"strongSequence":"emphasisSequence",start:d,end:{...e[i][1].end}},a={type:u>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:f},s={type:u>1?"strongText":"emphasisText",start:{...e[i][1].end},end:{...e[r][1].start}},n={type:u>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},e[i][1].end={...o.start},e[r][1].start={...a.end},c=[],e[i][1].end.offset-e[i][1].start.offset&&(c=fr(c,[["enter",e[i][1],t],["exit",e[i][1],t]])),c=fr(c,[["enter",n,t],["enter",o,t],["exit",o,t],["enter",s,t]]),c=fr(c,Ap(t.parser.constructs.insideSpan.null,e.slice(i+1,r),t)),c=fr(c,[["exit",s,t],["enter",a,t],["exit",a,t],["exit",n,t]]),e[r][1].end.offset-e[r][1].start.offset?(h=2,c=fr(c,[["enter",e[r][1],t],["exit",e[r][1],t]])):h=0,ei(e,i-1,r-i+3,c),r=i+c.length-h-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function wj(e,t){const r=this.parser.constructs.attentionMarkers.null,i=this.previous,n=z_(i);let s;return o;function o(u){return s=u,e.enter("attentionSequence"),a(u)}function a(u){if(u===s)return e.consume(u),a;const c=e.exit("attentionSequence"),h=z_(u),d=!h||h===2&&n||r.includes(u),f=!n||n===2&&h||r.includes(i);return c._open=!!(s===42?d:d&&(n||!f)),c._close=!!(s===42?f:f&&(h||!d)),t(u)}}function I_(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Sj={name:"autolink",tokenize:bj};function bj(e,t,r){let i=0;return n;function n(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),s}function s(p){return Yr(p)?(e.consume(p),o):p===64?r(p):c(p)}function o(p){return p===43||p===45||p===46||Zt(p)?(i=1,a(p)):c(p)}function a(p){return p===58?(e.consume(p),i=0,u):(p===43||p===45||p===46||Zt(p))&&i++<32?(e.consume(p),a):(i=0,c(p))}function u(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||sf(p)?r(p):(e.consume(p),u)}function c(p){return p===64?(e.consume(p),h):uj(p)?(e.consume(p),c):r(p)}function h(p){return Zt(p)?d(p):r(p)}function d(p){return p===46?(e.consume(p),i=0,h):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):f(p)}function f(p){if((p===45||Zt(p))&&i++<63){const m=p===45?f:d;return e.consume(p),m}return r(p)}}const eu={partial:!0,tokenize:Cj};function Cj(e,t,r){return i;function i(s){return me(s)?be(e,n,"linePrefix")(s):n(s)}function n(s){return s===null||re(s)?t(s):r(s)}}const Lw={continuation:{tokenize:Nj},exit:Ej,name:"blockQuote",tokenize:kj};function kj(e,t,r){const i=this;return n;function n(o){if(o===62){const a=i.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),s}return r(o)}function s(o){return me(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function Nj(e,t,r){const i=this;return n;function n(o){return me(o)?be(e,s,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return e.attempt(Lw,t,r)(o)}}function Ej(e){e.exit("blockQuote")}const Aw={name:"characterEscape",tokenize:jj};function jj(e,t,r){return i;function i(s){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(s),e.exit("escapeMarker"),n}function n(s){return dj(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):r(s)}}const Ow={name:"characterReference",tokenize:Pj};function Pj(e,t,r){const i=this;let n=0,s,o;return a;function a(d){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),u}function u(d){return d===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(d),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),s=31,o=Zt,h(d))}function c(d){return d===88||d===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(d),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,o=hj,h):(e.enter("characterReferenceValue"),s=7,o=of,h(d))}function h(d){if(d===59&&n){const f=e.exit("characterReferenceValue");return o===Zt&&!Lp(i.sliceSerialize(f))?r(d):(e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(d)&&n++<s?(e.consume(d),h):r(d)}}const F_={partial:!0,tokenize:Tj},H_={concrete:!0,name:"codeFenced",tokenize:Mj};function Mj(e,t,r){const i=this,n={partial:!0,tokenize:k};let s=0,o=0,a;return u;function u(b){return c(b)}function c(b){const j=i.events[i.events.length-1];return s=j&&j[1].type==="linePrefix"?j[2].sliceSerialize(j[1],!0).length:0,a=b,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),h(b)}function h(b){return b===a?(o++,e.consume(b),h):o<3?r(b):(e.exit("codeFencedFenceSequence"),me(b)?be(e,d,"whitespace")(b):d(b))}function d(b){return b===null||re(b)?(e.exit("codeFencedFence"),i.interrupt?t(b):e.check(F_,y,x)(b)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(b))}function f(b){return b===null||re(b)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(b)):me(b)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),be(e,p,"whitespace")(b)):b===96&&b===a?r(b):(e.consume(b),f)}function p(b){return b===null||re(b)?d(b):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),m(b))}function m(b){return b===null||re(b)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(b)):b===96&&b===a?r(b):(e.consume(b),m)}function y(b){return e.attempt(n,x,C)(b)}function C(b){return e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),g}function g(b){return s>0&&me(b)?be(e,_,"linePrefix",s+1)(b):_(b)}function _(b){return b===null||re(b)?e.check(F_,y,x)(b):(e.enter("codeFlowValue"),v(b))}function v(b){return b===null||re(b)?(e.exit("codeFlowValue"),_(b)):(e.consume(b),v)}function x(b){return e.exit("codeFenced"),t(b)}function k(b,j,L){let I=0;return P;function P(E){return b.enter("lineEnding"),b.consume(E),b.exit("lineEnding"),D}function D(E){return b.enter("codeFencedFence"),me(E)?be(b,M,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):M(E)}function M(E){return E===a?(b.enter("codeFencedFenceSequence"),R(E)):L(E)}function R(E){return E===a?(I++,b.consume(E),R):I>=o?(b.exit("codeFencedFenceSequence"),me(E)?be(b,O,"whitespace")(E):O(E)):L(E)}function O(E){return E===null||re(E)?(b.exit("codeFencedFence"),j(E)):L(E)}}}function Tj(e,t,r){const i=this;return n;function n(o){return o===null?r(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s)}function s(o){return i.parser.lazy[i.now().line]?r(o):t(o)}}const Xu={name:"codeIndented",tokenize:Dj},Rj={partial:!0,tokenize:Lj};function Dj(e,t,r){const i=this;return n;function n(c){return e.enter("codeIndented"),be(e,s,"linePrefix",5)(c)}function s(c){const h=i.events[i.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?o(c):r(c)}function o(c){return c===null?u(c):re(c)?e.attempt(Rj,o,u)(c):(e.enter("codeFlowValue"),a(c))}function a(c){return c===null||re(c)?(e.exit("codeFlowValue"),o(c)):(e.consume(c),a)}function u(c){return e.exit("codeIndented"),t(c)}}function Lj(e,t,r){const i=this;return n;function n(o){return i.parser.lazy[i.now().line]?r(o):re(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n):be(e,s,"linePrefix",5)(o)}function s(o){const a=i.events[i.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):re(o)?n(o):r(o)}}const Aj={name:"codeText",previous:Bj,resolve:Oj,tokenize:zj};function Oj(e){let t=e.length-4,r=3,i,n;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(i=r;++i<t;)if(e[i][1].type==="codeTextData"){e[r][1].type="codeTextPadding",e[t][1].type="codeTextPadding",r+=2,t-=2;break}}for(i=r-1,t++;++i<=t;)n===void 0?i!==t&&e[i][1].type!=="lineEnding"&&(n=i):(i===t||e[i][1].type==="lineEnding")&&(e[n][1].type="codeTextData",i!==n+2&&(e[n][1].end=e[i-1][1].end,e.splice(n+2,i-n-2),t-=i-n-2,i=n+2),n=void 0);return e}function Bj(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function zj(e,t,r){let i=0,n,s;return o;function o(d){return e.enter("codeText"),e.enter("codeTextSequence"),a(d)}function a(d){return d===96?(e.consume(d),i++,a):(e.exit("codeTextSequence"),u(d))}function u(d){return d===null?r(d):d===32?(e.enter("space"),e.consume(d),e.exit("space"),u):d===96?(s=e.enter("codeTextSequence"),n=0,h(d)):re(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),u):(e.enter("codeTextData"),c(d))}function c(d){return d===null||d===32||d===96||re(d)?(e.exit("codeTextData"),u(d)):(e.consume(d),c)}function h(d){return d===96?(e.consume(d),n++,h):n===i?(e.exit("codeTextSequence"),e.exit("codeText"),t(d)):(s.type="codeTextData",c(d))}}class Ij{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,r){const i=r??Number.POSITIVE_INFINITY;return i<this.left.length?this.left.slice(t,i):t>this.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(t,r,i){const n=r||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-n,Number.POSITIVE_INFINITY);return i&&ko(this.left,i),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),ko(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),ko(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const r=this.left.splice(t,Number.POSITIVE_INFINITY);ko(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);ko(this.left,r.reverse())}}}function ko(e,t){let r=0;if(t.length<1e4)e.push(...t);else for(;r<t.length;)e.push(...t.slice(r,r+1e4)),r+=1e4}function Bw(e){const t={};let r=-1,i,n,s,o,a,u,c;const h=new Ij(e);for(;++r<h.length;){for(;r in t;)r=t[r];if(i=h.get(r),r&&i[1].type==="chunkFlow"&&h.get(r-1)[1].type==="listItemPrefix"&&(u=i[1]._tokenizer.events,s=0,s<u.length&&u[s][1].type==="lineEndingBlank"&&(s+=2),s<u.length&&u[s][1].type==="content"))for(;++s<u.length&&u[s][1].type!=="content";)u[s][1].type==="chunkText"&&(u[s][1]._isInFirstContentOfListItem=!0,s++);if(i[0]==="enter")i[1].contentType&&(Object.assign(t,Fj(h,r)),r=t[r],c=!0);else if(i[1]._container){for(s=r,n=void 0;s--;)if(o=h.get(s),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(n&&(h.get(n)[1].type="lineEndingBlank"),o[1].type="lineEnding",n=s);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;n&&(i[1].end={...h.get(n)[1].start},a=h.slice(n,r),a.unshift(i),h.splice(n,r-n+1,a))}}return ei(e,0,Number.POSITIVE_INFINITY,h.slice(0)),!c}function Fj(e,t){const r=e.get(t)[1],i=e.get(t)[2];let n=t-1;const s=[];let o=r._tokenizer;o||(o=i.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const a=o.events,u=[],c={};let h,d,f=-1,p=r,m=0,y=0;const C=[y];for(;p;){for(;e.get(++n)[1]!==p;);s.push(n),p._tokenizer||(h=i.sliceStream(p),p.next||h.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(h),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=r;++f<a.length;)a[f][0]==="exit"&&a[f-1][0]==="enter"&&a[f][1].type===a[f-1][1].type&&a[f][1].start.line!==a[f][1].end.line&&(y=f+1,C.push(y),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):C.pop(),f=C.length;f--;){const g=a.slice(C[f],C[f+1]),_=s.pop();u.push([_,_+g.length-1]),e.splice(_,2,g)}for(u.reverse(),f=-1;++f<u.length;)c[m+u[f][0]]=m+u[f][1],m+=u[f][1]-u[f][0]-1;return c}const Hj={resolve:Wj,tokenize:Uj},$j={partial:!0,tokenize:Kj};function Wj(e){return Bw(e),e}function Uj(e,t){let r;return i;function i(a){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),n(a)}function n(a){return a===null?s(a):re(a)?e.check($j,o,s)(a):(e.consume(a),n)}function s(a){return e.exit("chunkContent"),e.exit("content"),t(a)}function o(a){return e.consume(a),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,n}}function Kj(e,t,r){const i=this;return n;function n(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),be(e,s,"linePrefix")}function s(o){if(o===null||re(o))return r(o);const a=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):e.interrupt(i.parser.constructs.flow,r,t)(o)}}function zw(e,t,r,i,n,s,o,a,u){const c=u||Number.POSITIVE_INFINITY;let h=0;return d;function d(g){return g===60?(e.enter(i),e.enter(n),e.enter(s),e.consume(g),e.exit(s),f):g===null||g===32||g===41||sf(g)?r(g):(e.enter(i),e.enter(o),e.enter(a),e.enter("chunkString",{contentType:"string"}),y(g))}function f(g){return g===62?(e.enter(s),e.consume(g),e.exit(s),e.exit(n),e.exit(i),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),p(g))}function p(g){return g===62?(e.exit("chunkString"),e.exit(a),f(g)):g===null||g===60||re(g)?r(g):(e.consume(g),g===92?m:p)}function m(g){return g===60||g===62||g===92?(e.consume(g),p):p(g)}function y(g){return!h&&(g===null||g===41||Ut(g))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(i),t(g)):h<c&&g===40?(e.consume(g),h++,y):g===41?(e.consume(g),h--,y):g===null||g===32||g===40||sf(g)?r(g):(e.consume(g),g===92?C:y)}function C(g){return g===40||g===41||g===92?(e.consume(g),y):y(g)}}function Iw(e,t,r,i,n,s){const o=this;let a=0,u;return c;function c(p){return e.enter(i),e.enter(n),e.consume(p),e.exit(n),e.enter(s),h}function h(p){return a>999||p===null||p===91||p===93&&!u||p===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?r(p):p===93?(e.exit(s),e.enter(n),e.consume(p),e.exit(n),e.exit(i),t):re(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),h):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===null||p===91||p===93||re(p)||a++>999?(e.exit("chunkString"),h(p)):(e.consume(p),u||(u=!me(p)),p===92?f:d)}function f(p){return p===91||p===92||p===93?(e.consume(p),a++,d):d(p)}}function Fw(e,t,r,i,n,s){let o;return a;function a(f){return f===34||f===39||f===40?(e.enter(i),e.enter(n),e.consume(f),e.exit(n),o=f===40?41:f,u):r(f)}function u(f){return f===o?(e.enter(n),e.consume(f),e.exit(n),e.exit(i),t):(e.enter(s),c(f))}function c(f){return f===o?(e.exit(s),u(o)):f===null?r(f):re(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),be(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),h(f))}function h(f){return f===o||f===null||re(f)?(e.exit("chunkString"),c(f)):(e.consume(f),f===92?d:h)}function d(f){return f===o||f===92?(e.consume(f),h):h(f)}}function Yo(e,t){let r;return i;function i(n){return re(n)?(e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),r=!0,i):me(n)?be(e,i,r?"linePrefix":"lineSuffix")(n):t(n)}}const qj={name:"definition",tokenize:Yj},Vj={partial:!0,tokenize:Xj};function Yj(e,t,r){const i=this;let n;return s;function s(p){return e.enter("definition"),o(p)}function o(p){return Iw.call(i,e,a,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function a(p){return n=Ps(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),u):r(p)}function u(p){return Ut(p)?Yo(e,c)(p):c(p)}function c(p){return zw(e,h,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function h(p){return e.attempt(Vj,d,d)(p)}function d(p){return me(p)?be(e,f,"whitespace")(p):f(p)}function f(p){return p===null||re(p)?(e.exit("definition"),i.parser.defined.push(n),t(p)):r(p)}}function Xj(e,t,r){return i;function i(a){return Ut(a)?Yo(e,n)(a):r(a)}function n(a){return Fw(e,s,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return me(a)?be(e,o,"whitespace")(a):o(a)}function o(a){return a===null||re(a)?t(a):r(a)}}const Qj={name:"hardBreakEscape",tokenize:Gj};function Gj(e,t,r){return i;function i(s){return e.enter("hardBreakEscape"),e.consume(s),n}function n(s){return re(s)?(e.exit("hardBreakEscape"),t(s)):r(s)}}const Jj={name:"headingAtx",resolve:Zj,tokenize:eP};function Zj(e,t){let r=e.length-2,i=3,n,s;return e[i][1].type==="whitespace"&&(i+=2),r-2>i&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(i===r-1||r-4>i&&e[r-2][1].type==="whitespace")&&(r-=i+1===r?2:4),r>i&&(n={type:"atxHeadingText",start:e[i][1].start,end:e[r][1].end},s={type:"chunkText",start:e[i][1].start,end:e[r][1].end,contentType:"text"},ei(e,i,r-i+1,[["enter",n,t],["enter",s,t],["exit",s,t],["exit",n,t]])),e}function eP(e,t,r){let i=0;return n;function n(h){return e.enter("atxHeading"),s(h)}function s(h){return e.enter("atxHeadingSequence"),o(h)}function o(h){return h===35&&i++<6?(e.consume(h),o):h===null||Ut(h)?(e.exit("atxHeadingSequence"),a(h)):r(h)}function a(h){return h===35?(e.enter("atxHeadingSequence"),u(h)):h===null||re(h)?(e.exit("atxHeading"),t(h)):me(h)?be(e,a,"whitespace")(h):(e.enter("atxHeadingText"),c(h))}function u(h){return h===35?(e.consume(h),u):(e.exit("atxHeadingSequence"),a(h))}function c(h){return h===null||h===35||Ut(h)?(e.exit("atxHeadingText"),a(h)):(e.consume(h),c)}}const tP=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],$_=["pre","script","style","textarea"],rP={concrete:!0,name:"htmlFlow",resolveTo:sP,tokenize:oP},iP={partial:!0,tokenize:lP},nP={partial:!0,tokenize:aP};function sP(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function oP(e,t,r){const i=this;let n,s,o,a,u;return c;function c(S){return h(S)}function h(S){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(S),d}function d(S){return S===33?(e.consume(S),f):S===47?(e.consume(S),s=!0,y):S===63?(e.consume(S),n=3,i.interrupt?t:w):Yr(S)?(e.consume(S),o=String.fromCharCode(S),C):r(S)}function f(S){return S===45?(e.consume(S),n=2,p):S===91?(e.consume(S),n=5,a=0,m):Yr(S)?(e.consume(S),n=4,i.interrupt?t:w):r(S)}function p(S){return S===45?(e.consume(S),i.interrupt?t:w):r(S)}function m(S){const H="CDATA[";return S===H.charCodeAt(a++)?(e.consume(S),a===H.length?i.interrupt?t:M:m):r(S)}function y(S){return Yr(S)?(e.consume(S),o=String.fromCharCode(S),C):r(S)}function C(S){if(S===null||S===47||S===62||Ut(S)){const H=S===47,ee=o.toLowerCase();return!H&&!s&&$_.includes(ee)?(n=1,i.interrupt?t(S):M(S)):tP.includes(o.toLowerCase())?(n=6,H?(e.consume(S),g):i.interrupt?t(S):M(S)):(n=7,i.interrupt&&!i.parser.lazy[i.now().line]?r(S):s?_(S):v(S))}return S===45||Zt(S)?(e.consume(S),o+=String.fromCharCode(S),C):r(S)}function g(S){return S===62?(e.consume(S),i.interrupt?t:M):r(S)}function _(S){return me(S)?(e.consume(S),_):P(S)}function v(S){return S===47?(e.consume(S),P):S===58||S===95||Yr(S)?(e.consume(S),x):me(S)?(e.consume(S),v):P(S)}function x(S){return S===45||S===46||S===58||S===95||Zt(S)?(e.consume(S),x):k(S)}function k(S){return S===61?(e.consume(S),b):me(S)?(e.consume(S),k):v(S)}function b(S){return S===null||S===60||S===61||S===62||S===96?r(S):S===34||S===39?(e.consume(S),u=S,j):me(S)?(e.consume(S),b):L(S)}function j(S){return S===u?(e.consume(S),u=null,I):S===null||re(S)?r(S):(e.consume(S),j)}function L(S){return S===null||S===34||S===39||S===47||S===60||S===61||S===62||S===96||Ut(S)?k(S):(e.consume(S),L)}function I(S){return S===47||S===62||me(S)?v(S):r(S)}function P(S){return S===62?(e.consume(S),D):r(S)}function D(S){return S===null||re(S)?M(S):me(S)?(e.consume(S),D):r(S)}function M(S){return S===45&&n===2?(e.consume(S),A):S===60&&n===1?(e.consume(S),U):S===62&&n===4?(e.consume(S),Z):S===63&&n===3?(e.consume(S),w):S===93&&n===5?(e.consume(S),$):re(S)&&(n===6||n===7)?(e.exit("htmlFlowData"),e.check(iP,ne,R)(S)):S===null||re(S)?(e.exit("htmlFlowData"),R(S)):(e.consume(S),M)}function R(S){return e.check(nP,O,ne)(S)}function O(S){return e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),E}function E(S){return S===null||re(S)?R(S):(e.enter("htmlFlowData"),M(S))}function A(S){return S===45?(e.consume(S),w):M(S)}function U(S){return S===47?(e.consume(S),o="",T):M(S)}function T(S){if(S===62){const H=o.toLowerCase();return $_.includes(H)?(e.consume(S),Z):M(S)}return Yr(S)&&o.length<8?(e.consume(S),o+=String.fromCharCode(S),T):M(S)}function $(S){return S===93?(e.consume(S),w):M(S)}function w(S){return S===62?(e.consume(S),Z):S===45&&n===2?(e.consume(S),w):M(S)}function Z(S){return S===null||re(S)?(e.exit("htmlFlowData"),ne(S)):(e.consume(S),Z)}function ne(S){return e.exit("htmlFlow"),t(S)}}function aP(e,t,r){const i=this;return n;function n(o){return re(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):r(o)}function s(o){return i.parser.lazy[i.now().line]?r(o):t(o)}}function lP(e,t,r){return i;function i(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),e.attempt(eu,t,r)}}const cP={name:"htmlText",tokenize:uP};function uP(e,t,r){const i=this;let n,s,o;return a;function a(w){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(w),u}function u(w){return w===33?(e.consume(w),c):w===47?(e.consume(w),k):w===63?(e.consume(w),v):Yr(w)?(e.consume(w),L):r(w)}function c(w){return w===45?(e.consume(w),h):w===91?(e.consume(w),s=0,m):Yr(w)?(e.consume(w),_):r(w)}function h(w){return w===45?(e.consume(w),p):r(w)}function d(w){return w===null?r(w):w===45?(e.consume(w),f):re(w)?(o=d,U(w)):(e.consume(w),d)}function f(w){return w===45?(e.consume(w),p):d(w)}function p(w){return w===62?A(w):w===45?f(w):d(w)}function m(w){const Z="CDATA[";return w===Z.charCodeAt(s++)?(e.consume(w),s===Z.length?y:m):r(w)}function y(w){return w===null?r(w):w===93?(e.consume(w),C):re(w)?(o=y,U(w)):(e.consume(w),y)}function C(w){return w===93?(e.consume(w),g):y(w)}function g(w){return w===62?A(w):w===93?(e.consume(w),g):y(w)}function _(w){return w===null||w===62?A(w):re(w)?(o=_,U(w)):(e.consume(w),_)}function v(w){return w===null?r(w):w===63?(e.consume(w),x):re(w)?(o=v,U(w)):(e.consume(w),v)}function x(w){return w===62?A(w):v(w)}function k(w){return Yr(w)?(e.consume(w),b):r(w)}function b(w){return w===45||Zt(w)?(e.consume(w),b):j(w)}function j(w){return re(w)?(o=j,U(w)):me(w)?(e.consume(w),j):A(w)}function L(w){return w===45||Zt(w)?(e.consume(w),L):w===47||w===62||Ut(w)?I(w):r(w)}function I(w){return w===47?(e.consume(w),A):w===58||w===95||Yr(w)?(e.consume(w),P):re(w)?(o=I,U(w)):me(w)?(e.consume(w),I):A(w)}function P(w){return w===45||w===46||w===58||w===95||Zt(w)?(e.consume(w),P):D(w)}function D(w){return w===61?(e.consume(w),M):re(w)?(o=D,U(w)):me(w)?(e.consume(w),D):I(w)}function M(w){return w===null||w===60||w===61||w===62||w===96?r(w):w===34||w===39?(e.consume(w),n=w,R):re(w)?(o=M,U(w)):me(w)?(e.consume(w),M):(e.consume(w),O)}function R(w){return w===n?(e.consume(w),n=void 0,E):w===null?r(w):re(w)?(o=R,U(w)):(e.consume(w),R)}function O(w){return w===null||w===34||w===39||w===60||w===61||w===96?r(w):w===47||w===62||Ut(w)?I(w):(e.consume(w),O)}function E(w){return w===47||w===62||Ut(w)?I(w):r(w)}function A(w){return w===62?(e.consume(w),e.exit("htmlTextData"),e.exit("htmlText"),t):r(w)}function U(w){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),T}function T(w){return me(w)?be(e,$,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(w):$(w)}function $(w){return e.enter("htmlTextData"),o(w)}}const Op={name:"labelEnd",resolveAll:pP,resolveTo:mP,tokenize:gP},hP={tokenize:_P},dP={tokenize:vP},fP={tokenize:yP};function pP(e){let t=-1;const r=[];for(;++t<e.length;){const i=e[t][1];if(r.push(e[t]),i.type==="labelImage"||i.type==="labelLink"||i.type==="labelEnd"){const n=i.type==="labelImage"?4:2;i.type="data",t+=n}}return e.length!==r.length&&ei(e,0,e.length,r),e}function mP(e,t){let r=e.length,i=0,n,s,o,a;for(;r--;)if(n=e[r][1],s){if(n.type==="link"||n.type==="labelLink"&&n._inactive)break;e[r][0]==="enter"&&n.type==="labelLink"&&(n._inactive=!0)}else if(o){if(e[r][0]==="enter"&&(n.type==="labelImage"||n.type==="labelLink")&&!n._balanced&&(s=r,n.type!=="labelLink")){i=2;break}}else n.type==="labelEnd"&&(o=r);const u={type:e[s][1].type==="labelLink"?"link":"image",start:{...e[s][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[s][1].start},end:{...e[o][1].end}},h={type:"labelText",start:{...e[s+i+2][1].end},end:{...e[o-2][1].start}};return a=[["enter",u,t],["enter",c,t]],a=fr(a,e.slice(s+1,s+i+3)),a=fr(a,[["enter",h,t]]),a=fr(a,Ap(t.parser.constructs.insideSpan.null,e.slice(s+i+4,o-3),t)),a=fr(a,[["exit",h,t],e[o-2],e[o-1],["exit",c,t]]),a=fr(a,e.slice(o+1)),a=fr(a,[["exit",u,t]]),ei(e,s,e.length,a),e}function gP(e,t,r){const i=this;let n=i.events.length,s,o;for(;n--;)if((i.events[n][1].type==="labelImage"||i.events[n][1].type==="labelLink")&&!i.events[n][1]._balanced){s=i.events[n][1];break}return a;function a(f){return s?s._inactive?d(f):(o=i.parser.defined.includes(Ps(i.sliceSerialize({start:s.end,end:i.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),u):r(f)}function u(f){return f===40?e.attempt(hP,h,o?h:d)(f):f===91?e.attempt(dP,h,o?c:d)(f):o?h(f):d(f)}function c(f){return e.attempt(fP,h,d)(f)}function h(f){return t(f)}function d(f){return s._balanced=!0,r(f)}}function _P(e,t,r){return i;function i(d){return e.enter("resource"),e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),n}function n(d){return Ut(d)?Yo(e,s)(d):s(d)}function s(d){return d===41?h(d):zw(e,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return Ut(d)?Yo(e,u)(d):h(d)}function a(d){return r(d)}function u(d){return d===34||d===39||d===40?Fw(e,c,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):h(d)}function c(d){return Ut(d)?Yo(e,h)(d):h(d)}function h(d){return d===41?(e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),e.exit("resource"),t):r(d)}}function vP(e,t,r){const i=this;return n;function n(a){return Iw.call(i,e,s,o,"reference","referenceMarker","referenceString")(a)}function s(a){return i.parser.defined.includes(Ps(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?t(a):r(a)}function o(a){return r(a)}}function yP(e,t,r){return i;function i(s){return e.enter("reference"),e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),n}function n(s){return s===93?(e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),e.exit("reference"),t):r(s)}}const xP={name:"labelStartImage",resolveAll:Op.resolveAll,tokenize:wP};function wP(e,t,r){const i=this;return n;function n(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),s}function s(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),o):r(a)}function o(a){return a===94&&"_hiddenFootnoteSupport"in i.parser.constructs?r(a):t(a)}}const SP={name:"labelStartLink",resolveAll:Op.resolveAll,tokenize:bP};function bP(e,t,r){const i=this;return n;function n(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),s}function s(o){return o===94&&"_hiddenFootnoteSupport"in i.parser.constructs?r(o):t(o)}}const Qu={name:"lineEnding",tokenize:CP};function CP(e,t){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),be(e,t,"linePrefix")}}const zl={name:"thematicBreak",tokenize:kP};function kP(e,t,r){let i=0,n;return s;function s(c){return e.enter("thematicBreak"),o(c)}function o(c){return n=c,a(c)}function a(c){return c===n?(e.enter("thematicBreakSequence"),u(c)):i>=3&&(c===null||re(c))?(e.exit("thematicBreak"),t(c)):r(c)}function u(c){return c===n?(e.consume(c),i++,u):(e.exit("thematicBreakSequence"),me(c)?be(e,a,"whitespace")(c):a(c))}}const Ot={continuation:{tokenize:PP},exit:TP,name:"list",tokenize:jP},NP={partial:!0,tokenize:RP},EP={partial:!0,tokenize:MP};function jP(e,t,r){const i=this,n=i.events[i.events.length-1];let s=n&&n[1].type==="linePrefix"?n[2].sliceSerialize(n[1],!0).length:0,o=0;return a;function a(p){const m=i.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!i.containerState.marker||p===i.containerState.marker:of(p)){if(i.containerState.type||(i.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(zl,r,c)(p):c(p);if(!i.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(p)}return r(p)}function u(p){return of(p)&&++o<10?(e.consume(p),u):(!i.interrupt||o<2)&&(i.containerState.marker?p===i.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),c(p)):r(p)}function c(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||p,e.check(eu,i.interrupt?r:h,e.attempt(NP,f,d))}function h(p){return i.containerState.initialBlankLine=!0,s++,f(p)}function d(p){return me(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),f):r(p)}function f(p){return i.containerState.size=s+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function PP(e,t,r){const i=this;return i.containerState._closeFlow=void 0,e.check(eu,n,s);function n(a){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,be(e,t,"listItemIndent",i.containerState.size+1)(a)}function s(a){return i.containerState.furtherBlankLines||!me(a)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,o(a)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,e.attempt(EP,t,o)(a))}function o(a){return i.containerState._closeFlow=!0,i.interrupt=void 0,be(e,e.attempt(Ot,t,r),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function MP(e,t,r){const i=this;return be(e,n,"listItemIndent",i.containerState.size+1);function n(s){const o=i.events[i.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===i.containerState.size?t(s):r(s)}}function TP(e){e.exit(this.containerState.type)}function RP(e,t,r){const i=this;return be(e,n,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function n(s){const o=i.events[i.events.length-1];return!me(s)&&o&&o[1].type==="listItemPrefixWhitespace"?t(s):r(s)}}const W_={name:"setextUnderline",resolveTo:DP,tokenize:LP};function DP(e,t){let r=e.length,i,n,s;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){i=r;break}e[r][1].type==="paragraph"&&(n=r)}else e[r][1].type==="content"&&e.splice(r,1),!s&&e[r][1].type==="definition"&&(s=r);const o={type:"setextHeading",start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[n][1].type="setextHeadingText",s?(e.splice(n,0,["enter",o,t]),e.splice(s+1,0,["exit",e[i][1],t]),e[i][1].end={...e[s][1].end}):e[i][1]=o,e.push(["exit",o,t]),e}function LP(e,t,r){const i=this;let n;return s;function s(c){let h=i.events.length,d;for(;h--;)if(i.events[h][1].type!=="lineEnding"&&i.events[h][1].type!=="linePrefix"&&i.events[h][1].type!=="content"){d=i.events[h][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||d)?(e.enter("setextHeadingLine"),n=c,o(c)):r(c)}function o(c){return e.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===n?(e.consume(c),a):(e.exit("setextHeadingLineSequence"),me(c)?be(e,u,"lineSuffix")(c):u(c))}function u(c){return c===null||re(c)?(e.exit("setextHeadingLine"),t(c)):r(c)}}const AP={tokenize:OP};function OP(e){const t=this,r=e.attempt(eu,i,e.attempt(this.parser.constructs.flowInitial,n,be(e,e.attempt(this.parser.constructs.flow,n,e.attempt(Hj,n)),"linePrefix")));return r;function i(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,r}function n(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,r}}const BP={resolveAll:$w()},zP=Hw("string"),IP=Hw("text");function Hw(e){return{resolveAll:$w(e==="text"?FP:void 0),tokenize:t};function t(r){const i=this,n=this.parser.constructs[e],s=r.attempt(n,o,a);return o;function o(h){return c(h)?s(h):a(h)}function a(h){if(h===null){r.consume(h);return}return r.enter("data"),r.consume(h),u}function u(h){return c(h)?(r.exit("data"),s(h)):(r.consume(h),u)}function c(h){if(h===null)return!0;const d=n[h];let f=-1;if(d)for(;++f<d.length;){const p=d[f];if(!p.previous||p.previous.call(i,i.previous))return!0}return!1}}}function $w(e){return t;function t(r,i){let n=-1,s;for(;++n<=r.length;)s===void 0?r[n]&&r[n][1].type==="data"&&(s=n,n++):(!r[n]||r[n][1].type!=="data")&&(n!==s+2&&(r[s][1].end=r[n-1][1].end,r.splice(s+2,n-s-2),n=s+2),s=void 0);return e?e(r,i):r}}function FP(e,t){let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const i=e[r-1][1],n=t.sliceStream(i);let s=n.length,o=-1,a=0,u;for(;s--;){const c=n[s];if(typeof c=="string"){for(o=c.length;c.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(c===-2)u=!0,a++;else if(c!==-1){s++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(a=0),a){const c={type:r===e.length||u||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?o:i.start._bufferIndex+o,_index:i.start._index+s,line:i.end.line,column:i.end.column-a,offset:i.end.offset-a},end:{...i.end}};i.end={...c.start},i.start.offset===i.end.offset?Object.assign(i,c):(e.splice(r,0,["enter",c,t],["exit",c,t]),r+=2)}r++}return e}const HP={42:Ot,43:Ot,45:Ot,48:Ot,49:Ot,50:Ot,51:Ot,52:Ot,53:Ot,54:Ot,55:Ot,56:Ot,57:Ot,62:Lw},$P={91:qj},WP={[-2]:Xu,[-1]:Xu,32:Xu},UP={35:Jj,42:zl,45:[W_,zl],60:rP,61:W_,95:zl,96:H_,126:H_},KP={38:Ow,92:Aw},qP={[-5]:Qu,[-4]:Qu,[-3]:Qu,33:xP,38:Ow,42:af,60:[Sj,cP],91:SP,92:[Qj,Aw],93:Op,95:af,96:Aj},VP={null:[af,BP]},YP={null:[42,95]},XP={null:[]},QP=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:YP,contentInitial:$P,disable:XP,document:HP,flow:UP,flowInitial:WP,insideSpan:VP,string:KP,text:qP},Symbol.toStringTag,{value:"Module"}));function GP(e,t,r){let i={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const n={},s=[];let o=[],a=[];const u={attempt:j(k),check:j(b),consume:_,enter:v,exit:x,interrupt:j(b,{interrupt:!0})},c={code:null,containerState:{},defineSkip:y,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d};let h=t.tokenize.call(c,u);return t.resolveAll&&s.push(t),c;function d(D){return o=fr(o,D),C(),o[o.length-1]!==null?[]:(L(t,0),c.events=Ap(s,c.events,c),c.events)}function f(D,M){return ZP(p(D),M)}function p(D){return JP(o,D)}function m(){const{_bufferIndex:D,_index:M,line:R,column:O,offset:E}=i;return{_bufferIndex:D,_index:M,line:R,column:O,offset:E}}function y(D){n[D.line]=D.column,P()}function C(){let D;for(;i._index<o.length;){const M=o[i._index];if(typeof M=="string")for(D=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===D&&i._bufferIndex<M.length;)g(M.charCodeAt(i._bufferIndex));else g(M)}}function g(D){h=h(D)}function _(D){re(D)?(i.line++,i.column=1,i.offset+=D===-3?2:1,P()):D!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===o[i._index].length&&(i._bufferIndex=-1,i._index++)),c.previous=D}function v(D,M){const R=M||{};return R.type=D,R.start=m(),c.events.push(["enter",R,c]),a.push(R),R}function x(D){const M=a.pop();return M.end=m(),c.events.push(["exit",M,c]),M}function k(D,M){L(D,M.from)}function b(D,M){M.restore()}function j(D,M){return R;function R(O,E,A){let U,T,$,w;return Array.isArray(O)?ne(O):"tokenize"in O?ne([O]):Z(O);function Z(ie){return We;function We(sr){const St=sr!==null&&ie[sr],yr=sr!==null&&ie.null,Ar=[...Array.isArray(St)?St:St?[St]:[],...Array.isArray(yr)?yr:yr?[yr]:[]];return ne(Ar)(sr)}}function ne(ie){return U=ie,T=0,ie.length===0?A:S(ie[T])}function S(ie){return We;function We(sr){return w=I(),$=ie,ie.partial||(c.currentConstruct=ie),ie.name&&c.parser.constructs.disable.null.includes(ie.name)?ee():ie.tokenize.call(M?Object.assign(Object.create(c),M):c,u,H,ee)(sr)}}function H(ie){return D($,w),E}function ee(ie){return w.restore(),++T<U.length?S(U[T]):A}}}function L(D,M){D.resolveAll&&!s.includes(D)&&s.push(D),D.resolve&&ei(c.events,M,c.events.length-M,D.resolve(c.events.slice(M),c)),D.resolveTo&&(c.events=D.resolveTo(c.events,c))}function I(){const D=m(),M=c.previous,R=c.currentConstruct,O=c.events.length,E=Array.from(a);return{from:O,restore:A};function A(){i=D,c.previous=M,c.currentConstruct=R,c.events.length=O,a=E,P()}}function P(){i.line in n&&i.column<2&&(i.column=n[i.line],i.offset+=n[i.line]-1)}}function JP(e,t){const r=t.start._index,i=t.start._bufferIndex,n=t.end._index,s=t.end._bufferIndex;let o;if(r===n)o=[e[r].slice(i,s)];else{if(o=e.slice(r,n),i>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(i):o.shift()}s>0&&o.push(e[n].slice(0,s))}return o}function ZP(e,t){let r=-1;const i=[];let n;for(;++r<e.length;){const s=e[r];let o;if(typeof s=="string")o=s;else switch(s){case-5:{o="\r";break}case-4:{o=`
408
+ `;break}case-3:{o=`\r
409
+ `;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&n)continue;o=" ";break}default:o=String.fromCharCode(s)}n=s===-2,i.push(o)}return i.join("")}function e5(e){const i={constructs:aj([QP,...(e||{}).extensions||[]]),content:n(mj),defined:[],document:n(_j),flow:n(AP),lazy:{},string:n(zP),text:n(IP)};return i;function n(s){return o;function o(a){return GP(i,s,a)}}}function t5(e){for(;!Bw(e););return e}const U_=/[\0\t\n\r]/g;function r5(){let e=1,t="",r=!0,i;return n;function n(s,o,a){const u=[];let c,h,d,f,p;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(o||void 0).decode(s)),d=0,t="",r&&(s.charCodeAt(0)===65279&&d++,r=void 0);d<s.length;){if(U_.lastIndex=d,c=U_.exec(s),f=c&&c.index!==void 0?c.index:s.length,p=s.charCodeAt(f),!c){t=s.slice(d);break}if(p===10&&d===f&&i)u.push(-3),i=void 0;else switch(i&&(u.push(-5),i=void 0),d<f&&(u.push(s.slice(d,f)),e+=f-d),p){case 0:{u.push(65533),e++;break}case 9:{for(h=Math.ceil(e/4)*4,u.push(-2);e++<h;)u.push(-1);break}case 10:{u.push(-4),e=1;break}default:i=!0,e=1}d=f+1}return a&&(i&&u.push(-5),t&&u.push(t),u.push(null)),u}}const i5=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function n5(e){return e.replace(i5,s5)}function s5(e,t,r){if(t)return t;if(r.charCodeAt(0)===35){const n=r.charCodeAt(1),s=n===120||n===88;return Dw(r.slice(s?2:1),s?16:10)}return Lp(r)||e}const Ww={}.hasOwnProperty;function o5(e,t,r){return typeof t!="string"&&(r=t,t=void 0),a5(r)(t5(e5(r).document().write(r5()(e,t,!0))))}function a5(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(Kp),autolinkProtocol:I,autolinkEmail:I,atxHeading:s($p),blockQuote:s(yr),characterEscape:I,characterReference:I,codeFenced:s(Ar),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(Ar,o),codeText:s(Or,o),codeTextData:I,data:I,codeFlowValue:I,definition:s(pe),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(so),hardBreakEscape:s(Wp),hardBreakTrailing:s(Wp),htmlFlow:s(Up,o),htmlFlowData:I,htmlText:s(Up,o),htmlTextData:I,image:s(tS),label:o,link:s(Kp),listItem:s(rS),listItemValue:f,listOrdered:s(qp,d),listUnordered:s(qp),paragraph:s(iS),reference:S,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s($p),strong:s(nS),thematicBreak:s(oS)},exit:{atxHeading:u(),atxHeadingSequence:k,autolink:u(),autolinkEmail:St,autolinkProtocol:sr,blockQuote:u(),characterEscapeValue:P,characterReferenceMarkerHexadecimal:ee,characterReferenceMarkerNumeric:ee,characterReferenceValue:ie,characterReference:We,codeFenced:u(C),codeFencedFence:y,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:P,codeIndented:u(g),codeText:u(E),codeTextData:P,data:P,definition:u(),definitionDestinationString:x,definitionLabelString:_,definitionTitleString:v,emphasis:u(),hardBreakEscape:u(M),hardBreakTrailing:u(M),htmlFlow:u(R),htmlFlowData:P,htmlText:u(O),htmlTextData:P,image:u(U),label:$,labelText:T,lineEnding:D,link:u(A),listItem:u(),listOrdered:u(),listUnordered:u(),paragraph:u(),referenceString:H,resourceDestinationString:w,resourceTitleString:Z,resource:ne,setextHeading:u(L),setextHeadingLineSequence:j,setextHeadingText:b,strong:u(),thematicBreak:u()}};Uw(t,(e||{}).mdastExtensions||[]);const r={};return i;function i(B){let V={type:"root",children:[]};const se={stack:[V],tokenStack:[],config:t,enter:a,exit:c,buffer:o,resume:h,data:r},he=[];let xe=-1;for(;++xe<B.length;)if(B[xe][1].type==="listOrdered"||B[xe][1].type==="listUnordered")if(B[xe][0]==="enter")he.push(xe);else{const xr=he.pop();xe=n(B,xr,xe)}for(xe=-1;++xe<B.length;){const xr=t[B[xe][0]];Ww.call(xr,B[xe][1].type)&&xr[B[xe][1].type].call(Object.assign({sliceSerialize:B[xe][2].sliceSerialize},se),B[xe][1])}if(se.tokenStack.length>0){const xr=se.tokenStack[se.tokenStack.length-1];(xr[1]||K_).call(se,void 0,xr[0])}for(V.position={start:Ti(B.length>0?B[0][1].start:{line:1,column:1,offset:0}),end:Ti(B.length>0?B[B.length-2][1].end:{line:1,column:1,offset:0})},xe=-1;++xe<t.transforms.length;)V=t.transforms[xe](V)||V;return V}function n(B,V,se){let he=V-1,xe=-1,xr=!1,pn,ii,oo,ao;for(;++he<=se;){const qt=B[he];switch(qt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{qt[0]==="enter"?xe++:xe--,ao=void 0;break}case"lineEndingBlank":{qt[0]==="enter"&&(pn&&!ao&&!xe&&!oo&&(oo=he),ao=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ao=void 0}if(!xe&&qt[0]==="enter"&&qt[1].type==="listItemPrefix"||xe===-1&&qt[0]==="exit"&&(qt[1].type==="listUnordered"||qt[1].type==="listOrdered")){if(pn){let ts=he;for(ii=void 0;ts--;){const ni=B[ts];if(ni[1].type==="lineEnding"||ni[1].type==="lineEndingBlank"){if(ni[0]==="exit")continue;ii&&(B[ii][1].type="lineEndingBlank",xr=!0),ni[1].type="lineEnding",ii=ts}else if(!(ni[1].type==="linePrefix"||ni[1].type==="blockQuotePrefix"||ni[1].type==="blockQuotePrefixWhitespace"||ni[1].type==="blockQuoteMarker"||ni[1].type==="listItemIndent"))break}oo&&(!ii||oo<ii)&&(pn._spread=!0),pn.end=Object.assign({},ii?B[ii][1].start:qt[1].end),B.splice(ii||he,0,["exit",pn,qt[2]]),he++,se++}if(qt[1].type==="listItemPrefix"){const ts={type:"listItem",_spread:!1,start:Object.assign({},qt[1].start),end:void 0};pn=ts,B.splice(he,0,["enter",ts,qt[2]]),he++,se++,oo=void 0,ao=!0}}}return B[V][1]._spread=xr,se}function s(B,V){return se;function se(he){a.call(this,B(he),he),V&&V.call(this,he)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(B,V,se){this.stack[this.stack.length-1].children.push(B),this.stack.push(B),this.tokenStack.push([V,se||void 0]),B.position={start:Ti(V.start),end:void 0}}function u(B){return V;function V(se){B&&B.call(this,se),c.call(this,se)}}function c(B,V){const se=this.stack.pop(),he=this.tokenStack.pop();if(he)he[0].type!==B.type&&(V?V.call(this,B,he[0]):(he[1]||K_).call(this,B,he[0]));else throw new Error("Cannot close `"+B.type+"` ("+Vo({start:B.start,end:B.end})+"): it’s not open");se.position.end=Ti(B.end)}function h(){return sj(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(B){if(this.data.expectingFirstListItemValue){const V=this.stack[this.stack.length-2];V.start=Number.parseInt(this.sliceSerialize(B),10),this.data.expectingFirstListItemValue=void 0}}function p(){const B=this.resume(),V=this.stack[this.stack.length-1];V.lang=B}function m(){const B=this.resume(),V=this.stack[this.stack.length-1];V.meta=B}function y(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function C(){const B=this.resume(),V=this.stack[this.stack.length-1];V.value=B.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function g(){const B=this.resume(),V=this.stack[this.stack.length-1];V.value=B.replace(/(\r?\n|\r)$/g,"")}function _(B){const V=this.resume(),se=this.stack[this.stack.length-1];se.label=V,se.identifier=Ps(this.sliceSerialize(B)).toLowerCase()}function v(){const B=this.resume(),V=this.stack[this.stack.length-1];V.title=B}function x(){const B=this.resume(),V=this.stack[this.stack.length-1];V.url=B}function k(B){const V=this.stack[this.stack.length-1];if(!V.depth){const se=this.sliceSerialize(B).length;V.depth=se}}function b(){this.data.setextHeadingSlurpLineEnding=!0}function j(B){const V=this.stack[this.stack.length-1];V.depth=this.sliceSerialize(B).codePointAt(0)===61?1:2}function L(){this.data.setextHeadingSlurpLineEnding=void 0}function I(B){const se=this.stack[this.stack.length-1].children;let he=se[se.length-1];(!he||he.type!=="text")&&(he=sS(),he.position={start:Ti(B.start),end:void 0},se.push(he)),this.stack.push(he)}function P(B){const V=this.stack.pop();V.value+=this.sliceSerialize(B),V.position.end=Ti(B.end)}function D(B){const V=this.stack[this.stack.length-1];if(this.data.atHardBreak){const se=V.children[V.children.length-1];se.position.end=Ti(B.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(V.type)&&(I.call(this,B),P.call(this,B))}function M(){this.data.atHardBreak=!0}function R(){const B=this.resume(),V=this.stack[this.stack.length-1];V.value=B}function O(){const B=this.resume(),V=this.stack[this.stack.length-1];V.value=B}function E(){const B=this.resume(),V=this.stack[this.stack.length-1];V.value=B}function A(){const B=this.stack[this.stack.length-1];if(this.data.inReference){const V=this.data.referenceType||"shortcut";B.type+="Reference",B.referenceType=V,delete B.url,delete B.title}else delete B.identifier,delete B.label;this.data.referenceType=void 0}function U(){const B=this.stack[this.stack.length-1];if(this.data.inReference){const V=this.data.referenceType||"shortcut";B.type+="Reference",B.referenceType=V,delete B.url,delete B.title}else delete B.identifier,delete B.label;this.data.referenceType=void 0}function T(B){const V=this.sliceSerialize(B),se=this.stack[this.stack.length-2];se.label=n5(V),se.identifier=Ps(V).toLowerCase()}function $(){const B=this.stack[this.stack.length-1],V=this.resume(),se=this.stack[this.stack.length-1];if(this.data.inReference=!0,se.type==="link"){const he=B.children;se.children=he}else se.alt=V}function w(){const B=this.resume(),V=this.stack[this.stack.length-1];V.url=B}function Z(){const B=this.resume(),V=this.stack[this.stack.length-1];V.title=B}function ne(){this.data.inReference=void 0}function S(){this.data.referenceType="collapsed"}function H(B){const V=this.resume(),se=this.stack[this.stack.length-1];se.label=V,se.identifier=Ps(this.sliceSerialize(B)).toLowerCase(),this.data.referenceType="full"}function ee(B){this.data.characterReferenceType=B.type}function ie(B){const V=this.sliceSerialize(B),se=this.data.characterReferenceType;let he;se?(he=Dw(V,se==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):he=Lp(V);const xe=this.stack[this.stack.length-1];xe.value+=he}function We(B){const V=this.stack.pop();V.position.end=Ti(B.end)}function sr(B){P.call(this,B);const V=this.stack[this.stack.length-1];V.url=this.sliceSerialize(B)}function St(B){P.call(this,B);const V=this.stack[this.stack.length-1];V.url="mailto:"+this.sliceSerialize(B)}function yr(){return{type:"blockquote",children:[]}}function Ar(){return{type:"code",lang:null,meta:null,value:""}}function Or(){return{type:"inlineCode",value:""}}function pe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function so(){return{type:"emphasis",children:[]}}function $p(){return{type:"heading",depth:0,children:[]}}function Wp(){return{type:"break"}}function Up(){return{type:"html",value:""}}function tS(){return{type:"image",title:null,url:"",alt:null}}function Kp(){return{type:"link",title:null,url:"",children:[]}}function qp(B){return{type:"list",ordered:B.type==="listOrdered",start:null,spread:B._spread,children:[]}}function rS(B){return{type:"listItem",spread:B._spread,checked:null,children:[]}}function iS(){return{type:"paragraph",children:[]}}function nS(){return{type:"strong",children:[]}}function sS(){return{type:"text",value:""}}function oS(){return{type:"thematicBreak"}}}function Ti(e){return{line:e.line,column:e.column,offset:e.offset}}function Uw(e,t){let r=-1;for(;++r<t.length;){const i=t[r];Array.isArray(i)?Uw(e,i):l5(e,i)}}function l5(e,t){let r;for(r in t)if(Ww.call(t,r))switch(r){case"canContainEols":{const i=t[r];i&&e[r].push(...i);break}case"transforms":{const i=t[r];i&&e[r].push(...i);break}case"enter":case"exit":{const i=t[r];i&&Object.assign(e[r],i);break}}}function K_(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Vo({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Vo({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Vo({start:t.start,end:t.end})+") is still open")}function c5(e){const t=this;t.parser=r;function r(i){return o5(i,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function u5(e,t){const r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,r),e.applyData(t,r)}function h5(e,t){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,r),[e.applyData(t,r),{type:"text",value:`
410
+ `}]}function d5(e,t){const r=t.value?t.value+`
411
+ `:"",i={},n=t.lang?t.lang.split(/\s+/):[];n.length>0&&(i.className=["language-"+n[0]]);let s={type:"element",tagName:"code",properties:i,children:[{type:"text",value:r}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function f5(e,t){const r={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function p5(e,t){const r={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function m5(e,t){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=String(t.identifier).toUpperCase(),n=no(i.toLowerCase()),s=e.footnoteOrder.indexOf(i);let o,a=e.footnoteCounts.get(i);a===void 0?(a=0,e.footnoteOrder.push(i),o=e.footnoteOrder.length):o=s+1,a+=1,e.footnoteCounts.set(i,a);const u={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+n,id:r+"fnref-"+n+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,u);const c={type:"element",tagName:"sup",properties:{},children:[u]};return e.patch(t,c),e.applyData(t,c)}function g5(e,t){const r={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function _5(e,t){if(e.options.allowDangerousHtml){const r={type:"raw",value:t.value};return e.patch(t,r),e.applyData(t,r)}}function Kw(e,t){const r=t.referenceType;let i="]";if(r==="collapsed"?i+="[]":r==="full"&&(i+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+i}];const n=e.all(t),s=n[0];s&&s.type==="text"?s.value="["+s.value:n.unshift({type:"text",value:"["});const o=n[n.length-1];return o&&o.type==="text"?o.value+=i:n.push({type:"text",value:i}),n}function v5(e,t){const r=String(t.identifier).toUpperCase(),i=e.definitionById.get(r);if(!i)return Kw(e,t);const n={src:no(i.url||""),alt:t.alt};i.title!==null&&i.title!==void 0&&(n.title=i.title);const s={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,s),e.applyData(t,s)}function y5(e,t){const r={src:no(t.url)};t.alt!==null&&t.alt!==void 0&&(r.alt=t.alt),t.title!==null&&t.title!==void 0&&(r.title=t.title);const i={type:"element",tagName:"img",properties:r,children:[]};return e.patch(t,i),e.applyData(t,i)}function x5(e,t){const r={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,r);const i={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(t,i),e.applyData(t,i)}function w5(e,t){const r=String(t.identifier).toUpperCase(),i=e.definitionById.get(r);if(!i)return Kw(e,t);const n={href:no(i.url||"")};i.title!==null&&i.title!==void 0&&(n.title=i.title);const s={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function S5(e,t){const r={href:no(t.url)};t.title!==null&&t.title!==void 0&&(r.title=t.title);const i={type:"element",tagName:"a",properties:r,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function b5(e,t,r){const i=e.all(t),n=r?C5(r):qw(t),s={},o=[];if(typeof t.checked=="boolean"){const h=i[0];let d;h&&h.type==="element"&&h.tagName==="p"?d=h:(d={type:"element",tagName:"p",properties:{},children:[]},i.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let a=-1;for(;++a<i.length;){const h=i[a];(n||a!==0||h.type!=="element"||h.tagName!=="p")&&o.push({type:"text",value:`
412
+ `}),h.type==="element"&&h.tagName==="p"&&!n?o.push(...h.children):o.push(h)}const u=i[i.length-1];u&&(n||u.type!=="element"||u.tagName!=="p")&&o.push({type:"text",value:`
413
+ `});const c={type:"element",tagName:"li",properties:s,children:o};return e.patch(t,c),e.applyData(t,c)}function C5(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const r=e.children;let i=-1;for(;!t&&++i<r.length;)t=qw(r[i])}return t}function qw(e){const t=e.spread;return t??e.children.length>1}function k5(e,t){const r={},i=e.all(t);let n=-1;for(typeof t.start=="number"&&t.start!==1&&(r.start=t.start);++n<i.length;){const o=i[n];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const s={type:"element",tagName:t.ordered?"ol":"ul",properties:r,children:e.wrap(i,!0)};return e.patch(t,s),e.applyData(t,s)}function N5(e,t){const r={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function E5(e,t){const r={type:"root",children:e.wrap(e.all(t))};return e.patch(t,r),e.applyData(t,r)}function j5(e,t){const r={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function P5(e,t){const r=e.all(t),i=r.shift(),n=[];if(i){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([i],!0)};e.patch(t.children[0],o),n.push(o)}if(r.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},a=Mp(t.children[1]),u=Nw(t.children[t.children.length-1]);a&&u&&(o.position={start:a,end:u}),n.push(o)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(n,!0)};return e.patch(t,s),e.applyData(t,s)}function M5(e,t,r){const i=r?r.children:void 0,s=(i?i.indexOf(t):1)===0?"th":"td",o=r&&r.type==="table"?r.align:void 0,a=o?o.length:t.children.length;let u=-1;const c=[];for(;++u<a;){const d=t.children[u],f={},p=o?o[u]:void 0;p&&(f.align=p);let m={type:"element",tagName:s,properties:f,children:[]};d&&(m.children=e.all(d),e.patch(d,m),m=e.applyData(d,m)),c.push(m)}const h={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(t,h),e.applyData(t,h)}function T5(e,t){const r={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}const q_=9,V_=32;function R5(e){const t=String(e),r=/\r?\n|\r/g;let i=r.exec(t),n=0;const s=[];for(;i;)s.push(Y_(t.slice(n,i.index),n>0,!0),i[0]),n=i.index+i[0].length,i=r.exec(t);return s.push(Y_(t.slice(n),n>0,!1)),s.join("")}function Y_(e,t,r){let i=0,n=e.length;if(t){let s=e.codePointAt(i);for(;s===q_||s===V_;)i++,s=e.codePointAt(i)}if(r){let s=e.codePointAt(n-1);for(;s===q_||s===V_;)n--,s=e.codePointAt(n-1)}return n>i?e.slice(i,n):""}function D5(e,t){const r={type:"text",value:R5(String(t.value))};return e.patch(t,r),e.applyData(t,r)}function L5(e,t){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,r),e.applyData(t,r)}const A5={blockquote:u5,break:h5,code:d5,delete:f5,emphasis:p5,footnoteReference:m5,heading:g5,html:_5,imageReference:v5,image:y5,inlineCode:x5,linkReference:w5,link:S5,listItem:b5,list:k5,paragraph:N5,root:E5,strong:j5,table:P5,tableCell:T5,tableRow:M5,text:D5,thematicBreak:L5,toml:dl,yaml:dl,definition:dl,footnoteDefinition:dl};function dl(){}const Vw=-1,tu=0,Xo=1,wc=2,Bp=3,zp=4,Ip=5,Fp=6,Yw=7,Xw=8,X_=typeof self=="object"?self:globalThis,O5=(e,t)=>{const r=(n,s)=>(e.set(s,n),n),i=n=>{if(e.has(n))return e.get(n);const[s,o]=t[n];switch(s){case tu:case Vw:return r(o,n);case Xo:{const a=r([],n);for(const u of o)a.push(i(u));return a}case wc:{const a=r({},n);for(const[u,c]of o)a[i(u)]=i(c);return a}case Bp:return r(new Date(o),n);case zp:{const{source:a,flags:u}=o;return r(new RegExp(a,u),n)}case Ip:{const a=r(new Map,n);for(const[u,c]of o)a.set(i(u),i(c));return a}case Fp:{const a=r(new Set,n);for(const u of o)a.add(i(u));return a}case Yw:{const{name:a,message:u}=o;return r(new X_[a](u),n)}case Xw:return r(BigInt(o),n);case"BigInt":return r(Object(BigInt(o)),n);case"ArrayBuffer":return r(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:a}=new Uint8Array(o);return r(new DataView(a),o)}}return r(new X_[s](o),n)};return i},Q_=e=>O5(new Map,e)(0),os="",{toString:B5}={},{keys:z5}=Object,No=e=>{const t=typeof e;if(t!=="object"||!e)return[tu,t];const r=B5.call(e).slice(8,-1);switch(r){case"Array":return[Xo,os];case"Object":return[wc,os];case"Date":return[Bp,os];case"RegExp":return[zp,os];case"Map":return[Ip,os];case"Set":return[Fp,os];case"DataView":return[Xo,r]}return r.includes("Array")?[Xo,r]:r.includes("Error")?[Yw,r]:[wc,r]},fl=([e,t])=>e===tu&&(t==="function"||t==="symbol"),I5=(e,t,r,i)=>{const n=(o,a)=>{const u=i.push(o)-1;return r.set(a,u),u},s=o=>{if(r.has(o))return r.get(o);let[a,u]=No(o);switch(a){case tu:{let h=o;switch(u){case"bigint":a=Xw,h=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+u);h=null;break;case"undefined":return n([Vw],o)}return n([a,h],o)}case Xo:{if(u){let f=o;return u==="DataView"?f=new Uint8Array(o.buffer):u==="ArrayBuffer"&&(f=new Uint8Array(o)),n([u,[...f]],o)}const h=[],d=n([a,h],o);for(const f of o)h.push(s(f));return d}case wc:{if(u)switch(u){case"BigInt":return n([u,o.toString()],o);case"Boolean":case"Number":case"String":return n([u,o.valueOf()],o)}if(t&&"toJSON"in o)return s(o.toJSON());const h=[],d=n([a,h],o);for(const f of z5(o))(e||!fl(No(o[f])))&&h.push([s(f),s(o[f])]);return d}case Bp:return n([a,o.toISOString()],o);case zp:{const{source:h,flags:d}=o;return n([a,{source:h,flags:d}],o)}case Ip:{const h=[],d=n([a,h],o);for(const[f,p]of o)(e||!(fl(No(f))||fl(No(p))))&&h.push([s(f),s(p)]);return d}case Fp:{const h=[],d=n([a,h],o);for(const f of o)(e||!fl(No(f)))&&h.push(s(f));return d}}const{message:c}=o;return n([a,{name:u,message:c}],o)};return s},G_=(e,{json:t,lossy:r}={})=>{const i=[];return I5(!(t||r),!!t,new Map,i)(e),i},Sc=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Q_(G_(e,t)):structuredClone(e):(e,t)=>Q_(G_(e,t));function F5(e,t){const r=[{type:"text",value:"↩"}];return t>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),r}function H5(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function $5(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||F5,i=e.options.footnoteBackLabel||H5,n=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let u=-1;for(;++u<e.footnoteOrder.length;){const c=e.footnoteById.get(e.footnoteOrder[u]);if(!c)continue;const h=e.all(c),d=String(c.identifier).toUpperCase(),f=no(d.toLowerCase());let p=0;const m=[],y=e.footnoteCounts.get(d);for(;y!==void 0&&++p<=y;){m.length>0&&m.push({type:"text",value:" "});let _=typeof r=="string"?r:r(u,p);typeof _=="string"&&(_={type:"text",value:_}),m.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+f+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof i=="string"?i:i(u,p),className:["data-footnote-backref"]},children:Array.isArray(_)?_:[_]})}const C=h[h.length-1];if(C&&C.type==="element"&&C.tagName==="p"){const _=C.children[C.children.length-1];_&&_.type==="text"?_.value+=" ":C.children.push({type:"text",value:" "}),C.children.push(...m)}else h.push(...m);const g={type:"element",tagName:"li",properties:{id:t+"fn-"+f},children:e.wrap(h,!0)};e.patch(c,g),a.push(g)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...Sc(o),id:"footnote-label"},children:[{type:"text",value:n}]},{type:"text",value:`
414
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:`
415
+ `}]}}const Qw=function(e){if(e==null)return q5;if(typeof e=="function")return ru(e);if(typeof e=="object")return Array.isArray(e)?W5(e):U5(e);if(typeof e=="string")return K5(e);throw new Error("Expected function, string, or object as test")};function W5(e){const t=[];let r=-1;for(;++r<e.length;)t[r]=Qw(e[r]);return ru(i);function i(...n){let s=-1;for(;++s<t.length;)if(t[s].apply(this,n))return!0;return!1}}function U5(e){const t=e;return ru(r);function r(i){const n=i;let s;for(s in e)if(n[s]!==t[s])return!1;return!0}}function K5(e){return ru(t);function t(r){return r&&r.type===e}}function ru(e){return t;function t(r,i,n){return!!(V5(r)&&e.call(this,r,typeof i=="number"?i:void 0,n||void 0))}}function q5(){return!0}function V5(e){return e!==null&&typeof e=="object"&&"type"in e}const Gw=[],Y5=!0,J_=!1,X5="skip";function Q5(e,t,r,i){let n;typeof t=="function"&&typeof r!="function"?(i=r,r=t):n=t;const s=Qw(n),o=i?-1:1;a(e,void 0,[])();function a(u,c,h){const d=u&&typeof u=="object"?u:{};if(typeof d.type=="string"){const p=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(u.type+(p?"<"+p+">":""))+")"})}return f;function f(){let p=Gw,m,y,C;if((!t||s(u,c,h[h.length-1]||void 0))&&(p=G5(r(u,h)),p[0]===J_))return p;if("children"in u&&u.children){const g=u;if(g.children&&p[0]!==X5)for(y=(i?g.children.length:-1)+o,C=h.concat(g);y>-1&&y<g.children.length;){const _=g.children[y];if(m=a(_,y,C)(),m[0]===J_)return m;y=typeof m[1]=="number"?m[1]:y+o}}return p}}}function G5(e){return Array.isArray(e)?e:typeof e=="number"?[Y5,e]:e==null?Gw:[e]}function Jw(e,t,r,i){let n,s,o;typeof t=="function"&&typeof r!="function"?(s=void 0,o=t,n=r):(s=t,o=r,n=i),Q5(e,s,a,n);function a(u,c){const h=c[c.length-1],d=h?h.children.indexOf(u):void 0;return o(u,d,h)}}const lf={}.hasOwnProperty,J5={};function Z5(e,t){const r=t||J5,i=new Map,n=new Map,s=new Map,o={...A5,...r.handlers},a={all:c,applyData:tM,definitionById:i,footnoteById:n,footnoteCounts:s,footnoteOrder:[],handlers:o,one:u,options:r,patch:eM,wrap:iM};return Jw(e,function(h){if(h.type==="definition"||h.type==="footnoteDefinition"){const d=h.type==="definition"?i:n,f=String(h.identifier).toUpperCase();d.has(f)||d.set(f,h)}}),a;function u(h,d){const f=h.type,p=a.handlers[f];if(lf.call(a.handlers,f)&&p)return p(a,h,d);if(a.options.passThrough&&a.options.passThrough.includes(f)){if("children"in h){const{children:y,...C}=h,g=Sc(C);return g.children=a.all(h),g}return Sc(h)}return(a.options.unknownHandler||rM)(a,h,d)}function c(h){const d=[];if("children"in h){const f=h.children;let p=-1;for(;++p<f.length;){const m=a.one(f[p],h);if(m){if(p&&f[p-1].type==="break"&&(!Array.isArray(m)&&m.type==="text"&&(m.value=Z_(m.value)),!Array.isArray(m)&&m.type==="element")){const y=m.children[0];y&&y.type==="text"&&(y.value=Z_(y.value))}Array.isArray(m)?d.push(...m):d.push(m)}}}return d}}function eM(e,t){e.position&&(t.position=B3(e))}function tM(e,t){let r=t;if(e&&e.data){const i=e.data.hName,n=e.data.hChildren,s=e.data.hProperties;if(typeof i=="string")if(r.type==="element")r.tagName=i;else{const o="children"in r?r.children:[r];r={type:"element",tagName:i,properties:{},children:o}}r.type==="element"&&s&&Object.assign(r.properties,Sc(s)),"children"in r&&r.children&&n!==null&&n!==void 0&&(r.children=n)}return r}function rM(e,t){const r=t.data||{},i="value"in t&&!(lf.call(r,"hProperties")||lf.call(r,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function iM(e,t){const r=[];let i=-1;for(t&&r.push({type:"text",value:`
416
+ `});++i<e.length;)i&&r.push({type:"text",value:`
417
+ `}),r.push(e[i]);return t&&e.length>0&&r.push({type:"text",value:`
418
+ `}),r}function Z_(e){let t=0,r=e.charCodeAt(t);for(;r===9||r===32;)t++,r=e.charCodeAt(t);return e.slice(t)}function e0(e,t){const r=Z5(e,t),i=r.one(e,void 0),n=$5(r),s=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return n&&s.children.push({type:"text",value:`
419
+ `},n),s}function nM(e,t){return e&&"run"in e?async function(r,i){const n=e0(r,{file:i,...t});await e.run(n,i)}:function(r,i){return e0(r,{file:i,...e||t})}}function t0(e){if(e)throw e}var Il=Object.prototype.hasOwnProperty,Zw=Object.prototype.toString,r0=Object.defineProperty,i0=Object.getOwnPropertyDescriptor,n0=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Zw.call(t)==="[object Array]"},s0=function(t){if(!t||Zw.call(t)!=="[object Object]")return!1;var r=Il.call(t,"constructor"),i=t.constructor&&t.constructor.prototype&&Il.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!r&&!i)return!1;var n;for(n in t);return typeof n>"u"||Il.call(t,n)},o0=function(t,r){r0&&r.name==="__proto__"?r0(t,r.name,{enumerable:!0,configurable:!0,value:r.newValue,writable:!0}):t[r.name]=r.newValue},a0=function(t,r){if(r==="__proto__")if(Il.call(t,r)){if(i0)return i0(t,r).value}else return;return t[r]},sM=function e(){var t,r,i,n,s,o,a=arguments[0],u=1,c=arguments.length,h=!1;for(typeof a=="boolean"&&(h=a,a=arguments[1]||{},u=2),(a==null||typeof a!="object"&&typeof a!="function")&&(a={});u<c;++u)if(t=arguments[u],t!=null)for(r in t)i=a0(a,r),n=a0(t,r),a!==n&&(h&&n&&(s0(n)||(s=n0(n)))?(s?(s=!1,o=i&&n0(i)?i:[]):o=i&&s0(i)?i:{},o0(a,{name:r,newValue:e(h,o,n)})):typeof n<"u"&&o0(a,{name:r,newValue:n}));return a};const Gu=bc(sM);function cf(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function oM(){const e=[],t={run:r,use:i};return t;function r(...n){let s=-1;const o=n.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);a(null,...n);function a(u,...c){const h=e[++s];let d=-1;if(u){o(u);return}for(;++d<n.length;)(c[d]===null||c[d]===void 0)&&(c[d]=n[d]);n=c,h?aM(h,a)(...c):o(null,...c)}}function i(n){if(typeof n!="function")throw new TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function aM(e,t){let r;return i;function i(...o){const a=e.length>o.length;let u;a&&o.push(n);try{u=e.apply(this,o)}catch(c){const h=c;if(a&&r)throw h;return n(h)}a||(u&&u.then&&typeof u.then=="function"?u.then(s,n):u instanceof Error?n(u):s(u))}function n(o,...a){r||(r=!0,t(o,...a))}function s(o){n(null,o)}}const Wr={basename:lM,dirname:cM,extname:uM,join:hM,sep:"/"};function lM(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Aa(e);let r=0,i=-1,n=e.length,s;if(t===void 0||t.length===0||t.length>e.length){for(;n--;)if(e.codePointAt(n)===47){if(s){r=n+1;break}}else i<0&&(s=!0,i=n+1);return i<0?"":e.slice(r,i)}if(t===e)return"";let o=-1,a=t.length-1;for(;n--;)if(e.codePointAt(n)===47){if(s){r=n+1;break}}else o<0&&(s=!0,o=n+1),a>-1&&(e.codePointAt(n)===t.codePointAt(a--)?a<0&&(i=n):(a=-1,i=o));return r===i?i=o:i<0&&(i=e.length),e.slice(r,i)}function cM(e){if(Aa(e),e.length===0)return".";let t=-1,r=e.length,i;for(;--r;)if(e.codePointAt(r)===47){if(i){t=r;break}}else i||(i=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function uM(e){Aa(e);let t=e.length,r=-1,i=0,n=-1,s=0,o;for(;t--;){const a=e.codePointAt(t);if(a===47){if(o){i=t+1;break}continue}r<0&&(o=!0,r=t+1),a===46?n<0?n=t:s!==1&&(s=1):n>-1&&(s=-1)}return n<0||r<0||s===0||s===1&&n===r-1&&n===i+1?"":e.slice(n,r)}function hM(...e){let t=-1,r;for(;++t<e.length;)Aa(e[t]),e[t]&&(r=r===void 0?e[t]:r+"/"+e[t]);return r===void 0?".":dM(r)}function dM(e){Aa(e);const t=e.codePointAt(0)===47;let r=fM(e,!t);return r.length===0&&!t&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),t?"/"+r:r}function fM(e,t){let r="",i=0,n=-1,s=0,o=-1,a,u;for(;++o<=e.length;){if(o<e.length)a=e.codePointAt(o);else{if(a===47)break;a=47}if(a===47){if(!(n===o-1||s===1))if(n!==o-1&&s===2){if(r.length<2||i!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(u=r.lastIndexOf("/"),u!==r.length-1){u<0?(r="",i=0):(r=r.slice(0,u),i=r.length-1-r.lastIndexOf("/")),n=o,s=0;continue}}else if(r.length>0){r="",i=0,n=o,s=0;continue}}t&&(r=r.length>0?r+"/..":"..",i=2)}else r.length>0?r+="/"+e.slice(n+1,o):r=e.slice(n+1,o),i=o-n-1;n=o,s=0}else a===46&&s>-1?s++:s=-1}return r}function Aa(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const pM={cwd:mM};function mM(){return"/"}function uf(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function gM(e){if(typeof e=="string")e=new URL(e);else if(!uf(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return _M(e)}function _M(e){if(e.hostname!==""){const i=new TypeError('File URL host must be "localhost" or empty on darwin');throw i.code="ERR_INVALID_FILE_URL_HOST",i}const t=e.pathname;let r=-1;for(;++r<t.length;)if(t.codePointAt(r)===37&&t.codePointAt(r+1)===50){const i=t.codePointAt(r+2);if(i===70||i===102){const n=new TypeError("File URL path must not include encoded / characters");throw n.code="ERR_INVALID_FILE_URL_PATH",n}}return decodeURIComponent(t)}const Ju=["history","path","basename","stem","extname","dirname"];class eS{constructor(t){let r;t?uf(t)?r={path:t}:typeof t=="string"||vM(t)?r={value:t}:r=t:r={},this.cwd="cwd"in r?"":pM.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<Ju.length;){const s=Ju[i];s in r&&r[s]!==void 0&&r[s]!==null&&(this[s]=s==="history"?[...r[s]]:r[s])}let n;for(n in r)Ju.includes(n)||(this[n]=r[n])}get basename(){return typeof this.path=="string"?Wr.basename(this.path):void 0}set basename(t){eh(t,"basename"),Zu(t,"basename"),this.path=Wr.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Wr.dirname(this.path):void 0}set dirname(t){l0(this.basename,"dirname"),this.path=Wr.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Wr.extname(this.path):void 0}set extname(t){if(Zu(t,"extname"),l0(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Wr.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){uf(t)&&(t=gM(t)),eh(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Wr.basename(this.path,this.extname):void 0}set stem(t){eh(t,"stem"),Zu(t,"stem"),this.path=Wr.join(this.dirname||"",t+(this.extname||""))}fail(t,r,i){const n=this.message(t,r,i);throw n.fatal=!0,n}info(t,r,i){const n=this.message(t,r,i);return n.fatal=void 0,n}message(t,r,i){const n=new wt(t,r,i);return this.path&&(n.name=this.path+":"+n.name,n.file=this.path),n.fatal=!1,this.messages.push(n),n}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Zu(e,t){if(e&&e.includes(Wr.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Wr.sep+"`")}function eh(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function l0(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function vM(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const yM=function(e){const i=this.constructor.prototype,n=i[e],s=function(){return n.apply(s,arguments)};return Object.setPrototypeOf(s,i),s},xM={}.hasOwnProperty;class Hp extends yM{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=oM()}copy(){const t=new Hp;let r=-1;for(;++r<this.attachers.length;){const i=this.attachers[r];t.use(...i)}return t.data(Gu(!0,{},this.namespace)),t}data(t,r){return typeof t=="string"?arguments.length===2?(ih("data",this.frozen),this.namespace[t]=r,this):xM.call(this.namespace,t)&&this.namespace[t]||void 0:t?(ih("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...i]=this.attachers[this.freezeIndex];if(i[0]===!1)continue;i[0]===!0&&(i[0]=void 0);const n=r.call(t,...i);typeof n=="function"&&this.transformers.use(n)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const r=pl(t),i=this.parser||this.Parser;return th("parse",i),i(String(r),r)}process(t,r){const i=this;return this.freeze(),th("process",this.parser||this.Parser),rh("process",this.compiler||this.Compiler),r?n(void 0,r):new Promise(n);function n(s,o){const a=pl(t),u=i.parse(a);i.run(u,a,function(h,d,f){if(h||!d||!f)return c(h);const p=d,m=i.stringify(p,f);bM(m)?f.value=m:f.result=m,c(h,f)});function c(h,d){h||!d?o(h):s?s(d):r(void 0,d)}}}processSync(t){let r=!1,i;return this.freeze(),th("processSync",this.parser||this.Parser),rh("processSync",this.compiler||this.Compiler),this.process(t,n),u0("processSync","process",r),i;function n(s,o){r=!0,t0(s),i=o}}run(t,r,i){c0(t),this.freeze();const n=this.transformers;return!i&&typeof r=="function"&&(i=r,r=void 0),i?s(void 0,i):new Promise(s);function s(o,a){const u=pl(r);n.run(t,u,c);function c(h,d,f){const p=d||t;h?a(h):o?o(p):i(void 0,p,f)}}}runSync(t,r){let i=!1,n;return this.run(t,r,s),u0("runSync","run",i),n;function s(o,a){t0(o),n=a,i=!0}}stringify(t,r){this.freeze();const i=pl(r),n=this.compiler||this.Compiler;return rh("stringify",n),c0(t),n(t,i)}use(t,...r){const i=this.attachers,n=this.namespace;if(ih("use",this.frozen),t!=null)if(typeof t=="function")u(t,r);else if(typeof t=="object")Array.isArray(t)?a(t):o(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function s(c){if(typeof c=="function")u(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[h,...d]=c;u(h,d)}else o(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function o(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(c.plugins),c.settings&&(n.settings=Gu(!0,n.settings,c.settings))}function a(c){let h=-1;if(c!=null)if(Array.isArray(c))for(;++h<c.length;){const d=c[h];s(d)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function u(c,h){let d=-1,f=-1;for(;++d<i.length;)if(i[d][0]===c){f=d;break}if(f===-1)i.push([c,...h]);else if(h.length>0){let[p,...m]=h;const y=i[f][1];cf(y)&&cf(p)&&(p=Gu(!0,y,p)),i[f]=[c,p,...m]}}}}const wM=new Hp().freeze();function th(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function rh(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function ih(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function c0(e){if(!cf(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function u0(e,t,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function pl(e){return SM(e)?e:new eS(e)}function SM(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function bM(e){return typeof e=="string"||CM(e)}function CM(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const kM="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",h0=[],d0={allowDangerousHtml:!0},NM=/^(https?|ircs?|mailto|xmpp)$/i,EM=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function jM(e){const t=PM(e),r=MM(e);return TM(t.runSync(t.parse(r),r),e)}function PM(e){const t=e.rehypePlugins||h0,r=e.remarkPlugins||h0,i=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...d0}:d0;return wM().use(c5).use(r).use(nM,i).use(t)}function MM(e){const t=e.children||"",r=new eS;return typeof t=="string"&&(r.value=t),r}function TM(e,t){const r=t.allowedElements,i=t.allowElement,n=t.components,s=t.disallowedElements,o=t.skipHtml,a=t.unwrapDisallowed,u=t.urlTransform||RM;for(const h of EM)Object.hasOwn(t,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+kM+h.id,void 0);return Jw(e,c),$3(e,{Fragment:l.Fragment,components:n,ignoreInvalidStyle:!0,jsx:l.jsx,jsxs:l.jsxs,passKeys:!0,passNode:!0});function c(h,d,f){if(h.type==="raw"&&f&&typeof d=="number")return o?f.children.splice(d,1):f.children[d]={type:"text",value:h.value},d;if(h.type==="element"){let p;for(p in Yu)if(Object.hasOwn(Yu,p)&&Object.hasOwn(h.properties,p)){const m=h.properties[p],y=Yu[p];(y===null||y.includes(h.tagName))&&(h.properties[p]=u(String(m||""),p,h))}}if(h.type==="element"){let p=r?!r.includes(h.tagName):s?s.includes(h.tagName):!1;if(!p&&i&&typeof d=="number"&&(p=!i(h,d,f)),p&&f&&typeof d=="number")return a&&h.children?f.children.splice(d,1,...h.children):f.children.splice(d,1),d}}}function RM(e){const t=e.indexOf(":"),r=e.indexOf("?"),i=e.indexOf("#"),n=e.indexOf("/");return t===-1||n!==-1&&t>n||r!==-1&&t>r||i!==-1&&t>i||NM.test(e.slice(0,t))?e:""}async function DM(e){const t=await fetch(`/api/issues/${e}/costs`);if(!t.ok)throw new Error("Failed to fetch costs");return t.json()}function nh(e){return e>=100?`$${e.toFixed(0)}`:e>=10?`$${e.toFixed(1)}`:e>=1?`$${e.toFixed(2)}`:e>0?`$${e.toFixed(3)}`:"$0.00"}function f0(e){return e>=1e6?`${(e/1e6).toFixed(2)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toString()}function p0(e){if(navigator.clipboard&&window.isSecureContext)return navigator.clipboard.writeText(e),!0;const t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.left="-999999px",t.style.top="-999999px",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),document.body.removeChild(t),!0}catch{return document.body.removeChild(t),!1}}function LM({issue:e,onClose:t,onStartAgent:r}){var A,U,T,$,w,Z,ne;const i=Lr(),[n,s]=F.useState(!1),[o,a]=F.useState(!1),[u,c]=F.useState(!1),[h,d]=F.useState(!0),{data:f,isLoading:p}=Pe({queryKey:["workspace",e.identifier],queryFn:async()=>{const S=await fetch(`/api/workspaces/${e.identifier}`);if(!S.ok)throw new Error("Failed to fetch workspace info");return S.json()},refetchInterval:5e3}),{data:m}=Pe({queryKey:["issueCosts",e.identifier],queryFn:()=>DM(e.identifier),refetchInterval:3e4,staleTime:1e4}),y=()=>{p0(e.identifier),s(!0),setTimeout(()=>s(!1),2e3)},C=()=>{f!=null&&f.path&&(p0(`cd ${f.path}`),a(!0),setTimeout(()=>a(!1),2e3))},g=ye({mutationFn:async()=>{var H;const S=await fetch("/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({issueId:e.identifier,projectId:(H=e.project)==null?void 0:H.id})});if(!S.ok)throw new Error("Failed to start agent");return S.json()},onSuccess:()=>{setTimeout(()=>{i.invalidateQueries({queryKey:["agents"]})},2e3),r==null||r()}}),_=ye({mutationFn:async()=>{var H;const S=await fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({issueId:e.identifier,projectId:(H=e.project)==null?void 0:H.id})});if(!S.ok)throw new Error("Failed to create workspace");return S.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["workspace",e.identifier]})}}),v=ye({mutationFn:async()=>{const S=await fetch(`/api/workspaces/${e.identifier}/containerize`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!S.ok){const H=await S.json();throw new Error(H.error||"Failed to containerize workspace")}return S.json()},onSuccess:()=>{setTimeout(()=>{i.invalidateQueries({queryKey:["workspace",e.identifier]})},3e3)}}),x=ye({mutationFn:async()=>{const S=await fetch(`/api/workspaces/${e.identifier}/start`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!S.ok){const H=await S.json();throw new Error(H.error||"Failed to start containers")}return S.json()},onSuccess:()=>{setTimeout(()=>{i.invalidateQueries({queryKey:["workspace",e.identifier]})},5e3)}}),{data:k,isLoading:b}=Pe({queryKey:["workspace-clean-preview",e.identifier],queryFn:async()=>{const S=await fetch(`/api/workspaces/${e.identifier}/clean/preview`);if(!S.ok)throw new Error("Failed to fetch preview");return S.json()},enabled:u&&(f==null?void 0:f.corrupted)===!0}),j=ye({mutationFn:async S=>{const H=await fetch(`/api/workspaces/${e.identifier}/clean`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({createBackup:S.createBackup})});if(!H.ok){const ee=await H.json();throw new Error(ee.error||"Failed to clean workspace")}return H.json()},onSuccess:S=>{c(!1),i.invalidateQueries({queryKey:["workspace",e.identifier]}),S.backupPath&&alert(`Workspace backed up to:
420
+ ${S.backupPath}
421
+
422
+ You can restore files from there after the new workspace is created.`)}}),L=()=>{g.mutate()},I=()=>{_.mutate()},P=()=>{v.mutate()},D=()=>{x.mutate()},M=()=>{c(!0)},R=()=>{j.mutate({createBackup:h})},O={0:{label:"No priority",color:"text-gray-400"},1:{label:"Urgent",color:"text-red-400"},2:{label:"High",color:"text-orange-400"},3:{label:"Medium",color:"text-yellow-400"},4:{label:"Low",color:"text-blue-400"}},E=O[e.priority]||O[0];return l.jsxs("div",{className:"flex flex-col h-full bg-gray-800 border-l border-gray-700",children:[l.jsxs("div",{className:"px-4 py-3 border-b border-gray-700 flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("button",{onClick:y,className:`font-mono text-sm font-medium transition-colors ${n?"text-green-400":"text-white hover:text-blue-400"}`,title:"Click to copy",children:[e.identifier,n?l.jsx(ys,{className:"w-3 h-3 inline ml-1"}):l.jsx(ax,{className:"w-3 h-3 inline ml-1 opacity-50"})]}),l.jsx("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-gray-400 hover:text-blue-400",children:l.jsx(Wc,{className:"w-4 h-4"})})]}),l.jsx("button",{onClick:t,className:"text-gray-400 hover:text-white p-1",children:l.jsx(Mr,{className:"w-4 h-4"})})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[l.jsx("h2",{className:"text-lg font-medium text-white mb-4",children:e.title}),l.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[l.jsx("span",{className:"px-2 py-1 bg-gray-700 text-white text-xs rounded",children:e.status}),l.jsx("span",{className:`text-xs ${E.color}`,children:E.label})]}),l.jsxs("div",{className:"space-y-3 mb-6",children:[e.assignee&&l.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[l.jsx(px,{className:"w-4 h-4 text-gray-400"}),l.jsx("span",{className:"text-gray-300",children:e.assignee.name}),l.jsx("span",{className:"text-gray-500 text-xs",children:e.assignee.email})]}),e.labels.length>0&&l.jsxs("div",{className:"flex items-center gap-2 text-sm flex-wrap",children:[l.jsx(fx,{className:"w-4 h-4 text-gray-400 shrink-0"}),e.labels.map(S=>l.jsx("span",{className:"px-2 py-0.5 bg-gray-700 text-gray-300 text-xs rounded",children:S},S))]}),l.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-400",children:[l.jsx(wC,{className:"w-4 h-4"}),l.jsxs("span",{children:["Updated ",new Date(e.updatedAt).toLocaleDateString()]})]})]}),e.description&&l.jsxs("div",{className:"mb-6",children:[l.jsx("h3",{className:"text-sm font-medium text-gray-400 mb-2",children:"Description"}),l.jsx("div",{className:"text-sm text-gray-300 bg-gray-900 rounded p-3 max-h-64 overflow-y-auto prose prose-sm prose-invert prose-p:my-2 prose-headings:my-2 prose-ul:my-1 prose-li:my-0",children:l.jsx(jM,{children:e.description})})]}),m&&(m.totalCost>0||m.sessions.length>0)&&l.jsxs("div",{className:"mb-6",children:[l.jsxs("h3",{className:"text-sm font-medium text-gray-400 mb-2 flex items-center gap-2",children:[l.jsx($c,{className:"w-4 h-4"}),"Cost Summary"]}),l.jsxs("div",{className:"bg-gray-900 rounded p-3 space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-gray-400",children:"Total Cost"}),l.jsx("span",{className:"text-xl font-semibold text-green-400",children:nh(m.totalCost)})]}),m.totalTokens>0&&l.jsxs("div",{className:"flex items-center justify-between text-sm",children:[l.jsxs("span",{className:"text-gray-500 flex items-center gap-1",children:[l.jsx(pc,{className:"w-3 h-3"}),"Total Tokens"]}),l.jsx("span",{className:"text-gray-300",children:f0(m.totalTokens)})]}),Object.keys(m.byModel).length>0&&l.jsxs("div",{className:"border-t border-gray-700 pt-2",children:[l.jsx("p",{className:"text-xs text-gray-500 uppercase tracking-wider mb-2",children:"By Model"}),l.jsx("div",{className:"space-y-1",children:Object.entries(m.byModel).sort(([,S],[,H])=>H-S).map(([S,H])=>l.jsxs("div",{className:"flex items-center justify-between text-sm",children:[l.jsx("span",{className:"text-gray-400 truncate",children:S}),l.jsx("span",{className:"text-gray-300",children:nh(H)})]},S))})]}),m.sessions.length>0&&l.jsxs("div",{className:"border-t border-gray-700 pt-2",children:[l.jsxs("p",{className:"text-xs text-gray-500 uppercase tracking-wider mb-2",children:["Sessions (",m.sessions.length,")"]}),l.jsx("div",{className:"space-y-2 max-h-32 overflow-y-auto",children:m.sessions.map(S=>l.jsxs("div",{className:"flex items-center justify-between text-xs bg-gray-800 rounded px-2 py-1",children:[l.jsxs("div",{className:"flex items-center gap-2 truncate",children:[l.jsx("span",{className:"px-1.5 py-0.5 bg-gray-700 rounded text-gray-400",children:S.type}),l.jsx("span",{className:"text-gray-500 truncate",children:S.model})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[S.tokenCount&&l.jsx("span",{className:"text-gray-500",children:f0(S.tokenCount)}),S.cost?l.jsx("span",{className:"text-green-400",children:nh(S.cost)}):l.jsx("span",{className:"text-gray-600",children:"-"})]})]},S.id))})]})]})]}),p&&l.jsx("div",{className:"bg-gray-700/30 border border-gray-600/50 rounded-lg p-4 mb-4 animate-pulse",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("div",{className:"w-8 h-8 bg-gray-600 rounded-full shrink-0"}),l.jsxs("div",{className:"flex-1 space-y-3",children:[l.jsx("div",{className:"h-4 bg-gray-600 rounded w-32"}),l.jsx("div",{className:"h-3 bg-gray-600 rounded w-full"}),l.jsx("div",{className:"h-3 bg-gray-600 rounded w-3/4"}),l.jsxs("div",{className:"flex gap-2 mt-3",children:[l.jsx("div",{className:"h-6 bg-gray-600 rounded w-20"}),l.jsx("div",{className:"h-6 bg-gray-600 rounded w-16"}),l.jsx("div",{className:"h-6 bg-gray-600 rounded w-24"})]})]})]})}),!p&&(f==null?void 0:f.exists)&&(f==null?void 0:f.corrupted)&&l.jsx("div",{className:"bg-yellow-900/20 border border-yellow-700/50 rounded-lg p-4 mb-4",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("div",{className:"w-8 h-8 bg-yellow-900/50 rounded-full flex items-center justify-center shrink-0",children:l.jsx(Xs,{className:"w-4 h-4 text-yellow-400"})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("h4",{className:"text-sm font-medium text-yellow-400",children:"Workspace Corrupted"}),l.jsx("p",{className:"text-sm text-gray-400 mt-1",children:f.message||"The workspace exists but is not a valid git worktree."}),l.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["Path: ",l.jsx("code",{className:"bg-gray-800 px-1 rounded",children:f.path})]}),l.jsx("button",{onClick:M,disabled:j.isPending,className:"mt-3 flex items-center gap-2 px-3 py-1.5 bg-yellow-600 hover:bg-yellow-500 disabled:bg-yellow-800 text-white text-sm rounded transition-colors",children:j.isPending?l.jsxs(l.Fragment,{children:[l.jsx(Ne,{className:"w-4 h-4 animate-spin"}),"Cleaning..."]}):l.jsxs(l.Fragment,{children:[l.jsx(Vn,{className:"w-4 h-4"}),"Clean & Recreate"]})}),j.isError&&l.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 px-2 py-1 rounded mt-2",children:j.error instanceof Error?j.error.message:"Failed to clean workspace"}),j.isSuccess&&l.jsx("div",{className:"text-xs text-green-400 bg-green-900/20 px-2 py-1 rounded mt-2",children:"Workspace cleaned! Recreating..."})]})]})}),!p&&(f==null?void 0:f.exists)&&!(f!=null&&f.corrupted)&&l.jsx("div",{className:"bg-green-900/20 border border-green-700/50 rounded-lg p-4 mb-4",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("div",{className:"w-8 h-8 bg-green-900/50 rounded-full flex items-center justify-center shrink-0",children:l.jsx(fp,{className:"w-4 h-4 text-green-400"})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[l.jsx("h4",{className:"text-sm font-medium text-green-400",children:"Workspace Ready"}),!f.hasDocker&&l.jsx("span",{className:"px-2 py-0.5 bg-gray-700 text-gray-400 text-xs rounded",children:"Git only"}),f.hasDocker&&l.jsx("span",{className:"px-2 py-0.5 bg-purple-900/50 text-purple-400 text-xs rounded",children:"Containerized"}),f.hasAgent&&l.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 bg-blue-900/50 text-blue-400 text-xs rounded",children:[l.jsx(xC,{className:"w-3 h-3"}),f.agentModel||"Agent"]})]}),l.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[l.jsx("code",{className:"text-xs text-gray-300 bg-gray-800 px-2 py-1 rounded truncate flex-1",children:f.path}),l.jsx("button",{onClick:C,className:"text-gray-400 hover:text-white p-1",title:"Copy cd command",children:o?l.jsx(ys,{className:"w-4 h-4 text-green-400"}):l.jsx(cn,{className:"w-4 h-4"})})]}),f.containers&&Object.values(f.containers).some(S=>S.running)&&l.jsxs("div",{className:"mt-3 space-y-1",children:[l.jsx("p",{className:"text-xs text-gray-500 uppercase tracking-wider",children:"Services"}),f.frontendUrl&&((U=(A=f.containers)==null?void 0:A.frontend)==null?void 0:U.running)&&l.jsxs("a",{href:f.frontendUrl,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 text-sm text-blue-400 hover:text-blue-300",children:[l.jsx(fd,{className:"w-3 h-3"}),"Frontend: ",f.frontendUrl]}),f.apiUrl&&(($=(T=f.containers)==null?void 0:T.api)==null?void 0:$.running)&&l.jsxs("a",{href:f.apiUrl,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 text-sm text-blue-400 hover:text-blue-300",children:[l.jsx(DC,{className:"w-3 h-3"}),"API: ",f.apiUrl]})]}),f.mrUrl&&l.jsx("div",{className:"mt-3",children:l.jsxs("a",{href:f.mrUrl,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 text-sm text-purple-400 hover:text-purple-300",children:[l.jsx(kC,{className:"w-3 h-3"}),"Merge Request"]})}),f.hasDocker&&(!f.containers||!Object.values(f.containers).some(S=>S.running))&&l.jsxs("div",{className:"mt-3 space-y-2",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("span",{className:"text-xs text-yellow-500",children:"Containers not running."}),l.jsx("button",{onClick:D,disabled:x.isPending,className:"flex items-center gap-1 px-2 py-1 bg-green-600 hover:bg-green-500 disabled:bg-green-800 text-white text-xs rounded transition-colors",children:x.isPending?l.jsxs(l.Fragment,{children:[l.jsx(Ne,{className:"w-3 h-3 animate-spin"}),"Starting..."]}):l.jsxs(l.Fragment,{children:[l.jsx(Pr,{className:"w-3 h-3"}),"Start Containers"]})})]}),x.isError&&l.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 px-2 py-1 rounded",children:x.error instanceof Error?x.error.message:"Failed to start containers"})]}),!f.hasDocker&&l.jsx("div",{className:"mt-3",children:f.canContainerize?l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("span",{className:"text-xs text-gray-500",children:"Git-only workspace."}),l.jsx("button",{onClick:P,disabled:v.isPending,className:"flex items-center gap-1 px-2 py-1 bg-purple-600 hover:bg-purple-500 disabled:bg-purple-800 text-white text-xs rounded transition-colors",children:v.isPending?l.jsxs(l.Fragment,{children:[l.jsx(Ne,{className:"w-3 h-3 animate-spin"}),"Setting up..."]}):l.jsxs(l.Fragment,{children:[l.jsx(fc,{className:"w-3 h-3"}),"Containerize"]})})]}),v.isError&&l.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 px-2 py-1 rounded",children:v.error instanceof Error?v.error.message:"Failed to containerize workspace"})]}):l.jsx("div",{className:"text-xs text-gray-500",children:"This is a git-only workspace (no containers)."})}),f.containers&&l.jsxs("div",{className:"mt-3",children:[l.jsx("p",{className:"text-xs text-gray-500 uppercase tracking-wider mb-1",children:"Containers"}),l.jsx("div",{className:"flex flex-wrap gap-2",children:Object.entries(f.containers).map(([S,H])=>{const ee=x.isPending&&!H.running;return l.jsxs("span",{className:`flex items-center gap-1 px-2 py-0.5 rounded text-xs ${H.running?"bg-green-900/30 text-green-400":ee?"bg-yellow-900/30 text-yellow-400 animate-pulse":"bg-gray-700 text-gray-500"}`,children:[ee?l.jsx(Ne,{className:"w-3 h-3 animate-spin"}):S==="postgres"||S==="redis"?l.jsx(lx,{className:"w-3 h-3"}):l.jsx(fc,{className:"w-3 h-3"}),S,H.running&&H.uptime&&l.jsx("span",{className:"text-gray-400 ml-1",children:H.uptime}),ee&&l.jsx("span",{className:"text-yellow-500 ml-1",children:"starting..."})]},S)})})]}),f.repoGit&&(f.repoGit.frontend||f.repoGit.api)&&l.jsxs("div",{className:"mt-3 space-y-2",children:[l.jsx("p",{className:"text-xs text-gray-500 uppercase tracking-wider",children:"Git Status"}),f.repoGit.frontend&&l.jsxs("div",{className:"text-xs",children:[l.jsx("span",{className:"text-gray-400",children:"Frontend:"}),l.jsxs("span",{className:"flex items-center gap-2 mt-0.5",children:[l.jsx(Tl,{className:"w-3 h-3 text-gray-500"}),l.jsx("span",{className:"text-gray-300",children:f.repoGit.frontend.branch}),f.repoGit.frontend.uncommittedFiles>0&&l.jsxs("span",{className:"text-yellow-400",children:[f.repoGit.frontend.uncommittedFiles," uncommitted"]})]})]}),f.repoGit.api&&l.jsxs("div",{className:"text-xs",children:[l.jsx("span",{className:"text-gray-400",children:"API:"}),l.jsxs("span",{className:"flex items-center gap-2 mt-0.5",children:[l.jsx(Tl,{className:"w-3 h-3 text-gray-500"}),l.jsx("span",{className:"text-gray-300",children:f.repoGit.api.branch}),f.repoGit.api.uncommittedFiles>0&&l.jsxs("span",{className:"text-yellow-400",children:[f.repoGit.api.uncommittedFiles," uncommitted"]})]})]})]}),f.git&&!((w=f.repoGit)!=null&&w.frontend)&&!((Z=f.repoGit)!=null&&Z.api)&&l.jsxs("div",{className:"flex items-center gap-3 mt-3 text-xs",children:[l.jsxs("span",{className:"flex items-center gap-1 text-gray-400",children:[l.jsx(Tl,{className:"w-3 h-3"}),f.git.branch]}),f.git.uncommittedFiles>0&&l.jsxs("span",{className:"text-yellow-400",children:[f.git.uncommittedFiles," uncommitted"]})]})]})]})}),!(f!=null&&f.exists)&&!p&&l.jsx("div",{className:"bg-yellow-900/20 border border-yellow-700/50 rounded-lg p-4 mb-4",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("div",{className:"w-8 h-8 bg-yellow-900/50 rounded-full flex items-center justify-center shrink-0",children:l.jsx(Pr,{className:"w-4 h-4 text-yellow-400"})}),l.jsxs("div",{children:[l.jsx("h4",{className:"text-sm font-medium text-yellow-400",children:"No Workspace"}),l.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Create a workspace or start an agent to begin work."})]})]})}),p&&l.jsxs("div",{className:"space-y-3 animate-pulse",children:[l.jsx("div",{className:"h-12 bg-gray-600 rounded-lg w-full"}),l.jsx("div",{className:"h-12 bg-gray-700 rounded-lg w-full"})]}),!p&&l.jsxs("div",{className:"space-y-3",children:[l.jsx("button",{onClick:L,disabled:g.isPending||g.isSuccess,className:"w-full flex items-center justify-center gap-2 px-4 py-3 bg-blue-600 text-white rounded-lg hover:bg-blue-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:g.isPending?l.jsxs(l.Fragment,{children:[l.jsx(Ne,{className:"w-5 h-5 animate-spin"}),l.jsx("span",{className:"font-medium",children:"Starting..."})]}):g.isSuccess?l.jsxs(l.Fragment,{children:[l.jsx(ys,{className:"w-5 h-5"}),l.jsx("span",{className:"font-medium",children:"Agent Started!"})]}):l.jsxs(l.Fragment,{children:[l.jsx(Pr,{className:"w-5 h-5"}),l.jsx("span",{className:"font-medium",children:f!=null&&f.exists?"Start Agent in Workspace":"Start Agent"})]})}),!(f!=null&&f.exists)&&l.jsx("button",{onClick:I,disabled:_.isPending||_.isSuccess,className:"w-full flex items-center justify-center gap-2 px-4 py-3 bg-gray-700 text-white rounded-lg hover:bg-gray-600 transition-colors border border-gray-600 disabled:opacity-50 disabled:cursor-not-allowed",children:_.isPending?l.jsxs(l.Fragment,{children:[l.jsx(Ne,{className:"w-5 h-5 animate-spin"}),l.jsx("span",{className:"font-medium",children:"Creating..."})]}):_.isSuccess?l.jsxs(l.Fragment,{children:[l.jsx(ys,{className:"w-5 h-5"}),l.jsx("span",{className:"font-medium",children:"Workspace Created!"})]}):l.jsxs(l.Fragment,{children:[l.jsx(CC,{className:"w-5 h-5"}),l.jsx("span",{className:"font-medium",children:"Create Workspace Only"})]})}),g.isError&&l.jsx("p",{className:"text-red-400 text-xs",children:"Failed to start agent. Check server logs."}),_.isError&&l.jsx("p",{className:"text-red-400 text-xs",children:"Failed to create workspace. Check server logs."})]}),!p&&l.jsxs("div",{className:"text-xs text-gray-500 mt-3 space-y-1",children:[l.jsxs("p",{children:[l.jsx("strong",{children:"Start Agent:"})," ",f!=null&&f.exists?"Starts autonomous agent in existing workspace":"Creates workspace + starts autonomous agent"]}),!(f!=null&&f.exists)&&l.jsxs("p",{children:[l.jsx("strong",{children:"Create Workspace:"})," Creates git worktree for manual work"]})]})]}),u&&l.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4",children:l.jsxs("div",{className:"bg-gray-800 rounded-lg max-w-2xl w-full max-h-[80vh] overflow-hidden flex flex-col",children:[l.jsxs("div",{className:"px-4 py-3 border-b border-gray-700 flex items-center justify-between",children:[l.jsxs("h3",{className:"text-lg font-medium text-white flex items-center gap-2",children:[l.jsx(Xs,{className:"w-5 h-5 text-yellow-500"}),"Clean Corrupted Workspace"]}),l.jsx("button",{onClick:()=>c(!1),className:"text-gray-400 hover:text-white",children:l.jsx(Mr,{className:"w-5 h-5"})})]}),l.jsx("div",{className:"p-4 overflow-y-auto flex-1",children:b?l.jsxs("div",{className:"flex items-center justify-center py-8",children:[l.jsx(Ne,{className:"w-6 h-6 animate-spin text-gray-400"}),l.jsx("span",{className:"ml-2 text-gray-400",children:"Scanning workspace..."})]}):k?l.jsxs("div",{className:"space-y-4",children:[k.diffAnalysis&&!k.diffAnalysis.error&&l.jsxs("div",{className:"space-y-3",children:[l.jsxs("p",{className:"text-xs text-gray-500",children:["Compared against: ",l.jsx("code",{className:"bg-gray-900 px-1 rounded",children:k.diffAnalysis.comparedAgainst})]}),k.diffAnalysis.modifiedFiles.length>0&&l.jsxs("div",{className:"bg-red-900/30 border border-red-700/50 rounded p-3",children:[l.jsxs("h4",{className:"text-sm font-medium text-red-400 flex items-center gap-2",children:[l.jsx("span",{className:"w-2 h-2 bg-red-500 rounded-full"}),k.diffAnalysis.modifiedFiles.length," Modified Files (WILL BE LOST)"]}),l.jsxs("p",{className:"text-xs text-gray-400 mt-1 mb-2",children:["These files have changes that differ from ",l.jsx("code",{children:k.diffAnalysis.comparedAgainst})]}),l.jsx("div",{className:"bg-gray-900 rounded p-2 max-h-32 overflow-y-auto",children:l.jsxs("ul",{className:"text-xs text-red-300 font-mono space-y-0.5",children:[k.diffAnalysis.modifiedFiles.slice(0,20).map((S,H)=>l.jsxs("li",{className:"truncate",children:["• ",S]},H)),k.diffAnalysis.modifiedFiles.length>20&&l.jsxs("li",{className:"text-gray-500",children:["...and ",k.diffAnalysis.modifiedFiles.length-20," more"]})]})})]}),k.diffAnalysis.newFiles.length>0&&l.jsxs("div",{className:"bg-orange-900/30 border border-orange-700/50 rounded p-3",children:[l.jsxs("h4",{className:"text-sm font-medium text-orange-400 flex items-center gap-2",children:[l.jsx("span",{className:"w-2 h-2 bg-orange-500 rounded-full"}),k.diffAnalysis.newFiles.length," New Files (WILL BE LOST)"]}),l.jsxs("p",{className:"text-xs text-gray-400 mt-1 mb-2",children:["These files don't exist in ",l.jsx("code",{children:k.diffAnalysis.comparedAgainst})]}),l.jsx("div",{className:"bg-gray-900 rounded p-2 max-h-24 overflow-y-auto",children:l.jsxs("ul",{className:"text-xs text-orange-300 font-mono space-y-0.5",children:[k.diffAnalysis.newFiles.slice(0,15).map((S,H)=>l.jsxs("li",{className:"truncate",children:["+ ",S]},H)),k.diffAnalysis.newFiles.length>15&&l.jsxs("li",{className:"text-gray-500",children:["...and ",k.diffAnalysis.newFiles.length-15," more"]})]})})]}),k.diffAnalysis.unchangedFiles.length>0&&l.jsxs("div",{className:"bg-green-900/30 border border-green-700/50 rounded p-3",children:[l.jsxs("h4",{className:"text-sm font-medium text-green-400 flex items-center gap-2",children:[l.jsx("span",{className:"w-2 h-2 bg-green-500 rounded-full"}),k.diffAnalysis.unchangedFiles.length," Unchanged Files (safe to delete)"]}),l.jsxs("p",{className:"text-xs text-gray-400 mt-1",children:["These files are identical to ",l.jsx("code",{children:k.diffAnalysis.comparedAgainst})," and will be recreated."]})]}),k.diffAnalysis.modifiedFiles.length===0&&k.diffAnalysis.newFiles.length===0&&l.jsxs("div",{className:"bg-green-900/30 border border-green-700/50 rounded p-3",children:[l.jsx("p",{className:"text-green-400 text-sm font-medium",children:"✓ No unique changes detected"}),l.jsxs("p",{className:"text-xs text-gray-400 mt-1",children:["All analyzed files match ",l.jsx("code",{children:k.diffAnalysis.comparedAgainst}),". Safe to clean without backup."]})]})]}),((ne=k.diffAnalysis)==null?void 0:ne.error)&&l.jsxs("div",{className:"bg-yellow-900/30 border border-yellow-700/50 rounded p-3",children:[l.jsx("p",{className:"text-yellow-400 text-sm font-medium",children:"⚠️ Could not analyze changes"}),l.jsx("p",{className:"text-xs text-gray-400 mt-1",children:k.diffAnalysis.error}),l.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Recommend creating a backup to be safe."})]}),l.jsxs("div",{className:"bg-gray-900/50 border border-gray-700 rounded p-3",children:[l.jsxs("p",{className:"text-gray-400 text-xs",children:[l.jsx("strong",{children:"Path:"})," ",l.jsx("code",{className:"bg-gray-800 px-1 rounded",children:k.workspacePath})]}),l.jsxs("p",{className:"text-gray-400 text-xs mt-1",children:[l.jsx("strong",{children:"Size:"})," ",k.totalSize," • ",k.fileCount," files analyzed"]})]}),l.jsx("div",{className:"border-t border-gray-700 pt-4",children:l.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:h,onChange:S=>d(S.target.checked),className:"mt-1 w-4 h-4 rounded border-gray-600 bg-gray-700 text-blue-500 focus:ring-blue-500"}),l.jsxs("div",{children:[l.jsx("span",{className:"text-white text-sm font-medium",children:"Create backup before cleaning"}),l.jsxs("p",{className:"text-xs text-gray-400 mt-0.5",children:["Files will be copied to: ",l.jsxs("code",{className:"bg-gray-900 px-1 rounded",children:[".backup-feature-",e.identifier.toLowerCase(),"-*"]})]}),l.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"You can manually restore files from the backup after the new workspace is created."})]})]})}),l.jsxs("details",{className:"group",children:[l.jsx("summary",{className:"text-xs text-gray-500 cursor-pointer hover:text-gray-400",children:"What causes corrupted workspaces?"}),l.jsx("div",{className:"mt-2 bg-blue-900/30 border border-blue-700/50 rounded p-3",children:l.jsxs("ul",{className:"text-xs text-gray-400 space-y-1 list-disc list-inside",children:[l.jsxs("li",{children:["Interrupted ",l.jsx("code",{children:"pan workspace create"})," command"]}),l.jsxs("li",{children:["Manual deletion of the ",l.jsx("code",{children:".git"})," file"]}),l.jsx("li",{children:"Disk space issues during workspace creation"}),l.jsx("li",{children:"Git worktree pruning from the main repository"})]})})]})]}):l.jsx("p",{className:"text-gray-400",children:"Failed to load preview"})}),l.jsxs("div",{className:"px-4 py-3 border-t border-gray-700 flex justify-end gap-3",children:[l.jsx("button",{onClick:()=>c(!1),className:"px-4 py-2 text-gray-400 hover:text-white text-sm",children:"Cancel"}),l.jsx("button",{onClick:R,disabled:j.isPending||b,className:"px-4 py-2 bg-yellow-600 hover:bg-yellow-500 disabled:bg-yellow-800 text-white text-sm rounded flex items-center gap-2",children:j.isPending?l.jsxs(l.Fragment,{children:[l.jsx(Ne,{className:"w-4 h-4 animate-spin"}),h?"Backing up & Cleaning...":"Cleaning..."]}):l.jsxs(l.Fragment,{children:[l.jsx(Vn,{className:"w-4 h-4"}),h?"Backup & Recreate":"Delete & Recreate"]})})]}),j.isError&&l.jsx("div",{className:"px-4 py-2 bg-red-900/30 border-t border-red-700",children:l.jsx("p",{className:"text-red-400 text-sm",children:j.error instanceof Error?j.error.message:"Failed to clean workspace"})})]})})]})}async function AM(){const e=await fetch("/api/activity");if(!e.ok)throw new Error("Failed to fetch activity");return e.json()}function OM({status:e}){switch(e){case"running":return l.jsx(Ne,{className:"w-4 h-4 text-blue-400 animate-spin"});case"completed":return l.jsx(Pa,{className:"w-4 h-4 text-green-400"});case"failed":return l.jsx(dp,{className:"w-4 h-4 text-red-400"})}}function BM(e){return new Date(e).toLocaleTimeString()}function zM({onClose:e}){const{data:t,isLoading:r}=Pe({queryKey:["activity"],queryFn:AM,refetchInterval:1e3});return l.jsxs("div",{className:"flex flex-col h-full bg-gray-800 border-l border-gray-700",children:[l.jsxs("div",{className:"px-4 py-3 border-b border-gray-700 flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(cn,{className:"w-5 h-5 text-blue-400"}),l.jsx("h2",{className:"font-medium text-white",children:"Activity Log"})]}),l.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white p-1",children:l.jsx(Mr,{className:"w-4 h-4"})})]}),l.jsx("div",{className:"flex-1 overflow-y-auto",children:r?l.jsx("div",{className:"flex items-center justify-center h-32 text-gray-400",children:l.jsx(Ne,{className:"w-6 h-6 animate-spin"})}):!t||t.length===0?l.jsxs("div",{className:"flex flex-col items-center justify-center h-32 text-gray-500",children:[l.jsx(cn,{className:"w-8 h-8 mb-2 opacity-50"}),l.jsx("p",{className:"text-sm",children:"No activity yet"}),l.jsx("p",{className:"text-xs mt-1",children:"Start an agent or create a workspace to see output here"})]}):l.jsx("div",{className:"divide-y divide-gray-700",children:t.map(i=>l.jsxs("div",{className:"p-3",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx(OM,{status:i.status}),l.jsx("code",{className:"text-sm text-white font-mono flex-1 truncate",children:i.command}),l.jsx("span",{className:"text-xs text-gray-500",children:BM(i.timestamp)})]}),l.jsx("pre",{className:"bg-gray-900 rounded p-2 text-xs text-gray-300 font-mono overflow-x-auto max-h-96 overflow-y-auto",children:i.output.length>0?i.output.join(`
423
+ `):i.status==="running"?"Waiting for output...":"No output"}),l.jsx("div",{className:"mt-2 flex items-center gap-2",children:l.jsx("span",{className:`text-xs px-2 py-0.5 rounded ${i.status==="running"?"bg-blue-900/50 text-blue-400":i.status==="completed"?"bg-green-900/50 text-green-400":"bg-red-900/50 text-red-400"}`,children:i.status})})]},i.id))})})]})}async function IM(){const e=await fetch("/api/metrics/runtimes");if(!e.ok)throw new Error("Failed to fetch runtime metrics");return e.json()}function gn(e){return`$${e.toFixed(2)}`}function m0(e){if(e<1)return`${Math.round(e*60)}s`;if(e<60)return`${Math.round(e)}m`;const t=Math.floor(e/60),r=Math.round(e%60);return`${t}h ${r}m`}function ml(e){return`${(e*100).toFixed(1)}%`}function FM(e){return e>=1e6?`${(e/1e6).toFixed(2)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toString()}function gl(e){return e>=.9?"text-green-400":e>=.7?"text-yellow-400":e>=.5?"text-orange-400":"text-red-400"}function g0(e){return{claude:"🤖",codex:"🧠",cursor:"📝",copilot:"✈️",aider:"🔧",continue:"➡️"}[e.toLowerCase()]||"⚙️"}function HM(){const{data:e,isLoading:t,error:r}=Pe({queryKey:["runtimeMetrics"],queryFn:IM,refetchInterval:6e4,staleTime:3e4});if(t)return l.jsx("div",{className:"p-6",children:l.jsxs("div",{className:"animate-pulse space-y-4",children:[l.jsx("div",{className:"h-8 bg-gray-700 rounded w-1/4"}),l.jsx("div",{className:"h-64 bg-gray-700 rounded"})]})});if(r)return l.jsx("div",{className:"p-6",children:l.jsx("div",{className:"bg-red-900/20 border border-red-500/30 rounded-lg p-4",children:l.jsx("p",{className:"text-red-400",children:"Failed to load runtime metrics"})})});const i=e!=null&&e.runtimes?Object.values(e.runtimes):[],n=e==null?void 0:e.aggregated;return i.length===0?l.jsxs("div",{className:"p-6",children:[l.jsxs("h2",{className:"text-xl font-semibold mb-4 flex items-center gap-2",children:[l.jsx(dd,{className:"w-5 h-5"}),"Runtime Comparison"]}),l.jsxs("div",{className:"bg-gray-800 rounded-lg p-8 text-center",children:[l.jsx(pc,{className:"w-12 h-12 mx-auto mb-4 text-gray-500"}),l.jsx("p",{className:"text-gray-400",children:"No runtime metrics recorded yet."}),l.jsx("p",{className:"text-gray-500 text-sm mt-2",children:"Metrics will appear here as tasks are completed by different runtimes."})]})]}):l.jsxs("div",{className:"p-6 space-y-6",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("h2",{className:"text-xl font-semibold flex items-center gap-2",children:[l.jsx(dd,{className:"w-5 h-5"}),"Runtime Comparison"]}),n&&l.jsxs("div",{className:"text-sm text-gray-400",children:[n.totalTasks," total tasks • ",gn(n.totalCost)," total cost"]})]}),n&&l.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[l.jsxs("div",{className:"bg-gray-800 rounded-lg p-4",children:[l.jsxs("div",{className:"flex items-center gap-2 text-gray-400 text-sm mb-1",children:[l.jsx(Pa,{className:"w-4 h-4"}),"Total Tasks"]}),l.jsx("div",{className:"text-2xl font-bold",children:n.totalTasks})]}),l.jsxs("div",{className:"bg-gray-800 rounded-lg p-4",children:[l.jsxs("div",{className:"flex items-center gap-2 text-gray-400 text-sm mb-1",children:[l.jsx(mg,{className:"w-4 h-4"}),"Avg Success Rate"]}),l.jsx("div",{className:`text-2xl font-bold ${gl(n.avgSuccessRate)}`,children:ml(n.avgSuccessRate)})]}),l.jsxs("div",{className:"bg-gray-800 rounded-lg p-4",children:[l.jsxs("div",{className:"flex items-center gap-2 text-gray-400 text-sm mb-1",children:[l.jsx(Hc,{className:"w-4 h-4"}),"Avg Duration"]}),l.jsx("div",{className:"text-2xl font-bold",children:m0(n.avgDuration)})]}),l.jsxs("div",{className:"bg-gray-800 rounded-lg p-4",children:[l.jsxs("div",{className:"flex items-center gap-2 text-gray-400 text-sm mb-1",children:[l.jsx($c,{className:"w-4 h-4"}),"Total Cost"]}),l.jsx("div",{className:"text-2xl font-bold text-green-400",children:gn(n.totalCost)})]})]}),l.jsx("div",{className:"bg-gray-800 rounded-lg overflow-hidden",children:l.jsxs("table",{className:"w-full",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-gray-700",children:[l.jsx("th",{className:"text-left p-4 text-gray-400 font-medium",children:"Runtime"}),l.jsx("th",{className:"text-right p-4 text-gray-400 font-medium",children:"Tasks"}),l.jsx("th",{className:"text-right p-4 text-gray-400 font-medium",children:"Success Rate"}),l.jsx("th",{className:"text-right p-4 text-gray-400 font-medium",children:"Avg Duration"}),l.jsx("th",{className:"text-right p-4 text-gray-400 font-medium",children:"Avg Cost"}),l.jsx("th",{className:"text-right p-4 text-gray-400 font-medium",children:"Total Cost"}),l.jsx("th",{className:"text-right p-4 text-gray-400 font-medium",children:"Tokens"})]})}),l.jsx("tbody",{children:i.map(s=>l.jsxs("tr",{className:"border-b border-gray-700/50 hover:bg-gray-700/30 transition-colors",children:[l.jsx("td",{className:"p-4",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-lg",children:g0(s.runtime)}),l.jsx("span",{className:"font-medium capitalize",children:s.runtime})]})}),l.jsx("td",{className:"text-right p-4",children:l.jsxs("div",{className:"flex items-center justify-end gap-2",children:[l.jsx("span",{className:"text-green-400",title:"Successful",children:s.successfulTasks}),l.jsx("span",{className:"text-gray-500",children:"/"}),l.jsx("span",{children:s.totalTasks}),s.failedTasks>0&&l.jsxs("span",{className:"text-red-400 text-sm",title:"Failed",children:["(",s.failedTasks," failed)"]})]})}),l.jsx("td",{className:"text-right p-4",children:l.jsx("span",{className:gl(s.successRate),children:ml(s.successRate)})}),l.jsx("td",{className:"text-right p-4 text-gray-300",children:m0(s.avgDurationMinutes)}),l.jsx("td",{className:"text-right p-4 text-gray-300",children:gn(s.avgCost)}),l.jsx("td",{className:"text-right p-4 font-medium text-green-400",children:gn(s.totalCost)}),l.jsx("td",{className:"text-right p-4 text-gray-300",children:FM(s.totalTokens)})]},s.runtime))})]})}),l.jsx("div",{className:"grid grid-cols-2 gap-6",children:i.map(s=>l.jsxs("div",{className:"bg-gray-800 rounded-lg p-4",children:[l.jsxs("h3",{className:"font-medium mb-3 flex items-center gap-2",children:[l.jsx("span",{children:g0(s.runtime)}),l.jsx("span",{className:"capitalize",children:s.runtime}),l.jsx("span",{className:"text-gray-500 text-sm",children:"by Capability"})]}),Object.keys(s.byCapability).length===0?l.jsx("p",{className:"text-gray-500 text-sm",children:"No capability data"}):l.jsx("div",{className:"space-y-2",children:Object.entries(s.byCapability).map(([o,a])=>l.jsxs("div",{className:"flex items-center justify-between text-sm",children:[l.jsx("span",{className:"capitalize text-gray-300",children:o}),l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsxs("span",{className:"text-gray-500",children:[a.tasks," tasks"]}),l.jsx("span",{className:gl(a.successRate),children:ml(a.successRate)}),l.jsx("span",{className:"text-green-400 w-16 text-right",children:gn(a.totalCost)})]})]},o))})]},s.runtime))}),l.jsxs("div",{className:"bg-gray-800 rounded-lg p-4",children:[l.jsxs("h3",{className:"font-medium mb-3 flex items-center gap-2",children:[l.jsx(pc,{className:"w-4 h-4"}),"By Model"]}),l.jsx("div",{className:"grid grid-cols-3 gap-4",children:i.map(s=>l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"text-sm text-gray-400 capitalize",children:s.runtime}),Object.keys(s.byModel).length===0?l.jsx("p",{className:"text-gray-500 text-xs",children:"No model data"}):Object.entries(s.byModel).map(([o,a])=>l.jsxs("div",{className:"bg-gray-700/50 rounded p-2 text-sm",children:[l.jsx("div",{className:"font-medium text-gray-200 truncate",title:o,children:o}),l.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-400 mt-1",children:[l.jsxs("span",{children:[a.tasks," tasks"]}),l.jsx("span",{className:gl(a.successRate),children:ml(a.successRate)}),l.jsx("span",{className:"text-green-400",children:gn(a.totalCost)})]})]},o))]},s.runtime))})]}),i.some(s=>s.dailyStats.length>0)&&l.jsxs("div",{className:"bg-gray-800 rounded-lg p-4",children:[l.jsxs("h3",{className:"font-medium mb-3 flex items-center gap-2",children:[l.jsx(mg,{className:"w-4 h-4"}),"Daily Activity (Last 30 Days)"]}),l.jsx("div",{className:"overflow-x-auto",children:l.jsx("div",{className:"flex gap-1 min-w-max",children:(()=>{const s=new Set;return i.forEach(a=>a.dailyStats.forEach(u=>s.add(u.date))),Array.from(s).sort().slice(-30).map(a=>{const u=i.reduce((f,p)=>{const m=p.dailyStats.find(y=>y.date===a);return f+((m==null?void 0:m.tasks)||0)},0),c=i.reduce((f,p)=>{const m=p.dailyStats.find(y=>y.date===a);return f+((m==null?void 0:m.cost)||0)},0),h=Math.max(...Array.from(s).map(f=>i.reduce((p,m)=>{const y=m.dailyStats.find(C=>C.date===f);return p+((y==null?void 0:y.tasks)||0)},0)),1),d=Math.max(u/h*60,4);return l.jsxs("div",{className:"flex flex-col items-center group",title:`${a}: ${u} tasks, ${gn(c)}`,children:[l.jsx("div",{className:"h-16 flex items-end",children:l.jsx("div",{className:"w-3 bg-blue-500 rounded-t transition-all group-hover:bg-blue-400",style:{height:`${d}px`}})}),l.jsx("div",{className:"text-[10px] text-gray-500 mt-1 rotate-45 origin-left w-8",children:a.slice(5)})]},a)})})()})})]})]})}async function $M(){const e=await fetch("/api/cloister/status");if(!e.ok)throw new Error("Failed to fetch Cloister status");return e.json()}async function WM(){if(!(await fetch("/api/cloister/start",{method:"POST"})).ok)throw new Error("Failed to start Cloister")}async function UM(){if(!(await fetch("/api/cloister/stop",{method:"POST"})).ok)throw new Error("Failed to stop Cloister")}async function KM(){const e=await fetch("/api/cloister/emergency-stop",{method:"POST"});if(!e.ok)throw new Error("Failed to execute emergency stop");return e.json()}function qM(){const[e,t]=F.useState(!1),[r,i]=F.useState(!1),{data:n,refetch:s}=Pe({queryKey:["cloister-status"],queryFn:$M,refetchInterval:1e4}),o=async()=>{i(!0);try{n!=null&&n.running?await UM():await WM(),await s()}finally{i(!1)}},a=async()=>{await KM(),t(!1),s()};if(!n)return null;const u=n.summary.warning>0||n.summary.stuck>0,c=n.agentsNeedingAttention.length;return l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[n.running?l.jsx(nx,{className:"w-5 h-5 text-green-400"}):l.jsx(yC,{className:"w-5 h-5 text-gray-500"}),l.jsx("span",{className:"text-sm text-gray-300",children:n.running?"Cloister: Running":"Cloister: Stopped"})]}),n.running&&n.summary.total>0&&l.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[n.summary.active>0&&l.jsxs("span",{className:"text-green-400",children:["🟢 ",n.summary.active]}),n.summary.stale>0&&l.jsxs("span",{className:"text-yellow-400",children:["🟡 ",n.summary.stale]}),n.summary.warning>0&&l.jsxs("span",{className:"text-orange-400",children:["🟠 ",n.summary.warning]}),n.summary.stuck>0&&l.jsxs("span",{className:"text-red-400",children:["🔴 ",n.summary.stuck]})]}),u&&l.jsxs("div",{className:"flex items-center gap-2 px-3 py-1 bg-orange-500/20 rounded-lg border border-orange-500/30",children:[l.jsx(Xs,{className:"w-4 h-4 text-orange-400"}),l.jsxs("span",{className:"text-xs text-orange-300",children:[c," agent",c!==1?"s":""," need attention"]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("button",{onClick:o,disabled:r,className:`px-3 py-1 rounded text-xs transition-colors ${r?"bg-gray-600 text-gray-400 cursor-wait":n.running?"bg-gray-700 text-gray-300 hover:bg-gray-600":"bg-blue-600 text-white hover:bg-blue-700"}`,children:r?n.running?"Stopping...":"Starting...":n.running?"Pause":"Start"}),e?l.jsxs("div",{className:"flex items-center gap-2 px-3 py-1 bg-red-600/20 rounded border border-red-600/30",children:[l.jsx("span",{className:"text-xs text-red-300",children:"Confirm?"}),l.jsx("button",{onClick:a,className:"px-2 py-0.5 rounded text-xs bg-red-600 text-white hover:bg-red-700",children:"Yes"}),l.jsx("button",{onClick:()=>t(!1),className:"px-2 py-0.5 rounded text-xs bg-gray-700 text-gray-300 hover:bg-gray-600",children:"No"})]}):l.jsx("button",{onClick:()=>t(!0),className:"px-3 py-1 rounded text-xs bg-red-600/20 text-red-400 border border-red-600/30 hover:bg-red-600/30 transition-colors",title:"Emergency stop - kill all agents",children:l.jsx(SC,{className:"w-4 h-4"})})]})]})}function VM(e){const t=new Date(e),r=t.toLocaleString("default",{month:"short"}),i=t.getDate(),n=t.getHours().toString().padStart(2,"0"),s=t.getMinutes().toString().padStart(2,"0"),o=t.getSeconds().toString().padStart(2,"0");return`${r} ${i}, ${n}:${s}:${o}`}async function YM(e=50){const t=await fetch(`/api/handoffs?limit=${e}`);if(!t.ok)throw new Error("Failed to fetch handoffs");return t.json()}async function XM(){const e=await fetch("/api/handoffs/stats");if(!e.ok)throw new Error("Failed to fetch handoff stats");return e.json()}const _0={opus:"text-purple-400 bg-purple-900/20 border-purple-500/30",sonnet:"text-blue-400 bg-blue-900/20 border-blue-500/30",haiku:"text-green-400 bg-green-900/20 border-green-500/30"},QM={stuck_escalation:"Stuck Escalation",planning_complete:"Planning Complete",test_failure:"Test Failure",task_complete:"Task Complete",manual:"Manual"},GM={stuck_escalation:"text-red-400",planning_complete:"text-green-400",test_failure:"text-orange-400",task_complete:"text-blue-400",manual:"text-gray-400"};function JM(){var n,s,o,a;const{data:e,isLoading:t}=Pe({queryKey:["handoffs"],queryFn:()=>YM(50),refetchInterval:1e4}),{data:r,isLoading:i}=Pe({queryKey:["handoff-stats"],queryFn:XM,refetchInterval:3e4});return t||i?l.jsx("div",{className:"p-6",children:l.jsx("div",{className:"text-gray-400",children:"Loading handoff data..."})}):l.jsxs("div",{className:"p-6 space-y-6",children:[l.jsxs("div",{children:[l.jsx("h2",{className:"text-2xl font-bold text-white mb-2",children:"Model Handoffs"}),l.jsx("p",{className:"text-gray-400",children:"History of automatic and manual model handoffs across agents"})]}),r&&l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[l.jsxs("div",{className:"p-4 bg-gray-800 rounded-lg border border-gray-700",children:[l.jsx("div",{className:"text-sm text-gray-400 mb-1",children:"Total Handoffs"}),l.jsx("div",{className:"text-2xl font-bold text-white",children:r.totalHandoffs})]}),l.jsxs("div",{className:"p-4 bg-gray-800 rounded-lg border border-gray-700",children:[l.jsx("div",{className:"text-sm text-gray-400 mb-1",children:"Success Rate"}),l.jsxs("div",{className:"text-2xl font-bold text-green-400",children:[(r.successRate*100).toFixed(0),"%"]})]}),l.jsxs("div",{className:"p-4 bg-gray-800 rounded-lg border border-gray-700",children:[l.jsx("div",{className:"text-sm text-gray-400 mb-1",children:"Most Common Trigger"}),l.jsx("div",{className:"text-sm font-medium text-white",children:((n=Object.entries(r.byTrigger).sort((u,c)=>c[1]-u[1])[0])==null?void 0:n[0])||"N/A"}),l.jsxs("div",{className:"text-xs text-gray-500",children:[((s=Object.entries(r.byTrigger).sort((u,c)=>c[1]-u[1])[0])==null?void 0:s[1])||0," times"]})]}),l.jsxs("div",{className:"p-4 bg-gray-800 rounded-lg border border-gray-700",children:[l.jsx("div",{className:"text-sm text-gray-400 mb-1",children:"Most Popular Target"}),l.jsx("div",{className:"text-sm font-medium text-white",children:((o=Object.entries(r.byModel.to).sort((u,c)=>c[1]-u[1])[0])==null?void 0:o[0])||"N/A"}),l.jsxs("div",{className:"text-xs text-gray-500",children:[((a=Object.entries(r.byModel.to).sort((u,c)=>c[1]-u[1])[0])==null?void 0:a[1])||0," handoffs"]})]})]}),l.jsxs("div",{className:"bg-gray-800 rounded-lg border border-gray-700 overflow-hidden",children:[l.jsx("div",{className:"p-4 border-b border-gray-700",children:l.jsx("h3",{className:"text-lg font-semibold text-white",children:"Recent Handoffs"})}),l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"w-full",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"bg-gray-750 text-left text-sm text-gray-400",children:[l.jsx("th",{className:"px-4 py-3",children:"Timestamp"}),l.jsx("th",{className:"px-4 py-3",children:"Agent"}),l.jsx("th",{className:"px-4 py-3",children:"Transition"}),l.jsx("th",{className:"px-4 py-3",children:"Trigger"}),l.jsx("th",{className:"px-4 py-3",children:"Reason"}),l.jsx("th",{className:"px-4 py-3",children:"Cost"}),l.jsx("th",{className:"px-4 py-3",children:"Status"})]})}),l.jsx("tbody",{className:"text-sm",children:e&&e.handoffs.length>0?e.handoffs.map((u,c)=>l.jsxs("tr",{className:"border-t border-gray-700 hover:bg-gray-750",children:[l.jsx("td",{className:"px-4 py-3 text-gray-400",children:l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(Hc,{className:"w-3 h-3"}),VM(u.timestamp)]})}),l.jsxs("td",{className:"px-4 py-3",children:[l.jsx("div",{className:"font-medium text-white",children:u.agentId}),l.jsx("div",{className:"text-xs text-gray-500",children:u.issueId})]}),l.jsx("td",{className:"px-4 py-3",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:`px-2 py-0.5 text-xs rounded border ${_0[u.from.model]||"text-gray-400 bg-gray-700"}`,children:u.from.model}),l.jsx(ix,{className:"w-3 h-3 text-gray-500"}),l.jsx("span",{className:`px-2 py-0.5 text-xs rounded border ${_0[u.to.model]||"text-gray-400 bg-gray-700"}`,children:u.to.model})]})}),l.jsx("td",{className:"px-4 py-3",children:l.jsx("span",{className:`text-xs ${GM[u.trigger]||"text-gray-400"}`,children:QM[u.trigger]||u.trigger})}),l.jsx("td",{className:"px-4 py-3 text-gray-300 max-w-xs truncate",children:u.reason}),l.jsx("td",{className:"px-4 py-3 text-emerald-400",children:u.context.costAtHandoff!==void 0?`$${u.context.costAtHandoff.toFixed(4)}`:"-"}),l.jsx("td",{className:"px-4 py-3",children:u.success?l.jsx("span",{className:"text-green-400 text-xs",children:"✓ Success"}):l.jsx("span",{className:"text-red-400 text-xs",title:u.errorMessage,children:"✗ Failed"})})]},`${u.timestamp}-${c}`)):l.jsx("tr",{children:l.jsx("td",{colSpan:7,className:"px-4 py-8 text-center text-gray-500",children:"No handoffs recorded yet"})})})]})})]})]})}const ZM=400,eT=1200,tT=700;async function rT(){const e=await fetch("/api/agents");if(!e.ok)throw new Error("Failed to fetch agents");return e.json()}async function iT(){const e=await fetch("/api/issues");if(!e.ok)throw new Error("Failed to fetch issues");return e.json()}function nT(){const[e,t]=F.useState("kanban"),[r,i]=F.useState(null),[n,s]=F.useState(null),[o,a]=F.useState(tT),[u,c]=F.useState(!1),[h,d]=F.useState(!1),f=F.useRef(null),{data:p=[]}=Pe({queryKey:["agents"],queryFn:rT,refetchInterval:5e3}),{data:m=[]}=Pe({queryKey:["issues"],queryFn:iT}),y=n?p.find(b=>{var j;return((j=b.issueId)==null?void 0:j.toLowerCase())===n.toLowerCase()}):null,C=n?m.find(b=>b.identifier.toLowerCase()===n.toLowerCase()):null,g=F.useCallback(b=>{b.preventDefault(),c(!0)},[]),_=F.useCallback(b=>{if(!u||!f.current)return;const L=f.current.getBoundingClientRect().right-b.clientX;a(Math.min(eT,Math.max(ZM,L)))},[u]),v=F.useCallback(()=>{c(!1)},[]);F.useEffect(()=>(u&&(document.addEventListener("mousemove",_),document.addEventListener("mouseup",v),document.body.style.cursor="col-resize",document.body.style.userSelect="none"),()=>{document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",v),document.body.style.cursor="",document.body.style.userSelect=""}),[u,_,v]);const x=F.useCallback(()=>{d(b=>!b)},[]),k=h?"calc(100% - 300px)":`${o}px`;return l.jsxs("div",{className:"h-screen bg-gray-900 flex flex-col overflow-hidden",children:[l.jsx("header",{className:"bg-gray-800 border-b border-gray-700 px-6 py-4 shrink-0",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-6",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(cx,{className:"w-6 h-6 text-blue-400"}),l.jsx("h1",{className:"text-xl font-bold text-white",children:"Panopticon"})]}),l.jsx(qM,{})]}),l.jsx("nav",{className:"flex gap-2",children:[{id:"kanban",label:"Board",icon:EC},{id:"agents",label:"Agents",icon:LC},{id:"handoffs",label:"Handoffs",icon:rx},{id:"activity",label:"Activity",icon:cn},{id:"metrics",label:"Metrics",icon:dd},{id:"skills",label:"Skills",icon:sx},{id:"health",label:"Health",icon:hp}].map(({id:b,label:j,icon:L})=>l.jsxs("button",{onClick:()=>t(b),className:`flex items-center gap-2 px-4 py-2 rounded-lg transition-colors ${e===b?"bg-blue-600 text-white":"text-gray-400 hover:text-white hover:bg-gray-700"}`,children:[l.jsx(L,{className:"w-4 h-4"}),j]},b))})]})}),l.jsxs("main",{ref:f,className:"flex-1 flex overflow-hidden",children:[e==="kanban"&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:`flex-1 overflow-auto p-6 ${n?"":"w-full"}`,children:l.jsx(s4,{selectedIssue:n,onSelectIssue:s})}),n&&y&&l.jsxs(l.Fragment,{children:[l.jsx("div",{onMouseDown:g,className:`w-1 hover:w-1.5 bg-gray-700 hover:bg-blue-500 cursor-col-resize transition-colors shrink-0 ${u?"bg-blue-500":""}`}),l.jsxs("div",{style:{width:k},className:"relative shrink-0 h-full flex flex-col",children:[l.jsx("button",{onClick:x,className:"absolute top-2 left-2 z-10 p-1.5 bg-gray-700 hover:bg-gray-600 rounded text-gray-400 hover:text-white",title:h?"Collapse panel":"Expand panel",children:h?l.jsx(MC,{className:"w-4 h-4"}):l.jsx(jC,{className:"w-4 h-4"})}),y.type==="planning"?l.jsx("div",{className:"h-full p-4",children:l.jsx(x_,{agentId:y.id})}):l.jsx(K4,{agent:y,issueId:n,issueUrl:C==null?void 0:C.url,onClose:()=>s(null)})]})]}),n&&!y&&C&&l.jsx("div",{className:"w-[400px] shrink-0 h-full",children:l.jsx(LM,{issue:C,onClose:()=>s(null)})})]}),e==="agents"&&l.jsx("div",{className:"p-6 w-full",children:l.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[l.jsx(B4,{selectedAgent:r,onSelectAgent:i}),r&&l.jsx(x_,{agentId:r})]})}),e==="skills"&&l.jsx("div",{className:"p-6 w-full overflow-auto",children:l.jsx($4,{})}),e==="health"&&l.jsx("div",{className:"p-6 w-full overflow-auto",children:l.jsx(H4,{})}),e==="activity"&&l.jsx("div",{className:"w-full h-full",children:l.jsx(zM,{onClose:()=>t("kanban")})}),e==="metrics"&&l.jsx("div",{className:"w-full overflow-auto",children:l.jsx(HM,{})}),e==="handoffs"&&l.jsx("div",{className:"w-full overflow-auto",children:l.jsx(JM,{})})]})]})}const sT=new iC({defaultOptions:{queries:{refetchInterval:5e3,staleTime:2e3}}});sh.createRoot(document.getElementById("root")).render(l.jsx(bS.StrictMode,{children:l.jsx(nC,{client:sT,children:l.jsx(nT,{})})}));