plotlink-ows 1.0.8 → 1.0.10

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.
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var Vg;function _x(){if(Vg)return ql;Vg=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(s,a,o){var c=null;if(o!==void 0&&(c=""+o),a.key!==void 0&&(c=""+a.key),"key"in a){o={};for(var f in a)f!=="key"&&(o[f]=a[f])}else o=a;return a=o.ref,{$$typeof:e,type:s,key:c,ref:a!==void 0?a:null,props:o}}return ql.Fragment=t,ql.jsx=n,ql.jsxs=n,ql}var Kg;function mx(){return Kg||(Kg=1,Fh.exports=_x()),Fh.exports}var x=mx(),qh={exports:{}},we={};/**
9
+ */var Vg;function mx(){if(Vg)return ql;Vg=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(s,a,o){var c=null;if(o!==void 0&&(c=""+o),a.key!==void 0&&(c=""+a.key),"key"in a){o={};for(var f in a)f!=="key"&&(o[f]=a[f])}else o=a;return a=o.ref,{$$typeof:e,type:s,key:c,ref:a!==void 0?a:null,props:o}}return ql.Fragment=t,ql.jsx=n,ql.jsxs=n,ql}var Kg;function _x(){return Kg||(Kg=1,Fh.exports=mx()),Fh.exports}var x=_x(),qh={exports:{}},we={};/**
10
10
  * @license React
11
11
  * react.production.js
12
12
  *
@@ -14,7 +14,7 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var Xg;function gx(){if(Xg)return we;Xg=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),c=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),S=Symbol.iterator;function v(T){return T===null||typeof T!="object"?null:(T=S&&T[S]||T["@@iterator"],typeof T=="function"?T:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,B={};function D(T,q,C){this.props=T,this.context=q,this.refs=B,this.updater=C||b}D.prototype.isReactComponent={},D.prototype.setState=function(T,q){if(typeof T!="object"&&typeof T!="function"&&T!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,T,q,"setState")},D.prototype.forceUpdate=function(T){this.updater.enqueueForceUpdate(this,T,"forceUpdate")};function G(){}G.prototype=D.prototype;function A(T,q,C){this.props=T,this.context=q,this.refs=B,this.updater=C||b}var N=A.prototype=new G;N.constructor=A,k(N,D.prototype),N.isPureReactComponent=!0;var $=Array.isArray;function z(){}var Q={H:null,A:null,T:null,S:null},se=Object.prototype.hasOwnProperty;function he(T,q,C){var ae=C.ref;return{$$typeof:e,type:T,key:q,ref:ae!==void 0?ae:null,props:C}}function j(T,q){return he(T.type,q,T.props)}function ne(T){return typeof T=="object"&&T!==null&&T.$$typeof===e}function Y(T){var q={"=":"=0",":":"=2"};return"$"+T.replace(/[=:]/g,function(C){return q[C]})}var U=/\/+/g;function K(T,q){return typeof T=="object"&&T!==null&&T.key!=null?Y(""+T.key):q.toString(36)}function H(T){switch(T.status){case"fulfilled":return T.value;case"rejected":throw T.reason;default:switch(typeof T.status=="string"?T.then(z,z):(T.status="pending",T.then(function(q){T.status==="pending"&&(T.status="fulfilled",T.value=q)},function(q){T.status==="pending"&&(T.status="rejected",T.reason=q)})),T.status){case"fulfilled":return T.value;case"rejected":throw T.reason}}throw T}function M(T,q,C,ae,_e){var de=typeof T;(de==="undefined"||de==="boolean")&&(T=null);var xe=!1;if(T===null)xe=!0;else switch(de){case"bigint":case"string":case"number":xe=!0;break;case"object":switch(T.$$typeof){case e:case t:xe=!0;break;case g:return xe=T._init,M(xe(T._payload),q,C,ae,_e)}}if(xe)return _e=_e(T),xe=ae===""?"."+K(T,0):ae,$(_e)?(C="",xe!=null&&(C=xe.replace(U,"$&/")+"/"),M(_e,q,C,"",function(Ht){return Ht})):_e!=null&&(ne(_e)&&(_e=j(_e,C+(_e.key==null||T&&T.key===_e.key?"":(""+_e.key).replace(U,"$&/")+"/")+xe)),q.push(_e)),1;xe=0;var Ye=ae===""?".":ae+":";if($(T))for(var De=0;De<T.length;De++)ae=T[De],de=Ye+K(ae,De),xe+=M(ae,q,C,de,_e);else if(De=v(T),typeof De=="function")for(T=De.call(T),De=0;!(ae=T.next()).done;)ae=ae.value,de=Ye+K(ae,De++),xe+=M(ae,q,C,de,_e);else if(de==="object"){if(typeof T.then=="function")return M(H(T),q,C,ae,_e);throw q=String(T),Error("Objects are not valid as a React child (found: "+(q==="[object Object]"?"object with keys {"+Object.keys(T).join(", ")+"}":q)+"). If you meant to render a collection of children, use an array instead.")}return xe}function F(T,q,C){if(T==null)return T;var ae=[],_e=0;return M(T,ae,"","",function(de){return q.call(C,de,_e++)}),ae}function V(T){if(T._status===-1){var q=T._result;q=q(),q.then(function(C){(T._status===0||T._status===-1)&&(T._status=1,T._result=C)},function(C){(T._status===0||T._status===-1)&&(T._status=2,T._result=C)}),T._status===-1&&(T._status=0,T._result=q)}if(T._status===1)return T._result.default;throw T._result}var oe=typeof reportError=="function"?reportError:function(T){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var q=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof T=="object"&&T!==null&&typeof T.message=="string"?String(T.message):String(T),error:T});if(!window.dispatchEvent(q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",T);return}console.error(T)},E={map:F,forEach:function(T,q,C){F(T,function(){q.apply(this,arguments)},C)},count:function(T){var q=0;return F(T,function(){q++}),q},toArray:function(T){return F(T,function(q){return q})||[]},only:function(T){if(!ne(T))throw Error("React.Children.only expected to receive a single React element child.");return T}};return we.Activity=m,we.Children=E,we.Component=D,we.Fragment=n,we.Profiler=a,we.PureComponent=A,we.StrictMode=s,we.Suspense=p,we.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Q,we.__COMPILER_RUNTIME={__proto__:null,c:function(T){return Q.H.useMemoCache(T)}},we.cache=function(T){return function(){return T.apply(null,arguments)}},we.cacheSignal=function(){return null},we.cloneElement=function(T,q,C){if(T==null)throw Error("The argument must be a React element, but you passed "+T+".");var ae=k({},T.props),_e=T.key;if(q!=null)for(de in q.key!==void 0&&(_e=""+q.key),q)!se.call(q,de)||de==="key"||de==="__self"||de==="__source"||de==="ref"&&q.ref===void 0||(ae[de]=q[de]);var de=arguments.length-2;if(de===1)ae.children=C;else if(1<de){for(var xe=Array(de),Ye=0;Ye<de;Ye++)xe[Ye]=arguments[Ye+2];ae.children=xe}return he(T.type,_e,ae)},we.createContext=function(T){return T={$$typeof:c,_currentValue:T,_currentValue2:T,_threadCount:0,Provider:null,Consumer:null},T.Provider=T,T.Consumer={$$typeof:o,_context:T},T},we.createElement=function(T,q,C){var ae,_e={},de=null;if(q!=null)for(ae in q.key!==void 0&&(de=""+q.key),q)se.call(q,ae)&&ae!=="key"&&ae!=="__self"&&ae!=="__source"&&(_e[ae]=q[ae]);var xe=arguments.length-2;if(xe===1)_e.children=C;else if(1<xe){for(var Ye=Array(xe),De=0;De<xe;De++)Ye[De]=arguments[De+2];_e.children=Ye}if(T&&T.defaultProps)for(ae in xe=T.defaultProps,xe)_e[ae]===void 0&&(_e[ae]=xe[ae]);return he(T,de,_e)},we.createRef=function(){return{current:null}},we.forwardRef=function(T){return{$$typeof:f,render:T}},we.isValidElement=ne,we.lazy=function(T){return{$$typeof:g,_payload:{_status:-1,_result:T},_init:V}},we.memo=function(T,q){return{$$typeof:h,type:T,compare:q===void 0?null:q}},we.startTransition=function(T){var q=Q.T,C={};Q.T=C;try{var ae=T(),_e=Q.S;_e!==null&&_e(C,ae),typeof ae=="object"&&ae!==null&&typeof ae.then=="function"&&ae.then(z,oe)}catch(de){oe(de)}finally{q!==null&&C.types!==null&&(q.types=C.types),Q.T=q}},we.unstable_useCacheRefresh=function(){return Q.H.useCacheRefresh()},we.use=function(T){return Q.H.use(T)},we.useActionState=function(T,q,C){return Q.H.useActionState(T,q,C)},we.useCallback=function(T,q){return Q.H.useCallback(T,q)},we.useContext=function(T){return Q.H.useContext(T)},we.useDebugValue=function(){},we.useDeferredValue=function(T,q){return Q.H.useDeferredValue(T,q)},we.useEffect=function(T,q){return Q.H.useEffect(T,q)},we.useEffectEvent=function(T){return Q.H.useEffectEvent(T)},we.useId=function(){return Q.H.useId()},we.useImperativeHandle=function(T,q,C){return Q.H.useImperativeHandle(T,q,C)},we.useInsertionEffect=function(T,q){return Q.H.useInsertionEffect(T,q)},we.useLayoutEffect=function(T,q){return Q.H.useLayoutEffect(T,q)},we.useMemo=function(T,q){return Q.H.useMemo(T,q)},we.useOptimistic=function(T,q){return Q.H.useOptimistic(T,q)},we.useReducer=function(T,q,C){return Q.H.useReducer(T,q,C)},we.useRef=function(T){return Q.H.useRef(T)},we.useState=function(T){return Q.H.useState(T)},we.useSyncExternalStore=function(T,q,C){return Q.H.useSyncExternalStore(T,q,C)},we.useTransition=function(){return Q.H.useTransition()},we.version="19.2.3",we}var $g;function bd(){return $g||($g=1,qh.exports=gx()),qh.exports}var re=bd();const vx=gu(re);var Wh={exports:{}},Wl={},Yh={exports:{}},Vh={};/**
17
+ */var Xg;function gx(){if(Xg)return we;Xg=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),c=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),_=Symbol.for("react.activity"),S=Symbol.iterator;function y(A){return A===null||typeof A!="object"?null:(A=S&&A[S]||A["@@iterator"],typeof A=="function"?A:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,R={};function T(A,K,C){this.props=A,this.context=K,this.refs=R,this.updater=C||b}T.prototype.isReactComponent={},T.prototype.setState=function(A,K){if(typeof A!="object"&&typeof A!="function"&&A!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,A,K,"setState")},T.prototype.forceUpdate=function(A){this.updater.enqueueForceUpdate(this,A,"forceUpdate")};function $(){}$.prototype=T.prototype;function j(A,K,C){this.props=A,this.context=K,this.refs=R,this.updater=C||b}var O=j.prototype=new $;O.constructor=j,k(O,T.prototype),O.isPureReactComponent=!0;var X=Array.isArray;function L(){}var re={H:null,A:null,T:null,S:null},Z=Object.prototype.hasOwnProperty;function le(A,K,C){var se=C.ref;return{$$typeof:e,type:A,key:K,ref:se!==void 0?se:null,props:C}}function z(A,K){return le(A.type,K,A.props)}function te(A){return typeof A=="object"&&A!==null&&A.$$typeof===e}function U(A){var K={"=":"=0",":":"=2"};return"$"+A.replace(/[=:]/g,function(C){return K[C]})}var F=/\/+/g;function V(A,K){return typeof A=="object"&&A!==null&&A.key!=null?U(""+A.key):K.toString(36)}function H(A){switch(A.status){case"fulfilled":return A.value;case"rejected":throw A.reason;default:switch(typeof A.status=="string"?A.then(L,L):(A.status="pending",A.then(function(K){A.status==="pending"&&(A.status="fulfilled",A.value=K)},function(K){A.status==="pending"&&(A.status="rejected",A.reason=K)})),A.status){case"fulfilled":return A.value;case"rejected":throw A.reason}}throw A}function M(A,K,C,se,fe){var pe=typeof A;(pe==="undefined"||pe==="boolean")&&(A=null);var xe=!1;if(A===null)xe=!0;else switch(pe){case"bigint":case"string":case"number":xe=!0;break;case"object":switch(A.$$typeof){case e:case t:xe=!0;break;case g:return xe=A._init,M(xe(A._payload),K,C,se,fe)}}if(xe)return fe=fe(A),xe=se===""?"."+V(A,0):se,X(fe)?(C="",xe!=null&&(C=xe.replace(F,"$&/")+"/"),M(fe,K,C,"",function(Ht){return Ht})):fe!=null&&(te(fe)&&(fe=z(fe,C+(fe.key==null||A&&A.key===fe.key?"":(""+fe.key).replace(F,"$&/")+"/")+xe)),K.push(fe)),1;xe=0;var Ye=se===""?".":se+":";if(X(A))for(var De=0;De<A.length;De++)se=A[De],pe=Ye+V(se,De),xe+=M(se,K,C,pe,fe);else if(De=y(A),typeof De=="function")for(A=De.call(A),De=0;!(se=A.next()).done;)se=se.value,pe=Ye+V(se,De++),xe+=M(se,K,C,pe,fe);else if(pe==="object"){if(typeof A.then=="function")return M(H(A),K,C,se,fe);throw K=String(A),Error("Objects are not valid as a React child (found: "+(K==="[object Object]"?"object with keys {"+Object.keys(A).join(", ")+"}":K)+"). If you meant to render a collection of children, use an array instead.")}return xe}function q(A,K,C){if(A==null)return A;var se=[],fe=0;return M(A,se,"","",function(pe){return K.call(C,pe,fe++)}),se}function W(A){if(A._status===-1){var K=A._result;K=K(),K.then(function(C){(A._status===0||A._status===-1)&&(A._status=1,A._result=C)},function(C){(A._status===0||A._status===-1)&&(A._status=2,A._result=C)}),A._status===-1&&(A._status=0,A._result=K)}if(A._status===1)return A._result.default;throw A._result}var ue=typeof reportError=="function"?reportError:function(A){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var K=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof A=="object"&&A!==null&&typeof A.message=="string"?String(A.message):String(A),error:A});if(!window.dispatchEvent(K))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",A);return}console.error(A)},E={map:q,forEach:function(A,K,C){q(A,function(){K.apply(this,arguments)},C)},count:function(A){var K=0;return q(A,function(){K++}),K},toArray:function(A){return q(A,function(K){return K})||[]},only:function(A){if(!te(A))throw Error("React.Children.only expected to receive a single React element child.");return A}};return we.Activity=_,we.Children=E,we.Component=T,we.Fragment=n,we.Profiler=a,we.PureComponent=j,we.StrictMode=s,we.Suspense=p,we.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=re,we.__COMPILER_RUNTIME={__proto__:null,c:function(A){return re.H.useMemoCache(A)}},we.cache=function(A){return function(){return A.apply(null,arguments)}},we.cacheSignal=function(){return null},we.cloneElement=function(A,K,C){if(A==null)throw Error("The argument must be a React element, but you passed "+A+".");var se=k({},A.props),fe=A.key;if(K!=null)for(pe in K.key!==void 0&&(fe=""+K.key),K)!Z.call(K,pe)||pe==="key"||pe==="__self"||pe==="__source"||pe==="ref"&&K.ref===void 0||(se[pe]=K[pe]);var pe=arguments.length-2;if(pe===1)se.children=C;else if(1<pe){for(var xe=Array(pe),Ye=0;Ye<pe;Ye++)xe[Ye]=arguments[Ye+2];se.children=xe}return le(A.type,fe,se)},we.createContext=function(A){return A={$$typeof:c,_currentValue:A,_currentValue2:A,_threadCount:0,Provider:null,Consumer:null},A.Provider=A,A.Consumer={$$typeof:o,_context:A},A},we.createElement=function(A,K,C){var se,fe={},pe=null;if(K!=null)for(se in K.key!==void 0&&(pe=""+K.key),K)Z.call(K,se)&&se!=="key"&&se!=="__self"&&se!=="__source"&&(fe[se]=K[se]);var xe=arguments.length-2;if(xe===1)fe.children=C;else if(1<xe){for(var Ye=Array(xe),De=0;De<xe;De++)Ye[De]=arguments[De+2];fe.children=Ye}if(A&&A.defaultProps)for(se in xe=A.defaultProps,xe)fe[se]===void 0&&(fe[se]=xe[se]);return le(A,pe,fe)},we.createRef=function(){return{current:null}},we.forwardRef=function(A){return{$$typeof:f,render:A}},we.isValidElement=te,we.lazy=function(A){return{$$typeof:g,_payload:{_status:-1,_result:A},_init:W}},we.memo=function(A,K){return{$$typeof:h,type:A,compare:K===void 0?null:K}},we.startTransition=function(A){var K=re.T,C={};re.T=C;try{var se=A(),fe=re.S;fe!==null&&fe(C,se),typeof se=="object"&&se!==null&&typeof se.then=="function"&&se.then(L,ue)}catch(pe){ue(pe)}finally{K!==null&&C.types!==null&&(K.types=C.types),re.T=K}},we.unstable_useCacheRefresh=function(){return re.H.useCacheRefresh()},we.use=function(A){return re.H.use(A)},we.useActionState=function(A,K,C){return re.H.useActionState(A,K,C)},we.useCallback=function(A,K){return re.H.useCallback(A,K)},we.useContext=function(A){return re.H.useContext(A)},we.useDebugValue=function(){},we.useDeferredValue=function(A,K){return re.H.useDeferredValue(A,K)},we.useEffect=function(A,K){return re.H.useEffect(A,K)},we.useEffectEvent=function(A){return re.H.useEffectEvent(A)},we.useId=function(){return re.H.useId()},we.useImperativeHandle=function(A,K,C){return re.H.useImperativeHandle(A,K,C)},we.useInsertionEffect=function(A,K){return re.H.useInsertionEffect(A,K)},we.useLayoutEffect=function(A,K){return re.H.useLayoutEffect(A,K)},we.useMemo=function(A,K){return re.H.useMemo(A,K)},we.useOptimistic=function(A,K){return re.H.useOptimistic(A,K)},we.useReducer=function(A,K,C){return re.H.useReducer(A,K,C)},we.useRef=function(A){return re.H.useRef(A)},we.useState=function(A){return re.H.useState(A)},we.useSyncExternalStore=function(A,K,C){return re.H.useSyncExternalStore(A,K,C)},we.useTransition=function(){return re.H.useTransition()},we.version="19.2.3",we}var $g;function bd(){return $g||($g=1,qh.exports=gx()),qh.exports}var ae=bd();const vx=gu(ae);var Wh={exports:{}},Wl={},Yh={exports:{}},Vh={};/**
18
18
  * @license React
19
19
  * scheduler.production.js
20
20
  *
@@ -22,7 +22,7 @@
22
22
  *
23
23
  * This source code is licensed under the MIT license found in the
24
24
  * LICENSE file in the root directory of this source tree.
25
- */var Gg;function yx(){return Gg||(Gg=1,(function(e){function t(M,F){var V=M.length;M.push(F);e:for(;0<V;){var oe=V-1>>>1,E=M[oe];if(0<a(E,F))M[oe]=F,M[V]=E,V=oe;else break e}}function n(M){return M.length===0?null:M[0]}function s(M){if(M.length===0)return null;var F=M[0],V=M.pop();if(V!==F){M[0]=V;e:for(var oe=0,E=M.length,T=E>>>1;oe<T;){var q=2*(oe+1)-1,C=M[q],ae=q+1,_e=M[ae];if(0>a(C,V))ae<E&&0>a(_e,C)?(M[oe]=_e,M[ae]=V,oe=ae):(M[oe]=C,M[q]=V,oe=q);else if(ae<E&&0>a(_e,V))M[oe]=_e,M[ae]=V,oe=ae;else break e}}return F}function a(M,F){var V=M.sortIndex-F.sortIndex;return V!==0?V:M.id-F.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var c=Date,f=c.now();e.unstable_now=function(){return c.now()-f}}var p=[],h=[],g=1,m=null,S=3,v=!1,b=!1,k=!1,B=!1,D=typeof setTimeout=="function"?setTimeout:null,G=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;function N(M){for(var F=n(h);F!==null;){if(F.callback===null)s(h);else if(F.startTime<=M)s(h),F.sortIndex=F.expirationTime,t(p,F);else break;F=n(h)}}function $(M){if(k=!1,N(M),!b)if(n(p)!==null)b=!0,z||(z=!0,Y());else{var F=n(h);F!==null&&H($,F.startTime-M)}}var z=!1,Q=-1,se=5,he=-1;function j(){return B?!0:!(e.unstable_now()-he<se)}function ne(){if(B=!1,z){var M=e.unstable_now();he=M;var F=!0;try{e:{b=!1,k&&(k=!1,G(Q),Q=-1),v=!0;var V=S;try{t:{for(N(M),m=n(p);m!==null&&!(m.expirationTime>M&&j());){var oe=m.callback;if(typeof oe=="function"){m.callback=null,S=m.priorityLevel;var E=oe(m.expirationTime<=M);if(M=e.unstable_now(),typeof E=="function"){m.callback=E,N(M),F=!0;break t}m===n(p)&&s(p),N(M)}else s(p);m=n(p)}if(m!==null)F=!0;else{var T=n(h);T!==null&&H($,T.startTime-M),F=!1}}break e}finally{m=null,S=V,v=!1}F=void 0}}finally{F?Y():z=!1}}}var Y;if(typeof A=="function")Y=function(){A(ne)};else if(typeof MessageChannel<"u"){var U=new MessageChannel,K=U.port2;U.port1.onmessage=ne,Y=function(){K.postMessage(null)}}else Y=function(){D(ne,0)};function H(M,F){Q=D(function(){M(e.unstable_now())},F)}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(M){M.callback=null},e.unstable_forceFrameRate=function(M){0>M||125<M?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):se=0<M?Math.floor(1e3/M):5},e.unstable_getCurrentPriorityLevel=function(){return S},e.unstable_next=function(M){switch(S){case 1:case 2:case 3:var F=3;break;default:F=S}var V=S;S=F;try{return M()}finally{S=V}},e.unstable_requestPaint=function(){B=!0},e.unstable_runWithPriority=function(M,F){switch(M){case 1:case 2:case 3:case 4:case 5:break;default:M=3}var V=S;S=M;try{return F()}finally{S=V}},e.unstable_scheduleCallback=function(M,F,V){var oe=e.unstable_now();switch(typeof V=="object"&&V!==null?(V=V.delay,V=typeof V=="number"&&0<V?oe+V:oe):V=oe,M){case 1:var E=-1;break;case 2:E=250;break;case 5:E=1073741823;break;case 4:E=1e4;break;default:E=5e3}return E=V+E,M={id:g++,callback:F,priorityLevel:M,startTime:V,expirationTime:E,sortIndex:-1},V>oe?(M.sortIndex=V,t(h,M),n(p)===null&&M===n(h)&&(k?(G(Q),Q=-1):k=!0,H($,V-oe))):(M.sortIndex=E,t(p,M),b||v||(b=!0,z||(z=!0,Y()))),M},e.unstable_shouldYield=j,e.unstable_wrapCallback=function(M){var F=S;return function(){var V=S;S=F;try{return M.apply(this,arguments)}finally{S=V}}}})(Vh)),Vh}var Zg;function Sx(){return Zg||(Zg=1,Yh.exports=yx()),Yh.exports}var Kh={exports:{}},Vt={};/**
25
+ */var Gg;function yx(){return Gg||(Gg=1,(function(e){function t(M,q){var W=M.length;M.push(q);e:for(;0<W;){var ue=W-1>>>1,E=M[ue];if(0<a(E,q))M[ue]=q,M[W]=E,W=ue;else break e}}function n(M){return M.length===0?null:M[0]}function s(M){if(M.length===0)return null;var q=M[0],W=M.pop();if(W!==q){M[0]=W;e:for(var ue=0,E=M.length,A=E>>>1;ue<A;){var K=2*(ue+1)-1,C=M[K],se=K+1,fe=M[se];if(0>a(C,W))se<E&&0>a(fe,C)?(M[ue]=fe,M[se]=W,ue=se):(M[ue]=C,M[K]=W,ue=K);else if(se<E&&0>a(fe,W))M[ue]=fe,M[se]=W,ue=se;else break e}}return q}function a(M,q){var W=M.sortIndex-q.sortIndex;return W!==0?W:M.id-q.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var c=Date,f=c.now();e.unstable_now=function(){return c.now()-f}}var p=[],h=[],g=1,_=null,S=3,y=!1,b=!1,k=!1,R=!1,T=typeof setTimeout=="function"?setTimeout:null,$=typeof clearTimeout=="function"?clearTimeout:null,j=typeof setImmediate<"u"?setImmediate:null;function O(M){for(var q=n(h);q!==null;){if(q.callback===null)s(h);else if(q.startTime<=M)s(h),q.sortIndex=q.expirationTime,t(p,q);else break;q=n(h)}}function X(M){if(k=!1,O(M),!b)if(n(p)!==null)b=!0,L||(L=!0,U());else{var q=n(h);q!==null&&H(X,q.startTime-M)}}var L=!1,re=-1,Z=5,le=-1;function z(){return R?!0:!(e.unstable_now()-le<Z)}function te(){if(R=!1,L){var M=e.unstable_now();le=M;var q=!0;try{e:{b=!1,k&&(k=!1,$(re),re=-1),y=!0;var W=S;try{t:{for(O(M),_=n(p);_!==null&&!(_.expirationTime>M&&z());){var ue=_.callback;if(typeof ue=="function"){_.callback=null,S=_.priorityLevel;var E=ue(_.expirationTime<=M);if(M=e.unstable_now(),typeof E=="function"){_.callback=E,O(M),q=!0;break t}_===n(p)&&s(p),O(M)}else s(p);_=n(p)}if(_!==null)q=!0;else{var A=n(h);A!==null&&H(X,A.startTime-M),q=!1}}break e}finally{_=null,S=W,y=!1}q=void 0}}finally{q?U():L=!1}}}var U;if(typeof j=="function")U=function(){j(te)};else if(typeof MessageChannel<"u"){var F=new MessageChannel,V=F.port2;F.port1.onmessage=te,U=function(){V.postMessage(null)}}else U=function(){T(te,0)};function H(M,q){re=T(function(){M(e.unstable_now())},q)}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(M){M.callback=null},e.unstable_forceFrameRate=function(M){0>M||125<M?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Z=0<M?Math.floor(1e3/M):5},e.unstable_getCurrentPriorityLevel=function(){return S},e.unstable_next=function(M){switch(S){case 1:case 2:case 3:var q=3;break;default:q=S}var W=S;S=q;try{return M()}finally{S=W}},e.unstable_requestPaint=function(){R=!0},e.unstable_runWithPriority=function(M,q){switch(M){case 1:case 2:case 3:case 4:case 5:break;default:M=3}var W=S;S=M;try{return q()}finally{S=W}},e.unstable_scheduleCallback=function(M,q,W){var ue=e.unstable_now();switch(typeof W=="object"&&W!==null?(W=W.delay,W=typeof W=="number"&&0<W?ue+W:ue):W=ue,M){case 1:var E=-1;break;case 2:E=250;break;case 5:E=1073741823;break;case 4:E=1e4;break;default:E=5e3}return E=W+E,M={id:g++,callback:q,priorityLevel:M,startTime:W,expirationTime:E,sortIndex:-1},W>ue?(M.sortIndex=W,t(h,M),n(p)===null&&M===n(h)&&(k?($(re),re=-1):k=!0,H(X,W-ue))):(M.sortIndex=E,t(p,M),b||y||(b=!0,L||(L=!0,U()))),M},e.unstable_shouldYield=z,e.unstable_wrapCallback=function(M){var q=S;return function(){var W=S;S=q;try{return M.apply(this,arguments)}finally{S=W}}}})(Vh)),Vh}var Zg;function Sx(){return Zg||(Zg=1,Yh.exports=yx()),Yh.exports}var Kh={exports:{}},Vt={};/**
26
26
  * @license React
27
27
  * react-dom.production.js
28
28
  *
@@ -30,7 +30,7 @@
30
30
  *
31
31
  * This source code is licensed under the MIT license found in the
32
32
  * LICENSE file in the root directory of this source tree.
33
- */var Qg;function bx(){if(Qg)return Vt;Qg=1;var e=bd();function t(p){var h="https://react.dev/errors/"+p;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)h+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+p+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var s={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},a=Symbol.for("react.portal");function o(p,h,g){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:m==null?null:""+m,children:p,containerInfo:h,implementation:g}}var c=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(p,h){if(p==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return Vt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,Vt.createPortal=function(p,h){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(t(299));return o(p,h,null,g)},Vt.flushSync=function(p){var h=c.T,g=s.p;try{if(c.T=null,s.p=2,p)return p()}finally{c.T=h,s.p=g,s.d.f()}},Vt.preconnect=function(p,h){typeof p=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,s.d.C(p,h))},Vt.prefetchDNS=function(p){typeof p=="string"&&s.d.D(p)},Vt.preinit=function(p,h){if(typeof p=="string"&&h&&typeof h.as=="string"){var g=h.as,m=f(g,h.crossOrigin),S=typeof h.integrity=="string"?h.integrity:void 0,v=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;g==="style"?s.d.S(p,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:m,integrity:S,fetchPriority:v}):g==="script"&&s.d.X(p,{crossOrigin:m,integrity:S,fetchPriority:v,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},Vt.preinitModule=function(p,h){if(typeof p=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var g=f(h.as,h.crossOrigin);s.d.M(p,{crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&s.d.M(p)},Vt.preload=function(p,h){if(typeof p=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var g=h.as,m=f(g,h.crossOrigin);s.d.L(p,g,{crossOrigin:m,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},Vt.preloadModule=function(p,h){if(typeof p=="string")if(h){var g=f(h.as,h.crossOrigin);s.d.m(p,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else s.d.m(p)},Vt.requestFormReset=function(p){s.d.r(p)},Vt.unstable_batchedUpdates=function(p,h){return p(h)},Vt.useFormState=function(p,h,g){return c.H.useFormState(p,h,g)},Vt.useFormStatus=function(){return c.H.useHostTransitionStatus()},Vt.version="19.2.3",Vt}var Jg;function xx(){if(Jg)return Kh.exports;Jg=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Kh.exports=bx(),Kh.exports}/**
33
+ */var Qg;function bx(){if(Qg)return Vt;Qg=1;var e=bd();function t(p){var h="https://react.dev/errors/"+p;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)h+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+p+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var s={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},a=Symbol.for("react.portal");function o(p,h,g){var _=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:_==null?null:""+_,children:p,containerInfo:h,implementation:g}}var c=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(p,h){if(p==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return Vt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,Vt.createPortal=function(p,h){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(t(299));return o(p,h,null,g)},Vt.flushSync=function(p){var h=c.T,g=s.p;try{if(c.T=null,s.p=2,p)return p()}finally{c.T=h,s.p=g,s.d.f()}},Vt.preconnect=function(p,h){typeof p=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,s.d.C(p,h))},Vt.prefetchDNS=function(p){typeof p=="string"&&s.d.D(p)},Vt.preinit=function(p,h){if(typeof p=="string"&&h&&typeof h.as=="string"){var g=h.as,_=f(g,h.crossOrigin),S=typeof h.integrity=="string"?h.integrity:void 0,y=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;g==="style"?s.d.S(p,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:_,integrity:S,fetchPriority:y}):g==="script"&&s.d.X(p,{crossOrigin:_,integrity:S,fetchPriority:y,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},Vt.preinitModule=function(p,h){if(typeof p=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var g=f(h.as,h.crossOrigin);s.d.M(p,{crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&s.d.M(p)},Vt.preload=function(p,h){if(typeof p=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var g=h.as,_=f(g,h.crossOrigin);s.d.L(p,g,{crossOrigin:_,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},Vt.preloadModule=function(p,h){if(typeof p=="string")if(h){var g=f(h.as,h.crossOrigin);s.d.m(p,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else s.d.m(p)},Vt.requestFormReset=function(p){s.d.r(p)},Vt.unstable_batchedUpdates=function(p,h){return p(h)},Vt.useFormState=function(p,h,g){return c.H.useFormState(p,h,g)},Vt.useFormStatus=function(){return c.H.useHostTransitionStatus()},Vt.version="19.2.3",Vt}var Jg;function xx(){if(Jg)return Kh.exports;Jg=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Kh.exports=bx(),Kh.exports}/**
34
34
  * @license React
35
35
  * react-dom-client.production.js
36
36
  *
@@ -38,15 +38,15 @@
38
38
  *
39
39
  * This source code is licensed under the MIT license found in the
40
40
  * LICENSE file in the root directory of this source tree.
41
- */var ev;function wx(){if(ev)return Wl;ev=1;var e=Sx(),t=bd(),n=xx();function s(i){var r="https://react.dev/errors/"+i;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)r+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+i+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function o(i){var r=i,l=i;if(i.alternate)for(;r.return;)r=r.return;else{i=r;do r=i,(r.flags&4098)!==0&&(l=r.return),i=r.return;while(i)}return r.tag===3?l:null}function c(i){if(i.tag===13){var r=i.memoizedState;if(r===null&&(i=i.alternate,i!==null&&(r=i.memoizedState)),r!==null)return r.dehydrated}return null}function f(i){if(i.tag===31){var r=i.memoizedState;if(r===null&&(i=i.alternate,i!==null&&(r=i.memoizedState)),r!==null)return r.dehydrated}return null}function p(i){if(o(i)!==i)throw Error(s(188))}function h(i){var r=i.alternate;if(!r){if(r=o(i),r===null)throw Error(s(188));return r!==i?null:i}for(var l=i,u=r;;){var d=l.return;if(d===null)break;var _=d.alternate;if(_===null){if(u=d.return,u!==null){l=u;continue}break}if(d.child===_.child){for(_=d.child;_;){if(_===l)return p(d),i;if(_===u)return p(d),r;_=_.sibling}throw Error(s(188))}if(l.return!==u.return)l=d,u=_;else{for(var y=!1,w=d.child;w;){if(w===l){y=!0,l=d,u=_;break}if(w===u){y=!0,u=d,l=_;break}w=w.sibling}if(!y){for(w=_.child;w;){if(w===l){y=!0,l=_,u=d;break}if(w===u){y=!0,u=_,l=d;break}w=w.sibling}if(!y)throw Error(s(189))}}if(l.alternate!==u)throw Error(s(190))}if(l.tag!==3)throw Error(s(188));return l.stateNode.current===l?i:r}function g(i){var r=i.tag;if(r===5||r===26||r===27||r===6)return i;for(i=i.child;i!==null;){if(r=g(i),r!==null)return r;i=i.sibling}return null}var m=Object.assign,S=Symbol.for("react.element"),v=Symbol.for("react.transitional.element"),b=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),B=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),G=Symbol.for("react.consumer"),A=Symbol.for("react.context"),N=Symbol.for("react.forward_ref"),$=Symbol.for("react.suspense"),z=Symbol.for("react.suspense_list"),Q=Symbol.for("react.memo"),se=Symbol.for("react.lazy"),he=Symbol.for("react.activity"),j=Symbol.for("react.memo_cache_sentinel"),ne=Symbol.iterator;function Y(i){return i===null||typeof i!="object"?null:(i=ne&&i[ne]||i["@@iterator"],typeof i=="function"?i:null)}var U=Symbol.for("react.client.reference");function K(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===U?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case k:return"Fragment";case D:return"Profiler";case B:return"StrictMode";case $:return"Suspense";case z:return"SuspenseList";case he:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case b:return"Portal";case A:return i.displayName||"Context";case G:return(i._context.displayName||"Context")+".Consumer";case N:var r=i.render;return i=i.displayName,i||(i=r.displayName||r.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case Q:return r=i.displayName||null,r!==null?r:K(i.type)||"Memo";case se:r=i._payload,i=i._init;try{return K(i(r))}catch{}}return null}var H=Array.isArray,M=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V={pending:!1,data:null,method:null,action:null},oe=[],E=-1;function T(i){return{current:i}}function q(i){0>E||(i.current=oe[E],oe[E]=null,E--)}function C(i,r){E++,oe[E]=i.current,i.current=r}var ae=T(null),_e=T(null),de=T(null),xe=T(null);function Ye(i,r){switch(C(de,r),C(_e,i),C(ae,null),r.nodeType){case 9:case 11:i=(i=r.documentElement)&&(i=i.namespaceURI)?_g(i):0;break;default:if(i=r.tagName,r=r.namespaceURI)r=_g(r),i=mg(r,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}q(ae),C(ae,i)}function De(){q(ae),q(_e),q(de)}function Ht(i){i.memoizedState!==null&&C(xe,i);var r=ae.current,l=mg(r,i.type);r!==l&&(C(_e,i),C(ae,l))}function Zt(i){_e.current===i&&(q(ae),q(_e)),xe.current===i&&(q(xe),Ul._currentValue=V)}var li,He;function vi(i){if(li===void 0)try{throw Error()}catch(l){var r=l.stack.trim().match(/\n( *(at )?)/);li=r&&r[1]||"",He=-1<l.stack.indexOf(`
41
+ */var ev;function wx(){if(ev)return Wl;ev=1;var e=Sx(),t=bd(),n=xx();function s(i){var r="https://react.dev/errors/"+i;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)r+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+i+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function o(i){var r=i,l=i;if(i.alternate)for(;r.return;)r=r.return;else{i=r;do r=i,(r.flags&4098)!==0&&(l=r.return),i=r.return;while(i)}return r.tag===3?l:null}function c(i){if(i.tag===13){var r=i.memoizedState;if(r===null&&(i=i.alternate,i!==null&&(r=i.memoizedState)),r!==null)return r.dehydrated}return null}function f(i){if(i.tag===31){var r=i.memoizedState;if(r===null&&(i=i.alternate,i!==null&&(r=i.memoizedState)),r!==null)return r.dehydrated}return null}function p(i){if(o(i)!==i)throw Error(s(188))}function h(i){var r=i.alternate;if(!r){if(r=o(i),r===null)throw Error(s(188));return r!==i?null:i}for(var l=i,u=r;;){var d=l.return;if(d===null)break;var m=d.alternate;if(m===null){if(u=d.return,u!==null){l=u;continue}break}if(d.child===m.child){for(m=d.child;m;){if(m===l)return p(d),i;if(m===u)return p(d),r;m=m.sibling}throw Error(s(188))}if(l.return!==u.return)l=d,u=m;else{for(var v=!1,w=d.child;w;){if(w===l){v=!0,l=d,u=m;break}if(w===u){v=!0,u=d,l=m;break}w=w.sibling}if(!v){for(w=m.child;w;){if(w===l){v=!0,l=m,u=d;break}if(w===u){v=!0,u=m,l=d;break}w=w.sibling}if(!v)throw Error(s(189))}}if(l.alternate!==u)throw Error(s(190))}if(l.tag!==3)throw Error(s(188));return l.stateNode.current===l?i:r}function g(i){var r=i.tag;if(r===5||r===26||r===27||r===6)return i;for(i=i.child;i!==null;){if(r=g(i),r!==null)return r;i=i.sibling}return null}var _=Object.assign,S=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),b=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),R=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),$=Symbol.for("react.consumer"),j=Symbol.for("react.context"),O=Symbol.for("react.forward_ref"),X=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),re=Symbol.for("react.memo"),Z=Symbol.for("react.lazy"),le=Symbol.for("react.activity"),z=Symbol.for("react.memo_cache_sentinel"),te=Symbol.iterator;function U(i){return i===null||typeof i!="object"?null:(i=te&&i[te]||i["@@iterator"],typeof i=="function"?i:null)}var F=Symbol.for("react.client.reference");function V(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===F?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case k:return"Fragment";case T:return"Profiler";case R:return"StrictMode";case X:return"Suspense";case L:return"SuspenseList";case le:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case b:return"Portal";case j:return i.displayName||"Context";case $:return(i._context.displayName||"Context")+".Consumer";case O:var r=i.render;return i=i.displayName,i||(i=r.displayName||r.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case re:return r=i.displayName||null,r!==null?r:V(i.type)||"Memo";case Z:r=i._payload,i=i._init;try{return V(i(r))}catch{}}return null}var H=Array.isArray,M=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W={pending:!1,data:null,method:null,action:null},ue=[],E=-1;function A(i){return{current:i}}function K(i){0>E||(i.current=ue[E],ue[E]=null,E--)}function C(i,r){E++,ue[E]=i.current,i.current=r}var se=A(null),fe=A(null),pe=A(null),xe=A(null);function Ye(i,r){switch(C(pe,r),C(fe,i),C(se,null),r.nodeType){case 9:case 11:i=(i=r.documentElement)&&(i=i.namespaceURI)?mg(i):0;break;default:if(i=r.tagName,r=r.namespaceURI)r=mg(r),i=_g(r,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}K(se),C(se,i)}function De(){K(se),K(fe),K(pe)}function Ht(i){i.memoizedState!==null&&C(xe,i);var r=se.current,l=_g(r,i.type);r!==l&&(C(fe,i),C(se,l))}function Zt(i){fe.current===i&&(K(se),K(fe)),xe.current===i&&(K(xe),Ul._currentValue=W)}var li,He;function vi(i){if(li===void 0)try{throw Error()}catch(l){var r=l.stack.trim().match(/\n( *(at )?)/);li=r&&r[1]||"",He=-1<l.stack.indexOf(`
42
42
  at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
43
- `+li+i+He}var $r=!1;function Gr(i,r){if(!i||$r)return"";$r=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(r){var te=function(){throw Error()};if(Object.defineProperty(te.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(te,[])}catch(X){var W=X}Reflect.construct(i,[],te)}else{try{te.call()}catch(X){W=X}i.call(te.prototype)}}else{try{throw Error()}catch(X){W=X}(te=i())&&typeof te.catch=="function"&&te.catch(function(){})}}catch(X){if(X&&W&&typeof X.stack=="string")return[X.stack,W.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var d=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");d&&d.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var _=u.DetermineComponentFrameRoot(),y=_[0],w=_[1];if(y&&w){var R=y.split(`
43
+ `+li+i+He}var $r=!1;function Gr(i,r){if(!i||$r)return"";$r=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(r){var ie=function(){throw Error()};if(Object.defineProperty(ie.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ie,[])}catch(G){var Y=G}Reflect.construct(i,[],ie)}else{try{ie.call()}catch(G){Y=G}i.call(ie.prototype)}}else{try{throw Error()}catch(G){Y=G}(ie=i())&&typeof ie.catch=="function"&&ie.catch(function(){})}}catch(G){if(G&&Y&&typeof G.stack=="string")return[G.stack,Y.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var d=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");d&&d.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var m=u.DetermineComponentFrameRoot(),v=m[0],w=m[1];if(v&&w){var D=v.split(`
44
44
  `),I=w.split(`
45
- `);for(d=u=0;u<R.length&&!R[u].includes("DetermineComponentFrameRoot");)u++;for(;d<I.length&&!I[d].includes("DetermineComponentFrameRoot");)d++;if(u===R.length||d===I.length)for(u=R.length-1,d=I.length-1;1<=u&&0<=d&&R[u]!==I[d];)d--;for(;1<=u&&0<=d;u--,d--)if(R[u]!==I[d]){if(u!==1||d!==1)do if(u--,d--,0>d||R[u]!==I[d]){var Z=`
46
- `+R[u].replace(" at new "," at ");return i.displayName&&Z.includes("<anonymous>")&&(Z=Z.replace("<anonymous>",i.displayName)),Z}while(1<=u&&0<=d);break}}}finally{$r=!1,Error.prepareStackTrace=l}return(l=i?i.displayName||i.name:"")?vi(l):""}function Ca(i,r){switch(i.tag){case 26:case 27:case 5:return vi(i.type);case 16:return vi("Lazy");case 13:return i.child!==r&&r!==null?vi("Suspense Fallback"):vi("Suspense");case 19:return vi("SuspenseList");case 0:case 15:return Gr(i.type,!1);case 11:return Gr(i.type.render,!1);case 1:return Gr(i.type,!0);case 31:return vi("Activity");default:return""}}function ka(i){try{var r="",l=null;do r+=Ca(i,l),l=i,i=i.return;while(i);return r}catch(u){return`
45
+ `);for(d=u=0;u<D.length&&!D[u].includes("DetermineComponentFrameRoot");)u++;for(;d<I.length&&!I[d].includes("DetermineComponentFrameRoot");)d++;if(u===D.length||d===I.length)for(u=D.length-1,d=I.length-1;1<=u&&0<=d&&D[u]!==I[d];)d--;for(;1<=u&&0<=d;u--,d--)if(D[u]!==I[d]){if(u!==1||d!==1)do if(u--,d--,0>d||D[u]!==I[d]){var Q=`
46
+ `+D[u].replace(" at new "," at ");return i.displayName&&Q.includes("<anonymous>")&&(Q=Q.replace("<anonymous>",i.displayName)),Q}while(1<=u&&0<=d);break}}}finally{$r=!1,Error.prepareStackTrace=l}return(l=i?i.displayName||i.name:"")?vi(l):""}function Ca(i,r){switch(i.tag){case 26:case 27:case 5:return vi(i.type);case 16:return vi("Lazy");case 13:return i.child!==r&&r!==null?vi("Suspense Fallback"):vi("Suspense");case 19:return vi("SuspenseList");case 0:case 15:return Gr(i.type,!1);case 11:return Gr(i.type.render,!1);case 1:return Gr(i.type,!0);case 31:return vi("Activity");default:return""}}function ka(i){try{var r="",l=null;do r+=Ca(i,l),l=i,i=i.return;while(i);return r}catch(u){return`
47
47
  Error generating stack: `+u.message+`
48
- `+u.stack}}var Zr=Object.prototype.hasOwnProperty,Qr=e.unstable_scheduleCallback,Zs=e.unstable_cancelCallback,Tu=e.unstable_shouldYield,Au=e.unstable_requestPaint,Qt=e.unstable_now,Du=e.unstable_getCurrentPriorityLevel,J=e.unstable_ImmediatePriority,ce=e.unstable_UserBlockingPriority,Se=e.unstable_NormalPriority,Re=e.unstable_LowPriority,Fe=e.unstable_IdlePriority,yi=e.log,fn=e.unstable_setDisableYieldValue,Jt=null,xt=null;function ai(i){if(typeof yi=="function"&&fn(i),xt&&typeof xt.setStrictMode=="function")try{xt.setStrictMode(Jt,i)}catch{}}var Ge=Math.clz32?Math.clz32:t0,jn=Math.log,Ki=Math.LN2;function t0(i){return i>>>=0,i===0?32:31-(jn(i)/Ki|0)|0}var Ea=256,Ta=262144,Aa=4194304;function vr(i){var r=i&42;if(r!==0)return r;switch(i&-i){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return i&261888;case 262144:case 524288:case 1048576:case 2097152:return i&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function Da(i,r,l){var u=i.pendingLanes;if(u===0)return 0;var d=0,_=i.suspendedLanes,y=i.pingedLanes;i=i.warmLanes;var w=u&134217727;return w!==0?(u=w&~_,u!==0?d=vr(u):(y&=w,y!==0?d=vr(y):l||(l=w&~i,l!==0&&(d=vr(l))))):(w=u&~_,w!==0?d=vr(w):y!==0?d=vr(y):l||(l=u&~i,l!==0&&(d=vr(l)))),d===0?0:r!==0&&r!==d&&(r&_)===0&&(_=d&-d,l=r&-r,_>=l||_===32&&(l&4194048)!==0)?r:d}function Qs(i,r){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&r)===0}function i0(i,r){switch(i){case 1:case 2:case 4:case 8:case 64:return r+250;case 16:case 32: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 r+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Gd(){var i=Aa;return Aa<<=1,(Aa&62914560)===0&&(Aa=4194304),i}function Ru(i){for(var r=[],l=0;31>l;l++)r.push(i);return r}function Js(i,r){i.pendingLanes|=r,r!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function n0(i,r,l,u,d,_){var y=i.pendingLanes;i.pendingLanes=l,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=l,i.entangledLanes&=l,i.errorRecoveryDisabledLanes&=l,i.shellSuspendCounter=0;var w=i.entanglements,R=i.expirationTimes,I=i.hiddenUpdates;for(l=y&~l;0<l;){var Z=31-Ge(l),te=1<<Z;w[Z]=0,R[Z]=-1;var W=I[Z];if(W!==null)for(I[Z]=null,Z=0;Z<W.length;Z++){var X=W[Z];X!==null&&(X.lane&=-536870913)}l&=~te}u!==0&&Zd(i,u,0),_!==0&&d===0&&i.tag!==0&&(i.suspendedLanes|=_&~(y&~r))}function Zd(i,r,l){i.pendingLanes|=r,i.suspendedLanes&=~r;var u=31-Ge(r);i.entangledLanes|=r,i.entanglements[u]=i.entanglements[u]|1073741824|l&261930}function Qd(i,r){var l=i.entangledLanes|=r;for(i=i.entanglements;l;){var u=31-Ge(l),d=1<<u;d&r|i[u]&r&&(i[u]|=r),l&=~d}}function Jd(i,r){var l=r&-r;return l=(l&42)!==0?1:Mu(l),(l&(i.suspendedLanes|r))!==0?0:l}function Mu(i){switch(i){case 2:i=1;break;case 8:i=4;break;case 32:i=16;break;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:i=128;break;case 268435456:i=134217728;break;default:i=0}return i}function Bu(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function ep(){var i=F.p;return i!==0?i:(i=window.event,i===void 0?32:Ug(i.type))}function tp(i,r){var l=F.p;try{return F.p=i,r()}finally{F.p=l}}var Un=Math.random().toString(36).slice(2),jt="__reactFiber$"+Un,oi="__reactProps$"+Un,Jr="__reactContainer$"+Un,Lu="__reactEvents$"+Un,r0="__reactListeners$"+Un,s0="__reactHandles$"+Un,ip="__reactResources$"+Un,el="__reactMarker$"+Un;function zu(i){delete i[jt],delete i[oi],delete i[Lu],delete i[r0],delete i[s0]}function es(i){var r=i[jt];if(r)return r;for(var l=i.parentNode;l;){if(r=l[Jr]||l[jt]){if(l=r.alternate,r.child!==null||l!==null&&l.child!==null)for(i=wg(i);i!==null;){if(l=i[jt])return l;i=wg(i)}return r}i=l,l=i.parentNode}return null}function ts(i){if(i=i[jt]||i[Jr]){var r=i.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return i}return null}function tl(i){var r=i.tag;if(r===5||r===26||r===27||r===6)return i.stateNode;throw Error(s(33))}function is(i){var r=i[ip];return r||(r=i[ip]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function Tt(i){i[el]=!0}var np=new Set,rp={};function yr(i,r){ns(i,r),ns(i+"Capture",r)}function ns(i,r){for(rp[i]=r,i=0;i<r.length;i++)np.add(r[i])}var l0=RegExp("^[: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]*$"),sp={},lp={};function a0(i){return Zr.call(lp,i)?!0:Zr.call(sp,i)?!1:l0.test(i)?lp[i]=!0:(sp[i]=!0,!1)}function Ra(i,r,l){if(a0(r))if(l===null)i.removeAttribute(r);else{switch(typeof l){case"undefined":case"function":case"symbol":i.removeAttribute(r);return;case"boolean":var u=r.toLowerCase().slice(0,5);if(u!=="data-"&&u!=="aria-"){i.removeAttribute(r);return}}i.setAttribute(r,""+l)}}function Ma(i,r,l){if(l===null)i.removeAttribute(r);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(r);return}i.setAttribute(r,""+l)}}function dn(i,r,l,u){if(u===null)i.removeAttribute(l);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(l);return}i.setAttributeNS(r,l,""+u)}}function Bi(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function ap(i){var r=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function o0(i,r,l){var u=Object.getOwnPropertyDescriptor(i.constructor.prototype,r);if(!i.hasOwnProperty(r)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var d=u.get,_=u.set;return Object.defineProperty(i,r,{configurable:!0,get:function(){return d.call(this)},set:function(y){l=""+y,_.call(this,y)}}),Object.defineProperty(i,r,{enumerable:u.enumerable}),{getValue:function(){return l},setValue:function(y){l=""+y},stopTracking:function(){i._valueTracker=null,delete i[r]}}}}function Nu(i){if(!i._valueTracker){var r=ap(i)?"checked":"value";i._valueTracker=o0(i,r,""+i[r])}}function op(i){if(!i)return!1;var r=i._valueTracker;if(!r)return!0;var l=r.getValue(),u="";return i&&(u=ap(i)?i.checked?"true":"false":i.value),i=u,i!==l?(r.setValue(i),!0):!1}function Ba(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}var u0=/[\n"\\]/g;function Li(i){return i.replace(u0,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function Ou(i,r,l,u,d,_,y,w){i.name="",y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"?i.type=y:i.removeAttribute("type"),r!=null?y==="number"?(r===0&&i.value===""||i.value!=r)&&(i.value=""+Bi(r)):i.value!==""+Bi(r)&&(i.value=""+Bi(r)):y!=="submit"&&y!=="reset"||i.removeAttribute("value"),r!=null?Hu(i,y,Bi(r)):l!=null?Hu(i,y,Bi(l)):u!=null&&i.removeAttribute("value"),d==null&&_!=null&&(i.defaultChecked=!!_),d!=null&&(i.checked=d&&typeof d!="function"&&typeof d!="symbol"),w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?i.name=""+Bi(w):i.removeAttribute("name")}function up(i,r,l,u,d,_,y,w){if(_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"&&(i.type=_),r!=null||l!=null){if(!(_!=="submit"&&_!=="reset"||r!=null)){Nu(i);return}l=l!=null?""+Bi(l):"",r=r!=null?""+Bi(r):l,w||r===i.value||(i.value=r),i.defaultValue=r}u=u??d,u=typeof u!="function"&&typeof u!="symbol"&&!!u,i.checked=w?i.checked:!!u,i.defaultChecked=!!u,y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(i.name=y),Nu(i)}function Hu(i,r,l){r==="number"&&Ba(i.ownerDocument)===i||i.defaultValue===""+l||(i.defaultValue=""+l)}function rs(i,r,l,u){if(i=i.options,r){r={};for(var d=0;d<l.length;d++)r["$"+l[d]]=!0;for(l=0;l<i.length;l++)d=r.hasOwnProperty("$"+i[l].value),i[l].selected!==d&&(i[l].selected=d),d&&u&&(i[l].defaultSelected=!0)}else{for(l=""+Bi(l),r=null,d=0;d<i.length;d++){if(i[d].value===l){i[d].selected=!0,u&&(i[d].defaultSelected=!0);return}r!==null||i[d].disabled||(r=i[d])}r!==null&&(r.selected=!0)}}function cp(i,r,l){if(r!=null&&(r=""+Bi(r),r!==i.value&&(i.value=r),l==null)){i.defaultValue!==r&&(i.defaultValue=r);return}i.defaultValue=l!=null?""+Bi(l):""}function hp(i,r,l,u){if(r==null){if(u!=null){if(l!=null)throw Error(s(92));if(H(u)){if(1<u.length)throw Error(s(93));u=u[0]}l=u}l==null&&(l=""),r=l}l=Bi(r),i.defaultValue=l,u=i.textContent,u===l&&u!==""&&u!==null&&(i.value=u),Nu(i)}function ss(i,r){if(r){var l=i.firstChild;if(l&&l===i.lastChild&&l.nodeType===3){l.nodeValue=r;return}}i.textContent=r}var c0=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function fp(i,r,l){var u=r.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?u?i.setProperty(r,""):r==="float"?i.cssFloat="":i[r]="":u?i.setProperty(r,l):typeof l!="number"||l===0||c0.has(r)?r==="float"?i.cssFloat=l:i[r]=(""+l).trim():i[r]=l+"px"}function dp(i,r,l){if(r!=null&&typeof r!="object")throw Error(s(62));if(i=i.style,l!=null){for(var u in l)!l.hasOwnProperty(u)||r!=null&&r.hasOwnProperty(u)||(u.indexOf("--")===0?i.setProperty(u,""):u==="float"?i.cssFloat="":i[u]="");for(var d in r)u=r[d],r.hasOwnProperty(d)&&l[d]!==u&&fp(i,d,u)}else for(var _ in r)r.hasOwnProperty(_)&&fp(i,_,r[_])}function ju(i){if(i.indexOf("-")===-1)return!1;switch(i){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var h0=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["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"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["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"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["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"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),f0=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function La(i){return f0.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function pn(){}var Uu=null;function Pu(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var ls=null,as=null;function pp(i){var r=ts(i);if(r&&(i=r.stateNode)){var l=i[oi]||null;e:switch(i=r.stateNode,r.type){case"input":if(Ou(i,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),r=l.name,l.type==="radio"&&r!=null){for(l=i;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+Li(""+r)+'"][type="radio"]'),r=0;r<l.length;r++){var u=l[r];if(u!==i&&u.form===i.form){var d=u[oi]||null;if(!d)throw Error(s(90));Ou(u,d.value,d.defaultValue,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name)}}for(r=0;r<l.length;r++)u=l[r],u.form===i.form&&op(u)}break e;case"textarea":cp(i,l.value,l.defaultValue);break e;case"select":r=l.value,r!=null&&rs(i,!!l.multiple,r,!1)}}}var Iu=!1;function _p(i,r,l){if(Iu)return i(r,l);Iu=!0;try{var u=i(r);return u}finally{if(Iu=!1,(ls!==null||as!==null)&&(bo(),ls&&(r=ls,i=as,as=ls=null,pp(r),i)))for(r=0;r<i.length;r++)pp(i[r])}}function il(i,r){var l=i.stateNode;if(l===null)return null;var u=l[oi]||null;if(u===null)return null;l=u[r];e:switch(r){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(u=!u.disabled)||(i=i.type,u=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!u;break e;default:i=!1}if(i)return null;if(l&&typeof l!="function")throw Error(s(231,r,typeof l));return l}var _n=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Fu=!1;if(_n)try{var nl={};Object.defineProperty(nl,"passive",{get:function(){Fu=!0}}),window.addEventListener("test",nl,nl),window.removeEventListener("test",nl,nl)}catch{Fu=!1}var Pn=null,qu=null,za=null;function mp(){if(za)return za;var i,r=qu,l=r.length,u,d="value"in Pn?Pn.value:Pn.textContent,_=d.length;for(i=0;i<l&&r[i]===d[i];i++);var y=l-i;for(u=1;u<=y&&r[l-u]===d[_-u];u++);return za=d.slice(i,1<u?1-u:void 0)}function Na(i){var r=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&r===13&&(i=13)):i=r,i===10&&(i=13),32<=i||i===13?i:0}function Oa(){return!0}function gp(){return!1}function ui(i){function r(l,u,d,_,y){this._reactName=l,this._targetInst=d,this.type=u,this.nativeEvent=_,this.target=y,this.currentTarget=null;for(var w in i)i.hasOwnProperty(w)&&(l=i[w],this[w]=l?l(_):_[w]);return this.isDefaultPrevented=(_.defaultPrevented!=null?_.defaultPrevented:_.returnValue===!1)?Oa:gp,this.isPropagationStopped=gp,this}return m(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=Oa)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Oa)},persist:function(){},isPersistent:Oa}),r}var Sr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ha=ui(Sr),rl=m({},Sr,{view:0,detail:0}),d0=ui(rl),Wu,Yu,sl,ja=m({},rl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ku,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==sl&&(sl&&i.type==="mousemove"?(Wu=i.screenX-sl.screenX,Yu=i.screenY-sl.screenY):Yu=Wu=0,sl=i),Wu)},movementY:function(i){return"movementY"in i?i.movementY:Yu}}),vp=ui(ja),p0=m({},ja,{dataTransfer:0}),_0=ui(p0),m0=m({},rl,{relatedTarget:0}),Vu=ui(m0),g0=m({},Sr,{animationName:0,elapsedTime:0,pseudoElement:0}),v0=ui(g0),y0=m({},Sr,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),S0=ui(y0),b0=m({},Sr,{data:0}),yp=ui(b0),x0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},w0={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"},C0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function k0(i){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(i):(i=C0[i])?!!r[i]:!1}function Ku(){return k0}var E0=m({},rl,{key:function(i){if(i.key){var r=x0[i.key]||i.key;if(r!=="Unidentified")return r}return i.type==="keypress"?(i=Na(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?w0[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ku,charCode:function(i){return i.type==="keypress"?Na(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?Na(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),T0=ui(E0),A0=m({},ja,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Sp=ui(A0),D0=m({},rl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ku}),R0=ui(D0),M0=m({},Sr,{propertyName:0,elapsedTime:0,pseudoElement:0}),B0=ui(M0),L0=m({},ja,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),z0=ui(L0),N0=m({},Sr,{newState:0,oldState:0}),O0=ui(N0),H0=[9,13,27,32],Xu=_n&&"CompositionEvent"in window,ll=null;_n&&"documentMode"in document&&(ll=document.documentMode);var j0=_n&&"TextEvent"in window&&!ll,bp=_n&&(!Xu||ll&&8<ll&&11>=ll),xp=" ",wp=!1;function Cp(i,r){switch(i){case"keyup":return H0.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function kp(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var os=!1;function U0(i,r){switch(i){case"compositionend":return kp(r);case"keypress":return r.which!==32?null:(wp=!0,xp);case"textInput":return i=r.data,i===xp&&wp?null:i;default:return null}}function P0(i,r){if(os)return i==="compositionend"||!Xu&&Cp(i,r)?(i=mp(),za=qu=Pn=null,os=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1<r.char.length)return r.char;if(r.which)return String.fromCharCode(r.which)}return null;case"compositionend":return bp&&r.locale!=="ko"?null:r.data;default:return null}}var I0={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 Ep(i){var r=i&&i.nodeName&&i.nodeName.toLowerCase();return r==="input"?!!I0[i.type]:r==="textarea"}function Tp(i,r,l,u){ls?as?as.push(u):as=[u]:ls=u,r=Ao(r,"onChange"),0<r.length&&(l=new Ha("onChange","change",null,l,u),i.push({event:l,listeners:r}))}var al=null,ol=null;function F0(i){ug(i,0)}function Ua(i){var r=tl(i);if(op(r))return i}function Ap(i,r){if(i==="change")return r}var Dp=!1;if(_n){var $u;if(_n){var Gu="oninput"in document;if(!Gu){var Rp=document.createElement("div");Rp.setAttribute("oninput","return;"),Gu=typeof Rp.oninput=="function"}$u=Gu}else $u=!1;Dp=$u&&(!document.documentMode||9<document.documentMode)}function Mp(){al&&(al.detachEvent("onpropertychange",Bp),ol=al=null)}function Bp(i){if(i.propertyName==="value"&&Ua(ol)){var r=[];Tp(r,ol,i,Pu(i)),_p(F0,r)}}function q0(i,r,l){i==="focusin"?(Mp(),al=r,ol=l,al.attachEvent("onpropertychange",Bp)):i==="focusout"&&Mp()}function W0(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return Ua(ol)}function Y0(i,r){if(i==="click")return Ua(r)}function V0(i,r){if(i==="input"||i==="change")return Ua(r)}function K0(i,r){return i===r&&(i!==0||1/i===1/r)||i!==i&&r!==r}var Si=typeof Object.is=="function"?Object.is:K0;function ul(i,r){if(Si(i,r))return!0;if(typeof i!="object"||i===null||typeof r!="object"||r===null)return!1;var l=Object.keys(i),u=Object.keys(r);if(l.length!==u.length)return!1;for(u=0;u<l.length;u++){var d=l[u];if(!Zr.call(r,d)||!Si(i[d],r[d]))return!1}return!0}function Lp(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function zp(i,r){var l=Lp(i);i=0;for(var u;l;){if(l.nodeType===3){if(u=i+l.textContent.length,i<=r&&u>=r)return{node:l,offset:r-i};i=u}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=Lp(l)}}function Np(i,r){return i&&r?i===r?!0:i&&i.nodeType===3?!1:r&&r.nodeType===3?Np(i,r.parentNode):"contains"in i?i.contains(r):i.compareDocumentPosition?!!(i.compareDocumentPosition(r)&16):!1:!1}function Op(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var r=Ba(i.document);r instanceof i.HTMLIFrameElement;){try{var l=typeof r.contentWindow.location.href=="string"}catch{l=!1}if(l)i=r.contentWindow;else break;r=Ba(i.document)}return r}function Zu(i){var r=i&&i.nodeName&&i.nodeName.toLowerCase();return r&&(r==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||r==="textarea"||i.contentEditable==="true")}var X0=_n&&"documentMode"in document&&11>=document.documentMode,us=null,Qu=null,cl=null,Ju=!1;function Hp(i,r,l){var u=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Ju||us==null||us!==Ba(u)||(u=us,"selectionStart"in u&&Zu(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),cl&&ul(cl,u)||(cl=u,u=Ao(Qu,"onSelect"),0<u.length&&(r=new Ha("onSelect","select",null,r,l),i.push({event:r,listeners:u}),r.target=us)))}function br(i,r){var l={};return l[i.toLowerCase()]=r.toLowerCase(),l["Webkit"+i]="webkit"+r,l["Moz"+i]="moz"+r,l}var cs={animationend:br("Animation","AnimationEnd"),animationiteration:br("Animation","AnimationIteration"),animationstart:br("Animation","AnimationStart"),transitionrun:br("Transition","TransitionRun"),transitionstart:br("Transition","TransitionStart"),transitioncancel:br("Transition","TransitionCancel"),transitionend:br("Transition","TransitionEnd")},ec={},jp={};_n&&(jp=document.createElement("div").style,"AnimationEvent"in window||(delete cs.animationend.animation,delete cs.animationiteration.animation,delete cs.animationstart.animation),"TransitionEvent"in window||delete cs.transitionend.transition);function xr(i){if(ec[i])return ec[i];if(!cs[i])return i;var r=cs[i],l;for(l in r)if(r.hasOwnProperty(l)&&l in jp)return ec[i]=r[l];return i}var Up=xr("animationend"),Pp=xr("animationiteration"),Ip=xr("animationstart"),$0=xr("transitionrun"),G0=xr("transitionstart"),Z0=xr("transitioncancel"),Fp=xr("transitionend"),qp=new Map,tc="abort auxClick beforeToggle 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(" ");tc.push("scrollEnd");function Xi(i,r){qp.set(i,r),yr(r,[i])}var Pa=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},zi=[],hs=0,ic=0;function Ia(){for(var i=hs,r=ic=hs=0;r<i;){var l=zi[r];zi[r++]=null;var u=zi[r];zi[r++]=null;var d=zi[r];zi[r++]=null;var _=zi[r];if(zi[r++]=null,u!==null&&d!==null){var y=u.pending;y===null?d.next=d:(d.next=y.next,y.next=d),u.pending=d}_!==0&&Wp(l,d,_)}}function Fa(i,r,l,u){zi[hs++]=i,zi[hs++]=r,zi[hs++]=l,zi[hs++]=u,ic|=u,i.lanes|=u,i=i.alternate,i!==null&&(i.lanes|=u)}function nc(i,r,l,u){return Fa(i,r,l,u),qa(i)}function wr(i,r){return Fa(i,null,null,r),qa(i)}function Wp(i,r,l){i.lanes|=l;var u=i.alternate;u!==null&&(u.lanes|=l);for(var d=!1,_=i.return;_!==null;)_.childLanes|=l,u=_.alternate,u!==null&&(u.childLanes|=l),_.tag===22&&(i=_.stateNode,i===null||i._visibility&1||(d=!0)),i=_,_=_.return;return i.tag===3?(_=i.stateNode,d&&r!==null&&(d=31-Ge(l),i=_.hiddenUpdates,u=i[d],u===null?i[d]=[r]:u.push(r),r.lane=l|536870912),_):null}function qa(i){if(50<Bl)throw Bl=0,fh=null,Error(s(185));for(var r=i.return;r!==null;)i=r,r=i.return;return i.tag===3?i.stateNode:null}var fs={};function Q0(i,r,l,u){this.tag=i,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=r,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function bi(i,r,l,u){return new Q0(i,r,l,u)}function rc(i){return i=i.prototype,!(!i||!i.isReactComponent)}function mn(i,r){var l=i.alternate;return l===null?(l=bi(i.tag,r,i.key,i.mode),l.elementType=i.elementType,l.type=i.type,l.stateNode=i.stateNode,l.alternate=i,i.alternate=l):(l.pendingProps=r,l.type=i.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=i.flags&65011712,l.childLanes=i.childLanes,l.lanes=i.lanes,l.child=i.child,l.memoizedProps=i.memoizedProps,l.memoizedState=i.memoizedState,l.updateQueue=i.updateQueue,r=i.dependencies,l.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},l.sibling=i.sibling,l.index=i.index,l.ref=i.ref,l.refCleanup=i.refCleanup,l}function Yp(i,r){i.flags&=65011714;var l=i.alternate;return l===null?(i.childLanes=0,i.lanes=r,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=l.childLanes,i.lanes=l.lanes,i.child=l.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=l.memoizedProps,i.memoizedState=l.memoizedState,i.updateQueue=l.updateQueue,i.type=l.type,r=l.dependencies,i.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),i}function Wa(i,r,l,u,d,_){var y=0;if(u=i,typeof i=="function")rc(i)&&(y=1);else if(typeof i=="string")y=nx(i,l,ae.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case he:return i=bi(31,l,r,d),i.elementType=he,i.lanes=_,i;case k:return Cr(l.children,d,_,r);case B:y=8,d|=24;break;case D:return i=bi(12,l,r,d|2),i.elementType=D,i.lanes=_,i;case $:return i=bi(13,l,r,d),i.elementType=$,i.lanes=_,i;case z:return i=bi(19,l,r,d),i.elementType=z,i.lanes=_,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case A:y=10;break e;case G:y=9;break e;case N:y=11;break e;case Q:y=14;break e;case se:y=16,u=null;break e}y=29,l=Error(s(130,i===null?"null":typeof i,"")),u=null}return r=bi(y,l,r,d),r.elementType=i,r.type=u,r.lanes=_,r}function Cr(i,r,l,u){return i=bi(7,i,u,r),i.lanes=l,i}function sc(i,r,l){return i=bi(6,i,null,r),i.lanes=l,i}function Vp(i){var r=bi(18,null,null,0);return r.stateNode=i,r}function lc(i,r,l){return r=bi(4,i.children!==null?i.children:[],i.key,r),r.lanes=l,r.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},r}var Kp=new WeakMap;function Ni(i,r){if(typeof i=="object"&&i!==null){var l=Kp.get(i);return l!==void 0?l:(r={value:i,source:r,stack:ka(r)},Kp.set(i,r),r)}return{value:i,source:r,stack:ka(r)}}var ds=[],ps=0,Ya=null,hl=0,Oi=[],Hi=0,In=null,Ji=1,en="";function gn(i,r){ds[ps++]=hl,ds[ps++]=Ya,Ya=i,hl=r}function Xp(i,r,l){Oi[Hi++]=Ji,Oi[Hi++]=en,Oi[Hi++]=In,In=i;var u=Ji;i=en;var d=32-Ge(u)-1;u&=~(1<<d),l+=1;var _=32-Ge(r)+d;if(30<_){var y=d-d%5;_=(u&(1<<y)-1).toString(32),u>>=y,d-=y,Ji=1<<32-Ge(r)+d|l<<d|u,en=_+i}else Ji=1<<_|l<<d|u,en=i}function ac(i){i.return!==null&&(gn(i,1),Xp(i,1,0))}function oc(i){for(;i===Ya;)Ya=ds[--ps],ds[ps]=null,hl=ds[--ps],ds[ps]=null;for(;i===In;)In=Oi[--Hi],Oi[Hi]=null,en=Oi[--Hi],Oi[Hi]=null,Ji=Oi[--Hi],Oi[Hi]=null}function $p(i,r){Oi[Hi++]=Ji,Oi[Hi++]=en,Oi[Hi++]=In,Ji=r.id,en=r.overflow,In=i}var Ut=null,et=null,Oe=!1,Fn=null,ji=!1,uc=Error(s(519));function qn(i){var r=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw fl(Ni(r,i)),uc}function Gp(i){var r=i.stateNode,l=i.type,u=i.memoizedProps;switch(r[jt]=i,r[oi]=u,l){case"dialog":Be("cancel",r),Be("close",r);break;case"iframe":case"object":case"embed":Be("load",r);break;case"video":case"audio":for(l=0;l<zl.length;l++)Be(zl[l],r);break;case"source":Be("error",r);break;case"img":case"image":case"link":Be("error",r),Be("load",r);break;case"details":Be("toggle",r);break;case"input":Be("invalid",r),up(r,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":Be("invalid",r);break;case"textarea":Be("invalid",r),hp(r,u.value,u.defaultValue,u.children)}l=u.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||r.textContent===""+l||u.suppressHydrationWarning===!0||dg(r.textContent,l)?(u.popover!=null&&(Be("beforetoggle",r),Be("toggle",r)),u.onScroll!=null&&Be("scroll",r),u.onScrollEnd!=null&&Be("scrollend",r),u.onClick!=null&&(r.onclick=pn),r=!0):r=!1,r||qn(i,!0)}function Zp(i){for(Ut=i.return;Ut;)switch(Ut.tag){case 5:case 31:case 13:ji=!1;return;case 27:case 3:ji=!0;return;default:Ut=Ut.return}}function _s(i){if(i!==Ut)return!1;if(!Oe)return Zp(i),Oe=!0,!1;var r=i.tag,l;if((l=r!==3&&r!==27)&&((l=r===5)&&(l=i.type,l=!(l!=="form"&&l!=="button")||Th(i.type,i.memoizedProps)),l=!l),l&&et&&qn(i),Zp(i),r===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(s(317));et=xg(i)}else if(r===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(s(317));et=xg(i)}else r===27?(r=et,nr(i.type)?(i=Bh,Bh=null,et=i):et=r):et=Ut?Pi(i.stateNode.nextSibling):null;return!0}function kr(){et=Ut=null,Oe=!1}function cc(){var i=Fn;return i!==null&&(di===null?di=i:di.push.apply(di,i),Fn=null),i}function fl(i){Fn===null?Fn=[i]:Fn.push(i)}var hc=T(null),Er=null,vn=null;function Wn(i,r,l){C(hc,r._currentValue),r._currentValue=l}function yn(i){i._currentValue=hc.current,q(hc)}function fc(i,r,l){for(;i!==null;){var u=i.alternate;if((i.childLanes&r)!==r?(i.childLanes|=r,u!==null&&(u.childLanes|=r)):u!==null&&(u.childLanes&r)!==r&&(u.childLanes|=r),i===l)break;i=i.return}}function dc(i,r,l,u){var d=i.child;for(d!==null&&(d.return=i);d!==null;){var _=d.dependencies;if(_!==null){var y=d.child;_=_.firstContext;e:for(;_!==null;){var w=_;_=d;for(var R=0;R<r.length;R++)if(w.context===r[R]){_.lanes|=l,w=_.alternate,w!==null&&(w.lanes|=l),fc(_.return,l,i),u||(y=null);break e}_=w.next}}else if(d.tag===18){if(y=d.return,y===null)throw Error(s(341));y.lanes|=l,_=y.alternate,_!==null&&(_.lanes|=l),fc(y,l,i),y=null}else y=d.child;if(y!==null)y.return=d;else for(y=d;y!==null;){if(y===i){y=null;break}if(d=y.sibling,d!==null){d.return=y.return,y=d;break}y=y.return}d=y}}function ms(i,r,l,u){i=null;for(var d=r,_=!1;d!==null;){if(!_){if((d.flags&524288)!==0)_=!0;else if((d.flags&262144)!==0)break}if(d.tag===10){var y=d.alternate;if(y===null)throw Error(s(387));if(y=y.memoizedProps,y!==null){var w=d.type;Si(d.pendingProps.value,y.value)||(i!==null?i.push(w):i=[w])}}else if(d===xe.current){if(y=d.alternate,y===null)throw Error(s(387));y.memoizedState.memoizedState!==d.memoizedState.memoizedState&&(i!==null?i.push(Ul):i=[Ul])}d=d.return}i!==null&&dc(r,i,l,u),r.flags|=262144}function Va(i){for(i=i.firstContext;i!==null;){if(!Si(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function Tr(i){Er=i,vn=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function Pt(i){return Qp(Er,i)}function Ka(i,r){return Er===null&&Tr(i),Qp(i,r)}function Qp(i,r){var l=r._currentValue;if(r={context:r,memoizedValue:l,next:null},vn===null){if(i===null)throw Error(s(308));vn=r,i.dependencies={lanes:0,firstContext:r},i.flags|=524288}else vn=vn.next=r;return l}var J0=typeof AbortController<"u"?AbortController:function(){var i=[],r=this.signal={aborted:!1,addEventListener:function(l,u){i.push(u)}};this.abort=function(){r.aborted=!0,i.forEach(function(l){return l()})}},e1=e.unstable_scheduleCallback,t1=e.unstable_NormalPriority,_t={$$typeof:A,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function pc(){return{controller:new J0,data:new Map,refCount:0}}function dl(i){i.refCount--,i.refCount===0&&e1(t1,function(){i.controller.abort()})}var pl=null,_c=0,gs=0,vs=null;function i1(i,r){if(pl===null){var l=pl=[];_c=0,gs=vh(),vs={status:"pending",value:void 0,then:function(u){l.push(u)}}}return _c++,r.then(Jp,Jp),r}function Jp(){if(--_c===0&&pl!==null){vs!==null&&(vs.status="fulfilled");var i=pl;pl=null,gs=0,vs=null;for(var r=0;r<i.length;r++)(0,i[r])()}}function n1(i,r){var l=[],u={status:"pending",value:null,reason:null,then:function(d){l.push(d)}};return i.then(function(){u.status="fulfilled",u.value=r;for(var d=0;d<l.length;d++)(0,l[d])(r)},function(d){for(u.status="rejected",u.reason=d,d=0;d<l.length;d++)(0,l[d])(void 0)}),u}var e_=M.S;M.S=function(i,r){Hm=Qt(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&i1(i,r),e_!==null&&e_(i,r)};var Ar=T(null);function mc(){var i=Ar.current;return i!==null?i:Ze.pooledCache}function Xa(i,r){r===null?C(Ar,Ar.current):C(Ar,r.pool)}function t_(){var i=mc();return i===null?null:{parent:_t._currentValue,pool:i}}var ys=Error(s(460)),gc=Error(s(474)),$a=Error(s(542)),Ga={then:function(){}};function i_(i){return i=i.status,i==="fulfilled"||i==="rejected"}function n_(i,r,l){switch(l=i[l],l===void 0?i.push(r):l!==r&&(r.then(pn,pn),r=l),r.status){case"fulfilled":return r.value;case"rejected":throw i=r.reason,s_(i),i;default:if(typeof r.status=="string")r.then(pn,pn);else{if(i=Ze,i!==null&&100<i.shellSuspendCounter)throw Error(s(482));i=r,i.status="pending",i.then(function(u){if(r.status==="pending"){var d=r;d.status="fulfilled",d.value=u}},function(u){if(r.status==="pending"){var d=r;d.status="rejected",d.reason=u}})}switch(r.status){case"fulfilled":return r.value;case"rejected":throw i=r.reason,s_(i),i}throw Rr=r,ys}}function Dr(i){try{var r=i._init;return r(i._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(Rr=l,ys):l}}var Rr=null;function r_(){if(Rr===null)throw Error(s(459));var i=Rr;return Rr=null,i}function s_(i){if(i===ys||i===$a)throw Error(s(483))}var Ss=null,_l=0;function Za(i){var r=_l;return _l+=1,Ss===null&&(Ss=[]),n_(Ss,i,r)}function ml(i,r){r=r.props.ref,i.ref=r!==void 0?r:null}function Qa(i,r){throw r.$$typeof===S?Error(s(525)):(i=Object.prototype.toString.call(r),Error(s(31,i==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":i)))}function l_(i){function r(O,L){if(i){var P=O.deletions;P===null?(O.deletions=[L],O.flags|=16):P.push(L)}}function l(O,L){if(!i)return null;for(;L!==null;)r(O,L),L=L.sibling;return null}function u(O){for(var L=new Map;O!==null;)O.key!==null?L.set(O.key,O):L.set(O.index,O),O=O.sibling;return L}function d(O,L){return O=mn(O,L),O.index=0,O.sibling=null,O}function _(O,L,P){return O.index=P,i?(P=O.alternate,P!==null?(P=P.index,P<L?(O.flags|=67108866,L):P):(O.flags|=67108866,L)):(O.flags|=1048576,L)}function y(O){return i&&O.alternate===null&&(O.flags|=67108866),O}function w(O,L,P,ee){return L===null||L.tag!==6?(L=sc(P,O.mode,ee),L.return=O,L):(L=d(L,P),L.return=O,L)}function R(O,L,P,ee){var ge=P.type;return ge===k?Z(O,L,P.props.children,ee,P.key):L!==null&&(L.elementType===ge||typeof ge=="object"&&ge!==null&&ge.$$typeof===se&&Dr(ge)===L.type)?(L=d(L,P.props),ml(L,P),L.return=O,L):(L=Wa(P.type,P.key,P.props,null,O.mode,ee),ml(L,P),L.return=O,L)}function I(O,L,P,ee){return L===null||L.tag!==4||L.stateNode.containerInfo!==P.containerInfo||L.stateNode.implementation!==P.implementation?(L=lc(P,O.mode,ee),L.return=O,L):(L=d(L,P.children||[]),L.return=O,L)}function Z(O,L,P,ee,ge){return L===null||L.tag!==7?(L=Cr(P,O.mode,ee,ge),L.return=O,L):(L=d(L,P),L.return=O,L)}function te(O,L,P){if(typeof L=="string"&&L!==""||typeof L=="number"||typeof L=="bigint")return L=sc(""+L,O.mode,P),L.return=O,L;if(typeof L=="object"&&L!==null){switch(L.$$typeof){case v:return P=Wa(L.type,L.key,L.props,null,O.mode,P),ml(P,L),P.return=O,P;case b:return L=lc(L,O.mode,P),L.return=O,L;case se:return L=Dr(L),te(O,L,P)}if(H(L)||Y(L))return L=Cr(L,O.mode,P,null),L.return=O,L;if(typeof L.then=="function")return te(O,Za(L),P);if(L.$$typeof===A)return te(O,Ka(O,L),P);Qa(O,L)}return null}function W(O,L,P,ee){var ge=L!==null?L.key:null;if(typeof P=="string"&&P!==""||typeof P=="number"||typeof P=="bigint")return ge!==null?null:w(O,L,""+P,ee);if(typeof P=="object"&&P!==null){switch(P.$$typeof){case v:return P.key===ge?R(O,L,P,ee):null;case b:return P.key===ge?I(O,L,P,ee):null;case se:return P=Dr(P),W(O,L,P,ee)}if(H(P)||Y(P))return ge!==null?null:Z(O,L,P,ee,null);if(typeof P.then=="function")return W(O,L,Za(P),ee);if(P.$$typeof===A)return W(O,L,Ka(O,P),ee);Qa(O,P)}return null}function X(O,L,P,ee,ge){if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return O=O.get(P)||null,w(L,O,""+ee,ge);if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case v:return O=O.get(ee.key===null?P:ee.key)||null,R(L,O,ee,ge);case b:return O=O.get(ee.key===null?P:ee.key)||null,I(L,O,ee,ge);case se:return ee=Dr(ee),X(O,L,P,ee,ge)}if(H(ee)||Y(ee))return O=O.get(P)||null,Z(L,O,ee,ge,null);if(typeof ee.then=="function")return X(O,L,P,Za(ee),ge);if(ee.$$typeof===A)return X(O,L,P,Ka(L,ee),ge);Qa(L,ee)}return null}function pe(O,L,P,ee){for(var ge=null,Ue=null,me=L,ke=L=0,Ne=null;me!==null&&ke<P.length;ke++){me.index>ke?(Ne=me,me=null):Ne=me.sibling;var Pe=W(O,me,P[ke],ee);if(Pe===null){me===null&&(me=Ne);break}i&&me&&Pe.alternate===null&&r(O,me),L=_(Pe,L,ke),Ue===null?ge=Pe:Ue.sibling=Pe,Ue=Pe,me=Ne}if(ke===P.length)return l(O,me),Oe&&gn(O,ke),ge;if(me===null){for(;ke<P.length;ke++)me=te(O,P[ke],ee),me!==null&&(L=_(me,L,ke),Ue===null?ge=me:Ue.sibling=me,Ue=me);return Oe&&gn(O,ke),ge}for(me=u(me);ke<P.length;ke++)Ne=X(me,O,ke,P[ke],ee),Ne!==null&&(i&&Ne.alternate!==null&&me.delete(Ne.key===null?ke:Ne.key),L=_(Ne,L,ke),Ue===null?ge=Ne:Ue.sibling=Ne,Ue=Ne);return i&&me.forEach(function(or){return r(O,or)}),Oe&&gn(O,ke),ge}function ye(O,L,P,ee){if(P==null)throw Error(s(151));for(var ge=null,Ue=null,me=L,ke=L=0,Ne=null,Pe=P.next();me!==null&&!Pe.done;ke++,Pe=P.next()){me.index>ke?(Ne=me,me=null):Ne=me.sibling;var or=W(O,me,Pe.value,ee);if(or===null){me===null&&(me=Ne);break}i&&me&&or.alternate===null&&r(O,me),L=_(or,L,ke),Ue===null?ge=or:Ue.sibling=or,Ue=or,me=Ne}if(Pe.done)return l(O,me),Oe&&gn(O,ke),ge;if(me===null){for(;!Pe.done;ke++,Pe=P.next())Pe=te(O,Pe.value,ee),Pe!==null&&(L=_(Pe,L,ke),Ue===null?ge=Pe:Ue.sibling=Pe,Ue=Pe);return Oe&&gn(O,ke),ge}for(me=u(me);!Pe.done;ke++,Pe=P.next())Pe=X(me,O,ke,Pe.value,ee),Pe!==null&&(i&&Pe.alternate!==null&&me.delete(Pe.key===null?ke:Pe.key),L=_(Pe,L,ke),Ue===null?ge=Pe:Ue.sibling=Pe,Ue=Pe);return i&&me.forEach(function(px){return r(O,px)}),Oe&&gn(O,ke),ge}function Xe(O,L,P,ee){if(typeof P=="object"&&P!==null&&P.type===k&&P.key===null&&(P=P.props.children),typeof P=="object"&&P!==null){switch(P.$$typeof){case v:e:{for(var ge=P.key;L!==null;){if(L.key===ge){if(ge=P.type,ge===k){if(L.tag===7){l(O,L.sibling),ee=d(L,P.props.children),ee.return=O,O=ee;break e}}else if(L.elementType===ge||typeof ge=="object"&&ge!==null&&ge.$$typeof===se&&Dr(ge)===L.type){l(O,L.sibling),ee=d(L,P.props),ml(ee,P),ee.return=O,O=ee;break e}l(O,L);break}else r(O,L);L=L.sibling}P.type===k?(ee=Cr(P.props.children,O.mode,ee,P.key),ee.return=O,O=ee):(ee=Wa(P.type,P.key,P.props,null,O.mode,ee),ml(ee,P),ee.return=O,O=ee)}return y(O);case b:e:{for(ge=P.key;L!==null;){if(L.key===ge)if(L.tag===4&&L.stateNode.containerInfo===P.containerInfo&&L.stateNode.implementation===P.implementation){l(O,L.sibling),ee=d(L,P.children||[]),ee.return=O,O=ee;break e}else{l(O,L);break}else r(O,L);L=L.sibling}ee=lc(P,O.mode,ee),ee.return=O,O=ee}return y(O);case se:return P=Dr(P),Xe(O,L,P,ee)}if(H(P))return pe(O,L,P,ee);if(Y(P)){if(ge=Y(P),typeof ge!="function")throw Error(s(150));return P=ge.call(P),ye(O,L,P,ee)}if(typeof P.then=="function")return Xe(O,L,Za(P),ee);if(P.$$typeof===A)return Xe(O,L,Ka(O,P),ee);Qa(O,P)}return typeof P=="string"&&P!==""||typeof P=="number"||typeof P=="bigint"?(P=""+P,L!==null&&L.tag===6?(l(O,L.sibling),ee=d(L,P),ee.return=O,O=ee):(l(O,L),ee=sc(P,O.mode,ee),ee.return=O,O=ee),y(O)):l(O,L)}return function(O,L,P,ee){try{_l=0;var ge=Xe(O,L,P,ee);return Ss=null,ge}catch(me){if(me===ys||me===$a)throw me;var Ue=bi(29,me,null,O.mode);return Ue.lanes=ee,Ue.return=O,Ue}finally{}}}var Mr=l_(!0),a_=l_(!1),Yn=!1;function vc(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function yc(i,r){i=i.updateQueue,r.updateQueue===i&&(r.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function Vn(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function Kn(i,r,l){var u=i.updateQueue;if(u===null)return null;if(u=u.shared,(Ie&2)!==0){var d=u.pending;return d===null?r.next=r:(r.next=d.next,d.next=r),u.pending=r,r=qa(i),Wp(i,null,l),r}return Fa(i,u,r,l),qa(i)}function gl(i,r,l){if(r=r.updateQueue,r!==null&&(r=r.shared,(l&4194048)!==0)){var u=r.lanes;u&=i.pendingLanes,l|=u,r.lanes=l,Qd(i,l)}}function Sc(i,r){var l=i.updateQueue,u=i.alternate;if(u!==null&&(u=u.updateQueue,l===u)){var d=null,_=null;if(l=l.firstBaseUpdate,l!==null){do{var y={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};_===null?d=_=y:_=_.next=y,l=l.next}while(l!==null);_===null?d=_=r:_=_.next=r}else d=_=r;l={baseState:u.baseState,firstBaseUpdate:d,lastBaseUpdate:_,shared:u.shared,callbacks:u.callbacks},i.updateQueue=l;return}i=l.lastBaseUpdate,i===null?l.firstBaseUpdate=r:i.next=r,l.lastBaseUpdate=r}var bc=!1;function vl(){if(bc){var i=vs;if(i!==null)throw i}}function yl(i,r,l,u){bc=!1;var d=i.updateQueue;Yn=!1;var _=d.firstBaseUpdate,y=d.lastBaseUpdate,w=d.shared.pending;if(w!==null){d.shared.pending=null;var R=w,I=R.next;R.next=null,y===null?_=I:y.next=I,y=R;var Z=i.alternate;Z!==null&&(Z=Z.updateQueue,w=Z.lastBaseUpdate,w!==y&&(w===null?Z.firstBaseUpdate=I:w.next=I,Z.lastBaseUpdate=R))}if(_!==null){var te=d.baseState;y=0,Z=I=R=null,w=_;do{var W=w.lane&-536870913,X=W!==w.lane;if(X?(ze&W)===W:(u&W)===W){W!==0&&W===gs&&(bc=!0),Z!==null&&(Z=Z.next={lane:0,tag:w.tag,payload:w.payload,callback:null,next:null});e:{var pe=i,ye=w;W=r;var Xe=l;switch(ye.tag){case 1:if(pe=ye.payload,typeof pe=="function"){te=pe.call(Xe,te,W);break e}te=pe;break e;case 3:pe.flags=pe.flags&-65537|128;case 0:if(pe=ye.payload,W=typeof pe=="function"?pe.call(Xe,te,W):pe,W==null)break e;te=m({},te,W);break e;case 2:Yn=!0}}W=w.callback,W!==null&&(i.flags|=64,X&&(i.flags|=8192),X=d.callbacks,X===null?d.callbacks=[W]:X.push(W))}else X={lane:W,tag:w.tag,payload:w.payload,callback:w.callback,next:null},Z===null?(I=Z=X,R=te):Z=Z.next=X,y|=W;if(w=w.next,w===null){if(w=d.shared.pending,w===null)break;X=w,w=X.next,X.next=null,d.lastBaseUpdate=X,d.shared.pending=null}}while(!0);Z===null&&(R=te),d.baseState=R,d.firstBaseUpdate=I,d.lastBaseUpdate=Z,_===null&&(d.shared.lanes=0),Qn|=y,i.lanes=y,i.memoizedState=te}}function o_(i,r){if(typeof i!="function")throw Error(s(191,i));i.call(r)}function u_(i,r){var l=i.callbacks;if(l!==null)for(i.callbacks=null,i=0;i<l.length;i++)o_(l[i],r)}var bs=T(null),Ja=T(0);function c_(i,r){i=An,C(Ja,i),C(bs,r),An=i|r.baseLanes}function xc(){C(Ja,An),C(bs,bs.current)}function wc(){An=Ja.current,q(bs),q(Ja)}var xi=T(null),Ui=null;function Xn(i){var r=i.alternate;C(ft,ft.current&1),C(xi,i),Ui===null&&(r===null||bs.current!==null||r.memoizedState!==null)&&(Ui=i)}function Cc(i){C(ft,ft.current),C(xi,i),Ui===null&&(Ui=i)}function h_(i){i.tag===22?(C(ft,ft.current),C(xi,i),Ui===null&&(Ui=i)):$n()}function $n(){C(ft,ft.current),C(xi,xi.current)}function wi(i){q(xi),Ui===i&&(Ui=null),q(ft)}var ft=T(0);function eo(i){for(var r=i;r!==null;){if(r.tag===13){var l=r.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||Rh(l)||Mh(l)))return r}else if(r.tag===19&&(r.memoizedProps.revealOrder==="forwards"||r.memoizedProps.revealOrder==="backwards"||r.memoizedProps.revealOrder==="unstable_legacy-backwards"||r.memoizedProps.revealOrder==="together")){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===i)break;for(;r.sibling===null;){if(r.return===null||r.return===i)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var Sn=0,Ce=null,Ve=null,mt=null,to=!1,xs=!1,Br=!1,io=0,Sl=0,ws=null,r1=0;function at(){throw Error(s(321))}function kc(i,r){if(r===null)return!1;for(var l=0;l<r.length&&l<i.length;l++)if(!Si(i[l],r[l]))return!1;return!0}function Ec(i,r,l,u,d,_){return Sn=_,Ce=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,M.H=i===null||i.memoizedState===null?X_:Ic,Br=!1,_=l(u,d),Br=!1,xs&&(_=d_(r,l,u,d)),f_(i),_}function f_(i){M.H=wl;var r=Ve!==null&&Ve.next!==null;if(Sn=0,mt=Ve=Ce=null,to=!1,Sl=0,ws=null,r)throw Error(s(300));i===null||gt||(i=i.dependencies,i!==null&&Va(i)&&(gt=!0))}function d_(i,r,l,u){Ce=i;var d=0;do{if(xs&&(ws=null),Sl=0,xs=!1,25<=d)throw Error(s(301));if(d+=1,mt=Ve=null,i.updateQueue!=null){var _=i.updateQueue;_.lastEffect=null,_.events=null,_.stores=null,_.memoCache!=null&&(_.memoCache.index=0)}M.H=$_,_=r(l,u)}while(xs);return _}function s1(){var i=M.H,r=i.useState()[0];return r=typeof r.then=="function"?bl(r):r,i=i.useState()[0],(Ve!==null?Ve.memoizedState:null)!==i&&(Ce.flags|=1024),r}function Tc(){var i=io!==0;return io=0,i}function Ac(i,r,l){r.updateQueue=i.updateQueue,r.flags&=-2053,i.lanes&=~l}function Dc(i){if(to){for(i=i.memoizedState;i!==null;){var r=i.queue;r!==null&&(r.pending=null),i=i.next}to=!1}Sn=0,mt=Ve=Ce=null,xs=!1,Sl=io=0,ws=null}function ei(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return mt===null?Ce.memoizedState=mt=i:mt=mt.next=i,mt}function dt(){if(Ve===null){var i=Ce.alternate;i=i!==null?i.memoizedState:null}else i=Ve.next;var r=mt===null?Ce.memoizedState:mt.next;if(r!==null)mt=r,Ve=i;else{if(i===null)throw Ce.alternate===null?Error(s(467)):Error(s(310));Ve=i,i={memoizedState:Ve.memoizedState,baseState:Ve.baseState,baseQueue:Ve.baseQueue,queue:Ve.queue,next:null},mt===null?Ce.memoizedState=mt=i:mt=mt.next=i}return mt}function no(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function bl(i){var r=Sl;return Sl+=1,ws===null&&(ws=[]),i=n_(ws,i,r),r=Ce,(mt===null?r.memoizedState:mt.next)===null&&(r=r.alternate,M.H=r===null||r.memoizedState===null?X_:Ic),i}function ro(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return bl(i);if(i.$$typeof===A)return Pt(i)}throw Error(s(438,String(i)))}function Rc(i){var r=null,l=Ce.updateQueue;if(l!==null&&(r=l.memoCache),r==null){var u=Ce.alternate;u!==null&&(u=u.updateQueue,u!==null&&(u=u.memoCache,u!=null&&(r={data:u.data.map(function(d){return d.slice()}),index:0})))}if(r==null&&(r={data:[],index:0}),l===null&&(l=no(),Ce.updateQueue=l),l.memoCache=r,l=r.data[r.index],l===void 0)for(l=r.data[r.index]=Array(i),u=0;u<i;u++)l[u]=j;return r.index++,l}function bn(i,r){return typeof r=="function"?r(i):r}function so(i){var r=dt();return Mc(r,Ve,i)}function Mc(i,r,l){var u=i.queue;if(u===null)throw Error(s(311));u.lastRenderedReducer=l;var d=i.baseQueue,_=u.pending;if(_!==null){if(d!==null){var y=d.next;d.next=_.next,_.next=y}r.baseQueue=d=_,u.pending=null}if(_=i.baseState,d===null)i.memoizedState=_;else{r=d.next;var w=y=null,R=null,I=r,Z=!1;do{var te=I.lane&-536870913;if(te!==I.lane?(ze&te)===te:(Sn&te)===te){var W=I.revertLane;if(W===0)R!==null&&(R=R.next={lane:0,revertLane:0,gesture:null,action:I.action,hasEagerState:I.hasEagerState,eagerState:I.eagerState,next:null}),te===gs&&(Z=!0);else if((Sn&W)===W){I=I.next,W===gs&&(Z=!0);continue}else te={lane:0,revertLane:I.revertLane,gesture:null,action:I.action,hasEagerState:I.hasEagerState,eagerState:I.eagerState,next:null},R===null?(w=R=te,y=_):R=R.next=te,Ce.lanes|=W,Qn|=W;te=I.action,Br&&l(_,te),_=I.hasEagerState?I.eagerState:l(_,te)}else W={lane:te,revertLane:I.revertLane,gesture:I.gesture,action:I.action,hasEagerState:I.hasEagerState,eagerState:I.eagerState,next:null},R===null?(w=R=W,y=_):R=R.next=W,Ce.lanes|=te,Qn|=te;I=I.next}while(I!==null&&I!==r);if(R===null?y=_:R.next=w,!Si(_,i.memoizedState)&&(gt=!0,Z&&(l=vs,l!==null)))throw l;i.memoizedState=_,i.baseState=y,i.baseQueue=R,u.lastRenderedState=_}return d===null&&(u.lanes=0),[i.memoizedState,u.dispatch]}function Bc(i){var r=dt(),l=r.queue;if(l===null)throw Error(s(311));l.lastRenderedReducer=i;var u=l.dispatch,d=l.pending,_=r.memoizedState;if(d!==null){l.pending=null;var y=d=d.next;do _=i(_,y.action),y=y.next;while(y!==d);Si(_,r.memoizedState)||(gt=!0),r.memoizedState=_,r.baseQueue===null&&(r.baseState=_),l.lastRenderedState=_}return[_,u]}function p_(i,r,l){var u=Ce,d=dt(),_=Oe;if(_){if(l===void 0)throw Error(s(407));l=l()}else l=r();var y=!Si((Ve||d).memoizedState,l);if(y&&(d.memoizedState=l,gt=!0),d=d.queue,Nc(g_.bind(null,u,d,i),[i]),d.getSnapshot!==r||y||mt!==null&&mt.memoizedState.tag&1){if(u.flags|=2048,Cs(9,{destroy:void 0},m_.bind(null,u,d,l,r),null),Ze===null)throw Error(s(349));_||(Sn&127)!==0||__(u,r,l)}return l}function __(i,r,l){i.flags|=16384,i={getSnapshot:r,value:l},r=Ce.updateQueue,r===null?(r=no(),Ce.updateQueue=r,r.stores=[i]):(l=r.stores,l===null?r.stores=[i]:l.push(i))}function m_(i,r,l,u){r.value=l,r.getSnapshot=u,v_(r)&&y_(i)}function g_(i,r,l){return l(function(){v_(r)&&y_(i)})}function v_(i){var r=i.getSnapshot;i=i.value;try{var l=r();return!Si(i,l)}catch{return!0}}function y_(i){var r=wr(i,2);r!==null&&pi(r,i,2)}function Lc(i){var r=ei();if(typeof i=="function"){var l=i;if(i=l(),Br){ai(!0);try{l()}finally{ai(!1)}}}return r.memoizedState=r.baseState=i,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:bn,lastRenderedState:i},r}function S_(i,r,l,u){return i.baseState=l,Mc(i,Ve,typeof u=="function"?u:bn)}function l1(i,r,l,u,d){if(oo(i))throw Error(s(485));if(i=r.action,i!==null){var _={payload:d,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(y){_.listeners.push(y)}};M.T!==null?l(!0):_.isTransition=!1,u(_),l=r.pending,l===null?(_.next=r.pending=_,b_(r,_)):(_.next=l.next,r.pending=l.next=_)}}function b_(i,r){var l=r.action,u=r.payload,d=i.state;if(r.isTransition){var _=M.T,y={};M.T=y;try{var w=l(d,u),R=M.S;R!==null&&R(y,w),x_(i,r,w)}catch(I){zc(i,r,I)}finally{_!==null&&y.types!==null&&(_.types=y.types),M.T=_}}else try{_=l(d,u),x_(i,r,_)}catch(I){zc(i,r,I)}}function x_(i,r,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(u){w_(i,r,u)},function(u){return zc(i,r,u)}):w_(i,r,l)}function w_(i,r,l){r.status="fulfilled",r.value=l,C_(r),i.state=l,r=i.pending,r!==null&&(l=r.next,l===r?i.pending=null:(l=l.next,r.next=l,b_(i,l)))}function zc(i,r,l){var u=i.pending;if(i.pending=null,u!==null){u=u.next;do r.status="rejected",r.reason=l,C_(r),r=r.next;while(r!==u)}i.action=null}function C_(i){i=i.listeners;for(var r=0;r<i.length;r++)(0,i[r])()}function k_(i,r){return r}function E_(i,r){if(Oe){var l=Ze.formState;if(l!==null){e:{var u=Ce;if(Oe){if(et){t:{for(var d=et,_=ji;d.nodeType!==8;){if(!_){d=null;break t}if(d=Pi(d.nextSibling),d===null){d=null;break t}}_=d.data,d=_==="F!"||_==="F"?d:null}if(d){et=Pi(d.nextSibling),u=d.data==="F!";break e}}qn(u)}u=!1}u&&(r=l[0])}}return l=ei(),l.memoizedState=l.baseState=r,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:k_,lastRenderedState:r},l.queue=u,l=Y_.bind(null,Ce,u),u.dispatch=l,u=Lc(!1),_=Pc.bind(null,Ce,!1,u.queue),u=ei(),d={state:r,dispatch:null,action:i,pending:null},u.queue=d,l=l1.bind(null,Ce,d,_,l),d.dispatch=l,u.memoizedState=i,[r,l,!1]}function T_(i){var r=dt();return A_(r,Ve,i)}function A_(i,r,l){if(r=Mc(i,r,k_)[0],i=so(bn)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var u=bl(r)}catch(y){throw y===ys?$a:y}else u=r;r=dt();var d=r.queue,_=d.dispatch;return l!==r.memoizedState&&(Ce.flags|=2048,Cs(9,{destroy:void 0},a1.bind(null,d,l),null)),[u,_,i]}function a1(i,r){i.action=r}function D_(i){var r=dt(),l=Ve;if(l!==null)return A_(r,l,i);dt(),r=r.memoizedState,l=dt();var u=l.queue.dispatch;return l.memoizedState=i,[r,u,!1]}function Cs(i,r,l,u){return i={tag:i,create:l,deps:u,inst:r,next:null},r=Ce.updateQueue,r===null&&(r=no(),Ce.updateQueue=r),l=r.lastEffect,l===null?r.lastEffect=i.next=i:(u=l.next,l.next=i,i.next=u,r.lastEffect=i),i}function R_(){return dt().memoizedState}function lo(i,r,l,u){var d=ei();Ce.flags|=i,d.memoizedState=Cs(1|r,{destroy:void 0},l,u===void 0?null:u)}function ao(i,r,l,u){var d=dt();u=u===void 0?null:u;var _=d.memoizedState.inst;Ve!==null&&u!==null&&kc(u,Ve.memoizedState.deps)?d.memoizedState=Cs(r,_,l,u):(Ce.flags|=i,d.memoizedState=Cs(1|r,_,l,u))}function M_(i,r){lo(8390656,8,i,r)}function Nc(i,r){ao(2048,8,i,r)}function o1(i){Ce.flags|=4;var r=Ce.updateQueue;if(r===null)r=no(),Ce.updateQueue=r,r.events=[i];else{var l=r.events;l===null?r.events=[i]:l.push(i)}}function B_(i){var r=dt().memoizedState;return o1({ref:r,nextImpl:i}),function(){if((Ie&2)!==0)throw Error(s(440));return r.impl.apply(void 0,arguments)}}function L_(i,r){return ao(4,2,i,r)}function z_(i,r){return ao(4,4,i,r)}function N_(i,r){if(typeof r=="function"){i=i();var l=r(i);return function(){typeof l=="function"?l():r(null)}}if(r!=null)return i=i(),r.current=i,function(){r.current=null}}function O_(i,r,l){l=l!=null?l.concat([i]):null,ao(4,4,N_.bind(null,r,i),l)}function Oc(){}function H_(i,r){var l=dt();r=r===void 0?null:r;var u=l.memoizedState;return r!==null&&kc(r,u[1])?u[0]:(l.memoizedState=[i,r],i)}function j_(i,r){var l=dt();r=r===void 0?null:r;var u=l.memoizedState;if(r!==null&&kc(r,u[1]))return u[0];if(u=i(),Br){ai(!0);try{i()}finally{ai(!1)}}return l.memoizedState=[u,r],u}function Hc(i,r,l){return l===void 0||(Sn&1073741824)!==0&&(ze&261930)===0?i.memoizedState=r:(i.memoizedState=l,i=Um(),Ce.lanes|=i,Qn|=i,l)}function U_(i,r,l,u){return Si(l,r)?l:bs.current!==null?(i=Hc(i,l,u),Si(i,r)||(gt=!0),i):(Sn&42)===0||(Sn&1073741824)!==0&&(ze&261930)===0?(gt=!0,i.memoizedState=l):(i=Um(),Ce.lanes|=i,Qn|=i,r)}function P_(i,r,l,u,d){var _=F.p;F.p=_!==0&&8>_?_:8;var y=M.T,w={};M.T=w,Pc(i,!1,r,l);try{var R=d(),I=M.S;if(I!==null&&I(w,R),R!==null&&typeof R=="object"&&typeof R.then=="function"){var Z=n1(R,u);xl(i,r,Z,Ei(i))}else xl(i,r,u,Ei(i))}catch(te){xl(i,r,{then:function(){},status:"rejected",reason:te},Ei())}finally{F.p=_,y!==null&&w.types!==null&&(y.types=w.types),M.T=y}}function u1(){}function jc(i,r,l,u){if(i.tag!==5)throw Error(s(476));var d=I_(i).queue;P_(i,d,r,V,l===null?u1:function(){return F_(i),l(u)})}function I_(i){var r=i.memoizedState;if(r!==null)return r;r={memoizedState:V,baseState:V,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:bn,lastRenderedState:V},next:null};var l={};return r.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:bn,lastRenderedState:l},next:null},i.memoizedState=r,i=i.alternate,i!==null&&(i.memoizedState=r),r}function F_(i){var r=I_(i);r.next===null&&(r=i.alternate.memoizedState),xl(i,r.next.queue,{},Ei())}function Uc(){return Pt(Ul)}function q_(){return dt().memoizedState}function W_(){return dt().memoizedState}function c1(i){for(var r=i.return;r!==null;){switch(r.tag){case 24:case 3:var l=Ei();i=Vn(l);var u=Kn(r,i,l);u!==null&&(pi(u,r,l),gl(u,r,l)),r={cache:pc()},i.payload=r;return}r=r.return}}function h1(i,r,l){var u=Ei();l={lane:u,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},oo(i)?V_(r,l):(l=nc(i,r,l,u),l!==null&&(pi(l,i,u),K_(l,r,u)))}function Y_(i,r,l){var u=Ei();xl(i,r,l,u)}function xl(i,r,l,u){var d={lane:u,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(oo(i))V_(r,d);else{var _=i.alternate;if(i.lanes===0&&(_===null||_.lanes===0)&&(_=r.lastRenderedReducer,_!==null))try{var y=r.lastRenderedState,w=_(y,l);if(d.hasEagerState=!0,d.eagerState=w,Si(w,y))return Fa(i,r,d,0),Ze===null&&Ia(),!1}catch{}finally{}if(l=nc(i,r,d,u),l!==null)return pi(l,i,u),K_(l,r,u),!0}return!1}function Pc(i,r,l,u){if(u={lane:2,revertLane:vh(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},oo(i)){if(r)throw Error(s(479))}else r=nc(i,l,u,2),r!==null&&pi(r,i,2)}function oo(i){var r=i.alternate;return i===Ce||r!==null&&r===Ce}function V_(i,r){xs=to=!0;var l=i.pending;l===null?r.next=r:(r.next=l.next,l.next=r),i.pending=r}function K_(i,r,l){if((l&4194048)!==0){var u=r.lanes;u&=i.pendingLanes,l|=u,r.lanes=l,Qd(i,l)}}var wl={readContext:Pt,use:ro,useCallback:at,useContext:at,useEffect:at,useImperativeHandle:at,useLayoutEffect:at,useInsertionEffect:at,useMemo:at,useReducer:at,useRef:at,useState:at,useDebugValue:at,useDeferredValue:at,useTransition:at,useSyncExternalStore:at,useId:at,useHostTransitionStatus:at,useFormState:at,useActionState:at,useOptimistic:at,useMemoCache:at,useCacheRefresh:at};wl.useEffectEvent=at;var X_={readContext:Pt,use:ro,useCallback:function(i,r){return ei().memoizedState=[i,r===void 0?null:r],i},useContext:Pt,useEffect:M_,useImperativeHandle:function(i,r,l){l=l!=null?l.concat([i]):null,lo(4194308,4,N_.bind(null,r,i),l)},useLayoutEffect:function(i,r){return lo(4194308,4,i,r)},useInsertionEffect:function(i,r){lo(4,2,i,r)},useMemo:function(i,r){var l=ei();r=r===void 0?null:r;var u=i();if(Br){ai(!0);try{i()}finally{ai(!1)}}return l.memoizedState=[u,r],u},useReducer:function(i,r,l){var u=ei();if(l!==void 0){var d=l(r);if(Br){ai(!0);try{l(r)}finally{ai(!1)}}}else d=r;return u.memoizedState=u.baseState=d,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:d},u.queue=i,i=i.dispatch=h1.bind(null,Ce,i),[u.memoizedState,i]},useRef:function(i){var r=ei();return i={current:i},r.memoizedState=i},useState:function(i){i=Lc(i);var r=i.queue,l=Y_.bind(null,Ce,r);return r.dispatch=l,[i.memoizedState,l]},useDebugValue:Oc,useDeferredValue:function(i,r){var l=ei();return Hc(l,i,r)},useTransition:function(){var i=Lc(!1);return i=P_.bind(null,Ce,i.queue,!0,!1),ei().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,r,l){var u=Ce,d=ei();if(Oe){if(l===void 0)throw Error(s(407));l=l()}else{if(l=r(),Ze===null)throw Error(s(349));(ze&127)!==0||__(u,r,l)}d.memoizedState=l;var _={value:l,getSnapshot:r};return d.queue=_,M_(g_.bind(null,u,_,i),[i]),u.flags|=2048,Cs(9,{destroy:void 0},m_.bind(null,u,_,l,r),null),l},useId:function(){var i=ei(),r=Ze.identifierPrefix;if(Oe){var l=en,u=Ji;l=(u&~(1<<32-Ge(u)-1)).toString(32)+l,r="_"+r+"R_"+l,l=io++,0<l&&(r+="H"+l.toString(32)),r+="_"}else l=r1++,r="_"+r+"r_"+l.toString(32)+"_";return i.memoizedState=r},useHostTransitionStatus:Uc,useFormState:E_,useActionState:E_,useOptimistic:function(i){var r=ei();r.memoizedState=r.baseState=i;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=l,r=Pc.bind(null,Ce,!0,l),l.dispatch=r,[i,r]},useMemoCache:Rc,useCacheRefresh:function(){return ei().memoizedState=c1.bind(null,Ce)},useEffectEvent:function(i){var r=ei(),l={impl:i};return r.memoizedState=l,function(){if((Ie&2)!==0)throw Error(s(440));return l.impl.apply(void 0,arguments)}}},Ic={readContext:Pt,use:ro,useCallback:H_,useContext:Pt,useEffect:Nc,useImperativeHandle:O_,useInsertionEffect:L_,useLayoutEffect:z_,useMemo:j_,useReducer:so,useRef:R_,useState:function(){return so(bn)},useDebugValue:Oc,useDeferredValue:function(i,r){var l=dt();return U_(l,Ve.memoizedState,i,r)},useTransition:function(){var i=so(bn)[0],r=dt().memoizedState;return[typeof i=="boolean"?i:bl(i),r]},useSyncExternalStore:p_,useId:q_,useHostTransitionStatus:Uc,useFormState:T_,useActionState:T_,useOptimistic:function(i,r){var l=dt();return S_(l,Ve,i,r)},useMemoCache:Rc,useCacheRefresh:W_};Ic.useEffectEvent=B_;var $_={readContext:Pt,use:ro,useCallback:H_,useContext:Pt,useEffect:Nc,useImperativeHandle:O_,useInsertionEffect:L_,useLayoutEffect:z_,useMemo:j_,useReducer:Bc,useRef:R_,useState:function(){return Bc(bn)},useDebugValue:Oc,useDeferredValue:function(i,r){var l=dt();return Ve===null?Hc(l,i,r):U_(l,Ve.memoizedState,i,r)},useTransition:function(){var i=Bc(bn)[0],r=dt().memoizedState;return[typeof i=="boolean"?i:bl(i),r]},useSyncExternalStore:p_,useId:q_,useHostTransitionStatus:Uc,useFormState:D_,useActionState:D_,useOptimistic:function(i,r){var l=dt();return Ve!==null?S_(l,Ve,i,r):(l.baseState=i,[i,l.queue.dispatch])},useMemoCache:Rc,useCacheRefresh:W_};$_.useEffectEvent=B_;function Fc(i,r,l,u){r=i.memoizedState,l=l(u,r),l=l==null?r:m({},r,l),i.memoizedState=l,i.lanes===0&&(i.updateQueue.baseState=l)}var qc={enqueueSetState:function(i,r,l){i=i._reactInternals;var u=Ei(),d=Vn(u);d.payload=r,l!=null&&(d.callback=l),r=Kn(i,d,u),r!==null&&(pi(r,i,u),gl(r,i,u))},enqueueReplaceState:function(i,r,l){i=i._reactInternals;var u=Ei(),d=Vn(u);d.tag=1,d.payload=r,l!=null&&(d.callback=l),r=Kn(i,d,u),r!==null&&(pi(r,i,u),gl(r,i,u))},enqueueForceUpdate:function(i,r){i=i._reactInternals;var l=Ei(),u=Vn(l);u.tag=2,r!=null&&(u.callback=r),r=Kn(i,u,l),r!==null&&(pi(r,i,l),gl(r,i,l))}};function G_(i,r,l,u,d,_,y){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(u,_,y):r.prototype&&r.prototype.isPureReactComponent?!ul(l,u)||!ul(d,_):!0}function Z_(i,r,l,u){i=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(l,u),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(l,u),r.state!==i&&qc.enqueueReplaceState(r,r.state,null)}function Lr(i,r){var l=r;if("ref"in r){l={};for(var u in r)u!=="ref"&&(l[u]=r[u])}if(i=i.defaultProps){l===r&&(l=m({},l));for(var d in i)l[d]===void 0&&(l[d]=i[d])}return l}function Q_(i){Pa(i)}function J_(i){console.error(i)}function em(i){Pa(i)}function uo(i,r){try{var l=i.onUncaughtError;l(r.value,{componentStack:r.stack})}catch(u){setTimeout(function(){throw u})}}function tm(i,r,l){try{var u=i.onCaughtError;u(l.value,{componentStack:l.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(d){setTimeout(function(){throw d})}}function Wc(i,r,l){return l=Vn(l),l.tag=3,l.payload={element:null},l.callback=function(){uo(i,r)},l}function im(i){return i=Vn(i),i.tag=3,i}function nm(i,r,l,u){var d=l.type.getDerivedStateFromError;if(typeof d=="function"){var _=u.value;i.payload=function(){return d(_)},i.callback=function(){tm(r,l,u)}}var y=l.stateNode;y!==null&&typeof y.componentDidCatch=="function"&&(i.callback=function(){tm(r,l,u),typeof d!="function"&&(Jn===null?Jn=new Set([this]):Jn.add(this));var w=u.stack;this.componentDidCatch(u.value,{componentStack:w!==null?w:""})})}function f1(i,r,l,u,d){if(l.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(r=l.alternate,r!==null&&ms(r,l,d,!0),l=xi.current,l!==null){switch(l.tag){case 31:case 13:return Ui===null?xo():l.alternate===null&&ot===0&&(ot=3),l.flags&=-257,l.flags|=65536,l.lanes=d,u===Ga?l.flags|=16384:(r=l.updateQueue,r===null?l.updateQueue=new Set([u]):r.add(u),_h(i,u,d)),!1;case 22:return l.flags|=65536,u===Ga?l.flags|=16384:(r=l.updateQueue,r===null?(r={transitions:null,markerInstances:null,retryQueue:new Set([u])},l.updateQueue=r):(l=r.retryQueue,l===null?r.retryQueue=new Set([u]):l.add(u)),_h(i,u,d)),!1}throw Error(s(435,l.tag))}return _h(i,u,d),xo(),!1}if(Oe)return r=xi.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=d,u!==uc&&(i=Error(s(422),{cause:u}),fl(Ni(i,l)))):(u!==uc&&(r=Error(s(423),{cause:u}),fl(Ni(r,l))),i=i.current.alternate,i.flags|=65536,d&=-d,i.lanes|=d,u=Ni(u,l),d=Wc(i.stateNode,u,d),Sc(i,d),ot!==4&&(ot=2)),!1;var _=Error(s(520),{cause:u});if(_=Ni(_,l),Ml===null?Ml=[_]:Ml.push(_),ot!==4&&(ot=2),r===null)return!0;u=Ni(u,l),l=r;do{switch(l.tag){case 3:return l.flags|=65536,i=d&-d,l.lanes|=i,i=Wc(l.stateNode,u,i),Sc(l,i),!1;case 1:if(r=l.type,_=l.stateNode,(l.flags&128)===0&&(typeof r.getDerivedStateFromError=="function"||_!==null&&typeof _.componentDidCatch=="function"&&(Jn===null||!Jn.has(_))))return l.flags|=65536,d&=-d,l.lanes|=d,d=im(d),nm(d,i,l,u),Sc(l,d),!1}l=l.return}while(l!==null);return!1}var Yc=Error(s(461)),gt=!1;function It(i,r,l,u){r.child=i===null?a_(r,null,l,u):Mr(r,i.child,l,u)}function rm(i,r,l,u,d){l=l.render;var _=r.ref;if("ref"in u){var y={};for(var w in u)w!=="ref"&&(y[w]=u[w])}else y=u;return Tr(r),u=Ec(i,r,l,y,_,d),w=Tc(),i!==null&&!gt?(Ac(i,r,d),xn(i,r,d)):(Oe&&w&&ac(r),r.flags|=1,It(i,r,u,d),r.child)}function sm(i,r,l,u,d){if(i===null){var _=l.type;return typeof _=="function"&&!rc(_)&&_.defaultProps===void 0&&l.compare===null?(r.tag=15,r.type=_,lm(i,r,_,u,d)):(i=Wa(l.type,null,u,r,r.mode,d),i.ref=r.ref,i.return=r,r.child=i)}if(_=i.child,!Jc(i,d)){var y=_.memoizedProps;if(l=l.compare,l=l!==null?l:ul,l(y,u)&&i.ref===r.ref)return xn(i,r,d)}return r.flags|=1,i=mn(_,u),i.ref=r.ref,i.return=r,r.child=i}function lm(i,r,l,u,d){if(i!==null){var _=i.memoizedProps;if(ul(_,u)&&i.ref===r.ref)if(gt=!1,r.pendingProps=u=_,Jc(i,d))(i.flags&131072)!==0&&(gt=!0);else return r.lanes=i.lanes,xn(i,r,d)}return Vc(i,r,l,u,d)}function am(i,r,l,u){var d=u.children,_=i!==null?i.memoizedState:null;if(i===null&&r.stateNode===null&&(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.mode==="hidden"){if((r.flags&128)!==0){if(_=_!==null?_.baseLanes|l:l,i!==null){for(u=r.child=i.child,d=0;u!==null;)d=d|u.lanes|u.childLanes,u=u.sibling;u=d&~_}else u=0,r.child=null;return om(i,r,_,l,u)}if((l&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},i!==null&&Xa(r,_!==null?_.cachePool:null),_!==null?c_(r,_):xc(),h_(r);else return u=r.lanes=536870912,om(i,r,_!==null?_.baseLanes|l:l,l,u)}else _!==null?(Xa(r,_.cachePool),c_(r,_),$n(),r.memoizedState=null):(i!==null&&Xa(r,null),xc(),$n());return It(i,r,d,l),r.child}function Cl(i,r){return i!==null&&i.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function om(i,r,l,u,d){var _=mc();return _=_===null?null:{parent:_t._currentValue,pool:_},r.memoizedState={baseLanes:l,cachePool:_},i!==null&&Xa(r,null),xc(),h_(r),i!==null&&ms(i,r,u,!0),r.childLanes=d,null}function co(i,r){return r=fo({mode:r.mode,children:r.children},i.mode),r.ref=i.ref,i.child=r,r.return=i,r}function um(i,r,l){return Mr(r,i.child,null,l),i=co(r,r.pendingProps),i.flags|=2,wi(r),r.memoizedState=null,i}function d1(i,r,l){var u=r.pendingProps,d=(r.flags&128)!==0;if(r.flags&=-129,i===null){if(Oe){if(u.mode==="hidden")return i=co(r,u),r.lanes=536870912,Cl(null,i);if(Cc(r),(i=et)?(i=bg(i,ji),i=i!==null&&i.data==="&"?i:null,i!==null&&(r.memoizedState={dehydrated:i,treeContext:In!==null?{id:Ji,overflow:en}:null,retryLane:536870912,hydrationErrors:null},l=Vp(i),l.return=r,r.child=l,Ut=r,et=null)):i=null,i===null)throw qn(r);return r.lanes=536870912,null}return co(r,u)}var _=i.memoizedState;if(_!==null){var y=_.dehydrated;if(Cc(r),d)if(r.flags&256)r.flags&=-257,r=um(i,r,l);else if(r.memoizedState!==null)r.child=i.child,r.flags|=128,r=null;else throw Error(s(558));else if(gt||ms(i,r,l,!1),d=(l&i.childLanes)!==0,gt||d){if(u=Ze,u!==null&&(y=Jd(u,l),y!==0&&y!==_.retryLane))throw _.retryLane=y,wr(i,y),pi(u,i,y),Yc;xo(),r=um(i,r,l)}else i=_.treeContext,et=Pi(y.nextSibling),Ut=r,Oe=!0,Fn=null,ji=!1,i!==null&&$p(r,i),r=co(r,u),r.flags|=4096;return r}return i=mn(i.child,{mode:u.mode,children:u.children}),i.ref=r.ref,r.child=i,i.return=r,i}function ho(i,r){var l=r.ref;if(l===null)i!==null&&i.ref!==null&&(r.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(s(284));(i===null||i.ref!==l)&&(r.flags|=4194816)}}function Vc(i,r,l,u,d){return Tr(r),l=Ec(i,r,l,u,void 0,d),u=Tc(),i!==null&&!gt?(Ac(i,r,d),xn(i,r,d)):(Oe&&u&&ac(r),r.flags|=1,It(i,r,l,d),r.child)}function cm(i,r,l,u,d,_){return Tr(r),r.updateQueue=null,l=d_(r,u,l,d),f_(i),u=Tc(),i!==null&&!gt?(Ac(i,r,_),xn(i,r,_)):(Oe&&u&&ac(r),r.flags|=1,It(i,r,l,_),r.child)}function hm(i,r,l,u,d){if(Tr(r),r.stateNode===null){var _=fs,y=l.contextType;typeof y=="object"&&y!==null&&(_=Pt(y)),_=new l(u,_),r.memoizedState=_.state!==null&&_.state!==void 0?_.state:null,_.updater=qc,r.stateNode=_,_._reactInternals=r,_=r.stateNode,_.props=u,_.state=r.memoizedState,_.refs={},vc(r),y=l.contextType,_.context=typeof y=="object"&&y!==null?Pt(y):fs,_.state=r.memoizedState,y=l.getDerivedStateFromProps,typeof y=="function"&&(Fc(r,l,y,u),_.state=r.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof _.getSnapshotBeforeUpdate=="function"||typeof _.UNSAFE_componentWillMount!="function"&&typeof _.componentWillMount!="function"||(y=_.state,typeof _.componentWillMount=="function"&&_.componentWillMount(),typeof _.UNSAFE_componentWillMount=="function"&&_.UNSAFE_componentWillMount(),y!==_.state&&qc.enqueueReplaceState(_,_.state,null),yl(r,u,_,d),vl(),_.state=r.memoizedState),typeof _.componentDidMount=="function"&&(r.flags|=4194308),u=!0}else if(i===null){_=r.stateNode;var w=r.memoizedProps,R=Lr(l,w);_.props=R;var I=_.context,Z=l.contextType;y=fs,typeof Z=="object"&&Z!==null&&(y=Pt(Z));var te=l.getDerivedStateFromProps;Z=typeof te=="function"||typeof _.getSnapshotBeforeUpdate=="function",w=r.pendingProps!==w,Z||typeof _.UNSAFE_componentWillReceiveProps!="function"&&typeof _.componentWillReceiveProps!="function"||(w||I!==y)&&Z_(r,_,u,y),Yn=!1;var W=r.memoizedState;_.state=W,yl(r,u,_,d),vl(),I=r.memoizedState,w||W!==I||Yn?(typeof te=="function"&&(Fc(r,l,te,u),I=r.memoizedState),(R=Yn||G_(r,l,R,u,W,I,y))?(Z||typeof _.UNSAFE_componentWillMount!="function"&&typeof _.componentWillMount!="function"||(typeof _.componentWillMount=="function"&&_.componentWillMount(),typeof _.UNSAFE_componentWillMount=="function"&&_.UNSAFE_componentWillMount()),typeof _.componentDidMount=="function"&&(r.flags|=4194308)):(typeof _.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=u,r.memoizedState=I),_.props=u,_.state=I,_.context=y,u=R):(typeof _.componentDidMount=="function"&&(r.flags|=4194308),u=!1)}else{_=r.stateNode,yc(i,r),y=r.memoizedProps,Z=Lr(l,y),_.props=Z,te=r.pendingProps,W=_.context,I=l.contextType,R=fs,typeof I=="object"&&I!==null&&(R=Pt(I)),w=l.getDerivedStateFromProps,(I=typeof w=="function"||typeof _.getSnapshotBeforeUpdate=="function")||typeof _.UNSAFE_componentWillReceiveProps!="function"&&typeof _.componentWillReceiveProps!="function"||(y!==te||W!==R)&&Z_(r,_,u,R),Yn=!1,W=r.memoizedState,_.state=W,yl(r,u,_,d),vl();var X=r.memoizedState;y!==te||W!==X||Yn||i!==null&&i.dependencies!==null&&Va(i.dependencies)?(typeof w=="function"&&(Fc(r,l,w,u),X=r.memoizedState),(Z=Yn||G_(r,l,Z,u,W,X,R)||i!==null&&i.dependencies!==null&&Va(i.dependencies))?(I||typeof _.UNSAFE_componentWillUpdate!="function"&&typeof _.componentWillUpdate!="function"||(typeof _.componentWillUpdate=="function"&&_.componentWillUpdate(u,X,R),typeof _.UNSAFE_componentWillUpdate=="function"&&_.UNSAFE_componentWillUpdate(u,X,R)),typeof _.componentDidUpdate=="function"&&(r.flags|=4),typeof _.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof _.componentDidUpdate!="function"||y===i.memoizedProps&&W===i.memoizedState||(r.flags|=4),typeof _.getSnapshotBeforeUpdate!="function"||y===i.memoizedProps&&W===i.memoizedState||(r.flags|=1024),r.memoizedProps=u,r.memoizedState=X),_.props=u,_.state=X,_.context=R,u=Z):(typeof _.componentDidUpdate!="function"||y===i.memoizedProps&&W===i.memoizedState||(r.flags|=4),typeof _.getSnapshotBeforeUpdate!="function"||y===i.memoizedProps&&W===i.memoizedState||(r.flags|=1024),u=!1)}return _=u,ho(i,r),u=(r.flags&128)!==0,_||u?(_=r.stateNode,l=u&&typeof l.getDerivedStateFromError!="function"?null:_.render(),r.flags|=1,i!==null&&u?(r.child=Mr(r,i.child,null,d),r.child=Mr(r,null,l,d)):It(i,r,l,d),r.memoizedState=_.state,i=r.child):i=xn(i,r,d),i}function fm(i,r,l,u){return kr(),r.flags|=256,It(i,r,l,u),r.child}var Kc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Xc(i){return{baseLanes:i,cachePool:t_()}}function $c(i,r,l){return i=i!==null?i.childLanes&~l:0,r&&(i|=ki),i}function dm(i,r,l){var u=r.pendingProps,d=!1,_=(r.flags&128)!==0,y;if((y=_)||(y=i!==null&&i.memoizedState===null?!1:(ft.current&2)!==0),y&&(d=!0,r.flags&=-129),y=(r.flags&32)!==0,r.flags&=-33,i===null){if(Oe){if(d?Xn(r):$n(),(i=et)?(i=bg(i,ji),i=i!==null&&i.data!=="&"?i:null,i!==null&&(r.memoizedState={dehydrated:i,treeContext:In!==null?{id:Ji,overflow:en}:null,retryLane:536870912,hydrationErrors:null},l=Vp(i),l.return=r,r.child=l,Ut=r,et=null)):i=null,i===null)throw qn(r);return Mh(i)?r.lanes=32:r.lanes=536870912,null}var w=u.children;return u=u.fallback,d?($n(),d=r.mode,w=fo({mode:"hidden",children:w},d),u=Cr(u,d,l,null),w.return=r,u.return=r,w.sibling=u,r.child=w,u=r.child,u.memoizedState=Xc(l),u.childLanes=$c(i,y,l),r.memoizedState=Kc,Cl(null,u)):(Xn(r),Gc(r,w))}var R=i.memoizedState;if(R!==null&&(w=R.dehydrated,w!==null)){if(_)r.flags&256?(Xn(r),r.flags&=-257,r=Zc(i,r,l)):r.memoizedState!==null?($n(),r.child=i.child,r.flags|=128,r=null):($n(),w=u.fallback,d=r.mode,u=fo({mode:"visible",children:u.children},d),w=Cr(w,d,l,null),w.flags|=2,u.return=r,w.return=r,u.sibling=w,r.child=u,Mr(r,i.child,null,l),u=r.child,u.memoizedState=Xc(l),u.childLanes=$c(i,y,l),r.memoizedState=Kc,r=Cl(null,u));else if(Xn(r),Mh(w)){if(y=w.nextSibling&&w.nextSibling.dataset,y)var I=y.dgst;y=I,u=Error(s(419)),u.stack="",u.digest=y,fl({value:u,source:null,stack:null}),r=Zc(i,r,l)}else if(gt||ms(i,r,l,!1),y=(l&i.childLanes)!==0,gt||y){if(y=Ze,y!==null&&(u=Jd(y,l),u!==0&&u!==R.retryLane))throw R.retryLane=u,wr(i,u),pi(y,i,u),Yc;Rh(w)||xo(),r=Zc(i,r,l)}else Rh(w)?(r.flags|=192,r.child=i.child,r=null):(i=R.treeContext,et=Pi(w.nextSibling),Ut=r,Oe=!0,Fn=null,ji=!1,i!==null&&$p(r,i),r=Gc(r,u.children),r.flags|=4096);return r}return d?($n(),w=u.fallback,d=r.mode,R=i.child,I=R.sibling,u=mn(R,{mode:"hidden",children:u.children}),u.subtreeFlags=R.subtreeFlags&65011712,I!==null?w=mn(I,w):(w=Cr(w,d,l,null),w.flags|=2),w.return=r,u.return=r,u.sibling=w,r.child=u,Cl(null,u),u=r.child,w=i.child.memoizedState,w===null?w=Xc(l):(d=w.cachePool,d!==null?(R=_t._currentValue,d=d.parent!==R?{parent:R,pool:R}:d):d=t_(),w={baseLanes:w.baseLanes|l,cachePool:d}),u.memoizedState=w,u.childLanes=$c(i,y,l),r.memoizedState=Kc,Cl(i.child,u)):(Xn(r),l=i.child,i=l.sibling,l=mn(l,{mode:"visible",children:u.children}),l.return=r,l.sibling=null,i!==null&&(y=r.deletions,y===null?(r.deletions=[i],r.flags|=16):y.push(i)),r.child=l,r.memoizedState=null,l)}function Gc(i,r){return r=fo({mode:"visible",children:r},i.mode),r.return=i,i.child=r}function fo(i,r){return i=bi(22,i,null,r),i.lanes=0,i}function Zc(i,r,l){return Mr(r,i.child,null,l),i=Gc(r,r.pendingProps.children),i.flags|=2,r.memoizedState=null,i}function pm(i,r,l){i.lanes|=r;var u=i.alternate;u!==null&&(u.lanes|=r),fc(i.return,r,l)}function Qc(i,r,l,u,d,_){var y=i.memoizedState;y===null?i.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:u,tail:l,tailMode:d,treeForkCount:_}:(y.isBackwards=r,y.rendering=null,y.renderingStartTime=0,y.last=u,y.tail=l,y.tailMode=d,y.treeForkCount=_)}function _m(i,r,l){var u=r.pendingProps,d=u.revealOrder,_=u.tail;u=u.children;var y=ft.current,w=(y&2)!==0;if(w?(y=y&1|2,r.flags|=128):y&=1,C(ft,y),It(i,r,u,l),u=Oe?hl:0,!w&&i!==null&&(i.flags&128)!==0)e:for(i=r.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&pm(i,l,r);else if(i.tag===19)pm(i,l,r);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)break e;for(;i.sibling===null;){if(i.return===null||i.return===r)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}switch(d){case"forwards":for(l=r.child,d=null;l!==null;)i=l.alternate,i!==null&&eo(i)===null&&(d=l),l=l.sibling;l=d,l===null?(d=r.child,r.child=null):(d=l.sibling,l.sibling=null),Qc(r,!1,d,l,_,u);break;case"backwards":case"unstable_legacy-backwards":for(l=null,d=r.child,r.child=null;d!==null;){if(i=d.alternate,i!==null&&eo(i)===null){r.child=d;break}i=d.sibling,d.sibling=l,l=d,d=i}Qc(r,!0,l,null,_,u);break;case"together":Qc(r,!1,null,null,void 0,u);break;default:r.memoizedState=null}return r.child}function xn(i,r,l){if(i!==null&&(r.dependencies=i.dependencies),Qn|=r.lanes,(l&r.childLanes)===0)if(i!==null){if(ms(i,r,l,!1),(l&r.childLanes)===0)return null}else return null;if(i!==null&&r.child!==i.child)throw Error(s(153));if(r.child!==null){for(i=r.child,l=mn(i,i.pendingProps),r.child=l,l.return=r;i.sibling!==null;)i=i.sibling,l=l.sibling=mn(i,i.pendingProps),l.return=r;l.sibling=null}return r.child}function Jc(i,r){return(i.lanes&r)!==0?!0:(i=i.dependencies,!!(i!==null&&Va(i)))}function p1(i,r,l){switch(r.tag){case 3:Ye(r,r.stateNode.containerInfo),Wn(r,_t,i.memoizedState.cache),kr();break;case 27:case 5:Ht(r);break;case 4:Ye(r,r.stateNode.containerInfo);break;case 10:Wn(r,r.type,r.memoizedProps.value);break;case 31:if(r.memoizedState!==null)return r.flags|=128,Cc(r),null;break;case 13:var u=r.memoizedState;if(u!==null)return u.dehydrated!==null?(Xn(r),r.flags|=128,null):(l&r.child.childLanes)!==0?dm(i,r,l):(Xn(r),i=xn(i,r,l),i!==null?i.sibling:null);Xn(r);break;case 19:var d=(i.flags&128)!==0;if(u=(l&r.childLanes)!==0,u||(ms(i,r,l,!1),u=(l&r.childLanes)!==0),d){if(u)return _m(i,r,l);r.flags|=128}if(d=r.memoizedState,d!==null&&(d.rendering=null,d.tail=null,d.lastEffect=null),C(ft,ft.current),u)break;return null;case 22:return r.lanes=0,am(i,r,l,r.pendingProps);case 24:Wn(r,_t,i.memoizedState.cache)}return xn(i,r,l)}function mm(i,r,l){if(i!==null)if(i.memoizedProps!==r.pendingProps)gt=!0;else{if(!Jc(i,l)&&(r.flags&128)===0)return gt=!1,p1(i,r,l);gt=(i.flags&131072)!==0}else gt=!1,Oe&&(r.flags&1048576)!==0&&Xp(r,hl,r.index);switch(r.lanes=0,r.tag){case 16:e:{var u=r.pendingProps;if(i=Dr(r.elementType),r.type=i,typeof i=="function")rc(i)?(u=Lr(i,u),r.tag=1,r=hm(null,r,i,u,l)):(r.tag=0,r=Vc(null,r,i,u,l));else{if(i!=null){var d=i.$$typeof;if(d===N){r.tag=11,r=rm(null,r,i,u,l);break e}else if(d===Q){r.tag=14,r=sm(null,r,i,u,l);break e}}throw r=K(i)||i,Error(s(306,r,""))}}return r;case 0:return Vc(i,r,r.type,r.pendingProps,l);case 1:return u=r.type,d=Lr(u,r.pendingProps),hm(i,r,u,d,l);case 3:e:{if(Ye(r,r.stateNode.containerInfo),i===null)throw Error(s(387));u=r.pendingProps;var _=r.memoizedState;d=_.element,yc(i,r),yl(r,u,null,l);var y=r.memoizedState;if(u=y.cache,Wn(r,_t,u),u!==_.cache&&dc(r,[_t],l,!0),vl(),u=y.element,_.isDehydrated)if(_={element:u,isDehydrated:!1,cache:y.cache},r.updateQueue.baseState=_,r.memoizedState=_,r.flags&256){r=fm(i,r,u,l);break e}else if(u!==d){d=Ni(Error(s(424)),r),fl(d),r=fm(i,r,u,l);break e}else{switch(i=r.stateNode.containerInfo,i.nodeType){case 9:i=i.body;break;default:i=i.nodeName==="HTML"?i.ownerDocument.body:i}for(et=Pi(i.firstChild),Ut=r,Oe=!0,Fn=null,ji=!0,l=a_(r,null,u,l),r.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(kr(),u===d){r=xn(i,r,l);break e}It(i,r,u,l)}r=r.child}return r;case 26:return ho(i,r),i===null?(l=Tg(r.type,null,r.pendingProps,null))?r.memoizedState=l:Oe||(l=r.type,i=r.pendingProps,u=Do(de.current).createElement(l),u[jt]=r,u[oi]=i,Ft(u,l,i),Tt(u),r.stateNode=u):r.memoizedState=Tg(r.type,i.memoizedProps,r.pendingProps,i.memoizedState),null;case 27:return Ht(r),i===null&&Oe&&(u=r.stateNode=Cg(r.type,r.pendingProps,de.current),Ut=r,ji=!0,d=et,nr(r.type)?(Bh=d,et=Pi(u.firstChild)):et=d),It(i,r,r.pendingProps.children,l),ho(i,r),i===null&&(r.flags|=4194304),r.child;case 5:return i===null&&Oe&&((d=u=et)&&(u=W1(u,r.type,r.pendingProps,ji),u!==null?(r.stateNode=u,Ut=r,et=Pi(u.firstChild),ji=!1,d=!0):d=!1),d||qn(r)),Ht(r),d=r.type,_=r.pendingProps,y=i!==null?i.memoizedProps:null,u=_.children,Th(d,_)?u=null:y!==null&&Th(d,y)&&(r.flags|=32),r.memoizedState!==null&&(d=Ec(i,r,s1,null,null,l),Ul._currentValue=d),ho(i,r),It(i,r,u,l),r.child;case 6:return i===null&&Oe&&((i=l=et)&&(l=Y1(l,r.pendingProps,ji),l!==null?(r.stateNode=l,Ut=r,et=null,i=!0):i=!1),i||qn(r)),null;case 13:return dm(i,r,l);case 4:return Ye(r,r.stateNode.containerInfo),u=r.pendingProps,i===null?r.child=Mr(r,null,u,l):It(i,r,u,l),r.child;case 11:return rm(i,r,r.type,r.pendingProps,l);case 7:return It(i,r,r.pendingProps,l),r.child;case 8:return It(i,r,r.pendingProps.children,l),r.child;case 12:return It(i,r,r.pendingProps.children,l),r.child;case 10:return u=r.pendingProps,Wn(r,r.type,u.value),It(i,r,u.children,l),r.child;case 9:return d=r.type._context,u=r.pendingProps.children,Tr(r),d=Pt(d),u=u(d),r.flags|=1,It(i,r,u,l),r.child;case 14:return sm(i,r,r.type,r.pendingProps,l);case 15:return lm(i,r,r.type,r.pendingProps,l);case 19:return _m(i,r,l);case 31:return d1(i,r,l);case 22:return am(i,r,l,r.pendingProps);case 24:return Tr(r),u=Pt(_t),i===null?(d=mc(),d===null&&(d=Ze,_=pc(),d.pooledCache=_,_.refCount++,_!==null&&(d.pooledCacheLanes|=l),d=_),r.memoizedState={parent:u,cache:d},vc(r),Wn(r,_t,d)):((i.lanes&l)!==0&&(yc(i,r),yl(r,null,null,l),vl()),d=i.memoizedState,_=r.memoizedState,d.parent!==u?(d={parent:u,cache:u},r.memoizedState=d,r.lanes===0&&(r.memoizedState=r.updateQueue.baseState=d),Wn(r,_t,u)):(u=_.cache,Wn(r,_t,u),u!==d.cache&&dc(r,[_t],l,!0))),It(i,r,r.pendingProps.children,l),r.child;case 29:throw r.pendingProps}throw Error(s(156,r.tag))}function wn(i){i.flags|=4}function eh(i,r,l,u,d){if((r=(i.mode&32)!==0)&&(r=!1),r){if(i.flags|=16777216,(d&335544128)===d)if(i.stateNode.complete)i.flags|=8192;else if(qm())i.flags|=8192;else throw Rr=Ga,gc}else i.flags&=-16777217}function gm(i,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!Bg(r))if(qm())i.flags|=8192;else throw Rr=Ga,gc}function po(i,r){r!==null&&(i.flags|=4),i.flags&16384&&(r=i.tag!==22?Gd():536870912,i.lanes|=r,As|=r)}function kl(i,r){if(!Oe)switch(i.tailMode){case"hidden":r=i.tail;for(var l=null;r!==null;)r.alternate!==null&&(l=r),r=r.sibling;l===null?i.tail=null:l.sibling=null;break;case"collapsed":l=i.tail;for(var u=null;l!==null;)l.alternate!==null&&(u=l),l=l.sibling;u===null?r||i.tail===null?i.tail=null:i.tail.sibling=null:u.sibling=null}}function tt(i){var r=i.alternate!==null&&i.alternate.child===i.child,l=0,u=0;if(r)for(var d=i.child;d!==null;)l|=d.lanes|d.childLanes,u|=d.subtreeFlags&65011712,u|=d.flags&65011712,d.return=i,d=d.sibling;else for(d=i.child;d!==null;)l|=d.lanes|d.childLanes,u|=d.subtreeFlags,u|=d.flags,d.return=i,d=d.sibling;return i.subtreeFlags|=u,i.childLanes=l,r}function _1(i,r,l){var u=r.pendingProps;switch(oc(r),r.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return tt(r),null;case 1:return tt(r),null;case 3:return l=r.stateNode,u=null,i!==null&&(u=i.memoizedState.cache),r.memoizedState.cache!==u&&(r.flags|=2048),yn(_t),De(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(i===null||i.child===null)&&(_s(r)?wn(r):i===null||i.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,cc())),tt(r),null;case 26:var d=r.type,_=r.memoizedState;return i===null?(wn(r),_!==null?(tt(r),gm(r,_)):(tt(r),eh(r,d,null,u,l))):_?_!==i.memoizedState?(wn(r),tt(r),gm(r,_)):(tt(r),r.flags&=-16777217):(i=i.memoizedProps,i!==u&&wn(r),tt(r),eh(r,d,i,u,l)),null;case 27:if(Zt(r),l=de.current,d=r.type,i!==null&&r.stateNode!=null)i.memoizedProps!==u&&wn(r);else{if(!u){if(r.stateNode===null)throw Error(s(166));return tt(r),null}i=ae.current,_s(r)?Gp(r):(i=Cg(d,u,l),r.stateNode=i,wn(r))}return tt(r),null;case 5:if(Zt(r),d=r.type,i!==null&&r.stateNode!=null)i.memoizedProps!==u&&wn(r);else{if(!u){if(r.stateNode===null)throw Error(s(166));return tt(r),null}if(_=ae.current,_s(r))Gp(r);else{var y=Do(de.current);switch(_){case 1:_=y.createElementNS("http://www.w3.org/2000/svg",d);break;case 2:_=y.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;default:switch(d){case"svg":_=y.createElementNS("http://www.w3.org/2000/svg",d);break;case"math":_=y.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;case"script":_=y.createElement("div"),_.innerHTML="<script><\/script>",_=_.removeChild(_.firstChild);break;case"select":_=typeof u.is=="string"?y.createElement("select",{is:u.is}):y.createElement("select"),u.multiple?_.multiple=!0:u.size&&(_.size=u.size);break;default:_=typeof u.is=="string"?y.createElement(d,{is:u.is}):y.createElement(d)}}_[jt]=r,_[oi]=u;e:for(y=r.child;y!==null;){if(y.tag===5||y.tag===6)_.appendChild(y.stateNode);else if(y.tag!==4&&y.tag!==27&&y.child!==null){y.child.return=y,y=y.child;continue}if(y===r)break e;for(;y.sibling===null;){if(y.return===null||y.return===r)break e;y=y.return}y.sibling.return=y.return,y=y.sibling}r.stateNode=_;e:switch(Ft(_,d,u),d){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&wn(r)}}return tt(r),eh(r,r.type,i===null?null:i.memoizedProps,r.pendingProps,l),null;case 6:if(i&&r.stateNode!=null)i.memoizedProps!==u&&wn(r);else{if(typeof u!="string"&&r.stateNode===null)throw Error(s(166));if(i=de.current,_s(r)){if(i=r.stateNode,l=r.memoizedProps,u=null,d=Ut,d!==null)switch(d.tag){case 27:case 5:u=d.memoizedProps}i[jt]=r,i=!!(i.nodeValue===l||u!==null&&u.suppressHydrationWarning===!0||dg(i.nodeValue,l)),i||qn(r,!0)}else i=Do(i).createTextNode(u),i[jt]=r,r.stateNode=i}return tt(r),null;case 31:if(l=r.memoizedState,i===null||i.memoizedState!==null){if(u=_s(r),l!==null){if(i===null){if(!u)throw Error(s(318));if(i=r.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(s(557));i[jt]=r}else kr(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;tt(r),i=!1}else l=cc(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=l),i=!0;if(!i)return r.flags&256?(wi(r),r):(wi(r),null);if((r.flags&128)!==0)throw Error(s(558))}return tt(r),null;case 13:if(u=r.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(d=_s(r),u!==null&&u.dehydrated!==null){if(i===null){if(!d)throw Error(s(318));if(d=r.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(s(317));d[jt]=r}else kr(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;tt(r),d=!1}else d=cc(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=d),d=!0;if(!d)return r.flags&256?(wi(r),r):(wi(r),null)}return wi(r),(r.flags&128)!==0?(r.lanes=l,r):(l=u!==null,i=i!==null&&i.memoizedState!==null,l&&(u=r.child,d=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(d=u.alternate.memoizedState.cachePool.pool),_=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(_=u.memoizedState.cachePool.pool),_!==d&&(u.flags|=2048)),l!==i&&l&&(r.child.flags|=8192),po(r,r.updateQueue),tt(r),null);case 4:return De(),i===null&&xh(r.stateNode.containerInfo),tt(r),null;case 10:return yn(r.type),tt(r),null;case 19:if(q(ft),u=r.memoizedState,u===null)return tt(r),null;if(d=(r.flags&128)!==0,_=u.rendering,_===null)if(d)kl(u,!1);else{if(ot!==0||i!==null&&(i.flags&128)!==0)for(i=r.child;i!==null;){if(_=eo(i),_!==null){for(r.flags|=128,kl(u,!1),i=_.updateQueue,r.updateQueue=i,po(r,i),r.subtreeFlags=0,i=l,l=r.child;l!==null;)Yp(l,i),l=l.sibling;return C(ft,ft.current&1|2),Oe&&gn(r,u.treeForkCount),r.child}i=i.sibling}u.tail!==null&&Qt()>yo&&(r.flags|=128,d=!0,kl(u,!1),r.lanes=4194304)}else{if(!d)if(i=eo(_),i!==null){if(r.flags|=128,d=!0,i=i.updateQueue,r.updateQueue=i,po(r,i),kl(u,!0),u.tail===null&&u.tailMode==="hidden"&&!_.alternate&&!Oe)return tt(r),null}else 2*Qt()-u.renderingStartTime>yo&&l!==536870912&&(r.flags|=128,d=!0,kl(u,!1),r.lanes=4194304);u.isBackwards?(_.sibling=r.child,r.child=_):(i=u.last,i!==null?i.sibling=_:r.child=_,u.last=_)}return u.tail!==null?(i=u.tail,u.rendering=i,u.tail=i.sibling,u.renderingStartTime=Qt(),i.sibling=null,l=ft.current,C(ft,d?l&1|2:l&1),Oe&&gn(r,u.treeForkCount),i):(tt(r),null);case 22:case 23:return wi(r),wc(),u=r.memoizedState!==null,i!==null?i.memoizedState!==null!==u&&(r.flags|=8192):u&&(r.flags|=8192),u?(l&536870912)!==0&&(r.flags&128)===0&&(tt(r),r.subtreeFlags&6&&(r.flags|=8192)):tt(r),l=r.updateQueue,l!==null&&po(r,l.retryQueue),l=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(l=i.memoizedState.cachePool.pool),u=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(u=r.memoizedState.cachePool.pool),u!==l&&(r.flags|=2048),i!==null&&q(Ar),null;case 24:return l=null,i!==null&&(l=i.memoizedState.cache),r.memoizedState.cache!==l&&(r.flags|=2048),yn(_t),tt(r),null;case 25:return null;case 30:return null}throw Error(s(156,r.tag))}function m1(i,r){switch(oc(r),r.tag){case 1:return i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 3:return yn(_t),De(),i=r.flags,(i&65536)!==0&&(i&128)===0?(r.flags=i&-65537|128,r):null;case 26:case 27:case 5:return Zt(r),null;case 31:if(r.memoizedState!==null){if(wi(r),r.alternate===null)throw Error(s(340));kr()}return i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 13:if(wi(r),i=r.memoizedState,i!==null&&i.dehydrated!==null){if(r.alternate===null)throw Error(s(340));kr()}return i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 19:return q(ft),null;case 4:return De(),null;case 10:return yn(r.type),null;case 22:case 23:return wi(r),wc(),i!==null&&q(Ar),i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 24:return yn(_t),null;case 25:return null;default:return null}}function vm(i,r){switch(oc(r),r.tag){case 3:yn(_t),De();break;case 26:case 27:case 5:Zt(r);break;case 4:De();break;case 31:r.memoizedState!==null&&wi(r);break;case 13:wi(r);break;case 19:q(ft);break;case 10:yn(r.type);break;case 22:case 23:wi(r),wc(),i!==null&&q(Ar);break;case 24:yn(_t)}}function El(i,r){try{var l=r.updateQueue,u=l!==null?l.lastEffect:null;if(u!==null){var d=u.next;l=d;do{if((l.tag&i)===i){u=void 0;var _=l.create,y=l.inst;u=_(),y.destroy=u}l=l.next}while(l!==d)}}catch(w){We(r,r.return,w)}}function Gn(i,r,l){try{var u=r.updateQueue,d=u!==null?u.lastEffect:null;if(d!==null){var _=d.next;u=_;do{if((u.tag&i)===i){var y=u.inst,w=y.destroy;if(w!==void 0){y.destroy=void 0,d=r;var R=l,I=w;try{I()}catch(Z){We(d,R,Z)}}}u=u.next}while(u!==_)}}catch(Z){We(r,r.return,Z)}}function ym(i){var r=i.updateQueue;if(r!==null){var l=i.stateNode;try{u_(r,l)}catch(u){We(i,i.return,u)}}}function Sm(i,r,l){l.props=Lr(i.type,i.memoizedProps),l.state=i.memoizedState;try{l.componentWillUnmount()}catch(u){We(i,r,u)}}function Tl(i,r){try{var l=i.ref;if(l!==null){switch(i.tag){case 26:case 27:case 5:var u=i.stateNode;break;case 30:u=i.stateNode;break;default:u=i.stateNode}typeof l=="function"?i.refCleanup=l(u):l.current=u}}catch(d){We(i,r,d)}}function tn(i,r){var l=i.ref,u=i.refCleanup;if(l!==null)if(typeof u=="function")try{u()}catch(d){We(i,r,d)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(d){We(i,r,d)}else l.current=null}function bm(i){var r=i.type,l=i.memoizedProps,u=i.stateNode;try{e:switch(r){case"button":case"input":case"select":case"textarea":l.autoFocus&&u.focus();break e;case"img":l.src?u.src=l.src:l.srcSet&&(u.srcset=l.srcSet)}}catch(d){We(i,i.return,d)}}function th(i,r,l){try{var u=i.stateNode;j1(u,i.type,l,r),u[oi]=r}catch(d){We(i,i.return,d)}}function xm(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&nr(i.type)||i.tag===4}function ih(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||xm(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&nr(i.type)||i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function nh(i,r,l){var u=i.tag;if(u===5||u===6)i=i.stateNode,r?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(i,r):(r=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,r.appendChild(i),l=l._reactRootContainer,l!=null||r.onclick!==null||(r.onclick=pn));else if(u!==4&&(u===27&&nr(i.type)&&(l=i.stateNode,r=null),i=i.child,i!==null))for(nh(i,r,l),i=i.sibling;i!==null;)nh(i,r,l),i=i.sibling}function _o(i,r,l){var u=i.tag;if(u===5||u===6)i=i.stateNode,r?l.insertBefore(i,r):l.appendChild(i);else if(u!==4&&(u===27&&nr(i.type)&&(l=i.stateNode),i=i.child,i!==null))for(_o(i,r,l),i=i.sibling;i!==null;)_o(i,r,l),i=i.sibling}function wm(i){var r=i.stateNode,l=i.memoizedProps;try{for(var u=i.type,d=r.attributes;d.length;)r.removeAttributeNode(d[0]);Ft(r,u,l),r[jt]=i,r[oi]=l}catch(_){We(i,i.return,_)}}var Cn=!1,vt=!1,rh=!1,Cm=typeof WeakSet=="function"?WeakSet:Set,At=null;function g1(i,r){if(i=i.containerInfo,kh=Oo,i=Op(i),Zu(i)){if("selectionStart"in i)var l={start:i.selectionStart,end:i.selectionEnd};else e:{l=(l=i.ownerDocument)&&l.defaultView||window;var u=l.getSelection&&l.getSelection();if(u&&u.rangeCount!==0){l=u.anchorNode;var d=u.anchorOffset,_=u.focusNode;u=u.focusOffset;try{l.nodeType,_.nodeType}catch{l=null;break e}var y=0,w=-1,R=-1,I=0,Z=0,te=i,W=null;t:for(;;){for(var X;te!==l||d!==0&&te.nodeType!==3||(w=y+d),te!==_||u!==0&&te.nodeType!==3||(R=y+u),te.nodeType===3&&(y+=te.nodeValue.length),(X=te.firstChild)!==null;)W=te,te=X;for(;;){if(te===i)break t;if(W===l&&++I===d&&(w=y),W===_&&++Z===u&&(R=y),(X=te.nextSibling)!==null)break;te=W,W=te.parentNode}te=X}l=w===-1||R===-1?null:{start:w,end:R}}else l=null}l=l||{start:0,end:0}}else l=null;for(Eh={focusedElem:i,selectionRange:l},Oo=!1,At=r;At!==null;)if(r=At,i=r.child,(r.subtreeFlags&1028)!==0&&i!==null)i.return=r,At=i;else for(;At!==null;){switch(r=At,_=r.alternate,i=r.flags,r.tag){case 0:if((i&4)!==0&&(i=r.updateQueue,i=i!==null?i.events:null,i!==null))for(l=0;l<i.length;l++)d=i[l],d.ref.impl=d.nextImpl;break;case 11:case 15:break;case 1:if((i&1024)!==0&&_!==null){i=void 0,l=r,d=_.memoizedProps,_=_.memoizedState,u=l.stateNode;try{var pe=Lr(l.type,d);i=u.getSnapshotBeforeUpdate(pe,_),u.__reactInternalSnapshotBeforeUpdate=i}catch(ye){We(l,l.return,ye)}}break;case 3:if((i&1024)!==0){if(i=r.stateNode.containerInfo,l=i.nodeType,l===9)Dh(i);else if(l===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":Dh(i);break;default:i.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((i&1024)!==0)throw Error(s(163))}if(i=r.sibling,i!==null){i.return=r.return,At=i;break}At=r.return}}function km(i,r,l){var u=l.flags;switch(l.tag){case 0:case 11:case 15:En(i,l),u&4&&El(5,l);break;case 1:if(En(i,l),u&4)if(i=l.stateNode,r===null)try{i.componentDidMount()}catch(y){We(l,l.return,y)}else{var d=Lr(l.type,r.memoizedProps);r=r.memoizedState;try{i.componentDidUpdate(d,r,i.__reactInternalSnapshotBeforeUpdate)}catch(y){We(l,l.return,y)}}u&64&&ym(l),u&512&&Tl(l,l.return);break;case 3:if(En(i,l),u&64&&(i=l.updateQueue,i!==null)){if(r=null,l.child!==null)switch(l.child.tag){case 27:case 5:r=l.child.stateNode;break;case 1:r=l.child.stateNode}try{u_(i,r)}catch(y){We(l,l.return,y)}}break;case 27:r===null&&u&4&&wm(l);case 26:case 5:En(i,l),r===null&&u&4&&bm(l),u&512&&Tl(l,l.return);break;case 12:En(i,l);break;case 31:En(i,l),u&4&&Am(i,l);break;case 13:En(i,l),u&4&&Dm(i,l),u&64&&(i=l.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(l=E1.bind(null,l),V1(i,l))));break;case 22:if(u=l.memoizedState!==null||Cn,!u){r=r!==null&&r.memoizedState!==null||vt,d=Cn;var _=vt;Cn=u,(vt=r)&&!_?Tn(i,l,(l.subtreeFlags&8772)!==0):En(i,l),Cn=d,vt=_}break;case 30:break;default:En(i,l)}}function Em(i){var r=i.alternate;r!==null&&(i.alternate=null,Em(r)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(r=i.stateNode,r!==null&&zu(r)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}var nt=null,ci=!1;function kn(i,r,l){for(l=l.child;l!==null;)Tm(i,r,l),l=l.sibling}function Tm(i,r,l){if(xt&&typeof xt.onCommitFiberUnmount=="function")try{xt.onCommitFiberUnmount(Jt,l)}catch{}switch(l.tag){case 26:vt||tn(l,r),kn(i,r,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:vt||tn(l,r);var u=nt,d=ci;nr(l.type)&&(nt=l.stateNode,ci=!1),kn(i,r,l),Ol(l.stateNode),nt=u,ci=d;break;case 5:vt||tn(l,r);case 6:if(u=nt,d=ci,nt=null,kn(i,r,l),nt=u,ci=d,nt!==null)if(ci)try{(nt.nodeType===9?nt.body:nt.nodeName==="HTML"?nt.ownerDocument.body:nt).removeChild(l.stateNode)}catch(_){We(l,r,_)}else try{nt.removeChild(l.stateNode)}catch(_){We(l,r,_)}break;case 18:nt!==null&&(ci?(i=nt,yg(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,l.stateNode),Os(i)):yg(nt,l.stateNode));break;case 4:u=nt,d=ci,nt=l.stateNode.containerInfo,ci=!0,kn(i,r,l),nt=u,ci=d;break;case 0:case 11:case 14:case 15:Gn(2,l,r),vt||Gn(4,l,r),kn(i,r,l);break;case 1:vt||(tn(l,r),u=l.stateNode,typeof u.componentWillUnmount=="function"&&Sm(l,r,u)),kn(i,r,l);break;case 21:kn(i,r,l);break;case 22:vt=(u=vt)||l.memoizedState!==null,kn(i,r,l),vt=u;break;default:kn(i,r,l)}}function Am(i,r){if(r.memoizedState===null&&(i=r.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{Os(i)}catch(l){We(r,r.return,l)}}}function Dm(i,r){if(r.memoizedState===null&&(i=r.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{Os(i)}catch(l){We(r,r.return,l)}}function v1(i){switch(i.tag){case 31:case 13:case 19:var r=i.stateNode;return r===null&&(r=i.stateNode=new Cm),r;case 22:return i=i.stateNode,r=i._retryCache,r===null&&(r=i._retryCache=new Cm),r;default:throw Error(s(435,i.tag))}}function mo(i,r){var l=v1(i);r.forEach(function(u){if(!l.has(u)){l.add(u);var d=T1.bind(null,i,u);u.then(d,d)}})}function hi(i,r){var l=r.deletions;if(l!==null)for(var u=0;u<l.length;u++){var d=l[u],_=i,y=r,w=y;e:for(;w!==null;){switch(w.tag){case 27:if(nr(w.type)){nt=w.stateNode,ci=!1;break e}break;case 5:nt=w.stateNode,ci=!1;break e;case 3:case 4:nt=w.stateNode.containerInfo,ci=!0;break e}w=w.return}if(nt===null)throw Error(s(160));Tm(_,y,d),nt=null,ci=!1,_=d.alternate,_!==null&&(_.return=null),d.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)Rm(r,i),r=r.sibling}var $i=null;function Rm(i,r){var l=i.alternate,u=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:hi(r,i),fi(i),u&4&&(Gn(3,i,i.return),El(3,i),Gn(5,i,i.return));break;case 1:hi(r,i),fi(i),u&512&&(vt||l===null||tn(l,l.return)),u&64&&Cn&&(i=i.updateQueue,i!==null&&(u=i.callbacks,u!==null&&(l=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=l===null?u:l.concat(u))));break;case 26:var d=$i;if(hi(r,i),fi(i),u&512&&(vt||l===null||tn(l,l.return)),u&4){var _=l!==null?l.memoizedState:null;if(u=i.memoizedState,l===null)if(u===null)if(i.stateNode===null){e:{u=i.type,l=i.memoizedProps,d=d.ownerDocument||d;t:switch(u){case"title":_=d.getElementsByTagName("title")[0],(!_||_[el]||_[jt]||_.namespaceURI==="http://www.w3.org/2000/svg"||_.hasAttribute("itemprop"))&&(_=d.createElement(u),d.head.insertBefore(_,d.querySelector("head > title"))),Ft(_,u,l),_[jt]=i,Tt(_),u=_;break e;case"link":var y=Rg("link","href",d).get(u+(l.href||""));if(y){for(var w=0;w<y.length;w++)if(_=y[w],_.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&_.getAttribute("rel")===(l.rel==null?null:l.rel)&&_.getAttribute("title")===(l.title==null?null:l.title)&&_.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){y.splice(w,1);break t}}_=d.createElement(u),Ft(_,u,l),d.head.appendChild(_);break;case"meta":if(y=Rg("meta","content",d).get(u+(l.content||""))){for(w=0;w<y.length;w++)if(_=y[w],_.getAttribute("content")===(l.content==null?null:""+l.content)&&_.getAttribute("name")===(l.name==null?null:l.name)&&_.getAttribute("property")===(l.property==null?null:l.property)&&_.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&_.getAttribute("charset")===(l.charSet==null?null:l.charSet)){y.splice(w,1);break t}}_=d.createElement(u),Ft(_,u,l),d.head.appendChild(_);break;default:throw Error(s(468,u))}_[jt]=i,Tt(_),u=_}i.stateNode=u}else Mg(d,i.type,i.stateNode);else i.stateNode=Dg(d,u,i.memoizedProps);else _!==u?(_===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):_.count--,u===null?Mg(d,i.type,i.stateNode):Dg(d,u,i.memoizedProps)):u===null&&i.stateNode!==null&&th(i,i.memoizedProps,l.memoizedProps)}break;case 27:hi(r,i),fi(i),u&512&&(vt||l===null||tn(l,l.return)),l!==null&&u&4&&th(i,i.memoizedProps,l.memoizedProps);break;case 5:if(hi(r,i),fi(i),u&512&&(vt||l===null||tn(l,l.return)),i.flags&32){d=i.stateNode;try{ss(d,"")}catch(pe){We(i,i.return,pe)}}u&4&&i.stateNode!=null&&(d=i.memoizedProps,th(i,d,l!==null?l.memoizedProps:d)),u&1024&&(rh=!0);break;case 6:if(hi(r,i),fi(i),u&4){if(i.stateNode===null)throw Error(s(162));u=i.memoizedProps,l=i.stateNode;try{l.nodeValue=u}catch(pe){We(i,i.return,pe)}}break;case 3:if(Bo=null,d=$i,$i=Ro(r.containerInfo),hi(r,i),$i=d,fi(i),u&4&&l!==null&&l.memoizedState.isDehydrated)try{Os(r.containerInfo)}catch(pe){We(i,i.return,pe)}rh&&(rh=!1,Mm(i));break;case 4:u=$i,$i=Ro(i.stateNode.containerInfo),hi(r,i),fi(i),$i=u;break;case 12:hi(r,i),fi(i);break;case 31:hi(r,i),fi(i),u&4&&(u=i.updateQueue,u!==null&&(i.updateQueue=null,mo(i,u)));break;case 13:hi(r,i),fi(i),i.child.flags&8192&&i.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(vo=Qt()),u&4&&(u=i.updateQueue,u!==null&&(i.updateQueue=null,mo(i,u)));break;case 22:d=i.memoizedState!==null;var R=l!==null&&l.memoizedState!==null,I=Cn,Z=vt;if(Cn=I||d,vt=Z||R,hi(r,i),vt=Z,Cn=I,fi(i),u&8192)e:for(r=i.stateNode,r._visibility=d?r._visibility&-2:r._visibility|1,d&&(l===null||R||Cn||vt||zr(i)),l=null,r=i;;){if(r.tag===5||r.tag===26){if(l===null){R=l=r;try{if(_=R.stateNode,d)y=_.style,typeof y.setProperty=="function"?y.setProperty("display","none","important"):y.display="none";else{w=R.stateNode;var te=R.memoizedProps.style,W=te!=null&&te.hasOwnProperty("display")?te.display:null;w.style.display=W==null||typeof W=="boolean"?"":(""+W).trim()}}catch(pe){We(R,R.return,pe)}}}else if(r.tag===6){if(l===null){R=r;try{R.stateNode.nodeValue=d?"":R.memoizedProps}catch(pe){We(R,R.return,pe)}}}else if(r.tag===18){if(l===null){R=r;try{var X=R.stateNode;d?Sg(X,!0):Sg(R.stateNode,!1)}catch(pe){We(R,R.return,pe)}}}else if((r.tag!==22&&r.tag!==23||r.memoizedState===null||r===i)&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===i)break e;for(;r.sibling===null;){if(r.return===null||r.return===i)break e;l===r&&(l=null),r=r.return}l===r&&(l=null),r.sibling.return=r.return,r=r.sibling}u&4&&(u=i.updateQueue,u!==null&&(l=u.retryQueue,l!==null&&(u.retryQueue=null,mo(i,l))));break;case 19:hi(r,i),fi(i),u&4&&(u=i.updateQueue,u!==null&&(i.updateQueue=null,mo(i,u)));break;case 30:break;case 21:break;default:hi(r,i),fi(i)}}function fi(i){var r=i.flags;if(r&2){try{for(var l,u=i.return;u!==null;){if(xm(u)){l=u;break}u=u.return}if(l==null)throw Error(s(160));switch(l.tag){case 27:var d=l.stateNode,_=ih(i);_o(i,_,d);break;case 5:var y=l.stateNode;l.flags&32&&(ss(y,""),l.flags&=-33);var w=ih(i);_o(i,w,y);break;case 3:case 4:var R=l.stateNode.containerInfo,I=ih(i);nh(i,I,R);break;default:throw Error(s(161))}}catch(Z){We(i,i.return,Z)}i.flags&=-3}r&4096&&(i.flags&=-4097)}function Mm(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var r=i;Mm(r),r.tag===5&&r.flags&1024&&r.stateNode.reset(),i=i.sibling}}function En(i,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)km(i,r.alternate,r),r=r.sibling}function zr(i){for(i=i.child;i!==null;){var r=i;switch(r.tag){case 0:case 11:case 14:case 15:Gn(4,r,r.return),zr(r);break;case 1:tn(r,r.return);var l=r.stateNode;typeof l.componentWillUnmount=="function"&&Sm(r,r.return,l),zr(r);break;case 27:Ol(r.stateNode);case 26:case 5:tn(r,r.return),zr(r);break;case 22:r.memoizedState===null&&zr(r);break;case 30:zr(r);break;default:zr(r)}i=i.sibling}}function Tn(i,r,l){for(l=l&&(r.subtreeFlags&8772)!==0,r=r.child;r!==null;){var u=r.alternate,d=i,_=r,y=_.flags;switch(_.tag){case 0:case 11:case 15:Tn(d,_,l),El(4,_);break;case 1:if(Tn(d,_,l),u=_,d=u.stateNode,typeof d.componentDidMount=="function")try{d.componentDidMount()}catch(I){We(u,u.return,I)}if(u=_,d=u.updateQueue,d!==null){var w=u.stateNode;try{var R=d.shared.hiddenCallbacks;if(R!==null)for(d.shared.hiddenCallbacks=null,d=0;d<R.length;d++)o_(R[d],w)}catch(I){We(u,u.return,I)}}l&&y&64&&ym(_),Tl(_,_.return);break;case 27:wm(_);case 26:case 5:Tn(d,_,l),l&&u===null&&y&4&&bm(_),Tl(_,_.return);break;case 12:Tn(d,_,l);break;case 31:Tn(d,_,l),l&&y&4&&Am(d,_);break;case 13:Tn(d,_,l),l&&y&4&&Dm(d,_);break;case 22:_.memoizedState===null&&Tn(d,_,l),Tl(_,_.return);break;case 30:break;default:Tn(d,_,l)}r=r.sibling}}function sh(i,r){var l=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(l=i.memoizedState.cachePool.pool),i=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(i=r.memoizedState.cachePool.pool),i!==l&&(i!=null&&i.refCount++,l!=null&&dl(l))}function lh(i,r){i=null,r.alternate!==null&&(i=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==i&&(r.refCount++,i!=null&&dl(i))}function Gi(i,r,l,u){if(r.subtreeFlags&10256)for(r=r.child;r!==null;)Bm(i,r,l,u),r=r.sibling}function Bm(i,r,l,u){var d=r.flags;switch(r.tag){case 0:case 11:case 15:Gi(i,r,l,u),d&2048&&El(9,r);break;case 1:Gi(i,r,l,u);break;case 3:Gi(i,r,l,u),d&2048&&(i=null,r.alternate!==null&&(i=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==i&&(r.refCount++,i!=null&&dl(i)));break;case 12:if(d&2048){Gi(i,r,l,u),i=r.stateNode;try{var _=r.memoizedProps,y=_.id,w=_.onPostCommit;typeof w=="function"&&w(y,r.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(R){We(r,r.return,R)}}else Gi(i,r,l,u);break;case 31:Gi(i,r,l,u);break;case 13:Gi(i,r,l,u);break;case 23:break;case 22:_=r.stateNode,y=r.alternate,r.memoizedState!==null?_._visibility&2?Gi(i,r,l,u):Al(i,r):_._visibility&2?Gi(i,r,l,u):(_._visibility|=2,ks(i,r,l,u,(r.subtreeFlags&10256)!==0||!1)),d&2048&&sh(y,r);break;case 24:Gi(i,r,l,u),d&2048&&lh(r.alternate,r);break;default:Gi(i,r,l,u)}}function ks(i,r,l,u,d){for(d=d&&((r.subtreeFlags&10256)!==0||!1),r=r.child;r!==null;){var _=i,y=r,w=l,R=u,I=y.flags;switch(y.tag){case 0:case 11:case 15:ks(_,y,w,R,d),El(8,y);break;case 23:break;case 22:var Z=y.stateNode;y.memoizedState!==null?Z._visibility&2?ks(_,y,w,R,d):Al(_,y):(Z._visibility|=2,ks(_,y,w,R,d)),d&&I&2048&&sh(y.alternate,y);break;case 24:ks(_,y,w,R,d),d&&I&2048&&lh(y.alternate,y);break;default:ks(_,y,w,R,d)}r=r.sibling}}function Al(i,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var l=i,u=r,d=u.flags;switch(u.tag){case 22:Al(l,u),d&2048&&sh(u.alternate,u);break;case 24:Al(l,u),d&2048&&lh(u.alternate,u);break;default:Al(l,u)}r=r.sibling}}var Dl=8192;function Es(i,r,l){if(i.subtreeFlags&Dl)for(i=i.child;i!==null;)Lm(i,r,l),i=i.sibling}function Lm(i,r,l){switch(i.tag){case 26:Es(i,r,l),i.flags&Dl&&i.memoizedState!==null&&rx(l,$i,i.memoizedState,i.memoizedProps);break;case 5:Es(i,r,l);break;case 3:case 4:var u=$i;$i=Ro(i.stateNode.containerInfo),Es(i,r,l),$i=u;break;case 22:i.memoizedState===null&&(u=i.alternate,u!==null&&u.memoizedState!==null?(u=Dl,Dl=16777216,Es(i,r,l),Dl=u):Es(i,r,l));break;default:Es(i,r,l)}}function zm(i){var r=i.alternate;if(r!==null&&(i=r.child,i!==null)){r.child=null;do r=i.sibling,i.sibling=null,i=r;while(i!==null)}}function Rl(i){var r=i.deletions;if((i.flags&16)!==0){if(r!==null)for(var l=0;l<r.length;l++){var u=r[l];At=u,Om(u,i)}zm(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)Nm(i),i=i.sibling}function Nm(i){switch(i.tag){case 0:case 11:case 15:Rl(i),i.flags&2048&&Gn(9,i,i.return);break;case 3:Rl(i);break;case 12:Rl(i);break;case 22:var r=i.stateNode;i.memoizedState!==null&&r._visibility&2&&(i.return===null||i.return.tag!==13)?(r._visibility&=-3,go(i)):Rl(i);break;default:Rl(i)}}function go(i){var r=i.deletions;if((i.flags&16)!==0){if(r!==null)for(var l=0;l<r.length;l++){var u=r[l];At=u,Om(u,i)}zm(i)}for(i=i.child;i!==null;){switch(r=i,r.tag){case 0:case 11:case 15:Gn(8,r,r.return),go(r);break;case 22:l=r.stateNode,l._visibility&2&&(l._visibility&=-3,go(r));break;default:go(r)}i=i.sibling}}function Om(i,r){for(;At!==null;){var l=At;switch(l.tag){case 0:case 11:case 15:Gn(8,l,r);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var u=l.memoizedState.cachePool.pool;u!=null&&u.refCount++}break;case 24:dl(l.memoizedState.cache)}if(u=l.child,u!==null)u.return=l,At=u;else e:for(l=i;At!==null;){u=At;var d=u.sibling,_=u.return;if(Em(u),u===l){At=null;break e}if(d!==null){d.return=_,At=d;break e}At=_}}}var y1={getCacheForType:function(i){var r=Pt(_t),l=r.data.get(i);return l===void 0&&(l=i(),r.data.set(i,l)),l},cacheSignal:function(){return Pt(_t).controller.signal}},S1=typeof WeakMap=="function"?WeakMap:Map,Ie=0,Ze=null,Me=null,ze=0,qe=0,Ci=null,Zn=!1,Ts=!1,ah=!1,An=0,ot=0,Qn=0,Nr=0,oh=0,ki=0,As=0,Ml=null,di=null,uh=!1,vo=0,Hm=0,yo=1/0,So=null,Jn=null,wt=0,er=null,Ds=null,Dn=0,ch=0,hh=null,jm=null,Bl=0,fh=null;function Ei(){return(Ie&2)!==0&&ze!==0?ze&-ze:M.T!==null?vh():ep()}function Um(){if(ki===0)if((ze&536870912)===0||Oe){var i=Ta;Ta<<=1,(Ta&3932160)===0&&(Ta=262144),ki=i}else ki=536870912;return i=xi.current,i!==null&&(i.flags|=32),ki}function pi(i,r,l){(i===Ze&&(qe===2||qe===9)||i.cancelPendingCommit!==null)&&(Rs(i,0),tr(i,ze,ki,!1)),Js(i,l),((Ie&2)===0||i!==Ze)&&(i===Ze&&((Ie&2)===0&&(Nr|=l),ot===4&&tr(i,ze,ki,!1)),nn(i))}function Pm(i,r,l){if((Ie&6)!==0)throw Error(s(327));var u=!l&&(r&127)===0&&(r&i.expiredLanes)===0||Qs(i,r),d=u?w1(i,r):ph(i,r,!0),_=u;do{if(d===0){Ts&&!u&&tr(i,r,0,!1);break}else{if(l=i.current.alternate,_&&!b1(l)){d=ph(i,r,!1),_=!1;continue}if(d===2){if(_=r,i.errorRecoveryDisabledLanes&_)var y=0;else y=i.pendingLanes&-536870913,y=y!==0?y:y&536870912?536870912:0;if(y!==0){r=y;e:{var w=i;d=Ml;var R=w.current.memoizedState.isDehydrated;if(R&&(Rs(w,y).flags|=256),y=ph(w,y,!1),y!==2){if(ah&&!R){w.errorRecoveryDisabledLanes|=_,Nr|=_,d=4;break e}_=di,di=d,_!==null&&(di===null?di=_:di.push.apply(di,_))}d=y}if(_=!1,d!==2)continue}}if(d===1){Rs(i,0),tr(i,r,0,!0);break}e:{switch(u=i,_=d,_){case 0:case 1:throw Error(s(345));case 4:if((r&4194048)!==r)break;case 6:tr(u,r,ki,!Zn);break e;case 2:di=null;break;case 3:case 5:break;default:throw Error(s(329))}if((r&62914560)===r&&(d=vo+300-Qt(),10<d)){if(tr(u,r,ki,!Zn),Da(u,0,!0)!==0)break e;Dn=r,u.timeoutHandle=gg(Im.bind(null,u,l,di,So,uh,r,ki,Nr,As,Zn,_,"Throttled",-0,0),d);break e}Im(u,l,di,So,uh,r,ki,Nr,As,Zn,_,null,-0,0)}}break}while(!0);nn(i)}function Im(i,r,l,u,d,_,y,w,R,I,Z,te,W,X){if(i.timeoutHandle=-1,te=r.subtreeFlags,te&8192||(te&16785408)===16785408){te={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:pn},Lm(r,_,te);var pe=(_&62914560)===_?vo-Qt():(_&4194048)===_?Hm-Qt():0;if(pe=sx(te,pe),pe!==null){Dn=_,i.cancelPendingCommit=pe($m.bind(null,i,r,_,l,u,d,y,w,R,Z,te,null,W,X)),tr(i,_,y,!I);return}}$m(i,r,_,l,u,d,y,w,R)}function b1(i){for(var r=i;;){var l=r.tag;if((l===0||l===11||l===15)&&r.flags&16384&&(l=r.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var u=0;u<l.length;u++){var d=l[u],_=d.getSnapshot;d=d.value;try{if(!Si(_(),d))return!1}catch{return!1}}if(l=r.child,r.subtreeFlags&16384&&l!==null)l.return=r,r=l;else{if(r===i)break;for(;r.sibling===null;){if(r.return===null||r.return===i)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function tr(i,r,l,u){r&=~oh,r&=~Nr,i.suspendedLanes|=r,i.pingedLanes&=~r,u&&(i.warmLanes|=r),u=i.expirationTimes;for(var d=r;0<d;){var _=31-Ge(d),y=1<<_;u[_]=-1,d&=~y}l!==0&&Zd(i,l,r)}function bo(){return(Ie&6)===0?(Ll(0),!1):!0}function dh(){if(Me!==null){if(qe===0)var i=Me.return;else i=Me,vn=Er=null,Dc(i),Ss=null,_l=0,i=Me;for(;i!==null;)vm(i.alternate,i),i=i.return;Me=null}}function Rs(i,r){var l=i.timeoutHandle;l!==-1&&(i.timeoutHandle=-1,I1(l)),l=i.cancelPendingCommit,l!==null&&(i.cancelPendingCommit=null,l()),Dn=0,dh(),Ze=i,Me=l=mn(i.current,null),ze=r,qe=0,Ci=null,Zn=!1,Ts=Qs(i,r),ah=!1,As=ki=oh=Nr=Qn=ot=0,di=Ml=null,uh=!1,(r&8)!==0&&(r|=r&32);var u=i.entangledLanes;if(u!==0)for(i=i.entanglements,u&=r;0<u;){var d=31-Ge(u),_=1<<d;r|=i[d],u&=~_}return An=r,Ia(),l}function Fm(i,r){Ce=null,M.H=wl,r===ys||r===$a?(r=r_(),qe=3):r===gc?(r=r_(),qe=4):qe=r===Yc?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,Ci=r,Me===null&&(ot=1,uo(i,Ni(r,i.current)))}function qm(){var i=xi.current;return i===null?!0:(ze&4194048)===ze?Ui===null:(ze&62914560)===ze||(ze&536870912)!==0?i===Ui:!1}function Wm(){var i=M.H;return M.H=wl,i===null?wl:i}function Ym(){var i=M.A;return M.A=y1,i}function xo(){ot=4,Zn||(ze&4194048)!==ze&&xi.current!==null||(Ts=!0),(Qn&134217727)===0&&(Nr&134217727)===0||Ze===null||tr(Ze,ze,ki,!1)}function ph(i,r,l){var u=Ie;Ie|=2;var d=Wm(),_=Ym();(Ze!==i||ze!==r)&&(So=null,Rs(i,r)),r=!1;var y=ot;e:do try{if(qe!==0&&Me!==null){var w=Me,R=Ci;switch(qe){case 8:dh(),y=6;break e;case 3:case 2:case 9:case 6:xi.current===null&&(r=!0);var I=qe;if(qe=0,Ci=null,Ms(i,w,R,I),l&&Ts){y=0;break e}break;default:I=qe,qe=0,Ci=null,Ms(i,w,R,I)}}x1(),y=ot;break}catch(Z){Fm(i,Z)}while(!0);return r&&i.shellSuspendCounter++,vn=Er=null,Ie=u,M.H=d,M.A=_,Me===null&&(Ze=null,ze=0,Ia()),y}function x1(){for(;Me!==null;)Vm(Me)}function w1(i,r){var l=Ie;Ie|=2;var u=Wm(),d=Ym();Ze!==i||ze!==r?(So=null,yo=Qt()+500,Rs(i,r)):Ts=Qs(i,r);e:do try{if(qe!==0&&Me!==null){r=Me;var _=Ci;t:switch(qe){case 1:qe=0,Ci=null,Ms(i,r,_,1);break;case 2:case 9:if(i_(_)){qe=0,Ci=null,Km(r);break}r=function(){qe!==2&&qe!==9||Ze!==i||(qe=7),nn(i)},_.then(r,r);break e;case 3:qe=7;break e;case 4:qe=5;break e;case 7:i_(_)?(qe=0,Ci=null,Km(r)):(qe=0,Ci=null,Ms(i,r,_,7));break;case 5:var y=null;switch(Me.tag){case 26:y=Me.memoizedState;case 5:case 27:var w=Me;if(y?Bg(y):w.stateNode.complete){qe=0,Ci=null;var R=w.sibling;if(R!==null)Me=R;else{var I=w.return;I!==null?(Me=I,wo(I)):Me=null}break t}}qe=0,Ci=null,Ms(i,r,_,5);break;case 6:qe=0,Ci=null,Ms(i,r,_,6);break;case 8:dh(),ot=6;break e;default:throw Error(s(462))}}C1();break}catch(Z){Fm(i,Z)}while(!0);return vn=Er=null,M.H=u,M.A=d,Ie=l,Me!==null?0:(Ze=null,ze=0,Ia(),ot)}function C1(){for(;Me!==null&&!Tu();)Vm(Me)}function Vm(i){var r=mm(i.alternate,i,An);i.memoizedProps=i.pendingProps,r===null?wo(i):Me=r}function Km(i){var r=i,l=r.alternate;switch(r.tag){case 15:case 0:r=cm(l,r,r.pendingProps,r.type,void 0,ze);break;case 11:r=cm(l,r,r.pendingProps,r.type.render,r.ref,ze);break;case 5:Dc(r);default:vm(l,r),r=Me=Yp(r,An),r=mm(l,r,An)}i.memoizedProps=i.pendingProps,r===null?wo(i):Me=r}function Ms(i,r,l,u){vn=Er=null,Dc(r),Ss=null,_l=0;var d=r.return;try{if(f1(i,d,r,l,ze)){ot=1,uo(i,Ni(l,i.current)),Me=null;return}}catch(_){if(d!==null)throw Me=d,_;ot=1,uo(i,Ni(l,i.current)),Me=null;return}r.flags&32768?(Oe||u===1?i=!0:Ts||(ze&536870912)!==0?i=!1:(Zn=i=!0,(u===2||u===9||u===3||u===6)&&(u=xi.current,u!==null&&u.tag===13&&(u.flags|=16384))),Xm(r,i)):wo(r)}function wo(i){var r=i;do{if((r.flags&32768)!==0){Xm(r,Zn);return}i=r.return;var l=_1(r.alternate,r,An);if(l!==null){Me=l;return}if(r=r.sibling,r!==null){Me=r;return}Me=r=i}while(r!==null);ot===0&&(ot=5)}function Xm(i,r){do{var l=m1(i.alternate,i);if(l!==null){l.flags&=32767,Me=l;return}if(l=i.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!r&&(i=i.sibling,i!==null)){Me=i;return}Me=i=l}while(i!==null);ot=6,Me=null}function $m(i,r,l,u,d,_,y,w,R){i.cancelPendingCommit=null;do Co();while(wt!==0);if((Ie&6)!==0)throw Error(s(327));if(r!==null){if(r===i.current)throw Error(s(177));if(_=r.lanes|r.childLanes,_|=ic,n0(i,l,_,y,w,R),i===Ze&&(Me=Ze=null,ze=0),Ds=r,er=i,Dn=l,ch=_,hh=d,jm=u,(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,A1(Se,function(){return eg(),null})):(i.callbackNode=null,i.callbackPriority=0),u=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||u){u=M.T,M.T=null,d=F.p,F.p=2,y=Ie,Ie|=4;try{g1(i,r,l)}finally{Ie=y,F.p=d,M.T=u}}wt=1,Gm(),Zm(),Qm()}}function Gm(){if(wt===1){wt=0;var i=er,r=Ds,l=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||l){l=M.T,M.T=null;var u=F.p;F.p=2;var d=Ie;Ie|=4;try{Rm(r,i);var _=Eh,y=Op(i.containerInfo),w=_.focusedElem,R=_.selectionRange;if(y!==w&&w&&w.ownerDocument&&Np(w.ownerDocument.documentElement,w)){if(R!==null&&Zu(w)){var I=R.start,Z=R.end;if(Z===void 0&&(Z=I),"selectionStart"in w)w.selectionStart=I,w.selectionEnd=Math.min(Z,w.value.length);else{var te=w.ownerDocument||document,W=te&&te.defaultView||window;if(W.getSelection){var X=W.getSelection(),pe=w.textContent.length,ye=Math.min(R.start,pe),Xe=R.end===void 0?ye:Math.min(R.end,pe);!X.extend&&ye>Xe&&(y=Xe,Xe=ye,ye=y);var O=zp(w,ye),L=zp(w,Xe);if(O&&L&&(X.rangeCount!==1||X.anchorNode!==O.node||X.anchorOffset!==O.offset||X.focusNode!==L.node||X.focusOffset!==L.offset)){var P=te.createRange();P.setStart(O.node,O.offset),X.removeAllRanges(),ye>Xe?(X.addRange(P),X.extend(L.node,L.offset)):(P.setEnd(L.node,L.offset),X.addRange(P))}}}}for(te=[],X=w;X=X.parentNode;)X.nodeType===1&&te.push({element:X,left:X.scrollLeft,top:X.scrollTop});for(typeof w.focus=="function"&&w.focus(),w=0;w<te.length;w++){var ee=te[w];ee.element.scrollLeft=ee.left,ee.element.scrollTop=ee.top}}Oo=!!kh,Eh=kh=null}finally{Ie=d,F.p=u,M.T=l}}i.current=r,wt=2}}function Zm(){if(wt===2){wt=0;var i=er,r=Ds,l=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||l){l=M.T,M.T=null;var u=F.p;F.p=2;var d=Ie;Ie|=4;try{km(i,r.alternate,r)}finally{Ie=d,F.p=u,M.T=l}}wt=3}}function Qm(){if(wt===4||wt===3){wt=0,Au();var i=er,r=Ds,l=Dn,u=jm;(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?wt=5:(wt=0,Ds=er=null,Jm(i,i.pendingLanes));var d=i.pendingLanes;if(d===0&&(Jn=null),Bu(l),r=r.stateNode,xt&&typeof xt.onCommitFiberRoot=="function")try{xt.onCommitFiberRoot(Jt,r,void 0,(r.current.flags&128)===128)}catch{}if(u!==null){r=M.T,d=F.p,F.p=2,M.T=null;try{for(var _=i.onRecoverableError,y=0;y<u.length;y++){var w=u[y];_(w.value,{componentStack:w.stack})}}finally{M.T=r,F.p=d}}(Dn&3)!==0&&Co(),nn(i),d=i.pendingLanes,(l&261930)!==0&&(d&42)!==0?i===fh?Bl++:(Bl=0,fh=i):Bl=0,Ll(0)}}function Jm(i,r){(i.pooledCacheLanes&=r)===0&&(r=i.pooledCache,r!=null&&(i.pooledCache=null,dl(r)))}function Co(){return Gm(),Zm(),Qm(),eg()}function eg(){if(wt!==5)return!1;var i=er,r=ch;ch=0;var l=Bu(Dn),u=M.T,d=F.p;try{F.p=32>l?32:l,M.T=null,l=hh,hh=null;var _=er,y=Dn;if(wt=0,Ds=er=null,Dn=0,(Ie&6)!==0)throw Error(s(331));var w=Ie;if(Ie|=4,Nm(_.current),Bm(_,_.current,y,l),Ie=w,Ll(0,!1),xt&&typeof xt.onPostCommitFiberRoot=="function")try{xt.onPostCommitFiberRoot(Jt,_)}catch{}return!0}finally{F.p=d,M.T=u,Jm(i,r)}}function tg(i,r,l){r=Ni(l,r),r=Wc(i.stateNode,r,2),i=Kn(i,r,2),i!==null&&(Js(i,2),nn(i))}function We(i,r,l){if(i.tag===3)tg(i,i,l);else for(;r!==null;){if(r.tag===3){tg(r,i,l);break}else if(r.tag===1){var u=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(Jn===null||!Jn.has(u))){i=Ni(l,i),l=im(2),u=Kn(r,l,2),u!==null&&(nm(l,u,r,i),Js(u,2),nn(u));break}}r=r.return}}function _h(i,r,l){var u=i.pingCache;if(u===null){u=i.pingCache=new S1;var d=new Set;u.set(r,d)}else d=u.get(r),d===void 0&&(d=new Set,u.set(r,d));d.has(l)||(ah=!0,d.add(l),i=k1.bind(null,i,r,l),r.then(i,i))}function k1(i,r,l){var u=i.pingCache;u!==null&&u.delete(r),i.pingedLanes|=i.suspendedLanes&l,i.warmLanes&=~l,Ze===i&&(ze&l)===l&&(ot===4||ot===3&&(ze&62914560)===ze&&300>Qt()-vo?(Ie&2)===0&&Rs(i,0):oh|=l,As===ze&&(As=0)),nn(i)}function ig(i,r){r===0&&(r=Gd()),i=wr(i,r),i!==null&&(Js(i,r),nn(i))}function E1(i){var r=i.memoizedState,l=0;r!==null&&(l=r.retryLane),ig(i,l)}function T1(i,r){var l=0;switch(i.tag){case 31:case 13:var u=i.stateNode,d=i.memoizedState;d!==null&&(l=d.retryLane);break;case 19:u=i.stateNode;break;case 22:u=i.stateNode._retryCache;break;default:throw Error(s(314))}u!==null&&u.delete(r),ig(i,l)}function A1(i,r){return Qr(i,r)}var ko=null,Bs=null,mh=!1,Eo=!1,gh=!1,ir=0;function nn(i){i!==Bs&&i.next===null&&(Bs===null?ko=Bs=i:Bs=Bs.next=i),Eo=!0,mh||(mh=!0,R1())}function Ll(i,r){if(!gh&&Eo){gh=!0;do for(var l=!1,u=ko;u!==null;){if(i!==0){var d=u.pendingLanes;if(d===0)var _=0;else{var y=u.suspendedLanes,w=u.pingedLanes;_=(1<<31-Ge(42|i)+1)-1,_&=d&~(y&~w),_=_&201326741?_&201326741|1:_?_|2:0}_!==0&&(l=!0,lg(u,_))}else _=ze,_=Da(u,u===Ze?_:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(_&3)===0||Qs(u,_)||(l=!0,lg(u,_));u=u.next}while(l);gh=!1}}function D1(){ng()}function ng(){Eo=mh=!1;var i=0;ir!==0&&P1()&&(i=ir);for(var r=Qt(),l=null,u=ko;u!==null;){var d=u.next,_=rg(u,r);_===0?(u.next=null,l===null?ko=d:l.next=d,d===null&&(Bs=l)):(l=u,(i!==0||(_&3)!==0)&&(Eo=!0)),u=d}wt!==0&&wt!==5||Ll(i),ir!==0&&(ir=0)}function rg(i,r){for(var l=i.suspendedLanes,u=i.pingedLanes,d=i.expirationTimes,_=i.pendingLanes&-62914561;0<_;){var y=31-Ge(_),w=1<<y,R=d[y];R===-1?((w&l)===0||(w&u)!==0)&&(d[y]=i0(w,r)):R<=r&&(i.expiredLanes|=w),_&=~w}if(r=Ze,l=ze,l=Da(i,i===r?l:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),u=i.callbackNode,l===0||i===r&&(qe===2||qe===9)||i.cancelPendingCommit!==null)return u!==null&&u!==null&&Zs(u),i.callbackNode=null,i.callbackPriority=0;if((l&3)===0||Qs(i,l)){if(r=l&-l,r===i.callbackPriority)return r;switch(u!==null&&Zs(u),Bu(l)){case 2:case 8:l=ce;break;case 32:l=Se;break;case 268435456:l=Fe;break;default:l=Se}return u=sg.bind(null,i),l=Qr(l,u),i.callbackPriority=r,i.callbackNode=l,r}return u!==null&&u!==null&&Zs(u),i.callbackPriority=2,i.callbackNode=null,2}function sg(i,r){if(wt!==0&&wt!==5)return i.callbackNode=null,i.callbackPriority=0,null;var l=i.callbackNode;if(Co()&&i.callbackNode!==l)return null;var u=ze;return u=Da(i,i===Ze?u:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),u===0?null:(Pm(i,u,r),rg(i,Qt()),i.callbackNode!=null&&i.callbackNode===l?sg.bind(null,i):null)}function lg(i,r){if(Co())return null;Pm(i,r,!0)}function R1(){F1(function(){(Ie&6)!==0?Qr(J,D1):ng()})}function vh(){if(ir===0){var i=gs;i===0&&(i=Ea,Ea<<=1,(Ea&261888)===0&&(Ea=256)),ir=i}return ir}function ag(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:La(""+i)}function og(i,r){var l=r.ownerDocument.createElement("input");return l.name=r.name,l.value=r.value,i.id&&l.setAttribute("form",i.id),r.parentNode.insertBefore(l,r),i=new FormData(i),l.parentNode.removeChild(l),i}function M1(i,r,l,u,d){if(r==="submit"&&l&&l.stateNode===d){var _=ag((d[oi]||null).action),y=u.submitter;y&&(r=(r=y[oi]||null)?ag(r.formAction):y.getAttribute("formAction"),r!==null&&(_=r,y=null));var w=new Ha("action","action",null,u,d);i.push({event:w,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(ir!==0){var R=y?og(d,y):new FormData(d);jc(l,{pending:!0,data:R,method:d.method,action:_},null,R)}}else typeof _=="function"&&(w.preventDefault(),R=y?og(d,y):new FormData(d),jc(l,{pending:!0,data:R,method:d.method,action:_},_,R))},currentTarget:d}]})}}for(var yh=0;yh<tc.length;yh++){var Sh=tc[yh],B1=Sh.toLowerCase(),L1=Sh[0].toUpperCase()+Sh.slice(1);Xi(B1,"on"+L1)}Xi(Up,"onAnimationEnd"),Xi(Pp,"onAnimationIteration"),Xi(Ip,"onAnimationStart"),Xi("dblclick","onDoubleClick"),Xi("focusin","onFocus"),Xi("focusout","onBlur"),Xi($0,"onTransitionRun"),Xi(G0,"onTransitionStart"),Xi(Z0,"onTransitionCancel"),Xi(Fp,"onTransitionEnd"),ns("onMouseEnter",["mouseout","mouseover"]),ns("onMouseLeave",["mouseout","mouseover"]),ns("onPointerEnter",["pointerout","pointerover"]),ns("onPointerLeave",["pointerout","pointerover"]),yr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),yr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),yr("onBeforeInput",["compositionend","keypress","textInput","paste"]),yr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),yr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),yr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var zl="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(" "),z1=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(zl));function ug(i,r){r=(r&4)!==0;for(var l=0;l<i.length;l++){var u=i[l],d=u.event;u=u.listeners;e:{var _=void 0;if(r)for(var y=u.length-1;0<=y;y--){var w=u[y],R=w.instance,I=w.currentTarget;if(w=w.listener,R!==_&&d.isPropagationStopped())break e;_=w,d.currentTarget=I;try{_(d)}catch(Z){Pa(Z)}d.currentTarget=null,_=R}else for(y=0;y<u.length;y++){if(w=u[y],R=w.instance,I=w.currentTarget,w=w.listener,R!==_&&d.isPropagationStopped())break e;_=w,d.currentTarget=I;try{_(d)}catch(Z){Pa(Z)}d.currentTarget=null,_=R}}}}function Be(i,r){var l=r[Lu];l===void 0&&(l=r[Lu]=new Set);var u=i+"__bubble";l.has(u)||(cg(r,i,2,!1),l.add(u))}function bh(i,r,l){var u=0;r&&(u|=4),cg(l,i,u,r)}var To="_reactListening"+Math.random().toString(36).slice(2);function xh(i){if(!i[To]){i[To]=!0,np.forEach(function(l){l!=="selectionchange"&&(z1.has(l)||bh(l,!1,i),bh(l,!0,i))});var r=i.nodeType===9?i:i.ownerDocument;r===null||r[To]||(r[To]=!0,bh("selectionchange",!1,r))}}function cg(i,r,l,u){switch(Ug(r)){case 2:var d=ox;break;case 8:d=ux;break;default:d=Hh}l=d.bind(null,r,l,i),d=void 0,!Fu||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(d=!0),u?d!==void 0?i.addEventListener(r,l,{capture:!0,passive:d}):i.addEventListener(r,l,!0):d!==void 0?i.addEventListener(r,l,{passive:d}):i.addEventListener(r,l,!1)}function wh(i,r,l,u,d){var _=u;if((r&1)===0&&(r&2)===0&&u!==null)e:for(;;){if(u===null)return;var y=u.tag;if(y===3||y===4){var w=u.stateNode.containerInfo;if(w===d)break;if(y===4)for(y=u.return;y!==null;){var R=y.tag;if((R===3||R===4)&&y.stateNode.containerInfo===d)return;y=y.return}for(;w!==null;){if(y=es(w),y===null)return;if(R=y.tag,R===5||R===6||R===26||R===27){u=_=y;continue e}w=w.parentNode}}u=u.return}_p(function(){var I=_,Z=Pu(l),te=[];e:{var W=qp.get(i);if(W!==void 0){var X=Ha,pe=i;switch(i){case"keypress":if(Na(l)===0)break e;case"keydown":case"keyup":X=T0;break;case"focusin":pe="focus",X=Vu;break;case"focusout":pe="blur",X=Vu;break;case"beforeblur":case"afterblur":X=Vu;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":X=vp;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":X=_0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":X=R0;break;case Up:case Pp:case Ip:X=v0;break;case Fp:X=B0;break;case"scroll":case"scrollend":X=d0;break;case"wheel":X=z0;break;case"copy":case"cut":case"paste":X=S0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":X=Sp;break;case"toggle":case"beforetoggle":X=O0}var ye=(r&4)!==0,Xe=!ye&&(i==="scroll"||i==="scrollend"),O=ye?W!==null?W+"Capture":null:W;ye=[];for(var L=I,P;L!==null;){var ee=L;if(P=ee.stateNode,ee=ee.tag,ee!==5&&ee!==26&&ee!==27||P===null||O===null||(ee=il(L,O),ee!=null&&ye.push(Nl(L,ee,P))),Xe)break;L=L.return}0<ye.length&&(W=new X(W,pe,null,l,Z),te.push({event:W,listeners:ye}))}}if((r&7)===0){e:{if(W=i==="mouseover"||i==="pointerover",X=i==="mouseout"||i==="pointerout",W&&l!==Uu&&(pe=l.relatedTarget||l.fromElement)&&(es(pe)||pe[Jr]))break e;if((X||W)&&(W=Z.window===Z?Z:(W=Z.ownerDocument)?W.defaultView||W.parentWindow:window,X?(pe=l.relatedTarget||l.toElement,X=I,pe=pe?es(pe):null,pe!==null&&(Xe=o(pe),ye=pe.tag,pe!==Xe||ye!==5&&ye!==27&&ye!==6)&&(pe=null)):(X=null,pe=I),X!==pe)){if(ye=vp,ee="onMouseLeave",O="onMouseEnter",L="mouse",(i==="pointerout"||i==="pointerover")&&(ye=Sp,ee="onPointerLeave",O="onPointerEnter",L="pointer"),Xe=X==null?W:tl(X),P=pe==null?W:tl(pe),W=new ye(ee,L+"leave",X,l,Z),W.target=Xe,W.relatedTarget=P,ee=null,es(Z)===I&&(ye=new ye(O,L+"enter",pe,l,Z),ye.target=P,ye.relatedTarget=Xe,ee=ye),Xe=ee,X&&pe)t:{for(ye=N1,O=X,L=pe,P=0,ee=O;ee;ee=ye(ee))P++;ee=0;for(var ge=L;ge;ge=ye(ge))ee++;for(;0<P-ee;)O=ye(O),P--;for(;0<ee-P;)L=ye(L),ee--;for(;P--;){if(O===L||L!==null&&O===L.alternate){ye=O;break t}O=ye(O),L=ye(L)}ye=null}else ye=null;X!==null&&hg(te,W,X,ye,!1),pe!==null&&Xe!==null&&hg(te,Xe,pe,ye,!0)}}e:{if(W=I?tl(I):window,X=W.nodeName&&W.nodeName.toLowerCase(),X==="select"||X==="input"&&W.type==="file")var Ue=Ap;else if(Ep(W))if(Dp)Ue=V0;else{Ue=W0;var me=q0}else X=W.nodeName,!X||X.toLowerCase()!=="input"||W.type!=="checkbox"&&W.type!=="radio"?I&&ju(I.elementType)&&(Ue=Ap):Ue=Y0;if(Ue&&(Ue=Ue(i,I))){Tp(te,Ue,l,Z);break e}me&&me(i,W,I),i==="focusout"&&I&&W.type==="number"&&I.memoizedProps.value!=null&&Hu(W,"number",W.value)}switch(me=I?tl(I):window,i){case"focusin":(Ep(me)||me.contentEditable==="true")&&(us=me,Qu=I,cl=null);break;case"focusout":cl=Qu=us=null;break;case"mousedown":Ju=!0;break;case"contextmenu":case"mouseup":case"dragend":Ju=!1,Hp(te,l,Z);break;case"selectionchange":if(X0)break;case"keydown":case"keyup":Hp(te,l,Z)}var ke;if(Xu)e:{switch(i){case"compositionstart":var Ne="onCompositionStart";break e;case"compositionend":Ne="onCompositionEnd";break e;case"compositionupdate":Ne="onCompositionUpdate";break e}Ne=void 0}else os?Cp(i,l)&&(Ne="onCompositionEnd"):i==="keydown"&&l.keyCode===229&&(Ne="onCompositionStart");Ne&&(bp&&l.locale!=="ko"&&(os||Ne!=="onCompositionStart"?Ne==="onCompositionEnd"&&os&&(ke=mp()):(Pn=Z,qu="value"in Pn?Pn.value:Pn.textContent,os=!0)),me=Ao(I,Ne),0<me.length&&(Ne=new yp(Ne,i,null,l,Z),te.push({event:Ne,listeners:me}),ke?Ne.data=ke:(ke=kp(l),ke!==null&&(Ne.data=ke)))),(ke=j0?U0(i,l):P0(i,l))&&(Ne=Ao(I,"onBeforeInput"),0<Ne.length&&(me=new yp("onBeforeInput","beforeinput",null,l,Z),te.push({event:me,listeners:Ne}),me.data=ke)),M1(te,i,I,l,Z)}ug(te,r)})}function Nl(i,r,l){return{instance:i,listener:r,currentTarget:l}}function Ao(i,r){for(var l=r+"Capture",u=[];i!==null;){var d=i,_=d.stateNode;if(d=d.tag,d!==5&&d!==26&&d!==27||_===null||(d=il(i,l),d!=null&&u.unshift(Nl(i,d,_)),d=il(i,r),d!=null&&u.push(Nl(i,d,_))),i.tag===3)return u;i=i.return}return[]}function N1(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function hg(i,r,l,u,d){for(var _=r._reactName,y=[];l!==null&&l!==u;){var w=l,R=w.alternate,I=w.stateNode;if(w=w.tag,R!==null&&R===u)break;w!==5&&w!==26&&w!==27||I===null||(R=I,d?(I=il(l,_),I!=null&&y.unshift(Nl(l,I,R))):d||(I=il(l,_),I!=null&&y.push(Nl(l,I,R)))),l=l.return}y.length!==0&&i.push({event:r,listeners:y})}var O1=/\r\n?/g,H1=/\u0000|\uFFFD/g;function fg(i){return(typeof i=="string"?i:""+i).replace(O1,`
49
- `).replace(H1,"")}function dg(i,r){return r=fg(r),fg(i)===r}function Ke(i,r,l,u,d,_){switch(l){case"children":typeof u=="string"?r==="body"||r==="textarea"&&u===""||ss(i,u):(typeof u=="number"||typeof u=="bigint")&&r!=="body"&&ss(i,""+u);break;case"className":Ma(i,"class",u);break;case"tabIndex":Ma(i,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":Ma(i,l,u);break;case"style":dp(i,u,_);break;case"data":if(r!=="object"){Ma(i,"data",u);break}case"src":case"href":if(u===""&&(r!=="a"||l!=="href")){i.removeAttribute(l);break}if(u==null||typeof u=="function"||typeof u=="symbol"||typeof u=="boolean"){i.removeAttribute(l);break}u=La(""+u),i.setAttribute(l,u);break;case"action":case"formAction":if(typeof u=="function"){i.setAttribute(l,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof _=="function"&&(l==="formAction"?(r!=="input"&&Ke(i,r,"name",d.name,d,null),Ke(i,r,"formEncType",d.formEncType,d,null),Ke(i,r,"formMethod",d.formMethod,d,null),Ke(i,r,"formTarget",d.formTarget,d,null)):(Ke(i,r,"encType",d.encType,d,null),Ke(i,r,"method",d.method,d,null),Ke(i,r,"target",d.target,d,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){i.removeAttribute(l);break}u=La(""+u),i.setAttribute(l,u);break;case"onClick":u!=null&&(i.onclick=pn);break;case"onScroll":u!=null&&Be("scroll",i);break;case"onScrollEnd":u!=null&&Be("scrollend",i);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(s(61));if(l=u.__html,l!=null){if(d.children!=null)throw Error(s(60));i.innerHTML=l}}break;case"multiple":i.multiple=u&&typeof u!="function"&&typeof u!="symbol";break;case"muted":i.muted=u&&typeof u!="function"&&typeof u!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(u==null||typeof u=="function"||typeof u=="boolean"||typeof u=="symbol"){i.removeAttribute("xlink:href");break}l=La(""+u),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":u!=null&&typeof u!="function"&&typeof u!="symbol"?i.setAttribute(l,""+u):i.removeAttribute(l);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":u&&typeof u!="function"&&typeof u!="symbol"?i.setAttribute(l,""):i.removeAttribute(l);break;case"capture":case"download":u===!0?i.setAttribute(l,""):u!==!1&&u!=null&&typeof u!="function"&&typeof u!="symbol"?i.setAttribute(l,u):i.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":u!=null&&typeof u!="function"&&typeof u!="symbol"&&!isNaN(u)&&1<=u?i.setAttribute(l,u):i.removeAttribute(l);break;case"rowSpan":case"start":u==null||typeof u=="function"||typeof u=="symbol"||isNaN(u)?i.removeAttribute(l):i.setAttribute(l,u);break;case"popover":Be("beforetoggle",i),Be("toggle",i),Ra(i,"popover",u);break;case"xlinkActuate":dn(i,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":dn(i,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":dn(i,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":dn(i,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":dn(i,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":dn(i,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":dn(i,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":dn(i,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":dn(i,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":Ra(i,"is",u);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=h0.get(l)||l,Ra(i,l,u))}}function Ch(i,r,l,u,d,_){switch(l){case"style":dp(i,u,_);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(s(61));if(l=u.__html,l!=null){if(d.children!=null)throw Error(s(60));i.innerHTML=l}}break;case"children":typeof u=="string"?ss(i,u):(typeof u=="number"||typeof u=="bigint")&&ss(i,""+u);break;case"onScroll":u!=null&&Be("scroll",i);break;case"onScrollEnd":u!=null&&Be("scrollend",i);break;case"onClick":u!=null&&(i.onclick=pn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!rp.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(d=l.endsWith("Capture"),r=l.slice(2,d?l.length-7:void 0),_=i[oi]||null,_=_!=null?_[l]:null,typeof _=="function"&&i.removeEventListener(r,_,d),typeof u=="function")){typeof _!="function"&&_!==null&&(l in i?i[l]=null:i.hasAttribute(l)&&i.removeAttribute(l)),i.addEventListener(r,u,d);break e}l in i?i[l]=u:u===!0?i.setAttribute(l,""):Ra(i,l,u)}}}function Ft(i,r,l){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Be("error",i),Be("load",i);var u=!1,d=!1,_;for(_ in l)if(l.hasOwnProperty(_)){var y=l[_];if(y!=null)switch(_){case"src":u=!0;break;case"srcSet":d=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,r));default:Ke(i,r,_,y,l,null)}}d&&Ke(i,r,"srcSet",l.srcSet,l,null),u&&Ke(i,r,"src",l.src,l,null);return;case"input":Be("invalid",i);var w=_=y=d=null,R=null,I=null;for(u in l)if(l.hasOwnProperty(u)){var Z=l[u];if(Z!=null)switch(u){case"name":d=Z;break;case"type":y=Z;break;case"checked":R=Z;break;case"defaultChecked":I=Z;break;case"value":_=Z;break;case"defaultValue":w=Z;break;case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(s(137,r));break;default:Ke(i,r,u,Z,l,null)}}up(i,_,w,R,I,y,d,!1);return;case"select":Be("invalid",i),u=y=_=null;for(d in l)if(l.hasOwnProperty(d)&&(w=l[d],w!=null))switch(d){case"value":_=w;break;case"defaultValue":y=w;break;case"multiple":u=w;default:Ke(i,r,d,w,l,null)}r=_,l=y,i.multiple=!!u,r!=null?rs(i,!!u,r,!1):l!=null&&rs(i,!!u,l,!0);return;case"textarea":Be("invalid",i),_=d=u=null;for(y in l)if(l.hasOwnProperty(y)&&(w=l[y],w!=null))switch(y){case"value":u=w;break;case"defaultValue":d=w;break;case"children":_=w;break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(s(91));break;default:Ke(i,r,y,w,l,null)}hp(i,u,d,_);return;case"option":for(R in l)if(l.hasOwnProperty(R)&&(u=l[R],u!=null))switch(R){case"selected":i.selected=u&&typeof u!="function"&&typeof u!="symbol";break;default:Ke(i,r,R,u,l,null)}return;case"dialog":Be("beforetoggle",i),Be("toggle",i),Be("cancel",i),Be("close",i);break;case"iframe":case"object":Be("load",i);break;case"video":case"audio":for(u=0;u<zl.length;u++)Be(zl[u],i);break;case"image":Be("error",i),Be("load",i);break;case"details":Be("toggle",i);break;case"embed":case"source":case"link":Be("error",i),Be("load",i);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(I in l)if(l.hasOwnProperty(I)&&(u=l[I],u!=null))switch(I){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,r));default:Ke(i,r,I,u,l,null)}return;default:if(ju(r)){for(Z in l)l.hasOwnProperty(Z)&&(u=l[Z],u!==void 0&&Ch(i,r,Z,u,l,void 0));return}}for(w in l)l.hasOwnProperty(w)&&(u=l[w],u!=null&&Ke(i,r,w,u,l,null))}function j1(i,r,l,u){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var d=null,_=null,y=null,w=null,R=null,I=null,Z=null;for(X in l){var te=l[X];if(l.hasOwnProperty(X)&&te!=null)switch(X){case"checked":break;case"value":break;case"defaultValue":R=te;default:u.hasOwnProperty(X)||Ke(i,r,X,null,u,te)}}for(var W in u){var X=u[W];if(te=l[W],u.hasOwnProperty(W)&&(X!=null||te!=null))switch(W){case"type":_=X;break;case"name":d=X;break;case"checked":I=X;break;case"defaultChecked":Z=X;break;case"value":y=X;break;case"defaultValue":w=X;break;case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(s(137,r));break;default:X!==te&&Ke(i,r,W,X,u,te)}}Ou(i,y,w,R,I,Z,_,d);return;case"select":X=y=w=W=null;for(_ in l)if(R=l[_],l.hasOwnProperty(_)&&R!=null)switch(_){case"value":break;case"multiple":X=R;default:u.hasOwnProperty(_)||Ke(i,r,_,null,u,R)}for(d in u)if(_=u[d],R=l[d],u.hasOwnProperty(d)&&(_!=null||R!=null))switch(d){case"value":W=_;break;case"defaultValue":w=_;break;case"multiple":y=_;default:_!==R&&Ke(i,r,d,_,u,R)}r=w,l=y,u=X,W!=null?rs(i,!!l,W,!1):!!u!=!!l&&(r!=null?rs(i,!!l,r,!0):rs(i,!!l,l?[]:"",!1));return;case"textarea":X=W=null;for(w in l)if(d=l[w],l.hasOwnProperty(w)&&d!=null&&!u.hasOwnProperty(w))switch(w){case"value":break;case"children":break;default:Ke(i,r,w,null,u,d)}for(y in u)if(d=u[y],_=l[y],u.hasOwnProperty(y)&&(d!=null||_!=null))switch(y){case"value":W=d;break;case"defaultValue":X=d;break;case"children":break;case"dangerouslySetInnerHTML":if(d!=null)throw Error(s(91));break;default:d!==_&&Ke(i,r,y,d,u,_)}cp(i,W,X);return;case"option":for(var pe in l)if(W=l[pe],l.hasOwnProperty(pe)&&W!=null&&!u.hasOwnProperty(pe))switch(pe){case"selected":i.selected=!1;break;default:Ke(i,r,pe,null,u,W)}for(R in u)if(W=u[R],X=l[R],u.hasOwnProperty(R)&&W!==X&&(W!=null||X!=null))switch(R){case"selected":i.selected=W&&typeof W!="function"&&typeof W!="symbol";break;default:Ke(i,r,R,W,u,X)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var ye in l)W=l[ye],l.hasOwnProperty(ye)&&W!=null&&!u.hasOwnProperty(ye)&&Ke(i,r,ye,null,u,W);for(I in u)if(W=u[I],X=l[I],u.hasOwnProperty(I)&&W!==X&&(W!=null||X!=null))switch(I){case"children":case"dangerouslySetInnerHTML":if(W!=null)throw Error(s(137,r));break;default:Ke(i,r,I,W,u,X)}return;default:if(ju(r)){for(var Xe in l)W=l[Xe],l.hasOwnProperty(Xe)&&W!==void 0&&!u.hasOwnProperty(Xe)&&Ch(i,r,Xe,void 0,u,W);for(Z in u)W=u[Z],X=l[Z],!u.hasOwnProperty(Z)||W===X||W===void 0&&X===void 0||Ch(i,r,Z,W,u,X);return}}for(var O in l)W=l[O],l.hasOwnProperty(O)&&W!=null&&!u.hasOwnProperty(O)&&Ke(i,r,O,null,u,W);for(te in u)W=u[te],X=l[te],!u.hasOwnProperty(te)||W===X||W==null&&X==null||Ke(i,r,te,W,u,X)}function pg(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function U1(){if(typeof performance.getEntriesByType=="function"){for(var i=0,r=0,l=performance.getEntriesByType("resource"),u=0;u<l.length;u++){var d=l[u],_=d.transferSize,y=d.initiatorType,w=d.duration;if(_&&w&&pg(y)){for(y=0,w=d.responseEnd,u+=1;u<l.length;u++){var R=l[u],I=R.startTime;if(I>w)break;var Z=R.transferSize,te=R.initiatorType;Z&&pg(te)&&(R=R.responseEnd,y+=Z*(R<w?1:(w-I)/(R-I)))}if(--u,r+=8*(_+y)/(d.duration/1e3),i++,10<i)break}}if(0<i)return r/i/1e6}return navigator.connection&&(i=navigator.connection.downlink,typeof i=="number")?i:5}var kh=null,Eh=null;function Do(i){return i.nodeType===9?i:i.ownerDocument}function _g(i){switch(i){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function mg(i,r){if(i===0)switch(r){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&r==="foreignObject"?0:i}function Th(i,r){return i==="textarea"||i==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.children=="bigint"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var Ah=null;function P1(){var i=window.event;return i&&i.type==="popstate"?i===Ah?!1:(Ah=i,!0):(Ah=null,!1)}var gg=typeof setTimeout=="function"?setTimeout:void 0,I1=typeof clearTimeout=="function"?clearTimeout:void 0,vg=typeof Promise=="function"?Promise:void 0,F1=typeof queueMicrotask=="function"?queueMicrotask:typeof vg<"u"?function(i){return vg.resolve(null).then(i).catch(q1)}:gg;function q1(i){setTimeout(function(){throw i})}function nr(i){return i==="head"}function yg(i,r){var l=r,u=0;do{var d=l.nextSibling;if(i.removeChild(l),d&&d.nodeType===8)if(l=d.data,l==="/$"||l==="/&"){if(u===0){i.removeChild(d),Os(r);return}u--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")u++;else if(l==="html")Ol(i.ownerDocument.documentElement);else if(l==="head"){l=i.ownerDocument.head,Ol(l);for(var _=l.firstChild;_;){var y=_.nextSibling,w=_.nodeName;_[el]||w==="SCRIPT"||w==="STYLE"||w==="LINK"&&_.rel.toLowerCase()==="stylesheet"||l.removeChild(_),_=y}}else l==="body"&&Ol(i.ownerDocument.body);l=d}while(l);Os(r)}function Sg(i,r){var l=i;i=0;do{var u=l.nextSibling;if(l.nodeType===1?r?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(r?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),u&&u.nodeType===8)if(l=u.data,l==="/$"){if(i===0)break;i--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||i++;l=u}while(l)}function Dh(i){var r=i.firstChild;for(r&&r.nodeType===10&&(r=r.nextSibling);r;){var l=r;switch(r=r.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":Dh(l),zu(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}i.removeChild(l)}}function W1(i,r,l,u){for(;i.nodeType===1;){var d=l;if(i.nodeName.toLowerCase()!==r.toLowerCase()){if(!u&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(u){if(!i[el])switch(r){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(_=i.getAttribute("rel"),_==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(_!==d.rel||i.getAttribute("href")!==(d.href==null||d.href===""?null:d.href)||i.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin)||i.getAttribute("title")!==(d.title==null?null:d.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(_=i.getAttribute("src"),(_!==(d.src==null?null:d.src)||i.getAttribute("type")!==(d.type==null?null:d.type)||i.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin))&&_&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(r==="input"&&i.type==="hidden"){var _=d.name==null?null:""+d.name;if(d.type==="hidden"&&i.getAttribute("name")===_)return i}else return i;if(i=Pi(i.nextSibling),i===null)break}return null}function Y1(i,r,l){if(r==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!l||(i=Pi(i.nextSibling),i===null))return null;return i}function bg(i,r){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!r||(i=Pi(i.nextSibling),i===null))return null;return i}function Rh(i){return i.data==="$?"||i.data==="$~"}function Mh(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function V1(i,r){var l=i.ownerDocument;if(i.data==="$~")i._reactRetry=r;else if(i.data!=="$?"||l.readyState!=="loading")r();else{var u=function(){r(),l.removeEventListener("DOMContentLoaded",u)};l.addEventListener("DOMContentLoaded",u),i._reactRetry=u}}function Pi(i){for(;i!=null;i=i.nextSibling){var r=i.nodeType;if(r===1||r===3)break;if(r===8){if(r=i.data,r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"||r==="F!"||r==="F")break;if(r==="/$"||r==="/&")return null}}return i}var Bh=null;function xg(i){i=i.nextSibling;for(var r=0;i;){if(i.nodeType===8){var l=i.data;if(l==="/$"||l==="/&"){if(r===0)return Pi(i.nextSibling);r--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||r++}i=i.nextSibling}return null}function wg(i){i=i.previousSibling;for(var r=0;i;){if(i.nodeType===8){var l=i.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(r===0)return i;r--}else l!=="/$"&&l!=="/&"||r++}i=i.previousSibling}return null}function Cg(i,r,l){switch(r=Do(l),i){case"html":if(i=r.documentElement,!i)throw Error(s(452));return i;case"head":if(i=r.head,!i)throw Error(s(453));return i;case"body":if(i=r.body,!i)throw Error(s(454));return i;default:throw Error(s(451))}}function Ol(i){for(var r=i.attributes;r.length;)i.removeAttributeNode(r[0]);zu(i)}var Ii=new Map,kg=new Set;function Ro(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var Rn=F.d;F.d={f:K1,r:X1,D:$1,C:G1,L:Z1,m:Q1,X:ex,S:J1,M:tx};function K1(){var i=Rn.f(),r=bo();return i||r}function X1(i){var r=ts(i);r!==null&&r.tag===5&&r.type==="form"?F_(r):Rn.r(i)}var Ls=typeof document>"u"?null:document;function Eg(i,r,l){var u=Ls;if(u&&typeof r=="string"&&r){var d=Li(r);d='link[rel="'+i+'"][href="'+d+'"]',typeof l=="string"&&(d+='[crossorigin="'+l+'"]'),kg.has(d)||(kg.add(d),i={rel:i,crossOrigin:l,href:r},u.querySelector(d)===null&&(r=u.createElement("link"),Ft(r,"link",i),Tt(r),u.head.appendChild(r)))}}function $1(i){Rn.D(i),Eg("dns-prefetch",i,null)}function G1(i,r){Rn.C(i,r),Eg("preconnect",i,r)}function Z1(i,r,l){Rn.L(i,r,l);var u=Ls;if(u&&i&&r){var d='link[rel="preload"][as="'+Li(r)+'"]';r==="image"&&l&&l.imageSrcSet?(d+='[imagesrcset="'+Li(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(d+='[imagesizes="'+Li(l.imageSizes)+'"]')):d+='[href="'+Li(i)+'"]';var _=d;switch(r){case"style":_=zs(i);break;case"script":_=Ns(i)}Ii.has(_)||(i=m({rel:"preload",href:r==="image"&&l&&l.imageSrcSet?void 0:i,as:r},l),Ii.set(_,i),u.querySelector(d)!==null||r==="style"&&u.querySelector(Hl(_))||r==="script"&&u.querySelector(jl(_))||(r=u.createElement("link"),Ft(r,"link",i),Tt(r),u.head.appendChild(r)))}}function Q1(i,r){Rn.m(i,r);var l=Ls;if(l&&i){var u=r&&typeof r.as=="string"?r.as:"script",d='link[rel="modulepreload"][as="'+Li(u)+'"][href="'+Li(i)+'"]',_=d;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":_=Ns(i)}if(!Ii.has(_)&&(i=m({rel:"modulepreload",href:i},r),Ii.set(_,i),l.querySelector(d)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(jl(_)))return}u=l.createElement("link"),Ft(u,"link",i),Tt(u),l.head.appendChild(u)}}}function J1(i,r,l){Rn.S(i,r,l);var u=Ls;if(u&&i){var d=is(u).hoistableStyles,_=zs(i);r=r||"default";var y=d.get(_);if(!y){var w={loading:0,preload:null};if(y=u.querySelector(Hl(_)))w.loading=5;else{i=m({rel:"stylesheet",href:i,"data-precedence":r},l),(l=Ii.get(_))&&Lh(i,l);var R=y=u.createElement("link");Tt(R),Ft(R,"link",i),R._p=new Promise(function(I,Z){R.onload=I,R.onerror=Z}),R.addEventListener("load",function(){w.loading|=1}),R.addEventListener("error",function(){w.loading|=2}),w.loading|=4,Mo(y,r,u)}y={type:"stylesheet",instance:y,count:1,state:w},d.set(_,y)}}}function ex(i,r){Rn.X(i,r);var l=Ls;if(l&&i){var u=is(l).hoistableScripts,d=Ns(i),_=u.get(d);_||(_=l.querySelector(jl(d)),_||(i=m({src:i,async:!0},r),(r=Ii.get(d))&&zh(i,r),_=l.createElement("script"),Tt(_),Ft(_,"link",i),l.head.appendChild(_)),_={type:"script",instance:_,count:1,state:null},u.set(d,_))}}function tx(i,r){Rn.M(i,r);var l=Ls;if(l&&i){var u=is(l).hoistableScripts,d=Ns(i),_=u.get(d);_||(_=l.querySelector(jl(d)),_||(i=m({src:i,async:!0,type:"module"},r),(r=Ii.get(d))&&zh(i,r),_=l.createElement("script"),Tt(_),Ft(_,"link",i),l.head.appendChild(_)),_={type:"script",instance:_,count:1,state:null},u.set(d,_))}}function Tg(i,r,l,u){var d=(d=de.current)?Ro(d):null;if(!d)throw Error(s(446));switch(i){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(r=zs(l.href),l=is(d).hoistableStyles,u=l.get(r),u||(u={type:"style",instance:null,count:0,state:null},l.set(r,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){i=zs(l.href);var _=is(d).hoistableStyles,y=_.get(i);if(y||(d=d.ownerDocument||d,y={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},_.set(i,y),(_=d.querySelector(Hl(i)))&&!_._p&&(y.instance=_,y.state.loading=5),Ii.has(i)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},Ii.set(i,l),_||ix(d,i,l,y.state))),r&&u===null)throw Error(s(528,""));return y}if(r&&u!==null)throw Error(s(529,""));return null;case"script":return r=l.async,l=l.src,typeof l=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=Ns(l),l=is(d).hoistableScripts,u=l.get(r),u||(u={type:"script",instance:null,count:0,state:null},l.set(r,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,i))}}function zs(i){return'href="'+Li(i)+'"'}function Hl(i){return'link[rel="stylesheet"]['+i+"]"}function Ag(i){return m({},i,{"data-precedence":i.precedence,precedence:null})}function ix(i,r,l,u){i.querySelector('link[rel="preload"][as="style"]['+r+"]")?u.loading=1:(r=i.createElement("link"),u.preload=r,r.addEventListener("load",function(){return u.loading|=1}),r.addEventListener("error",function(){return u.loading|=2}),Ft(r,"link",l),Tt(r),i.head.appendChild(r))}function Ns(i){return'[src="'+Li(i)+'"]'}function jl(i){return"script[async]"+i}function Dg(i,r,l){if(r.count++,r.instance===null)switch(r.type){case"style":var u=i.querySelector('style[data-href~="'+Li(l.href)+'"]');if(u)return r.instance=u,Tt(u),u;var d=m({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return u=(i.ownerDocument||i).createElement("style"),Tt(u),Ft(u,"style",d),Mo(u,l.precedence,i),r.instance=u;case"stylesheet":d=zs(l.href);var _=i.querySelector(Hl(d));if(_)return r.state.loading|=4,r.instance=_,Tt(_),_;u=Ag(l),(d=Ii.get(d))&&Lh(u,d),_=(i.ownerDocument||i).createElement("link"),Tt(_);var y=_;return y._p=new Promise(function(w,R){y.onload=w,y.onerror=R}),Ft(_,"link",u),r.state.loading|=4,Mo(_,l.precedence,i),r.instance=_;case"script":return _=Ns(l.src),(d=i.querySelector(jl(_)))?(r.instance=d,Tt(d),d):(u=l,(d=Ii.get(_))&&(u=m({},l),zh(u,d)),i=i.ownerDocument||i,d=i.createElement("script"),Tt(d),Ft(d,"link",u),i.head.appendChild(d),r.instance=d);case"void":return null;default:throw Error(s(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(u=r.instance,r.state.loading|=4,Mo(u,l.precedence,i));return r.instance}function Mo(i,r,l){for(var u=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),d=u.length?u[u.length-1]:null,_=d,y=0;y<u.length;y++){var w=u[y];if(w.dataset.precedence===r)_=w;else if(_!==d)break}_?_.parentNode.insertBefore(i,_.nextSibling):(r=l.nodeType===9?l.head:l,r.insertBefore(i,r.firstChild))}function Lh(i,r){i.crossOrigin==null&&(i.crossOrigin=r.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=r.referrerPolicy),i.title==null&&(i.title=r.title)}function zh(i,r){i.crossOrigin==null&&(i.crossOrigin=r.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=r.referrerPolicy),i.integrity==null&&(i.integrity=r.integrity)}var Bo=null;function Rg(i,r,l){if(Bo===null){var u=new Map,d=Bo=new Map;d.set(l,u)}else d=Bo,u=d.get(l),u||(u=new Map,d.set(l,u));if(u.has(i))return u;for(u.set(i,null),l=l.getElementsByTagName(i),d=0;d<l.length;d++){var _=l[d];if(!(_[el]||_[jt]||i==="link"&&_.getAttribute("rel")==="stylesheet")&&_.namespaceURI!=="http://www.w3.org/2000/svg"){var y=_.getAttribute(r)||"";y=i+y;var w=u.get(y);w?w.push(_):u.set(y,[_])}}return u}function Mg(i,r,l){i=i.ownerDocument||i,i.head.insertBefore(l,r==="title"?i.querySelector("head > title"):null)}function nx(i,r,l){if(l===1||r.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;switch(r.rel){case"stylesheet":return i=r.disabled,typeof r.precedence=="string"&&i==null;default:return!0}case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function Bg(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function rx(i,r,l,u){if(l.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var d=zs(u.href),_=r.querySelector(Hl(d));if(_){r=_._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(i.count++,i=Lo.bind(i),r.then(i,i)),l.state.loading|=4,l.instance=_,Tt(_);return}_=r.ownerDocument||r,u=Ag(u),(d=Ii.get(d))&&Lh(u,d),_=_.createElement("link"),Tt(_);var y=_;y._p=new Promise(function(w,R){y.onload=w,y.onerror=R}),Ft(_,"link",u),l.instance=_}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(l,r),(r=l.state.preload)&&(l.state.loading&3)===0&&(i.count++,l=Lo.bind(i),r.addEventListener("load",l),r.addEventListener("error",l))}}var Nh=0;function sx(i,r){return i.stylesheets&&i.count===0&&No(i,i.stylesheets),0<i.count||0<i.imgCount?function(l){var u=setTimeout(function(){if(i.stylesheets&&No(i,i.stylesheets),i.unsuspend){var _=i.unsuspend;i.unsuspend=null,_()}},6e4+r);0<i.imgBytes&&Nh===0&&(Nh=62500*U1());var d=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&No(i,i.stylesheets),i.unsuspend)){var _=i.unsuspend;i.unsuspend=null,_()}},(i.imgBytes>Nh?50:800)+r);return i.unsuspend=l,function(){i.unsuspend=null,clearTimeout(u),clearTimeout(d)}}:null}function Lo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)No(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var zo=null;function No(i,r){i.stylesheets=null,i.unsuspend!==null&&(i.count++,zo=new Map,r.forEach(lx,i),zo=null,Lo.call(i))}function lx(i,r){if(!(r.state.loading&4)){var l=zo.get(i);if(l)var u=l.get(null);else{l=new Map,zo.set(i,l);for(var d=i.querySelectorAll("link[data-precedence],style[data-precedence]"),_=0;_<d.length;_++){var y=d[_];(y.nodeName==="LINK"||y.getAttribute("media")!=="not all")&&(l.set(y.dataset.precedence,y),u=y)}u&&l.set(null,u)}d=r.instance,y=d.getAttribute("data-precedence"),_=l.get(y)||u,_===u&&l.set(null,d),l.set(y,d),this.count++,u=Lo.bind(this),d.addEventListener("load",u),d.addEventListener("error",u),_?_.parentNode.insertBefore(d,_.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(d,i.firstChild)),r.state.loading|=4}}var Ul={$$typeof:A,Provider:null,Consumer:null,_currentValue:V,_currentValue2:V,_threadCount:0};function ax(i,r,l,u,d,_,y,w,R){this.tag=1,this.containerInfo=i,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ru(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ru(0),this.hiddenUpdates=Ru(null),this.identifierPrefix=u,this.onUncaughtError=d,this.onCaughtError=_,this.onRecoverableError=y,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=R,this.incompleteTransitions=new Map}function Lg(i,r,l,u,d,_,y,w,R,I,Z,te){return i=new ax(i,r,l,y,R,I,Z,te,w),r=1,_===!0&&(r|=24),_=bi(3,null,null,r),i.current=_,_.stateNode=i,r=pc(),r.refCount++,i.pooledCache=r,r.refCount++,_.memoizedState={element:u,isDehydrated:l,cache:r},vc(_),i}function zg(i){return i?(i=fs,i):fs}function Ng(i,r,l,u,d,_){d=zg(d),u.context===null?u.context=d:u.pendingContext=d,u=Vn(r),u.payload={element:l},_=_===void 0?null:_,_!==null&&(u.callback=_),l=Kn(i,u,r),l!==null&&(pi(l,i,r),gl(l,i,r))}function Og(i,r){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var l=i.retryLane;i.retryLane=l!==0&&l<r?l:r}}function Oh(i,r){Og(i,r),(i=i.alternate)&&Og(i,r)}function Hg(i){if(i.tag===13||i.tag===31){var r=wr(i,67108864);r!==null&&pi(r,i,67108864),Oh(i,67108864)}}function jg(i){if(i.tag===13||i.tag===31){var r=Ei();r=Mu(r);var l=wr(i,r);l!==null&&pi(l,i,r),Oh(i,r)}}var Oo=!0;function ox(i,r,l,u){var d=M.T;M.T=null;var _=F.p;try{F.p=2,Hh(i,r,l,u)}finally{F.p=_,M.T=d}}function ux(i,r,l,u){var d=M.T;M.T=null;var _=F.p;try{F.p=8,Hh(i,r,l,u)}finally{F.p=_,M.T=d}}function Hh(i,r,l,u){if(Oo){var d=jh(u);if(d===null)wh(i,r,u,Ho,l),Pg(i,u);else if(hx(d,i,r,l,u))u.stopPropagation();else if(Pg(i,u),r&4&&-1<cx.indexOf(i)){for(;d!==null;){var _=ts(d);if(_!==null)switch(_.tag){case 3:if(_=_.stateNode,_.current.memoizedState.isDehydrated){var y=vr(_.pendingLanes);if(y!==0){var w=_;for(w.pendingLanes|=2,w.entangledLanes|=2;y;){var R=1<<31-Ge(y);w.entanglements[1]|=R,y&=~R}nn(_),(Ie&6)===0&&(yo=Qt()+500,Ll(0))}}break;case 31:case 13:w=wr(_,2),w!==null&&pi(w,_,2),bo(),Oh(_,2)}if(_=jh(u),_===null&&wh(i,r,u,Ho,l),_===d)break;d=_}d!==null&&u.stopPropagation()}else wh(i,r,u,null,l)}}function jh(i){return i=Pu(i),Uh(i)}var Ho=null;function Uh(i){if(Ho=null,i=es(i),i!==null){var r=o(i);if(r===null)i=null;else{var l=r.tag;if(l===13){if(i=c(r),i!==null)return i;i=null}else if(l===31){if(i=f(r),i!==null)return i;i=null}else if(l===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;i=null}else r!==i&&(i=null)}}return Ho=i,null}function Ug(i){switch(i){case"beforetoggle":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"toggle":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 2;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"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Du()){case J:return 2;case ce:return 8;case Se:case Re:return 32;case Fe:return 268435456;default:return 32}default:return 32}}var Ph=!1,rr=null,sr=null,lr=null,Pl=new Map,Il=new Map,ar=[],cx="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".split(" ");function Pg(i,r){switch(i){case"focusin":case"focusout":rr=null;break;case"dragenter":case"dragleave":sr=null;break;case"mouseover":case"mouseout":lr=null;break;case"pointerover":case"pointerout":Pl.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":Il.delete(r.pointerId)}}function Fl(i,r,l,u,d,_){return i===null||i.nativeEvent!==_?(i={blockedOn:r,domEventName:l,eventSystemFlags:u,nativeEvent:_,targetContainers:[d]},r!==null&&(r=ts(r),r!==null&&Hg(r)),i):(i.eventSystemFlags|=u,r=i.targetContainers,d!==null&&r.indexOf(d)===-1&&r.push(d),i)}function hx(i,r,l,u,d){switch(r){case"focusin":return rr=Fl(rr,i,r,l,u,d),!0;case"dragenter":return sr=Fl(sr,i,r,l,u,d),!0;case"mouseover":return lr=Fl(lr,i,r,l,u,d),!0;case"pointerover":var _=d.pointerId;return Pl.set(_,Fl(Pl.get(_)||null,i,r,l,u,d)),!0;case"gotpointercapture":return _=d.pointerId,Il.set(_,Fl(Il.get(_)||null,i,r,l,u,d)),!0}return!1}function Ig(i){var r=es(i.target);if(r!==null){var l=o(r);if(l!==null){if(r=l.tag,r===13){if(r=c(l),r!==null){i.blockedOn=r,tp(i.priority,function(){jg(l)});return}}else if(r===31){if(r=f(l),r!==null){i.blockedOn=r,tp(i.priority,function(){jg(l)});return}}else if(r===3&&l.stateNode.current.memoizedState.isDehydrated){i.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}i.blockedOn=null}function jo(i){if(i.blockedOn!==null)return!1;for(var r=i.targetContainers;0<r.length;){var l=jh(i.nativeEvent);if(l===null){l=i.nativeEvent;var u=new l.constructor(l.type,l);Uu=u,l.target.dispatchEvent(u),Uu=null}else return r=ts(l),r!==null&&Hg(r),i.blockedOn=l,!1;r.shift()}return!0}function Fg(i,r,l){jo(i)&&l.delete(r)}function fx(){Ph=!1,rr!==null&&jo(rr)&&(rr=null),sr!==null&&jo(sr)&&(sr=null),lr!==null&&jo(lr)&&(lr=null),Pl.forEach(Fg),Il.forEach(Fg)}function Uo(i,r){i.blockedOn===r&&(i.blockedOn=null,Ph||(Ph=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,fx)))}var Po=null;function qg(i){Po!==i&&(Po=i,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Po===i&&(Po=null);for(var r=0;r<i.length;r+=3){var l=i[r],u=i[r+1],d=i[r+2];if(typeof u!="function"){if(Uh(u||l)===null)continue;break}var _=ts(l);_!==null&&(i.splice(r,3),r-=3,jc(_,{pending:!0,data:d,method:l.method,action:u},u,d))}}))}function Os(i){function r(R){return Uo(R,i)}rr!==null&&Uo(rr,i),sr!==null&&Uo(sr,i),lr!==null&&Uo(lr,i),Pl.forEach(r),Il.forEach(r);for(var l=0;l<ar.length;l++){var u=ar[l];u.blockedOn===i&&(u.blockedOn=null)}for(;0<ar.length&&(l=ar[0],l.blockedOn===null);)Ig(l),l.blockedOn===null&&ar.shift();if(l=(i.ownerDocument||i).$$reactFormReplay,l!=null)for(u=0;u<l.length;u+=3){var d=l[u],_=l[u+1],y=d[oi]||null;if(typeof _=="function")y||qg(l);else if(y){var w=null;if(_&&_.hasAttribute("formAction")){if(d=_,y=_[oi]||null)w=y.formAction;else if(Uh(d)!==null)continue}else w=y.action;typeof w=="function"?l[u+1]=w:(l.splice(u,3),u-=3),qg(l)}}}function Wg(){function i(_){_.canIntercept&&_.info==="react-transition"&&_.intercept({handler:function(){return new Promise(function(y){return d=y})},focusReset:"manual",scroll:"manual"})}function r(){d!==null&&(d(),d=null),u||setTimeout(l,20)}function l(){if(!u&&!navigation.transition){var _=navigation.currentEntry;_&&_.url!=null&&navigation.navigate(_.url,{state:_.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var u=!1,d=null;return navigation.addEventListener("navigate",i),navigation.addEventListener("navigatesuccess",r),navigation.addEventListener("navigateerror",r),setTimeout(l,100),function(){u=!0,navigation.removeEventListener("navigate",i),navigation.removeEventListener("navigatesuccess",r),navigation.removeEventListener("navigateerror",r),d!==null&&(d(),d=null)}}}function Ih(i){this._internalRoot=i}Io.prototype.render=Ih.prototype.render=function(i){var r=this._internalRoot;if(r===null)throw Error(s(409));var l=r.current,u=Ei();Ng(l,u,i,r,null,null)},Io.prototype.unmount=Ih.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var r=i.containerInfo;Ng(i.current,2,null,i,null,null),bo(),r[Jr]=null}};function Io(i){this._internalRoot=i}Io.prototype.unstable_scheduleHydration=function(i){if(i){var r=ep();i={blockedOn:null,target:i,priority:r};for(var l=0;l<ar.length&&r!==0&&r<ar[l].priority;l++);ar.splice(l,0,i),l===0&&Ig(i)}};var Yg=t.version;if(Yg!=="19.2.3")throw Error(s(527,Yg,"19.2.3"));F.findDOMNode=function(i){var r=i._reactInternals;if(r===void 0)throw typeof i.render=="function"?Error(s(188)):(i=Object.keys(i).join(","),Error(s(268,i)));return i=h(r),i=i!==null?g(i):null,i=i===null?null:i.stateNode,i};var dx={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:M,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Fo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Fo.isDisabled&&Fo.supportsFiber)try{Jt=Fo.inject(dx),xt=Fo}catch{}}return Wl.createRoot=function(i,r){if(!a(i))throw Error(s(299));var l=!1,u="",d=Q_,_=J_,y=em;return r!=null&&(r.unstable_strictMode===!0&&(l=!0),r.identifierPrefix!==void 0&&(u=r.identifierPrefix),r.onUncaughtError!==void 0&&(d=r.onUncaughtError),r.onCaughtError!==void 0&&(_=r.onCaughtError),r.onRecoverableError!==void 0&&(y=r.onRecoverableError)),r=Lg(i,1,!1,null,null,l,u,null,d,_,y,Wg),i[Jr]=r.current,xh(i),new Ih(r)},Wl.hydrateRoot=function(i,r,l){if(!a(i))throw Error(s(299));var u=!1,d="",_=Q_,y=J_,w=em,R=null;return l!=null&&(l.unstable_strictMode===!0&&(u=!0),l.identifierPrefix!==void 0&&(d=l.identifierPrefix),l.onUncaughtError!==void 0&&(_=l.onUncaughtError),l.onCaughtError!==void 0&&(y=l.onCaughtError),l.onRecoverableError!==void 0&&(w=l.onRecoverableError),l.formState!==void 0&&(R=l.formState)),r=Lg(i,1,!0,r,l??null,u,d,R,_,y,w,Wg),r.context=zg(null),l=r.current,u=Ei(),u=Mu(u),d=Vn(u),d.callback=null,Kn(l,d,u),l=u,r.current.lanes=l,Js(r,l),nn(r),i[Jr]=r.current,xh(i),new Io(r)},Wl.version="19.2.3",Wl}var tv;function Cx(){if(tv)return Wh.exports;tv=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Wh.exports=wx(),Wh.exports}var kx=Cx();const Ex=gu(kx);function Tx({onLogin:e}){const[t,n]=re.useState(""),[s,a]=re.useState(null),[o,c]=re.useState(!1),f=async p=>{if(p.preventDefault(),!t.trim())return;c(!0),a(null);const h=await e(t);h&&a(h),c(!1)};return x.jsx("div",{className:"flex h-screen items-center justify-center p-4",children:x.jsxs("div",{className:"w-full max-w-sm",children:[x.jsxs("div",{className:"border-border rounded border p-6",children:[x.jsxs("div",{className:"mb-6 text-center",children:[x.jsx("h1",{className:"text-accent text-lg font-bold tracking-tight",children:"PlotLink OWS"}),x.jsx("p",{className:"text-muted mt-1 text-xs",children:"local writer agent"})]}),x.jsxs("form",{onSubmit:f,className:"space-y-4",children:[x.jsxs("div",{children:[x.jsx("label",{className:"text-muted mb-1.5 block text-xs uppercase tracking-wider",children:"Passphrase"}),x.jsx("input",{type:"password",value:t,onChange:p=>n(p.target.value),placeholder:"enter your passphrase",autoFocus:!0,className:"bg-surface border-border text-foreground placeholder:text-muted/50 w-full rounded border px-3 py-2 text-sm outline-none focus:border-accent"})]}),s&&x.jsx("p",{className:"text-error text-xs",children:s}),x.jsx("button",{type:"submit",disabled:o||!t.trim(),className:"border-accent text-accent hover:bg-accent/10 disabled:opacity-40 w-full rounded border px-4 py-2 text-sm font-medium transition-colors",children:o?"authenticating...":"unlock"})]})]}),x.jsx("p",{className:"text-muted mt-4 text-center text-[10px]",children:"enter your passphrase to unlock"})]})})}function Ax({onSetup:e}){const[t,n]=re.useState(""),[s,a]=re.useState(""),[o,c]=re.useState(null),[f,p]=re.useState(!1),h=async g=>{if(g.preventDefault(),!t.trim()||t.length<4){c("Passphrase must be at least 4 characters");return}if(t!==s){c("Passphrases do not match");return}p(!0),c(null);const m=await e(t);m&&c(m),p(!1)};return x.jsx("div",{className:"flex h-screen items-center justify-center p-4",children:x.jsx("div",{className:"w-full max-w-sm",children:x.jsxs("div",{className:"border-border rounded border p-6",children:[x.jsxs("div",{className:"mb-6 text-center",children:[x.jsx("h1",{className:"text-accent text-lg font-bold tracking-tight",children:"PlotLink OWS"}),x.jsx("p",{className:"text-muted mt-1 text-xs",children:"first-time setup"})]}),x.jsx("p",{className:"text-muted mb-4 text-xs leading-relaxed",children:"Choose a passphrase to protect your local writer agent. This will be used to unlock the app and secure your OWS wallet."}),x.jsxs("form",{onSubmit:h,className:"space-y-4",children:[x.jsxs("div",{children:[x.jsx("label",{className:"text-muted mb-1.5 block text-xs uppercase tracking-wider",children:"Passphrase"}),x.jsx("input",{type:"password",value:t,onChange:g=>n(g.target.value),placeholder:"choose a passphrase",autoFocus:!0,className:"bg-surface border-border text-foreground placeholder:text-muted/50 w-full rounded border px-3 py-2 text-sm outline-none focus:border-accent"})]}),x.jsxs("div",{children:[x.jsx("label",{className:"text-muted mb-1.5 block text-xs uppercase tracking-wider",children:"Confirm"}),x.jsx("input",{type:"password",value:s,onChange:g=>a(g.target.value),placeholder:"repeat passphrase",className:"bg-surface border-border text-foreground placeholder:text-muted/50 w-full rounded border px-3 py-2 text-sm outline-none focus:border-accent"})]}),o&&x.jsx("p",{className:"text-error text-xs",children:o}),x.jsx("button",{type:"submit",disabled:f||!t.trim()||!s.trim(),className:"border-accent text-accent hover:bg-accent/10 disabled:opacity-40 w-full rounded border px-4 py-2 text-sm font-medium transition-colors",children:f?"setting up...":"create passphrase"})]})]})})})}const iv="http://localhost:7777";function Gy({token:e}){const[t,n]=re.useState(null),[s,a]=re.useState(!1),[o,c]=re.useState(!1),[f,p]=re.useState(null),h=(b,k)=>fetch(b,{...k,headers:{...k==null?void 0:k.headers,Authorization:`Bearer ${e}`,"Content-Type":"application/json"}}),g=()=>{h(`${iv}/api/wallet`).then(b=>b.json()).then(b=>n(b)).catch(()=>n({exists:!1,error:"Failed to load wallet"}))};re.useEffect(()=>{g()},[]);const m=async()=>{a(!0),p(null);try{const b=await h(`${iv}/api/wallet/create`,{method:"POST"}),k=await b.json();if(!b.ok)throw new Error(k.error||"Creation failed");g()}catch(b){p(b instanceof Error?b.message:"Failed to create wallet")}a(!1)},S=()=>{t!=null&&t.address&&(navigator.clipboard.writeText(t.address),c(!0),setTimeout(()=>c(!1),2e3))},v=b=>`${b.slice(0,6)}...${b.slice(-4)}`;return x.jsxs("div",{className:"border-border rounded border p-4",children:[x.jsx("h3",{className:"text-accent mb-3 text-xs font-bold uppercase tracking-wider",children:"OWS Wallet"}),!t&&x.jsx("p",{className:"text-muted text-xs",children:"loading..."}),t&&!t.exists&&x.jsxs("div",{className:"space-y-3",children:[x.jsx("p",{className:"text-muted text-xs",children:"No wallet created yet. Create one to enable autonomous transactions."}),f&&x.jsx("p",{className:"text-error text-xs",children:f}),x.jsx("button",{onClick:m,disabled:s,className:"border-accent text-accent hover:bg-accent/10 disabled:opacity-40 rounded border px-4 py-2 text-xs font-medium transition-colors",children:s?"creating...":"create wallet"})]}),t&&t.exists&&t.address&&x.jsxs("div",{className:"space-y-3",children:[x.jsxs("div",{className:"flex items-center justify-between",children:[x.jsx("span",{className:"text-muted text-[10px] uppercase tracking-wider",children:"Address (Base)"}),x.jsx("span",{className:`rounded border px-1.5 py-0.5 text-[9px] ${t.ethBalance&&parseFloat(t.ethBalance)>0?"border-accent/30 text-accent":"border-accent-dim/30 text-accent-dim"}`,children:t.ethBalance&&parseFloat(t.ethBalance)>0?"active":"no balance"})]}),x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx("code",{className:"text-foreground bg-surface rounded px-2 py-1 text-xs font-mono",children:v(t.address)}),x.jsx("button",{onClick:S,className:"text-muted hover:text-accent text-xs transition-colors",children:o?"copied":"copy"})]}),x.jsxs("div",{className:"border-border space-y-1 border-t pt-3",children:[x.jsxs("div",{className:"flex justify-between text-xs",children:[x.jsx("span",{className:"text-muted",children:"ETH"}),x.jsxs("span",{className:"text-foreground font-medium",children:[t.ethBalance||"0.000000"," ETH"]})]}),x.jsxs("div",{className:"flex justify-between text-xs",children:[x.jsx("span",{className:"text-muted",children:"USDC"}),x.jsxs("span",{className:"text-foreground font-medium",children:["$",t.usdcBalance||"0.00"]})]}),x.jsxs("div",{className:"flex justify-between text-xs",children:[x.jsx("span",{className:"text-muted",children:"PLOT"}),x.jsxs("span",{className:"text-foreground font-medium",children:[t.plotBalance||"0.0000"," PLOT"]})]}),x.jsxs("div",{className:"flex justify-between text-xs",children:[x.jsx("span",{className:"text-muted",children:"Network"}),x.jsx("span",{className:"text-foreground",children:"Base"})]})]}),x.jsxs("div",{className:"border-border border-t pt-3",children:[x.jsx("p",{className:"text-muted mb-2 text-[10px] font-medium uppercase tracking-wider",children:"Fund Wallet"}),x.jsx("p",{className:"text-muted text-[10px]",children:"Send ETH on Base for gas (~$0.01 per publish):"}),x.jsx("code",{className:"text-foreground bg-surface mt-1 block break-all rounded px-2 py-1.5 text-[10px] font-mono",children:t.address})]})]})]})}function Dx({token:e,onLogout:t}){const[n,s]=re.useState(""),[a,o]=re.useState(""),[c,f]=re.useState(null),[p,h]=re.useState(!1),[g,m]=re.useState(!1),[S,v]=re.useState(null),[b,k]=re.useState(""),[B,D]=re.useState(null),[G,A]=re.useState(!1),[N,$]=re.useState(null),[z,Q]=re.useState(null),[se,he]=re.useState(""),[j,ne]=re.useState(null),[Y,U]=re.useState(!1),[K,H]=re.useState(null),M=re.useCallback((T,q)=>fetch(T,{...q,headers:{...q==null?void 0:q.headers,Authorization:`Bearer ${e}`,"Content-Type":"application/json"}}),[e]);re.useEffect(()=>{M("/api/settings/link-status").then(T=>T.json()).then(T=>v(T)).catch(()=>v({linked:!1}))},[]);const F=async()=>{if(!b.trim()||!/^0x[a-fA-F0-9]{40}$/.test(b)){$("Enter a valid wallet address (0x...)");return}A(!0),$(null),D(null);try{const T=await M("/api/settings/generate-binding",{method:"POST",body:JSON.stringify({humanWallet:b})}),q=await T.json();if(!T.ok)throw new Error(q.error||"Failed to generate binding code");D(q)}catch(T){$(T instanceof Error?T.message:"Failed to generate binding code")}A(!1)},V=async(T,q)=>{await navigator.clipboard.writeText(T),Q(q),setTimeout(()=>Q(null),2e3)},oe=async()=>{const T=parseInt(se,10);if(!T||T<=0){H("Enter a valid Agent ID");return}if(!b.trim()||!/^0x[a-fA-F0-9]{40}$/.test(b)){H("Enter your PlotLink wallet address above first");return}U(!0),H(null),ne(null);try{const q=await M("/api/settings/generate-wallet-bind",{method:"POST",body:JSON.stringify({agentId:T,humanWallet:b})}),C=await q.json();if(!q.ok)throw new Error(C.error||"Failed to generate wallet bind code");ne(C)}catch(q){H(q instanceof Error?q.message:"Failed to generate wallet bind code")}U(!1)},E=async()=>{if(f(null),h(!1),!n||n.length<4){f("Passphrase must be at least 4 characters");return}if(n!==a){f("Passphrases do not match");return}m(!0);try{const T=await M("/api/auth/reset-passphrase",{method:"POST",body:JSON.stringify({passphrase:n})});if(!T.ok){const q=await T.json();throw new Error(q.error||"Reset failed")}h(!0),s(""),o(""),setTimeout(()=>h(!1),3e3)}catch(T){f(T instanceof Error?T.message:"Reset failed")}m(!1)};return x.jsxs("div",{className:"mx-auto max-w-lg space-y-6 p-6",children:[x.jsx("h2",{className:"text-accent text-lg font-bold",children:"Settings"}),x.jsxs("div",{className:"border-border rounded border p-4",children:[x.jsx("h3",{className:"text-accent mb-3 text-xs font-bold uppercase tracking-wider",children:"Link to PlotLink"}),S!=null&&S.linked?x.jsxs("div",{className:"space-y-2",children:[x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx("span",{className:"text-sm font-medium",style:{color:"#00ff88"},children:"Linked to PlotLink"}),x.jsxs("span",{className:"text-muted text-xs",children:["Agent #",S.agentId]})]}),S.owner&&x.jsxs("p",{className:"text-muted text-xs font-mono",children:["Owner: ",S.owner.slice(0,6),"...",S.owner.slice(-4)]}),x.jsx("p",{className:"text-muted text-xs",children:x.jsx("a",{href:`https://plotlink.xyz/agents/${S.agentId}`,target:"_blank",rel:"noopener noreferrer",className:"text-accent underline",children:"View agent profile on plotlink.xyz"})})]}):x.jsxs("div",{className:"space-y-3",children:[x.jsxs("p",{className:"text-muted text-xs",children:['Connect this AI writer wallet to your PlotLink account. After linking, your stories will show as "',"{your name}'s AI Writer",'" on plotlink.xyz.']}),x.jsxs("div",{className:"text-muted text-xs space-y-1 pl-3",children:[x.jsx("p",{children:"1. Enter your PlotLink wallet address below"}),x.jsx("p",{children:'2. Click "Generate Binding Code"'}),x.jsx("p",{children:"3. Copy the code and paste it on plotlink.xyz → Agents → Link AI Writer"})]}),x.jsx("input",{value:b,onChange:T=>k(T.target.value),placeholder:"Your PlotLink wallet address (0x...)",className:"bg-surface border-border text-foreground placeholder:text-muted/50 w-full rounded border px-3 py-2 text-sm outline-none focus:border-accent font-mono"}),N&&x.jsx("p",{className:"text-error text-xs",children:N}),x.jsx("button",{onClick:F,disabled:G||!b.trim(),className:"bg-accent text-white hover:bg-accent-dim disabled:opacity-50 w-full rounded px-4 py-2 text-sm font-medium transition-colors",children:G?"Generating...":"Generate Binding Code"}),B&&x.jsxs("div",{className:"space-y-3 mt-3",children:[x.jsxs("div",{children:[x.jsx("label",{className:"text-muted text-xs block mb-1",children:"Binding Code (signature)"}),x.jsxs("div",{className:"relative",children:[x.jsx("div",{className:"bg-surface border-border rounded border p-2 text-xs font-mono break-all text-foreground pr-16",children:B.signature}),x.jsx("button",{onClick:()=>V(B.signature,"signature"),className:"absolute top-1 right-1 text-xs px-2 py-1 rounded border border-border text-muted hover:text-accent hover:border-accent transition-colors",children:z==="signature"?"Copied!":"Copy"})]})]}),x.jsxs("div",{children:[x.jsx("label",{className:"text-muted text-xs block mb-1",children:"OWS Wallet Address"}),x.jsxs("div",{className:"relative",children:[x.jsx("div",{className:"bg-surface border-border rounded border p-2 text-xs font-mono break-all text-foreground pr-16",children:B.owsWallet}),x.jsx("button",{onClick:()=>V(B.owsWallet,"wallet"),className:"absolute top-1 right-1 text-xs px-2 py-1 rounded border border-border text-muted hover:text-accent hover:border-accent transition-colors",children:z==="wallet"?"Copied!":"Copy"})]})]}),x.jsx("p",{className:"text-xs",style:{color:"#00ff88"},children:'Now go to plotlink.xyz/agents and paste both values in the "Link AI Writer" section.'}),x.jsxs("div",{className:"border-t border-border mt-4 pt-4 space-y-3",children:[x.jsxs("p",{className:"text-muted text-xs",children:[x.jsx("strong",{className:"text-foreground",children:"Step 2:"})," After registering on PlotLink, enter the Agent ID below to complete on-chain wallet binding."]}),x.jsx("input",{value:se,onChange:T=>he(T.target.value),placeholder:"Agent ID (e.g. 42)",className:"bg-surface border-border text-foreground placeholder:text-muted/50 w-full rounded border px-3 py-2 text-sm outline-none focus:border-accent font-mono"}),K&&x.jsx("p",{className:"text-error text-xs",children:K}),x.jsx("button",{onClick:oe,disabled:Y||!se.trim(),className:"border-border text-muted hover:border-accent hover:text-accent disabled:opacity-40 w-full rounded border px-4 py-2 text-xs font-medium transition-colors",children:Y?"Generating...":"Generate Wallet Bind Code"}),j&&x.jsxs("div",{className:"space-y-2",children:[x.jsxs("div",{children:[x.jsx("label",{className:"text-muted text-xs block mb-1",children:"Wallet Bind Signature"}),x.jsxs("div",{className:"relative",children:[x.jsx("div",{className:"bg-surface border-border rounded border p-2 text-xs font-mono break-all text-foreground pr-16",children:j.signature}),x.jsx("button",{onClick:()=>V(j.signature,"bindSig"),className:"absolute top-1 right-1 text-xs px-2 py-1 rounded border border-border text-muted hover:text-accent hover:border-accent transition-colors",children:z==="bindSig"?"Copied!":"Copy"})]})]}),x.jsxs("div",{children:[x.jsx("label",{className:"text-muted text-xs block mb-1",children:"Deadline (unix timestamp)"}),x.jsxs("div",{className:"relative",children:[x.jsx("div",{className:"bg-surface border-border rounded border p-2 text-xs font-mono text-foreground pr-16",children:j.deadline}),x.jsx("button",{onClick:()=>V(String(j.deadline),"bindDeadline"),className:"absolute top-1 right-1 text-xs px-2 py-1 rounded border border-border text-muted hover:text-accent hover:border-accent transition-colors",children:z==="bindDeadline"?"Copied!":"Copy"})]})]}),x.jsx("p",{className:"text-xs",style:{color:"#00ff88"},children:"Paste both values on plotlink.xyz to complete the wallet binding."})]})]})]})]})]}),x.jsx(Gy,{token:e}),x.jsxs("div",{className:"border-border rounded border p-4",children:[x.jsx("h3",{className:"text-accent mb-3 text-xs font-bold uppercase tracking-wider",children:"Reset Passphrase"}),x.jsxs("div",{className:"space-y-3",children:[x.jsx("input",{type:"password",value:n,onChange:T=>s(T.target.value),placeholder:"new passphrase",className:"bg-surface border-border text-foreground placeholder:text-muted/50 w-full rounded border px-3 py-2 text-sm outline-none focus:border-accent"}),x.jsx("input",{type:"password",value:a,onChange:T=>o(T.target.value),placeholder:"confirm passphrase",className:"bg-surface border-border text-foreground placeholder:text-muted/50 w-full rounded border px-3 py-2 text-sm outline-none focus:border-accent"}),c&&x.jsx("p",{className:"text-error text-xs",children:c}),p&&x.jsx("p",{className:"text-xs text-accent",children:"passphrase updated"}),x.jsx("button",{onClick:E,disabled:g||!n.trim(),className:"border-border text-muted hover:border-accent hover:text-accent disabled:opacity-40 w-full rounded border px-4 py-2 text-xs font-medium transition-colors",children:g?"updating...":"update passphrase"})]})]}),x.jsxs("div",{className:"border-border rounded border p-4",children:[x.jsx("h3",{className:"text-accent mb-3 text-xs font-bold uppercase tracking-wider",children:"Session"}),x.jsx("button",{onClick:t,className:"border-border text-muted hover:border-error hover:text-error rounded border px-4 py-2 text-xs font-medium transition-colors",children:"logout"})]})]})}const Rx="http://localhost:7777";function Mx({token:e}){const[t,n]=re.useState(null),s=(f,p)=>fetch(f,{...p,headers:{...p==null?void 0:p.headers,Authorization:`Bearer ${e}`,"Content-Type":"application/json"}}),a=()=>{s(`${Rx}/api/dashboard`).then(f=>f.json()).then(n)};re.useEffect(()=>{a()},[]);const o=f=>`${f.slice(0,6)}...${f.slice(-4)}`,c=f=>{if(!f)return"Unknown date";const p=new Date(f);return isNaN(p.getTime())?"Unknown date":p.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})};return t?x.jsxs("div",{className:"mx-auto max-w-2xl space-y-6 p-6",children:[x.jsx("h2",{className:"text-accent text-lg font-bold",children:"Writer Dashboard"}),x.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[x.jsxs("div",{className:"border-border rounded border p-3 text-center",children:[x.jsx("div",{className:"text-accent text-lg font-bold",children:t.stories.totalPublished}),x.jsx("div",{className:"text-muted text-[10px] uppercase tracking-wider",children:"published"})]}),x.jsxs("div",{className:"border-border rounded border p-3 text-center",children:[x.jsx("div",{className:"text-foreground text-lg font-bold",children:t.stories.pendingFiles}),x.jsx("div",{className:"text-muted text-[10px] uppercase tracking-wider",children:"pending"})]}),x.jsxs("div",{className:"border-border rounded border p-3 text-center",children:[x.jsx("div",{className:"text-foreground text-lg font-bold",children:t.stories.totalStories}),x.jsx("div",{className:"text-muted text-[10px] uppercase tracking-wider",children:"stories"})]}),x.jsxs("div",{className:"border-border rounded border p-3 text-center",children:[x.jsx("div",{className:"text-foreground text-lg font-bold",children:t.stories.totalFiles}),x.jsx("div",{className:"text-muted text-[10px] uppercase tracking-wider",children:"files"})]})]}),t.wallet&&x.jsxs("div",{className:"border-border rounded border p-4",children:[x.jsx("h3",{className:"text-accent mb-3 text-xs font-bold uppercase tracking-wider",children:"Wallet"}),x.jsxs("div",{className:"space-y-1.5",children:[x.jsxs("div",{className:"flex justify-between text-xs",children:[x.jsx("span",{className:"text-muted",children:"Address"}),x.jsx("code",{className:"text-foreground font-mono text-[10px]",children:o(t.wallet.address)})]}),x.jsxs("div",{className:"flex justify-between text-xs",children:[x.jsx("span",{className:"text-muted",children:"ETH Balance"}),x.jsxs("span",{className:"text-foreground",children:[t.wallet.ethFormatted," ETH"]})]}),x.jsxs("div",{className:"flex justify-between text-xs",children:[x.jsx("span",{className:"text-muted",children:"USDC Balance"}),x.jsxs("span",{className:"text-foreground",children:["$",t.wallet.usdcBalance]})]})]})]}),x.jsxs("div",{className:"border-border rounded border p-4",children:[x.jsx("h3",{className:"text-accent mb-3 text-xs font-bold uppercase tracking-wider",children:"Profit & Loss"}),x.jsxs("div",{className:"space-y-1.5",children:[x.jsxs("div",{className:"flex justify-between text-xs",children:[x.jsx("span",{className:"text-muted",children:"Total costs (gas)"}),x.jsxs("span",{className:"text-error",children:["-",t.pnl.totalCostsEth," ETH (~$",t.pnl.totalCostsUsd,")"]})]}),x.jsxs("div",{className:"flex justify-between text-xs",children:[x.jsx("span",{className:"text-muted",children:"Royalties earned"}),x.jsxs("span",{className:"text-accent",children:["+",t.pnl.totalRoyaltiesPlot," PLOT"]})]}),x.jsxs("div",{className:"flex justify-between text-xs",children:[x.jsx("span",{className:"text-muted",children:"Unclaimed royalties"}),x.jsxs("span",{className:"text-foreground",children:[t.royalties.unclaimed," PLOT"]})]}),x.jsxs("div",{className:"border-border flex justify-between border-t pt-1.5 text-xs font-medium",children:[x.jsx("span",{className:"text-muted",children:"Net P&L (USD)"}),x.jsxs("span",{className:parseFloat(t.pnl.netPnlUsd)>=0?"text-accent":"text-error",children:[parseFloat(t.pnl.netPnlUsd)>=0?"+":"","$",t.pnl.netPnlUsd]})]}),x.jsxs("div",{className:"flex justify-between text-xs",children:[x.jsx("span",{className:"text-muted",children:"Stories published"}),x.jsx("span",{className:"text-foreground",children:t.costs.storiesPublished})]})]})]}),x.jsxs("div",{className:"border-border rounded border p-4",children:[x.jsx("h3",{className:"text-accent mb-3 text-xs font-bold uppercase tracking-wider",children:"Published Stories"}),t.stories.published.length===0?x.jsx("p",{className:"text-muted text-xs",children:"no published stories yet"}):x.jsx("div",{className:"space-y-3",children:t.stories.published.map(f=>x.jsxs("div",{className:"bg-surface rounded border border-border p-4",children:[x.jsxs("div",{className:"flex items-start justify-between",children:[x.jsxs("div",{children:[f.genre&&x.jsx("span",{className:"bg-accent/10 text-accent rounded px-2 py-0.5 text-[10px] font-medium",children:f.genre}),x.jsx("h4",{className:"text-foreground mt-1 text-sm font-serif font-medium",children:f.title}),x.jsx("p",{className:"text-muted mt-0.5 text-[10px] font-mono",children:f.storyName})]}),x.jsxs("div",{className:"flex items-center gap-2",children:[f.hasNotIndexed&&x.jsx("span",{className:"rounded border border-amber-600/30 px-1.5 py-0.5 text-[9px] text-amber-700",children:"not indexed"}),x.jsxs("span",{className:"rounded border border-green-700/30 px-1.5 py-0.5 text-[9px] text-green-700",children:[f.publishedFiles," published"]})]})]}),x.jsxs("div",{className:"mt-2 grid grid-cols-3 gap-2 text-center",children:[x.jsxs("div",{className:"rounded bg-background p-1.5",children:[x.jsx("div",{className:"text-foreground text-sm font-medium",children:f.plotCount}),x.jsx("div",{className:"text-muted text-[9px]",children:"Plots"})]}),x.jsxs("div",{className:"rounded bg-background p-1.5",children:[x.jsx("div",{className:"text-foreground text-sm font-medium font-mono",children:f.storylineId?`#${f.storylineId}`:"—"}),x.jsx("div",{className:"text-muted text-[9px]",children:"Storyline"})]}),x.jsxs("div",{className:"rounded bg-background p-1.5",children:[x.jsx("div",{className:"text-foreground text-sm font-medium",children:f.totalGasCostEth??"—"}),x.jsx("div",{className:"text-muted text-[9px]",children:"Gas (ETH)"})]})]}),x.jsx("div",{className:"mt-2 space-y-1",children:f.files.map(p=>x.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[x.jsxs("div",{className:"flex items-center gap-1.5",children:[x.jsx("span",{className:p.status==="published-not-indexed"?"text-amber-700":"text-green-700",children:p.status==="published-not-indexed"?"⚠":"✓"}),x.jsx("span",{className:"text-muted font-mono",children:p.file})]}),p.txHash&&x.jsxs("a",{href:`https://basescan.org/tx/${p.txHash}`,target:"_blank",rel:"noopener noreferrer",className:"text-muted hover:text-accent font-mono",children:["tx:",p.txHash.slice(0,8),"..."]})]},p.file))}),x.jsxs("div",{className:"mt-2 flex items-center justify-between text-[10px]",children:[x.jsx("span",{className:"text-muted",children:c(f.latestPublishedAt)}),f.storylineId&&x.jsx("a",{href:`https://plotlink.xyz/story/${f.storylineId}`,target:"_blank",rel:"noopener noreferrer",className:"text-accent underline",children:"View on PlotLink"})]})]},f.id))})]}),t.stories.pendingFiles>0&&x.jsx("div",{className:"border-border rounded border p-4",children:x.jsxs("p",{className:"text-muted text-xs",children:[t.stories.pendingFiles," file(s) pending publish — go to Stories to publish them."]})})]}):x.jsx("div",{className:"flex h-full items-center justify-center",children:x.jsx("span",{className:"text-muted text-sm",children:"loading dashboard..."})})}const Bx={published:"✓","published-not-indexed":"⚠",pending:"⏳",draft:"📝"},Lx={published:"text-green-700","published-not-indexed":"text-amber-700",pending:"text-amber-700",draft:"text-muted"};function zx({authFetch:e,selectedStory:t,selectedFile:n,onSelectFile:s}){const[a,o]=re.useState([]),[c,f]=re.useState(new Set),p=re.useCallback(async()=>{try{const v=await e("/api/stories");if(v.ok){const b=await v.json();o(b.stories)}}catch{}},[e]);re.useEffect(()=>{p();const v=setInterval(p,5e3);return()=>clearInterval(v)},[p]),re.useEffect(()=>{t&&f(v=>new Set(v).add(t))},[t]);const h=v=>{var k;const b=v.map(B=>{var D;return{file:B.file,num:(D=B.file.match(/^plot-(\d+)\.md$/))==null?void 0:D[1]}}).filter(B=>B.num!=null).sort((B,D)=>parseInt(D.num)-parseInt(B.num));return b.length>0?b[0].file:v.some(B=>B.file==="genesis.md")?"genesis.md":v.some(B=>B.file==="structure.md")?"structure.md":((k=v[0])==null?void 0:k.file)??null},g=v=>{f(b=>{const k=new Set(b);return k.has(v)?k.delete(v):k.add(v),k})},m=v=>{if(g(v.name),!c.has(v.name)){const b=h(v.files);b&&s(v.name,b)}},S=v=>{const b=k=>{if(k==="structure.md")return 0;if(k==="genesis.md")return 1;const B=k.match(/^plot-(\d+)\.md$/);return B?2+parseInt(B[1]):100};return[...v].sort((k,B)=>b(k.file)-b(B.file))};return x.jsxs("div",{className:"h-full flex flex-col",children:[x.jsxs("div",{className:"px-3 py-1.5 border-b border-border flex items-center justify-between",children:[x.jsx("span",{className:"text-xs font-mono text-muted",children:"Stories"}),x.jsx("span",{className:"text-xs text-muted",children:a.length})]}),x.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:a.length===0?x.jsxs("div",{className:"p-3 text-sm text-muted",children:[x.jsx("p",{children:"No stories yet."}),x.jsx("p",{className:"mt-1 text-xs",children:"Use the terminal to start writing with Claude."})]}):a.filter(v=>v.name!=="_example").map(v=>x.jsxs("div",{children:[x.jsxs("button",{onClick:()=>m(v),className:"w-full px-3 py-2 text-left flex items-center gap-2 hover:bg-surface text-sm",children:[x.jsx("span",{className:"text-xs text-muted",children:c.has(v.name)?"▼":"▶"}),x.jsx("span",{className:"font-medium truncate",children:v.name}),x.jsxs("span",{className:"ml-auto text-xs text-muted",children:[v.publishedCount,"/",v.files.length]})]}),c.has(v.name)&&x.jsx("div",{className:"pl-4",children:S(v.files).map(b=>{const k=t===v.name&&n===b.file;return x.jsxs("button",{onClick:()=>s(v.name,b.file),className:`w-full px-3 py-1.5 text-left flex items-center gap-2 text-xs hover:bg-surface ${k?"bg-surface font-medium":""}`,children:[x.jsx("span",{className:Lx[b.status],children:Bx[b.status]}),x.jsx("span",{className:"truncate font-mono",children:b.file})]},b.file)})})]},v.name))})]})}/**
48
+ `+u.stack}}var Zr=Object.prototype.hasOwnProperty,Qr=e.unstable_scheduleCallback,Zs=e.unstable_cancelCallback,Tu=e.unstable_shouldYield,Au=e.unstable_requestPaint,Qt=e.unstable_now,Du=e.unstable_getCurrentPriorityLevel,J=e.unstable_ImmediatePriority,he=e.unstable_UserBlockingPriority,Se=e.unstable_NormalPriority,Re=e.unstable_LowPriority,Fe=e.unstable_IdlePriority,yi=e.log,fn=e.unstable_setDisableYieldValue,Jt=null,xt=null;function ai(i){if(typeof yi=="function"&&fn(i),xt&&typeof xt.setStrictMode=="function")try{xt.setStrictMode(Jt,i)}catch{}}var Ge=Math.clz32?Math.clz32:t0,jn=Math.log,Ki=Math.LN2;function t0(i){return i>>>=0,i===0?32:31-(jn(i)/Ki|0)|0}var Ea=256,Ta=262144,Aa=4194304;function vr(i){var r=i&42;if(r!==0)return r;switch(i&-i){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return i&261888;case 262144:case 524288:case 1048576:case 2097152:return i&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function Da(i,r,l){var u=i.pendingLanes;if(u===0)return 0;var d=0,m=i.suspendedLanes,v=i.pingedLanes;i=i.warmLanes;var w=u&134217727;return w!==0?(u=w&~m,u!==0?d=vr(u):(v&=w,v!==0?d=vr(v):l||(l=w&~i,l!==0&&(d=vr(l))))):(w=u&~m,w!==0?d=vr(w):v!==0?d=vr(v):l||(l=u&~i,l!==0&&(d=vr(l)))),d===0?0:r!==0&&r!==d&&(r&m)===0&&(m=d&-d,l=r&-r,m>=l||m===32&&(l&4194048)!==0)?r:d}function Qs(i,r){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&r)===0}function i0(i,r){switch(i){case 1:case 2:case 4:case 8:case 64:return r+250;case 16:case 32: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 r+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Gd(){var i=Aa;return Aa<<=1,(Aa&62914560)===0&&(Aa=4194304),i}function Ru(i){for(var r=[],l=0;31>l;l++)r.push(i);return r}function Js(i,r){i.pendingLanes|=r,r!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function n0(i,r,l,u,d,m){var v=i.pendingLanes;i.pendingLanes=l,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=l,i.entangledLanes&=l,i.errorRecoveryDisabledLanes&=l,i.shellSuspendCounter=0;var w=i.entanglements,D=i.expirationTimes,I=i.hiddenUpdates;for(l=v&~l;0<l;){var Q=31-Ge(l),ie=1<<Q;w[Q]=0,D[Q]=-1;var Y=I[Q];if(Y!==null)for(I[Q]=null,Q=0;Q<Y.length;Q++){var G=Y[Q];G!==null&&(G.lane&=-536870913)}l&=~ie}u!==0&&Zd(i,u,0),m!==0&&d===0&&i.tag!==0&&(i.suspendedLanes|=m&~(v&~r))}function Zd(i,r,l){i.pendingLanes|=r,i.suspendedLanes&=~r;var u=31-Ge(r);i.entangledLanes|=r,i.entanglements[u]=i.entanglements[u]|1073741824|l&261930}function Qd(i,r){var l=i.entangledLanes|=r;for(i=i.entanglements;l;){var u=31-Ge(l),d=1<<u;d&r|i[u]&r&&(i[u]|=r),l&=~d}}function Jd(i,r){var l=r&-r;return l=(l&42)!==0?1:Mu(l),(l&(i.suspendedLanes|r))!==0?0:l}function Mu(i){switch(i){case 2:i=1;break;case 8:i=4;break;case 32:i=16;break;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:i=128;break;case 268435456:i=134217728;break;default:i=0}return i}function Bu(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function ep(){var i=q.p;return i!==0?i:(i=window.event,i===void 0?32:Ug(i.type))}function tp(i,r){var l=q.p;try{return q.p=i,r()}finally{q.p=l}}var Un=Math.random().toString(36).slice(2),jt="__reactFiber$"+Un,oi="__reactProps$"+Un,Jr="__reactContainer$"+Un,Lu="__reactEvents$"+Un,r0="__reactListeners$"+Un,s0="__reactHandles$"+Un,ip="__reactResources$"+Un,el="__reactMarker$"+Un;function zu(i){delete i[jt],delete i[oi],delete i[Lu],delete i[r0],delete i[s0]}function es(i){var r=i[jt];if(r)return r;for(var l=i.parentNode;l;){if(r=l[Jr]||l[jt]){if(l=r.alternate,r.child!==null||l!==null&&l.child!==null)for(i=wg(i);i!==null;){if(l=i[jt])return l;i=wg(i)}return r}i=l,l=i.parentNode}return null}function ts(i){if(i=i[jt]||i[Jr]){var r=i.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return i}return null}function tl(i){var r=i.tag;if(r===5||r===26||r===27||r===6)return i.stateNode;throw Error(s(33))}function is(i){var r=i[ip];return r||(r=i[ip]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function Tt(i){i[el]=!0}var np=new Set,rp={};function yr(i,r){ns(i,r),ns(i+"Capture",r)}function ns(i,r){for(rp[i]=r,i=0;i<r.length;i++)np.add(r[i])}var l0=RegExp("^[: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]*$"),sp={},lp={};function a0(i){return Zr.call(lp,i)?!0:Zr.call(sp,i)?!1:l0.test(i)?lp[i]=!0:(sp[i]=!0,!1)}function Ra(i,r,l){if(a0(r))if(l===null)i.removeAttribute(r);else{switch(typeof l){case"undefined":case"function":case"symbol":i.removeAttribute(r);return;case"boolean":var u=r.toLowerCase().slice(0,5);if(u!=="data-"&&u!=="aria-"){i.removeAttribute(r);return}}i.setAttribute(r,""+l)}}function Ma(i,r,l){if(l===null)i.removeAttribute(r);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(r);return}i.setAttribute(r,""+l)}}function dn(i,r,l,u){if(u===null)i.removeAttribute(l);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(l);return}i.setAttributeNS(r,l,""+u)}}function Bi(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function ap(i){var r=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function o0(i,r,l){var u=Object.getOwnPropertyDescriptor(i.constructor.prototype,r);if(!i.hasOwnProperty(r)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var d=u.get,m=u.set;return Object.defineProperty(i,r,{configurable:!0,get:function(){return d.call(this)},set:function(v){l=""+v,m.call(this,v)}}),Object.defineProperty(i,r,{enumerable:u.enumerable}),{getValue:function(){return l},setValue:function(v){l=""+v},stopTracking:function(){i._valueTracker=null,delete i[r]}}}}function Nu(i){if(!i._valueTracker){var r=ap(i)?"checked":"value";i._valueTracker=o0(i,r,""+i[r])}}function op(i){if(!i)return!1;var r=i._valueTracker;if(!r)return!0;var l=r.getValue(),u="";return i&&(u=ap(i)?i.checked?"true":"false":i.value),i=u,i!==l?(r.setValue(i),!0):!1}function Ba(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}var u0=/[\n"\\]/g;function Li(i){return i.replace(u0,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function Ou(i,r,l,u,d,m,v,w){i.name="",v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?i.type=v:i.removeAttribute("type"),r!=null?v==="number"?(r===0&&i.value===""||i.value!=r)&&(i.value=""+Bi(r)):i.value!==""+Bi(r)&&(i.value=""+Bi(r)):v!=="submit"&&v!=="reset"||i.removeAttribute("value"),r!=null?Hu(i,v,Bi(r)):l!=null?Hu(i,v,Bi(l)):u!=null&&i.removeAttribute("value"),d==null&&m!=null&&(i.defaultChecked=!!m),d!=null&&(i.checked=d&&typeof d!="function"&&typeof d!="symbol"),w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?i.name=""+Bi(w):i.removeAttribute("name")}function up(i,r,l,u,d,m,v,w){if(m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"&&(i.type=m),r!=null||l!=null){if(!(m!=="submit"&&m!=="reset"||r!=null)){Nu(i);return}l=l!=null?""+Bi(l):"",r=r!=null?""+Bi(r):l,w||r===i.value||(i.value=r),i.defaultValue=r}u=u??d,u=typeof u!="function"&&typeof u!="symbol"&&!!u,i.checked=w?i.checked:!!u,i.defaultChecked=!!u,v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(i.name=v),Nu(i)}function Hu(i,r,l){r==="number"&&Ba(i.ownerDocument)===i||i.defaultValue===""+l||(i.defaultValue=""+l)}function rs(i,r,l,u){if(i=i.options,r){r={};for(var d=0;d<l.length;d++)r["$"+l[d]]=!0;for(l=0;l<i.length;l++)d=r.hasOwnProperty("$"+i[l].value),i[l].selected!==d&&(i[l].selected=d),d&&u&&(i[l].defaultSelected=!0)}else{for(l=""+Bi(l),r=null,d=0;d<i.length;d++){if(i[d].value===l){i[d].selected=!0,u&&(i[d].defaultSelected=!0);return}r!==null||i[d].disabled||(r=i[d])}r!==null&&(r.selected=!0)}}function cp(i,r,l){if(r!=null&&(r=""+Bi(r),r!==i.value&&(i.value=r),l==null)){i.defaultValue!==r&&(i.defaultValue=r);return}i.defaultValue=l!=null?""+Bi(l):""}function hp(i,r,l,u){if(r==null){if(u!=null){if(l!=null)throw Error(s(92));if(H(u)){if(1<u.length)throw Error(s(93));u=u[0]}l=u}l==null&&(l=""),r=l}l=Bi(r),i.defaultValue=l,u=i.textContent,u===l&&u!==""&&u!==null&&(i.value=u),Nu(i)}function ss(i,r){if(r){var l=i.firstChild;if(l&&l===i.lastChild&&l.nodeType===3){l.nodeValue=r;return}}i.textContent=r}var c0=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function fp(i,r,l){var u=r.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?u?i.setProperty(r,""):r==="float"?i.cssFloat="":i[r]="":u?i.setProperty(r,l):typeof l!="number"||l===0||c0.has(r)?r==="float"?i.cssFloat=l:i[r]=(""+l).trim():i[r]=l+"px"}function dp(i,r,l){if(r!=null&&typeof r!="object")throw Error(s(62));if(i=i.style,l!=null){for(var u in l)!l.hasOwnProperty(u)||r!=null&&r.hasOwnProperty(u)||(u.indexOf("--")===0?i.setProperty(u,""):u==="float"?i.cssFloat="":i[u]="");for(var d in r)u=r[d],r.hasOwnProperty(d)&&l[d]!==u&&fp(i,d,u)}else for(var m in r)r.hasOwnProperty(m)&&fp(i,m,r[m])}function ju(i){if(i.indexOf("-")===-1)return!1;switch(i){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var h0=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["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"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["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"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["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"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),f0=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function La(i){return f0.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function pn(){}var Uu=null;function Pu(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var ls=null,as=null;function pp(i){var r=ts(i);if(r&&(i=r.stateNode)){var l=i[oi]||null;e:switch(i=r.stateNode,r.type){case"input":if(Ou(i,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),r=l.name,l.type==="radio"&&r!=null){for(l=i;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+Li(""+r)+'"][type="radio"]'),r=0;r<l.length;r++){var u=l[r];if(u!==i&&u.form===i.form){var d=u[oi]||null;if(!d)throw Error(s(90));Ou(u,d.value,d.defaultValue,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name)}}for(r=0;r<l.length;r++)u=l[r],u.form===i.form&&op(u)}break e;case"textarea":cp(i,l.value,l.defaultValue);break e;case"select":r=l.value,r!=null&&rs(i,!!l.multiple,r,!1)}}}var Iu=!1;function mp(i,r,l){if(Iu)return i(r,l);Iu=!0;try{var u=i(r);return u}finally{if(Iu=!1,(ls!==null||as!==null)&&(bo(),ls&&(r=ls,i=as,as=ls=null,pp(r),i)))for(r=0;r<i.length;r++)pp(i[r])}}function il(i,r){var l=i.stateNode;if(l===null)return null;var u=l[oi]||null;if(u===null)return null;l=u[r];e:switch(r){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(u=!u.disabled)||(i=i.type,u=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!u;break e;default:i=!1}if(i)return null;if(l&&typeof l!="function")throw Error(s(231,r,typeof l));return l}var mn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Fu=!1;if(mn)try{var nl={};Object.defineProperty(nl,"passive",{get:function(){Fu=!0}}),window.addEventListener("test",nl,nl),window.removeEventListener("test",nl,nl)}catch{Fu=!1}var Pn=null,qu=null,za=null;function _p(){if(za)return za;var i,r=qu,l=r.length,u,d="value"in Pn?Pn.value:Pn.textContent,m=d.length;for(i=0;i<l&&r[i]===d[i];i++);var v=l-i;for(u=1;u<=v&&r[l-u]===d[m-u];u++);return za=d.slice(i,1<u?1-u:void 0)}function Na(i){var r=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&r===13&&(i=13)):i=r,i===10&&(i=13),32<=i||i===13?i:0}function Oa(){return!0}function gp(){return!1}function ui(i){function r(l,u,d,m,v){this._reactName=l,this._targetInst=d,this.type=u,this.nativeEvent=m,this.target=v,this.currentTarget=null;for(var w in i)i.hasOwnProperty(w)&&(l=i[w],this[w]=l?l(m):m[w]);return this.isDefaultPrevented=(m.defaultPrevented!=null?m.defaultPrevented:m.returnValue===!1)?Oa:gp,this.isPropagationStopped=gp,this}return _(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=Oa)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Oa)},persist:function(){},isPersistent:Oa}),r}var Sr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ha=ui(Sr),rl=_({},Sr,{view:0,detail:0}),d0=ui(rl),Wu,Yu,sl,ja=_({},rl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ku,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==sl&&(sl&&i.type==="mousemove"?(Wu=i.screenX-sl.screenX,Yu=i.screenY-sl.screenY):Yu=Wu=0,sl=i),Wu)},movementY:function(i){return"movementY"in i?i.movementY:Yu}}),vp=ui(ja),p0=_({},ja,{dataTransfer:0}),m0=ui(p0),_0=_({},rl,{relatedTarget:0}),Vu=ui(_0),g0=_({},Sr,{animationName:0,elapsedTime:0,pseudoElement:0}),v0=ui(g0),y0=_({},Sr,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),S0=ui(y0),b0=_({},Sr,{data:0}),yp=ui(b0),x0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},w0={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"},C0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function k0(i){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(i):(i=C0[i])?!!r[i]:!1}function Ku(){return k0}var E0=_({},rl,{key:function(i){if(i.key){var r=x0[i.key]||i.key;if(r!=="Unidentified")return r}return i.type==="keypress"?(i=Na(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?w0[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ku,charCode:function(i){return i.type==="keypress"?Na(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?Na(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),T0=ui(E0),A0=_({},ja,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Sp=ui(A0),D0=_({},rl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ku}),R0=ui(D0),M0=_({},Sr,{propertyName:0,elapsedTime:0,pseudoElement:0}),B0=ui(M0),L0=_({},ja,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),z0=ui(L0),N0=_({},Sr,{newState:0,oldState:0}),O0=ui(N0),H0=[9,13,27,32],Xu=mn&&"CompositionEvent"in window,ll=null;mn&&"documentMode"in document&&(ll=document.documentMode);var j0=mn&&"TextEvent"in window&&!ll,bp=mn&&(!Xu||ll&&8<ll&&11>=ll),xp=" ",wp=!1;function Cp(i,r){switch(i){case"keyup":return H0.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function kp(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var os=!1;function U0(i,r){switch(i){case"compositionend":return kp(r);case"keypress":return r.which!==32?null:(wp=!0,xp);case"textInput":return i=r.data,i===xp&&wp?null:i;default:return null}}function P0(i,r){if(os)return i==="compositionend"||!Xu&&Cp(i,r)?(i=_p(),za=qu=Pn=null,os=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1<r.char.length)return r.char;if(r.which)return String.fromCharCode(r.which)}return null;case"compositionend":return bp&&r.locale!=="ko"?null:r.data;default:return null}}var I0={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 Ep(i){var r=i&&i.nodeName&&i.nodeName.toLowerCase();return r==="input"?!!I0[i.type]:r==="textarea"}function Tp(i,r,l,u){ls?as?as.push(u):as=[u]:ls=u,r=Ao(r,"onChange"),0<r.length&&(l=new Ha("onChange","change",null,l,u),i.push({event:l,listeners:r}))}var al=null,ol=null;function F0(i){ug(i,0)}function Ua(i){var r=tl(i);if(op(r))return i}function Ap(i,r){if(i==="change")return r}var Dp=!1;if(mn){var $u;if(mn){var Gu="oninput"in document;if(!Gu){var Rp=document.createElement("div");Rp.setAttribute("oninput","return;"),Gu=typeof Rp.oninput=="function"}$u=Gu}else $u=!1;Dp=$u&&(!document.documentMode||9<document.documentMode)}function Mp(){al&&(al.detachEvent("onpropertychange",Bp),ol=al=null)}function Bp(i){if(i.propertyName==="value"&&Ua(ol)){var r=[];Tp(r,ol,i,Pu(i)),mp(F0,r)}}function q0(i,r,l){i==="focusin"?(Mp(),al=r,ol=l,al.attachEvent("onpropertychange",Bp)):i==="focusout"&&Mp()}function W0(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return Ua(ol)}function Y0(i,r){if(i==="click")return Ua(r)}function V0(i,r){if(i==="input"||i==="change")return Ua(r)}function K0(i,r){return i===r&&(i!==0||1/i===1/r)||i!==i&&r!==r}var Si=typeof Object.is=="function"?Object.is:K0;function ul(i,r){if(Si(i,r))return!0;if(typeof i!="object"||i===null||typeof r!="object"||r===null)return!1;var l=Object.keys(i),u=Object.keys(r);if(l.length!==u.length)return!1;for(u=0;u<l.length;u++){var d=l[u];if(!Zr.call(r,d)||!Si(i[d],r[d]))return!1}return!0}function Lp(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function zp(i,r){var l=Lp(i);i=0;for(var u;l;){if(l.nodeType===3){if(u=i+l.textContent.length,i<=r&&u>=r)return{node:l,offset:r-i};i=u}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=Lp(l)}}function Np(i,r){return i&&r?i===r?!0:i&&i.nodeType===3?!1:r&&r.nodeType===3?Np(i,r.parentNode):"contains"in i?i.contains(r):i.compareDocumentPosition?!!(i.compareDocumentPosition(r)&16):!1:!1}function Op(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var r=Ba(i.document);r instanceof i.HTMLIFrameElement;){try{var l=typeof r.contentWindow.location.href=="string"}catch{l=!1}if(l)i=r.contentWindow;else break;r=Ba(i.document)}return r}function Zu(i){var r=i&&i.nodeName&&i.nodeName.toLowerCase();return r&&(r==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||r==="textarea"||i.contentEditable==="true")}var X0=mn&&"documentMode"in document&&11>=document.documentMode,us=null,Qu=null,cl=null,Ju=!1;function Hp(i,r,l){var u=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Ju||us==null||us!==Ba(u)||(u=us,"selectionStart"in u&&Zu(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),cl&&ul(cl,u)||(cl=u,u=Ao(Qu,"onSelect"),0<u.length&&(r=new Ha("onSelect","select",null,r,l),i.push({event:r,listeners:u}),r.target=us)))}function br(i,r){var l={};return l[i.toLowerCase()]=r.toLowerCase(),l["Webkit"+i]="webkit"+r,l["Moz"+i]="moz"+r,l}var cs={animationend:br("Animation","AnimationEnd"),animationiteration:br("Animation","AnimationIteration"),animationstart:br("Animation","AnimationStart"),transitionrun:br("Transition","TransitionRun"),transitionstart:br("Transition","TransitionStart"),transitioncancel:br("Transition","TransitionCancel"),transitionend:br("Transition","TransitionEnd")},ec={},jp={};mn&&(jp=document.createElement("div").style,"AnimationEvent"in window||(delete cs.animationend.animation,delete cs.animationiteration.animation,delete cs.animationstart.animation),"TransitionEvent"in window||delete cs.transitionend.transition);function xr(i){if(ec[i])return ec[i];if(!cs[i])return i;var r=cs[i],l;for(l in r)if(r.hasOwnProperty(l)&&l in jp)return ec[i]=r[l];return i}var Up=xr("animationend"),Pp=xr("animationiteration"),Ip=xr("animationstart"),$0=xr("transitionrun"),G0=xr("transitionstart"),Z0=xr("transitioncancel"),Fp=xr("transitionend"),qp=new Map,tc="abort auxClick beforeToggle 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(" ");tc.push("scrollEnd");function Xi(i,r){qp.set(i,r),yr(r,[i])}var Pa=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},zi=[],hs=0,ic=0;function Ia(){for(var i=hs,r=ic=hs=0;r<i;){var l=zi[r];zi[r++]=null;var u=zi[r];zi[r++]=null;var d=zi[r];zi[r++]=null;var m=zi[r];if(zi[r++]=null,u!==null&&d!==null){var v=u.pending;v===null?d.next=d:(d.next=v.next,v.next=d),u.pending=d}m!==0&&Wp(l,d,m)}}function Fa(i,r,l,u){zi[hs++]=i,zi[hs++]=r,zi[hs++]=l,zi[hs++]=u,ic|=u,i.lanes|=u,i=i.alternate,i!==null&&(i.lanes|=u)}function nc(i,r,l,u){return Fa(i,r,l,u),qa(i)}function wr(i,r){return Fa(i,null,null,r),qa(i)}function Wp(i,r,l){i.lanes|=l;var u=i.alternate;u!==null&&(u.lanes|=l);for(var d=!1,m=i.return;m!==null;)m.childLanes|=l,u=m.alternate,u!==null&&(u.childLanes|=l),m.tag===22&&(i=m.stateNode,i===null||i._visibility&1||(d=!0)),i=m,m=m.return;return i.tag===3?(m=i.stateNode,d&&r!==null&&(d=31-Ge(l),i=m.hiddenUpdates,u=i[d],u===null?i[d]=[r]:u.push(r),r.lane=l|536870912),m):null}function qa(i){if(50<Bl)throw Bl=0,fh=null,Error(s(185));for(var r=i.return;r!==null;)i=r,r=i.return;return i.tag===3?i.stateNode:null}var fs={};function Q0(i,r,l,u){this.tag=i,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=r,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function bi(i,r,l,u){return new Q0(i,r,l,u)}function rc(i){return i=i.prototype,!(!i||!i.isReactComponent)}function _n(i,r){var l=i.alternate;return l===null?(l=bi(i.tag,r,i.key,i.mode),l.elementType=i.elementType,l.type=i.type,l.stateNode=i.stateNode,l.alternate=i,i.alternate=l):(l.pendingProps=r,l.type=i.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=i.flags&65011712,l.childLanes=i.childLanes,l.lanes=i.lanes,l.child=i.child,l.memoizedProps=i.memoizedProps,l.memoizedState=i.memoizedState,l.updateQueue=i.updateQueue,r=i.dependencies,l.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},l.sibling=i.sibling,l.index=i.index,l.ref=i.ref,l.refCleanup=i.refCleanup,l}function Yp(i,r){i.flags&=65011714;var l=i.alternate;return l===null?(i.childLanes=0,i.lanes=r,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=l.childLanes,i.lanes=l.lanes,i.child=l.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=l.memoizedProps,i.memoizedState=l.memoizedState,i.updateQueue=l.updateQueue,i.type=l.type,r=l.dependencies,i.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),i}function Wa(i,r,l,u,d,m){var v=0;if(u=i,typeof i=="function")rc(i)&&(v=1);else if(typeof i=="string")v=nx(i,l,se.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case le:return i=bi(31,l,r,d),i.elementType=le,i.lanes=m,i;case k:return Cr(l.children,d,m,r);case R:v=8,d|=24;break;case T:return i=bi(12,l,r,d|2),i.elementType=T,i.lanes=m,i;case X:return i=bi(13,l,r,d),i.elementType=X,i.lanes=m,i;case L:return i=bi(19,l,r,d),i.elementType=L,i.lanes=m,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case j:v=10;break e;case $:v=9;break e;case O:v=11;break e;case re:v=14;break e;case Z:v=16,u=null;break e}v=29,l=Error(s(130,i===null?"null":typeof i,"")),u=null}return r=bi(v,l,r,d),r.elementType=i,r.type=u,r.lanes=m,r}function Cr(i,r,l,u){return i=bi(7,i,u,r),i.lanes=l,i}function sc(i,r,l){return i=bi(6,i,null,r),i.lanes=l,i}function Vp(i){var r=bi(18,null,null,0);return r.stateNode=i,r}function lc(i,r,l){return r=bi(4,i.children!==null?i.children:[],i.key,r),r.lanes=l,r.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},r}var Kp=new WeakMap;function Ni(i,r){if(typeof i=="object"&&i!==null){var l=Kp.get(i);return l!==void 0?l:(r={value:i,source:r,stack:ka(r)},Kp.set(i,r),r)}return{value:i,source:r,stack:ka(r)}}var ds=[],ps=0,Ya=null,hl=0,Oi=[],Hi=0,In=null,Ji=1,en="";function gn(i,r){ds[ps++]=hl,ds[ps++]=Ya,Ya=i,hl=r}function Xp(i,r,l){Oi[Hi++]=Ji,Oi[Hi++]=en,Oi[Hi++]=In,In=i;var u=Ji;i=en;var d=32-Ge(u)-1;u&=~(1<<d),l+=1;var m=32-Ge(r)+d;if(30<m){var v=d-d%5;m=(u&(1<<v)-1).toString(32),u>>=v,d-=v,Ji=1<<32-Ge(r)+d|l<<d|u,en=m+i}else Ji=1<<m|l<<d|u,en=i}function ac(i){i.return!==null&&(gn(i,1),Xp(i,1,0))}function oc(i){for(;i===Ya;)Ya=ds[--ps],ds[ps]=null,hl=ds[--ps],ds[ps]=null;for(;i===In;)In=Oi[--Hi],Oi[Hi]=null,en=Oi[--Hi],Oi[Hi]=null,Ji=Oi[--Hi],Oi[Hi]=null}function $p(i,r){Oi[Hi++]=Ji,Oi[Hi++]=en,Oi[Hi++]=In,Ji=r.id,en=r.overflow,In=i}var Ut=null,et=null,Oe=!1,Fn=null,ji=!1,uc=Error(s(519));function qn(i){var r=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw fl(Ni(r,i)),uc}function Gp(i){var r=i.stateNode,l=i.type,u=i.memoizedProps;switch(r[jt]=i,r[oi]=u,l){case"dialog":Be("cancel",r),Be("close",r);break;case"iframe":case"object":case"embed":Be("load",r);break;case"video":case"audio":for(l=0;l<zl.length;l++)Be(zl[l],r);break;case"source":Be("error",r);break;case"img":case"image":case"link":Be("error",r),Be("load",r);break;case"details":Be("toggle",r);break;case"input":Be("invalid",r),up(r,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":Be("invalid",r);break;case"textarea":Be("invalid",r),hp(r,u.value,u.defaultValue,u.children)}l=u.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||r.textContent===""+l||u.suppressHydrationWarning===!0||dg(r.textContent,l)?(u.popover!=null&&(Be("beforetoggle",r),Be("toggle",r)),u.onScroll!=null&&Be("scroll",r),u.onScrollEnd!=null&&Be("scrollend",r),u.onClick!=null&&(r.onclick=pn),r=!0):r=!1,r||qn(i,!0)}function Zp(i){for(Ut=i.return;Ut;)switch(Ut.tag){case 5:case 31:case 13:ji=!1;return;case 27:case 3:ji=!0;return;default:Ut=Ut.return}}function ms(i){if(i!==Ut)return!1;if(!Oe)return Zp(i),Oe=!0,!1;var r=i.tag,l;if((l=r!==3&&r!==27)&&((l=r===5)&&(l=i.type,l=!(l!=="form"&&l!=="button")||Th(i.type,i.memoizedProps)),l=!l),l&&et&&qn(i),Zp(i),r===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(s(317));et=xg(i)}else if(r===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(s(317));et=xg(i)}else r===27?(r=et,nr(i.type)?(i=Bh,Bh=null,et=i):et=r):et=Ut?Pi(i.stateNode.nextSibling):null;return!0}function kr(){et=Ut=null,Oe=!1}function cc(){var i=Fn;return i!==null&&(di===null?di=i:di.push.apply(di,i),Fn=null),i}function fl(i){Fn===null?Fn=[i]:Fn.push(i)}var hc=A(null),Er=null,vn=null;function Wn(i,r,l){C(hc,r._currentValue),r._currentValue=l}function yn(i){i._currentValue=hc.current,K(hc)}function fc(i,r,l){for(;i!==null;){var u=i.alternate;if((i.childLanes&r)!==r?(i.childLanes|=r,u!==null&&(u.childLanes|=r)):u!==null&&(u.childLanes&r)!==r&&(u.childLanes|=r),i===l)break;i=i.return}}function dc(i,r,l,u){var d=i.child;for(d!==null&&(d.return=i);d!==null;){var m=d.dependencies;if(m!==null){var v=d.child;m=m.firstContext;e:for(;m!==null;){var w=m;m=d;for(var D=0;D<r.length;D++)if(w.context===r[D]){m.lanes|=l,w=m.alternate,w!==null&&(w.lanes|=l),fc(m.return,l,i),u||(v=null);break e}m=w.next}}else if(d.tag===18){if(v=d.return,v===null)throw Error(s(341));v.lanes|=l,m=v.alternate,m!==null&&(m.lanes|=l),fc(v,l,i),v=null}else v=d.child;if(v!==null)v.return=d;else for(v=d;v!==null;){if(v===i){v=null;break}if(d=v.sibling,d!==null){d.return=v.return,v=d;break}v=v.return}d=v}}function _s(i,r,l,u){i=null;for(var d=r,m=!1;d!==null;){if(!m){if((d.flags&524288)!==0)m=!0;else if((d.flags&262144)!==0)break}if(d.tag===10){var v=d.alternate;if(v===null)throw Error(s(387));if(v=v.memoizedProps,v!==null){var w=d.type;Si(d.pendingProps.value,v.value)||(i!==null?i.push(w):i=[w])}}else if(d===xe.current){if(v=d.alternate,v===null)throw Error(s(387));v.memoizedState.memoizedState!==d.memoizedState.memoizedState&&(i!==null?i.push(Ul):i=[Ul])}d=d.return}i!==null&&dc(r,i,l,u),r.flags|=262144}function Va(i){for(i=i.firstContext;i!==null;){if(!Si(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function Tr(i){Er=i,vn=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function Pt(i){return Qp(Er,i)}function Ka(i,r){return Er===null&&Tr(i),Qp(i,r)}function Qp(i,r){var l=r._currentValue;if(r={context:r,memoizedValue:l,next:null},vn===null){if(i===null)throw Error(s(308));vn=r,i.dependencies={lanes:0,firstContext:r},i.flags|=524288}else vn=vn.next=r;return l}var J0=typeof AbortController<"u"?AbortController:function(){var i=[],r=this.signal={aborted:!1,addEventListener:function(l,u){i.push(u)}};this.abort=function(){r.aborted=!0,i.forEach(function(l){return l()})}},e1=e.unstable_scheduleCallback,t1=e.unstable_NormalPriority,mt={$$typeof:j,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function pc(){return{controller:new J0,data:new Map,refCount:0}}function dl(i){i.refCount--,i.refCount===0&&e1(t1,function(){i.controller.abort()})}var pl=null,mc=0,gs=0,vs=null;function i1(i,r){if(pl===null){var l=pl=[];mc=0,gs=vh(),vs={status:"pending",value:void 0,then:function(u){l.push(u)}}}return mc++,r.then(Jp,Jp),r}function Jp(){if(--mc===0&&pl!==null){vs!==null&&(vs.status="fulfilled");var i=pl;pl=null,gs=0,vs=null;for(var r=0;r<i.length;r++)(0,i[r])()}}function n1(i,r){var l=[],u={status:"pending",value:null,reason:null,then:function(d){l.push(d)}};return i.then(function(){u.status="fulfilled",u.value=r;for(var d=0;d<l.length;d++)(0,l[d])(r)},function(d){for(u.status="rejected",u.reason=d,d=0;d<l.length;d++)(0,l[d])(void 0)}),u}var em=M.S;M.S=function(i,r){H_=Qt(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&i1(i,r),em!==null&&em(i,r)};var Ar=A(null);function _c(){var i=Ar.current;return i!==null?i:Ze.pooledCache}function Xa(i,r){r===null?C(Ar,Ar.current):C(Ar,r.pool)}function tm(){var i=_c();return i===null?null:{parent:mt._currentValue,pool:i}}var ys=Error(s(460)),gc=Error(s(474)),$a=Error(s(542)),Ga={then:function(){}};function im(i){return i=i.status,i==="fulfilled"||i==="rejected"}function nm(i,r,l){switch(l=i[l],l===void 0?i.push(r):l!==r&&(r.then(pn,pn),r=l),r.status){case"fulfilled":return r.value;case"rejected":throw i=r.reason,sm(i),i;default:if(typeof r.status=="string")r.then(pn,pn);else{if(i=Ze,i!==null&&100<i.shellSuspendCounter)throw Error(s(482));i=r,i.status="pending",i.then(function(u){if(r.status==="pending"){var d=r;d.status="fulfilled",d.value=u}},function(u){if(r.status==="pending"){var d=r;d.status="rejected",d.reason=u}})}switch(r.status){case"fulfilled":return r.value;case"rejected":throw i=r.reason,sm(i),i}throw Rr=r,ys}}function Dr(i){try{var r=i._init;return r(i._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(Rr=l,ys):l}}var Rr=null;function rm(){if(Rr===null)throw Error(s(459));var i=Rr;return Rr=null,i}function sm(i){if(i===ys||i===$a)throw Error(s(483))}var Ss=null,ml=0;function Za(i){var r=ml;return ml+=1,Ss===null&&(Ss=[]),nm(Ss,i,r)}function _l(i,r){r=r.props.ref,i.ref=r!==void 0?r:null}function Qa(i,r){throw r.$$typeof===S?Error(s(525)):(i=Object.prototype.toString.call(r),Error(s(31,i==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":i)))}function lm(i){function r(N,B){if(i){var P=N.deletions;P===null?(N.deletions=[B],N.flags|=16):P.push(B)}}function l(N,B){if(!i)return null;for(;B!==null;)r(N,B),B=B.sibling;return null}function u(N){for(var B=new Map;N!==null;)N.key!==null?B.set(N.key,N):B.set(N.index,N),N=N.sibling;return B}function d(N,B){return N=_n(N,B),N.index=0,N.sibling=null,N}function m(N,B,P){return N.index=P,i?(P=N.alternate,P!==null?(P=P.index,P<B?(N.flags|=67108866,B):P):(N.flags|=67108866,B)):(N.flags|=1048576,B)}function v(N){return i&&N.alternate===null&&(N.flags|=67108866),N}function w(N,B,P,ee){return B===null||B.tag!==6?(B=sc(P,N.mode,ee),B.return=N,B):(B=d(B,P),B.return=N,B)}function D(N,B,P,ee){var ge=P.type;return ge===k?Q(N,B,P.props.children,ee,P.key):B!==null&&(B.elementType===ge||typeof ge=="object"&&ge!==null&&ge.$$typeof===Z&&Dr(ge)===B.type)?(B=d(B,P.props),_l(B,P),B.return=N,B):(B=Wa(P.type,P.key,P.props,null,N.mode,ee),_l(B,P),B.return=N,B)}function I(N,B,P,ee){return B===null||B.tag!==4||B.stateNode.containerInfo!==P.containerInfo||B.stateNode.implementation!==P.implementation?(B=lc(P,N.mode,ee),B.return=N,B):(B=d(B,P.children||[]),B.return=N,B)}function Q(N,B,P,ee,ge){return B===null||B.tag!==7?(B=Cr(P,N.mode,ee,ge),B.return=N,B):(B=d(B,P),B.return=N,B)}function ie(N,B,P){if(typeof B=="string"&&B!==""||typeof B=="number"||typeof B=="bigint")return B=sc(""+B,N.mode,P),B.return=N,B;if(typeof B=="object"&&B!==null){switch(B.$$typeof){case y:return P=Wa(B.type,B.key,B.props,null,N.mode,P),_l(P,B),P.return=N,P;case b:return B=lc(B,N.mode,P),B.return=N,B;case Z:return B=Dr(B),ie(N,B,P)}if(H(B)||U(B))return B=Cr(B,N.mode,P,null),B.return=N,B;if(typeof B.then=="function")return ie(N,Za(B),P);if(B.$$typeof===j)return ie(N,Ka(N,B),P);Qa(N,B)}return null}function Y(N,B,P,ee){var ge=B!==null?B.key:null;if(typeof P=="string"&&P!==""||typeof P=="number"||typeof P=="bigint")return ge!==null?null:w(N,B,""+P,ee);if(typeof P=="object"&&P!==null){switch(P.$$typeof){case y:return P.key===ge?D(N,B,P,ee):null;case b:return P.key===ge?I(N,B,P,ee):null;case Z:return P=Dr(P),Y(N,B,P,ee)}if(H(P)||U(P))return ge!==null?null:Q(N,B,P,ee,null);if(typeof P.then=="function")return Y(N,B,Za(P),ee);if(P.$$typeof===j)return Y(N,B,Ka(N,P),ee);Qa(N,P)}return null}function G(N,B,P,ee,ge){if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return N=N.get(P)||null,w(B,N,""+ee,ge);if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case y:return N=N.get(ee.key===null?P:ee.key)||null,D(B,N,ee,ge);case b:return N=N.get(ee.key===null?P:ee.key)||null,I(B,N,ee,ge);case Z:return ee=Dr(ee),G(N,B,P,ee,ge)}if(H(ee)||U(ee))return N=N.get(P)||null,Q(B,N,ee,ge,null);if(typeof ee.then=="function")return G(N,B,P,Za(ee),ge);if(ee.$$typeof===j)return G(N,B,P,Ka(B,ee),ge);Qa(B,ee)}return null}function me(N,B,P,ee){for(var ge=null,Ue=null,_e=B,ke=B=0,Ne=null;_e!==null&&ke<P.length;ke++){_e.index>ke?(Ne=_e,_e=null):Ne=_e.sibling;var Pe=Y(N,_e,P[ke],ee);if(Pe===null){_e===null&&(_e=Ne);break}i&&_e&&Pe.alternate===null&&r(N,_e),B=m(Pe,B,ke),Ue===null?ge=Pe:Ue.sibling=Pe,Ue=Pe,_e=Ne}if(ke===P.length)return l(N,_e),Oe&&gn(N,ke),ge;if(_e===null){for(;ke<P.length;ke++)_e=ie(N,P[ke],ee),_e!==null&&(B=m(_e,B,ke),Ue===null?ge=_e:Ue.sibling=_e,Ue=_e);return Oe&&gn(N,ke),ge}for(_e=u(_e);ke<P.length;ke++)Ne=G(_e,N,ke,P[ke],ee),Ne!==null&&(i&&Ne.alternate!==null&&_e.delete(Ne.key===null?ke:Ne.key),B=m(Ne,B,ke),Ue===null?ge=Ne:Ue.sibling=Ne,Ue=Ne);return i&&_e.forEach(function(or){return r(N,or)}),Oe&&gn(N,ke),ge}function ye(N,B,P,ee){if(P==null)throw Error(s(151));for(var ge=null,Ue=null,_e=B,ke=B=0,Ne=null,Pe=P.next();_e!==null&&!Pe.done;ke++,Pe=P.next()){_e.index>ke?(Ne=_e,_e=null):Ne=_e.sibling;var or=Y(N,_e,Pe.value,ee);if(or===null){_e===null&&(_e=Ne);break}i&&_e&&or.alternate===null&&r(N,_e),B=m(or,B,ke),Ue===null?ge=or:Ue.sibling=or,Ue=or,_e=Ne}if(Pe.done)return l(N,_e),Oe&&gn(N,ke),ge;if(_e===null){for(;!Pe.done;ke++,Pe=P.next())Pe=ie(N,Pe.value,ee),Pe!==null&&(B=m(Pe,B,ke),Ue===null?ge=Pe:Ue.sibling=Pe,Ue=Pe);return Oe&&gn(N,ke),ge}for(_e=u(_e);!Pe.done;ke++,Pe=P.next())Pe=G(_e,N,ke,Pe.value,ee),Pe!==null&&(i&&Pe.alternate!==null&&_e.delete(Pe.key===null?ke:Pe.key),B=m(Pe,B,ke),Ue===null?ge=Pe:Ue.sibling=Pe,Ue=Pe);return i&&_e.forEach(function(px){return r(N,px)}),Oe&&gn(N,ke),ge}function Xe(N,B,P,ee){if(typeof P=="object"&&P!==null&&P.type===k&&P.key===null&&(P=P.props.children),typeof P=="object"&&P!==null){switch(P.$$typeof){case y:e:{for(var ge=P.key;B!==null;){if(B.key===ge){if(ge=P.type,ge===k){if(B.tag===7){l(N,B.sibling),ee=d(B,P.props.children),ee.return=N,N=ee;break e}}else if(B.elementType===ge||typeof ge=="object"&&ge!==null&&ge.$$typeof===Z&&Dr(ge)===B.type){l(N,B.sibling),ee=d(B,P.props),_l(ee,P),ee.return=N,N=ee;break e}l(N,B);break}else r(N,B);B=B.sibling}P.type===k?(ee=Cr(P.props.children,N.mode,ee,P.key),ee.return=N,N=ee):(ee=Wa(P.type,P.key,P.props,null,N.mode,ee),_l(ee,P),ee.return=N,N=ee)}return v(N);case b:e:{for(ge=P.key;B!==null;){if(B.key===ge)if(B.tag===4&&B.stateNode.containerInfo===P.containerInfo&&B.stateNode.implementation===P.implementation){l(N,B.sibling),ee=d(B,P.children||[]),ee.return=N,N=ee;break e}else{l(N,B);break}else r(N,B);B=B.sibling}ee=lc(P,N.mode,ee),ee.return=N,N=ee}return v(N);case Z:return P=Dr(P),Xe(N,B,P,ee)}if(H(P))return me(N,B,P,ee);if(U(P)){if(ge=U(P),typeof ge!="function")throw Error(s(150));return P=ge.call(P),ye(N,B,P,ee)}if(typeof P.then=="function")return Xe(N,B,Za(P),ee);if(P.$$typeof===j)return Xe(N,B,Ka(N,P),ee);Qa(N,P)}return typeof P=="string"&&P!==""||typeof P=="number"||typeof P=="bigint"?(P=""+P,B!==null&&B.tag===6?(l(N,B.sibling),ee=d(B,P),ee.return=N,N=ee):(l(N,B),ee=sc(P,N.mode,ee),ee.return=N,N=ee),v(N)):l(N,B)}return function(N,B,P,ee){try{ml=0;var ge=Xe(N,B,P,ee);return Ss=null,ge}catch(_e){if(_e===ys||_e===$a)throw _e;var Ue=bi(29,_e,null,N.mode);return Ue.lanes=ee,Ue.return=N,Ue}finally{}}}var Mr=lm(!0),am=lm(!1),Yn=!1;function vc(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function yc(i,r){i=i.updateQueue,r.updateQueue===i&&(r.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function Vn(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function Kn(i,r,l){var u=i.updateQueue;if(u===null)return null;if(u=u.shared,(Ie&2)!==0){var d=u.pending;return d===null?r.next=r:(r.next=d.next,d.next=r),u.pending=r,r=qa(i),Wp(i,null,l),r}return Fa(i,u,r,l),qa(i)}function gl(i,r,l){if(r=r.updateQueue,r!==null&&(r=r.shared,(l&4194048)!==0)){var u=r.lanes;u&=i.pendingLanes,l|=u,r.lanes=l,Qd(i,l)}}function Sc(i,r){var l=i.updateQueue,u=i.alternate;if(u!==null&&(u=u.updateQueue,l===u)){var d=null,m=null;if(l=l.firstBaseUpdate,l!==null){do{var v={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};m===null?d=m=v:m=m.next=v,l=l.next}while(l!==null);m===null?d=m=r:m=m.next=r}else d=m=r;l={baseState:u.baseState,firstBaseUpdate:d,lastBaseUpdate:m,shared:u.shared,callbacks:u.callbacks},i.updateQueue=l;return}i=l.lastBaseUpdate,i===null?l.firstBaseUpdate=r:i.next=r,l.lastBaseUpdate=r}var bc=!1;function vl(){if(bc){var i=vs;if(i!==null)throw i}}function yl(i,r,l,u){bc=!1;var d=i.updateQueue;Yn=!1;var m=d.firstBaseUpdate,v=d.lastBaseUpdate,w=d.shared.pending;if(w!==null){d.shared.pending=null;var D=w,I=D.next;D.next=null,v===null?m=I:v.next=I,v=D;var Q=i.alternate;Q!==null&&(Q=Q.updateQueue,w=Q.lastBaseUpdate,w!==v&&(w===null?Q.firstBaseUpdate=I:w.next=I,Q.lastBaseUpdate=D))}if(m!==null){var ie=d.baseState;v=0,Q=I=D=null,w=m;do{var Y=w.lane&-536870913,G=Y!==w.lane;if(G?(ze&Y)===Y:(u&Y)===Y){Y!==0&&Y===gs&&(bc=!0),Q!==null&&(Q=Q.next={lane:0,tag:w.tag,payload:w.payload,callback:null,next:null});e:{var me=i,ye=w;Y=r;var Xe=l;switch(ye.tag){case 1:if(me=ye.payload,typeof me=="function"){ie=me.call(Xe,ie,Y);break e}ie=me;break e;case 3:me.flags=me.flags&-65537|128;case 0:if(me=ye.payload,Y=typeof me=="function"?me.call(Xe,ie,Y):me,Y==null)break e;ie=_({},ie,Y);break e;case 2:Yn=!0}}Y=w.callback,Y!==null&&(i.flags|=64,G&&(i.flags|=8192),G=d.callbacks,G===null?d.callbacks=[Y]:G.push(Y))}else G={lane:Y,tag:w.tag,payload:w.payload,callback:w.callback,next:null},Q===null?(I=Q=G,D=ie):Q=Q.next=G,v|=Y;if(w=w.next,w===null){if(w=d.shared.pending,w===null)break;G=w,w=G.next,G.next=null,d.lastBaseUpdate=G,d.shared.pending=null}}while(!0);Q===null&&(D=ie),d.baseState=D,d.firstBaseUpdate=I,d.lastBaseUpdate=Q,m===null&&(d.shared.lanes=0),Qn|=v,i.lanes=v,i.memoizedState=ie}}function om(i,r){if(typeof i!="function")throw Error(s(191,i));i.call(r)}function um(i,r){var l=i.callbacks;if(l!==null)for(i.callbacks=null,i=0;i<l.length;i++)om(l[i],r)}var bs=A(null),Ja=A(0);function cm(i,r){i=An,C(Ja,i),C(bs,r),An=i|r.baseLanes}function xc(){C(Ja,An),C(bs,bs.current)}function wc(){An=Ja.current,K(bs),K(Ja)}var xi=A(null),Ui=null;function Xn(i){var r=i.alternate;C(ft,ft.current&1),C(xi,i),Ui===null&&(r===null||bs.current!==null||r.memoizedState!==null)&&(Ui=i)}function Cc(i){C(ft,ft.current),C(xi,i),Ui===null&&(Ui=i)}function hm(i){i.tag===22?(C(ft,ft.current),C(xi,i),Ui===null&&(Ui=i)):$n()}function $n(){C(ft,ft.current),C(xi,xi.current)}function wi(i){K(xi),Ui===i&&(Ui=null),K(ft)}var ft=A(0);function eo(i){for(var r=i;r!==null;){if(r.tag===13){var l=r.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||Rh(l)||Mh(l)))return r}else if(r.tag===19&&(r.memoizedProps.revealOrder==="forwards"||r.memoizedProps.revealOrder==="backwards"||r.memoizedProps.revealOrder==="unstable_legacy-backwards"||r.memoizedProps.revealOrder==="together")){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===i)break;for(;r.sibling===null;){if(r.return===null||r.return===i)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var Sn=0,Ce=null,Ve=null,_t=null,to=!1,xs=!1,Br=!1,io=0,Sl=0,ws=null,r1=0;function at(){throw Error(s(321))}function kc(i,r){if(r===null)return!1;for(var l=0;l<r.length&&l<i.length;l++)if(!Si(i[l],r[l]))return!1;return!0}function Ec(i,r,l,u,d,m){return Sn=m,Ce=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,M.H=i===null||i.memoizedState===null?Xm:Ic,Br=!1,m=l(u,d),Br=!1,xs&&(m=dm(r,l,u,d)),fm(i),m}function fm(i){M.H=wl;var r=Ve!==null&&Ve.next!==null;if(Sn=0,_t=Ve=Ce=null,to=!1,Sl=0,ws=null,r)throw Error(s(300));i===null||gt||(i=i.dependencies,i!==null&&Va(i)&&(gt=!0))}function dm(i,r,l,u){Ce=i;var d=0;do{if(xs&&(ws=null),Sl=0,xs=!1,25<=d)throw Error(s(301));if(d+=1,_t=Ve=null,i.updateQueue!=null){var m=i.updateQueue;m.lastEffect=null,m.events=null,m.stores=null,m.memoCache!=null&&(m.memoCache.index=0)}M.H=$m,m=r(l,u)}while(xs);return m}function s1(){var i=M.H,r=i.useState()[0];return r=typeof r.then=="function"?bl(r):r,i=i.useState()[0],(Ve!==null?Ve.memoizedState:null)!==i&&(Ce.flags|=1024),r}function Tc(){var i=io!==0;return io=0,i}function Ac(i,r,l){r.updateQueue=i.updateQueue,r.flags&=-2053,i.lanes&=~l}function Dc(i){if(to){for(i=i.memoizedState;i!==null;){var r=i.queue;r!==null&&(r.pending=null),i=i.next}to=!1}Sn=0,_t=Ve=Ce=null,xs=!1,Sl=io=0,ws=null}function ei(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return _t===null?Ce.memoizedState=_t=i:_t=_t.next=i,_t}function dt(){if(Ve===null){var i=Ce.alternate;i=i!==null?i.memoizedState:null}else i=Ve.next;var r=_t===null?Ce.memoizedState:_t.next;if(r!==null)_t=r,Ve=i;else{if(i===null)throw Ce.alternate===null?Error(s(467)):Error(s(310));Ve=i,i={memoizedState:Ve.memoizedState,baseState:Ve.baseState,baseQueue:Ve.baseQueue,queue:Ve.queue,next:null},_t===null?Ce.memoizedState=_t=i:_t=_t.next=i}return _t}function no(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function bl(i){var r=Sl;return Sl+=1,ws===null&&(ws=[]),i=nm(ws,i,r),r=Ce,(_t===null?r.memoizedState:_t.next)===null&&(r=r.alternate,M.H=r===null||r.memoizedState===null?Xm:Ic),i}function ro(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return bl(i);if(i.$$typeof===j)return Pt(i)}throw Error(s(438,String(i)))}function Rc(i){var r=null,l=Ce.updateQueue;if(l!==null&&(r=l.memoCache),r==null){var u=Ce.alternate;u!==null&&(u=u.updateQueue,u!==null&&(u=u.memoCache,u!=null&&(r={data:u.data.map(function(d){return d.slice()}),index:0})))}if(r==null&&(r={data:[],index:0}),l===null&&(l=no(),Ce.updateQueue=l),l.memoCache=r,l=r.data[r.index],l===void 0)for(l=r.data[r.index]=Array(i),u=0;u<i;u++)l[u]=z;return r.index++,l}function bn(i,r){return typeof r=="function"?r(i):r}function so(i){var r=dt();return Mc(r,Ve,i)}function Mc(i,r,l){var u=i.queue;if(u===null)throw Error(s(311));u.lastRenderedReducer=l;var d=i.baseQueue,m=u.pending;if(m!==null){if(d!==null){var v=d.next;d.next=m.next,m.next=v}r.baseQueue=d=m,u.pending=null}if(m=i.baseState,d===null)i.memoizedState=m;else{r=d.next;var w=v=null,D=null,I=r,Q=!1;do{var ie=I.lane&-536870913;if(ie!==I.lane?(ze&ie)===ie:(Sn&ie)===ie){var Y=I.revertLane;if(Y===0)D!==null&&(D=D.next={lane:0,revertLane:0,gesture:null,action:I.action,hasEagerState:I.hasEagerState,eagerState:I.eagerState,next:null}),ie===gs&&(Q=!0);else if((Sn&Y)===Y){I=I.next,Y===gs&&(Q=!0);continue}else ie={lane:0,revertLane:I.revertLane,gesture:null,action:I.action,hasEagerState:I.hasEagerState,eagerState:I.eagerState,next:null},D===null?(w=D=ie,v=m):D=D.next=ie,Ce.lanes|=Y,Qn|=Y;ie=I.action,Br&&l(m,ie),m=I.hasEagerState?I.eagerState:l(m,ie)}else Y={lane:ie,revertLane:I.revertLane,gesture:I.gesture,action:I.action,hasEagerState:I.hasEagerState,eagerState:I.eagerState,next:null},D===null?(w=D=Y,v=m):D=D.next=Y,Ce.lanes|=ie,Qn|=ie;I=I.next}while(I!==null&&I!==r);if(D===null?v=m:D.next=w,!Si(m,i.memoizedState)&&(gt=!0,Q&&(l=vs,l!==null)))throw l;i.memoizedState=m,i.baseState=v,i.baseQueue=D,u.lastRenderedState=m}return d===null&&(u.lanes=0),[i.memoizedState,u.dispatch]}function Bc(i){var r=dt(),l=r.queue;if(l===null)throw Error(s(311));l.lastRenderedReducer=i;var u=l.dispatch,d=l.pending,m=r.memoizedState;if(d!==null){l.pending=null;var v=d=d.next;do m=i(m,v.action),v=v.next;while(v!==d);Si(m,r.memoizedState)||(gt=!0),r.memoizedState=m,r.baseQueue===null&&(r.baseState=m),l.lastRenderedState=m}return[m,u]}function pm(i,r,l){var u=Ce,d=dt(),m=Oe;if(m){if(l===void 0)throw Error(s(407));l=l()}else l=r();var v=!Si((Ve||d).memoizedState,l);if(v&&(d.memoizedState=l,gt=!0),d=d.queue,Nc(gm.bind(null,u,d,i),[i]),d.getSnapshot!==r||v||_t!==null&&_t.memoizedState.tag&1){if(u.flags|=2048,Cs(9,{destroy:void 0},_m.bind(null,u,d,l,r),null),Ze===null)throw Error(s(349));m||(Sn&127)!==0||mm(u,r,l)}return l}function mm(i,r,l){i.flags|=16384,i={getSnapshot:r,value:l},r=Ce.updateQueue,r===null?(r=no(),Ce.updateQueue=r,r.stores=[i]):(l=r.stores,l===null?r.stores=[i]:l.push(i))}function _m(i,r,l,u){r.value=l,r.getSnapshot=u,vm(r)&&ym(i)}function gm(i,r,l){return l(function(){vm(r)&&ym(i)})}function vm(i){var r=i.getSnapshot;i=i.value;try{var l=r();return!Si(i,l)}catch{return!0}}function ym(i){var r=wr(i,2);r!==null&&pi(r,i,2)}function Lc(i){var r=ei();if(typeof i=="function"){var l=i;if(i=l(),Br){ai(!0);try{l()}finally{ai(!1)}}}return r.memoizedState=r.baseState=i,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:bn,lastRenderedState:i},r}function Sm(i,r,l,u){return i.baseState=l,Mc(i,Ve,typeof u=="function"?u:bn)}function l1(i,r,l,u,d){if(oo(i))throw Error(s(485));if(i=r.action,i!==null){var m={payload:d,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(v){m.listeners.push(v)}};M.T!==null?l(!0):m.isTransition=!1,u(m),l=r.pending,l===null?(m.next=r.pending=m,bm(r,m)):(m.next=l.next,r.pending=l.next=m)}}function bm(i,r){var l=r.action,u=r.payload,d=i.state;if(r.isTransition){var m=M.T,v={};M.T=v;try{var w=l(d,u),D=M.S;D!==null&&D(v,w),xm(i,r,w)}catch(I){zc(i,r,I)}finally{m!==null&&v.types!==null&&(m.types=v.types),M.T=m}}else try{m=l(d,u),xm(i,r,m)}catch(I){zc(i,r,I)}}function xm(i,r,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(u){wm(i,r,u)},function(u){return zc(i,r,u)}):wm(i,r,l)}function wm(i,r,l){r.status="fulfilled",r.value=l,Cm(r),i.state=l,r=i.pending,r!==null&&(l=r.next,l===r?i.pending=null:(l=l.next,r.next=l,bm(i,l)))}function zc(i,r,l){var u=i.pending;if(i.pending=null,u!==null){u=u.next;do r.status="rejected",r.reason=l,Cm(r),r=r.next;while(r!==u)}i.action=null}function Cm(i){i=i.listeners;for(var r=0;r<i.length;r++)(0,i[r])()}function km(i,r){return r}function Em(i,r){if(Oe){var l=Ze.formState;if(l!==null){e:{var u=Ce;if(Oe){if(et){t:{for(var d=et,m=ji;d.nodeType!==8;){if(!m){d=null;break t}if(d=Pi(d.nextSibling),d===null){d=null;break t}}m=d.data,d=m==="F!"||m==="F"?d:null}if(d){et=Pi(d.nextSibling),u=d.data==="F!";break e}}qn(u)}u=!1}u&&(r=l[0])}}return l=ei(),l.memoizedState=l.baseState=r,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:km,lastRenderedState:r},l.queue=u,l=Ym.bind(null,Ce,u),u.dispatch=l,u=Lc(!1),m=Pc.bind(null,Ce,!1,u.queue),u=ei(),d={state:r,dispatch:null,action:i,pending:null},u.queue=d,l=l1.bind(null,Ce,d,m,l),d.dispatch=l,u.memoizedState=i,[r,l,!1]}function Tm(i){var r=dt();return Am(r,Ve,i)}function Am(i,r,l){if(r=Mc(i,r,km)[0],i=so(bn)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var u=bl(r)}catch(v){throw v===ys?$a:v}else u=r;r=dt();var d=r.queue,m=d.dispatch;return l!==r.memoizedState&&(Ce.flags|=2048,Cs(9,{destroy:void 0},a1.bind(null,d,l),null)),[u,m,i]}function a1(i,r){i.action=r}function Dm(i){var r=dt(),l=Ve;if(l!==null)return Am(r,l,i);dt(),r=r.memoizedState,l=dt();var u=l.queue.dispatch;return l.memoizedState=i,[r,u,!1]}function Cs(i,r,l,u){return i={tag:i,create:l,deps:u,inst:r,next:null},r=Ce.updateQueue,r===null&&(r=no(),Ce.updateQueue=r),l=r.lastEffect,l===null?r.lastEffect=i.next=i:(u=l.next,l.next=i,i.next=u,r.lastEffect=i),i}function Rm(){return dt().memoizedState}function lo(i,r,l,u){var d=ei();Ce.flags|=i,d.memoizedState=Cs(1|r,{destroy:void 0},l,u===void 0?null:u)}function ao(i,r,l,u){var d=dt();u=u===void 0?null:u;var m=d.memoizedState.inst;Ve!==null&&u!==null&&kc(u,Ve.memoizedState.deps)?d.memoizedState=Cs(r,m,l,u):(Ce.flags|=i,d.memoizedState=Cs(1|r,m,l,u))}function Mm(i,r){lo(8390656,8,i,r)}function Nc(i,r){ao(2048,8,i,r)}function o1(i){Ce.flags|=4;var r=Ce.updateQueue;if(r===null)r=no(),Ce.updateQueue=r,r.events=[i];else{var l=r.events;l===null?r.events=[i]:l.push(i)}}function Bm(i){var r=dt().memoizedState;return o1({ref:r,nextImpl:i}),function(){if((Ie&2)!==0)throw Error(s(440));return r.impl.apply(void 0,arguments)}}function Lm(i,r){return ao(4,2,i,r)}function zm(i,r){return ao(4,4,i,r)}function Nm(i,r){if(typeof r=="function"){i=i();var l=r(i);return function(){typeof l=="function"?l():r(null)}}if(r!=null)return i=i(),r.current=i,function(){r.current=null}}function Om(i,r,l){l=l!=null?l.concat([i]):null,ao(4,4,Nm.bind(null,r,i),l)}function Oc(){}function Hm(i,r){var l=dt();r=r===void 0?null:r;var u=l.memoizedState;return r!==null&&kc(r,u[1])?u[0]:(l.memoizedState=[i,r],i)}function jm(i,r){var l=dt();r=r===void 0?null:r;var u=l.memoizedState;if(r!==null&&kc(r,u[1]))return u[0];if(u=i(),Br){ai(!0);try{i()}finally{ai(!1)}}return l.memoizedState=[u,r],u}function Hc(i,r,l){return l===void 0||(Sn&1073741824)!==0&&(ze&261930)===0?i.memoizedState=r:(i.memoizedState=l,i=U_(),Ce.lanes|=i,Qn|=i,l)}function Um(i,r,l,u){return Si(l,r)?l:bs.current!==null?(i=Hc(i,l,u),Si(i,r)||(gt=!0),i):(Sn&42)===0||(Sn&1073741824)!==0&&(ze&261930)===0?(gt=!0,i.memoizedState=l):(i=U_(),Ce.lanes|=i,Qn|=i,r)}function Pm(i,r,l,u,d){var m=q.p;q.p=m!==0&&8>m?m:8;var v=M.T,w={};M.T=w,Pc(i,!1,r,l);try{var D=d(),I=M.S;if(I!==null&&I(w,D),D!==null&&typeof D=="object"&&typeof D.then=="function"){var Q=n1(D,u);xl(i,r,Q,Ei(i))}else xl(i,r,u,Ei(i))}catch(ie){xl(i,r,{then:function(){},status:"rejected",reason:ie},Ei())}finally{q.p=m,v!==null&&w.types!==null&&(v.types=w.types),M.T=v}}function u1(){}function jc(i,r,l,u){if(i.tag!==5)throw Error(s(476));var d=Im(i).queue;Pm(i,d,r,W,l===null?u1:function(){return Fm(i),l(u)})}function Im(i){var r=i.memoizedState;if(r!==null)return r;r={memoizedState:W,baseState:W,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:bn,lastRenderedState:W},next:null};var l={};return r.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:bn,lastRenderedState:l},next:null},i.memoizedState=r,i=i.alternate,i!==null&&(i.memoizedState=r),r}function Fm(i){var r=Im(i);r.next===null&&(r=i.alternate.memoizedState),xl(i,r.next.queue,{},Ei())}function Uc(){return Pt(Ul)}function qm(){return dt().memoizedState}function Wm(){return dt().memoizedState}function c1(i){for(var r=i.return;r!==null;){switch(r.tag){case 24:case 3:var l=Ei();i=Vn(l);var u=Kn(r,i,l);u!==null&&(pi(u,r,l),gl(u,r,l)),r={cache:pc()},i.payload=r;return}r=r.return}}function h1(i,r,l){var u=Ei();l={lane:u,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},oo(i)?Vm(r,l):(l=nc(i,r,l,u),l!==null&&(pi(l,i,u),Km(l,r,u)))}function Ym(i,r,l){var u=Ei();xl(i,r,l,u)}function xl(i,r,l,u){var d={lane:u,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(oo(i))Vm(r,d);else{var m=i.alternate;if(i.lanes===0&&(m===null||m.lanes===0)&&(m=r.lastRenderedReducer,m!==null))try{var v=r.lastRenderedState,w=m(v,l);if(d.hasEagerState=!0,d.eagerState=w,Si(w,v))return Fa(i,r,d,0),Ze===null&&Ia(),!1}catch{}finally{}if(l=nc(i,r,d,u),l!==null)return pi(l,i,u),Km(l,r,u),!0}return!1}function Pc(i,r,l,u){if(u={lane:2,revertLane:vh(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},oo(i)){if(r)throw Error(s(479))}else r=nc(i,l,u,2),r!==null&&pi(r,i,2)}function oo(i){var r=i.alternate;return i===Ce||r!==null&&r===Ce}function Vm(i,r){xs=to=!0;var l=i.pending;l===null?r.next=r:(r.next=l.next,l.next=r),i.pending=r}function Km(i,r,l){if((l&4194048)!==0){var u=r.lanes;u&=i.pendingLanes,l|=u,r.lanes=l,Qd(i,l)}}var wl={readContext:Pt,use:ro,useCallback:at,useContext:at,useEffect:at,useImperativeHandle:at,useLayoutEffect:at,useInsertionEffect:at,useMemo:at,useReducer:at,useRef:at,useState:at,useDebugValue:at,useDeferredValue:at,useTransition:at,useSyncExternalStore:at,useId:at,useHostTransitionStatus:at,useFormState:at,useActionState:at,useOptimistic:at,useMemoCache:at,useCacheRefresh:at};wl.useEffectEvent=at;var Xm={readContext:Pt,use:ro,useCallback:function(i,r){return ei().memoizedState=[i,r===void 0?null:r],i},useContext:Pt,useEffect:Mm,useImperativeHandle:function(i,r,l){l=l!=null?l.concat([i]):null,lo(4194308,4,Nm.bind(null,r,i),l)},useLayoutEffect:function(i,r){return lo(4194308,4,i,r)},useInsertionEffect:function(i,r){lo(4,2,i,r)},useMemo:function(i,r){var l=ei();r=r===void 0?null:r;var u=i();if(Br){ai(!0);try{i()}finally{ai(!1)}}return l.memoizedState=[u,r],u},useReducer:function(i,r,l){var u=ei();if(l!==void 0){var d=l(r);if(Br){ai(!0);try{l(r)}finally{ai(!1)}}}else d=r;return u.memoizedState=u.baseState=d,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:d},u.queue=i,i=i.dispatch=h1.bind(null,Ce,i),[u.memoizedState,i]},useRef:function(i){var r=ei();return i={current:i},r.memoizedState=i},useState:function(i){i=Lc(i);var r=i.queue,l=Ym.bind(null,Ce,r);return r.dispatch=l,[i.memoizedState,l]},useDebugValue:Oc,useDeferredValue:function(i,r){var l=ei();return Hc(l,i,r)},useTransition:function(){var i=Lc(!1);return i=Pm.bind(null,Ce,i.queue,!0,!1),ei().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,r,l){var u=Ce,d=ei();if(Oe){if(l===void 0)throw Error(s(407));l=l()}else{if(l=r(),Ze===null)throw Error(s(349));(ze&127)!==0||mm(u,r,l)}d.memoizedState=l;var m={value:l,getSnapshot:r};return d.queue=m,Mm(gm.bind(null,u,m,i),[i]),u.flags|=2048,Cs(9,{destroy:void 0},_m.bind(null,u,m,l,r),null),l},useId:function(){var i=ei(),r=Ze.identifierPrefix;if(Oe){var l=en,u=Ji;l=(u&~(1<<32-Ge(u)-1)).toString(32)+l,r="_"+r+"R_"+l,l=io++,0<l&&(r+="H"+l.toString(32)),r+="_"}else l=r1++,r="_"+r+"r_"+l.toString(32)+"_";return i.memoizedState=r},useHostTransitionStatus:Uc,useFormState:Em,useActionState:Em,useOptimistic:function(i){var r=ei();r.memoizedState=r.baseState=i;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=l,r=Pc.bind(null,Ce,!0,l),l.dispatch=r,[i,r]},useMemoCache:Rc,useCacheRefresh:function(){return ei().memoizedState=c1.bind(null,Ce)},useEffectEvent:function(i){var r=ei(),l={impl:i};return r.memoizedState=l,function(){if((Ie&2)!==0)throw Error(s(440));return l.impl.apply(void 0,arguments)}}},Ic={readContext:Pt,use:ro,useCallback:Hm,useContext:Pt,useEffect:Nc,useImperativeHandle:Om,useInsertionEffect:Lm,useLayoutEffect:zm,useMemo:jm,useReducer:so,useRef:Rm,useState:function(){return so(bn)},useDebugValue:Oc,useDeferredValue:function(i,r){var l=dt();return Um(l,Ve.memoizedState,i,r)},useTransition:function(){var i=so(bn)[0],r=dt().memoizedState;return[typeof i=="boolean"?i:bl(i),r]},useSyncExternalStore:pm,useId:qm,useHostTransitionStatus:Uc,useFormState:Tm,useActionState:Tm,useOptimistic:function(i,r){var l=dt();return Sm(l,Ve,i,r)},useMemoCache:Rc,useCacheRefresh:Wm};Ic.useEffectEvent=Bm;var $m={readContext:Pt,use:ro,useCallback:Hm,useContext:Pt,useEffect:Nc,useImperativeHandle:Om,useInsertionEffect:Lm,useLayoutEffect:zm,useMemo:jm,useReducer:Bc,useRef:Rm,useState:function(){return Bc(bn)},useDebugValue:Oc,useDeferredValue:function(i,r){var l=dt();return Ve===null?Hc(l,i,r):Um(l,Ve.memoizedState,i,r)},useTransition:function(){var i=Bc(bn)[0],r=dt().memoizedState;return[typeof i=="boolean"?i:bl(i),r]},useSyncExternalStore:pm,useId:qm,useHostTransitionStatus:Uc,useFormState:Dm,useActionState:Dm,useOptimistic:function(i,r){var l=dt();return Ve!==null?Sm(l,Ve,i,r):(l.baseState=i,[i,l.queue.dispatch])},useMemoCache:Rc,useCacheRefresh:Wm};$m.useEffectEvent=Bm;function Fc(i,r,l,u){r=i.memoizedState,l=l(u,r),l=l==null?r:_({},r,l),i.memoizedState=l,i.lanes===0&&(i.updateQueue.baseState=l)}var qc={enqueueSetState:function(i,r,l){i=i._reactInternals;var u=Ei(),d=Vn(u);d.payload=r,l!=null&&(d.callback=l),r=Kn(i,d,u),r!==null&&(pi(r,i,u),gl(r,i,u))},enqueueReplaceState:function(i,r,l){i=i._reactInternals;var u=Ei(),d=Vn(u);d.tag=1,d.payload=r,l!=null&&(d.callback=l),r=Kn(i,d,u),r!==null&&(pi(r,i,u),gl(r,i,u))},enqueueForceUpdate:function(i,r){i=i._reactInternals;var l=Ei(),u=Vn(l);u.tag=2,r!=null&&(u.callback=r),r=Kn(i,u,l),r!==null&&(pi(r,i,l),gl(r,i,l))}};function Gm(i,r,l,u,d,m,v){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(u,m,v):r.prototype&&r.prototype.isPureReactComponent?!ul(l,u)||!ul(d,m):!0}function Zm(i,r,l,u){i=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(l,u),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(l,u),r.state!==i&&qc.enqueueReplaceState(r,r.state,null)}function Lr(i,r){var l=r;if("ref"in r){l={};for(var u in r)u!=="ref"&&(l[u]=r[u])}if(i=i.defaultProps){l===r&&(l=_({},l));for(var d in i)l[d]===void 0&&(l[d]=i[d])}return l}function Qm(i){Pa(i)}function Jm(i){console.error(i)}function e_(i){Pa(i)}function uo(i,r){try{var l=i.onUncaughtError;l(r.value,{componentStack:r.stack})}catch(u){setTimeout(function(){throw u})}}function t_(i,r,l){try{var u=i.onCaughtError;u(l.value,{componentStack:l.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(d){setTimeout(function(){throw d})}}function Wc(i,r,l){return l=Vn(l),l.tag=3,l.payload={element:null},l.callback=function(){uo(i,r)},l}function i_(i){return i=Vn(i),i.tag=3,i}function n_(i,r,l,u){var d=l.type.getDerivedStateFromError;if(typeof d=="function"){var m=u.value;i.payload=function(){return d(m)},i.callback=function(){t_(r,l,u)}}var v=l.stateNode;v!==null&&typeof v.componentDidCatch=="function"&&(i.callback=function(){t_(r,l,u),typeof d!="function"&&(Jn===null?Jn=new Set([this]):Jn.add(this));var w=u.stack;this.componentDidCatch(u.value,{componentStack:w!==null?w:""})})}function f1(i,r,l,u,d){if(l.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(r=l.alternate,r!==null&&_s(r,l,d,!0),l=xi.current,l!==null){switch(l.tag){case 31:case 13:return Ui===null?xo():l.alternate===null&&ot===0&&(ot=3),l.flags&=-257,l.flags|=65536,l.lanes=d,u===Ga?l.flags|=16384:(r=l.updateQueue,r===null?l.updateQueue=new Set([u]):r.add(u),mh(i,u,d)),!1;case 22:return l.flags|=65536,u===Ga?l.flags|=16384:(r=l.updateQueue,r===null?(r={transitions:null,markerInstances:null,retryQueue:new Set([u])},l.updateQueue=r):(l=r.retryQueue,l===null?r.retryQueue=new Set([u]):l.add(u)),mh(i,u,d)),!1}throw Error(s(435,l.tag))}return mh(i,u,d),xo(),!1}if(Oe)return r=xi.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=d,u!==uc&&(i=Error(s(422),{cause:u}),fl(Ni(i,l)))):(u!==uc&&(r=Error(s(423),{cause:u}),fl(Ni(r,l))),i=i.current.alternate,i.flags|=65536,d&=-d,i.lanes|=d,u=Ni(u,l),d=Wc(i.stateNode,u,d),Sc(i,d),ot!==4&&(ot=2)),!1;var m=Error(s(520),{cause:u});if(m=Ni(m,l),Ml===null?Ml=[m]:Ml.push(m),ot!==4&&(ot=2),r===null)return!0;u=Ni(u,l),l=r;do{switch(l.tag){case 3:return l.flags|=65536,i=d&-d,l.lanes|=i,i=Wc(l.stateNode,u,i),Sc(l,i),!1;case 1:if(r=l.type,m=l.stateNode,(l.flags&128)===0&&(typeof r.getDerivedStateFromError=="function"||m!==null&&typeof m.componentDidCatch=="function"&&(Jn===null||!Jn.has(m))))return l.flags|=65536,d&=-d,l.lanes|=d,d=i_(d),n_(d,i,l,u),Sc(l,d),!1}l=l.return}while(l!==null);return!1}var Yc=Error(s(461)),gt=!1;function It(i,r,l,u){r.child=i===null?am(r,null,l,u):Mr(r,i.child,l,u)}function r_(i,r,l,u,d){l=l.render;var m=r.ref;if("ref"in u){var v={};for(var w in u)w!=="ref"&&(v[w]=u[w])}else v=u;return Tr(r),u=Ec(i,r,l,v,m,d),w=Tc(),i!==null&&!gt?(Ac(i,r,d),xn(i,r,d)):(Oe&&w&&ac(r),r.flags|=1,It(i,r,u,d),r.child)}function s_(i,r,l,u,d){if(i===null){var m=l.type;return typeof m=="function"&&!rc(m)&&m.defaultProps===void 0&&l.compare===null?(r.tag=15,r.type=m,l_(i,r,m,u,d)):(i=Wa(l.type,null,u,r,r.mode,d),i.ref=r.ref,i.return=r,r.child=i)}if(m=i.child,!Jc(i,d)){var v=m.memoizedProps;if(l=l.compare,l=l!==null?l:ul,l(v,u)&&i.ref===r.ref)return xn(i,r,d)}return r.flags|=1,i=_n(m,u),i.ref=r.ref,i.return=r,r.child=i}function l_(i,r,l,u,d){if(i!==null){var m=i.memoizedProps;if(ul(m,u)&&i.ref===r.ref)if(gt=!1,r.pendingProps=u=m,Jc(i,d))(i.flags&131072)!==0&&(gt=!0);else return r.lanes=i.lanes,xn(i,r,d)}return Vc(i,r,l,u,d)}function a_(i,r,l,u){var d=u.children,m=i!==null?i.memoizedState:null;if(i===null&&r.stateNode===null&&(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.mode==="hidden"){if((r.flags&128)!==0){if(m=m!==null?m.baseLanes|l:l,i!==null){for(u=r.child=i.child,d=0;u!==null;)d=d|u.lanes|u.childLanes,u=u.sibling;u=d&~m}else u=0,r.child=null;return o_(i,r,m,l,u)}if((l&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},i!==null&&Xa(r,m!==null?m.cachePool:null),m!==null?cm(r,m):xc(),hm(r);else return u=r.lanes=536870912,o_(i,r,m!==null?m.baseLanes|l:l,l,u)}else m!==null?(Xa(r,m.cachePool),cm(r,m),$n(),r.memoizedState=null):(i!==null&&Xa(r,null),xc(),$n());return It(i,r,d,l),r.child}function Cl(i,r){return i!==null&&i.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function o_(i,r,l,u,d){var m=_c();return m=m===null?null:{parent:mt._currentValue,pool:m},r.memoizedState={baseLanes:l,cachePool:m},i!==null&&Xa(r,null),xc(),hm(r),i!==null&&_s(i,r,u,!0),r.childLanes=d,null}function co(i,r){return r=fo({mode:r.mode,children:r.children},i.mode),r.ref=i.ref,i.child=r,r.return=i,r}function u_(i,r,l){return Mr(r,i.child,null,l),i=co(r,r.pendingProps),i.flags|=2,wi(r),r.memoizedState=null,i}function d1(i,r,l){var u=r.pendingProps,d=(r.flags&128)!==0;if(r.flags&=-129,i===null){if(Oe){if(u.mode==="hidden")return i=co(r,u),r.lanes=536870912,Cl(null,i);if(Cc(r),(i=et)?(i=bg(i,ji),i=i!==null&&i.data==="&"?i:null,i!==null&&(r.memoizedState={dehydrated:i,treeContext:In!==null?{id:Ji,overflow:en}:null,retryLane:536870912,hydrationErrors:null},l=Vp(i),l.return=r,r.child=l,Ut=r,et=null)):i=null,i===null)throw qn(r);return r.lanes=536870912,null}return co(r,u)}var m=i.memoizedState;if(m!==null){var v=m.dehydrated;if(Cc(r),d)if(r.flags&256)r.flags&=-257,r=u_(i,r,l);else if(r.memoizedState!==null)r.child=i.child,r.flags|=128,r=null;else throw Error(s(558));else if(gt||_s(i,r,l,!1),d=(l&i.childLanes)!==0,gt||d){if(u=Ze,u!==null&&(v=Jd(u,l),v!==0&&v!==m.retryLane))throw m.retryLane=v,wr(i,v),pi(u,i,v),Yc;xo(),r=u_(i,r,l)}else i=m.treeContext,et=Pi(v.nextSibling),Ut=r,Oe=!0,Fn=null,ji=!1,i!==null&&$p(r,i),r=co(r,u),r.flags|=4096;return r}return i=_n(i.child,{mode:u.mode,children:u.children}),i.ref=r.ref,r.child=i,i.return=r,i}function ho(i,r){var l=r.ref;if(l===null)i!==null&&i.ref!==null&&(r.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(s(284));(i===null||i.ref!==l)&&(r.flags|=4194816)}}function Vc(i,r,l,u,d){return Tr(r),l=Ec(i,r,l,u,void 0,d),u=Tc(),i!==null&&!gt?(Ac(i,r,d),xn(i,r,d)):(Oe&&u&&ac(r),r.flags|=1,It(i,r,l,d),r.child)}function c_(i,r,l,u,d,m){return Tr(r),r.updateQueue=null,l=dm(r,u,l,d),fm(i),u=Tc(),i!==null&&!gt?(Ac(i,r,m),xn(i,r,m)):(Oe&&u&&ac(r),r.flags|=1,It(i,r,l,m),r.child)}function h_(i,r,l,u,d){if(Tr(r),r.stateNode===null){var m=fs,v=l.contextType;typeof v=="object"&&v!==null&&(m=Pt(v)),m=new l(u,m),r.memoizedState=m.state!==null&&m.state!==void 0?m.state:null,m.updater=qc,r.stateNode=m,m._reactInternals=r,m=r.stateNode,m.props=u,m.state=r.memoizedState,m.refs={},vc(r),v=l.contextType,m.context=typeof v=="object"&&v!==null?Pt(v):fs,m.state=r.memoizedState,v=l.getDerivedStateFromProps,typeof v=="function"&&(Fc(r,l,v,u),m.state=r.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof m.getSnapshotBeforeUpdate=="function"||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(v=m.state,typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount(),v!==m.state&&qc.enqueueReplaceState(m,m.state,null),yl(r,u,m,d),vl(),m.state=r.memoizedState),typeof m.componentDidMount=="function"&&(r.flags|=4194308),u=!0}else if(i===null){m=r.stateNode;var w=r.memoizedProps,D=Lr(l,w);m.props=D;var I=m.context,Q=l.contextType;v=fs,typeof Q=="object"&&Q!==null&&(v=Pt(Q));var ie=l.getDerivedStateFromProps;Q=typeof ie=="function"||typeof m.getSnapshotBeforeUpdate=="function",w=r.pendingProps!==w,Q||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(w||I!==v)&&Zm(r,m,u,v),Yn=!1;var Y=r.memoizedState;m.state=Y,yl(r,u,m,d),vl(),I=r.memoizedState,w||Y!==I||Yn?(typeof ie=="function"&&(Fc(r,l,ie,u),I=r.memoizedState),(D=Yn||Gm(r,l,D,u,Y,I,v))?(Q||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount()),typeof m.componentDidMount=="function"&&(r.flags|=4194308)):(typeof m.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=u,r.memoizedState=I),m.props=u,m.state=I,m.context=v,u=D):(typeof m.componentDidMount=="function"&&(r.flags|=4194308),u=!1)}else{m=r.stateNode,yc(i,r),v=r.memoizedProps,Q=Lr(l,v),m.props=Q,ie=r.pendingProps,Y=m.context,I=l.contextType,D=fs,typeof I=="object"&&I!==null&&(D=Pt(I)),w=l.getDerivedStateFromProps,(I=typeof w=="function"||typeof m.getSnapshotBeforeUpdate=="function")||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(v!==ie||Y!==D)&&Zm(r,m,u,D),Yn=!1,Y=r.memoizedState,m.state=Y,yl(r,u,m,d),vl();var G=r.memoizedState;v!==ie||Y!==G||Yn||i!==null&&i.dependencies!==null&&Va(i.dependencies)?(typeof w=="function"&&(Fc(r,l,w,u),G=r.memoizedState),(Q=Yn||Gm(r,l,Q,u,Y,G,D)||i!==null&&i.dependencies!==null&&Va(i.dependencies))?(I||typeof m.UNSAFE_componentWillUpdate!="function"&&typeof m.componentWillUpdate!="function"||(typeof m.componentWillUpdate=="function"&&m.componentWillUpdate(u,G,D),typeof m.UNSAFE_componentWillUpdate=="function"&&m.UNSAFE_componentWillUpdate(u,G,D)),typeof m.componentDidUpdate=="function"&&(r.flags|=4),typeof m.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof m.componentDidUpdate!="function"||v===i.memoizedProps&&Y===i.memoizedState||(r.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||v===i.memoizedProps&&Y===i.memoizedState||(r.flags|=1024),r.memoizedProps=u,r.memoizedState=G),m.props=u,m.state=G,m.context=D,u=Q):(typeof m.componentDidUpdate!="function"||v===i.memoizedProps&&Y===i.memoizedState||(r.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||v===i.memoizedProps&&Y===i.memoizedState||(r.flags|=1024),u=!1)}return m=u,ho(i,r),u=(r.flags&128)!==0,m||u?(m=r.stateNode,l=u&&typeof l.getDerivedStateFromError!="function"?null:m.render(),r.flags|=1,i!==null&&u?(r.child=Mr(r,i.child,null,d),r.child=Mr(r,null,l,d)):It(i,r,l,d),r.memoizedState=m.state,i=r.child):i=xn(i,r,d),i}function f_(i,r,l,u){return kr(),r.flags|=256,It(i,r,l,u),r.child}var Kc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Xc(i){return{baseLanes:i,cachePool:tm()}}function $c(i,r,l){return i=i!==null?i.childLanes&~l:0,r&&(i|=ki),i}function d_(i,r,l){var u=r.pendingProps,d=!1,m=(r.flags&128)!==0,v;if((v=m)||(v=i!==null&&i.memoizedState===null?!1:(ft.current&2)!==0),v&&(d=!0,r.flags&=-129),v=(r.flags&32)!==0,r.flags&=-33,i===null){if(Oe){if(d?Xn(r):$n(),(i=et)?(i=bg(i,ji),i=i!==null&&i.data!=="&"?i:null,i!==null&&(r.memoizedState={dehydrated:i,treeContext:In!==null?{id:Ji,overflow:en}:null,retryLane:536870912,hydrationErrors:null},l=Vp(i),l.return=r,r.child=l,Ut=r,et=null)):i=null,i===null)throw qn(r);return Mh(i)?r.lanes=32:r.lanes=536870912,null}var w=u.children;return u=u.fallback,d?($n(),d=r.mode,w=fo({mode:"hidden",children:w},d),u=Cr(u,d,l,null),w.return=r,u.return=r,w.sibling=u,r.child=w,u=r.child,u.memoizedState=Xc(l),u.childLanes=$c(i,v,l),r.memoizedState=Kc,Cl(null,u)):(Xn(r),Gc(r,w))}var D=i.memoizedState;if(D!==null&&(w=D.dehydrated,w!==null)){if(m)r.flags&256?(Xn(r),r.flags&=-257,r=Zc(i,r,l)):r.memoizedState!==null?($n(),r.child=i.child,r.flags|=128,r=null):($n(),w=u.fallback,d=r.mode,u=fo({mode:"visible",children:u.children},d),w=Cr(w,d,l,null),w.flags|=2,u.return=r,w.return=r,u.sibling=w,r.child=u,Mr(r,i.child,null,l),u=r.child,u.memoizedState=Xc(l),u.childLanes=$c(i,v,l),r.memoizedState=Kc,r=Cl(null,u));else if(Xn(r),Mh(w)){if(v=w.nextSibling&&w.nextSibling.dataset,v)var I=v.dgst;v=I,u=Error(s(419)),u.stack="",u.digest=v,fl({value:u,source:null,stack:null}),r=Zc(i,r,l)}else if(gt||_s(i,r,l,!1),v=(l&i.childLanes)!==0,gt||v){if(v=Ze,v!==null&&(u=Jd(v,l),u!==0&&u!==D.retryLane))throw D.retryLane=u,wr(i,u),pi(v,i,u),Yc;Rh(w)||xo(),r=Zc(i,r,l)}else Rh(w)?(r.flags|=192,r.child=i.child,r=null):(i=D.treeContext,et=Pi(w.nextSibling),Ut=r,Oe=!0,Fn=null,ji=!1,i!==null&&$p(r,i),r=Gc(r,u.children),r.flags|=4096);return r}return d?($n(),w=u.fallback,d=r.mode,D=i.child,I=D.sibling,u=_n(D,{mode:"hidden",children:u.children}),u.subtreeFlags=D.subtreeFlags&65011712,I!==null?w=_n(I,w):(w=Cr(w,d,l,null),w.flags|=2),w.return=r,u.return=r,u.sibling=w,r.child=u,Cl(null,u),u=r.child,w=i.child.memoizedState,w===null?w=Xc(l):(d=w.cachePool,d!==null?(D=mt._currentValue,d=d.parent!==D?{parent:D,pool:D}:d):d=tm(),w={baseLanes:w.baseLanes|l,cachePool:d}),u.memoizedState=w,u.childLanes=$c(i,v,l),r.memoizedState=Kc,Cl(i.child,u)):(Xn(r),l=i.child,i=l.sibling,l=_n(l,{mode:"visible",children:u.children}),l.return=r,l.sibling=null,i!==null&&(v=r.deletions,v===null?(r.deletions=[i],r.flags|=16):v.push(i)),r.child=l,r.memoizedState=null,l)}function Gc(i,r){return r=fo({mode:"visible",children:r},i.mode),r.return=i,i.child=r}function fo(i,r){return i=bi(22,i,null,r),i.lanes=0,i}function Zc(i,r,l){return Mr(r,i.child,null,l),i=Gc(r,r.pendingProps.children),i.flags|=2,r.memoizedState=null,i}function p_(i,r,l){i.lanes|=r;var u=i.alternate;u!==null&&(u.lanes|=r),fc(i.return,r,l)}function Qc(i,r,l,u,d,m){var v=i.memoizedState;v===null?i.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:u,tail:l,tailMode:d,treeForkCount:m}:(v.isBackwards=r,v.rendering=null,v.renderingStartTime=0,v.last=u,v.tail=l,v.tailMode=d,v.treeForkCount=m)}function m_(i,r,l){var u=r.pendingProps,d=u.revealOrder,m=u.tail;u=u.children;var v=ft.current,w=(v&2)!==0;if(w?(v=v&1|2,r.flags|=128):v&=1,C(ft,v),It(i,r,u,l),u=Oe?hl:0,!w&&i!==null&&(i.flags&128)!==0)e:for(i=r.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&p_(i,l,r);else if(i.tag===19)p_(i,l,r);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)break e;for(;i.sibling===null;){if(i.return===null||i.return===r)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}switch(d){case"forwards":for(l=r.child,d=null;l!==null;)i=l.alternate,i!==null&&eo(i)===null&&(d=l),l=l.sibling;l=d,l===null?(d=r.child,r.child=null):(d=l.sibling,l.sibling=null),Qc(r,!1,d,l,m,u);break;case"backwards":case"unstable_legacy-backwards":for(l=null,d=r.child,r.child=null;d!==null;){if(i=d.alternate,i!==null&&eo(i)===null){r.child=d;break}i=d.sibling,d.sibling=l,l=d,d=i}Qc(r,!0,l,null,m,u);break;case"together":Qc(r,!1,null,null,void 0,u);break;default:r.memoizedState=null}return r.child}function xn(i,r,l){if(i!==null&&(r.dependencies=i.dependencies),Qn|=r.lanes,(l&r.childLanes)===0)if(i!==null){if(_s(i,r,l,!1),(l&r.childLanes)===0)return null}else return null;if(i!==null&&r.child!==i.child)throw Error(s(153));if(r.child!==null){for(i=r.child,l=_n(i,i.pendingProps),r.child=l,l.return=r;i.sibling!==null;)i=i.sibling,l=l.sibling=_n(i,i.pendingProps),l.return=r;l.sibling=null}return r.child}function Jc(i,r){return(i.lanes&r)!==0?!0:(i=i.dependencies,!!(i!==null&&Va(i)))}function p1(i,r,l){switch(r.tag){case 3:Ye(r,r.stateNode.containerInfo),Wn(r,mt,i.memoizedState.cache),kr();break;case 27:case 5:Ht(r);break;case 4:Ye(r,r.stateNode.containerInfo);break;case 10:Wn(r,r.type,r.memoizedProps.value);break;case 31:if(r.memoizedState!==null)return r.flags|=128,Cc(r),null;break;case 13:var u=r.memoizedState;if(u!==null)return u.dehydrated!==null?(Xn(r),r.flags|=128,null):(l&r.child.childLanes)!==0?d_(i,r,l):(Xn(r),i=xn(i,r,l),i!==null?i.sibling:null);Xn(r);break;case 19:var d=(i.flags&128)!==0;if(u=(l&r.childLanes)!==0,u||(_s(i,r,l,!1),u=(l&r.childLanes)!==0),d){if(u)return m_(i,r,l);r.flags|=128}if(d=r.memoizedState,d!==null&&(d.rendering=null,d.tail=null,d.lastEffect=null),C(ft,ft.current),u)break;return null;case 22:return r.lanes=0,a_(i,r,l,r.pendingProps);case 24:Wn(r,mt,i.memoizedState.cache)}return xn(i,r,l)}function __(i,r,l){if(i!==null)if(i.memoizedProps!==r.pendingProps)gt=!0;else{if(!Jc(i,l)&&(r.flags&128)===0)return gt=!1,p1(i,r,l);gt=(i.flags&131072)!==0}else gt=!1,Oe&&(r.flags&1048576)!==0&&Xp(r,hl,r.index);switch(r.lanes=0,r.tag){case 16:e:{var u=r.pendingProps;if(i=Dr(r.elementType),r.type=i,typeof i=="function")rc(i)?(u=Lr(i,u),r.tag=1,r=h_(null,r,i,u,l)):(r.tag=0,r=Vc(null,r,i,u,l));else{if(i!=null){var d=i.$$typeof;if(d===O){r.tag=11,r=r_(null,r,i,u,l);break e}else if(d===re){r.tag=14,r=s_(null,r,i,u,l);break e}}throw r=V(i)||i,Error(s(306,r,""))}}return r;case 0:return Vc(i,r,r.type,r.pendingProps,l);case 1:return u=r.type,d=Lr(u,r.pendingProps),h_(i,r,u,d,l);case 3:e:{if(Ye(r,r.stateNode.containerInfo),i===null)throw Error(s(387));u=r.pendingProps;var m=r.memoizedState;d=m.element,yc(i,r),yl(r,u,null,l);var v=r.memoizedState;if(u=v.cache,Wn(r,mt,u),u!==m.cache&&dc(r,[mt],l,!0),vl(),u=v.element,m.isDehydrated)if(m={element:u,isDehydrated:!1,cache:v.cache},r.updateQueue.baseState=m,r.memoizedState=m,r.flags&256){r=f_(i,r,u,l);break e}else if(u!==d){d=Ni(Error(s(424)),r),fl(d),r=f_(i,r,u,l);break e}else{switch(i=r.stateNode.containerInfo,i.nodeType){case 9:i=i.body;break;default:i=i.nodeName==="HTML"?i.ownerDocument.body:i}for(et=Pi(i.firstChild),Ut=r,Oe=!0,Fn=null,ji=!0,l=am(r,null,u,l),r.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(kr(),u===d){r=xn(i,r,l);break e}It(i,r,u,l)}r=r.child}return r;case 26:return ho(i,r),i===null?(l=Tg(r.type,null,r.pendingProps,null))?r.memoizedState=l:Oe||(l=r.type,i=r.pendingProps,u=Do(pe.current).createElement(l),u[jt]=r,u[oi]=i,Ft(u,l,i),Tt(u),r.stateNode=u):r.memoizedState=Tg(r.type,i.memoizedProps,r.pendingProps,i.memoizedState),null;case 27:return Ht(r),i===null&&Oe&&(u=r.stateNode=Cg(r.type,r.pendingProps,pe.current),Ut=r,ji=!0,d=et,nr(r.type)?(Bh=d,et=Pi(u.firstChild)):et=d),It(i,r,r.pendingProps.children,l),ho(i,r),i===null&&(r.flags|=4194304),r.child;case 5:return i===null&&Oe&&((d=u=et)&&(u=W1(u,r.type,r.pendingProps,ji),u!==null?(r.stateNode=u,Ut=r,et=Pi(u.firstChild),ji=!1,d=!0):d=!1),d||qn(r)),Ht(r),d=r.type,m=r.pendingProps,v=i!==null?i.memoizedProps:null,u=m.children,Th(d,m)?u=null:v!==null&&Th(d,v)&&(r.flags|=32),r.memoizedState!==null&&(d=Ec(i,r,s1,null,null,l),Ul._currentValue=d),ho(i,r),It(i,r,u,l),r.child;case 6:return i===null&&Oe&&((i=l=et)&&(l=Y1(l,r.pendingProps,ji),l!==null?(r.stateNode=l,Ut=r,et=null,i=!0):i=!1),i||qn(r)),null;case 13:return d_(i,r,l);case 4:return Ye(r,r.stateNode.containerInfo),u=r.pendingProps,i===null?r.child=Mr(r,null,u,l):It(i,r,u,l),r.child;case 11:return r_(i,r,r.type,r.pendingProps,l);case 7:return It(i,r,r.pendingProps,l),r.child;case 8:return It(i,r,r.pendingProps.children,l),r.child;case 12:return It(i,r,r.pendingProps.children,l),r.child;case 10:return u=r.pendingProps,Wn(r,r.type,u.value),It(i,r,u.children,l),r.child;case 9:return d=r.type._context,u=r.pendingProps.children,Tr(r),d=Pt(d),u=u(d),r.flags|=1,It(i,r,u,l),r.child;case 14:return s_(i,r,r.type,r.pendingProps,l);case 15:return l_(i,r,r.type,r.pendingProps,l);case 19:return m_(i,r,l);case 31:return d1(i,r,l);case 22:return a_(i,r,l,r.pendingProps);case 24:return Tr(r),u=Pt(mt),i===null?(d=_c(),d===null&&(d=Ze,m=pc(),d.pooledCache=m,m.refCount++,m!==null&&(d.pooledCacheLanes|=l),d=m),r.memoizedState={parent:u,cache:d},vc(r),Wn(r,mt,d)):((i.lanes&l)!==0&&(yc(i,r),yl(r,null,null,l),vl()),d=i.memoizedState,m=r.memoizedState,d.parent!==u?(d={parent:u,cache:u},r.memoizedState=d,r.lanes===0&&(r.memoizedState=r.updateQueue.baseState=d),Wn(r,mt,u)):(u=m.cache,Wn(r,mt,u),u!==d.cache&&dc(r,[mt],l,!0))),It(i,r,r.pendingProps.children,l),r.child;case 29:throw r.pendingProps}throw Error(s(156,r.tag))}function wn(i){i.flags|=4}function eh(i,r,l,u,d){if((r=(i.mode&32)!==0)&&(r=!1),r){if(i.flags|=16777216,(d&335544128)===d)if(i.stateNode.complete)i.flags|=8192;else if(q_())i.flags|=8192;else throw Rr=Ga,gc}else i.flags&=-16777217}function g_(i,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!Bg(r))if(q_())i.flags|=8192;else throw Rr=Ga,gc}function po(i,r){r!==null&&(i.flags|=4),i.flags&16384&&(r=i.tag!==22?Gd():536870912,i.lanes|=r,As|=r)}function kl(i,r){if(!Oe)switch(i.tailMode){case"hidden":r=i.tail;for(var l=null;r!==null;)r.alternate!==null&&(l=r),r=r.sibling;l===null?i.tail=null:l.sibling=null;break;case"collapsed":l=i.tail;for(var u=null;l!==null;)l.alternate!==null&&(u=l),l=l.sibling;u===null?r||i.tail===null?i.tail=null:i.tail.sibling=null:u.sibling=null}}function tt(i){var r=i.alternate!==null&&i.alternate.child===i.child,l=0,u=0;if(r)for(var d=i.child;d!==null;)l|=d.lanes|d.childLanes,u|=d.subtreeFlags&65011712,u|=d.flags&65011712,d.return=i,d=d.sibling;else for(d=i.child;d!==null;)l|=d.lanes|d.childLanes,u|=d.subtreeFlags,u|=d.flags,d.return=i,d=d.sibling;return i.subtreeFlags|=u,i.childLanes=l,r}function m1(i,r,l){var u=r.pendingProps;switch(oc(r),r.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return tt(r),null;case 1:return tt(r),null;case 3:return l=r.stateNode,u=null,i!==null&&(u=i.memoizedState.cache),r.memoizedState.cache!==u&&(r.flags|=2048),yn(mt),De(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(i===null||i.child===null)&&(ms(r)?wn(r):i===null||i.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,cc())),tt(r),null;case 26:var d=r.type,m=r.memoizedState;return i===null?(wn(r),m!==null?(tt(r),g_(r,m)):(tt(r),eh(r,d,null,u,l))):m?m!==i.memoizedState?(wn(r),tt(r),g_(r,m)):(tt(r),r.flags&=-16777217):(i=i.memoizedProps,i!==u&&wn(r),tt(r),eh(r,d,i,u,l)),null;case 27:if(Zt(r),l=pe.current,d=r.type,i!==null&&r.stateNode!=null)i.memoizedProps!==u&&wn(r);else{if(!u){if(r.stateNode===null)throw Error(s(166));return tt(r),null}i=se.current,ms(r)?Gp(r):(i=Cg(d,u,l),r.stateNode=i,wn(r))}return tt(r),null;case 5:if(Zt(r),d=r.type,i!==null&&r.stateNode!=null)i.memoizedProps!==u&&wn(r);else{if(!u){if(r.stateNode===null)throw Error(s(166));return tt(r),null}if(m=se.current,ms(r))Gp(r);else{var v=Do(pe.current);switch(m){case 1:m=v.createElementNS("http://www.w3.org/2000/svg",d);break;case 2:m=v.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;default:switch(d){case"svg":m=v.createElementNS("http://www.w3.org/2000/svg",d);break;case"math":m=v.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;case"script":m=v.createElement("div"),m.innerHTML="<script><\/script>",m=m.removeChild(m.firstChild);break;case"select":m=typeof u.is=="string"?v.createElement("select",{is:u.is}):v.createElement("select"),u.multiple?m.multiple=!0:u.size&&(m.size=u.size);break;default:m=typeof u.is=="string"?v.createElement(d,{is:u.is}):v.createElement(d)}}m[jt]=r,m[oi]=u;e:for(v=r.child;v!==null;){if(v.tag===5||v.tag===6)m.appendChild(v.stateNode);else if(v.tag!==4&&v.tag!==27&&v.child!==null){v.child.return=v,v=v.child;continue}if(v===r)break e;for(;v.sibling===null;){if(v.return===null||v.return===r)break e;v=v.return}v.sibling.return=v.return,v=v.sibling}r.stateNode=m;e:switch(Ft(m,d,u),d){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&wn(r)}}return tt(r),eh(r,r.type,i===null?null:i.memoizedProps,r.pendingProps,l),null;case 6:if(i&&r.stateNode!=null)i.memoizedProps!==u&&wn(r);else{if(typeof u!="string"&&r.stateNode===null)throw Error(s(166));if(i=pe.current,ms(r)){if(i=r.stateNode,l=r.memoizedProps,u=null,d=Ut,d!==null)switch(d.tag){case 27:case 5:u=d.memoizedProps}i[jt]=r,i=!!(i.nodeValue===l||u!==null&&u.suppressHydrationWarning===!0||dg(i.nodeValue,l)),i||qn(r,!0)}else i=Do(i).createTextNode(u),i[jt]=r,r.stateNode=i}return tt(r),null;case 31:if(l=r.memoizedState,i===null||i.memoizedState!==null){if(u=ms(r),l!==null){if(i===null){if(!u)throw Error(s(318));if(i=r.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(s(557));i[jt]=r}else kr(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;tt(r),i=!1}else l=cc(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=l),i=!0;if(!i)return r.flags&256?(wi(r),r):(wi(r),null);if((r.flags&128)!==0)throw Error(s(558))}return tt(r),null;case 13:if(u=r.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(d=ms(r),u!==null&&u.dehydrated!==null){if(i===null){if(!d)throw Error(s(318));if(d=r.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(s(317));d[jt]=r}else kr(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;tt(r),d=!1}else d=cc(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=d),d=!0;if(!d)return r.flags&256?(wi(r),r):(wi(r),null)}return wi(r),(r.flags&128)!==0?(r.lanes=l,r):(l=u!==null,i=i!==null&&i.memoizedState!==null,l&&(u=r.child,d=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(d=u.alternate.memoizedState.cachePool.pool),m=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(m=u.memoizedState.cachePool.pool),m!==d&&(u.flags|=2048)),l!==i&&l&&(r.child.flags|=8192),po(r,r.updateQueue),tt(r),null);case 4:return De(),i===null&&xh(r.stateNode.containerInfo),tt(r),null;case 10:return yn(r.type),tt(r),null;case 19:if(K(ft),u=r.memoizedState,u===null)return tt(r),null;if(d=(r.flags&128)!==0,m=u.rendering,m===null)if(d)kl(u,!1);else{if(ot!==0||i!==null&&(i.flags&128)!==0)for(i=r.child;i!==null;){if(m=eo(i),m!==null){for(r.flags|=128,kl(u,!1),i=m.updateQueue,r.updateQueue=i,po(r,i),r.subtreeFlags=0,i=l,l=r.child;l!==null;)Yp(l,i),l=l.sibling;return C(ft,ft.current&1|2),Oe&&gn(r,u.treeForkCount),r.child}i=i.sibling}u.tail!==null&&Qt()>yo&&(r.flags|=128,d=!0,kl(u,!1),r.lanes=4194304)}else{if(!d)if(i=eo(m),i!==null){if(r.flags|=128,d=!0,i=i.updateQueue,r.updateQueue=i,po(r,i),kl(u,!0),u.tail===null&&u.tailMode==="hidden"&&!m.alternate&&!Oe)return tt(r),null}else 2*Qt()-u.renderingStartTime>yo&&l!==536870912&&(r.flags|=128,d=!0,kl(u,!1),r.lanes=4194304);u.isBackwards?(m.sibling=r.child,r.child=m):(i=u.last,i!==null?i.sibling=m:r.child=m,u.last=m)}return u.tail!==null?(i=u.tail,u.rendering=i,u.tail=i.sibling,u.renderingStartTime=Qt(),i.sibling=null,l=ft.current,C(ft,d?l&1|2:l&1),Oe&&gn(r,u.treeForkCount),i):(tt(r),null);case 22:case 23:return wi(r),wc(),u=r.memoizedState!==null,i!==null?i.memoizedState!==null!==u&&(r.flags|=8192):u&&(r.flags|=8192),u?(l&536870912)!==0&&(r.flags&128)===0&&(tt(r),r.subtreeFlags&6&&(r.flags|=8192)):tt(r),l=r.updateQueue,l!==null&&po(r,l.retryQueue),l=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(l=i.memoizedState.cachePool.pool),u=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(u=r.memoizedState.cachePool.pool),u!==l&&(r.flags|=2048),i!==null&&K(Ar),null;case 24:return l=null,i!==null&&(l=i.memoizedState.cache),r.memoizedState.cache!==l&&(r.flags|=2048),yn(mt),tt(r),null;case 25:return null;case 30:return null}throw Error(s(156,r.tag))}function _1(i,r){switch(oc(r),r.tag){case 1:return i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 3:return yn(mt),De(),i=r.flags,(i&65536)!==0&&(i&128)===0?(r.flags=i&-65537|128,r):null;case 26:case 27:case 5:return Zt(r),null;case 31:if(r.memoizedState!==null){if(wi(r),r.alternate===null)throw Error(s(340));kr()}return i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 13:if(wi(r),i=r.memoizedState,i!==null&&i.dehydrated!==null){if(r.alternate===null)throw Error(s(340));kr()}return i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 19:return K(ft),null;case 4:return De(),null;case 10:return yn(r.type),null;case 22:case 23:return wi(r),wc(),i!==null&&K(Ar),i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 24:return yn(mt),null;case 25:return null;default:return null}}function v_(i,r){switch(oc(r),r.tag){case 3:yn(mt),De();break;case 26:case 27:case 5:Zt(r);break;case 4:De();break;case 31:r.memoizedState!==null&&wi(r);break;case 13:wi(r);break;case 19:K(ft);break;case 10:yn(r.type);break;case 22:case 23:wi(r),wc(),i!==null&&K(Ar);break;case 24:yn(mt)}}function El(i,r){try{var l=r.updateQueue,u=l!==null?l.lastEffect:null;if(u!==null){var d=u.next;l=d;do{if((l.tag&i)===i){u=void 0;var m=l.create,v=l.inst;u=m(),v.destroy=u}l=l.next}while(l!==d)}}catch(w){We(r,r.return,w)}}function Gn(i,r,l){try{var u=r.updateQueue,d=u!==null?u.lastEffect:null;if(d!==null){var m=d.next;u=m;do{if((u.tag&i)===i){var v=u.inst,w=v.destroy;if(w!==void 0){v.destroy=void 0,d=r;var D=l,I=w;try{I()}catch(Q){We(d,D,Q)}}}u=u.next}while(u!==m)}}catch(Q){We(r,r.return,Q)}}function y_(i){var r=i.updateQueue;if(r!==null){var l=i.stateNode;try{um(r,l)}catch(u){We(i,i.return,u)}}}function S_(i,r,l){l.props=Lr(i.type,i.memoizedProps),l.state=i.memoizedState;try{l.componentWillUnmount()}catch(u){We(i,r,u)}}function Tl(i,r){try{var l=i.ref;if(l!==null){switch(i.tag){case 26:case 27:case 5:var u=i.stateNode;break;case 30:u=i.stateNode;break;default:u=i.stateNode}typeof l=="function"?i.refCleanup=l(u):l.current=u}}catch(d){We(i,r,d)}}function tn(i,r){var l=i.ref,u=i.refCleanup;if(l!==null)if(typeof u=="function")try{u()}catch(d){We(i,r,d)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(d){We(i,r,d)}else l.current=null}function b_(i){var r=i.type,l=i.memoizedProps,u=i.stateNode;try{e:switch(r){case"button":case"input":case"select":case"textarea":l.autoFocus&&u.focus();break e;case"img":l.src?u.src=l.src:l.srcSet&&(u.srcset=l.srcSet)}}catch(d){We(i,i.return,d)}}function th(i,r,l){try{var u=i.stateNode;j1(u,i.type,l,r),u[oi]=r}catch(d){We(i,i.return,d)}}function x_(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&nr(i.type)||i.tag===4}function ih(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||x_(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&nr(i.type)||i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function nh(i,r,l){var u=i.tag;if(u===5||u===6)i=i.stateNode,r?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(i,r):(r=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,r.appendChild(i),l=l._reactRootContainer,l!=null||r.onclick!==null||(r.onclick=pn));else if(u!==4&&(u===27&&nr(i.type)&&(l=i.stateNode,r=null),i=i.child,i!==null))for(nh(i,r,l),i=i.sibling;i!==null;)nh(i,r,l),i=i.sibling}function mo(i,r,l){var u=i.tag;if(u===5||u===6)i=i.stateNode,r?l.insertBefore(i,r):l.appendChild(i);else if(u!==4&&(u===27&&nr(i.type)&&(l=i.stateNode),i=i.child,i!==null))for(mo(i,r,l),i=i.sibling;i!==null;)mo(i,r,l),i=i.sibling}function w_(i){var r=i.stateNode,l=i.memoizedProps;try{for(var u=i.type,d=r.attributes;d.length;)r.removeAttributeNode(d[0]);Ft(r,u,l),r[jt]=i,r[oi]=l}catch(m){We(i,i.return,m)}}var Cn=!1,vt=!1,rh=!1,C_=typeof WeakSet=="function"?WeakSet:Set,At=null;function g1(i,r){if(i=i.containerInfo,kh=Oo,i=Op(i),Zu(i)){if("selectionStart"in i)var l={start:i.selectionStart,end:i.selectionEnd};else e:{l=(l=i.ownerDocument)&&l.defaultView||window;var u=l.getSelection&&l.getSelection();if(u&&u.rangeCount!==0){l=u.anchorNode;var d=u.anchorOffset,m=u.focusNode;u=u.focusOffset;try{l.nodeType,m.nodeType}catch{l=null;break e}var v=0,w=-1,D=-1,I=0,Q=0,ie=i,Y=null;t:for(;;){for(var G;ie!==l||d!==0&&ie.nodeType!==3||(w=v+d),ie!==m||u!==0&&ie.nodeType!==3||(D=v+u),ie.nodeType===3&&(v+=ie.nodeValue.length),(G=ie.firstChild)!==null;)Y=ie,ie=G;for(;;){if(ie===i)break t;if(Y===l&&++I===d&&(w=v),Y===m&&++Q===u&&(D=v),(G=ie.nextSibling)!==null)break;ie=Y,Y=ie.parentNode}ie=G}l=w===-1||D===-1?null:{start:w,end:D}}else l=null}l=l||{start:0,end:0}}else l=null;for(Eh={focusedElem:i,selectionRange:l},Oo=!1,At=r;At!==null;)if(r=At,i=r.child,(r.subtreeFlags&1028)!==0&&i!==null)i.return=r,At=i;else for(;At!==null;){switch(r=At,m=r.alternate,i=r.flags,r.tag){case 0:if((i&4)!==0&&(i=r.updateQueue,i=i!==null?i.events:null,i!==null))for(l=0;l<i.length;l++)d=i[l],d.ref.impl=d.nextImpl;break;case 11:case 15:break;case 1:if((i&1024)!==0&&m!==null){i=void 0,l=r,d=m.memoizedProps,m=m.memoizedState,u=l.stateNode;try{var me=Lr(l.type,d);i=u.getSnapshotBeforeUpdate(me,m),u.__reactInternalSnapshotBeforeUpdate=i}catch(ye){We(l,l.return,ye)}}break;case 3:if((i&1024)!==0){if(i=r.stateNode.containerInfo,l=i.nodeType,l===9)Dh(i);else if(l===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":Dh(i);break;default:i.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((i&1024)!==0)throw Error(s(163))}if(i=r.sibling,i!==null){i.return=r.return,At=i;break}At=r.return}}function k_(i,r,l){var u=l.flags;switch(l.tag){case 0:case 11:case 15:En(i,l),u&4&&El(5,l);break;case 1:if(En(i,l),u&4)if(i=l.stateNode,r===null)try{i.componentDidMount()}catch(v){We(l,l.return,v)}else{var d=Lr(l.type,r.memoizedProps);r=r.memoizedState;try{i.componentDidUpdate(d,r,i.__reactInternalSnapshotBeforeUpdate)}catch(v){We(l,l.return,v)}}u&64&&y_(l),u&512&&Tl(l,l.return);break;case 3:if(En(i,l),u&64&&(i=l.updateQueue,i!==null)){if(r=null,l.child!==null)switch(l.child.tag){case 27:case 5:r=l.child.stateNode;break;case 1:r=l.child.stateNode}try{um(i,r)}catch(v){We(l,l.return,v)}}break;case 27:r===null&&u&4&&w_(l);case 26:case 5:En(i,l),r===null&&u&4&&b_(l),u&512&&Tl(l,l.return);break;case 12:En(i,l);break;case 31:En(i,l),u&4&&A_(i,l);break;case 13:En(i,l),u&4&&D_(i,l),u&64&&(i=l.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(l=E1.bind(null,l),V1(i,l))));break;case 22:if(u=l.memoizedState!==null||Cn,!u){r=r!==null&&r.memoizedState!==null||vt,d=Cn;var m=vt;Cn=u,(vt=r)&&!m?Tn(i,l,(l.subtreeFlags&8772)!==0):En(i,l),Cn=d,vt=m}break;case 30:break;default:En(i,l)}}function E_(i){var r=i.alternate;r!==null&&(i.alternate=null,E_(r)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(r=i.stateNode,r!==null&&zu(r)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}var nt=null,ci=!1;function kn(i,r,l){for(l=l.child;l!==null;)T_(i,r,l),l=l.sibling}function T_(i,r,l){if(xt&&typeof xt.onCommitFiberUnmount=="function")try{xt.onCommitFiberUnmount(Jt,l)}catch{}switch(l.tag){case 26:vt||tn(l,r),kn(i,r,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:vt||tn(l,r);var u=nt,d=ci;nr(l.type)&&(nt=l.stateNode,ci=!1),kn(i,r,l),Ol(l.stateNode),nt=u,ci=d;break;case 5:vt||tn(l,r);case 6:if(u=nt,d=ci,nt=null,kn(i,r,l),nt=u,ci=d,nt!==null)if(ci)try{(nt.nodeType===9?nt.body:nt.nodeName==="HTML"?nt.ownerDocument.body:nt).removeChild(l.stateNode)}catch(m){We(l,r,m)}else try{nt.removeChild(l.stateNode)}catch(m){We(l,r,m)}break;case 18:nt!==null&&(ci?(i=nt,yg(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,l.stateNode),Os(i)):yg(nt,l.stateNode));break;case 4:u=nt,d=ci,nt=l.stateNode.containerInfo,ci=!0,kn(i,r,l),nt=u,ci=d;break;case 0:case 11:case 14:case 15:Gn(2,l,r),vt||Gn(4,l,r),kn(i,r,l);break;case 1:vt||(tn(l,r),u=l.stateNode,typeof u.componentWillUnmount=="function"&&S_(l,r,u)),kn(i,r,l);break;case 21:kn(i,r,l);break;case 22:vt=(u=vt)||l.memoizedState!==null,kn(i,r,l),vt=u;break;default:kn(i,r,l)}}function A_(i,r){if(r.memoizedState===null&&(i=r.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{Os(i)}catch(l){We(r,r.return,l)}}}function D_(i,r){if(r.memoizedState===null&&(i=r.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{Os(i)}catch(l){We(r,r.return,l)}}function v1(i){switch(i.tag){case 31:case 13:case 19:var r=i.stateNode;return r===null&&(r=i.stateNode=new C_),r;case 22:return i=i.stateNode,r=i._retryCache,r===null&&(r=i._retryCache=new C_),r;default:throw Error(s(435,i.tag))}}function _o(i,r){var l=v1(i);r.forEach(function(u){if(!l.has(u)){l.add(u);var d=T1.bind(null,i,u);u.then(d,d)}})}function hi(i,r){var l=r.deletions;if(l!==null)for(var u=0;u<l.length;u++){var d=l[u],m=i,v=r,w=v;e:for(;w!==null;){switch(w.tag){case 27:if(nr(w.type)){nt=w.stateNode,ci=!1;break e}break;case 5:nt=w.stateNode,ci=!1;break e;case 3:case 4:nt=w.stateNode.containerInfo,ci=!0;break e}w=w.return}if(nt===null)throw Error(s(160));T_(m,v,d),nt=null,ci=!1,m=d.alternate,m!==null&&(m.return=null),d.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)R_(r,i),r=r.sibling}var $i=null;function R_(i,r){var l=i.alternate,u=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:hi(r,i),fi(i),u&4&&(Gn(3,i,i.return),El(3,i),Gn(5,i,i.return));break;case 1:hi(r,i),fi(i),u&512&&(vt||l===null||tn(l,l.return)),u&64&&Cn&&(i=i.updateQueue,i!==null&&(u=i.callbacks,u!==null&&(l=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=l===null?u:l.concat(u))));break;case 26:var d=$i;if(hi(r,i),fi(i),u&512&&(vt||l===null||tn(l,l.return)),u&4){var m=l!==null?l.memoizedState:null;if(u=i.memoizedState,l===null)if(u===null)if(i.stateNode===null){e:{u=i.type,l=i.memoizedProps,d=d.ownerDocument||d;t:switch(u){case"title":m=d.getElementsByTagName("title")[0],(!m||m[el]||m[jt]||m.namespaceURI==="http://www.w3.org/2000/svg"||m.hasAttribute("itemprop"))&&(m=d.createElement(u),d.head.insertBefore(m,d.querySelector("head > title"))),Ft(m,u,l),m[jt]=i,Tt(m),u=m;break e;case"link":var v=Rg("link","href",d).get(u+(l.href||""));if(v){for(var w=0;w<v.length;w++)if(m=v[w],m.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&m.getAttribute("rel")===(l.rel==null?null:l.rel)&&m.getAttribute("title")===(l.title==null?null:l.title)&&m.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){v.splice(w,1);break t}}m=d.createElement(u),Ft(m,u,l),d.head.appendChild(m);break;case"meta":if(v=Rg("meta","content",d).get(u+(l.content||""))){for(w=0;w<v.length;w++)if(m=v[w],m.getAttribute("content")===(l.content==null?null:""+l.content)&&m.getAttribute("name")===(l.name==null?null:l.name)&&m.getAttribute("property")===(l.property==null?null:l.property)&&m.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&m.getAttribute("charset")===(l.charSet==null?null:l.charSet)){v.splice(w,1);break t}}m=d.createElement(u),Ft(m,u,l),d.head.appendChild(m);break;default:throw Error(s(468,u))}m[jt]=i,Tt(m),u=m}i.stateNode=u}else Mg(d,i.type,i.stateNode);else i.stateNode=Dg(d,u,i.memoizedProps);else m!==u?(m===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):m.count--,u===null?Mg(d,i.type,i.stateNode):Dg(d,u,i.memoizedProps)):u===null&&i.stateNode!==null&&th(i,i.memoizedProps,l.memoizedProps)}break;case 27:hi(r,i),fi(i),u&512&&(vt||l===null||tn(l,l.return)),l!==null&&u&4&&th(i,i.memoizedProps,l.memoizedProps);break;case 5:if(hi(r,i),fi(i),u&512&&(vt||l===null||tn(l,l.return)),i.flags&32){d=i.stateNode;try{ss(d,"")}catch(me){We(i,i.return,me)}}u&4&&i.stateNode!=null&&(d=i.memoizedProps,th(i,d,l!==null?l.memoizedProps:d)),u&1024&&(rh=!0);break;case 6:if(hi(r,i),fi(i),u&4){if(i.stateNode===null)throw Error(s(162));u=i.memoizedProps,l=i.stateNode;try{l.nodeValue=u}catch(me){We(i,i.return,me)}}break;case 3:if(Bo=null,d=$i,$i=Ro(r.containerInfo),hi(r,i),$i=d,fi(i),u&4&&l!==null&&l.memoizedState.isDehydrated)try{Os(r.containerInfo)}catch(me){We(i,i.return,me)}rh&&(rh=!1,M_(i));break;case 4:u=$i,$i=Ro(i.stateNode.containerInfo),hi(r,i),fi(i),$i=u;break;case 12:hi(r,i),fi(i);break;case 31:hi(r,i),fi(i),u&4&&(u=i.updateQueue,u!==null&&(i.updateQueue=null,_o(i,u)));break;case 13:hi(r,i),fi(i),i.child.flags&8192&&i.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(vo=Qt()),u&4&&(u=i.updateQueue,u!==null&&(i.updateQueue=null,_o(i,u)));break;case 22:d=i.memoizedState!==null;var D=l!==null&&l.memoizedState!==null,I=Cn,Q=vt;if(Cn=I||d,vt=Q||D,hi(r,i),vt=Q,Cn=I,fi(i),u&8192)e:for(r=i.stateNode,r._visibility=d?r._visibility&-2:r._visibility|1,d&&(l===null||D||Cn||vt||zr(i)),l=null,r=i;;){if(r.tag===5||r.tag===26){if(l===null){D=l=r;try{if(m=D.stateNode,d)v=m.style,typeof v.setProperty=="function"?v.setProperty("display","none","important"):v.display="none";else{w=D.stateNode;var ie=D.memoizedProps.style,Y=ie!=null&&ie.hasOwnProperty("display")?ie.display:null;w.style.display=Y==null||typeof Y=="boolean"?"":(""+Y).trim()}}catch(me){We(D,D.return,me)}}}else if(r.tag===6){if(l===null){D=r;try{D.stateNode.nodeValue=d?"":D.memoizedProps}catch(me){We(D,D.return,me)}}}else if(r.tag===18){if(l===null){D=r;try{var G=D.stateNode;d?Sg(G,!0):Sg(D.stateNode,!1)}catch(me){We(D,D.return,me)}}}else if((r.tag!==22&&r.tag!==23||r.memoizedState===null||r===i)&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===i)break e;for(;r.sibling===null;){if(r.return===null||r.return===i)break e;l===r&&(l=null),r=r.return}l===r&&(l=null),r.sibling.return=r.return,r=r.sibling}u&4&&(u=i.updateQueue,u!==null&&(l=u.retryQueue,l!==null&&(u.retryQueue=null,_o(i,l))));break;case 19:hi(r,i),fi(i),u&4&&(u=i.updateQueue,u!==null&&(i.updateQueue=null,_o(i,u)));break;case 30:break;case 21:break;default:hi(r,i),fi(i)}}function fi(i){var r=i.flags;if(r&2){try{for(var l,u=i.return;u!==null;){if(x_(u)){l=u;break}u=u.return}if(l==null)throw Error(s(160));switch(l.tag){case 27:var d=l.stateNode,m=ih(i);mo(i,m,d);break;case 5:var v=l.stateNode;l.flags&32&&(ss(v,""),l.flags&=-33);var w=ih(i);mo(i,w,v);break;case 3:case 4:var D=l.stateNode.containerInfo,I=ih(i);nh(i,I,D);break;default:throw Error(s(161))}}catch(Q){We(i,i.return,Q)}i.flags&=-3}r&4096&&(i.flags&=-4097)}function M_(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var r=i;M_(r),r.tag===5&&r.flags&1024&&r.stateNode.reset(),i=i.sibling}}function En(i,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)k_(i,r.alternate,r),r=r.sibling}function zr(i){for(i=i.child;i!==null;){var r=i;switch(r.tag){case 0:case 11:case 14:case 15:Gn(4,r,r.return),zr(r);break;case 1:tn(r,r.return);var l=r.stateNode;typeof l.componentWillUnmount=="function"&&S_(r,r.return,l),zr(r);break;case 27:Ol(r.stateNode);case 26:case 5:tn(r,r.return),zr(r);break;case 22:r.memoizedState===null&&zr(r);break;case 30:zr(r);break;default:zr(r)}i=i.sibling}}function Tn(i,r,l){for(l=l&&(r.subtreeFlags&8772)!==0,r=r.child;r!==null;){var u=r.alternate,d=i,m=r,v=m.flags;switch(m.tag){case 0:case 11:case 15:Tn(d,m,l),El(4,m);break;case 1:if(Tn(d,m,l),u=m,d=u.stateNode,typeof d.componentDidMount=="function")try{d.componentDidMount()}catch(I){We(u,u.return,I)}if(u=m,d=u.updateQueue,d!==null){var w=u.stateNode;try{var D=d.shared.hiddenCallbacks;if(D!==null)for(d.shared.hiddenCallbacks=null,d=0;d<D.length;d++)om(D[d],w)}catch(I){We(u,u.return,I)}}l&&v&64&&y_(m),Tl(m,m.return);break;case 27:w_(m);case 26:case 5:Tn(d,m,l),l&&u===null&&v&4&&b_(m),Tl(m,m.return);break;case 12:Tn(d,m,l);break;case 31:Tn(d,m,l),l&&v&4&&A_(d,m);break;case 13:Tn(d,m,l),l&&v&4&&D_(d,m);break;case 22:m.memoizedState===null&&Tn(d,m,l),Tl(m,m.return);break;case 30:break;default:Tn(d,m,l)}r=r.sibling}}function sh(i,r){var l=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(l=i.memoizedState.cachePool.pool),i=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(i=r.memoizedState.cachePool.pool),i!==l&&(i!=null&&i.refCount++,l!=null&&dl(l))}function lh(i,r){i=null,r.alternate!==null&&(i=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==i&&(r.refCount++,i!=null&&dl(i))}function Gi(i,r,l,u){if(r.subtreeFlags&10256)for(r=r.child;r!==null;)B_(i,r,l,u),r=r.sibling}function B_(i,r,l,u){var d=r.flags;switch(r.tag){case 0:case 11:case 15:Gi(i,r,l,u),d&2048&&El(9,r);break;case 1:Gi(i,r,l,u);break;case 3:Gi(i,r,l,u),d&2048&&(i=null,r.alternate!==null&&(i=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==i&&(r.refCount++,i!=null&&dl(i)));break;case 12:if(d&2048){Gi(i,r,l,u),i=r.stateNode;try{var m=r.memoizedProps,v=m.id,w=m.onPostCommit;typeof w=="function"&&w(v,r.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(D){We(r,r.return,D)}}else Gi(i,r,l,u);break;case 31:Gi(i,r,l,u);break;case 13:Gi(i,r,l,u);break;case 23:break;case 22:m=r.stateNode,v=r.alternate,r.memoizedState!==null?m._visibility&2?Gi(i,r,l,u):Al(i,r):m._visibility&2?Gi(i,r,l,u):(m._visibility|=2,ks(i,r,l,u,(r.subtreeFlags&10256)!==0||!1)),d&2048&&sh(v,r);break;case 24:Gi(i,r,l,u),d&2048&&lh(r.alternate,r);break;default:Gi(i,r,l,u)}}function ks(i,r,l,u,d){for(d=d&&((r.subtreeFlags&10256)!==0||!1),r=r.child;r!==null;){var m=i,v=r,w=l,D=u,I=v.flags;switch(v.tag){case 0:case 11:case 15:ks(m,v,w,D,d),El(8,v);break;case 23:break;case 22:var Q=v.stateNode;v.memoizedState!==null?Q._visibility&2?ks(m,v,w,D,d):Al(m,v):(Q._visibility|=2,ks(m,v,w,D,d)),d&&I&2048&&sh(v.alternate,v);break;case 24:ks(m,v,w,D,d),d&&I&2048&&lh(v.alternate,v);break;default:ks(m,v,w,D,d)}r=r.sibling}}function Al(i,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var l=i,u=r,d=u.flags;switch(u.tag){case 22:Al(l,u),d&2048&&sh(u.alternate,u);break;case 24:Al(l,u),d&2048&&lh(u.alternate,u);break;default:Al(l,u)}r=r.sibling}}var Dl=8192;function Es(i,r,l){if(i.subtreeFlags&Dl)for(i=i.child;i!==null;)L_(i,r,l),i=i.sibling}function L_(i,r,l){switch(i.tag){case 26:Es(i,r,l),i.flags&Dl&&i.memoizedState!==null&&rx(l,$i,i.memoizedState,i.memoizedProps);break;case 5:Es(i,r,l);break;case 3:case 4:var u=$i;$i=Ro(i.stateNode.containerInfo),Es(i,r,l),$i=u;break;case 22:i.memoizedState===null&&(u=i.alternate,u!==null&&u.memoizedState!==null?(u=Dl,Dl=16777216,Es(i,r,l),Dl=u):Es(i,r,l));break;default:Es(i,r,l)}}function z_(i){var r=i.alternate;if(r!==null&&(i=r.child,i!==null)){r.child=null;do r=i.sibling,i.sibling=null,i=r;while(i!==null)}}function Rl(i){var r=i.deletions;if((i.flags&16)!==0){if(r!==null)for(var l=0;l<r.length;l++){var u=r[l];At=u,O_(u,i)}z_(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)N_(i),i=i.sibling}function N_(i){switch(i.tag){case 0:case 11:case 15:Rl(i),i.flags&2048&&Gn(9,i,i.return);break;case 3:Rl(i);break;case 12:Rl(i);break;case 22:var r=i.stateNode;i.memoizedState!==null&&r._visibility&2&&(i.return===null||i.return.tag!==13)?(r._visibility&=-3,go(i)):Rl(i);break;default:Rl(i)}}function go(i){var r=i.deletions;if((i.flags&16)!==0){if(r!==null)for(var l=0;l<r.length;l++){var u=r[l];At=u,O_(u,i)}z_(i)}for(i=i.child;i!==null;){switch(r=i,r.tag){case 0:case 11:case 15:Gn(8,r,r.return),go(r);break;case 22:l=r.stateNode,l._visibility&2&&(l._visibility&=-3,go(r));break;default:go(r)}i=i.sibling}}function O_(i,r){for(;At!==null;){var l=At;switch(l.tag){case 0:case 11:case 15:Gn(8,l,r);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var u=l.memoizedState.cachePool.pool;u!=null&&u.refCount++}break;case 24:dl(l.memoizedState.cache)}if(u=l.child,u!==null)u.return=l,At=u;else e:for(l=i;At!==null;){u=At;var d=u.sibling,m=u.return;if(E_(u),u===l){At=null;break e}if(d!==null){d.return=m,At=d;break e}At=m}}}var y1={getCacheForType:function(i){var r=Pt(mt),l=r.data.get(i);return l===void 0&&(l=i(),r.data.set(i,l)),l},cacheSignal:function(){return Pt(mt).controller.signal}},S1=typeof WeakMap=="function"?WeakMap:Map,Ie=0,Ze=null,Me=null,ze=0,qe=0,Ci=null,Zn=!1,Ts=!1,ah=!1,An=0,ot=0,Qn=0,Nr=0,oh=0,ki=0,As=0,Ml=null,di=null,uh=!1,vo=0,H_=0,yo=1/0,So=null,Jn=null,wt=0,er=null,Ds=null,Dn=0,ch=0,hh=null,j_=null,Bl=0,fh=null;function Ei(){return(Ie&2)!==0&&ze!==0?ze&-ze:M.T!==null?vh():ep()}function U_(){if(ki===0)if((ze&536870912)===0||Oe){var i=Ta;Ta<<=1,(Ta&3932160)===0&&(Ta=262144),ki=i}else ki=536870912;return i=xi.current,i!==null&&(i.flags|=32),ki}function pi(i,r,l){(i===Ze&&(qe===2||qe===9)||i.cancelPendingCommit!==null)&&(Rs(i,0),tr(i,ze,ki,!1)),Js(i,l),((Ie&2)===0||i!==Ze)&&(i===Ze&&((Ie&2)===0&&(Nr|=l),ot===4&&tr(i,ze,ki,!1)),nn(i))}function P_(i,r,l){if((Ie&6)!==0)throw Error(s(327));var u=!l&&(r&127)===0&&(r&i.expiredLanes)===0||Qs(i,r),d=u?w1(i,r):ph(i,r,!0),m=u;do{if(d===0){Ts&&!u&&tr(i,r,0,!1);break}else{if(l=i.current.alternate,m&&!b1(l)){d=ph(i,r,!1),m=!1;continue}if(d===2){if(m=r,i.errorRecoveryDisabledLanes&m)var v=0;else v=i.pendingLanes&-536870913,v=v!==0?v:v&536870912?536870912:0;if(v!==0){r=v;e:{var w=i;d=Ml;var D=w.current.memoizedState.isDehydrated;if(D&&(Rs(w,v).flags|=256),v=ph(w,v,!1),v!==2){if(ah&&!D){w.errorRecoveryDisabledLanes|=m,Nr|=m,d=4;break e}m=di,di=d,m!==null&&(di===null?di=m:di.push.apply(di,m))}d=v}if(m=!1,d!==2)continue}}if(d===1){Rs(i,0),tr(i,r,0,!0);break}e:{switch(u=i,m=d,m){case 0:case 1:throw Error(s(345));case 4:if((r&4194048)!==r)break;case 6:tr(u,r,ki,!Zn);break e;case 2:di=null;break;case 3:case 5:break;default:throw Error(s(329))}if((r&62914560)===r&&(d=vo+300-Qt(),10<d)){if(tr(u,r,ki,!Zn),Da(u,0,!0)!==0)break e;Dn=r,u.timeoutHandle=gg(I_.bind(null,u,l,di,So,uh,r,ki,Nr,As,Zn,m,"Throttled",-0,0),d);break e}I_(u,l,di,So,uh,r,ki,Nr,As,Zn,m,null,-0,0)}}break}while(!0);nn(i)}function I_(i,r,l,u,d,m,v,w,D,I,Q,ie,Y,G){if(i.timeoutHandle=-1,ie=r.subtreeFlags,ie&8192||(ie&16785408)===16785408){ie={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:pn},L_(r,m,ie);var me=(m&62914560)===m?vo-Qt():(m&4194048)===m?H_-Qt():0;if(me=sx(ie,me),me!==null){Dn=m,i.cancelPendingCommit=me($_.bind(null,i,r,m,l,u,d,v,w,D,Q,ie,null,Y,G)),tr(i,m,v,!I);return}}$_(i,r,m,l,u,d,v,w,D)}function b1(i){for(var r=i;;){var l=r.tag;if((l===0||l===11||l===15)&&r.flags&16384&&(l=r.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var u=0;u<l.length;u++){var d=l[u],m=d.getSnapshot;d=d.value;try{if(!Si(m(),d))return!1}catch{return!1}}if(l=r.child,r.subtreeFlags&16384&&l!==null)l.return=r,r=l;else{if(r===i)break;for(;r.sibling===null;){if(r.return===null||r.return===i)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function tr(i,r,l,u){r&=~oh,r&=~Nr,i.suspendedLanes|=r,i.pingedLanes&=~r,u&&(i.warmLanes|=r),u=i.expirationTimes;for(var d=r;0<d;){var m=31-Ge(d),v=1<<m;u[m]=-1,d&=~v}l!==0&&Zd(i,l,r)}function bo(){return(Ie&6)===0?(Ll(0),!1):!0}function dh(){if(Me!==null){if(qe===0)var i=Me.return;else i=Me,vn=Er=null,Dc(i),Ss=null,ml=0,i=Me;for(;i!==null;)v_(i.alternate,i),i=i.return;Me=null}}function Rs(i,r){var l=i.timeoutHandle;l!==-1&&(i.timeoutHandle=-1,I1(l)),l=i.cancelPendingCommit,l!==null&&(i.cancelPendingCommit=null,l()),Dn=0,dh(),Ze=i,Me=l=_n(i.current,null),ze=r,qe=0,Ci=null,Zn=!1,Ts=Qs(i,r),ah=!1,As=ki=oh=Nr=Qn=ot=0,di=Ml=null,uh=!1,(r&8)!==0&&(r|=r&32);var u=i.entangledLanes;if(u!==0)for(i=i.entanglements,u&=r;0<u;){var d=31-Ge(u),m=1<<d;r|=i[d],u&=~m}return An=r,Ia(),l}function F_(i,r){Ce=null,M.H=wl,r===ys||r===$a?(r=rm(),qe=3):r===gc?(r=rm(),qe=4):qe=r===Yc?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,Ci=r,Me===null&&(ot=1,uo(i,Ni(r,i.current)))}function q_(){var i=xi.current;return i===null?!0:(ze&4194048)===ze?Ui===null:(ze&62914560)===ze||(ze&536870912)!==0?i===Ui:!1}function W_(){var i=M.H;return M.H=wl,i===null?wl:i}function Y_(){var i=M.A;return M.A=y1,i}function xo(){ot=4,Zn||(ze&4194048)!==ze&&xi.current!==null||(Ts=!0),(Qn&134217727)===0&&(Nr&134217727)===0||Ze===null||tr(Ze,ze,ki,!1)}function ph(i,r,l){var u=Ie;Ie|=2;var d=W_(),m=Y_();(Ze!==i||ze!==r)&&(So=null,Rs(i,r)),r=!1;var v=ot;e:do try{if(qe!==0&&Me!==null){var w=Me,D=Ci;switch(qe){case 8:dh(),v=6;break e;case 3:case 2:case 9:case 6:xi.current===null&&(r=!0);var I=qe;if(qe=0,Ci=null,Ms(i,w,D,I),l&&Ts){v=0;break e}break;default:I=qe,qe=0,Ci=null,Ms(i,w,D,I)}}x1(),v=ot;break}catch(Q){F_(i,Q)}while(!0);return r&&i.shellSuspendCounter++,vn=Er=null,Ie=u,M.H=d,M.A=m,Me===null&&(Ze=null,ze=0,Ia()),v}function x1(){for(;Me!==null;)V_(Me)}function w1(i,r){var l=Ie;Ie|=2;var u=W_(),d=Y_();Ze!==i||ze!==r?(So=null,yo=Qt()+500,Rs(i,r)):Ts=Qs(i,r);e:do try{if(qe!==0&&Me!==null){r=Me;var m=Ci;t:switch(qe){case 1:qe=0,Ci=null,Ms(i,r,m,1);break;case 2:case 9:if(im(m)){qe=0,Ci=null,K_(r);break}r=function(){qe!==2&&qe!==9||Ze!==i||(qe=7),nn(i)},m.then(r,r);break e;case 3:qe=7;break e;case 4:qe=5;break e;case 7:im(m)?(qe=0,Ci=null,K_(r)):(qe=0,Ci=null,Ms(i,r,m,7));break;case 5:var v=null;switch(Me.tag){case 26:v=Me.memoizedState;case 5:case 27:var w=Me;if(v?Bg(v):w.stateNode.complete){qe=0,Ci=null;var D=w.sibling;if(D!==null)Me=D;else{var I=w.return;I!==null?(Me=I,wo(I)):Me=null}break t}}qe=0,Ci=null,Ms(i,r,m,5);break;case 6:qe=0,Ci=null,Ms(i,r,m,6);break;case 8:dh(),ot=6;break e;default:throw Error(s(462))}}C1();break}catch(Q){F_(i,Q)}while(!0);return vn=Er=null,M.H=u,M.A=d,Ie=l,Me!==null?0:(Ze=null,ze=0,Ia(),ot)}function C1(){for(;Me!==null&&!Tu();)V_(Me)}function V_(i){var r=__(i.alternate,i,An);i.memoizedProps=i.pendingProps,r===null?wo(i):Me=r}function K_(i){var r=i,l=r.alternate;switch(r.tag){case 15:case 0:r=c_(l,r,r.pendingProps,r.type,void 0,ze);break;case 11:r=c_(l,r,r.pendingProps,r.type.render,r.ref,ze);break;case 5:Dc(r);default:v_(l,r),r=Me=Yp(r,An),r=__(l,r,An)}i.memoizedProps=i.pendingProps,r===null?wo(i):Me=r}function Ms(i,r,l,u){vn=Er=null,Dc(r),Ss=null,ml=0;var d=r.return;try{if(f1(i,d,r,l,ze)){ot=1,uo(i,Ni(l,i.current)),Me=null;return}}catch(m){if(d!==null)throw Me=d,m;ot=1,uo(i,Ni(l,i.current)),Me=null;return}r.flags&32768?(Oe||u===1?i=!0:Ts||(ze&536870912)!==0?i=!1:(Zn=i=!0,(u===2||u===9||u===3||u===6)&&(u=xi.current,u!==null&&u.tag===13&&(u.flags|=16384))),X_(r,i)):wo(r)}function wo(i){var r=i;do{if((r.flags&32768)!==0){X_(r,Zn);return}i=r.return;var l=m1(r.alternate,r,An);if(l!==null){Me=l;return}if(r=r.sibling,r!==null){Me=r;return}Me=r=i}while(r!==null);ot===0&&(ot=5)}function X_(i,r){do{var l=_1(i.alternate,i);if(l!==null){l.flags&=32767,Me=l;return}if(l=i.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!r&&(i=i.sibling,i!==null)){Me=i;return}Me=i=l}while(i!==null);ot=6,Me=null}function $_(i,r,l,u,d,m,v,w,D){i.cancelPendingCommit=null;do Co();while(wt!==0);if((Ie&6)!==0)throw Error(s(327));if(r!==null){if(r===i.current)throw Error(s(177));if(m=r.lanes|r.childLanes,m|=ic,n0(i,l,m,v,w,D),i===Ze&&(Me=Ze=null,ze=0),Ds=r,er=i,Dn=l,ch=m,hh=d,j_=u,(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,A1(Se,function(){return eg(),null})):(i.callbackNode=null,i.callbackPriority=0),u=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||u){u=M.T,M.T=null,d=q.p,q.p=2,v=Ie,Ie|=4;try{g1(i,r,l)}finally{Ie=v,q.p=d,M.T=u}}wt=1,G_(),Z_(),Q_()}}function G_(){if(wt===1){wt=0;var i=er,r=Ds,l=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||l){l=M.T,M.T=null;var u=q.p;q.p=2;var d=Ie;Ie|=4;try{R_(r,i);var m=Eh,v=Op(i.containerInfo),w=m.focusedElem,D=m.selectionRange;if(v!==w&&w&&w.ownerDocument&&Np(w.ownerDocument.documentElement,w)){if(D!==null&&Zu(w)){var I=D.start,Q=D.end;if(Q===void 0&&(Q=I),"selectionStart"in w)w.selectionStart=I,w.selectionEnd=Math.min(Q,w.value.length);else{var ie=w.ownerDocument||document,Y=ie&&ie.defaultView||window;if(Y.getSelection){var G=Y.getSelection(),me=w.textContent.length,ye=Math.min(D.start,me),Xe=D.end===void 0?ye:Math.min(D.end,me);!G.extend&&ye>Xe&&(v=Xe,Xe=ye,ye=v);var N=zp(w,ye),B=zp(w,Xe);if(N&&B&&(G.rangeCount!==1||G.anchorNode!==N.node||G.anchorOffset!==N.offset||G.focusNode!==B.node||G.focusOffset!==B.offset)){var P=ie.createRange();P.setStart(N.node,N.offset),G.removeAllRanges(),ye>Xe?(G.addRange(P),G.extend(B.node,B.offset)):(P.setEnd(B.node,B.offset),G.addRange(P))}}}}for(ie=[],G=w;G=G.parentNode;)G.nodeType===1&&ie.push({element:G,left:G.scrollLeft,top:G.scrollTop});for(typeof w.focus=="function"&&w.focus(),w=0;w<ie.length;w++){var ee=ie[w];ee.element.scrollLeft=ee.left,ee.element.scrollTop=ee.top}}Oo=!!kh,Eh=kh=null}finally{Ie=d,q.p=u,M.T=l}}i.current=r,wt=2}}function Z_(){if(wt===2){wt=0;var i=er,r=Ds,l=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||l){l=M.T,M.T=null;var u=q.p;q.p=2;var d=Ie;Ie|=4;try{k_(i,r.alternate,r)}finally{Ie=d,q.p=u,M.T=l}}wt=3}}function Q_(){if(wt===4||wt===3){wt=0,Au();var i=er,r=Ds,l=Dn,u=j_;(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?wt=5:(wt=0,Ds=er=null,J_(i,i.pendingLanes));var d=i.pendingLanes;if(d===0&&(Jn=null),Bu(l),r=r.stateNode,xt&&typeof xt.onCommitFiberRoot=="function")try{xt.onCommitFiberRoot(Jt,r,void 0,(r.current.flags&128)===128)}catch{}if(u!==null){r=M.T,d=q.p,q.p=2,M.T=null;try{for(var m=i.onRecoverableError,v=0;v<u.length;v++){var w=u[v];m(w.value,{componentStack:w.stack})}}finally{M.T=r,q.p=d}}(Dn&3)!==0&&Co(),nn(i),d=i.pendingLanes,(l&261930)!==0&&(d&42)!==0?i===fh?Bl++:(Bl=0,fh=i):Bl=0,Ll(0)}}function J_(i,r){(i.pooledCacheLanes&=r)===0&&(r=i.pooledCache,r!=null&&(i.pooledCache=null,dl(r)))}function Co(){return G_(),Z_(),Q_(),eg()}function eg(){if(wt!==5)return!1;var i=er,r=ch;ch=0;var l=Bu(Dn),u=M.T,d=q.p;try{q.p=32>l?32:l,M.T=null,l=hh,hh=null;var m=er,v=Dn;if(wt=0,Ds=er=null,Dn=0,(Ie&6)!==0)throw Error(s(331));var w=Ie;if(Ie|=4,N_(m.current),B_(m,m.current,v,l),Ie=w,Ll(0,!1),xt&&typeof xt.onPostCommitFiberRoot=="function")try{xt.onPostCommitFiberRoot(Jt,m)}catch{}return!0}finally{q.p=d,M.T=u,J_(i,r)}}function tg(i,r,l){r=Ni(l,r),r=Wc(i.stateNode,r,2),i=Kn(i,r,2),i!==null&&(Js(i,2),nn(i))}function We(i,r,l){if(i.tag===3)tg(i,i,l);else for(;r!==null;){if(r.tag===3){tg(r,i,l);break}else if(r.tag===1){var u=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(Jn===null||!Jn.has(u))){i=Ni(l,i),l=i_(2),u=Kn(r,l,2),u!==null&&(n_(l,u,r,i),Js(u,2),nn(u));break}}r=r.return}}function mh(i,r,l){var u=i.pingCache;if(u===null){u=i.pingCache=new S1;var d=new Set;u.set(r,d)}else d=u.get(r),d===void 0&&(d=new Set,u.set(r,d));d.has(l)||(ah=!0,d.add(l),i=k1.bind(null,i,r,l),r.then(i,i))}function k1(i,r,l){var u=i.pingCache;u!==null&&u.delete(r),i.pingedLanes|=i.suspendedLanes&l,i.warmLanes&=~l,Ze===i&&(ze&l)===l&&(ot===4||ot===3&&(ze&62914560)===ze&&300>Qt()-vo?(Ie&2)===0&&Rs(i,0):oh|=l,As===ze&&(As=0)),nn(i)}function ig(i,r){r===0&&(r=Gd()),i=wr(i,r),i!==null&&(Js(i,r),nn(i))}function E1(i){var r=i.memoizedState,l=0;r!==null&&(l=r.retryLane),ig(i,l)}function T1(i,r){var l=0;switch(i.tag){case 31:case 13:var u=i.stateNode,d=i.memoizedState;d!==null&&(l=d.retryLane);break;case 19:u=i.stateNode;break;case 22:u=i.stateNode._retryCache;break;default:throw Error(s(314))}u!==null&&u.delete(r),ig(i,l)}function A1(i,r){return Qr(i,r)}var ko=null,Bs=null,_h=!1,Eo=!1,gh=!1,ir=0;function nn(i){i!==Bs&&i.next===null&&(Bs===null?ko=Bs=i:Bs=Bs.next=i),Eo=!0,_h||(_h=!0,R1())}function Ll(i,r){if(!gh&&Eo){gh=!0;do for(var l=!1,u=ko;u!==null;){if(i!==0){var d=u.pendingLanes;if(d===0)var m=0;else{var v=u.suspendedLanes,w=u.pingedLanes;m=(1<<31-Ge(42|i)+1)-1,m&=d&~(v&~w),m=m&201326741?m&201326741|1:m?m|2:0}m!==0&&(l=!0,lg(u,m))}else m=ze,m=Da(u,u===Ze?m:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(m&3)===0||Qs(u,m)||(l=!0,lg(u,m));u=u.next}while(l);gh=!1}}function D1(){ng()}function ng(){Eo=_h=!1;var i=0;ir!==0&&P1()&&(i=ir);for(var r=Qt(),l=null,u=ko;u!==null;){var d=u.next,m=rg(u,r);m===0?(u.next=null,l===null?ko=d:l.next=d,d===null&&(Bs=l)):(l=u,(i!==0||(m&3)!==0)&&(Eo=!0)),u=d}wt!==0&&wt!==5||Ll(i),ir!==0&&(ir=0)}function rg(i,r){for(var l=i.suspendedLanes,u=i.pingedLanes,d=i.expirationTimes,m=i.pendingLanes&-62914561;0<m;){var v=31-Ge(m),w=1<<v,D=d[v];D===-1?((w&l)===0||(w&u)!==0)&&(d[v]=i0(w,r)):D<=r&&(i.expiredLanes|=w),m&=~w}if(r=Ze,l=ze,l=Da(i,i===r?l:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),u=i.callbackNode,l===0||i===r&&(qe===2||qe===9)||i.cancelPendingCommit!==null)return u!==null&&u!==null&&Zs(u),i.callbackNode=null,i.callbackPriority=0;if((l&3)===0||Qs(i,l)){if(r=l&-l,r===i.callbackPriority)return r;switch(u!==null&&Zs(u),Bu(l)){case 2:case 8:l=he;break;case 32:l=Se;break;case 268435456:l=Fe;break;default:l=Se}return u=sg.bind(null,i),l=Qr(l,u),i.callbackPriority=r,i.callbackNode=l,r}return u!==null&&u!==null&&Zs(u),i.callbackPriority=2,i.callbackNode=null,2}function sg(i,r){if(wt!==0&&wt!==5)return i.callbackNode=null,i.callbackPriority=0,null;var l=i.callbackNode;if(Co()&&i.callbackNode!==l)return null;var u=ze;return u=Da(i,i===Ze?u:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),u===0?null:(P_(i,u,r),rg(i,Qt()),i.callbackNode!=null&&i.callbackNode===l?sg.bind(null,i):null)}function lg(i,r){if(Co())return null;P_(i,r,!0)}function R1(){F1(function(){(Ie&6)!==0?Qr(J,D1):ng()})}function vh(){if(ir===0){var i=gs;i===0&&(i=Ea,Ea<<=1,(Ea&261888)===0&&(Ea=256)),ir=i}return ir}function ag(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:La(""+i)}function og(i,r){var l=r.ownerDocument.createElement("input");return l.name=r.name,l.value=r.value,i.id&&l.setAttribute("form",i.id),r.parentNode.insertBefore(l,r),i=new FormData(i),l.parentNode.removeChild(l),i}function M1(i,r,l,u,d){if(r==="submit"&&l&&l.stateNode===d){var m=ag((d[oi]||null).action),v=u.submitter;v&&(r=(r=v[oi]||null)?ag(r.formAction):v.getAttribute("formAction"),r!==null&&(m=r,v=null));var w=new Ha("action","action",null,u,d);i.push({event:w,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(ir!==0){var D=v?og(d,v):new FormData(d);jc(l,{pending:!0,data:D,method:d.method,action:m},null,D)}}else typeof m=="function"&&(w.preventDefault(),D=v?og(d,v):new FormData(d),jc(l,{pending:!0,data:D,method:d.method,action:m},m,D))},currentTarget:d}]})}}for(var yh=0;yh<tc.length;yh++){var Sh=tc[yh],B1=Sh.toLowerCase(),L1=Sh[0].toUpperCase()+Sh.slice(1);Xi(B1,"on"+L1)}Xi(Up,"onAnimationEnd"),Xi(Pp,"onAnimationIteration"),Xi(Ip,"onAnimationStart"),Xi("dblclick","onDoubleClick"),Xi("focusin","onFocus"),Xi("focusout","onBlur"),Xi($0,"onTransitionRun"),Xi(G0,"onTransitionStart"),Xi(Z0,"onTransitionCancel"),Xi(Fp,"onTransitionEnd"),ns("onMouseEnter",["mouseout","mouseover"]),ns("onMouseLeave",["mouseout","mouseover"]),ns("onPointerEnter",["pointerout","pointerover"]),ns("onPointerLeave",["pointerout","pointerover"]),yr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),yr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),yr("onBeforeInput",["compositionend","keypress","textInput","paste"]),yr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),yr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),yr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var zl="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(" "),z1=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(zl));function ug(i,r){r=(r&4)!==0;for(var l=0;l<i.length;l++){var u=i[l],d=u.event;u=u.listeners;e:{var m=void 0;if(r)for(var v=u.length-1;0<=v;v--){var w=u[v],D=w.instance,I=w.currentTarget;if(w=w.listener,D!==m&&d.isPropagationStopped())break e;m=w,d.currentTarget=I;try{m(d)}catch(Q){Pa(Q)}d.currentTarget=null,m=D}else for(v=0;v<u.length;v++){if(w=u[v],D=w.instance,I=w.currentTarget,w=w.listener,D!==m&&d.isPropagationStopped())break e;m=w,d.currentTarget=I;try{m(d)}catch(Q){Pa(Q)}d.currentTarget=null,m=D}}}}function Be(i,r){var l=r[Lu];l===void 0&&(l=r[Lu]=new Set);var u=i+"__bubble";l.has(u)||(cg(r,i,2,!1),l.add(u))}function bh(i,r,l){var u=0;r&&(u|=4),cg(l,i,u,r)}var To="_reactListening"+Math.random().toString(36).slice(2);function xh(i){if(!i[To]){i[To]=!0,np.forEach(function(l){l!=="selectionchange"&&(z1.has(l)||bh(l,!1,i),bh(l,!0,i))});var r=i.nodeType===9?i:i.ownerDocument;r===null||r[To]||(r[To]=!0,bh("selectionchange",!1,r))}}function cg(i,r,l,u){switch(Ug(r)){case 2:var d=ox;break;case 8:d=ux;break;default:d=Hh}l=d.bind(null,r,l,i),d=void 0,!Fu||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(d=!0),u?d!==void 0?i.addEventListener(r,l,{capture:!0,passive:d}):i.addEventListener(r,l,!0):d!==void 0?i.addEventListener(r,l,{passive:d}):i.addEventListener(r,l,!1)}function wh(i,r,l,u,d){var m=u;if((r&1)===0&&(r&2)===0&&u!==null)e:for(;;){if(u===null)return;var v=u.tag;if(v===3||v===4){var w=u.stateNode.containerInfo;if(w===d)break;if(v===4)for(v=u.return;v!==null;){var D=v.tag;if((D===3||D===4)&&v.stateNode.containerInfo===d)return;v=v.return}for(;w!==null;){if(v=es(w),v===null)return;if(D=v.tag,D===5||D===6||D===26||D===27){u=m=v;continue e}w=w.parentNode}}u=u.return}mp(function(){var I=m,Q=Pu(l),ie=[];e:{var Y=qp.get(i);if(Y!==void 0){var G=Ha,me=i;switch(i){case"keypress":if(Na(l)===0)break e;case"keydown":case"keyup":G=T0;break;case"focusin":me="focus",G=Vu;break;case"focusout":me="blur",G=Vu;break;case"beforeblur":case"afterblur":G=Vu;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":G=vp;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":G=m0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":G=R0;break;case Up:case Pp:case Ip:G=v0;break;case Fp:G=B0;break;case"scroll":case"scrollend":G=d0;break;case"wheel":G=z0;break;case"copy":case"cut":case"paste":G=S0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":G=Sp;break;case"toggle":case"beforetoggle":G=O0}var ye=(r&4)!==0,Xe=!ye&&(i==="scroll"||i==="scrollend"),N=ye?Y!==null?Y+"Capture":null:Y;ye=[];for(var B=I,P;B!==null;){var ee=B;if(P=ee.stateNode,ee=ee.tag,ee!==5&&ee!==26&&ee!==27||P===null||N===null||(ee=il(B,N),ee!=null&&ye.push(Nl(B,ee,P))),Xe)break;B=B.return}0<ye.length&&(Y=new G(Y,me,null,l,Q),ie.push({event:Y,listeners:ye}))}}if((r&7)===0){e:{if(Y=i==="mouseover"||i==="pointerover",G=i==="mouseout"||i==="pointerout",Y&&l!==Uu&&(me=l.relatedTarget||l.fromElement)&&(es(me)||me[Jr]))break e;if((G||Y)&&(Y=Q.window===Q?Q:(Y=Q.ownerDocument)?Y.defaultView||Y.parentWindow:window,G?(me=l.relatedTarget||l.toElement,G=I,me=me?es(me):null,me!==null&&(Xe=o(me),ye=me.tag,me!==Xe||ye!==5&&ye!==27&&ye!==6)&&(me=null)):(G=null,me=I),G!==me)){if(ye=vp,ee="onMouseLeave",N="onMouseEnter",B="mouse",(i==="pointerout"||i==="pointerover")&&(ye=Sp,ee="onPointerLeave",N="onPointerEnter",B="pointer"),Xe=G==null?Y:tl(G),P=me==null?Y:tl(me),Y=new ye(ee,B+"leave",G,l,Q),Y.target=Xe,Y.relatedTarget=P,ee=null,es(Q)===I&&(ye=new ye(N,B+"enter",me,l,Q),ye.target=P,ye.relatedTarget=Xe,ee=ye),Xe=ee,G&&me)t:{for(ye=N1,N=G,B=me,P=0,ee=N;ee;ee=ye(ee))P++;ee=0;for(var ge=B;ge;ge=ye(ge))ee++;for(;0<P-ee;)N=ye(N),P--;for(;0<ee-P;)B=ye(B),ee--;for(;P--;){if(N===B||B!==null&&N===B.alternate){ye=N;break t}N=ye(N),B=ye(B)}ye=null}else ye=null;G!==null&&hg(ie,Y,G,ye,!1),me!==null&&Xe!==null&&hg(ie,Xe,me,ye,!0)}}e:{if(Y=I?tl(I):window,G=Y.nodeName&&Y.nodeName.toLowerCase(),G==="select"||G==="input"&&Y.type==="file")var Ue=Ap;else if(Ep(Y))if(Dp)Ue=V0;else{Ue=W0;var _e=q0}else G=Y.nodeName,!G||G.toLowerCase()!=="input"||Y.type!=="checkbox"&&Y.type!=="radio"?I&&ju(I.elementType)&&(Ue=Ap):Ue=Y0;if(Ue&&(Ue=Ue(i,I))){Tp(ie,Ue,l,Q);break e}_e&&_e(i,Y,I),i==="focusout"&&I&&Y.type==="number"&&I.memoizedProps.value!=null&&Hu(Y,"number",Y.value)}switch(_e=I?tl(I):window,i){case"focusin":(Ep(_e)||_e.contentEditable==="true")&&(us=_e,Qu=I,cl=null);break;case"focusout":cl=Qu=us=null;break;case"mousedown":Ju=!0;break;case"contextmenu":case"mouseup":case"dragend":Ju=!1,Hp(ie,l,Q);break;case"selectionchange":if(X0)break;case"keydown":case"keyup":Hp(ie,l,Q)}var ke;if(Xu)e:{switch(i){case"compositionstart":var Ne="onCompositionStart";break e;case"compositionend":Ne="onCompositionEnd";break e;case"compositionupdate":Ne="onCompositionUpdate";break e}Ne=void 0}else os?Cp(i,l)&&(Ne="onCompositionEnd"):i==="keydown"&&l.keyCode===229&&(Ne="onCompositionStart");Ne&&(bp&&l.locale!=="ko"&&(os||Ne!=="onCompositionStart"?Ne==="onCompositionEnd"&&os&&(ke=_p()):(Pn=Q,qu="value"in Pn?Pn.value:Pn.textContent,os=!0)),_e=Ao(I,Ne),0<_e.length&&(Ne=new yp(Ne,i,null,l,Q),ie.push({event:Ne,listeners:_e}),ke?Ne.data=ke:(ke=kp(l),ke!==null&&(Ne.data=ke)))),(ke=j0?U0(i,l):P0(i,l))&&(Ne=Ao(I,"onBeforeInput"),0<Ne.length&&(_e=new yp("onBeforeInput","beforeinput",null,l,Q),ie.push({event:_e,listeners:Ne}),_e.data=ke)),M1(ie,i,I,l,Q)}ug(ie,r)})}function Nl(i,r,l){return{instance:i,listener:r,currentTarget:l}}function Ao(i,r){for(var l=r+"Capture",u=[];i!==null;){var d=i,m=d.stateNode;if(d=d.tag,d!==5&&d!==26&&d!==27||m===null||(d=il(i,l),d!=null&&u.unshift(Nl(i,d,m)),d=il(i,r),d!=null&&u.push(Nl(i,d,m))),i.tag===3)return u;i=i.return}return[]}function N1(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function hg(i,r,l,u,d){for(var m=r._reactName,v=[];l!==null&&l!==u;){var w=l,D=w.alternate,I=w.stateNode;if(w=w.tag,D!==null&&D===u)break;w!==5&&w!==26&&w!==27||I===null||(D=I,d?(I=il(l,m),I!=null&&v.unshift(Nl(l,I,D))):d||(I=il(l,m),I!=null&&v.push(Nl(l,I,D)))),l=l.return}v.length!==0&&i.push({event:r,listeners:v})}var O1=/\r\n?/g,H1=/\u0000|\uFFFD/g;function fg(i){return(typeof i=="string"?i:""+i).replace(O1,`
49
+ `).replace(H1,"")}function dg(i,r){return r=fg(r),fg(i)===r}function Ke(i,r,l,u,d,m){switch(l){case"children":typeof u=="string"?r==="body"||r==="textarea"&&u===""||ss(i,u):(typeof u=="number"||typeof u=="bigint")&&r!=="body"&&ss(i,""+u);break;case"className":Ma(i,"class",u);break;case"tabIndex":Ma(i,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":Ma(i,l,u);break;case"style":dp(i,u,m);break;case"data":if(r!=="object"){Ma(i,"data",u);break}case"src":case"href":if(u===""&&(r!=="a"||l!=="href")){i.removeAttribute(l);break}if(u==null||typeof u=="function"||typeof u=="symbol"||typeof u=="boolean"){i.removeAttribute(l);break}u=La(""+u),i.setAttribute(l,u);break;case"action":case"formAction":if(typeof u=="function"){i.setAttribute(l,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof m=="function"&&(l==="formAction"?(r!=="input"&&Ke(i,r,"name",d.name,d,null),Ke(i,r,"formEncType",d.formEncType,d,null),Ke(i,r,"formMethod",d.formMethod,d,null),Ke(i,r,"formTarget",d.formTarget,d,null)):(Ke(i,r,"encType",d.encType,d,null),Ke(i,r,"method",d.method,d,null),Ke(i,r,"target",d.target,d,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){i.removeAttribute(l);break}u=La(""+u),i.setAttribute(l,u);break;case"onClick":u!=null&&(i.onclick=pn);break;case"onScroll":u!=null&&Be("scroll",i);break;case"onScrollEnd":u!=null&&Be("scrollend",i);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(s(61));if(l=u.__html,l!=null){if(d.children!=null)throw Error(s(60));i.innerHTML=l}}break;case"multiple":i.multiple=u&&typeof u!="function"&&typeof u!="symbol";break;case"muted":i.muted=u&&typeof u!="function"&&typeof u!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(u==null||typeof u=="function"||typeof u=="boolean"||typeof u=="symbol"){i.removeAttribute("xlink:href");break}l=La(""+u),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":u!=null&&typeof u!="function"&&typeof u!="symbol"?i.setAttribute(l,""+u):i.removeAttribute(l);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":u&&typeof u!="function"&&typeof u!="symbol"?i.setAttribute(l,""):i.removeAttribute(l);break;case"capture":case"download":u===!0?i.setAttribute(l,""):u!==!1&&u!=null&&typeof u!="function"&&typeof u!="symbol"?i.setAttribute(l,u):i.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":u!=null&&typeof u!="function"&&typeof u!="symbol"&&!isNaN(u)&&1<=u?i.setAttribute(l,u):i.removeAttribute(l);break;case"rowSpan":case"start":u==null||typeof u=="function"||typeof u=="symbol"||isNaN(u)?i.removeAttribute(l):i.setAttribute(l,u);break;case"popover":Be("beforetoggle",i),Be("toggle",i),Ra(i,"popover",u);break;case"xlinkActuate":dn(i,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":dn(i,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":dn(i,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":dn(i,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":dn(i,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":dn(i,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":dn(i,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":dn(i,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":dn(i,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":Ra(i,"is",u);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=h0.get(l)||l,Ra(i,l,u))}}function Ch(i,r,l,u,d,m){switch(l){case"style":dp(i,u,m);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(s(61));if(l=u.__html,l!=null){if(d.children!=null)throw Error(s(60));i.innerHTML=l}}break;case"children":typeof u=="string"?ss(i,u):(typeof u=="number"||typeof u=="bigint")&&ss(i,""+u);break;case"onScroll":u!=null&&Be("scroll",i);break;case"onScrollEnd":u!=null&&Be("scrollend",i);break;case"onClick":u!=null&&(i.onclick=pn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!rp.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(d=l.endsWith("Capture"),r=l.slice(2,d?l.length-7:void 0),m=i[oi]||null,m=m!=null?m[l]:null,typeof m=="function"&&i.removeEventListener(r,m,d),typeof u=="function")){typeof m!="function"&&m!==null&&(l in i?i[l]=null:i.hasAttribute(l)&&i.removeAttribute(l)),i.addEventListener(r,u,d);break e}l in i?i[l]=u:u===!0?i.setAttribute(l,""):Ra(i,l,u)}}}function Ft(i,r,l){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Be("error",i),Be("load",i);var u=!1,d=!1,m;for(m in l)if(l.hasOwnProperty(m)){var v=l[m];if(v!=null)switch(m){case"src":u=!0;break;case"srcSet":d=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,r));default:Ke(i,r,m,v,l,null)}}d&&Ke(i,r,"srcSet",l.srcSet,l,null),u&&Ke(i,r,"src",l.src,l,null);return;case"input":Be("invalid",i);var w=m=v=d=null,D=null,I=null;for(u in l)if(l.hasOwnProperty(u)){var Q=l[u];if(Q!=null)switch(u){case"name":d=Q;break;case"type":v=Q;break;case"checked":D=Q;break;case"defaultChecked":I=Q;break;case"value":m=Q;break;case"defaultValue":w=Q;break;case"children":case"dangerouslySetInnerHTML":if(Q!=null)throw Error(s(137,r));break;default:Ke(i,r,u,Q,l,null)}}up(i,m,w,D,I,v,d,!1);return;case"select":Be("invalid",i),u=v=m=null;for(d in l)if(l.hasOwnProperty(d)&&(w=l[d],w!=null))switch(d){case"value":m=w;break;case"defaultValue":v=w;break;case"multiple":u=w;default:Ke(i,r,d,w,l,null)}r=m,l=v,i.multiple=!!u,r!=null?rs(i,!!u,r,!1):l!=null&&rs(i,!!u,l,!0);return;case"textarea":Be("invalid",i),m=d=u=null;for(v in l)if(l.hasOwnProperty(v)&&(w=l[v],w!=null))switch(v){case"value":u=w;break;case"defaultValue":d=w;break;case"children":m=w;break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(s(91));break;default:Ke(i,r,v,w,l,null)}hp(i,u,d,m);return;case"option":for(D in l)if(l.hasOwnProperty(D)&&(u=l[D],u!=null))switch(D){case"selected":i.selected=u&&typeof u!="function"&&typeof u!="symbol";break;default:Ke(i,r,D,u,l,null)}return;case"dialog":Be("beforetoggle",i),Be("toggle",i),Be("cancel",i),Be("close",i);break;case"iframe":case"object":Be("load",i);break;case"video":case"audio":for(u=0;u<zl.length;u++)Be(zl[u],i);break;case"image":Be("error",i),Be("load",i);break;case"details":Be("toggle",i);break;case"embed":case"source":case"link":Be("error",i),Be("load",i);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(I in l)if(l.hasOwnProperty(I)&&(u=l[I],u!=null))switch(I){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,r));default:Ke(i,r,I,u,l,null)}return;default:if(ju(r)){for(Q in l)l.hasOwnProperty(Q)&&(u=l[Q],u!==void 0&&Ch(i,r,Q,u,l,void 0));return}}for(w in l)l.hasOwnProperty(w)&&(u=l[w],u!=null&&Ke(i,r,w,u,l,null))}function j1(i,r,l,u){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var d=null,m=null,v=null,w=null,D=null,I=null,Q=null;for(G in l){var ie=l[G];if(l.hasOwnProperty(G)&&ie!=null)switch(G){case"checked":break;case"value":break;case"defaultValue":D=ie;default:u.hasOwnProperty(G)||Ke(i,r,G,null,u,ie)}}for(var Y in u){var G=u[Y];if(ie=l[Y],u.hasOwnProperty(Y)&&(G!=null||ie!=null))switch(Y){case"type":m=G;break;case"name":d=G;break;case"checked":I=G;break;case"defaultChecked":Q=G;break;case"value":v=G;break;case"defaultValue":w=G;break;case"children":case"dangerouslySetInnerHTML":if(G!=null)throw Error(s(137,r));break;default:G!==ie&&Ke(i,r,Y,G,u,ie)}}Ou(i,v,w,D,I,Q,m,d);return;case"select":G=v=w=Y=null;for(m in l)if(D=l[m],l.hasOwnProperty(m)&&D!=null)switch(m){case"value":break;case"multiple":G=D;default:u.hasOwnProperty(m)||Ke(i,r,m,null,u,D)}for(d in u)if(m=u[d],D=l[d],u.hasOwnProperty(d)&&(m!=null||D!=null))switch(d){case"value":Y=m;break;case"defaultValue":w=m;break;case"multiple":v=m;default:m!==D&&Ke(i,r,d,m,u,D)}r=w,l=v,u=G,Y!=null?rs(i,!!l,Y,!1):!!u!=!!l&&(r!=null?rs(i,!!l,r,!0):rs(i,!!l,l?[]:"",!1));return;case"textarea":G=Y=null;for(w in l)if(d=l[w],l.hasOwnProperty(w)&&d!=null&&!u.hasOwnProperty(w))switch(w){case"value":break;case"children":break;default:Ke(i,r,w,null,u,d)}for(v in u)if(d=u[v],m=l[v],u.hasOwnProperty(v)&&(d!=null||m!=null))switch(v){case"value":Y=d;break;case"defaultValue":G=d;break;case"children":break;case"dangerouslySetInnerHTML":if(d!=null)throw Error(s(91));break;default:d!==m&&Ke(i,r,v,d,u,m)}cp(i,Y,G);return;case"option":for(var me in l)if(Y=l[me],l.hasOwnProperty(me)&&Y!=null&&!u.hasOwnProperty(me))switch(me){case"selected":i.selected=!1;break;default:Ke(i,r,me,null,u,Y)}for(D in u)if(Y=u[D],G=l[D],u.hasOwnProperty(D)&&Y!==G&&(Y!=null||G!=null))switch(D){case"selected":i.selected=Y&&typeof Y!="function"&&typeof Y!="symbol";break;default:Ke(i,r,D,Y,u,G)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var ye in l)Y=l[ye],l.hasOwnProperty(ye)&&Y!=null&&!u.hasOwnProperty(ye)&&Ke(i,r,ye,null,u,Y);for(I in u)if(Y=u[I],G=l[I],u.hasOwnProperty(I)&&Y!==G&&(Y!=null||G!=null))switch(I){case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(s(137,r));break;default:Ke(i,r,I,Y,u,G)}return;default:if(ju(r)){for(var Xe in l)Y=l[Xe],l.hasOwnProperty(Xe)&&Y!==void 0&&!u.hasOwnProperty(Xe)&&Ch(i,r,Xe,void 0,u,Y);for(Q in u)Y=u[Q],G=l[Q],!u.hasOwnProperty(Q)||Y===G||Y===void 0&&G===void 0||Ch(i,r,Q,Y,u,G);return}}for(var N in l)Y=l[N],l.hasOwnProperty(N)&&Y!=null&&!u.hasOwnProperty(N)&&Ke(i,r,N,null,u,Y);for(ie in u)Y=u[ie],G=l[ie],!u.hasOwnProperty(ie)||Y===G||Y==null&&G==null||Ke(i,r,ie,Y,u,G)}function pg(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function U1(){if(typeof performance.getEntriesByType=="function"){for(var i=0,r=0,l=performance.getEntriesByType("resource"),u=0;u<l.length;u++){var d=l[u],m=d.transferSize,v=d.initiatorType,w=d.duration;if(m&&w&&pg(v)){for(v=0,w=d.responseEnd,u+=1;u<l.length;u++){var D=l[u],I=D.startTime;if(I>w)break;var Q=D.transferSize,ie=D.initiatorType;Q&&pg(ie)&&(D=D.responseEnd,v+=Q*(D<w?1:(w-I)/(D-I)))}if(--u,r+=8*(m+v)/(d.duration/1e3),i++,10<i)break}}if(0<i)return r/i/1e6}return navigator.connection&&(i=navigator.connection.downlink,typeof i=="number")?i:5}var kh=null,Eh=null;function Do(i){return i.nodeType===9?i:i.ownerDocument}function mg(i){switch(i){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function _g(i,r){if(i===0)switch(r){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&r==="foreignObject"?0:i}function Th(i,r){return i==="textarea"||i==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.children=="bigint"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var Ah=null;function P1(){var i=window.event;return i&&i.type==="popstate"?i===Ah?!1:(Ah=i,!0):(Ah=null,!1)}var gg=typeof setTimeout=="function"?setTimeout:void 0,I1=typeof clearTimeout=="function"?clearTimeout:void 0,vg=typeof Promise=="function"?Promise:void 0,F1=typeof queueMicrotask=="function"?queueMicrotask:typeof vg<"u"?function(i){return vg.resolve(null).then(i).catch(q1)}:gg;function q1(i){setTimeout(function(){throw i})}function nr(i){return i==="head"}function yg(i,r){var l=r,u=0;do{var d=l.nextSibling;if(i.removeChild(l),d&&d.nodeType===8)if(l=d.data,l==="/$"||l==="/&"){if(u===0){i.removeChild(d),Os(r);return}u--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")u++;else if(l==="html")Ol(i.ownerDocument.documentElement);else if(l==="head"){l=i.ownerDocument.head,Ol(l);for(var m=l.firstChild;m;){var v=m.nextSibling,w=m.nodeName;m[el]||w==="SCRIPT"||w==="STYLE"||w==="LINK"&&m.rel.toLowerCase()==="stylesheet"||l.removeChild(m),m=v}}else l==="body"&&Ol(i.ownerDocument.body);l=d}while(l);Os(r)}function Sg(i,r){var l=i;i=0;do{var u=l.nextSibling;if(l.nodeType===1?r?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(r?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),u&&u.nodeType===8)if(l=u.data,l==="/$"){if(i===0)break;i--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||i++;l=u}while(l)}function Dh(i){var r=i.firstChild;for(r&&r.nodeType===10&&(r=r.nextSibling);r;){var l=r;switch(r=r.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":Dh(l),zu(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}i.removeChild(l)}}function W1(i,r,l,u){for(;i.nodeType===1;){var d=l;if(i.nodeName.toLowerCase()!==r.toLowerCase()){if(!u&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(u){if(!i[el])switch(r){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(m=i.getAttribute("rel"),m==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(m!==d.rel||i.getAttribute("href")!==(d.href==null||d.href===""?null:d.href)||i.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin)||i.getAttribute("title")!==(d.title==null?null:d.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(m=i.getAttribute("src"),(m!==(d.src==null?null:d.src)||i.getAttribute("type")!==(d.type==null?null:d.type)||i.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin))&&m&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(r==="input"&&i.type==="hidden"){var m=d.name==null?null:""+d.name;if(d.type==="hidden"&&i.getAttribute("name")===m)return i}else return i;if(i=Pi(i.nextSibling),i===null)break}return null}function Y1(i,r,l){if(r==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!l||(i=Pi(i.nextSibling),i===null))return null;return i}function bg(i,r){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!r||(i=Pi(i.nextSibling),i===null))return null;return i}function Rh(i){return i.data==="$?"||i.data==="$~"}function Mh(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function V1(i,r){var l=i.ownerDocument;if(i.data==="$~")i._reactRetry=r;else if(i.data!=="$?"||l.readyState!=="loading")r();else{var u=function(){r(),l.removeEventListener("DOMContentLoaded",u)};l.addEventListener("DOMContentLoaded",u),i._reactRetry=u}}function Pi(i){for(;i!=null;i=i.nextSibling){var r=i.nodeType;if(r===1||r===3)break;if(r===8){if(r=i.data,r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"||r==="F!"||r==="F")break;if(r==="/$"||r==="/&")return null}}return i}var Bh=null;function xg(i){i=i.nextSibling;for(var r=0;i;){if(i.nodeType===8){var l=i.data;if(l==="/$"||l==="/&"){if(r===0)return Pi(i.nextSibling);r--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||r++}i=i.nextSibling}return null}function wg(i){i=i.previousSibling;for(var r=0;i;){if(i.nodeType===8){var l=i.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(r===0)return i;r--}else l!=="/$"&&l!=="/&"||r++}i=i.previousSibling}return null}function Cg(i,r,l){switch(r=Do(l),i){case"html":if(i=r.documentElement,!i)throw Error(s(452));return i;case"head":if(i=r.head,!i)throw Error(s(453));return i;case"body":if(i=r.body,!i)throw Error(s(454));return i;default:throw Error(s(451))}}function Ol(i){for(var r=i.attributes;r.length;)i.removeAttributeNode(r[0]);zu(i)}var Ii=new Map,kg=new Set;function Ro(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var Rn=q.d;q.d={f:K1,r:X1,D:$1,C:G1,L:Z1,m:Q1,X:ex,S:J1,M:tx};function K1(){var i=Rn.f(),r=bo();return i||r}function X1(i){var r=ts(i);r!==null&&r.tag===5&&r.type==="form"?Fm(r):Rn.r(i)}var Ls=typeof document>"u"?null:document;function Eg(i,r,l){var u=Ls;if(u&&typeof r=="string"&&r){var d=Li(r);d='link[rel="'+i+'"][href="'+d+'"]',typeof l=="string"&&(d+='[crossorigin="'+l+'"]'),kg.has(d)||(kg.add(d),i={rel:i,crossOrigin:l,href:r},u.querySelector(d)===null&&(r=u.createElement("link"),Ft(r,"link",i),Tt(r),u.head.appendChild(r)))}}function $1(i){Rn.D(i),Eg("dns-prefetch",i,null)}function G1(i,r){Rn.C(i,r),Eg("preconnect",i,r)}function Z1(i,r,l){Rn.L(i,r,l);var u=Ls;if(u&&i&&r){var d='link[rel="preload"][as="'+Li(r)+'"]';r==="image"&&l&&l.imageSrcSet?(d+='[imagesrcset="'+Li(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(d+='[imagesizes="'+Li(l.imageSizes)+'"]')):d+='[href="'+Li(i)+'"]';var m=d;switch(r){case"style":m=zs(i);break;case"script":m=Ns(i)}Ii.has(m)||(i=_({rel:"preload",href:r==="image"&&l&&l.imageSrcSet?void 0:i,as:r},l),Ii.set(m,i),u.querySelector(d)!==null||r==="style"&&u.querySelector(Hl(m))||r==="script"&&u.querySelector(jl(m))||(r=u.createElement("link"),Ft(r,"link",i),Tt(r),u.head.appendChild(r)))}}function Q1(i,r){Rn.m(i,r);var l=Ls;if(l&&i){var u=r&&typeof r.as=="string"?r.as:"script",d='link[rel="modulepreload"][as="'+Li(u)+'"][href="'+Li(i)+'"]',m=d;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":m=Ns(i)}if(!Ii.has(m)&&(i=_({rel:"modulepreload",href:i},r),Ii.set(m,i),l.querySelector(d)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(jl(m)))return}u=l.createElement("link"),Ft(u,"link",i),Tt(u),l.head.appendChild(u)}}}function J1(i,r,l){Rn.S(i,r,l);var u=Ls;if(u&&i){var d=is(u).hoistableStyles,m=zs(i);r=r||"default";var v=d.get(m);if(!v){var w={loading:0,preload:null};if(v=u.querySelector(Hl(m)))w.loading=5;else{i=_({rel:"stylesheet",href:i,"data-precedence":r},l),(l=Ii.get(m))&&Lh(i,l);var D=v=u.createElement("link");Tt(D),Ft(D,"link",i),D._p=new Promise(function(I,Q){D.onload=I,D.onerror=Q}),D.addEventListener("load",function(){w.loading|=1}),D.addEventListener("error",function(){w.loading|=2}),w.loading|=4,Mo(v,r,u)}v={type:"stylesheet",instance:v,count:1,state:w},d.set(m,v)}}}function ex(i,r){Rn.X(i,r);var l=Ls;if(l&&i){var u=is(l).hoistableScripts,d=Ns(i),m=u.get(d);m||(m=l.querySelector(jl(d)),m||(i=_({src:i,async:!0},r),(r=Ii.get(d))&&zh(i,r),m=l.createElement("script"),Tt(m),Ft(m,"link",i),l.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},u.set(d,m))}}function tx(i,r){Rn.M(i,r);var l=Ls;if(l&&i){var u=is(l).hoistableScripts,d=Ns(i),m=u.get(d);m||(m=l.querySelector(jl(d)),m||(i=_({src:i,async:!0,type:"module"},r),(r=Ii.get(d))&&zh(i,r),m=l.createElement("script"),Tt(m),Ft(m,"link",i),l.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},u.set(d,m))}}function Tg(i,r,l,u){var d=(d=pe.current)?Ro(d):null;if(!d)throw Error(s(446));switch(i){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(r=zs(l.href),l=is(d).hoistableStyles,u=l.get(r),u||(u={type:"style",instance:null,count:0,state:null},l.set(r,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){i=zs(l.href);var m=is(d).hoistableStyles,v=m.get(i);if(v||(d=d.ownerDocument||d,v={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},m.set(i,v),(m=d.querySelector(Hl(i)))&&!m._p&&(v.instance=m,v.state.loading=5),Ii.has(i)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},Ii.set(i,l),m||ix(d,i,l,v.state))),r&&u===null)throw Error(s(528,""));return v}if(r&&u!==null)throw Error(s(529,""));return null;case"script":return r=l.async,l=l.src,typeof l=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=Ns(l),l=is(d).hoistableScripts,u=l.get(r),u||(u={type:"script",instance:null,count:0,state:null},l.set(r,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,i))}}function zs(i){return'href="'+Li(i)+'"'}function Hl(i){return'link[rel="stylesheet"]['+i+"]"}function Ag(i){return _({},i,{"data-precedence":i.precedence,precedence:null})}function ix(i,r,l,u){i.querySelector('link[rel="preload"][as="style"]['+r+"]")?u.loading=1:(r=i.createElement("link"),u.preload=r,r.addEventListener("load",function(){return u.loading|=1}),r.addEventListener("error",function(){return u.loading|=2}),Ft(r,"link",l),Tt(r),i.head.appendChild(r))}function Ns(i){return'[src="'+Li(i)+'"]'}function jl(i){return"script[async]"+i}function Dg(i,r,l){if(r.count++,r.instance===null)switch(r.type){case"style":var u=i.querySelector('style[data-href~="'+Li(l.href)+'"]');if(u)return r.instance=u,Tt(u),u;var d=_({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return u=(i.ownerDocument||i).createElement("style"),Tt(u),Ft(u,"style",d),Mo(u,l.precedence,i),r.instance=u;case"stylesheet":d=zs(l.href);var m=i.querySelector(Hl(d));if(m)return r.state.loading|=4,r.instance=m,Tt(m),m;u=Ag(l),(d=Ii.get(d))&&Lh(u,d),m=(i.ownerDocument||i).createElement("link"),Tt(m);var v=m;return v._p=new Promise(function(w,D){v.onload=w,v.onerror=D}),Ft(m,"link",u),r.state.loading|=4,Mo(m,l.precedence,i),r.instance=m;case"script":return m=Ns(l.src),(d=i.querySelector(jl(m)))?(r.instance=d,Tt(d),d):(u=l,(d=Ii.get(m))&&(u=_({},l),zh(u,d)),i=i.ownerDocument||i,d=i.createElement("script"),Tt(d),Ft(d,"link",u),i.head.appendChild(d),r.instance=d);case"void":return null;default:throw Error(s(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(u=r.instance,r.state.loading|=4,Mo(u,l.precedence,i));return r.instance}function Mo(i,r,l){for(var u=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),d=u.length?u[u.length-1]:null,m=d,v=0;v<u.length;v++){var w=u[v];if(w.dataset.precedence===r)m=w;else if(m!==d)break}m?m.parentNode.insertBefore(i,m.nextSibling):(r=l.nodeType===9?l.head:l,r.insertBefore(i,r.firstChild))}function Lh(i,r){i.crossOrigin==null&&(i.crossOrigin=r.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=r.referrerPolicy),i.title==null&&(i.title=r.title)}function zh(i,r){i.crossOrigin==null&&(i.crossOrigin=r.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=r.referrerPolicy),i.integrity==null&&(i.integrity=r.integrity)}var Bo=null;function Rg(i,r,l){if(Bo===null){var u=new Map,d=Bo=new Map;d.set(l,u)}else d=Bo,u=d.get(l),u||(u=new Map,d.set(l,u));if(u.has(i))return u;for(u.set(i,null),l=l.getElementsByTagName(i),d=0;d<l.length;d++){var m=l[d];if(!(m[el]||m[jt]||i==="link"&&m.getAttribute("rel")==="stylesheet")&&m.namespaceURI!=="http://www.w3.org/2000/svg"){var v=m.getAttribute(r)||"";v=i+v;var w=u.get(v);w?w.push(m):u.set(v,[m])}}return u}function Mg(i,r,l){i=i.ownerDocument||i,i.head.insertBefore(l,r==="title"?i.querySelector("head > title"):null)}function nx(i,r,l){if(l===1||r.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;switch(r.rel){case"stylesheet":return i=r.disabled,typeof r.precedence=="string"&&i==null;default:return!0}case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function Bg(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function rx(i,r,l,u){if(l.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var d=zs(u.href),m=r.querySelector(Hl(d));if(m){r=m._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(i.count++,i=Lo.bind(i),r.then(i,i)),l.state.loading|=4,l.instance=m,Tt(m);return}m=r.ownerDocument||r,u=Ag(u),(d=Ii.get(d))&&Lh(u,d),m=m.createElement("link"),Tt(m);var v=m;v._p=new Promise(function(w,D){v.onload=w,v.onerror=D}),Ft(m,"link",u),l.instance=m}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(l,r),(r=l.state.preload)&&(l.state.loading&3)===0&&(i.count++,l=Lo.bind(i),r.addEventListener("load",l),r.addEventListener("error",l))}}var Nh=0;function sx(i,r){return i.stylesheets&&i.count===0&&No(i,i.stylesheets),0<i.count||0<i.imgCount?function(l){var u=setTimeout(function(){if(i.stylesheets&&No(i,i.stylesheets),i.unsuspend){var m=i.unsuspend;i.unsuspend=null,m()}},6e4+r);0<i.imgBytes&&Nh===0&&(Nh=62500*U1());var d=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&No(i,i.stylesheets),i.unsuspend)){var m=i.unsuspend;i.unsuspend=null,m()}},(i.imgBytes>Nh?50:800)+r);return i.unsuspend=l,function(){i.unsuspend=null,clearTimeout(u),clearTimeout(d)}}:null}function Lo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)No(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var zo=null;function No(i,r){i.stylesheets=null,i.unsuspend!==null&&(i.count++,zo=new Map,r.forEach(lx,i),zo=null,Lo.call(i))}function lx(i,r){if(!(r.state.loading&4)){var l=zo.get(i);if(l)var u=l.get(null);else{l=new Map,zo.set(i,l);for(var d=i.querySelectorAll("link[data-precedence],style[data-precedence]"),m=0;m<d.length;m++){var v=d[m];(v.nodeName==="LINK"||v.getAttribute("media")!=="not all")&&(l.set(v.dataset.precedence,v),u=v)}u&&l.set(null,u)}d=r.instance,v=d.getAttribute("data-precedence"),m=l.get(v)||u,m===u&&l.set(null,d),l.set(v,d),this.count++,u=Lo.bind(this),d.addEventListener("load",u),d.addEventListener("error",u),m?m.parentNode.insertBefore(d,m.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(d,i.firstChild)),r.state.loading|=4}}var Ul={$$typeof:j,Provider:null,Consumer:null,_currentValue:W,_currentValue2:W,_threadCount:0};function ax(i,r,l,u,d,m,v,w,D){this.tag=1,this.containerInfo=i,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ru(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ru(0),this.hiddenUpdates=Ru(null),this.identifierPrefix=u,this.onUncaughtError=d,this.onCaughtError=m,this.onRecoverableError=v,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=D,this.incompleteTransitions=new Map}function Lg(i,r,l,u,d,m,v,w,D,I,Q,ie){return i=new ax(i,r,l,v,D,I,Q,ie,w),r=1,m===!0&&(r|=24),m=bi(3,null,null,r),i.current=m,m.stateNode=i,r=pc(),r.refCount++,i.pooledCache=r,r.refCount++,m.memoizedState={element:u,isDehydrated:l,cache:r},vc(m),i}function zg(i){return i?(i=fs,i):fs}function Ng(i,r,l,u,d,m){d=zg(d),u.context===null?u.context=d:u.pendingContext=d,u=Vn(r),u.payload={element:l},m=m===void 0?null:m,m!==null&&(u.callback=m),l=Kn(i,u,r),l!==null&&(pi(l,i,r),gl(l,i,r))}function Og(i,r){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var l=i.retryLane;i.retryLane=l!==0&&l<r?l:r}}function Oh(i,r){Og(i,r),(i=i.alternate)&&Og(i,r)}function Hg(i){if(i.tag===13||i.tag===31){var r=wr(i,67108864);r!==null&&pi(r,i,67108864),Oh(i,67108864)}}function jg(i){if(i.tag===13||i.tag===31){var r=Ei();r=Mu(r);var l=wr(i,r);l!==null&&pi(l,i,r),Oh(i,r)}}var Oo=!0;function ox(i,r,l,u){var d=M.T;M.T=null;var m=q.p;try{q.p=2,Hh(i,r,l,u)}finally{q.p=m,M.T=d}}function ux(i,r,l,u){var d=M.T;M.T=null;var m=q.p;try{q.p=8,Hh(i,r,l,u)}finally{q.p=m,M.T=d}}function Hh(i,r,l,u){if(Oo){var d=jh(u);if(d===null)wh(i,r,u,Ho,l),Pg(i,u);else if(hx(d,i,r,l,u))u.stopPropagation();else if(Pg(i,u),r&4&&-1<cx.indexOf(i)){for(;d!==null;){var m=ts(d);if(m!==null)switch(m.tag){case 3:if(m=m.stateNode,m.current.memoizedState.isDehydrated){var v=vr(m.pendingLanes);if(v!==0){var w=m;for(w.pendingLanes|=2,w.entangledLanes|=2;v;){var D=1<<31-Ge(v);w.entanglements[1]|=D,v&=~D}nn(m),(Ie&6)===0&&(yo=Qt()+500,Ll(0))}}break;case 31:case 13:w=wr(m,2),w!==null&&pi(w,m,2),bo(),Oh(m,2)}if(m=jh(u),m===null&&wh(i,r,u,Ho,l),m===d)break;d=m}d!==null&&u.stopPropagation()}else wh(i,r,u,null,l)}}function jh(i){return i=Pu(i),Uh(i)}var Ho=null;function Uh(i){if(Ho=null,i=es(i),i!==null){var r=o(i);if(r===null)i=null;else{var l=r.tag;if(l===13){if(i=c(r),i!==null)return i;i=null}else if(l===31){if(i=f(r),i!==null)return i;i=null}else if(l===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;i=null}else r!==i&&(i=null)}}return Ho=i,null}function Ug(i){switch(i){case"beforetoggle":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"toggle":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 2;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"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Du()){case J:return 2;case he:return 8;case Se:case Re:return 32;case Fe:return 268435456;default:return 32}default:return 32}}var Ph=!1,rr=null,sr=null,lr=null,Pl=new Map,Il=new Map,ar=[],cx="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".split(" ");function Pg(i,r){switch(i){case"focusin":case"focusout":rr=null;break;case"dragenter":case"dragleave":sr=null;break;case"mouseover":case"mouseout":lr=null;break;case"pointerover":case"pointerout":Pl.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":Il.delete(r.pointerId)}}function Fl(i,r,l,u,d,m){return i===null||i.nativeEvent!==m?(i={blockedOn:r,domEventName:l,eventSystemFlags:u,nativeEvent:m,targetContainers:[d]},r!==null&&(r=ts(r),r!==null&&Hg(r)),i):(i.eventSystemFlags|=u,r=i.targetContainers,d!==null&&r.indexOf(d)===-1&&r.push(d),i)}function hx(i,r,l,u,d){switch(r){case"focusin":return rr=Fl(rr,i,r,l,u,d),!0;case"dragenter":return sr=Fl(sr,i,r,l,u,d),!0;case"mouseover":return lr=Fl(lr,i,r,l,u,d),!0;case"pointerover":var m=d.pointerId;return Pl.set(m,Fl(Pl.get(m)||null,i,r,l,u,d)),!0;case"gotpointercapture":return m=d.pointerId,Il.set(m,Fl(Il.get(m)||null,i,r,l,u,d)),!0}return!1}function Ig(i){var r=es(i.target);if(r!==null){var l=o(r);if(l!==null){if(r=l.tag,r===13){if(r=c(l),r!==null){i.blockedOn=r,tp(i.priority,function(){jg(l)});return}}else if(r===31){if(r=f(l),r!==null){i.blockedOn=r,tp(i.priority,function(){jg(l)});return}}else if(r===3&&l.stateNode.current.memoizedState.isDehydrated){i.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}i.blockedOn=null}function jo(i){if(i.blockedOn!==null)return!1;for(var r=i.targetContainers;0<r.length;){var l=jh(i.nativeEvent);if(l===null){l=i.nativeEvent;var u=new l.constructor(l.type,l);Uu=u,l.target.dispatchEvent(u),Uu=null}else return r=ts(l),r!==null&&Hg(r),i.blockedOn=l,!1;r.shift()}return!0}function Fg(i,r,l){jo(i)&&l.delete(r)}function fx(){Ph=!1,rr!==null&&jo(rr)&&(rr=null),sr!==null&&jo(sr)&&(sr=null),lr!==null&&jo(lr)&&(lr=null),Pl.forEach(Fg),Il.forEach(Fg)}function Uo(i,r){i.blockedOn===r&&(i.blockedOn=null,Ph||(Ph=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,fx)))}var Po=null;function qg(i){Po!==i&&(Po=i,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Po===i&&(Po=null);for(var r=0;r<i.length;r+=3){var l=i[r],u=i[r+1],d=i[r+2];if(typeof u!="function"){if(Uh(u||l)===null)continue;break}var m=ts(l);m!==null&&(i.splice(r,3),r-=3,jc(m,{pending:!0,data:d,method:l.method,action:u},u,d))}}))}function Os(i){function r(D){return Uo(D,i)}rr!==null&&Uo(rr,i),sr!==null&&Uo(sr,i),lr!==null&&Uo(lr,i),Pl.forEach(r),Il.forEach(r);for(var l=0;l<ar.length;l++){var u=ar[l];u.blockedOn===i&&(u.blockedOn=null)}for(;0<ar.length&&(l=ar[0],l.blockedOn===null);)Ig(l),l.blockedOn===null&&ar.shift();if(l=(i.ownerDocument||i).$$reactFormReplay,l!=null)for(u=0;u<l.length;u+=3){var d=l[u],m=l[u+1],v=d[oi]||null;if(typeof m=="function")v||qg(l);else if(v){var w=null;if(m&&m.hasAttribute("formAction")){if(d=m,v=m[oi]||null)w=v.formAction;else if(Uh(d)!==null)continue}else w=v.action;typeof w=="function"?l[u+1]=w:(l.splice(u,3),u-=3),qg(l)}}}function Wg(){function i(m){m.canIntercept&&m.info==="react-transition"&&m.intercept({handler:function(){return new Promise(function(v){return d=v})},focusReset:"manual",scroll:"manual"})}function r(){d!==null&&(d(),d=null),u||setTimeout(l,20)}function l(){if(!u&&!navigation.transition){var m=navigation.currentEntry;m&&m.url!=null&&navigation.navigate(m.url,{state:m.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var u=!1,d=null;return navigation.addEventListener("navigate",i),navigation.addEventListener("navigatesuccess",r),navigation.addEventListener("navigateerror",r),setTimeout(l,100),function(){u=!0,navigation.removeEventListener("navigate",i),navigation.removeEventListener("navigatesuccess",r),navigation.removeEventListener("navigateerror",r),d!==null&&(d(),d=null)}}}function Ih(i){this._internalRoot=i}Io.prototype.render=Ih.prototype.render=function(i){var r=this._internalRoot;if(r===null)throw Error(s(409));var l=r.current,u=Ei();Ng(l,u,i,r,null,null)},Io.prototype.unmount=Ih.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var r=i.containerInfo;Ng(i.current,2,null,i,null,null),bo(),r[Jr]=null}};function Io(i){this._internalRoot=i}Io.prototype.unstable_scheduleHydration=function(i){if(i){var r=ep();i={blockedOn:null,target:i,priority:r};for(var l=0;l<ar.length&&r!==0&&r<ar[l].priority;l++);ar.splice(l,0,i),l===0&&Ig(i)}};var Yg=t.version;if(Yg!=="19.2.3")throw Error(s(527,Yg,"19.2.3"));q.findDOMNode=function(i){var r=i._reactInternals;if(r===void 0)throw typeof i.render=="function"?Error(s(188)):(i=Object.keys(i).join(","),Error(s(268,i)));return i=h(r),i=i!==null?g(i):null,i=i===null?null:i.stateNode,i};var dx={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:M,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Fo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Fo.isDisabled&&Fo.supportsFiber)try{Jt=Fo.inject(dx),xt=Fo}catch{}}return Wl.createRoot=function(i,r){if(!a(i))throw Error(s(299));var l=!1,u="",d=Qm,m=Jm,v=e_;return r!=null&&(r.unstable_strictMode===!0&&(l=!0),r.identifierPrefix!==void 0&&(u=r.identifierPrefix),r.onUncaughtError!==void 0&&(d=r.onUncaughtError),r.onCaughtError!==void 0&&(m=r.onCaughtError),r.onRecoverableError!==void 0&&(v=r.onRecoverableError)),r=Lg(i,1,!1,null,null,l,u,null,d,m,v,Wg),i[Jr]=r.current,xh(i),new Ih(r)},Wl.hydrateRoot=function(i,r,l){if(!a(i))throw Error(s(299));var u=!1,d="",m=Qm,v=Jm,w=e_,D=null;return l!=null&&(l.unstable_strictMode===!0&&(u=!0),l.identifierPrefix!==void 0&&(d=l.identifierPrefix),l.onUncaughtError!==void 0&&(m=l.onUncaughtError),l.onCaughtError!==void 0&&(v=l.onCaughtError),l.onRecoverableError!==void 0&&(w=l.onRecoverableError),l.formState!==void 0&&(D=l.formState)),r=Lg(i,1,!0,r,l??null,u,d,D,m,v,w,Wg),r.context=zg(null),l=r.current,u=Ei(),u=Mu(u),d=Vn(u),d.callback=null,Kn(l,d,u),l=u,r.current.lanes=l,Js(r,l),nn(r),i[Jr]=r.current,xh(i),new Io(r)},Wl.version="19.2.3",Wl}var tv;function Cx(){if(tv)return Wh.exports;tv=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Wh.exports=wx(),Wh.exports}var kx=Cx();const Ex=gu(kx);function Tx({onLogin:e}){const[t,n]=ae.useState(""),[s,a]=ae.useState(null),[o,c]=ae.useState(!1),f=async p=>{if(p.preventDefault(),!t.trim())return;c(!0),a(null);const h=await e(t);h&&a(h),c(!1)};return x.jsx("div",{className:"flex h-screen items-center justify-center p-4",children:x.jsxs("div",{className:"w-full max-w-sm",children:[x.jsxs("div",{className:"border-border rounded border p-6",children:[x.jsxs("div",{className:"mb-6 text-center",children:[x.jsx("h1",{className:"text-accent text-lg font-bold tracking-tight",children:"PlotLink OWS"}),x.jsx("p",{className:"text-muted mt-1 text-xs",children:"local writer agent"})]}),x.jsxs("form",{onSubmit:f,className:"space-y-4",children:[x.jsxs("div",{children:[x.jsx("label",{className:"text-muted mb-1.5 block text-xs uppercase tracking-wider",children:"Passphrase"}),x.jsx("input",{type:"password",value:t,onChange:p=>n(p.target.value),placeholder:"enter your passphrase",autoFocus:!0,className:"bg-surface border-border text-foreground placeholder:text-muted/50 w-full rounded border px-3 py-2 text-sm outline-none focus:border-accent"})]}),s&&x.jsx("p",{className:"text-error text-xs",children:s}),x.jsx("button",{type:"submit",disabled:o||!t.trim(),className:"border-accent text-accent hover:bg-accent/10 disabled:opacity-40 w-full rounded border px-4 py-2 text-sm font-medium transition-colors",children:o?"authenticating...":"unlock"})]})]}),x.jsx("p",{className:"text-muted mt-4 text-center text-[10px]",children:"enter your passphrase to unlock"})]})})}function Ax({onSetup:e}){const[t,n]=ae.useState(""),[s,a]=ae.useState(""),[o,c]=ae.useState(null),[f,p]=ae.useState(!1),h=async g=>{if(g.preventDefault(),!t.trim()||t.length<4){c("Passphrase must be at least 4 characters");return}if(t!==s){c("Passphrases do not match");return}p(!0),c(null);const _=await e(t);_&&c(_),p(!1)};return x.jsx("div",{className:"flex h-screen items-center justify-center p-4",children:x.jsx("div",{className:"w-full max-w-sm",children:x.jsxs("div",{className:"border-border rounded border p-6",children:[x.jsxs("div",{className:"mb-6 text-center",children:[x.jsx("h1",{className:"text-accent text-lg font-bold tracking-tight",children:"PlotLink OWS"}),x.jsx("p",{className:"text-muted mt-1 text-xs",children:"first-time setup"})]}),x.jsx("p",{className:"text-muted mb-4 text-xs leading-relaxed",children:"Choose a passphrase to protect your local writer agent. This will be used to unlock the app and secure your OWS wallet."}),x.jsxs("form",{onSubmit:h,className:"space-y-4",children:[x.jsxs("div",{children:[x.jsx("label",{className:"text-muted mb-1.5 block text-xs uppercase tracking-wider",children:"Passphrase"}),x.jsx("input",{type:"password",value:t,onChange:g=>n(g.target.value),placeholder:"choose a passphrase",autoFocus:!0,className:"bg-surface border-border text-foreground placeholder:text-muted/50 w-full rounded border px-3 py-2 text-sm outline-none focus:border-accent"})]}),x.jsxs("div",{children:[x.jsx("label",{className:"text-muted mb-1.5 block text-xs uppercase tracking-wider",children:"Confirm"}),x.jsx("input",{type:"password",value:s,onChange:g=>a(g.target.value),placeholder:"repeat passphrase",className:"bg-surface border-border text-foreground placeholder:text-muted/50 w-full rounded border px-3 py-2 text-sm outline-none focus:border-accent"})]}),o&&x.jsx("p",{className:"text-error text-xs",children:o}),x.jsx("button",{type:"submit",disabled:f||!t.trim()||!s.trim(),className:"border-accent text-accent hover:bg-accent/10 disabled:opacity-40 w-full rounded border px-4 py-2 text-sm font-medium transition-colors",children:f?"setting up...":"create passphrase"})]})]})})})}const iv="http://localhost:7777";function Gy({token:e}){const[t,n]=ae.useState(null),[s,a]=ae.useState(!1),[o,c]=ae.useState(!1),[f,p]=ae.useState(null),h=(b,k)=>fetch(b,{...k,headers:{...k==null?void 0:k.headers,Authorization:`Bearer ${e}`,"Content-Type":"application/json"}}),g=()=>{h(`${iv}/api/wallet`).then(b=>b.json()).then(b=>n(b)).catch(()=>n({exists:!1,error:"Failed to load wallet"}))};ae.useEffect(()=>{g()},[]);const _=async()=>{a(!0),p(null);try{const b=await h(`${iv}/api/wallet/create`,{method:"POST"}),k=await b.json();if(!b.ok)throw new Error(k.error||"Creation failed");g()}catch(b){p(b instanceof Error?b.message:"Failed to create wallet")}a(!1)},S=()=>{t!=null&&t.address&&(navigator.clipboard.writeText(t.address),c(!0),setTimeout(()=>c(!1),2e3))},y=b=>`${b.slice(0,6)}...${b.slice(-4)}`;return x.jsxs("div",{className:"border-border rounded border p-4",children:[x.jsx("h3",{className:"text-accent mb-3 text-xs font-bold uppercase tracking-wider",children:"OWS Wallet"}),!t&&x.jsx("p",{className:"text-muted text-xs",children:"loading..."}),t&&!t.exists&&x.jsxs("div",{className:"space-y-3",children:[x.jsx("p",{className:"text-muted text-xs",children:"No wallet created yet. Create one to enable autonomous transactions."}),f&&x.jsx("p",{className:"text-error text-xs",children:f}),x.jsx("button",{onClick:_,disabled:s,className:"border-accent text-accent hover:bg-accent/10 disabled:opacity-40 rounded border px-4 py-2 text-xs font-medium transition-colors",children:s?"creating...":"create wallet"})]}),t&&t.exists&&t.address&&x.jsxs("div",{className:"space-y-3",children:[x.jsxs("div",{className:"flex items-center justify-between",children:[x.jsx("span",{className:"text-muted text-[10px] uppercase tracking-wider",children:"Address (Base)"}),x.jsx("span",{className:`rounded border px-1.5 py-0.5 text-[9px] ${t.ethBalance&&parseFloat(t.ethBalance)>0?"border-accent/30 text-accent":"border-accent-dim/30 text-accent-dim"}`,children:t.ethBalance&&parseFloat(t.ethBalance)>0?"active":"no balance"})]}),x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx("code",{className:"text-foreground bg-surface rounded px-2 py-1 text-xs font-mono",children:y(t.address)}),x.jsx("button",{onClick:S,className:"text-muted hover:text-accent text-xs transition-colors",children:o?"copied":"copy"})]}),x.jsxs("div",{className:"border-border space-y-1 border-t pt-3",children:[x.jsxs("div",{className:"flex justify-between text-xs",children:[x.jsx("span",{className:"text-muted",children:"ETH"}),x.jsxs("span",{className:"text-foreground font-medium",children:[t.ethBalance||"0.000000"," ETH"]})]}),x.jsxs("div",{className:"flex justify-between text-xs",children:[x.jsx("span",{className:"text-muted",children:"USDC"}),x.jsxs("span",{className:"text-foreground font-medium",children:["$",t.usdcBalance||"0.00"]})]}),x.jsxs("div",{className:"flex justify-between text-xs",children:[x.jsx("span",{className:"text-muted",children:"PLOT"}),x.jsxs("span",{className:"text-foreground font-medium",children:[t.plotBalance||"0.0000"," PLOT"]})]}),x.jsxs("div",{className:"flex justify-between text-xs",children:[x.jsx("span",{className:"text-muted",children:"Network"}),x.jsx("span",{className:"text-foreground",children:"Base"})]})]}),x.jsxs("div",{className:"border-border border-t pt-3",children:[x.jsx("p",{className:"text-muted mb-2 text-[10px] font-medium uppercase tracking-wider",children:"Fund Wallet"}),x.jsx("p",{className:"text-muted text-[10px]",children:"Send ETH on Base for gas (~$0.01 per publish):"}),x.jsx("code",{className:"text-foreground bg-surface mt-1 block break-all rounded px-2 py-1.5 text-[10px] font-mono",children:t.address})]})]})]})}function Dx({token:e,onLogout:t}){const[n,s]=ae.useState(""),[a,o]=ae.useState(""),[c,f]=ae.useState(null),[p,h]=ae.useState(!1),[g,_]=ae.useState(!1),[S,y]=ae.useState(null),[b,k]=ae.useState("AI Writer"),[R,T]=ae.useState(""),[$,j]=ae.useState(""),[O,X]=ae.useState(!1),[L,re]=ae.useState(null),[Z,le]=ae.useState(""),[z,te]=ae.useState(null),[U,F]=ae.useState(!1),[V,H]=ae.useState(null),[M,q]=ae.useState(null),W=ae.useCallback((C,se)=>fetch(C,{...se,headers:{...se==null?void 0:se.headers,Authorization:`Bearer ${e}`,"Content-Type":"application/json"}}),[e]);ae.useEffect(()=>{W("/api/settings/link-status").then(C=>C.json()).then(C=>y(C)).catch(()=>y({linked:!1}))},[]);const ue=async()=>{if(!b.trim()){re("Agent name is required");return}if(!R.trim()){re("Description is required");return}X(!0),re(null);try{const C=await W("/api/settings/register-agent",{method:"POST",body:JSON.stringify({name:b,description:R,...$.trim()&&{genre:$}})}),se=await C.json();if(!C.ok)throw new Error(se.error||"Registration failed");y({linked:!0,agentId:se.agentId,owsWallet:se.owsWallet})}catch(C){re(C instanceof Error?C.message:"Registration failed")}X(!1)},E=async()=>{if(!Z.trim()||!/^0x[a-fA-F0-9]{40}$/.test(Z)){H("Enter a valid wallet address (0x...)");return}F(!0),H(null),te(null);try{const C=await W("/api/settings/generate-binding",{method:"POST",body:JSON.stringify({humanWallet:Z})}),se=await C.json();if(!C.ok)throw new Error(se.error||"Failed to generate binding code");te(se)}catch(C){H(C instanceof Error?C.message:"Failed to generate binding code")}F(!1)},A=async(C,se)=>{await navigator.clipboard.writeText(C),q(se),setTimeout(()=>q(null),2e3)},K=async()=>{if(f(null),h(!1),!n||n.length<4){f("Passphrase must be at least 4 characters");return}if(n!==a){f("Passphrases do not match");return}_(!0);try{const C=await W("/api/auth/reset-passphrase",{method:"POST",body:JSON.stringify({passphrase:n})});if(!C.ok){const se=await C.json();throw new Error(se.error||"Reset failed")}h(!0),s(""),o(""),setTimeout(()=>h(!1),3e3)}catch(C){f(C instanceof Error?C.message:"Reset failed")}_(!1)};return x.jsxs("div",{className:"mx-auto max-w-lg space-y-6 p-6",children:[x.jsx("h2",{className:"text-accent text-lg font-bold",children:"Settings"}),x.jsxs("div",{className:"border-border rounded border p-4",children:[x.jsx("h3",{className:"text-accent mb-3 text-xs font-bold uppercase tracking-wider",children:"Agent Identity"}),S!=null&&S.linked?x.jsxs("div",{className:"space-y-2",children:[x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx("span",{className:"text-sm font-medium text-accent",children:"Registered"}),x.jsxs("span",{className:"text-muted text-xs",children:["Agent #",S.agentId]})]}),S.owsWallet&&x.jsxs("p",{className:"text-muted text-xs font-mono",children:["Wallet: ",S.owsWallet.slice(0,6),"...",S.owsWallet.slice(-4)]}),S.owner&&x.jsxs("p",{className:"text-muted text-xs font-mono",children:["Owner: ",S.owner.slice(0,6),"...",S.owner.slice(-4)]}),x.jsx("p",{className:"text-muted text-xs",children:x.jsx("a",{href:`https://plotlink.xyz/agents/${S.agentId}`,target:"_blank",rel:"noopener noreferrer",className:"text-accent underline",children:"View agent profile on plotlink.xyz"})})]}):x.jsxs("div",{className:"space-y-3",children:[x.jsx("p",{className:"text-muted text-xs",children:"Register this AI writer on-chain via ERC-8004. Uses your OWS wallet's existing ETH balance for gas."}),x.jsxs("div",{children:[x.jsx("label",{className:"text-muted text-xs block mb-1",children:"Name"}),x.jsx("input",{value:b,onChange:C=>k(C.target.value),placeholder:"AI Writer",className:"bg-surface border-border text-foreground placeholder:text-muted/50 w-full rounded border px-3 py-2 text-sm outline-none focus:border-accent"})]}),x.jsxs("div",{children:[x.jsx("label",{className:"text-muted text-xs block mb-1",children:"Description"}),x.jsx("input",{value:R,onChange:C=>T(C.target.value),placeholder:"An AI writing assistant for fiction stories",className:"bg-surface border-border text-foreground placeholder:text-muted/50 w-full rounded border px-3 py-2 text-sm outline-none focus:border-accent"})]}),x.jsxs("div",{children:[x.jsx("label",{className:"text-muted text-xs block mb-1",children:"Genre (optional)"}),x.jsx("input",{value:$,onChange:C=>j(C.target.value),placeholder:"e.g. Fiction, Sci-Fi, Fantasy",className:"bg-surface border-border text-foreground placeholder:text-muted/50 w-full rounded border px-3 py-2 text-sm outline-none focus:border-accent"})]}),L&&x.jsx("p",{className:"text-error text-xs",children:L}),x.jsx("button",{onClick:ue,disabled:O||!b.trim()||!R.trim(),className:"bg-accent text-white hover:bg-accent-dim disabled:opacity-50 w-full rounded px-4 py-2 text-sm font-medium transition-colors",children:O?"Registering...":"Register Agent Identity"})]})]}),x.jsxs("div",{className:"border-border rounded border p-4",children:[x.jsx("h3",{className:"text-accent mb-3 text-xs font-bold uppercase tracking-wider",children:"Link to PlotLink"}),S!=null&&S.owner?x.jsxs("p",{className:"text-muted text-xs",children:["Linked to owner ",x.jsxs("span",{className:"font-mono",children:[S.owner.slice(0,6),"...",S.owner.slice(-4)]})]}):x.jsxs("div",{className:"space-y-3",children:[x.jsx("p",{className:"text-muted text-xs",children:"Link this OWS wallet to your PlotLink account so your stories appear under your profile on plotlink.xyz."}),x.jsxs("div",{className:"text-muted text-xs space-y-1 pl-3",children:[x.jsx("p",{children:"1. Enter your PlotLink wallet address below"}),x.jsx("p",{children:'2. Click "Generate Binding Code"'}),x.jsx("p",{children:"3. Copy the code and paste it on plotlink.xyz → Agents → Link AI Writer"})]}),x.jsx("input",{value:Z,onChange:C=>le(C.target.value),placeholder:"Your PlotLink wallet address (0x...)",className:"bg-surface border-border text-foreground placeholder:text-muted/50 w-full rounded border px-3 py-2 text-sm outline-none focus:border-accent font-mono"}),V&&x.jsx("p",{className:"text-error text-xs",children:V}),x.jsx("button",{onClick:E,disabled:U||!Z.trim(),className:"bg-accent text-white hover:bg-accent-dim disabled:opacity-50 w-full rounded px-4 py-2 text-sm font-medium transition-colors",children:U?"Generating...":"Generate Binding Code"}),z&&x.jsxs("div",{className:"space-y-3 mt-3",children:[x.jsxs("div",{children:[x.jsx("label",{className:"text-muted text-xs block mb-1",children:"Binding Code (signature)"}),x.jsxs("div",{className:"relative",children:[x.jsx("div",{className:"bg-surface border-border rounded border p-2 text-xs font-mono break-all text-foreground pr-16",children:z.signature}),x.jsx("button",{onClick:()=>A(z.signature,"signature"),className:"absolute top-1 right-1 text-xs px-2 py-1 rounded border border-border text-muted hover:text-accent hover:border-accent transition-colors",children:M==="signature"?"Copied!":"Copy"})]})]}),x.jsxs("div",{children:[x.jsx("label",{className:"text-muted text-xs block mb-1",children:"OWS Wallet Address"}),x.jsxs("div",{className:"relative",children:[x.jsx("div",{className:"bg-surface border-border rounded border p-2 text-xs font-mono break-all text-foreground pr-16",children:z.owsWallet}),x.jsx("button",{onClick:()=>A(z.owsWallet,"wallet"),className:"absolute top-1 right-1 text-xs px-2 py-1 rounded border border-border text-muted hover:text-accent hover:border-accent transition-colors",children:M==="wallet"?"Copied!":"Copy"})]})]}),x.jsx("p",{className:"text-xs text-accent",children:'Now go to plotlink.xyz/agents and paste both values in the "Link AI Writer" section.'})]})]})]}),x.jsx(Gy,{token:e}),x.jsxs("div",{className:"border-border rounded border p-4",children:[x.jsx("h3",{className:"text-accent mb-3 text-xs font-bold uppercase tracking-wider",children:"Reset Passphrase"}),x.jsxs("div",{className:"space-y-3",children:[x.jsx("input",{type:"password",value:n,onChange:C=>s(C.target.value),placeholder:"new passphrase",className:"bg-surface border-border text-foreground placeholder:text-muted/50 w-full rounded border px-3 py-2 text-sm outline-none focus:border-accent"}),x.jsx("input",{type:"password",value:a,onChange:C=>o(C.target.value),placeholder:"confirm passphrase",className:"bg-surface border-border text-foreground placeholder:text-muted/50 w-full rounded border px-3 py-2 text-sm outline-none focus:border-accent"}),c&&x.jsx("p",{className:"text-error text-xs",children:c}),p&&x.jsx("p",{className:"text-xs text-accent",children:"passphrase updated"}),x.jsx("button",{onClick:K,disabled:g||!n.trim(),className:"border-border text-muted hover:border-accent hover:text-accent disabled:opacity-40 w-full rounded border px-4 py-2 text-xs font-medium transition-colors",children:g?"updating...":"update passphrase"})]})]}),x.jsxs("div",{className:"border-border rounded border p-4",children:[x.jsx("h3",{className:"text-accent mb-3 text-xs font-bold uppercase tracking-wider",children:"Session"}),x.jsx("button",{onClick:t,className:"border-border text-muted hover:border-error hover:text-error rounded border px-4 py-2 text-xs font-medium transition-colors",children:"logout"})]})]})}const Rx="http://localhost:7777";function Mx({token:e}){const[t,n]=ae.useState(null),s=(f,p)=>fetch(f,{...p,headers:{...p==null?void 0:p.headers,Authorization:`Bearer ${e}`,"Content-Type":"application/json"}}),a=()=>{s(`${Rx}/api/dashboard`).then(f=>f.json()).then(n)};ae.useEffect(()=>{a()},[]);const o=f=>`${f.slice(0,6)}...${f.slice(-4)}`,c=f=>{if(!f)return"Unknown date";const p=new Date(f);return isNaN(p.getTime())?"Unknown date":p.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})};return t?x.jsxs("div",{className:"mx-auto max-w-2xl space-y-6 p-6",children:[x.jsx("h2",{className:"text-accent text-lg font-bold",children:"Writer Dashboard"}),x.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[x.jsxs("div",{className:"border-border rounded border p-3 text-center",children:[x.jsx("div",{className:"text-accent text-lg font-bold",children:t.stories.totalPublished}),x.jsx("div",{className:"text-muted text-[10px] uppercase tracking-wider",children:"published"})]}),x.jsxs("div",{className:"border-border rounded border p-3 text-center",children:[x.jsx("div",{className:"text-foreground text-lg font-bold",children:t.stories.pendingFiles}),x.jsx("div",{className:"text-muted text-[10px] uppercase tracking-wider",children:"pending"})]}),x.jsxs("div",{className:"border-border rounded border p-3 text-center",children:[x.jsx("div",{className:"text-foreground text-lg font-bold",children:t.stories.totalStories}),x.jsx("div",{className:"text-muted text-[10px] uppercase tracking-wider",children:"stories"})]}),x.jsxs("div",{className:"border-border rounded border p-3 text-center",children:[x.jsx("div",{className:"text-foreground text-lg font-bold",children:t.stories.totalFiles}),x.jsx("div",{className:"text-muted text-[10px] uppercase tracking-wider",children:"files"})]})]}),t.wallet&&x.jsxs("div",{className:"border-border rounded border p-4",children:[x.jsx("h3",{className:"text-accent mb-3 text-xs font-bold uppercase tracking-wider",children:"Wallet"}),x.jsxs("div",{className:"space-y-1.5",children:[x.jsxs("div",{className:"flex justify-between text-xs",children:[x.jsx("span",{className:"text-muted",children:"Address"}),x.jsx("code",{className:"text-foreground font-mono text-[10px]",children:o(t.wallet.address)})]}),x.jsxs("div",{className:"flex justify-between text-xs",children:[x.jsx("span",{className:"text-muted",children:"ETH Balance"}),x.jsxs("span",{className:"text-foreground",children:[t.wallet.ethFormatted," ETH"]})]}),x.jsxs("div",{className:"flex justify-between text-xs",children:[x.jsx("span",{className:"text-muted",children:"USDC Balance"}),x.jsxs("span",{className:"text-foreground",children:["$",t.wallet.usdcBalance]})]})]})]}),x.jsxs("div",{className:"border-border rounded border p-4",children:[x.jsx("h3",{className:"text-accent mb-3 text-xs font-bold uppercase tracking-wider",children:"Profit & Loss"}),x.jsxs("div",{className:"space-y-1.5",children:[x.jsxs("div",{className:"flex justify-between text-xs",children:[x.jsx("span",{className:"text-muted",children:"Total costs (gas)"}),x.jsxs("span",{className:"text-error",children:["-",t.pnl.totalCostsEth," ETH (~$",t.pnl.totalCostsUsd,")"]})]}),x.jsxs("div",{className:"flex justify-between text-xs",children:[x.jsx("span",{className:"text-muted",children:"Royalties earned"}),x.jsxs("span",{className:"text-accent",children:["+",t.pnl.totalRoyaltiesPlot," PLOT"]})]}),x.jsxs("div",{className:"flex justify-between text-xs",children:[x.jsx("span",{className:"text-muted",children:"Unclaimed royalties"}),x.jsxs("span",{className:"text-foreground",children:[t.royalties.unclaimed," PLOT"]})]}),x.jsxs("div",{className:"border-border flex justify-between border-t pt-1.5 text-xs font-medium",children:[x.jsx("span",{className:"text-muted",children:"Net P&L (USD)"}),x.jsxs("span",{className:parseFloat(t.pnl.netPnlUsd)>=0?"text-accent":"text-error",children:[parseFloat(t.pnl.netPnlUsd)>=0?"+":"","$",t.pnl.netPnlUsd]})]}),x.jsxs("div",{className:"flex justify-between text-xs",children:[x.jsx("span",{className:"text-muted",children:"Stories published"}),x.jsx("span",{className:"text-foreground",children:t.costs.storiesPublished})]})]})]}),x.jsxs("div",{className:"border-border rounded border p-4",children:[x.jsx("h3",{className:"text-accent mb-3 text-xs font-bold uppercase tracking-wider",children:"Published Stories"}),t.stories.published.length===0?x.jsx("p",{className:"text-muted text-xs",children:"no published stories yet"}):x.jsx("div",{className:"space-y-3",children:t.stories.published.map(f=>x.jsxs("div",{className:"bg-surface rounded border border-border p-4",children:[x.jsxs("div",{className:"flex items-start justify-between",children:[x.jsxs("div",{children:[f.genre&&x.jsx("span",{className:"bg-accent/10 text-accent rounded px-2 py-0.5 text-[10px] font-medium",children:f.genre}),x.jsx("h4",{className:"text-foreground mt-1 text-sm font-serif font-medium",children:f.title}),x.jsx("p",{className:"text-muted mt-0.5 text-[10px] font-mono",children:f.storyName})]}),x.jsxs("div",{className:"flex items-center gap-2",children:[f.hasNotIndexed&&x.jsx("span",{className:"rounded border border-amber-600/30 px-1.5 py-0.5 text-[9px] text-amber-700",children:"not indexed"}),x.jsxs("span",{className:"rounded border border-green-700/30 px-1.5 py-0.5 text-[9px] text-green-700",children:[f.publishedFiles," published"]})]})]}),x.jsxs("div",{className:"mt-2 grid grid-cols-3 gap-2 text-center",children:[x.jsxs("div",{className:"rounded bg-background p-1.5",children:[x.jsx("div",{className:"text-foreground text-sm font-medium",children:f.plotCount}),x.jsx("div",{className:"text-muted text-[9px]",children:"Plots"})]}),x.jsxs("div",{className:"rounded bg-background p-1.5",children:[x.jsx("div",{className:"text-foreground text-sm font-medium font-mono",children:f.storylineId?`#${f.storylineId}`:"—"}),x.jsx("div",{className:"text-muted text-[9px]",children:"Storyline"})]}),x.jsxs("div",{className:"rounded bg-background p-1.5",children:[x.jsx("div",{className:"text-foreground text-sm font-medium",children:f.totalGasCostEth??"—"}),x.jsx("div",{className:"text-muted text-[9px]",children:"Gas (ETH)"})]})]}),x.jsx("div",{className:"mt-2 space-y-1",children:f.files.map(p=>x.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[x.jsxs("div",{className:"flex items-center gap-1.5",children:[x.jsx("span",{className:p.status==="published-not-indexed"?"text-amber-700":"text-green-700",children:p.status==="published-not-indexed"?"⚠":"✓"}),x.jsx("span",{className:"text-muted font-mono",children:p.file})]}),p.txHash&&x.jsxs("a",{href:`https://basescan.org/tx/${p.txHash}`,target:"_blank",rel:"noopener noreferrer",className:"text-muted hover:text-accent font-mono",children:["tx:",p.txHash.slice(0,8),"..."]})]},p.file))}),x.jsxs("div",{className:"mt-2 flex items-center justify-between text-[10px]",children:[x.jsx("span",{className:"text-muted",children:c(f.latestPublishedAt)}),f.storylineId&&x.jsx("a",{href:`https://plotlink.xyz/story/${f.storylineId}`,target:"_blank",rel:"noopener noreferrer",className:"text-accent underline",children:"View on PlotLink"})]})]},f.id))})]}),t.stories.pendingFiles>0&&x.jsx("div",{className:"border-border rounded border p-4",children:x.jsxs("p",{className:"text-muted text-xs",children:[t.stories.pendingFiles," file(s) pending publish — go to Stories to publish them."]})})]}):x.jsx("div",{className:"flex h-full items-center justify-center",children:x.jsx("span",{className:"text-muted text-sm",children:"loading dashboard..."})})}const Bx={published:"✓","published-not-indexed":"⚠",pending:"⏳",draft:"📝"},Lx={published:"text-green-700","published-not-indexed":"text-amber-700",pending:"text-amber-700",draft:"text-muted"};function zx({authFetch:e,selectedStory:t,selectedFile:n,onSelectFile:s,onNewStory:a,untitledSessions:o=[]}){const[c,f]=ae.useState([]),[p,h]=ae.useState(new Set),g=ae.useCallback(async()=>{try{const k=await e("/api/stories");if(k.ok){const R=await k.json();f(R.stories)}}catch{}},[e]);ae.useEffect(()=>{g();const k=setInterval(g,5e3);return()=>clearInterval(k)},[g]),ae.useEffect(()=>{t&&h(k=>new Set(k).add(t))},[t]);const _=k=>{var T;const R=k.map($=>{var j;return{file:$.file,num:(j=$.file.match(/^plot-(\d+)\.md$/))==null?void 0:j[1]}}).filter($=>$.num!=null).sort(($,j)=>parseInt(j.num)-parseInt($.num));return R.length>0?R[0].file:k.some($=>$.file==="genesis.md")?"genesis.md":k.some($=>$.file==="structure.md")?"structure.md":((T=k[0])==null?void 0:T.file)??null},S=k=>{h(R=>{const T=new Set(R);return T.has(k)?T.delete(k):T.add(k),T})},y=k=>{if(S(k.name),!p.has(k.name)){const R=_(k.files);R&&s(k.name,R)}},b=k=>{const R=T=>{if(T==="structure.md")return 0;if(T==="genesis.md")return 1;const $=T.match(/^plot-(\d+)\.md$/);return $?2+parseInt($[1]):100};return[...k].sort((T,$)=>R(T.file)-R($.file))};return x.jsxs("div",{className:"h-full flex flex-col",children:[x.jsxs("div",{className:"px-3 py-1.5 border-b border-border flex items-center justify-between",children:[x.jsx("span",{className:"text-xs font-mono text-muted",children:"Stories"}),x.jsx("span",{className:"text-xs text-muted",children:c.length})]}),x.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[o.map(k=>x.jsx("div",{children:x.jsxs("button",{onClick:()=>s(k,""),className:`w-full px-3 py-2 text-left flex items-center gap-2 hover:bg-surface text-sm ${t===k?"bg-surface":""}`,children:[x.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-600 flex-shrink-0"}),x.jsx("span",{className:"font-medium italic text-muted",children:"Untitled"})]})},k)),c.length===0&&o.length===0?x.jsxs("div",{className:"p-3 text-sm text-muted",children:[x.jsx("p",{children:"No stories yet."}),x.jsx("p",{className:"mt-1 text-xs",children:'Click "+ New Story" below to start writing.'})]}):c.filter(k=>k.name!=="_example").map(k=>x.jsxs("div",{children:[x.jsxs("button",{onClick:()=>y(k),className:"w-full px-3 py-2 text-left flex items-center gap-2 hover:bg-surface text-sm",children:[x.jsx("span",{className:"text-xs text-muted",children:p.has(k.name)?"▼":"▶"}),x.jsx("span",{className:"font-medium truncate",title:k.name,children:k.title||k.name}),x.jsxs("span",{className:"ml-auto text-xs text-muted",children:[k.publishedCount,"/",k.files.length]})]}),p.has(k.name)&&x.jsx("div",{className:"pl-4",children:b(k.files).map(R=>{const T=t===k.name&&n===R.file;return x.jsxs("button",{onClick:()=>s(k.name,R.file),className:`w-full px-3 py-1.5 text-left flex items-center gap-2 text-xs hover:bg-surface ${T?"bg-surface font-medium":""}`,children:[x.jsx("span",{className:Lx[R.status],children:Bx[R.status]}),x.jsx("span",{className:"truncate font-mono",children:R.file})]},R.file)})})]},k.name))]}),a&&x.jsx("div",{className:"px-3 py-2 border-t border-border",children:x.jsxs("button",{onClick:a,className:"w-full px-3 py-1.5 text-sm text-accent hover:bg-surface rounded flex items-center gap-1.5",children:[x.jsx("span",{children:"+"}),x.jsx("span",{children:"New Story"})]})})]})}/**
50
50
  * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
51
51
  * @license MIT
52
52
  *
@@ -57,21 +57,21 @@ Error generating stack: `+u.message+`
57
57
  * Fabrice Bellard's javascript vt100 for jslinux:
58
58
  * http://bellard.org/jslinux/
59
59
  * Copyright (c) 2011 Fabrice Bellard
60
- */var Zy=Object.defineProperty,Nx=Object.getOwnPropertyDescriptor,Ox=(e,t)=>{for(var n in t)Zy(e,n,{get:t[n],enumerable:!0})},ht=(e,t,n,s)=>{for(var a=s>1?void 0:s?Nx(t,n):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(a=(s?c(t,n,a):c(a))||a);return s&&a&&Zy(t,n,a),a},fe=(e,t)=>(n,s)=>t(n,s,e),nv="Terminal input",Tf={get:()=>nv,set:e=>nv=e},rv="Too much output to announce, navigate to rows manually to read",Af={get:()=>rv,set:e=>rv=e};function Hx(e){return e.replace(/\r?\n/g,"\r")}function jx(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function Ux(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function Px(e,t,n,s){if(e.stopPropagation(),e.clipboardData){let a=e.clipboardData.getData("text/plain");Qy(a,t,n,s)}}function Qy(e,t,n,s){e=Hx(e),e=jx(e,n.decPrivateModes.bracketedPasteMode&&s.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=""}function Jy(e,t,n){let s=n.getBoundingClientRect(),a=e.clientX-s.left-10,o=e.clientY-s.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${a}px`,t.style.top=`${o}px`,t.style.zIndex="1000",t.focus()}function sv(e,t,n,s,a){Jy(e,t,n),a&&s.rightClickSelect(e),t.value=s.selectionText,t.select()}function dr(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function vu(e,t=0,n=e.length){let s="";for(let a=t;a<n;++a){let o=e[a];o>65535?(o-=65536,s+=String.fromCharCode((o>>10)+55296)+String.fromCharCode(o%1024+56320)):s+=String.fromCharCode(o)}return s}var Ix=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let s=0,a=0;if(this._interim){let o=e.charCodeAt(a++);56320<=o&&o<=57343?t[s++]=(this._interim-55296)*1024+o-56320+65536:(t[s++]=this._interim,t[s++]=o),this._interim=0}for(let o=a;o<n;++o){let c=e.charCodeAt(o);if(55296<=c&&c<=56319){if(++o>=n)return this._interim=c,s;let f=e.charCodeAt(o);56320<=f&&f<=57343?t[s++]=(c-55296)*1024+f-56320+65536:(t[s++]=c,t[s++]=f);continue}c!==65279&&(t[s++]=c)}return s}},Fx=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let s=0,a,o,c,f,p=0,h=0;if(this.interim[0]){let S=!1,v=this.interim[0];v&=(v&224)===192?31:(v&240)===224?15:7;let b=0,k;for(;(k=this.interim[++b]&63)&&b<4;)v<<=6,v|=k;let B=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,D=B-b;for(;h<D;){if(h>=n)return 0;if(k=e[h++],(k&192)!==128){h--,S=!0;break}else this.interim[b++]=k,v<<=6,v|=k&63}S||(B===2?v<128?h--:t[s++]=v:B===3?v<2048||v>=55296&&v<=57343||v===65279||(t[s++]=v):v<65536||v>1114111||(t[s++]=v)),this.interim.fill(0)}let g=n-4,m=h;for(;m<n;){for(;m<g&&!((a=e[m])&128)&&!((o=e[m+1])&128)&&!((c=e[m+2])&128)&&!((f=e[m+3])&128);)t[s++]=a,t[s++]=o,t[s++]=c,t[s++]=f,m+=4;if(a=e[m++],a<128)t[s++]=a;else if((a&224)===192){if(m>=n)return this.interim[0]=a,s;if(o=e[m++],(o&192)!==128){m--;continue}if(p=(a&31)<<6|o&63,p<128){m--;continue}t[s++]=p}else if((a&240)===224){if(m>=n)return this.interim[0]=a,s;if(o=e[m++],(o&192)!==128){m--;continue}if(m>=n)return this.interim[0]=a,this.interim[1]=o,s;if(c=e[m++],(c&192)!==128){m--;continue}if(p=(a&15)<<12|(o&63)<<6|c&63,p<2048||p>=55296&&p<=57343||p===65279)continue;t[s++]=p}else if((a&248)===240){if(m>=n)return this.interim[0]=a,s;if(o=e[m++],(o&192)!==128){m--;continue}if(m>=n)return this.interim[0]=a,this.interim[1]=o,s;if(c=e[m++],(c&192)!==128){m--;continue}if(m>=n)return this.interim[0]=a,this.interim[1]=o,this.interim[2]=c,s;if(f=e[m++],(f&192)!==128){m--;continue}if(p=(a&7)<<18|(o&63)<<12|(c&63)<<6|f&63,p<65536||p>1114111)continue;t[s++]=p}}return s}},eS="",_r=" ",ma=class tS{constructor(){this.fg=0,this.bg=0,this.extended=new ou}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 tS;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}},ou=class iS{constructor(t=0,n=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=n}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 iS(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Vi=class nS extends ma{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new ou,this.combinedData=""}static fromCharData(t){let n=new nS;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?dr(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 n=!1;if(t[1].length>2)n=!0;else if(t[1].length===2){let s=t[1].charCodeAt(0);if(55296<=s&&s<=56319){let a=t[1].charCodeAt(1);56320<=a&&a<=57343?this.content=(s-55296)*1024+a-56320+65536|t[2]<<22:n=!0}else n=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;n&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},lv="di$target",Df="di$dependencies",Xh=new Map;function qx(e){return e[Df]||[]}function Ot(e){if(Xh.has(e))return Xh.get(e);let t=function(n,s,a){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Wx(t,n,a)};return t._id=e,Xh.set(e,t),t}function Wx(e,t,n){t[lv]===t?t[Df].push({id:e,index:n}):(t[Df]=[{id:e,index:n}],t[lv]=t)}var ri=Ot("BufferService"),rS=Ot("CoreMouseService"),Kr=Ot("CoreService"),Yx=Ot("CharsetService"),xd=Ot("InstantiationService"),sS=Ot("LogService"),si=Ot("OptionsService"),lS=Ot("OscLinkService"),Vx=Ot("UnicodeService"),ga=Ot("DecorationService"),Rf=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){var g;let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let s=[],a=this._optionsService.rawOptions.linkHandler,o=new Vi,c=n.getTrimmedLength(),f=-1,p=-1,h=!1;for(let m=0;m<c;m++)if(!(p===-1&&!n.hasContent(m))){if(n.loadCell(m,o),o.hasExtendedAttrs()&&o.extended.urlId)if(p===-1){p=m,f=o.extended.urlId;continue}else h=o.extended.urlId!==f;else p!==-1&&(h=!0);if(h||p!==-1&&m===c-1){let S=(g=this._oscLinkService.getLinkData(f))==null?void 0:g.uri;if(S){let v={start:{x:p+1,y:e},end:{x:m+(!h&&m===c-1?1:0),y:e}},b=!1;if(!(a!=null&&a.allowNonHttpProtocols))try{let k=new URL(S);["http:","https:"].includes(k.protocol)||(b=!0)}catch{b=!0}b||s.push({text:S,range:v,activate:(k,B)=>a?a.activate(k,B,v):Kx(k,B),hover:(k,B)=>{var D;return(D=a==null?void 0:a.hover)==null?void 0:D.call(a,k,B,v)},leave:(k,B)=>{var D;return(D=a==null?void 0:a.leave)==null?void 0:D.call(a,k,B,v)}})}h=!1,o.hasExtendedAttrs()&&o.extended.urlId?(p=m,f=o.extended.urlId):(p=-1,f=-1)}}t(s)}};Rf=ht([fe(0,ri),fe(1,si),fe(2,lS)],Rf);function Kx(e,t){if(confirm(`Do you want to navigate to ${t}?
60
+ */var Zy=Object.defineProperty,Nx=Object.getOwnPropertyDescriptor,Ox=(e,t)=>{for(var n in t)Zy(e,n,{get:t[n],enumerable:!0})},ht=(e,t,n,s)=>{for(var a=s>1?void 0:s?Nx(t,n):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(a=(s?c(t,n,a):c(a))||a);return s&&a&&Zy(t,n,a),a},de=(e,t)=>(n,s)=>t(n,s,e),nv="Terminal input",Tf={get:()=>nv,set:e=>nv=e},rv="Too much output to announce, navigate to rows manually to read",Af={get:()=>rv,set:e=>rv=e};function Hx(e){return e.replace(/\r?\n/g,"\r")}function jx(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function Ux(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function Px(e,t,n,s){if(e.stopPropagation(),e.clipboardData){let a=e.clipboardData.getData("text/plain");Qy(a,t,n,s)}}function Qy(e,t,n,s){e=Hx(e),e=jx(e,n.decPrivateModes.bracketedPasteMode&&s.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=""}function Jy(e,t,n){let s=n.getBoundingClientRect(),a=e.clientX-s.left-10,o=e.clientY-s.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${a}px`,t.style.top=`${o}px`,t.style.zIndex="1000",t.focus()}function sv(e,t,n,s,a){Jy(e,t,n),a&&s.rightClickSelect(e),t.value=s.selectionText,t.select()}function dr(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function vu(e,t=0,n=e.length){let s="";for(let a=t;a<n;++a){let o=e[a];o>65535?(o-=65536,s+=String.fromCharCode((o>>10)+55296)+String.fromCharCode(o%1024+56320)):s+=String.fromCharCode(o)}return s}var Ix=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let s=0,a=0;if(this._interim){let o=e.charCodeAt(a++);56320<=o&&o<=57343?t[s++]=(this._interim-55296)*1024+o-56320+65536:(t[s++]=this._interim,t[s++]=o),this._interim=0}for(let o=a;o<n;++o){let c=e.charCodeAt(o);if(55296<=c&&c<=56319){if(++o>=n)return this._interim=c,s;let f=e.charCodeAt(o);56320<=f&&f<=57343?t[s++]=(c-55296)*1024+f-56320+65536:(t[s++]=c,t[s++]=f);continue}c!==65279&&(t[s++]=c)}return s}},Fx=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let s=0,a,o,c,f,p=0,h=0;if(this.interim[0]){let S=!1,y=this.interim[0];y&=(y&224)===192?31:(y&240)===224?15:7;let b=0,k;for(;(k=this.interim[++b]&63)&&b<4;)y<<=6,y|=k;let R=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,T=R-b;for(;h<T;){if(h>=n)return 0;if(k=e[h++],(k&192)!==128){h--,S=!0;break}else this.interim[b++]=k,y<<=6,y|=k&63}S||(R===2?y<128?h--:t[s++]=y:R===3?y<2048||y>=55296&&y<=57343||y===65279||(t[s++]=y):y<65536||y>1114111||(t[s++]=y)),this.interim.fill(0)}let g=n-4,_=h;for(;_<n;){for(;_<g&&!((a=e[_])&128)&&!((o=e[_+1])&128)&&!((c=e[_+2])&128)&&!((f=e[_+3])&128);)t[s++]=a,t[s++]=o,t[s++]=c,t[s++]=f,_+=4;if(a=e[_++],a<128)t[s++]=a;else if((a&224)===192){if(_>=n)return this.interim[0]=a,s;if(o=e[_++],(o&192)!==128){_--;continue}if(p=(a&31)<<6|o&63,p<128){_--;continue}t[s++]=p}else if((a&240)===224){if(_>=n)return this.interim[0]=a,s;if(o=e[_++],(o&192)!==128){_--;continue}if(_>=n)return this.interim[0]=a,this.interim[1]=o,s;if(c=e[_++],(c&192)!==128){_--;continue}if(p=(a&15)<<12|(o&63)<<6|c&63,p<2048||p>=55296&&p<=57343||p===65279)continue;t[s++]=p}else if((a&248)===240){if(_>=n)return this.interim[0]=a,s;if(o=e[_++],(o&192)!==128){_--;continue}if(_>=n)return this.interim[0]=a,this.interim[1]=o,s;if(c=e[_++],(c&192)!==128){_--;continue}if(_>=n)return this.interim[0]=a,this.interim[1]=o,this.interim[2]=c,s;if(f=e[_++],(f&192)!==128){_--;continue}if(p=(a&7)<<18|(o&63)<<12|(c&63)<<6|f&63,p<65536||p>1114111)continue;t[s++]=p}}return s}},eS="",mr=" ",_a=class tS{constructor(){this.fg=0,this.bg=0,this.extended=new ou}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 tS;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}},ou=class iS{constructor(t=0,n=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=n}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 iS(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Vi=class nS extends _a{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new ou,this.combinedData=""}static fromCharData(t){let n=new nS;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?dr(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 n=!1;if(t[1].length>2)n=!0;else if(t[1].length===2){let s=t[1].charCodeAt(0);if(55296<=s&&s<=56319){let a=t[1].charCodeAt(1);56320<=a&&a<=57343?this.content=(s-55296)*1024+a-56320+65536|t[2]<<22:n=!0}else n=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;n&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},lv="di$target",Df="di$dependencies",Xh=new Map;function qx(e){return e[Df]||[]}function Ot(e){if(Xh.has(e))return Xh.get(e);let t=function(n,s,a){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Wx(t,n,a)};return t._id=e,Xh.set(e,t),t}function Wx(e,t,n){t[lv]===t?t[Df].push({id:e,index:n}):(t[Df]=[{id:e,index:n}],t[lv]=t)}var ri=Ot("BufferService"),rS=Ot("CoreMouseService"),Kr=Ot("CoreService"),Yx=Ot("CharsetService"),xd=Ot("InstantiationService"),sS=Ot("LogService"),si=Ot("OptionsService"),lS=Ot("OscLinkService"),Vx=Ot("UnicodeService"),ga=Ot("DecorationService"),Rf=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){var g;let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let s=[],a=this._optionsService.rawOptions.linkHandler,o=new Vi,c=n.getTrimmedLength(),f=-1,p=-1,h=!1;for(let _=0;_<c;_++)if(!(p===-1&&!n.hasContent(_))){if(n.loadCell(_,o),o.hasExtendedAttrs()&&o.extended.urlId)if(p===-1){p=_,f=o.extended.urlId;continue}else h=o.extended.urlId!==f;else p!==-1&&(h=!0);if(h||p!==-1&&_===c-1){let S=(g=this._oscLinkService.getLinkData(f))==null?void 0:g.uri;if(S){let y={start:{x:p+1,y:e},end:{x:_+(!h&&_===c-1?1:0),y:e}},b=!1;if(!(a!=null&&a.allowNonHttpProtocols))try{let k=new URL(S);["http:","https:"].includes(k.protocol)||(b=!0)}catch{b=!0}b||s.push({text:S,range:y,activate:(k,R)=>a?a.activate(k,R,y):Kx(k,R),hover:(k,R)=>{var T;return(T=a==null?void 0:a.hover)==null?void 0:T.call(a,k,R,y)},leave:(k,R)=>{var T;return(T=a==null?void 0:a.leave)==null?void 0:T.call(a,k,R,y)}})}h=!1,o.hasExtendedAttrs()&&o.extended.urlId?(p=_,f=o.extended.urlId):(p=-1,f=-1)}}t(s)}};Rf=ht([de(0,ri),de(1,si),de(2,lS)],Rf);function Kx(e,t){if(confirm(`Do you want to navigate to ${t}?
61
61
 
62
62
  WARNING: This link could potentially be dangerous`)){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var yu=Ot("CharSizeService"),Nn=Ot("CoreBrowserService"),wd=Ot("MouseService"),On=Ot("RenderService"),Xx=Ot("SelectionService"),aS=Ot("CharacterJoinerService"),Ks=Ot("ThemeService"),oS=Ot("LinkProviderService"),$x=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?av.isErrorNoTelemetry(e)?new av(e.message+`
63
63
 
64
64
  `+e.stack):new Error(e.message+`
65
65
 
66
- `+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)}},Gx=new $x;function eu(e){Zx(e)||Gx.onUnexpectedError(e)}var Mf="Canceled";function Zx(e){return e instanceof Qx?!0:e instanceof Error&&e.name===Mf&&e.message===Mf}var Qx=class extends Error{constructor(){super(Mf),this.name=this.message}};function Jx(e){return new Error(`Illegal argument: ${e}`)}var av=class Bf extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Bf)return t;let n=new Bf;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Lf=class uS extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,uS.prototype)}};function Ti(e,t=0){return e[e.length-(1+t)]}var ew;(e=>{function t(o){return o<0}e.isLessThan=t;function n(o){return o<=0}e.isLessThanOrEqual=n;function s(o){return o>0}e.isGreaterThan=s;function a(o){return o===0}e.isNeitherLessOrGreaterThan=a,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(ew||(ew={}));function tw(e,t){let n=this,s=!1,a;return function(){return s||(s=!0,t||(a=e.apply(n,arguments))),a}}var cS;(e=>{function t(N){return N&&typeof N=="object"&&typeof N[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function s(){return n}e.empty=s;function*a(N){yield N}e.single=a;function o(N){return t(N)?N:a(N)}e.wrap=o;function c(N){return N||n}e.from=c;function*f(N){for(let $=N.length-1;$>=0;$--)yield N[$]}e.reverse=f;function p(N){return!N||N[Symbol.iterator]().next().done===!0}e.isEmpty=p;function h(N){return N[Symbol.iterator]().next().value}e.first=h;function g(N,$){let z=0;for(let Q of N)if($(Q,z++))return!0;return!1}e.some=g;function m(N,$){for(let z of N)if($(z))return z}e.find=m;function*S(N,$){for(let z of N)$(z)&&(yield z)}e.filter=S;function*v(N,$){let z=0;for(let Q of N)yield $(Q,z++)}e.map=v;function*b(N,$){let z=0;for(let Q of N)yield*$(Q,z++)}e.flatMap=b;function*k(...N){for(let $ of N)yield*$}e.concat=k;function B(N,$,z){let Q=z;for(let se of N)Q=$(Q,se);return Q}e.reduce=B;function*D(N,$,z=N.length){for($<0&&($+=N.length),z<0?z+=N.length:z>N.length&&(z=N.length);$<z;$++)yield N[$]}e.slice=D;function G(N,$=Number.POSITIVE_INFINITY){let z=[];if($===0)return[z,N];let Q=N[Symbol.iterator]();for(let se=0;se<$;se++){let he=Q.next();if(he.done)return[z,e.empty()];z.push(he.value)}return[z,{[Symbol.iterator](){return Q}}]}e.consume=G;async function A(N){let $=[];for await(let z of N)$.push(z);return Promise.resolve($)}e.asyncToArray=A})(cS||(cS={}));function Wr(e){if(cS.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(s){t.push(s)}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 iw(...e){return rt(()=>Wr(e))}function rt(e){return{dispose:tw(()=>{e()})}}var hS=class fS{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{Wr(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?fS.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)}};hS.DISABLE_DISPOSED_WARNING=!1;var mr=hS,Ae=class{constructor(){this._store=new mr,this._store}dispose(){this._store.dispose()}_register(t){if(t===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(t)}};Ae.None=Object.freeze({dispose(){}});var Ws=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}},zn=typeof window=="object"?window:globalThis,zf=class Nf{constructor(t){this.element=t,this.next=Nf.Undefined,this.prev=Nf.Undefined}};zf.Undefined=new zf(void 0);var st=zf,ov=class{constructor(){this._first=st.Undefined,this._last=st.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===st.Undefined}clear(){let e=this._first;for(;e!==st.Undefined;){let t=e.next;e.prev=st.Undefined,e.next=st.Undefined,e=t}this._first=st.Undefined,this._last=st.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new st(e);if(this._first===st.Undefined)this._first=n,this._last=n;else if(t){let a=this._last;this._last=n,n.prev=a,a.next=n}else{let a=this._first;this._first=n,n.next=a,a.prev=n}this._size+=1;let s=!1;return()=>{s||(s=!0,this._remove(n))}}shift(){if(this._first!==st.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==st.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==st.Undefined&&e.next!==st.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===st.Undefined&&e.next===st.Undefined?(this._first=st.Undefined,this._last=st.Undefined):e.next===st.Undefined?(this._last=this._last.prev,this._last.next=st.Undefined):e.prev===st.Undefined&&(this._first=this._first.next,this._first.prev=st.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==st.Undefined;)yield e.element,e=e.next}},nw=globalThis.performance&&typeof globalThis.performance.now=="function",rw=class dS{static create(t){return new dS(t)}constructor(t){this._now=nw&&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}},Yt;(e=>{e.None=()=>Ae.None;function t(Y,U){return m(Y,()=>{},0,void 0,!0,void 0,U)}e.defer=t;function n(Y){return(U,K=null,H)=>{let M=!1,F;return F=Y(V=>{if(!M)return F?F.dispose():M=!0,U.call(K,V)},null,H),M&&F.dispose(),F}}e.once=n;function s(Y,U,K){return h((H,M=null,F)=>Y(V=>H.call(M,U(V)),null,F),K)}e.map=s;function a(Y,U,K){return h((H,M=null,F)=>Y(V=>{U(V),H.call(M,V)},null,F),K)}e.forEach=a;function o(Y,U,K){return h((H,M=null,F)=>Y(V=>U(V)&&H.call(M,V),null,F),K)}e.filter=o;function c(Y){return Y}e.signal=c;function f(...Y){return(U,K=null,H)=>{let M=iw(...Y.map(F=>F(V=>U.call(K,V))));return g(M,H)}}e.any=f;function p(Y,U,K,H){let M=K;return s(Y,F=>(M=U(M,F),M),H)}e.reduce=p;function h(Y,U){let K,H={onWillAddFirstListener(){K=Y(M.fire,M)},onDidRemoveLastListener(){K==null||K.dispose()}},M=new ue(H);return U==null||U.add(M),M.event}function g(Y,U){return U instanceof Array?U.push(Y):U&&U.add(Y),Y}function m(Y,U,K=100,H=!1,M=!1,F,V){let oe,E,T,q=0,C,ae={leakWarningThreshold:F,onWillAddFirstListener(){oe=Y(de=>{q++,E=U(E,de),H&&!T&&(_e.fire(E),E=void 0),C=()=>{let xe=E;E=void 0,T=void 0,(!H||q>1)&&_e.fire(xe),q=0},typeof K=="number"?(clearTimeout(T),T=setTimeout(C,K)):T===void 0&&(T=0,queueMicrotask(C))})},onWillRemoveListener(){M&&q>0&&(C==null||C())},onDidRemoveLastListener(){C=void 0,oe.dispose()}},_e=new ue(ae);return V==null||V.add(_e),_e.event}e.debounce=m;function S(Y,U=0,K){return e.debounce(Y,(H,M)=>H?(H.push(M),H):[M],U,void 0,!0,void 0,K)}e.accumulate=S;function v(Y,U=(H,M)=>H===M,K){let H=!0,M;return o(Y,F=>{let V=H||!U(F,M);return H=!1,M=F,V},K)}e.latch=v;function b(Y,U,K){return[e.filter(Y,U,K),e.filter(Y,H=>!U(H),K)]}e.split=b;function k(Y,U=!1,K=[],H){let M=K.slice(),F=Y(E=>{M?M.push(E):oe.fire(E)});H&&H.add(F);let V=()=>{M==null||M.forEach(E=>oe.fire(E)),M=null},oe=new ue({onWillAddFirstListener(){F||(F=Y(E=>oe.fire(E)),H&&H.add(F))},onDidAddFirstListener(){M&&(U?setTimeout(V):V())},onDidRemoveLastListener(){F&&F.dispose(),F=null}});return H&&H.add(oe),oe.event}e.buffer=k;function B(Y,U){return(K,H,M)=>{let F=U(new G);return Y(function(V){let oe=F.evaluate(V);oe!==D&&K.call(H,oe)},void 0,M)}}e.chain=B;let D=Symbol("HaltChainable");class G{constructor(){this.steps=[]}map(U){return this.steps.push(U),this}forEach(U){return this.steps.push(K=>(U(K),K)),this}filter(U){return this.steps.push(K=>U(K)?K:D),this}reduce(U,K){let H=K;return this.steps.push(M=>(H=U(H,M),H)),this}latch(U=(K,H)=>K===H){let K=!0,H;return this.steps.push(M=>{let F=K||!U(M,H);return K=!1,H=M,F?M:D}),this}evaluate(U){for(let K of this.steps)if(U=K(U),U===D)break;return U}}function A(Y,U,K=H=>H){let H=(...oe)=>V.fire(K(...oe)),M=()=>Y.on(U,H),F=()=>Y.removeListener(U,H),V=new ue({onWillAddFirstListener:M,onDidRemoveLastListener:F});return V.event}e.fromNodeEventEmitter=A;function N(Y,U,K=H=>H){let H=(...oe)=>V.fire(K(...oe)),M=()=>Y.addEventListener(U,H),F=()=>Y.removeEventListener(U,H),V=new ue({onWillAddFirstListener:M,onDidRemoveLastListener:F});return V.event}e.fromDOMEventEmitter=N;function $(Y){return new Promise(U=>n(Y)(U))}e.toPromise=$;function z(Y){let U=new ue;return Y.then(K=>{U.fire(K)},()=>{U.fire(void 0)}).finally(()=>{U.dispose()}),U.event}e.fromPromise=z;function Q(Y,U){return Y(K=>U.fire(K))}e.forward=Q;function se(Y,U,K){return U(K),Y(H=>U(H))}e.runAndSubscribe=se;class he{constructor(U,K){this._observable=U,this._counter=0,this._hasChanged=!1;let H={onWillAddFirstListener:()=>{U.addObserver(this)},onDidRemoveLastListener:()=>{U.removeObserver(this)}};this.emitter=new ue(H),K&&K.add(this.emitter)}beginUpdate(U){this._counter++}handlePossibleChange(U){}handleChange(U,K){this._hasChanged=!0}endUpdate(U){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function j(Y,U){return new he(Y,U).emitter.event}e.fromObservable=j;function ne(Y){return(U,K,H)=>{let M=0,F=!1,V={beginUpdate(){M++},endUpdate(){M--,M===0&&(Y.reportChanges(),F&&(F=!1,U.call(K)))},handlePossibleChange(){},handleChange(){F=!0}};Y.addObserver(V),Y.reportChanges();let oe={dispose(){Y.removeObserver(V)}};return H instanceof mr?H.add(oe):Array.isArray(H)&&H.push(oe),oe}}e.fromObservableLight=ne})(Yt||(Yt={}));var Of=class Hf{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Hf._idPool++}`,Hf.all.add(this)}start(t){this._stopWatch=new rw,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}}};Of.all=new Set,Of._idPool=0;var sw=Of,lw=-1,pS=class _S{constructor(t,n,s=(_S._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=n,this.name=s,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,n){let s=this.threshold;if(s<=0||n<s)return;this._stacks||(this._stacks=new Map);let a=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,a+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=s*.5;let[o,c]=this.getMostFrequentStack(),f=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${c}):`;console.warn(f),console.warn(o);let p=new uw(f,o);this._errorHandler(p)}return()=>{let o=this._stacks.get(t.value)||0;this._stacks.set(t.value,o-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,n=0;for(let[s,a]of this._stacks)(!t||n<a)&&(t=[s,a],n=a);return t}};pS._idPool=1;var aw=pS,ow=class mS{constructor(t){this.value=t}static create(){let t=new Error;return new mS(t.stack??"")}print(){console.warn(this.value.split(`
66
+ `+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)}},Gx=new $x;function eu(e){Zx(e)||Gx.onUnexpectedError(e)}var Mf="Canceled";function Zx(e){return e instanceof Qx?!0:e instanceof Error&&e.name===Mf&&e.message===Mf}var Qx=class extends Error{constructor(){super(Mf),this.name=this.message}};function Jx(e){return new Error(`Illegal argument: ${e}`)}var av=class Bf extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Bf)return t;let n=new Bf;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Lf=class uS extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,uS.prototype)}};function Ti(e,t=0){return e[e.length-(1+t)]}var ew;(e=>{function t(o){return o<0}e.isLessThan=t;function n(o){return o<=0}e.isLessThanOrEqual=n;function s(o){return o>0}e.isGreaterThan=s;function a(o){return o===0}e.isNeitherLessOrGreaterThan=a,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(ew||(ew={}));function tw(e,t){let n=this,s=!1,a;return function(){return s||(s=!0,t||(a=e.apply(n,arguments))),a}}var cS;(e=>{function t(O){return O&&typeof O=="object"&&typeof O[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function s(){return n}e.empty=s;function*a(O){yield O}e.single=a;function o(O){return t(O)?O:a(O)}e.wrap=o;function c(O){return O||n}e.from=c;function*f(O){for(let X=O.length-1;X>=0;X--)yield O[X]}e.reverse=f;function p(O){return!O||O[Symbol.iterator]().next().done===!0}e.isEmpty=p;function h(O){return O[Symbol.iterator]().next().value}e.first=h;function g(O,X){let L=0;for(let re of O)if(X(re,L++))return!0;return!1}e.some=g;function _(O,X){for(let L of O)if(X(L))return L}e.find=_;function*S(O,X){for(let L of O)X(L)&&(yield L)}e.filter=S;function*y(O,X){let L=0;for(let re of O)yield X(re,L++)}e.map=y;function*b(O,X){let L=0;for(let re of O)yield*X(re,L++)}e.flatMap=b;function*k(...O){for(let X of O)yield*X}e.concat=k;function R(O,X,L){let re=L;for(let Z of O)re=X(re,Z);return re}e.reduce=R;function*T(O,X,L=O.length){for(X<0&&(X+=O.length),L<0?L+=O.length:L>O.length&&(L=O.length);X<L;X++)yield O[X]}e.slice=T;function $(O,X=Number.POSITIVE_INFINITY){let L=[];if(X===0)return[L,O];let re=O[Symbol.iterator]();for(let Z=0;Z<X;Z++){let le=re.next();if(le.done)return[L,e.empty()];L.push(le.value)}return[L,{[Symbol.iterator](){return re}}]}e.consume=$;async function j(O){let X=[];for await(let L of O)X.push(L);return Promise.resolve(X)}e.asyncToArray=j})(cS||(cS={}));function Wr(e){if(cS.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(s){t.push(s)}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 iw(...e){return rt(()=>Wr(e))}function rt(e){return{dispose:tw(()=>{e()})}}var hS=class fS{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{Wr(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?fS.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)}};hS.DISABLE_DISPOSED_WARNING=!1;var _r=hS,Ae=class{constructor(){this._store=new _r,this._store}dispose(){this._store.dispose()}_register(t){if(t===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(t)}};Ae.None=Object.freeze({dispose(){}});var Ws=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}},zn=typeof window=="object"?window:globalThis,zf=class Nf{constructor(t){this.element=t,this.next=Nf.Undefined,this.prev=Nf.Undefined}};zf.Undefined=new zf(void 0);var st=zf,ov=class{constructor(){this._first=st.Undefined,this._last=st.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===st.Undefined}clear(){let e=this._first;for(;e!==st.Undefined;){let t=e.next;e.prev=st.Undefined,e.next=st.Undefined,e=t}this._first=st.Undefined,this._last=st.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new st(e);if(this._first===st.Undefined)this._first=n,this._last=n;else if(t){let a=this._last;this._last=n,n.prev=a,a.next=n}else{let a=this._first;this._first=n,n.next=a,a.prev=n}this._size+=1;let s=!1;return()=>{s||(s=!0,this._remove(n))}}shift(){if(this._first!==st.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==st.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==st.Undefined&&e.next!==st.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===st.Undefined&&e.next===st.Undefined?(this._first=st.Undefined,this._last=st.Undefined):e.next===st.Undefined?(this._last=this._last.prev,this._last.next=st.Undefined):e.prev===st.Undefined&&(this._first=this._first.next,this._first.prev=st.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==st.Undefined;)yield e.element,e=e.next}},nw=globalThis.performance&&typeof globalThis.performance.now=="function",rw=class dS{static create(t){return new dS(t)}constructor(t){this._now=nw&&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}},Yt;(e=>{e.None=()=>Ae.None;function t(U,F){return _(U,()=>{},0,void 0,!0,void 0,F)}e.defer=t;function n(U){return(F,V=null,H)=>{let M=!1,q;return q=U(W=>{if(!M)return q?q.dispose():M=!0,F.call(V,W)},null,H),M&&q.dispose(),q}}e.once=n;function s(U,F,V){return h((H,M=null,q)=>U(W=>H.call(M,F(W)),null,q),V)}e.map=s;function a(U,F,V){return h((H,M=null,q)=>U(W=>{F(W),H.call(M,W)},null,q),V)}e.forEach=a;function o(U,F,V){return h((H,M=null,q)=>U(W=>F(W)&&H.call(M,W),null,q),V)}e.filter=o;function c(U){return U}e.signal=c;function f(...U){return(F,V=null,H)=>{let M=iw(...U.map(q=>q(W=>F.call(V,W))));return g(M,H)}}e.any=f;function p(U,F,V,H){let M=V;return s(U,q=>(M=F(M,q),M),H)}e.reduce=p;function h(U,F){let V,H={onWillAddFirstListener(){V=U(M.fire,M)},onDidRemoveLastListener(){V==null||V.dispose()}},M=new ce(H);return F==null||F.add(M),M.event}function g(U,F){return F instanceof Array?F.push(U):F&&F.add(U),U}function _(U,F,V=100,H=!1,M=!1,q,W){let ue,E,A,K=0,C,se={leakWarningThreshold:q,onWillAddFirstListener(){ue=U(pe=>{K++,E=F(E,pe),H&&!A&&(fe.fire(E),E=void 0),C=()=>{let xe=E;E=void 0,A=void 0,(!H||K>1)&&fe.fire(xe),K=0},typeof V=="number"?(clearTimeout(A),A=setTimeout(C,V)):A===void 0&&(A=0,queueMicrotask(C))})},onWillRemoveListener(){M&&K>0&&(C==null||C())},onDidRemoveLastListener(){C=void 0,ue.dispose()}},fe=new ce(se);return W==null||W.add(fe),fe.event}e.debounce=_;function S(U,F=0,V){return e.debounce(U,(H,M)=>H?(H.push(M),H):[M],F,void 0,!0,void 0,V)}e.accumulate=S;function y(U,F=(H,M)=>H===M,V){let H=!0,M;return o(U,q=>{let W=H||!F(q,M);return H=!1,M=q,W},V)}e.latch=y;function b(U,F,V){return[e.filter(U,F,V),e.filter(U,H=>!F(H),V)]}e.split=b;function k(U,F=!1,V=[],H){let M=V.slice(),q=U(E=>{M?M.push(E):ue.fire(E)});H&&H.add(q);let W=()=>{M==null||M.forEach(E=>ue.fire(E)),M=null},ue=new ce({onWillAddFirstListener(){q||(q=U(E=>ue.fire(E)),H&&H.add(q))},onDidAddFirstListener(){M&&(F?setTimeout(W):W())},onDidRemoveLastListener(){q&&q.dispose(),q=null}});return H&&H.add(ue),ue.event}e.buffer=k;function R(U,F){return(V,H,M)=>{let q=F(new $);return U(function(W){let ue=q.evaluate(W);ue!==T&&V.call(H,ue)},void 0,M)}}e.chain=R;let T=Symbol("HaltChainable");class ${constructor(){this.steps=[]}map(F){return this.steps.push(F),this}forEach(F){return this.steps.push(V=>(F(V),V)),this}filter(F){return this.steps.push(V=>F(V)?V:T),this}reduce(F,V){let H=V;return this.steps.push(M=>(H=F(H,M),H)),this}latch(F=(V,H)=>V===H){let V=!0,H;return this.steps.push(M=>{let q=V||!F(M,H);return V=!1,H=M,q?M:T}),this}evaluate(F){for(let V of this.steps)if(F=V(F),F===T)break;return F}}function j(U,F,V=H=>H){let H=(...ue)=>W.fire(V(...ue)),M=()=>U.on(F,H),q=()=>U.removeListener(F,H),W=new ce({onWillAddFirstListener:M,onDidRemoveLastListener:q});return W.event}e.fromNodeEventEmitter=j;function O(U,F,V=H=>H){let H=(...ue)=>W.fire(V(...ue)),M=()=>U.addEventListener(F,H),q=()=>U.removeEventListener(F,H),W=new ce({onWillAddFirstListener:M,onDidRemoveLastListener:q});return W.event}e.fromDOMEventEmitter=O;function X(U){return new Promise(F=>n(U)(F))}e.toPromise=X;function L(U){let F=new ce;return U.then(V=>{F.fire(V)},()=>{F.fire(void 0)}).finally(()=>{F.dispose()}),F.event}e.fromPromise=L;function re(U,F){return U(V=>F.fire(V))}e.forward=re;function Z(U,F,V){return F(V),U(H=>F(H))}e.runAndSubscribe=Z;class le{constructor(F,V){this._observable=F,this._counter=0,this._hasChanged=!1;let H={onWillAddFirstListener:()=>{F.addObserver(this)},onDidRemoveLastListener:()=>{F.removeObserver(this)}};this.emitter=new ce(H),V&&V.add(this.emitter)}beginUpdate(F){this._counter++}handlePossibleChange(F){}handleChange(F,V){this._hasChanged=!0}endUpdate(F){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function z(U,F){return new le(U,F).emitter.event}e.fromObservable=z;function te(U){return(F,V,H)=>{let M=0,q=!1,W={beginUpdate(){M++},endUpdate(){M--,M===0&&(U.reportChanges(),q&&(q=!1,F.call(V)))},handlePossibleChange(){},handleChange(){q=!0}};U.addObserver(W),U.reportChanges();let ue={dispose(){U.removeObserver(W)}};return H instanceof _r?H.add(ue):Array.isArray(H)&&H.push(ue),ue}}e.fromObservableLight=te})(Yt||(Yt={}));var Of=class Hf{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Hf._idPool++}`,Hf.all.add(this)}start(t){this._stopWatch=new rw,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}}};Of.all=new Set,Of._idPool=0;var sw=Of,lw=-1,pS=class mS{constructor(t,n,s=(mS._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=n,this.name=s,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,n){let s=this.threshold;if(s<=0||n<s)return;this._stacks||(this._stacks=new Map);let a=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,a+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=s*.5;let[o,c]=this.getMostFrequentStack(),f=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${c}):`;console.warn(f),console.warn(o);let p=new uw(f,o);this._errorHandler(p)}return()=>{let o=this._stacks.get(t.value)||0;this._stacks.set(t.value,o-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,n=0;for(let[s,a]of this._stacks)(!t||n<a)&&(t=[s,a],n=a);return t}};pS._idPool=1;var aw=pS,ow=class _S{constructor(t){this.value=t}static create(){let t=new Error;return new _S(t.stack??"")}print(){console.warn(this.value.split(`
67
67
  `).slice(2).join(`
68
- `))}},uw=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},cw=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},hw=0,$h=class{constructor(e){this.value=e,this.id=hw++}},fw=2,dw,ue=class{constructor(t){var n,s,a,o;this._size=0,this._options=t,this._leakageMon=(n=this._options)!=null&&n.leakWarningThreshold?new aw((t==null?void 0:t.onListenerError)??eu,((s=this._options)==null?void 0:s.leakWarningThreshold)??lw):void 0,this._perfMon=(a=this._options)!=null&&a._profName?new sw(this._options._profName):void 0,this._deliveryQueue=(o=this._options)==null?void 0:o.deliveryQueue}dispose(){var t,n,s,a;this._disposed||(this._disposed=!0,((t=this._deliveryQueue)==null?void 0:t.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(s=(n=this._options)==null?void 0:n.onDidRemoveLastListener)==null||s.call(n),(a=this._leakageMon)==null||a.dispose())}get event(){return this._event??(this._event=(t,n,s)=>{var f,p,h,g,m;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let S=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(S);let v=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],b=new cw(`${S}. HINT: Stack shows most frequent listener (${v[1]}-times)`,v[0]);return(((f=this._options)==null?void 0:f.onListenerError)||eu)(b),Ae.None}if(this._disposed)return Ae.None;n&&(t=t.bind(n));let a=new $h(t),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(a.stack=ow.create(),o=this._leakageMon.check(a.stack,this._size+1)),this._listeners?this._listeners instanceof $h?(this._deliveryQueue??(this._deliveryQueue=new pw),this._listeners=[this._listeners,a]):this._listeners.push(a):((h=(p=this._options)==null?void 0:p.onWillAddFirstListener)==null||h.call(p,this),this._listeners=a,(m=(g=this._options)==null?void 0:g.onDidAddFirstListener)==null||m.call(g,this)),this._size++;let c=rt(()=>{o==null||o(),this._removeListener(a)});return s instanceof mr?s.add(c):Array.isArray(s)&&s.push(c),c}),this._event}_removeListener(t){var o,c,f,p;if((c=(o=this._options)==null?void 0:o.onWillRemoveListener)==null||c.call(o,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(p=(f=this._options)==null?void 0:f.onDidRemoveLastListener)==null||p.call(f,this),this._size=0;return}let n=this._listeners,s=n.indexOf(t);if(s===-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--,n[s]=void 0;let a=this._deliveryQueue.current===this;if(this._size*fw<=n.length){let h=0;for(let g=0;g<n.length;g++)n[g]?n[h++]=n[g]:a&&(this._deliveryQueue.end--,h<this._deliveryQueue.i&&this._deliveryQueue.i--);n.length=h}}_deliver(t,n){var a;if(!t)return;let s=((a=this._options)==null?void 0:a.onListenerError)||eu;if(!s){t.value(n);return}try{t.value(n)}catch(o){s(o)}}_deliverQueue(t){let n=t.current._listeners;for(;t.i<t.end;)this._deliver(n[t.i++],t.value);t.reset()}fire(t){var n,s,a,o;if((n=this._deliveryQueue)!=null&&n.current&&(this._deliverQueue(this._deliveryQueue),(s=this._perfMon)==null||s.stop()),(a=this._perfMon)==null||a.start(this._size),this._listeners)if(this._listeners instanceof $h)this._deliver(this._listeners,t);else{let c=this._deliveryQueue;c.enqueue(this,t,this._listeners.length),this._deliverQueue(c)}(o=this._perfMon)==null||o.stop()}hasListeners(){return this._size>0}},pw=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},jf=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new ue,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new ue,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,n){if(this.getZoomLevel(n)===t)return;let s=this.getWindowId(n);this.mapWindowIdToZoomLevel.set(s,t),this._onDidChangeZoomLevel.fire(s)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,n){this.mapWindowIdToZoomFactor.set(this.getWindowId(n),t)}setFullscreen(t,n){if(this.isFullscreen(n)===t)return;let s=this.getWindowId(n);this.mapWindowIdToFullScreen.set(s,t),this._onDidChangeFullscreen.fire(s)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};jf.INSTANCE=new jf;var Cd=jf;function _w(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}Cd.INSTANCE.onDidChangeZoomLevel;function mw(e){return Cd.INSTANCE.getZoomFactor(e)}Cd.INSTANCE.onDidChangeFullscreen;var Xs=typeof navigator=="object"?navigator.userAgent:"",Uf=Xs.indexOf("Firefox")>=0,gw=Xs.indexOf("AppleWebKit")>=0,kd=Xs.indexOf("Chrome")>=0,vw=!kd&&Xs.indexOf("Safari")>=0;Xs.indexOf("Electron/")>=0;Xs.indexOf("Android")>=0;var Gh=!1;if(typeof zn.matchMedia=="function"){let e=zn.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=zn.matchMedia("(display-mode: fullscreen)");Gh=e.matches,_w(zn,e,({matches:n})=>{Gh&&t.matches||(Gh=n)})}var Fs="en",Pf=!1,If=!1,tu=!1,gS=!1,qo,iu=Fs,uv=Fs,yw,Zi,qr=globalThis,Wt,Ky;typeof qr.vscode<"u"&&typeof qr.vscode.process<"u"?Wt=qr.vscode.process:typeof process<"u"&&typeof((Ky=process==null?void 0:process.versions)==null?void 0:Ky.node)=="string"&&(Wt=process);var Xy,Sw=typeof((Xy=Wt==null?void 0:Wt.versions)==null?void 0:Xy.electron)=="string",bw=Sw&&(Wt==null?void 0:Wt.type)==="renderer",$y;if(typeof Wt=="object"){Pf=Wt.platform==="win32",If=Wt.platform==="darwin",tu=Wt.platform==="linux",tu&&Wt.env.SNAP&&Wt.env.SNAP_REVISION,Wt.env.CI||Wt.env.BUILD_ARTIFACTSTAGINGDIRECTORY,qo=Fs,iu=Fs;let e=Wt.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);qo=t.userLocale,uv=t.osLocale,iu=t.resolvedLanguage||Fs,yw=($y=t.languagePack)==null?void 0:$y.translationsConfigFile}catch{}gS=!0}else typeof navigator=="object"&&!bw?(Zi=navigator.userAgent,Pf=Zi.indexOf("Windows")>=0,If=Zi.indexOf("Macintosh")>=0,(Zi.indexOf("Macintosh")>=0||Zi.indexOf("iPad")>=0||Zi.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,tu=Zi.indexOf("Linux")>=0,(Zi==null?void 0:Zi.indexOf("Mobi"))>=0,iu=globalThis._VSCODE_NLS_LANGUAGE||Fs,qo=navigator.language.toLowerCase(),uv=qo):console.error("Unable to resolve platform.");var vS=Pf,un=If,xw=tu,cv=gS,cn=Zi,ur=iu,ww;(e=>{function t(){return ur}e.value=t;function n(){return ur.length===2?ur==="en":ur.length>=3?ur[0]==="e"&&ur[1]==="n"&&ur[2]==="-":!1}e.isDefaultVariant=n;function s(){return ur==="en"}e.isDefault=s})(ww||(ww={}));var Cw=typeof qr.postMessage=="function"&&!qr.importScripts;(()=>{if(Cw){let e=[];qr.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let s=0,a=e.length;s<a;s++){let o=e[s];if(o.id===n.data.vscodeScheduleAsyncWork){e.splice(s,1),o.callback();return}}});let t=0;return n=>{let s=++t;e.push({id:s,callback:n}),qr.postMessage({vscodeScheduleAsyncWork:s},"*")}}return e=>setTimeout(e)})();var kw=!!(cn&&cn.indexOf("Chrome")>=0);cn&&cn.indexOf("Firefox")>=0;!kw&&cn&&cn.indexOf("Safari")>=0;cn&&cn.indexOf("Edg/")>=0;cn&&cn.indexOf("Android")>=0;var Hs=typeof navigator=="object"?navigator:{};cv||document.queryCommandSupported&&document.queryCommandSupported("copy")||Hs&&Hs.clipboard&&Hs.clipboard.writeText,cv||Hs&&Hs.clipboard&&Hs.clipboard.readText;var Ed=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}},Zh=new Ed,hv=new Ed,fv=new Ed,Ew=new Array(230),yS;(e=>{function t(f){return Zh.keyCodeToStr(f)}e.toString=t;function n(f){return Zh.strToKeyCode(f)}e.fromString=n;function s(f){return hv.keyCodeToStr(f)}e.toUserSettingsUS=s;function a(f){return fv.keyCodeToStr(f)}e.toUserSettingsGeneral=a;function o(f){return hv.strToKeyCode(f)||fv.strToKeyCode(f)}e.fromUserSettings=o;function c(f){if(f>=98&&f<=113)return null;switch(f){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Zh.keyCodeToStr(f)}e.toElectronAccelerator=c})(yS||(yS={}));var Tw=class SS{constructor(t,n,s,a,o){this.ctrlKey=t,this.shiftKey=n,this.altKey=s,this.metaKey=a,this.keyCode=o}equals(t){return t instanceof SS&&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",n=this.shiftKey?"1":"0",s=this.altKey?"1":"0",a=this.metaKey?"1":"0";return`K${t}${n}${s}${a}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new Aw([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},Aw=class{constructor(e){if(e.length===0)throw Jx("chords");this.chords=e}getHashCode(){let e="";for(let t=0,n=this.chords.length;t<n;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 Dw(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return yS.fromString(n)}let t=e.keyCode;if(t===3)return 7;if(Uf)switch(t){case 59:return 85;case 60:if(xw)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(un)return 57;break}else if(gw&&(un&&t===93||!un&&t===92))return 57;return Ew[t]||0}var Rw=un?256:2048,Mw=512,Bw=1024,Lw=un?2048:256,dv=class{constructor(e){var n;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=(n=t.getModifierState)==null?void 0:n.call(t,"AltGraph"),this.keyCode=Dw(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|=Rw),this.altKey&&(t|=Mw),this.shiftKey&&(t|=Bw),this.metaKey&&(t|=Lw),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new Tw(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},pv=new WeakMap;function zw(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!=="null"&&n.origin!=="null"&&t.origin!==n.origin)return null}catch{return null}return e.parent}var Nw=class{static getSameOriginWindowChain(e){let t=pv.get(e);if(!t){t=[],pv.set(e,t);let n=e,s;do s=zw(n),s?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=s;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,s=0,a=this.getSameOriginWindowChain(e);for(let o of a){let c=o.window.deref();if(n+=(c==null?void 0:c.scrollY)??0,s+=(c==null?void 0:c.scrollX)??0,c===t||!o.iframeElement)break;let f=o.iframeElement.getBoundingClientRect();n+=f.top,s+=f.left}return{top:n,left:s}}},Wo=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 n=Nw.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},_v=class{constructor(e,t=0,n=0){var a;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let s=!1;if(kd){let o=navigator.userAgent.match(/Chrome\/(\d+)/);s=(o?parseInt(o[1]):123)<=122}if(e){let o=e,c=e,f=((a=e.view)==null?void 0:a.devicePixelRatio)||1;if(typeof o.wheelDeltaY<"u")s?this.deltaY=o.wheelDeltaY/(120*f):this.deltaY=o.wheelDeltaY/120;else if(typeof c.VERTICAL_AXIS<"u"&&c.axis===c.VERTICAL_AXIS)this.deltaY=-c.detail/3;else if(e.type==="wheel"){let p=e;p.deltaMode===p.DOM_DELTA_LINE?Uf&&!un?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof o.wheelDeltaX<"u")vw&&vS?this.deltaX=-(o.wheelDeltaX/120):s?this.deltaX=o.wheelDeltaX/(120*f):this.deltaX=o.wheelDeltaX/120;else if(typeof c.HORIZONTAL_AXIS<"u"&&c.axis===c.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let p=e;p.deltaMode===p.DOM_DELTA_LINE?Uf&&!un?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(s?this.deltaY=e.wheelDelta/(120*f):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},bS=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),Ow;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof Hw?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Yt.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:bS})})(Ow||(Ow={}));var Hw=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?bS:(this._emitter||(this._emitter=new ue),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Td=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 Lf("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Lf("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},jw=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,n=globalThis){if(this.isDisposed)throw new Lf("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let s=n.setInterval(()=>{e()},t);this.disposable=rt(()=>{n.clearInterval(s),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},Uw;(e=>{async function t(s){let a,o=await Promise.all(s.map(c=>c.then(f=>f,f=>{a||(a=f)})));if(typeof a<"u")throw a;return o}e.settled=t;function n(s){return new Promise(async(a,o)=>{try{await s(a,o)}catch(c){o(c)}})}e.withAsyncBody=n})(Uw||(Uw={}));var mv=class qi{static fromArray(t){return new qi(n=>{n.emitMany(t)})}static fromPromise(t){return new qi(async n=>{n.emitMany(await t)})}static fromPromises(t){return new qi(async n=>{await Promise.all(t.map(async s=>n.emitOne(await s)))})}static merge(t){return new qi(async n=>{await Promise.all(t.map(async s=>{for await(let a of s)n.emitOne(a)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new ue,queueMicrotask(async()=>{let s={emitOne:a=>this.emitOne(a),emitMany:a=>this.emitMany(a),reject:a=>this.reject(a)};try{await Promise.resolve(t(s)),this.resolve()}catch(a){this.reject(a)}finally{s.emitOne=void 0,s.emitMany=void 0,s.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 Yt.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var n;return(n=this._onReturn)==null||n.call(this),{done:!0,value:void 0}}}}static map(t,n){return new qi(async s=>{for await(let a of t)s.emitOne(n(a))})}map(t){return qi.map(this,t)}static filter(t,n){return new qi(async s=>{for await(let a of t)n(a)&&s.emitOne(a)})}filter(t){return qi.filter(this,t)}static coalesce(t){return qi.filter(t,n=>!!n)}coalesce(){return qi.coalesce(this)}static async toPromise(t){let n=[];for await(let s of t)n.push(s);return n}toPromise(){return qi.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())}};mv.EMPTY=mv.fromArray([]);var{getWindow:on,getWindowId:Pw,onDidRegisterWindow:Iw}=(function(){let e=new Map,t={window:zn,disposables:new mr};e.set(zn.vscodeWindowId,t);let n=new ue,s=new ue,a=new ue;function o(c,f){return(typeof c=="number"?e.get(c):void 0)??(f?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:a.event,onDidUnregisterWindow:s.event,registerWindow(c){if(e.has(c.vscodeWindowId))return Ae.None;let f=new mr,p={window:c,disposables:f.add(new mr)};return e.set(c.vscodeWindowId,p),f.add(rt(()=>{e.delete(c.vscodeWindowId),s.fire(c)})),f.add(be(c,Dt.BEFORE_UNLOAD,()=>{a.fire(c)})),n.fire(p),f},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(c){return c.vscodeWindowId},hasWindow(c){return e.has(c)},getWindowById:o,getWindow(c){var h;let f=c;if((h=f==null?void 0:f.ownerDocument)!=null&&h.defaultView)return f.ownerDocument.defaultView.window;let p=c;return p!=null&&p.view?p.view.window:zn},getDocument(c){return on(c).document}}})(),Fw=class{constructor(e,t,n,s){this._node=e,this._type=t,this._handler=n,this._options=s||!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 be(e,t,n,s){return new Fw(e,t,n,s)}var gv=function(e,t,n,s){return be(e,t,n,s)},Ad,qw=class extends jw{constructor(e){super(),this.defaultTarget=e&&on(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},vv=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){eu(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,s=new Map,a=o=>{n.set(o,!1);let c=e.get(o)??[];for(t.set(o,c),e.set(o,[]),s.set(o,!0);c.length>0;)c.sort(vv.sort),c.shift().execute();s.set(o,!1)};Ad=(o,c,f=0)=>{let p=Pw(o),h=new vv(c,f),g=e.get(p);return g||(g=[],e.set(p,g)),g.push(h),n.get(p)||(n.set(p,!0),o.requestAnimationFrame(()=>a(p))),h}})();function Ww(e){let t=e.getBoundingClientRect(),n=on(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}var Dt={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"},Yw=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=_i(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=_i(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=_i(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=_i(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=_i(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=_i(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=_i(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=_i(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=_i(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=_i(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=_i(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=_i(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=_i(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=_i(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 _i(e){return typeof e=="number"?`${e}px`:e}function la(e){return new Yw(e)}var xS=class{constructor(){this._hooks=new mr,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 n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,s,a){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=s,this._onStopCallback=a;let o=e;try{e.setPointerCapture(t),this._hooks.add(rt(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{o=on(e)}this._hooks.add(be(o,Dt.POINTER_MOVE,c=>{if(c.buttons!==n){this.stopMonitoring(!0);return}c.preventDefault(),this._pointerMoveCallback(c)})),this._hooks.add(be(o,Dt.POINTER_UP,c=>this.stopMonitoring(!0)))}};function Vw(e,t,n){let s=null,a=null;if(typeof n.value=="function"?(s="value",a=n.value,a.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof n.get=="function"&&(s="get",a=n.get),!a)throw new Error("not supported");let o=`$memoize$${t}`;n[s]=function(...c){return this.hasOwnProperty(o)||Object.defineProperty(this,o,{configurable:!1,enumerable:!1,writable:!1,value:a.apply(this,c)}),this[o]}}var ln;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(ln||(ln={}));var ta=class Kt extends Ae{constructor(){super(),this.dispatched=!1,this.targets=new ov,this.ignoreTargets=new ov,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Yt.runAndSubscribe(Iw,({window:t,disposables:n})=>{n.add(be(t.document,"touchstart",s=>this.onTouchStart(s),{passive:!1})),n.add(be(t.document,"touchend",s=>this.onTouchEnd(t,s))),n.add(be(t.document,"touchmove",s=>this.onTouchMove(s),{passive:!1}))},{window:zn,disposables:this._store}))}static addTarget(t){if(!Kt.isTouchDevice())return Ae.None;Kt.INSTANCE||(Kt.INSTANCE=new Kt);let n=Kt.INSTANCE.targets.push(t);return rt(n)}static ignoreTarget(t){if(!Kt.isTouchDevice())return Ae.None;Kt.INSTANCE||(Kt.INSTANCE=new Kt);let n=Kt.INSTANCE.ignoreTargets.push(t);return rt(n)}static isTouchDevice(){return"ontouchstart"in zn||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let n=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let s=0,a=t.targetTouches.length;s<a;s++){let o=t.targetTouches.item(s);this.activeTouches[o.identifier]={id:o.identifier,initialTarget:o.target,initialTimeStamp:n,initialPageX:o.pageX,initialPageY:o.pageY,rollingTimestamps:[n],rollingPageX:[o.pageX],rollingPageY:[o.pageY]};let c=this.newGestureEvent(ln.Start,o.target);c.pageX=o.pageX,c.pageY=o.pageY,this.dispatchEvent(c)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,n){let s=Date.now(),a=Object.keys(this.activeTouches).length;for(let o=0,c=n.changedTouches.length;o<c;o++){let f=n.changedTouches.item(o);if(!this.activeTouches.hasOwnProperty(String(f.identifier))){console.warn("move of an UNKNOWN touch",f);continue}let p=this.activeTouches[f.identifier],h=Date.now()-p.initialTimeStamp;if(h<Kt.HOLD_DELAY&&Math.abs(p.initialPageX-Ti(p.rollingPageX))<30&&Math.abs(p.initialPageY-Ti(p.rollingPageY))<30){let g=this.newGestureEvent(ln.Tap,p.initialTarget);g.pageX=Ti(p.rollingPageX),g.pageY=Ti(p.rollingPageY),this.dispatchEvent(g)}else if(h>=Kt.HOLD_DELAY&&Math.abs(p.initialPageX-Ti(p.rollingPageX))<30&&Math.abs(p.initialPageY-Ti(p.rollingPageY))<30){let g=this.newGestureEvent(ln.Contextmenu,p.initialTarget);g.pageX=Ti(p.rollingPageX),g.pageY=Ti(p.rollingPageY),this.dispatchEvent(g)}else if(a===1){let g=Ti(p.rollingPageX),m=Ti(p.rollingPageY),S=Ti(p.rollingTimestamps)-p.rollingTimestamps[0],v=g-p.rollingPageX[0],b=m-p.rollingPageY[0],k=[...this.targets].filter(B=>p.initialTarget instanceof Node&&B.contains(p.initialTarget));this.inertia(t,k,s,Math.abs(v)/S,v>0?1:-1,g,Math.abs(b)/S,b>0?1:-1,m)}this.dispatchEvent(this.newGestureEvent(ln.End,p.initialTarget)),delete this.activeTouches[f.identifier]}this.dispatched&&(n.preventDefault(),n.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,n){let s=document.createEvent("CustomEvent");return s.initEvent(t,!1,!0),s.initialTarget=n,s.tapCount=0,s}dispatchEvent(t){if(t.type===ln.Tap){let n=new Date().getTime(),s=0;n-this._lastSetTapCountTime>Kt.CLEAR_TAP_COUNT_TIME?s=1:s=2,this._lastSetTapCountTime=n,t.tapCount=s}else(t.type===ln.Change||t.type===ln.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let s of this.ignoreTargets)if(s.contains(t.initialTarget))return;let n=[];for(let s of this.targets)if(s.contains(t.initialTarget)){let a=0,o=t.initialTarget;for(;o&&o!==s;)a++,o=o.parentElement;n.push([a,s])}n.sort((s,a)=>s[0]-a[0]);for(let[s,a]of n)a.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,s,a,o,c,f,p,h){this.handle=Ad(t,()=>{let g=Date.now(),m=g-s,S=0,v=0,b=!0;a+=Kt.SCROLL_FRICTION*m,f+=Kt.SCROLL_FRICTION*m,a>0&&(b=!1,S=o*a*m),f>0&&(b=!1,v=p*f*m);let k=this.newGestureEvent(ln.Change);k.translationX=S,k.translationY=v,n.forEach(B=>B.dispatchEvent(k)),b||this.inertia(t,n,g,a,o,c+S,f,p,h+v)})}onTouchMove(t){let n=Date.now();for(let s=0,a=t.changedTouches.length;s<a;s++){let o=t.changedTouches.item(s);if(!this.activeTouches.hasOwnProperty(String(o.identifier))){console.warn("end of an UNKNOWN touch",o);continue}let c=this.activeTouches[o.identifier],f=this.newGestureEvent(ln.Change,c.initialTarget);f.translationX=o.pageX-Ti(c.rollingPageX),f.translationY=o.pageY-Ti(c.rollingPageY),f.pageX=o.pageX,f.pageY=o.pageY,this.dispatchEvent(f),c.rollingPageX.length>3&&(c.rollingPageX.shift(),c.rollingPageY.shift(),c.rollingTimestamps.shift()),c.rollingPageX.push(o.pageX),c.rollingPageY.push(o.pageY),c.rollingTimestamps.push(n)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};ta.SCROLL_FRICTION=-.005,ta.HOLD_DELAY=700,ta.CLEAR_TAP_COUNT_TIME=400,ht([Vw],ta,"isTouchDevice",1);var Kw=ta,Dd=class extends Ae{onclick(e,t){this._register(be(e,Dt.CLICK,n=>t(new Wo(on(e),n))))}onmousedown(e,t){this._register(be(e,Dt.MOUSE_DOWN,n=>t(new Wo(on(e),n))))}onmouseover(e,t){this._register(be(e,Dt.MOUSE_OVER,n=>t(new Wo(on(e),n))))}onmouseleave(e,t){this._register(be(e,Dt.MOUSE_LEAVE,n=>t(new Wo(on(e),n))))}onkeydown(e,t){this._register(be(e,Dt.KEY_DOWN,n=>t(new dv(n))))}onkeyup(e,t){this._register(be(e,Dt.KEY_UP,n=>t(new dv(n))))}oninput(e,t){this._register(be(e,Dt.INPUT,t))}onblur(e,t){this._register(be(e,Dt.BLUR,t))}onfocus(e,t){this._register(be(e,Dt.FOCUS,t))}onchange(e,t){this._register(be(e,Dt.CHANGE,t))}ignoreGesture(e){return Kw.ignoreTarget(e)}},yv=11,Xw=class extends Dd{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=yv+"px",this.domNode.style.height=yv+"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 xS),this._register(gv(this.bgDomNode,Dt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(gv(this.domNode,Dt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new qw),this._pointerdownScheduleRepeatTimer=this._register(new Td)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,on(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},$w=class Ff{constructor(t,n,s,a,o,c,f){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(n=n|0,s=s|0,a=a|0,o=o|0,c=c|0,f=f|0),this.rawScrollLeft=a,this.rawScrollTop=f,n<0&&(n=0),a+n>s&&(a=s-n),a<0&&(a=0),o<0&&(o=0),f+o>c&&(f=c-o),f<0&&(f=0),this.width=n,this.scrollWidth=s,this.scrollLeft=a,this.height=o,this.scrollHeight=c,this.scrollTop=f}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,n){return new Ff(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new Ff(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,n){let s=this.width!==t.width,a=this.scrollWidth!==t.scrollWidth,o=this.scrollLeft!==t.scrollLeft,c=this.height!==t.height,f=this.scrollHeight!==t.scrollHeight,p=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:n,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:s,scrollWidthChanged:a,scrollLeftChanged:o,heightChanged:c,scrollHeightChanged:f,scrollTopChanged:p}}},Gw=class extends Ae{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new ue),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new $w(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 s;let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),(s=this._smoothScrolling)==null||s.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 n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let s;t?s=new bv(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):s=this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=s}else{let n=this._state.withScrollPosition(e);this._smoothScrolling=bv.start(this._state,n,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 n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},Sv=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function Qh(e,t){let n=t-e;return function(s){return e+n*Jw(s)}}function Zw(e,t,n){return function(s){return s<n?e(s/n):t((s-n)/(1-n))}}var bv=class qf{constructor(t,n,s,a){this.from=t,this.to=n,this.duration=a,this.startTime=s,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,n,s){if(Math.abs(t-n)>2.5*s){let a,o;return t<n?(a=t+.75*s,o=n-.75*s):(a=t-.75*s,o=n+.75*s),Zw(Qh(t,a),Qh(o,n),.33)}return Qh(t,n)}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 n=(t-this.startTime)/this.duration;if(n<1){let s=this.scrollLeft(n),a=this.scrollTop(n);return new Sv(s,a,!1)}return new Sv(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,s){return qf.start(t,n,s)}static start(t,n,s){s=s+10;let a=Date.now()-10;return new qf(t,n,a,s)}};function Qw(e){return Math.pow(e,3)}function Jw(e){return 1-Qw(1-e)}var eC=class extends Ae{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new Td)}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":"")))}},tC=140,wS=class extends Dd{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 eC(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new xS),this._shouldRender=!0,this.domNode=la(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(be(this.domNode.domNode,Dt.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new Xw(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,s){this.slider=la(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof n=="number"&&this.slider.setWidth(n),typeof s=="number"&&this.slider.setHeight(s),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(be(this.slider.domNode,Dt.POINTER_DOWN,a=>{a.button===0&&(a.preventDefault(),this._sliderPointerDown(a))})),this.onclick(this.slider.domNode,a=>{a.leftButton&&a.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,n=t+this._scrollbarState.getSliderPosition(),s=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),a=this._sliderPointerPosition(e);n<=a&&a<=s?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,n=e.offsetY;else{let a=Ww(this.domNode.domNode);t=e.pageX-a.left,n=e.pageY-a.top}let s=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(s):this._scrollbarState.getDesiredScrollPositionFromOffset(s)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),s=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,a=>{let o=this._sliderOrthogonalPointerPosition(a),c=Math.abs(o-n);if(vS&&c>tC){this._setDesiredScrollPositionNow(s.getScrollPosition());return}let f=this._sliderPointerPosition(a)-t;this._setDesiredScrollPositionNow(s.getDesiredScrollPositionFromDelta(f))},()=>{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()}},CS=class Wf{constructor(t,n,s,a,o,c){this._scrollbarSize=Math.round(n),this._oppositeScrollbarSize=Math.round(s),this._arrowSize=Math.round(t),this._visibleSize=a,this._scrollSize=o,this._scrollPosition=c,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new Wf(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let n=Math.round(t);return this._visibleSize!==n?(this._visibleSize=n,this._refreshComputedValues(),!0):!1}setScrollSize(t){let n=Math.round(t);return this._scrollSize!==n?(this._scrollSize=n,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let n=Math.round(t);return this._scrollPosition!==n?(this._scrollPosition=n,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,n,s,a,o){let c=Math.max(0,s-t),f=Math.max(0,c-2*n),p=a>0&&a>s;if(!p)return{computedAvailableSize:Math.round(c),computedIsNeeded:p,computedSliderSize:Math.round(f),computedSliderRatio:0,computedSliderPosition:0};let h=Math.round(Math.max(20,Math.floor(s*f/a))),g=(f-h)/(a-s),m=o*g;return{computedAvailableSize:Math.round(c),computedIsNeeded:p,computedSliderSize:Math.round(h),computedSliderRatio:g,computedSliderPosition:Math.round(m)}}_refreshComputedValues(){let t=Wf._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 n=t-this._arrowSize-this._computedSliderSize/2;return Math.round(n/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize,s=this._scrollPosition;return n<this._computedSliderPosition?s-=this._visibleSize:s+=this._visibleSize,s}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let n=this._computedSliderPosition+t;return Math.round(n/this._computedSliderRatio)}},iC=class extends wS{constructor(e,t,n){let s=e.getScrollDimensions(),a=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new CS(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,s.width,s.scrollWidth,a.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}},nC=class extends wS{constructor(e,t,n){let s=e.getScrollDimensions(),a=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new CS(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,s.height,s.scrollHeight,a.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}},rC=500,xv=50,sC=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},Yf=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,n=0,s=1,a=this._rear;do{let o=a===this._front?t:Math.pow(2,-s);if(t-=o,n+=this._memory[a].score*o,a===this._front)break;a=(this._capacity+a-1)%this._capacity,s++}while(!0);return n<=.5}acceptStandardWheelEvent(t){if(kd){let n=on(t.browserEvent),s=mw(n);this.accept(Date.now(),t.deltaX*s,t.deltaY*s)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,n,s){let a=null,o=new sC(t,n,s);this._front===-1&&this._rear===-1?(this._memory[0]=o,this._front=0,this._rear=0):(a=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]=o),o.score=this._computeScore(o,a)}_computeScore(t,n){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let s=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(s+=.25),n){let a=Math.abs(t.deltaX),o=Math.abs(t.deltaY),c=Math.abs(n.deltaX),f=Math.abs(n.deltaY),p=Math.max(Math.min(a,c),1),h=Math.max(Math.min(o,f),1),g=Math.max(a,c),m=Math.max(o,f);g%p===0&&m%h===0&&(s-=.5)}return Math.min(Math.max(s,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};Yf.INSTANCE=new Yf;var lC=Yf,aC=class extends Dd{constructor(e,t,n){super(),this._onScroll=this._register(new ue),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new ue),this.onWillScroll=this._onWillScroll.event,this._options=uC(t),this._scrollable=n,this._register(this._scrollable.onScroll(a=>{this._onWillScroll.fire(a),this._onDidScroll(a),this._onScroll.fire(a)}));let s={onMouseWheel:a=>this._onMouseWheel(a),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new nC(this._scrollable,this._options,s)),this._horizontalScrollbar=this._register(new iC(this._scrollable,this._options,s)),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=la(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=la(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=la(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,a=>this._onMouseOver(a)),this.onmouseleave(this._listenOnDomNode,a=>this._onMouseLeave(a)),this._hideTimeout=this._register(new Td),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Wr(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,un&&(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 _v(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Wr(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new _v(n))};this._mouseWheelToDispose.push(be(this._listenOnDomNode,Dt.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var a;if((a=e.browserEvent)!=null&&a.defaultPrevented)return;let t=lC.INSTANCE;t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let o=e.deltaY*this._options.mouseWheelScrollSensitivity,c=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&c+o===0?c=o=0:Math.abs(o)>=Math.abs(c)?c=0:o=0),this._options.flipAxes&&([o,c]=[c,o]);let f=!un&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||f)&&!c&&(c=o,o=0),e.browserEvent&&e.browserEvent.altKey&&(c=c*this._options.fastScrollSensitivity,o=o*this._options.fastScrollSensitivity);let p=this._scrollable.getFutureScrollPosition(),h={};if(o){let g=xv*o,m=p.scrollTop-(g<0?Math.floor(g):Math.ceil(g));this._verticalScrollbar.writeScrollPosition(h,m)}if(c){let g=xv*c,m=p.scrollLeft-(g<0?Math.floor(g):Math.ceil(g));this._horizontalScrollbar.writeScrollPosition(h,m)}h=this._scrollable.validateScrollPosition(h),(p.scrollLeft!==h.scrollLeft||p.scrollTop!==h.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(h):this._scrollable.setScrollPositionNow(h),n=!0)}let s=n;!s&&this._options.alwaysConsumeMouseWheel&&(s=!0),!s&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(s=!0),s&&(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,n=e.scrollLeft>0,s=n?" left":"",a=t?" top":"",o=n||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${s}`),this._topShadowDomNode.setClassName(`shadow${a}`),this._topLeftShadowDomNode.setClassName(`shadow${o}${a}${s}`)}}_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(),rC)}},oC=class extends aC{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function uC(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,un&&(t.className+=" mac"),t}var Vf=class extends Ae{constructor(e,t,n,s,a,o,c,f){super(),this._bufferService=n,this._optionsService=c,this._renderService=f,this._onRequestScrollLines=this._register(new ue),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let p=this._register(new Gw({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:h=>Ad(s.window,h)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{p.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new oC(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},p)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(a.onProtocolChange(h=>{this._scrollableElement.updateOptions({handleMouseWheel:!(h&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Yt.runAndSubscribe(o.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(rt(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=s.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(rt(()=>this._styleElement.remove())),this._register(Yt.runAndSubscribe(o.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${o.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${o.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${o.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
69
- `)})),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(h=>this._handleScroll(h)))}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),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};Vf=ht([fe(2,ri),fe(3,Nn),fe(4,rS),fe(5,Ks),fe(6,si),fe(7,On)],Vf);var Kf=class extends Ae{constructor(e,t,n,s,a){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=s,this._renderService=a,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(o=>this._removeDecoration(o))),this._register(rt(()=>{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 s;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((s=e==null?void 0:e.options)==null?void 0:s.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 n=e.options.x??0;return n&&n>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 n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var t;(t=this._decorationElements.get(e))==null||t.remove(),this._decorationElements.delete(e),e.dispose()}};Kf=ht([fe(1,ri),fe(2,Nn),fe(3,ga),fe(4,On)],Kf);var cC=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,n){return t>=e.startBufferLine-this._linePadding[n||"full"]&&t<=e.endBufferLine+this._linePadding[n||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},rn={full:0,left:0,center:0,right:0},cr={full:0,left:0,center:0,right:0},Yl={full:0,left:0,center:0,right:0},uu=class extends Ae{constructor(e,t,n,s,a,o,c,f){var h;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=s,this._renderService=a,this._optionsService=o,this._themeService=c,this._coreBrowserService=f,this._colorZoneStore=new cC,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(),(h=this._viewportElement.parentElement)==null||h.insertBefore(this._canvas,this._viewportElement),this._register(rt(()=>{var g;return(g=this._canvas)==null?void 0:g.remove()}));let p=this._canvas.getContext("2d");if(p)this._ctx=p;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);cr.full=this._canvas.width,cr.left=e,cr.center=t,cr.right=e,this._refreshDrawHeightConstants(),Yl.full=1,Yl.left=1,Yl.center=1+cr.left,Yl.right=1+cr.left+cr.center}_refreshDrawHeightConstants(){rn.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);rn.left=t,rn.center=t,rn.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*rn.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*rn.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*rn.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*rn.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(Yl[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-rn[e.position||"full"]/2),cr[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+rn[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}))}};uu=ht([fe(2,ri),fe(3,ga),fe(4,On),fe(5,si),fe(6,Ks),fe(7,Nn)],uu);var ie;(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=`
70
- `,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=""))(ie||(ie={}));var nu;(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="Ÿ"))(nu||(nu={}));var kS;(e=>e.ST=`${ie.ESC}\\`)(kS||(kS={}));var Xf=class{constructor(e,t,n,s,a,o){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=s,this._coreService=a,this._renderService=o,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 n;t.start+=this._dataAlreadySent.length,this._isComposing?n=this._textarea.value.substring(t.start,this._compositionPosition.start):n=this._textarea.value.substring(t.start),n.length>0&&this._coreService.triggerDataEvent(n,!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,n=t.replace(e,"");this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${ie.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),n=this._renderService.dimensions.css.cell.height,s=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,a=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=a+"px",this._compositionView.style.top=s+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let o=this._compositionView.getBoundingClientRect();this._textarea.style.left=a+"px",this._textarea.style.top=s+"px",this._textarea.style.width=Math.max(o.width,1)+"px",this._textarea.style.height=Math.max(o.height,1)+"px",this._textarea.style.lineHeight=o.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};Xf=ht([fe(2,ri),fe(3,si),fe(4,Kr),fe(5,On)],Xf);var Rt=0,Mt=0,Bt=0,ut=0,wv={css:"#00000000",rgba:0},bt;(e=>{function t(a,o,c,f){return f!==void 0?`#${Or(a)}${Or(o)}${Or(c)}${Or(f)}`:`#${Or(a)}${Or(o)}${Or(c)}`}e.toCss=t;function n(a,o,c,f=255){return(a<<24|o<<16|c<<8|f)>>>0}e.toRgba=n;function s(a,o,c,f){return{css:e.toCss(a,o,c,f),rgba:e.toRgba(a,o,c,f)}}e.toColor=s})(bt||(bt={}));var it;(e=>{function t(p,h){if(ut=(h.rgba&255)/255,ut===1)return{css:h.css,rgba:h.rgba};let g=h.rgba>>24&255,m=h.rgba>>16&255,S=h.rgba>>8&255,v=p.rgba>>24&255,b=p.rgba>>16&255,k=p.rgba>>8&255;Rt=v+Math.round((g-v)*ut),Mt=b+Math.round((m-b)*ut),Bt=k+Math.round((S-k)*ut);let B=bt.toCss(Rt,Mt,Bt),D=bt.toRgba(Rt,Mt,Bt);return{css:B,rgba:D}}e.blend=t;function n(p){return(p.rgba&255)===255}e.isOpaque=n;function s(p,h,g){let m=ru.ensureContrastRatio(p.rgba,h.rgba,g);if(m)return bt.toColor(m>>24&255,m>>16&255,m>>8&255)}e.ensureContrastRatio=s;function a(p){let h=(p.rgba|255)>>>0;return[Rt,Mt,Bt]=ru.toChannels(h),{css:bt.toCss(Rt,Mt,Bt),rgba:h}}e.opaque=a;function o(p,h){return ut=Math.round(h*255),[Rt,Mt,Bt]=ru.toChannels(p.rgba),{css:bt.toCss(Rt,Mt,Bt,ut),rgba:bt.toRgba(Rt,Mt,Bt,ut)}}e.opacity=o;function c(p,h){return ut=p.rgba&255,o(p,ut*h/255)}e.multiplyOpacity=c;function f(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}e.toColorRGB=f})(it||(it={}));var lt;(e=>{let t,n;try{let a=document.createElement("canvas");a.width=1,a.height=1;let o=a.getContext("2d",{willReadFrequently:!0});o&&(t=o,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function s(a){if(a.match(/#[\da-f]{3,8}/i))switch(a.length){case 4:return Rt=parseInt(a.slice(1,2).repeat(2),16),Mt=parseInt(a.slice(2,3).repeat(2),16),Bt=parseInt(a.slice(3,4).repeat(2),16),bt.toColor(Rt,Mt,Bt);case 5:return Rt=parseInt(a.slice(1,2).repeat(2),16),Mt=parseInt(a.slice(2,3).repeat(2),16),Bt=parseInt(a.slice(3,4).repeat(2),16),ut=parseInt(a.slice(4,5).repeat(2),16),bt.toColor(Rt,Mt,Bt,ut);case 7:return{css:a,rgba:(parseInt(a.slice(1),16)<<8|255)>>>0};case 9:return{css:a,rgba:parseInt(a.slice(1),16)>>>0}}let o=a.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(o)return Rt=parseInt(o[1]),Mt=parseInt(o[2]),Bt=parseInt(o[3]),ut=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),bt.toColor(Rt,Mt,Bt,ut);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=a,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Rt,Mt,Bt,ut]=t.getImageData(0,0,1,1).data,ut!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:bt.toRgba(Rt,Mt,Bt,ut),css:a}}e.toColor=s})(lt||(lt={}));var ti;(e=>{function t(s){return n(s>>16&255,s>>8&255,s&255)}e.relativeLuminance=t;function n(s,a,o){let c=s/255,f=a/255,p=o/255,h=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4),g=f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4),m=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4);return h*.2126+g*.7152+m*.0722}e.relativeLuminance2=n})(ti||(ti={}));var ru;(e=>{function t(c,f){if(ut=(f&255)/255,ut===1)return f;let p=f>>24&255,h=f>>16&255,g=f>>8&255,m=c>>24&255,S=c>>16&255,v=c>>8&255;return Rt=m+Math.round((p-m)*ut),Mt=S+Math.round((h-S)*ut),Bt=v+Math.round((g-v)*ut),bt.toRgba(Rt,Mt,Bt)}e.blend=t;function n(c,f,p){let h=ti.relativeLuminance(c>>8),g=ti.relativeLuminance(f>>8);if(Mn(h,g)<p){if(g<h){let v=s(c,f,p),b=Mn(h,ti.relativeLuminance(v>>8));if(b<p){let k=a(c,f,p),B=Mn(h,ti.relativeLuminance(k>>8));return b>B?v:k}return v}let m=a(c,f,p),S=Mn(h,ti.relativeLuminance(m>>8));if(S<p){let v=s(c,f,p),b=Mn(h,ti.relativeLuminance(v>>8));return S>b?m:v}return m}}e.ensureContrastRatio=n;function s(c,f,p){let h=c>>24&255,g=c>>16&255,m=c>>8&255,S=f>>24&255,v=f>>16&255,b=f>>8&255,k=Mn(ti.relativeLuminance2(S,v,b),ti.relativeLuminance2(h,g,m));for(;k<p&&(S>0||v>0||b>0);)S-=Math.max(0,Math.ceil(S*.1)),v-=Math.max(0,Math.ceil(v*.1)),b-=Math.max(0,Math.ceil(b*.1)),k=Mn(ti.relativeLuminance2(S,v,b),ti.relativeLuminance2(h,g,m));return(S<<24|v<<16|b<<8|255)>>>0}e.reduceLuminance=s;function a(c,f,p){let h=c>>24&255,g=c>>16&255,m=c>>8&255,S=f>>24&255,v=f>>16&255,b=f>>8&255,k=Mn(ti.relativeLuminance2(S,v,b),ti.relativeLuminance2(h,g,m));for(;k<p&&(S<255||v<255||b<255);)S=Math.min(255,S+Math.ceil((255-S)*.1)),v=Math.min(255,v+Math.ceil((255-v)*.1)),b=Math.min(255,b+Math.ceil((255-b)*.1)),k=Mn(ti.relativeLuminance2(S,v,b),ti.relativeLuminance2(h,g,m));return(S<<24|v<<16|b<<8|255)>>>0}e.increaseLuminance=a;function o(c){return[c>>24&255,c>>16&255,c>>8&255,c&255]}e.toChannels=o})(ru||(ru={}));function Or(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Mn(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var hC=class extends ma{constructor(e,t,n){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},cu=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Vi}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 n=[],s=t.translateToString(!0),a=0,o=0,c=0,f=t.getFg(0),p=t.getBg(0);for(let h=0;h<t.getTrimmedLength();h++)if(t.loadCell(h,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==f||this._workCell.bg!==p){if(h-a>1){let g=this._getJoinedRanges(s,c,o,t,a);for(let m=0;m<g.length;m++)n.push(g[m])}a=h,c=o,f=this._workCell.fg,p=this._workCell.bg}o+=this._workCell.getChars().length||_r.length}if(this._bufferService.cols-a>1){let h=this._getJoinedRanges(s,c,o,t,a);for(let g=0;g<h.length;g++)n.push(h[g])}return n}_getJoinedRanges(e,t,n,s,a){let o=e.substring(t,n),c=[];try{c=this._characterJoiners[0].handler(o)}catch(f){console.error(f)}for(let f=1;f<this._characterJoiners.length;f++)try{let p=this._characterJoiners[f].handler(o);for(let h=0;h<p.length;h++)cu._mergeRanges(c,p[h])}catch(p){console.error(p)}return this._stringRangesToCellRanges(c,s,a),c}_stringRangesToCellRanges(e,t,n){let s=0,a=!1,o=0,c=e[s];if(c){for(let f=n;f<this._bufferService.cols;f++){let p=t.getWidth(f),h=t.getString(f).length||_r.length;if(p!==0){if(!a&&c[0]<=o&&(c[0]=f,a=!0),c[1]<=o){if(c[1]=f,c=e[++s],!c)break;c[0]<=o?(c[0]=f,a=!0):a=!1}o+=h}}c&&(c[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let s=0;s<e.length;s++){let a=e[s];if(n){if(t[1]<=a[0])return e[s-1][1]=t[1],e;if(t[1]<=a[1])return e[s-1][1]=Math.max(t[1],a[1]),e.splice(s,1),e;e.splice(s,1),s--}else{if(t[1]<=a[0])return e.splice(s,0,t),e;if(t[1]<=a[1])return a[0]=Math.min(t[0],a[0]),e;t[0]<a[1]&&(a[0]=Math.min(t[0],a[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};cu=ht([fe(0,ri)],cu);function fC(e){return 57508<=e&&e<=57558}function dC(e){return 9472<=e&&e<=9631}function pC(e){return fC(e)||dC(e)}function _C(){return{css:{canvas:Yo(),cell:Yo()},device:{canvas:Yo(),cell:Yo(),char:{width:0,height:0,left:0,top:0}}}}function Yo(){return{width:0,height:0}}var $f=class{constructor(e,t,n,s,a,o,c){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=s,this._coreService=a,this._decorationService=o,this._themeService=c,this._workCell=new Vi,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,s,a,o,c,f,p,h,g){let m=[],S=this._characterJoinerService.getJoinedCharacters(t),v=this._themeService.colors,b=e.getNoBgTrimmedLength();n&&b<o+1&&(b=o+1);let k,B=0,D="",G=0,A=0,N=0,$=0,z=!1,Q=0,se=!1,he=0,j=0,ne=[],Y=h!==-1&&g!==-1;for(let U=0;U<b;U++){e.loadCell(U,this._workCell);let K=this._workCell.getWidth();if(K===0)continue;let H=!1,M=U>=j,F=U,V=this._workCell;if(S.length>0&&U===S[0][0]&&M){let He=S.shift(),vi=this._isCellInSelection(He[0],t);for(G=He[0]+1;G<He[1];G++)M&&(M=vi===this._isCellInSelection(G,t));M&&(M=!n||o<He[0]||o>=He[1]),M?(H=!0,V=new hC(this._workCell,e.translateToString(!0,He[0],He[1]),He[1]-He[0]),F=He[1]-1,K=V.getWidth()):j=He[1]}let oe=this._isCellInSelection(U,t),E=n&&U===o,T=Y&&U>=h&&U<=g,q=!1;this._decorationService.forEachDecorationAtCell(U,t,void 0,He=>{q=!0});let C=V.getChars()||_r;if(C===" "&&(V.isUnderline()||V.isOverline())&&(C=" "),he=K*f-p.get(C,V.isBold(),V.isItalic()),!k)k=this._document.createElement("span");else if(B&&(oe&&se||!oe&&!se&&V.bg===A)&&(oe&&se&&v.selectionForeground||V.fg===N)&&V.extended.ext===$&&T===z&&he===Q&&!E&&!H&&!q&&M){V.isInvisible()?D+=_r:D+=C,B++;continue}else B&&(k.textContent=D),k=this._document.createElement("span"),B=0,D="";if(A=V.bg,N=V.fg,$=V.extended.ext,z=T,Q=he,se=oe,H&&o>=U&&o<=F&&(o=U),!this._coreService.isCursorHidden&&E&&this._coreService.isCursorInitialized){if(ne.push("xterm-cursor"),this._coreBrowserService.isFocused)c&&ne.push("xterm-cursor-blink"),ne.push(s==="bar"?"xterm-cursor-bar":s==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(a)switch(a){case"outline":ne.push("xterm-cursor-outline");break;case"block":ne.push("xterm-cursor-block");break;case"bar":ne.push("xterm-cursor-bar");break;case"underline":ne.push("xterm-cursor-underline");break}}if(V.isBold()&&ne.push("xterm-bold"),V.isItalic()&&ne.push("xterm-italic"),V.isDim()&&ne.push("xterm-dim"),V.isInvisible()?D=_r:D=V.getChars()||_r,V.isUnderline()&&(ne.push(`xterm-underline-${V.extended.underlineStyle}`),D===" "&&(D=" "),!V.isUnderlineColorDefault()))if(V.isUnderlineColorRGB())k.style.textDecorationColor=`rgb(${ma.toColorRGB(V.getUnderlineColor()).join(",")})`;else{let He=V.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&V.isBold()&&He<8&&(He+=8),k.style.textDecorationColor=v.ansi[He].css}V.isOverline()&&(ne.push("xterm-overline"),D===" "&&(D=" ")),V.isStrikethrough()&&ne.push("xterm-strikethrough"),T&&(k.style.textDecoration="underline");let ae=V.getFgColor(),_e=V.getFgColorMode(),de=V.getBgColor(),xe=V.getBgColorMode(),Ye=!!V.isInverse();if(Ye){let He=ae;ae=de,de=He;let vi=_e;_e=xe,xe=vi}let De,Ht,Zt=!1;this._decorationService.forEachDecorationAtCell(U,t,void 0,He=>{He.options.layer!=="top"&&Zt||(He.backgroundColorRGB&&(xe=50331648,de=He.backgroundColorRGB.rgba>>8&16777215,De=He.backgroundColorRGB),He.foregroundColorRGB&&(_e=50331648,ae=He.foregroundColorRGB.rgba>>8&16777215,Ht=He.foregroundColorRGB),Zt=He.options.layer==="top")}),!Zt&&oe&&(De=this._coreBrowserService.isFocused?v.selectionBackgroundOpaque:v.selectionInactiveBackgroundOpaque,de=De.rgba>>8&16777215,xe=50331648,Zt=!0,v.selectionForeground&&(_e=50331648,ae=v.selectionForeground.rgba>>8&16777215,Ht=v.selectionForeground)),Zt&&ne.push("xterm-decoration-top");let li;switch(xe){case 16777216:case 33554432:li=v.ansi[de],ne.push(`xterm-bg-${de}`);break;case 50331648:li=bt.toColor(de>>16,de>>8&255,de&255),this._addStyle(k,`background-color:#${Cv((de>>>0).toString(16),"0",6)}`);break;case 0:default:Ye?(li=v.foreground,ne.push("xterm-bg-257")):li=v.background}switch(De||V.isDim()&&(De=it.multiplyOpacity(li,.5)),_e){case 16777216:case 33554432:V.isBold()&&ae<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ae+=8),this._applyMinimumContrast(k,li,v.ansi[ae],V,De,void 0)||ne.push(`xterm-fg-${ae}`);break;case 50331648:let He=bt.toColor(ae>>16&255,ae>>8&255,ae&255);this._applyMinimumContrast(k,li,He,V,De,Ht)||this._addStyle(k,`color:#${Cv(ae.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(k,li,v.foreground,V,De,Ht)||Ye&&ne.push("xterm-fg-257")}ne.length&&(k.className=ne.join(" "),ne.length=0),!E&&!H&&!q&&M?B++:k.textContent=D,he!==this.defaultSpacing&&(k.style.letterSpacing=`${he}px`),m.push(k),U=F}return k&&B&&(k.textContent=D),m}_applyMinimumContrast(e,t,n,s,a,o){if(this._optionsService.rawOptions.minimumContrastRatio===1||pC(s.getCode()))return!1;let c=this._getContrastCache(s),f;if(!a&&!o&&(f=c.getColor(t.rgba,n.rgba)),f===void 0){let p=this._optionsService.rawOptions.minimumContrastRatio/(s.isDim()?2:1);f=it.ensureContrastRatio(a||t,o||n,p),c.setColor((a||t).rgba,(o||n).rgba,f??null)}return f?(this._addStyle(e,`color:${f.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 n=this._selectionStart,s=this._selectionEnd;return!n||!s?!1:this._columnSelectMode?n[0]<=s[0]?e>=n[0]&&t>=n[1]&&e<s[0]&&t<=s[1]:e<n[0]&&t>=n[1]&&e>=s[0]&&t<=s[1]:t>n[1]&&t<s[1]||n[1]===s[1]&&t===n[1]&&e>=n[0]&&e<s[0]||n[1]<s[1]&&t===s[1]&&e<s[0]||n[1]<s[1]&&t===n[1]&&e>=n[0]}};$f=ht([fe(1,aS),fe(2,si),fe(3,Nn),fe(4,Kr),fe(5,ga),fe(6,Ks)],$f);function Cv(e,t,n){for(;e.length<n;)e=t+e;return e}var mC=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 n=e.createElement("span");n.classList.add("xterm-char-measure-element");let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold";let a=e.createElement("span");a.classList.add("xterm-char-measure-element"),a.style.fontStyle="italic";let o=e.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontWeight="bold",o.style.fontStyle="italic",this._measureElements=[n,s,a,o],this._container.appendChild(n),this._container.appendChild(s),this._container.appendChild(a),this._container.appendChild(o),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,n,s){e===this._font&&t===this._fontSize&&n===this._weight&&s===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=s,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${s}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${s}`,this.clear())}get(e,t,n){let s=0;if(!t&&!n&&e.length===1&&(s=e.charCodeAt(0))<256){if(this._flat[s]!==-9999)return this._flat[s];let c=this._measure(e,0);return c>0&&(this._flat[s]=c),c}let a=e;t&&(a+="B"),n&&(a+="I");let o=this._holey.get(a);if(o===void 0){let c=0;t&&(c|=1),n&&(c|=2),o=this._measure(e,c),o>0&&this._holey.set(a,o)}return o}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},gC=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,s=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let a=e.buffers.active.ydisp,o=t[1]-a,c=n[1]-a,f=Math.max(o,0),p=Math.min(c,e.rows-1);if(f>=e.rows||p<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=o,this.viewportEndRow=c,this.viewportCappedStartRow=f,this.viewportCappedEndRow=p,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function vC(){return new gC}var Jh="xterm-dom-renderer-owner-",Fi="xterm-rows",Vo="xterm-fg-",kv="xterm-bg-",Vl="xterm-focus",Ko="xterm-selection",yC=1,Gf=class extends Ae{constructor(e,t,n,s,a,o,c,f,p,h,g,m,S,v){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=s,this._viewportElement=a,this._helperContainer=o,this._linkifier2=c,this._charSizeService=p,this._optionsService=h,this._bufferService=g,this._coreService=m,this._coreBrowserService=S,this._themeService=v,this._terminalClass=yC++,this._rowElements=[],this._selectionRenderModel=vC(),this.onRequestRedraw=this._register(new ue).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Fi),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(Ko),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=_C(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(b=>this._injectCss(b))),this._injectCss(this._themeService.colors),this._rowFactory=f.createInstance($f,document),this._element.classList.add(Jh+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(b=>this._handleLinkHover(b))),this._register(this._linkifier2.onHideLinkUnderline(b=>this._handleLinkLeave(b))),this._register(rt(()=>{this._element.classList.remove(Jh+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new mC(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 n of this._rowElements)n.style.width=`${this.dimensions.css.canvas.width}px`,n.style.height=`${this.dimensions.css.cell.height}px`,n.style.lineHeight=`${this.dimensions.css.cell.height}px`,n.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${Fi} 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} .${Fi} { 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} .${Fi} .xterm-dim { color: ${it.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 n=`blink_underline_${this._terminalClass}`,s=`blink_bar_${this._terminalClass}`,a=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${s} { 50% { box-shadow: none; }}`,t+=`@keyframes ${a} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Fi}.${Vl} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Fi}.${Vl} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${Fi}.${Vl} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${a} 1s step-end infinite;}${this._terminalSelector} .${Fi} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Fi} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Fi} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Fi} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Fi} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Ko} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Ko} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Ko} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[o,c]of e.ansi.entries())t+=`${this._terminalSelector} .${Vo}${o} { color: ${c.css}; }${this._terminalSelector} .${Vo}${o}.xterm-dim { color: ${it.multiplyOpacity(c,.5).css}; }${this._terminalSelector} .${kv}${o} { background-color: ${c.css}; }`;t+=`${this._terminalSelector} .${Vo}257 { color: ${it.opaque(e.background).css}; }${this._terminalSelector} .${Vo}257.xterm-dim { color: ${it.multiplyOpacity(it.opaque(e.background),.5).css}; }${this._terminalSelector} .${kv}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let n=this._rowElements.length;n<=t;n++){let s=this._document.createElement("div");this._rowContainer.appendChild(s),this._rowElements.push(s)}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(Vl),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Vl),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let s=this._selectionRenderModel.viewportStartRow,a=this._selectionRenderModel.viewportEndRow,o=this._selectionRenderModel.viewportCappedStartRow,c=this._selectionRenderModel.viewportCappedEndRow,f=this._document.createDocumentFragment();if(n){let p=e[0]>t[0];f.appendChild(this._createSelectionElement(o,p?t[0]:e[0],p?e[0]:t[0],c-o+1))}else{let p=s===o?e[0]:0,h=o===a?t[0]:this._bufferService.cols;f.appendChild(this._createSelectionElement(o,p,h));let g=c-o-1;if(f.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,g)),o!==c){let m=a===c?t[0]:this._bufferService.cols;f.appendChild(this._createSelectionElement(c,0,m))}}this._selectionContainer.appendChild(f)}_createSelectionElement(e,t,n,s=1){let a=this._document.createElement("div"),o=t*this.dimensions.css.cell.width,c=this.dimensions.css.cell.width*(n-t);return o+c>this.dimensions.css.canvas.width&&(c=this.dimensions.css.canvas.width-o),a.style.height=`${s*this.dimensions.css.cell.height}px`,a.style.top=`${e*this.dimensions.css.cell.height}px`,a.style.left=`${o}px`,a.style.width=`${c}px`,a}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 n=this._bufferService.buffer,s=n.ybase+n.y,a=Math.min(n.x,this._bufferService.cols-1),o=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,c=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let p=e;p<=t;p++){let h=p+n.ydisp,g=this._rowElements[p],m=n.lines.get(h);if(!g||!m)break;g.replaceChildren(...this._rowFactory.createRow(m,h,h===s,c,f,a,o,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Jh}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,s,a,o){n<0&&(e=0),s<0&&(t=0);let c=this._bufferService.rows-1;n=Math.max(Math.min(n,c),0),s=Math.max(Math.min(s,c),0),a=Math.min(a,this._bufferService.cols);let f=this._bufferService.buffer,p=f.ybase+f.y,h=Math.min(f.x,a-1),g=this._optionsService.rawOptions.cursorBlink,m=this._optionsService.rawOptions.cursorStyle,S=this._optionsService.rawOptions.cursorInactiveStyle;for(let v=n;v<=s;++v){let b=v+f.ydisp,k=this._rowElements[v],B=f.lines.get(b);if(!k||!B)break;k.replaceChildren(...this._rowFactory.createRow(B,b,b===p,m,S,h,g,this.dimensions.css.cell.width,this._widthCache,o?v===n?e:0:-1,o?(v===s?t:a)-1:-1))}}};Gf=ht([fe(7,xd),fe(8,yu),fe(9,si),fe(10,ri),fe(11,Kr),fe(12,Nn),fe(13,Ks)],Gf);var Zf=class extends Ae{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new ue),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new bC(this._optionsService))}catch{this._measureStrategy=this._register(new SC(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())}};Zf=ht([fe(2,si)],Zf);var ES=class extends Ae{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)}},SC=class extends ES{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},bC=class extends ES{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}},xC=class extends Ae{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new wC(this._window)),this._onDprChange=this._register(new ue),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new ue),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(s=>this._screenDprMonitor.setWindow(s))),this._register(Yt.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(be(this._textarea,"focus",()=>this._isFocused=!0)),this._register(be(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}},wC=class extends Ae{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Ws),this._onDprChange=this._register(new ue),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(rt(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=be(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)}},CC=class extends Ae{constructor(){super(),this.linkProviders=[],this._register(rt(()=>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 Rd(e,t,n){let s=n.getBoundingClientRect(),a=e.getComputedStyle(n),o=parseInt(a.getPropertyValue("padding-left")),c=parseInt(a.getPropertyValue("padding-top"));return[t.clientX-s.left-o,t.clientY-s.top-c]}function kC(e,t,n,s,a,o,c,f,p){if(!o)return;let h=Rd(e,t,n);if(h)return h[0]=Math.ceil((h[0]+(p?c/2:0))/c),h[1]=Math.ceil(h[1]/f),h[0]=Math.min(Math.max(h[0],1),s+(p?1:0)),h[1]=Math.min(Math.max(h[1],1),a),h}var Qf=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,s,a){return kC(window,e,t,n,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,a)}getMouseReportCoords(e,t){let n=Rd(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};Qf=ht([fe(0,On),fe(1,yu)],Qf);var EC=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,n){this._rowCount=n,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=[]}},TS={};Ox(TS,{getSafariVersion:()=>AC,isChromeOS:()=>MS,isFirefox:()=>AS,isIpad:()=>DC,isIphone:()=>RC,isLegacyEdge:()=>TC,isLinux:()=>Md,isMac:()=>hu,isNode:()=>Su,isSafari:()=>DS,isWindows:()=>RS});var Su=typeof process<"u"&&"title"in process,va=Su?"node":navigator.userAgent,ya=Su?"node":navigator.platform,AS=va.includes("Firefox"),TC=va.includes("Edge"),DS=/^((?!chrome|android).)*safari/i.test(va);function AC(){if(!DS)return 0;let e=va.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var hu=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(ya),DC=ya==="iPad",RC=ya==="iPhone",RS=["Windows","Win16","Win32","WinCE"].includes(ya),Md=ya.indexOf("Linux")>=0,MS=/\bCrOS\b/.test(va),BS=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,n=0,s=e.timeRemaining(),a=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),a=e.timeRemaining(),n*1.5>a){s-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-t))}ms`),this._start();return}s=a}this.clear()}},MC=class extends BS{_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())}}},BC=class extends BS{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},fu=!Su&&"requestIdleCallback"in window?BC:MC,LC=class{constructor(){this._queue=new fu}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Jf=class extends Ae{constructor(e,t,n,s,a,o,c,f,p){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=s,this._coreService=a,this._coreBrowserService=f,this._renderer=this._register(new Ws),this._pausedResizeTask=new LC,this._observerDisposable=this._register(new Ws),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 ue),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new ue),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new ue),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new ue),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new EC((h,g)=>this._renderRows(h,g),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new zC(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(rt(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(c.onResize(()=>this._fullRefresh())),this._register(c.buffers.onBufferActivate(()=>{var h;return(h=this._renderer.value)==null?void 0:h.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(o.onDecorationRegistered(()=>this._fullRefresh())),this._register(o.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(c.cols,c.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(c.buffer.y,c.buffer.y,!0))),this._register(p.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(h=>this._registerIntersectionObserver(h,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let n=new e.IntersectionObserver(s=>this._handleIntersectionChange(s[s.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=rt(()=>n.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,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let s=this._syncOutputHandler.flush();s&&(e=Math.min(e,s.start),t=Math.max(t,s.end)),n||(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 n;return(n=this._renderer.value)==null?void 0:n.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,n){var s;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,(s=this._renderer.value)==null||s.handleSelectionChanged(e,t,n)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};Jf=ht([fe(2,si),fe(3,yu),fe(4,Kr),fe(5,ga),fe(6,ri),fe(7,Nn),fe(8,Ks)],Jf);var zC=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===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 NC(e,t,n,s){let a=n.buffer.x,o=n.buffer.y;if(!n.buffer.hasScrollback)return jC(a,o,e,t,n,s)+bu(o,t,n,s)+UC(a,o,e,t,n,s);let c;if(o===t)return c=a>e?"D":"C",ha(Math.abs(a-e),ca(c,s));c=o>t?"D":"C";let f=Math.abs(o-t),p=HC(o>t?e:a,n)+(f-1)*n.cols+1+OC(o>t?a:e);return ha(p,ca(c,s))}function OC(e,t){return e-1}function HC(e,t){return t.cols-e}function jC(e,t,n,s,a,o){return bu(t,s,a,o).length===0?"":ha(zS(e,t,e,t-Yr(t,a),!1,a).length,ca("D",o))}function bu(e,t,n,s){let a=e-Yr(e,n),o=t-Yr(t,n),c=Math.abs(a-o)-PC(e,t,n);return ha(c,ca(LS(e,t),s))}function UC(e,t,n,s,a,o){let c;bu(t,s,a,o).length>0?c=s-Yr(s,a):c=t;let f=s,p=IC(e,t,n,s,a,o);return ha(zS(e,c,n,f,p==="C",a).length,ca(p,o))}function PC(e,t,n){var c;let s=0,a=e-Yr(e,n),o=t-Yr(t,n);for(let f=0;f<Math.abs(a-o);f++){let p=LS(e,t)==="A"?-1:1;(c=n.buffer.lines.get(a+p*f))!=null&&c.isWrapped&&s++}return s}function Yr(e,t){let n=0,s=t.buffer.lines.get(e),a=s==null?void 0:s.isWrapped;for(;a&&e>=0&&e<t.rows;)n++,s=t.buffer.lines.get(--e),a=s==null?void 0:s.isWrapped;return n}function IC(e,t,n,s,a,o){let c;return bu(n,s,a,o).length>0?c=s-Yr(s,a):c=t,e<n&&c<=s||e>=n&&c<s?"C":"D"}function LS(e,t){return e>t?"A":"B"}function zS(e,t,n,s,a,o){let c=e,f=t,p="";for(;(c!==n||f!==s)&&f>=0&&f<o.buffer.lines.length;)c+=a?1:-1,a&&c>o.cols-1?(p+=o.buffer.translateBufferLineToString(f,!1,e,c),c=0,e=0,f++):!a&&c<0&&(p+=o.buffer.translateBufferLineToString(f,!1,0,e+1),c=o.cols-1,e=c,f--);return p+o.buffer.translateBufferLineToString(f,!1,e,c)}function ca(e,t){let n=t?"O":"[";return ie.ESC+n+e}function ha(e,t){e=Math.floor(e);let n="";for(let s=0;s<e;s++)n+=t;return n}var FC=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 Ev(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 ef=50,qC=15,WC=50,YC=500,VC=" ",KC=new RegExp(VC,"g"),ed=class extends Ae{constructor(e,t,n,s,a,o,c,f,p){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=s,this._coreService=a,this._mouseService=o,this._optionsService=c,this._renderService=f,this._coreBrowserService=p,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Vi,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new ue),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new ue),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new ue),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new ue),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=h=>this._handleMouseMove(h),this._mouseUpListener=h=>this._handleMouseUp(h),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(h=>this._handleTrim(h)),this._register(this._bufferService.buffers.onBufferActivate(h=>this._handleBufferActivate(h))),this.enable(),this._model=new FC(this._bufferService),this._activeSelectionMode=0,this._register(rt(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(h=>{h.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 n=this._bufferService.buffer,s=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let a=e[0]<t[0]?e[0]:t[0],o=e[0]<t[0]?t[0]:e[0];for(let c=e[1];c<=t[1];c++){let f=n.translateBufferLineToString(c,!0,a,o);s.push(f)}}else{let a=e[1]===t[1]?t[0]:void 0;s.push(n.translateBufferLineToString(e[1],!0,e[0],a));for(let o=e[1]+1;o<=t[1]-1;o++){let c=n.lines.get(o),f=n.translateBufferLineToString(o,!0);c!=null&&c.isWrapped?s[s.length-1]+=f:s.push(f)}if(e[1]!==t[1]){let o=n.lines.get(t[1]),c=n.translateBufferLineToString(t[1],!0,0,t[0]);o&&o.isWrapped?s[s.length-1]+=c:s.push(c)}}return s.map(a=>a.replace(KC," ")).join(RS?`\r
68
+ `))}},uw=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},cw=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},hw=0,$h=class{constructor(e){this.value=e,this.id=hw++}},fw=2,dw,ce=class{constructor(t){var n,s,a,o;this._size=0,this._options=t,this._leakageMon=(n=this._options)!=null&&n.leakWarningThreshold?new aw((t==null?void 0:t.onListenerError)??eu,((s=this._options)==null?void 0:s.leakWarningThreshold)??lw):void 0,this._perfMon=(a=this._options)!=null&&a._profName?new sw(this._options._profName):void 0,this._deliveryQueue=(o=this._options)==null?void 0:o.deliveryQueue}dispose(){var t,n,s,a;this._disposed||(this._disposed=!0,((t=this._deliveryQueue)==null?void 0:t.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(s=(n=this._options)==null?void 0:n.onDidRemoveLastListener)==null||s.call(n),(a=this._leakageMon)==null||a.dispose())}get event(){return this._event??(this._event=(t,n,s)=>{var f,p,h,g,_;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let S=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(S);let y=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],b=new cw(`${S}. HINT: Stack shows most frequent listener (${y[1]}-times)`,y[0]);return(((f=this._options)==null?void 0:f.onListenerError)||eu)(b),Ae.None}if(this._disposed)return Ae.None;n&&(t=t.bind(n));let a=new $h(t),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(a.stack=ow.create(),o=this._leakageMon.check(a.stack,this._size+1)),this._listeners?this._listeners instanceof $h?(this._deliveryQueue??(this._deliveryQueue=new pw),this._listeners=[this._listeners,a]):this._listeners.push(a):((h=(p=this._options)==null?void 0:p.onWillAddFirstListener)==null||h.call(p,this),this._listeners=a,(_=(g=this._options)==null?void 0:g.onDidAddFirstListener)==null||_.call(g,this)),this._size++;let c=rt(()=>{o==null||o(),this._removeListener(a)});return s instanceof _r?s.add(c):Array.isArray(s)&&s.push(c),c}),this._event}_removeListener(t){var o,c,f,p;if((c=(o=this._options)==null?void 0:o.onWillRemoveListener)==null||c.call(o,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(p=(f=this._options)==null?void 0:f.onDidRemoveLastListener)==null||p.call(f,this),this._size=0;return}let n=this._listeners,s=n.indexOf(t);if(s===-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--,n[s]=void 0;let a=this._deliveryQueue.current===this;if(this._size*fw<=n.length){let h=0;for(let g=0;g<n.length;g++)n[g]?n[h++]=n[g]:a&&(this._deliveryQueue.end--,h<this._deliveryQueue.i&&this._deliveryQueue.i--);n.length=h}}_deliver(t,n){var a;if(!t)return;let s=((a=this._options)==null?void 0:a.onListenerError)||eu;if(!s){t.value(n);return}try{t.value(n)}catch(o){s(o)}}_deliverQueue(t){let n=t.current._listeners;for(;t.i<t.end;)this._deliver(n[t.i++],t.value);t.reset()}fire(t){var n,s,a,o;if((n=this._deliveryQueue)!=null&&n.current&&(this._deliverQueue(this._deliveryQueue),(s=this._perfMon)==null||s.stop()),(a=this._perfMon)==null||a.start(this._size),this._listeners)if(this._listeners instanceof $h)this._deliver(this._listeners,t);else{let c=this._deliveryQueue;c.enqueue(this,t,this._listeners.length),this._deliverQueue(c)}(o=this._perfMon)==null||o.stop()}hasListeners(){return this._size>0}},pw=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},jf=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new ce,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new ce,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,n){if(this.getZoomLevel(n)===t)return;let s=this.getWindowId(n);this.mapWindowIdToZoomLevel.set(s,t),this._onDidChangeZoomLevel.fire(s)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,n){this.mapWindowIdToZoomFactor.set(this.getWindowId(n),t)}setFullscreen(t,n){if(this.isFullscreen(n)===t)return;let s=this.getWindowId(n);this.mapWindowIdToFullScreen.set(s,t),this._onDidChangeFullscreen.fire(s)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};jf.INSTANCE=new jf;var Cd=jf;function mw(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}Cd.INSTANCE.onDidChangeZoomLevel;function _w(e){return Cd.INSTANCE.getZoomFactor(e)}Cd.INSTANCE.onDidChangeFullscreen;var Xs=typeof navigator=="object"?navigator.userAgent:"",Uf=Xs.indexOf("Firefox")>=0,gw=Xs.indexOf("AppleWebKit")>=0,kd=Xs.indexOf("Chrome")>=0,vw=!kd&&Xs.indexOf("Safari")>=0;Xs.indexOf("Electron/")>=0;Xs.indexOf("Android")>=0;var Gh=!1;if(typeof zn.matchMedia=="function"){let e=zn.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=zn.matchMedia("(display-mode: fullscreen)");Gh=e.matches,mw(zn,e,({matches:n})=>{Gh&&t.matches||(Gh=n)})}var Fs="en",Pf=!1,If=!1,tu=!1,gS=!1,qo,iu=Fs,uv=Fs,yw,Zi,qr=globalThis,Wt,Ky;typeof qr.vscode<"u"&&typeof qr.vscode.process<"u"?Wt=qr.vscode.process:typeof process<"u"&&typeof((Ky=process==null?void 0:process.versions)==null?void 0:Ky.node)=="string"&&(Wt=process);var Xy,Sw=typeof((Xy=Wt==null?void 0:Wt.versions)==null?void 0:Xy.electron)=="string",bw=Sw&&(Wt==null?void 0:Wt.type)==="renderer",$y;if(typeof Wt=="object"){Pf=Wt.platform==="win32",If=Wt.platform==="darwin",tu=Wt.platform==="linux",tu&&Wt.env.SNAP&&Wt.env.SNAP_REVISION,Wt.env.CI||Wt.env.BUILD_ARTIFACTSTAGINGDIRECTORY,qo=Fs,iu=Fs;let e=Wt.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);qo=t.userLocale,uv=t.osLocale,iu=t.resolvedLanguage||Fs,yw=($y=t.languagePack)==null?void 0:$y.translationsConfigFile}catch{}gS=!0}else typeof navigator=="object"&&!bw?(Zi=navigator.userAgent,Pf=Zi.indexOf("Windows")>=0,If=Zi.indexOf("Macintosh")>=0,(Zi.indexOf("Macintosh")>=0||Zi.indexOf("iPad")>=0||Zi.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,tu=Zi.indexOf("Linux")>=0,(Zi==null?void 0:Zi.indexOf("Mobi"))>=0,iu=globalThis._VSCODE_NLS_LANGUAGE||Fs,qo=navigator.language.toLowerCase(),uv=qo):console.error("Unable to resolve platform.");var vS=Pf,un=If,xw=tu,cv=gS,cn=Zi,ur=iu,ww;(e=>{function t(){return ur}e.value=t;function n(){return ur.length===2?ur==="en":ur.length>=3?ur[0]==="e"&&ur[1]==="n"&&ur[2]==="-":!1}e.isDefaultVariant=n;function s(){return ur==="en"}e.isDefault=s})(ww||(ww={}));var Cw=typeof qr.postMessage=="function"&&!qr.importScripts;(()=>{if(Cw){let e=[];qr.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let s=0,a=e.length;s<a;s++){let o=e[s];if(o.id===n.data.vscodeScheduleAsyncWork){e.splice(s,1),o.callback();return}}});let t=0;return n=>{let s=++t;e.push({id:s,callback:n}),qr.postMessage({vscodeScheduleAsyncWork:s},"*")}}return e=>setTimeout(e)})();var kw=!!(cn&&cn.indexOf("Chrome")>=0);cn&&cn.indexOf("Firefox")>=0;!kw&&cn&&cn.indexOf("Safari")>=0;cn&&cn.indexOf("Edg/")>=0;cn&&cn.indexOf("Android")>=0;var Hs=typeof navigator=="object"?navigator:{};cv||document.queryCommandSupported&&document.queryCommandSupported("copy")||Hs&&Hs.clipboard&&Hs.clipboard.writeText,cv||Hs&&Hs.clipboard&&Hs.clipboard.readText;var Ed=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}},Zh=new Ed,hv=new Ed,fv=new Ed,Ew=new Array(230),yS;(e=>{function t(f){return Zh.keyCodeToStr(f)}e.toString=t;function n(f){return Zh.strToKeyCode(f)}e.fromString=n;function s(f){return hv.keyCodeToStr(f)}e.toUserSettingsUS=s;function a(f){return fv.keyCodeToStr(f)}e.toUserSettingsGeneral=a;function o(f){return hv.strToKeyCode(f)||fv.strToKeyCode(f)}e.fromUserSettings=o;function c(f){if(f>=98&&f<=113)return null;switch(f){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Zh.keyCodeToStr(f)}e.toElectronAccelerator=c})(yS||(yS={}));var Tw=class SS{constructor(t,n,s,a,o){this.ctrlKey=t,this.shiftKey=n,this.altKey=s,this.metaKey=a,this.keyCode=o}equals(t){return t instanceof SS&&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",n=this.shiftKey?"1":"0",s=this.altKey?"1":"0",a=this.metaKey?"1":"0";return`K${t}${n}${s}${a}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new Aw([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},Aw=class{constructor(e){if(e.length===0)throw Jx("chords");this.chords=e}getHashCode(){let e="";for(let t=0,n=this.chords.length;t<n;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 Dw(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return yS.fromString(n)}let t=e.keyCode;if(t===3)return 7;if(Uf)switch(t){case 59:return 85;case 60:if(xw)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(un)return 57;break}else if(gw&&(un&&t===93||!un&&t===92))return 57;return Ew[t]||0}var Rw=un?256:2048,Mw=512,Bw=1024,Lw=un?2048:256,dv=class{constructor(e){var n;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=(n=t.getModifierState)==null?void 0:n.call(t,"AltGraph"),this.keyCode=Dw(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|=Rw),this.altKey&&(t|=Mw),this.shiftKey&&(t|=Bw),this.metaKey&&(t|=Lw),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new Tw(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},pv=new WeakMap;function zw(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!=="null"&&n.origin!=="null"&&t.origin!==n.origin)return null}catch{return null}return e.parent}var Nw=class{static getSameOriginWindowChain(e){let t=pv.get(e);if(!t){t=[],pv.set(e,t);let n=e,s;do s=zw(n),s?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=s;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,s=0,a=this.getSameOriginWindowChain(e);for(let o of a){let c=o.window.deref();if(n+=(c==null?void 0:c.scrollY)??0,s+=(c==null?void 0:c.scrollX)??0,c===t||!o.iframeElement)break;let f=o.iframeElement.getBoundingClientRect();n+=f.top,s+=f.left}return{top:n,left:s}}},Wo=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 n=Nw.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},mv=class{constructor(e,t=0,n=0){var a;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let s=!1;if(kd){let o=navigator.userAgent.match(/Chrome\/(\d+)/);s=(o?parseInt(o[1]):123)<=122}if(e){let o=e,c=e,f=((a=e.view)==null?void 0:a.devicePixelRatio)||1;if(typeof o.wheelDeltaY<"u")s?this.deltaY=o.wheelDeltaY/(120*f):this.deltaY=o.wheelDeltaY/120;else if(typeof c.VERTICAL_AXIS<"u"&&c.axis===c.VERTICAL_AXIS)this.deltaY=-c.detail/3;else if(e.type==="wheel"){let p=e;p.deltaMode===p.DOM_DELTA_LINE?Uf&&!un?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof o.wheelDeltaX<"u")vw&&vS?this.deltaX=-(o.wheelDeltaX/120):s?this.deltaX=o.wheelDeltaX/(120*f):this.deltaX=o.wheelDeltaX/120;else if(typeof c.HORIZONTAL_AXIS<"u"&&c.axis===c.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let p=e;p.deltaMode===p.DOM_DELTA_LINE?Uf&&!un?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(s?this.deltaY=e.wheelDelta/(120*f):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},bS=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),Ow;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof Hw?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Yt.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:bS})})(Ow||(Ow={}));var Hw=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?bS:(this._emitter||(this._emitter=new ce),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Td=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 Lf("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Lf("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},jw=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,n=globalThis){if(this.isDisposed)throw new Lf("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let s=n.setInterval(()=>{e()},t);this.disposable=rt(()=>{n.clearInterval(s),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},Uw;(e=>{async function t(s){let a,o=await Promise.all(s.map(c=>c.then(f=>f,f=>{a||(a=f)})));if(typeof a<"u")throw a;return o}e.settled=t;function n(s){return new Promise(async(a,o)=>{try{await s(a,o)}catch(c){o(c)}})}e.withAsyncBody=n})(Uw||(Uw={}));var _v=class qi{static fromArray(t){return new qi(n=>{n.emitMany(t)})}static fromPromise(t){return new qi(async n=>{n.emitMany(await t)})}static fromPromises(t){return new qi(async n=>{await Promise.all(t.map(async s=>n.emitOne(await s)))})}static merge(t){return new qi(async n=>{await Promise.all(t.map(async s=>{for await(let a of s)n.emitOne(a)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new ce,queueMicrotask(async()=>{let s={emitOne:a=>this.emitOne(a),emitMany:a=>this.emitMany(a),reject:a=>this.reject(a)};try{await Promise.resolve(t(s)),this.resolve()}catch(a){this.reject(a)}finally{s.emitOne=void 0,s.emitMany=void 0,s.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 Yt.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var n;return(n=this._onReturn)==null||n.call(this),{done:!0,value:void 0}}}}static map(t,n){return new qi(async s=>{for await(let a of t)s.emitOne(n(a))})}map(t){return qi.map(this,t)}static filter(t,n){return new qi(async s=>{for await(let a of t)n(a)&&s.emitOne(a)})}filter(t){return qi.filter(this,t)}static coalesce(t){return qi.filter(t,n=>!!n)}coalesce(){return qi.coalesce(this)}static async toPromise(t){let n=[];for await(let s of t)n.push(s);return n}toPromise(){return qi.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())}};_v.EMPTY=_v.fromArray([]);var{getWindow:on,getWindowId:Pw,onDidRegisterWindow:Iw}=(function(){let e=new Map,t={window:zn,disposables:new _r};e.set(zn.vscodeWindowId,t);let n=new ce,s=new ce,a=new ce;function o(c,f){return(typeof c=="number"?e.get(c):void 0)??(f?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:a.event,onDidUnregisterWindow:s.event,registerWindow(c){if(e.has(c.vscodeWindowId))return Ae.None;let f=new _r,p={window:c,disposables:f.add(new _r)};return e.set(c.vscodeWindowId,p),f.add(rt(()=>{e.delete(c.vscodeWindowId),s.fire(c)})),f.add(be(c,Dt.BEFORE_UNLOAD,()=>{a.fire(c)})),n.fire(p),f},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(c){return c.vscodeWindowId},hasWindow(c){return e.has(c)},getWindowById:o,getWindow(c){var h;let f=c;if((h=f==null?void 0:f.ownerDocument)!=null&&h.defaultView)return f.ownerDocument.defaultView.window;let p=c;return p!=null&&p.view?p.view.window:zn},getDocument(c){return on(c).document}}})(),Fw=class{constructor(e,t,n,s){this._node=e,this._type=t,this._handler=n,this._options=s||!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 be(e,t,n,s){return new Fw(e,t,n,s)}var gv=function(e,t,n,s){return be(e,t,n,s)},Ad,qw=class extends jw{constructor(e){super(),this.defaultTarget=e&&on(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},vv=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){eu(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,s=new Map,a=o=>{n.set(o,!1);let c=e.get(o)??[];for(t.set(o,c),e.set(o,[]),s.set(o,!0);c.length>0;)c.sort(vv.sort),c.shift().execute();s.set(o,!1)};Ad=(o,c,f=0)=>{let p=Pw(o),h=new vv(c,f),g=e.get(p);return g||(g=[],e.set(p,g)),g.push(h),n.get(p)||(n.set(p,!0),o.requestAnimationFrame(()=>a(p))),h}})();function Ww(e){let t=e.getBoundingClientRect(),n=on(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}var Dt={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"},Yw=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=mi(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=mi(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=mi(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=mi(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=mi(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=mi(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=mi(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=mi(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=mi(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=mi(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=mi(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=mi(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=mi(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=mi(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 mi(e){return typeof e=="number"?`${e}px`:e}function la(e){return new Yw(e)}var xS=class{constructor(){this._hooks=new _r,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 n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,s,a){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=s,this._onStopCallback=a;let o=e;try{e.setPointerCapture(t),this._hooks.add(rt(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{o=on(e)}this._hooks.add(be(o,Dt.POINTER_MOVE,c=>{if(c.buttons!==n){this.stopMonitoring(!0);return}c.preventDefault(),this._pointerMoveCallback(c)})),this._hooks.add(be(o,Dt.POINTER_UP,c=>this.stopMonitoring(!0)))}};function Vw(e,t,n){let s=null,a=null;if(typeof n.value=="function"?(s="value",a=n.value,a.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof n.get=="function"&&(s="get",a=n.get),!a)throw new Error("not supported");let o=`$memoize$${t}`;n[s]=function(...c){return this.hasOwnProperty(o)||Object.defineProperty(this,o,{configurable:!1,enumerable:!1,writable:!1,value:a.apply(this,c)}),this[o]}}var ln;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(ln||(ln={}));var ta=class Kt extends Ae{constructor(){super(),this.dispatched=!1,this.targets=new ov,this.ignoreTargets=new ov,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Yt.runAndSubscribe(Iw,({window:t,disposables:n})=>{n.add(be(t.document,"touchstart",s=>this.onTouchStart(s),{passive:!1})),n.add(be(t.document,"touchend",s=>this.onTouchEnd(t,s))),n.add(be(t.document,"touchmove",s=>this.onTouchMove(s),{passive:!1}))},{window:zn,disposables:this._store}))}static addTarget(t){if(!Kt.isTouchDevice())return Ae.None;Kt.INSTANCE||(Kt.INSTANCE=new Kt);let n=Kt.INSTANCE.targets.push(t);return rt(n)}static ignoreTarget(t){if(!Kt.isTouchDevice())return Ae.None;Kt.INSTANCE||(Kt.INSTANCE=new Kt);let n=Kt.INSTANCE.ignoreTargets.push(t);return rt(n)}static isTouchDevice(){return"ontouchstart"in zn||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let n=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let s=0,a=t.targetTouches.length;s<a;s++){let o=t.targetTouches.item(s);this.activeTouches[o.identifier]={id:o.identifier,initialTarget:o.target,initialTimeStamp:n,initialPageX:o.pageX,initialPageY:o.pageY,rollingTimestamps:[n],rollingPageX:[o.pageX],rollingPageY:[o.pageY]};let c=this.newGestureEvent(ln.Start,o.target);c.pageX=o.pageX,c.pageY=o.pageY,this.dispatchEvent(c)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,n){let s=Date.now(),a=Object.keys(this.activeTouches).length;for(let o=0,c=n.changedTouches.length;o<c;o++){let f=n.changedTouches.item(o);if(!this.activeTouches.hasOwnProperty(String(f.identifier))){console.warn("move of an UNKNOWN touch",f);continue}let p=this.activeTouches[f.identifier],h=Date.now()-p.initialTimeStamp;if(h<Kt.HOLD_DELAY&&Math.abs(p.initialPageX-Ti(p.rollingPageX))<30&&Math.abs(p.initialPageY-Ti(p.rollingPageY))<30){let g=this.newGestureEvent(ln.Tap,p.initialTarget);g.pageX=Ti(p.rollingPageX),g.pageY=Ti(p.rollingPageY),this.dispatchEvent(g)}else if(h>=Kt.HOLD_DELAY&&Math.abs(p.initialPageX-Ti(p.rollingPageX))<30&&Math.abs(p.initialPageY-Ti(p.rollingPageY))<30){let g=this.newGestureEvent(ln.Contextmenu,p.initialTarget);g.pageX=Ti(p.rollingPageX),g.pageY=Ti(p.rollingPageY),this.dispatchEvent(g)}else if(a===1){let g=Ti(p.rollingPageX),_=Ti(p.rollingPageY),S=Ti(p.rollingTimestamps)-p.rollingTimestamps[0],y=g-p.rollingPageX[0],b=_-p.rollingPageY[0],k=[...this.targets].filter(R=>p.initialTarget instanceof Node&&R.contains(p.initialTarget));this.inertia(t,k,s,Math.abs(y)/S,y>0?1:-1,g,Math.abs(b)/S,b>0?1:-1,_)}this.dispatchEvent(this.newGestureEvent(ln.End,p.initialTarget)),delete this.activeTouches[f.identifier]}this.dispatched&&(n.preventDefault(),n.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,n){let s=document.createEvent("CustomEvent");return s.initEvent(t,!1,!0),s.initialTarget=n,s.tapCount=0,s}dispatchEvent(t){if(t.type===ln.Tap){let n=new Date().getTime(),s=0;n-this._lastSetTapCountTime>Kt.CLEAR_TAP_COUNT_TIME?s=1:s=2,this._lastSetTapCountTime=n,t.tapCount=s}else(t.type===ln.Change||t.type===ln.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let s of this.ignoreTargets)if(s.contains(t.initialTarget))return;let n=[];for(let s of this.targets)if(s.contains(t.initialTarget)){let a=0,o=t.initialTarget;for(;o&&o!==s;)a++,o=o.parentElement;n.push([a,s])}n.sort((s,a)=>s[0]-a[0]);for(let[s,a]of n)a.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,s,a,o,c,f,p,h){this.handle=Ad(t,()=>{let g=Date.now(),_=g-s,S=0,y=0,b=!0;a+=Kt.SCROLL_FRICTION*_,f+=Kt.SCROLL_FRICTION*_,a>0&&(b=!1,S=o*a*_),f>0&&(b=!1,y=p*f*_);let k=this.newGestureEvent(ln.Change);k.translationX=S,k.translationY=y,n.forEach(R=>R.dispatchEvent(k)),b||this.inertia(t,n,g,a,o,c+S,f,p,h+y)})}onTouchMove(t){let n=Date.now();for(let s=0,a=t.changedTouches.length;s<a;s++){let o=t.changedTouches.item(s);if(!this.activeTouches.hasOwnProperty(String(o.identifier))){console.warn("end of an UNKNOWN touch",o);continue}let c=this.activeTouches[o.identifier],f=this.newGestureEvent(ln.Change,c.initialTarget);f.translationX=o.pageX-Ti(c.rollingPageX),f.translationY=o.pageY-Ti(c.rollingPageY),f.pageX=o.pageX,f.pageY=o.pageY,this.dispatchEvent(f),c.rollingPageX.length>3&&(c.rollingPageX.shift(),c.rollingPageY.shift(),c.rollingTimestamps.shift()),c.rollingPageX.push(o.pageX),c.rollingPageY.push(o.pageY),c.rollingTimestamps.push(n)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};ta.SCROLL_FRICTION=-.005,ta.HOLD_DELAY=700,ta.CLEAR_TAP_COUNT_TIME=400,ht([Vw],ta,"isTouchDevice",1);var Kw=ta,Dd=class extends Ae{onclick(e,t){this._register(be(e,Dt.CLICK,n=>t(new Wo(on(e),n))))}onmousedown(e,t){this._register(be(e,Dt.MOUSE_DOWN,n=>t(new Wo(on(e),n))))}onmouseover(e,t){this._register(be(e,Dt.MOUSE_OVER,n=>t(new Wo(on(e),n))))}onmouseleave(e,t){this._register(be(e,Dt.MOUSE_LEAVE,n=>t(new Wo(on(e),n))))}onkeydown(e,t){this._register(be(e,Dt.KEY_DOWN,n=>t(new dv(n))))}onkeyup(e,t){this._register(be(e,Dt.KEY_UP,n=>t(new dv(n))))}oninput(e,t){this._register(be(e,Dt.INPUT,t))}onblur(e,t){this._register(be(e,Dt.BLUR,t))}onfocus(e,t){this._register(be(e,Dt.FOCUS,t))}onchange(e,t){this._register(be(e,Dt.CHANGE,t))}ignoreGesture(e){return Kw.ignoreTarget(e)}},yv=11,Xw=class extends Dd{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=yv+"px",this.domNode.style.height=yv+"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 xS),this._register(gv(this.bgDomNode,Dt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(gv(this.domNode,Dt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new qw),this._pointerdownScheduleRepeatTimer=this._register(new Td)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,on(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},$w=class Ff{constructor(t,n,s,a,o,c,f){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(n=n|0,s=s|0,a=a|0,o=o|0,c=c|0,f=f|0),this.rawScrollLeft=a,this.rawScrollTop=f,n<0&&(n=0),a+n>s&&(a=s-n),a<0&&(a=0),o<0&&(o=0),f+o>c&&(f=c-o),f<0&&(f=0),this.width=n,this.scrollWidth=s,this.scrollLeft=a,this.height=o,this.scrollHeight=c,this.scrollTop=f}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,n){return new Ff(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new Ff(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,n){let s=this.width!==t.width,a=this.scrollWidth!==t.scrollWidth,o=this.scrollLeft!==t.scrollLeft,c=this.height!==t.height,f=this.scrollHeight!==t.scrollHeight,p=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:n,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:s,scrollWidthChanged:a,scrollLeftChanged:o,heightChanged:c,scrollHeightChanged:f,scrollTopChanged:p}}},Gw=class extends Ae{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new ce),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new $w(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 s;let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),(s=this._smoothScrolling)==null||s.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 n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let s;t?s=new bv(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):s=this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=s}else{let n=this._state.withScrollPosition(e);this._smoothScrolling=bv.start(this._state,n,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 n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},Sv=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function Qh(e,t){let n=t-e;return function(s){return e+n*Jw(s)}}function Zw(e,t,n){return function(s){return s<n?e(s/n):t((s-n)/(1-n))}}var bv=class qf{constructor(t,n,s,a){this.from=t,this.to=n,this.duration=a,this.startTime=s,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,n,s){if(Math.abs(t-n)>2.5*s){let a,o;return t<n?(a=t+.75*s,o=n-.75*s):(a=t-.75*s,o=n+.75*s),Zw(Qh(t,a),Qh(o,n),.33)}return Qh(t,n)}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 n=(t-this.startTime)/this.duration;if(n<1){let s=this.scrollLeft(n),a=this.scrollTop(n);return new Sv(s,a,!1)}return new Sv(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,s){return qf.start(t,n,s)}static start(t,n,s){s=s+10;let a=Date.now()-10;return new qf(t,n,a,s)}};function Qw(e){return Math.pow(e,3)}function Jw(e){return 1-Qw(1-e)}var eC=class extends Ae{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new Td)}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":"")))}},tC=140,wS=class extends Dd{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 eC(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new xS),this._shouldRender=!0,this.domNode=la(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(be(this.domNode.domNode,Dt.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new Xw(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,s){this.slider=la(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof n=="number"&&this.slider.setWidth(n),typeof s=="number"&&this.slider.setHeight(s),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(be(this.slider.domNode,Dt.POINTER_DOWN,a=>{a.button===0&&(a.preventDefault(),this._sliderPointerDown(a))})),this.onclick(this.slider.domNode,a=>{a.leftButton&&a.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,n=t+this._scrollbarState.getSliderPosition(),s=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),a=this._sliderPointerPosition(e);n<=a&&a<=s?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,n=e.offsetY;else{let a=Ww(this.domNode.domNode);t=e.pageX-a.left,n=e.pageY-a.top}let s=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(s):this._scrollbarState.getDesiredScrollPositionFromOffset(s)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),s=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,a=>{let o=this._sliderOrthogonalPointerPosition(a),c=Math.abs(o-n);if(vS&&c>tC){this._setDesiredScrollPositionNow(s.getScrollPosition());return}let f=this._sliderPointerPosition(a)-t;this._setDesiredScrollPositionNow(s.getDesiredScrollPositionFromDelta(f))},()=>{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()}},CS=class Wf{constructor(t,n,s,a,o,c){this._scrollbarSize=Math.round(n),this._oppositeScrollbarSize=Math.round(s),this._arrowSize=Math.round(t),this._visibleSize=a,this._scrollSize=o,this._scrollPosition=c,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new Wf(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let n=Math.round(t);return this._visibleSize!==n?(this._visibleSize=n,this._refreshComputedValues(),!0):!1}setScrollSize(t){let n=Math.round(t);return this._scrollSize!==n?(this._scrollSize=n,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let n=Math.round(t);return this._scrollPosition!==n?(this._scrollPosition=n,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,n,s,a,o){let c=Math.max(0,s-t),f=Math.max(0,c-2*n),p=a>0&&a>s;if(!p)return{computedAvailableSize:Math.round(c),computedIsNeeded:p,computedSliderSize:Math.round(f),computedSliderRatio:0,computedSliderPosition:0};let h=Math.round(Math.max(20,Math.floor(s*f/a))),g=(f-h)/(a-s),_=o*g;return{computedAvailableSize:Math.round(c),computedIsNeeded:p,computedSliderSize:Math.round(h),computedSliderRatio:g,computedSliderPosition:Math.round(_)}}_refreshComputedValues(){let t=Wf._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 n=t-this._arrowSize-this._computedSliderSize/2;return Math.round(n/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize,s=this._scrollPosition;return n<this._computedSliderPosition?s-=this._visibleSize:s+=this._visibleSize,s}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let n=this._computedSliderPosition+t;return Math.round(n/this._computedSliderRatio)}},iC=class extends wS{constructor(e,t,n){let s=e.getScrollDimensions(),a=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new CS(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,s.width,s.scrollWidth,a.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}},nC=class extends wS{constructor(e,t,n){let s=e.getScrollDimensions(),a=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new CS(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,s.height,s.scrollHeight,a.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}},rC=500,xv=50,sC=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},Yf=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,n=0,s=1,a=this._rear;do{let o=a===this._front?t:Math.pow(2,-s);if(t-=o,n+=this._memory[a].score*o,a===this._front)break;a=(this._capacity+a-1)%this._capacity,s++}while(!0);return n<=.5}acceptStandardWheelEvent(t){if(kd){let n=on(t.browserEvent),s=_w(n);this.accept(Date.now(),t.deltaX*s,t.deltaY*s)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,n,s){let a=null,o=new sC(t,n,s);this._front===-1&&this._rear===-1?(this._memory[0]=o,this._front=0,this._rear=0):(a=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]=o),o.score=this._computeScore(o,a)}_computeScore(t,n){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let s=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(s+=.25),n){let a=Math.abs(t.deltaX),o=Math.abs(t.deltaY),c=Math.abs(n.deltaX),f=Math.abs(n.deltaY),p=Math.max(Math.min(a,c),1),h=Math.max(Math.min(o,f),1),g=Math.max(a,c),_=Math.max(o,f);g%p===0&&_%h===0&&(s-=.5)}return Math.min(Math.max(s,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};Yf.INSTANCE=new Yf;var lC=Yf,aC=class extends Dd{constructor(e,t,n){super(),this._onScroll=this._register(new ce),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new ce),this.onWillScroll=this._onWillScroll.event,this._options=uC(t),this._scrollable=n,this._register(this._scrollable.onScroll(a=>{this._onWillScroll.fire(a),this._onDidScroll(a),this._onScroll.fire(a)}));let s={onMouseWheel:a=>this._onMouseWheel(a),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new nC(this._scrollable,this._options,s)),this._horizontalScrollbar=this._register(new iC(this._scrollable,this._options,s)),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=la(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=la(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=la(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,a=>this._onMouseOver(a)),this.onmouseleave(this._listenOnDomNode,a=>this._onMouseLeave(a)),this._hideTimeout=this._register(new Td),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Wr(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,un&&(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 mv(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Wr(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new mv(n))};this._mouseWheelToDispose.push(be(this._listenOnDomNode,Dt.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var a;if((a=e.browserEvent)!=null&&a.defaultPrevented)return;let t=lC.INSTANCE;t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let o=e.deltaY*this._options.mouseWheelScrollSensitivity,c=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&c+o===0?c=o=0:Math.abs(o)>=Math.abs(c)?c=0:o=0),this._options.flipAxes&&([o,c]=[c,o]);let f=!un&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||f)&&!c&&(c=o,o=0),e.browserEvent&&e.browserEvent.altKey&&(c=c*this._options.fastScrollSensitivity,o=o*this._options.fastScrollSensitivity);let p=this._scrollable.getFutureScrollPosition(),h={};if(o){let g=xv*o,_=p.scrollTop-(g<0?Math.floor(g):Math.ceil(g));this._verticalScrollbar.writeScrollPosition(h,_)}if(c){let g=xv*c,_=p.scrollLeft-(g<0?Math.floor(g):Math.ceil(g));this._horizontalScrollbar.writeScrollPosition(h,_)}h=this._scrollable.validateScrollPosition(h),(p.scrollLeft!==h.scrollLeft||p.scrollTop!==h.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(h):this._scrollable.setScrollPositionNow(h),n=!0)}let s=n;!s&&this._options.alwaysConsumeMouseWheel&&(s=!0),!s&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(s=!0),s&&(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,n=e.scrollLeft>0,s=n?" left":"",a=t?" top":"",o=n||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${s}`),this._topShadowDomNode.setClassName(`shadow${a}`),this._topLeftShadowDomNode.setClassName(`shadow${o}${a}${s}`)}}_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(),rC)}},oC=class extends aC{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function uC(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,un&&(t.className+=" mac"),t}var Vf=class extends Ae{constructor(e,t,n,s,a,o,c,f){super(),this._bufferService=n,this._optionsService=c,this._renderService=f,this._onRequestScrollLines=this._register(new ce),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let p=this._register(new Gw({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:h=>Ad(s.window,h)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{p.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new oC(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},p)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(a.onProtocolChange(h=>{this._scrollableElement.updateOptions({handleMouseWheel:!(h&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Yt.runAndSubscribe(o.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(rt(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=s.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(rt(()=>this._styleElement.remove())),this._register(Yt.runAndSubscribe(o.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${o.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${o.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${o.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
69
+ `)})),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(h=>this._handleScroll(h)))}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),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};Vf=ht([de(2,ri),de(3,Nn),de(4,rS),de(5,Ks),de(6,si),de(7,On)],Vf);var Kf=class extends Ae{constructor(e,t,n,s,a){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=s,this._renderService=a,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(o=>this._removeDecoration(o))),this._register(rt(()=>{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 s;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((s=e==null?void 0:e.options)==null?void 0:s.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 n=e.options.x??0;return n&&n>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 n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var t;(t=this._decorationElements.get(e))==null||t.remove(),this._decorationElements.delete(e),e.dispose()}};Kf=ht([de(1,ri),de(2,Nn),de(3,ga),de(4,On)],Kf);var cC=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,n){return t>=e.startBufferLine-this._linePadding[n||"full"]&&t<=e.endBufferLine+this._linePadding[n||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},rn={full:0,left:0,center:0,right:0},cr={full:0,left:0,center:0,right:0},Yl={full:0,left:0,center:0,right:0},uu=class extends Ae{constructor(e,t,n,s,a,o,c,f){var h;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=s,this._renderService=a,this._optionsService=o,this._themeService=c,this._coreBrowserService=f,this._colorZoneStore=new cC,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(),(h=this._viewportElement.parentElement)==null||h.insertBefore(this._canvas,this._viewportElement),this._register(rt(()=>{var g;return(g=this._canvas)==null?void 0:g.remove()}));let p=this._canvas.getContext("2d");if(p)this._ctx=p;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);cr.full=this._canvas.width,cr.left=e,cr.center=t,cr.right=e,this._refreshDrawHeightConstants(),Yl.full=1,Yl.left=1,Yl.center=1+cr.left,Yl.right=1+cr.left+cr.center}_refreshDrawHeightConstants(){rn.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);rn.left=t,rn.center=t,rn.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*rn.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*rn.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*rn.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*rn.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(Yl[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-rn[e.position||"full"]/2),cr[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+rn[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}))}};uu=ht([de(2,ri),de(3,ga),de(4,On),de(5,si),de(6,Ks),de(7,Nn)],uu);var ne;(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=`
70
+ `,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=""))(ne||(ne={}));var nu;(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="Ÿ"))(nu||(nu={}));var kS;(e=>e.ST=`${ne.ESC}\\`)(kS||(kS={}));var Xf=class{constructor(e,t,n,s,a,o){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=s,this._coreService=a,this._renderService=o,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 n;t.start+=this._dataAlreadySent.length,this._isComposing?n=this._textarea.value.substring(t.start,this._compositionPosition.start):n=this._textarea.value.substring(t.start),n.length>0&&this._coreService.triggerDataEvent(n,!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,n=t.replace(e,"");this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${ne.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),n=this._renderService.dimensions.css.cell.height,s=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,a=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=a+"px",this._compositionView.style.top=s+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let o=this._compositionView.getBoundingClientRect();this._textarea.style.left=a+"px",this._textarea.style.top=s+"px",this._textarea.style.width=Math.max(o.width,1)+"px",this._textarea.style.height=Math.max(o.height,1)+"px",this._textarea.style.lineHeight=o.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};Xf=ht([de(2,ri),de(3,si),de(4,Kr),de(5,On)],Xf);var Rt=0,Mt=0,Bt=0,ut=0,wv={css:"#00000000",rgba:0},bt;(e=>{function t(a,o,c,f){return f!==void 0?`#${Or(a)}${Or(o)}${Or(c)}${Or(f)}`:`#${Or(a)}${Or(o)}${Or(c)}`}e.toCss=t;function n(a,o,c,f=255){return(a<<24|o<<16|c<<8|f)>>>0}e.toRgba=n;function s(a,o,c,f){return{css:e.toCss(a,o,c,f),rgba:e.toRgba(a,o,c,f)}}e.toColor=s})(bt||(bt={}));var it;(e=>{function t(p,h){if(ut=(h.rgba&255)/255,ut===1)return{css:h.css,rgba:h.rgba};let g=h.rgba>>24&255,_=h.rgba>>16&255,S=h.rgba>>8&255,y=p.rgba>>24&255,b=p.rgba>>16&255,k=p.rgba>>8&255;Rt=y+Math.round((g-y)*ut),Mt=b+Math.round((_-b)*ut),Bt=k+Math.round((S-k)*ut);let R=bt.toCss(Rt,Mt,Bt),T=bt.toRgba(Rt,Mt,Bt);return{css:R,rgba:T}}e.blend=t;function n(p){return(p.rgba&255)===255}e.isOpaque=n;function s(p,h,g){let _=ru.ensureContrastRatio(p.rgba,h.rgba,g);if(_)return bt.toColor(_>>24&255,_>>16&255,_>>8&255)}e.ensureContrastRatio=s;function a(p){let h=(p.rgba|255)>>>0;return[Rt,Mt,Bt]=ru.toChannels(h),{css:bt.toCss(Rt,Mt,Bt),rgba:h}}e.opaque=a;function o(p,h){return ut=Math.round(h*255),[Rt,Mt,Bt]=ru.toChannels(p.rgba),{css:bt.toCss(Rt,Mt,Bt,ut),rgba:bt.toRgba(Rt,Mt,Bt,ut)}}e.opacity=o;function c(p,h){return ut=p.rgba&255,o(p,ut*h/255)}e.multiplyOpacity=c;function f(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}e.toColorRGB=f})(it||(it={}));var lt;(e=>{let t,n;try{let a=document.createElement("canvas");a.width=1,a.height=1;let o=a.getContext("2d",{willReadFrequently:!0});o&&(t=o,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function s(a){if(a.match(/#[\da-f]{3,8}/i))switch(a.length){case 4:return Rt=parseInt(a.slice(1,2).repeat(2),16),Mt=parseInt(a.slice(2,3).repeat(2),16),Bt=parseInt(a.slice(3,4).repeat(2),16),bt.toColor(Rt,Mt,Bt);case 5:return Rt=parseInt(a.slice(1,2).repeat(2),16),Mt=parseInt(a.slice(2,3).repeat(2),16),Bt=parseInt(a.slice(3,4).repeat(2),16),ut=parseInt(a.slice(4,5).repeat(2),16),bt.toColor(Rt,Mt,Bt,ut);case 7:return{css:a,rgba:(parseInt(a.slice(1),16)<<8|255)>>>0};case 9:return{css:a,rgba:parseInt(a.slice(1),16)>>>0}}let o=a.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(o)return Rt=parseInt(o[1]),Mt=parseInt(o[2]),Bt=parseInt(o[3]),ut=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),bt.toColor(Rt,Mt,Bt,ut);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=a,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Rt,Mt,Bt,ut]=t.getImageData(0,0,1,1).data,ut!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:bt.toRgba(Rt,Mt,Bt,ut),css:a}}e.toColor=s})(lt||(lt={}));var ti;(e=>{function t(s){return n(s>>16&255,s>>8&255,s&255)}e.relativeLuminance=t;function n(s,a,o){let c=s/255,f=a/255,p=o/255,h=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4),g=f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4),_=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4);return h*.2126+g*.7152+_*.0722}e.relativeLuminance2=n})(ti||(ti={}));var ru;(e=>{function t(c,f){if(ut=(f&255)/255,ut===1)return f;let p=f>>24&255,h=f>>16&255,g=f>>8&255,_=c>>24&255,S=c>>16&255,y=c>>8&255;return Rt=_+Math.round((p-_)*ut),Mt=S+Math.round((h-S)*ut),Bt=y+Math.round((g-y)*ut),bt.toRgba(Rt,Mt,Bt)}e.blend=t;function n(c,f,p){let h=ti.relativeLuminance(c>>8),g=ti.relativeLuminance(f>>8);if(Mn(h,g)<p){if(g<h){let y=s(c,f,p),b=Mn(h,ti.relativeLuminance(y>>8));if(b<p){let k=a(c,f,p),R=Mn(h,ti.relativeLuminance(k>>8));return b>R?y:k}return y}let _=a(c,f,p),S=Mn(h,ti.relativeLuminance(_>>8));if(S<p){let y=s(c,f,p),b=Mn(h,ti.relativeLuminance(y>>8));return S>b?_:y}return _}}e.ensureContrastRatio=n;function s(c,f,p){let h=c>>24&255,g=c>>16&255,_=c>>8&255,S=f>>24&255,y=f>>16&255,b=f>>8&255,k=Mn(ti.relativeLuminance2(S,y,b),ti.relativeLuminance2(h,g,_));for(;k<p&&(S>0||y>0||b>0);)S-=Math.max(0,Math.ceil(S*.1)),y-=Math.max(0,Math.ceil(y*.1)),b-=Math.max(0,Math.ceil(b*.1)),k=Mn(ti.relativeLuminance2(S,y,b),ti.relativeLuminance2(h,g,_));return(S<<24|y<<16|b<<8|255)>>>0}e.reduceLuminance=s;function a(c,f,p){let h=c>>24&255,g=c>>16&255,_=c>>8&255,S=f>>24&255,y=f>>16&255,b=f>>8&255,k=Mn(ti.relativeLuminance2(S,y,b),ti.relativeLuminance2(h,g,_));for(;k<p&&(S<255||y<255||b<255);)S=Math.min(255,S+Math.ceil((255-S)*.1)),y=Math.min(255,y+Math.ceil((255-y)*.1)),b=Math.min(255,b+Math.ceil((255-b)*.1)),k=Mn(ti.relativeLuminance2(S,y,b),ti.relativeLuminance2(h,g,_));return(S<<24|y<<16|b<<8|255)>>>0}e.increaseLuminance=a;function o(c){return[c>>24&255,c>>16&255,c>>8&255,c&255]}e.toChannels=o})(ru||(ru={}));function Or(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Mn(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var hC=class extends _a{constructor(e,t,n){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},cu=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Vi}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 n=[],s=t.translateToString(!0),a=0,o=0,c=0,f=t.getFg(0),p=t.getBg(0);for(let h=0;h<t.getTrimmedLength();h++)if(t.loadCell(h,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==f||this._workCell.bg!==p){if(h-a>1){let g=this._getJoinedRanges(s,c,o,t,a);for(let _=0;_<g.length;_++)n.push(g[_])}a=h,c=o,f=this._workCell.fg,p=this._workCell.bg}o+=this._workCell.getChars().length||mr.length}if(this._bufferService.cols-a>1){let h=this._getJoinedRanges(s,c,o,t,a);for(let g=0;g<h.length;g++)n.push(h[g])}return n}_getJoinedRanges(e,t,n,s,a){let o=e.substring(t,n),c=[];try{c=this._characterJoiners[0].handler(o)}catch(f){console.error(f)}for(let f=1;f<this._characterJoiners.length;f++)try{let p=this._characterJoiners[f].handler(o);for(let h=0;h<p.length;h++)cu._mergeRanges(c,p[h])}catch(p){console.error(p)}return this._stringRangesToCellRanges(c,s,a),c}_stringRangesToCellRanges(e,t,n){let s=0,a=!1,o=0,c=e[s];if(c){for(let f=n;f<this._bufferService.cols;f++){let p=t.getWidth(f),h=t.getString(f).length||mr.length;if(p!==0){if(!a&&c[0]<=o&&(c[0]=f,a=!0),c[1]<=o){if(c[1]=f,c=e[++s],!c)break;c[0]<=o?(c[0]=f,a=!0):a=!1}o+=h}}c&&(c[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let s=0;s<e.length;s++){let a=e[s];if(n){if(t[1]<=a[0])return e[s-1][1]=t[1],e;if(t[1]<=a[1])return e[s-1][1]=Math.max(t[1],a[1]),e.splice(s,1),e;e.splice(s,1),s--}else{if(t[1]<=a[0])return e.splice(s,0,t),e;if(t[1]<=a[1])return a[0]=Math.min(t[0],a[0]),e;t[0]<a[1]&&(a[0]=Math.min(t[0],a[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};cu=ht([de(0,ri)],cu);function fC(e){return 57508<=e&&e<=57558}function dC(e){return 9472<=e&&e<=9631}function pC(e){return fC(e)||dC(e)}function mC(){return{css:{canvas:Yo(),cell:Yo()},device:{canvas:Yo(),cell:Yo(),char:{width:0,height:0,left:0,top:0}}}}function Yo(){return{width:0,height:0}}var $f=class{constructor(e,t,n,s,a,o,c){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=s,this._coreService=a,this._decorationService=o,this._themeService=c,this._workCell=new Vi,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,s,a,o,c,f,p,h,g){let _=[],S=this._characterJoinerService.getJoinedCharacters(t),y=this._themeService.colors,b=e.getNoBgTrimmedLength();n&&b<o+1&&(b=o+1);let k,R=0,T="",$=0,j=0,O=0,X=0,L=!1,re=0,Z=!1,le=0,z=0,te=[],U=h!==-1&&g!==-1;for(let F=0;F<b;F++){e.loadCell(F,this._workCell);let V=this._workCell.getWidth();if(V===0)continue;let H=!1,M=F>=z,q=F,W=this._workCell;if(S.length>0&&F===S[0][0]&&M){let He=S.shift(),vi=this._isCellInSelection(He[0],t);for($=He[0]+1;$<He[1];$++)M&&(M=vi===this._isCellInSelection($,t));M&&(M=!n||o<He[0]||o>=He[1]),M?(H=!0,W=new hC(this._workCell,e.translateToString(!0,He[0],He[1]),He[1]-He[0]),q=He[1]-1,V=W.getWidth()):z=He[1]}let ue=this._isCellInSelection(F,t),E=n&&F===o,A=U&&F>=h&&F<=g,K=!1;this._decorationService.forEachDecorationAtCell(F,t,void 0,He=>{K=!0});let C=W.getChars()||mr;if(C===" "&&(W.isUnderline()||W.isOverline())&&(C=" "),le=V*f-p.get(C,W.isBold(),W.isItalic()),!k)k=this._document.createElement("span");else if(R&&(ue&&Z||!ue&&!Z&&W.bg===j)&&(ue&&Z&&y.selectionForeground||W.fg===O)&&W.extended.ext===X&&A===L&&le===re&&!E&&!H&&!K&&M){W.isInvisible()?T+=mr:T+=C,R++;continue}else R&&(k.textContent=T),k=this._document.createElement("span"),R=0,T="";if(j=W.bg,O=W.fg,X=W.extended.ext,L=A,re=le,Z=ue,H&&o>=F&&o<=q&&(o=F),!this._coreService.isCursorHidden&&E&&this._coreService.isCursorInitialized){if(te.push("xterm-cursor"),this._coreBrowserService.isFocused)c&&te.push("xterm-cursor-blink"),te.push(s==="bar"?"xterm-cursor-bar":s==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(a)switch(a){case"outline":te.push("xterm-cursor-outline");break;case"block":te.push("xterm-cursor-block");break;case"bar":te.push("xterm-cursor-bar");break;case"underline":te.push("xterm-cursor-underline");break}}if(W.isBold()&&te.push("xterm-bold"),W.isItalic()&&te.push("xterm-italic"),W.isDim()&&te.push("xterm-dim"),W.isInvisible()?T=mr:T=W.getChars()||mr,W.isUnderline()&&(te.push(`xterm-underline-${W.extended.underlineStyle}`),T===" "&&(T=" "),!W.isUnderlineColorDefault()))if(W.isUnderlineColorRGB())k.style.textDecorationColor=`rgb(${_a.toColorRGB(W.getUnderlineColor()).join(",")})`;else{let He=W.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&W.isBold()&&He<8&&(He+=8),k.style.textDecorationColor=y.ansi[He].css}W.isOverline()&&(te.push("xterm-overline"),T===" "&&(T=" ")),W.isStrikethrough()&&te.push("xterm-strikethrough"),A&&(k.style.textDecoration="underline");let se=W.getFgColor(),fe=W.getFgColorMode(),pe=W.getBgColor(),xe=W.getBgColorMode(),Ye=!!W.isInverse();if(Ye){let He=se;se=pe,pe=He;let vi=fe;fe=xe,xe=vi}let De,Ht,Zt=!1;this._decorationService.forEachDecorationAtCell(F,t,void 0,He=>{He.options.layer!=="top"&&Zt||(He.backgroundColorRGB&&(xe=50331648,pe=He.backgroundColorRGB.rgba>>8&16777215,De=He.backgroundColorRGB),He.foregroundColorRGB&&(fe=50331648,se=He.foregroundColorRGB.rgba>>8&16777215,Ht=He.foregroundColorRGB),Zt=He.options.layer==="top")}),!Zt&&ue&&(De=this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque,pe=De.rgba>>8&16777215,xe=50331648,Zt=!0,y.selectionForeground&&(fe=50331648,se=y.selectionForeground.rgba>>8&16777215,Ht=y.selectionForeground)),Zt&&te.push("xterm-decoration-top");let li;switch(xe){case 16777216:case 33554432:li=y.ansi[pe],te.push(`xterm-bg-${pe}`);break;case 50331648:li=bt.toColor(pe>>16,pe>>8&255,pe&255),this._addStyle(k,`background-color:#${Cv((pe>>>0).toString(16),"0",6)}`);break;case 0:default:Ye?(li=y.foreground,te.push("xterm-bg-257")):li=y.background}switch(De||W.isDim()&&(De=it.multiplyOpacity(li,.5)),fe){case 16777216:case 33554432:W.isBold()&&se<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(se+=8),this._applyMinimumContrast(k,li,y.ansi[se],W,De,void 0)||te.push(`xterm-fg-${se}`);break;case 50331648:let He=bt.toColor(se>>16&255,se>>8&255,se&255);this._applyMinimumContrast(k,li,He,W,De,Ht)||this._addStyle(k,`color:#${Cv(se.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(k,li,y.foreground,W,De,Ht)||Ye&&te.push("xterm-fg-257")}te.length&&(k.className=te.join(" "),te.length=0),!E&&!H&&!K&&M?R++:k.textContent=T,le!==this.defaultSpacing&&(k.style.letterSpacing=`${le}px`),_.push(k),F=q}return k&&R&&(k.textContent=T),_}_applyMinimumContrast(e,t,n,s,a,o){if(this._optionsService.rawOptions.minimumContrastRatio===1||pC(s.getCode()))return!1;let c=this._getContrastCache(s),f;if(!a&&!o&&(f=c.getColor(t.rgba,n.rgba)),f===void 0){let p=this._optionsService.rawOptions.minimumContrastRatio/(s.isDim()?2:1);f=it.ensureContrastRatio(a||t,o||n,p),c.setColor((a||t).rgba,(o||n).rgba,f??null)}return f?(this._addStyle(e,`color:${f.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 n=this._selectionStart,s=this._selectionEnd;return!n||!s?!1:this._columnSelectMode?n[0]<=s[0]?e>=n[0]&&t>=n[1]&&e<s[0]&&t<=s[1]:e<n[0]&&t>=n[1]&&e>=s[0]&&t<=s[1]:t>n[1]&&t<s[1]||n[1]===s[1]&&t===n[1]&&e>=n[0]&&e<s[0]||n[1]<s[1]&&t===s[1]&&e<s[0]||n[1]<s[1]&&t===n[1]&&e>=n[0]}};$f=ht([de(1,aS),de(2,si),de(3,Nn),de(4,Kr),de(5,ga),de(6,Ks)],$f);function Cv(e,t,n){for(;e.length<n;)e=t+e;return e}var _C=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 n=e.createElement("span");n.classList.add("xterm-char-measure-element");let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold";let a=e.createElement("span");a.classList.add("xterm-char-measure-element"),a.style.fontStyle="italic";let o=e.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontWeight="bold",o.style.fontStyle="italic",this._measureElements=[n,s,a,o],this._container.appendChild(n),this._container.appendChild(s),this._container.appendChild(a),this._container.appendChild(o),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,n,s){e===this._font&&t===this._fontSize&&n===this._weight&&s===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=s,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${s}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${s}`,this.clear())}get(e,t,n){let s=0;if(!t&&!n&&e.length===1&&(s=e.charCodeAt(0))<256){if(this._flat[s]!==-9999)return this._flat[s];let c=this._measure(e,0);return c>0&&(this._flat[s]=c),c}let a=e;t&&(a+="B"),n&&(a+="I");let o=this._holey.get(a);if(o===void 0){let c=0;t&&(c|=1),n&&(c|=2),o=this._measure(e,c),o>0&&this._holey.set(a,o)}return o}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},gC=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,s=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let a=e.buffers.active.ydisp,o=t[1]-a,c=n[1]-a,f=Math.max(o,0),p=Math.min(c,e.rows-1);if(f>=e.rows||p<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=o,this.viewportEndRow=c,this.viewportCappedStartRow=f,this.viewportCappedEndRow=p,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function vC(){return new gC}var Jh="xterm-dom-renderer-owner-",Fi="xterm-rows",Vo="xterm-fg-",kv="xterm-bg-",Vl="xterm-focus",Ko="xterm-selection",yC=1,Gf=class extends Ae{constructor(e,t,n,s,a,o,c,f,p,h,g,_,S,y){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=s,this._viewportElement=a,this._helperContainer=o,this._linkifier2=c,this._charSizeService=p,this._optionsService=h,this._bufferService=g,this._coreService=_,this._coreBrowserService=S,this._themeService=y,this._terminalClass=yC++,this._rowElements=[],this._selectionRenderModel=vC(),this.onRequestRedraw=this._register(new ce).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Fi),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(Ko),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=mC(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(b=>this._injectCss(b))),this._injectCss(this._themeService.colors),this._rowFactory=f.createInstance($f,document),this._element.classList.add(Jh+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(b=>this._handleLinkHover(b))),this._register(this._linkifier2.onHideLinkUnderline(b=>this._handleLinkLeave(b))),this._register(rt(()=>{this._element.classList.remove(Jh+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new _C(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 n of this._rowElements)n.style.width=`${this.dimensions.css.canvas.width}px`,n.style.height=`${this.dimensions.css.cell.height}px`,n.style.lineHeight=`${this.dimensions.css.cell.height}px`,n.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${Fi} 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} .${Fi} { 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} .${Fi} .xterm-dim { color: ${it.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 n=`blink_underline_${this._terminalClass}`,s=`blink_bar_${this._terminalClass}`,a=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${s} { 50% { box-shadow: none; }}`,t+=`@keyframes ${a} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Fi}.${Vl} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Fi}.${Vl} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${Fi}.${Vl} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${a} 1s step-end infinite;}${this._terminalSelector} .${Fi} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Fi} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Fi} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Fi} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Fi} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Ko} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Ko} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Ko} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[o,c]of e.ansi.entries())t+=`${this._terminalSelector} .${Vo}${o} { color: ${c.css}; }${this._terminalSelector} .${Vo}${o}.xterm-dim { color: ${it.multiplyOpacity(c,.5).css}; }${this._terminalSelector} .${kv}${o} { background-color: ${c.css}; }`;t+=`${this._terminalSelector} .${Vo}257 { color: ${it.opaque(e.background).css}; }${this._terminalSelector} .${Vo}257.xterm-dim { color: ${it.multiplyOpacity(it.opaque(e.background),.5).css}; }${this._terminalSelector} .${kv}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let n=this._rowElements.length;n<=t;n++){let s=this._document.createElement("div");this._rowContainer.appendChild(s),this._rowElements.push(s)}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(Vl),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Vl),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let s=this._selectionRenderModel.viewportStartRow,a=this._selectionRenderModel.viewportEndRow,o=this._selectionRenderModel.viewportCappedStartRow,c=this._selectionRenderModel.viewportCappedEndRow,f=this._document.createDocumentFragment();if(n){let p=e[0]>t[0];f.appendChild(this._createSelectionElement(o,p?t[0]:e[0],p?e[0]:t[0],c-o+1))}else{let p=s===o?e[0]:0,h=o===a?t[0]:this._bufferService.cols;f.appendChild(this._createSelectionElement(o,p,h));let g=c-o-1;if(f.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,g)),o!==c){let _=a===c?t[0]:this._bufferService.cols;f.appendChild(this._createSelectionElement(c,0,_))}}this._selectionContainer.appendChild(f)}_createSelectionElement(e,t,n,s=1){let a=this._document.createElement("div"),o=t*this.dimensions.css.cell.width,c=this.dimensions.css.cell.width*(n-t);return o+c>this.dimensions.css.canvas.width&&(c=this.dimensions.css.canvas.width-o),a.style.height=`${s*this.dimensions.css.cell.height}px`,a.style.top=`${e*this.dimensions.css.cell.height}px`,a.style.left=`${o}px`,a.style.width=`${c}px`,a}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 n=this._bufferService.buffer,s=n.ybase+n.y,a=Math.min(n.x,this._bufferService.cols-1),o=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,c=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let p=e;p<=t;p++){let h=p+n.ydisp,g=this._rowElements[p],_=n.lines.get(h);if(!g||!_)break;g.replaceChildren(...this._rowFactory.createRow(_,h,h===s,c,f,a,o,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Jh}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,s,a,o){n<0&&(e=0),s<0&&(t=0);let c=this._bufferService.rows-1;n=Math.max(Math.min(n,c),0),s=Math.max(Math.min(s,c),0),a=Math.min(a,this._bufferService.cols);let f=this._bufferService.buffer,p=f.ybase+f.y,h=Math.min(f.x,a-1),g=this._optionsService.rawOptions.cursorBlink,_=this._optionsService.rawOptions.cursorStyle,S=this._optionsService.rawOptions.cursorInactiveStyle;for(let y=n;y<=s;++y){let b=y+f.ydisp,k=this._rowElements[y],R=f.lines.get(b);if(!k||!R)break;k.replaceChildren(...this._rowFactory.createRow(R,b,b===p,_,S,h,g,this.dimensions.css.cell.width,this._widthCache,o?y===n?e:0:-1,o?(y===s?t:a)-1:-1))}}};Gf=ht([de(7,xd),de(8,yu),de(9,si),de(10,ri),de(11,Kr),de(12,Nn),de(13,Ks)],Gf);var Zf=class extends Ae{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new ce),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new bC(this._optionsService))}catch{this._measureStrategy=this._register(new SC(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())}};Zf=ht([de(2,si)],Zf);var ES=class extends Ae{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)}},SC=class extends ES{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},bC=class extends ES{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}},xC=class extends Ae{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new wC(this._window)),this._onDprChange=this._register(new ce),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new ce),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(s=>this._screenDprMonitor.setWindow(s))),this._register(Yt.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(be(this._textarea,"focus",()=>this._isFocused=!0)),this._register(be(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}},wC=class extends Ae{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Ws),this._onDprChange=this._register(new ce),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(rt(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=be(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)}},CC=class extends Ae{constructor(){super(),this.linkProviders=[],this._register(rt(()=>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 Rd(e,t,n){let s=n.getBoundingClientRect(),a=e.getComputedStyle(n),o=parseInt(a.getPropertyValue("padding-left")),c=parseInt(a.getPropertyValue("padding-top"));return[t.clientX-s.left-o,t.clientY-s.top-c]}function kC(e,t,n,s,a,o,c,f,p){if(!o)return;let h=Rd(e,t,n);if(h)return h[0]=Math.ceil((h[0]+(p?c/2:0))/c),h[1]=Math.ceil(h[1]/f),h[0]=Math.min(Math.max(h[0],1),s+(p?1:0)),h[1]=Math.min(Math.max(h[1],1),a),h}var Qf=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,s,a){return kC(window,e,t,n,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,a)}getMouseReportCoords(e,t){let n=Rd(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};Qf=ht([de(0,On),de(1,yu)],Qf);var EC=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,n){this._rowCount=n,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=[]}},TS={};Ox(TS,{getSafariVersion:()=>AC,isChromeOS:()=>MS,isFirefox:()=>AS,isIpad:()=>DC,isIphone:()=>RC,isLegacyEdge:()=>TC,isLinux:()=>Md,isMac:()=>hu,isNode:()=>Su,isSafari:()=>DS,isWindows:()=>RS});var Su=typeof process<"u"&&"title"in process,va=Su?"node":navigator.userAgent,ya=Su?"node":navigator.platform,AS=va.includes("Firefox"),TC=va.includes("Edge"),DS=/^((?!chrome|android).)*safari/i.test(va);function AC(){if(!DS)return 0;let e=va.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var hu=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(ya),DC=ya==="iPad",RC=ya==="iPhone",RS=["Windows","Win16","Win32","WinCE"].includes(ya),Md=ya.indexOf("Linux")>=0,MS=/\bCrOS\b/.test(va),BS=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,n=0,s=e.timeRemaining(),a=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),a=e.timeRemaining(),n*1.5>a){s-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-t))}ms`),this._start();return}s=a}this.clear()}},MC=class extends BS{_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())}}},BC=class extends BS{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},fu=!Su&&"requestIdleCallback"in window?BC:MC,LC=class{constructor(){this._queue=new fu}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Jf=class extends Ae{constructor(e,t,n,s,a,o,c,f,p){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=s,this._coreService=a,this._coreBrowserService=f,this._renderer=this._register(new Ws),this._pausedResizeTask=new LC,this._observerDisposable=this._register(new Ws),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 ce),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new ce),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new ce),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new ce),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new EC((h,g)=>this._renderRows(h,g),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new zC(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(rt(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(c.onResize(()=>this._fullRefresh())),this._register(c.buffers.onBufferActivate(()=>{var h;return(h=this._renderer.value)==null?void 0:h.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(o.onDecorationRegistered(()=>this._fullRefresh())),this._register(o.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(c.cols,c.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(c.buffer.y,c.buffer.y,!0))),this._register(p.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(h=>this._registerIntersectionObserver(h,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let n=new e.IntersectionObserver(s=>this._handleIntersectionChange(s[s.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=rt(()=>n.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,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let s=this._syncOutputHandler.flush();s&&(e=Math.min(e,s.start),t=Math.max(t,s.end)),n||(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 n;return(n=this._renderer.value)==null?void 0:n.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,n){var s;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,(s=this._renderer.value)==null||s.handleSelectionChanged(e,t,n)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};Jf=ht([de(2,si),de(3,yu),de(4,Kr),de(5,ga),de(6,ri),de(7,Nn),de(8,Ks)],Jf);var zC=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===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 NC(e,t,n,s){let a=n.buffer.x,o=n.buffer.y;if(!n.buffer.hasScrollback)return jC(a,o,e,t,n,s)+bu(o,t,n,s)+UC(a,o,e,t,n,s);let c;if(o===t)return c=a>e?"D":"C",ha(Math.abs(a-e),ca(c,s));c=o>t?"D":"C";let f=Math.abs(o-t),p=HC(o>t?e:a,n)+(f-1)*n.cols+1+OC(o>t?a:e);return ha(p,ca(c,s))}function OC(e,t){return e-1}function HC(e,t){return t.cols-e}function jC(e,t,n,s,a,o){return bu(t,s,a,o).length===0?"":ha(zS(e,t,e,t-Yr(t,a),!1,a).length,ca("D",o))}function bu(e,t,n,s){let a=e-Yr(e,n),o=t-Yr(t,n),c=Math.abs(a-o)-PC(e,t,n);return ha(c,ca(LS(e,t),s))}function UC(e,t,n,s,a,o){let c;bu(t,s,a,o).length>0?c=s-Yr(s,a):c=t;let f=s,p=IC(e,t,n,s,a,o);return ha(zS(e,c,n,f,p==="C",a).length,ca(p,o))}function PC(e,t,n){var c;let s=0,a=e-Yr(e,n),o=t-Yr(t,n);for(let f=0;f<Math.abs(a-o);f++){let p=LS(e,t)==="A"?-1:1;(c=n.buffer.lines.get(a+p*f))!=null&&c.isWrapped&&s++}return s}function Yr(e,t){let n=0,s=t.buffer.lines.get(e),a=s==null?void 0:s.isWrapped;for(;a&&e>=0&&e<t.rows;)n++,s=t.buffer.lines.get(--e),a=s==null?void 0:s.isWrapped;return n}function IC(e,t,n,s,a,o){let c;return bu(n,s,a,o).length>0?c=s-Yr(s,a):c=t,e<n&&c<=s||e>=n&&c<s?"C":"D"}function LS(e,t){return e>t?"A":"B"}function zS(e,t,n,s,a,o){let c=e,f=t,p="";for(;(c!==n||f!==s)&&f>=0&&f<o.buffer.lines.length;)c+=a?1:-1,a&&c>o.cols-1?(p+=o.buffer.translateBufferLineToString(f,!1,e,c),c=0,e=0,f++):!a&&c<0&&(p+=o.buffer.translateBufferLineToString(f,!1,0,e+1),c=o.cols-1,e=c,f--);return p+o.buffer.translateBufferLineToString(f,!1,e,c)}function ca(e,t){let n=t?"O":"[";return ne.ESC+n+e}function ha(e,t){e=Math.floor(e);let n="";for(let s=0;s<e;s++)n+=t;return n}var FC=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 Ev(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 ef=50,qC=15,WC=50,YC=500,VC=" ",KC=new RegExp(VC,"g"),ed=class extends Ae{constructor(e,t,n,s,a,o,c,f,p){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=s,this._coreService=a,this._mouseService=o,this._optionsService=c,this._renderService=f,this._coreBrowserService=p,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Vi,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new ce),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new ce),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new ce),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new ce),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=h=>this._handleMouseMove(h),this._mouseUpListener=h=>this._handleMouseUp(h),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(h=>this._handleTrim(h)),this._register(this._bufferService.buffers.onBufferActivate(h=>this._handleBufferActivate(h))),this.enable(),this._model=new FC(this._bufferService),this._activeSelectionMode=0,this._register(rt(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(h=>{h.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 n=this._bufferService.buffer,s=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let a=e[0]<t[0]?e[0]:t[0],o=e[0]<t[0]?t[0]:e[0];for(let c=e[1];c<=t[1];c++){let f=n.translateBufferLineToString(c,!0,a,o);s.push(f)}}else{let a=e[1]===t[1]?t[0]:void 0;s.push(n.translateBufferLineToString(e[1],!0,e[0],a));for(let o=e[1]+1;o<=t[1]-1;o++){let c=n.lines.get(o),f=n.translateBufferLineToString(o,!0);c!=null&&c.isWrapped?s[s.length-1]+=f:s.push(f)}if(e[1]!==t[1]){let o=n.lines.get(t[1]),c=n.translateBufferLineToString(t[1],!0,0,t[0]);o&&o.isWrapped?s[s.length-1]+=c:s.push(c)}}return s.map(a=>a.replace(KC," ")).join(RS?`\r
71
71
  `:`
72
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Md&&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),n=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!n||!s||!t?!1:this._areCoordsInSelection(t,n,s)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!n||!s?!1:this._areCoordsInSelection([e,t],n,s)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var a,o;let n=(o=(a=this._linkifier.currentLink)==null?void 0:a.link)==null?void 0:o.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=Ev(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let s=this._getMouseBufferCoords(e);return s?(this._selectWordAt(s,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=Rd(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-ef),ef),t/=ef,t/Math.abs(t)+Math.round(t*(qC-1)))}shouldForceSelection(e){return hu?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(),WC)}_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&&!(hu&&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 n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let s=n.lines.get(this._model.selectionEnd[1]);s&&s.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<YC&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let n=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(n&&n[0]!==void 0&&n[1]!==void 0){let s=NC(n[0]-1,n[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(s,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);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,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let s=0;t>=s;s++){let a=e.loadCell(s,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:a>1&&t!==s&&(n+=a-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,s=!0){if(e[0]>=this._bufferService.cols)return;let a=this._bufferService.buffer,o=a.lines.get(e[1]);if(!o)return;let c=a.translateBufferLineToString(e[1],!1),f=this._convertViewportColToCharacterIndex(o,e[0]),p=f,h=e[0]-f,g=0,m=0,S=0,v=0;if(c.charAt(f)===" "){for(;f>0&&c.charAt(f-1)===" ";)f--;for(;p<c.length&&c.charAt(p+1)===" ";)p++}else{let B=e[0],D=e[0];o.getWidth(B)===0&&(g++,B--),o.getWidth(D)===2&&(m++,D++);let G=o.getString(D).length;for(G>1&&(v+=G-1,p+=G-1);B>0&&f>0&&!this._isCharWordSeparator(o.loadCell(B-1,this._workCell));){o.loadCell(B-1,this._workCell);let A=this._workCell.getChars().length;this._workCell.getWidth()===0?(g++,B--):A>1&&(S+=A-1,f-=A-1),f--,B--}for(;D<o.length&&p+1<c.length&&!this._isCharWordSeparator(o.loadCell(D+1,this._workCell));){o.loadCell(D+1,this._workCell);let A=this._workCell.getChars().length;this._workCell.getWidth()===2?(m++,D++):A>1&&(v+=A-1,p+=A-1),p++,D++}}p++;let b=f+h-g+S,k=Math.min(this._bufferService.cols,p-f+g+m-S-v);if(!(!t&&c.slice(f,p).trim()==="")){if(n&&b===0&&o.getCodePoint(0)!==32){let B=a.lines.get(e[1]-1);if(B&&o.isWrapped&&B.getCodePoint(this._bufferService.cols-1)!==32){let D=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(D){let G=this._bufferService.cols-D.start;b-=G,k+=G}}}if(s&&b+k===this._bufferService.cols&&o.getCodePoint(this._bufferService.cols-1)!==32){let B=a.lines.get(e[1]+1);if(B!=null&&B.isWrapped&&B.getCodePoint(0)!==32){let D=this._getWordAt([0,e[1]+1],!1,!1,!0);D&&(k+=D.length)}}return{start:b,length:k}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=Ev(n,this._bufferService.cols)}};ed=ht([fe(3,ri),fe(4,Kr),fe(5,wd),fe(6,si),fe(7,On),fe(8,Nn)],ed);var Tv=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},Av=class{constructor(){this._color=new Tv,this._css=new Tv}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},Ct=Object.freeze((()=>{let e=[lt.toColor("#2e3436"),lt.toColor("#cc0000"),lt.toColor("#4e9a06"),lt.toColor("#c4a000"),lt.toColor("#3465a4"),lt.toColor("#75507b"),lt.toColor("#06989a"),lt.toColor("#d3d7cf"),lt.toColor("#555753"),lt.toColor("#ef2929"),lt.toColor("#8ae234"),lt.toColor("#fce94f"),lt.toColor("#729fcf"),lt.toColor("#ad7fa8"),lt.toColor("#34e2e2"),lt.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let s=t[n/36%6|0],a=t[n/6%6|0],o=t[n%6];e.push({css:bt.toCss(s,a,o),rgba:bt.toRgba(s,a,o)})}for(let n=0;n<24;n++){let s=8+n*10;e.push({css:bt.toCss(s,s,s),rgba:bt.toRgba(s,s,s)})}return e})()),Pr=lt.toColor("#ffffff"),ia=lt.toColor("#000000"),Dv=lt.toColor("#ffffff"),Rv=ia,Kl={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},XC=Pr,td=class extends Ae{constructor(e){super(),this._optionsService=e,this._contrastCache=new Av,this._halfContrastCache=new Av,this._onChangeColors=this._register(new ue),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Pr,background:ia,cursor:Dv,cursorAccent:Rv,selectionForeground:void 0,selectionBackgroundTransparent:Kl,selectionBackgroundOpaque:it.blend(ia,Kl),selectionInactiveBackgroundTransparent:Kl,selectionInactiveBackgroundOpaque:it.blend(ia,Kl),scrollbarSliderBackground:it.opacity(Pr,.2),scrollbarSliderHoverBackground:it.opacity(Pr,.4),scrollbarSliderActiveBackground:it.opacity(Pr,.5),overviewRulerBorder:Pr,ansi:Ct.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=$e(e.foreground,Pr),t.background=$e(e.background,ia),t.cursor=it.blend(t.background,$e(e.cursor,Dv)),t.cursorAccent=it.blend(t.background,$e(e.cursorAccent,Rv)),t.selectionBackgroundTransparent=$e(e.selectionBackground,Kl),t.selectionBackgroundOpaque=it.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=$e(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=it.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?$e(e.selectionForeground,wv):void 0,t.selectionForeground===wv&&(t.selectionForeground=void 0),it.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=it.opacity(t.selectionBackgroundTransparent,.3)),it.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=it.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=$e(e.scrollbarSliderBackground,it.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=$e(e.scrollbarSliderHoverBackground,it.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=$e(e.scrollbarSliderActiveBackground,it.opacity(t.foreground,.5)),t.overviewRulerBorder=$e(e.overviewRulerBorder,XC),t.ansi=Ct.slice(),t.ansi[0]=$e(e.black,Ct[0]),t.ansi[1]=$e(e.red,Ct[1]),t.ansi[2]=$e(e.green,Ct[2]),t.ansi[3]=$e(e.yellow,Ct[3]),t.ansi[4]=$e(e.blue,Ct[4]),t.ansi[5]=$e(e.magenta,Ct[5]),t.ansi[6]=$e(e.cyan,Ct[6]),t.ansi[7]=$e(e.white,Ct[7]),t.ansi[8]=$e(e.brightBlack,Ct[8]),t.ansi[9]=$e(e.brightRed,Ct[9]),t.ansi[10]=$e(e.brightGreen,Ct[10]),t.ansi[11]=$e(e.brightYellow,Ct[11]),t.ansi[12]=$e(e.brightBlue,Ct[12]),t.ansi[13]=$e(e.brightMagenta,Ct[13]),t.ansi[14]=$e(e.brightCyan,Ct[14]),t.ansi[15]=$e(e.brightWhite,Ct[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let s=0;s<n;s++)t.ansi[s+16]=$e(e.extendedAnsi[s],Ct[s+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(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()}}};td=ht([fe(0,si)],td);function $e(e,t){if(e!==void 0)try{return lt.toColor(e)}catch{}return t}var $C=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},GC=class{constructor(){this._services=new $C,this._services.set(xd,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=qx(e).sort((o,c)=>o.index-c.index),s=[];for(let o of n){let c=this._services.get(o.id);if(!c)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${o.id._id}.`);s.push(c)}let a=n.length>0?n[0].index:t.length;if(t.length!==a)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${a+1} conflicts with ${t.length} static arguments`);return new e(...t,...s)}},ZC={trace:0,debug:1,info:2,warn:3,error:4,off:5},QC="xterm.js: ",id=class extends Ae{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=ZC[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,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?"":QC)+t,...n)}trace(e,...t){var n;this._logLevel<=0&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var n;this._logLevel<=1&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var n;this._logLevel<=2&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var n;this._logLevel<=3&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var n;this._logLevel<=4&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.error.bind(this._optionsService.options.logger))??console.error,e,t)}};id=ht([fe(0,si)],id);var Mv=class extends Ae{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new ue),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new ue),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new ue),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let s=e;s<this._length-t;s++)this._array[this._getCyclicIndex(s)]=this._array[this._getCyclicIndex(s+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let s=this._length-1;s>=e;s--)this._array[this._getCyclicIndex(s+n.length)]=this._array[this._getCyclicIndex(s)];for(let s=0;s<n.length;s++)this._array[this._getCyclicIndex(e+s)]=n[s];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let s=this._length+n.length-this._maxLength;this._startIndex+=s,this._length=this._maxLength,this.onTrimEmitter.fire(s)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+n<0)throw new Error("Cannot shift elements in list beyond index 0");if(n>0){for(let a=t-1;a>=0;a--)this.set(e+a+n,this.get(e+a));let s=e+t+n-this._length;if(s>0)for(this._length+=s;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let s=0;s<t;s++)this.set(e+s+n,this.get(e+s))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},Te=3,St=Object.freeze(new ma),Xo=0,tf=2,na=class NS{constructor(t,n,s=!1){this.isWrapped=s,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*Te);let a=n||Vi.fromCharData([0,eS,1,0]);for(let o=0;o<t;++o)this.setCell(o,a);this.length=t}get(t){let n=this._data[t*Te+0],s=n&2097151;return[this._data[t*Te+1],n&2097152?this._combined[t]:s?dr(s):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):s]}set(t,n){this._data[t*Te+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*Te+0]=t|2097152|n[2]<<22):this._data[t*Te+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*Te+0]>>22}hasWidth(t){return this._data[t*Te+0]&12582912}getFg(t){return this._data[t*Te+1]}getBg(t){return this._data[t*Te+2]}hasContent(t){return this._data[t*Te+0]&4194303}getCodePoint(t){let n=this._data[t*Te+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*Te+0]&2097152}getString(t){let n=this._data[t*Te+0];return n&2097152?this._combined[t]:n&2097151?dr(n&2097151):""}isProtected(t){return this._data[t*Te+2]&536870912}loadCell(t,n){return Xo=t*Te,n.content=this._data[Xo+0],n.fg=this._data[Xo+1],n.bg=this._data[Xo+2],n.content&2097152&&(n.combinedData=this._combined[t]),n.bg&268435456&&(n.extended=this._extendedAttrs[t]),n}setCell(t,n){n.content&2097152&&(this._combined[t]=n.combinedData),n.bg&268435456&&(this._extendedAttrs[t]=n.extended),this._data[t*Te+0]=n.content,this._data[t*Te+1]=n.fg,this._data[t*Te+2]=n.bg}setCellFromCodepoint(t,n,s,a){a.bg&268435456&&(this._extendedAttrs[t]=a.extended),this._data[t*Te+0]=n|s<<22,this._data[t*Te+1]=a.fg,this._data[t*Te+2]=a.bg}addCodepointToCell(t,n,s){let a=this._data[t*Te+0];a&2097152?this._combined[t]+=dr(n):a&2097151?(this._combined[t]=dr(a&2097151)+dr(n),a&=-2097152,a|=2097152):a=n|1<<22,s&&(a&=-12582913,a|=s<<22),this._data[t*Te+0]=a}insertCells(t,n,s){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),n<this.length-t){let a=new Vi;for(let o=this.length-t-n-1;o>=0;--o)this.setCell(t+n+o,this.loadCell(t+o,a));for(let o=0;o<n;++o)this.setCell(t+o,s)}else for(let a=t;a<this.length;++a)this.setCell(a,s);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,s)}deleteCells(t,n,s){if(t%=this.length,n<this.length-t){let a=new Vi;for(let o=0;o<this.length-t-n;++o)this.setCell(t+o,this.loadCell(t+n+o,a));for(let o=this.length-n;o<this.length;++o)this.setCell(o,s)}else for(let a=t;a<this.length;++a)this.setCell(a,s);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,s)}replaceCells(t,n,s,a=!1){if(a){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,s),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,s);t<n&&t<this.length;)this.isProtected(t)||this.setCell(t,s),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,s);t<n&&t<this.length;)this.setCell(t++,s)}resize(t,n){if(t===this.length)return this._data.length*4*tf<this._data.buffer.byteLength;let s=t*Te;if(t>this.length){if(this._data.buffer.byteLength>=s*4)this._data=new Uint32Array(this._data.buffer,0,s);else{let a=new Uint32Array(s);a.set(this._data),this._data=a}for(let a=this.length;a<t;++a)this.setCell(a,n)}else{this._data=this._data.subarray(0,s);let a=Object.keys(this._combined);for(let c=0;c<a.length;c++){let f=parseInt(a[c],10);f>=t&&delete this._combined[f]}let o=Object.keys(this._extendedAttrs);for(let c=0;c<o.length;c++){let f=parseInt(o[c],10);f>=t&&delete this._extendedAttrs[f]}}return this.length=t,s*4*tf<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*tf<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,n=!1){if(n){for(let s=0;s<this.length;++s)this.isProtected(s)||this.setCell(s,t);return}this._combined={},this._extendedAttrs={};for(let s=0;s<this.length;++s)this.setCell(s,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 n in t._combined)this._combined[n]=t._combined[n];this._extendedAttrs={};for(let n in t._extendedAttrs)this._extendedAttrs[n]=t._extendedAttrs[n];this.isWrapped=t.isWrapped}clone(){let t=new NS(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let n in this._combined)t._combined[n]=this._combined[n];for(let n in this._extendedAttrs)t._extendedAttrs[n]=this._extendedAttrs[n];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Te+0]&4194303)return t+(this._data[t*Te+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Te+0]&4194303||this._data[t*Te+2]&50331648)return t+(this._data[t*Te+0]>>22);return 0}copyCellsFrom(t,n,s,a,o){let c=t._data;if(o)for(let p=a-1;p>=0;p--){for(let h=0;h<Te;h++)this._data[(s+p)*Te+h]=c[(n+p)*Te+h];c[(n+p)*Te+2]&268435456&&(this._extendedAttrs[s+p]=t._extendedAttrs[n+p])}else for(let p=0;p<a;p++){for(let h=0;h<Te;h++)this._data[(s+p)*Te+h]=c[(n+p)*Te+h];c[(n+p)*Te+2]&268435456&&(this._extendedAttrs[s+p]=t._extendedAttrs[n+p])}let f=Object.keys(t._combined);for(let p=0;p<f.length;p++){let h=parseInt(f[p],10);h>=n&&(this._combined[h-n+s]=t._combined[h])}}translateToString(t,n,s,a){n=n??0,s=s??this.length,t&&(s=Math.min(s,this.getTrimmedLength())),a&&(a.length=0);let o="";for(;n<s;){let c=this._data[n*Te+0],f=c&2097151,p=c&2097152?this._combined[n]:f?dr(f):_r;if(o+=p,a)for(let h=0;h<p.length;++h)a.push(n);n+=c>>22||1}return a&&a.push(n),o}};function JC(e,t,n,s,a,o){let c=[];for(let f=0;f<e.length-1;f++){let p=f,h=e.get(++p);if(!h.isWrapped)continue;let g=[e.get(f)];for(;p<e.length&&h.isWrapped;)g.push(h),h=e.get(++p);if(!o&&s>=f&&s<p){f+=g.length-1;continue}let m=0,S=fa(g,m,t),v=1,b=0;for(;v<g.length;){let B=fa(g,v,t),D=B-b,G=n-S,A=Math.min(D,G);g[m].copyCellsFrom(g[v],b,S,A,!1),S+=A,S===n&&(m++,S=0),b+=A,b===B&&(v++,b=0),S===0&&m!==0&&g[m-1].getWidth(n-1)===2&&(g[m].copyCellsFrom(g[m-1],n-1,S++,1,!1),g[m-1].setCell(n-1,a))}g[m].replaceCells(S,n,a);let k=0;for(let B=g.length-1;B>0&&(B>m||g[B].getTrimmedLength()===0);B--)k++;k>0&&(c.push(f+g.length-k),c.push(k)),f+=g.length-1}return c}function e2(e,t){let n=[],s=0,a=t[s],o=0;for(let c=0;c<e.length;c++)if(a===c){let f=t[++s];e.onDeleteEmitter.fire({index:c-o,amount:f}),c+=f-1,o+=f,a=t[++s]}else n.push(c);return{layout:n,countRemoved:o}}function t2(e,t){let n=[];for(let s=0;s<t.length;s++)n.push(e.get(t[s]));for(let s=0;s<n.length;s++)e.set(s,n[s]);e.length=t.length}function i2(e,t,n){let s=[],a=e.map((p,h)=>fa(e,h,t)).reduce((p,h)=>p+h),o=0,c=0,f=0;for(;f<a;){if(a-f<n){s.push(a-f);break}o+=n;let p=fa(e,c,t);o>p&&(o-=p,c++);let h=e[c].getWidth(o-1)===2;h&&o--;let g=h?n-1:n;s.push(g),f+=g}return s}function fa(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let s=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,a=e[t+1].getWidth(0)===2;return s&&a?n-1:n}var OS=class HS{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=HS._nextId++,this._onDispose=this.register(new ue),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Wr(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};OS._nextId=1;var n2=OS,Et={},Ir=Et.B;Et[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:"≥","{":"π","|":"≠","}":"£","~":"·"};Et.A={"#":"£"};Et.B=void 0;Et[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Et.C=Et[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Et.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Et.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Et.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Et.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Et.E=Et[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Et.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Et.H=Et[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Et["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var Bv=4294967295,Lv=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=St.clone(),this.savedCharset=Ir,this.markers=[],this._nullCell=Vi.fromCharData([0,eS,1,0]),this._whitespaceCell=Vi.fromCharData([0,_r,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new fu,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Mv(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 ou),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 ou),this._whitespaceCell}getBlankLine(e,t){return new na(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>Bv?Bv:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=St);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 Mv(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(St),s=0,a=this._getCorrectBufferLength(t);if(a>this.lines.maxLength&&(this.lines.maxLength=a),this.lines.length>0){if(this._cols<e)for(let c=0;c<this.lines.length;c++)s+=+this.lines.get(c).resize(e,n);let o=0;if(this._rows<t)for(let c=this._rows;c<t;c++)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 na(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+o+1?(this.ybase--,o++,this.ydisp>0&&this.ydisp--):this.lines.push(new na(e,n)));else for(let c=this._rows;c>t;c--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(a<this.lines.maxLength){let c=this.lines.length-a;c>0&&(this.lines.trimStart(c),this.ybase=Math.max(this.ybase-c,0),this.ydisp=Math.max(this.ydisp-c,0),this.savedY=Math.max(this.savedY-c,0)),this.lines.maxLength=a}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),o&&(this.y+=o),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 o=0;o<this.lines.length;o++)s+=+this.lines.get(o).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),s>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&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 n=this._optionsService.rawOptions.reflowCursorLine,s=JC(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(St),n);if(s.length>0){let a=e2(this.lines,s);t2(this.lines,a.layout),this._reflowLargerAdjustViewport(e,t,a.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let s=this.getNullCell(St),a=n;for(;a-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new na(e,s))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,s=this.getNullCell(St),a=[],o=0;for(let c=this.lines.length-1;c>=0;c--){let f=this.lines.get(c);if(!f||!f.isWrapped&&f.getTrimmedLength()<=e)continue;let p=[f];for(;f.isWrapped&&c>0;)f=this.lines.get(--c),p.unshift(f);if(!n){let A=this.ybase+this.y;if(A>=c&&A<c+p.length)continue}let h=p[p.length-1].getTrimmedLength(),g=i2(p,this._cols,e),m=g.length-p.length,S;this.ybase===0&&this.y!==this.lines.length-1?S=Math.max(0,this.y-this.lines.maxLength+m):S=Math.max(0,this.lines.length-this.lines.maxLength+m);let v=[];for(let A=0;A<m;A++){let N=this.getBlankLine(St,!0);v.push(N)}v.length>0&&(a.push({start:c+p.length+o,newLines:v}),o+=v.length),p.push(...v);let b=g.length-1,k=g[b];k===0&&(b--,k=g[b]);let B=p.length-m-1,D=h;for(;B>=0;){let A=Math.min(D,k);if(p[b]===void 0)break;if(p[b].copyCellsFrom(p[B],D-A,k-A,A,!0),k-=A,k===0&&(b--,k=g[b]),D-=A,D===0){B--;let N=Math.max(B,0);D=fa(p,N,this._cols)}}for(let A=0;A<p.length;A++)g[A]<e&&p[A].setCell(g[A],s);let G=m-S;for(;G-- >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+o)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+m,this.ybase+t-1)}if(a.length>0){let c=[],f=[];for(let k=0;k<this.lines.length;k++)f.push(this.lines.get(k));let p=this.lines.length,h=p-1,g=0,m=a[g];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+o);let S=0;for(let k=Math.min(this.lines.maxLength-1,p+o-1);k>=0;k--)if(m&&m.start>h+S){for(let B=m.newLines.length-1;B>=0;B--)this.lines.set(k--,m.newLines[B]);k++,c.push({index:h+1,amount:m.newLines.length}),S+=m.newLines.length,m=a[++g]}else this.lines.set(k,f[h--]);let v=0;for(let k=c.length-1;k>=0;k--)c[k].index+=v,this.lines.onInsertEmitter.fire(c[k]),v+=c[k].amount;let b=Math.max(0,p+o-this.lines.maxLength);b>0&&this.lines.onTrimEmitter.fire(b)}}translateBufferLineToString(e,t,n=0,s){let a=this.lines.get(e);return a?a.translateToString(t,n,s):""}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(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 n2(e);return this.markers.push(t),t.register(this.lines.onTrim(n=>{t.line-=n,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(n=>{t.line>=n.index&&(t.line+=n.amount)})),t.register(this.lines.onDelete(n=>{t.line>=n.index&&t.line<n.index+n.amount&&t.dispose(),t.line>n.index&&(t.line-=n.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},r2=class extends Ae{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new ue),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 Lv(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new Lv(!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)}},jS=2,US=1,nd=class extends Ae{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new ue),this.onResize=this._onResize.event,this._onScroll=this._register(new ue),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,jS),this.rows=Math.max(e.rawOptions.rows||0,US),this.buffers=this._register(new r2(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,s=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:s})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,s;s=this._cachedBlankLine,(!s||s.length!==this.cols||s.getFg(0)!==e.fg||s.getBg(0)!==e.bg)&&(s=n.getBlankLine(e,t),this._cachedBlankLine=s),s.isWrapped=t;let a=n.ybase+n.scrollTop,o=n.ybase+n.scrollBottom;if(n.scrollTop===0){let c=n.lines.isFull;o===n.lines.length-1?c?n.lines.recycle().copyFrom(s):n.lines.push(s.clone()):n.lines.splice(o+1,0,s.clone()),c?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let c=o-a+1;n.lines.shiftElements(a+1,c-1,-1),n.lines.set(o,s.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let s=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),s!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};nd=ht([fe(0,si)],nd);var js={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:hu,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},s2=["normal","bold","100","200","300","400","500","600","700","800","900"],l2=class extends Ae{constructor(e){super(),this._onOptionChange=this._register(new ue),this.onOptionChange=this._onOptionChange.event;let t={...js};for(let n in e)if(n in t)try{let s=e[n];t[n]=this._sanitizeAndValidateOption(n,s)}catch(s){console.error(s)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(rt(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=n=>{if(!(n in js))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,s)=>{if(!(n in js))throw new Error(`No option with key "${n}"`);s=this._sanitizeAndValidateOption(n,s),this.rawOptions[n]!==s&&(this.rawOptions[n]=s,this._onOptionChange.fire(n))};for(let n in this.rawOptions){let s={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,s)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=js[e]),!a2(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=js[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=s2.includes(t)?t:js[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 a2(e){return e==="block"||e==="underline"||e==="bar"}function ra(e,t=5){if(typeof e!="object")return e;let n=Array.isArray(e)?[]:{};for(let s in e)n[s]=t<=1?e[s]:e[s]&&ra(e[s],t-1);return n}var zv=Object.freeze({insertMode:!1}),Nv=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),rd=class extends Ae{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new ue),this.onData=this._onData.event,this._onUserInput=this._register(new ue),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new ue),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new ue),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=ra(zv),this.decPrivateModes=ra(Nv)}reset(){this.modes=ra(zv),this.decPrivateModes=ra(Nv)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(s=>s.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))}};rd=ht([fe(0,ri),fe(1,sS),fe(2,si)],rd);var Ov={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 nf(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var rf=String.fromCharCode,Hv={DEFAULT:e=>{let t=[nf(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${rf(t[0])}${rf(t[1])}${rf(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${nf(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${nf(e,!0)};${e.x};${e.y}${t}`}},sd=class extends Ae{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new ue),this.onProtocolChange=this._onProtocolChange.event;for(let s of Object.keys(Ov))this.addProtocol(s,Ov[s]);for(let s of Object.keys(Hv))this.addEncoding(s,Hv[s]);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,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let s=t/n,a=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(a/=s+0,Math.abs(e.deltaY)<50&&(a*=.3),this._wheelPartialScroll+=a,a=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(a*=this._bufferService.rows),a}_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,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};sd=ht([fe(0,ri),fe(1,Kr),fe(2,si)],sd);var sf=[[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]],o2=[[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]],kt;function u2(e,t){let n=0,s=t.length-1,a;if(e<t[0][0]||e>t[s][1])return!1;for(;s>=n;)if(a=n+s>>1,e>t[a][1])n=a+1;else if(e<t[a][0])s=a-1;else return!0;return!1}var c2=class{constructor(){if(this.version="6",!kt){kt=new Uint8Array(65536),kt.fill(1),kt[0]=0,kt.fill(0,1,32),kt.fill(0,127,160),kt.fill(2,4352,4448),kt[9001]=2,kt[9002]=2,kt.fill(2,11904,42192),kt[12351]=1,kt.fill(2,44032,55204),kt.fill(2,63744,64256),kt.fill(2,65040,65050),kt.fill(2,65072,65136),kt.fill(2,65280,65377),kt.fill(2,65504,65511);for(let e=0;e<sf.length;++e)kt.fill(0,sf[e][0],sf[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?kt[e]:u2(e,o2)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),s=n===0&&t!==0;if(s){let a=Fr.extractWidth(t);a===0?s=!1:a>n&&(n=a)}return Fr.createPropertyValue(0,n,s)}},Fr=class su{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new ue,this.onChange=this._onChange.event;let t=new c2;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,n,s=!1){return(t&16777215)<<3|(n&3)<<1|(s?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 n=0,s=0,a=t.length;for(let o=0;o<a;++o){let c=t.charCodeAt(o);if(55296<=c&&c<=56319){if(++o>=a)return n+this.wcwidth(c);let h=t.charCodeAt(o);56320<=h&&h<=57343?c=(c-55296)*1024+h-56320+65536:n+=this.wcwidth(h)}let f=this.charProperties(c,s),p=su.extractWidth(f);su.extractShouldJoin(f)&&(p-=su.extractWidth(s)),n+=p,s=f}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},h2=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 jv(e){var s;let t=(s=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:s.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var Xl=2147483647,f2=256,PS=class ld{constructor(t=32,n=32){if(this.maxLength=t,this.maxSubParamsLength=n,n>f2)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(n),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new ld;if(!t.length)return n;for(let s=Array.isArray(t[0])?1:0;s<t.length;++s){let a=t[s];if(Array.isArray(a))for(let o=0;o<a.length;++o)n.addSubParam(a[o]);else n.addParam(a)}return n}clone(){let t=new ld(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 n=0;n<this.length;++n){t.push(this.params[n]);let s=this._subParamsIdx[n]>>8,a=this._subParamsIdx[n]&255;a-s>0&&t.push(Array.prototype.slice.call(this._subParams,s,a))}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>Xl?Xl: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>Xl?Xl:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let n=this._subParamsIdx[t]>>8,s=this._subParamsIdx[t]&255;return s-n>0?this._subParams.subarray(n,s):null}getSubParamsAll(){let t={};for(let n=0;n<this.length;++n){let s=this._subParamsIdx[n]>>8,a=this._subParamsIdx[n]&255;a-s>0&&(t[n]=this._subParams.slice(s,a))}return t}addDigit(t){let n;if(this._rejectDigits||!(n=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let s=this._digitIsSub?this._subParams:this.params,a=s[n-1];s[n-1]=~a?Math.min(a*10+t,Xl):t}},$l=[],d2=class{constructor(){this._state=0,this._active=$l,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 n=this._handlers[e];return n.push(t),{dispose:()=>{let s=n.indexOf(t);s!==-1&&n.splice(s,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=$l}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=$l,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||$l,!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,n){if(!this._active.length)this._handlerFb(this._id,"PUT",vu(e,t,n));else for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let s=e[t++];if(s===59){this._state=2,this._start();break}if(s<48||57<s){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+s-48}this._state===2&&n-t>0&&this._put(e,t,n)}}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 n=!1,s=this._active.length-1,a=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,n=t,a=this._stack.fallThrough,this._stack.paused=!1),!a&&n===!1){for(;s>=0&&(n=this._active[s].end(e),n!==!0);s--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,n;s--}for(;s>=0;s--)if(n=this._active[s].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,n}this._active=$l,this._id=-1,this._state=0}}},Ai=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=vu(e,t,n),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(n=>(this._data="",this._hitLimit=!1,n));return this._data="",this._hitLimit=!1,t}},Gl=[],p2=class{constructor(){this._handlers=Object.create(null),this._active=Gl,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Gl}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let s=n.indexOf(t);s!==-1&&n.splice(s,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=Gl,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Gl,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let n=this._active.length-1;n>=0;n--)this._active[n].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,"PUT",vu(e,t,n));else for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let n=!1,s=this._active.length-1,a=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,n=t,a=this._stack.fallThrough,this._stack.paused=!1),!a&&n===!1){for(;s>=0&&(n=this._active[s].unhook(e),n!==!0);s--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,n;s--}for(;s>=0;s--)if(n=this._active[s].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,n}this._active=Gl,this._ident=0}},sa=new PS;sa.addParam(0);var Uv=class{constructor(e){this._handler=e,this._data="",this._params=sa,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():sa,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=vu(e,t,n),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(n=>(this._params=sa,this._data="",this._hitLimit=!1,n));return this._params=sa,this._data="",this._hitLimit=!1,t}},_2=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,s){this.table[t<<8|e]=n<<4|s}addMany(e,t,n,s){for(let a=0;a<e.length;a++)this.table[t<<8|e[a]]=n<<4|s}},Wi=160,m2=(function(){let e=new _2(4095),t=Array.apply(null,Array(256)).map((f,p)=>p),n=(f,p)=>t.slice(f,p),s=n(32,127),a=n(0,24);a.push(25),a.push.apply(a,n(28,32));let o=n(0,14),c;e.setDefault(1,0),e.addMany(s,0,2,0);for(c in o)e.addMany([24,26,153,154],c,3,0),e.addMany(n(128,144),c,3,0),e.addMany(n(144,152),c,3,0),e.add(156,c,0,0),e.add(27,c,11,1),e.add(157,c,4,8),e.addMany([152,158,159],c,0,7),e.add(155,c,11,3),e.add(144,c,11,9);return e.addMany(a,0,3,0),e.addMany(a,1,3,1),e.add(127,1,0,1),e.addMany(a,8,0,8),e.addMany(a,3,3,3),e.add(127,3,0,3),e.addMany(a,4,3,4),e.add(127,4,0,4),e.addMany(a,6,3,6),e.addMany(a,5,3,5),e.add(127,5,0,5),e.addMany(a,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(s,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(s,7,0,7),e.addMany(a,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(a,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(a,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(a,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(a,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(a,13,13,13),e.addMany(s,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(Wi,0,2,0),e.add(Wi,8,5,8),e.add(Wi,6,0,6),e.add(Wi,11,0,11),e.add(Wi,13,13,13),e})(),g2=class extends Ae{constructor(e=m2){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 PS,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,n,s)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,n)=>{},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(rt(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new d2),this._dcsParser=this._register(new p2),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let a=0;a<e.intermediates.length;++a){let o=e.intermediates.charCodeAt(a);if(32>o||o>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=o}}if(e.final.length!==1)throw new Error("final must be a single byte");let s=e.final.charCodeAt(0);if(t[0]>s||s>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=s,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let s=this._escHandlers[n];return s.push(t),{dispose:()=>{let a=s.indexOf(t);a!==-1&&s.splice(a,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 n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let s=this._csiHandlers[n];return s.push(t),{dispose:()=>{let a=s.indexOf(t);a!==-1&&s.splice(a,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,n,s,a){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=s,this._parseStack.chunkPos=a}parse(e,t,n){let s=0,a=0,o=0,c;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let f=this._parseStack.handlers,p=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&p>-1){for(;p>=0&&(c=f[p](this._params),c!==!0);p--)if(c instanceof Promise)return this._parseStack.handlerPos=p,c}this._parseStack.handlers=[];break;case 4:if(n===!1&&p>-1){for(;p>=0&&(c=f[p](),c!==!0);p--)if(c instanceof Promise)return this._parseStack.handlerPos=p,c}this._parseStack.handlers=[];break;case 6:if(s=e[this._parseStack.chunkPos],c=this._dcsParser.unhook(s!==24&&s!==26,n),c)return c;s===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(s=e[this._parseStack.chunkPos],c=this._oscParser.end(s!==24&&s!==26,n),c)return c;s===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let f=o;f<t;++f){switch(s=e[f],a=this._transitions.table[this.currentState<<8|(s<160?s:Wi)],a>>4){case 2:for(let S=f+1;;++S){if(S>=t||(s=e[S])<32||s>126&&s<Wi){this._printHandler(e,f,S),f=S-1;break}if(++S>=t||(s=e[S])<32||s>126&&s<Wi){this._printHandler(e,f,S),f=S-1;break}if(++S>=t||(s=e[S])<32||s>126&&s<Wi){this._printHandler(e,f,S),f=S-1;break}if(++S>=t||(s=e[S])<32||s>126&&s<Wi){this._printHandler(e,f,S),f=S-1;break}}break;case 3:this._executeHandlers[s]?this._executeHandlers[s]():this._executeHandlerFb(s),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:f,code:s,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let p=this._csiHandlers[this._collect<<8|s],h=p?p.length-1:-1;for(;h>=0&&(c=p[h](this._params),c!==!0);h--)if(c instanceof Promise)return this._preserveStack(3,p,h,a,f),c;h<0&&this._csiHandlerFb(this._collect<<8|s,this._params),this.precedingJoinState=0;break;case 8:do switch(s){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(s-48)}while(++f<t&&(s=e[f])>47&&s<60);f--;break;case 9:this._collect<<=8,this._collect|=s;break;case 10:let g=this._escHandlers[this._collect<<8|s],m=g?g.length-1:-1;for(;m>=0&&(c=g[m](),c!==!0);m--)if(c instanceof Promise)return this._preserveStack(4,g,m,a,f),c;m<0&&this._escHandlerFb(this._collect<<8|s),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|s,this._params);break;case 13:for(let S=f+1;;++S)if(S>=t||(s=e[S])===24||s===26||s===27||s>127&&s<Wi){this._dcsParser.put(e,f,S),f=S-1;break}break;case 14:if(c=this._dcsParser.unhook(s!==24&&s!==26),c)return this._preserveStack(6,[],0,a,f),c;s===27&&(a|=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 S=f+1;;S++)if(S>=t||(s=e[S])<32||s>127&&s<Wi){this._oscParser.put(e,f,S),f=S-1;break}break;case 6:if(c=this._oscParser.end(s!==24&&s!==26),c)return this._preserveStack(5,[],0,a,f),c;s===27&&(a|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=a&15}}},v2=/^([\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})$/,y2=/^[\da-f]+$/;function Pv(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let n=v2.exec(t);if(n){let s=n[1]?15:n[4]?255:n[7]?4095:65535;return[Math.round(parseInt(n[1]||n[4]||n[7]||n[10],16)/s*255),Math.round(parseInt(n[2]||n[5]||n[8]||n[11],16)/s*255),Math.round(parseInt(n[3]||n[6]||n[9]||n[12],16)/s*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),y2.exec(t)&&[3,6,9,12].includes(t.length))){let n=t.length/3,s=[0,0,0];for(let a=0;a<3;++a){let o=parseInt(t.slice(n*a,n*a+n),16);s[a]=n===1?o<<4:n===2?o:n===3?o>>4:o>>8}return s}}function lf(e,t){let n=e.toString(16),s=n.length<2?"0"+n:n;switch(t){case 4:return n[0];case 8:return s;case 12:return(s+s).slice(0,3);default:return s+s}}function S2(e,t=16){let[n,s,a]=e;return`rgb:${lf(n,t)}/${lf(s,t)}/${lf(a,t)}`}var b2={"(":0,")":1,"*":2,"+":3,"-":1,".":2},hr=131072,Iv=10;function Fv(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 qv=5e3,Wv=0,x2=class extends Ae{constructor(e,t,n,s,a,o,c,f,p=new g2){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=s,this._optionsService=a,this._oscLinkService=o,this._coreMouseService=c,this._unicodeService=f,this._parser=p,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new Ix,this._utf8Decoder=new Fx,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=St.clone(),this._eraseAttrDataInternal=St.clone(),this._onRequestBell=this._register(new ue),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new ue),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new ue),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new ue),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new ue),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new ue),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new ue),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new ue),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new ue),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new ue),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new ue),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new ue),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new ue),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 ad(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(h=>this._activeBuffer=h.activeBuffer)),this._parser.setCsiHandlerFallback((h,g)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(h),params:g.toArray()})}),this._parser.setEscHandlerFallback(h=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(h)})}),this._parser.setExecuteHandlerFallback(h=>{this._logService.debug("Unknown EXECUTE code: ",{code:h})}),this._parser.setOscHandlerFallback((h,g,m)=>{this._logService.debug("Unknown OSC code: ",{identifier:h,action:g,data:m})}),this._parser.setDcsHandlerFallback((h,g,m)=>{g==="HOOK"&&(m=m.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(h),action:g,payload:m})}),this._parser.setPrintHandler((h,g,m)=>this.print(h,g,m)),this._parser.registerCsiHandler({final:"@"},h=>this.insertChars(h)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},h=>this.scrollLeft(h)),this._parser.registerCsiHandler({final:"A"},h=>this.cursorUp(h)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},h=>this.scrollRight(h)),this._parser.registerCsiHandler({final:"B"},h=>this.cursorDown(h)),this._parser.registerCsiHandler({final:"C"},h=>this.cursorForward(h)),this._parser.registerCsiHandler({final:"D"},h=>this.cursorBackward(h)),this._parser.registerCsiHandler({final:"E"},h=>this.cursorNextLine(h)),this._parser.registerCsiHandler({final:"F"},h=>this.cursorPrecedingLine(h)),this._parser.registerCsiHandler({final:"G"},h=>this.cursorCharAbsolute(h)),this._parser.registerCsiHandler({final:"H"},h=>this.cursorPosition(h)),this._parser.registerCsiHandler({final:"I"},h=>this.cursorForwardTab(h)),this._parser.registerCsiHandler({final:"J"},h=>this.eraseInDisplay(h,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},h=>this.eraseInDisplay(h,!0)),this._parser.registerCsiHandler({final:"K"},h=>this.eraseInLine(h,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},h=>this.eraseInLine(h,!0)),this._parser.registerCsiHandler({final:"L"},h=>this.insertLines(h)),this._parser.registerCsiHandler({final:"M"},h=>this.deleteLines(h)),this._parser.registerCsiHandler({final:"P"},h=>this.deleteChars(h)),this._parser.registerCsiHandler({final:"S"},h=>this.scrollUp(h)),this._parser.registerCsiHandler({final:"T"},h=>this.scrollDown(h)),this._parser.registerCsiHandler({final:"X"},h=>this.eraseChars(h)),this._parser.registerCsiHandler({final:"Z"},h=>this.cursorBackwardTab(h)),this._parser.registerCsiHandler({final:"`"},h=>this.charPosAbsolute(h)),this._parser.registerCsiHandler({final:"a"},h=>this.hPositionRelative(h)),this._parser.registerCsiHandler({final:"b"},h=>this.repeatPrecedingCharacter(h)),this._parser.registerCsiHandler({final:"c"},h=>this.sendDeviceAttributesPrimary(h)),this._parser.registerCsiHandler({prefix:">",final:"c"},h=>this.sendDeviceAttributesSecondary(h)),this._parser.registerCsiHandler({final:"d"},h=>this.linePosAbsolute(h)),this._parser.registerCsiHandler({final:"e"},h=>this.vPositionRelative(h)),this._parser.registerCsiHandler({final:"f"},h=>this.hVPosition(h)),this._parser.registerCsiHandler({final:"g"},h=>this.tabClear(h)),this._parser.registerCsiHandler({final:"h"},h=>this.setMode(h)),this._parser.registerCsiHandler({prefix:"?",final:"h"},h=>this.setModePrivate(h)),this._parser.registerCsiHandler({final:"l"},h=>this.resetMode(h)),this._parser.registerCsiHandler({prefix:"?",final:"l"},h=>this.resetModePrivate(h)),this._parser.registerCsiHandler({final:"m"},h=>this.charAttributes(h)),this._parser.registerCsiHandler({final:"n"},h=>this.deviceStatus(h)),this._parser.registerCsiHandler({prefix:"?",final:"n"},h=>this.deviceStatusPrivate(h)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},h=>this.softReset(h)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},h=>this.setCursorStyle(h)),this._parser.registerCsiHandler({final:"r"},h=>this.setScrollRegion(h)),this._parser.registerCsiHandler({final:"s"},h=>this.saveCursor(h)),this._parser.registerCsiHandler({final:"t"},h=>this.windowOptions(h)),this._parser.registerCsiHandler({final:"u"},h=>this.restoreCursor(h)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},h=>this.insertColumns(h)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},h=>this.deleteColumns(h)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},h=>this.selectProtected(h)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},h=>this.requestMode(h,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},h=>this.requestMode(h,!1)),this._parser.setExecuteHandler(ie.BEL,()=>this.bell()),this._parser.setExecuteHandler(ie.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(ie.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(ie.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(ie.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(ie.BS,()=>this.backspace()),this._parser.setExecuteHandler(ie.HT,()=>this.tab()),this._parser.setExecuteHandler(ie.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(ie.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(nu.IND,()=>this.index()),this._parser.setExecuteHandler(nu.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(nu.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Ai(h=>(this.setTitle(h),this.setIconName(h),!0))),this._parser.registerOscHandler(1,new Ai(h=>this.setIconName(h))),this._parser.registerOscHandler(2,new Ai(h=>this.setTitle(h))),this._parser.registerOscHandler(4,new Ai(h=>this.setOrReportIndexedColor(h))),this._parser.registerOscHandler(8,new Ai(h=>this.setHyperlink(h))),this._parser.registerOscHandler(10,new Ai(h=>this.setOrReportFgColor(h))),this._parser.registerOscHandler(11,new Ai(h=>this.setOrReportBgColor(h))),this._parser.registerOscHandler(12,new Ai(h=>this.setOrReportCursorColor(h))),this._parser.registerOscHandler(104,new Ai(h=>this.restoreIndexedColor(h))),this._parser.registerOscHandler(110,new Ai(h=>this.restoreFgColor(h))),this._parser.registerOscHandler(111,new Ai(h=>this.restoreBgColor(h))),this._parser.registerOscHandler(112,new Ai(h=>this.restoreCursorColor(h))),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 h in Et)this._parser.registerEscHandler({intermediates:"(",final:h},()=>this.selectCharset("("+h)),this._parser.registerEscHandler({intermediates:")",final:h},()=>this.selectCharset(")"+h)),this._parser.registerEscHandler({intermediates:"*",final:h},()=>this.selectCharset("*"+h)),this._parser.registerEscHandler({intermediates:"+",final:h},()=>this.selectCharset("+"+h)),this._parser.registerEscHandler({intermediates:"-",final:h},()=>this.selectCharset("-"+h)),this._parser.registerEscHandler({intermediates:".",final:h},()=>this.selectCharset("."+h)),this._parser.registerEscHandler({intermediates:"/",final:h},()=>this.selectCharset("/"+h));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(h=>(this._logService.error("Parsing error: ",h),h)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new Uv((h,g)=>this.requestStatusString(h,g)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,s){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=s}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,n)=>setTimeout(()=>n("#SLOW_TIMEOUT"),qv))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${qv} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,s=this._activeBuffer.x,a=this._activeBuffer.y,o=0,c=this._parseStack.paused;if(c){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;s=this._parseStack.cursorStartX,a=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>hr&&(o=this._parseStack.position+hr)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,h=>String.fromCharCode(h)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(h=>h.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<hr&&(this._parseBuffer=new Uint32Array(Math.min(e.length,hr))),c||this._dirtyRowTracker.clearRange(),e.length>hr)for(let h=o;h<e.length;h+=hr){let g=h+hr<e.length?h+hr:e.length,m=typeof e=="string"?this._stringDecoder.decode(e.substring(h,g),this._parseBuffer):this._utf8Decoder.decode(e.subarray(h,g),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,m))return this._preserveStack(s,a,m,h),this._logSlowResolvingAsync(n),n}else if(!c){let h=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,h))return this._preserveStack(s,a,h,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==s||this._activeBuffer.y!==a)&&this._onCursorMove.fire();let f=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),p=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);p<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(p,this._bufferService.rows-1),end:Math.min(f,this._bufferService.rows-1)})}print(e,t,n){let s,a,o=this._charsetService.charset,c=this._optionsService.rawOptions.screenReaderMode,f=this._bufferService.cols,p=this._coreService.decPrivateModes.wraparound,h=this._coreService.modes.insertMode,g=this._curAttrData,m=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&m.getWidth(this._activeBuffer.x-1)===2&&m.setCellFromCodepoint(this._activeBuffer.x-1,0,1,g);let S=this._parser.precedingJoinState;for(let v=t;v<n;++v){if(s=e[v],s<127&&o){let D=o[String.fromCharCode(s)];D&&(s=D.charCodeAt(0))}let b=this._unicodeService.charProperties(s,S);a=Fr.extractWidth(b);let k=Fr.extractShouldJoin(b),B=k?Fr.extractWidth(S):0;if(S=b,c&&this._onA11yChar.fire(dr(s)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+a-B>f){if(p){let D=m,G=this._activeBuffer.x-B;for(this._activeBuffer.x=B,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),m=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),B>0&&m instanceof na&&m.copyCellsFrom(D,G,0,B,!1);G<f;)D.setCellFromCodepoint(G++,0,1,g)}else if(this._activeBuffer.x=f-1,a===2)continue}if(k&&this._activeBuffer.x){let D=m.getWidth(this._activeBuffer.x-1)?1:2;m.addCodepointToCell(this._activeBuffer.x-D,s,a);for(let G=a-B;--G>=0;)m.setCellFromCodepoint(this._activeBuffer.x++,0,0,g);continue}if(h&&(m.insertCells(this._activeBuffer.x,a-B,this._activeBuffer.getNullCell(g)),m.getWidth(f-1)===2&&m.setCellFromCodepoint(f-1,0,1,g)),m.setCellFromCodepoint(this._activeBuffer.x++,s,a,g),a>0)for(;--a;)m.setCellFromCodepoint(this._activeBuffer.x++,0,0,g)}this._parser.precedingJoinState=S,this._activeBuffer.x<f&&n-t>0&&m.getWidth(this._activeBuffer.x)===0&&!m.hasContent(this._activeBuffer.x)&&m.setCellFromCodepoint(this._activeBuffer.x,0,1,g),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,n=>Fv(n.params[0],this._optionsService.rawOptions.windowOptions)?t(n):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new Uv(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Ai(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,n,s=!1,a=!1){let o=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);o.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),a),s&&(o.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){var s;this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!((s=this._activeBuffer.lines.get(this._activeBuffer.ybase+n))!=null&&s.getTrimmedLength()););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let a=this._activeBuffer.lines.length-this._bufferService.rows;a>0&&(this._activeBuffer.lines.trimStart(a),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-a,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-a,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 n=this._activeBuffer.ybase+this._activeBuffer.y,s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,a=this._bufferService.rows-1+this._activeBuffer.ybase-s+1;for(;t--;)this._activeBuffer.lines.splice(a-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,s;for(s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-s;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(s,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(St));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);s.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);s.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);s.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);s.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,s=Fr.extractWidth(t),a=this._activeBuffer.x-s,o=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(a),c=new Uint32Array(o.length*n),f=0;for(let h=0;h<o.length;){let g=o.codePointAt(h)||0;c[f++]=g,h+=g>65535?2:1}let p=f;for(let h=1;h<n;++h)c.copyWithin(p,0,f),p+=f;return this.print(c,0,p),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(ie.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(ie.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(ie.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(ie.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(ie.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,Ir),this._charsetService.setgCharset(1,Ir),this._charsetService.setgCharset(2,Ir),this._charsetService.setgCharset(3,Ir);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){(k=>(k[k.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",k[k.SET=1]="SET",k[k.RESET=2]="RESET",k[k.PERMANENTLY_SET=3]="PERMANENTLY_SET",k[k.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(n={}));let s=this._coreService.decPrivateModes,{activeProtocol:a,activeEncoding:o}=this._coreMouseService,c=this._coreService,{buffers:f,cols:p}=this._bufferService,{active:h,alt:g}=f,m=this._optionsService.rawOptions,S=(k,B)=>(c.triggerDataEvent(`${ie.ESC}[${t?"":"?"}${k};${B}$y`),!0),v=k=>k?1:2,b=e.params[0];return t?b===2?S(b,4):b===4?S(b,v(c.modes.insertMode)):b===12?S(b,3):b===20?S(b,v(m.convertEol)):S(b,0):b===1?S(b,v(s.applicationCursorKeys)):b===3?S(b,m.windowOptions.setWinLines?p===80?2:p===132?1:0:0):b===6?S(b,v(s.origin)):b===7?S(b,v(s.wraparound)):b===8?S(b,3):b===9?S(b,v(a==="X10")):b===12?S(b,v(m.cursorBlink)):b===25?S(b,v(!c.isCursorHidden)):b===45?S(b,v(s.reverseWraparound)):b===66?S(b,v(s.applicationKeypad)):b===67?S(b,4):b===1e3?S(b,v(a==="VT200")):b===1002?S(b,v(a==="DRAG")):b===1003?S(b,v(a==="ANY")):b===1004?S(b,v(s.sendFocus)):b===1005?S(b,4):b===1006?S(b,v(o==="SGR")):b===1015?S(b,4):b===1016?S(b,v(o==="SGR_PIXELS")):b===1048?S(b,1):b===47||b===1047||b===1049?S(b,v(h===g)):b===2004?S(b,v(s.bracketedPasteMode)):b===2026?S(b,v(s.synchronizedOutput)):S(b,0)}_updateAttrColor(e,t,n,s,a){return t===2?(e|=50331648,e&=-16777216,e|=ma.fromColorRGB([n,s,a])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let s=[0,0,-1,0,0,0],a=0,o=0;do{if(s[o+a]=e.params[t+o],e.hasSubParams(t+o)){let c=e.getSubParams(t+o),f=0;do s[1]===5&&(a=1),s[o+f+1+a]=c[f];while(++f<c.length&&f+o+1+a<s.length);break}if(s[1]===5&&o+a>=2||s[1]===2&&o+a>=5)break;s[1]&&(a=1)}while(++o+t<e.length&&o+a<s.length);for(let c=2;c<s.length;++c)s[c]===-1&&(s[c]=0);switch(s[0]){case 38:n.fg=this._updateAttrColor(n.fg,s[1],s[3],s[4],s[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,s[1],s[3],s[4],s[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,s[1],s[3],s[4],s[5])}return o}_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=St.fg,e.bg=St.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,n,s=this._curAttrData;for(let a=0;a<t;a++)n=e.params[a],n>=30&&n<=37?(s.fg&=-50331904,s.fg|=16777216|n-30):n>=40&&n<=47?(s.bg&=-50331904,s.bg|=16777216|n-40):n>=90&&n<=97?(s.fg&=-50331904,s.fg|=16777216|n-90|8):n>=100&&n<=107?(s.bg&=-50331904,s.bg|=16777216|n-100|8):n===0?this._processSGR0(s):n===1?s.fg|=134217728:n===3?s.bg|=67108864:n===4?(s.fg|=268435456,this._processUnderline(e.hasSubParams(a)?e.getSubParams(a)[0]:1,s)):n===5?s.fg|=536870912:n===7?s.fg|=67108864:n===8?s.fg|=1073741824:n===9?s.fg|=2147483648:n===2?s.bg|=134217728:n===21?this._processUnderline(2,s):n===22?(s.fg&=-134217729,s.bg&=-134217729):n===23?s.bg&=-67108865:n===24?(s.fg&=-268435457,this._processUnderline(0,s)):n===25?s.fg&=-536870913:n===27?s.fg&=-67108865:n===28?s.fg&=-1073741825:n===29?s.fg&=2147483647:n===39?(s.fg&=-67108864,s.fg|=St.fg&16777215):n===49?(s.bg&=-67108864,s.bg|=St.bg&16777215):n===38||n===48||n===58?a+=this._extractColor(e,a,s):n===53?s.bg|=1073741824:n===55?s.bg&=-1073741825:n===59?(s.extended=s.extended.clone(),s.extended.underlineColor=-1,s.updateExtended()):n===100?(s.fg&=-67108864,s.fg|=St.fg&16777215,s.bg&=-67108864,s.bg|=St.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${ie.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ie.ESC}[${t};${n}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ie.ESC}[?${t};${n}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=St.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 n=t%2===1;this._coreService.decPrivateModes.cursorBlink=n}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!Fv(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(`${ie.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>Iv&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>Iv&&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=[],n=e.split(";");for(;n.length>1;){let s=n.shift(),a=n.shift();if(/^\d+$/.exec(s)){let o=parseInt(s);if(Yv(o))if(a==="?")t.push({type:0,index:o});else{let c=Pv(a);c&&t.push({type:1,index:o,color:c})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let n=e.slice(0,t).trim(),s=e.slice(t+1);return s?this._createHyperlink(n,s):n.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(":"),s,a=n.findIndex(o=>o.startsWith("id="));return a!==-1&&(s=n[a].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:s,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(";");for(let s=0;s<n.length&&!(t>=this._specialColors.length);++s,++t)if(n[s]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let a=Pv(n[s]);a&&this._onColor.fire([{type:1,index:this._specialColors[t],color:a}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(";");for(let s=0;s<n.length;++s)if(/^\d+$/.exec(n[s])){let a=parseInt(n[s]);Yv(a)&&t.push({type:2,index:a})}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,Ir),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(b2[e[0]],Et[e[1]]||Ir),!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=St.clone(),this._eraseAttrDataInternal=St.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 Vi;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 n=this._activeBuffer.ybase+this._activeBuffer.y+t,s=this._activeBuffer.lines.get(n);s&&(s.fill(e),s.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=c=>(this._coreService.triggerDataEvent(`${ie.ESC}${c}${ie.ESC}\\`),!0),s=this._bufferService.buffer,a=this._optionsService.rawOptions;return n(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${s.scrollTop+1};${s.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[a.cursorStyle]-(a.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},ad=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&&(Wv=e,e=t,t=Wv),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};ad=ht([fe(0,ri)],ad);function Yv(e){return 0<=e&&e<256}var w2=5e7,Vv=12,C2=50,k2=class extends Ae{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 ue),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 n;for(;n=this._writeBuffer.shift();){this._action(n);let s=this._callbacks.shift();s&&s()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>w2)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 n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let s=this._writeBuffer[this._bufferOffset],a=this._action(s,t);if(a){let c=f=>performance.now()-n>=Vv?setTimeout(()=>this._innerWrite(0,f)):this._innerWrite(n,f);a.catch(f=>(queueMicrotask(()=>{throw f}),Promise.resolve(!1))).then(c);return}let o=this._callbacks[this._bufferOffset];if(o&&o(),this._bufferOffset++,this._pendingData-=s.length,performance.now()-n>=Vv)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>C2&&(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()}},od=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 f=t.addMarker(t.ybase+t.y),p={data:e,id:this._nextId++,lines:[f]};return f.onDispose(()=>this._removeMarkerFromLink(p,f)),this._dataByLinkId.set(p.id,p),p.id}let n=e,s=this._getEntryIdKey(n),a=this._entriesWithId.get(s);if(a)return this.addLineToLink(a.id,t.ybase+t.y),a.id;let o=t.addMarker(t.ybase+t.y),c={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[o]};return o.onDispose(()=>this._removeMarkerFromLink(c,o)),this._entriesWithId.set(c.key,c),this._dataByLinkId.set(c.id,c),c.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(s=>s.line!==t)){let s=this._bufferService.buffer.addMarker(t);n.lines.push(s),s.onDispose(()=>this._removeMarkerFromLink(n,s))}}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 n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};od=ht([fe(0,ri)],od);var Kv=!1,E2=class extends Ae{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Ws),this._onBinary=this._register(new ue),this.onBinary=this._onBinary.event,this._onData=this._register(new ue),this.onData=this._onData.event,this._onLineFeed=this._register(new ue),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new ue),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new ue),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new ue),this._instantiationService=new GC,this.optionsService=this._register(new l2(e)),this._instantiationService.setService(si,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(nd)),this._instantiationService.setService(ri,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(id)),this._instantiationService.setService(sS,this._logService),this.coreService=this._register(this._instantiationService.createInstance(rd)),this._instantiationService.setService(Kr,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(sd)),this._instantiationService.setService(rS,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Fr)),this._instantiationService.setService(Vx,this.unicodeService),this._charsetService=this._instantiationService.createInstance(h2),this._instantiationService.setService(Yx,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(od),this._instantiationService.setService(lS,this._oscLinkService),this._inputHandler=this._register(new x2(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Yt.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Yt.forward(this._bufferService.onResize,this._onResize)),this._register(Yt.forward(this.coreService.onData,this._onData)),this._register(Yt.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 k2((t,n)=>this._inputHandler.parse(t,n))),this._register(Yt.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new ue),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&&!Kv&&(this._logService.warn("writeSync is unreliable and will be removed soon."),Kv=!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,jS),t=Math.max(t,US),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(jv.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(jv(this._bufferService),!1))),this._windowsWrappingHeuristics.value=rt(()=>{for(let t of e)t.dispose()})}}},T2={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 A2(e,t,n,s){var c;let a={type:0,cancel:!1,key:void 0},o=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?a.key=ie.ESC+"OA":a.key=ie.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?a.key=ie.ESC+"OD":a.key=ie.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?a.key=ie.ESC+"OC":a.key=ie.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?a.key=ie.ESC+"OB":a.key=ie.ESC+"[B");break;case 8:a.key=e.ctrlKey?"\b":ie.DEL,e.altKey&&(a.key=ie.ESC+a.key);break;case 9:if(e.shiftKey){a.key=ie.ESC+"[Z";break}a.key=ie.HT,a.cancel=!0;break;case 13:a.key=e.altKey?ie.ESC+ie.CR:ie.CR,a.cancel=!0;break;case 27:a.key=ie.ESC,e.altKey&&(a.key=ie.ESC+ie.ESC),a.cancel=!0;break;case 37:if(e.metaKey)break;o?a.key=ie.ESC+"[1;"+(o+1)+"D":t?a.key=ie.ESC+"OD":a.key=ie.ESC+"[D";break;case 39:if(e.metaKey)break;o?a.key=ie.ESC+"[1;"+(o+1)+"C":t?a.key=ie.ESC+"OC":a.key=ie.ESC+"[C";break;case 38:if(e.metaKey)break;o?a.key=ie.ESC+"[1;"+(o+1)+"A":t?a.key=ie.ESC+"OA":a.key=ie.ESC+"[A";break;case 40:if(e.metaKey)break;o?a.key=ie.ESC+"[1;"+(o+1)+"B":t?a.key=ie.ESC+"OB":a.key=ie.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(a.key=ie.ESC+"[2~");break;case 46:o?a.key=ie.ESC+"[3;"+(o+1)+"~":a.key=ie.ESC+"[3~";break;case 36:o?a.key=ie.ESC+"[1;"+(o+1)+"H":t?a.key=ie.ESC+"OH":a.key=ie.ESC+"[H";break;case 35:o?a.key=ie.ESC+"[1;"+(o+1)+"F":t?a.key=ie.ESC+"OF":a.key=ie.ESC+"[F";break;case 33:e.shiftKey?a.type=2:e.ctrlKey?a.key=ie.ESC+"[5;"+(o+1)+"~":a.key=ie.ESC+"[5~";break;case 34:e.shiftKey?a.type=3:e.ctrlKey?a.key=ie.ESC+"[6;"+(o+1)+"~":a.key=ie.ESC+"[6~";break;case 112:o?a.key=ie.ESC+"[1;"+(o+1)+"P":a.key=ie.ESC+"OP";break;case 113:o?a.key=ie.ESC+"[1;"+(o+1)+"Q":a.key=ie.ESC+"OQ";break;case 114:o?a.key=ie.ESC+"[1;"+(o+1)+"R":a.key=ie.ESC+"OR";break;case 115:o?a.key=ie.ESC+"[1;"+(o+1)+"S":a.key=ie.ESC+"OS";break;case 116:o?a.key=ie.ESC+"[15;"+(o+1)+"~":a.key=ie.ESC+"[15~";break;case 117:o?a.key=ie.ESC+"[17;"+(o+1)+"~":a.key=ie.ESC+"[17~";break;case 118:o?a.key=ie.ESC+"[18;"+(o+1)+"~":a.key=ie.ESC+"[18~";break;case 119:o?a.key=ie.ESC+"[19;"+(o+1)+"~":a.key=ie.ESC+"[19~";break;case 120:o?a.key=ie.ESC+"[20;"+(o+1)+"~":a.key=ie.ESC+"[20~";break;case 121:o?a.key=ie.ESC+"[21;"+(o+1)+"~":a.key=ie.ESC+"[21~";break;case 122:o?a.key=ie.ESC+"[23;"+(o+1)+"~":a.key=ie.ESC+"[23~";break;case 123:o?a.key=ie.ESC+"[24;"+(o+1)+"~":a.key=ie.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?a.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?a.key=ie.NUL:e.keyCode>=51&&e.keyCode<=55?a.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?a.key=ie.DEL:e.keyCode===219?a.key=ie.ESC:e.keyCode===220?a.key=ie.FS:e.keyCode===221&&(a.key=ie.GS);else if((!n||s)&&e.altKey&&!e.metaKey){let f=(c=T2[e.keyCode])==null?void 0:c[e.shiftKey?1:0];if(f)a.key=ie.ESC+f;else if(e.keyCode>=65&&e.keyCode<=90){let p=e.ctrlKey?e.keyCode-64:e.keyCode+32,h=String.fromCharCode(p);e.shiftKey&&(h=h.toUpperCase()),a.key=ie.ESC+h}else if(e.keyCode===32)a.key=ie.ESC+(e.ctrlKey?ie.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let p=e.code.slice(3,4);e.shiftKey||(p=p.toLowerCase()),a.key=ie.ESC+p,a.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(a.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?a.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(a.key=ie.US),e.key==="@"&&(a.key=ie.NUL));break}return a}var pt=0,D2=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new fu,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new fu,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((a,o)=>this._getKey(a)-this._getKey(o)),t=0,n=0,s=new Array(this._array.length+this._insertedValues.length);for(let a=0;a<s.length;a++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(s[a]=e[t],t++):s[a]=this._array[n++];this._array=s,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(pt=this._search(t),pt===-1)||this._getKey(this._array[pt])!==t)return!1;do if(this._array[pt]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(pt),!0;while(++pt<this._array.length&&this._getKey(this._array[pt])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((a,o)=>a-o),t=0,n=new Array(this._array.length-e.length),s=0;for(let a=0;a<this._array.length;a++)e[t]===a?t++:n[s++]=this._array[a];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(pt=this._search(e),!(pt<0||pt>=this._array.length)&&this._getKey(this._array[pt])===e))do yield this._array[pt];while(++pt<this._array.length&&this._getKey(this._array[pt])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(pt=this._search(e),!(pt<0||pt>=this._array.length)&&this._getKey(this._array[pt])===e))do t(this._array[pt]);while(++pt<this._array.length&&this._getKey(this._array[pt])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let s=t+n>>1,a=this._getKey(this._array[s]);if(a>e)n=s-1;else if(a<e)t=s+1;else{for(;s>0&&this._getKey(this._array[s-1])===e;)s--;return s}}return t}},af=0,Xv=0,R2=class extends Ae{constructor(){super(),this._decorations=new D2(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new ue),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new ue),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(rt(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new M2(e);if(t){let n=t.marker.onDispose(()=>t.dispose()),s=t.onDispose(()=>{s.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),n.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,n){let s=0,a=0;for(let o of this._decorations.getKeyIterator(t))s=o.options.x??0,a=s+(o.options.width??1),e>=s&&e<a&&(!n||(o.options.layer??"bottom")===n)&&(yield o)}forEachDecorationAtCell(e,t,n,s){this._decorations.forEachByKey(t,a=>{af=a.options.x??0,Xv=af+(a.options.width??1),e>=af&&e<Xv&&(!n||(a.options.layer??"bottom")===n)&&s(a)})}},M2=class extends mr{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new ue),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new ue),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=lt.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=lt.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},B2=1e3,L2=class{constructor(e,t=B2){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,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 s=performance.now();if(s-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=s,this._innerRefresh();else if(!this._additionalRefreshRequested){let a=s-this._lastRefreshMs,o=this._debounceThresholdMS-a;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},o)}}_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)}},$v=20,du=class extends Ae{constructor(e,t,n,s){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=s,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let a=this._coreBrowserService.mainDocument;this._accessibilityContainer=a.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=a.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let o=0;o<this._terminal.rows;o++)this._rowElements[o]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[o]);if(this._topBoundaryFocusListener=o=>this._handleBoundaryFocus(o,0),this._bottomBoundaryFocusListener=o=>this._handleBoundaryFocus(o,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=a.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new L2(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(o=>this._handleResize(o.rows))),this._register(this._terminal.onRender(o=>this._refreshRows(o.start,o.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(o=>this._handleChar(o))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
72
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Md&&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),n=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!n||!s||!t?!1:this._areCoordsInSelection(t,n,s)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!n||!s?!1:this._areCoordsInSelection([e,t],n,s)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var a,o;let n=(o=(a=this._linkifier.currentLink)==null?void 0:a.link)==null?void 0:o.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=Ev(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let s=this._getMouseBufferCoords(e);return s?(this._selectWordAt(s,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=Rd(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-ef),ef),t/=ef,t/Math.abs(t)+Math.round(t*(qC-1)))}shouldForceSelection(e){return hu?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(),WC)}_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&&!(hu&&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 n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let s=n.lines.get(this._model.selectionEnd[1]);s&&s.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<YC&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let n=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(n&&n[0]!==void 0&&n[1]!==void 0){let s=NC(n[0]-1,n[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(s,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);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,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let s=0;t>=s;s++){let a=e.loadCell(s,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:a>1&&t!==s&&(n+=a-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,s=!0){if(e[0]>=this._bufferService.cols)return;let a=this._bufferService.buffer,o=a.lines.get(e[1]);if(!o)return;let c=a.translateBufferLineToString(e[1],!1),f=this._convertViewportColToCharacterIndex(o,e[0]),p=f,h=e[0]-f,g=0,_=0,S=0,y=0;if(c.charAt(f)===" "){for(;f>0&&c.charAt(f-1)===" ";)f--;for(;p<c.length&&c.charAt(p+1)===" ";)p++}else{let R=e[0],T=e[0];o.getWidth(R)===0&&(g++,R--),o.getWidth(T)===2&&(_++,T++);let $=o.getString(T).length;for($>1&&(y+=$-1,p+=$-1);R>0&&f>0&&!this._isCharWordSeparator(o.loadCell(R-1,this._workCell));){o.loadCell(R-1,this._workCell);let j=this._workCell.getChars().length;this._workCell.getWidth()===0?(g++,R--):j>1&&(S+=j-1,f-=j-1),f--,R--}for(;T<o.length&&p+1<c.length&&!this._isCharWordSeparator(o.loadCell(T+1,this._workCell));){o.loadCell(T+1,this._workCell);let j=this._workCell.getChars().length;this._workCell.getWidth()===2?(_++,T++):j>1&&(y+=j-1,p+=j-1),p++,T++}}p++;let b=f+h-g+S,k=Math.min(this._bufferService.cols,p-f+g+_-S-y);if(!(!t&&c.slice(f,p).trim()==="")){if(n&&b===0&&o.getCodePoint(0)!==32){let R=a.lines.get(e[1]-1);if(R&&o.isWrapped&&R.getCodePoint(this._bufferService.cols-1)!==32){let T=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(T){let $=this._bufferService.cols-T.start;b-=$,k+=$}}}if(s&&b+k===this._bufferService.cols&&o.getCodePoint(this._bufferService.cols-1)!==32){let R=a.lines.get(e[1]+1);if(R!=null&&R.isWrapped&&R.getCodePoint(0)!==32){let T=this._getWordAt([0,e[1]+1],!1,!1,!0);T&&(k+=T.length)}}return{start:b,length:k}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=Ev(n,this._bufferService.cols)}};ed=ht([de(3,ri),de(4,Kr),de(5,wd),de(6,si),de(7,On),de(8,Nn)],ed);var Tv=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},Av=class{constructor(){this._color=new Tv,this._css=new Tv}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},Ct=Object.freeze((()=>{let e=[lt.toColor("#2e3436"),lt.toColor("#cc0000"),lt.toColor("#4e9a06"),lt.toColor("#c4a000"),lt.toColor("#3465a4"),lt.toColor("#75507b"),lt.toColor("#06989a"),lt.toColor("#d3d7cf"),lt.toColor("#555753"),lt.toColor("#ef2929"),lt.toColor("#8ae234"),lt.toColor("#fce94f"),lt.toColor("#729fcf"),lt.toColor("#ad7fa8"),lt.toColor("#34e2e2"),lt.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let s=t[n/36%6|0],a=t[n/6%6|0],o=t[n%6];e.push({css:bt.toCss(s,a,o),rgba:bt.toRgba(s,a,o)})}for(let n=0;n<24;n++){let s=8+n*10;e.push({css:bt.toCss(s,s,s),rgba:bt.toRgba(s,s,s)})}return e})()),Pr=lt.toColor("#ffffff"),ia=lt.toColor("#000000"),Dv=lt.toColor("#ffffff"),Rv=ia,Kl={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},XC=Pr,td=class extends Ae{constructor(e){super(),this._optionsService=e,this._contrastCache=new Av,this._halfContrastCache=new Av,this._onChangeColors=this._register(new ce),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Pr,background:ia,cursor:Dv,cursorAccent:Rv,selectionForeground:void 0,selectionBackgroundTransparent:Kl,selectionBackgroundOpaque:it.blend(ia,Kl),selectionInactiveBackgroundTransparent:Kl,selectionInactiveBackgroundOpaque:it.blend(ia,Kl),scrollbarSliderBackground:it.opacity(Pr,.2),scrollbarSliderHoverBackground:it.opacity(Pr,.4),scrollbarSliderActiveBackground:it.opacity(Pr,.5),overviewRulerBorder:Pr,ansi:Ct.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=$e(e.foreground,Pr),t.background=$e(e.background,ia),t.cursor=it.blend(t.background,$e(e.cursor,Dv)),t.cursorAccent=it.blend(t.background,$e(e.cursorAccent,Rv)),t.selectionBackgroundTransparent=$e(e.selectionBackground,Kl),t.selectionBackgroundOpaque=it.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=$e(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=it.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?$e(e.selectionForeground,wv):void 0,t.selectionForeground===wv&&(t.selectionForeground=void 0),it.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=it.opacity(t.selectionBackgroundTransparent,.3)),it.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=it.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=$e(e.scrollbarSliderBackground,it.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=$e(e.scrollbarSliderHoverBackground,it.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=$e(e.scrollbarSliderActiveBackground,it.opacity(t.foreground,.5)),t.overviewRulerBorder=$e(e.overviewRulerBorder,XC),t.ansi=Ct.slice(),t.ansi[0]=$e(e.black,Ct[0]),t.ansi[1]=$e(e.red,Ct[1]),t.ansi[2]=$e(e.green,Ct[2]),t.ansi[3]=$e(e.yellow,Ct[3]),t.ansi[4]=$e(e.blue,Ct[4]),t.ansi[5]=$e(e.magenta,Ct[5]),t.ansi[6]=$e(e.cyan,Ct[6]),t.ansi[7]=$e(e.white,Ct[7]),t.ansi[8]=$e(e.brightBlack,Ct[8]),t.ansi[9]=$e(e.brightRed,Ct[9]),t.ansi[10]=$e(e.brightGreen,Ct[10]),t.ansi[11]=$e(e.brightYellow,Ct[11]),t.ansi[12]=$e(e.brightBlue,Ct[12]),t.ansi[13]=$e(e.brightMagenta,Ct[13]),t.ansi[14]=$e(e.brightCyan,Ct[14]),t.ansi[15]=$e(e.brightWhite,Ct[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let s=0;s<n;s++)t.ansi[s+16]=$e(e.extendedAnsi[s],Ct[s+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(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()}}};td=ht([de(0,si)],td);function $e(e,t){if(e!==void 0)try{return lt.toColor(e)}catch{}return t}var $C=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},GC=class{constructor(){this._services=new $C,this._services.set(xd,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=qx(e).sort((o,c)=>o.index-c.index),s=[];for(let o of n){let c=this._services.get(o.id);if(!c)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${o.id._id}.`);s.push(c)}let a=n.length>0?n[0].index:t.length;if(t.length!==a)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${a+1} conflicts with ${t.length} static arguments`);return new e(...t,...s)}},ZC={trace:0,debug:1,info:2,warn:3,error:4,off:5},QC="xterm.js: ",id=class extends Ae{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=ZC[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,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?"":QC)+t,...n)}trace(e,...t){var n;this._logLevel<=0&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var n;this._logLevel<=1&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var n;this._logLevel<=2&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var n;this._logLevel<=3&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var n;this._logLevel<=4&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.error.bind(this._optionsService.options.logger))??console.error,e,t)}};id=ht([de(0,si)],id);var Mv=class extends Ae{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new ce),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new ce),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new ce),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let s=e;s<this._length-t;s++)this._array[this._getCyclicIndex(s)]=this._array[this._getCyclicIndex(s+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let s=this._length-1;s>=e;s--)this._array[this._getCyclicIndex(s+n.length)]=this._array[this._getCyclicIndex(s)];for(let s=0;s<n.length;s++)this._array[this._getCyclicIndex(e+s)]=n[s];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let s=this._length+n.length-this._maxLength;this._startIndex+=s,this._length=this._maxLength,this.onTrimEmitter.fire(s)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+n<0)throw new Error("Cannot shift elements in list beyond index 0");if(n>0){for(let a=t-1;a>=0;a--)this.set(e+a+n,this.get(e+a));let s=e+t+n-this._length;if(s>0)for(this._length+=s;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let s=0;s<t;s++)this.set(e+s+n,this.get(e+s))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},Te=3,St=Object.freeze(new _a),Xo=0,tf=2,na=class NS{constructor(t,n,s=!1){this.isWrapped=s,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*Te);let a=n||Vi.fromCharData([0,eS,1,0]);for(let o=0;o<t;++o)this.setCell(o,a);this.length=t}get(t){let n=this._data[t*Te+0],s=n&2097151;return[this._data[t*Te+1],n&2097152?this._combined[t]:s?dr(s):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):s]}set(t,n){this._data[t*Te+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*Te+0]=t|2097152|n[2]<<22):this._data[t*Te+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*Te+0]>>22}hasWidth(t){return this._data[t*Te+0]&12582912}getFg(t){return this._data[t*Te+1]}getBg(t){return this._data[t*Te+2]}hasContent(t){return this._data[t*Te+0]&4194303}getCodePoint(t){let n=this._data[t*Te+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*Te+0]&2097152}getString(t){let n=this._data[t*Te+0];return n&2097152?this._combined[t]:n&2097151?dr(n&2097151):""}isProtected(t){return this._data[t*Te+2]&536870912}loadCell(t,n){return Xo=t*Te,n.content=this._data[Xo+0],n.fg=this._data[Xo+1],n.bg=this._data[Xo+2],n.content&2097152&&(n.combinedData=this._combined[t]),n.bg&268435456&&(n.extended=this._extendedAttrs[t]),n}setCell(t,n){n.content&2097152&&(this._combined[t]=n.combinedData),n.bg&268435456&&(this._extendedAttrs[t]=n.extended),this._data[t*Te+0]=n.content,this._data[t*Te+1]=n.fg,this._data[t*Te+2]=n.bg}setCellFromCodepoint(t,n,s,a){a.bg&268435456&&(this._extendedAttrs[t]=a.extended),this._data[t*Te+0]=n|s<<22,this._data[t*Te+1]=a.fg,this._data[t*Te+2]=a.bg}addCodepointToCell(t,n,s){let a=this._data[t*Te+0];a&2097152?this._combined[t]+=dr(n):a&2097151?(this._combined[t]=dr(a&2097151)+dr(n),a&=-2097152,a|=2097152):a=n|1<<22,s&&(a&=-12582913,a|=s<<22),this._data[t*Te+0]=a}insertCells(t,n,s){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),n<this.length-t){let a=new Vi;for(let o=this.length-t-n-1;o>=0;--o)this.setCell(t+n+o,this.loadCell(t+o,a));for(let o=0;o<n;++o)this.setCell(t+o,s)}else for(let a=t;a<this.length;++a)this.setCell(a,s);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,s)}deleteCells(t,n,s){if(t%=this.length,n<this.length-t){let a=new Vi;for(let o=0;o<this.length-t-n;++o)this.setCell(t+o,this.loadCell(t+n+o,a));for(let o=this.length-n;o<this.length;++o)this.setCell(o,s)}else for(let a=t;a<this.length;++a)this.setCell(a,s);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,s)}replaceCells(t,n,s,a=!1){if(a){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,s),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,s);t<n&&t<this.length;)this.isProtected(t)||this.setCell(t,s),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,s);t<n&&t<this.length;)this.setCell(t++,s)}resize(t,n){if(t===this.length)return this._data.length*4*tf<this._data.buffer.byteLength;let s=t*Te;if(t>this.length){if(this._data.buffer.byteLength>=s*4)this._data=new Uint32Array(this._data.buffer,0,s);else{let a=new Uint32Array(s);a.set(this._data),this._data=a}for(let a=this.length;a<t;++a)this.setCell(a,n)}else{this._data=this._data.subarray(0,s);let a=Object.keys(this._combined);for(let c=0;c<a.length;c++){let f=parseInt(a[c],10);f>=t&&delete this._combined[f]}let o=Object.keys(this._extendedAttrs);for(let c=0;c<o.length;c++){let f=parseInt(o[c],10);f>=t&&delete this._extendedAttrs[f]}}return this.length=t,s*4*tf<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*tf<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,n=!1){if(n){for(let s=0;s<this.length;++s)this.isProtected(s)||this.setCell(s,t);return}this._combined={},this._extendedAttrs={};for(let s=0;s<this.length;++s)this.setCell(s,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 n in t._combined)this._combined[n]=t._combined[n];this._extendedAttrs={};for(let n in t._extendedAttrs)this._extendedAttrs[n]=t._extendedAttrs[n];this.isWrapped=t.isWrapped}clone(){let t=new NS(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let n in this._combined)t._combined[n]=this._combined[n];for(let n in this._extendedAttrs)t._extendedAttrs[n]=this._extendedAttrs[n];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Te+0]&4194303)return t+(this._data[t*Te+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Te+0]&4194303||this._data[t*Te+2]&50331648)return t+(this._data[t*Te+0]>>22);return 0}copyCellsFrom(t,n,s,a,o){let c=t._data;if(o)for(let p=a-1;p>=0;p--){for(let h=0;h<Te;h++)this._data[(s+p)*Te+h]=c[(n+p)*Te+h];c[(n+p)*Te+2]&268435456&&(this._extendedAttrs[s+p]=t._extendedAttrs[n+p])}else for(let p=0;p<a;p++){for(let h=0;h<Te;h++)this._data[(s+p)*Te+h]=c[(n+p)*Te+h];c[(n+p)*Te+2]&268435456&&(this._extendedAttrs[s+p]=t._extendedAttrs[n+p])}let f=Object.keys(t._combined);for(let p=0;p<f.length;p++){let h=parseInt(f[p],10);h>=n&&(this._combined[h-n+s]=t._combined[h])}}translateToString(t,n,s,a){n=n??0,s=s??this.length,t&&(s=Math.min(s,this.getTrimmedLength())),a&&(a.length=0);let o="";for(;n<s;){let c=this._data[n*Te+0],f=c&2097151,p=c&2097152?this._combined[n]:f?dr(f):mr;if(o+=p,a)for(let h=0;h<p.length;++h)a.push(n);n+=c>>22||1}return a&&a.push(n),o}};function JC(e,t,n,s,a,o){let c=[];for(let f=0;f<e.length-1;f++){let p=f,h=e.get(++p);if(!h.isWrapped)continue;let g=[e.get(f)];for(;p<e.length&&h.isWrapped;)g.push(h),h=e.get(++p);if(!o&&s>=f&&s<p){f+=g.length-1;continue}let _=0,S=fa(g,_,t),y=1,b=0;for(;y<g.length;){let R=fa(g,y,t),T=R-b,$=n-S,j=Math.min(T,$);g[_].copyCellsFrom(g[y],b,S,j,!1),S+=j,S===n&&(_++,S=0),b+=j,b===R&&(y++,b=0),S===0&&_!==0&&g[_-1].getWidth(n-1)===2&&(g[_].copyCellsFrom(g[_-1],n-1,S++,1,!1),g[_-1].setCell(n-1,a))}g[_].replaceCells(S,n,a);let k=0;for(let R=g.length-1;R>0&&(R>_||g[R].getTrimmedLength()===0);R--)k++;k>0&&(c.push(f+g.length-k),c.push(k)),f+=g.length-1}return c}function e2(e,t){let n=[],s=0,a=t[s],o=0;for(let c=0;c<e.length;c++)if(a===c){let f=t[++s];e.onDeleteEmitter.fire({index:c-o,amount:f}),c+=f-1,o+=f,a=t[++s]}else n.push(c);return{layout:n,countRemoved:o}}function t2(e,t){let n=[];for(let s=0;s<t.length;s++)n.push(e.get(t[s]));for(let s=0;s<n.length;s++)e.set(s,n[s]);e.length=t.length}function i2(e,t,n){let s=[],a=e.map((p,h)=>fa(e,h,t)).reduce((p,h)=>p+h),o=0,c=0,f=0;for(;f<a;){if(a-f<n){s.push(a-f);break}o+=n;let p=fa(e,c,t);o>p&&(o-=p,c++);let h=e[c].getWidth(o-1)===2;h&&o--;let g=h?n-1:n;s.push(g),f+=g}return s}function fa(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let s=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,a=e[t+1].getWidth(0)===2;return s&&a?n-1:n}var OS=class HS{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=HS._nextId++,this._onDispose=this.register(new ce),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Wr(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};OS._nextId=1;var n2=OS,Et={},Ir=Et.B;Et[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:"≥","{":"π","|":"≠","}":"£","~":"·"};Et.A={"#":"£"};Et.B=void 0;Et[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Et.C=Et[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Et.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Et.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Et.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Et.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Et.E=Et[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Et.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Et.H=Et[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Et["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var Bv=4294967295,Lv=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=St.clone(),this.savedCharset=Ir,this.markers=[],this._nullCell=Vi.fromCharData([0,eS,1,0]),this._whitespaceCell=Vi.fromCharData([0,mr,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new fu,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Mv(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 ou),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 ou),this._whitespaceCell}getBlankLine(e,t){return new na(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>Bv?Bv:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=St);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 Mv(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(St),s=0,a=this._getCorrectBufferLength(t);if(a>this.lines.maxLength&&(this.lines.maxLength=a),this.lines.length>0){if(this._cols<e)for(let c=0;c<this.lines.length;c++)s+=+this.lines.get(c).resize(e,n);let o=0;if(this._rows<t)for(let c=this._rows;c<t;c++)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 na(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+o+1?(this.ybase--,o++,this.ydisp>0&&this.ydisp--):this.lines.push(new na(e,n)));else for(let c=this._rows;c>t;c--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(a<this.lines.maxLength){let c=this.lines.length-a;c>0&&(this.lines.trimStart(c),this.ybase=Math.max(this.ybase-c,0),this.ydisp=Math.max(this.ydisp-c,0),this.savedY=Math.max(this.savedY-c,0)),this.lines.maxLength=a}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),o&&(this.y+=o),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 o=0;o<this.lines.length;o++)s+=+this.lines.get(o).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),s>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&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 n=this._optionsService.rawOptions.reflowCursorLine,s=JC(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(St),n);if(s.length>0){let a=e2(this.lines,s);t2(this.lines,a.layout),this._reflowLargerAdjustViewport(e,t,a.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let s=this.getNullCell(St),a=n;for(;a-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new na(e,s))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,s=this.getNullCell(St),a=[],o=0;for(let c=this.lines.length-1;c>=0;c--){let f=this.lines.get(c);if(!f||!f.isWrapped&&f.getTrimmedLength()<=e)continue;let p=[f];for(;f.isWrapped&&c>0;)f=this.lines.get(--c),p.unshift(f);if(!n){let j=this.ybase+this.y;if(j>=c&&j<c+p.length)continue}let h=p[p.length-1].getTrimmedLength(),g=i2(p,this._cols,e),_=g.length-p.length,S;this.ybase===0&&this.y!==this.lines.length-1?S=Math.max(0,this.y-this.lines.maxLength+_):S=Math.max(0,this.lines.length-this.lines.maxLength+_);let y=[];for(let j=0;j<_;j++){let O=this.getBlankLine(St,!0);y.push(O)}y.length>0&&(a.push({start:c+p.length+o,newLines:y}),o+=y.length),p.push(...y);let b=g.length-1,k=g[b];k===0&&(b--,k=g[b]);let R=p.length-_-1,T=h;for(;R>=0;){let j=Math.min(T,k);if(p[b]===void 0)break;if(p[b].copyCellsFrom(p[R],T-j,k-j,j,!0),k-=j,k===0&&(b--,k=g[b]),T-=j,T===0){R--;let O=Math.max(R,0);T=fa(p,O,this._cols)}}for(let j=0;j<p.length;j++)g[j]<e&&p[j].setCell(g[j],s);let $=_-S;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+o)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+_,this.ybase+t-1)}if(a.length>0){let c=[],f=[];for(let k=0;k<this.lines.length;k++)f.push(this.lines.get(k));let p=this.lines.length,h=p-1,g=0,_=a[g];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+o);let S=0;for(let k=Math.min(this.lines.maxLength-1,p+o-1);k>=0;k--)if(_&&_.start>h+S){for(let R=_.newLines.length-1;R>=0;R--)this.lines.set(k--,_.newLines[R]);k++,c.push({index:h+1,amount:_.newLines.length}),S+=_.newLines.length,_=a[++g]}else this.lines.set(k,f[h--]);let y=0;for(let k=c.length-1;k>=0;k--)c[k].index+=y,this.lines.onInsertEmitter.fire(c[k]),y+=c[k].amount;let b=Math.max(0,p+o-this.lines.maxLength);b>0&&this.lines.onTrimEmitter.fire(b)}}translateBufferLineToString(e,t,n=0,s){let a=this.lines.get(e);return a?a.translateToString(t,n,s):""}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(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 n2(e);return this.markers.push(t),t.register(this.lines.onTrim(n=>{t.line-=n,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(n=>{t.line>=n.index&&(t.line+=n.amount)})),t.register(this.lines.onDelete(n=>{t.line>=n.index&&t.line<n.index+n.amount&&t.dispose(),t.line>n.index&&(t.line-=n.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},r2=class extends Ae{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new ce),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 Lv(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new Lv(!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)}},jS=2,US=1,nd=class extends Ae{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new ce),this.onResize=this._onResize.event,this._onScroll=this._register(new ce),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,jS),this.rows=Math.max(e.rawOptions.rows||0,US),this.buffers=this._register(new r2(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,s=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:s})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,s;s=this._cachedBlankLine,(!s||s.length!==this.cols||s.getFg(0)!==e.fg||s.getBg(0)!==e.bg)&&(s=n.getBlankLine(e,t),this._cachedBlankLine=s),s.isWrapped=t;let a=n.ybase+n.scrollTop,o=n.ybase+n.scrollBottom;if(n.scrollTop===0){let c=n.lines.isFull;o===n.lines.length-1?c?n.lines.recycle().copyFrom(s):n.lines.push(s.clone()):n.lines.splice(o+1,0,s.clone()),c?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let c=o-a+1;n.lines.shiftElements(a+1,c-1,-1),n.lines.set(o,s.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let s=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),s!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};nd=ht([de(0,si)],nd);var js={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:hu,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},s2=["normal","bold","100","200","300","400","500","600","700","800","900"],l2=class extends Ae{constructor(e){super(),this._onOptionChange=this._register(new ce),this.onOptionChange=this._onOptionChange.event;let t={...js};for(let n in e)if(n in t)try{let s=e[n];t[n]=this._sanitizeAndValidateOption(n,s)}catch(s){console.error(s)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(rt(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=n=>{if(!(n in js))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,s)=>{if(!(n in js))throw new Error(`No option with key "${n}"`);s=this._sanitizeAndValidateOption(n,s),this.rawOptions[n]!==s&&(this.rawOptions[n]=s,this._onOptionChange.fire(n))};for(let n in this.rawOptions){let s={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,s)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=js[e]),!a2(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=js[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=s2.includes(t)?t:js[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 a2(e){return e==="block"||e==="underline"||e==="bar"}function ra(e,t=5){if(typeof e!="object")return e;let n=Array.isArray(e)?[]:{};for(let s in e)n[s]=t<=1?e[s]:e[s]&&ra(e[s],t-1);return n}var zv=Object.freeze({insertMode:!1}),Nv=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),rd=class extends Ae{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new ce),this.onData=this._onData.event,this._onUserInput=this._register(new ce),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new ce),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new ce),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=ra(zv),this.decPrivateModes=ra(Nv)}reset(){this.modes=ra(zv),this.decPrivateModes=ra(Nv)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(s=>s.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))}};rd=ht([de(0,ri),de(1,sS),de(2,si)],rd);var Ov={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 nf(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var rf=String.fromCharCode,Hv={DEFAULT:e=>{let t=[nf(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${rf(t[0])}${rf(t[1])}${rf(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${nf(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${nf(e,!0)};${e.x};${e.y}${t}`}},sd=class extends Ae{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new ce),this.onProtocolChange=this._onProtocolChange.event;for(let s of Object.keys(Ov))this.addProtocol(s,Ov[s]);for(let s of Object.keys(Hv))this.addEncoding(s,Hv[s]);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,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let s=t/n,a=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(a/=s+0,Math.abs(e.deltaY)<50&&(a*=.3),this._wheelPartialScroll+=a,a=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(a*=this._bufferService.rows),a}_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,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};sd=ht([de(0,ri),de(1,Kr),de(2,si)],sd);var sf=[[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]],o2=[[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]],kt;function u2(e,t){let n=0,s=t.length-1,a;if(e<t[0][0]||e>t[s][1])return!1;for(;s>=n;)if(a=n+s>>1,e>t[a][1])n=a+1;else if(e<t[a][0])s=a-1;else return!0;return!1}var c2=class{constructor(){if(this.version="6",!kt){kt=new Uint8Array(65536),kt.fill(1),kt[0]=0,kt.fill(0,1,32),kt.fill(0,127,160),kt.fill(2,4352,4448),kt[9001]=2,kt[9002]=2,kt.fill(2,11904,42192),kt[12351]=1,kt.fill(2,44032,55204),kt.fill(2,63744,64256),kt.fill(2,65040,65050),kt.fill(2,65072,65136),kt.fill(2,65280,65377),kt.fill(2,65504,65511);for(let e=0;e<sf.length;++e)kt.fill(0,sf[e][0],sf[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?kt[e]:u2(e,o2)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),s=n===0&&t!==0;if(s){let a=Fr.extractWidth(t);a===0?s=!1:a>n&&(n=a)}return Fr.createPropertyValue(0,n,s)}},Fr=class su{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new ce,this.onChange=this._onChange.event;let t=new c2;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,n,s=!1){return(t&16777215)<<3|(n&3)<<1|(s?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 n=0,s=0,a=t.length;for(let o=0;o<a;++o){let c=t.charCodeAt(o);if(55296<=c&&c<=56319){if(++o>=a)return n+this.wcwidth(c);let h=t.charCodeAt(o);56320<=h&&h<=57343?c=(c-55296)*1024+h-56320+65536:n+=this.wcwidth(h)}let f=this.charProperties(c,s),p=su.extractWidth(f);su.extractShouldJoin(f)&&(p-=su.extractWidth(s)),n+=p,s=f}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},h2=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 jv(e){var s;let t=(s=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:s.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var Xl=2147483647,f2=256,PS=class ld{constructor(t=32,n=32){if(this.maxLength=t,this.maxSubParamsLength=n,n>f2)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(n),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new ld;if(!t.length)return n;for(let s=Array.isArray(t[0])?1:0;s<t.length;++s){let a=t[s];if(Array.isArray(a))for(let o=0;o<a.length;++o)n.addSubParam(a[o]);else n.addParam(a)}return n}clone(){let t=new ld(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 n=0;n<this.length;++n){t.push(this.params[n]);let s=this._subParamsIdx[n]>>8,a=this._subParamsIdx[n]&255;a-s>0&&t.push(Array.prototype.slice.call(this._subParams,s,a))}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>Xl?Xl: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>Xl?Xl:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let n=this._subParamsIdx[t]>>8,s=this._subParamsIdx[t]&255;return s-n>0?this._subParams.subarray(n,s):null}getSubParamsAll(){let t={};for(let n=0;n<this.length;++n){let s=this._subParamsIdx[n]>>8,a=this._subParamsIdx[n]&255;a-s>0&&(t[n]=this._subParams.slice(s,a))}return t}addDigit(t){let n;if(this._rejectDigits||!(n=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let s=this._digitIsSub?this._subParams:this.params,a=s[n-1];s[n-1]=~a?Math.min(a*10+t,Xl):t}},$l=[],d2=class{constructor(){this._state=0,this._active=$l,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 n=this._handlers[e];return n.push(t),{dispose:()=>{let s=n.indexOf(t);s!==-1&&n.splice(s,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=$l}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=$l,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||$l,!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,n){if(!this._active.length)this._handlerFb(this._id,"PUT",vu(e,t,n));else for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let s=e[t++];if(s===59){this._state=2,this._start();break}if(s<48||57<s){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+s-48}this._state===2&&n-t>0&&this._put(e,t,n)}}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 n=!1,s=this._active.length-1,a=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,n=t,a=this._stack.fallThrough,this._stack.paused=!1),!a&&n===!1){for(;s>=0&&(n=this._active[s].end(e),n!==!0);s--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,n;s--}for(;s>=0;s--)if(n=this._active[s].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,n}this._active=$l,this._id=-1,this._state=0}}},Ai=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=vu(e,t,n),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(n=>(this._data="",this._hitLimit=!1,n));return this._data="",this._hitLimit=!1,t}},Gl=[],p2=class{constructor(){this._handlers=Object.create(null),this._active=Gl,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Gl}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let s=n.indexOf(t);s!==-1&&n.splice(s,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=Gl,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Gl,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let n=this._active.length-1;n>=0;n--)this._active[n].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,"PUT",vu(e,t,n));else for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let n=!1,s=this._active.length-1,a=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,n=t,a=this._stack.fallThrough,this._stack.paused=!1),!a&&n===!1){for(;s>=0&&(n=this._active[s].unhook(e),n!==!0);s--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,n;s--}for(;s>=0;s--)if(n=this._active[s].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,n}this._active=Gl,this._ident=0}},sa=new PS;sa.addParam(0);var Uv=class{constructor(e){this._handler=e,this._data="",this._params=sa,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():sa,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=vu(e,t,n),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(n=>(this._params=sa,this._data="",this._hitLimit=!1,n));return this._params=sa,this._data="",this._hitLimit=!1,t}},m2=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,s){this.table[t<<8|e]=n<<4|s}addMany(e,t,n,s){for(let a=0;a<e.length;a++)this.table[t<<8|e[a]]=n<<4|s}},Wi=160,_2=(function(){let e=new m2(4095),t=Array.apply(null,Array(256)).map((f,p)=>p),n=(f,p)=>t.slice(f,p),s=n(32,127),a=n(0,24);a.push(25),a.push.apply(a,n(28,32));let o=n(0,14),c;e.setDefault(1,0),e.addMany(s,0,2,0);for(c in o)e.addMany([24,26,153,154],c,3,0),e.addMany(n(128,144),c,3,0),e.addMany(n(144,152),c,3,0),e.add(156,c,0,0),e.add(27,c,11,1),e.add(157,c,4,8),e.addMany([152,158,159],c,0,7),e.add(155,c,11,3),e.add(144,c,11,9);return e.addMany(a,0,3,0),e.addMany(a,1,3,1),e.add(127,1,0,1),e.addMany(a,8,0,8),e.addMany(a,3,3,3),e.add(127,3,0,3),e.addMany(a,4,3,4),e.add(127,4,0,4),e.addMany(a,6,3,6),e.addMany(a,5,3,5),e.add(127,5,0,5),e.addMany(a,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(s,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(s,7,0,7),e.addMany(a,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(a,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(a,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(a,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(a,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(a,13,13,13),e.addMany(s,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(Wi,0,2,0),e.add(Wi,8,5,8),e.add(Wi,6,0,6),e.add(Wi,11,0,11),e.add(Wi,13,13,13),e})(),g2=class extends Ae{constructor(e=_2){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 PS,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,n,s)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,n)=>{},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(rt(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new d2),this._dcsParser=this._register(new p2),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let a=0;a<e.intermediates.length;++a){let o=e.intermediates.charCodeAt(a);if(32>o||o>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=o}}if(e.final.length!==1)throw new Error("final must be a single byte");let s=e.final.charCodeAt(0);if(t[0]>s||s>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=s,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let s=this._escHandlers[n];return s.push(t),{dispose:()=>{let a=s.indexOf(t);a!==-1&&s.splice(a,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 n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let s=this._csiHandlers[n];return s.push(t),{dispose:()=>{let a=s.indexOf(t);a!==-1&&s.splice(a,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,n,s,a){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=s,this._parseStack.chunkPos=a}parse(e,t,n){let s=0,a=0,o=0,c;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let f=this._parseStack.handlers,p=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&p>-1){for(;p>=0&&(c=f[p](this._params),c!==!0);p--)if(c instanceof Promise)return this._parseStack.handlerPos=p,c}this._parseStack.handlers=[];break;case 4:if(n===!1&&p>-1){for(;p>=0&&(c=f[p](),c!==!0);p--)if(c instanceof Promise)return this._parseStack.handlerPos=p,c}this._parseStack.handlers=[];break;case 6:if(s=e[this._parseStack.chunkPos],c=this._dcsParser.unhook(s!==24&&s!==26,n),c)return c;s===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(s=e[this._parseStack.chunkPos],c=this._oscParser.end(s!==24&&s!==26,n),c)return c;s===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let f=o;f<t;++f){switch(s=e[f],a=this._transitions.table[this.currentState<<8|(s<160?s:Wi)],a>>4){case 2:for(let S=f+1;;++S){if(S>=t||(s=e[S])<32||s>126&&s<Wi){this._printHandler(e,f,S),f=S-1;break}if(++S>=t||(s=e[S])<32||s>126&&s<Wi){this._printHandler(e,f,S),f=S-1;break}if(++S>=t||(s=e[S])<32||s>126&&s<Wi){this._printHandler(e,f,S),f=S-1;break}if(++S>=t||(s=e[S])<32||s>126&&s<Wi){this._printHandler(e,f,S),f=S-1;break}}break;case 3:this._executeHandlers[s]?this._executeHandlers[s]():this._executeHandlerFb(s),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:f,code:s,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let p=this._csiHandlers[this._collect<<8|s],h=p?p.length-1:-1;for(;h>=0&&(c=p[h](this._params),c!==!0);h--)if(c instanceof Promise)return this._preserveStack(3,p,h,a,f),c;h<0&&this._csiHandlerFb(this._collect<<8|s,this._params),this.precedingJoinState=0;break;case 8:do switch(s){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(s-48)}while(++f<t&&(s=e[f])>47&&s<60);f--;break;case 9:this._collect<<=8,this._collect|=s;break;case 10:let g=this._escHandlers[this._collect<<8|s],_=g?g.length-1:-1;for(;_>=0&&(c=g[_](),c!==!0);_--)if(c instanceof Promise)return this._preserveStack(4,g,_,a,f),c;_<0&&this._escHandlerFb(this._collect<<8|s),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|s,this._params);break;case 13:for(let S=f+1;;++S)if(S>=t||(s=e[S])===24||s===26||s===27||s>127&&s<Wi){this._dcsParser.put(e,f,S),f=S-1;break}break;case 14:if(c=this._dcsParser.unhook(s!==24&&s!==26),c)return this._preserveStack(6,[],0,a,f),c;s===27&&(a|=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 S=f+1;;S++)if(S>=t||(s=e[S])<32||s>127&&s<Wi){this._oscParser.put(e,f,S),f=S-1;break}break;case 6:if(c=this._oscParser.end(s!==24&&s!==26),c)return this._preserveStack(5,[],0,a,f),c;s===27&&(a|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=a&15}}},v2=/^([\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})$/,y2=/^[\da-f]+$/;function Pv(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let n=v2.exec(t);if(n){let s=n[1]?15:n[4]?255:n[7]?4095:65535;return[Math.round(parseInt(n[1]||n[4]||n[7]||n[10],16)/s*255),Math.round(parseInt(n[2]||n[5]||n[8]||n[11],16)/s*255),Math.round(parseInt(n[3]||n[6]||n[9]||n[12],16)/s*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),y2.exec(t)&&[3,6,9,12].includes(t.length))){let n=t.length/3,s=[0,0,0];for(let a=0;a<3;++a){let o=parseInt(t.slice(n*a,n*a+n),16);s[a]=n===1?o<<4:n===2?o:n===3?o>>4:o>>8}return s}}function lf(e,t){let n=e.toString(16),s=n.length<2?"0"+n:n;switch(t){case 4:return n[0];case 8:return s;case 12:return(s+s).slice(0,3);default:return s+s}}function S2(e,t=16){let[n,s,a]=e;return`rgb:${lf(n,t)}/${lf(s,t)}/${lf(a,t)}`}var b2={"(":0,")":1,"*":2,"+":3,"-":1,".":2},hr=131072,Iv=10;function Fv(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 qv=5e3,Wv=0,x2=class extends Ae{constructor(e,t,n,s,a,o,c,f,p=new g2){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=s,this._optionsService=a,this._oscLinkService=o,this._coreMouseService=c,this._unicodeService=f,this._parser=p,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new Ix,this._utf8Decoder=new Fx,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=St.clone(),this._eraseAttrDataInternal=St.clone(),this._onRequestBell=this._register(new ce),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new ce),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new ce),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new ce),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new ce),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new ce),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new ce),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new ce),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new ce),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new ce),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new ce),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new ce),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new ce),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 ad(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(h=>this._activeBuffer=h.activeBuffer)),this._parser.setCsiHandlerFallback((h,g)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(h),params:g.toArray()})}),this._parser.setEscHandlerFallback(h=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(h)})}),this._parser.setExecuteHandlerFallback(h=>{this._logService.debug("Unknown EXECUTE code: ",{code:h})}),this._parser.setOscHandlerFallback((h,g,_)=>{this._logService.debug("Unknown OSC code: ",{identifier:h,action:g,data:_})}),this._parser.setDcsHandlerFallback((h,g,_)=>{g==="HOOK"&&(_=_.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(h),action:g,payload:_})}),this._parser.setPrintHandler((h,g,_)=>this.print(h,g,_)),this._parser.registerCsiHandler({final:"@"},h=>this.insertChars(h)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},h=>this.scrollLeft(h)),this._parser.registerCsiHandler({final:"A"},h=>this.cursorUp(h)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},h=>this.scrollRight(h)),this._parser.registerCsiHandler({final:"B"},h=>this.cursorDown(h)),this._parser.registerCsiHandler({final:"C"},h=>this.cursorForward(h)),this._parser.registerCsiHandler({final:"D"},h=>this.cursorBackward(h)),this._parser.registerCsiHandler({final:"E"},h=>this.cursorNextLine(h)),this._parser.registerCsiHandler({final:"F"},h=>this.cursorPrecedingLine(h)),this._parser.registerCsiHandler({final:"G"},h=>this.cursorCharAbsolute(h)),this._parser.registerCsiHandler({final:"H"},h=>this.cursorPosition(h)),this._parser.registerCsiHandler({final:"I"},h=>this.cursorForwardTab(h)),this._parser.registerCsiHandler({final:"J"},h=>this.eraseInDisplay(h,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},h=>this.eraseInDisplay(h,!0)),this._parser.registerCsiHandler({final:"K"},h=>this.eraseInLine(h,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},h=>this.eraseInLine(h,!0)),this._parser.registerCsiHandler({final:"L"},h=>this.insertLines(h)),this._parser.registerCsiHandler({final:"M"},h=>this.deleteLines(h)),this._parser.registerCsiHandler({final:"P"},h=>this.deleteChars(h)),this._parser.registerCsiHandler({final:"S"},h=>this.scrollUp(h)),this._parser.registerCsiHandler({final:"T"},h=>this.scrollDown(h)),this._parser.registerCsiHandler({final:"X"},h=>this.eraseChars(h)),this._parser.registerCsiHandler({final:"Z"},h=>this.cursorBackwardTab(h)),this._parser.registerCsiHandler({final:"`"},h=>this.charPosAbsolute(h)),this._parser.registerCsiHandler({final:"a"},h=>this.hPositionRelative(h)),this._parser.registerCsiHandler({final:"b"},h=>this.repeatPrecedingCharacter(h)),this._parser.registerCsiHandler({final:"c"},h=>this.sendDeviceAttributesPrimary(h)),this._parser.registerCsiHandler({prefix:">",final:"c"},h=>this.sendDeviceAttributesSecondary(h)),this._parser.registerCsiHandler({final:"d"},h=>this.linePosAbsolute(h)),this._parser.registerCsiHandler({final:"e"},h=>this.vPositionRelative(h)),this._parser.registerCsiHandler({final:"f"},h=>this.hVPosition(h)),this._parser.registerCsiHandler({final:"g"},h=>this.tabClear(h)),this._parser.registerCsiHandler({final:"h"},h=>this.setMode(h)),this._parser.registerCsiHandler({prefix:"?",final:"h"},h=>this.setModePrivate(h)),this._parser.registerCsiHandler({final:"l"},h=>this.resetMode(h)),this._parser.registerCsiHandler({prefix:"?",final:"l"},h=>this.resetModePrivate(h)),this._parser.registerCsiHandler({final:"m"},h=>this.charAttributes(h)),this._parser.registerCsiHandler({final:"n"},h=>this.deviceStatus(h)),this._parser.registerCsiHandler({prefix:"?",final:"n"},h=>this.deviceStatusPrivate(h)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},h=>this.softReset(h)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},h=>this.setCursorStyle(h)),this._parser.registerCsiHandler({final:"r"},h=>this.setScrollRegion(h)),this._parser.registerCsiHandler({final:"s"},h=>this.saveCursor(h)),this._parser.registerCsiHandler({final:"t"},h=>this.windowOptions(h)),this._parser.registerCsiHandler({final:"u"},h=>this.restoreCursor(h)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},h=>this.insertColumns(h)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},h=>this.deleteColumns(h)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},h=>this.selectProtected(h)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},h=>this.requestMode(h,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},h=>this.requestMode(h,!1)),this._parser.setExecuteHandler(ne.BEL,()=>this.bell()),this._parser.setExecuteHandler(ne.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(ne.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(ne.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(ne.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(ne.BS,()=>this.backspace()),this._parser.setExecuteHandler(ne.HT,()=>this.tab()),this._parser.setExecuteHandler(ne.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(ne.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(nu.IND,()=>this.index()),this._parser.setExecuteHandler(nu.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(nu.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Ai(h=>(this.setTitle(h),this.setIconName(h),!0))),this._parser.registerOscHandler(1,new Ai(h=>this.setIconName(h))),this._parser.registerOscHandler(2,new Ai(h=>this.setTitle(h))),this._parser.registerOscHandler(4,new Ai(h=>this.setOrReportIndexedColor(h))),this._parser.registerOscHandler(8,new Ai(h=>this.setHyperlink(h))),this._parser.registerOscHandler(10,new Ai(h=>this.setOrReportFgColor(h))),this._parser.registerOscHandler(11,new Ai(h=>this.setOrReportBgColor(h))),this._parser.registerOscHandler(12,new Ai(h=>this.setOrReportCursorColor(h))),this._parser.registerOscHandler(104,new Ai(h=>this.restoreIndexedColor(h))),this._parser.registerOscHandler(110,new Ai(h=>this.restoreFgColor(h))),this._parser.registerOscHandler(111,new Ai(h=>this.restoreBgColor(h))),this._parser.registerOscHandler(112,new Ai(h=>this.restoreCursorColor(h))),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 h in Et)this._parser.registerEscHandler({intermediates:"(",final:h},()=>this.selectCharset("("+h)),this._parser.registerEscHandler({intermediates:")",final:h},()=>this.selectCharset(")"+h)),this._parser.registerEscHandler({intermediates:"*",final:h},()=>this.selectCharset("*"+h)),this._parser.registerEscHandler({intermediates:"+",final:h},()=>this.selectCharset("+"+h)),this._parser.registerEscHandler({intermediates:"-",final:h},()=>this.selectCharset("-"+h)),this._parser.registerEscHandler({intermediates:".",final:h},()=>this.selectCharset("."+h)),this._parser.registerEscHandler({intermediates:"/",final:h},()=>this.selectCharset("/"+h));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(h=>(this._logService.error("Parsing error: ",h),h)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new Uv((h,g)=>this.requestStatusString(h,g)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,s){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=s}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,n)=>setTimeout(()=>n("#SLOW_TIMEOUT"),qv))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${qv} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,s=this._activeBuffer.x,a=this._activeBuffer.y,o=0,c=this._parseStack.paused;if(c){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;s=this._parseStack.cursorStartX,a=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>hr&&(o=this._parseStack.position+hr)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,h=>String.fromCharCode(h)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(h=>h.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<hr&&(this._parseBuffer=new Uint32Array(Math.min(e.length,hr))),c||this._dirtyRowTracker.clearRange(),e.length>hr)for(let h=o;h<e.length;h+=hr){let g=h+hr<e.length?h+hr:e.length,_=typeof e=="string"?this._stringDecoder.decode(e.substring(h,g),this._parseBuffer):this._utf8Decoder.decode(e.subarray(h,g),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,_))return this._preserveStack(s,a,_,h),this._logSlowResolvingAsync(n),n}else if(!c){let h=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,h))return this._preserveStack(s,a,h,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==s||this._activeBuffer.y!==a)&&this._onCursorMove.fire();let f=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),p=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);p<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(p,this._bufferService.rows-1),end:Math.min(f,this._bufferService.rows-1)})}print(e,t,n){let s,a,o=this._charsetService.charset,c=this._optionsService.rawOptions.screenReaderMode,f=this._bufferService.cols,p=this._coreService.decPrivateModes.wraparound,h=this._coreService.modes.insertMode,g=this._curAttrData,_=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&_.getWidth(this._activeBuffer.x-1)===2&&_.setCellFromCodepoint(this._activeBuffer.x-1,0,1,g);let S=this._parser.precedingJoinState;for(let y=t;y<n;++y){if(s=e[y],s<127&&o){let T=o[String.fromCharCode(s)];T&&(s=T.charCodeAt(0))}let b=this._unicodeService.charProperties(s,S);a=Fr.extractWidth(b);let k=Fr.extractShouldJoin(b),R=k?Fr.extractWidth(S):0;if(S=b,c&&this._onA11yChar.fire(dr(s)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+a-R>f){if(p){let T=_,$=this._activeBuffer.x-R;for(this._activeBuffer.x=R,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),_=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),R>0&&_ instanceof na&&_.copyCellsFrom(T,$,0,R,!1);$<f;)T.setCellFromCodepoint($++,0,1,g)}else if(this._activeBuffer.x=f-1,a===2)continue}if(k&&this._activeBuffer.x){let T=_.getWidth(this._activeBuffer.x-1)?1:2;_.addCodepointToCell(this._activeBuffer.x-T,s,a);for(let $=a-R;--$>=0;)_.setCellFromCodepoint(this._activeBuffer.x++,0,0,g);continue}if(h&&(_.insertCells(this._activeBuffer.x,a-R,this._activeBuffer.getNullCell(g)),_.getWidth(f-1)===2&&_.setCellFromCodepoint(f-1,0,1,g)),_.setCellFromCodepoint(this._activeBuffer.x++,s,a,g),a>0)for(;--a;)_.setCellFromCodepoint(this._activeBuffer.x++,0,0,g)}this._parser.precedingJoinState=S,this._activeBuffer.x<f&&n-t>0&&_.getWidth(this._activeBuffer.x)===0&&!_.hasContent(this._activeBuffer.x)&&_.setCellFromCodepoint(this._activeBuffer.x,0,1,g),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,n=>Fv(n.params[0],this._optionsService.rawOptions.windowOptions)?t(n):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new Uv(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Ai(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,n,s=!1,a=!1){let o=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);o.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),a),s&&(o.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){var s;this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!((s=this._activeBuffer.lines.get(this._activeBuffer.ybase+n))!=null&&s.getTrimmedLength()););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let a=this._activeBuffer.lines.length-this._bufferService.rows;a>0&&(this._activeBuffer.lines.trimStart(a),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-a,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-a,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 n=this._activeBuffer.ybase+this._activeBuffer.y,s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,a=this._bufferService.rows-1+this._activeBuffer.ybase-s+1;for(;t--;)this._activeBuffer.lines.splice(a-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,s;for(s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-s;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(s,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(St));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);s.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);s.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);s.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);s.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,s=Fr.extractWidth(t),a=this._activeBuffer.x-s,o=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(a),c=new Uint32Array(o.length*n),f=0;for(let h=0;h<o.length;){let g=o.codePointAt(h)||0;c[f++]=g,h+=g>65535?2:1}let p=f;for(let h=1;h<n;++h)c.copyWithin(p,0,f),p+=f;return this.print(c,0,p),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(ne.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(ne.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(ne.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(ne.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(ne.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,Ir),this._charsetService.setgCharset(1,Ir),this._charsetService.setgCharset(2,Ir),this._charsetService.setgCharset(3,Ir);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){(k=>(k[k.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",k[k.SET=1]="SET",k[k.RESET=2]="RESET",k[k.PERMANENTLY_SET=3]="PERMANENTLY_SET",k[k.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(n={}));let s=this._coreService.decPrivateModes,{activeProtocol:a,activeEncoding:o}=this._coreMouseService,c=this._coreService,{buffers:f,cols:p}=this._bufferService,{active:h,alt:g}=f,_=this._optionsService.rawOptions,S=(k,R)=>(c.triggerDataEvent(`${ne.ESC}[${t?"":"?"}${k};${R}$y`),!0),y=k=>k?1:2,b=e.params[0];return t?b===2?S(b,4):b===4?S(b,y(c.modes.insertMode)):b===12?S(b,3):b===20?S(b,y(_.convertEol)):S(b,0):b===1?S(b,y(s.applicationCursorKeys)):b===3?S(b,_.windowOptions.setWinLines?p===80?2:p===132?1:0:0):b===6?S(b,y(s.origin)):b===7?S(b,y(s.wraparound)):b===8?S(b,3):b===9?S(b,y(a==="X10")):b===12?S(b,y(_.cursorBlink)):b===25?S(b,y(!c.isCursorHidden)):b===45?S(b,y(s.reverseWraparound)):b===66?S(b,y(s.applicationKeypad)):b===67?S(b,4):b===1e3?S(b,y(a==="VT200")):b===1002?S(b,y(a==="DRAG")):b===1003?S(b,y(a==="ANY")):b===1004?S(b,y(s.sendFocus)):b===1005?S(b,4):b===1006?S(b,y(o==="SGR")):b===1015?S(b,4):b===1016?S(b,y(o==="SGR_PIXELS")):b===1048?S(b,1):b===47||b===1047||b===1049?S(b,y(h===g)):b===2004?S(b,y(s.bracketedPasteMode)):b===2026?S(b,y(s.synchronizedOutput)):S(b,0)}_updateAttrColor(e,t,n,s,a){return t===2?(e|=50331648,e&=-16777216,e|=_a.fromColorRGB([n,s,a])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let s=[0,0,-1,0,0,0],a=0,o=0;do{if(s[o+a]=e.params[t+o],e.hasSubParams(t+o)){let c=e.getSubParams(t+o),f=0;do s[1]===5&&(a=1),s[o+f+1+a]=c[f];while(++f<c.length&&f+o+1+a<s.length);break}if(s[1]===5&&o+a>=2||s[1]===2&&o+a>=5)break;s[1]&&(a=1)}while(++o+t<e.length&&o+a<s.length);for(let c=2;c<s.length;++c)s[c]===-1&&(s[c]=0);switch(s[0]){case 38:n.fg=this._updateAttrColor(n.fg,s[1],s[3],s[4],s[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,s[1],s[3],s[4],s[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,s[1],s[3],s[4],s[5])}return o}_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=St.fg,e.bg=St.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,n,s=this._curAttrData;for(let a=0;a<t;a++)n=e.params[a],n>=30&&n<=37?(s.fg&=-50331904,s.fg|=16777216|n-30):n>=40&&n<=47?(s.bg&=-50331904,s.bg|=16777216|n-40):n>=90&&n<=97?(s.fg&=-50331904,s.fg|=16777216|n-90|8):n>=100&&n<=107?(s.bg&=-50331904,s.bg|=16777216|n-100|8):n===0?this._processSGR0(s):n===1?s.fg|=134217728:n===3?s.bg|=67108864:n===4?(s.fg|=268435456,this._processUnderline(e.hasSubParams(a)?e.getSubParams(a)[0]:1,s)):n===5?s.fg|=536870912:n===7?s.fg|=67108864:n===8?s.fg|=1073741824:n===9?s.fg|=2147483648:n===2?s.bg|=134217728:n===21?this._processUnderline(2,s):n===22?(s.fg&=-134217729,s.bg&=-134217729):n===23?s.bg&=-67108865:n===24?(s.fg&=-268435457,this._processUnderline(0,s)):n===25?s.fg&=-536870913:n===27?s.fg&=-67108865:n===28?s.fg&=-1073741825:n===29?s.fg&=2147483647:n===39?(s.fg&=-67108864,s.fg|=St.fg&16777215):n===49?(s.bg&=-67108864,s.bg|=St.bg&16777215):n===38||n===48||n===58?a+=this._extractColor(e,a,s):n===53?s.bg|=1073741824:n===55?s.bg&=-1073741825:n===59?(s.extended=s.extended.clone(),s.extended.underlineColor=-1,s.updateExtended()):n===100?(s.fg&=-67108864,s.fg|=St.fg&16777215,s.bg&=-67108864,s.bg|=St.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${ne.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ne.ESC}[${t};${n}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ne.ESC}[?${t};${n}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=St.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 n=t%2===1;this._coreService.decPrivateModes.cursorBlink=n}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!Fv(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(`${ne.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>Iv&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>Iv&&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=[],n=e.split(";");for(;n.length>1;){let s=n.shift(),a=n.shift();if(/^\d+$/.exec(s)){let o=parseInt(s);if(Yv(o))if(a==="?")t.push({type:0,index:o});else{let c=Pv(a);c&&t.push({type:1,index:o,color:c})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let n=e.slice(0,t).trim(),s=e.slice(t+1);return s?this._createHyperlink(n,s):n.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(":"),s,a=n.findIndex(o=>o.startsWith("id="));return a!==-1&&(s=n[a].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:s,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(";");for(let s=0;s<n.length&&!(t>=this._specialColors.length);++s,++t)if(n[s]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let a=Pv(n[s]);a&&this._onColor.fire([{type:1,index:this._specialColors[t],color:a}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(";");for(let s=0;s<n.length;++s)if(/^\d+$/.exec(n[s])){let a=parseInt(n[s]);Yv(a)&&t.push({type:2,index:a})}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,Ir),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(b2[e[0]],Et[e[1]]||Ir),!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=St.clone(),this._eraseAttrDataInternal=St.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 Vi;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 n=this._activeBuffer.ybase+this._activeBuffer.y+t,s=this._activeBuffer.lines.get(n);s&&(s.fill(e),s.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=c=>(this._coreService.triggerDataEvent(`${ne.ESC}${c}${ne.ESC}\\`),!0),s=this._bufferService.buffer,a=this._optionsService.rawOptions;return n(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${s.scrollTop+1};${s.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[a.cursorStyle]-(a.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},ad=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&&(Wv=e,e=t,t=Wv),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};ad=ht([de(0,ri)],ad);function Yv(e){return 0<=e&&e<256}var w2=5e7,Vv=12,C2=50,k2=class extends Ae{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 ce),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 n;for(;n=this._writeBuffer.shift();){this._action(n);let s=this._callbacks.shift();s&&s()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>w2)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 n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let s=this._writeBuffer[this._bufferOffset],a=this._action(s,t);if(a){let c=f=>performance.now()-n>=Vv?setTimeout(()=>this._innerWrite(0,f)):this._innerWrite(n,f);a.catch(f=>(queueMicrotask(()=>{throw f}),Promise.resolve(!1))).then(c);return}let o=this._callbacks[this._bufferOffset];if(o&&o(),this._bufferOffset++,this._pendingData-=s.length,performance.now()-n>=Vv)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>C2&&(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()}},od=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 f=t.addMarker(t.ybase+t.y),p={data:e,id:this._nextId++,lines:[f]};return f.onDispose(()=>this._removeMarkerFromLink(p,f)),this._dataByLinkId.set(p.id,p),p.id}let n=e,s=this._getEntryIdKey(n),a=this._entriesWithId.get(s);if(a)return this.addLineToLink(a.id,t.ybase+t.y),a.id;let o=t.addMarker(t.ybase+t.y),c={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[o]};return o.onDispose(()=>this._removeMarkerFromLink(c,o)),this._entriesWithId.set(c.key,c),this._dataByLinkId.set(c.id,c),c.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(s=>s.line!==t)){let s=this._bufferService.buffer.addMarker(t);n.lines.push(s),s.onDispose(()=>this._removeMarkerFromLink(n,s))}}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 n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};od=ht([de(0,ri)],od);var Kv=!1,E2=class extends Ae{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Ws),this._onBinary=this._register(new ce),this.onBinary=this._onBinary.event,this._onData=this._register(new ce),this.onData=this._onData.event,this._onLineFeed=this._register(new ce),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new ce),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new ce),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new ce),this._instantiationService=new GC,this.optionsService=this._register(new l2(e)),this._instantiationService.setService(si,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(nd)),this._instantiationService.setService(ri,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(id)),this._instantiationService.setService(sS,this._logService),this.coreService=this._register(this._instantiationService.createInstance(rd)),this._instantiationService.setService(Kr,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(sd)),this._instantiationService.setService(rS,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Fr)),this._instantiationService.setService(Vx,this.unicodeService),this._charsetService=this._instantiationService.createInstance(h2),this._instantiationService.setService(Yx,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(od),this._instantiationService.setService(lS,this._oscLinkService),this._inputHandler=this._register(new x2(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Yt.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Yt.forward(this._bufferService.onResize,this._onResize)),this._register(Yt.forward(this.coreService.onData,this._onData)),this._register(Yt.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 k2((t,n)=>this._inputHandler.parse(t,n))),this._register(Yt.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new ce),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&&!Kv&&(this._logService.warn("writeSync is unreliable and will be removed soon."),Kv=!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,jS),t=Math.max(t,US),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(jv.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(jv(this._bufferService),!1))),this._windowsWrappingHeuristics.value=rt(()=>{for(let t of e)t.dispose()})}}},T2={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 A2(e,t,n,s){var c;let a={type:0,cancel:!1,key:void 0},o=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?a.key=ne.ESC+"OA":a.key=ne.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?a.key=ne.ESC+"OD":a.key=ne.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?a.key=ne.ESC+"OC":a.key=ne.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?a.key=ne.ESC+"OB":a.key=ne.ESC+"[B");break;case 8:a.key=e.ctrlKey?"\b":ne.DEL,e.altKey&&(a.key=ne.ESC+a.key);break;case 9:if(e.shiftKey){a.key=ne.ESC+"[Z";break}a.key=ne.HT,a.cancel=!0;break;case 13:a.key=e.altKey?ne.ESC+ne.CR:ne.CR,a.cancel=!0;break;case 27:a.key=ne.ESC,e.altKey&&(a.key=ne.ESC+ne.ESC),a.cancel=!0;break;case 37:if(e.metaKey)break;o?a.key=ne.ESC+"[1;"+(o+1)+"D":t?a.key=ne.ESC+"OD":a.key=ne.ESC+"[D";break;case 39:if(e.metaKey)break;o?a.key=ne.ESC+"[1;"+(o+1)+"C":t?a.key=ne.ESC+"OC":a.key=ne.ESC+"[C";break;case 38:if(e.metaKey)break;o?a.key=ne.ESC+"[1;"+(o+1)+"A":t?a.key=ne.ESC+"OA":a.key=ne.ESC+"[A";break;case 40:if(e.metaKey)break;o?a.key=ne.ESC+"[1;"+(o+1)+"B":t?a.key=ne.ESC+"OB":a.key=ne.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(a.key=ne.ESC+"[2~");break;case 46:o?a.key=ne.ESC+"[3;"+(o+1)+"~":a.key=ne.ESC+"[3~";break;case 36:o?a.key=ne.ESC+"[1;"+(o+1)+"H":t?a.key=ne.ESC+"OH":a.key=ne.ESC+"[H";break;case 35:o?a.key=ne.ESC+"[1;"+(o+1)+"F":t?a.key=ne.ESC+"OF":a.key=ne.ESC+"[F";break;case 33:e.shiftKey?a.type=2:e.ctrlKey?a.key=ne.ESC+"[5;"+(o+1)+"~":a.key=ne.ESC+"[5~";break;case 34:e.shiftKey?a.type=3:e.ctrlKey?a.key=ne.ESC+"[6;"+(o+1)+"~":a.key=ne.ESC+"[6~";break;case 112:o?a.key=ne.ESC+"[1;"+(o+1)+"P":a.key=ne.ESC+"OP";break;case 113:o?a.key=ne.ESC+"[1;"+(o+1)+"Q":a.key=ne.ESC+"OQ";break;case 114:o?a.key=ne.ESC+"[1;"+(o+1)+"R":a.key=ne.ESC+"OR";break;case 115:o?a.key=ne.ESC+"[1;"+(o+1)+"S":a.key=ne.ESC+"OS";break;case 116:o?a.key=ne.ESC+"[15;"+(o+1)+"~":a.key=ne.ESC+"[15~";break;case 117:o?a.key=ne.ESC+"[17;"+(o+1)+"~":a.key=ne.ESC+"[17~";break;case 118:o?a.key=ne.ESC+"[18;"+(o+1)+"~":a.key=ne.ESC+"[18~";break;case 119:o?a.key=ne.ESC+"[19;"+(o+1)+"~":a.key=ne.ESC+"[19~";break;case 120:o?a.key=ne.ESC+"[20;"+(o+1)+"~":a.key=ne.ESC+"[20~";break;case 121:o?a.key=ne.ESC+"[21;"+(o+1)+"~":a.key=ne.ESC+"[21~";break;case 122:o?a.key=ne.ESC+"[23;"+(o+1)+"~":a.key=ne.ESC+"[23~";break;case 123:o?a.key=ne.ESC+"[24;"+(o+1)+"~":a.key=ne.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?a.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?a.key=ne.NUL:e.keyCode>=51&&e.keyCode<=55?a.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?a.key=ne.DEL:e.keyCode===219?a.key=ne.ESC:e.keyCode===220?a.key=ne.FS:e.keyCode===221&&(a.key=ne.GS);else if((!n||s)&&e.altKey&&!e.metaKey){let f=(c=T2[e.keyCode])==null?void 0:c[e.shiftKey?1:0];if(f)a.key=ne.ESC+f;else if(e.keyCode>=65&&e.keyCode<=90){let p=e.ctrlKey?e.keyCode-64:e.keyCode+32,h=String.fromCharCode(p);e.shiftKey&&(h=h.toUpperCase()),a.key=ne.ESC+h}else if(e.keyCode===32)a.key=ne.ESC+(e.ctrlKey?ne.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let p=e.code.slice(3,4);e.shiftKey||(p=p.toLowerCase()),a.key=ne.ESC+p,a.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(a.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?a.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(a.key=ne.US),e.key==="@"&&(a.key=ne.NUL));break}return a}var pt=0,D2=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new fu,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new fu,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((a,o)=>this._getKey(a)-this._getKey(o)),t=0,n=0,s=new Array(this._array.length+this._insertedValues.length);for(let a=0;a<s.length;a++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(s[a]=e[t],t++):s[a]=this._array[n++];this._array=s,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(pt=this._search(t),pt===-1)||this._getKey(this._array[pt])!==t)return!1;do if(this._array[pt]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(pt),!0;while(++pt<this._array.length&&this._getKey(this._array[pt])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((a,o)=>a-o),t=0,n=new Array(this._array.length-e.length),s=0;for(let a=0;a<this._array.length;a++)e[t]===a?t++:n[s++]=this._array[a];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(pt=this._search(e),!(pt<0||pt>=this._array.length)&&this._getKey(this._array[pt])===e))do yield this._array[pt];while(++pt<this._array.length&&this._getKey(this._array[pt])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(pt=this._search(e),!(pt<0||pt>=this._array.length)&&this._getKey(this._array[pt])===e))do t(this._array[pt]);while(++pt<this._array.length&&this._getKey(this._array[pt])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let s=t+n>>1,a=this._getKey(this._array[s]);if(a>e)n=s-1;else if(a<e)t=s+1;else{for(;s>0&&this._getKey(this._array[s-1])===e;)s--;return s}}return t}},af=0,Xv=0,R2=class extends Ae{constructor(){super(),this._decorations=new D2(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new ce),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new ce),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(rt(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new M2(e);if(t){let n=t.marker.onDispose(()=>t.dispose()),s=t.onDispose(()=>{s.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),n.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,n){let s=0,a=0;for(let o of this._decorations.getKeyIterator(t))s=o.options.x??0,a=s+(o.options.width??1),e>=s&&e<a&&(!n||(o.options.layer??"bottom")===n)&&(yield o)}forEachDecorationAtCell(e,t,n,s){this._decorations.forEachByKey(t,a=>{af=a.options.x??0,Xv=af+(a.options.width??1),e>=af&&e<Xv&&(!n||(a.options.layer??"bottom")===n)&&s(a)})}},M2=class extends _r{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new ce),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new ce),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=lt.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=lt.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},B2=1e3,L2=class{constructor(e,t=B2){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,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 s=performance.now();if(s-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=s,this._innerRefresh();else if(!this._additionalRefreshRequested){let a=s-this._lastRefreshMs,o=this._debounceThresholdMS-a;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},o)}}_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)}},$v=20,du=class extends Ae{constructor(e,t,n,s){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=s,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let a=this._coreBrowserService.mainDocument;this._accessibilityContainer=a.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=a.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let o=0;o<this._terminal.rows;o++)this._rowElements[o]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[o]);if(this._topBoundaryFocusListener=o=>this._handleBoundaryFocus(o,0),this._bottomBoundaryFocusListener=o=>this._handleBoundaryFocus(o,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=a.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new L2(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(o=>this._handleResize(o.rows))),this._register(this._terminal.onRender(o=>this._refreshRows(o.start,o.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(o=>this._handleChar(o))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
73
73
  `))),this._register(this._terminal.onA11yTab(o=>this._handleTab(o))),this._register(this._terminal.onKey(o=>this._handleKey(o.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(be(a,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(rt(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<$v+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
74
- `&&(this._liveRegionLineCount++,this._liveRegionLineCount===$v+1&&(this._liveRegion.textContent+=Af.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 n=this._terminal.buffer,s=n.lines.length.toString();for(let a=e;a<=t;a++){let o=n.lines.get(n.ydisp+a),c=[],f=(o==null?void 0:o.translateToString(!0,void 0,void 0,c))||"",p=(n.ydisp+a+1).toString(),h=this._rowElements[a];h&&(f.length===0?(h.textContent=" ",this._rowColumns.set(h,[0,1])):(h.textContent=f,this._rowColumns.set(h,c)),h.setAttribute("aria-posinset",p),h.setAttribute("aria-setsize",s),this._alignRowWidth(h))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let n=e.target,s=this._rowElements[t===0?1:this._rowElements.length-2],a=n.getAttribute("aria-posinset"),o=t===0?"1":`${this._terminal.buffer.lines.length}`;if(a===o||e.relatedTarget!==s)return;let c,f;if(t===0?(c=n,f=this._rowElements.pop(),this._rowContainer.removeChild(f)):(c=this._rowElements.shift(),f=n,this._rowContainer.removeChild(c)),c.removeEventListener("focus",this._topBoundaryFocusListener),f.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let p=this._createAccessibilityTreeNode();this._rowElements.unshift(p),this._rowContainer.insertAdjacentElement("afterbegin",p)}else{let p=this._createAccessibilityTreeNode();this._rowElements.push(p),this._rowContainer.appendChild(p)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){var f;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},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,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 s=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(s)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:s,offset:((f=s.textContent)==null?void 0:f.length)??0}),!this._rowContainer.contains(n.node))return;let a=({node:p,offset:h})=>{let g=p instanceof Text?p.parentNode:p,m=parseInt(g==null?void 0:g.getAttribute("aria-posinset"),10)-1;if(isNaN(m))return console.warn("row is invalid. Race condition?"),null;let S=this._rowColumns.get(g);if(!S)return console.warn("columns is null. Race condition?"),null;let v=h<S.length?S[h]:S.slice(-1)[0]+1;return v>=this._terminal.cols&&(++m,v=0),{row:m,column:v}},o=a(t),c=a(n);if(!(!o||!c)){if(o.row>c.row||o.row===c.row&&o.column>=c.column)throw new Error("invalid range");this._terminal.select(o.column,o.row,(c.row-o.row)*this._terminal.cols-o.column+c.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 a,o;e.style.transform="";let t=e.getBoundingClientRect().width,n=(o=(a=this._rowColumns.get(e))==null?void 0:a.slice(-1))==null?void 0:o[0];if(!n)return;let s=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${s/t})`}};du=ht([fe(1,xd),fe(2,Nn),fe(3,On)],du);var ud=class extends Ae{constructor(e,t,n,s,a){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=s,this._linkProviderService=a,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new ue),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new ue),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(rt(()=>{var o;Wr(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(o=this._activeProviderReplies)==null||o.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(be(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(be(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(be(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(be(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 n=e.composedPath();for(let s=0;s<n.length;s++){let a=n[s];if(a.classList.contains("xterm"))break;if(a.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 s,a;(!this._activeProviderReplies||!t)&&((s=this._activeProviderReplies)==null||s.forEach(o=>{o==null||o.forEach(c=>{c.link.dispose&&c.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[o,c]of this._linkProviderService.linkProviders.entries())t?(a=this._activeProviderReplies)!=null&&a.get(o)&&(n=this._checkLinkProviderResult(o,e,n)):c.provideLinks(e.y,f=>{var h,g;if(this._isMouseOut)return;let p=f==null?void 0:f.map(m=>({link:m}));(h=this._activeProviderReplies)==null||h.set(o,p),n=this._checkLinkProviderResult(o,e,n),((g=this._activeProviderReplies)==null?void 0:g.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let s=0;s<t.size;s++){let a=t.get(s);if(a)for(let o=0;o<a.length;o++){let c=a[o],f=c.link.range.start.y<e?0:c.link.range.start.x,p=c.link.range.end.y>e?this._bufferService.cols:c.link.range.end.x;for(let h=f;h<=p;h++){if(n.has(h)){a.splice(o--,1);break}n.add(h)}}}}_checkLinkProviderResult(e,t,n){var o;if(!this._activeProviderReplies)return n;let s=this._activeProviderReplies.get(e),a=!1;for(let c=0;c<e;c++)(!this._activeProviderReplies.has(c)||this._activeProviderReplies.get(c))&&(a=!0);if(!a&&s){let c=s.find(f=>this._linkAtPosition(f.link,t));c&&(n=!0,this._handleNewLink(c))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let c=0;c<this._activeProviderReplies.size;c++){let f=(o=this._activeProviderReplies.get(c))==null?void 0:o.find(p=>this._linkAtPosition(p.link,t));if(f){n=!0,this._handleNewLink(f);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&z2(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,Wr(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 n,s;return(s=(n=this._currentLink)==null?void 0:n.state)==null?void 0:s.decorations.pointerCursor},set:n=>{var s;(s=this._currentLink)!=null&&s.state&&this._currentLink.state.decorations.pointerCursor!==n&&(this._currentLink.state.decorations.pointerCursor=n,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",n))}},underline:{get:()=>{var n,s;return(s=(n=this._currentLink)==null?void 0:n.state)==null?void 0:s.decorations.underline},set:n=>{var s,a,o;(s=this._currentLink)!=null&&s.state&&((o=(a=this._currentLink)==null?void 0:a.state)==null?void 0:o.decorations.underline)!==n&&(this._currentLink.state.decorations.underline=n,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,n))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(n=>{if(!this._currentLink)return;let s=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,a=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=s&&this._currentLink.link.range.end.y<=a&&(this._clearCurrentLink(s,a),this._lastMouseEvent)){let o=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);o&&this._askForLink(o,!1)}})))}_linkHover(e,t,n){var s;(s=this._currentLink)!=null&&s.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,s=this._bufferService.buffer.ydisp,a=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-s-1,n.end.x,n.end.y-s-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(a)}_linkLeave(e,t,n){var s;(s=this._currentLink)!=null&&s.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,s=e.range.end.y*this._bufferService.cols+e.range.end.x,a=t.y*this._bufferService.cols+t.x;return n<=a&&a<=s}_positionFromMouseEvent(e,t,n){let s=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(s)return{x:s[0],y:s[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,s,a){return{x1:e,y1:t,x2:n,y2:s,cols:this._bufferService.cols,fg:a}}};ud=ht([fe(1,wd),fe(2,On),fe(3,ri),fe(4,oS)],ud);function z2(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 N2=class extends E2{constructor(e={}){super(e),this._linkifier=this._register(new Ws),this.browser=TS,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Ws),this._onCursorMove=this._register(new ue),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new ue),this.onKey=this._onKey.event,this._onRender=this._register(new ue),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new ue),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new ue),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new ue),this.onBell=this._onBell.event,this._onFocus=this._register(new ue),this._onBlur=this._register(new ue),this._onA11yCharEmitter=this._register(new ue),this._onA11yTabEmitter=this._register(new ue),this._onWillOpen=this._register(new ue),this._setup(),this._decorationService=this._instantiationService.createInstance(R2),this._instantiationService.setService(ga,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(CC),this._instantiationService.setService(oS,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Rf)),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(Yt.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Yt.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Yt.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Yt.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(rt(()=>{var t,n;this._customKeyEventHandler=void 0,(n=(t=this.element)==null?void 0:t.parentNode)==null||n.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 n,s="";switch(t.index){case 256:n="foreground",s="10";break;case 257:n="background",s="11";break;case 258:n="cursor",s="12";break;default:n="ansi",s="4;"+t.index}switch(t.type){case 0:let a=it.toColorRGB(n==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${ie.ESC}]${s};${S2(a)}${kS.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(o=>o.ansi[t.index]=bt.toColor(...t.color));else{let o=n;this._themeService.modifyColors(c=>c[o]=bt.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(du,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ie.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(ie.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 n=Math.min(this.buffer.x,this.cols-1),s=this._renderService.dimensions.css.cell.height,a=t.getWidth(n),o=this._renderService.dimensions.css.cell.width*a,c=this.buffer.y*this._renderService.dimensions.css.cell.height,f=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=f+"px",this.textarea.style.top=c+"px",this.textarea.style.width=o+"px",this.textarea.style.height=s+"px",this.textarea.style.lineHeight=s+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(be(this.element,"copy",t=>{this.hasSelection()&&Ux(t,this._selectionService)}));let e=t=>Px(t,this.textarea,this.coreService,this.optionsService);this._register(be(this.textarea,"paste",e)),this._register(be(this.element,"paste",e)),AS?this._register(be(this.element,"mousedown",t=>{t.button===2&&sv(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(be(this.element,"contextmenu",t=>{sv(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Md&&this._register(be(this.element,"auxclick",t=>{t.button===1&&Jy(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(be(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(be(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(be(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(be(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(be(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(be(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(be(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var a;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"),((a=this.element)==null?void 0:a.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(be(this.screenElement,"mousemove",o=>this.updateCursorStyle(o))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",Tf.get()),MS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(xC,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Nn,this._coreBrowserService),this._register(be(this.textarea,"focus",o=>this._handleTextAreaFocus(o))),this._register(be(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Zf,this._document,this._helperContainer),this._instantiationService.setService(yu,this._charSizeService),this._themeService=this._instantiationService.createInstance(td),this._instantiationService.setService(Ks,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(cu),this._instantiationService.setService(aS,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Jf,this.rows,this.screenElement)),this._instantiationService.setService(On,this._renderService),this._register(this._renderService.onRenderedViewportChange(o=>this._onRender.fire(o))),this.onResize(o=>this._renderService.resize(o.cols,o.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(Xf,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Qf),this._instantiationService.setService(wd,this._mouseService);let s=this._linkifier.value=this._register(this._instantiationService.createInstance(ud,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(Vf,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(o=>{super.scrollLines(o,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(ed,this.element,this.screenElement,s)),this._instantiationService.setService(Xx,this._selectionService),this._register(this._selectionService.onRequestScrollLines(o=>this.scrollLines(o.amount,o.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(o=>this._renderService.handleSelectionChanged(o.start,o.end,o.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(o=>{this.textarea.value=o,this.textarea.focus(),this.textarea.select()})),this._register(Yt.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var o;this._selectionService.refresh(),(o=this._viewport)==null||o.queueSync()})),this._register(this._instantiationService.createInstance(Kf,this.screenElement)),this._register(be(this.element,"mousedown",o=>this._selectionService.handleMouseDown(o))),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(du,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",o=>this._handleScreenReaderModeOptionChange(o))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(uu,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",o=>{!this._overviewRulerRenderer&&o&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(uu,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Gf,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(o){var h,g,m,S,v;let c=e._mouseService.getMouseReportCoords(o,e.screenElement);if(!c)return!1;let f,p;switch(o.overrideType||o.type){case"mousemove":p=32,o.buttons===void 0?(f=3,o.button!==void 0&&(f=o.button<3?o.button:3)):f=o.buttons&1?0:o.buttons&4?1:o.buttons&2?2:3;break;case"mouseup":p=0,f=o.button<3?o.button:3;break;case"mousedown":p=1,f=o.button<3?o.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(o)===!1)return!1;let b=o.deltaY;if(b===0||e.coreMouseService.consumeWheelEvent(o,(S=(m=(g=(h=e._renderService)==null?void 0:h.dimensions)==null?void 0:g.device)==null?void 0:m.cell)==null?void 0:S.height,(v=e._coreBrowserService)==null?void 0:v.dpr)===0)return!1;p=b<0?0:1,f=4;break;default:return!1}return p===void 0||f===void 0||f>4?!1:e.coreMouseService.triggerMouseEvent({col:c.col,row:c.row,x:c.x,y:c.y,button:f,action:p,ctrl:o.ctrlKey,alt:o.altKey,shift:o.shiftKey})}let s={mouseup:null,wheel:null,mousedrag:null,mousemove:null},a={mouseup:o=>(n(o),o.buttons||(this._document.removeEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.removeEventListener("mousemove",s.mousedrag)),this.cancel(o)),wheel:o=>(n(o),this.cancel(o,!0)),mousedrag:o=>{o.buttons&&n(o)},mousemove:o=>{o.buttons||n(o)}};this._register(this.coreMouseService.onProtocolChange(o=>{o?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(o)),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()),o&8?s.mousemove||(t.addEventListener("mousemove",a.mousemove),s.mousemove=a.mousemove):(t.removeEventListener("mousemove",s.mousemove),s.mousemove=null),o&16?s.wheel||(t.addEventListener("wheel",a.wheel,{passive:!1}),s.wheel=a.wheel):(t.removeEventListener("wheel",s.wheel),s.wheel=null),o&2?s.mouseup||(s.mouseup=a.mouseup):(this._document.removeEventListener("mouseup",s.mouseup),s.mouseup=null),o&4?s.mousedrag||(s.mousedrag=a.mousedrag):(this._document.removeEventListener("mousemove",s.mousedrag),s.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(be(t,"mousedown",o=>{if(o.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(o)))return n(o),s.mouseup&&this._document.addEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.addEventListener("mousemove",s.mousedrag),this.cancel(o)})),this._register(be(t,"wheel",o=>{var c,f,p,h,g;if(!s.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(o)===!1)return!1;if(!this.buffer.hasScrollback){if(o.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(o,(h=(p=(f=(c=e._renderService)==null?void 0:c.dimensions)==null?void 0:f.device)==null?void 0:p.cell)==null?void 0:h.height,(g=e._coreBrowserService)==null?void 0:g.dpr)===0)return this.cancel(o,!0);let m=ie.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(o.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(m,!0),this.cancel(o,!0)}}},{passive:!1}))}refresh(e,t){var n;(n=this._renderService)==null||n.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){Qy(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,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var e;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,t){var n;(n=this._selectionService)==null||n.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 n=A2(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let s=this.rows-1;return this.scrollLines(n.type===2?-s:s),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.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((n.key===ie.ETX||n.key===ie.CR)&&(this.textarea.value=""),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(O2(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 n;(n=this._charSizeService)==null||n.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(St));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(ie.ESC+"[I"):this.coreService.triggerDataEvent(ie.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),n=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${ie.ESC}[4;${n};${t}t`);break;case 1:let s=this._renderService.dimensions.css.cell.width.toFixed(0),a=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${ie.ESC}[6;${a};${s}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function O2(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var H2=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(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)}},j2=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 Vi)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},Gv=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 j2(t)}getNullCell(){return new Vi}},U2=class extends Ae{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new ue),this.onBufferChange=this._onBufferChange.event,this._normal=new Gv(this._core.buffers.normal,"normal"),this._alternate=new Gv(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)}},P2=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,n=>t(n.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(n,s)=>t(n,s.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)}},I2=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}},F2=["cols","rows"],sn=0,q2=class extends Ae{constructor(e){super(),this._core=this._register(new N2(e)),this._addonManager=this._register(new H2),this._publicOptions={...this._core.options};let t=s=>this._core.options[s],n=(s,a)=>{this._checkReadonlyOptions(s),this._core.options[s]=a};for(let s in this._core.options){let a={get:t.bind(this,s),set:n.bind(this,s)};Object.defineProperty(this._publicOptions,s,a)}}_checkReadonlyOptions(e){if(F2.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 P2(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new I2(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 U2(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,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
74
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===$v+1&&(this._liveRegion.textContent+=Af.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 n=this._terminal.buffer,s=n.lines.length.toString();for(let a=e;a<=t;a++){let o=n.lines.get(n.ydisp+a),c=[],f=(o==null?void 0:o.translateToString(!0,void 0,void 0,c))||"",p=(n.ydisp+a+1).toString(),h=this._rowElements[a];h&&(f.length===0?(h.textContent=" ",this._rowColumns.set(h,[0,1])):(h.textContent=f,this._rowColumns.set(h,c)),h.setAttribute("aria-posinset",p),h.setAttribute("aria-setsize",s),this._alignRowWidth(h))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let n=e.target,s=this._rowElements[t===0?1:this._rowElements.length-2],a=n.getAttribute("aria-posinset"),o=t===0?"1":`${this._terminal.buffer.lines.length}`;if(a===o||e.relatedTarget!==s)return;let c,f;if(t===0?(c=n,f=this._rowElements.pop(),this._rowContainer.removeChild(f)):(c=this._rowElements.shift(),f=n,this._rowContainer.removeChild(c)),c.removeEventListener("focus",this._topBoundaryFocusListener),f.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let p=this._createAccessibilityTreeNode();this._rowElements.unshift(p),this._rowContainer.insertAdjacentElement("afterbegin",p)}else{let p=this._createAccessibilityTreeNode();this._rowElements.push(p),this._rowContainer.appendChild(p)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){var f;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},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,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 s=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(s)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:s,offset:((f=s.textContent)==null?void 0:f.length)??0}),!this._rowContainer.contains(n.node))return;let a=({node:p,offset:h})=>{let g=p instanceof Text?p.parentNode:p,_=parseInt(g==null?void 0:g.getAttribute("aria-posinset"),10)-1;if(isNaN(_))return console.warn("row is invalid. Race condition?"),null;let S=this._rowColumns.get(g);if(!S)return console.warn("columns is null. Race condition?"),null;let y=h<S.length?S[h]:S.slice(-1)[0]+1;return y>=this._terminal.cols&&(++_,y=0),{row:_,column:y}},o=a(t),c=a(n);if(!(!o||!c)){if(o.row>c.row||o.row===c.row&&o.column>=c.column)throw new Error("invalid range");this._terminal.select(o.column,o.row,(c.row-o.row)*this._terminal.cols-o.column+c.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 a,o;e.style.transform="";let t=e.getBoundingClientRect().width,n=(o=(a=this._rowColumns.get(e))==null?void 0:a.slice(-1))==null?void 0:o[0];if(!n)return;let s=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${s/t})`}};du=ht([de(1,xd),de(2,Nn),de(3,On)],du);var ud=class extends Ae{constructor(e,t,n,s,a){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=s,this._linkProviderService=a,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new ce),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new ce),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(rt(()=>{var o;Wr(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(o=this._activeProviderReplies)==null||o.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(be(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(be(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(be(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(be(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 n=e.composedPath();for(let s=0;s<n.length;s++){let a=n[s];if(a.classList.contains("xterm"))break;if(a.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 s,a;(!this._activeProviderReplies||!t)&&((s=this._activeProviderReplies)==null||s.forEach(o=>{o==null||o.forEach(c=>{c.link.dispose&&c.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[o,c]of this._linkProviderService.linkProviders.entries())t?(a=this._activeProviderReplies)!=null&&a.get(o)&&(n=this._checkLinkProviderResult(o,e,n)):c.provideLinks(e.y,f=>{var h,g;if(this._isMouseOut)return;let p=f==null?void 0:f.map(_=>({link:_}));(h=this._activeProviderReplies)==null||h.set(o,p),n=this._checkLinkProviderResult(o,e,n),((g=this._activeProviderReplies)==null?void 0:g.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let s=0;s<t.size;s++){let a=t.get(s);if(a)for(let o=0;o<a.length;o++){let c=a[o],f=c.link.range.start.y<e?0:c.link.range.start.x,p=c.link.range.end.y>e?this._bufferService.cols:c.link.range.end.x;for(let h=f;h<=p;h++){if(n.has(h)){a.splice(o--,1);break}n.add(h)}}}}_checkLinkProviderResult(e,t,n){var o;if(!this._activeProviderReplies)return n;let s=this._activeProviderReplies.get(e),a=!1;for(let c=0;c<e;c++)(!this._activeProviderReplies.has(c)||this._activeProviderReplies.get(c))&&(a=!0);if(!a&&s){let c=s.find(f=>this._linkAtPosition(f.link,t));c&&(n=!0,this._handleNewLink(c))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let c=0;c<this._activeProviderReplies.size;c++){let f=(o=this._activeProviderReplies.get(c))==null?void 0:o.find(p=>this._linkAtPosition(p.link,t));if(f){n=!0,this._handleNewLink(f);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&z2(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,Wr(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 n,s;return(s=(n=this._currentLink)==null?void 0:n.state)==null?void 0:s.decorations.pointerCursor},set:n=>{var s;(s=this._currentLink)!=null&&s.state&&this._currentLink.state.decorations.pointerCursor!==n&&(this._currentLink.state.decorations.pointerCursor=n,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",n))}},underline:{get:()=>{var n,s;return(s=(n=this._currentLink)==null?void 0:n.state)==null?void 0:s.decorations.underline},set:n=>{var s,a,o;(s=this._currentLink)!=null&&s.state&&((o=(a=this._currentLink)==null?void 0:a.state)==null?void 0:o.decorations.underline)!==n&&(this._currentLink.state.decorations.underline=n,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,n))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(n=>{if(!this._currentLink)return;let s=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,a=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=s&&this._currentLink.link.range.end.y<=a&&(this._clearCurrentLink(s,a),this._lastMouseEvent)){let o=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);o&&this._askForLink(o,!1)}})))}_linkHover(e,t,n){var s;(s=this._currentLink)!=null&&s.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,s=this._bufferService.buffer.ydisp,a=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-s-1,n.end.x,n.end.y-s-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(a)}_linkLeave(e,t,n){var s;(s=this._currentLink)!=null&&s.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,s=e.range.end.y*this._bufferService.cols+e.range.end.x,a=t.y*this._bufferService.cols+t.x;return n<=a&&a<=s}_positionFromMouseEvent(e,t,n){let s=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(s)return{x:s[0],y:s[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,s,a){return{x1:e,y1:t,x2:n,y2:s,cols:this._bufferService.cols,fg:a}}};ud=ht([de(1,wd),de(2,On),de(3,ri),de(4,oS)],ud);function z2(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 N2=class extends E2{constructor(e={}){super(e),this._linkifier=this._register(new Ws),this.browser=TS,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Ws),this._onCursorMove=this._register(new ce),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new ce),this.onKey=this._onKey.event,this._onRender=this._register(new ce),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new ce),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new ce),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new ce),this.onBell=this._onBell.event,this._onFocus=this._register(new ce),this._onBlur=this._register(new ce),this._onA11yCharEmitter=this._register(new ce),this._onA11yTabEmitter=this._register(new ce),this._onWillOpen=this._register(new ce),this._setup(),this._decorationService=this._instantiationService.createInstance(R2),this._instantiationService.setService(ga,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(CC),this._instantiationService.setService(oS,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Rf)),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(Yt.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Yt.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Yt.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Yt.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(rt(()=>{var t,n;this._customKeyEventHandler=void 0,(n=(t=this.element)==null?void 0:t.parentNode)==null||n.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 n,s="";switch(t.index){case 256:n="foreground",s="10";break;case 257:n="background",s="11";break;case 258:n="cursor",s="12";break;default:n="ansi",s="4;"+t.index}switch(t.type){case 0:let a=it.toColorRGB(n==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${ne.ESC}]${s};${S2(a)}${kS.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(o=>o.ansi[t.index]=bt.toColor(...t.color));else{let o=n;this._themeService.modifyColors(c=>c[o]=bt.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(du,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ne.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(ne.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 n=Math.min(this.buffer.x,this.cols-1),s=this._renderService.dimensions.css.cell.height,a=t.getWidth(n),o=this._renderService.dimensions.css.cell.width*a,c=this.buffer.y*this._renderService.dimensions.css.cell.height,f=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=f+"px",this.textarea.style.top=c+"px",this.textarea.style.width=o+"px",this.textarea.style.height=s+"px",this.textarea.style.lineHeight=s+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(be(this.element,"copy",t=>{this.hasSelection()&&Ux(t,this._selectionService)}));let e=t=>Px(t,this.textarea,this.coreService,this.optionsService);this._register(be(this.textarea,"paste",e)),this._register(be(this.element,"paste",e)),AS?this._register(be(this.element,"mousedown",t=>{t.button===2&&sv(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(be(this.element,"contextmenu",t=>{sv(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Md&&this._register(be(this.element,"auxclick",t=>{t.button===1&&Jy(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(be(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(be(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(be(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(be(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(be(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(be(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(be(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var a;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"),((a=this.element)==null?void 0:a.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(be(this.screenElement,"mousemove",o=>this.updateCursorStyle(o))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",Tf.get()),MS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(xC,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Nn,this._coreBrowserService),this._register(be(this.textarea,"focus",o=>this._handleTextAreaFocus(o))),this._register(be(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Zf,this._document,this._helperContainer),this._instantiationService.setService(yu,this._charSizeService),this._themeService=this._instantiationService.createInstance(td),this._instantiationService.setService(Ks,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(cu),this._instantiationService.setService(aS,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Jf,this.rows,this.screenElement)),this._instantiationService.setService(On,this._renderService),this._register(this._renderService.onRenderedViewportChange(o=>this._onRender.fire(o))),this.onResize(o=>this._renderService.resize(o.cols,o.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(Xf,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Qf),this._instantiationService.setService(wd,this._mouseService);let s=this._linkifier.value=this._register(this._instantiationService.createInstance(ud,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(Vf,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(o=>{super.scrollLines(o,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(ed,this.element,this.screenElement,s)),this._instantiationService.setService(Xx,this._selectionService),this._register(this._selectionService.onRequestScrollLines(o=>this.scrollLines(o.amount,o.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(o=>this._renderService.handleSelectionChanged(o.start,o.end,o.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(o=>{this.textarea.value=o,this.textarea.focus(),this.textarea.select()})),this._register(Yt.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var o;this._selectionService.refresh(),(o=this._viewport)==null||o.queueSync()})),this._register(this._instantiationService.createInstance(Kf,this.screenElement)),this._register(be(this.element,"mousedown",o=>this._selectionService.handleMouseDown(o))),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(du,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",o=>this._handleScreenReaderModeOptionChange(o))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(uu,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",o=>{!this._overviewRulerRenderer&&o&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(uu,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Gf,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(o){var h,g,_,S,y;let c=e._mouseService.getMouseReportCoords(o,e.screenElement);if(!c)return!1;let f,p;switch(o.overrideType||o.type){case"mousemove":p=32,o.buttons===void 0?(f=3,o.button!==void 0&&(f=o.button<3?o.button:3)):f=o.buttons&1?0:o.buttons&4?1:o.buttons&2?2:3;break;case"mouseup":p=0,f=o.button<3?o.button:3;break;case"mousedown":p=1,f=o.button<3?o.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(o)===!1)return!1;let b=o.deltaY;if(b===0||e.coreMouseService.consumeWheelEvent(o,(S=(_=(g=(h=e._renderService)==null?void 0:h.dimensions)==null?void 0:g.device)==null?void 0:_.cell)==null?void 0:S.height,(y=e._coreBrowserService)==null?void 0:y.dpr)===0)return!1;p=b<0?0:1,f=4;break;default:return!1}return p===void 0||f===void 0||f>4?!1:e.coreMouseService.triggerMouseEvent({col:c.col,row:c.row,x:c.x,y:c.y,button:f,action:p,ctrl:o.ctrlKey,alt:o.altKey,shift:o.shiftKey})}let s={mouseup:null,wheel:null,mousedrag:null,mousemove:null},a={mouseup:o=>(n(o),o.buttons||(this._document.removeEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.removeEventListener("mousemove",s.mousedrag)),this.cancel(o)),wheel:o=>(n(o),this.cancel(o,!0)),mousedrag:o=>{o.buttons&&n(o)},mousemove:o=>{o.buttons||n(o)}};this._register(this.coreMouseService.onProtocolChange(o=>{o?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(o)),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()),o&8?s.mousemove||(t.addEventListener("mousemove",a.mousemove),s.mousemove=a.mousemove):(t.removeEventListener("mousemove",s.mousemove),s.mousemove=null),o&16?s.wheel||(t.addEventListener("wheel",a.wheel,{passive:!1}),s.wheel=a.wheel):(t.removeEventListener("wheel",s.wheel),s.wheel=null),o&2?s.mouseup||(s.mouseup=a.mouseup):(this._document.removeEventListener("mouseup",s.mouseup),s.mouseup=null),o&4?s.mousedrag||(s.mousedrag=a.mousedrag):(this._document.removeEventListener("mousemove",s.mousedrag),s.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(be(t,"mousedown",o=>{if(o.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(o)))return n(o),s.mouseup&&this._document.addEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.addEventListener("mousemove",s.mousedrag),this.cancel(o)})),this._register(be(t,"wheel",o=>{var c,f,p,h,g;if(!s.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(o)===!1)return!1;if(!this.buffer.hasScrollback){if(o.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(o,(h=(p=(f=(c=e._renderService)==null?void 0:c.dimensions)==null?void 0:f.device)==null?void 0:p.cell)==null?void 0:h.height,(g=e._coreBrowserService)==null?void 0:g.dpr)===0)return this.cancel(o,!0);let _=ne.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(o.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(_,!0),this.cancel(o,!0)}}},{passive:!1}))}refresh(e,t){var n;(n=this._renderService)==null||n.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){Qy(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,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var e;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,t){var n;(n=this._selectionService)==null||n.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 n=A2(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let s=this.rows-1;return this.scrollLines(n.type===2?-s:s),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.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((n.key===ne.ETX||n.key===ne.CR)&&(this.textarea.value=""),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(O2(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 n;(n=this._charSizeService)==null||n.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(St));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(ne.ESC+"[I"):this.coreService.triggerDataEvent(ne.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),n=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${ne.ESC}[4;${n};${t}t`);break;case 1:let s=this._renderService.dimensions.css.cell.width.toFixed(0),a=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${ne.ESC}[6;${a};${s}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function O2(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var H2=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(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)}},j2=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 Vi)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},Gv=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 j2(t)}getNullCell(){return new Vi}},U2=class extends Ae{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new ce),this.onBufferChange=this._onBufferChange.event,this._normal=new Gv(this._core.buffers.normal,"normal"),this._alternate=new Gv(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)}},P2=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,n=>t(n.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(n,s)=>t(n,s.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)}},I2=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}},F2=["cols","rows"],sn=0,q2=class extends Ae{constructor(e){super(),this._core=this._register(new N2(e)),this._addonManager=this._register(new H2),this._publicOptions={...this._core.options};let t=s=>this._core.options[s],n=(s,a)=>{this._checkReadonlyOptions(s),this._core.options[s]=a};for(let s in this._core.options){let a={get:t.bind(this,s),set:n.bind(this,s)};Object.defineProperty(this._publicOptions,s,a)}}_checkReadonlyOptions(e){if(F2.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 P2(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new I2(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 U2(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,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
75
75
  `,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 Tf.get()},set promptLabel(e){Tf.set(e)},get tooMuchOutput(){return Af.get()},set tooMuchOutput(e){Af.set(e)}}}_verifyIntegers(...e){for(sn of e)if(sn===1/0||isNaN(sn)||sn%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(sn of e)if(sn&&(sn===1/0||isNaN(sn)||sn%1!==0||sn<0))throw new Error("This API only accepts positive integers")}};/**
76
76
  * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
77
77
  * @license MIT
@@ -83,7 +83,7 @@ WARNING: This link could potentially be dangerous`)){let n=window.open();if(n){t
83
83
  * Fabrice Bellard's javascript vt100 for jslinux:
84
84
  * http://bellard.org/jslinux/
85
85
  * Copyright (c) 2011 Fabrice Bellard
86
- */var W2=2,Y2=1,V2=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 m;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:((m=this._terminal.options.overviewRuler)==null?void 0:m.width)||14,n=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(n.getPropertyValue("height")),a=Math.max(0,parseInt(n.getPropertyValue("width"))),o=window.getComputedStyle(this._terminal.element),c={top:parseInt(o.getPropertyValue("padding-top")),bottom:parseInt(o.getPropertyValue("padding-bottom")),right:parseInt(o.getPropertyValue("padding-right")),left:parseInt(o.getPropertyValue("padding-left"))},f=c.top+c.bottom,p=c.right+c.left,h=s-f,g=a-p-t;return{cols:Math.max(W2,Math.floor(g/e.css.cell.width)),rows:Math.max(Y2,Math.floor(h/e.css.cell.height))}}};/**
86
+ */var W2=2,Y2=1,V2=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 _;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:((_=this._terminal.options.overviewRuler)==null?void 0:_.width)||14,n=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(n.getPropertyValue("height")),a=Math.max(0,parseInt(n.getPropertyValue("width"))),o=window.getComputedStyle(this._terminal.element),c={top:parseInt(o.getPropertyValue("padding-top")),bottom:parseInt(o.getPropertyValue("padding-bottom")),right:parseInt(o.getPropertyValue("padding-right")),left:parseInt(o.getPropertyValue("padding-left"))},f=c.top+c.bottom,p=c.right+c.left,h=s-f,g=a-p-t;return{cols:Math.max(W2,Math.floor(g/e.css.cell.width)),rows:Math.max(Y2,Math.floor(h/e.css.cell.height))}}};/**
87
87
  * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
88
88
  * @license MIT
89
89
  *
@@ -94,36 +94,36 @@ WARNING: This link could potentially be dangerous`)){let n=window.open();if(n){t
94
94
  * Fabrice Bellard's javascript vt100 for jslinux:
95
95
  * http://bellard.org/jslinux/
96
96
  * Copyright (c) 2011 Fabrice Bellard
97
- */var Lt=0,zt=0,Nt=0,ct=0,Xt;(e=>{function t(a,o,c,f){return f!==void 0?`#${Hr(a)}${Hr(o)}${Hr(c)}${Hr(f)}`:`#${Hr(a)}${Hr(o)}${Hr(c)}`}e.toCss=t;function n(a,o,c,f=255){return(a<<24|o<<16|c<<8|f)>>>0}e.toRgba=n;function s(a,o,c,f){return{css:e.toCss(a,o,c,f),rgba:e.toRgba(a,o,c,f)}}e.toColor=s})(Xt||(Xt={}));var K2;(e=>{function t(p,h){if(ct=(h.rgba&255)/255,ct===1)return{css:h.css,rgba:h.rgba};let g=h.rgba>>24&255,m=h.rgba>>16&255,S=h.rgba>>8&255,v=p.rgba>>24&255,b=p.rgba>>16&255,k=p.rgba>>8&255;Lt=v+Math.round((g-v)*ct),zt=b+Math.round((m-b)*ct),Nt=k+Math.round((S-k)*ct);let B=Xt.toCss(Lt,zt,Nt),D=Xt.toRgba(Lt,zt,Nt);return{css:B,rgba:D}}e.blend=t;function n(p){return(p.rgba&255)===255}e.isOpaque=n;function s(p,h,g){let m=lu.ensureContrastRatio(p.rgba,h.rgba,g);if(m)return Xt.toColor(m>>24&255,m>>16&255,m>>8&255)}e.ensureContrastRatio=s;function a(p){let h=(p.rgba|255)>>>0;return[Lt,zt,Nt]=lu.toChannels(h),{css:Xt.toCss(Lt,zt,Nt),rgba:h}}e.opaque=a;function o(p,h){return ct=Math.round(h*255),[Lt,zt,Nt]=lu.toChannels(p.rgba),{css:Xt.toCss(Lt,zt,Nt,ct),rgba:Xt.toRgba(Lt,zt,Nt,ct)}}e.opacity=o;function c(p,h){return ct=p.rgba&255,o(p,ct*h/255)}e.multiplyOpacity=c;function f(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}e.toColorRGB=f})(K2||(K2={}));var qt;(e=>{let t,n;try{let a=document.createElement("canvas");a.width=1,a.height=1;let o=a.getContext("2d",{willReadFrequently:!0});o&&(t=o,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function s(a){if(a.match(/#[\da-f]{3,8}/i))switch(a.length){case 4:return Lt=parseInt(a.slice(1,2).repeat(2),16),zt=parseInt(a.slice(2,3).repeat(2),16),Nt=parseInt(a.slice(3,4).repeat(2),16),Xt.toColor(Lt,zt,Nt);case 5:return Lt=parseInt(a.slice(1,2).repeat(2),16),zt=parseInt(a.slice(2,3).repeat(2),16),Nt=parseInt(a.slice(3,4).repeat(2),16),ct=parseInt(a.slice(4,5).repeat(2),16),Xt.toColor(Lt,zt,Nt,ct);case 7:return{css:a,rgba:(parseInt(a.slice(1),16)<<8|255)>>>0};case 9:return{css:a,rgba:parseInt(a.slice(1),16)>>>0}}let o=a.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(o)return Lt=parseInt(o[1]),zt=parseInt(o[2]),Nt=parseInt(o[3]),ct=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),Xt.toColor(Lt,zt,Nt,ct);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=a,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Lt,zt,Nt,ct]=t.getImageData(0,0,1,1).data,ct!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Xt.toRgba(Lt,zt,Nt,ct),css:a}}e.toColor=s})(qt||(qt={}));var ii;(e=>{function t(s){return n(s>>16&255,s>>8&255,s&255)}e.relativeLuminance=t;function n(s,a,o){let c=s/255,f=a/255,p=o/255,h=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4),g=f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4),m=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4);return h*.2126+g*.7152+m*.0722}e.relativeLuminance2=n})(ii||(ii={}));var lu;(e=>{function t(c,f){if(ct=(f&255)/255,ct===1)return f;let p=f>>24&255,h=f>>16&255,g=f>>8&255,m=c>>24&255,S=c>>16&255,v=c>>8&255;return Lt=m+Math.round((p-m)*ct),zt=S+Math.round((h-S)*ct),Nt=v+Math.round((g-v)*ct),Xt.toRgba(Lt,zt,Nt)}e.blend=t;function n(c,f,p){let h=ii.relativeLuminance(c>>8),g=ii.relativeLuminance(f>>8);if(Bn(h,g)<p){if(g<h){let v=s(c,f,p),b=Bn(h,ii.relativeLuminance(v>>8));if(b<p){let k=a(c,f,p),B=Bn(h,ii.relativeLuminance(k>>8));return b>B?v:k}return v}let m=a(c,f,p),S=Bn(h,ii.relativeLuminance(m>>8));if(S<p){let v=s(c,f,p),b=Bn(h,ii.relativeLuminance(v>>8));return S>b?m:v}return m}}e.ensureContrastRatio=n;function s(c,f,p){let h=c>>24&255,g=c>>16&255,m=c>>8&255,S=f>>24&255,v=f>>16&255,b=f>>8&255,k=Bn(ii.relativeLuminance2(S,v,b),ii.relativeLuminance2(h,g,m));for(;k<p&&(S>0||v>0||b>0);)S-=Math.max(0,Math.ceil(S*.1)),v-=Math.max(0,Math.ceil(v*.1)),b-=Math.max(0,Math.ceil(b*.1)),k=Bn(ii.relativeLuminance2(S,v,b),ii.relativeLuminance2(h,g,m));return(S<<24|v<<16|b<<8|255)>>>0}e.reduceLuminance=s;function a(c,f,p){let h=c>>24&255,g=c>>16&255,m=c>>8&255,S=f>>24&255,v=f>>16&255,b=f>>8&255,k=Bn(ii.relativeLuminance2(S,v,b),ii.relativeLuminance2(h,g,m));for(;k<p&&(S<255||v<255||b<255);)S=Math.min(255,S+Math.ceil((255-S)*.1)),v=Math.min(255,v+Math.ceil((255-v)*.1)),b=Math.min(255,b+Math.ceil((255-b)*.1)),k=Bn(ii.relativeLuminance2(S,v,b),ii.relativeLuminance2(h,g,m));return(S<<24|v<<16|b<<8|255)>>>0}e.increaseLuminance=a;function o(c){return[c>>24&255,c>>16&255,c>>8&255,c&255]}e.toChannels=o})(lu||(lu={}));function Hr(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Bn(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var X2=Object.freeze((()=>{let e=[qt.toColor("#2e3436"),qt.toColor("#cc0000"),qt.toColor("#4e9a06"),qt.toColor("#c4a000"),qt.toColor("#3465a4"),qt.toColor("#75507b"),qt.toColor("#06989a"),qt.toColor("#d3d7cf"),qt.toColor("#555753"),qt.toColor("#ef2929"),qt.toColor("#8ae234"),qt.toColor("#fce94f"),qt.toColor("#729fcf"),qt.toColor("#ad7fa8"),qt.toColor("#34e2e2"),qt.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let s=t[n/36%6|0],a=t[n/6%6|0],o=t[n%6];e.push({css:Xt.toCss(s,a,o),rgba:Xt.toRgba(s,a,o)})}for(let n=0;n<24;n++){let s=8+n*10;e.push({css:Xt.toCss(s,s,s),rgba:Xt.toRgba(s,s,s)})}return e})());function Zv(e,t,n){return Math.max(t,Math.min(e,n))}function $2(e){switch(e){case"&":return"&amp;";case"<":return"&lt;"}return e}var IS=class{constructor(e){this._buffer=e}serialize(e,t){let n=this._buffer.getNullCell(),s=this._buffer.getNullCell(),a=n,o=e.start.y,c=e.end.y,f=e.start.x,p=e.end.x;this._beforeSerialize(c-o,o,c);for(let h=o;h<=c;h++){let g=this._buffer.getLine(h);if(g){let m=h===e.start.y?f:0,S=h===e.end.y?p:g.length;for(let v=m;v<S;v++){let b=g.getCell(v,a===n?s:n);if(!b){console.warn(`Can't get cell at row=${h}, col=${v}`);continue}this._nextCell(b,a,h,v),a=b}}this._rowEnd(h,h===c)}return this._afterSerialize(),this._serializeString(t)}_nextCell(e,t,n,s){}_rowEnd(e,t){}_beforeSerialize(e,t,n){}_afterSerialize(){}_serializeString(e){return""}};function FS(e,t){return e.getFgColorMode()===t.getFgColorMode()&&e.getFgColor()===t.getFgColor()}function Ln(e,t){return e.getBgColorMode()===t.getBgColorMode()&&e.getBgColor()===t.getBgColor()}function qS(e,t){return e.isInverse()===t.isInverse()&&e.isBold()===t.isBold()&&e.isUnderline()===t.isUnderline()&&e.isOverline()===t.isOverline()&&e.isBlink()===t.isBlink()&&e.isInvisible()===t.isInvisible()&&e.isItalic()===t.isItalic()&&e.isDim()===t.isDim()&&e.isStrikethrough()===t.isStrikethrough()}var G2=class extends IS{constructor(e,t){super(e),this._terminal=t,this._rowIndex=0,this._allRows=new Array,this._allRowSeparators=new Array,this._currentRow="",this._nullCellCount=0,this._cursorStyle=this._buffer.getNullCell(),this._cursorStyleRow=0,this._cursorStyleCol=0,this._backgroundCell=this._buffer.getNullCell(),this._firstRow=0,this._lastCursorRow=0,this._lastCursorCol=0,this._lastContentCursorRow=0,this._lastContentCursorCol=0,this._thisRowLastChar=this._buffer.getNullCell(),this._thisRowLastSecondChar=this._buffer.getNullCell(),this._nextRowFirstChar=this._buffer.getNullCell()}_beforeSerialize(e,t,n){this._allRows=new Array(e),this._lastContentCursorRow=t,this._lastCursorRow=t,this._firstRow=t}_rowEnd(e,t){var s;this._nullCellCount>0&&!Ln(this._cursorStyle,this._backgroundCell)&&(this._currentRow+=`\x1B[${this._nullCellCount}X`);let n="";if(!t){e-this._firstRow>=this._terminal.rows&&((s=this._buffer.getLine(this._cursorStyleRow))==null||s.getCell(this._cursorStyleCol,this._backgroundCell));let a=this._buffer.getLine(e),o=this._buffer.getLine(e+1);if(!o.isWrapped)n=`\r
98
- `,this._lastCursorRow=e+1,this._lastCursorCol=0;else{n="";let c=a.getCell(a.length-1,this._thisRowLastChar),f=a.getCell(a.length-2,this._thisRowLastSecondChar),p=o.getCell(0,this._nextRowFirstChar),h=p.getWidth()>1,g=!1;(p.getChars()&&h?this._nullCellCount<=1:this._nullCellCount<=0)&&((c.getChars()||c.getWidth()===0)&&Ln(c,p)&&(g=!0),h&&(f.getChars()||f.getWidth()===0)&&Ln(c,p)&&Ln(f,p)&&(g=!0)),g||(n="-".repeat(this._nullCellCount+1),n+="\x1B[1D\x1B[1X",this._nullCellCount>0&&(n+="\x1B[A",n+=`\x1B[${a.length-this._nullCellCount}C`,n+=`\x1B[${this._nullCellCount}X`,n+=`\x1B[${a.length-this._nullCellCount}D`,n+="\x1B[B"),this._lastContentCursorRow=e+1,this._lastContentCursorCol=0,this._lastCursorRow=e+1,this._lastCursorCol=0)}}this._allRows[this._rowIndex]=this._currentRow,this._allRowSeparators[this._rowIndex++]=n,this._currentRow="",this._nullCellCount=0}_diffStyle(e,t){let n=[],s=!FS(e,t),a=!Ln(e,t),o=!qS(e,t);if(s||a||o)if(e.isAttributeDefault())t.isAttributeDefault()||n.push(0);else{if(s){let c=e.getFgColor();e.isFgRGB()?n.push(38,2,c>>>16&255,c>>>8&255,c&255):e.isFgPalette()?c>=16?n.push(38,5,c):n.push(c&8?90+(c&7):30+(c&7)):n.push(39)}if(a){let c=e.getBgColor();e.isBgRGB()?n.push(48,2,c>>>16&255,c>>>8&255,c&255):e.isBgPalette()?c>=16?n.push(48,5,c):n.push(c&8?100+(c&7):40+(c&7)):n.push(49)}o&&(e.isInverse()!==t.isInverse()&&n.push(e.isInverse()?7:27),e.isBold()!==t.isBold()&&n.push(e.isBold()?1:22),e.isUnderline()!==t.isUnderline()&&n.push(e.isUnderline()?4:24),e.isOverline()!==t.isOverline()&&n.push(e.isOverline()?53:55),e.isBlink()!==t.isBlink()&&n.push(e.isBlink()?5:25),e.isInvisible()!==t.isInvisible()&&n.push(e.isInvisible()?8:28),e.isItalic()!==t.isItalic()&&n.push(e.isItalic()?3:23),e.isDim()!==t.isDim()&&n.push(e.isDim()?2:22),e.isStrikethrough()!==t.isStrikethrough()&&n.push(e.isStrikethrough()?9:29))}return n}_nextCell(e,t,n,s){if(e.getWidth()===0)return;let a=e.getChars()==="",o=this._diffStyle(e,this._cursorStyle);if(a?!Ln(this._cursorStyle,e):o.length>0){this._nullCellCount>0&&(Ln(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._lastContentCursorRow=this._lastCursorRow=n,this._lastContentCursorCol=this._lastCursorCol=s,this._currentRow+=`\x1B[${o.join(";")}m`;let c=this._buffer.getLine(n);c!==void 0&&(c.getCell(s,this._cursorStyle),this._cursorStyleRow=n,this._cursorStyleCol=s)}a?this._nullCellCount+=e.getWidth():(this._nullCellCount>0&&(Ln(this._cursorStyle,this._backgroundCell)?this._currentRow+=`\x1B[${this._nullCellCount}C`:(this._currentRow+=`\x1B[${this._nullCellCount}X`,this._currentRow+=`\x1B[${this._nullCellCount}C`),this._nullCellCount=0),this._currentRow+=e.getChars(),this._lastContentCursorRow=this._lastCursorRow=n,this._lastContentCursorCol=this._lastCursorCol=s+e.getWidth())}_serializeString(e){let t=this._allRows.length;this._buffer.length-this._firstRow<=this._terminal.rows&&(t=this._lastContentCursorRow+1-this._firstRow,this._lastCursorCol=this._lastContentCursorCol,this._lastCursorRow=this._lastContentCursorRow);let n="";for(let o=0;o<t;o++)n+=this._allRows[o],o+1<t&&(n+=this._allRowSeparators[o]);if(!e){let o=this._buffer.baseY+this._buffer.cursorY,c=this._buffer.cursorX,f=o!==this._lastCursorRow||c!==this._lastCursorCol,p=h=>{h>0?n+=`\x1B[${h}C`:h<0&&(n+=`\x1B[${-h}D`)};f&&((h=>{h>0?n+=`\x1B[${h}B`:h<0&&(n+=`\x1B[${-h}A`)})(o-this._lastCursorRow),p(c-this._lastCursorCol))}let s=this._terminal._core._inputHandler._curAttrData,a=this._diffStyle(s,this._cursorStyle);return a.length>0&&(n+=`\x1B[${a.join(";")}m`),n}},Z2=class{activate(e){this._terminal=e}_serializeBufferByScrollback(e,t,n){let s=t.length,a=n===void 0?s:Zv(n+e.rows,0,s);return this._serializeBufferByRange(e,t,{start:s-a,end:s-1},!1)}_serializeBufferByRange(e,t,n,s){return new G2(t,e).serialize({start:{x:0,y:typeof n.start=="number"?n.start:n.start.line},end:{x:e.cols,y:typeof n.end=="number"?n.end:n.end.line}},s)}_serializeBufferAsHTML(e,t){var f;let n=e.buffer.active,s=new Q2(n,e,t),a=t.onlySelection??!1,o=t.range;if(o)return s.serialize({start:{x:o.startCol,y:(o.startLine,o.startLine)},end:{x:e.cols,y:(o.endLine,o.endLine)}});if(!a){let p=n.length,h=t.scrollback,g=h===void 0?p:Zv(h+e.rows,0,p);return s.serialize({start:{x:0,y:p-g},end:{x:e.cols,y:p-1}})}let c=(f=this._terminal)==null?void 0:f.getSelectionPosition();return c!==void 0?s.serialize({start:{x:c.start.x,y:c.start.y},end:{x:c.end.x,y:c.end.y}}):""}_serializeModes(e){let t="",n=e.modes;if(n.applicationCursorKeysMode&&(t+="\x1B[?1h"),n.applicationKeypadMode&&(t+="\x1B[?66h"),n.bracketedPasteMode&&(t+="\x1B[?2004h"),n.insertMode&&(t+="\x1B[4h"),n.originMode&&(t+="\x1B[?6h"),n.reverseWraparoundMode&&(t+="\x1B[?45h"),n.sendFocusMode&&(t+="\x1B[?1004h"),n.wraparoundMode===!1&&(t+="\x1B[?7l"),n.mouseTrackingMode!=="none")switch(n.mouseTrackingMode){case"x10":t+="\x1B[?9h";break;case"vt200":t+="\x1B[?1000h";break;case"drag":t+="\x1B[?1002h";break;case"any":t+="\x1B[?1003h";break}return t}serialize(e){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");let t=e!=null&&e.range?this._serializeBufferByRange(this._terminal,this._terminal.buffer.normal,e.range,!0):this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.normal,e==null?void 0:e.scrollback);if(!(e!=null&&e.excludeAltBuffer)&&this._terminal.buffer.active.type==="alternate"){let n=this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.alternate,void 0);t+=`\x1B[?1049h\x1B[H${n}`}return e!=null&&e.excludeModes||(t+=this._serializeModes(this._terminal)),t}serializeAsHTML(e){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");return this._serializeBufferAsHTML(this._terminal,e||{})}dispose(){}},Q2=class extends IS{constructor(e,t,n){super(e),this._terminal=t,this._options=n,this._currentRow="",this._htmlContent="",t._core._themeService?this._ansiColors=t._core._themeService.colors.ansi:this._ansiColors=X2}_padStart(e,t,n){return t=t>>0,n=n??" ",e.length>t?e:(t-=e.length,t>n.length&&(n+=n.repeat(t/n.length)),n.slice(0,t)+e)}_beforeSerialize(e,t,n){var c,f;this._htmlContent+="<html><body><!--StartFragment--><pre>";let s="#000000",a="#ffffff";(this._options.includeGlobalBackground??!1)&&(s=((c=this._terminal.options.theme)==null?void 0:c.foreground)??"#ffffff",a=((f=this._terminal.options.theme)==null?void 0:f.background)??"#000000");let o=[];o.push("color: "+s+";"),o.push("background-color: "+a+";"),o.push("font-family: "+this._terminal.options.fontFamily+";"),o.push("font-size: "+this._terminal.options.fontSize+"px;"),this._htmlContent+="<div style='"+o.join(" ")+"'>"}_afterSerialize(){this._htmlContent+="</div>",this._htmlContent+="</pre><!--EndFragment--></body></html>"}_rowEnd(e,t){this._htmlContent+="<div><span>"+this._currentRow+"</span></div>",this._currentRow=""}_getHexColor(e,t){let n=t?e.getFgColor():e.getBgColor();if(t?e.isFgRGB():e.isBgRGB())return"#"+[n>>16&255,n>>8&255,n&255].map(s=>this._padStart(s.toString(16),2,"0")).join("");if(t?e.isFgPalette():e.isBgPalette())return this._ansiColors[n].css}_diffStyle(e,t){let n=[],s=!FS(e,t),a=!Ln(e,t),o=!qS(e,t);if(s||a||o){let c=this._getHexColor(e,!0);c&&n.push("color: "+c+";");let f=this._getHexColor(e,!1);return f&&n.push("background-color: "+f+";"),e.isInverse()&&n.push("color: #000000; background-color: #BFBFBF;"),e.isBold()&&n.push("font-weight: bold;"),e.isUnderline()&&e.isOverline()?n.push("text-decoration: overline underline;"):e.isUnderline()?n.push("text-decoration: underline;"):e.isOverline()&&n.push("text-decoration: overline;"),e.isBlink()&&n.push("text-decoration: blink;"),e.isInvisible()&&n.push("visibility: hidden;"),e.isItalic()&&n.push("font-style: italic;"),e.isDim()&&n.push("opacity: 0.5;"),e.isStrikethrough()&&n.push("text-decoration: line-through;"),n}}_nextCell(e,t,n,s){if(e.getWidth()===0)return;let a=e.getChars()==="",o=this._diffStyle(e,t);o&&(this._currentRow+=o.length===0?"</span><span>":"</span><span style='"+o.join(" ")+"'>"),a?this._currentRow+=" ":this._currentRow+=$2(e.getChars())}_serializeString(){return this._htmlContent}};const J2={background:"#F0EBE1",foreground:"#2C1810",cursor:"#8B4513",cursorAccent:"#F0EBE1",selectionBackground:"#D4C5B0",selectionForeground:"#2C1810",black:"#2C1810",red:"#A63D40",green:"#4A7A4A",yellow:"#8B6914",blue:"#4A6FA5",magenta:"#7B4B8A",cyan:"#3D7A7A",white:"#3A2A1E",brightBlack:"#8B7355",brightRed:"#B85C5C",brightGreen:"#5A8A5A",brightYellow:"#A07D1C",brightBlue:"#5A82BA",brightMagenta:"#8E5D9F",brightCyan:"#5A8F8F",brightWhite:"#4A3728"},ek="plotlink-terminal",tk=1,Ys="scrollback",Qv=10*1024*1024;function WS(){return new Promise((e,t)=>{const n=indexedDB.open(ek,tk);n.onupgradeneeded=()=>{const s=n.result;s.objectStoreNames.contains(Ys)||s.createObjectStore(Ys)},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error)})}async function $o(e,t){const n=t.length>Qv?t.slice(-Qv):t,s=await WS();return new Promise((a,o)=>{const c=s.transaction(Ys,"readwrite");c.objectStore(Ys).put(n,e),c.oncomplete=()=>{s.close(),a()},c.onerror=()=>{s.close(),o(c.error)}})}async function ik(e){const t=await WS();return new Promise((n,s)=>{const o=t.transaction(Ys,"readonly").objectStore(Ys).get(e);o.onsuccess=()=>{t.close(),n(o.result??null)},o.onerror=()=>{t.close(),s(o.error)}})}const Di=new Map;function nk({token:e,storyName:t,authFetch:n,onSelectStory:s}){const a=re.useRef(null),o=re.useRef(n),[c,f]=re.useState([]),[p,h]=re.useState(new Set),g=re.useRef(()=>{});re.useEffect(()=>{o.current=n},[n]);const m=re.useCallback(A=>{var $;const{width:N}=A.container.getBoundingClientRect();if(!(N<50))try{A.fit.fit(),(($=A.ws)==null?void 0:$.readyState)===WebSocket.OPEN&&A.ws.send(JSON.stringify({type:"resize",cols:A.term.cols,rows:A.term.rows}))}catch{}},[]),S=re.useCallback(A=>{for(const[N,$]of Di)$.container.style.display=N===A?"block":"none";if(A){const N=Di.get(A);N&&setTimeout(()=>m(N),50)}},[m]),v=re.useCallback((A,N,$)=>{const z=window.location.protocol==="https:"?"wss:":"ws:",Q=new WebSocket(`${z}//${window.location.host}/ws/terminal?story=${encodeURIComponent(A)}&token=${e}&resume=${$}`);Q.onopen=()=>{N.connected=!0,N._retried=!1,h(se=>{const he=new Set(se);return he.delete(A),he}),Q.send(JSON.stringify({type:"resize",cols:N.term.cols,rows:N.term.rows}))},Q.onmessage=se=>{N.term.write(se.data)},Q.onclose=se=>{if(N.connected=!1,N.ws===Q){N.ws=null;try{const he=N.serialize.serialize();$o(A,he).catch(()=>{})}catch{}if(se.code===4e3&&!N._retried){N._retried=!0,N.term.write(`\r
97
+ */var Lt=0,zt=0,Nt=0,ct=0,Xt;(e=>{function t(a,o,c,f){return f!==void 0?`#${Hr(a)}${Hr(o)}${Hr(c)}${Hr(f)}`:`#${Hr(a)}${Hr(o)}${Hr(c)}`}e.toCss=t;function n(a,o,c,f=255){return(a<<24|o<<16|c<<8|f)>>>0}e.toRgba=n;function s(a,o,c,f){return{css:e.toCss(a,o,c,f),rgba:e.toRgba(a,o,c,f)}}e.toColor=s})(Xt||(Xt={}));var K2;(e=>{function t(p,h){if(ct=(h.rgba&255)/255,ct===1)return{css:h.css,rgba:h.rgba};let g=h.rgba>>24&255,_=h.rgba>>16&255,S=h.rgba>>8&255,y=p.rgba>>24&255,b=p.rgba>>16&255,k=p.rgba>>8&255;Lt=y+Math.round((g-y)*ct),zt=b+Math.round((_-b)*ct),Nt=k+Math.round((S-k)*ct);let R=Xt.toCss(Lt,zt,Nt),T=Xt.toRgba(Lt,zt,Nt);return{css:R,rgba:T}}e.blend=t;function n(p){return(p.rgba&255)===255}e.isOpaque=n;function s(p,h,g){let _=lu.ensureContrastRatio(p.rgba,h.rgba,g);if(_)return Xt.toColor(_>>24&255,_>>16&255,_>>8&255)}e.ensureContrastRatio=s;function a(p){let h=(p.rgba|255)>>>0;return[Lt,zt,Nt]=lu.toChannels(h),{css:Xt.toCss(Lt,zt,Nt),rgba:h}}e.opaque=a;function o(p,h){return ct=Math.round(h*255),[Lt,zt,Nt]=lu.toChannels(p.rgba),{css:Xt.toCss(Lt,zt,Nt,ct),rgba:Xt.toRgba(Lt,zt,Nt,ct)}}e.opacity=o;function c(p,h){return ct=p.rgba&255,o(p,ct*h/255)}e.multiplyOpacity=c;function f(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}e.toColorRGB=f})(K2||(K2={}));var qt;(e=>{let t,n;try{let a=document.createElement("canvas");a.width=1,a.height=1;let o=a.getContext("2d",{willReadFrequently:!0});o&&(t=o,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function s(a){if(a.match(/#[\da-f]{3,8}/i))switch(a.length){case 4:return Lt=parseInt(a.slice(1,2).repeat(2),16),zt=parseInt(a.slice(2,3).repeat(2),16),Nt=parseInt(a.slice(3,4).repeat(2),16),Xt.toColor(Lt,zt,Nt);case 5:return Lt=parseInt(a.slice(1,2).repeat(2),16),zt=parseInt(a.slice(2,3).repeat(2),16),Nt=parseInt(a.slice(3,4).repeat(2),16),ct=parseInt(a.slice(4,5).repeat(2),16),Xt.toColor(Lt,zt,Nt,ct);case 7:return{css:a,rgba:(parseInt(a.slice(1),16)<<8|255)>>>0};case 9:return{css:a,rgba:parseInt(a.slice(1),16)>>>0}}let o=a.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(o)return Lt=parseInt(o[1]),zt=parseInt(o[2]),Nt=parseInt(o[3]),ct=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),Xt.toColor(Lt,zt,Nt,ct);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=a,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Lt,zt,Nt,ct]=t.getImageData(0,0,1,1).data,ct!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Xt.toRgba(Lt,zt,Nt,ct),css:a}}e.toColor=s})(qt||(qt={}));var ii;(e=>{function t(s){return n(s>>16&255,s>>8&255,s&255)}e.relativeLuminance=t;function n(s,a,o){let c=s/255,f=a/255,p=o/255,h=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4),g=f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4),_=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4);return h*.2126+g*.7152+_*.0722}e.relativeLuminance2=n})(ii||(ii={}));var lu;(e=>{function t(c,f){if(ct=(f&255)/255,ct===1)return f;let p=f>>24&255,h=f>>16&255,g=f>>8&255,_=c>>24&255,S=c>>16&255,y=c>>8&255;return Lt=_+Math.round((p-_)*ct),zt=S+Math.round((h-S)*ct),Nt=y+Math.round((g-y)*ct),Xt.toRgba(Lt,zt,Nt)}e.blend=t;function n(c,f,p){let h=ii.relativeLuminance(c>>8),g=ii.relativeLuminance(f>>8);if(Bn(h,g)<p){if(g<h){let y=s(c,f,p),b=Bn(h,ii.relativeLuminance(y>>8));if(b<p){let k=a(c,f,p),R=Bn(h,ii.relativeLuminance(k>>8));return b>R?y:k}return y}let _=a(c,f,p),S=Bn(h,ii.relativeLuminance(_>>8));if(S<p){let y=s(c,f,p),b=Bn(h,ii.relativeLuminance(y>>8));return S>b?_:y}return _}}e.ensureContrastRatio=n;function s(c,f,p){let h=c>>24&255,g=c>>16&255,_=c>>8&255,S=f>>24&255,y=f>>16&255,b=f>>8&255,k=Bn(ii.relativeLuminance2(S,y,b),ii.relativeLuminance2(h,g,_));for(;k<p&&(S>0||y>0||b>0);)S-=Math.max(0,Math.ceil(S*.1)),y-=Math.max(0,Math.ceil(y*.1)),b-=Math.max(0,Math.ceil(b*.1)),k=Bn(ii.relativeLuminance2(S,y,b),ii.relativeLuminance2(h,g,_));return(S<<24|y<<16|b<<8|255)>>>0}e.reduceLuminance=s;function a(c,f,p){let h=c>>24&255,g=c>>16&255,_=c>>8&255,S=f>>24&255,y=f>>16&255,b=f>>8&255,k=Bn(ii.relativeLuminance2(S,y,b),ii.relativeLuminance2(h,g,_));for(;k<p&&(S<255||y<255||b<255);)S=Math.min(255,S+Math.ceil((255-S)*.1)),y=Math.min(255,y+Math.ceil((255-y)*.1)),b=Math.min(255,b+Math.ceil((255-b)*.1)),k=Bn(ii.relativeLuminance2(S,y,b),ii.relativeLuminance2(h,g,_));return(S<<24|y<<16|b<<8|255)>>>0}e.increaseLuminance=a;function o(c){return[c>>24&255,c>>16&255,c>>8&255,c&255]}e.toChannels=o})(lu||(lu={}));function Hr(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Bn(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var X2=Object.freeze((()=>{let e=[qt.toColor("#2e3436"),qt.toColor("#cc0000"),qt.toColor("#4e9a06"),qt.toColor("#c4a000"),qt.toColor("#3465a4"),qt.toColor("#75507b"),qt.toColor("#06989a"),qt.toColor("#d3d7cf"),qt.toColor("#555753"),qt.toColor("#ef2929"),qt.toColor("#8ae234"),qt.toColor("#fce94f"),qt.toColor("#729fcf"),qt.toColor("#ad7fa8"),qt.toColor("#34e2e2"),qt.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let s=t[n/36%6|0],a=t[n/6%6|0],o=t[n%6];e.push({css:Xt.toCss(s,a,o),rgba:Xt.toRgba(s,a,o)})}for(let n=0;n<24;n++){let s=8+n*10;e.push({css:Xt.toCss(s,s,s),rgba:Xt.toRgba(s,s,s)})}return e})());function Zv(e,t,n){return Math.max(t,Math.min(e,n))}function $2(e){switch(e){case"&":return"&amp;";case"<":return"&lt;"}return e}var IS=class{constructor(e){this._buffer=e}serialize(e,t){let n=this._buffer.getNullCell(),s=this._buffer.getNullCell(),a=n,o=e.start.y,c=e.end.y,f=e.start.x,p=e.end.x;this._beforeSerialize(c-o,o,c);for(let h=o;h<=c;h++){let g=this._buffer.getLine(h);if(g){let _=h===e.start.y?f:0,S=h===e.end.y?p:g.length;for(let y=_;y<S;y++){let b=g.getCell(y,a===n?s:n);if(!b){console.warn(`Can't get cell at row=${h}, col=${y}`);continue}this._nextCell(b,a,h,y),a=b}}this._rowEnd(h,h===c)}return this._afterSerialize(),this._serializeString(t)}_nextCell(e,t,n,s){}_rowEnd(e,t){}_beforeSerialize(e,t,n){}_afterSerialize(){}_serializeString(e){return""}};function FS(e,t){return e.getFgColorMode()===t.getFgColorMode()&&e.getFgColor()===t.getFgColor()}function Ln(e,t){return e.getBgColorMode()===t.getBgColorMode()&&e.getBgColor()===t.getBgColor()}function qS(e,t){return e.isInverse()===t.isInverse()&&e.isBold()===t.isBold()&&e.isUnderline()===t.isUnderline()&&e.isOverline()===t.isOverline()&&e.isBlink()===t.isBlink()&&e.isInvisible()===t.isInvisible()&&e.isItalic()===t.isItalic()&&e.isDim()===t.isDim()&&e.isStrikethrough()===t.isStrikethrough()}var G2=class extends IS{constructor(e,t){super(e),this._terminal=t,this._rowIndex=0,this._allRows=new Array,this._allRowSeparators=new Array,this._currentRow="",this._nullCellCount=0,this._cursorStyle=this._buffer.getNullCell(),this._cursorStyleRow=0,this._cursorStyleCol=0,this._backgroundCell=this._buffer.getNullCell(),this._firstRow=0,this._lastCursorRow=0,this._lastCursorCol=0,this._lastContentCursorRow=0,this._lastContentCursorCol=0,this._thisRowLastChar=this._buffer.getNullCell(),this._thisRowLastSecondChar=this._buffer.getNullCell(),this._nextRowFirstChar=this._buffer.getNullCell()}_beforeSerialize(e,t,n){this._allRows=new Array(e),this._lastContentCursorRow=t,this._lastCursorRow=t,this._firstRow=t}_rowEnd(e,t){var s;this._nullCellCount>0&&!Ln(this._cursorStyle,this._backgroundCell)&&(this._currentRow+=`\x1B[${this._nullCellCount}X`);let n="";if(!t){e-this._firstRow>=this._terminal.rows&&((s=this._buffer.getLine(this._cursorStyleRow))==null||s.getCell(this._cursorStyleCol,this._backgroundCell));let a=this._buffer.getLine(e),o=this._buffer.getLine(e+1);if(!o.isWrapped)n=`\r
98
+ `,this._lastCursorRow=e+1,this._lastCursorCol=0;else{n="";let c=a.getCell(a.length-1,this._thisRowLastChar),f=a.getCell(a.length-2,this._thisRowLastSecondChar),p=o.getCell(0,this._nextRowFirstChar),h=p.getWidth()>1,g=!1;(p.getChars()&&h?this._nullCellCount<=1:this._nullCellCount<=0)&&((c.getChars()||c.getWidth()===0)&&Ln(c,p)&&(g=!0),h&&(f.getChars()||f.getWidth()===0)&&Ln(c,p)&&Ln(f,p)&&(g=!0)),g||(n="-".repeat(this._nullCellCount+1),n+="\x1B[1D\x1B[1X",this._nullCellCount>0&&(n+="\x1B[A",n+=`\x1B[${a.length-this._nullCellCount}C`,n+=`\x1B[${this._nullCellCount}X`,n+=`\x1B[${a.length-this._nullCellCount}D`,n+="\x1B[B"),this._lastContentCursorRow=e+1,this._lastContentCursorCol=0,this._lastCursorRow=e+1,this._lastCursorCol=0)}}this._allRows[this._rowIndex]=this._currentRow,this._allRowSeparators[this._rowIndex++]=n,this._currentRow="",this._nullCellCount=0}_diffStyle(e,t){let n=[],s=!FS(e,t),a=!Ln(e,t),o=!qS(e,t);if(s||a||o)if(e.isAttributeDefault())t.isAttributeDefault()||n.push(0);else{if(s){let c=e.getFgColor();e.isFgRGB()?n.push(38,2,c>>>16&255,c>>>8&255,c&255):e.isFgPalette()?c>=16?n.push(38,5,c):n.push(c&8?90+(c&7):30+(c&7)):n.push(39)}if(a){let c=e.getBgColor();e.isBgRGB()?n.push(48,2,c>>>16&255,c>>>8&255,c&255):e.isBgPalette()?c>=16?n.push(48,5,c):n.push(c&8?100+(c&7):40+(c&7)):n.push(49)}o&&(e.isInverse()!==t.isInverse()&&n.push(e.isInverse()?7:27),e.isBold()!==t.isBold()&&n.push(e.isBold()?1:22),e.isUnderline()!==t.isUnderline()&&n.push(e.isUnderline()?4:24),e.isOverline()!==t.isOverline()&&n.push(e.isOverline()?53:55),e.isBlink()!==t.isBlink()&&n.push(e.isBlink()?5:25),e.isInvisible()!==t.isInvisible()&&n.push(e.isInvisible()?8:28),e.isItalic()!==t.isItalic()&&n.push(e.isItalic()?3:23),e.isDim()!==t.isDim()&&n.push(e.isDim()?2:22),e.isStrikethrough()!==t.isStrikethrough()&&n.push(e.isStrikethrough()?9:29))}return n}_nextCell(e,t,n,s){if(e.getWidth()===0)return;let a=e.getChars()==="",o=this._diffStyle(e,this._cursorStyle);if(a?!Ln(this._cursorStyle,e):o.length>0){this._nullCellCount>0&&(Ln(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._lastContentCursorRow=this._lastCursorRow=n,this._lastContentCursorCol=this._lastCursorCol=s,this._currentRow+=`\x1B[${o.join(";")}m`;let c=this._buffer.getLine(n);c!==void 0&&(c.getCell(s,this._cursorStyle),this._cursorStyleRow=n,this._cursorStyleCol=s)}a?this._nullCellCount+=e.getWidth():(this._nullCellCount>0&&(Ln(this._cursorStyle,this._backgroundCell)?this._currentRow+=`\x1B[${this._nullCellCount}C`:(this._currentRow+=`\x1B[${this._nullCellCount}X`,this._currentRow+=`\x1B[${this._nullCellCount}C`),this._nullCellCount=0),this._currentRow+=e.getChars(),this._lastContentCursorRow=this._lastCursorRow=n,this._lastContentCursorCol=this._lastCursorCol=s+e.getWidth())}_serializeString(e){let t=this._allRows.length;this._buffer.length-this._firstRow<=this._terminal.rows&&(t=this._lastContentCursorRow+1-this._firstRow,this._lastCursorCol=this._lastContentCursorCol,this._lastCursorRow=this._lastContentCursorRow);let n="";for(let o=0;o<t;o++)n+=this._allRows[o],o+1<t&&(n+=this._allRowSeparators[o]);if(!e){let o=this._buffer.baseY+this._buffer.cursorY,c=this._buffer.cursorX,f=o!==this._lastCursorRow||c!==this._lastCursorCol,p=h=>{h>0?n+=`\x1B[${h}C`:h<0&&(n+=`\x1B[${-h}D`)};f&&((h=>{h>0?n+=`\x1B[${h}B`:h<0&&(n+=`\x1B[${-h}A`)})(o-this._lastCursorRow),p(c-this._lastCursorCol))}let s=this._terminal._core._inputHandler._curAttrData,a=this._diffStyle(s,this._cursorStyle);return a.length>0&&(n+=`\x1B[${a.join(";")}m`),n}},Z2=class{activate(e){this._terminal=e}_serializeBufferByScrollback(e,t,n){let s=t.length,a=n===void 0?s:Zv(n+e.rows,0,s);return this._serializeBufferByRange(e,t,{start:s-a,end:s-1},!1)}_serializeBufferByRange(e,t,n,s){return new G2(t,e).serialize({start:{x:0,y:typeof n.start=="number"?n.start:n.start.line},end:{x:e.cols,y:typeof n.end=="number"?n.end:n.end.line}},s)}_serializeBufferAsHTML(e,t){var f;let n=e.buffer.active,s=new Q2(n,e,t),a=t.onlySelection??!1,o=t.range;if(o)return s.serialize({start:{x:o.startCol,y:(o.startLine,o.startLine)},end:{x:e.cols,y:(o.endLine,o.endLine)}});if(!a){let p=n.length,h=t.scrollback,g=h===void 0?p:Zv(h+e.rows,0,p);return s.serialize({start:{x:0,y:p-g},end:{x:e.cols,y:p-1}})}let c=(f=this._terminal)==null?void 0:f.getSelectionPosition();return c!==void 0?s.serialize({start:{x:c.start.x,y:c.start.y},end:{x:c.end.x,y:c.end.y}}):""}_serializeModes(e){let t="",n=e.modes;if(n.applicationCursorKeysMode&&(t+="\x1B[?1h"),n.applicationKeypadMode&&(t+="\x1B[?66h"),n.bracketedPasteMode&&(t+="\x1B[?2004h"),n.insertMode&&(t+="\x1B[4h"),n.originMode&&(t+="\x1B[?6h"),n.reverseWraparoundMode&&(t+="\x1B[?45h"),n.sendFocusMode&&(t+="\x1B[?1004h"),n.wraparoundMode===!1&&(t+="\x1B[?7l"),n.mouseTrackingMode!=="none")switch(n.mouseTrackingMode){case"x10":t+="\x1B[?9h";break;case"vt200":t+="\x1B[?1000h";break;case"drag":t+="\x1B[?1002h";break;case"any":t+="\x1B[?1003h";break}return t}serialize(e){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");let t=e!=null&&e.range?this._serializeBufferByRange(this._terminal,this._terminal.buffer.normal,e.range,!0):this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.normal,e==null?void 0:e.scrollback);if(!(e!=null&&e.excludeAltBuffer)&&this._terminal.buffer.active.type==="alternate"){let n=this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.alternate,void 0);t+=`\x1B[?1049h\x1B[H${n}`}return e!=null&&e.excludeModes||(t+=this._serializeModes(this._terminal)),t}serializeAsHTML(e){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");return this._serializeBufferAsHTML(this._terminal,e||{})}dispose(){}},Q2=class extends IS{constructor(e,t,n){super(e),this._terminal=t,this._options=n,this._currentRow="",this._htmlContent="",t._core._themeService?this._ansiColors=t._core._themeService.colors.ansi:this._ansiColors=X2}_padStart(e,t,n){return t=t>>0,n=n??" ",e.length>t?e:(t-=e.length,t>n.length&&(n+=n.repeat(t/n.length)),n.slice(0,t)+e)}_beforeSerialize(e,t,n){var c,f;this._htmlContent+="<html><body><!--StartFragment--><pre>";let s="#000000",a="#ffffff";(this._options.includeGlobalBackground??!1)&&(s=((c=this._terminal.options.theme)==null?void 0:c.foreground)??"#ffffff",a=((f=this._terminal.options.theme)==null?void 0:f.background)??"#000000");let o=[];o.push("color: "+s+";"),o.push("background-color: "+a+";"),o.push("font-family: "+this._terminal.options.fontFamily+";"),o.push("font-size: "+this._terminal.options.fontSize+"px;"),this._htmlContent+="<div style='"+o.join(" ")+"'>"}_afterSerialize(){this._htmlContent+="</div>",this._htmlContent+="</pre><!--EndFragment--></body></html>"}_rowEnd(e,t){this._htmlContent+="<div><span>"+this._currentRow+"</span></div>",this._currentRow=""}_getHexColor(e,t){let n=t?e.getFgColor():e.getBgColor();if(t?e.isFgRGB():e.isBgRGB())return"#"+[n>>16&255,n>>8&255,n&255].map(s=>this._padStart(s.toString(16),2,"0")).join("");if(t?e.isFgPalette():e.isBgPalette())return this._ansiColors[n].css}_diffStyle(e,t){let n=[],s=!FS(e,t),a=!Ln(e,t),o=!qS(e,t);if(s||a||o){let c=this._getHexColor(e,!0);c&&n.push("color: "+c+";");let f=this._getHexColor(e,!1);return f&&n.push("background-color: "+f+";"),e.isInverse()&&n.push("color: #000000; background-color: #BFBFBF;"),e.isBold()&&n.push("font-weight: bold;"),e.isUnderline()&&e.isOverline()?n.push("text-decoration: overline underline;"):e.isUnderline()?n.push("text-decoration: underline;"):e.isOverline()&&n.push("text-decoration: overline;"),e.isBlink()&&n.push("text-decoration: blink;"),e.isInvisible()&&n.push("visibility: hidden;"),e.isItalic()&&n.push("font-style: italic;"),e.isDim()&&n.push("opacity: 0.5;"),e.isStrikethrough()&&n.push("text-decoration: line-through;"),n}}_nextCell(e,t,n,s){if(e.getWidth()===0)return;let a=e.getChars()==="",o=this._diffStyle(e,t);o&&(this._currentRow+=o.length===0?"</span><span>":"</span><span style='"+o.join(" ")+"'>"),a?this._currentRow+=" ":this._currentRow+=$2(e.getChars())}_serializeString(){return this._htmlContent}};const J2={background:"#F0EBE1",foreground:"#2C1810",cursor:"#8B4513",cursorAccent:"#F0EBE1",selectionBackground:"#D4C5B0",selectionForeground:"#2C1810",black:"#2C1810",red:"#A63D40",green:"#4A7A4A",yellow:"#8B6914",blue:"#4A6FA5",magenta:"#7B4B8A",cyan:"#3D7A7A",white:"#E6DDD0",brightBlack:"#8B7355",brightRed:"#B85C5C",brightGreen:"#5A8A5A",brightYellow:"#A07D1C",brightBlue:"#5A82BA",brightMagenta:"#8E5D9F",brightCyan:"#5A8F8F",brightWhite:"#4A3728"},ek="plotlink-terminal",tk=1,Ys="scrollback",Qv=10*1024*1024;function WS(){return new Promise((e,t)=>{const n=indexedDB.open(ek,tk);n.onupgradeneeded=()=>{const s=n.result;s.objectStoreNames.contains(Ys)||s.createObjectStore(Ys)},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error)})}async function $o(e,t){const n=t.length>Qv?t.slice(-Qv):t,s=await WS();return new Promise((a,o)=>{const c=s.transaction(Ys,"readwrite");c.objectStore(Ys).put(n,e),c.oncomplete=()=>{s.close(),a()},c.onerror=()=>{s.close(),o(c.error)}})}async function ik(e){const t=await WS();return new Promise((n,s)=>{const o=t.transaction(Ys,"readonly").objectStore(Ys).get(e);o.onsuccess=()=>{t.close(),n(o.result??null)},o.onerror=()=>{t.close(),s(o.error)}})}const Di=new Map;function nk({token:e,storyName:t,authFetch:n,onSelectStory:s,onDestroySession:a}){const o=ae.useRef(null),c=ae.useRef(n),[f,p]=ae.useState([]),[h,g]=ae.useState(new Set),_=ae.useRef(()=>{});ae.useEffect(()=>{c.current=n},[n]);const S=ae.useCallback(O=>{var L;const{width:X}=O.container.getBoundingClientRect();if(!(X<50))try{O.fit.fit(),((L=O.ws)==null?void 0:L.readyState)===WebSocket.OPEN&&O.ws.send(JSON.stringify({type:"resize",cols:O.term.cols,rows:O.term.rows}))}catch{}},[]),y=ae.useCallback(O=>{for(const[X,L]of Di)L.container.style.display=X===O?"block":"none";if(O){const X=Di.get(O);X&&setTimeout(()=>S(X),50)}},[S]),b=ae.useCallback((O,X,L)=>{const re=window.location.protocol==="https:"?"wss:":"ws:",Z=new WebSocket(`${re}//${window.location.host}/ws/terminal?story=${encodeURIComponent(O)}&token=${e}&resume=${L}`);Z.onopen=()=>{X.connected=!0,X._retried=!1,g(le=>{const z=new Set(le);return z.delete(O),z}),Z.send(JSON.stringify({type:"resize",cols:X.term.cols,rows:X.term.rows}))},Z.onmessage=le=>{X.term.write(le.data)},Z.onclose=le=>{if(X.connected=!1,X.ws===Z){X.ws=null;try{const z=X.serialize.serialize();$o(O,z).catch(()=>{})}catch{}if(le.code===4e3&&!X._retried){X._retried=!0,X.term.write(`\r
99
99
  \x1B[33m[Resume failed — starting fresh session...]\x1B[0m\r
100
- `),g.current(A,N,!1);return}h(he=>new Set(he).add(A))}},N.term.onData(se=>{Q.readyState===WebSocket.OPEN&&Q.send(se)}),N.ws=Q},[e]);re.useEffect(()=>{g.current=v},[v]);const b=re.useCallback(async(A,N)=>{if(!a.current||Di.has(A))return;const{resume:$=!1,autoConnect:z=!0}=N??{},Q=document.createElement("div");Q.style.width="100%",Q.style.height="100%",Q.style.display="none",a.current.appendChild(Q);const se=new q2({cols:80,scrollback:5e3,fontSize:13,fontFamily:'"Geist Mono", ui-monospace, monospace',lineHeight:1.05,letterSpacing:0,cursorBlink:!0,cursorStyle:"block",theme:J2,allowTransparency:!1,drawBoldTextInBrightColors:!1,minimumContrastRatio:7}),he=new V2,j=new Z2;se.loadAddon(he),se.loadAddon(j),se.open(Q),se.element&&(se.element.style.paddingLeft="10px");const ne={term:se,fit:he,serialize:j,ws:null,container:Q,observer:null,connected:!1},Y=new ResizeObserver(()=>{var K;const{width:U}=Q.getBoundingClientRect();if(!(U<50))try{he.fit(),((K=ne.ws)==null?void 0:K.readyState)===WebSocket.OPEN&&ne.ws.send(JSON.stringify({type:"resize",cols:se.cols,rows:se.rows}))}catch{}});Y.observe(Q),ne.observer=Y,Di.set(A,ne),f(U=>[...U,A]);try{const U=await ik(A);U&&se.write(U)}catch{}z?v(A,ne,$):h(U=>new Set(U).add(A)),setTimeout(()=>m(ne),50)},[v,m]),k=re.useCallback(async(A,N)=>{const $=Di.get(A);$&&($.ws&&($.ws.close(),$.ws=null),N||(await o.current(`/api/terminal/${encodeURIComponent(A)}`,{method:"DELETE"}).catch(()=>{}),$.term.clear()),v(A,$,N))},[v]),B=re.useCallback(A=>{const N=Di.get(A);if(N){try{const $=N.serialize.serialize();$o(A,$).catch(()=>{})}catch{}N.observer.disconnect(),N.ws&&N.ws.close(),N.term.dispose(),N.container.remove(),Di.delete(A),f($=>$.filter(z=>z!==A)),h($=>{const z=new Set($);return z.delete(A),z}),n(`/api/terminal/${encodeURIComponent(A)}`,{method:"DELETE"}).catch(()=>{})}},[n]);re.useEffect(()=>{t&&(Di.has(t)?S(t):o.current(`/api/terminal/session/${encodeURIComponent(t)}`).then(A=>A.ok?A.json():null).then(A=>{if(!Di.has(t)){const N=(A==null?void 0:A.sessionId)&&!(A!=null&&A.running);b(t,{autoConnect:!N}),S(t)}}).catch(()=>{Di.has(t)||(b(t),S(t))}))},[t,b,S]),re.useEffect(()=>{const A=setInterval(()=>{for(const[N,$]of Di)if($.connected)try{const z=$.serialize.serialize();$o(N,z).catch(()=>{})}catch{}},3e4);return()=>clearInterval(A)},[]),re.useEffect(()=>()=>{for(const[A,N]of Di){try{const $=N.serialize.serialize();$o(A,$).catch(()=>{})}catch{}N.observer.disconnect(),N.ws&&N.ws.close(),N.term.dispose(),N.container.remove(),o.current(`/api/terminal/${encodeURIComponent(A)}`,{method:"DELETE"}).catch(()=>{})}Di.clear()},[]);const D=t?p.has(t):!1,G=c.length===0;return x.jsxs("div",{className:"h-full flex flex-col",children:[!G&&x.jsx("div",{className:"px-2 py-1 border-b border-border flex items-center gap-1 overflow-x-auto",children:c.map(A=>x.jsxs("div",{onClick:()=>s==null?void 0:s(A),className:`flex items-center gap-1 px-2 py-0.5 rounded text-xs font-mono cursor-pointer ${A===t?"bg-accent/10 text-accent":"text-muted hover:text-foreground"}`,children:[x.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${p.has(A)?"bg-amber-500":A===t?"bg-green-600":"bg-muted/50"}`}),x.jsx("span",{className:"truncate max-w-[120px]",children:A}),x.jsx("button",{onClick:N=>{N.stopPropagation(),B(A)},className:"ml-0.5 text-muted hover:text-error text-[10px] leading-none",title:"Close terminal",children:"×"})]},A))}),x.jsxs("div",{className:"relative flex-1 min-h-0",children:[x.jsx("div",{ref:a,className:"h-full"}),G&&x.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-muted",children:x.jsxs("div",{className:"text-center",children:[x.jsx("p",{className:"text-lg font-serif",children:"Select a story on the left menu"}),x.jsx("p",{className:"text-sm mt-1",children:"to start an AI Writer session"})]})}),D&&t&&x.jsx("div",{className:"absolute inset-0 flex items-center justify-center",style:{background:"rgba(240, 235, 225, 0.9)"},children:x.jsxs("div",{className:"text-center space-y-3",children:[x.jsx("p",{className:"text-sm font-serif text-foreground",children:"Terminal disconnected"}),x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx("button",{onClick:()=>k(t,!0),className:"px-4 py-1.5 bg-accent text-white text-sm rounded hover:bg-accent-dim",children:"Resume Session"}),x.jsx("button",{onClick:()=>k(t,!1),className:"px-4 py-1.5 border border-border text-sm rounded hover:bg-surface",children:"Start Fresh"})]}),x.jsx("p",{className:"text-xs text-muted",children:"Resume continues your previous Claude conversation"})]})})]})]})}function rk(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const sk=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,lk=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ak={};function Jv(e,t){return(ak.jsx?lk:sk).test(e)}const ok=/[ \t\n\f\r]/g;function uk(e){return typeof e=="object"?e.type==="text"?ey(e.value):!1:ey(e)}function ey(e){return e.replace(ok,"")===""}class Sa{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}}Sa.prototype.normal={};Sa.prototype.property={};Sa.prototype.space=void 0;function YS(e,t){const n={},s={};for(const a of e)Object.assign(n,a.property),Object.assign(s,a.normal);return new Sa(n,s,t)}function cd(e){return e.toLowerCase()}class gi{constructor(t,n){this.attribute=n,this.property=t}}gi.prototype.attribute="";gi.prototype.booleanish=!1;gi.prototype.boolean=!1;gi.prototype.commaOrSpaceSeparated=!1;gi.prototype.commaSeparated=!1;gi.prototype.defined=!1;gi.prototype.mustUseProperty=!1;gi.prototype.number=!1;gi.prototype.overloadedBoolean=!1;gi.prototype.property="";gi.prototype.spaceSeparated=!1;gi.prototype.space=void 0;let ck=0;const Ee=Xr(),yt=Xr(),hd=Xr(),le=Xr(),Je=Xr(),qs=Xr(),Ri=Xr();function Xr(){return 2**++ck}const fd=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ee,booleanish:yt,commaOrSpaceSeparated:Ri,commaSeparated:qs,number:le,overloadedBoolean:hd,spaceSeparated:Je},Symbol.toStringTag,{value:"Module"})),of=Object.keys(fd);class Bd extends gi{constructor(t,n,s,a){let o=-1;if(super(t,n),ty(this,"space",a),typeof s=="number")for(;++o<of.length;){const c=of[o];ty(this,of[o],(s&fd[c])===fd[c])}}}Bd.prototype.defined=!0;function ty(e,t,n){n&&(e[t]=n)}function $s(e){const t={},n={};for(const[s,a]of Object.entries(e.properties)){const o=new Bd(s,e.transform(e.attributes||{},s),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(o.mustUseProperty=!0),t[s]=o,n[cd(s)]=s,n[cd(o.attribute)]=s}return new Sa(t,n,e.space)}const VS=$s({properties:{ariaActiveDescendant:null,ariaAtomic:yt,ariaAutoComplete:null,ariaBusy:yt,ariaChecked:yt,ariaColCount:le,ariaColIndex:le,ariaColSpan:le,ariaControls:Je,ariaCurrent:null,ariaDescribedBy:Je,ariaDetails:null,ariaDisabled:yt,ariaDropEffect:Je,ariaErrorMessage:null,ariaExpanded:yt,ariaFlowTo:Je,ariaGrabbed:yt,ariaHasPopup:null,ariaHidden:yt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Je,ariaLevel:le,ariaLive:null,ariaModal:yt,ariaMultiLine:yt,ariaMultiSelectable:yt,ariaOrientation:null,ariaOwns:Je,ariaPlaceholder:null,ariaPosInSet:le,ariaPressed:yt,ariaReadOnly:yt,ariaRelevant:null,ariaRequired:yt,ariaRoleDescription:Je,ariaRowCount:le,ariaRowIndex:le,ariaRowSpan:le,ariaSelected:yt,ariaSetSize:le,ariaSort:null,ariaValueMax:le,ariaValueMin:le,ariaValueNow:le,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function KS(e,t){return t in e?e[t]:t}function XS(e,t){return KS(e,t.toLowerCase())}const hk=$s({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:qs,acceptCharset:Je,accessKey:Je,action:null,allow:null,allowFullScreen:Ee,allowPaymentRequest:Ee,allowUserMedia:Ee,alt:null,as:null,async:Ee,autoCapitalize:null,autoComplete:Je,autoFocus:Ee,autoPlay:Ee,blocking:Je,capture:null,charSet:null,checked:Ee,cite:null,className:Je,cols:le,colSpan:null,content:null,contentEditable:yt,controls:Ee,controlsList:Je,coords:le|qs,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ee,defer:Ee,dir:null,dirName:null,disabled:Ee,download:hd,draggable:yt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ee,formTarget:null,headers:Je,height:le,hidden:hd,high:le,href:null,hrefLang:null,htmlFor:Je,httpEquiv:Je,id:null,imageSizes:null,imageSrcSet:null,inert:Ee,inputMode:null,integrity:null,is:null,isMap:Ee,itemId:null,itemProp:Je,itemRef:Je,itemScope:Ee,itemType:Je,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ee,low:le,manifest:null,max:null,maxLength:le,media:null,method:null,min:null,minLength:le,multiple:Ee,muted:Ee,name:null,nonce:null,noModule:Ee,noValidate:Ee,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:Ee,optimum:le,pattern:null,ping:Je,placeholder:null,playsInline:Ee,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ee,referrerPolicy:null,rel:Je,required:Ee,reversed:Ee,rows:le,rowSpan:le,sandbox:Je,scope:null,scoped:Ee,seamless:Ee,selected:Ee,shadowRootClonable:Ee,shadowRootDelegatesFocus:Ee,shadowRootMode:null,shape:null,size:le,sizes:null,slot:null,span:le,spellCheck:yt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:le,step:null,style:null,tabIndex:le,target:null,title:null,translate:null,type:null,typeMustMatch:Ee,useMap:null,value:yt,width:le,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Je,axis:null,background:null,bgColor:null,border:le,borderColor:null,bottomMargin:le,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ee,declare:Ee,event:null,face:null,frame:null,frameBorder:null,hSpace:le,leftMargin:le,link:null,longDesc:null,lowSrc:null,marginHeight:le,marginWidth:le,noResize:Ee,noHref:Ee,noShade:Ee,noWrap:Ee,object:null,profile:null,prompt:null,rev:null,rightMargin:le,rules:null,scheme:null,scrolling:yt,standby:null,summary:null,text:null,topMargin:le,valueType:null,version:null,vAlign:null,vLink:null,vSpace:le,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ee,disableRemotePlayback:Ee,prefix:null,property:null,results:le,security:null,unselectable:null},space:"html",transform:XS}),fk=$s({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:Ri,accentHeight:le,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:le,amplitude:le,arabicForm:null,ascent:le,attributeName:null,attributeType:null,azimuth:le,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:le,by:null,calcMode:null,capHeight:le,className:Je,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:le,diffuseConstant:le,direction:null,display:null,dur:null,divisor:le,dominantBaseline:null,download:Ee,dx:null,dy:null,edgeMode:null,editable:null,elevation:le,enableBackground:null,end:null,event:null,exponent:le,externalResourcesRequired:null,fill:null,fillOpacity:le,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:qs,g2:qs,glyphName:qs,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:le,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:le,horizOriginX:le,horizOriginY:le,id:null,ideographic:le,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:le,k:le,k1:le,k2:le,k3:le,k4:le,kernelMatrix:Ri,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:le,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:le,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:le,overlineThickness:le,paintOrder:null,panose1:null,path:null,pathLength:le,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Je,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:le,pointsAtY:le,pointsAtZ:le,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ri,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ri,rev:Ri,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ri,requiredFeatures:Ri,requiredFonts:Ri,requiredFormats:Ri,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:le,specularExponent:le,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:le,strikethroughThickness:le,string:null,stroke:null,strokeDashArray:Ri,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:le,strokeOpacity:le,strokeWidth:null,style:null,surfaceScale:le,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ri,tabIndex:le,tableValues:null,target:null,targetX:le,targetY:le,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ri,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:le,underlineThickness:le,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:le,values:null,vAlphabetic:le,vMathematical:le,vectorEffect:null,vHanging:le,vIdeographic:le,version:null,vertAdvY:le,vertOriginX:le,vertOriginY:le,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:le,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:KS}),$S=$s({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()}}),GS=$s({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:XS}),ZS=$s({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),dk={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"},pk=/[A-Z]/g,iy=/-[a-z]/g,_k=/^data[-\w.:]+$/i;function mk(e,t){const n=cd(t);let s=t,a=gi;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&_k.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(iy,vk);s="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!iy.test(o)){let c=o.replace(pk,gk);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}a=Bd}return new a(s,t)}function gk(e){return"-"+e.toLowerCase()}function vk(e){return e.charAt(1).toUpperCase()}const yk=YS([VS,hk,$S,GS,ZS],"html"),Ld=YS([VS,fk,$S,GS,ZS],"svg");function Sk(e){return e.join(" ").trim()}var Us={},uf,ny;function bk(){if(ny)return uf;ny=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,f=/^\s+|\s+$/g,p=`
101
- `,h="/",g="*",m="",S="comment",v="declaration";function b(B,D){if(typeof B!="string")throw new TypeError("First argument must be a string");if(!B)return[];D=D||{};var G=1,A=1;function N(K){var H=K.match(t);H&&(G+=H.length);var M=K.lastIndexOf(p);A=~M?K.length-M:A+K.length}function $(){var K={line:G,column:A};return function(H){return H.position=new z(K),he(),H}}function z(K){this.start=K,this.end={line:G,column:A},this.source=D.source}z.prototype.content=B;function Q(K){var H=new Error(D.source+":"+G+":"+A+": "+K);if(H.reason=K,H.filename=D.source,H.line=G,H.column=A,H.source=B,!D.silent)throw H}function se(K){var H=K.exec(B);if(H){var M=H[0];return N(M),B=B.slice(M.length),H}}function he(){se(n)}function j(K){var H;for(K=K||[];H=ne();)H!==!1&&K.push(H);return K}function ne(){var K=$();if(!(h!=B.charAt(0)||g!=B.charAt(1))){for(var H=2;m!=B.charAt(H)&&(g!=B.charAt(H)||h!=B.charAt(H+1));)++H;if(H+=2,m===B.charAt(H-1))return Q("End of comment missing");var M=B.slice(2,H-2);return A+=2,N(M),B=B.slice(H),A+=2,K({type:S,comment:M})}}function Y(){var K=$(),H=se(s);if(H){if(ne(),!se(a))return Q("property missing ':'");var M=se(o),F=K({type:v,property:k(H[0].replace(e,m)),value:M?k(M[0].replace(e,m)):m});return se(c),F}}function U(){var K=[];j(K);for(var H;H=Y();)H!==!1&&(K.push(H),j(K));return K}return he(),U()}function k(B){return B?B.replace(f,m):m}return uf=b,uf}var ry;function xk(){if(ry)return Us;ry=1;var e=Us&&Us.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Us,"__esModule",{value:!0}),Us.default=n;const t=e(bk());function n(s,a){let o=null;if(!s||typeof s!="string")return o;const c=(0,t.default)(s),f=typeof a=="function";return c.forEach(p=>{if(p.type!=="declaration")return;const{property:h,value:g}=p;f?a(h,g,p):g&&(o=o||{},o[h]=g)}),o}return Us}var Zl={},sy;function wk(){if(sy)return Zl;sy=1,Object.defineProperty(Zl,"__esModule",{value:!0}),Zl.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(h){return!h||n.test(h)||e.test(h)},c=function(h,g){return g.toUpperCase()},f=function(h,g){return"".concat(g,"-")},p=function(h,g){return g===void 0&&(g={}),o(h)?h:(h=h.toLowerCase(),g.reactCompat?h=h.replace(a,f):h=h.replace(s,f),h.replace(t,c))};return Zl.camelCase=p,Zl}var Ql,ly;function Ck(){if(ly)return Ql;ly=1;var e=Ql&&Ql.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(xk()),n=wk();function s(a,o){var c={};return!a||typeof a!="string"||(0,t.default)(a,function(f,p){f&&p&&(c[(0,n.camelCase)(f,o)]=p)}),c}return s.default=s,Ql=s,Ql}var kk=Ck();const Ek=gu(kk),QS=JS("end"),zd=JS("start");function JS(e){return t;function t(n){const s=n&&n.position&&n.position[e]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function eb(e){const t=zd(e),n=QS(e);if(t&&n)return{start:t,end:n}}function aa(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?ay(e.position):"start"in e||"end"in e?ay(e):"line"in e||"column"in e?dd(e):""}function dd(e){return oy(e&&e.line)+":"+oy(e&&e.column)}function ay(e){return dd(e&&e.start)+"-"+dd(e&&e.end)}function oy(e){return e&&typeof e=="number"?e:1}class Gt extends Error{constructor(t,n,s){super(),typeof n=="string"&&(s=n,n=void 0);let a="",o={},c=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?a=t:!o.cause&&t&&(c=!0,a=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof s=="string"){const p=s.indexOf(":");p===-1?o.ruleId=s:(o.source=s.slice(0,p),o.ruleId=s.slice(p+1))}if(!o.place&&o.ancestors&&o.ancestors){const p=o.ancestors[o.ancestors.length-1];p&&(o.place=p.position)}const f=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=f?f.line:void 0,this.name=aa(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=c&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Gt.prototype.file="";Gt.prototype.name="";Gt.prototype.reason="";Gt.prototype.message="";Gt.prototype.stack="";Gt.prototype.column=void 0;Gt.prototype.line=void 0;Gt.prototype.ancestors=void 0;Gt.prototype.cause=void 0;Gt.prototype.fatal=void 0;Gt.prototype.place=void 0;Gt.prototype.ruleId=void 0;Gt.prototype.source=void 0;const Nd={}.hasOwnProperty,Tk=new Map,Ak=/[A-Z]/g,Dk=new Set(["table","tbody","thead","tfoot","tr"]),Rk=new Set(["td","th"]),tb="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Mk(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let s;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=Uk(n,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");s=jk(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:s,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Ld:yk,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=ib(a,e,void 0);return o&&typeof o!="string"?o:a.create(e,a.Fragment,{children:o||void 0},void 0)}function ib(e,t,n){if(t.type==="element")return Bk(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Lk(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Nk(e,t,n);if(t.type==="mdxjsEsm")return zk(e,t);if(t.type==="root")return Ok(e,t,n);if(t.type==="text")return Hk(e,t)}function Bk(e,t,n){const s=e.schema;let a=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(a=Ld,e.schema=a),e.ancestors.push(t);const o=rb(e,t.tagName,!1),c=Pk(e,t);let f=Hd(e,t);return Dk.has(t.tagName)&&(f=f.filter(function(p){return typeof p=="string"?!uk(p):!0})),nb(e,c,o,t),Od(c,f),e.ancestors.pop(),e.schema=s,e.create(t,o,c,n)}function Lk(e,t){if(t.data&&t.data.estree&&e.evaluater){const s=t.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}da(e,t.position)}function zk(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);da(e,t.position)}function Nk(e,t,n){const s=e.schema;let a=s;t.name==="svg"&&s.space==="html"&&(a=Ld,e.schema=a),e.ancestors.push(t);const o=t.name===null?e.Fragment:rb(e,t.name,!0),c=Ik(e,t),f=Hd(e,t);return nb(e,c,o,t),Od(c,f),e.ancestors.pop(),e.schema=s,e.create(t,o,c,n)}function Ok(e,t,n){const s={};return Od(s,Hd(e,t)),e.create(t,e.Fragment,s,n)}function Hk(e,t){return t.value}function nb(e,t,n,s){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=s)}function Od(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function jk(e,t,n){return s;function s(a,o,c,f){const h=Array.isArray(c.children)?n:t;return f?h(o,c,f):h(o,c)}}function Uk(e,t){return n;function n(s,a,o,c){const f=Array.isArray(o.children),p=zd(s);return t(a,o,c,f,{columnNumber:p?p.column-1:void 0,fileName:e,lineNumber:p?p.line:void 0},void 0)}}function Pk(e,t){const n={};let s,a;for(a in t.properties)if(a!=="children"&&Nd.call(t.properties,a)){const o=Fk(e,a,t.properties[a]);if(o){const[c,f]=o;e.tableCellAlignToStyle&&c==="align"&&typeof f=="string"&&Rk.has(t.tagName)?s=f:n[c]=f}}if(s){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return n}function Ik(e,t){const n={};for(const s of t.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const o=s.data.estree.body[0];o.type;const c=o.expression;c.type;const f=c.properties[0];f.type,Object.assign(n,e.evaluater.evaluateExpression(f.argument))}else da(e,t.position);else{const a=s.name;let o;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const f=s.value.data.estree.body[0];f.type,o=e.evaluater.evaluateExpression(f.expression)}else da(e,t.position);else o=s.value===null?!0:s.value;n[a]=o}return n}function Hd(e,t){const n=[];let s=-1;const a=e.passKeys?new Map:Tk;for(;++s<t.children.length;){const o=t.children[s];let c;if(e.passKeys){const p=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(p){const h=a.get(p)||0;c=p+"-"+h,a.set(p,h+1)}}const f=ib(e,o,c);f!==void 0&&n.push(f)}return n}function Fk(e,t,n){const s=mk(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=s.commaSeparated?rk(n):Sk(n)),s.property==="style"){let a=typeof n=="object"?n:qk(e,String(n));return e.stylePropertyNameCase==="css"&&(a=Wk(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&s.space?dk[s.property]||s.property:s.attribute,n]}}function qk(e,t){try{return Ek(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const s=n,a=new Gt("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=tb+"#cannot-parse-style-attribute",a}}function rb(e,t,n){let s;if(!n)s={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let o=-1,c;for(;++o<a.length;){const f=Jv(a[o])?{type:"Identifier",name:a[o]}:{type:"Literal",value:a[o]};c=c?{type:"MemberExpression",object:c,property:f,computed:!!(o&&f.type==="Literal"),optional:!1}:f}s=c}else s=Jv(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const a=s.value;return Nd.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(s);da(e)}function da(e,t){const n=new Gt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=tb+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Wk(e){const t={};let n;for(n in e)Nd.call(e,n)&&(t[Yk(n)]=e[n]);return t}function Yk(e){let t=e.replace(Ak,Vk);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function Vk(e){return"-"+e.toLowerCase()}const cf={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"]},Kk={};function jd(e,t){const n=Kk,s=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return sb(e,s,a)}function sb(e,t,n){if(Xk(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return uy(e.children,t,n)}return Array.isArray(e)?uy(e,t,n):""}function uy(e,t,n){const s=[];let a=-1;for(;++a<e.length;)s[a]=sb(e[a],t,n);return s.join("")}function Xk(e){return!!(e&&typeof e=="object")}const cy=document.createElement("i");function Ud(e){const t="&"+e+";";cy.innerHTML=t;const n=cy.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Mi(e,t,n,s){const a=e.length;let o=0,c;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,s.length<1e4)c=Array.from(s),c.unshift(t,n),e.splice(...c);else for(n&&e.splice(t,n);o<s.length;)c=s.slice(o,o+1e4),c.unshift(t,0),e.splice(...c),o+=1e4,t+=1e4}function Yi(e,t){return e.length>0?(Mi(e,e.length,0,t),e):t}const hy={}.hasOwnProperty;function lb(e){const t={};let n=-1;for(;++n<e.length;)$k(t,e[n]);return t}function $k(e,t){let n;for(n in t){const a=(hy.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let c;if(o)for(c in o){hy.call(a,c)||(a[c]=[]);const f=o[c];Gk(a[c],Array.isArray(f)?f:f?[f]:[])}}}function Gk(e,t){let n=-1;const s=[];for(;++n<t.length;)(t[n].add==="after"?e:s).push(t[n]);Mi(e,0,0,s)}function ab(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Qi(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ni=gr(/[A-Za-z]/),$t=gr(/[\dA-Za-z]/),Zk=gr(/[#-'*+\--9=?A-Z^-~]/);function pu(e){return e!==null&&(e<32||e===127)}const pd=gr(/\d/),Qk=gr(/[\dA-Fa-f]/),Jk=gr(/[!-/:-@[-`{-~]/);function ve(e){return e!==null&&e<-2}function Qe(e){return e!==null&&(e<0||e===32)}function Le(e){return e===-2||e===-1||e===32}const xu=gr(new RegExp("\\p{P}|\\p{S}","u")),Vr=gr(/\s/);function gr(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Gs(e){const t=[];let n=-1,s=0,a=0;for(;++n<e.length;){const o=e.charCodeAt(n);let c="";if(o===37&&$t(e.charCodeAt(n+1))&&$t(e.charCodeAt(n+2)))a=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(c=String.fromCharCode(o));else if(o>55295&&o<57344){const f=e.charCodeAt(n+1);o<56320&&f>56319&&f<57344?(c=String.fromCharCode(o,f),a=1):c="�"}else c=String.fromCharCode(o);c&&(t.push(e.slice(s,n),encodeURIComponent(c)),s=n+a+1,c=""),a&&(n+=a,a=0)}return t.join("")+e.slice(s)}function je(e,t,n,s){const a=s?s-1:Number.POSITIVE_INFINITY;let o=0;return c;function c(p){return Le(p)?(e.enter(n),f(p)):t(p)}function f(p){return Le(p)&&o++<a?(e.consume(p),f):(e.exit(n),t(p))}}const eE={tokenize:tE};function tE(e){const t=e.attempt(this.parser.constructs.contentInitial,s,a);let n;return t;function s(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),je(e,t,"linePrefix")}function a(f){return e.enter("paragraph"),o(f)}function o(f){const p=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=p),n=p,c(f)}function c(f){if(f===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(f);return}return ve(f)?(e.consume(f),e.exit("chunkText"),o):(e.consume(f),c)}}const iE={tokenize:nE},fy={tokenize:rE};function nE(e){const t=this,n=[];let s=0,a,o,c;return f;function f(A){if(s<n.length){const N=n[s];return t.containerState=N[1],e.attempt(N[0].continuation,p,h)(A)}return h(A)}function p(A){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&G();const N=t.events.length;let $=N,z;for(;$--;)if(t.events[$][0]==="exit"&&t.events[$][1].type==="chunkFlow"){z=t.events[$][1].end;break}D(s);let Q=N;for(;Q<t.events.length;)t.events[Q][1].end={...z},Q++;return Mi(t.events,$+1,0,t.events.slice(N)),t.events.length=Q,h(A)}return f(A)}function h(A){if(s===n.length){if(!a)return S(A);if(a.currentConstruct&&a.currentConstruct.concrete)return b(A);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(fy,g,m)(A)}function g(A){return a&&G(),D(s),S(A)}function m(A){return t.parser.lazy[t.now().line]=s!==n.length,c=t.now().offset,b(A)}function S(A){return t.containerState={},e.attempt(fy,v,b)(A)}function v(A){return s++,n.push([t.currentConstruct,t.containerState]),S(A)}function b(A){if(A===null){a&&G(),D(0),e.consume(A);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:o}),k(A)}function k(A){if(A===null){B(e.exit("chunkFlow"),!0),D(0),e.consume(A);return}return ve(A)?(e.consume(A),B(e.exit("chunkFlow")),s=0,t.interrupt=void 0,f):(e.consume(A),k)}function B(A,N){const $=t.sliceStream(A);if(N&&$.push(null),A.previous=o,o&&(o.next=A),o=A,a.defineSkip(A.start),a.write($),t.parser.lazy[A.start.line]){let z=a.events.length;for(;z--;)if(a.events[z][1].start.offset<c&&(!a.events[z][1].end||a.events[z][1].end.offset>c))return;const Q=t.events.length;let se=Q,he,j;for(;se--;)if(t.events[se][0]==="exit"&&t.events[se][1].type==="chunkFlow"){if(he){j=t.events[se][1].end;break}he=!0}for(D(s),z=Q;z<t.events.length;)t.events[z][1].end={...j},z++;Mi(t.events,se+1,0,t.events.slice(Q)),t.events.length=z}}function D(A){let N=n.length;for(;N-- >A;){const $=n[N];t.containerState=$[1],$[0].exit.call(t,e)}n.length=A}function G(){a.write([null]),o=void 0,a=void 0,t.containerState._closeFlow=void 0}}function rE(e,t,n){return je(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Vs(e){if(e===null||Qe(e)||Vr(e))return 1;if(xu(e))return 2}function wu(e,t,n){const s=[];let a=-1;for(;++a<e.length;){const o=e[a].resolveAll;o&&!s.includes(o)&&(t=o(t,n),s.push(o))}return t}const _d={name:"attention",resolveAll:sE,tokenize:lE};function sE(e,t){let n=-1,s,a,o,c,f,p,h,g;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(s=n;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&t.sliceSerialize(e[s][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[s][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;p=e[s][1].end.offset-e[s][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const m={...e[s][1].end},S={...e[n][1].start};dy(m,-p),dy(S,p),c={type:p>1?"strongSequence":"emphasisSequence",start:m,end:{...e[s][1].end}},f={type:p>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:S},o={type:p>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[n][1].start}},a={type:p>1?"strong":"emphasis",start:{...c.start},end:{...f.end}},e[s][1].end={...c.start},e[n][1].start={...f.end},h=[],e[s][1].end.offset-e[s][1].start.offset&&(h=Yi(h,[["enter",e[s][1],t],["exit",e[s][1],t]])),h=Yi(h,[["enter",a,t],["enter",c,t],["exit",c,t],["enter",o,t]]),h=Yi(h,wu(t.parser.constructs.insideSpan.null,e.slice(s+1,n),t)),h=Yi(h,[["exit",o,t],["enter",f,t],["exit",f,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(g=2,h=Yi(h,[["enter",e[n][1],t],["exit",e[n][1],t]])):g=0,Mi(e,s-1,n-s+3,h),n=s+h.length-g-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function lE(e,t){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,a=Vs(s);let o;return c;function c(p){return o=p,e.enter("attentionSequence"),f(p)}function f(p){if(p===o)return e.consume(p),f;const h=e.exit("attentionSequence"),g=Vs(p),m=!g||g===2&&a||n.includes(p),S=!a||a===2&&g||n.includes(s);return h._open=!!(o===42?m:m&&(a||!S)),h._close=!!(o===42?S:S&&(g||!m)),t(p)}}function dy(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const aE={name:"autolink",tokenize:oE};function oE(e,t,n){let s=0;return a;function a(v){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(v){return ni(v)?(e.consume(v),c):v===64?n(v):h(v)}function c(v){return v===43||v===45||v===46||$t(v)?(s=1,f(v)):h(v)}function f(v){return v===58?(e.consume(v),s=0,p):(v===43||v===45||v===46||$t(v))&&s++<32?(e.consume(v),f):(s=0,h(v))}function p(v){return v===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.exit("autolink"),t):v===null||v===32||v===60||pu(v)?n(v):(e.consume(v),p)}function h(v){return v===64?(e.consume(v),g):Zk(v)?(e.consume(v),h):n(v)}function g(v){return $t(v)?m(v):n(v)}function m(v){return v===46?(e.consume(v),s=0,g):v===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.exit("autolink"),t):S(v)}function S(v){if((v===45||$t(v))&&s++<63){const b=v===45?S:m;return e.consume(v),b}return n(v)}}const ba={partial:!0,tokenize:uE};function uE(e,t,n){return s;function s(o){return Le(o)?je(e,a,"linePrefix")(o):a(o)}function a(o){return o===null||ve(o)?t(o):n(o)}}const ob={continuation:{tokenize:hE},exit:fE,name:"blockQuote",tokenize:cE};function cE(e,t,n){const s=this;return a;function a(c){if(c===62){const f=s.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(c),e.exit("blockQuoteMarker"),o}return n(c)}function o(c){return Le(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(c))}}function hE(e,t,n){const s=this;return a;function a(c){return Le(c)?je(e,o,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):o(c)}function o(c){return e.attempt(ob,t,n)(c)}}function fE(e){e.exit("blockQuote")}const ub={name:"characterEscape",tokenize:dE};function dE(e,t,n){return s;function s(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),a}function a(o){return Jk(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const cb={name:"characterReference",tokenize:pE};function pE(e,t,n){const s=this;let a=0,o,c;return f;function f(m){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),p}function p(m){return m===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(m),e.exit("characterReferenceMarkerNumeric"),h):(e.enter("characterReferenceValue"),o=31,c=$t,g(m))}function h(m){return m===88||m===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(m),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,c=Qk,g):(e.enter("characterReferenceValue"),o=7,c=pd,g(m))}function g(m){if(m===59&&a){const S=e.exit("characterReferenceValue");return c===$t&&!Ud(s.sliceSerialize(S))?n(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return c(m)&&a++<o?(e.consume(m),g):n(m)}}const py={partial:!0,tokenize:mE},_y={concrete:!0,name:"codeFenced",tokenize:_E};function _E(e,t,n){const s=this,a={partial:!0,tokenize:$};let o=0,c=0,f;return p;function p(z){return h(z)}function h(z){const Q=s.events[s.events.length-1];return o=Q&&Q[1].type==="linePrefix"?Q[2].sliceSerialize(Q[1],!0).length:0,f=z,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(z)}function g(z){return z===f?(c++,e.consume(z),g):c<3?n(z):(e.exit("codeFencedFenceSequence"),Le(z)?je(e,m,"whitespace")(z):m(z))}function m(z){return z===null||ve(z)?(e.exit("codeFencedFence"),s.interrupt?t(z):e.check(py,k,N)(z)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),S(z))}function S(z){return z===null||ve(z)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(z)):Le(z)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),je(e,v,"whitespace")(z)):z===96&&z===f?n(z):(e.consume(z),S)}function v(z){return z===null||ve(z)?m(z):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),b(z))}function b(z){return z===null||ve(z)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(z)):z===96&&z===f?n(z):(e.consume(z),b)}function k(z){return e.attempt(a,N,B)(z)}function B(z){return e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),D}function D(z){return o>0&&Le(z)?je(e,G,"linePrefix",o+1)(z):G(z)}function G(z){return z===null||ve(z)?e.check(py,k,N)(z):(e.enter("codeFlowValue"),A(z))}function A(z){return z===null||ve(z)?(e.exit("codeFlowValue"),G(z)):(e.consume(z),A)}function N(z){return e.exit("codeFenced"),t(z)}function $(z,Q,se){let he=0;return j;function j(H){return z.enter("lineEnding"),z.consume(H),z.exit("lineEnding"),ne}function ne(H){return z.enter("codeFencedFence"),Le(H)?je(z,Y,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(H):Y(H)}function Y(H){return H===f?(z.enter("codeFencedFenceSequence"),U(H)):se(H)}function U(H){return H===f?(he++,z.consume(H),U):he>=c?(z.exit("codeFencedFenceSequence"),Le(H)?je(z,K,"whitespace")(H):K(H)):se(H)}function K(H){return H===null||ve(H)?(z.exit("codeFencedFence"),Q(H)):se(H)}}}function mE(e,t,n){const s=this;return a;function a(c){return c===null?n(c):(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),o)}function o(c){return s.parser.lazy[s.now().line]?n(c):t(c)}}const hf={name:"codeIndented",tokenize:vE},gE={partial:!0,tokenize:yE};function vE(e,t,n){const s=this;return a;function a(h){return e.enter("codeIndented"),je(e,o,"linePrefix",5)(h)}function o(h){const g=s.events[s.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?c(h):n(h)}function c(h){return h===null?p(h):ve(h)?e.attempt(gE,c,p)(h):(e.enter("codeFlowValue"),f(h))}function f(h){return h===null||ve(h)?(e.exit("codeFlowValue"),c(h)):(e.consume(h),f)}function p(h){return e.exit("codeIndented"),t(h)}}function yE(e,t,n){const s=this;return a;function a(c){return s.parser.lazy[s.now().line]?n(c):ve(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),a):je(e,o,"linePrefix",5)(c)}function o(c){const f=s.events[s.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(c):ve(c)?a(c):n(c)}}const SE={name:"codeText",previous:xE,resolve:bE,tokenize:wE};function bE(e){let t=e.length-4,n=3,s,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(s=n;++s<t;)if(e[s][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(s=n-1,t++;++s<=t;)a===void 0?s!==t&&e[s][1].type!=="lineEnding"&&(a=s):(s===t||e[s][1].type==="lineEnding")&&(e[a][1].type="codeTextData",s!==a+2&&(e[a][1].end=e[s-1][1].end,e.splice(a+2,s-a-2),t-=s-a-2,s=a+2),a=void 0);return e}function xE(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function wE(e,t,n){let s=0,a,o;return c;function c(m){return e.enter("codeText"),e.enter("codeTextSequence"),f(m)}function f(m){return m===96?(e.consume(m),s++,f):(e.exit("codeTextSequence"),p(m))}function p(m){return m===null?n(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),p):m===96?(o=e.enter("codeTextSequence"),a=0,g(m)):ve(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),p):(e.enter("codeTextData"),h(m))}function h(m){return m===null||m===32||m===96||ve(m)?(e.exit("codeTextData"),p(m)):(e.consume(m),h)}function g(m){return m===96?(e.consume(m),a++,g):a===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(m)):(o.type="codeTextData",h(m))}}class CE{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,n){const s=n??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(t,s):t>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(t,n,s){const a=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return s&&Jl(this.left,s),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Jl(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Jl(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 n=this.left.splice(t,Number.POSITIVE_INFINITY);Jl(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Jl(this.left,n.reverse())}}}function Jl(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function hb(e){const t={};let n=-1,s,a,o,c,f,p,h;const g=new CE(e);for(;++n<g.length;){for(;n in t;)n=t[n];if(s=g.get(n),n&&s[1].type==="chunkFlow"&&g.get(n-1)[1].type==="listItemPrefix"&&(p=s[1]._tokenizer.events,o=0,o<p.length&&p[o][1].type==="lineEndingBlank"&&(o+=2),o<p.length&&p[o][1].type==="content"))for(;++o<p.length&&p[o][1].type!=="content";)p[o][1].type==="chunkText"&&(p[o][1]._isInFirstContentOfListItem=!0,o++);if(s[0]==="enter")s[1].contentType&&(Object.assign(t,kE(g,n)),n=t[n],h=!0);else if(s[1]._container){for(o=n,a=void 0;o--;)if(c=g.get(o),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(a&&(g.get(a)[1].type="lineEndingBlank"),c[1].type="lineEnding",a=o);else if(!(c[1].type==="linePrefix"||c[1].type==="listItemIndent"))break;a&&(s[1].end={...g.get(a)[1].start},f=g.slice(a,n),f.unshift(s),g.splice(a,n-a+1,f))}}return Mi(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!h}function kE(e,t){const n=e.get(t)[1],s=e.get(t)[2];let a=t-1;const o=[];let c=n._tokenizer;c||(c=s.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const f=c.events,p=[],h={};let g,m,S=-1,v=n,b=0,k=0;const B=[k];for(;v;){for(;e.get(++a)[1]!==v;);o.push(a),v._tokenizer||(g=s.sliceStream(v),v.next||g.push(null),m&&c.defineSkip(v.start),v._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(g),v._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),m=v,v=v.next}for(v=n;++S<f.length;)f[S][0]==="exit"&&f[S-1][0]==="enter"&&f[S][1].type===f[S-1][1].type&&f[S][1].start.line!==f[S][1].end.line&&(k=S+1,B.push(k),v._tokenizer=void 0,v.previous=void 0,v=v.next);for(c.events=[],v?(v._tokenizer=void 0,v.previous=void 0):B.pop(),S=B.length;S--;){const D=f.slice(B[S],B[S+1]),G=o.pop();p.push([G,G+D.length-1]),e.splice(G,2,D)}for(p.reverse(),S=-1;++S<p.length;)h[b+p[S][0]]=b+p[S][1],b+=p[S][1]-p[S][0]-1;return h}const EE={resolve:AE,tokenize:DE},TE={partial:!0,tokenize:RE};function AE(e){return hb(e),e}function DE(e,t){let n;return s;function s(f){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(f)}function a(f){return f===null?o(f):ve(f)?e.check(TE,c,o)(f):(e.consume(f),a)}function o(f){return e.exit("chunkContent"),e.exit("content"),t(f)}function c(f){return e.consume(f),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function RE(e,t,n){const s=this;return a;function a(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),je(e,o,"linePrefix")}function o(c){if(c===null||ve(c))return n(c);const f=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(c):e.interrupt(s.parser.constructs.flow,n,t)(c)}}function fb(e,t,n,s,a,o,c,f,p){const h=p||Number.POSITIVE_INFINITY;let g=0;return m;function m(D){return D===60?(e.enter(s),e.enter(a),e.enter(o),e.consume(D),e.exit(o),S):D===null||D===32||D===41||pu(D)?n(D):(e.enter(s),e.enter(c),e.enter(f),e.enter("chunkString",{contentType:"string"}),k(D))}function S(D){return D===62?(e.enter(o),e.consume(D),e.exit(o),e.exit(a),e.exit(s),t):(e.enter(f),e.enter("chunkString",{contentType:"string"}),v(D))}function v(D){return D===62?(e.exit("chunkString"),e.exit(f),S(D)):D===null||D===60||ve(D)?n(D):(e.consume(D),D===92?b:v)}function b(D){return D===60||D===62||D===92?(e.consume(D),v):v(D)}function k(D){return!g&&(D===null||D===41||Qe(D))?(e.exit("chunkString"),e.exit(f),e.exit(c),e.exit(s),t(D)):g<h&&D===40?(e.consume(D),g++,k):D===41?(e.consume(D),g--,k):D===null||D===32||D===40||pu(D)?n(D):(e.consume(D),D===92?B:k)}function B(D){return D===40||D===41||D===92?(e.consume(D),k):k(D)}}function db(e,t,n,s,a,o){const c=this;let f=0,p;return h;function h(v){return e.enter(s),e.enter(a),e.consume(v),e.exit(a),e.enter(o),g}function g(v){return f>999||v===null||v===91||v===93&&!p||v===94&&!f&&"_hiddenFootnoteSupport"in c.parser.constructs?n(v):v===93?(e.exit(o),e.enter(a),e.consume(v),e.exit(a),e.exit(s),t):ve(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),m(v))}function m(v){return v===null||v===91||v===93||ve(v)||f++>999?(e.exit("chunkString"),g(v)):(e.consume(v),p||(p=!Le(v)),v===92?S:m)}function S(v){return v===91||v===92||v===93?(e.consume(v),f++,m):m(v)}}function pb(e,t,n,s,a,o){let c;return f;function f(S){return S===34||S===39||S===40?(e.enter(s),e.enter(a),e.consume(S),e.exit(a),c=S===40?41:S,p):n(S)}function p(S){return S===c?(e.enter(a),e.consume(S),e.exit(a),e.exit(s),t):(e.enter(o),h(S))}function h(S){return S===c?(e.exit(o),p(c)):S===null?n(S):ve(S)?(e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),je(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(S))}function g(S){return S===c||S===null||ve(S)?(e.exit("chunkString"),h(S)):(e.consume(S),S===92?m:g)}function m(S){return S===c||S===92?(e.consume(S),g):g(S)}}function oa(e,t){let n;return s;function s(a){return ve(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,s):Le(a)?je(e,s,n?"linePrefix":"lineSuffix")(a):t(a)}}const ME={name:"definition",tokenize:LE},BE={partial:!0,tokenize:zE};function LE(e,t,n){const s=this;let a;return o;function o(v){return e.enter("definition"),c(v)}function c(v){return db.call(s,e,f,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function f(v){return a=Qi(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),v===58?(e.enter("definitionMarker"),e.consume(v),e.exit("definitionMarker"),p):n(v)}function p(v){return Qe(v)?oa(e,h)(v):h(v)}function h(v){return fb(e,g,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function g(v){return e.attempt(BE,m,m)(v)}function m(v){return Le(v)?je(e,S,"whitespace")(v):S(v)}function S(v){return v===null||ve(v)?(e.exit("definition"),s.parser.defined.push(a),t(v)):n(v)}}function zE(e,t,n){return s;function s(f){return Qe(f)?oa(e,a)(f):n(f)}function a(f){return pb(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function o(f){return Le(f)?je(e,c,"whitespace")(f):c(f)}function c(f){return f===null||ve(f)?t(f):n(f)}}const NE={name:"hardBreakEscape",tokenize:OE};function OE(e,t,n){return s;function s(o){return e.enter("hardBreakEscape"),e.consume(o),a}function a(o){return ve(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const HE={name:"headingAtx",resolve:jE,tokenize:UE};function jE(e,t){let n=e.length-2,s=3,a,o;return e[s][1].type==="whitespace"&&(s+=2),n-2>s&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(s===n-1||n-4>s&&e[n-2][1].type==="whitespace")&&(n-=s+1===n?2:4),n>s&&(a={type:"atxHeadingText",start:e[s][1].start,end:e[n][1].end},o={type:"chunkText",start:e[s][1].start,end:e[n][1].end,contentType:"text"},Mi(e,s,n-s+1,[["enter",a,t],["enter",o,t],["exit",o,t],["exit",a,t]])),e}function UE(e,t,n){let s=0;return a;function a(g){return e.enter("atxHeading"),o(g)}function o(g){return e.enter("atxHeadingSequence"),c(g)}function c(g){return g===35&&s++<6?(e.consume(g),c):g===null||Qe(g)?(e.exit("atxHeadingSequence"),f(g)):n(g)}function f(g){return g===35?(e.enter("atxHeadingSequence"),p(g)):g===null||ve(g)?(e.exit("atxHeading"),t(g)):Le(g)?je(e,f,"whitespace")(g):(e.enter("atxHeadingText"),h(g))}function p(g){return g===35?(e.consume(g),p):(e.exit("atxHeadingSequence"),f(g))}function h(g){return g===null||g===35||Qe(g)?(e.exit("atxHeadingText"),f(g)):(e.consume(g),h)}}const PE=["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"],my=["pre","script","style","textarea"],IE={concrete:!0,name:"htmlFlow",resolveTo:WE,tokenize:YE},FE={partial:!0,tokenize:KE},qE={partial:!0,tokenize:VE};function WE(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 YE(e,t,n){const s=this;let a,o,c,f,p;return h;function h(C){return g(C)}function g(C){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(C),m}function m(C){return C===33?(e.consume(C),S):C===47?(e.consume(C),o=!0,k):C===63?(e.consume(C),a=3,s.interrupt?t:E):ni(C)?(e.consume(C),c=String.fromCharCode(C),B):n(C)}function S(C){return C===45?(e.consume(C),a=2,v):C===91?(e.consume(C),a=5,f=0,b):ni(C)?(e.consume(C),a=4,s.interrupt?t:E):n(C)}function v(C){return C===45?(e.consume(C),s.interrupt?t:E):n(C)}function b(C){const ae="CDATA[";return C===ae.charCodeAt(f++)?(e.consume(C),f===ae.length?s.interrupt?t:Y:b):n(C)}function k(C){return ni(C)?(e.consume(C),c=String.fromCharCode(C),B):n(C)}function B(C){if(C===null||C===47||C===62||Qe(C)){const ae=C===47,_e=c.toLowerCase();return!ae&&!o&&my.includes(_e)?(a=1,s.interrupt?t(C):Y(C)):PE.includes(c.toLowerCase())?(a=6,ae?(e.consume(C),D):s.interrupt?t(C):Y(C)):(a=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(C):o?G(C):A(C))}return C===45||$t(C)?(e.consume(C),c+=String.fromCharCode(C),B):n(C)}function D(C){return C===62?(e.consume(C),s.interrupt?t:Y):n(C)}function G(C){return Le(C)?(e.consume(C),G):j(C)}function A(C){return C===47?(e.consume(C),j):C===58||C===95||ni(C)?(e.consume(C),N):Le(C)?(e.consume(C),A):j(C)}function N(C){return C===45||C===46||C===58||C===95||$t(C)?(e.consume(C),N):$(C)}function $(C){return C===61?(e.consume(C),z):Le(C)?(e.consume(C),$):A(C)}function z(C){return C===null||C===60||C===61||C===62||C===96?n(C):C===34||C===39?(e.consume(C),p=C,Q):Le(C)?(e.consume(C),z):se(C)}function Q(C){return C===p?(e.consume(C),p=null,he):C===null||ve(C)?n(C):(e.consume(C),Q)}function se(C){return C===null||C===34||C===39||C===47||C===60||C===61||C===62||C===96||Qe(C)?$(C):(e.consume(C),se)}function he(C){return C===47||C===62||Le(C)?A(C):n(C)}function j(C){return C===62?(e.consume(C),ne):n(C)}function ne(C){return C===null||ve(C)?Y(C):Le(C)?(e.consume(C),ne):n(C)}function Y(C){return C===45&&a===2?(e.consume(C),M):C===60&&a===1?(e.consume(C),F):C===62&&a===4?(e.consume(C),T):C===63&&a===3?(e.consume(C),E):C===93&&a===5?(e.consume(C),oe):ve(C)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(FE,q,U)(C)):C===null||ve(C)?(e.exit("htmlFlowData"),U(C)):(e.consume(C),Y)}function U(C){return e.check(qE,K,q)(C)}function K(C){return e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),H}function H(C){return C===null||ve(C)?U(C):(e.enter("htmlFlowData"),Y(C))}function M(C){return C===45?(e.consume(C),E):Y(C)}function F(C){return C===47?(e.consume(C),c="",V):Y(C)}function V(C){if(C===62){const ae=c.toLowerCase();return my.includes(ae)?(e.consume(C),T):Y(C)}return ni(C)&&c.length<8?(e.consume(C),c+=String.fromCharCode(C),V):Y(C)}function oe(C){return C===93?(e.consume(C),E):Y(C)}function E(C){return C===62?(e.consume(C),T):C===45&&a===2?(e.consume(C),E):Y(C)}function T(C){return C===null||ve(C)?(e.exit("htmlFlowData"),q(C)):(e.consume(C),T)}function q(C){return e.exit("htmlFlow"),t(C)}}function VE(e,t,n){const s=this;return a;function a(c){return ve(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),o):n(c)}function o(c){return s.parser.lazy[s.now().line]?n(c):t(c)}}function KE(e,t,n){return s;function s(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(ba,t,n)}}const XE={name:"htmlText",tokenize:$E};function $E(e,t,n){const s=this;let a,o,c;return f;function f(E){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(E),p}function p(E){return E===33?(e.consume(E),h):E===47?(e.consume(E),$):E===63?(e.consume(E),A):ni(E)?(e.consume(E),se):n(E)}function h(E){return E===45?(e.consume(E),g):E===91?(e.consume(E),o=0,b):ni(E)?(e.consume(E),G):n(E)}function g(E){return E===45?(e.consume(E),v):n(E)}function m(E){return E===null?n(E):E===45?(e.consume(E),S):ve(E)?(c=m,F(E)):(e.consume(E),m)}function S(E){return E===45?(e.consume(E),v):m(E)}function v(E){return E===62?M(E):E===45?S(E):m(E)}function b(E){const T="CDATA[";return E===T.charCodeAt(o++)?(e.consume(E),o===T.length?k:b):n(E)}function k(E){return E===null?n(E):E===93?(e.consume(E),B):ve(E)?(c=k,F(E)):(e.consume(E),k)}function B(E){return E===93?(e.consume(E),D):k(E)}function D(E){return E===62?M(E):E===93?(e.consume(E),D):k(E)}function G(E){return E===null||E===62?M(E):ve(E)?(c=G,F(E)):(e.consume(E),G)}function A(E){return E===null?n(E):E===63?(e.consume(E),N):ve(E)?(c=A,F(E)):(e.consume(E),A)}function N(E){return E===62?M(E):A(E)}function $(E){return ni(E)?(e.consume(E),z):n(E)}function z(E){return E===45||$t(E)?(e.consume(E),z):Q(E)}function Q(E){return ve(E)?(c=Q,F(E)):Le(E)?(e.consume(E),Q):M(E)}function se(E){return E===45||$t(E)?(e.consume(E),se):E===47||E===62||Qe(E)?he(E):n(E)}function he(E){return E===47?(e.consume(E),M):E===58||E===95||ni(E)?(e.consume(E),j):ve(E)?(c=he,F(E)):Le(E)?(e.consume(E),he):M(E)}function j(E){return E===45||E===46||E===58||E===95||$t(E)?(e.consume(E),j):ne(E)}function ne(E){return E===61?(e.consume(E),Y):ve(E)?(c=ne,F(E)):Le(E)?(e.consume(E),ne):he(E)}function Y(E){return E===null||E===60||E===61||E===62||E===96?n(E):E===34||E===39?(e.consume(E),a=E,U):ve(E)?(c=Y,F(E)):Le(E)?(e.consume(E),Y):(e.consume(E),K)}function U(E){return E===a?(e.consume(E),a=void 0,H):E===null?n(E):ve(E)?(c=U,F(E)):(e.consume(E),U)}function K(E){return E===null||E===34||E===39||E===60||E===61||E===96?n(E):E===47||E===62||Qe(E)?he(E):(e.consume(E),K)}function H(E){return E===47||E===62||Qe(E)?he(E):n(E)}function M(E){return E===62?(e.consume(E),e.exit("htmlTextData"),e.exit("htmlText"),t):n(E)}function F(E){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),V}function V(E){return Le(E)?je(e,oe,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):oe(E)}function oe(E){return e.enter("htmlTextData"),c(E)}}const Pd={name:"labelEnd",resolveAll:JE,resolveTo:e5,tokenize:t5},GE={tokenize:i5},ZE={tokenize:n5},QE={tokenize:r5};function JE(e){let t=-1;const n=[];for(;++t<e.length;){const s=e[t][1];if(n.push(e[t]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const a=s.type==="labelImage"?4:2;s.type="data",t+=a}}return e.length!==n.length&&Mi(e,0,e.length,n),e}function e5(e,t){let n=e.length,s=0,a,o,c,f;for(;n--;)if(a=e[n][1],o){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(c){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(o=n,a.type!=="labelLink")){s=2;break}}else a.type==="labelEnd"&&(c=n);const p={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},h={type:"label",start:{...e[o][1].start},end:{...e[c][1].end}},g={type:"labelText",start:{...e[o+s+2][1].end},end:{...e[c-2][1].start}};return f=[["enter",p,t],["enter",h,t]],f=Yi(f,e.slice(o+1,o+s+3)),f=Yi(f,[["enter",g,t]]),f=Yi(f,wu(t.parser.constructs.insideSpan.null,e.slice(o+s+4,c-3),t)),f=Yi(f,[["exit",g,t],e[c-2],e[c-1],["exit",h,t]]),f=Yi(f,e.slice(c+1)),f=Yi(f,[["exit",p,t]]),Mi(e,o,e.length,f),e}function t5(e,t,n){const s=this;let a=s.events.length,o,c;for(;a--;)if((s.events[a][1].type==="labelImage"||s.events[a][1].type==="labelLink")&&!s.events[a][1]._balanced){o=s.events[a][1];break}return f;function f(S){return o?o._inactive?m(S):(c=s.parser.defined.includes(Qi(s.sliceSerialize({start:o.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(S),e.exit("labelMarker"),e.exit("labelEnd"),p):n(S)}function p(S){return S===40?e.attempt(GE,g,c?g:m)(S):S===91?e.attempt(ZE,g,c?h:m)(S):c?g(S):m(S)}function h(S){return e.attempt(QE,g,m)(S)}function g(S){return t(S)}function m(S){return o._balanced=!0,n(S)}}function i5(e,t,n){return s;function s(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),a}function a(m){return Qe(m)?oa(e,o)(m):o(m)}function o(m){return m===41?g(m):fb(e,c,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function c(m){return Qe(m)?oa(e,p)(m):g(m)}function f(m){return n(m)}function p(m){return m===34||m===39||m===40?pb(e,h,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):g(m)}function h(m){return Qe(m)?oa(e,g)(m):g(m)}function g(m){return m===41?(e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),e.exit("resource"),t):n(m)}}function n5(e,t,n){const s=this;return a;function a(f){return db.call(s,e,o,c,"reference","referenceMarker","referenceString")(f)}function o(f){return s.parser.defined.includes(Qi(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(f):n(f)}function c(f){return n(f)}}function r5(e,t,n){return s;function s(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),a}function a(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const s5={name:"labelStartImage",resolveAll:Pd.resolveAll,tokenize:l5};function l5(e,t,n){const s=this;return a;function a(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),o}function o(f){return f===91?(e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelImage"),c):n(f)}function c(f){return f===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(f):t(f)}}const a5={name:"labelStartLink",resolveAll:Pd.resolveAll,tokenize:o5};function o5(e,t,n){const s=this;return a;function a(c){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelLink"),o}function o(c){return c===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(c):t(c)}}const ff={name:"lineEnding",tokenize:u5};function u5(e,t){return n;function n(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),je(e,t,"linePrefix")}}const au={name:"thematicBreak",tokenize:c5};function c5(e,t,n){let s=0,a;return o;function o(h){return e.enter("thematicBreak"),c(h)}function c(h){return a=h,f(h)}function f(h){return h===a?(e.enter("thematicBreakSequence"),p(h)):s>=3&&(h===null||ve(h))?(e.exit("thematicBreak"),t(h)):n(h)}function p(h){return h===a?(e.consume(h),s++,p):(e.exit("thematicBreakSequence"),Le(h)?je(e,f,"whitespace")(h):f(h))}}const mi={continuation:{tokenize:p5},exit:m5,name:"list",tokenize:d5},h5={partial:!0,tokenize:g5},f5={partial:!0,tokenize:_5};function d5(e,t,n){const s=this,a=s.events[s.events.length-1];let o=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,c=0;return f;function f(v){const b=s.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(b==="listUnordered"?!s.containerState.marker||v===s.containerState.marker:pd(v)){if(s.containerState.type||(s.containerState.type=b,e.enter(b,{_container:!0})),b==="listUnordered")return e.enter("listItemPrefix"),v===42||v===45?e.check(au,n,h)(v):h(v);if(!s.interrupt||v===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),p(v)}return n(v)}function p(v){return pd(v)&&++c<10?(e.consume(v),p):(!s.interrupt||c<2)&&(s.containerState.marker?v===s.containerState.marker:v===41||v===46)?(e.exit("listItemValue"),h(v)):n(v)}function h(v){return e.enter("listItemMarker"),e.consume(v),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||v,e.check(ba,s.interrupt?n:g,e.attempt(h5,S,m))}function g(v){return s.containerState.initialBlankLine=!0,o++,S(v)}function m(v){return Le(v)?(e.enter("listItemPrefixWhitespace"),e.consume(v),e.exit("listItemPrefixWhitespace"),S):n(v)}function S(v){return s.containerState.size=o+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(v)}}function p5(e,t,n){const s=this;return s.containerState._closeFlow=void 0,e.check(ba,a,o);function a(f){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,je(e,t,"listItemIndent",s.containerState.size+1)(f)}function o(f){return s.containerState.furtherBlankLines||!Le(f)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,c(f)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(f5,t,c)(f))}function c(f){return s.containerState._closeFlow=!0,s.interrupt=void 0,je(e,e.attempt(mi,t,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function _5(e,t,n){const s=this;return je(e,a,"listItemIndent",s.containerState.size+1);function a(o){const c=s.events[s.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===s.containerState.size?t(o):n(o)}}function m5(e){e.exit(this.containerState.type)}function g5(e,t,n){const s=this;return je(e,a,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(o){const c=s.events[s.events.length-1];return!Le(o)&&c&&c[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const gy={name:"setextUnderline",resolveTo:v5,tokenize:y5};function v5(e,t){let n=e.length,s,a,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){s=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const c={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",o?(e.splice(a,0,["enter",c,t]),e.splice(o+1,0,["exit",e[s][1],t]),e[s][1].end={...e[o][1].end}):e[s][1]=c,e.push(["exit",c,t]),e}function y5(e,t,n){const s=this;let a;return o;function o(h){let g=s.events.length,m;for(;g--;)if(s.events[g][1].type!=="lineEnding"&&s.events[g][1].type!=="linePrefix"&&s.events[g][1].type!=="content"){m=s.events[g][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||m)?(e.enter("setextHeadingLine"),a=h,c(h)):n(h)}function c(h){return e.enter("setextHeadingLineSequence"),f(h)}function f(h){return h===a?(e.consume(h),f):(e.exit("setextHeadingLineSequence"),Le(h)?je(e,p,"lineSuffix")(h):p(h))}function p(h){return h===null||ve(h)?(e.exit("setextHeadingLine"),t(h)):n(h)}}const S5={tokenize:b5};function b5(e){const t=this,n=e.attempt(ba,s,e.attempt(this.parser.constructs.flowInitial,a,je(e,e.attempt(this.parser.constructs.flow,a,e.attempt(EE,a)),"linePrefix")));return n;function s(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const x5={resolveAll:mb()},w5=_b("string"),C5=_b("text");function _b(e){return{resolveAll:mb(e==="text"?k5:void 0),tokenize:t};function t(n){const s=this,a=this.parser.constructs[e],o=n.attempt(a,c,f);return c;function c(g){return h(g)?o(g):f(g)}function f(g){if(g===null){n.consume(g);return}return n.enter("data"),n.consume(g),p}function p(g){return h(g)?(n.exit("data"),o(g)):(n.consume(g),p)}function h(g){if(g===null)return!0;const m=a[g];let S=-1;if(m)for(;++S<m.length;){const v=m[S];if(!v.previous||v.previous.call(s,s.previous))return!0}return!1}}}function mb(e){return t;function t(n,s){let a=-1,o;for(;++a<=n.length;)o===void 0?n[a]&&n[a][1].type==="data"&&(o=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==o+2&&(n[o][1].end=n[a-1][1].end,n.splice(o+2,a-o-2),a=o+2),o=void 0);return e?e(n,s):n}}function k5(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const s=e[n-1][1],a=t.sliceStream(s);let o=a.length,c=-1,f=0,p;for(;o--;){const h=a[o];if(typeof h=="string"){for(c=h.length;h.charCodeAt(c-1)===32;)f++,c--;if(c)break;c=-1}else if(h===-2)p=!0,f++;else if(h!==-1){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(f=0),f){const h={type:n===e.length||p||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?c:s.start._bufferIndex+c,_index:s.start._index+o,line:s.end.line,column:s.end.column-f,offset:s.end.offset-f},end:{...s.end}};s.end={...h.start},s.start.offset===s.end.offset?Object.assign(s,h):(e.splice(n,0,["enter",h,t],["exit",h,t]),n+=2)}n++}return e}const E5={42:mi,43:mi,45:mi,48:mi,49:mi,50:mi,51:mi,52:mi,53:mi,54:mi,55:mi,56:mi,57:mi,62:ob},T5={91:ME},A5={[-2]:hf,[-1]:hf,32:hf},D5={35:HE,42:au,45:[gy,au],60:IE,61:gy,95:au,96:_y,126:_y},R5={38:cb,92:ub},M5={[-5]:ff,[-4]:ff,[-3]:ff,33:s5,38:cb,42:_d,60:[aE,XE],91:a5,92:[NE,ub],93:Pd,95:_d,96:SE},B5={null:[_d,x5]},L5={null:[42,95]},z5={null:[]},N5=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:L5,contentInitial:T5,disable:z5,document:E5,flow:D5,flowInitial:A5,insideSpan:B5,string:R5,text:M5},Symbol.toStringTag,{value:"Module"}));function O5(e,t,n){let s={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},o=[];let c=[],f=[];const p={attempt:Q($),check:Q(z),consume:G,enter:A,exit:N,interrupt:Q(z,{interrupt:!0})},h={code:null,containerState:{},defineSkip:k,events:[],now:b,parser:e,previous:null,sliceSerialize:S,sliceStream:v,write:m};let g=t.tokenize.call(h,p);return t.resolveAll&&o.push(t),h;function m(ne){return c=Yi(c,ne),B(),c[c.length-1]!==null?[]:(se(t,0),h.events=wu(o,h.events,h),h.events)}function S(ne,Y){return j5(v(ne),Y)}function v(ne){return H5(c,ne)}function b(){const{_bufferIndex:ne,_index:Y,line:U,column:K,offset:H}=s;return{_bufferIndex:ne,_index:Y,line:U,column:K,offset:H}}function k(ne){a[ne.line]=ne.column,j()}function B(){let ne;for(;s._index<c.length;){const Y=c[s._index];if(typeof Y=="string")for(ne=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===ne&&s._bufferIndex<Y.length;)D(Y.charCodeAt(s._bufferIndex));else D(Y)}}function D(ne){g=g(ne)}function G(ne){ve(ne)?(s.line++,s.column=1,s.offset+=ne===-3?2:1,j()):ne!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===c[s._index].length&&(s._bufferIndex=-1,s._index++)),h.previous=ne}function A(ne,Y){const U=Y||{};return U.type=ne,U.start=b(),h.events.push(["enter",U,h]),f.push(U),U}function N(ne){const Y=f.pop();return Y.end=b(),h.events.push(["exit",Y,h]),Y}function $(ne,Y){se(ne,Y.from)}function z(ne,Y){Y.restore()}function Q(ne,Y){return U;function U(K,H,M){let F,V,oe,E;return Array.isArray(K)?q(K):"tokenize"in K?q([K]):T(K);function T(de){return xe;function xe(Ye){const De=Ye!==null&&de[Ye],Ht=Ye!==null&&de.null,Zt=[...Array.isArray(De)?De:De?[De]:[],...Array.isArray(Ht)?Ht:Ht?[Ht]:[]];return q(Zt)(Ye)}}function q(de){return F=de,V=0,de.length===0?M:C(de[V])}function C(de){return xe;function xe(Ye){return E=he(),oe=de,de.partial||(h.currentConstruct=de),de.name&&h.parser.constructs.disable.null.includes(de.name)?_e():de.tokenize.call(Y?Object.assign(Object.create(h),Y):h,p,ae,_e)(Ye)}}function ae(de){return ne(oe,E),H}function _e(de){return E.restore(),++V<F.length?C(F[V]):M}}}function se(ne,Y){ne.resolveAll&&!o.includes(ne)&&o.push(ne),ne.resolve&&Mi(h.events,Y,h.events.length-Y,ne.resolve(h.events.slice(Y),h)),ne.resolveTo&&(h.events=ne.resolveTo(h.events,h))}function he(){const ne=b(),Y=h.previous,U=h.currentConstruct,K=h.events.length,H=Array.from(f);return{from:K,restore:M};function M(){s=ne,h.previous=Y,h.currentConstruct=U,h.events.length=K,f=H,j()}}function j(){s.line in a&&s.column<2&&(s.column=a[s.line],s.offset+=a[s.line]-1)}}function H5(e,t){const n=t.start._index,s=t.start._bufferIndex,a=t.end._index,o=t.end._bufferIndex;let c;if(n===a)c=[e[n].slice(s,o)];else{if(c=e.slice(n,a),s>-1){const f=c[0];typeof f=="string"?c[0]=f.slice(s):c.shift()}o>0&&c.push(e[a].slice(0,o))}return c}function j5(e,t){let n=-1;const s=[];let a;for(;++n<e.length;){const o=e[n];let c;if(typeof o=="string")c=o;else switch(o){case-5:{c="\r";break}case-4:{c=`
100
+ `),_.current(O,X,!1);return}g(z=>new Set(z).add(O))}},X.term.onData(le=>{Z.readyState===WebSocket.OPEN&&Z.send(le)}),X.ws=Z},[e]);ae.useEffect(()=>{_.current=b},[b]);const k=ae.useCallback(async(O,X)=>{if(!o.current||Di.has(O))return;const{resume:L=!1,autoConnect:re=!0}=X??{},Z=document.createElement("div");Z.style.width="100%",Z.style.height="100%",Z.style.display="none",Z.style.paddingLeft="10px",Z.style.boxSizing="border-box",o.current.appendChild(Z);const le=new q2({cols:80,scrollback:5e3,fontSize:13,fontFamily:'"Geist Mono", ui-monospace, monospace',lineHeight:1.05,letterSpacing:0,cursorBlink:!0,cursorStyle:"block",theme:J2,allowTransparency:!1,drawBoldTextInBrightColors:!1,minimumContrastRatio:7}),z=new V2,te=new Z2;le.loadAddon(z),le.loadAddon(te),le.open(Z);const U={term:le,fit:z,serialize:te,ws:null,container:Z,observer:null,connected:!1},F=new ResizeObserver(()=>{var H;const{width:V}=Z.getBoundingClientRect();if(!(V<50))try{z.fit(),((H=U.ws)==null?void 0:H.readyState)===WebSocket.OPEN&&U.ws.send(JSON.stringify({type:"resize",cols:le.cols,rows:le.rows}))}catch{}});F.observe(Z),U.observer=F,Di.set(O,U),p(V=>[...V,O]);try{const V=await ik(O);V&&le.write(V)}catch{}re?b(O,U,L):g(V=>new Set(V).add(O)),setTimeout(()=>S(U),50)},[b,S]),R=ae.useCallback(async(O,X)=>{const L=Di.get(O);L&&(L.ws&&(L.ws.close(),L.ws=null),X||(await c.current(`/api/terminal/${encodeURIComponent(O)}`,{method:"DELETE"}).catch(()=>{}),L.term.clear()),b(O,L,X))},[b]),T=ae.useCallback(O=>{const X=Di.get(O);if(X){try{const L=X.serialize.serialize();$o(O,L).catch(()=>{})}catch{}X.observer.disconnect(),X.ws&&X.ws.close(),X.term.dispose(),X.container.remove(),Di.delete(O),p(L=>L.filter(re=>re!==O)),g(L=>{const re=new Set(L);return re.delete(O),re}),n(`/api/terminal/${encodeURIComponent(O)}`,{method:"DELETE"}).catch(()=>{}),a==null||a(O)}},[n,a]);ae.useEffect(()=>{t&&(Di.has(t)?y(t):c.current(`/api/terminal/session/${encodeURIComponent(t)}`).then(O=>O.ok?O.json():null).then(O=>{if(!Di.has(t)){const X=(O==null?void 0:O.sessionId)&&!(O!=null&&O.running);k(t,{autoConnect:!X}),y(t)}}).catch(()=>{Di.has(t)||(k(t),y(t))}))},[t,k,y]),ae.useEffect(()=>{const O=setInterval(()=>{for(const[X,L]of Di)if(L.connected)try{const re=L.serialize.serialize();$o(X,re).catch(()=>{})}catch{}},3e4);return()=>clearInterval(O)},[]),ae.useEffect(()=>()=>{for(const[O,X]of Di){try{const L=X.serialize.serialize();$o(O,L).catch(()=>{})}catch{}X.observer.disconnect(),X.ws&&X.ws.close(),X.term.dispose(),X.container.remove(),c.current(`/api/terminal/${encodeURIComponent(O)}`,{method:"DELETE"}).catch(()=>{})}Di.clear()},[]);const $=t?h.has(t):!1,j=f.length===0;return x.jsxs("div",{className:"h-full flex flex-col",children:[!j&&x.jsx("div",{className:"px-2 py-1 border-b border-border flex items-center gap-1 overflow-x-auto",children:f.map(O=>x.jsxs("div",{onClick:()=>s==null?void 0:s(O),className:`flex items-center gap-1 px-2 py-0.5 rounded text-xs font-mono cursor-pointer ${O===t?"bg-accent/10 text-accent":"text-muted hover:text-foreground"}`,children:[x.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${h.has(O)?"bg-amber-500":O===t?"bg-green-600":"bg-muted/50"}`}),x.jsx("span",{className:`truncate max-w-[120px] ${O.startsWith("_new_")?"italic":""}`,children:O.startsWith("_new_")?"Untitled":O}),x.jsx("button",{onClick:X=>{X.stopPropagation(),T(O)},className:"ml-0.5 text-muted hover:text-error text-[10px] leading-none",title:"Close terminal",children:"×"})]},O))}),x.jsxs("div",{className:"relative flex-1 min-h-0",children:[x.jsx("div",{ref:o,className:"h-full"}),j&&x.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-muted",children:x.jsxs("div",{className:"text-center",children:[x.jsx("p",{className:"text-lg font-serif",children:"Select a story on the left menu"}),x.jsx("p",{className:"text-sm mt-1",children:"to start an AI Writer session"})]})}),$&&t&&x.jsx("div",{className:"absolute inset-0 flex items-center justify-center",style:{background:"rgba(240, 235, 225, 0.9)"},children:x.jsxs("div",{className:"text-center space-y-3",children:[x.jsx("p",{className:"text-sm font-serif text-foreground",children:"Terminal disconnected"}),x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx("button",{onClick:()=>R(t,!0),className:"px-4 py-1.5 bg-accent text-white text-sm rounded hover:bg-accent-dim",children:"Resume Session"}),x.jsx("button",{onClick:()=>R(t,!1),className:"px-4 py-1.5 border border-border text-sm rounded hover:bg-surface",children:"Start Fresh"})]}),x.jsx("p",{className:"text-xs text-muted",children:"Resume continues your previous Claude conversation"})]})})]})]})}function rk(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const sk=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,lk=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ak={};function Jv(e,t){return(ak.jsx?lk:sk).test(e)}const ok=/[ \t\n\f\r]/g;function uk(e){return typeof e=="object"?e.type==="text"?ey(e.value):!1:ey(e)}function ey(e){return e.replace(ok,"")===""}class Sa{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}}Sa.prototype.normal={};Sa.prototype.property={};Sa.prototype.space=void 0;function YS(e,t){const n={},s={};for(const a of e)Object.assign(n,a.property),Object.assign(s,a.normal);return new Sa(n,s,t)}function cd(e){return e.toLowerCase()}class gi{constructor(t,n){this.attribute=n,this.property=t}}gi.prototype.attribute="";gi.prototype.booleanish=!1;gi.prototype.boolean=!1;gi.prototype.commaOrSpaceSeparated=!1;gi.prototype.commaSeparated=!1;gi.prototype.defined=!1;gi.prototype.mustUseProperty=!1;gi.prototype.number=!1;gi.prototype.overloadedBoolean=!1;gi.prototype.property="";gi.prototype.spaceSeparated=!1;gi.prototype.space=void 0;let ck=0;const Ee=Xr(),yt=Xr(),hd=Xr(),oe=Xr(),Je=Xr(),qs=Xr(),Ri=Xr();function Xr(){return 2**++ck}const fd=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ee,booleanish:yt,commaOrSpaceSeparated:Ri,commaSeparated:qs,number:oe,overloadedBoolean:hd,spaceSeparated:Je},Symbol.toStringTag,{value:"Module"})),of=Object.keys(fd);class Bd extends gi{constructor(t,n,s,a){let o=-1;if(super(t,n),ty(this,"space",a),typeof s=="number")for(;++o<of.length;){const c=of[o];ty(this,of[o],(s&fd[c])===fd[c])}}}Bd.prototype.defined=!0;function ty(e,t,n){n&&(e[t]=n)}function $s(e){const t={},n={};for(const[s,a]of Object.entries(e.properties)){const o=new Bd(s,e.transform(e.attributes||{},s),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(o.mustUseProperty=!0),t[s]=o,n[cd(s)]=s,n[cd(o.attribute)]=s}return new Sa(t,n,e.space)}const VS=$s({properties:{ariaActiveDescendant:null,ariaAtomic:yt,ariaAutoComplete:null,ariaBusy:yt,ariaChecked:yt,ariaColCount:oe,ariaColIndex:oe,ariaColSpan:oe,ariaControls:Je,ariaCurrent:null,ariaDescribedBy:Je,ariaDetails:null,ariaDisabled:yt,ariaDropEffect:Je,ariaErrorMessage:null,ariaExpanded:yt,ariaFlowTo:Je,ariaGrabbed:yt,ariaHasPopup:null,ariaHidden:yt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Je,ariaLevel:oe,ariaLive:null,ariaModal:yt,ariaMultiLine:yt,ariaMultiSelectable:yt,ariaOrientation:null,ariaOwns:Je,ariaPlaceholder:null,ariaPosInSet:oe,ariaPressed:yt,ariaReadOnly:yt,ariaRelevant:null,ariaRequired:yt,ariaRoleDescription:Je,ariaRowCount:oe,ariaRowIndex:oe,ariaRowSpan:oe,ariaSelected:yt,ariaSetSize:oe,ariaSort:null,ariaValueMax:oe,ariaValueMin:oe,ariaValueNow:oe,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function KS(e,t){return t in e?e[t]:t}function XS(e,t){return KS(e,t.toLowerCase())}const hk=$s({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:qs,acceptCharset:Je,accessKey:Je,action:null,allow:null,allowFullScreen:Ee,allowPaymentRequest:Ee,allowUserMedia:Ee,alt:null,as:null,async:Ee,autoCapitalize:null,autoComplete:Je,autoFocus:Ee,autoPlay:Ee,blocking:Je,capture:null,charSet:null,checked:Ee,cite:null,className:Je,cols:oe,colSpan:null,content:null,contentEditable:yt,controls:Ee,controlsList:Je,coords:oe|qs,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ee,defer:Ee,dir:null,dirName:null,disabled:Ee,download:hd,draggable:yt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ee,formTarget:null,headers:Je,height:oe,hidden:hd,high:oe,href:null,hrefLang:null,htmlFor:Je,httpEquiv:Je,id:null,imageSizes:null,imageSrcSet:null,inert:Ee,inputMode:null,integrity:null,is:null,isMap:Ee,itemId:null,itemProp:Je,itemRef:Je,itemScope:Ee,itemType:Je,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ee,low:oe,manifest:null,max:null,maxLength:oe,media:null,method:null,min:null,minLength:oe,multiple:Ee,muted:Ee,name:null,nonce:null,noModule:Ee,noValidate:Ee,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:Ee,optimum:oe,pattern:null,ping:Je,placeholder:null,playsInline:Ee,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ee,referrerPolicy:null,rel:Je,required:Ee,reversed:Ee,rows:oe,rowSpan:oe,sandbox:Je,scope:null,scoped:Ee,seamless:Ee,selected:Ee,shadowRootClonable:Ee,shadowRootDelegatesFocus:Ee,shadowRootMode:null,shape:null,size:oe,sizes:null,slot:null,span:oe,spellCheck:yt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:oe,step:null,style:null,tabIndex:oe,target:null,title:null,translate:null,type:null,typeMustMatch:Ee,useMap:null,value:yt,width:oe,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Je,axis:null,background:null,bgColor:null,border:oe,borderColor:null,bottomMargin:oe,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ee,declare:Ee,event:null,face:null,frame:null,frameBorder:null,hSpace:oe,leftMargin:oe,link:null,longDesc:null,lowSrc:null,marginHeight:oe,marginWidth:oe,noResize:Ee,noHref:Ee,noShade:Ee,noWrap:Ee,object:null,profile:null,prompt:null,rev:null,rightMargin:oe,rules:null,scheme:null,scrolling:yt,standby:null,summary:null,text:null,topMargin:oe,valueType:null,version:null,vAlign:null,vLink:null,vSpace:oe,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ee,disableRemotePlayback:Ee,prefix:null,property:null,results:oe,security:null,unselectable:null},space:"html",transform:XS}),fk=$s({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:Ri,accentHeight:oe,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:oe,amplitude:oe,arabicForm:null,ascent:oe,attributeName:null,attributeType:null,azimuth:oe,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:oe,by:null,calcMode:null,capHeight:oe,className:Je,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:oe,diffuseConstant:oe,direction:null,display:null,dur:null,divisor:oe,dominantBaseline:null,download:Ee,dx:null,dy:null,edgeMode:null,editable:null,elevation:oe,enableBackground:null,end:null,event:null,exponent:oe,externalResourcesRequired:null,fill:null,fillOpacity:oe,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:qs,g2:qs,glyphName:qs,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:oe,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:oe,horizOriginX:oe,horizOriginY:oe,id:null,ideographic:oe,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:oe,k:oe,k1:oe,k2:oe,k3:oe,k4:oe,kernelMatrix:Ri,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:oe,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:oe,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:oe,overlineThickness:oe,paintOrder:null,panose1:null,path:null,pathLength:oe,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Je,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:oe,pointsAtY:oe,pointsAtZ:oe,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ri,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ri,rev:Ri,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ri,requiredFeatures:Ri,requiredFonts:Ri,requiredFormats:Ri,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:oe,specularExponent:oe,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:oe,strikethroughThickness:oe,string:null,stroke:null,strokeDashArray:Ri,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:oe,strokeOpacity:oe,strokeWidth:null,style:null,surfaceScale:oe,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ri,tabIndex:oe,tableValues:null,target:null,targetX:oe,targetY:oe,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ri,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:oe,underlineThickness:oe,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:oe,values:null,vAlphabetic:oe,vMathematical:oe,vectorEffect:null,vHanging:oe,vIdeographic:oe,version:null,vertAdvY:oe,vertOriginX:oe,vertOriginY:oe,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:oe,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:KS}),$S=$s({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()}}),GS=$s({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:XS}),ZS=$s({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),dk={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"},pk=/[A-Z]/g,iy=/-[a-z]/g,mk=/^data[-\w.:]+$/i;function _k(e,t){const n=cd(t);let s=t,a=gi;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&mk.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(iy,vk);s="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!iy.test(o)){let c=o.replace(pk,gk);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}a=Bd}return new a(s,t)}function gk(e){return"-"+e.toLowerCase()}function vk(e){return e.charAt(1).toUpperCase()}const yk=YS([VS,hk,$S,GS,ZS],"html"),Ld=YS([VS,fk,$S,GS,ZS],"svg");function Sk(e){return e.join(" ").trim()}var Us={},uf,ny;function bk(){if(ny)return uf;ny=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,f=/^\s+|\s+$/g,p=`
101
+ `,h="/",g="*",_="",S="comment",y="declaration";function b(R,T){if(typeof R!="string")throw new TypeError("First argument must be a string");if(!R)return[];T=T||{};var $=1,j=1;function O(V){var H=V.match(t);H&&($+=H.length);var M=V.lastIndexOf(p);j=~M?V.length-M:j+V.length}function X(){var V={line:$,column:j};return function(H){return H.position=new L(V),le(),H}}function L(V){this.start=V,this.end={line:$,column:j},this.source=T.source}L.prototype.content=R;function re(V){var H=new Error(T.source+":"+$+":"+j+": "+V);if(H.reason=V,H.filename=T.source,H.line=$,H.column=j,H.source=R,!T.silent)throw H}function Z(V){var H=V.exec(R);if(H){var M=H[0];return O(M),R=R.slice(M.length),H}}function le(){Z(n)}function z(V){var H;for(V=V||[];H=te();)H!==!1&&V.push(H);return V}function te(){var V=X();if(!(h!=R.charAt(0)||g!=R.charAt(1))){for(var H=2;_!=R.charAt(H)&&(g!=R.charAt(H)||h!=R.charAt(H+1));)++H;if(H+=2,_===R.charAt(H-1))return re("End of comment missing");var M=R.slice(2,H-2);return j+=2,O(M),R=R.slice(H),j+=2,V({type:S,comment:M})}}function U(){var V=X(),H=Z(s);if(H){if(te(),!Z(a))return re("property missing ':'");var M=Z(o),q=V({type:y,property:k(H[0].replace(e,_)),value:M?k(M[0].replace(e,_)):_});return Z(c),q}}function F(){var V=[];z(V);for(var H;H=U();)H!==!1&&(V.push(H),z(V));return V}return le(),F()}function k(R){return R?R.replace(f,_):_}return uf=b,uf}var ry;function xk(){if(ry)return Us;ry=1;var e=Us&&Us.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Us,"__esModule",{value:!0}),Us.default=n;const t=e(bk());function n(s,a){let o=null;if(!s||typeof s!="string")return o;const c=(0,t.default)(s),f=typeof a=="function";return c.forEach(p=>{if(p.type!=="declaration")return;const{property:h,value:g}=p;f?a(h,g,p):g&&(o=o||{},o[h]=g)}),o}return Us}var Zl={},sy;function wk(){if(sy)return Zl;sy=1,Object.defineProperty(Zl,"__esModule",{value:!0}),Zl.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(h){return!h||n.test(h)||e.test(h)},c=function(h,g){return g.toUpperCase()},f=function(h,g){return"".concat(g,"-")},p=function(h,g){return g===void 0&&(g={}),o(h)?h:(h=h.toLowerCase(),g.reactCompat?h=h.replace(a,f):h=h.replace(s,f),h.replace(t,c))};return Zl.camelCase=p,Zl}var Ql,ly;function Ck(){if(ly)return Ql;ly=1;var e=Ql&&Ql.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(xk()),n=wk();function s(a,o){var c={};return!a||typeof a!="string"||(0,t.default)(a,function(f,p){f&&p&&(c[(0,n.camelCase)(f,o)]=p)}),c}return s.default=s,Ql=s,Ql}var kk=Ck();const Ek=gu(kk),QS=JS("end"),zd=JS("start");function JS(e){return t;function t(n){const s=n&&n.position&&n.position[e]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function eb(e){const t=zd(e),n=QS(e);if(t&&n)return{start:t,end:n}}function aa(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?ay(e.position):"start"in e||"end"in e?ay(e):"line"in e||"column"in e?dd(e):""}function dd(e){return oy(e&&e.line)+":"+oy(e&&e.column)}function ay(e){return dd(e&&e.start)+"-"+dd(e&&e.end)}function oy(e){return e&&typeof e=="number"?e:1}class Gt extends Error{constructor(t,n,s){super(),typeof n=="string"&&(s=n,n=void 0);let a="",o={},c=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?a=t:!o.cause&&t&&(c=!0,a=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof s=="string"){const p=s.indexOf(":");p===-1?o.ruleId=s:(o.source=s.slice(0,p),o.ruleId=s.slice(p+1))}if(!o.place&&o.ancestors&&o.ancestors){const p=o.ancestors[o.ancestors.length-1];p&&(o.place=p.position)}const f=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=f?f.line:void 0,this.name=aa(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=c&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Gt.prototype.file="";Gt.prototype.name="";Gt.prototype.reason="";Gt.prototype.message="";Gt.prototype.stack="";Gt.prototype.column=void 0;Gt.prototype.line=void 0;Gt.prototype.ancestors=void 0;Gt.prototype.cause=void 0;Gt.prototype.fatal=void 0;Gt.prototype.place=void 0;Gt.prototype.ruleId=void 0;Gt.prototype.source=void 0;const Nd={}.hasOwnProperty,Tk=new Map,Ak=/[A-Z]/g,Dk=new Set(["table","tbody","thead","tfoot","tr"]),Rk=new Set(["td","th"]),tb="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Mk(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let s;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=Uk(n,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");s=jk(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:s,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Ld:yk,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=ib(a,e,void 0);return o&&typeof o!="string"?o:a.create(e,a.Fragment,{children:o||void 0},void 0)}function ib(e,t,n){if(t.type==="element")return Bk(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Lk(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Nk(e,t,n);if(t.type==="mdxjsEsm")return zk(e,t);if(t.type==="root")return Ok(e,t,n);if(t.type==="text")return Hk(e,t)}function Bk(e,t,n){const s=e.schema;let a=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(a=Ld,e.schema=a),e.ancestors.push(t);const o=rb(e,t.tagName,!1),c=Pk(e,t);let f=Hd(e,t);return Dk.has(t.tagName)&&(f=f.filter(function(p){return typeof p=="string"?!uk(p):!0})),nb(e,c,o,t),Od(c,f),e.ancestors.pop(),e.schema=s,e.create(t,o,c,n)}function Lk(e,t){if(t.data&&t.data.estree&&e.evaluater){const s=t.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}da(e,t.position)}function zk(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);da(e,t.position)}function Nk(e,t,n){const s=e.schema;let a=s;t.name==="svg"&&s.space==="html"&&(a=Ld,e.schema=a),e.ancestors.push(t);const o=t.name===null?e.Fragment:rb(e,t.name,!0),c=Ik(e,t),f=Hd(e,t);return nb(e,c,o,t),Od(c,f),e.ancestors.pop(),e.schema=s,e.create(t,o,c,n)}function Ok(e,t,n){const s={};return Od(s,Hd(e,t)),e.create(t,e.Fragment,s,n)}function Hk(e,t){return t.value}function nb(e,t,n,s){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=s)}function Od(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function jk(e,t,n){return s;function s(a,o,c,f){const h=Array.isArray(c.children)?n:t;return f?h(o,c,f):h(o,c)}}function Uk(e,t){return n;function n(s,a,o,c){const f=Array.isArray(o.children),p=zd(s);return t(a,o,c,f,{columnNumber:p?p.column-1:void 0,fileName:e,lineNumber:p?p.line:void 0},void 0)}}function Pk(e,t){const n={};let s,a;for(a in t.properties)if(a!=="children"&&Nd.call(t.properties,a)){const o=Fk(e,a,t.properties[a]);if(o){const[c,f]=o;e.tableCellAlignToStyle&&c==="align"&&typeof f=="string"&&Rk.has(t.tagName)?s=f:n[c]=f}}if(s){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return n}function Ik(e,t){const n={};for(const s of t.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const o=s.data.estree.body[0];o.type;const c=o.expression;c.type;const f=c.properties[0];f.type,Object.assign(n,e.evaluater.evaluateExpression(f.argument))}else da(e,t.position);else{const a=s.name;let o;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const f=s.value.data.estree.body[0];f.type,o=e.evaluater.evaluateExpression(f.expression)}else da(e,t.position);else o=s.value===null?!0:s.value;n[a]=o}return n}function Hd(e,t){const n=[];let s=-1;const a=e.passKeys?new Map:Tk;for(;++s<t.children.length;){const o=t.children[s];let c;if(e.passKeys){const p=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(p){const h=a.get(p)||0;c=p+"-"+h,a.set(p,h+1)}}const f=ib(e,o,c);f!==void 0&&n.push(f)}return n}function Fk(e,t,n){const s=_k(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=s.commaSeparated?rk(n):Sk(n)),s.property==="style"){let a=typeof n=="object"?n:qk(e,String(n));return e.stylePropertyNameCase==="css"&&(a=Wk(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&s.space?dk[s.property]||s.property:s.attribute,n]}}function qk(e,t){try{return Ek(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const s=n,a=new Gt("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=tb+"#cannot-parse-style-attribute",a}}function rb(e,t,n){let s;if(!n)s={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let o=-1,c;for(;++o<a.length;){const f=Jv(a[o])?{type:"Identifier",name:a[o]}:{type:"Literal",value:a[o]};c=c?{type:"MemberExpression",object:c,property:f,computed:!!(o&&f.type==="Literal"),optional:!1}:f}s=c}else s=Jv(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const a=s.value;return Nd.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(s);da(e)}function da(e,t){const n=new Gt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=tb+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Wk(e){const t={};let n;for(n in e)Nd.call(e,n)&&(t[Yk(n)]=e[n]);return t}function Yk(e){let t=e.replace(Ak,Vk);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function Vk(e){return"-"+e.toLowerCase()}const cf={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"]},Kk={};function jd(e,t){const n=Kk,s=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return sb(e,s,a)}function sb(e,t,n){if(Xk(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return uy(e.children,t,n)}return Array.isArray(e)?uy(e,t,n):""}function uy(e,t,n){const s=[];let a=-1;for(;++a<e.length;)s[a]=sb(e[a],t,n);return s.join("")}function Xk(e){return!!(e&&typeof e=="object")}const cy=document.createElement("i");function Ud(e){const t="&"+e+";";cy.innerHTML=t;const n=cy.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Mi(e,t,n,s){const a=e.length;let o=0,c;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,s.length<1e4)c=Array.from(s),c.unshift(t,n),e.splice(...c);else for(n&&e.splice(t,n);o<s.length;)c=s.slice(o,o+1e4),c.unshift(t,0),e.splice(...c),o+=1e4,t+=1e4}function Yi(e,t){return e.length>0?(Mi(e,e.length,0,t),e):t}const hy={}.hasOwnProperty;function lb(e){const t={};let n=-1;for(;++n<e.length;)$k(t,e[n]);return t}function $k(e,t){let n;for(n in t){const a=(hy.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let c;if(o)for(c in o){hy.call(a,c)||(a[c]=[]);const f=o[c];Gk(a[c],Array.isArray(f)?f:f?[f]:[])}}}function Gk(e,t){let n=-1;const s=[];for(;++n<t.length;)(t[n].add==="after"?e:s).push(t[n]);Mi(e,0,0,s)}function ab(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Qi(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ni=gr(/[A-Za-z]/),$t=gr(/[\dA-Za-z]/),Zk=gr(/[#-'*+\--9=?A-Z^-~]/);function pu(e){return e!==null&&(e<32||e===127)}const pd=gr(/\d/),Qk=gr(/[\dA-Fa-f]/),Jk=gr(/[!-/:-@[-`{-~]/);function ve(e){return e!==null&&e<-2}function Qe(e){return e!==null&&(e<0||e===32)}function Le(e){return e===-2||e===-1||e===32}const xu=gr(new RegExp("\\p{P}|\\p{S}","u")),Vr=gr(/\s/);function gr(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Gs(e){const t=[];let n=-1,s=0,a=0;for(;++n<e.length;){const o=e.charCodeAt(n);let c="";if(o===37&&$t(e.charCodeAt(n+1))&&$t(e.charCodeAt(n+2)))a=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(c=String.fromCharCode(o));else if(o>55295&&o<57344){const f=e.charCodeAt(n+1);o<56320&&f>56319&&f<57344?(c=String.fromCharCode(o,f),a=1):c="�"}else c=String.fromCharCode(o);c&&(t.push(e.slice(s,n),encodeURIComponent(c)),s=n+a+1,c=""),a&&(n+=a,a=0)}return t.join("")+e.slice(s)}function je(e,t,n,s){const a=s?s-1:Number.POSITIVE_INFINITY;let o=0;return c;function c(p){return Le(p)?(e.enter(n),f(p)):t(p)}function f(p){return Le(p)&&o++<a?(e.consume(p),f):(e.exit(n),t(p))}}const eE={tokenize:tE};function tE(e){const t=e.attempt(this.parser.constructs.contentInitial,s,a);let n;return t;function s(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),je(e,t,"linePrefix")}function a(f){return e.enter("paragraph"),o(f)}function o(f){const p=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=p),n=p,c(f)}function c(f){if(f===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(f);return}return ve(f)?(e.consume(f),e.exit("chunkText"),o):(e.consume(f),c)}}const iE={tokenize:nE},fy={tokenize:rE};function nE(e){const t=this,n=[];let s=0,a,o,c;return f;function f(j){if(s<n.length){const O=n[s];return t.containerState=O[1],e.attempt(O[0].continuation,p,h)(j)}return h(j)}function p(j){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&$();const O=t.events.length;let X=O,L;for(;X--;)if(t.events[X][0]==="exit"&&t.events[X][1].type==="chunkFlow"){L=t.events[X][1].end;break}T(s);let re=O;for(;re<t.events.length;)t.events[re][1].end={...L},re++;return Mi(t.events,X+1,0,t.events.slice(O)),t.events.length=re,h(j)}return f(j)}function h(j){if(s===n.length){if(!a)return S(j);if(a.currentConstruct&&a.currentConstruct.concrete)return b(j);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(fy,g,_)(j)}function g(j){return a&&$(),T(s),S(j)}function _(j){return t.parser.lazy[t.now().line]=s!==n.length,c=t.now().offset,b(j)}function S(j){return t.containerState={},e.attempt(fy,y,b)(j)}function y(j){return s++,n.push([t.currentConstruct,t.containerState]),S(j)}function b(j){if(j===null){a&&$(),T(0),e.consume(j);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:o}),k(j)}function k(j){if(j===null){R(e.exit("chunkFlow"),!0),T(0),e.consume(j);return}return ve(j)?(e.consume(j),R(e.exit("chunkFlow")),s=0,t.interrupt=void 0,f):(e.consume(j),k)}function R(j,O){const X=t.sliceStream(j);if(O&&X.push(null),j.previous=o,o&&(o.next=j),o=j,a.defineSkip(j.start),a.write(X),t.parser.lazy[j.start.line]){let L=a.events.length;for(;L--;)if(a.events[L][1].start.offset<c&&(!a.events[L][1].end||a.events[L][1].end.offset>c))return;const re=t.events.length;let Z=re,le,z;for(;Z--;)if(t.events[Z][0]==="exit"&&t.events[Z][1].type==="chunkFlow"){if(le){z=t.events[Z][1].end;break}le=!0}for(T(s),L=re;L<t.events.length;)t.events[L][1].end={...z},L++;Mi(t.events,Z+1,0,t.events.slice(re)),t.events.length=L}}function T(j){let O=n.length;for(;O-- >j;){const X=n[O];t.containerState=X[1],X[0].exit.call(t,e)}n.length=j}function $(){a.write([null]),o=void 0,a=void 0,t.containerState._closeFlow=void 0}}function rE(e,t,n){return je(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Vs(e){if(e===null||Qe(e)||Vr(e))return 1;if(xu(e))return 2}function wu(e,t,n){const s=[];let a=-1;for(;++a<e.length;){const o=e[a].resolveAll;o&&!s.includes(o)&&(t=o(t,n),s.push(o))}return t}const md={name:"attention",resolveAll:sE,tokenize:lE};function sE(e,t){let n=-1,s,a,o,c,f,p,h,g;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(s=n;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&t.sliceSerialize(e[s][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[s][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;p=e[s][1].end.offset-e[s][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const _={...e[s][1].end},S={...e[n][1].start};dy(_,-p),dy(S,p),c={type:p>1?"strongSequence":"emphasisSequence",start:_,end:{...e[s][1].end}},f={type:p>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:S},o={type:p>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[n][1].start}},a={type:p>1?"strong":"emphasis",start:{...c.start},end:{...f.end}},e[s][1].end={...c.start},e[n][1].start={...f.end},h=[],e[s][1].end.offset-e[s][1].start.offset&&(h=Yi(h,[["enter",e[s][1],t],["exit",e[s][1],t]])),h=Yi(h,[["enter",a,t],["enter",c,t],["exit",c,t],["enter",o,t]]),h=Yi(h,wu(t.parser.constructs.insideSpan.null,e.slice(s+1,n),t)),h=Yi(h,[["exit",o,t],["enter",f,t],["exit",f,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(g=2,h=Yi(h,[["enter",e[n][1],t],["exit",e[n][1],t]])):g=0,Mi(e,s-1,n-s+3,h),n=s+h.length-g-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function lE(e,t){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,a=Vs(s);let o;return c;function c(p){return o=p,e.enter("attentionSequence"),f(p)}function f(p){if(p===o)return e.consume(p),f;const h=e.exit("attentionSequence"),g=Vs(p),_=!g||g===2&&a||n.includes(p),S=!a||a===2&&g||n.includes(s);return h._open=!!(o===42?_:_&&(a||!S)),h._close=!!(o===42?S:S&&(g||!_)),t(p)}}function dy(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const aE={name:"autolink",tokenize:oE};function oE(e,t,n){let s=0;return a;function a(y){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(y){return ni(y)?(e.consume(y),c):y===64?n(y):h(y)}function c(y){return y===43||y===45||y===46||$t(y)?(s=1,f(y)):h(y)}function f(y){return y===58?(e.consume(y),s=0,p):(y===43||y===45||y===46||$t(y))&&s++<32?(e.consume(y),f):(s=0,h(y))}function p(y){return y===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):y===null||y===32||y===60||pu(y)?n(y):(e.consume(y),p)}function h(y){return y===64?(e.consume(y),g):Zk(y)?(e.consume(y),h):n(y)}function g(y){return $t(y)?_(y):n(y)}function _(y){return y===46?(e.consume(y),s=0,g):y===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):S(y)}function S(y){if((y===45||$t(y))&&s++<63){const b=y===45?S:_;return e.consume(y),b}return n(y)}}const ba={partial:!0,tokenize:uE};function uE(e,t,n){return s;function s(o){return Le(o)?je(e,a,"linePrefix")(o):a(o)}function a(o){return o===null||ve(o)?t(o):n(o)}}const ob={continuation:{tokenize:hE},exit:fE,name:"blockQuote",tokenize:cE};function cE(e,t,n){const s=this;return a;function a(c){if(c===62){const f=s.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(c),e.exit("blockQuoteMarker"),o}return n(c)}function o(c){return Le(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(c))}}function hE(e,t,n){const s=this;return a;function a(c){return Le(c)?je(e,o,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):o(c)}function o(c){return e.attempt(ob,t,n)(c)}}function fE(e){e.exit("blockQuote")}const ub={name:"characterEscape",tokenize:dE};function dE(e,t,n){return s;function s(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),a}function a(o){return Jk(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const cb={name:"characterReference",tokenize:pE};function pE(e,t,n){const s=this;let a=0,o,c;return f;function f(_){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(_),e.exit("characterReferenceMarker"),p}function p(_){return _===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(_),e.exit("characterReferenceMarkerNumeric"),h):(e.enter("characterReferenceValue"),o=31,c=$t,g(_))}function h(_){return _===88||_===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(_),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,c=Qk,g):(e.enter("characterReferenceValue"),o=7,c=pd,g(_))}function g(_){if(_===59&&a){const S=e.exit("characterReferenceValue");return c===$t&&!Ud(s.sliceSerialize(S))?n(_):(e.enter("characterReferenceMarker"),e.consume(_),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return c(_)&&a++<o?(e.consume(_),g):n(_)}}const py={partial:!0,tokenize:_E},my={concrete:!0,name:"codeFenced",tokenize:mE};function mE(e,t,n){const s=this,a={partial:!0,tokenize:X};let o=0,c=0,f;return p;function p(L){return h(L)}function h(L){const re=s.events[s.events.length-1];return o=re&&re[1].type==="linePrefix"?re[2].sliceSerialize(re[1],!0).length:0,f=L,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(L)}function g(L){return L===f?(c++,e.consume(L),g):c<3?n(L):(e.exit("codeFencedFenceSequence"),Le(L)?je(e,_,"whitespace")(L):_(L))}function _(L){return L===null||ve(L)?(e.exit("codeFencedFence"),s.interrupt?t(L):e.check(py,k,O)(L)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),S(L))}function S(L){return L===null||ve(L)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),_(L)):Le(L)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),je(e,y,"whitespace")(L)):L===96&&L===f?n(L):(e.consume(L),S)}function y(L){return L===null||ve(L)?_(L):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),b(L))}function b(L){return L===null||ve(L)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),_(L)):L===96&&L===f?n(L):(e.consume(L),b)}function k(L){return e.attempt(a,O,R)(L)}function R(L){return e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),T}function T(L){return o>0&&Le(L)?je(e,$,"linePrefix",o+1)(L):$(L)}function $(L){return L===null||ve(L)?e.check(py,k,O)(L):(e.enter("codeFlowValue"),j(L))}function j(L){return L===null||ve(L)?(e.exit("codeFlowValue"),$(L)):(e.consume(L),j)}function O(L){return e.exit("codeFenced"),t(L)}function X(L,re,Z){let le=0;return z;function z(H){return L.enter("lineEnding"),L.consume(H),L.exit("lineEnding"),te}function te(H){return L.enter("codeFencedFence"),Le(H)?je(L,U,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(H):U(H)}function U(H){return H===f?(L.enter("codeFencedFenceSequence"),F(H)):Z(H)}function F(H){return H===f?(le++,L.consume(H),F):le>=c?(L.exit("codeFencedFenceSequence"),Le(H)?je(L,V,"whitespace")(H):V(H)):Z(H)}function V(H){return H===null||ve(H)?(L.exit("codeFencedFence"),re(H)):Z(H)}}}function _E(e,t,n){const s=this;return a;function a(c){return c===null?n(c):(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),o)}function o(c){return s.parser.lazy[s.now().line]?n(c):t(c)}}const hf={name:"codeIndented",tokenize:vE},gE={partial:!0,tokenize:yE};function vE(e,t,n){const s=this;return a;function a(h){return e.enter("codeIndented"),je(e,o,"linePrefix",5)(h)}function o(h){const g=s.events[s.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?c(h):n(h)}function c(h){return h===null?p(h):ve(h)?e.attempt(gE,c,p)(h):(e.enter("codeFlowValue"),f(h))}function f(h){return h===null||ve(h)?(e.exit("codeFlowValue"),c(h)):(e.consume(h),f)}function p(h){return e.exit("codeIndented"),t(h)}}function yE(e,t,n){const s=this;return a;function a(c){return s.parser.lazy[s.now().line]?n(c):ve(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),a):je(e,o,"linePrefix",5)(c)}function o(c){const f=s.events[s.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(c):ve(c)?a(c):n(c)}}const SE={name:"codeText",previous:xE,resolve:bE,tokenize:wE};function bE(e){let t=e.length-4,n=3,s,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(s=n;++s<t;)if(e[s][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(s=n-1,t++;++s<=t;)a===void 0?s!==t&&e[s][1].type!=="lineEnding"&&(a=s):(s===t||e[s][1].type==="lineEnding")&&(e[a][1].type="codeTextData",s!==a+2&&(e[a][1].end=e[s-1][1].end,e.splice(a+2,s-a-2),t-=s-a-2,s=a+2),a=void 0);return e}function xE(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function wE(e,t,n){let s=0,a,o;return c;function c(_){return e.enter("codeText"),e.enter("codeTextSequence"),f(_)}function f(_){return _===96?(e.consume(_),s++,f):(e.exit("codeTextSequence"),p(_))}function p(_){return _===null?n(_):_===32?(e.enter("space"),e.consume(_),e.exit("space"),p):_===96?(o=e.enter("codeTextSequence"),a=0,g(_)):ve(_)?(e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),p):(e.enter("codeTextData"),h(_))}function h(_){return _===null||_===32||_===96||ve(_)?(e.exit("codeTextData"),p(_)):(e.consume(_),h)}function g(_){return _===96?(e.consume(_),a++,g):a===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(_)):(o.type="codeTextData",h(_))}}class CE{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,n){const s=n??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(t,s):t>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(t,n,s){const a=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return s&&Jl(this.left,s),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Jl(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Jl(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 n=this.left.splice(t,Number.POSITIVE_INFINITY);Jl(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Jl(this.left,n.reverse())}}}function Jl(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function hb(e){const t={};let n=-1,s,a,o,c,f,p,h;const g=new CE(e);for(;++n<g.length;){for(;n in t;)n=t[n];if(s=g.get(n),n&&s[1].type==="chunkFlow"&&g.get(n-1)[1].type==="listItemPrefix"&&(p=s[1]._tokenizer.events,o=0,o<p.length&&p[o][1].type==="lineEndingBlank"&&(o+=2),o<p.length&&p[o][1].type==="content"))for(;++o<p.length&&p[o][1].type!=="content";)p[o][1].type==="chunkText"&&(p[o][1]._isInFirstContentOfListItem=!0,o++);if(s[0]==="enter")s[1].contentType&&(Object.assign(t,kE(g,n)),n=t[n],h=!0);else if(s[1]._container){for(o=n,a=void 0;o--;)if(c=g.get(o),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(a&&(g.get(a)[1].type="lineEndingBlank"),c[1].type="lineEnding",a=o);else if(!(c[1].type==="linePrefix"||c[1].type==="listItemIndent"))break;a&&(s[1].end={...g.get(a)[1].start},f=g.slice(a,n),f.unshift(s),g.splice(a,n-a+1,f))}}return Mi(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!h}function kE(e,t){const n=e.get(t)[1],s=e.get(t)[2];let a=t-1;const o=[];let c=n._tokenizer;c||(c=s.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const f=c.events,p=[],h={};let g,_,S=-1,y=n,b=0,k=0;const R=[k];for(;y;){for(;e.get(++a)[1]!==y;);o.push(a),y._tokenizer||(g=s.sliceStream(y),y.next||g.push(null),_&&c.defineSkip(y.start),y._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(g),y._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),_=y,y=y.next}for(y=n;++S<f.length;)f[S][0]==="exit"&&f[S-1][0]==="enter"&&f[S][1].type===f[S-1][1].type&&f[S][1].start.line!==f[S][1].end.line&&(k=S+1,R.push(k),y._tokenizer=void 0,y.previous=void 0,y=y.next);for(c.events=[],y?(y._tokenizer=void 0,y.previous=void 0):R.pop(),S=R.length;S--;){const T=f.slice(R[S],R[S+1]),$=o.pop();p.push([$,$+T.length-1]),e.splice($,2,T)}for(p.reverse(),S=-1;++S<p.length;)h[b+p[S][0]]=b+p[S][1],b+=p[S][1]-p[S][0]-1;return h}const EE={resolve:AE,tokenize:DE},TE={partial:!0,tokenize:RE};function AE(e){return hb(e),e}function DE(e,t){let n;return s;function s(f){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(f)}function a(f){return f===null?o(f):ve(f)?e.check(TE,c,o)(f):(e.consume(f),a)}function o(f){return e.exit("chunkContent"),e.exit("content"),t(f)}function c(f){return e.consume(f),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function RE(e,t,n){const s=this;return a;function a(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),je(e,o,"linePrefix")}function o(c){if(c===null||ve(c))return n(c);const f=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(c):e.interrupt(s.parser.constructs.flow,n,t)(c)}}function fb(e,t,n,s,a,o,c,f,p){const h=p||Number.POSITIVE_INFINITY;let g=0;return _;function _(T){return T===60?(e.enter(s),e.enter(a),e.enter(o),e.consume(T),e.exit(o),S):T===null||T===32||T===41||pu(T)?n(T):(e.enter(s),e.enter(c),e.enter(f),e.enter("chunkString",{contentType:"string"}),k(T))}function S(T){return T===62?(e.enter(o),e.consume(T),e.exit(o),e.exit(a),e.exit(s),t):(e.enter(f),e.enter("chunkString",{contentType:"string"}),y(T))}function y(T){return T===62?(e.exit("chunkString"),e.exit(f),S(T)):T===null||T===60||ve(T)?n(T):(e.consume(T),T===92?b:y)}function b(T){return T===60||T===62||T===92?(e.consume(T),y):y(T)}function k(T){return!g&&(T===null||T===41||Qe(T))?(e.exit("chunkString"),e.exit(f),e.exit(c),e.exit(s),t(T)):g<h&&T===40?(e.consume(T),g++,k):T===41?(e.consume(T),g--,k):T===null||T===32||T===40||pu(T)?n(T):(e.consume(T),T===92?R:k)}function R(T){return T===40||T===41||T===92?(e.consume(T),k):k(T)}}function db(e,t,n,s,a,o){const c=this;let f=0,p;return h;function h(y){return e.enter(s),e.enter(a),e.consume(y),e.exit(a),e.enter(o),g}function g(y){return f>999||y===null||y===91||y===93&&!p||y===94&&!f&&"_hiddenFootnoteSupport"in c.parser.constructs?n(y):y===93?(e.exit(o),e.enter(a),e.consume(y),e.exit(a),e.exit(s),t):ve(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),_(y))}function _(y){return y===null||y===91||y===93||ve(y)||f++>999?(e.exit("chunkString"),g(y)):(e.consume(y),p||(p=!Le(y)),y===92?S:_)}function S(y){return y===91||y===92||y===93?(e.consume(y),f++,_):_(y)}}function pb(e,t,n,s,a,o){let c;return f;function f(S){return S===34||S===39||S===40?(e.enter(s),e.enter(a),e.consume(S),e.exit(a),c=S===40?41:S,p):n(S)}function p(S){return S===c?(e.enter(a),e.consume(S),e.exit(a),e.exit(s),t):(e.enter(o),h(S))}function h(S){return S===c?(e.exit(o),p(c)):S===null?n(S):ve(S)?(e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),je(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(S))}function g(S){return S===c||S===null||ve(S)?(e.exit("chunkString"),h(S)):(e.consume(S),S===92?_:g)}function _(S){return S===c||S===92?(e.consume(S),g):g(S)}}function oa(e,t){let n;return s;function s(a){return ve(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,s):Le(a)?je(e,s,n?"linePrefix":"lineSuffix")(a):t(a)}}const ME={name:"definition",tokenize:LE},BE={partial:!0,tokenize:zE};function LE(e,t,n){const s=this;let a;return o;function o(y){return e.enter("definition"),c(y)}function c(y){return db.call(s,e,f,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function f(y){return a=Qi(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),p):n(y)}function p(y){return Qe(y)?oa(e,h)(y):h(y)}function h(y){return fb(e,g,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function g(y){return e.attempt(BE,_,_)(y)}function _(y){return Le(y)?je(e,S,"whitespace")(y):S(y)}function S(y){return y===null||ve(y)?(e.exit("definition"),s.parser.defined.push(a),t(y)):n(y)}}function zE(e,t,n){return s;function s(f){return Qe(f)?oa(e,a)(f):n(f)}function a(f){return pb(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function o(f){return Le(f)?je(e,c,"whitespace")(f):c(f)}function c(f){return f===null||ve(f)?t(f):n(f)}}const NE={name:"hardBreakEscape",tokenize:OE};function OE(e,t,n){return s;function s(o){return e.enter("hardBreakEscape"),e.consume(o),a}function a(o){return ve(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const HE={name:"headingAtx",resolve:jE,tokenize:UE};function jE(e,t){let n=e.length-2,s=3,a,o;return e[s][1].type==="whitespace"&&(s+=2),n-2>s&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(s===n-1||n-4>s&&e[n-2][1].type==="whitespace")&&(n-=s+1===n?2:4),n>s&&(a={type:"atxHeadingText",start:e[s][1].start,end:e[n][1].end},o={type:"chunkText",start:e[s][1].start,end:e[n][1].end,contentType:"text"},Mi(e,s,n-s+1,[["enter",a,t],["enter",o,t],["exit",o,t],["exit",a,t]])),e}function UE(e,t,n){let s=0;return a;function a(g){return e.enter("atxHeading"),o(g)}function o(g){return e.enter("atxHeadingSequence"),c(g)}function c(g){return g===35&&s++<6?(e.consume(g),c):g===null||Qe(g)?(e.exit("atxHeadingSequence"),f(g)):n(g)}function f(g){return g===35?(e.enter("atxHeadingSequence"),p(g)):g===null||ve(g)?(e.exit("atxHeading"),t(g)):Le(g)?je(e,f,"whitespace")(g):(e.enter("atxHeadingText"),h(g))}function p(g){return g===35?(e.consume(g),p):(e.exit("atxHeadingSequence"),f(g))}function h(g){return g===null||g===35||Qe(g)?(e.exit("atxHeadingText"),f(g)):(e.consume(g),h)}}const PE=["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"],_y=["pre","script","style","textarea"],IE={concrete:!0,name:"htmlFlow",resolveTo:WE,tokenize:YE},FE={partial:!0,tokenize:KE},qE={partial:!0,tokenize:VE};function WE(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 YE(e,t,n){const s=this;let a,o,c,f,p;return h;function h(C){return g(C)}function g(C){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(C),_}function _(C){return C===33?(e.consume(C),S):C===47?(e.consume(C),o=!0,k):C===63?(e.consume(C),a=3,s.interrupt?t:E):ni(C)?(e.consume(C),c=String.fromCharCode(C),R):n(C)}function S(C){return C===45?(e.consume(C),a=2,y):C===91?(e.consume(C),a=5,f=0,b):ni(C)?(e.consume(C),a=4,s.interrupt?t:E):n(C)}function y(C){return C===45?(e.consume(C),s.interrupt?t:E):n(C)}function b(C){const se="CDATA[";return C===se.charCodeAt(f++)?(e.consume(C),f===se.length?s.interrupt?t:U:b):n(C)}function k(C){return ni(C)?(e.consume(C),c=String.fromCharCode(C),R):n(C)}function R(C){if(C===null||C===47||C===62||Qe(C)){const se=C===47,fe=c.toLowerCase();return!se&&!o&&_y.includes(fe)?(a=1,s.interrupt?t(C):U(C)):PE.includes(c.toLowerCase())?(a=6,se?(e.consume(C),T):s.interrupt?t(C):U(C)):(a=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(C):o?$(C):j(C))}return C===45||$t(C)?(e.consume(C),c+=String.fromCharCode(C),R):n(C)}function T(C){return C===62?(e.consume(C),s.interrupt?t:U):n(C)}function $(C){return Le(C)?(e.consume(C),$):z(C)}function j(C){return C===47?(e.consume(C),z):C===58||C===95||ni(C)?(e.consume(C),O):Le(C)?(e.consume(C),j):z(C)}function O(C){return C===45||C===46||C===58||C===95||$t(C)?(e.consume(C),O):X(C)}function X(C){return C===61?(e.consume(C),L):Le(C)?(e.consume(C),X):j(C)}function L(C){return C===null||C===60||C===61||C===62||C===96?n(C):C===34||C===39?(e.consume(C),p=C,re):Le(C)?(e.consume(C),L):Z(C)}function re(C){return C===p?(e.consume(C),p=null,le):C===null||ve(C)?n(C):(e.consume(C),re)}function Z(C){return C===null||C===34||C===39||C===47||C===60||C===61||C===62||C===96||Qe(C)?X(C):(e.consume(C),Z)}function le(C){return C===47||C===62||Le(C)?j(C):n(C)}function z(C){return C===62?(e.consume(C),te):n(C)}function te(C){return C===null||ve(C)?U(C):Le(C)?(e.consume(C),te):n(C)}function U(C){return C===45&&a===2?(e.consume(C),M):C===60&&a===1?(e.consume(C),q):C===62&&a===4?(e.consume(C),A):C===63&&a===3?(e.consume(C),E):C===93&&a===5?(e.consume(C),ue):ve(C)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(FE,K,F)(C)):C===null||ve(C)?(e.exit("htmlFlowData"),F(C)):(e.consume(C),U)}function F(C){return e.check(qE,V,K)(C)}function V(C){return e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),H}function H(C){return C===null||ve(C)?F(C):(e.enter("htmlFlowData"),U(C))}function M(C){return C===45?(e.consume(C),E):U(C)}function q(C){return C===47?(e.consume(C),c="",W):U(C)}function W(C){if(C===62){const se=c.toLowerCase();return _y.includes(se)?(e.consume(C),A):U(C)}return ni(C)&&c.length<8?(e.consume(C),c+=String.fromCharCode(C),W):U(C)}function ue(C){return C===93?(e.consume(C),E):U(C)}function E(C){return C===62?(e.consume(C),A):C===45&&a===2?(e.consume(C),E):U(C)}function A(C){return C===null||ve(C)?(e.exit("htmlFlowData"),K(C)):(e.consume(C),A)}function K(C){return e.exit("htmlFlow"),t(C)}}function VE(e,t,n){const s=this;return a;function a(c){return ve(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),o):n(c)}function o(c){return s.parser.lazy[s.now().line]?n(c):t(c)}}function KE(e,t,n){return s;function s(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(ba,t,n)}}const XE={name:"htmlText",tokenize:$E};function $E(e,t,n){const s=this;let a,o,c;return f;function f(E){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(E),p}function p(E){return E===33?(e.consume(E),h):E===47?(e.consume(E),X):E===63?(e.consume(E),j):ni(E)?(e.consume(E),Z):n(E)}function h(E){return E===45?(e.consume(E),g):E===91?(e.consume(E),o=0,b):ni(E)?(e.consume(E),$):n(E)}function g(E){return E===45?(e.consume(E),y):n(E)}function _(E){return E===null?n(E):E===45?(e.consume(E),S):ve(E)?(c=_,q(E)):(e.consume(E),_)}function S(E){return E===45?(e.consume(E),y):_(E)}function y(E){return E===62?M(E):E===45?S(E):_(E)}function b(E){const A="CDATA[";return E===A.charCodeAt(o++)?(e.consume(E),o===A.length?k:b):n(E)}function k(E){return E===null?n(E):E===93?(e.consume(E),R):ve(E)?(c=k,q(E)):(e.consume(E),k)}function R(E){return E===93?(e.consume(E),T):k(E)}function T(E){return E===62?M(E):E===93?(e.consume(E),T):k(E)}function $(E){return E===null||E===62?M(E):ve(E)?(c=$,q(E)):(e.consume(E),$)}function j(E){return E===null?n(E):E===63?(e.consume(E),O):ve(E)?(c=j,q(E)):(e.consume(E),j)}function O(E){return E===62?M(E):j(E)}function X(E){return ni(E)?(e.consume(E),L):n(E)}function L(E){return E===45||$t(E)?(e.consume(E),L):re(E)}function re(E){return ve(E)?(c=re,q(E)):Le(E)?(e.consume(E),re):M(E)}function Z(E){return E===45||$t(E)?(e.consume(E),Z):E===47||E===62||Qe(E)?le(E):n(E)}function le(E){return E===47?(e.consume(E),M):E===58||E===95||ni(E)?(e.consume(E),z):ve(E)?(c=le,q(E)):Le(E)?(e.consume(E),le):M(E)}function z(E){return E===45||E===46||E===58||E===95||$t(E)?(e.consume(E),z):te(E)}function te(E){return E===61?(e.consume(E),U):ve(E)?(c=te,q(E)):Le(E)?(e.consume(E),te):le(E)}function U(E){return E===null||E===60||E===61||E===62||E===96?n(E):E===34||E===39?(e.consume(E),a=E,F):ve(E)?(c=U,q(E)):Le(E)?(e.consume(E),U):(e.consume(E),V)}function F(E){return E===a?(e.consume(E),a=void 0,H):E===null?n(E):ve(E)?(c=F,q(E)):(e.consume(E),F)}function V(E){return E===null||E===34||E===39||E===60||E===61||E===96?n(E):E===47||E===62||Qe(E)?le(E):(e.consume(E),V)}function H(E){return E===47||E===62||Qe(E)?le(E):n(E)}function M(E){return E===62?(e.consume(E),e.exit("htmlTextData"),e.exit("htmlText"),t):n(E)}function q(E){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),W}function W(E){return Le(E)?je(e,ue,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):ue(E)}function ue(E){return e.enter("htmlTextData"),c(E)}}const Pd={name:"labelEnd",resolveAll:JE,resolveTo:e5,tokenize:t5},GE={tokenize:i5},ZE={tokenize:n5},QE={tokenize:r5};function JE(e){let t=-1;const n=[];for(;++t<e.length;){const s=e[t][1];if(n.push(e[t]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const a=s.type==="labelImage"?4:2;s.type="data",t+=a}}return e.length!==n.length&&Mi(e,0,e.length,n),e}function e5(e,t){let n=e.length,s=0,a,o,c,f;for(;n--;)if(a=e[n][1],o){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(c){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(o=n,a.type!=="labelLink")){s=2;break}}else a.type==="labelEnd"&&(c=n);const p={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},h={type:"label",start:{...e[o][1].start},end:{...e[c][1].end}},g={type:"labelText",start:{...e[o+s+2][1].end},end:{...e[c-2][1].start}};return f=[["enter",p,t],["enter",h,t]],f=Yi(f,e.slice(o+1,o+s+3)),f=Yi(f,[["enter",g,t]]),f=Yi(f,wu(t.parser.constructs.insideSpan.null,e.slice(o+s+4,c-3),t)),f=Yi(f,[["exit",g,t],e[c-2],e[c-1],["exit",h,t]]),f=Yi(f,e.slice(c+1)),f=Yi(f,[["exit",p,t]]),Mi(e,o,e.length,f),e}function t5(e,t,n){const s=this;let a=s.events.length,o,c;for(;a--;)if((s.events[a][1].type==="labelImage"||s.events[a][1].type==="labelLink")&&!s.events[a][1]._balanced){o=s.events[a][1];break}return f;function f(S){return o?o._inactive?_(S):(c=s.parser.defined.includes(Qi(s.sliceSerialize({start:o.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(S),e.exit("labelMarker"),e.exit("labelEnd"),p):n(S)}function p(S){return S===40?e.attempt(GE,g,c?g:_)(S):S===91?e.attempt(ZE,g,c?h:_)(S):c?g(S):_(S)}function h(S){return e.attempt(QE,g,_)(S)}function g(S){return t(S)}function _(S){return o._balanced=!0,n(S)}}function i5(e,t,n){return s;function s(_){return e.enter("resource"),e.enter("resourceMarker"),e.consume(_),e.exit("resourceMarker"),a}function a(_){return Qe(_)?oa(e,o)(_):o(_)}function o(_){return _===41?g(_):fb(e,c,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(_)}function c(_){return Qe(_)?oa(e,p)(_):g(_)}function f(_){return n(_)}function p(_){return _===34||_===39||_===40?pb(e,h,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(_):g(_)}function h(_){return Qe(_)?oa(e,g)(_):g(_)}function g(_){return _===41?(e.enter("resourceMarker"),e.consume(_),e.exit("resourceMarker"),e.exit("resource"),t):n(_)}}function n5(e,t,n){const s=this;return a;function a(f){return db.call(s,e,o,c,"reference","referenceMarker","referenceString")(f)}function o(f){return s.parser.defined.includes(Qi(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(f):n(f)}function c(f){return n(f)}}function r5(e,t,n){return s;function s(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),a}function a(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const s5={name:"labelStartImage",resolveAll:Pd.resolveAll,tokenize:l5};function l5(e,t,n){const s=this;return a;function a(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),o}function o(f){return f===91?(e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelImage"),c):n(f)}function c(f){return f===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(f):t(f)}}const a5={name:"labelStartLink",resolveAll:Pd.resolveAll,tokenize:o5};function o5(e,t,n){const s=this;return a;function a(c){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelLink"),o}function o(c){return c===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(c):t(c)}}const ff={name:"lineEnding",tokenize:u5};function u5(e,t){return n;function n(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),je(e,t,"linePrefix")}}const au={name:"thematicBreak",tokenize:c5};function c5(e,t,n){let s=0,a;return o;function o(h){return e.enter("thematicBreak"),c(h)}function c(h){return a=h,f(h)}function f(h){return h===a?(e.enter("thematicBreakSequence"),p(h)):s>=3&&(h===null||ve(h))?(e.exit("thematicBreak"),t(h)):n(h)}function p(h){return h===a?(e.consume(h),s++,p):(e.exit("thematicBreakSequence"),Le(h)?je(e,f,"whitespace")(h):f(h))}}const _i={continuation:{tokenize:p5},exit:_5,name:"list",tokenize:d5},h5={partial:!0,tokenize:g5},f5={partial:!0,tokenize:m5};function d5(e,t,n){const s=this,a=s.events[s.events.length-1];let o=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,c=0;return f;function f(y){const b=s.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(b==="listUnordered"?!s.containerState.marker||y===s.containerState.marker:pd(y)){if(s.containerState.type||(s.containerState.type=b,e.enter(b,{_container:!0})),b==="listUnordered")return e.enter("listItemPrefix"),y===42||y===45?e.check(au,n,h)(y):h(y);if(!s.interrupt||y===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),p(y)}return n(y)}function p(y){return pd(y)&&++c<10?(e.consume(y),p):(!s.interrupt||c<2)&&(s.containerState.marker?y===s.containerState.marker:y===41||y===46)?(e.exit("listItemValue"),h(y)):n(y)}function h(y){return e.enter("listItemMarker"),e.consume(y),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||y,e.check(ba,s.interrupt?n:g,e.attempt(h5,S,_))}function g(y){return s.containerState.initialBlankLine=!0,o++,S(y)}function _(y){return Le(y)?(e.enter("listItemPrefixWhitespace"),e.consume(y),e.exit("listItemPrefixWhitespace"),S):n(y)}function S(y){return s.containerState.size=o+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(y)}}function p5(e,t,n){const s=this;return s.containerState._closeFlow=void 0,e.check(ba,a,o);function a(f){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,je(e,t,"listItemIndent",s.containerState.size+1)(f)}function o(f){return s.containerState.furtherBlankLines||!Le(f)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,c(f)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(f5,t,c)(f))}function c(f){return s.containerState._closeFlow=!0,s.interrupt=void 0,je(e,e.attempt(_i,t,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function m5(e,t,n){const s=this;return je(e,a,"listItemIndent",s.containerState.size+1);function a(o){const c=s.events[s.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===s.containerState.size?t(o):n(o)}}function _5(e){e.exit(this.containerState.type)}function g5(e,t,n){const s=this;return je(e,a,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(o){const c=s.events[s.events.length-1];return!Le(o)&&c&&c[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const gy={name:"setextUnderline",resolveTo:v5,tokenize:y5};function v5(e,t){let n=e.length,s,a,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){s=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const c={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",o?(e.splice(a,0,["enter",c,t]),e.splice(o+1,0,["exit",e[s][1],t]),e[s][1].end={...e[o][1].end}):e[s][1]=c,e.push(["exit",c,t]),e}function y5(e,t,n){const s=this;let a;return o;function o(h){let g=s.events.length,_;for(;g--;)if(s.events[g][1].type!=="lineEnding"&&s.events[g][1].type!=="linePrefix"&&s.events[g][1].type!=="content"){_=s.events[g][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||_)?(e.enter("setextHeadingLine"),a=h,c(h)):n(h)}function c(h){return e.enter("setextHeadingLineSequence"),f(h)}function f(h){return h===a?(e.consume(h),f):(e.exit("setextHeadingLineSequence"),Le(h)?je(e,p,"lineSuffix")(h):p(h))}function p(h){return h===null||ve(h)?(e.exit("setextHeadingLine"),t(h)):n(h)}}const S5={tokenize:b5};function b5(e){const t=this,n=e.attempt(ba,s,e.attempt(this.parser.constructs.flowInitial,a,je(e,e.attempt(this.parser.constructs.flow,a,e.attempt(EE,a)),"linePrefix")));return n;function s(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const x5={resolveAll:_b()},w5=mb("string"),C5=mb("text");function mb(e){return{resolveAll:_b(e==="text"?k5:void 0),tokenize:t};function t(n){const s=this,a=this.parser.constructs[e],o=n.attempt(a,c,f);return c;function c(g){return h(g)?o(g):f(g)}function f(g){if(g===null){n.consume(g);return}return n.enter("data"),n.consume(g),p}function p(g){return h(g)?(n.exit("data"),o(g)):(n.consume(g),p)}function h(g){if(g===null)return!0;const _=a[g];let S=-1;if(_)for(;++S<_.length;){const y=_[S];if(!y.previous||y.previous.call(s,s.previous))return!0}return!1}}}function _b(e){return t;function t(n,s){let a=-1,o;for(;++a<=n.length;)o===void 0?n[a]&&n[a][1].type==="data"&&(o=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==o+2&&(n[o][1].end=n[a-1][1].end,n.splice(o+2,a-o-2),a=o+2),o=void 0);return e?e(n,s):n}}function k5(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const s=e[n-1][1],a=t.sliceStream(s);let o=a.length,c=-1,f=0,p;for(;o--;){const h=a[o];if(typeof h=="string"){for(c=h.length;h.charCodeAt(c-1)===32;)f++,c--;if(c)break;c=-1}else if(h===-2)p=!0,f++;else if(h!==-1){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(f=0),f){const h={type:n===e.length||p||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?c:s.start._bufferIndex+c,_index:s.start._index+o,line:s.end.line,column:s.end.column-f,offset:s.end.offset-f},end:{...s.end}};s.end={...h.start},s.start.offset===s.end.offset?Object.assign(s,h):(e.splice(n,0,["enter",h,t],["exit",h,t]),n+=2)}n++}return e}const E5={42:_i,43:_i,45:_i,48:_i,49:_i,50:_i,51:_i,52:_i,53:_i,54:_i,55:_i,56:_i,57:_i,62:ob},T5={91:ME},A5={[-2]:hf,[-1]:hf,32:hf},D5={35:HE,42:au,45:[gy,au],60:IE,61:gy,95:au,96:my,126:my},R5={38:cb,92:ub},M5={[-5]:ff,[-4]:ff,[-3]:ff,33:s5,38:cb,42:md,60:[aE,XE],91:a5,92:[NE,ub],93:Pd,95:md,96:SE},B5={null:[md,x5]},L5={null:[42,95]},z5={null:[]},N5=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:L5,contentInitial:T5,disable:z5,document:E5,flow:D5,flowInitial:A5,insideSpan:B5,string:R5,text:M5},Symbol.toStringTag,{value:"Module"}));function O5(e,t,n){let s={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},o=[];let c=[],f=[];const p={attempt:re(X),check:re(L),consume:$,enter:j,exit:O,interrupt:re(L,{interrupt:!0})},h={code:null,containerState:{},defineSkip:k,events:[],now:b,parser:e,previous:null,sliceSerialize:S,sliceStream:y,write:_};let g=t.tokenize.call(h,p);return t.resolveAll&&o.push(t),h;function _(te){return c=Yi(c,te),R(),c[c.length-1]!==null?[]:(Z(t,0),h.events=wu(o,h.events,h),h.events)}function S(te,U){return j5(y(te),U)}function y(te){return H5(c,te)}function b(){const{_bufferIndex:te,_index:U,line:F,column:V,offset:H}=s;return{_bufferIndex:te,_index:U,line:F,column:V,offset:H}}function k(te){a[te.line]=te.column,z()}function R(){let te;for(;s._index<c.length;){const U=c[s._index];if(typeof U=="string")for(te=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===te&&s._bufferIndex<U.length;)T(U.charCodeAt(s._bufferIndex));else T(U)}}function T(te){g=g(te)}function $(te){ve(te)?(s.line++,s.column=1,s.offset+=te===-3?2:1,z()):te!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===c[s._index].length&&(s._bufferIndex=-1,s._index++)),h.previous=te}function j(te,U){const F=U||{};return F.type=te,F.start=b(),h.events.push(["enter",F,h]),f.push(F),F}function O(te){const U=f.pop();return U.end=b(),h.events.push(["exit",U,h]),U}function X(te,U){Z(te,U.from)}function L(te,U){U.restore()}function re(te,U){return F;function F(V,H,M){let q,W,ue,E;return Array.isArray(V)?K(V):"tokenize"in V?K([V]):A(V);function A(pe){return xe;function xe(Ye){const De=Ye!==null&&pe[Ye],Ht=Ye!==null&&pe.null,Zt=[...Array.isArray(De)?De:De?[De]:[],...Array.isArray(Ht)?Ht:Ht?[Ht]:[]];return K(Zt)(Ye)}}function K(pe){return q=pe,W=0,pe.length===0?M:C(pe[W])}function C(pe){return xe;function xe(Ye){return E=le(),ue=pe,pe.partial||(h.currentConstruct=pe),pe.name&&h.parser.constructs.disable.null.includes(pe.name)?fe():pe.tokenize.call(U?Object.assign(Object.create(h),U):h,p,se,fe)(Ye)}}function se(pe){return te(ue,E),H}function fe(pe){return E.restore(),++W<q.length?C(q[W]):M}}}function Z(te,U){te.resolveAll&&!o.includes(te)&&o.push(te),te.resolve&&Mi(h.events,U,h.events.length-U,te.resolve(h.events.slice(U),h)),te.resolveTo&&(h.events=te.resolveTo(h.events,h))}function le(){const te=b(),U=h.previous,F=h.currentConstruct,V=h.events.length,H=Array.from(f);return{from:V,restore:M};function M(){s=te,h.previous=U,h.currentConstruct=F,h.events.length=V,f=H,z()}}function z(){s.line in a&&s.column<2&&(s.column=a[s.line],s.offset+=a[s.line]-1)}}function H5(e,t){const n=t.start._index,s=t.start._bufferIndex,a=t.end._index,o=t.end._bufferIndex;let c;if(n===a)c=[e[n].slice(s,o)];else{if(c=e.slice(n,a),s>-1){const f=c[0];typeof f=="string"?c[0]=f.slice(s):c.shift()}o>0&&c.push(e[a].slice(0,o))}return c}function j5(e,t){let n=-1;const s=[];let a;for(;++n<e.length;){const o=e[n];let c;if(typeof o=="string")c=o;else switch(o){case-5:{c="\r";break}case-4:{c=`
102
102
  `;break}case-3:{c=`\r
103
- `;break}case-2:{c=t?" ":" ";break}case-1:{if(!t&&a)continue;c=" ";break}default:c=String.fromCharCode(o)}a=o===-2,s.push(c)}return s.join("")}function U5(e){const s={constructs:lb([N5,...(e||{}).extensions||[]]),content:a(eE),defined:[],document:a(iE),flow:a(S5),lazy:{},string:a(w5),text:a(C5)};return s;function a(o){return c;function c(f){return O5(s,o,f)}}}function P5(e){for(;!hb(e););return e}const vy=/[\0\t\n\r]/g;function I5(){let e=1,t="",n=!0,s;return a;function a(o,c,f){const p=[];let h,g,m,S,v;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(c||void 0).decode(o)),m=0,t="",n&&(o.charCodeAt(0)===65279&&m++,n=void 0);m<o.length;){if(vy.lastIndex=m,h=vy.exec(o),S=h&&h.index!==void 0?h.index:o.length,v=o.charCodeAt(S),!h){t=o.slice(m);break}if(v===10&&m===S&&s)p.push(-3),s=void 0;else switch(s&&(p.push(-5),s=void 0),m<S&&(p.push(o.slice(m,S)),e+=S-m),v){case 0:{p.push(65533),e++;break}case 9:{for(g=Math.ceil(e/4)*4,p.push(-2);e++<g;)p.push(-1);break}case 10:{p.push(-4),e=1;break}default:s=!0,e=1}m=S+1}return f&&(s&&p.push(-5),t&&p.push(t),p.push(null)),p}}const F5=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function q5(e){return e.replace(F5,W5)}function W5(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),o=a===120||a===88;return ab(n.slice(o?2:1),o?16:10)}return Ud(n)||e}const gb={}.hasOwnProperty;function Y5(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),V5(n)(P5(U5(n).document().write(I5()(e,t,!0))))}function V5(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(Zr),autolinkProtocol:he,autolinkEmail:he,atxHeading:o($r),blockQuote:o(Ht),characterEscape:he,characterReference:he,codeFenced:o(Zt),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:o(Zt,c),codeText:o(li,c),codeTextData:he,data:he,codeFlowValue:he,definition:o(He),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:o(vi),hardBreakEscape:o(Gr),hardBreakTrailing:o(Gr),htmlFlow:o(Ca,c),htmlFlowData:he,htmlText:o(Ca,c),htmlTextData:he,image:o(ka),label:c,link:o(Zr),listItem:o(Zs),listItemValue:S,listOrdered:o(Qr,m),listUnordered:o(Qr),paragraph:o(Tu),reference:C,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:o($r),strong:o(Au),thematicBreak:o(Du)},exit:{atxHeading:p(),atxHeadingSequence:$,autolink:p(),autolinkEmail:De,autolinkProtocol:Ye,blockQuote:p(),characterEscapeValue:j,characterReferenceMarkerHexadecimal:_e,characterReferenceMarkerNumeric:_e,characterReferenceValue:de,characterReference:xe,codeFenced:p(B),codeFencedFence:k,codeFencedFenceInfo:v,codeFencedFenceMeta:b,codeFlowValue:j,codeIndented:p(D),codeText:p(H),codeTextData:j,data:j,definition:p(),definitionDestinationString:N,definitionLabelString:G,definitionTitleString:A,emphasis:p(),hardBreakEscape:p(Y),hardBreakTrailing:p(Y),htmlFlow:p(U),htmlFlowData:j,htmlText:p(K),htmlTextData:j,image:p(F),label:oe,labelText:V,lineEnding:ne,link:p(M),listItem:p(),listOrdered:p(),listUnordered:p(),paragraph:p(),referenceString:ae,resourceDestinationString:E,resourceTitleString:T,resource:q,setextHeading:p(se),setextHeadingLineSequence:Q,setextHeadingText:z,strong:p(),thematicBreak:p()}};vb(t,(e||{}).mdastExtensions||[]);const n={};return s;function s(J){let ce={type:"root",children:[]};const Se={stack:[ce],tokenStack:[],config:t,enter:f,exit:h,buffer:c,resume:g,data:n},Re=[];let Fe=-1;for(;++Fe<J.length;)if(J[Fe][1].type==="listOrdered"||J[Fe][1].type==="listUnordered")if(J[Fe][0]==="enter")Re.push(Fe);else{const yi=Re.pop();Fe=a(J,yi,Fe)}for(Fe=-1;++Fe<J.length;){const yi=t[J[Fe][0]];gb.call(yi,J[Fe][1].type)&&yi[J[Fe][1].type].call(Object.assign({sliceSerialize:J[Fe][2].sliceSerialize},Se),J[Fe][1])}if(Se.tokenStack.length>0){const yi=Se.tokenStack[Se.tokenStack.length-1];(yi[1]||yy).call(Se,void 0,yi[0])}for(ce.position={start:fr(J.length>0?J[0][1].start:{line:1,column:1,offset:0}),end:fr(J.length>0?J[J.length-2][1].end:{line:1,column:1,offset:0})},Fe=-1;++Fe<t.transforms.length;)ce=t.transforms[Fe](ce)||ce;return ce}function a(J,ce,Se){let Re=ce-1,Fe=-1,yi=!1,fn,Jt,xt,ai;for(;++Re<=Se;){const Ge=J[Re];switch(Ge[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ge[0]==="enter"?Fe++:Fe--,ai=void 0;break}case"lineEndingBlank":{Ge[0]==="enter"&&(fn&&!ai&&!Fe&&!xt&&(xt=Re),ai=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ai=void 0}if(!Fe&&Ge[0]==="enter"&&Ge[1].type==="listItemPrefix"||Fe===-1&&Ge[0]==="exit"&&(Ge[1].type==="listUnordered"||Ge[1].type==="listOrdered")){if(fn){let jn=Re;for(Jt=void 0;jn--;){const Ki=J[jn];if(Ki[1].type==="lineEnding"||Ki[1].type==="lineEndingBlank"){if(Ki[0]==="exit")continue;Jt&&(J[Jt][1].type="lineEndingBlank",yi=!0),Ki[1].type="lineEnding",Jt=jn}else if(!(Ki[1].type==="linePrefix"||Ki[1].type==="blockQuotePrefix"||Ki[1].type==="blockQuotePrefixWhitespace"||Ki[1].type==="blockQuoteMarker"||Ki[1].type==="listItemIndent"))break}xt&&(!Jt||xt<Jt)&&(fn._spread=!0),fn.end=Object.assign({},Jt?J[Jt][1].start:Ge[1].end),J.splice(Jt||Re,0,["exit",fn,Ge[2]]),Re++,Se++}if(Ge[1].type==="listItemPrefix"){const jn={type:"listItem",_spread:!1,start:Object.assign({},Ge[1].start),end:void 0};fn=jn,J.splice(Re,0,["enter",jn,Ge[2]]),Re++,Se++,xt=void 0,ai=!0}}}return J[ce][1]._spread=yi,Se}function o(J,ce){return Se;function Se(Re){f.call(this,J(Re),Re),ce&&ce.call(this,Re)}}function c(){this.stack.push({type:"fragment",children:[]})}function f(J,ce,Se){this.stack[this.stack.length-1].children.push(J),this.stack.push(J),this.tokenStack.push([ce,Se||void 0]),J.position={start:fr(ce.start),end:void 0}}function p(J){return ce;function ce(Se){J&&J.call(this,Se),h.call(this,Se)}}function h(J,ce){const Se=this.stack.pop(),Re=this.tokenStack.pop();if(Re)Re[0].type!==J.type&&(ce?ce.call(this,J,Re[0]):(Re[1]||yy).call(this,J,Re[0]));else throw new Error("Cannot close `"+J.type+"` ("+aa({start:J.start,end:J.end})+"): it’s not open");Se.position.end=fr(J.end)}function g(){return jd(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function S(J){if(this.data.expectingFirstListItemValue){const ce=this.stack[this.stack.length-2];ce.start=Number.parseInt(this.sliceSerialize(J),10),this.data.expectingFirstListItemValue=void 0}}function v(){const J=this.resume(),ce=this.stack[this.stack.length-1];ce.lang=J}function b(){const J=this.resume(),ce=this.stack[this.stack.length-1];ce.meta=J}function k(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function B(){const J=this.resume(),ce=this.stack[this.stack.length-1];ce.value=J.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function D(){const J=this.resume(),ce=this.stack[this.stack.length-1];ce.value=J.replace(/(\r?\n|\r)$/g,"")}function G(J){const ce=this.resume(),Se=this.stack[this.stack.length-1];Se.label=ce,Se.identifier=Qi(this.sliceSerialize(J)).toLowerCase()}function A(){const J=this.resume(),ce=this.stack[this.stack.length-1];ce.title=J}function N(){const J=this.resume(),ce=this.stack[this.stack.length-1];ce.url=J}function $(J){const ce=this.stack[this.stack.length-1];if(!ce.depth){const Se=this.sliceSerialize(J).length;ce.depth=Se}}function z(){this.data.setextHeadingSlurpLineEnding=!0}function Q(J){const ce=this.stack[this.stack.length-1];ce.depth=this.sliceSerialize(J).codePointAt(0)===61?1:2}function se(){this.data.setextHeadingSlurpLineEnding=void 0}function he(J){const Se=this.stack[this.stack.length-1].children;let Re=Se[Se.length-1];(!Re||Re.type!=="text")&&(Re=Qt(),Re.position={start:fr(J.start),end:void 0},Se.push(Re)),this.stack.push(Re)}function j(J){const ce=this.stack.pop();ce.value+=this.sliceSerialize(J),ce.position.end=fr(J.end)}function ne(J){const ce=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Se=ce.children[ce.children.length-1];Se.position.end=fr(J.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ce.type)&&(he.call(this,J),j.call(this,J))}function Y(){this.data.atHardBreak=!0}function U(){const J=this.resume(),ce=this.stack[this.stack.length-1];ce.value=J}function K(){const J=this.resume(),ce=this.stack[this.stack.length-1];ce.value=J}function H(){const J=this.resume(),ce=this.stack[this.stack.length-1];ce.value=J}function M(){const J=this.stack[this.stack.length-1];if(this.data.inReference){const ce=this.data.referenceType||"shortcut";J.type+="Reference",J.referenceType=ce,delete J.url,delete J.title}else delete J.identifier,delete J.label;this.data.referenceType=void 0}function F(){const J=this.stack[this.stack.length-1];if(this.data.inReference){const ce=this.data.referenceType||"shortcut";J.type+="Reference",J.referenceType=ce,delete J.url,delete J.title}else delete J.identifier,delete J.label;this.data.referenceType=void 0}function V(J){const ce=this.sliceSerialize(J),Se=this.stack[this.stack.length-2];Se.label=q5(ce),Se.identifier=Qi(ce).toLowerCase()}function oe(){const J=this.stack[this.stack.length-1],ce=this.resume(),Se=this.stack[this.stack.length-1];if(this.data.inReference=!0,Se.type==="link"){const Re=J.children;Se.children=Re}else Se.alt=ce}function E(){const J=this.resume(),ce=this.stack[this.stack.length-1];ce.url=J}function T(){const J=this.resume(),ce=this.stack[this.stack.length-1];ce.title=J}function q(){this.data.inReference=void 0}function C(){this.data.referenceType="collapsed"}function ae(J){const ce=this.resume(),Se=this.stack[this.stack.length-1];Se.label=ce,Se.identifier=Qi(this.sliceSerialize(J)).toLowerCase(),this.data.referenceType="full"}function _e(J){this.data.characterReferenceType=J.type}function de(J){const ce=this.sliceSerialize(J),Se=this.data.characterReferenceType;let Re;Se?(Re=ab(ce,Se==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Re=Ud(ce);const Fe=this.stack[this.stack.length-1];Fe.value+=Re}function xe(J){const ce=this.stack.pop();ce.position.end=fr(J.end)}function Ye(J){j.call(this,J);const ce=this.stack[this.stack.length-1];ce.url=this.sliceSerialize(J)}function De(J){j.call(this,J);const ce=this.stack[this.stack.length-1];ce.url="mailto:"+this.sliceSerialize(J)}function Ht(){return{type:"blockquote",children:[]}}function Zt(){return{type:"code",lang:null,meta:null,value:""}}function li(){return{type:"inlineCode",value:""}}function He(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function vi(){return{type:"emphasis",children:[]}}function $r(){return{type:"heading",depth:0,children:[]}}function Gr(){return{type:"break"}}function Ca(){return{type:"html",value:""}}function ka(){return{type:"image",title:null,url:"",alt:null}}function Zr(){return{type:"link",title:null,url:"",children:[]}}function Qr(J){return{type:"list",ordered:J.type==="listOrdered",start:null,spread:J._spread,children:[]}}function Zs(J){return{type:"listItem",spread:J._spread,checked:null,children:[]}}function Tu(){return{type:"paragraph",children:[]}}function Au(){return{type:"strong",children:[]}}function Qt(){return{type:"text",value:""}}function Du(){return{type:"thematicBreak"}}}function fr(e){return{line:e.line,column:e.column,offset:e.offset}}function vb(e,t){let n=-1;for(;++n<t.length;){const s=t[n];Array.isArray(s)?vb(e,s):K5(e,s)}}function K5(e,t){let n;for(n in t)if(gb.call(t,n))switch(n){case"canContainEols":{const s=t[n];s&&e[n].push(...s);break}case"transforms":{const s=t[n];s&&e[n].push(...s);break}case"enter":case"exit":{const s=t[n];s&&Object.assign(e[n],s);break}}}function yy(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+aa({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+aa({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+aa({start:t.start,end:t.end})+") is still open")}function X5(e){const t=this;t.parser=n;function n(s){return Y5(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function $5(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function G5(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
103
+ `;break}case-2:{c=t?" ":" ";break}case-1:{if(!t&&a)continue;c=" ";break}default:c=String.fromCharCode(o)}a=o===-2,s.push(c)}return s.join("")}function U5(e){const s={constructs:lb([N5,...(e||{}).extensions||[]]),content:a(eE),defined:[],document:a(iE),flow:a(S5),lazy:{},string:a(w5),text:a(C5)};return s;function a(o){return c;function c(f){return O5(s,o,f)}}}function P5(e){for(;!hb(e););return e}const vy=/[\0\t\n\r]/g;function I5(){let e=1,t="",n=!0,s;return a;function a(o,c,f){const p=[];let h,g,_,S,y;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(c||void 0).decode(o)),_=0,t="",n&&(o.charCodeAt(0)===65279&&_++,n=void 0);_<o.length;){if(vy.lastIndex=_,h=vy.exec(o),S=h&&h.index!==void 0?h.index:o.length,y=o.charCodeAt(S),!h){t=o.slice(_);break}if(y===10&&_===S&&s)p.push(-3),s=void 0;else switch(s&&(p.push(-5),s=void 0),_<S&&(p.push(o.slice(_,S)),e+=S-_),y){case 0:{p.push(65533),e++;break}case 9:{for(g=Math.ceil(e/4)*4,p.push(-2);e++<g;)p.push(-1);break}case 10:{p.push(-4),e=1;break}default:s=!0,e=1}_=S+1}return f&&(s&&p.push(-5),t&&p.push(t),p.push(null)),p}}const F5=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function q5(e){return e.replace(F5,W5)}function W5(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),o=a===120||a===88;return ab(n.slice(o?2:1),o?16:10)}return Ud(n)||e}const gb={}.hasOwnProperty;function Y5(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),V5(n)(P5(U5(n).document().write(I5()(e,t,!0))))}function V5(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(Zr),autolinkProtocol:le,autolinkEmail:le,atxHeading:o($r),blockQuote:o(Ht),characterEscape:le,characterReference:le,codeFenced:o(Zt),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:o(Zt,c),codeText:o(li,c),codeTextData:le,data:le,codeFlowValue:le,definition:o(He),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:o(vi),hardBreakEscape:o(Gr),hardBreakTrailing:o(Gr),htmlFlow:o(Ca,c),htmlFlowData:le,htmlText:o(Ca,c),htmlTextData:le,image:o(ka),label:c,link:o(Zr),listItem:o(Zs),listItemValue:S,listOrdered:o(Qr,_),listUnordered:o(Qr),paragraph:o(Tu),reference:C,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:o($r),strong:o(Au),thematicBreak:o(Du)},exit:{atxHeading:p(),atxHeadingSequence:X,autolink:p(),autolinkEmail:De,autolinkProtocol:Ye,blockQuote:p(),characterEscapeValue:z,characterReferenceMarkerHexadecimal:fe,characterReferenceMarkerNumeric:fe,characterReferenceValue:pe,characterReference:xe,codeFenced:p(R),codeFencedFence:k,codeFencedFenceInfo:y,codeFencedFenceMeta:b,codeFlowValue:z,codeIndented:p(T),codeText:p(H),codeTextData:z,data:z,definition:p(),definitionDestinationString:O,definitionLabelString:$,definitionTitleString:j,emphasis:p(),hardBreakEscape:p(U),hardBreakTrailing:p(U),htmlFlow:p(F),htmlFlowData:z,htmlText:p(V),htmlTextData:z,image:p(q),label:ue,labelText:W,lineEnding:te,link:p(M),listItem:p(),listOrdered:p(),listUnordered:p(),paragraph:p(),referenceString:se,resourceDestinationString:E,resourceTitleString:A,resource:K,setextHeading:p(Z),setextHeadingLineSequence:re,setextHeadingText:L,strong:p(),thematicBreak:p()}};vb(t,(e||{}).mdastExtensions||[]);const n={};return s;function s(J){let he={type:"root",children:[]};const Se={stack:[he],tokenStack:[],config:t,enter:f,exit:h,buffer:c,resume:g,data:n},Re=[];let Fe=-1;for(;++Fe<J.length;)if(J[Fe][1].type==="listOrdered"||J[Fe][1].type==="listUnordered")if(J[Fe][0]==="enter")Re.push(Fe);else{const yi=Re.pop();Fe=a(J,yi,Fe)}for(Fe=-1;++Fe<J.length;){const yi=t[J[Fe][0]];gb.call(yi,J[Fe][1].type)&&yi[J[Fe][1].type].call(Object.assign({sliceSerialize:J[Fe][2].sliceSerialize},Se),J[Fe][1])}if(Se.tokenStack.length>0){const yi=Se.tokenStack[Se.tokenStack.length-1];(yi[1]||yy).call(Se,void 0,yi[0])}for(he.position={start:fr(J.length>0?J[0][1].start:{line:1,column:1,offset:0}),end:fr(J.length>0?J[J.length-2][1].end:{line:1,column:1,offset:0})},Fe=-1;++Fe<t.transforms.length;)he=t.transforms[Fe](he)||he;return he}function a(J,he,Se){let Re=he-1,Fe=-1,yi=!1,fn,Jt,xt,ai;for(;++Re<=Se;){const Ge=J[Re];switch(Ge[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ge[0]==="enter"?Fe++:Fe--,ai=void 0;break}case"lineEndingBlank":{Ge[0]==="enter"&&(fn&&!ai&&!Fe&&!xt&&(xt=Re),ai=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ai=void 0}if(!Fe&&Ge[0]==="enter"&&Ge[1].type==="listItemPrefix"||Fe===-1&&Ge[0]==="exit"&&(Ge[1].type==="listUnordered"||Ge[1].type==="listOrdered")){if(fn){let jn=Re;for(Jt=void 0;jn--;){const Ki=J[jn];if(Ki[1].type==="lineEnding"||Ki[1].type==="lineEndingBlank"){if(Ki[0]==="exit")continue;Jt&&(J[Jt][1].type="lineEndingBlank",yi=!0),Ki[1].type="lineEnding",Jt=jn}else if(!(Ki[1].type==="linePrefix"||Ki[1].type==="blockQuotePrefix"||Ki[1].type==="blockQuotePrefixWhitespace"||Ki[1].type==="blockQuoteMarker"||Ki[1].type==="listItemIndent"))break}xt&&(!Jt||xt<Jt)&&(fn._spread=!0),fn.end=Object.assign({},Jt?J[Jt][1].start:Ge[1].end),J.splice(Jt||Re,0,["exit",fn,Ge[2]]),Re++,Se++}if(Ge[1].type==="listItemPrefix"){const jn={type:"listItem",_spread:!1,start:Object.assign({},Ge[1].start),end:void 0};fn=jn,J.splice(Re,0,["enter",jn,Ge[2]]),Re++,Se++,xt=void 0,ai=!0}}}return J[he][1]._spread=yi,Se}function o(J,he){return Se;function Se(Re){f.call(this,J(Re),Re),he&&he.call(this,Re)}}function c(){this.stack.push({type:"fragment",children:[]})}function f(J,he,Se){this.stack[this.stack.length-1].children.push(J),this.stack.push(J),this.tokenStack.push([he,Se||void 0]),J.position={start:fr(he.start),end:void 0}}function p(J){return he;function he(Se){J&&J.call(this,Se),h.call(this,Se)}}function h(J,he){const Se=this.stack.pop(),Re=this.tokenStack.pop();if(Re)Re[0].type!==J.type&&(he?he.call(this,J,Re[0]):(Re[1]||yy).call(this,J,Re[0]));else throw new Error("Cannot close `"+J.type+"` ("+aa({start:J.start,end:J.end})+"): it’s not open");Se.position.end=fr(J.end)}function g(){return jd(this.stack.pop())}function _(){this.data.expectingFirstListItemValue=!0}function S(J){if(this.data.expectingFirstListItemValue){const he=this.stack[this.stack.length-2];he.start=Number.parseInt(this.sliceSerialize(J),10),this.data.expectingFirstListItemValue=void 0}}function y(){const J=this.resume(),he=this.stack[this.stack.length-1];he.lang=J}function b(){const J=this.resume(),he=this.stack[this.stack.length-1];he.meta=J}function k(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function R(){const J=this.resume(),he=this.stack[this.stack.length-1];he.value=J.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function T(){const J=this.resume(),he=this.stack[this.stack.length-1];he.value=J.replace(/(\r?\n|\r)$/g,"")}function $(J){const he=this.resume(),Se=this.stack[this.stack.length-1];Se.label=he,Se.identifier=Qi(this.sliceSerialize(J)).toLowerCase()}function j(){const J=this.resume(),he=this.stack[this.stack.length-1];he.title=J}function O(){const J=this.resume(),he=this.stack[this.stack.length-1];he.url=J}function X(J){const he=this.stack[this.stack.length-1];if(!he.depth){const Se=this.sliceSerialize(J).length;he.depth=Se}}function L(){this.data.setextHeadingSlurpLineEnding=!0}function re(J){const he=this.stack[this.stack.length-1];he.depth=this.sliceSerialize(J).codePointAt(0)===61?1:2}function Z(){this.data.setextHeadingSlurpLineEnding=void 0}function le(J){const Se=this.stack[this.stack.length-1].children;let Re=Se[Se.length-1];(!Re||Re.type!=="text")&&(Re=Qt(),Re.position={start:fr(J.start),end:void 0},Se.push(Re)),this.stack.push(Re)}function z(J){const he=this.stack.pop();he.value+=this.sliceSerialize(J),he.position.end=fr(J.end)}function te(J){const he=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Se=he.children[he.children.length-1];Se.position.end=fr(J.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(he.type)&&(le.call(this,J),z.call(this,J))}function U(){this.data.atHardBreak=!0}function F(){const J=this.resume(),he=this.stack[this.stack.length-1];he.value=J}function V(){const J=this.resume(),he=this.stack[this.stack.length-1];he.value=J}function H(){const J=this.resume(),he=this.stack[this.stack.length-1];he.value=J}function M(){const J=this.stack[this.stack.length-1];if(this.data.inReference){const he=this.data.referenceType||"shortcut";J.type+="Reference",J.referenceType=he,delete J.url,delete J.title}else delete J.identifier,delete J.label;this.data.referenceType=void 0}function q(){const J=this.stack[this.stack.length-1];if(this.data.inReference){const he=this.data.referenceType||"shortcut";J.type+="Reference",J.referenceType=he,delete J.url,delete J.title}else delete J.identifier,delete J.label;this.data.referenceType=void 0}function W(J){const he=this.sliceSerialize(J),Se=this.stack[this.stack.length-2];Se.label=q5(he),Se.identifier=Qi(he).toLowerCase()}function ue(){const J=this.stack[this.stack.length-1],he=this.resume(),Se=this.stack[this.stack.length-1];if(this.data.inReference=!0,Se.type==="link"){const Re=J.children;Se.children=Re}else Se.alt=he}function E(){const J=this.resume(),he=this.stack[this.stack.length-1];he.url=J}function A(){const J=this.resume(),he=this.stack[this.stack.length-1];he.title=J}function K(){this.data.inReference=void 0}function C(){this.data.referenceType="collapsed"}function se(J){const he=this.resume(),Se=this.stack[this.stack.length-1];Se.label=he,Se.identifier=Qi(this.sliceSerialize(J)).toLowerCase(),this.data.referenceType="full"}function fe(J){this.data.characterReferenceType=J.type}function pe(J){const he=this.sliceSerialize(J),Se=this.data.characterReferenceType;let Re;Se?(Re=ab(he,Se==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Re=Ud(he);const Fe=this.stack[this.stack.length-1];Fe.value+=Re}function xe(J){const he=this.stack.pop();he.position.end=fr(J.end)}function Ye(J){z.call(this,J);const he=this.stack[this.stack.length-1];he.url=this.sliceSerialize(J)}function De(J){z.call(this,J);const he=this.stack[this.stack.length-1];he.url="mailto:"+this.sliceSerialize(J)}function Ht(){return{type:"blockquote",children:[]}}function Zt(){return{type:"code",lang:null,meta:null,value:""}}function li(){return{type:"inlineCode",value:""}}function He(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function vi(){return{type:"emphasis",children:[]}}function $r(){return{type:"heading",depth:0,children:[]}}function Gr(){return{type:"break"}}function Ca(){return{type:"html",value:""}}function ka(){return{type:"image",title:null,url:"",alt:null}}function Zr(){return{type:"link",title:null,url:"",children:[]}}function Qr(J){return{type:"list",ordered:J.type==="listOrdered",start:null,spread:J._spread,children:[]}}function Zs(J){return{type:"listItem",spread:J._spread,checked:null,children:[]}}function Tu(){return{type:"paragraph",children:[]}}function Au(){return{type:"strong",children:[]}}function Qt(){return{type:"text",value:""}}function Du(){return{type:"thematicBreak"}}}function fr(e){return{line:e.line,column:e.column,offset:e.offset}}function vb(e,t){let n=-1;for(;++n<t.length;){const s=t[n];Array.isArray(s)?vb(e,s):K5(e,s)}}function K5(e,t){let n;for(n in t)if(gb.call(t,n))switch(n){case"canContainEols":{const s=t[n];s&&e[n].push(...s);break}case"transforms":{const s=t[n];s&&e[n].push(...s);break}case"enter":case"exit":{const s=t[n];s&&Object.assign(e[n],s);break}}}function yy(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+aa({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+aa({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+aa({start:t.start,end:t.end})+") is still open")}function X5(e){const t=this;t.parser=n;function n(s){return Y5(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function $5(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function G5(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
104
104
  `}]}function Z5(e,t){const n=t.value?t.value+`
105
- `:"",s={},a=t.lang?t.lang.split(/\s+/):[];a.length>0&&(s.className=["language-"+a[0]]);let o={type:"element",tagName:"code",properties:s,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function Q5(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function J5(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function eT(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),a=Gs(s.toLowerCase()),o=e.footnoteOrder.indexOf(s);let c,f=e.footnoteCounts.get(s);f===void 0?(f=0,e.footnoteOrder.push(s),c=e.footnoteOrder.length):c=o+1,f+=1,e.footnoteCounts.set(s,f);const p={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(f>1?"-"+f:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(c)}]};e.patch(t,p);const h={type:"element",tagName:"sup",properties:{},children:[p]};return e.patch(t,h),e.applyData(t,h)}function tT(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function iT(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function yb(e,t){const n=t.referenceType;let s="]";if(n==="collapsed"?s+="[]":n==="full"&&(s+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+s}];const a=e.all(t),o=a[0];o&&o.type==="text"?o.value="["+o.value:a.unshift({type:"text",value:"["});const c=a[a.length-1];return c&&c.type==="text"?c.value+=s:a.push({type:"text",value:s}),a}function nT(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return yb(e,t);const a={src:Gs(s.url||""),alt:t.alt};s.title!==null&&s.title!==void 0&&(a.title=s.title);const o={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,o),e.applyData(t,o)}function rT(e,t){const n={src:Gs(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,s),e.applyData(t,s)}function sT(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const s={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,s),e.applyData(t,s)}function lT(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return yb(e,t);const a={href:Gs(s.url||"")};s.title!==null&&s.title!==void 0&&(a.title=s.title);const o={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function aT(e,t){const n={href:Gs(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function oT(e,t,n){const s=e.all(t),a=n?uT(n):Sb(t),o={},c=[];if(typeof t.checked=="boolean"){const g=s[0];let m;g&&g.type==="element"&&g.tagName==="p"?m=g:(m={type:"element",tagName:"p",properties:{},children:[]},s.unshift(m)),m.children.length>0&&m.children.unshift({type:"text",value:" "}),m.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let f=-1;for(;++f<s.length;){const g=s[f];(a||f!==0||g.type!=="element"||g.tagName!=="p")&&c.push({type:"text",value:`
105
+ `:"",s={},a=t.lang?t.lang.split(/\s+/):[];a.length>0&&(s.className=["language-"+a[0]]);let o={type:"element",tagName:"code",properties:s,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function Q5(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function J5(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function eT(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),a=Gs(s.toLowerCase()),o=e.footnoteOrder.indexOf(s);let c,f=e.footnoteCounts.get(s);f===void 0?(f=0,e.footnoteOrder.push(s),c=e.footnoteOrder.length):c=o+1,f+=1,e.footnoteCounts.set(s,f);const p={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(f>1?"-"+f:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(c)}]};e.patch(t,p);const h={type:"element",tagName:"sup",properties:{},children:[p]};return e.patch(t,h),e.applyData(t,h)}function tT(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function iT(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function yb(e,t){const n=t.referenceType;let s="]";if(n==="collapsed"?s+="[]":n==="full"&&(s+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+s}];const a=e.all(t),o=a[0];o&&o.type==="text"?o.value="["+o.value:a.unshift({type:"text",value:"["});const c=a[a.length-1];return c&&c.type==="text"?c.value+=s:a.push({type:"text",value:s}),a}function nT(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return yb(e,t);const a={src:Gs(s.url||""),alt:t.alt};s.title!==null&&s.title!==void 0&&(a.title=s.title);const o={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,o),e.applyData(t,o)}function rT(e,t){const n={src:Gs(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,s),e.applyData(t,s)}function sT(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const s={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,s),e.applyData(t,s)}function lT(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return yb(e,t);const a={href:Gs(s.url||"")};s.title!==null&&s.title!==void 0&&(a.title=s.title);const o={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function aT(e,t){const n={href:Gs(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function oT(e,t,n){const s=e.all(t),a=n?uT(n):Sb(t),o={},c=[];if(typeof t.checked=="boolean"){const g=s[0];let _;g&&g.type==="element"&&g.tagName==="p"?_=g:(_={type:"element",tagName:"p",properties:{},children:[]},s.unshift(_)),_.children.length>0&&_.children.unshift({type:"text",value:" "}),_.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let f=-1;for(;++f<s.length;){const g=s[f];(a||f!==0||g.type!=="element"||g.tagName!=="p")&&c.push({type:"text",value:`
106
106
  `}),g.type==="element"&&g.tagName==="p"&&!a?c.push(...g.children):c.push(g)}const p=s[s.length-1];p&&(a||p.type!=="element"||p.tagName!=="p")&&c.push({type:"text",value:`
107
- `});const h={type:"element",tagName:"li",properties:o,children:c};return e.patch(t,h),e.applyData(t,h)}function uT(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let s=-1;for(;!t&&++s<n.length;)t=Sb(n[s])}return t}function Sb(e){const t=e.spread;return t??e.children.length>1}function cT(e,t){const n={},s=e.all(t);let a=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++a<s.length;){const c=s[a];if(c.type==="element"&&c.tagName==="li"&&c.properties&&Array.isArray(c.properties.className)&&c.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(s,!0)};return e.patch(t,o),e.applyData(t,o)}function hT(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function fT(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function dT(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function pT(e,t){const n=e.all(t),s=n.shift(),a=[];if(s){const c={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!0)};e.patch(t.children[0],c),a.push(c)}if(n.length>0){const c={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},f=zd(t.children[1]),p=QS(t.children[t.children.length-1]);f&&p&&(c.position={start:f,end:p}),a.push(c)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,o),e.applyData(t,o)}function _T(e,t,n){const s=n?n.children:void 0,o=(s?s.indexOf(t):1)===0?"th":"td",c=n&&n.type==="table"?n.align:void 0,f=c?c.length:t.children.length;let p=-1;const h=[];for(;++p<f;){const m=t.children[p],S={},v=c?c[p]:void 0;v&&(S.align=v);let b={type:"element",tagName:o,properties:S,children:[]};m&&(b.children=e.all(m),e.patch(m,b),b=e.applyData(m,b)),h.push(b)}const g={type:"element",tagName:"tr",properties:{},children:e.wrap(h,!0)};return e.patch(t,g),e.applyData(t,g)}function mT(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Sy=9,by=32;function gT(e){const t=String(e),n=/\r?\n|\r/g;let s=n.exec(t),a=0;const o=[];for(;s;)o.push(xy(t.slice(a,s.index),a>0,!0),s[0]),a=s.index+s[0].length,s=n.exec(t);return o.push(xy(t.slice(a),a>0,!1)),o.join("")}function xy(e,t,n){let s=0,a=e.length;if(t){let o=e.codePointAt(s);for(;o===Sy||o===by;)s++,o=e.codePointAt(s)}if(n){let o=e.codePointAt(a-1);for(;o===Sy||o===by;)a--,o=e.codePointAt(a-1)}return a>s?e.slice(s,a):""}function vT(e,t){const n={type:"text",value:gT(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function yT(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const ST={blockquote:$5,break:G5,code:Z5,delete:Q5,emphasis:J5,footnoteReference:eT,heading:tT,html:iT,imageReference:nT,image:rT,inlineCode:sT,linkReference:lT,link:aT,listItem:oT,list:cT,paragraph:hT,root:fT,strong:dT,table:pT,tableCell:mT,tableRow:_T,text:vT,thematicBreak:yT,toml:Go,yaml:Go,definition:Go,footnoteDefinition:Go};function Go(){}const bb=-1,Cu=0,ua=1,_u=2,Id=3,Fd=4,qd=5,Wd=6,xb=7,wb=8,wy=typeof self=="object"?self:globalThis,bT=(e,t)=>{const n=(a,o)=>(e.set(o,a),a),s=a=>{if(e.has(a))return e.get(a);const[o,c]=t[a];switch(o){case Cu:case bb:return n(c,a);case ua:{const f=n([],a);for(const p of c)f.push(s(p));return f}case _u:{const f=n({},a);for(const[p,h]of c)f[s(p)]=s(h);return f}case Id:return n(new Date(c),a);case Fd:{const{source:f,flags:p}=c;return n(new RegExp(f,p),a)}case qd:{const f=n(new Map,a);for(const[p,h]of c)f.set(s(p),s(h));return f}case Wd:{const f=n(new Set,a);for(const p of c)f.add(s(p));return f}case xb:{const{name:f,message:p}=c;return n(new wy[f](p),a)}case wb:return n(BigInt(c),a);case"BigInt":return n(Object(BigInt(c)),a);case"ArrayBuffer":return n(new Uint8Array(c).buffer,c);case"DataView":{const{buffer:f}=new Uint8Array(c);return n(new DataView(f),c)}}return n(new wy[o](c),a)};return s},Cy=e=>bT(new Map,e)(0),Ps="",{toString:xT}={},{keys:wT}=Object,ea=e=>{const t=typeof e;if(t!=="object"||!e)return[Cu,t];const n=xT.call(e).slice(8,-1);switch(n){case"Array":return[ua,Ps];case"Object":return[_u,Ps];case"Date":return[Id,Ps];case"RegExp":return[Fd,Ps];case"Map":return[qd,Ps];case"Set":return[Wd,Ps];case"DataView":return[ua,n]}return n.includes("Array")?[ua,n]:n.includes("Error")?[xb,n]:[_u,n]},Zo=([e,t])=>e===Cu&&(t==="function"||t==="symbol"),CT=(e,t,n,s)=>{const a=(c,f)=>{const p=s.push(c)-1;return n.set(f,p),p},o=c=>{if(n.has(c))return n.get(c);let[f,p]=ea(c);switch(f){case Cu:{let g=c;switch(p){case"bigint":f=wb,g=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+p);g=null;break;case"undefined":return a([bb],c)}return a([f,g],c)}case ua:{if(p){let S=c;return p==="DataView"?S=new Uint8Array(c.buffer):p==="ArrayBuffer"&&(S=new Uint8Array(c)),a([p,[...S]],c)}const g=[],m=a([f,g],c);for(const S of c)g.push(o(S));return m}case _u:{if(p)switch(p){case"BigInt":return a([p,c.toString()],c);case"Boolean":case"Number":case"String":return a([p,c.valueOf()],c)}if(t&&"toJSON"in c)return o(c.toJSON());const g=[],m=a([f,g],c);for(const S of wT(c))(e||!Zo(ea(c[S])))&&g.push([o(S),o(c[S])]);return m}case Id:return a([f,c.toISOString()],c);case Fd:{const{source:g,flags:m}=c;return a([f,{source:g,flags:m}],c)}case qd:{const g=[],m=a([f,g],c);for(const[S,v]of c)(e||!(Zo(ea(S))||Zo(ea(v))))&&g.push([o(S),o(v)]);return m}case Wd:{const g=[],m=a([f,g],c);for(const S of c)(e||!Zo(ea(S)))&&g.push(o(S));return m}}const{message:h}=c;return a([f,{name:p,message:h}],c)};return o},ky=(e,{json:t,lossy:n}={})=>{const s=[];return CT(!(t||n),!!t,new Map,s)(e),s},pa=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Cy(ky(e,t)):structuredClone(e):(e,t)=>Cy(ky(e,t));function kT(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function ET(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function TT(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||kT,s=e.options.footnoteBackLabel||ET,a=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",c=e.options.footnoteLabelProperties||{className:["sr-only"]},f=[];let p=-1;for(;++p<e.footnoteOrder.length;){const h=e.footnoteById.get(e.footnoteOrder[p]);if(!h)continue;const g=e.all(h),m=String(h.identifier).toUpperCase(),S=Gs(m.toLowerCase());let v=0;const b=[],k=e.footnoteCounts.get(m);for(;k!==void 0&&++v<=k;){b.length>0&&b.push({type:"text",value:" "});let G=typeof n=="string"?n:n(p,v);typeof G=="string"&&(G={type:"text",value:G}),b.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+S+(v>1?"-"+v:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(p,v),className:["data-footnote-backref"]},children:Array.isArray(G)?G:[G]})}const B=g[g.length-1];if(B&&B.type==="element"&&B.tagName==="p"){const G=B.children[B.children.length-1];G&&G.type==="text"?G.value+=" ":B.children.push({type:"text",value:" "}),B.children.push(...b)}else g.push(...b);const D={type:"element",tagName:"li",properties:{id:t+"fn-"+S},children:e.wrap(g,!0)};e.patch(h,D),f.push(D)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...pa(c),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:`
107
+ `});const h={type:"element",tagName:"li",properties:o,children:c};return e.patch(t,h),e.applyData(t,h)}function uT(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let s=-1;for(;!t&&++s<n.length;)t=Sb(n[s])}return t}function Sb(e){const t=e.spread;return t??e.children.length>1}function cT(e,t){const n={},s=e.all(t);let a=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++a<s.length;){const c=s[a];if(c.type==="element"&&c.tagName==="li"&&c.properties&&Array.isArray(c.properties.className)&&c.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(s,!0)};return e.patch(t,o),e.applyData(t,o)}function hT(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function fT(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function dT(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function pT(e,t){const n=e.all(t),s=n.shift(),a=[];if(s){const c={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!0)};e.patch(t.children[0],c),a.push(c)}if(n.length>0){const c={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},f=zd(t.children[1]),p=QS(t.children[t.children.length-1]);f&&p&&(c.position={start:f,end:p}),a.push(c)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,o),e.applyData(t,o)}function mT(e,t,n){const s=n?n.children:void 0,o=(s?s.indexOf(t):1)===0?"th":"td",c=n&&n.type==="table"?n.align:void 0,f=c?c.length:t.children.length;let p=-1;const h=[];for(;++p<f;){const _=t.children[p],S={},y=c?c[p]:void 0;y&&(S.align=y);let b={type:"element",tagName:o,properties:S,children:[]};_&&(b.children=e.all(_),e.patch(_,b),b=e.applyData(_,b)),h.push(b)}const g={type:"element",tagName:"tr",properties:{},children:e.wrap(h,!0)};return e.patch(t,g),e.applyData(t,g)}function _T(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Sy=9,by=32;function gT(e){const t=String(e),n=/\r?\n|\r/g;let s=n.exec(t),a=0;const o=[];for(;s;)o.push(xy(t.slice(a,s.index),a>0,!0),s[0]),a=s.index+s[0].length,s=n.exec(t);return o.push(xy(t.slice(a),a>0,!1)),o.join("")}function xy(e,t,n){let s=0,a=e.length;if(t){let o=e.codePointAt(s);for(;o===Sy||o===by;)s++,o=e.codePointAt(s)}if(n){let o=e.codePointAt(a-1);for(;o===Sy||o===by;)a--,o=e.codePointAt(a-1)}return a>s?e.slice(s,a):""}function vT(e,t){const n={type:"text",value:gT(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function yT(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const ST={blockquote:$5,break:G5,code:Z5,delete:Q5,emphasis:J5,footnoteReference:eT,heading:tT,html:iT,imageReference:nT,image:rT,inlineCode:sT,linkReference:lT,link:aT,listItem:oT,list:cT,paragraph:hT,root:fT,strong:dT,table:pT,tableCell:_T,tableRow:mT,text:vT,thematicBreak:yT,toml:Go,yaml:Go,definition:Go,footnoteDefinition:Go};function Go(){}const bb=-1,Cu=0,ua=1,mu=2,Id=3,Fd=4,qd=5,Wd=6,xb=7,wb=8,wy=typeof self=="object"?self:globalThis,bT=(e,t)=>{const n=(a,o)=>(e.set(o,a),a),s=a=>{if(e.has(a))return e.get(a);const[o,c]=t[a];switch(o){case Cu:case bb:return n(c,a);case ua:{const f=n([],a);for(const p of c)f.push(s(p));return f}case mu:{const f=n({},a);for(const[p,h]of c)f[s(p)]=s(h);return f}case Id:return n(new Date(c),a);case Fd:{const{source:f,flags:p}=c;return n(new RegExp(f,p),a)}case qd:{const f=n(new Map,a);for(const[p,h]of c)f.set(s(p),s(h));return f}case Wd:{const f=n(new Set,a);for(const p of c)f.add(s(p));return f}case xb:{const{name:f,message:p}=c;return n(new wy[f](p),a)}case wb:return n(BigInt(c),a);case"BigInt":return n(Object(BigInt(c)),a);case"ArrayBuffer":return n(new Uint8Array(c).buffer,c);case"DataView":{const{buffer:f}=new Uint8Array(c);return n(new DataView(f),c)}}return n(new wy[o](c),a)};return s},Cy=e=>bT(new Map,e)(0),Ps="",{toString:xT}={},{keys:wT}=Object,ea=e=>{const t=typeof e;if(t!=="object"||!e)return[Cu,t];const n=xT.call(e).slice(8,-1);switch(n){case"Array":return[ua,Ps];case"Object":return[mu,Ps];case"Date":return[Id,Ps];case"RegExp":return[Fd,Ps];case"Map":return[qd,Ps];case"Set":return[Wd,Ps];case"DataView":return[ua,n]}return n.includes("Array")?[ua,n]:n.includes("Error")?[xb,n]:[mu,n]},Zo=([e,t])=>e===Cu&&(t==="function"||t==="symbol"),CT=(e,t,n,s)=>{const a=(c,f)=>{const p=s.push(c)-1;return n.set(f,p),p},o=c=>{if(n.has(c))return n.get(c);let[f,p]=ea(c);switch(f){case Cu:{let g=c;switch(p){case"bigint":f=wb,g=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+p);g=null;break;case"undefined":return a([bb],c)}return a([f,g],c)}case ua:{if(p){let S=c;return p==="DataView"?S=new Uint8Array(c.buffer):p==="ArrayBuffer"&&(S=new Uint8Array(c)),a([p,[...S]],c)}const g=[],_=a([f,g],c);for(const S of c)g.push(o(S));return _}case mu:{if(p)switch(p){case"BigInt":return a([p,c.toString()],c);case"Boolean":case"Number":case"String":return a([p,c.valueOf()],c)}if(t&&"toJSON"in c)return o(c.toJSON());const g=[],_=a([f,g],c);for(const S of wT(c))(e||!Zo(ea(c[S])))&&g.push([o(S),o(c[S])]);return _}case Id:return a([f,c.toISOString()],c);case Fd:{const{source:g,flags:_}=c;return a([f,{source:g,flags:_}],c)}case qd:{const g=[],_=a([f,g],c);for(const[S,y]of c)(e||!(Zo(ea(S))||Zo(ea(y))))&&g.push([o(S),o(y)]);return _}case Wd:{const g=[],_=a([f,g],c);for(const S of c)(e||!Zo(ea(S)))&&g.push(o(S));return _}}const{message:h}=c;return a([f,{name:p,message:h}],c)};return o},ky=(e,{json:t,lossy:n}={})=>{const s=[];return CT(!(t||n),!!t,new Map,s)(e),s},pa=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Cy(ky(e,t)):structuredClone(e):(e,t)=>Cy(ky(e,t));function kT(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function ET(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function TT(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||kT,s=e.options.footnoteBackLabel||ET,a=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",c=e.options.footnoteLabelProperties||{className:["sr-only"]},f=[];let p=-1;for(;++p<e.footnoteOrder.length;){const h=e.footnoteById.get(e.footnoteOrder[p]);if(!h)continue;const g=e.all(h),_=String(h.identifier).toUpperCase(),S=Gs(_.toLowerCase());let y=0;const b=[],k=e.footnoteCounts.get(_);for(;k!==void 0&&++y<=k;){b.length>0&&b.push({type:"text",value:" "});let $=typeof n=="string"?n:n(p,y);typeof $=="string"&&($={type:"text",value:$}),b.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+S+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(p,y),className:["data-footnote-backref"]},children:Array.isArray($)?$:[$]})}const R=g[g.length-1];if(R&&R.type==="element"&&R.tagName==="p"){const $=R.children[R.children.length-1];$&&$.type==="text"?$.value+=" ":R.children.push({type:"text",value:" "}),R.children.push(...b)}else g.push(...b);const T={type:"element",tagName:"li",properties:{id:t+"fn-"+S},children:e.wrap(g,!0)};e.patch(h,T),f.push(T)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...pa(c),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:`
108
108
  `},{type:"element",tagName:"ol",properties:{},children:e.wrap(f,!0)},{type:"text",value:`
109
- `}]}}const ku=(function(e){if(e==null)return MT;if(typeof e=="function")return Eu(e);if(typeof e=="object")return Array.isArray(e)?AT(e):DT(e);if(typeof e=="string")return RT(e);throw new Error("Expected function, string, or object as test")});function AT(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=ku(e[n]);return Eu(s);function s(...a){let o=-1;for(;++o<t.length;)if(t[o].apply(this,a))return!0;return!1}}function DT(e){const t=e;return Eu(n);function n(s){const a=s;let o;for(o in e)if(a[o]!==t[o])return!1;return!0}}function RT(e){return Eu(t);function t(n){return n&&n.type===e}}function Eu(e){return t;function t(n,s,a){return!!(BT(n)&&e.call(this,n,typeof s=="number"?s:void 0,a||void 0))}}function MT(){return!0}function BT(e){return e!==null&&typeof e=="object"&&"type"in e}const Cb=[],LT=!0,md=!1,zT="skip";function kb(e,t,n,s){let a;typeof t=="function"&&typeof n!="function"?(s=n,n=t):a=t;const o=ku(a),c=s?-1:1;f(e,void 0,[])();function f(p,h,g){const m=p&&typeof p=="object"?p:{};if(typeof m.type=="string"){const v=typeof m.tagName=="string"?m.tagName:typeof m.name=="string"?m.name:void 0;Object.defineProperty(S,"name",{value:"node ("+(p.type+(v?"<"+v+">":""))+")"})}return S;function S(){let v=Cb,b,k,B;if((!t||o(p,h,g[g.length-1]||void 0))&&(v=NT(n(p,g)),v[0]===md))return v;if("children"in p&&p.children){const D=p;if(D.children&&v[0]!==zT)for(k=(s?D.children.length:-1)+c,B=g.concat(D);k>-1&&k<D.children.length;){const G=D.children[k];if(b=f(G,k,B)(),b[0]===md)return b;k=typeof b[1]=="number"?b[1]:k+c}}return v}}}function NT(e){return Array.isArray(e)?e:typeof e=="number"?[LT,e]:e==null?Cb:[e]}function Yd(e,t,n,s){let a,o,c;typeof t=="function"&&typeof n!="function"?(o=void 0,c=t,a=n):(o=t,c=n,a=s),kb(e,o,f,a);function f(p,h){const g=h[h.length-1],m=g?g.children.indexOf(p):void 0;return c(p,m,g)}}const gd={}.hasOwnProperty,OT={};function HT(e,t){const n=t||OT,s=new Map,a=new Map,o=new Map,c={...ST,...n.handlers},f={all:h,applyData:UT,definitionById:s,footnoteById:a,footnoteCounts:o,footnoteOrder:[],handlers:c,one:p,options:n,patch:jT,wrap:IT};return Yd(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const m=g.type==="definition"?s:a,S=String(g.identifier).toUpperCase();m.has(S)||m.set(S,g)}}),f;function p(g,m){const S=g.type,v=f.handlers[S];if(gd.call(f.handlers,S)&&v)return v(f,g,m);if(f.options.passThrough&&f.options.passThrough.includes(S)){if("children"in g){const{children:k,...B}=g,D=pa(B);return D.children=f.all(g),D}return pa(g)}return(f.options.unknownHandler||PT)(f,g,m)}function h(g){const m=[];if("children"in g){const S=g.children;let v=-1;for(;++v<S.length;){const b=f.one(S[v],g);if(b){if(v&&S[v-1].type==="break"&&(!Array.isArray(b)&&b.type==="text"&&(b.value=Ey(b.value)),!Array.isArray(b)&&b.type==="element")){const k=b.children[0];k&&k.type==="text"&&(k.value=Ey(k.value))}Array.isArray(b)?m.push(...b):m.push(b)}}}return m}}function jT(e,t){e.position&&(t.position=eb(e))}function UT(e,t){let n=t;if(e&&e.data){const s=e.data.hName,a=e.data.hChildren,o=e.data.hProperties;if(typeof s=="string")if(n.type==="element")n.tagName=s;else{const c="children"in n?n.children:[n];n={type:"element",tagName:s,properties:{},children:c}}n.type==="element"&&o&&Object.assign(n.properties,pa(o)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function PT(e,t){const n=t.data||{},s="value"in t&&!(gd.call(n,"hProperties")||gd.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function IT(e,t){const n=[];let s=-1;for(t&&n.push({type:"text",value:`
109
+ `}]}}const ku=(function(e){if(e==null)return MT;if(typeof e=="function")return Eu(e);if(typeof e=="object")return Array.isArray(e)?AT(e):DT(e);if(typeof e=="string")return RT(e);throw new Error("Expected function, string, or object as test")});function AT(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=ku(e[n]);return Eu(s);function s(...a){let o=-1;for(;++o<t.length;)if(t[o].apply(this,a))return!0;return!1}}function DT(e){const t=e;return Eu(n);function n(s){const a=s;let o;for(o in e)if(a[o]!==t[o])return!1;return!0}}function RT(e){return Eu(t);function t(n){return n&&n.type===e}}function Eu(e){return t;function t(n,s,a){return!!(BT(n)&&e.call(this,n,typeof s=="number"?s:void 0,a||void 0))}}function MT(){return!0}function BT(e){return e!==null&&typeof e=="object"&&"type"in e}const Cb=[],LT=!0,_d=!1,zT="skip";function kb(e,t,n,s){let a;typeof t=="function"&&typeof n!="function"?(s=n,n=t):a=t;const o=ku(a),c=s?-1:1;f(e,void 0,[])();function f(p,h,g){const _=p&&typeof p=="object"?p:{};if(typeof _.type=="string"){const y=typeof _.tagName=="string"?_.tagName:typeof _.name=="string"?_.name:void 0;Object.defineProperty(S,"name",{value:"node ("+(p.type+(y?"<"+y+">":""))+")"})}return S;function S(){let y=Cb,b,k,R;if((!t||o(p,h,g[g.length-1]||void 0))&&(y=NT(n(p,g)),y[0]===_d))return y;if("children"in p&&p.children){const T=p;if(T.children&&y[0]!==zT)for(k=(s?T.children.length:-1)+c,R=g.concat(T);k>-1&&k<T.children.length;){const $=T.children[k];if(b=f($,k,R)(),b[0]===_d)return b;k=typeof b[1]=="number"?b[1]:k+c}}return y}}}function NT(e){return Array.isArray(e)?e:typeof e=="number"?[LT,e]:e==null?Cb:[e]}function Yd(e,t,n,s){let a,o,c;typeof t=="function"&&typeof n!="function"?(o=void 0,c=t,a=n):(o=t,c=n,a=s),kb(e,o,f,a);function f(p,h){const g=h[h.length-1],_=g?g.children.indexOf(p):void 0;return c(p,_,g)}}const gd={}.hasOwnProperty,OT={};function HT(e,t){const n=t||OT,s=new Map,a=new Map,o=new Map,c={...ST,...n.handlers},f={all:h,applyData:UT,definitionById:s,footnoteById:a,footnoteCounts:o,footnoteOrder:[],handlers:c,one:p,options:n,patch:jT,wrap:IT};return Yd(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const _=g.type==="definition"?s:a,S=String(g.identifier).toUpperCase();_.has(S)||_.set(S,g)}}),f;function p(g,_){const S=g.type,y=f.handlers[S];if(gd.call(f.handlers,S)&&y)return y(f,g,_);if(f.options.passThrough&&f.options.passThrough.includes(S)){if("children"in g){const{children:k,...R}=g,T=pa(R);return T.children=f.all(g),T}return pa(g)}return(f.options.unknownHandler||PT)(f,g,_)}function h(g){const _=[];if("children"in g){const S=g.children;let y=-1;for(;++y<S.length;){const b=f.one(S[y],g);if(b){if(y&&S[y-1].type==="break"&&(!Array.isArray(b)&&b.type==="text"&&(b.value=Ey(b.value)),!Array.isArray(b)&&b.type==="element")){const k=b.children[0];k&&k.type==="text"&&(k.value=Ey(k.value))}Array.isArray(b)?_.push(...b):_.push(b)}}}return _}}function jT(e,t){e.position&&(t.position=eb(e))}function UT(e,t){let n=t;if(e&&e.data){const s=e.data.hName,a=e.data.hChildren,o=e.data.hProperties;if(typeof s=="string")if(n.type==="element")n.tagName=s;else{const c="children"in n?n.children:[n];n={type:"element",tagName:s,properties:{},children:c}}n.type==="element"&&o&&Object.assign(n.properties,pa(o)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function PT(e,t){const n=t.data||{},s="value"in t&&!(gd.call(n,"hProperties")||gd.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function IT(e,t){const n=[];let s=-1;for(t&&n.push({type:"text",value:`
110
110
  `});++s<e.length;)s&&n.push({type:"text",value:`
111
111
  `}),n.push(e[s]);return t&&e.length>0&&n.push({type:"text",value:`
112
112
  `}),n}function Ey(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Ty(e,t){const n=HT(e,t),s=n.one(e,void 0),a=TT(n),o=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return a&&o.children.push({type:"text",value:`
113
- `},a),o}function FT(e,t){return e&&"run"in e?async function(n,s){const a=Ty(n,{file:s,...t});await e.run(a,s)}:function(n,s){return Ty(n,{file:s,...e||t})}}function Ay(e){if(e)throw e}var df,Dy;function qT(){if(Dy)return df;Dy=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,s=Object.getOwnPropertyDescriptor,a=function(h){return typeof Array.isArray=="function"?Array.isArray(h):t.call(h)==="[object Array]"},o=function(h){if(!h||t.call(h)!=="[object Object]")return!1;var g=e.call(h,"constructor"),m=h.constructor&&h.constructor.prototype&&e.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!g&&!m)return!1;var S;for(S in h);return typeof S>"u"||e.call(h,S)},c=function(h,g){n&&g.name==="__proto__"?n(h,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):h[g.name]=g.newValue},f=function(h,g){if(g==="__proto__")if(e.call(h,g)){if(s)return s(h,g).value}else return;return h[g]};return df=function p(){var h,g,m,S,v,b,k=arguments[0],B=1,D=arguments.length,G=!1;for(typeof k=="boolean"&&(G=k,k=arguments[1]||{},B=2),(k==null||typeof k!="object"&&typeof k!="function")&&(k={});B<D;++B)if(h=arguments[B],h!=null)for(g in h)m=f(k,g),S=f(h,g),k!==S&&(G&&S&&(o(S)||(v=a(S)))?(v?(v=!1,b=m&&a(m)?m:[]):b=m&&o(m)?m:{},c(k,{name:g,newValue:p(G,b,S)})):typeof S<"u"&&c(k,{name:g,newValue:S}));return k},df}var WT=qT();const pf=gu(WT);function vd(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 YT(){const e=[],t={run:n,use:s};return t;function n(...a){let o=-1;const c=a.pop();if(typeof c!="function")throw new TypeError("Expected function as last argument, not "+c);f(null,...a);function f(p,...h){const g=e[++o];let m=-1;if(p){c(p);return}for(;++m<a.length;)(h[m]===null||h[m]===void 0)&&(h[m]=a[m]);a=h,g?VT(g,f)(...h):c(null,...h)}}function s(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function VT(e,t){let n;return s;function s(...c){const f=e.length>c.length;let p;f&&c.push(a);try{p=e.apply(this,c)}catch(h){const g=h;if(f&&n)throw g;return a(g)}f||(p&&p.then&&typeof p.then=="function"?p.then(o,a):p instanceof Error?a(p):o(p))}function a(c,...f){n||(n=!0,t(c,...f))}function o(c){a(null,c)}}const an={basename:KT,dirname:XT,extname:$T,join:GT,sep:"/"};function KT(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');xa(e);let n=0,s=-1,a=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(o){n=a+1;break}}else s<0&&(o=!0,s=a+1);return s<0?"":e.slice(n,s)}if(t===e)return"";let c=-1,f=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(o){n=a+1;break}}else c<0&&(o=!0,c=a+1),f>-1&&(e.codePointAt(a)===t.codePointAt(f--)?f<0&&(s=a):(f=-1,s=c));return n===s?s=c:s<0&&(s=e.length),e.slice(n,s)}function XT(e){if(xa(e),e.length===0)return".";let t=-1,n=e.length,s;for(;--n;)if(e.codePointAt(n)===47){if(s){t=n;break}}else s||(s=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function $T(e){xa(e);let t=e.length,n=-1,s=0,a=-1,o=0,c;for(;t--;){const f=e.codePointAt(t);if(f===47){if(c){s=t+1;break}continue}n<0&&(c=!0,n=t+1),f===46?a<0?a=t:o!==1&&(o=1):a>-1&&(o=-1)}return a<0||n<0||o===0||o===1&&a===n-1&&a===s+1?"":e.slice(a,n)}function GT(...e){let t=-1,n;for(;++t<e.length;)xa(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":ZT(n)}function ZT(e){xa(e);const t=e.codePointAt(0)===47;let n=QT(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function QT(e,t){let n="",s=0,a=-1,o=0,c=-1,f,p;for(;++c<=e.length;){if(c<e.length)f=e.codePointAt(c);else{if(f===47)break;f=47}if(f===47){if(!(a===c-1||o===1))if(a!==c-1&&o===2){if(n.length<2||s!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(p=n.lastIndexOf("/"),p!==n.length-1){p<0?(n="",s=0):(n=n.slice(0,p),s=n.length-1-n.lastIndexOf("/")),a=c,o=0;continue}}else if(n.length>0){n="",s=0,a=c,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",s=2)}else n.length>0?n+="/"+e.slice(a+1,c):n=e.slice(a+1,c),s=c-a-1;a=c,o=0}else f===46&&o>-1?o++:o=-1}return n}function xa(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const JT={cwd:e3};function e3(){return"/"}function yd(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function t3(e){if(typeof e=="string")e=new URL(e);else if(!yd(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 i3(e)}function i3(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const s=t.codePointAt(n+2);if(s===70||s===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(t)}const _f=["history","path","basename","stem","extname","dirname"];class Eb{constructor(t){let n;t?yd(t)?n={path:t}:typeof t=="string"||n3(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":JT.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<_f.length;){const o=_f[s];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let a;for(a in n)_f.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?an.basename(this.path):void 0}set basename(t){gf(t,"basename"),mf(t,"basename"),this.path=an.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?an.dirname(this.path):void 0}set dirname(t){Ry(this.basename,"dirname"),this.path=an.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?an.extname(this.path):void 0}set extname(t){if(mf(t,"extname"),Ry(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=an.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){yd(t)&&(t=t3(t)),gf(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?an.basename(this.path,this.extname):void 0}set stem(t){gf(t,"stem"),mf(t,"stem"),this.path=an.join(this.dirname||"",t+(this.extname||""))}fail(t,n,s){const a=this.message(t,n,s);throw a.fatal=!0,a}info(t,n,s){const a=this.message(t,n,s);return a.fatal=void 0,a}message(t,n,s){const a=new Gt(t,n,s);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function mf(e,t){if(e&&e.includes(an.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+an.sep+"`")}function gf(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Ry(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function n3(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const r3=(function(e){const s=this.constructor.prototype,a=s[e],o=function(){return a.apply(o,arguments)};return Object.setPrototypeOf(o,s),o}),s3={}.hasOwnProperty;class Vd extends r3{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=YT()}copy(){const t=new Vd;let n=-1;for(;++n<this.attachers.length;){const s=this.attachers[n];t.use(...s)}return t.data(pf(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Sf("data",this.frozen),this.namespace[t]=n,this):s3.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Sf("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[n,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const a=n.call(t,...s);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Qo(t),s=this.parser||this.Parser;return vf("parse",s),s(String(n),n)}process(t,n){const s=this;return this.freeze(),vf("process",this.parser||this.Parser),yf("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(o,c){const f=Qo(t),p=s.parse(f);s.run(p,f,function(g,m,S){if(g||!m||!S)return h(g);const v=m,b=s.stringify(v,S);o3(b)?S.value=b:S.result=b,h(g,S)});function h(g,m){g||!m?c(g):o?o(m):n(void 0,m)}}}processSync(t){let n=!1,s;return this.freeze(),vf("processSync",this.parser||this.Parser),yf("processSync",this.compiler||this.Compiler),this.process(t,a),By("processSync","process",n),s;function a(o,c){n=!0,Ay(o),s=c}}run(t,n,s){My(t),this.freeze();const a=this.transformers;return!s&&typeof n=="function"&&(s=n,n=void 0),s?o(void 0,s):new Promise(o);function o(c,f){const p=Qo(n);a.run(t,p,h);function h(g,m,S){const v=m||t;g?f(g):c?c(v):s(void 0,v,S)}}}runSync(t,n){let s=!1,a;return this.run(t,n,o),By("runSync","run",s),a;function o(c,f){Ay(c),a=f,s=!0}}stringify(t,n){this.freeze();const s=Qo(n),a=this.compiler||this.Compiler;return yf("stringify",a),My(t),a(t,s)}use(t,...n){const s=this.attachers,a=this.namespace;if(Sf("use",this.frozen),t!=null)if(typeof t=="function")p(t,n);else if(typeof t=="object")Array.isArray(t)?f(t):c(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(h){if(typeof h=="function")p(h,[]);else if(typeof h=="object")if(Array.isArray(h)){const[g,...m]=h;p(g,m)}else c(h);else throw new TypeError("Expected usable value, not `"+h+"`")}function c(h){if(!("plugins"in h)&&!("settings"in h))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");f(h.plugins),h.settings&&(a.settings=pf(!0,a.settings,h.settings))}function f(h){let g=-1;if(h!=null)if(Array.isArray(h))for(;++g<h.length;){const m=h[g];o(m)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function p(h,g){let m=-1,S=-1;for(;++m<s.length;)if(s[m][0]===h){S=m;break}if(S===-1)s.push([h,...g]);else if(g.length>0){let[v,...b]=g;const k=s[S][1];vd(k)&&vd(v)&&(v=pf(!0,k,v)),s[S]=[h,v,...b]}}}}const l3=new Vd().freeze();function vf(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function yf(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Sf(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 My(e){if(!vd(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function By(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Qo(e){return a3(e)?e:new Eb(e)}function a3(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function o3(e){return typeof e=="string"||u3(e)}function u3(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const c3="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Ly=[],zy={allowDangerousHtml:!0},h3=/^(https?|ircs?|mailto|xmpp)$/i,f3=[{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 d3(e){const t=p3(e),n=_3(e);return m3(t.runSync(t.parse(n),n),e)}function p3(e){const t=e.rehypePlugins||Ly,n=e.remarkPlugins||Ly,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...zy}:zy;return l3().use(X5).use(n).use(FT,s).use(t)}function _3(e){const t=e.children||"",n=new Eb;return typeof t=="string"&&(n.value=t),n}function m3(e,t){const n=t.allowedElements,s=t.allowElement,a=t.components,o=t.disallowedElements,c=t.skipHtml,f=t.unwrapDisallowed,p=t.urlTransform||g3;for(const g of f3)Object.hasOwn(t,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+c3+g.id,void 0);return Yd(e,h),Mk(e,{Fragment:x.Fragment,components:a,ignoreInvalidStyle:!0,jsx:x.jsx,jsxs:x.jsxs,passKeys:!0,passNode:!0});function h(g,m,S){if(g.type==="raw"&&S&&typeof m=="number")return c?S.children.splice(m,1):S.children[m]={type:"text",value:g.value},m;if(g.type==="element"){let v;for(v in cf)if(Object.hasOwn(cf,v)&&Object.hasOwn(g.properties,v)){const b=g.properties[v],k=cf[v];(k===null||k.includes(g.tagName))&&(g.properties[v]=p(String(b||""),v,g))}}if(g.type==="element"){let v=n?!n.includes(g.tagName):o?o.includes(g.tagName):!1;if(!v&&s&&typeof m=="number"&&(v=!s(g,m,S)),v&&S&&typeof m=="number")return f&&g.children?S.children.splice(m,1,...g.children):S.children.splice(m,1),m}}}function g3(e){const t=e.indexOf(":"),n=e.indexOf("?"),s=e.indexOf("#"),a=e.indexOf("/");return t===-1||a!==-1&&t>a||n!==-1&&t>n||s!==-1&&t>s||h3.test(e.slice(0,t))?e:""}function v3(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Tb(e,t,n){const a=ku((n||{}).ignore||[]),o=y3(t);let c=-1;for(;++c<o.length;)kb(e,"text",f);function f(h,g){let m=-1,S;for(;++m<g.length;){const v=g[m],b=S?S.children:void 0;if(a(v,b?b.indexOf(v):void 0,S))return;S=v}if(S)return p(h,g)}function p(h,g){const m=g[g.length-1],S=o[c][0],v=o[c][1];let b=0;const B=m.children.indexOf(h);let D=!1,G=[];S.lastIndex=0;let A=S.exec(h.value);for(;A;){const N=A.index,$={index:A.index,input:A.input,stack:[...g,h]};let z=v(...A,$);if(typeof z=="string"&&(z=z.length>0?{type:"text",value:z}:void 0),z===!1?S.lastIndex=N+1:(b!==N&&G.push({type:"text",value:h.value.slice(b,N)}),Array.isArray(z)?G.push(...z):z&&G.push(z),b=N+A[0].length,D=!0),!S.global)break;A=S.exec(h.value)}return D?(b<h.value.length&&G.push({type:"text",value:h.value.slice(b)}),m.children.splice(B,1,...G)):G=[h],B+G.length}}function y3(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let s=-1;for(;++s<n.length;){const a=n[s];t.push([S3(a[0]),b3(a[1])])}return t}function S3(e){return typeof e=="string"?new RegExp(v3(e),"g"):e}function b3(e){return typeof e=="function"?e:function(){return e}}function x3(e){Tb(e,[/\r?\n|\r/g,w3])}function w3(){return{type:"break"}}function C3(){return function(e){x3(e)}}function Ny(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let s=0,a=n.indexOf(t);for(;a!==-1;)s++,a=n.indexOf(t,a+t.length);return s}const bf="phrasing",xf=["autolink","link","image","label"];function k3(){return{transforms:[B3],enter:{literalAutolink:T3,literalAutolinkEmail:wf,literalAutolinkHttp:wf,literalAutolinkWww:wf},exit:{literalAutolink:M3,literalAutolinkEmail:R3,literalAutolinkHttp:A3,literalAutolinkWww:D3}}}function E3(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:bf,notInConstruct:xf},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:bf,notInConstruct:xf},{character:":",before:"[ps]",after:"\\/",inConstruct:bf,notInConstruct:xf}]}}function T3(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function wf(e){this.config.enter.autolinkProtocol.call(this,e)}function A3(e){this.config.exit.autolinkProtocol.call(this,e)}function D3(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function R3(e){this.config.exit.autolinkEmail.call(this,e)}function M3(e){this.exit(e)}function B3(e){Tb(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,L3],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),z3]],{ignore:["link","linkReference"]})}function L3(e,t,n,s,a){let o="";if(!Ab(a)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!N3(n)))return!1;const c=O3(n+s);if(!c[0])return!1;const f={type:"link",title:null,url:o+t+c[0],children:[{type:"text",value:t+c[0]}]};return c[1]?[f,{type:"text",value:c[1]}]:f}function z3(e,t,n,s){return!Ab(s,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function N3(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function O3(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],s=n.indexOf(")");const a=Ny(e,"(");let o=Ny(e,")");for(;s!==-1&&a>o;)e+=n.slice(0,s+1),n=n.slice(s+1),s=n.indexOf(")"),o++;return[e,n]}function Ab(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Vr(n)||xu(n))&&(!t||n!==47)}Db.peek=Y3;function H3(){this.buffer()}function j3(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function U3(){this.buffer()}function P3(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function I3(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Qi(this.sliceSerialize(e)).toLowerCase(),n.label=t}function F3(e){this.exit(e)}function q3(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Qi(this.sliceSerialize(e)).toLowerCase(),n.label=t}function W3(e){this.exit(e)}function Y3(){return"["}function Db(e,t,n,s){const a=n.createTracker(s);let o=a.move("[^");const c=n.enter("footnoteReference"),f=n.enter("reference");return o+=a.move(n.safe(n.associationId(e),{after:"]",before:o})),f(),c(),o+=a.move("]"),o}function V3(){return{enter:{gfmFootnoteCallString:H3,gfmFootnoteCall:j3,gfmFootnoteDefinitionLabelString:U3,gfmFootnoteDefinition:P3},exit:{gfmFootnoteCallString:I3,gfmFootnoteCall:F3,gfmFootnoteDefinitionLabelString:q3,gfmFootnoteDefinition:W3}}}function K3(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Db},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(s,a,o,c){const f=o.createTracker(c);let p=f.move("[^");const h=o.enter("footnoteDefinition"),g=o.enter("label");return p+=f.move(o.safe(o.associationId(s),{before:p,after:"]"})),g(),p+=f.move("]:"),s.children&&s.children.length>0&&(f.shift(4),p+=f.move((t?`
114
- `:" ")+o.indentLines(o.containerFlow(s,f.current()),t?Rb:X3))),h(),p}}function X3(e,t,n){return t===0?e:Rb(e,t,n)}function Rb(e,t,n){return(n?"":" ")+e}const $3=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Mb.peek=eA;function G3(){return{canContainEols:["delete"],enter:{strikethrough:Q3},exit:{strikethrough:J3}}}function Z3(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:$3}],handlers:{delete:Mb}}}function Q3(e){this.enter({type:"delete",children:[]},e)}function J3(e){this.exit(e)}function Mb(e,t,n,s){const a=n.createTracker(s),o=n.enter("strikethrough");let c=a.move("~~");return c+=n.containerPhrasing(e,{...a.current(),before:c,after:"~"}),c+=a.move("~~"),o(),c}function eA(){return"~"}function tA(e){return e.length}function iA(e,t){const n=t||{},s=(n.align||[]).concat(),a=n.stringLength||tA,o=[],c=[],f=[],p=[];let h=0,g=-1;for(;++g<e.length;){const k=[],B=[];let D=-1;for(e[g].length>h&&(h=e[g].length);++D<e[g].length;){const G=nA(e[g][D]);if(n.alignDelimiters!==!1){const A=a(G);B[D]=A,(p[D]===void 0||A>p[D])&&(p[D]=A)}k.push(G)}c[g]=k,f[g]=B}let m=-1;if(typeof s=="object"&&"length"in s)for(;++m<h;)o[m]=Oy(s[m]);else{const k=Oy(s);for(;++m<h;)o[m]=k}m=-1;const S=[],v=[];for(;++m<h;){const k=o[m];let B="",D="";k===99?(B=":",D=":"):k===108?B=":":k===114&&(D=":");let G=n.alignDelimiters===!1?1:Math.max(1,p[m]-B.length-D.length);const A=B+"-".repeat(G)+D;n.alignDelimiters!==!1&&(G=B.length+G+D.length,G>p[m]&&(p[m]=G),v[m]=G),S[m]=A}c.splice(1,0,S),f.splice(1,0,v),g=-1;const b=[];for(;++g<c.length;){const k=c[g],B=f[g];m=-1;const D=[];for(;++m<h;){const G=k[m]||"";let A="",N="";if(n.alignDelimiters!==!1){const $=p[m]-(B[m]||0),z=o[m];z===114?A=" ".repeat($):z===99?$%2?(A=" ".repeat($/2+.5),N=" ".repeat($/2-.5)):(A=" ".repeat($/2),N=A):N=" ".repeat($)}n.delimiterStart!==!1&&!m&&D.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&G==="")&&(n.delimiterStart!==!1||m)&&D.push(" "),n.alignDelimiters!==!1&&D.push(A),D.push(G),n.alignDelimiters!==!1&&D.push(N),n.padding!==!1&&D.push(" "),(n.delimiterEnd!==!1||m!==h-1)&&D.push("|")}b.push(n.delimiterEnd===!1?D.join("").replace(/ +$/,""):D.join(""))}return b.join(`
113
+ `},a),o}function FT(e,t){return e&&"run"in e?async function(n,s){const a=Ty(n,{file:s,...t});await e.run(a,s)}:function(n,s){return Ty(n,{file:s,...e||t})}}function Ay(e){if(e)throw e}var df,Dy;function qT(){if(Dy)return df;Dy=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,s=Object.getOwnPropertyDescriptor,a=function(h){return typeof Array.isArray=="function"?Array.isArray(h):t.call(h)==="[object Array]"},o=function(h){if(!h||t.call(h)!=="[object Object]")return!1;var g=e.call(h,"constructor"),_=h.constructor&&h.constructor.prototype&&e.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!g&&!_)return!1;var S;for(S in h);return typeof S>"u"||e.call(h,S)},c=function(h,g){n&&g.name==="__proto__"?n(h,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):h[g.name]=g.newValue},f=function(h,g){if(g==="__proto__")if(e.call(h,g)){if(s)return s(h,g).value}else return;return h[g]};return df=function p(){var h,g,_,S,y,b,k=arguments[0],R=1,T=arguments.length,$=!1;for(typeof k=="boolean"&&($=k,k=arguments[1]||{},R=2),(k==null||typeof k!="object"&&typeof k!="function")&&(k={});R<T;++R)if(h=arguments[R],h!=null)for(g in h)_=f(k,g),S=f(h,g),k!==S&&($&&S&&(o(S)||(y=a(S)))?(y?(y=!1,b=_&&a(_)?_:[]):b=_&&o(_)?_:{},c(k,{name:g,newValue:p($,b,S)})):typeof S<"u"&&c(k,{name:g,newValue:S}));return k},df}var WT=qT();const pf=gu(WT);function vd(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 YT(){const e=[],t={run:n,use:s};return t;function n(...a){let o=-1;const c=a.pop();if(typeof c!="function")throw new TypeError("Expected function as last argument, not "+c);f(null,...a);function f(p,...h){const g=e[++o];let _=-1;if(p){c(p);return}for(;++_<a.length;)(h[_]===null||h[_]===void 0)&&(h[_]=a[_]);a=h,g?VT(g,f)(...h):c(null,...h)}}function s(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function VT(e,t){let n;return s;function s(...c){const f=e.length>c.length;let p;f&&c.push(a);try{p=e.apply(this,c)}catch(h){const g=h;if(f&&n)throw g;return a(g)}f||(p&&p.then&&typeof p.then=="function"?p.then(o,a):p instanceof Error?a(p):o(p))}function a(c,...f){n||(n=!0,t(c,...f))}function o(c){a(null,c)}}const an={basename:KT,dirname:XT,extname:$T,join:GT,sep:"/"};function KT(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');xa(e);let n=0,s=-1,a=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(o){n=a+1;break}}else s<0&&(o=!0,s=a+1);return s<0?"":e.slice(n,s)}if(t===e)return"";let c=-1,f=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(o){n=a+1;break}}else c<0&&(o=!0,c=a+1),f>-1&&(e.codePointAt(a)===t.codePointAt(f--)?f<0&&(s=a):(f=-1,s=c));return n===s?s=c:s<0&&(s=e.length),e.slice(n,s)}function XT(e){if(xa(e),e.length===0)return".";let t=-1,n=e.length,s;for(;--n;)if(e.codePointAt(n)===47){if(s){t=n;break}}else s||(s=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function $T(e){xa(e);let t=e.length,n=-1,s=0,a=-1,o=0,c;for(;t--;){const f=e.codePointAt(t);if(f===47){if(c){s=t+1;break}continue}n<0&&(c=!0,n=t+1),f===46?a<0?a=t:o!==1&&(o=1):a>-1&&(o=-1)}return a<0||n<0||o===0||o===1&&a===n-1&&a===s+1?"":e.slice(a,n)}function GT(...e){let t=-1,n;for(;++t<e.length;)xa(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":ZT(n)}function ZT(e){xa(e);const t=e.codePointAt(0)===47;let n=QT(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function QT(e,t){let n="",s=0,a=-1,o=0,c=-1,f,p;for(;++c<=e.length;){if(c<e.length)f=e.codePointAt(c);else{if(f===47)break;f=47}if(f===47){if(!(a===c-1||o===1))if(a!==c-1&&o===2){if(n.length<2||s!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(p=n.lastIndexOf("/"),p!==n.length-1){p<0?(n="",s=0):(n=n.slice(0,p),s=n.length-1-n.lastIndexOf("/")),a=c,o=0;continue}}else if(n.length>0){n="",s=0,a=c,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",s=2)}else n.length>0?n+="/"+e.slice(a+1,c):n=e.slice(a+1,c),s=c-a-1;a=c,o=0}else f===46&&o>-1?o++:o=-1}return n}function xa(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const JT={cwd:e3};function e3(){return"/"}function yd(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function t3(e){if(typeof e=="string")e=new URL(e);else if(!yd(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 i3(e)}function i3(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const s=t.codePointAt(n+2);if(s===70||s===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(t)}const mf=["history","path","basename","stem","extname","dirname"];class Eb{constructor(t){let n;t?yd(t)?n={path:t}:typeof t=="string"||n3(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":JT.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<mf.length;){const o=mf[s];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let a;for(a in n)mf.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?an.basename(this.path):void 0}set basename(t){gf(t,"basename"),_f(t,"basename"),this.path=an.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?an.dirname(this.path):void 0}set dirname(t){Ry(this.basename,"dirname"),this.path=an.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?an.extname(this.path):void 0}set extname(t){if(_f(t,"extname"),Ry(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=an.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){yd(t)&&(t=t3(t)),gf(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?an.basename(this.path,this.extname):void 0}set stem(t){gf(t,"stem"),_f(t,"stem"),this.path=an.join(this.dirname||"",t+(this.extname||""))}fail(t,n,s){const a=this.message(t,n,s);throw a.fatal=!0,a}info(t,n,s){const a=this.message(t,n,s);return a.fatal=void 0,a}message(t,n,s){const a=new Gt(t,n,s);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function _f(e,t){if(e&&e.includes(an.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+an.sep+"`")}function gf(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Ry(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function n3(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const r3=(function(e){const s=this.constructor.prototype,a=s[e],o=function(){return a.apply(o,arguments)};return Object.setPrototypeOf(o,s),o}),s3={}.hasOwnProperty;class Vd extends r3{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=YT()}copy(){const t=new Vd;let n=-1;for(;++n<this.attachers.length;){const s=this.attachers[n];t.use(...s)}return t.data(pf(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Sf("data",this.frozen),this.namespace[t]=n,this):s3.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Sf("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[n,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const a=n.call(t,...s);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Qo(t),s=this.parser||this.Parser;return vf("parse",s),s(String(n),n)}process(t,n){const s=this;return this.freeze(),vf("process",this.parser||this.Parser),yf("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(o,c){const f=Qo(t),p=s.parse(f);s.run(p,f,function(g,_,S){if(g||!_||!S)return h(g);const y=_,b=s.stringify(y,S);o3(b)?S.value=b:S.result=b,h(g,S)});function h(g,_){g||!_?c(g):o?o(_):n(void 0,_)}}}processSync(t){let n=!1,s;return this.freeze(),vf("processSync",this.parser||this.Parser),yf("processSync",this.compiler||this.Compiler),this.process(t,a),By("processSync","process",n),s;function a(o,c){n=!0,Ay(o),s=c}}run(t,n,s){My(t),this.freeze();const a=this.transformers;return!s&&typeof n=="function"&&(s=n,n=void 0),s?o(void 0,s):new Promise(o);function o(c,f){const p=Qo(n);a.run(t,p,h);function h(g,_,S){const y=_||t;g?f(g):c?c(y):s(void 0,y,S)}}}runSync(t,n){let s=!1,a;return this.run(t,n,o),By("runSync","run",s),a;function o(c,f){Ay(c),a=f,s=!0}}stringify(t,n){this.freeze();const s=Qo(n),a=this.compiler||this.Compiler;return yf("stringify",a),My(t),a(t,s)}use(t,...n){const s=this.attachers,a=this.namespace;if(Sf("use",this.frozen),t!=null)if(typeof t=="function")p(t,n);else if(typeof t=="object")Array.isArray(t)?f(t):c(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(h){if(typeof h=="function")p(h,[]);else if(typeof h=="object")if(Array.isArray(h)){const[g,..._]=h;p(g,_)}else c(h);else throw new TypeError("Expected usable value, not `"+h+"`")}function c(h){if(!("plugins"in h)&&!("settings"in h))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");f(h.plugins),h.settings&&(a.settings=pf(!0,a.settings,h.settings))}function f(h){let g=-1;if(h!=null)if(Array.isArray(h))for(;++g<h.length;){const _=h[g];o(_)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function p(h,g){let _=-1,S=-1;for(;++_<s.length;)if(s[_][0]===h){S=_;break}if(S===-1)s.push([h,...g]);else if(g.length>0){let[y,...b]=g;const k=s[S][1];vd(k)&&vd(y)&&(y=pf(!0,k,y)),s[S]=[h,y,...b]}}}}const l3=new Vd().freeze();function vf(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function yf(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Sf(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 My(e){if(!vd(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function By(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Qo(e){return a3(e)?e:new Eb(e)}function a3(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function o3(e){return typeof e=="string"||u3(e)}function u3(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const c3="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Ly=[],zy={allowDangerousHtml:!0},h3=/^(https?|ircs?|mailto|xmpp)$/i,f3=[{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 d3(e){const t=p3(e),n=m3(e);return _3(t.runSync(t.parse(n),n),e)}function p3(e){const t=e.rehypePlugins||Ly,n=e.remarkPlugins||Ly,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...zy}:zy;return l3().use(X5).use(n).use(FT,s).use(t)}function m3(e){const t=e.children||"",n=new Eb;return typeof t=="string"&&(n.value=t),n}function _3(e,t){const n=t.allowedElements,s=t.allowElement,a=t.components,o=t.disallowedElements,c=t.skipHtml,f=t.unwrapDisallowed,p=t.urlTransform||g3;for(const g of f3)Object.hasOwn(t,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+c3+g.id,void 0);return Yd(e,h),Mk(e,{Fragment:x.Fragment,components:a,ignoreInvalidStyle:!0,jsx:x.jsx,jsxs:x.jsxs,passKeys:!0,passNode:!0});function h(g,_,S){if(g.type==="raw"&&S&&typeof _=="number")return c?S.children.splice(_,1):S.children[_]={type:"text",value:g.value},_;if(g.type==="element"){let y;for(y in cf)if(Object.hasOwn(cf,y)&&Object.hasOwn(g.properties,y)){const b=g.properties[y],k=cf[y];(k===null||k.includes(g.tagName))&&(g.properties[y]=p(String(b||""),y,g))}}if(g.type==="element"){let y=n?!n.includes(g.tagName):o?o.includes(g.tagName):!1;if(!y&&s&&typeof _=="number"&&(y=!s(g,_,S)),y&&S&&typeof _=="number")return f&&g.children?S.children.splice(_,1,...g.children):S.children.splice(_,1),_}}}function g3(e){const t=e.indexOf(":"),n=e.indexOf("?"),s=e.indexOf("#"),a=e.indexOf("/");return t===-1||a!==-1&&t>a||n!==-1&&t>n||s!==-1&&t>s||h3.test(e.slice(0,t))?e:""}function v3(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Tb(e,t,n){const a=ku((n||{}).ignore||[]),o=y3(t);let c=-1;for(;++c<o.length;)kb(e,"text",f);function f(h,g){let _=-1,S;for(;++_<g.length;){const y=g[_],b=S?S.children:void 0;if(a(y,b?b.indexOf(y):void 0,S))return;S=y}if(S)return p(h,g)}function p(h,g){const _=g[g.length-1],S=o[c][0],y=o[c][1];let b=0;const R=_.children.indexOf(h);let T=!1,$=[];S.lastIndex=0;let j=S.exec(h.value);for(;j;){const O=j.index,X={index:j.index,input:j.input,stack:[...g,h]};let L=y(...j,X);if(typeof L=="string"&&(L=L.length>0?{type:"text",value:L}:void 0),L===!1?S.lastIndex=O+1:(b!==O&&$.push({type:"text",value:h.value.slice(b,O)}),Array.isArray(L)?$.push(...L):L&&$.push(L),b=O+j[0].length,T=!0),!S.global)break;j=S.exec(h.value)}return T?(b<h.value.length&&$.push({type:"text",value:h.value.slice(b)}),_.children.splice(R,1,...$)):$=[h],R+$.length}}function y3(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let s=-1;for(;++s<n.length;){const a=n[s];t.push([S3(a[0]),b3(a[1])])}return t}function S3(e){return typeof e=="string"?new RegExp(v3(e),"g"):e}function b3(e){return typeof e=="function"?e:function(){return e}}function x3(e){Tb(e,[/\r?\n|\r/g,w3])}function w3(){return{type:"break"}}function C3(){return function(e){x3(e)}}function Ny(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let s=0,a=n.indexOf(t);for(;a!==-1;)s++,a=n.indexOf(t,a+t.length);return s}const bf="phrasing",xf=["autolink","link","image","label"];function k3(){return{transforms:[B3],enter:{literalAutolink:T3,literalAutolinkEmail:wf,literalAutolinkHttp:wf,literalAutolinkWww:wf},exit:{literalAutolink:M3,literalAutolinkEmail:R3,literalAutolinkHttp:A3,literalAutolinkWww:D3}}}function E3(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:bf,notInConstruct:xf},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:bf,notInConstruct:xf},{character:":",before:"[ps]",after:"\\/",inConstruct:bf,notInConstruct:xf}]}}function T3(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function wf(e){this.config.enter.autolinkProtocol.call(this,e)}function A3(e){this.config.exit.autolinkProtocol.call(this,e)}function D3(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function R3(e){this.config.exit.autolinkEmail.call(this,e)}function M3(e){this.exit(e)}function B3(e){Tb(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,L3],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),z3]],{ignore:["link","linkReference"]})}function L3(e,t,n,s,a){let o="";if(!Ab(a)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!N3(n)))return!1;const c=O3(n+s);if(!c[0])return!1;const f={type:"link",title:null,url:o+t+c[0],children:[{type:"text",value:t+c[0]}]};return c[1]?[f,{type:"text",value:c[1]}]:f}function z3(e,t,n,s){return!Ab(s,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function N3(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function O3(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],s=n.indexOf(")");const a=Ny(e,"(");let o=Ny(e,")");for(;s!==-1&&a>o;)e+=n.slice(0,s+1),n=n.slice(s+1),s=n.indexOf(")"),o++;return[e,n]}function Ab(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Vr(n)||xu(n))&&(!t||n!==47)}Db.peek=Y3;function H3(){this.buffer()}function j3(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function U3(){this.buffer()}function P3(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function I3(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Qi(this.sliceSerialize(e)).toLowerCase(),n.label=t}function F3(e){this.exit(e)}function q3(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Qi(this.sliceSerialize(e)).toLowerCase(),n.label=t}function W3(e){this.exit(e)}function Y3(){return"["}function Db(e,t,n,s){const a=n.createTracker(s);let o=a.move("[^");const c=n.enter("footnoteReference"),f=n.enter("reference");return o+=a.move(n.safe(n.associationId(e),{after:"]",before:o})),f(),c(),o+=a.move("]"),o}function V3(){return{enter:{gfmFootnoteCallString:H3,gfmFootnoteCall:j3,gfmFootnoteDefinitionLabelString:U3,gfmFootnoteDefinition:P3},exit:{gfmFootnoteCallString:I3,gfmFootnoteCall:F3,gfmFootnoteDefinitionLabelString:q3,gfmFootnoteDefinition:W3}}}function K3(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Db},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(s,a,o,c){const f=o.createTracker(c);let p=f.move("[^");const h=o.enter("footnoteDefinition"),g=o.enter("label");return p+=f.move(o.safe(o.associationId(s),{before:p,after:"]"})),g(),p+=f.move("]:"),s.children&&s.children.length>0&&(f.shift(4),p+=f.move((t?`
114
+ `:" ")+o.indentLines(o.containerFlow(s,f.current()),t?Rb:X3))),h(),p}}function X3(e,t,n){return t===0?e:Rb(e,t,n)}function Rb(e,t,n){return(n?"":" ")+e}const $3=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Mb.peek=eA;function G3(){return{canContainEols:["delete"],enter:{strikethrough:Q3},exit:{strikethrough:J3}}}function Z3(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:$3}],handlers:{delete:Mb}}}function Q3(e){this.enter({type:"delete",children:[]},e)}function J3(e){this.exit(e)}function Mb(e,t,n,s){const a=n.createTracker(s),o=n.enter("strikethrough");let c=a.move("~~");return c+=n.containerPhrasing(e,{...a.current(),before:c,after:"~"}),c+=a.move("~~"),o(),c}function eA(){return"~"}function tA(e){return e.length}function iA(e,t){const n=t||{},s=(n.align||[]).concat(),a=n.stringLength||tA,o=[],c=[],f=[],p=[];let h=0,g=-1;for(;++g<e.length;){const k=[],R=[];let T=-1;for(e[g].length>h&&(h=e[g].length);++T<e[g].length;){const $=nA(e[g][T]);if(n.alignDelimiters!==!1){const j=a($);R[T]=j,(p[T]===void 0||j>p[T])&&(p[T]=j)}k.push($)}c[g]=k,f[g]=R}let _=-1;if(typeof s=="object"&&"length"in s)for(;++_<h;)o[_]=Oy(s[_]);else{const k=Oy(s);for(;++_<h;)o[_]=k}_=-1;const S=[],y=[];for(;++_<h;){const k=o[_];let R="",T="";k===99?(R=":",T=":"):k===108?R=":":k===114&&(T=":");let $=n.alignDelimiters===!1?1:Math.max(1,p[_]-R.length-T.length);const j=R+"-".repeat($)+T;n.alignDelimiters!==!1&&($=R.length+$+T.length,$>p[_]&&(p[_]=$),y[_]=$),S[_]=j}c.splice(1,0,S),f.splice(1,0,y),g=-1;const b=[];for(;++g<c.length;){const k=c[g],R=f[g];_=-1;const T=[];for(;++_<h;){const $=k[_]||"";let j="",O="";if(n.alignDelimiters!==!1){const X=p[_]-(R[_]||0),L=o[_];L===114?j=" ".repeat(X):L===99?X%2?(j=" ".repeat(X/2+.5),O=" ".repeat(X/2-.5)):(j=" ".repeat(X/2),O=j):O=" ".repeat(X)}n.delimiterStart!==!1&&!_&&T.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&$==="")&&(n.delimiterStart!==!1||_)&&T.push(" "),n.alignDelimiters!==!1&&T.push(j),T.push($),n.alignDelimiters!==!1&&T.push(O),n.padding!==!1&&T.push(" "),(n.delimiterEnd!==!1||_!==h-1)&&T.push("|")}b.push(n.delimiterEnd===!1?T.join("").replace(/ +$/,""):T.join(""))}return b.join(`
115
115
  `)}function nA(e){return e==null?"":String(e)}function Oy(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function rA(e,t,n,s){const a=n.enter("blockquote"),o=n.createTracker(s);o.move("> "),o.shift(2);const c=n.indentLines(n.containerFlow(e,o.current()),sA);return a(),c}function sA(e,t,n){return">"+(n?"":" ")+e}function lA(e,t){return Hy(e,t.inConstruct,!0)&&!Hy(e,t.notInConstruct,!1)}function Hy(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let s=-1;for(;++s<t.length;)if(e.includes(t[s]))return!0;return!1}function jy(e,t,n,s){let a=-1;for(;++a<n.unsafe.length;)if(n.unsafe[a].character===`
116
116
  `&&lA(n.stack,n.unsafe[a]))return/[ \t]/.test(s.before)?"":" ";return`\\
117
- `}function aA(e,t){const n=String(e);let s=n.indexOf(t),a=s,o=0,c=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;s!==-1;)s===a?++o>c&&(c=o):o=1,a=s+t.length,s=n.indexOf(t,a);return c}function oA(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function uA(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function cA(e,t,n,s){const a=uA(n),o=e.value||"",c=a==="`"?"GraveAccent":"Tilde";if(oA(e,n)){const m=n.enter("codeIndented"),S=n.indentLines(o,hA);return m(),S}const f=n.createTracker(s),p=a.repeat(Math.max(aA(o,a)+1,3)),h=n.enter("codeFenced");let g=f.move(p);if(e.lang){const m=n.enter(`codeFencedLang${c}`);g+=f.move(n.safe(e.lang,{before:g,after:" ",encode:["`"],...f.current()})),m()}if(e.lang&&e.meta){const m=n.enter(`codeFencedMeta${c}`);g+=f.move(" "),g+=f.move(n.safe(e.meta,{before:g,after:`
118
- `,encode:["`"],...f.current()})),m()}return g+=f.move(`
117
+ `}function aA(e,t){const n=String(e);let s=n.indexOf(t),a=s,o=0,c=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;s!==-1;)s===a?++o>c&&(c=o):o=1,a=s+t.length,s=n.indexOf(t,a);return c}function oA(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function uA(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function cA(e,t,n,s){const a=uA(n),o=e.value||"",c=a==="`"?"GraveAccent":"Tilde";if(oA(e,n)){const _=n.enter("codeIndented"),S=n.indentLines(o,hA);return _(),S}const f=n.createTracker(s),p=a.repeat(Math.max(aA(o,a)+1,3)),h=n.enter("codeFenced");let g=f.move(p);if(e.lang){const _=n.enter(`codeFencedLang${c}`);g+=f.move(n.safe(e.lang,{before:g,after:" ",encode:["`"],...f.current()})),_()}if(e.lang&&e.meta){const _=n.enter(`codeFencedMeta${c}`);g+=f.move(" "),g+=f.move(n.safe(e.meta,{before:g,after:`
118
+ `,encode:["`"],...f.current()})),_()}return g+=f.move(`
119
119
  `),o&&(g+=f.move(o+`
120
120
  `)),g+=f.move(p),h(),g}function hA(e,t,n){return(n?"":" ")+e}function Kd(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function fA(e,t,n,s){const a=Kd(n),o=a==='"'?"Quote":"Apostrophe",c=n.enter("definition");let f=n.enter("label");const p=n.createTracker(s);let h=p.move("[");return h+=p.move(n.safe(n.associationId(e),{before:h,after:"]",...p.current()})),h+=p.move("]: "),f(),!e.url||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),h+=p.move("<"),h+=p.move(n.safe(e.url,{before:h,after:">",...p.current()})),h+=p.move(">")):(f=n.enter("destinationRaw"),h+=p.move(n.safe(e.url,{before:h,after:e.title?" ":`
121
- `,...p.current()}))),f(),e.title&&(f=n.enter(`title${o}`),h+=p.move(" "+a),h+=p.move(n.safe(e.title,{before:h,after:a,...p.current()})),h+=p.move(a),f()),c(),h}function dA(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function _a(e){return"&#x"+e.toString(16).toUpperCase()+";"}function mu(e,t,n){const s=Vs(e),a=Vs(t);return s===void 0?a===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:s===1?a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Bb.peek=pA;function Bb(e,t,n,s){const a=dA(n),o=n.enter("emphasis"),c=n.createTracker(s),f=c.move(a);let p=c.move(n.containerPhrasing(e,{after:a,before:f,...c.current()}));const h=p.charCodeAt(0),g=mu(s.before.charCodeAt(s.before.length-1),h,a);g.inside&&(p=_a(h)+p.slice(1));const m=p.charCodeAt(p.length-1),S=mu(s.after.charCodeAt(0),m,a);S.inside&&(p=p.slice(0,-1)+_a(m));const v=c.move(a);return o(),n.attentionEncodeSurroundingInfo={after:S.outside,before:g.outside},f+p+v}function pA(e,t,n){return n.options.emphasis||"*"}function _A(e,t){let n=!1;return Yd(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return n=!0,md}),!!((!e.depth||e.depth<3)&&jd(e)&&(t.options.setext||n))}function mA(e,t,n,s){const a=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(s);if(_A(e,n)){const g=n.enter("headingSetext"),m=n.enter("phrasing"),S=n.containerPhrasing(e,{...o.current(),before:`
121
+ `,...p.current()}))),f(),e.title&&(f=n.enter(`title${o}`),h+=p.move(" "+a),h+=p.move(n.safe(e.title,{before:h,after:a,...p.current()})),h+=p.move(a),f()),c(),h}function dA(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function ma(e){return"&#x"+e.toString(16).toUpperCase()+";"}function _u(e,t,n){const s=Vs(e),a=Vs(t);return s===void 0?a===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:s===1?a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Bb.peek=pA;function Bb(e,t,n,s){const a=dA(n),o=n.enter("emphasis"),c=n.createTracker(s),f=c.move(a);let p=c.move(n.containerPhrasing(e,{after:a,before:f,...c.current()}));const h=p.charCodeAt(0),g=_u(s.before.charCodeAt(s.before.length-1),h,a);g.inside&&(p=ma(h)+p.slice(1));const _=p.charCodeAt(p.length-1),S=_u(s.after.charCodeAt(0),_,a);S.inside&&(p=p.slice(0,-1)+ma(_));const y=c.move(a);return o(),n.attentionEncodeSurroundingInfo={after:S.outside,before:g.outside},f+p+y}function pA(e,t,n){return n.options.emphasis||"*"}function mA(e,t){let n=!1;return Yd(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return n=!0,_d}),!!((!e.depth||e.depth<3)&&jd(e)&&(t.options.setext||n))}function _A(e,t,n,s){const a=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(s);if(mA(e,n)){const g=n.enter("headingSetext"),_=n.enter("phrasing"),S=n.containerPhrasing(e,{...o.current(),before:`
122
122
  `,after:`
123
- `});return m(),g(),S+`
123
+ `});return _(),g(),S+`
124
124
  `+(a===1?"=":"-").repeat(S.length-(Math.max(S.lastIndexOf("\r"),S.lastIndexOf(`
125
125
  `))+1))}const c="#".repeat(a),f=n.enter("headingAtx"),p=n.enter("phrasing");o.move(c+" ");let h=n.containerPhrasing(e,{before:"# ",after:`
126
- `,...o.current()});return/^[\t ]/.test(h)&&(h=_a(h.charCodeAt(0))+h.slice(1)),h=h?c+" "+h:c,n.options.closeAtx&&(h+=" "+c),p(),f(),h}Lb.peek=gA;function Lb(e){return e.value||""}function gA(){return"<"}zb.peek=vA;function zb(e,t,n,s){const a=Kd(n),o=a==='"'?"Quote":"Apostrophe",c=n.enter("image");let f=n.enter("label");const p=n.createTracker(s);let h=p.move("![");return h+=p.move(n.safe(e.alt,{before:h,after:"]",...p.current()})),h+=p.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),h+=p.move("<"),h+=p.move(n.safe(e.url,{before:h,after:">",...p.current()})),h+=p.move(">")):(f=n.enter("destinationRaw"),h+=p.move(n.safe(e.url,{before:h,after:e.title?" ":")",...p.current()}))),f(),e.title&&(f=n.enter(`title${o}`),h+=p.move(" "+a),h+=p.move(n.safe(e.title,{before:h,after:a,...p.current()})),h+=p.move(a),f()),h+=p.move(")"),c(),h}function vA(){return"!"}Nb.peek=yA;function Nb(e,t,n,s){const a=e.referenceType,o=n.enter("imageReference");let c=n.enter("label");const f=n.createTracker(s);let p=f.move("![");const h=n.safe(e.alt,{before:p,after:"]",...f.current()});p+=f.move(h+"]["),c();const g=n.stack;n.stack=[],c=n.enter("reference");const m=n.safe(n.associationId(e),{before:p,after:"]",...f.current()});return c(),n.stack=g,o(),a==="full"||!h||h!==m?p+=f.move(m+"]"):a==="shortcut"?p=p.slice(0,-1):p+=f.move("]"),p}function yA(){return"!"}Ob.peek=SA;function Ob(e,t,n){let s=e.value||"",a="`",o=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(s);)a+="`";for(/[^ \r\n]/.test(s)&&(/^[ \r\n]/.test(s)&&/[ \r\n]$/.test(s)||/^`|`$/.test(s))&&(s=" "+s+" ");++o<n.unsafe.length;){const c=n.unsafe[o],f=n.compilePattern(c);let p;if(c.atBreak)for(;p=f.exec(s);){let h=p.index;s.charCodeAt(h)===10&&s.charCodeAt(h-1)===13&&h--,s=s.slice(0,h)+" "+s.slice(p.index+1)}}return a+s+a}function SA(){return"`"}function Hb(e,t){const n=jd(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}jb.peek=bA;function jb(e,t,n,s){const a=Kd(n),o=a==='"'?"Quote":"Apostrophe",c=n.createTracker(s);let f,p;if(Hb(e,n)){const g=n.stack;n.stack=[],f=n.enter("autolink");let m=c.move("<");return m+=c.move(n.containerPhrasing(e,{before:m,after:">",...c.current()})),m+=c.move(">"),f(),n.stack=g,m}f=n.enter("link"),p=n.enter("label");let h=c.move("[");return h+=c.move(n.containerPhrasing(e,{before:h,after:"](",...c.current()})),h+=c.move("]("),p(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(p=n.enter("destinationLiteral"),h+=c.move("<"),h+=c.move(n.safe(e.url,{before:h,after:">",...c.current()})),h+=c.move(">")):(p=n.enter("destinationRaw"),h+=c.move(n.safe(e.url,{before:h,after:e.title?" ":")",...c.current()}))),p(),e.title&&(p=n.enter(`title${o}`),h+=c.move(" "+a),h+=c.move(n.safe(e.title,{before:h,after:a,...c.current()})),h+=c.move(a),p()),h+=c.move(")"),f(),h}function bA(e,t,n){return Hb(e,n)?"<":"["}Ub.peek=xA;function Ub(e,t,n,s){const a=e.referenceType,o=n.enter("linkReference");let c=n.enter("label");const f=n.createTracker(s);let p=f.move("[");const h=n.containerPhrasing(e,{before:p,after:"]",...f.current()});p+=f.move(h+"]["),c();const g=n.stack;n.stack=[],c=n.enter("reference");const m=n.safe(n.associationId(e),{before:p,after:"]",...f.current()});return c(),n.stack=g,o(),a==="full"||!h||h!==m?p+=f.move(m+"]"):a==="shortcut"?p=p.slice(0,-1):p+=f.move("]"),p}function xA(){return"["}function Xd(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function wA(e){const t=Xd(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function CA(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function Pb(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function kA(e,t,n,s){const a=n.enter("list"),o=n.bulletCurrent;let c=e.ordered?CA(n):Xd(n);const f=e.ordered?c==="."?")":".":wA(n);let p=t&&n.bulletLastUsed?c===n.bulletLastUsed:!1;if(!e.ordered){const g=e.children?e.children[0]:void 0;if((c==="*"||c==="-")&&g&&(!g.children||!g.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(p=!0),Pb(n)===c&&g){let m=-1;for(;++m<e.children.length;){const S=e.children[m];if(S&&S.type==="listItem"&&S.children&&S.children[0]&&S.children[0].type==="thematicBreak"){p=!0;break}}}}p&&(c=f),n.bulletCurrent=c;const h=n.containerFlow(e,s);return n.bulletLastUsed=c,n.bulletCurrent=o,a(),h}function EA(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function TA(e,t,n,s){const a=EA(n);let o=n.bulletCurrent||Xd(n);t&&t.type==="list"&&t.ordered&&(o=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let c=o.length+1;(a==="tab"||a==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(c=Math.ceil(c/4)*4);const f=n.createTracker(s);f.move(o+" ".repeat(c-o.length)),f.shift(c);const p=n.enter("listItem"),h=n.indentLines(n.containerFlow(e,f.current()),g);return p(),h;function g(m,S,v){return S?(v?"":" ".repeat(c))+m:(v?o:o+" ".repeat(c-o.length))+m}}function AA(e,t,n,s){const a=n.enter("paragraph"),o=n.enter("phrasing"),c=n.containerPhrasing(e,s);return o(),a(),c}const DA=ku(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function RA(e,t,n,s){return(e.children.some(function(c){return DA(c)})?n.containerPhrasing:n.containerFlow).call(n,e,s)}function MA(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Ib.peek=BA;function Ib(e,t,n,s){const a=MA(n),o=n.enter("strong"),c=n.createTracker(s),f=c.move(a+a);let p=c.move(n.containerPhrasing(e,{after:a,before:f,...c.current()}));const h=p.charCodeAt(0),g=mu(s.before.charCodeAt(s.before.length-1),h,a);g.inside&&(p=_a(h)+p.slice(1));const m=p.charCodeAt(p.length-1),S=mu(s.after.charCodeAt(0),m,a);S.inside&&(p=p.slice(0,-1)+_a(m));const v=c.move(a+a);return o(),n.attentionEncodeSurroundingInfo={after:S.outside,before:g.outside},f+p+v}function BA(e,t,n){return n.options.strong||"*"}function LA(e,t,n,s){return n.safe(e.value,s)}function zA(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function NA(e,t,n){const s=(Pb(n)+(n.options.ruleSpaces?" ":"")).repeat(zA(n));return n.options.ruleSpaces?s.slice(0,-1):s}const Fb={blockquote:rA,break:jy,code:cA,definition:fA,emphasis:Bb,hardBreak:jy,heading:mA,html:Lb,image:zb,imageReference:Nb,inlineCode:Ob,link:jb,linkReference:Ub,list:kA,listItem:TA,paragraph:AA,root:RA,strong:Ib,text:LA,thematicBreak:NA};function OA(){return{enter:{table:HA,tableData:Uy,tableHeader:Uy,tableRow:UA},exit:{codeText:PA,table:jA,tableData:Cf,tableHeader:Cf,tableRow:Cf}}}function HA(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function jA(e){this.exit(e),this.data.inTable=void 0}function UA(e){this.enter({type:"tableRow",children:[]},e)}function Cf(e){this.exit(e)}function Uy(e){this.enter({type:"tableCell",children:[]},e)}function PA(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,IA));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function IA(e,t){return t==="|"?t:e}function FA(e){const t=e||{},n=t.tableCellPadding,s=t.tablePipeAlign,a=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
127
- `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:S,table:c,tableCell:p,tableRow:f}};function c(v,b,k,B){return h(g(v,k,B),v.align)}function f(v,b,k,B){const D=m(v,k,B),G=h([D]);return G.slice(0,G.indexOf(`
128
- `))}function p(v,b,k,B){const D=k.enter("tableCell"),G=k.enter("phrasing"),A=k.containerPhrasing(v,{...B,before:o,after:o});return G(),D(),A}function h(v,b){return iA(v,{align:b,alignDelimiters:s,padding:n,stringLength:a})}function g(v,b,k){const B=v.children;let D=-1;const G=[],A=b.enter("table");for(;++D<B.length;)G[D]=m(B[D],b,k);return A(),G}function m(v,b,k){const B=v.children;let D=-1;const G=[],A=b.enter("tableRow");for(;++D<B.length;)G[D]=p(B[D],v,b,k);return A(),G}function S(v,b,k){let B=Fb.inlineCode(v,b,k);return k.stack.includes("tableCell")&&(B=B.replace(/\|/g,"\\$&")),B}}function qA(){return{exit:{taskListCheckValueChecked:Py,taskListCheckValueUnchecked:Py,paragraph:YA}}}function WA(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:VA}}}function Py(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function YA(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const s=n.children[0];if(s&&s.type==="text"){const a=t.children;let o=-1,c;for(;++o<a.length;){const f=a[o];if(f.type==="paragraph"){c=f;break}}c===n&&(s.value=s.value.slice(1),s.value.length===0?n.children.shift():n.position&&s.position&&typeof s.position.start.offset=="number"&&(s.position.start.column++,s.position.start.offset++,n.position.start=Object.assign({},s.position.start)))}}this.exit(e)}function VA(e,t,n,s){const a=e.children[0],o=typeof e.checked=="boolean"&&a&&a.type==="paragraph",c="["+(e.checked?"x":" ")+"] ",f=n.createTracker(s);o&&f.move(c);let p=Fb.listItem(e,t,n,{...s,...f.current()});return o&&(p=p.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),p;function h(g){return g+c}}function KA(){return[k3(),V3(),G3(),OA(),qA()]}function XA(e){return{extensions:[E3(),K3(e),Z3(),FA(e),WA()]}}const $A={tokenize:tD,partial:!0},qb={tokenize:iD,partial:!0},Wb={tokenize:nD,partial:!0},Yb={tokenize:rD,partial:!0},GA={tokenize:sD,partial:!0},Vb={name:"wwwAutolink",tokenize:JA,previous:Xb},Kb={name:"protocolAutolink",tokenize:eD,previous:$b},Hn={name:"emailAutolink",tokenize:QA,previous:Gb},hn={};function ZA(){return{text:hn}}let jr=48;for(;jr<123;)hn[jr]=Hn,jr++,jr===58?jr=65:jr===91&&(jr=97);hn[43]=Hn;hn[45]=Hn;hn[46]=Hn;hn[95]=Hn;hn[72]=[Hn,Kb];hn[104]=[Hn,Kb];hn[87]=[Hn,Vb];hn[119]=[Hn,Vb];function QA(e,t,n){const s=this;let a,o;return c;function c(m){return!Sd(m)||!Gb.call(s,s.previous)||$d(s.events)?n(m):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(m))}function f(m){return Sd(m)?(e.consume(m),f):m===64?(e.consume(m),p):n(m)}function p(m){return m===46?e.check(GA,g,h)(m):m===45||m===95||$t(m)?(o=!0,e.consume(m),p):g(m)}function h(m){return e.consume(m),a=!0,p}function g(m){return o&&a&&ni(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(m)):n(m)}}function JA(e,t,n){const s=this;return a;function a(c){return c!==87&&c!==119||!Xb.call(s,s.previous)||$d(s.events)?n(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check($A,e.attempt(qb,e.attempt(Wb,o),n),n)(c))}function o(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(c)}}function eD(e,t,n){const s=this;let a="",o=!1;return c;function c(m){return(m===72||m===104)&&$b.call(s,s.previous)&&!$d(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(m),e.consume(m),f):n(m)}function f(m){if(ni(m)&&a.length<5)return a+=String.fromCodePoint(m),e.consume(m),f;if(m===58){const S=a.toLowerCase();if(S==="http"||S==="https")return e.consume(m),p}return n(m)}function p(m){return m===47?(e.consume(m),o?h:(o=!0,p)):n(m)}function h(m){return m===null||pu(m)||Qe(m)||Vr(m)||xu(m)?n(m):e.attempt(qb,e.attempt(Wb,g),n)(m)}function g(m){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(m)}}function tD(e,t,n){let s=0;return a;function a(c){return(c===87||c===119)&&s<3?(s++,e.consume(c),a):c===46&&s===3?(e.consume(c),o):n(c)}function o(c){return c===null?n(c):t(c)}}function iD(e,t,n){let s,a,o;return c;function c(h){return h===46||h===95?e.check(Yb,p,f)(h):h===null||Qe(h)||Vr(h)||h!==45&&xu(h)?p(h):(o=!0,e.consume(h),c)}function f(h){return h===95?s=!0:(a=s,s=void 0),e.consume(h),c}function p(h){return a||s||!o?n(h):t(h)}}function nD(e,t){let n=0,s=0;return a;function a(c){return c===40?(n++,e.consume(c),a):c===41&&s<n?o(c):c===33||c===34||c===38||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===60||c===63||c===93||c===95||c===126?e.check(Yb,t,o)(c):c===null||Qe(c)||Vr(c)?t(c):(e.consume(c),a)}function o(c){return c===41&&s++,e.consume(c),a}}function rD(e,t,n){return s;function s(f){return f===33||f===34||f===39||f===41||f===42||f===44||f===46||f===58||f===59||f===63||f===95||f===126?(e.consume(f),s):f===38?(e.consume(f),o):f===93?(e.consume(f),a):f===60||f===null||Qe(f)||Vr(f)?t(f):n(f)}function a(f){return f===null||f===40||f===91||Qe(f)||Vr(f)?t(f):s(f)}function o(f){return ni(f)?c(f):n(f)}function c(f){return f===59?(e.consume(f),s):ni(f)?(e.consume(f),c):n(f)}}function sD(e,t,n){return s;function s(o){return e.consume(o),a}function a(o){return $t(o)?n(o):t(o)}}function Xb(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Qe(e)}function $b(e){return!ni(e)}function Gb(e){return!(e===47||Sd(e))}function Sd(e){return e===43||e===45||e===46||e===95||$t(e)}function $d(e){let t=e.length,n=!1;for(;t--;){const s=e[t][1];if((s.type==="labelLink"||s.type==="labelImage")&&!s._balanced){n=!0;break}if(s._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const lD={tokenize:pD,partial:!0};function aD(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:hD,continuation:{tokenize:fD},exit:dD}},text:{91:{name:"gfmFootnoteCall",tokenize:cD},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:oD,resolveTo:uD}}}}function oD(e,t,n){const s=this;let a=s.events.length;const o=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let c;for(;a--;){const p=s.events[a][1];if(p.type==="labelImage"){c=p;break}if(p.type==="gfmFootnoteCall"||p.type==="labelLink"||p.type==="label"||p.type==="image"||p.type==="link")break}return f;function f(p){if(!c||!c._balanced)return n(p);const h=Qi(s.sliceSerialize({start:c.end,end:s.now()}));return h.codePointAt(0)!==94||!o.includes(h.slice(1))?n(p):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),t(p))}}function uD(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const s={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},c={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},f=[e[n+1],e[n+2],["enter",s,t],e[n+3],e[n+4],["enter",a,t],["exit",a,t],["enter",o,t],["enter",c,t],["exit",c,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",s,t]];return e.splice(n,e.length-n+1,...f),e}function cD(e,t,n){const s=this,a=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let o=0,c;return f;function f(m){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),p}function p(m){return m!==94?n(m):(e.enter("gfmFootnoteCallMarker"),e.consume(m),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",h)}function h(m){if(o>999||m===93&&!c||m===null||m===91||Qe(m))return n(m);if(m===93){e.exit("chunkString");const S=e.exit("gfmFootnoteCallString");return a.includes(Qi(s.sliceSerialize(S)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(m)}return Qe(m)||(c=!0),o++,e.consume(m),m===92?g:h}function g(m){return m===91||m===92||m===93?(e.consume(m),o++,h):h(m)}}function hD(e,t,n){const s=this,a=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let o,c=0,f;return p;function p(b){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(b),e.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(b){return b===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(b),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",g):n(b)}function g(b){if(c>999||b===93&&!f||b===null||b===91||Qe(b))return n(b);if(b===93){e.exit("chunkString");const k=e.exit("gfmFootnoteDefinitionLabelString");return o=Qi(s.sliceSerialize(k)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(b),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),S}return Qe(b)||(f=!0),c++,e.consume(b),b===92?m:g}function m(b){return b===91||b===92||b===93?(e.consume(b),c++,g):g(b)}function S(b){return b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),a.includes(o)||a.push(o),je(e,v,"gfmFootnoteDefinitionWhitespace")):n(b)}function v(b){return t(b)}}function fD(e,t,n){return e.check(ba,t,e.attempt(lD,t,n))}function dD(e){e.exit("gfmFootnoteDefinition")}function pD(e,t,n){const s=this;return je(e,a,"gfmFootnoteDefinitionIndent",5);function a(o){const c=s.events[s.events.length-1];return c&&c[1].type==="gfmFootnoteDefinitionIndent"&&c[2].sliceSerialize(c[1],!0).length===4?t(o):n(o)}}function _D(e){let n=(e||{}).singleTilde;const s={name:"strikethrough",tokenize:o,resolveAll:a};return n==null&&(n=!0),{text:{126:s},insideSpan:{null:[s]},attentionMarkers:{null:[126]}};function a(c,f){let p=-1;for(;++p<c.length;)if(c[p][0]==="enter"&&c[p][1].type==="strikethroughSequenceTemporary"&&c[p][1]._close){let h=p;for(;h--;)if(c[h][0]==="exit"&&c[h][1].type==="strikethroughSequenceTemporary"&&c[h][1]._open&&c[p][1].end.offset-c[p][1].start.offset===c[h][1].end.offset-c[h][1].start.offset){c[p][1].type="strikethroughSequence",c[h][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},c[h][1].start),end:Object.assign({},c[p][1].end)},m={type:"strikethroughText",start:Object.assign({},c[h][1].end),end:Object.assign({},c[p][1].start)},S=[["enter",g,f],["enter",c[h][1],f],["exit",c[h][1],f],["enter",m,f]],v=f.parser.constructs.insideSpan.null;v&&Mi(S,S.length,0,wu(v,c.slice(h+1,p),f)),Mi(S,S.length,0,[["exit",m,f],["enter",c[p][1],f],["exit",c[p][1],f],["exit",g,f]]),Mi(c,h-1,p-h+3,S),p=h+S.length-2;break}}for(p=-1;++p<c.length;)c[p][1].type==="strikethroughSequenceTemporary"&&(c[p][1].type="data");return c}function o(c,f,p){const h=this.previous,g=this.events;let m=0;return S;function S(b){return h===126&&g[g.length-1][1].type!=="characterEscape"?p(b):(c.enter("strikethroughSequenceTemporary"),v(b))}function v(b){const k=Vs(h);if(b===126)return m>1?p(b):(c.consume(b),m++,v);if(m<2&&!n)return p(b);const B=c.exit("strikethroughSequenceTemporary"),D=Vs(b);return B._open=!D||D===2&&!!k,B._close=!k||k===2&&!!D,f(b)}}}class mD{constructor(){this.map=[]}add(t,n,s){gD(this,t,n,s)}consume(t){if(this.map.sort(function(o,c){return o[0]-c[0]}),this.map.length===0)return;let n=this.map.length;const s=[];for(;n>0;)n-=1,s.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];s.push(t.slice()),t.length=0;let a=s.pop();for(;a;){for(const o of a)t.push(o);a=s.pop()}this.map.length=0}}function gD(e,t,n,s){let a=0;if(!(n===0&&s.length===0)){for(;a<e.map.length;){if(e.map[a][0]===t){e.map[a][1]+=n,e.map[a][2].push(...s);return}a+=1}e.map.push([t,n,s])}}function vD(e,t){let n=!1;const s=[];for(;t<e.length;){const a=e[t];if(n){if(a[0]==="enter")a[1].type==="tableContent"&&s.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(a[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=s.length-1;s[o]=s[o]==="left"?"center":"right"}}else if(a[1].type==="tableDelimiterRow")break}else a[0]==="enter"&&a[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return s}function yD(){return{flow:{null:{name:"table",tokenize:SD,resolveAll:bD}}}}function SD(e,t,n){const s=this;let a=0,o=0,c;return f;function f(j){let ne=s.events.length-1;for(;ne>-1;){const K=s.events[ne][1].type;if(K==="lineEnding"||K==="linePrefix")ne--;else break}const Y=ne>-1?s.events[ne][1].type:null,U=Y==="tableHead"||Y==="tableRow"?z:p;return U===z&&s.parser.lazy[s.now().line]?n(j):U(j)}function p(j){return e.enter("tableHead"),e.enter("tableRow"),h(j)}function h(j){return j===124||(c=!0,o+=1),g(j)}function g(j){return j===null?n(j):ve(j)?o>1?(o=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),v):n(j):Le(j)?je(e,g,"whitespace")(j):(o+=1,c&&(c=!1,a+=1),j===124?(e.enter("tableCellDivider"),e.consume(j),e.exit("tableCellDivider"),c=!0,g):(e.enter("data"),m(j)))}function m(j){return j===null||j===124||Qe(j)?(e.exit("data"),g(j)):(e.consume(j),j===92?S:m)}function S(j){return j===92||j===124?(e.consume(j),m):m(j)}function v(j){return s.interrupt=!1,s.parser.lazy[s.now().line]?n(j):(e.enter("tableDelimiterRow"),c=!1,Le(j)?je(e,b,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):b(j))}function b(j){return j===45||j===58?B(j):j===124?(c=!0,e.enter("tableCellDivider"),e.consume(j),e.exit("tableCellDivider"),k):$(j)}function k(j){return Le(j)?je(e,B,"whitespace")(j):B(j)}function B(j){return j===58?(o+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(j),e.exit("tableDelimiterMarker"),D):j===45?(o+=1,D(j)):j===null||ve(j)?N(j):$(j)}function D(j){return j===45?(e.enter("tableDelimiterFiller"),G(j)):$(j)}function G(j){return j===45?(e.consume(j),G):j===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(j),e.exit("tableDelimiterMarker"),A):(e.exit("tableDelimiterFiller"),A(j))}function A(j){return Le(j)?je(e,N,"whitespace")(j):N(j)}function N(j){return j===124?b(j):j===null||ve(j)?!c||a!==o?$(j):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(j)):$(j)}function $(j){return n(j)}function z(j){return e.enter("tableRow"),Q(j)}function Q(j){return j===124?(e.enter("tableCellDivider"),e.consume(j),e.exit("tableCellDivider"),Q):j===null||ve(j)?(e.exit("tableRow"),t(j)):Le(j)?je(e,Q,"whitespace")(j):(e.enter("data"),se(j))}function se(j){return j===null||j===124||Qe(j)?(e.exit("data"),Q(j)):(e.consume(j),j===92?he:se)}function he(j){return j===92||j===124?(e.consume(j),se):se(j)}}function bD(e,t){let n=-1,s=!0,a=0,o=[0,0,0,0],c=[0,0,0,0],f=!1,p=0,h,g,m;const S=new mD;for(;++n<e.length;){const v=e[n],b=v[1];v[0]==="enter"?b.type==="tableHead"?(f=!1,p!==0&&(Iy(S,t,p,h,g),g=void 0,p=0),h={type:"table",start:Object.assign({},b.start),end:Object.assign({},b.end)},S.add(n,0,[["enter",h,t]])):b.type==="tableRow"||b.type==="tableDelimiterRow"?(s=!0,m=void 0,o=[0,0,0,0],c=[0,n+1,0,0],f&&(f=!1,g={type:"tableBody",start:Object.assign({},b.start),end:Object.assign({},b.end)},S.add(n,0,[["enter",g,t]])),a=b.type==="tableDelimiterRow"?2:g?3:1):a&&(b.type==="data"||b.type==="tableDelimiterMarker"||b.type==="tableDelimiterFiller")?(s=!1,c[2]===0&&(o[1]!==0&&(c[0]=c[1],m=Jo(S,t,o,a,void 0,m),o=[0,0,0,0]),c[2]=n)):b.type==="tableCellDivider"&&(s?s=!1:(o[1]!==0&&(c[0]=c[1],m=Jo(S,t,o,a,void 0,m)),o=c,c=[o[1],n,0,0])):b.type==="tableHead"?(f=!0,p=n):b.type==="tableRow"||b.type==="tableDelimiterRow"?(p=n,o[1]!==0?(c[0]=c[1],m=Jo(S,t,o,a,n,m)):c[1]!==0&&(m=Jo(S,t,c,a,n,m)),a=0):a&&(b.type==="data"||b.type==="tableDelimiterMarker"||b.type==="tableDelimiterFiller")&&(c[3]=n)}for(p!==0&&Iy(S,t,p,h,g),S.consume(t.events),n=-1;++n<t.events.length;){const v=t.events[n];v[0]==="enter"&&v[1].type==="table"&&(v[1]._align=vD(t.events,n))}return e}function Jo(e,t,n,s,a,o){const c=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",f="tableContent";n[0]!==0&&(o.end=Object.assign({},Is(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const p=Is(t.events,n[1]);if(o={type:c,start:Object.assign({},p),end:Object.assign({},p)},e.add(n[1],0,[["enter",o,t]]),n[2]!==0){const h=Is(t.events,n[2]),g=Is(t.events,n[3]),m={type:f,start:Object.assign({},h),end:Object.assign({},g)};if(e.add(n[2],0,[["enter",m,t]]),s!==2){const S=t.events[n[2]],v=t.events[n[3]];if(S[1].end=Object.assign({},v[1].end),S[1].type="chunkText",S[1].contentType="text",n[3]>n[2]+1){const b=n[2]+1,k=n[3]-n[2]-1;e.add(b,k,[])}}e.add(n[3]+1,0,[["exit",m,t]])}return a!==void 0&&(o.end=Object.assign({},Is(t.events,a)),e.add(a,0,[["exit",o,t]]),o=void 0),o}function Iy(e,t,n,s,a){const o=[],c=Is(t.events,n);a&&(a.end=Object.assign({},c),o.push(["exit",a,t])),s.end=Object.assign({},c),o.push(["exit",s,t]),e.add(n+1,0,o)}function Is(e,t){const n=e[t],s=n[0]==="enter"?"start":"end";return n[1][s]}const xD={name:"tasklistCheck",tokenize:CD};function wD(){return{text:{91:xD}}}function CD(e,t,n){const s=this;return a;function a(p){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?n(p):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(p),e.exit("taskListCheckMarker"),o)}function o(p){return Qe(p)?(e.enter("taskListCheckValueUnchecked"),e.consume(p),e.exit("taskListCheckValueUnchecked"),c):p===88||p===120?(e.enter("taskListCheckValueChecked"),e.consume(p),e.exit("taskListCheckValueChecked"),c):n(p)}function c(p){return p===93?(e.enter("taskListCheckMarker"),e.consume(p),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),f):n(p)}function f(p){return ve(p)?t(p):Le(p)?e.check({tokenize:kD},t,n)(p):n(p)}}function kD(e,t,n){return je(e,s,"whitespace");function s(a){return a===null?n(a):t(a)}}function ED(e){return lb([ZA(),aD(),_D(e),yD(),wD()])}const TD={};function AD(e){const t=this,n=e||TD,s=t.data(),a=s.micromarkExtensions||(s.micromarkExtensions=[]),o=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),c=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);a.push(ED(n)),o.push(KA()),c.push(XA(n))}const Ur=["ariaDescribedBy","ariaLabel","ariaLabelledBy"],Fy={ancestors:{tbody:["table"],td:["table"],th:["table"],thead:["table"],tfoot:["table"],tr:["table"]},attributes:{a:[...Ur,"dataFootnoteBackref","dataFootnoteRef",["className","data-footnote-backref"],"href"],blockquote:["cite"],code:[["className",/^language-./]],del:["cite"],div:["itemScope","itemType"],dl:[...Ur],h2:[["className","sr-only"]],img:[...Ur,"longDesc","src"],input:[["disabled",!0],["type","checkbox"]],ins:["cite"],li:[["className","task-list-item"]],ol:[...Ur,["className","contains-task-list"]],q:["cite"],section:["dataFootnotes",["className","footnotes"]],source:["srcSet"],summary:[...Ur],table:[...Ur],ul:[...Ur,["className","contains-task-list"]],"*":["abbr","accept","acceptCharset","accessKey","action","align","alt","axis","border","cellPadding","cellSpacing","char","charOff","charSet","checked","clear","colSpan","color","cols","compact","coords","dateTime","dir","encType","frame","hSpace","headers","height","hrefLang","htmlFor","id","isMap","itemProp","label","lang","maxLength","media","method","multiple","name","noHref","noShade","noWrap","open","prompt","readOnly","rev","rowSpan","rows","rules","scope","selected","shape","size","span","start","summary","tabIndex","title","useMap","vAlign","value","width"]},clobber:["ariaDescribedBy","ariaLabelledBy","id","name"],clobberPrefix:"user-content-",protocols:{cite:["http","https"],href:["http","https","irc","ircs","mailto","xmpp"],longDesc:["http","https"],src:["http","https"]},required:{input:{disabled:!0,type:"checkbox"}},strip:["script"],tagNames:["a","b","blockquote","br","code","dd","del","details","div","dl","dt","em","h1","h2","h3","h4","h5","h6","hr","i","img","input","ins","kbd","li","ol","p","picture","pre","q","rp","rt","ruby","s","samp","section","source","span","strike","strong","sub","summary","sup","table","tbody","td","tfoot","th","thead","tr","tt","ul","var"]},pr={}.hasOwnProperty;function DD(e,t){let n={type:"root",children:[]};const s={schema:t?{...Fy,...t}:Fy,stack:[]},a=Zb(s,e);return a&&(Array.isArray(a)?a.length===1?n=a[0]:n.children=a:n=a),n}function Zb(e,t){if(t&&typeof t=="object"){const n=t;switch(typeof n.type=="string"?n.type:""){case"comment":return RD(e,n);case"doctype":return MD(e,n);case"element":return BD(e,n);case"root":return LD(e,n);case"text":return zD(e,n)}}}function RD(e,t){if(e.schema.allowComments){const n=typeof t.value=="string"?t.value:"",s=n.indexOf("-->"),o={type:"comment",value:s<0?n:n.slice(0,s)};return wa(o,t),o}}function MD(e,t){if(e.schema.allowDoctypes){const n={type:"doctype"};return wa(n,t),n}}function BD(e,t){const n=typeof t.tagName=="string"?t.tagName:"";e.stack.push(n);const s=Qb(e,t.children),a=ND(e,t.properties);e.stack.pop();let o=!1;if(n&&n!=="*"&&(!e.schema.tagNames||e.schema.tagNames.includes(n))&&(o=!0,e.schema.ancestors&&pr.call(e.schema.ancestors,n))){const f=e.schema.ancestors[n];let p=-1;for(o=!1;++p<f.length;)e.stack.includes(f[p])&&(o=!0)}if(!o)return e.schema.strip&&!e.schema.strip.includes(n)?s:void 0;const c={type:"element",tagName:n,properties:a,children:s};return wa(c,t),c}function LD(e,t){const s={type:"root",children:Qb(e,t.children)};return wa(s,t),s}function zD(e,t){const s={type:"text",value:typeof t.value=="string"?t.value:""};return wa(s,t),s}function Qb(e,t){const n=[];if(Array.isArray(t)){const s=t;let a=-1;for(;++a<s.length;){const o=Zb(e,s[a]);o&&(Array.isArray(o)?n.push(...o):n.push(o))}}return n}function ND(e,t){const n=e.stack[e.stack.length-1],s=e.schema.attributes,a=e.schema.required,o=s&&pr.call(s,n)?s[n]:void 0,c=s&&pr.call(s,"*")?s["*"]:void 0,f=t&&typeof t=="object"?t:{},p={};let h;for(h in f)if(pr.call(f,h)){const g=f[h];let m=qy(e,Wy(o,h),h,g);m==null&&(m=qy(e,Wy(c,h),h,g)),m!=null&&(p[h]=m)}if(a&&pr.call(a,n)){const g=a[n];for(h in g)pr.call(g,h)&&!pr.call(p,h)&&(p[h]=g[h])}return p}function qy(e,t,n,s){return t?Array.isArray(s)?OD(e,t,n,s):Jb(e,t,n,s):void 0}function OD(e,t,n,s){let a=-1;const o=[];for(;++a<s.length;){const c=Jb(e,t,n,s[a]);(typeof c=="number"||typeof c=="string")&&o.push(c)}return o}function Jb(e,t,n,s){if(!(typeof s!="boolean"&&typeof s!="number"&&typeof s!="string")&&HD(e,n,s)){if(typeof t=="object"&&t.length>1){let a=!1,o=0;for(;++o<t.length;){const c=t[o];if(c&&typeof c=="object"&&"flags"in c){if(c.test(String(s))){a=!0;break}}else if(c===s){a=!0;break}}if(!a)return}return e.schema.clobber&&e.schema.clobberPrefix&&e.schema.clobber.includes(n)?e.schema.clobberPrefix+s:s}}function HD(e,t,n){const s=e.schema.protocols&&pr.call(e.schema.protocols,t)?e.schema.protocols[t]:void 0;if(!s||s.length===0)return!0;const a=String(n),o=a.indexOf(":"),c=a.indexOf("?"),f=a.indexOf("#"),p=a.indexOf("/");if(o<0||p>-1&&o>p||c>-1&&o>c||f>-1&&o>f)return!0;let h=-1;for(;++h<s.length;){const g=s[h];if(o===g.length&&a.slice(0,g.length)===g)return!0}return!1}function wa(e,t){const n=eb(t);t.data&&(e.data=pa(t.data)),n&&(e.position=n)}function Wy(e,t){let n,s=-1;if(e)for(;++s<e.length;){const a=e[s],o=typeof a=="string"?a:a[0];if(o===t)return a;o==="data*"&&(n=a)}if(t.length>4&&t.slice(0,4).toLowerCase()==="data")return n}function jD(e){return function(t){return DD(t,e)}}function UD({storyName:e,fileName:t,authFetch:n,onPublish:s,publishingFile:a}){const[o,c]=re.useState(null),[f,p]=re.useState(!1),[h,g]=re.useState("preview"),[m,S]=re.useState(""),[v,b]=re.useState(!1),[k,B]=re.useState(!1),[D,G]=re.useState(!1),[A,N]=re.useState(null),$=re.useRef(null),z=re.useRef(!1),Q=re.useRef(null),se=re.useCallback(async()=>{if(!e||!t){c(null);return}const oe=`${e}/${t}`,E=Q.current!==oe;E&&(Q.current=oe);try{const T=await n(`/api/stories/${e}/${t}`);if(T.ok){const q=await T.json();c(q),(E||!z.current)&&(S(q.content??""),E&&(B(!1),z.current=!1))}}catch{}},[e,t,n]);re.useEffect(()=>{p(!0),se().finally(()=>p(!1))},[se]),re.useEffect(()=>{if(!e||!t||h==="edit"&&k)return;const oe=setInterval(se,3e3);return()=>clearInterval(oe)},[e,t,se,h,k]);const he=re.useCallback(async()=>{if(!(!e||!t)){b(!0);try{(await n(`/api/stories/${e}/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:m})})).ok&&(B(!1),z.current=!1,c(E=>E&&{...E,content:m}))}catch{}b(!1)}},[e,t,n,m]);re.useEffect(()=>{if(h!=="edit")return;const oe=E=>{(E.metaKey||E.ctrlKey)&&E.key==="s"&&(E.preventDefault(),he())};return window.addEventListener("keydown",oe),()=>window.removeEventListener("keydown",oe)},[h,he]),re.useEffect(()=>{if((o==null?void 0:o.status)!=="published-not-indexed"||!o.publishedAt)return;const oe=new Date(o.publishedAt).getTime(),E=300*1e3,T=()=>{const C=Math.max(0,E-(Date.now()-oe));N(C)};T();const q=setInterval(T,1e3);return()=>clearInterval(q)},[o==null?void 0:o.status,o==null?void 0:o.publishedAt]);const j=A!==null&&A<=0,ne=A!==null&&A>0?`${Math.floor(A/6e4)}:${String(Math.floor(A%6e4/1e3)).padStart(2,"0")}`:null;if(!e||!t)return x.jsx("div",{className:"h-full flex items-center justify-center text-muted",children:x.jsxs("div",{className:"text-center",children:[x.jsx("p",{className:"text-lg font-serif",children:"Select a file to preview"}),x.jsx("p",{className:"text-sm mt-1",children:"Click a story file in the sidebar"})]})});if(f&&!o)return x.jsx("div",{className:"h-full flex items-center justify-center text-muted",children:"Loading..."});const U=(h==="edit"?m:(o==null?void 0:o.content)??"").length,K=t==="genesis.md",H=t?/^plot-\d+\.md$/.test(t):!1,M=(o==null?void 0:o.status)==="published"||(o==null?void 0:o.status)==="published-not-indexed",F=K?1e3:H?1e4:null,V=!M&&F!==null&&U>F;return x.jsxs("div",{className:"h-full flex flex-col",children:[x.jsxs("div",{className:"border-b border-border",children:[x.jsxs("div",{className:"px-3 py-1.5 flex items-center justify-between",children:[x.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono text-muted",children:[x.jsxs("span",{children:[e,"/",t]}),(o==null?void 0:o.status)==="published"&&x.jsx("span",{className:"text-green-700 font-medium",children:"Published"}),(o==null?void 0:o.status)==="published-not-indexed"&&x.jsx("span",{className:"text-amber-700 font-medium",title:o.indexError,children:"Published (not indexed)"}),(o==null?void 0:o.status)==="pending"&&x.jsx("span",{className:"text-amber-700 font-medium",children:"Pending"})]}),x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsxs("span",{className:`text-xs font-mono ${V?"text-error font-medium":"text-muted"}`,children:[U.toLocaleString(),F!==null?`/${F.toLocaleString()}`:" chars"]}),V&&x.jsxs("span",{className:"text-error text-xs font-medium",children:[(U-F).toLocaleString()," over limit"]})]})]}),x.jsxs("div",{className:"flex px-3 gap-1",children:[x.jsx("button",{onClick:()=>g("preview"),className:`px-3 py-1 text-xs font-medium border-b-2 transition-colors ${h==="preview"?"border-accent text-accent":"border-transparent text-muted hover:text-foreground"}`,children:"Preview"}),x.jsxs("button",{onClick:()=>g("edit"),className:`px-3 py-1 text-xs font-medium border-b-2 transition-colors ${h==="edit"?"border-accent text-accent":"border-transparent text-muted hover:text-foreground"}`,children:["Edit",k&&x.jsx("span",{className:"ml-1 text-amber-600",children:"*"})]})]})]}),h==="preview"?x.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto px-6 py-4",style:{background:"var(--paper-bg)"},children:o!=null&&o.content?x.jsx("div",{className:"prose max-w-none",children:x.jsx(d3,{remarkPlugins:[C3,AD],rehypePlugins:[jD],children:o.content})}):x.jsx("p",{className:"text-muted italic",children:"No content"})}):x.jsxs("div",{className:"flex-1 min-h-0 flex flex-col",style:{background:"var(--paper-bg)"},children:[x.jsx("textarea",{ref:$,value:m,onChange:oe=>{S(oe.target.value),B(!0),z.current=!0},className:"flex-1 min-h-0 w-full resize-none px-4 py-3 text-sm leading-relaxed focus:outline-none",style:{fontFamily:'"Geist Mono", ui-monospace, monospace',background:"var(--paper-bg)",color:"var(--text)"},spellCheck:!1}),x.jsxs("div",{className:"px-3 py-1.5 border-t border-border flex items-center justify-between",children:[x.jsx("span",{className:"text-xs text-muted",children:k?"Unsaved changes":"No changes"}),x.jsx("button",{onClick:he,disabled:!k||v,className:"px-3 py-1 bg-accent text-white text-xs rounded hover:bg-accent-dim disabled:opacity-50 disabled:cursor-not-allowed",children:v?"Saving...":"Save"})]})]}),x.jsx("div",{className:"px-3 py-2 border-t border-border flex items-center justify-between",children:t==="structure.md"?x.jsx("p",{className:"text-muted text-xs italic",children:"This is your story outline — not publishable. Ask AI to write the genesis next."}):(o==null?void 0:o.status)==="published-not-indexed"?x.jsxs("div",{className:"flex flex-col gap-1",children:[x.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[x.jsx("span",{className:"text-amber-700",children:"Published on-chain but not indexed on PlotLink"}),!j&&x.jsx("button",{onClick:async()=>{if(!(!e||!t||!o.txHash)){G(!0);try{(await(await n("/api/publish/retry-index",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({storyName:e,fileName:t,txHash:o.txHash,content:o.content,storylineId:o.storylineId})})).json()).ok&&(await n(`/api/stories/${e}/${t}/publish-status`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({txHash:o.txHash,storylineId:o.storylineId,contentCid:"",gasCost:""})}),se())}catch{}G(!1)}},disabled:D,className:"px-3 py-1 bg-accent text-white text-xs rounded hover:bg-accent-dim disabled:opacity-50",children:D?"Retrying...":`Retry Index${ne?` (${ne})`:""}`}),H&&x.jsx("button",{onClick:()=>e&&t&&(s==null?void 0:s(e,t)),disabled:!!a,className:"px-3 py-1 border border-border text-xs rounded hover:bg-surface disabled:opacity-50",children:a===t?"Publishing...":"Retry Publish"}),o.txHash&&x.jsx("a",{href:`https://basescan.org/tx/${o.txHash}`,target:"_blank",rel:"noopener noreferrer",className:"text-muted underline",children:"BaseScan"})]}),x.jsx("p",{className:"text-muted text-xs",children:j?H?"Index window expired. Use Retry Publish to create a new on-chain tx.":"Index window expired. Contact support or re-publish manually.":H?"Try Retry Index first (available for 5 min after publish). If that fails, Retry Publish creates a new on-chain tx.":"Retry Index is available for 5 min after publish."}),o.indexError&&x.jsx("p",{className:"text-error text-xs",children:o.indexError})]}):(o==null?void 0:o.status)==="published"?x.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[x.jsx("span",{className:"text-green-700",children:"Published"}),o.storylineId&&x.jsx("a",{href:(()=>{var T;const oe=`https://plotlink.xyz/story/${o.storylineId}`;if(!H)return oe;const E=o.plotIndex!=null&&o.plotIndex>0?o.plotIndex:parseInt(((T=t==null?void 0:t.match(/^plot-(\d+)\.md$/))==null?void 0:T[1])??"1");return`${oe}/${E}`})(),target:"_blank",rel:"noopener noreferrer",className:"text-accent underline",children:"View on PlotLink"}),o.txHash&&x.jsx("a",{href:`https://basescan.org/tx/${o.txHash}`,target:"_blank",rel:"noopener noreferrer",className:"text-muted underline",children:"BaseScan"})]}):x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx("button",{onClick:()=>e&&t&&(s==null?void 0:s(e,t)),disabled:!!a||V,className:"px-4 py-1.5 bg-accent text-white text-sm rounded hover:bg-accent-dim disabled:opacity-50 disabled:cursor-not-allowed",children:a===t?"Publishing...":"Publish to PlotLink"}),V&&x.jsx("span",{className:"text-error text-xs",children:"Reduce content to publish"})]})})]})}const e0="plotlink-panel-ratio",PD=.6,Yy=300,kf=224,Ef=6;function ID(){try{const e=localStorage.getItem(e0);if(e){const t=parseFloat(e);if(t>0&&t<1)return t}}catch{}return PD}function Vy(e,t){if(t<=0)return e;const n=Yy/t,s=1-Yy/t;return n>=s?.5:Math.min(s,Math.max(n,e))}function FD({token:e,authFetch:t}){const[n,s]=re.useState(null),[a,o]=re.useState(null),[c,f]=re.useState(null),[p,h]=re.useState(""),[g,m]=re.useState(ID),S=re.useRef(null),v=re.useRef(!1);re.useEffect(()=>{try{localStorage.setItem(e0,String(g))}catch{}},[g]),re.useEffect(()=>{const A=()=>{if(!S.current)return;const N=S.current.getBoundingClientRect().width-kf-Ef;m($=>Vy($,N))};return window.addEventListener("resize",A),A(),()=>window.removeEventListener("resize",A)},[]);const b=re.useCallback((A,N)=>{s(A),o(N)},[]),k=re.useRef(null),B=re.useCallback(async A=>{var N,$,z,Q;k.current=A,s(A),o(null);try{const se=await t(`/api/stories/${A}`);if(se.ok&&k.current===A){const j=(await se.json()).files||[],Y=((N=j.map(U=>{var K;return{file:U.file,num:(K=U.file.match(/^plot-(\d+)\.md$/))==null?void 0:K[1]}}).filter(U=>U.num!=null).sort((U,K)=>parseInt(K.num)-parseInt(U.num))[0])==null?void 0:N.file)??(($=j.find(U=>U.file==="genesis.md"))==null?void 0:$.file)??((z=j.find(U=>U.file==="structure.md"))==null?void 0:z.file)??((Q=j[0])==null?void 0:Q.file);Y&&k.current===A&&o(Y)}}catch{}},[t]),D=re.useCallback(A=>{A.preventDefault(),v.current=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none";const N=z=>{if(!v.current||!S.current)return;const Q=S.current.getBoundingClientRect(),se=Q.width-kf-Ef,he=z.clientX-Q.left-kf;m(Vy(he/se,se))},$=()=>{v.current=!1,document.body.style.cursor="",document.body.style.userSelect="",window.removeEventListener("mousemove",N),window.removeEventListener("mouseup",$)};window.addEventListener("mousemove",N),window.addEventListener("mouseup",$)},[]),G=re.useCallback(async(A,N)=>{var $;f(N),h("Reading file...");try{const z=await t(`/api/stories/${A}/${N}`);if(!z.ok)throw new Error("Failed to read file");const Q=await z.json(),se=Q.content.match(/^#\s+(.+)$/m),he=se?se[1].slice(0,60):N.replace(".md","");let j="Fiction";try{const H=await t(`/api/stories/${A}/structure.md`);if(H.ok){const F=(await H.json()).content.match(/genre[:\s]+(.+)/i);F&&(j=F[1].trim().slice(0,30))}}catch{}let ne;if(N.match(/^plot-\d+\.md$/)){try{const H=await t(`/api/stories/${A}`);if(H.ok){const F=(await H.json()).files.find(V=>V.file==="genesis.md"&&V.storylineId);ne=F==null?void 0:F.storylineId}}catch{}if(!ne){h("Error: Publish genesis first to create the storyline"),setTimeout(()=>{f(null),h("")},3e3);return}}h("Publishing...");const Y=await t("/api/publish/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({storyName:A,fileName:N,title:he,content:Q.content,genre:j,storylineId:ne})});if(!Y.ok){const H=await Y.json();throw new Error(H.error||"Publish failed")}const U=($=Y.body)==null?void 0:$.getReader(),K=new TextDecoder;if(U)for(;;){const{done:H,value:M}=await U.read();if(H)break;const V=K.decode(M).split(`
129
- `).filter(oe=>oe.startsWith("data: "));for(const oe of V)try{const E=JSON.parse(oe.slice(6));E.step&&h(E.message||E.step),E.step==="done"&&E.txHash&&await t(`/api/stories/${A}/${N}/publish-status`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({txHash:E.txHash,storylineId:E.storylineId,plotIndex:E.plotIndex,contentCid:E.contentCid,gasCost:E.gasCost,indexError:E.indexError})})}catch{}}h("Published!")}catch(z){const Q=z instanceof Error?z.message:"Publish failed";h(`Error: ${Q}`)}finally{setTimeout(()=>{f(null),h("")},3e3)}},[t]);return x.jsxs("div",{ref:S,className:"h-[calc(100vh-3.5rem)] flex",children:[x.jsx("div",{className:"w-56 border-r border-border flex-shrink-0",children:x.jsx(zx,{authFetch:t,selectedStory:n,selectedFile:a,onSelectFile:b})}),x.jsx("div",{className:"min-w-0 border-r border-border",style:{flex:`${g} 0 0`},children:x.jsx(nk,{token:e,storyName:n,authFetch:t,onSelectStory:B})}),x.jsx("div",{onMouseDown:D,className:"flex-shrink-0 flex items-center justify-center hover:bg-border/50 transition-colors",style:{width:Ef,cursor:"col-resize",background:"var(--border)"},children:x.jsxs("div",{className:"flex flex-col gap-1",children:[x.jsx("div",{className:"w-0.5 h-0.5 rounded-full",style:{background:"var(--text-muted)"}}),x.jsx("div",{className:"w-0.5 h-0.5 rounded-full",style:{background:"var(--text-muted)"}}),x.jsx("div",{className:"w-0.5 h-0.5 rounded-full",style:{background:"var(--text-muted)"}})]})}),x.jsxs("div",{className:"min-w-0 flex flex-col",style:{flex:`${1-g} 0 0`},children:[x.jsx(UD,{storyName:n,fileName:a,authFetch:t,onPublish:G,publishingFile:c}),p&&x.jsx("div",{className:"px-3 py-1.5 bg-surface border-t border-border text-xs text-muted",children:p})]})]})}function qD({token:e,onComplete:t}){const[n,s]=re.useState(!1),[a,o]=re.useState(null),[c,f]=re.useState(!1),p=async()=>{s(!0),o(null);try{const h=await fetch("/api/wallet/create",{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"}}),g=await h.json();if(!h.ok)throw new Error(g.error||"Wallet creation failed");f(!0)}catch(h){o(h instanceof Error?h.message:"Wallet creation failed")}s(!1)};return re.useEffect(()=>{p()},[]),x.jsxs("div",{className:"mx-auto max-w-sm p-6 text-center",children:[x.jsx("h2",{className:"text-accent mb-1 text-lg font-bold",children:"Wallet Setup"}),x.jsx("p",{className:"text-muted mb-6 text-xs",children:"creating your OWS wallet for on-chain publishing"}),n&&x.jsx("p",{className:"text-accent text-sm",children:"creating wallet..."}),a&&x.jsxs("div",{className:"space-y-4",children:[x.jsx("div",{className:"rounded border border-red-700/30 p-3 text-xs text-red-700",children:a}),x.jsx("button",{onClick:p,className:"border-accent text-accent hover:bg-accent/10 w-full rounded border px-4 py-2 text-sm font-medium transition-colors",children:"retry"})]}),c&&x.jsxs("div",{className:"space-y-4",children:[x.jsx("div",{className:"text-accent text-2xl",children:"✓"}),x.jsx("p",{className:"text-foreground text-sm font-medium",children:"wallet created"}),x.jsx("button",{onClick:t,className:"border-accent text-accent hover:bg-accent/10 w-full rounded border px-4 py-2 text-sm font-medium transition-colors",children:"continue"})]})]})}function WD({token:e,onLogout:t}){const[n,s]=re.useState("home"),[a,o]=re.useState(0),c=re.useCallback(async(f,p)=>fetch(f,{...p,headers:{...(p==null?void 0:p.headers)||{},Authorization:`Bearer ${e}`}}),[e]);return re.useEffect(()=>{async function f(){try{if(!(await(await c("/api/wallet")).json()).exists){s("wallet-setup");return}const g=await c("/api/stories");if(g.ok){const m=await g.json();o(m.stories.filter(S=>S.name!=="_example").length)}}catch{}}f()},[e]),x.jsxs("div",{className:"flex h-screen flex-col",children:[x.jsxs("header",{className:"border-border flex h-14 items-center justify-between border-b px-4 flex-shrink-0",children:[x.jsxs("div",{className:"flex items-center gap-3",children:[x.jsx("button",{onClick:()=>{n!=="wallet-setup"&&s("home")},className:"flex items-center gap-2 hover:opacity-80",children:x.jsx("span",{className:"text-accent text-sm font-bold tracking-tight",children:"PlotLink OWS"})}),x.jsx("span",{className:"text-muted text-[10px] uppercase tracking-wider",children:"writer"})]}),n!=="wallet-setup"&&x.jsxs("nav",{className:"flex items-center gap-4",children:[x.jsx("button",{onClick:()=>s("stories"),className:`text-xs transition-colors ${n==="stories"?"text-accent":"text-muted hover:text-foreground"}`,children:"stories"}),x.jsx("button",{onClick:()=>s("dashboard"),className:`text-xs transition-colors ${n==="dashboard"?"text-accent":"text-muted hover:text-foreground"}`,children:"dashboard"}),x.jsx("button",{onClick:()=>s("settings"),className:`text-xs transition-colors ${n==="settings"?"text-accent":"text-muted hover:text-foreground"}`,children:"settings"}),x.jsx("button",{onClick:t,className:"text-muted hover:text-foreground text-xs transition-colors",children:"logout"})]})]}),x.jsxs("main",{className:"flex-1 min-h-0",children:[n==="home"&&x.jsxs("div",{className:"mx-auto max-w-lg space-y-6 p-8",children:[x.jsxs("div",{className:"text-center space-y-2",children:[x.jsx("h1",{className:"text-2xl font-serif text-foreground",children:"Write. Publish. Earn."}),x.jsx("p",{className:"text-muted text-sm",children:"Claude CLI writes stories. You publish them on-chain."})]}),x.jsxs("div",{className:"text-center space-y-3",children:[x.jsx("button",{onClick:()=>s("stories"),className:"bg-accent text-white hover:bg-accent-dim px-6 py-2.5 rounded text-sm font-medium transition-colors",children:"Start Writing"}),a>0&&x.jsxs("p",{className:"text-muted text-xs",children:[a," ",a===1?"story":"stories"," in progress"]})]}),x.jsxs("div",{className:"rounded border border-border p-4 space-y-2 text-xs text-muted",children:[x.jsx("p",{className:"font-medium text-foreground text-sm",children:"How it works"}),x.jsxs("ol",{className:"space-y-1.5 list-decimal list-inside",children:[x.jsxs("li",{children:["Open the ",x.jsx("strong",{children:"Stories"})," tab — Claude CLI launches in the terminal"]}),x.jsx("li",{children:"Tell Claude your story idea — it brainstorms, outlines, and writes"}),x.jsx("li",{children:"Review the live preview as Claude creates files"}),x.jsxs("li",{children:["Click ",x.jsx("strong",{children:"Publish"})," to put your story on-chain"]}),x.jsxs("li",{children:["Earn 5% royalties on every trade at ",x.jsx("a",{href:"https://plotlink.xyz",target:"_blank",rel:"noopener noreferrer",className:"text-accent underline",children:"plotlink.xyz"})]})]})]}),x.jsx(Gy,{token:e})]}),n==="stories"&&x.jsx(FD,{token:e,authFetch:c}),n==="dashboard"&&x.jsx(Mx,{token:e}),n==="wallet-setup"&&x.jsx(qD,{token:e,onComplete:()=>s("home")}),n==="settings"&&x.jsx(Dx,{token:e,onLogout:t})]})]})}function YD(){const[e,t]=re.useState(()=>localStorage.getItem("ows-token")),[n,s]=re.useState(null),[a,o]=re.useState(!0);re.useEffect(()=>{fetch("/api/auth/status").then(h=>h.json()).then(h=>s(h.configured)).catch(()=>s(null))},[]),re.useEffect(()=>{if(!e){o(!1);return}fetch("/api/auth/verify",{headers:{Authorization:`Bearer ${e}`}}).then(h=>{h.ok||(localStorage.removeItem("ows-token"),t(null))}).catch(()=>{localStorage.removeItem("ows-token"),t(null)}).finally(()=>o(!1))},[e]);const c=async h=>{try{const g=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({passphrase:h})}),m=await g.json();return g.ok?(localStorage.setItem("ows-token",m.token),t(m.token),null):m.error||"Login failed"}catch{return"Cannot connect to server"}},f=async h=>{try{const g=await fetch("/api/auth/setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({passphrase:h})}),m=await g.json();return g.ok?(localStorage.setItem("ows-token",m.token),t(m.token),s(!0),null):m.error||"Setup failed"}catch{return"Cannot connect to server"}},p=()=>{localStorage.removeItem("ows-token"),t(null)};return a||n===null?x.jsx("div",{className:"flex h-screen items-center justify-center",children:x.jsx("span",{className:"text-muted text-sm",children:"connecting..."})}):n?e?x.jsx(WD,{token:e,onLogout:p}):x.jsx(Tx,{onLogin:c}):x.jsx(Ax,{onSetup:f})}Ex.createRoot(document.getElementById("root")).render(x.jsx(vx.StrictMode,{children:x.jsx(YD,{})}));
126
+ `,...o.current()});return/^[\t ]/.test(h)&&(h=ma(h.charCodeAt(0))+h.slice(1)),h=h?c+" "+h:c,n.options.closeAtx&&(h+=" "+c),p(),f(),h}Lb.peek=gA;function Lb(e){return e.value||""}function gA(){return"<"}zb.peek=vA;function zb(e,t,n,s){const a=Kd(n),o=a==='"'?"Quote":"Apostrophe",c=n.enter("image");let f=n.enter("label");const p=n.createTracker(s);let h=p.move("![");return h+=p.move(n.safe(e.alt,{before:h,after:"]",...p.current()})),h+=p.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),h+=p.move("<"),h+=p.move(n.safe(e.url,{before:h,after:">",...p.current()})),h+=p.move(">")):(f=n.enter("destinationRaw"),h+=p.move(n.safe(e.url,{before:h,after:e.title?" ":")",...p.current()}))),f(),e.title&&(f=n.enter(`title${o}`),h+=p.move(" "+a),h+=p.move(n.safe(e.title,{before:h,after:a,...p.current()})),h+=p.move(a),f()),h+=p.move(")"),c(),h}function vA(){return"!"}Nb.peek=yA;function Nb(e,t,n,s){const a=e.referenceType,o=n.enter("imageReference");let c=n.enter("label");const f=n.createTracker(s);let p=f.move("![");const h=n.safe(e.alt,{before:p,after:"]",...f.current()});p+=f.move(h+"]["),c();const g=n.stack;n.stack=[],c=n.enter("reference");const _=n.safe(n.associationId(e),{before:p,after:"]",...f.current()});return c(),n.stack=g,o(),a==="full"||!h||h!==_?p+=f.move(_+"]"):a==="shortcut"?p=p.slice(0,-1):p+=f.move("]"),p}function yA(){return"!"}Ob.peek=SA;function Ob(e,t,n){let s=e.value||"",a="`",o=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(s);)a+="`";for(/[^ \r\n]/.test(s)&&(/^[ \r\n]/.test(s)&&/[ \r\n]$/.test(s)||/^`|`$/.test(s))&&(s=" "+s+" ");++o<n.unsafe.length;){const c=n.unsafe[o],f=n.compilePattern(c);let p;if(c.atBreak)for(;p=f.exec(s);){let h=p.index;s.charCodeAt(h)===10&&s.charCodeAt(h-1)===13&&h--,s=s.slice(0,h)+" "+s.slice(p.index+1)}}return a+s+a}function SA(){return"`"}function Hb(e,t){const n=jd(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}jb.peek=bA;function jb(e,t,n,s){const a=Kd(n),o=a==='"'?"Quote":"Apostrophe",c=n.createTracker(s);let f,p;if(Hb(e,n)){const g=n.stack;n.stack=[],f=n.enter("autolink");let _=c.move("<");return _+=c.move(n.containerPhrasing(e,{before:_,after:">",...c.current()})),_+=c.move(">"),f(),n.stack=g,_}f=n.enter("link"),p=n.enter("label");let h=c.move("[");return h+=c.move(n.containerPhrasing(e,{before:h,after:"](",...c.current()})),h+=c.move("]("),p(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(p=n.enter("destinationLiteral"),h+=c.move("<"),h+=c.move(n.safe(e.url,{before:h,after:">",...c.current()})),h+=c.move(">")):(p=n.enter("destinationRaw"),h+=c.move(n.safe(e.url,{before:h,after:e.title?" ":")",...c.current()}))),p(),e.title&&(p=n.enter(`title${o}`),h+=c.move(" "+a),h+=c.move(n.safe(e.title,{before:h,after:a,...c.current()})),h+=c.move(a),p()),h+=c.move(")"),f(),h}function bA(e,t,n){return Hb(e,n)?"<":"["}Ub.peek=xA;function Ub(e,t,n,s){const a=e.referenceType,o=n.enter("linkReference");let c=n.enter("label");const f=n.createTracker(s);let p=f.move("[");const h=n.containerPhrasing(e,{before:p,after:"]",...f.current()});p+=f.move(h+"]["),c();const g=n.stack;n.stack=[],c=n.enter("reference");const _=n.safe(n.associationId(e),{before:p,after:"]",...f.current()});return c(),n.stack=g,o(),a==="full"||!h||h!==_?p+=f.move(_+"]"):a==="shortcut"?p=p.slice(0,-1):p+=f.move("]"),p}function xA(){return"["}function Xd(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function wA(e){const t=Xd(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function CA(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function Pb(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function kA(e,t,n,s){const a=n.enter("list"),o=n.bulletCurrent;let c=e.ordered?CA(n):Xd(n);const f=e.ordered?c==="."?")":".":wA(n);let p=t&&n.bulletLastUsed?c===n.bulletLastUsed:!1;if(!e.ordered){const g=e.children?e.children[0]:void 0;if((c==="*"||c==="-")&&g&&(!g.children||!g.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(p=!0),Pb(n)===c&&g){let _=-1;for(;++_<e.children.length;){const S=e.children[_];if(S&&S.type==="listItem"&&S.children&&S.children[0]&&S.children[0].type==="thematicBreak"){p=!0;break}}}}p&&(c=f),n.bulletCurrent=c;const h=n.containerFlow(e,s);return n.bulletLastUsed=c,n.bulletCurrent=o,a(),h}function EA(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function TA(e,t,n,s){const a=EA(n);let o=n.bulletCurrent||Xd(n);t&&t.type==="list"&&t.ordered&&(o=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let c=o.length+1;(a==="tab"||a==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(c=Math.ceil(c/4)*4);const f=n.createTracker(s);f.move(o+" ".repeat(c-o.length)),f.shift(c);const p=n.enter("listItem"),h=n.indentLines(n.containerFlow(e,f.current()),g);return p(),h;function g(_,S,y){return S?(y?"":" ".repeat(c))+_:(y?o:o+" ".repeat(c-o.length))+_}}function AA(e,t,n,s){const a=n.enter("paragraph"),o=n.enter("phrasing"),c=n.containerPhrasing(e,s);return o(),a(),c}const DA=ku(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function RA(e,t,n,s){return(e.children.some(function(c){return DA(c)})?n.containerPhrasing:n.containerFlow).call(n,e,s)}function MA(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Ib.peek=BA;function Ib(e,t,n,s){const a=MA(n),o=n.enter("strong"),c=n.createTracker(s),f=c.move(a+a);let p=c.move(n.containerPhrasing(e,{after:a,before:f,...c.current()}));const h=p.charCodeAt(0),g=_u(s.before.charCodeAt(s.before.length-1),h,a);g.inside&&(p=ma(h)+p.slice(1));const _=p.charCodeAt(p.length-1),S=_u(s.after.charCodeAt(0),_,a);S.inside&&(p=p.slice(0,-1)+ma(_));const y=c.move(a+a);return o(),n.attentionEncodeSurroundingInfo={after:S.outside,before:g.outside},f+p+y}function BA(e,t,n){return n.options.strong||"*"}function LA(e,t,n,s){return n.safe(e.value,s)}function zA(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function NA(e,t,n){const s=(Pb(n)+(n.options.ruleSpaces?" ":"")).repeat(zA(n));return n.options.ruleSpaces?s.slice(0,-1):s}const Fb={blockquote:rA,break:jy,code:cA,definition:fA,emphasis:Bb,hardBreak:jy,heading:_A,html:Lb,image:zb,imageReference:Nb,inlineCode:Ob,link:jb,linkReference:Ub,list:kA,listItem:TA,paragraph:AA,root:RA,strong:Ib,text:LA,thematicBreak:NA};function OA(){return{enter:{table:HA,tableData:Uy,tableHeader:Uy,tableRow:UA},exit:{codeText:PA,table:jA,tableData:Cf,tableHeader:Cf,tableRow:Cf}}}function HA(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function jA(e){this.exit(e),this.data.inTable=void 0}function UA(e){this.enter({type:"tableRow",children:[]},e)}function Cf(e){this.exit(e)}function Uy(e){this.enter({type:"tableCell",children:[]},e)}function PA(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,IA));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function IA(e,t){return t==="|"?t:e}function FA(e){const t=e||{},n=t.tableCellPadding,s=t.tablePipeAlign,a=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
127
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:S,table:c,tableCell:p,tableRow:f}};function c(y,b,k,R){return h(g(y,k,R),y.align)}function f(y,b,k,R){const T=_(y,k,R),$=h([T]);return $.slice(0,$.indexOf(`
128
+ `))}function p(y,b,k,R){const T=k.enter("tableCell"),$=k.enter("phrasing"),j=k.containerPhrasing(y,{...R,before:o,after:o});return $(),T(),j}function h(y,b){return iA(y,{align:b,alignDelimiters:s,padding:n,stringLength:a})}function g(y,b,k){const R=y.children;let T=-1;const $=[],j=b.enter("table");for(;++T<R.length;)$[T]=_(R[T],b,k);return j(),$}function _(y,b,k){const R=y.children;let T=-1;const $=[],j=b.enter("tableRow");for(;++T<R.length;)$[T]=p(R[T],y,b,k);return j(),$}function S(y,b,k){let R=Fb.inlineCode(y,b,k);return k.stack.includes("tableCell")&&(R=R.replace(/\|/g,"\\$&")),R}}function qA(){return{exit:{taskListCheckValueChecked:Py,taskListCheckValueUnchecked:Py,paragraph:YA}}}function WA(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:VA}}}function Py(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function YA(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const s=n.children[0];if(s&&s.type==="text"){const a=t.children;let o=-1,c;for(;++o<a.length;){const f=a[o];if(f.type==="paragraph"){c=f;break}}c===n&&(s.value=s.value.slice(1),s.value.length===0?n.children.shift():n.position&&s.position&&typeof s.position.start.offset=="number"&&(s.position.start.column++,s.position.start.offset++,n.position.start=Object.assign({},s.position.start)))}}this.exit(e)}function VA(e,t,n,s){const a=e.children[0],o=typeof e.checked=="boolean"&&a&&a.type==="paragraph",c="["+(e.checked?"x":" ")+"] ",f=n.createTracker(s);o&&f.move(c);let p=Fb.listItem(e,t,n,{...s,...f.current()});return o&&(p=p.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),p;function h(g){return g+c}}function KA(){return[k3(),V3(),G3(),OA(),qA()]}function XA(e){return{extensions:[E3(),K3(e),Z3(),FA(e),WA()]}}const $A={tokenize:tD,partial:!0},qb={tokenize:iD,partial:!0},Wb={tokenize:nD,partial:!0},Yb={tokenize:rD,partial:!0},GA={tokenize:sD,partial:!0},Vb={name:"wwwAutolink",tokenize:JA,previous:Xb},Kb={name:"protocolAutolink",tokenize:eD,previous:$b},Hn={name:"emailAutolink",tokenize:QA,previous:Gb},hn={};function ZA(){return{text:hn}}let jr=48;for(;jr<123;)hn[jr]=Hn,jr++,jr===58?jr=65:jr===91&&(jr=97);hn[43]=Hn;hn[45]=Hn;hn[46]=Hn;hn[95]=Hn;hn[72]=[Hn,Kb];hn[104]=[Hn,Kb];hn[87]=[Hn,Vb];hn[119]=[Hn,Vb];function QA(e,t,n){const s=this;let a,o;return c;function c(_){return!Sd(_)||!Gb.call(s,s.previous)||$d(s.events)?n(_):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(_))}function f(_){return Sd(_)?(e.consume(_),f):_===64?(e.consume(_),p):n(_)}function p(_){return _===46?e.check(GA,g,h)(_):_===45||_===95||$t(_)?(o=!0,e.consume(_),p):g(_)}function h(_){return e.consume(_),a=!0,p}function g(_){return o&&a&&ni(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(_)):n(_)}}function JA(e,t,n){const s=this;return a;function a(c){return c!==87&&c!==119||!Xb.call(s,s.previous)||$d(s.events)?n(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check($A,e.attempt(qb,e.attempt(Wb,o),n),n)(c))}function o(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(c)}}function eD(e,t,n){const s=this;let a="",o=!1;return c;function c(_){return(_===72||_===104)&&$b.call(s,s.previous)&&!$d(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(_),e.consume(_),f):n(_)}function f(_){if(ni(_)&&a.length<5)return a+=String.fromCodePoint(_),e.consume(_),f;if(_===58){const S=a.toLowerCase();if(S==="http"||S==="https")return e.consume(_),p}return n(_)}function p(_){return _===47?(e.consume(_),o?h:(o=!0,p)):n(_)}function h(_){return _===null||pu(_)||Qe(_)||Vr(_)||xu(_)?n(_):e.attempt(qb,e.attempt(Wb,g),n)(_)}function g(_){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(_)}}function tD(e,t,n){let s=0;return a;function a(c){return(c===87||c===119)&&s<3?(s++,e.consume(c),a):c===46&&s===3?(e.consume(c),o):n(c)}function o(c){return c===null?n(c):t(c)}}function iD(e,t,n){let s,a,o;return c;function c(h){return h===46||h===95?e.check(Yb,p,f)(h):h===null||Qe(h)||Vr(h)||h!==45&&xu(h)?p(h):(o=!0,e.consume(h),c)}function f(h){return h===95?s=!0:(a=s,s=void 0),e.consume(h),c}function p(h){return a||s||!o?n(h):t(h)}}function nD(e,t){let n=0,s=0;return a;function a(c){return c===40?(n++,e.consume(c),a):c===41&&s<n?o(c):c===33||c===34||c===38||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===60||c===63||c===93||c===95||c===126?e.check(Yb,t,o)(c):c===null||Qe(c)||Vr(c)?t(c):(e.consume(c),a)}function o(c){return c===41&&s++,e.consume(c),a}}function rD(e,t,n){return s;function s(f){return f===33||f===34||f===39||f===41||f===42||f===44||f===46||f===58||f===59||f===63||f===95||f===126?(e.consume(f),s):f===38?(e.consume(f),o):f===93?(e.consume(f),a):f===60||f===null||Qe(f)||Vr(f)?t(f):n(f)}function a(f){return f===null||f===40||f===91||Qe(f)||Vr(f)?t(f):s(f)}function o(f){return ni(f)?c(f):n(f)}function c(f){return f===59?(e.consume(f),s):ni(f)?(e.consume(f),c):n(f)}}function sD(e,t,n){return s;function s(o){return e.consume(o),a}function a(o){return $t(o)?n(o):t(o)}}function Xb(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Qe(e)}function $b(e){return!ni(e)}function Gb(e){return!(e===47||Sd(e))}function Sd(e){return e===43||e===45||e===46||e===95||$t(e)}function $d(e){let t=e.length,n=!1;for(;t--;){const s=e[t][1];if((s.type==="labelLink"||s.type==="labelImage")&&!s._balanced){n=!0;break}if(s._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const lD={tokenize:pD,partial:!0};function aD(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:hD,continuation:{tokenize:fD},exit:dD}},text:{91:{name:"gfmFootnoteCall",tokenize:cD},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:oD,resolveTo:uD}}}}function oD(e,t,n){const s=this;let a=s.events.length;const o=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let c;for(;a--;){const p=s.events[a][1];if(p.type==="labelImage"){c=p;break}if(p.type==="gfmFootnoteCall"||p.type==="labelLink"||p.type==="label"||p.type==="image"||p.type==="link")break}return f;function f(p){if(!c||!c._balanced)return n(p);const h=Qi(s.sliceSerialize({start:c.end,end:s.now()}));return h.codePointAt(0)!==94||!o.includes(h.slice(1))?n(p):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),t(p))}}function uD(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const s={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},c={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},f=[e[n+1],e[n+2],["enter",s,t],e[n+3],e[n+4],["enter",a,t],["exit",a,t],["enter",o,t],["enter",c,t],["exit",c,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",s,t]];return e.splice(n,e.length-n+1,...f),e}function cD(e,t,n){const s=this,a=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let o=0,c;return f;function f(_){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(_),e.exit("gfmFootnoteCallLabelMarker"),p}function p(_){return _!==94?n(_):(e.enter("gfmFootnoteCallMarker"),e.consume(_),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",h)}function h(_){if(o>999||_===93&&!c||_===null||_===91||Qe(_))return n(_);if(_===93){e.exit("chunkString");const S=e.exit("gfmFootnoteCallString");return a.includes(Qi(s.sliceSerialize(S)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(_),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(_)}return Qe(_)||(c=!0),o++,e.consume(_),_===92?g:h}function g(_){return _===91||_===92||_===93?(e.consume(_),o++,h):h(_)}}function hD(e,t,n){const s=this,a=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let o,c=0,f;return p;function p(b){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(b),e.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(b){return b===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(b),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",g):n(b)}function g(b){if(c>999||b===93&&!f||b===null||b===91||Qe(b))return n(b);if(b===93){e.exit("chunkString");const k=e.exit("gfmFootnoteDefinitionLabelString");return o=Qi(s.sliceSerialize(k)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(b),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),S}return Qe(b)||(f=!0),c++,e.consume(b),b===92?_:g}function _(b){return b===91||b===92||b===93?(e.consume(b),c++,g):g(b)}function S(b){return b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),a.includes(o)||a.push(o),je(e,y,"gfmFootnoteDefinitionWhitespace")):n(b)}function y(b){return t(b)}}function fD(e,t,n){return e.check(ba,t,e.attempt(lD,t,n))}function dD(e){e.exit("gfmFootnoteDefinition")}function pD(e,t,n){const s=this;return je(e,a,"gfmFootnoteDefinitionIndent",5);function a(o){const c=s.events[s.events.length-1];return c&&c[1].type==="gfmFootnoteDefinitionIndent"&&c[2].sliceSerialize(c[1],!0).length===4?t(o):n(o)}}function mD(e){let n=(e||{}).singleTilde;const s={name:"strikethrough",tokenize:o,resolveAll:a};return n==null&&(n=!0),{text:{126:s},insideSpan:{null:[s]},attentionMarkers:{null:[126]}};function a(c,f){let p=-1;for(;++p<c.length;)if(c[p][0]==="enter"&&c[p][1].type==="strikethroughSequenceTemporary"&&c[p][1]._close){let h=p;for(;h--;)if(c[h][0]==="exit"&&c[h][1].type==="strikethroughSequenceTemporary"&&c[h][1]._open&&c[p][1].end.offset-c[p][1].start.offset===c[h][1].end.offset-c[h][1].start.offset){c[p][1].type="strikethroughSequence",c[h][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},c[h][1].start),end:Object.assign({},c[p][1].end)},_={type:"strikethroughText",start:Object.assign({},c[h][1].end),end:Object.assign({},c[p][1].start)},S=[["enter",g,f],["enter",c[h][1],f],["exit",c[h][1],f],["enter",_,f]],y=f.parser.constructs.insideSpan.null;y&&Mi(S,S.length,0,wu(y,c.slice(h+1,p),f)),Mi(S,S.length,0,[["exit",_,f],["enter",c[p][1],f],["exit",c[p][1],f],["exit",g,f]]),Mi(c,h-1,p-h+3,S),p=h+S.length-2;break}}for(p=-1;++p<c.length;)c[p][1].type==="strikethroughSequenceTemporary"&&(c[p][1].type="data");return c}function o(c,f,p){const h=this.previous,g=this.events;let _=0;return S;function S(b){return h===126&&g[g.length-1][1].type!=="characterEscape"?p(b):(c.enter("strikethroughSequenceTemporary"),y(b))}function y(b){const k=Vs(h);if(b===126)return _>1?p(b):(c.consume(b),_++,y);if(_<2&&!n)return p(b);const R=c.exit("strikethroughSequenceTemporary"),T=Vs(b);return R._open=!T||T===2&&!!k,R._close=!k||k===2&&!!T,f(b)}}}class _D{constructor(){this.map=[]}add(t,n,s){gD(this,t,n,s)}consume(t){if(this.map.sort(function(o,c){return o[0]-c[0]}),this.map.length===0)return;let n=this.map.length;const s=[];for(;n>0;)n-=1,s.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];s.push(t.slice()),t.length=0;let a=s.pop();for(;a;){for(const o of a)t.push(o);a=s.pop()}this.map.length=0}}function gD(e,t,n,s){let a=0;if(!(n===0&&s.length===0)){for(;a<e.map.length;){if(e.map[a][0]===t){e.map[a][1]+=n,e.map[a][2].push(...s);return}a+=1}e.map.push([t,n,s])}}function vD(e,t){let n=!1;const s=[];for(;t<e.length;){const a=e[t];if(n){if(a[0]==="enter")a[1].type==="tableContent"&&s.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(a[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=s.length-1;s[o]=s[o]==="left"?"center":"right"}}else if(a[1].type==="tableDelimiterRow")break}else a[0]==="enter"&&a[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return s}function yD(){return{flow:{null:{name:"table",tokenize:SD,resolveAll:bD}}}}function SD(e,t,n){const s=this;let a=0,o=0,c;return f;function f(z){let te=s.events.length-1;for(;te>-1;){const V=s.events[te][1].type;if(V==="lineEnding"||V==="linePrefix")te--;else break}const U=te>-1?s.events[te][1].type:null,F=U==="tableHead"||U==="tableRow"?L:p;return F===L&&s.parser.lazy[s.now().line]?n(z):F(z)}function p(z){return e.enter("tableHead"),e.enter("tableRow"),h(z)}function h(z){return z===124||(c=!0,o+=1),g(z)}function g(z){return z===null?n(z):ve(z)?o>1?(o=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),y):n(z):Le(z)?je(e,g,"whitespace")(z):(o+=1,c&&(c=!1,a+=1),z===124?(e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),c=!0,g):(e.enter("data"),_(z)))}function _(z){return z===null||z===124||Qe(z)?(e.exit("data"),g(z)):(e.consume(z),z===92?S:_)}function S(z){return z===92||z===124?(e.consume(z),_):_(z)}function y(z){return s.interrupt=!1,s.parser.lazy[s.now().line]?n(z):(e.enter("tableDelimiterRow"),c=!1,Le(z)?je(e,b,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):b(z))}function b(z){return z===45||z===58?R(z):z===124?(c=!0,e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),k):X(z)}function k(z){return Le(z)?je(e,R,"whitespace")(z):R(z)}function R(z){return z===58?(o+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(z),e.exit("tableDelimiterMarker"),T):z===45?(o+=1,T(z)):z===null||ve(z)?O(z):X(z)}function T(z){return z===45?(e.enter("tableDelimiterFiller"),$(z)):X(z)}function $(z){return z===45?(e.consume(z),$):z===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(z),e.exit("tableDelimiterMarker"),j):(e.exit("tableDelimiterFiller"),j(z))}function j(z){return Le(z)?je(e,O,"whitespace")(z):O(z)}function O(z){return z===124?b(z):z===null||ve(z)?!c||a!==o?X(z):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(z)):X(z)}function X(z){return n(z)}function L(z){return e.enter("tableRow"),re(z)}function re(z){return z===124?(e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),re):z===null||ve(z)?(e.exit("tableRow"),t(z)):Le(z)?je(e,re,"whitespace")(z):(e.enter("data"),Z(z))}function Z(z){return z===null||z===124||Qe(z)?(e.exit("data"),re(z)):(e.consume(z),z===92?le:Z)}function le(z){return z===92||z===124?(e.consume(z),Z):Z(z)}}function bD(e,t){let n=-1,s=!0,a=0,o=[0,0,0,0],c=[0,0,0,0],f=!1,p=0,h,g,_;const S=new _D;for(;++n<e.length;){const y=e[n],b=y[1];y[0]==="enter"?b.type==="tableHead"?(f=!1,p!==0&&(Iy(S,t,p,h,g),g=void 0,p=0),h={type:"table",start:Object.assign({},b.start),end:Object.assign({},b.end)},S.add(n,0,[["enter",h,t]])):b.type==="tableRow"||b.type==="tableDelimiterRow"?(s=!0,_=void 0,o=[0,0,0,0],c=[0,n+1,0,0],f&&(f=!1,g={type:"tableBody",start:Object.assign({},b.start),end:Object.assign({},b.end)},S.add(n,0,[["enter",g,t]])),a=b.type==="tableDelimiterRow"?2:g?3:1):a&&(b.type==="data"||b.type==="tableDelimiterMarker"||b.type==="tableDelimiterFiller")?(s=!1,c[2]===0&&(o[1]!==0&&(c[0]=c[1],_=Jo(S,t,o,a,void 0,_),o=[0,0,0,0]),c[2]=n)):b.type==="tableCellDivider"&&(s?s=!1:(o[1]!==0&&(c[0]=c[1],_=Jo(S,t,o,a,void 0,_)),o=c,c=[o[1],n,0,0])):b.type==="tableHead"?(f=!0,p=n):b.type==="tableRow"||b.type==="tableDelimiterRow"?(p=n,o[1]!==0?(c[0]=c[1],_=Jo(S,t,o,a,n,_)):c[1]!==0&&(_=Jo(S,t,c,a,n,_)),a=0):a&&(b.type==="data"||b.type==="tableDelimiterMarker"||b.type==="tableDelimiterFiller")&&(c[3]=n)}for(p!==0&&Iy(S,t,p,h,g),S.consume(t.events),n=-1;++n<t.events.length;){const y=t.events[n];y[0]==="enter"&&y[1].type==="table"&&(y[1]._align=vD(t.events,n))}return e}function Jo(e,t,n,s,a,o){const c=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",f="tableContent";n[0]!==0&&(o.end=Object.assign({},Is(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const p=Is(t.events,n[1]);if(o={type:c,start:Object.assign({},p),end:Object.assign({},p)},e.add(n[1],0,[["enter",o,t]]),n[2]!==0){const h=Is(t.events,n[2]),g=Is(t.events,n[3]),_={type:f,start:Object.assign({},h),end:Object.assign({},g)};if(e.add(n[2],0,[["enter",_,t]]),s!==2){const S=t.events[n[2]],y=t.events[n[3]];if(S[1].end=Object.assign({},y[1].end),S[1].type="chunkText",S[1].contentType="text",n[3]>n[2]+1){const b=n[2]+1,k=n[3]-n[2]-1;e.add(b,k,[])}}e.add(n[3]+1,0,[["exit",_,t]])}return a!==void 0&&(o.end=Object.assign({},Is(t.events,a)),e.add(a,0,[["exit",o,t]]),o=void 0),o}function Iy(e,t,n,s,a){const o=[],c=Is(t.events,n);a&&(a.end=Object.assign({},c),o.push(["exit",a,t])),s.end=Object.assign({},c),o.push(["exit",s,t]),e.add(n+1,0,o)}function Is(e,t){const n=e[t],s=n[0]==="enter"?"start":"end";return n[1][s]}const xD={name:"tasklistCheck",tokenize:CD};function wD(){return{text:{91:xD}}}function CD(e,t,n){const s=this;return a;function a(p){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?n(p):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(p),e.exit("taskListCheckMarker"),o)}function o(p){return Qe(p)?(e.enter("taskListCheckValueUnchecked"),e.consume(p),e.exit("taskListCheckValueUnchecked"),c):p===88||p===120?(e.enter("taskListCheckValueChecked"),e.consume(p),e.exit("taskListCheckValueChecked"),c):n(p)}function c(p){return p===93?(e.enter("taskListCheckMarker"),e.consume(p),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),f):n(p)}function f(p){return ve(p)?t(p):Le(p)?e.check({tokenize:kD},t,n)(p):n(p)}}function kD(e,t,n){return je(e,s,"whitespace");function s(a){return a===null?n(a):t(a)}}function ED(e){return lb([ZA(),aD(),mD(e),yD(),wD()])}const TD={};function AD(e){const t=this,n=e||TD,s=t.data(),a=s.micromarkExtensions||(s.micromarkExtensions=[]),o=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),c=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);a.push(ED(n)),o.push(KA()),c.push(XA(n))}const Ur=["ariaDescribedBy","ariaLabel","ariaLabelledBy"],Fy={ancestors:{tbody:["table"],td:["table"],th:["table"],thead:["table"],tfoot:["table"],tr:["table"]},attributes:{a:[...Ur,"dataFootnoteBackref","dataFootnoteRef",["className","data-footnote-backref"],"href"],blockquote:["cite"],code:[["className",/^language-./]],del:["cite"],div:["itemScope","itemType"],dl:[...Ur],h2:[["className","sr-only"]],img:[...Ur,"longDesc","src"],input:[["disabled",!0],["type","checkbox"]],ins:["cite"],li:[["className","task-list-item"]],ol:[...Ur,["className","contains-task-list"]],q:["cite"],section:["dataFootnotes",["className","footnotes"]],source:["srcSet"],summary:[...Ur],table:[...Ur],ul:[...Ur,["className","contains-task-list"]],"*":["abbr","accept","acceptCharset","accessKey","action","align","alt","axis","border","cellPadding","cellSpacing","char","charOff","charSet","checked","clear","colSpan","color","cols","compact","coords","dateTime","dir","encType","frame","hSpace","headers","height","hrefLang","htmlFor","id","isMap","itemProp","label","lang","maxLength","media","method","multiple","name","noHref","noShade","noWrap","open","prompt","readOnly","rev","rowSpan","rows","rules","scope","selected","shape","size","span","start","summary","tabIndex","title","useMap","vAlign","value","width"]},clobber:["ariaDescribedBy","ariaLabelledBy","id","name"],clobberPrefix:"user-content-",protocols:{cite:["http","https"],href:["http","https","irc","ircs","mailto","xmpp"],longDesc:["http","https"],src:["http","https"]},required:{input:{disabled:!0,type:"checkbox"}},strip:["script"],tagNames:["a","b","blockquote","br","code","dd","del","details","div","dl","dt","em","h1","h2","h3","h4","h5","h6","hr","i","img","input","ins","kbd","li","ol","p","picture","pre","q","rp","rt","ruby","s","samp","section","source","span","strike","strong","sub","summary","sup","table","tbody","td","tfoot","th","thead","tr","tt","ul","var"]},pr={}.hasOwnProperty;function DD(e,t){let n={type:"root",children:[]};const s={schema:t?{...Fy,...t}:Fy,stack:[]},a=Zb(s,e);return a&&(Array.isArray(a)?a.length===1?n=a[0]:n.children=a:n=a),n}function Zb(e,t){if(t&&typeof t=="object"){const n=t;switch(typeof n.type=="string"?n.type:""){case"comment":return RD(e,n);case"doctype":return MD(e,n);case"element":return BD(e,n);case"root":return LD(e,n);case"text":return zD(e,n)}}}function RD(e,t){if(e.schema.allowComments){const n=typeof t.value=="string"?t.value:"",s=n.indexOf("-->"),o={type:"comment",value:s<0?n:n.slice(0,s)};return wa(o,t),o}}function MD(e,t){if(e.schema.allowDoctypes){const n={type:"doctype"};return wa(n,t),n}}function BD(e,t){const n=typeof t.tagName=="string"?t.tagName:"";e.stack.push(n);const s=Qb(e,t.children),a=ND(e,t.properties);e.stack.pop();let o=!1;if(n&&n!=="*"&&(!e.schema.tagNames||e.schema.tagNames.includes(n))&&(o=!0,e.schema.ancestors&&pr.call(e.schema.ancestors,n))){const f=e.schema.ancestors[n];let p=-1;for(o=!1;++p<f.length;)e.stack.includes(f[p])&&(o=!0)}if(!o)return e.schema.strip&&!e.schema.strip.includes(n)?s:void 0;const c={type:"element",tagName:n,properties:a,children:s};return wa(c,t),c}function LD(e,t){const s={type:"root",children:Qb(e,t.children)};return wa(s,t),s}function zD(e,t){const s={type:"text",value:typeof t.value=="string"?t.value:""};return wa(s,t),s}function Qb(e,t){const n=[];if(Array.isArray(t)){const s=t;let a=-1;for(;++a<s.length;){const o=Zb(e,s[a]);o&&(Array.isArray(o)?n.push(...o):n.push(o))}}return n}function ND(e,t){const n=e.stack[e.stack.length-1],s=e.schema.attributes,a=e.schema.required,o=s&&pr.call(s,n)?s[n]:void 0,c=s&&pr.call(s,"*")?s["*"]:void 0,f=t&&typeof t=="object"?t:{},p={};let h;for(h in f)if(pr.call(f,h)){const g=f[h];let _=qy(e,Wy(o,h),h,g);_==null&&(_=qy(e,Wy(c,h),h,g)),_!=null&&(p[h]=_)}if(a&&pr.call(a,n)){const g=a[n];for(h in g)pr.call(g,h)&&!pr.call(p,h)&&(p[h]=g[h])}return p}function qy(e,t,n,s){return t?Array.isArray(s)?OD(e,t,n,s):Jb(e,t,n,s):void 0}function OD(e,t,n,s){let a=-1;const o=[];for(;++a<s.length;){const c=Jb(e,t,n,s[a]);(typeof c=="number"||typeof c=="string")&&o.push(c)}return o}function Jb(e,t,n,s){if(!(typeof s!="boolean"&&typeof s!="number"&&typeof s!="string")&&HD(e,n,s)){if(typeof t=="object"&&t.length>1){let a=!1,o=0;for(;++o<t.length;){const c=t[o];if(c&&typeof c=="object"&&"flags"in c){if(c.test(String(s))){a=!0;break}}else if(c===s){a=!0;break}}if(!a)return}return e.schema.clobber&&e.schema.clobberPrefix&&e.schema.clobber.includes(n)?e.schema.clobberPrefix+s:s}}function HD(e,t,n){const s=e.schema.protocols&&pr.call(e.schema.protocols,t)?e.schema.protocols[t]:void 0;if(!s||s.length===0)return!0;const a=String(n),o=a.indexOf(":"),c=a.indexOf("?"),f=a.indexOf("#"),p=a.indexOf("/");if(o<0||p>-1&&o>p||c>-1&&o>c||f>-1&&o>f)return!0;let h=-1;for(;++h<s.length;){const g=s[h];if(o===g.length&&a.slice(0,g.length)===g)return!0}return!1}function wa(e,t){const n=eb(t);t.data&&(e.data=pa(t.data)),n&&(e.position=n)}function Wy(e,t){let n,s=-1;if(e)for(;++s<e.length;){const a=e[s],o=typeof a=="string"?a:a[0];if(o===t)return a;o==="data*"&&(n=a)}if(t.length>4&&t.slice(0,4).toLowerCase()==="data")return n}function jD(e){return function(t){return DD(t,e)}}function UD({storyName:e,fileName:t,authFetch:n,onPublish:s,publishingFile:a}){const[o,c]=ae.useState(null),[f,p]=ae.useState(!1),[h,g]=ae.useState("preview"),[_,S]=ae.useState(""),[y,b]=ae.useState(!1),[k,R]=ae.useState(!1),[T,$]=ae.useState(!1),[j,O]=ae.useState(null),X=ae.useRef(null),L=ae.useRef(!1),re=ae.useRef(null),Z=ae.useCallback(async()=>{if(!e||!t){c(null);return}const ue=`${e}/${t}`,E=re.current!==ue;E&&(re.current=ue);try{const A=await n(`/api/stories/${e}/${t}`);if(A.ok){const K=await A.json();c(K),(E||!L.current)&&(S(K.content??""),E&&(R(!1),L.current=!1))}}catch{}},[e,t,n]);ae.useEffect(()=>{p(!0),Z().finally(()=>p(!1))},[Z]),ae.useEffect(()=>{if(!e||!t||h==="edit"&&k)return;const ue=setInterval(Z,3e3);return()=>clearInterval(ue)},[e,t,Z,h,k]);const le=ae.useCallback(async()=>{if(!(!e||!t)){b(!0);try{(await n(`/api/stories/${e}/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:_})})).ok&&(R(!1),L.current=!1,c(E=>E&&{...E,content:_}))}catch{}b(!1)}},[e,t,n,_]);ae.useEffect(()=>{if(h!=="edit")return;const ue=E=>{(E.metaKey||E.ctrlKey)&&E.key==="s"&&(E.preventDefault(),le())};return window.addEventListener("keydown",ue),()=>window.removeEventListener("keydown",ue)},[h,le]),ae.useEffect(()=>{if((o==null?void 0:o.status)!=="published-not-indexed"||!o.publishedAt)return;const ue=new Date(o.publishedAt).getTime(),E=300*1e3,A=()=>{const C=Math.max(0,E-(Date.now()-ue));O(C)};A();const K=setInterval(A,1e3);return()=>clearInterval(K)},[o==null?void 0:o.status,o==null?void 0:o.publishedAt]);const z=j!==null&&j<=0,te=j!==null&&j>0?`${Math.floor(j/6e4)}:${String(Math.floor(j%6e4/1e3)).padStart(2,"0")}`:null;if(!e||!t)return x.jsx("div",{className:"h-full flex items-center justify-center text-muted",children:x.jsxs("div",{className:"text-center",children:[x.jsx("p",{className:"text-lg font-serif",children:"Select a file to preview"}),x.jsx("p",{className:"text-sm mt-1",children:"Click a story file in the sidebar"})]})});if(f&&!o)return x.jsx("div",{className:"h-full flex items-center justify-center text-muted",children:"Loading..."});const F=(h==="edit"?_:(o==null?void 0:o.content)??"").length,V=t==="genesis.md",H=t?/^plot-\d+\.md$/.test(t):!1,M=(o==null?void 0:o.status)==="published"||(o==null?void 0:o.status)==="published-not-indexed",q=V?1e3:H?1e4:null,W=!M&&q!==null&&F>q;return x.jsxs("div",{className:"h-full flex flex-col",children:[x.jsxs("div",{className:"border-b border-border",children:[x.jsxs("div",{className:"px-3 py-1.5 flex items-center justify-between",children:[x.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono text-muted",children:[x.jsxs("span",{children:[e,"/",t]}),(o==null?void 0:o.status)==="published"&&x.jsx("span",{className:"text-green-700 font-medium",children:"Published"}),(o==null?void 0:o.status)==="published-not-indexed"&&x.jsx("span",{className:"text-amber-700 font-medium",title:o.indexError,children:"Published (not indexed)"}),(o==null?void 0:o.status)==="pending"&&x.jsx("span",{className:"text-amber-700 font-medium",children:"Pending"})]}),x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsxs("span",{className:`text-xs font-mono ${W?"text-error font-medium":"text-muted"}`,children:[F.toLocaleString(),q!==null?`/${q.toLocaleString()}`:" chars"]}),W&&x.jsxs("span",{className:"text-error text-xs font-medium",children:[(F-q).toLocaleString()," over limit"]})]})]}),x.jsxs("div",{className:"flex px-3 gap-1",children:[x.jsx("button",{onClick:()=>g("preview"),className:`px-3 py-1 text-xs font-medium border-b-2 transition-colors ${h==="preview"?"border-accent text-accent":"border-transparent text-muted hover:text-foreground"}`,children:"Preview"}),x.jsxs("button",{onClick:()=>g("edit"),className:`px-3 py-1 text-xs font-medium border-b-2 transition-colors ${h==="edit"?"border-accent text-accent":"border-transparent text-muted hover:text-foreground"}`,children:["Edit",k&&x.jsx("span",{className:"ml-1 text-amber-600",children:"*"})]})]})]}),h==="preview"?x.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto px-6 py-4",style:{background:"var(--paper-bg)"},children:o!=null&&o.content?x.jsx("div",{className:"prose max-w-none",children:x.jsx(d3,{remarkPlugins:[C3,AD],rehypePlugins:[jD],children:o.content})}):x.jsx("p",{className:"text-muted italic",children:"No content"})}):x.jsxs("div",{className:"flex-1 min-h-0 flex flex-col",style:{background:"var(--paper-bg)"},children:[x.jsx("textarea",{ref:X,value:_,onChange:ue=>{S(ue.target.value),R(!0),L.current=!0},className:"flex-1 min-h-0 w-full resize-none px-4 py-3 text-sm leading-relaxed focus:outline-none",style:{fontFamily:'"Geist Mono", ui-monospace, monospace',background:"var(--paper-bg)",color:"var(--text)"},spellCheck:!1}),x.jsxs("div",{className:"px-3 py-1.5 border-t border-border flex items-center justify-between",children:[x.jsx("span",{className:"text-xs text-muted",children:k?"Unsaved changes":"No changes"}),x.jsx("button",{onClick:le,disabled:!k||y,className:"px-3 py-1 bg-accent text-white text-xs rounded hover:bg-accent-dim disabled:opacity-50 disabled:cursor-not-allowed",children:y?"Saving...":"Save"})]})]}),x.jsx("div",{className:"px-3 py-2 border-t border-border flex items-center justify-between",children:t==="structure.md"?x.jsx("p",{className:"text-muted text-xs italic",children:"This is your story outline — not publishable. Ask AI to write the genesis next."}):(o==null?void 0:o.status)==="published-not-indexed"?x.jsxs("div",{className:"flex flex-col gap-1",children:[x.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[x.jsx("span",{className:"text-amber-700",children:"Published on-chain but not indexed on PlotLink"}),!z&&x.jsx("button",{onClick:async()=>{if(!(!e||!t||!o.txHash)){$(!0);try{(await(await n("/api/publish/retry-index",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({storyName:e,fileName:t,txHash:o.txHash,content:o.content,storylineId:o.storylineId})})).json()).ok&&(await n(`/api/stories/${e}/${t}/publish-status`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({txHash:o.txHash,storylineId:o.storylineId,contentCid:"",gasCost:""})}),Z())}catch{}$(!1)}},disabled:T,className:"px-3 py-1 bg-accent text-white text-xs rounded hover:bg-accent-dim disabled:opacity-50",children:T?"Retrying...":`Retry Index${te?` (${te})`:""}`}),H&&x.jsx("button",{onClick:()=>e&&t&&(s==null?void 0:s(e,t)),disabled:!!a,className:"px-3 py-1 border border-border text-xs rounded hover:bg-surface disabled:opacity-50",children:a===t?"Publishing...":"Retry Publish"}),o.txHash&&x.jsx("a",{href:`https://basescan.org/tx/${o.txHash}`,target:"_blank",rel:"noopener noreferrer",className:"text-muted underline",children:"BaseScan"})]}),x.jsx("p",{className:"text-muted text-xs",children:z?H?"Index window expired. Use Retry Publish to create a new on-chain tx.":"Index window expired. Contact support or re-publish manually.":H?"Try Retry Index first (available for 5 min after publish). If that fails, Retry Publish creates a new on-chain tx.":"Retry Index is available for 5 min after publish."}),o.indexError&&x.jsx("p",{className:"text-error text-xs",children:o.indexError})]}):(o==null?void 0:o.status)==="published"?x.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[x.jsx("span",{className:"text-green-700",children:"Published"}),o.storylineId&&x.jsx("a",{href:(()=>{var A;const ue=`https://plotlink.xyz/story/${o.storylineId}`;if(!H)return ue;const E=o.plotIndex!=null&&o.plotIndex>0?o.plotIndex:parseInt(((A=t==null?void 0:t.match(/^plot-(\d+)\.md$/))==null?void 0:A[1])??"1");return`${ue}/${E}`})(),target:"_blank",rel:"noopener noreferrer",className:"text-accent underline",children:"View on PlotLink"}),o.txHash&&x.jsx("a",{href:`https://basescan.org/tx/${o.txHash}`,target:"_blank",rel:"noopener noreferrer",className:"text-muted underline",children:"BaseScan"})]}):x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx("button",{onClick:()=>e&&t&&(s==null?void 0:s(e,t)),disabled:!!a||W,className:"px-4 py-1.5 bg-accent text-white text-sm rounded hover:bg-accent-dim disabled:opacity-50 disabled:cursor-not-allowed",children:a===t?"Publishing...":"Publish to PlotLink"}),W&&x.jsx("span",{className:"text-error text-xs",children:"Reduce content to publish"})]})})]})}const e0="plotlink-panel-ratio",PD=.6,Yy=300,kf=224,Ef=6;function ID(){try{const e=localStorage.getItem(e0);if(e){const t=parseFloat(e);if(t>0&&t<1)return t}}catch{}return PD}function Vy(e,t){if(t<=0)return e;const n=Yy/t,s=1-Yy/t;return n>=s?.5:Math.min(s,Math.max(n,e))}function FD({token:e,authFetch:t}){const[n,s]=ae.useState(null),[a,o]=ae.useState(null),[c,f]=ae.useState(null),[p,h]=ae.useState(""),[g,_]=ae.useState(ID),[S,y]=ae.useState([]),b=ae.useRef(new Set),k=ae.useRef(null),R=ae.useRef(!1);ae.useEffect(()=>{try{localStorage.setItem(e0,String(g))}catch{}},[g]),ae.useEffect(()=>{const Z=()=>{if(!k.current)return;const le=k.current.getBoundingClientRect().width-kf-Ef;_(z=>Vy(z,le))};return window.addEventListener("resize",Z),Z(),()=>window.removeEventListener("resize",Z)},[]);const T=ae.useCallback(()=>{const Z=`_new_${Date.now()}`;y(le=>[...le,Z]),s(Z),o(null)},[]);ae.useEffect(()=>{if(S.length===0)return;const Z=setInterval(async()=>{try{const le=await t("/api/stories");if(!le.ok)return;const z=await le.json(),te=new Set(z.stories.filter(U=>U.name!=="_example").map(U=>U.name));for(const U of te)!b.current.has(U)&&S.length>0&&(y(F=>F.slice(1)),s(U),o(null));b.current=te}catch{}},3e3);return()=>clearInterval(Z)},[t,S]),ae.useEffect(()=>{t("/api/stories").then(Z=>{if(Z.ok)return Z.json()}).then(Z=>{Z!=null&&Z.stories&&(b.current=new Set(Z.stories.filter(le=>le.name!=="_example").map(le=>le.name)))}).catch(()=>{})},[t]);const $=ae.useCallback((Z,le)=>{s(Z),o(le)},[]),j=ae.useRef(null),O=ae.useCallback(async Z=>{var le,z,te,U;j.current=Z,s(Z),o(null);try{const F=await t(`/api/stories/${Z}`);if(F.ok&&j.current===Z){const H=(await F.json()).files||[],q=((le=H.map(W=>{var ue;return{file:W.file,num:(ue=W.file.match(/^plot-(\d+)\.md$/))==null?void 0:ue[1]}}).filter(W=>W.num!=null).sort((W,ue)=>parseInt(ue.num)-parseInt(W.num))[0])==null?void 0:le.file)??((z=H.find(W=>W.file==="genesis.md"))==null?void 0:z.file)??((te=H.find(W=>W.file==="structure.md"))==null?void 0:te.file)??((U=H[0])==null?void 0:U.file);q&&j.current===Z&&o(q)}}catch{}},[t]),X=ae.useCallback(Z=>{Z.preventDefault(),R.current=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none";const le=te=>{if(!R.current||!k.current)return;const U=k.current.getBoundingClientRect(),F=U.width-kf-Ef,V=te.clientX-U.left-kf;_(Vy(V/F,F))},z=()=>{R.current=!1,document.body.style.cursor="",document.body.style.userSelect="",window.removeEventListener("mousemove",le),window.removeEventListener("mouseup",z)};window.addEventListener("mousemove",le),window.addEventListener("mouseup",z)},[]),L=ae.useCallback(async(Z,le)=>{var z;f(le),h("Reading file...");try{const te=await t(`/api/stories/${Z}/${le}`);if(!te.ok)throw new Error("Failed to read file");const U=await te.json(),F=U.content.match(/^#\s+(.+)$/m),V=F?F[1].slice(0,60):le.replace(".md","");let H="Fiction";try{const E=await t(`/api/stories/${Z}/structure.md`);if(E.ok){const K=(await E.json()).content.match(/genre[:\s]+(.+)/i);K&&(H=K[1].trim().slice(0,30))}}catch{}let M;if(le.match(/^plot-\d+\.md$/)){try{const E=await t(`/api/stories/${Z}`);if(E.ok){const K=(await E.json()).files.find(C=>C.file==="genesis.md"&&C.storylineId);M=K==null?void 0:K.storylineId}}catch{}if(!M){h("Error: Publish genesis first to create the storyline"),setTimeout(()=>{f(null),h("")},3e3);return}}h("Publishing...");const q=await t("/api/publish/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({storyName:Z,fileName:le,title:V,content:U.content,genre:H,storylineId:M})});if(!q.ok){const E=await q.json();throw new Error(E.error||"Publish failed")}const W=(z=q.body)==null?void 0:z.getReader(),ue=new TextDecoder;if(W)for(;;){const{done:E,value:A}=await W.read();if(E)break;const C=ue.decode(A).split(`
129
+ `).filter(se=>se.startsWith("data: "));for(const se of C)try{const fe=JSON.parse(se.slice(6));fe.step&&h(fe.message||fe.step),fe.step==="done"&&fe.txHash&&await t(`/api/stories/${Z}/${le}/publish-status`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({txHash:fe.txHash,storylineId:fe.storylineId,plotIndex:fe.plotIndex,contentCid:fe.contentCid,gasCost:fe.gasCost,indexError:fe.indexError})})}catch{}}h("Published!")}catch(te){const U=te instanceof Error?te.message:"Publish failed";h(`Error: ${U}`)}finally{setTimeout(()=>{f(null),h("")},3e3)}},[t]),re=ae.useCallback(Z=>{Z.startsWith("_new_")&&y(le=>le.filter(z=>z!==Z))},[]);return x.jsxs("div",{ref:k,className:"h-[calc(100vh-3.5rem)] flex",children:[x.jsx("div",{className:"w-56 border-r border-border flex-shrink-0",children:x.jsx(zx,{authFetch:t,selectedStory:n,selectedFile:a,onSelectFile:$,onNewStory:T,untitledSessions:S})}),x.jsx("div",{className:"min-w-0 border-r border-border",style:{flex:`${g} 0 0`},children:x.jsx(nk,{token:e,storyName:n,authFetch:t,onSelectStory:O,onDestroySession:re})}),x.jsx("div",{onMouseDown:X,className:"flex-shrink-0 flex items-center justify-center hover:bg-border/50 transition-colors",style:{width:Ef,cursor:"col-resize",background:"var(--border)"},children:x.jsxs("div",{className:"flex flex-col gap-1",children:[x.jsx("div",{className:"w-0.5 h-0.5 rounded-full",style:{background:"var(--text-muted)"}}),x.jsx("div",{className:"w-0.5 h-0.5 rounded-full",style:{background:"var(--text-muted)"}}),x.jsx("div",{className:"w-0.5 h-0.5 rounded-full",style:{background:"var(--text-muted)"}})]})}),x.jsxs("div",{className:"min-w-0 flex flex-col",style:{flex:`${1-g} 0 0`},children:[x.jsx(UD,{storyName:n,fileName:a,authFetch:t,onPublish:L,publishingFile:c}),p&&x.jsx("div",{className:"px-3 py-1.5 bg-surface border-t border-border text-xs text-muted",children:p})]})]})}function qD({token:e,onComplete:t}){const[n,s]=ae.useState(!1),[a,o]=ae.useState(null),[c,f]=ae.useState(!1),p=async()=>{s(!0),o(null);try{const h=await fetch("/api/wallet/create",{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"}}),g=await h.json();if(!h.ok)throw new Error(g.error||"Wallet creation failed");f(!0)}catch(h){o(h instanceof Error?h.message:"Wallet creation failed")}s(!1)};return ae.useEffect(()=>{p()},[]),x.jsxs("div",{className:"mx-auto max-w-sm p-6 text-center",children:[x.jsx("h2",{className:"text-accent mb-1 text-lg font-bold",children:"Wallet Setup"}),x.jsx("p",{className:"text-muted mb-6 text-xs",children:"creating your OWS wallet for on-chain publishing"}),n&&x.jsx("p",{className:"text-accent text-sm",children:"creating wallet..."}),a&&x.jsxs("div",{className:"space-y-4",children:[x.jsx("div",{className:"rounded border border-red-700/30 p-3 text-xs text-red-700",children:a}),x.jsx("button",{onClick:p,className:"border-accent text-accent hover:bg-accent/10 w-full rounded border px-4 py-2 text-sm font-medium transition-colors",children:"retry"})]}),c&&x.jsxs("div",{className:"space-y-4",children:[x.jsx("div",{className:"text-accent text-2xl",children:"✓"}),x.jsx("p",{className:"text-foreground text-sm font-medium",children:"wallet created"}),x.jsx("button",{onClick:t,className:"border-accent text-accent hover:bg-accent/10 w-full rounded border px-4 py-2 text-sm font-medium transition-colors",children:"continue"})]})]})}function WD({token:e,onLogout:t}){const[n,s]=ae.useState("home"),[a,o]=ae.useState(0),c=ae.useCallback(async(f,p)=>fetch(f,{...p,headers:{...(p==null?void 0:p.headers)||{},Authorization:`Bearer ${e}`}}),[e]);return ae.useEffect(()=>{async function f(){try{if(!(await(await c("/api/wallet")).json()).exists){s("wallet-setup");return}const g=await c("/api/stories");if(g.ok){const _=await g.json();o(_.stories.filter(S=>S.name!=="_example").length)}}catch{}}f()},[e]),x.jsxs("div",{className:"flex h-screen flex-col",children:[x.jsxs("header",{className:"border-border flex h-14 items-center justify-between border-b px-4 flex-shrink-0",children:[x.jsxs("div",{className:"flex items-center gap-3",children:[x.jsx("button",{onClick:()=>{n!=="wallet-setup"&&s("home")},className:"flex items-center gap-2 hover:opacity-80",children:x.jsx("span",{className:"text-accent text-sm font-bold tracking-tight",children:"PlotLink OWS"})}),x.jsx("span",{className:"text-muted text-[10px] uppercase tracking-wider",children:"writer"})]}),n!=="wallet-setup"&&x.jsxs("nav",{className:"flex items-center gap-4",children:[x.jsx("button",{onClick:()=>s("stories"),className:`text-xs transition-colors ${n==="stories"?"text-accent":"text-muted hover:text-foreground"}`,children:"stories"}),x.jsx("button",{onClick:()=>s("dashboard"),className:`text-xs transition-colors ${n==="dashboard"?"text-accent":"text-muted hover:text-foreground"}`,children:"dashboard"}),x.jsx("button",{onClick:()=>s("settings"),className:`text-xs transition-colors ${n==="settings"?"text-accent":"text-muted hover:text-foreground"}`,children:"settings"}),x.jsx("button",{onClick:t,className:"text-muted hover:text-foreground text-xs transition-colors",children:"logout"})]})]}),x.jsxs("main",{className:"flex-1 min-h-0",children:[n==="home"&&x.jsxs("div",{className:"mx-auto max-w-lg space-y-6 p-8",children:[x.jsxs("div",{className:"text-center space-y-2",children:[x.jsx("h1",{className:"text-2xl font-serif text-foreground",children:"Write. Publish. Earn."}),x.jsx("p",{className:"text-muted text-sm",children:"Claude CLI writes stories. You publish them on-chain."})]}),x.jsxs("div",{className:"text-center space-y-3",children:[x.jsx("button",{onClick:()=>s("stories"),className:"bg-accent text-white hover:bg-accent-dim px-6 py-2.5 rounded text-sm font-medium transition-colors",children:"Start Writing"}),a>0&&x.jsxs("p",{className:"text-muted text-xs",children:[a," ",a===1?"story":"stories"," in progress"]})]}),x.jsxs("div",{className:"rounded border border-border p-4 space-y-2 text-xs text-muted",children:[x.jsx("p",{className:"font-medium text-foreground text-sm",children:"How it works"}),x.jsxs("ol",{className:"space-y-1.5 list-decimal list-inside",children:[x.jsxs("li",{children:["Open the ",x.jsx("strong",{children:"Stories"})," tab — Claude CLI launches in the terminal"]}),x.jsx("li",{children:"Tell Claude your story idea — it brainstorms, outlines, and writes"}),x.jsx("li",{children:"Review the live preview as Claude creates files"}),x.jsxs("li",{children:["Click ",x.jsx("strong",{children:"Publish"})," to put your story on-chain"]}),x.jsxs("li",{children:["Earn 5% royalties on every trade at ",x.jsx("a",{href:"https://plotlink.xyz",target:"_blank",rel:"noopener noreferrer",className:"text-accent underline",children:"plotlink.xyz"})]})]})]}),x.jsx(Gy,{token:e})]}),n==="stories"&&x.jsx(FD,{token:e,authFetch:c}),n==="dashboard"&&x.jsx(Mx,{token:e}),n==="wallet-setup"&&x.jsx(qD,{token:e,onComplete:()=>s("home")}),n==="settings"&&x.jsx(Dx,{token:e,onLogout:t})]})]})}function YD(){const[e,t]=ae.useState(()=>localStorage.getItem("ows-token")),[n,s]=ae.useState(null),[a,o]=ae.useState(!0);ae.useEffect(()=>{fetch("/api/auth/status").then(h=>h.json()).then(h=>s(h.configured)).catch(()=>s(null))},[]),ae.useEffect(()=>{if(!e){o(!1);return}fetch("/api/auth/verify",{headers:{Authorization:`Bearer ${e}`}}).then(h=>{h.ok||(localStorage.removeItem("ows-token"),t(null))}).catch(()=>{localStorage.removeItem("ows-token"),t(null)}).finally(()=>o(!1))},[e]);const c=async h=>{try{const g=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({passphrase:h})}),_=await g.json();return g.ok?(localStorage.setItem("ows-token",_.token),t(_.token),null):_.error||"Login failed"}catch{return"Cannot connect to server"}},f=async h=>{try{const g=await fetch("/api/auth/setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({passphrase:h})}),_=await g.json();return g.ok?(localStorage.setItem("ows-token",_.token),t(_.token),s(!0),null):_.error||"Setup failed"}catch{return"Cannot connect to server"}},p=()=>{localStorage.removeItem("ows-token"),t(null)};return a||n===null?x.jsx("div",{className:"flex h-screen items-center justify-center",children:x.jsx("span",{className:"text-muted text-sm",children:"connecting..."})}):n?e?x.jsx(WD,{token:e,onLogout:p}):x.jsx(Tx,{onLogin:c}):x.jsx(Ax,{onSetup:f})}Ex.createRoot(document.getElementById("root")).render(x.jsx(vx.StrictMode,{children:x.jsx(YD,{})}));