@dadigua/web-terminal 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,28 @@
1
+ (function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const u of document.querySelectorAll('link[rel="modulepreload"]'))a(u);new MutationObserver(u=>{for(const h of u)if(h.type==="childList")for(const f of h.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&a(f)}).observe(document,{childList:!0,subtree:!0});function l(u){const h={};return u.integrity&&(h.integrity=u.integrity),u.referrerPolicy&&(h.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?h.credentials="include":u.crossOrigin==="anonymous"?h.credentials="omit":h.credentials="same-origin",h}function a(u){if(u.ep)return;u.ep=!0;const h=l(u);fetch(u.href,h)}})();var Wh={exports:{}},$l={};var Rv;function p1(){if(Rv)return $l;Rv=1;var t=Symbol.for("react.transitional.element"),s=Symbol.for("react.fragment");function l(a,u,h){var f=null;if(h!==void 0&&(f=""+h),u.key!==void 0&&(f=""+u.key),"key"in u){h={};for(var d in u)d!=="key"&&(h[d]=u[d])}else h=u;return u=h.ref,{$$typeof:t,type:a,key:f,ref:u!==void 0?u:null,props:h}}return $l.Fragment=s,$l.jsx=l,$l.jsxs=l,$l}var Ov;function S1(){return Ov||(Ov=1,Wh.exports=p1()),Wh.exports}var C=S1(),Fh={exports:{}},Jl={},Zh={exports:{}},Qh={};var Av;function y1(){return Av||(Av=1,(function(t){function s(z,P){var E=z.length;z.push(P);e:for(;0<E;){var I=E-1>>>1,ie=z[I];if(0<u(ie,P))z[I]=P,z[E]=ie,E=I;else break e}}function l(z){return z.length===0?null:z[0]}function a(z){if(z.length===0)return null;var P=z[0],E=z.pop();if(E!==P){z[0]=E;e:for(var I=0,ie=z.length,B=ie>>>1;I<B;){var _e=2*(I+1)-1,se=z[_e],b=_e+1,H=z[b];if(0>u(se,E))b<ie&&0>u(H,se)?(z[I]=H,z[b]=E,I=b):(z[I]=se,z[_e]=E,I=_e);else if(b<ie&&0>u(H,E))z[I]=H,z[b]=E,I=b;else break e}}return P}function u(z,P){var E=z.sortIndex-P.sortIndex;return E!==0?E:z.id-P.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var h=performance;t.unstable_now=function(){return h.now()}}else{var f=Date,d=f.now();t.unstable_now=function(){return f.now()-d}}var m=[],g=[],S=1,v=null,w=3,O=!1,T=!1,k=!1,j=!1,F=typeof setTimeout=="function"?setTimeout:null,ve=typeof clearTimeout=="function"?clearTimeout:null,he=typeof setImmediate<"u"?setImmediate:null;function te(z){for(var P=l(g);P!==null;){if(P.callback===null)a(g);else if(P.startTime<=z)a(g),P.sortIndex=P.expirationTime,s(m,P);else break;P=l(g)}}function $(z){if(k=!1,te(z),!T)if(l(m)!==null)T=!0,oe||(oe=!0,ee());else{var P=l(g);P!==null&&Z($,P.startTime-z)}}var oe=!1,ce=-1,ge=5,je=-1;function qe(){return j?!0:!(t.unstable_now()-je<ge)}function we(){if(j=!1,oe){var z=t.unstable_now();je=z;var P=!0;try{e:{T=!1,k&&(k=!1,ve(ce),ce=-1),O=!0;var E=w;try{t:{for(te(z),v=l(m);v!==null&&!(v.expirationTime>z&&qe());){var I=v.callback;if(typeof I=="function"){v.callback=null,w=v.priorityLevel;var ie=I(v.expirationTime<=z);if(z=t.unstable_now(),typeof ie=="function"){v.callback=ie,te(z),P=!0;break t}v===l(m)&&a(m),te(z)}else a(m);v=l(m)}if(v!==null)P=!0;else{var B=l(g);B!==null&&Z($,B.startTime-z),P=!1}}break e}finally{v=null,w=E,O=!1}P=void 0}}finally{P?ee():oe=!1}}}var ee;if(typeof he=="function")ee=function(){he(we)};else if(typeof MessageChannel<"u"){var K=new MessageChannel,re=K.port2;K.port1.onmessage=we,ee=function(){re.postMessage(null)}}else ee=function(){F(we,0)};function Z(z,P){ce=F(function(){z(t.unstable_now())},P)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(z){z.callback=null},t.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):ge=0<z?Math.floor(1e3/z):5},t.unstable_getCurrentPriorityLevel=function(){return w},t.unstable_next=function(z){switch(w){case 1:case 2:case 3:var P=3;break;default:P=w}var E=w;w=P;try{return z()}finally{w=E}},t.unstable_requestPaint=function(){j=!0},t.unstable_runWithPriority=function(z,P){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var E=w;w=z;try{return P()}finally{w=E}},t.unstable_scheduleCallback=function(z,P,E){var I=t.unstable_now();switch(typeof E=="object"&&E!==null?(E=E.delay,E=typeof E=="number"&&0<E?I+E:I):E=I,z){case 1:var ie=-1;break;case 2:ie=250;break;case 5:ie=1073741823;break;case 4:ie=1e4;break;default:ie=5e3}return ie=E+ie,z={id:S++,callback:P,priorityLevel:z,startTime:E,expirationTime:ie,sortIndex:-1},E>I?(z.sortIndex=E,s(g,z),l(m)===null&&z===l(g)&&(k?(ve(ce),ce=-1):k=!0,Z($,E-I))):(z.sortIndex=ie,s(m,z),T||O||(T=!0,oe||(oe=!0,ee()))),z},t.unstable_shouldYield=qe,t.unstable_wrapCallback=function(z){var P=w;return function(){var E=w;w=P;try{return z.apply(this,arguments)}finally{w=E}}}})(Qh)),Qh}var Bv;function b1(){return Bv||(Bv=1,Zh.exports=y1()),Zh.exports}var $h={exports:{}},De={};var kv;function w1(){if(kv)return De;kv=1;var t=Symbol.for("react.transitional.element"),s=Symbol.for("react.portal"),l=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),h=Symbol.for("react.consumer"),f=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),w=Symbol.for("react.view_transition"),O=Symbol.iterator;function T(b){return b===null||typeof b!="object"?null:(b=O&&b[O]||b["@@iterator"],typeof b=="function"?b:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,F={};function ve(b,H,G){this.props=b,this.context=H,this.refs=F,this.updater=G||k}ve.prototype.isReactComponent={},ve.prototype.setState=function(b,H){if(typeof b!="object"&&typeof b!="function"&&b!=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,b,H,"setState")},ve.prototype.forceUpdate=function(b){this.updater.enqueueForceUpdate(this,b,"forceUpdate")};function he(){}he.prototype=ve.prototype;function te(b,H,G){this.props=b,this.context=H,this.refs=F,this.updater=G||k}var $=te.prototype=new he;$.constructor=te,j($,ve.prototype),$.isPureReactComponent=!0;var oe=Array.isArray;function ce(){}var ge={H:null,A:null,T:null,S:null},je=Object.prototype.hasOwnProperty;function qe(b,H,G){var Q=G.ref;return{$$typeof:t,type:b,key:H,ref:Q!==void 0?Q:null,props:G}}function we(b,H){return qe(b.type,H,b.props)}function ee(b){return typeof b=="object"&&b!==null&&b.$$typeof===t}function K(b){var H={"=":"=0",":":"=2"};return"$"+b.replace(/[=:]/g,function(G){return H[G]})}var re=/\/+/g;function Z(b,H){return typeof b=="object"&&b!==null&&b.key!=null?K(""+b.key):H.toString(36)}function z(b){switch(b.status){case"fulfilled":return b.value;case"rejected":throw b.reason;default:switch(typeof b.status=="string"?b.then(ce,ce):(b.status="pending",b.then(function(H){b.status==="pending"&&(b.status="fulfilled",b.value=H)},function(H){b.status==="pending"&&(b.status="rejected",b.reason=H)})),b.status){case"fulfilled":return b.value;case"rejected":throw b.reason}}throw b}function P(b,H,G,Q,ye){var me=typeof b;(me==="undefined"||me==="boolean")&&(b=null);var Ee=!1;if(b===null)Ee=!0;else switch(me){case"bigint":case"string":case"number":Ee=!0;break;case"object":switch(b.$$typeof){case t:case s:Ee=!0;break;case S:return Ee=b._init,P(Ee(b._payload),H,G,Q,ye)}}if(Ee)return ye=ye(b),Ee=Q===""?"."+Z(b,0):Q,oe(ye)?(G="",Ee!=null&&(G=Ee.replace(re,"$&/")+"/"),P(ye,H,G,"",function(J){return J})):ye!=null&&(ee(ye)&&(ye=we(ye,G+(ye.key==null||b&&b.key===ye.key?"":(""+ye.key).replace(re,"$&/")+"/")+Ee)),H.push(ye)),1;Ee=0;var le=Q===""?".":Q+":";if(oe(b))for(var X=0;X<b.length;X++)Q=b[X],me=le+Z(Q,X),Ee+=P(Q,H,G,me,ye);else if(X=T(b),typeof X=="function")for(b=X.call(b),X=0;!(Q=b.next()).done;)Q=Q.value,me=le+Z(Q,X++),Ee+=P(Q,H,G,me,ye);else if(me==="object"){if(typeof b.then=="function")return P(z(b),H,G,Q,ye);throw H=String(b),Error("Objects are not valid as a React child (found: "+(H==="[object Object]"?"object with keys {"+Object.keys(b).join(", ")+"}":H)+"). If you meant to render a collection of children, use an array instead.")}return Ee}function E(b,H,G){if(b==null)return b;var Q=[],ye=0;return P(b,Q,"","",function(me){return H.call(G,me,ye++)}),Q}function I(b){if(b._status===-1){var H=b._result,G=H();G.then(function(Q){(b._status===0||b._status===-1)&&(b._status=1,b._result=Q,G.status===void 0&&(G.status="fulfilled",G.value=Q))},function(Q){(b._status===0||b._status===-1)&&(b._status=2,b._result=Q,G.status===void 0&&(G.status="rejected",G.reason=Q))}),b._status===-1&&(b._status=0,b._result=G)}if(b._status===1)return b._result.default;throw b._result}var ie=typeof reportError=="function"?reportError:function(b){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var H=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof b=="object"&&b!==null&&typeof b.message=="string"?String(b.message):String(b),error:b});if(!window.dispatchEvent(H))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",b);return}console.error(b)};function B(b){var H=ge.T,G={};G.types=H!==null?H.types:null,ge.T=G;try{var Q=b(),ye=ge.S;ye!==null&&ye(G,Q),typeof Q=="object"&&Q!==null&&typeof Q.then=="function"&&Q.then(ce,ie)}catch(me){ie(me)}finally{H!==null&&G.types!==null&&(H.types=G.types),ge.T=H}}function _e(b){var H=ge.T;if(H!==null){var G=H.types;G===null?H.types=[b]:G.indexOf(b)===-1&&G.push(b)}else B(_e.bind(null,b))}var se={map:E,forEach:function(b,H,G){E(b,function(){H.apply(this,arguments)},G)},count:function(b){var H=0;return E(b,function(){H++}),H},toArray:function(b){return E(b,function(H){return H})||[]},only:function(b){if(!ee(b))throw Error("React.Children.only expected to receive a single React element child.");return b}};return De.Activity=v,De.Children=se,De.Component=ve,De.Fragment=l,De.Profiler=u,De.PureComponent=te,De.StrictMode=a,De.Suspense=m,De.ViewTransition=w,De.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=ge,De.__COMPILER_RUNTIME={__proto__:null,c:function(b){return ge.H.useMemoCache(b)}},De.addTransitionType=_e,De.cache=function(b){return function(){return b.apply(null,arguments)}},De.cacheSignal=function(){return null},De.cloneElement=function(b,H,G){if(b==null)throw Error("The argument must be a React element, but you passed "+b+".");var Q=j({},b.props),ye=b.key;if(H!=null)for(me in H.key!==void 0&&(ye=""+H.key),H)!je.call(H,me)||me==="key"||me==="__self"||me==="__source"||me==="ref"&&H.ref===void 0||(Q[me]=H[me]);var me=arguments.length-2;if(me===1)Q.children=G;else if(1<me){for(var Ee=Array(me),le=0;le<me;le++)Ee[le]=arguments[le+2];Q.children=Ee}return qe(b.type,ye,Q)},De.createContext=function(b){return b={$$typeof:f,_currentValue:b,_currentValue2:b,_threadCount:0,Provider:null,Consumer:null},b.Provider=b,b.Consumer={$$typeof:h,_context:b},b},De.createElement=function(b,H,G){var Q,ye={},me=null;if(H!=null)for(Q in H.key!==void 0&&(me=""+H.key),H)je.call(H,Q)&&Q!=="key"&&Q!=="__self"&&Q!=="__source"&&(ye[Q]=H[Q]);var Ee=arguments.length-2;if(Ee===1)ye.children=G;else if(1<Ee){for(var le=Array(Ee),X=0;X<Ee;X++)le[X]=arguments[X+2];ye.children=le}if(b&&b.defaultProps)for(Q in Ee=b.defaultProps,Ee)ye[Q]===void 0&&(ye[Q]=Ee[Q]);return qe(b,me,ye)},De.createRef=function(){return{current:null}},De.forwardRef=function(b){return{$$typeof:d,render:b}},De.isValidElement=ee,De.lazy=function(b){return{$$typeof:S,_payload:{_status:-1,_result:b},_init:I}},De.memo=function(b,H){return{$$typeof:g,type:b,compare:H===void 0?null:H}},De.startTransition=B,De.unstable_useCacheRefresh=function(){return ge.H.useCacheRefresh()},De.use=function(b){return ge.H.use(b)},De.useActionState=function(b,H,G){return ge.H.useActionState(b,H,G)},De.useCallback=function(b,H){return ge.H.useCallback(b,H)},De.useContext=function(b){return ge.H.useContext(b)},De.useDebugValue=function(){},De.useDeferredValue=function(b,H){return ge.H.useDeferredValue(b,H)},De.useEffect=function(b,H){return ge.H.useEffect(b,H)},De.useEffectEvent=function(b){return ge.H.useEffectEvent(b)},De.useId=function(){return ge.H.useId()},De.useImperativeHandle=function(b,H,G){return ge.H.useImperativeHandle(b,H,G)},De.useInsertionEffect=function(b,H){return ge.H.useInsertionEffect(b,H)},De.useLayoutEffect=function(b,H){return ge.H.useLayoutEffect(b,H)},De.useMemo=function(b,H){return ge.H.useMemo(b,H)},De.useOptimistic=function(b,H){return ge.H.useOptimistic(b,H)},De.useReducer=function(b,H,G){return ge.H.useReducer(b,H,G)},De.useRef=function(b){return ge.H.useRef(b)},De.useState=function(b){return ge.H.useState(b)},De.useSyncExternalStore=function(b,H,G){return ge.H.useSyncExternalStore(b,H,G)},De.useTransition=function(){return ge.H.useTransition()},De.version="19.3.0",De}var Nv;function ed(){return Nv||(Nv=1,$h.exports=w1()),$h.exports}var Jh={exports:{}},Gt={};var Lv;function C1(){if(Lv)return Gt;Lv=1;var t=ed();function s(S){var v="https://react.dev/errors/"+S;if(1<arguments.length){v+="?args[]="+encodeURIComponent(arguments[1]);for(var w=2;w<arguments.length;w++)v+="&args[]="+encodeURIComponent(arguments[w])}return"Minified React error #"+S+"; visit "+v+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(){}var a={d:{f:l,r:function(){throw Error(s(522))},D:l,C:l,L:l,m:l,X:l,S:l,M:l},p:0,findDOMNode:null},u=Symbol.for("react.portal"),h=Symbol.for("react.recoverable"),f=Symbol.for("react.optimistic_key");function d(S,v,w){var O=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:u,key:O==null?null:O===f?f:""+O,children:S,containerInfo:v,implementation:w}}var m=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function g(S,v){if(S==="font")return"";if(typeof v=="string")return v==="use-credentials"?v:""}return Gt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,Gt.browser=function(S){return{$$typeof:h,_reason:S}},Gt.createPortal=function(S,v){var w=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!v||v.nodeType!==1&&v.nodeType!==9&&v.nodeType!==11)throw Error(s(299));return d(S,v,null,w)},Gt.flushSync=function(S){var v=m.T,w=a.p;try{if(m.T=null,a.p=2,S)return S()}finally{m.T=v,a.p=w,a.d.f()}},Gt.preconnect=function(S,v){typeof S=="string"&&(v?(v=v.crossOrigin,v=typeof v=="string"?v==="use-credentials"?v:"":void 0):v=null,a.d.C(S,v))},Gt.prefetchDNS=function(S){typeof S=="string"&&a.d.D(S)},Gt.preinit=function(S,v){if(typeof S=="string"&&v&&typeof v.as=="string"){var w=v.as,O=g(w,v.crossOrigin),T=typeof v.integrity=="string"?v.integrity:void 0,k=typeof v.fetchPriority=="string"?v.fetchPriority:void 0;w==="style"?a.d.S(S,typeof v.precedence=="string"?v.precedence:void 0,{crossOrigin:O,integrity:T,fetchPriority:k}):w==="script"&&a.d.X(S,{crossOrigin:O,integrity:T,fetchPriority:k,nonce:typeof v.nonce=="string"?v.nonce:void 0})}},Gt.preinitModule=function(S,v){if(typeof S=="string")if(typeof v=="object"&&v!==null){if(v.as==null||v.as==="script"){var w=g(v.as,v.crossOrigin);a.d.M(S,{crossOrigin:w,integrity:typeof v.integrity=="string"?v.integrity:void 0,nonce:typeof v.nonce=="string"?v.nonce:void 0,fetchPriority:typeof v.fetchPriority=="string"?v.fetchPriority:void 0})}}else v==null&&a.d.M(S)},Gt.preload=function(S,v){if(typeof S=="string"&&typeof v=="object"&&v!==null&&typeof v.as=="string"){var w=v.as,O=g(w,v.crossOrigin);a.d.L(S,w,{crossOrigin:O,integrity:typeof v.integrity=="string"?v.integrity:void 0,nonce:typeof v.nonce=="string"?v.nonce:void 0,type:typeof v.type=="string"?v.type:void 0,fetchPriority:typeof v.fetchPriority=="string"?v.fetchPriority:void 0,referrerPolicy:typeof v.referrerPolicy=="string"?v.referrerPolicy:void 0,imageSrcSet:typeof v.imageSrcSet=="string"?v.imageSrcSet:void 0,imageSizes:typeof v.imageSizes=="string"?v.imageSizes:void 0,media:typeof v.media=="string"?v.media:void 0})}},Gt.preloadModule=function(S,v){if(typeof S=="string")if(v){var w=g(v.as,v.crossOrigin);a.d.m(S,{as:typeof v.as=="string"&&v.as!=="script"?v.as:void 0,crossOrigin:w,integrity:typeof v.integrity=="string"?v.integrity:void 0,nonce:typeof v.nonce=="string"?v.nonce:void 0,fetchPriority:typeof v.fetchPriority=="string"?v.fetchPriority:void 0})}else a.d.m(S)},Gt.requestFormReset=function(S){a.d.r(S)},Gt.unstable_batchedUpdates=function(S,v){return S(v)},Gt.useFormState=function(S,v,w){return m.H.useFormState(S,v,w)},Gt.useFormStatus=function(){return m.H.useHostTransitionStatus()},Gt.version="19.3.0",Gt}var zv;function zp(){if(zv)return Jh.exports;zv=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(s){console.error(s)}}return t(),Jh.exports=C1(),Jh.exports}var Hv;function E1(){if(Hv)return Jl;Hv=1;var t=b1(),s=ed(),l=zp();function a(e){var i="https://react.dev/errors/"+e;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var r=2;r<arguments.length;r++)i+="&args[]="+encodeURIComponent(arguments[r])}return"Minified React error #"+e+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function u(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function h(e){for(var i=e,r=i;r&&!r.alternate;)i=r,(i.flags&4098)!==0&&(e=i.return),r=i.return;for(;i.return;)i=i.return;return i.tag===3?e:null}function f(e){if(e.tag===13){var i=e.memoizedState;if(i===null&&(e=e.alternate,e!==null&&(i=e.memoizedState)),i!==null)return i.dehydrated}return null}function d(e){if(e.tag===31){var i=e.memoizedState;if(i===null&&(e=e.alternate,e!==null&&(i=e.memoizedState)),i!==null)return i.dehydrated}return null}function m(e){if(h(e)!==e)throw Error(a(188))}function g(e){var i=e.alternate;if(!i){if(i=h(e),i===null)throw Error(a(188));return i!==e?null:e}for(var r=e,n=i;;){var o=r.return;if(o===null)break;var c=o.alternate;if(c===null){if(n=o.return,n!==null){r=n;continue}break}if(o.child===c.child){for(c=o.child;c;){if(c===r)return m(o),e;if(c===n)return m(o),i;c=c.sibling}throw Error(a(188))}if(r.return!==n.return)r=o,n=c;else{for(var _=!1,p=o.child;p;){if(p===r){_=!0,r=o,n=c;break}if(p===n){_=!0,n=o,r=c;break}p=p.sibling}if(!_){for(p=c.child;p;){if(p===r){_=!0,r=c,n=o;break}if(p===n){_=!0,n=c,r=o;break}p=p.sibling}if(!_)throw Error(a(189))}}if(r.alternate!==n)throw Error(a(190))}if(r.tag!==3)throw Error(a(188));return r.stateNode.current===r?e:i}function S(e){var i=e.tag;if(i===5||i===26||i===27||i===6)return e;for(e=e.child;e!==null;){if(i=S(e),i!==null)return i;e=e.sibling}return null}function v(e,i,r,n,o,c){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&r(e,n,o,c)||(e.tag!==22||e.memoizedState===null)&&(i||e.tag!==5&&e.tag!==27)&&v(e.child,i,r,n,o,c))return!0;e=e.sibling}return!1}function w(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function O(e){var i=!1;for(e=e.return;e!==null&&(e.tag===4&&(i=!0),!(e.tag===3||e.tag===5||e.tag===27));)e=e.return;return i}function T(e){var i=[null,null],r=w(e);return r===null||k(i,e,r.child,{foundSelf:!1}),i}function k(e,i,r,n){for(;r!==null;){if(r===i)n.foundSelf=!0;else if(r.tag===5||r.tag===27||r.tag===6){if(n.foundSelf)return e[1]=r,!0;e[0]=r}else if((r.tag!==22||r.memoizedState===null)&&k(e,i,r.child,n))return!0;r=r.sibling}return!1}function j(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(a(559))}}var F=null,ve=null;function he(e,i,r){return e===r?!0:e===i?(F=e,!0):!1}function te(e,i,r){return e===r?(ve=e,!1):e===i?(ve!==null&&(F=e),!0):!1}function $(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function oe(e,i,r){for(var n=0,o=e;o;o=r(o))n++;o=0;for(var c=i;c;c=r(c))o++;for(;0<n-o;)e=r(e),n--;for(;0<o-n;)i=r(i),o--;for(;n--;){if(e===i||i!==null&&e===i.alternate)return e;e=r(e),i=r(i)}return null}var ce=Object.assign,ge=Symbol.for("react.element"),je=Symbol.for("react.transitional.element"),qe=Symbol.for("react.portal"),we=Symbol.for("react.fragment"),ee=Symbol.for("react.strict_mode"),K=Symbol.for("react.profiler"),re=Symbol.for("react.consumer"),Z=Symbol.for("react.context"),z=Symbol.for("react.forward_ref"),P=Symbol.for("react.suspense"),E=Symbol.for("react.suspense_list"),I=Symbol.for("react.memo"),ie=Symbol.for("react.lazy"),B=Symbol.for("react.activity"),_e=Symbol.for("react.legacy_hidden"),se=Symbol.for("react.memo_cache_sentinel"),b=Symbol.for("react.view_transition"),H=Symbol.for("react.recoverable"),G=Symbol.iterator;function Q(e){return e===null||typeof e!="object"?null:(e=G&&e[G]||e["@@iterator"],typeof e=="function"?e:null)}var ye=Symbol.for("react.client.reference");function me(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ye?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case we:return"Fragment";case K:return"Profiler";case ee:return"StrictMode";case P:return"Suspense";case E:return"SuspenseList";case B:return"Activity";case b:return"ViewTransition"}if(typeof e=="object")switch(e.$$typeof){case qe:return"Portal";case Z:return e.displayName||"Context";case re:return(e._context.displayName||"Context")+".Consumer";case z:var i=e.render;return e=e.displayName,e||(e=i.displayName||i.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case I:return i=e.displayName||null,i!==null?i:me(e.type)||"Memo";case ie:i=e._payload,e=e._init;try{return me(e(i))}catch{}}return null}var Ee=Array.isArray,le=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=l.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J={pending:!1,data:null,method:null,action:null},$e=[],$t=-1;function vi(e){return{current:e}}function tt(e){0>$t||(e.current=$e[$t],$e[$t]=null,$t--)}function Ve(e,i){$t++,$e[$t]=e.current,e.current=i}var Jt=vi(null),$i=vi(null),Pi=vi(null),sn=vi(null);function Ss(e,i){switch(Ve(Pi,i),Ve($i,e),Ve(Jt,null),i.nodeType){case 9:case 11:e=(e=i.documentElement)&&(e=e.namespaceURI)?Um(e):0;break;default:if(e=i.tagName,i=i.namespaceURI)i=Um(i),e=jm(i,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}tt(Jt),Ve(Jt,e)}function Ii(){tt(Jt),tt($i),tt(Pi)}function rn(e){var i=e.memoizedState;i!==null&&(Gn._currentValue=i.memoizedState,Ve(sn,e)),i=Jt.current;var r=jm(i,e.type);i!==r&&(Ve($i,e),Ve(Jt,r))}function Cr(e){$i.current===e&&(tt(Jt),tt($i)),sn.current===e&&(tt(sn),Gn._currentValue=J)}var nn,W;function be(e){if(nn===void 0)try{throw Error()}catch(r){var i=r.stack.trim().match(/\n( *(at )?)/);nn=i&&i[1]||"",W=-1<r.stack.indexOf(`
2
+ at`)?" (<anonymous>)":-1<r.stack.indexOf("@")?"@unknown:0:0":""}return`
3
+ `+nn+e+W}var Ce=!1;function Oe(e,i){if(!e||Ce)return"";Ce=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var n={DetermineComponentFrameRoot:function(){try{if(i){var Y=function(){throw Error()};if(Object.defineProperty(Y.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Y,[])}catch(ae){var D=ae}Reflect.construct(e,[],Y)}else{try{Y.call()}catch(ae){D=ae}Y=!1;try{var N=Object.getOwnPropertyDescriptor(e.prototype,"props");Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),Y=!0,new e}finally{Y&&(N!==void 0?Object.defineProperty(e.prototype,"props",N):delete e.prototype.props)}}}else{try{throw Error()}catch(ae){D=ae}(Y=e())&&typeof Y.catch=="function"&&Y.catch(function(){})}}catch(ae){if(ae&&D&&typeof ae.stack=="string")return[ae.stack,D.stack]}return[null,null]}};n.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var o=Object.getOwnPropertyDescriptor(n.DetermineComponentFrameRoot,"name");o&&o.configurable&&Object.defineProperty(n.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var c=n.DetermineComponentFrameRoot(),_=c[0],p=c[1];if(_&&p){var y=_.split(`
4
+ `),R=p.split(`
5
+ `);for(o=n=0;n<y.length&&!y[n].includes("DetermineComponentFrameRoot");)n++;for(;o<R.length&&!R[o].includes("DetermineComponentFrameRoot");)o++;if(n===y.length||o===R.length)for(n=y.length-1,o=R.length-1;1<=n&&0<=o&&y[n]!==R[o];)o--;for(;1<=n&&0<=o;n--,o--)if(y[n]!==R[o]){if(n!==1||o!==1)do if(n--,o--,0>o||y[n]!==R[o]){var L=`
6
+ `+y[n].replace(" at new "," at ");return e.displayName&&L.includes("<anonymous>")&&(L=L.replace("<anonymous>",e.displayName)),L}while(1<=n&&0<=o);break}}}finally{Ce=!1,Error.prepareStackTrace=r}return(r=e?e.displayName||e.name:"")?be(r):""}function yt(e,i){switch(e.tag){case 26:case 27:case 5:return be(e.type);case 16:return be("Lazy");case 13:return e.child!==i&&i!==null?be("Suspense Fallback"):be("Suspense");case 19:return be("SuspenseList");case 0:case 15:return Oe(e.type,!1);case 11:return Oe(e.type.render,!1);case 1:return Oe(e.type,!0);case 31:return be("Activity");case 30:return be("ViewTransition");default:return""}}function lt(e){try{var i="",r=null;do i+=yt(e,r),r=e,e=e.return;while(e);return i}catch(n){return`
7
+ Error generating stack: `+n.message+`
8
+ `+n.stack}}var Pe=Object.prototype.hasOwnProperty,Je=t.unstable_scheduleCallback,Se=t.unstable_cancelCallback,ci=t.unstable_shouldYield,ln=t.unstable_requestPaint,Ft=t.unstable_now,ya=t.unstable_getCurrentPriorityLevel,ba=t.unstable_ImmediatePriority,wa=t.unstable_UserBlockingPriority,Ji=t.unstable_NormalPriority,rl=t.unstable_LowPriority,nl=t.unstable_IdlePriority,Er=t.log,ll=t.unstable_setDisableYieldValue,qs=null,ei=null;function es(e){if(typeof Er=="function"&&ll(e),ei&&typeof ei.setStrictMode=="function")try{ei.setStrictMode(qs,e)}catch{}}var ti=Math.clz32?Math.clz32:bc,Ca=Math.log,yc=Math.LN2;function bc(e){return e>>>=0,e===0?32:31-(Ca(e)/yc|0)|0}var xr=256,Ne=262144,rt=4194304;function ft(e){var i=e&42;if(i!==0)return i;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64: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 e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function dt(e,i,r){var n=e.pendingLanes;if(n===0)return 0;var o=0,c=e.suspendedLanes,_=e.pingedLanes;e=e.warmLanes;var p=n&134217727;return p!==0?(n=p&~c,n!==0?o=ft(n):(_&=p,_!==0?o=ft(_):r||(r=p&~e,r!==0&&(o=ft(r))))):(p=n&~c,p!==0?o=ft(p):_!==0?o=ft(_):r||(r=n&~e,r!==0&&(o=ft(r)))),o===0?0:i!==0&&i!==o&&(i&c)===0&&(c=o&-o,r=i&-i,c>=r||c===32&&(r&4194048)!==0)?i:o}function Ys(e,i){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&i)===0}function Vi(e,i){(i&8)!==0&&(i|=i&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=i;0<r;){var n=31-ti(r),o=1<<n;i|=e[n],r&=~o}return i}function Ks(e,i){switch(e){case 1:case 2:case 4:case 8:case 64:return i+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 i+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 Ea(){var e=rt;return rt<<=1,(rt&62914560)===0&&(rt=4194304),e}function ts(e){for(var i=[],r=0;31>r;r++)i.push(e);return i}function al(e,i){e.pendingLanes|=i,i!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function k0(e,i,r,n,o,c){var _=e.pendingLanes;e.pendingLanes=r,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=r,e.entangledLanes&=r,e.errorRecoveryDisabledLanes&=r,e.shellSuspendCounter=0;var p=e.entanglements,y=e.expirationTimes,R=e.hiddenUpdates;for(r=_&~r;0<r;){var L=31-ti(r),Y=1<<L;p[L]=0,y[L]=-1;var D=R[L];if(D!==null)for(R[L]=null,L=0;L<D.length;L++){var N=D[L];N!==null&&(N.lane&=-536870913)}r&=~Y}n!==0&&fd(e,n,0),c!==0&&o===0&&e.tag!==0&&(e.suspendedLanes|=c&~(_&~i))}function fd(e,i,r){e.pendingLanes|=i,e.suspendedLanes&=~i;var n=31-ti(i);e.entangledLanes|=i,e.entanglements[n]=e.entanglements[n]|1073741824|r&261930}function dd(e,i){var r=e.entangledLanes|=i;for(e=e.entanglements;r;){var n=31-ti(r),o=1<<n;o&i|e[n]&i&&(e[n]|=i),r&=~o}}function _d(e,i){var r=i&-i;return r=(r&42)!==0?1:wc(r),(r&(e.suspendedLanes|i))!==0?0:r}function wc(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Cc(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function gd(){var e=X.p;return e!==0?e:(e=window.event,e===void 0?32:wv(e.type))}function md(e,i){var r=X.p;try{return X.p=e,i()}finally{X.p=r}}var ys=Math.random().toString(36).slice(2),Yt="__reactFiber$"+ys,ui="__reactProps$"+ys,an="__reactContainer$"+ys,vd="__reactEvents$"+ys,N0="__reactListeners$"+ys,L0="__reactHandles$"+ys,pd="__reactResources$"+ys,ol="__reactMarker$"+ys,xa="__reactLoad$"+ys;function Ta(e){delete e[Yt],delete e[ui],delete e[N0],delete e[L0]}function Tr(e){var i;if(i=e[Yt])return i;for(var r=e.parentNode;r;){if(i=r[an]||r[Yt]){if(r=i.alternate,i.child!==null||r!==null&&r.child!==null)for(e=iv(e);e!==null;){if(r=e[Yt])return r;e=iv(e)}return i}e=r,r=e.parentNode}return null}function on(e){if(e=e[Yt]||e[an]){var i=e.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return e}return null}function cl(e){var i=e.tag;if(i===5||i===26||i===27||i===6)return e.stateNode;throw Error(a(33))}function cn(e){var i=e[pd];return i||(i=e[pd]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function At(e){e[ol]=!0}function Sd(e){e[xa]=void 0}var yd=new Set,bd={};function Dr(e,i){un(e,i),un(e+"Capture",i)}function un(e,i){for(bd[e]=i,e=0;e<i.length;e++)yd.add(i[e])}var z0=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]*$"),wd={},Cd={};function H0(e){return Pe.call(Cd,e)?!0:Pe.call(wd,e)?!1:z0.test(e)?Cd[e]=!0:(wd[e]=!0,!1)}var Ke=!1;function Ed(){var e=Ke;return Ke=!1,e}function Da(e,i,r){if(H0(i))if(r===null)e.removeAttribute(i);else{switch(typeof r){case"undefined":case"function":case"symbol":e.removeAttribute(i);return;case"boolean":var n=i.toLowerCase().slice(0,5);if(n!=="data-"&&n!=="aria-"){e.removeAttribute(i);return}}e.setAttribute(i,r)}}function Ma(e,i,r){if(r===null)e.removeAttribute(i);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(i);return}e.setAttribute(i,r)}}function bs(e,i,r,n){if(n===null)e.removeAttribute(r);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(r);return}e.setAttributeNS(i,r,n)}}function pi(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function xd(e){var i=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function U0(e,i,r){var n=Object.getOwnPropertyDescriptor(e.constructor.prototype,i);if(!e.hasOwnProperty(i)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var o=n.get,c=n.set;return Object.defineProperty(e,i,{configurable:!0,get:function(){return o.call(this)},set:function(_){r=""+_,c.call(this,_)}}),Object.defineProperty(e,i,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(_){r=""+_},stopTracking:function(){e._valueTracker=null,delete e[i]}}}}function Ec(e){if(!e._valueTracker){var i=xd(e)?"checked":"value";e._valueTracker=U0(e,i,""+e[i])}}function Td(e){if(!e)return!1;var i=e._valueTracker;if(!i)return!0;var r=i.getValue(),n="";return e&&(n=xd(e)?e.checked?"true":"false":e.value),e=n,e!==r?(i.setValue(e),!0):!1}var j0=/[\n"\\]/g;function Oi(e){return e.replace(j0,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function xc(e,i,r,n,o,c,_,p){e.name="",_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?e.type=_:e.removeAttribute("type"),i!=null?_==="number"?(i===0&&e.value===""||e.value!=i)&&(e.value=""+pi(i)):e.value!==""+pi(i)&&(e.value=""+pi(i)):_!=="submit"&&_!=="reset"||e.removeAttribute("value"),i!=null?_==="number"&&e.value==i?Tc(e,pi(e.value)):Tc(e,pi(i)):r!=null?Tc(e,pi(r)):n!=null&&e.removeAttribute("value"),o==null&&c!=null&&(e.defaultChecked=!!c),o!=null&&(e.checked=o&&typeof o!="function"&&typeof o!="symbol"),p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"?e.name=""+pi(p):e.removeAttribute("name")}function Dd(e,i,r,n,o,c,_,p){if(c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"&&(e.type=c),i!=null||r!=null){if(!(c!=="submit"&&c!=="reset"||i!=null)){Ec(e);return}r=r!=null?""+pi(r):"",i=i!=null?""+pi(i):r,p||i===e.value||(e.value=i),e.defaultValue=i}n=n??o,n=typeof n!="function"&&typeof n!="symbol"&&!!n,e.checked=p?e.checked:!!n,e.defaultChecked=!!n,_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"&&(e.name=_),Ec(e)}function Tc(e,i){e.defaultValue!==""+i&&(e.defaultValue=""+i)}function hn(e,i,r,n){if(e=e.options,i){i={};for(var o=0;o<r.length;o++)i["$"+r[o]]=!0;for(r=0;r<e.length;r++)o=i.hasOwnProperty("$"+e[r].value),e[r].selected!==o&&(e[r].selected=o),o&&n&&(e[r].defaultSelected=!0)}else{for(r=""+pi(r),i=null,o=0;o<e.length;o++){if(e[o].value===r){e[o].selected=!0,n&&(e[o].defaultSelected=!0);return}i!==null||e[o].disabled||(i=e[o])}i!==null&&(i.selected=!0)}}function Md(e,i,r){if(i!=null&&(i=""+pi(i),i!==e.value&&(e.value=i),r==null)){e.defaultValue!==i&&(e.defaultValue=i);return}e.defaultValue=r!=null?""+pi(r):""}function Rd(e,i,r,n){if(i==null){if(n!=null){if(r!=null)throw Error(a(92));if(Ee(n)){if(1<n.length)throw Error(a(93));n=n[0]}r=n}r==null&&(r=""),i=r}r=pi(i),e.defaultValue=r,n=e.textContent,n===r&&n!==""&&n!==null&&(e.value=n),Ec(e)}function fn(e,i){if(i){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=i;return}}e.textContent=i}var q0=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 Od(e,i,r){var n=i.indexOf("--")===0;r==null||typeof r=="boolean"||r===""?n?e.setProperty(i,""):i==="float"?e.cssFloat="":e[i]="":n?e.setProperty(i,r):typeof r!="number"||r===0||q0.has(i)?i==="float"?e.cssFloat=r:e[i]=(""+r).trim():e[i]=r+"px"}function Ad(e,i,r){if(i!=null&&typeof i!="object")throw Error(a(62));if(e=e.style,r!=null){for(var n in r)!r.hasOwnProperty(n)||i!=null&&i.hasOwnProperty(n)||(n.indexOf("--")===0?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="",Ke=!0);for(var o in i)n=i[o],i.hasOwnProperty(o)&&r[o]!==n&&(Od(e,o,n),Ke=!0)}else for(var c in i)i.hasOwnProperty(c)&&Od(e,c,i[c])}function Dc(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Y0=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"],["maskType","mask-type"],["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"]]),K0=/^[\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 Ra(e){return K0.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function is(){}var Mc=null;function Rc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var dn=null,_n=null;function Bd(e){var i=on(e);if(i&&(e=i.stateNode)){var r=e[ui]||null;e:switch(e=i.stateNode,i.type){case"input":if(xc(e,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name),i=r.name,r.type==="radio"&&i!=null){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll('input[name="'+Oi(""+i)+'"][type="radio"]'),i=0;i<r.length;i++){var n=r[i];if(n!==e&&n.form===e.form){var o=n[ui]||null;if(!o)throw Error(a(90));xc(n,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name)}}for(i=0;i<r.length;i++)n=r[i],n.form===e.form&&Td(n)}break e;case"textarea":Md(e,r.value,r.defaultValue);break e;case"select":i=r.value,i!=null&&hn(e,!!r.multiple,i,!1)}}}var Oc=!1;function kd(e,i,r){if(Oc)return e(i,r);Oc=!0;try{var n=e(i);return n}finally{if(Oc=!1,(dn!==null||_n!==null)&&(Oo(),dn&&(i=dn,e=_n,_n=dn=null,Bd(i),e)))for(i=0;i<e.length;i++)Bd(e[i])}}function ul(e,i){var r=e.stateNode;if(r===null)return null;var n=r[ui]||null;if(n===null)return null;r=n[i];e:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(n=!n.disabled)||(e=e.type,n=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!n;break e;default:e=!1}if(e)return null;if(r&&typeof r!="function")throw Error(a(231,i,typeof r));return r}var ws=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ac=!1;if(ws)try{var hl={};Object.defineProperty(hl,"passive",{get:function(){Ac=!0}}),window.addEventListener("test",hl,hl),window.removeEventListener("test",hl,hl)}catch{Ac=!1}var Ps=null,Bc=null,Oa=null;function Nd(){if(Oa)return Oa;var e,i=Bc,r=i.length,n,o="value"in Ps?Ps.value:Ps.textContent,c=o.length;for(e=0;e<r&&i[e]===o[e];e++);var _=r-e;for(n=1;n<=_&&i[r-n]===o[c-n];n++);return Oa=o.slice(e,1<n?1-n:void 0)}function Aa(e){var i=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&i===13&&(e=13)):e=i,e===10&&(e=13),32<=e||e===13?e:0}function Ba(){return!0}function Ld(){return!1}function ii(e){function i(r,n,o,c,_){this._reactName=r,this._targetInst=o,this.type=n,this.nativeEvent=c,this.target=_,this.currentTarget=null;for(var p in e)e.hasOwnProperty(p)&&(r=e[p],this[p]=r?r(c):c[p]);return this.isDefaultPrevented=(c.defaultPrevented!=null?c.defaultPrevented:c.returnValue===!1)?Ba:Ld,this.isPropagationStopped=Ld,this}return ce(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=Ba)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=Ba)},persist:function(){},isPersistent:Ba}),i}var Is={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ka=ii(Is),fl=ce({},Is,{view:0,detail:0}),P0=ii(fl),kc,Nc,dl,Na=ce({},fl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:zc,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==dl&&(dl&&e.type==="mousemove"?(kc=e.screenX-dl.screenX,Nc=e.screenY-dl.screenY):Nc=kc=0,dl=e),kc)},movementY:function(e){return"movementY"in e?e.movementY:Nc}}),zd=ii(Na),I0=ce({},Na,{dataTransfer:0}),V0=ii(I0),X0=ce({},fl,{relatedTarget:0}),Lc=ii(X0),G0=ce({},Is,{animationName:0,elapsedTime:0,pseudoElement:0}),W0=ii(G0),F0=ce({},Is,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Z0=ii(F0),Q0=ce({},Is,{data:0}),Hd=ii(Q0),$0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},J0={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"},eS={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function tS(e){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(e):(e=eS[e])?!!i[e]:!1}function zc(){return tS}var iS=ce({},fl,{key:function(e){if(e.key){var i=$0[e.key]||e.key;if(i!=="Unidentified")return i}return e.type==="keypress"?(e=Aa(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?J0[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:zc,charCode:function(e){return e.type==="keypress"?Aa(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Aa(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),sS=ii(iS),rS=ce({},Na,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ud=ii(rS),nS=ce({},Is,{submitter:0}),lS=ii(nS),aS=ce({},fl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:zc}),oS=ii(aS),cS=ce({},Is,{propertyName:0,elapsedTime:0,pseudoElement:0}),uS=ii(cS),hS=ce({},Na,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),fS=ii(hS),dS=ce({},Is,{newState:0,oldState:0,source:0}),_S=ii(dS),gS=[9,13,27,32],Hc=ws&&"CompositionEvent"in window,_l=null;ws&&"documentMode"in document&&(_l=document.documentMode);var mS=ws&&"TextEvent"in window&&!_l,jd=ws&&(!Hc||_l&&8<_l&&11>=_l),qd=" ",Yd=!1;function Kd(e,i){switch(e){case"keyup":return gS.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Pd(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var gn=!1;function vS(e,i){switch(e){case"compositionend":return Pd(i);case"keypress":return i.which!==32?null:(Yd=!0,qd);case"textInput":return e=i.data,e===qd&&Yd?null:e;default:return null}}function pS(e,i){if(gn)return e==="compositionend"||!Hc&&Kd(e,i)?(e=Nd(),Oa=Bc=Ps=null,gn=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return jd&&i.locale!=="ko"?null:i.data;default:return null}}var SS={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 Id(e){var i=e&&e.nodeName&&e.nodeName.toLowerCase();return i==="input"?!!SS[e.type]:i==="textarea"}function Vd(e,i,r,n){dn?_n?_n.push(n):_n=[n]:dn=n,i=zo(i,"onChange"),0<i.length&&(r=new ka("onChange","change",null,r,n),e.push({event:r,listeners:i}))}var gl=null,ml=null;function yS(e){Bm(e,0)}function La(e){var i=cl(e);if(Td(i))return e}function Xd(e,i){if(e==="change")return i}var Gd=!1;if(ws){var Uc;if(ws){var jc="oninput"in document;if(!jc){var Wd=document.createElement("div");Wd.setAttribute("oninput","return;"),jc=typeof Wd.oninput=="function"}Uc=jc}else Uc=!1;Gd=Uc&&(!document.documentMode||9<document.documentMode)}function Fd(){gl&&(gl.detachEvent("onpropertychange",Zd),ml=gl=null)}function Zd(e){if(e.propertyName==="value"&&La(ml)){var i=[];Vd(i,ml,e,Rc(e)),kd(yS,i)}}function bS(e,i,r){e==="focusin"?(Fd(),gl=i,ml=r,gl.attachEvent("onpropertychange",Zd)):e==="focusout"&&Fd()}function wS(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return La(ml)}function CS(e,i){if(e==="click")return La(i)}function ES(e,i){if(e==="input"||e==="change")return La(i)}function xS(e,i){return e===i&&(e!==0||1/e===1/i)||e!==e&&i!==i}var Si=typeof Object.is=="function"?Object.is:xS;function vl(e,i){if(Si(e,i))return!0;if(typeof e!="object"||e===null||typeof i!="object"||i===null)return!1;var r=Object.keys(e),n=Object.keys(i);if(r.length!==n.length)return!1;for(n=0;n<r.length;n++){var o=r[n];if(!Pe.call(i,o)||!Si(e[o],i[o]))return!1}return!0}function qc(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Qd(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function $d(e,i){var r=Qd(e);e=0;for(var n;r;){if(r.nodeType===3){if(n=e+r.textContent.length,e<=i&&n>=i)return{node:r,offset:i-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Qd(r)}}function Jd(e,i){return e&&i?e===i?!0:e&&e.nodeType===3?!1:i&&i.nodeType===3?Jd(e,i.parentNode):"contains"in e?e.contains(i):e.compareDocumentPosition?!!(e.compareDocumentPosition(i)&16):!1:!1}function e_(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var i=qc(e.document);i instanceof e.HTMLIFrameElement;){try{var r=typeof i.contentWindow.location.href=="string"}catch{r=!1}if(r)e=i.contentWindow;else break;i=qc(e.document)}return i}function Yc(e){var i=e&&e.nodeName&&e.nodeName.toLowerCase();return i&&(i==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||i==="textarea"||e.contentEditable==="true")}var TS=ws&&"documentMode"in document&&11>=document.documentMode,mn=null,Kc=null,pl=null,Pc=!1;function t_(e,i,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Pc||mn==null||mn!==qc(n)||(n=mn,"selectionStart"in n&&Yc(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),pl&&vl(pl,n)||(pl=n,n=zo(Kc,"onSelect"),0<n.length&&(i=new ka("onSelect","select",null,i,r),e.push({event:i,listeners:n}),i.target=mn)))}function Mr(e,i){var r={};return r[e.toLowerCase()]=i.toLowerCase(),r["Webkit"+e]="webkit"+i,r["Moz"+e]="moz"+i,r}var vn={animationend:Mr("Animation","AnimationEnd"),animationiteration:Mr("Animation","AnimationIteration"),animationstart:Mr("Animation","AnimationStart"),transitionrun:Mr("Transition","TransitionRun"),transitionstart:Mr("Transition","TransitionStart"),transitioncancel:Mr("Transition","TransitionCancel"),transitionend:Mr("Transition","TransitionEnd")},Ic={},i_={};ws&&(i_=document.createElement("div").style,"AnimationEvent"in window||(delete vn.animationend.animation,delete vn.animationiteration.animation,delete vn.animationstart.animation),"TransitionEvent"in window||delete vn.transitionend.transition);function Rr(e){if(Ic[e])return Ic[e];if(!vn[e])return e;var i=vn[e],r;for(r in i)if(i.hasOwnProperty(r)&&r in i_)return Ic[e]=i[r];return e}var s_=Rr("animationend"),r_=Rr("animationiteration"),n_=Rr("animationstart"),DS=Rr("transitionrun"),MS=Rr("transitionstart"),RS=Rr("transitioncancel"),l_=Rr("transitionend"),a_=new Map,Vc="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError 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(" ");Vc.push("scrollEnd");function Xi(e,i){a_.set(e,i),Dr(i,[e])}var OS=0;function Cs(e,i){if(e.name!=null&&e.name!=="auto")return e.name;if(i.autoName!==null)return i.autoName;e=Zi.identifierPrefix;var r=OS++;return e="_"+e+"t_"+r.toString(32)+"_",i.autoName=e}function o_(e){if(e==null||typeof e=="string")return e;var i=null,r=Hn;if(r!==null)for(var n=0;n<r.length;n++){var o=e[r[n]];if(o!=null){if(o==="none")return"none";i=i==null?o:i+(" "+o)}}return i??e.default}function Es(e,i){return e=o_(e),i=o_(i),i==null?e==="auto"?null:e:i==="auto"?null:i}var za=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Ai=[],pn=0,Xc=0;function Ha(){for(var e=pn,i=Xc=pn=0;i<e;){var r=Ai[i];Ai[i++]=null;var n=Ai[i];Ai[i++]=null;var o=Ai[i];Ai[i++]=null;var c=Ai[i];if(Ai[i++]=null,n!==null&&o!==null){var _=n.pending;_===null?o.next=o:(o.next=_.next,_.next=o),n.pending=o}c!==0&&c_(r,o,c)}}function Ua(e,i,r,n){Ai[pn++]=e,Ai[pn++]=i,Ai[pn++]=r,Ai[pn++]=n,Xc|=n,e.lanes|=n,e=e.alternate,e!==null&&(e.lanes|=n)}function Gc(e,i,r,n){return Ua(e,i,r,n),ja(e)}function Or(e,i){return Ua(e,null,null,i),ja(e)}function c_(e,i,r){e.lanes|=r;var n=e.alternate;n!==null&&(n.lanes|=r);for(var o=!1,c=e.return;c!==null;)c.childLanes|=r,n=c.alternate,n!==null&&(n.childLanes|=r),c.tag===22&&(e=c.stateNode,e===null||e._visibility&1||(o=!0)),e=c,c=c.return;return e.tag===3?(c=e.stateNode,o&&i!==null&&(o=31-ti(r),e=c.hiddenUpdates,n=e[o],n===null?e[o]=[i]:n.push(i),i.lane=r|536870912),c):null}function ja(e){if(50<ql)throw ql=0,Ro=null,Error(a(185));for(var i=e.return;i!==null;)e=i,i=e.return;return e.tag===3?e.stateNode:null}var Sn={};function AS(e,i,r,n){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function hi(e,i,r,n){return new AS(e,i,r,n)}function Wc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function xs(e,i){var r=e.alternate;return r===null?(r=hi(e.tag,i,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=i,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&1206910976,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,i=e.dependencies,r.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r.refCleanup=e.refCleanup,r}function u_(e,i){e.flags&=1206910978;var r=e.alternate;return r===null?(e.childLanes=0,e.lanes=i,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=r.childLanes,e.lanes=r.lanes,e.child=r.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=r.memoizedProps,e.memoizedState=r.memoizedState,e.updateQueue=r.updateQueue,e.type=r.type,i=r.dependencies,e.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),e}function qa(e,i,r,n,o,c){var _=0;if(n=e,typeof n=="function")Wc(n)&&(_=1);else if(typeof n=="string")_=n1(e,r,Jt.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(n){case B:return e=hi(31,r,i,o),e.elementType=B,e.lanes=c,e;case we:return Ar(r.children,o,c,i);case ee:_=8,o|=24;break;case K:return e=hi(12,r,i,o|2),e.elementType=K,e.lanes=c,e;case P:return e=hi(13,r,i,o),e.elementType=P,e.lanes=c,e;case E:return e=hi(19,r,i,o),e.elementType=E,e.lanes=c,e;case _e:case b:return e=o|32,e=hi(30,r,i,e),e.elementType=b,e.lanes=c,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case Z:_=10;break e;case re:_=9;break e;case z:_=11;break e;case I:_=14;break e;case ie:_=16,n=null;break e}_=29,r=Error(a(130,e===null?"null":typeof e,"")),n=null}return i=hi(_,r,i,o),i.elementType=e,i.type=n,i.lanes=c,i}function Ar(e,i,r,n){return e=hi(7,e,n,i),e.lanes=r,e}function Fc(e,i,r){return e=hi(6,e,null,i),e.lanes=r,e}function h_(e){var i=hi(18,null,null,0);return i.stateNode=e,i}function Zc(e,i,r){return i=hi(4,e.children!==null?e.children:[],e.key,i),i.lanes=r,i.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},i}var f_=new WeakMap;function Bi(e,i){if(typeof e=="object"&&e!==null){var r=f_.get(e);return r!==void 0?r:(i={value:e,source:i,stack:lt(i)},f_.set(e,i),i)}return{value:e,source:i,stack:lt(i)}}var yn=[],bn=0,Ya=null,Sl=0,ki=[],Ni=0,Vs=null,ss=1,rs="";function Ts(e,i){yn[bn++]=Sl,yn[bn++]=Ya,Ya=e,Sl=i}function d_(e,i,r){ki[Ni++]=ss,ki[Ni++]=rs,ki[Ni++]=Vs,Vs=e;var n=ss;e=rs;var o=32-ti(n)-1;n&=~(1<<o),r+=1;var c=32-ti(i)+o;if(30<c){var _=o-o%5;c=(n&(1<<_)-1).toString(32),n>>=_,o-=_,ss=1<<32-ti(i)+o|r<<o|n,rs=c+e}else ss=1<<c|r<<o|n,rs=e}function Ka(e){e.return!==null&&(Ts(e,1),d_(e,1,0))}function Qc(e){for(;e===Ya;)Ya=yn[--bn],yn[bn]=null,Sl=yn[--bn],yn[bn]=null;for(;e===Vs;)Vs=ki[--Ni],ki[Ni]=null,rs=ki[--Ni],ki[Ni]=null,ss=ki[--Ni],ki[Ni]=null}function __(e,i){ki[Ni++]=ss,ki[Ni++]=rs,ki[Ni++]=Vs,ss=i.id,rs=i.overflow,Vs=e}var Bt=null,it=null,Ae=!1,Xs=null,Li=!1,$c=Error(a(519));function Gs(e){var i=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw yl(Bi(i,e)),$c}function g_(e){var i=e.stateNode,r=e.type,n=e.memoizedProps;switch(i[Yt]=e,i[ui]=n,r){case"dialog":ze("cancel",i),ze("close",i);break;case"iframe":case"object":case"embed":ze("load",i);break;case"video":case"audio":for(r=0;r<Kl.length;r++)ze(Kl[r],i);break;case"source":ze("error",i);break;case"img":case"image":case"link":ze("error",i),ze("load",i);break;case"details":ze("toggle",i);break;case"input":ze("invalid",i),Dd(i,n.value,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name,!0);break;case"select":ze("invalid",i);break;case"textarea":ze("invalid",i),Rd(i,n.value,n.defaultValue,n.children)}r=n.children,typeof r!="string"&&typeof r!="number"&&typeof r!="bigint"||i.textContent===""+r||n.suppressHydrationWarning===!0||zm(i.textContent,r)?(n.popover!=null&&(ze("beforetoggle",i),ze("toggle",i)),n.onScroll!=null&&ze("scroll",i),n.onScrollEnd!=null&&ze("scrollend",i),n.onClick!=null&&(i.onclick=is),i=!0):i=!1,i||Gs(e,!0)}function Pa(e){for(Bt=e.return;Bt;)switch(Bt.tag){case 5:case 31:case 13:Li=!1;return;case 27:case 3:Li=!0;return;default:Bt=Bt.return}}function wn(e){if(e!==Bt)return!1;if(!Ae)return Pa(e),Ae=!0,!1;var i=e.tag,r;if((r=i!==3&&i!==27)&&((r=i===5)&&(r=e.type,r=!(r!=="form"&&r!=="button")||Mh(e.type,e.memoizedProps)),r=!r),r&&it&&Gs(e),Pa(e),i===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(317));it=tv(e)}else if(i===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(317));it=tv(e)}else i===27?(i=it,cr(e.type)?(e=Hh,Hh=null,it=e):it=i):it=Bt?Hi(e.stateNode.nextSibling):null;return!0}function Br(){it=Bt=null,Ae=!1}function Jc(){var e=Xs;return e!==null&&(_i===null?_i=e:_i.push.apply(_i,e),Xs=null),e}function yl(e){Xs===null?Xs=[e]:Xs.push(e)}var eu=vi(null),kr=null,Ds=null;function Ws(e,i,r){Ve(eu,i._currentValue),i._currentValue=r}function Ms(e){e._currentValue=eu.current,tt(eu)}function Ia(e,i,r){for(;e!==null;){var n=e.alternate;if((e.childLanes&i)!==i?(e.childLanes|=i,n!==null&&(n.childLanes|=i)):n!==null&&(n.childLanes&i)!==i&&(n.childLanes|=i),e===r)break;e=e.return}}function tu(e,i,r,n){var o=e.child;for(o!==null&&(o.return=e);o!==null;){var c=o.dependencies;if(c!==null){var _=o.child;c=c.firstContext;e:for(;c!==null;){var p=c;c=o;for(var y=0;y<i.length;y++)if(p.context===i[y]){c.lanes|=r,p=c.alternate,p!==null&&(p.lanes|=r),Ia(c.return,r,e),n||(_=null);break e}c=p.next}}else if(o.tag===18){if(_=o.return,_===null)throw Error(a(341));_.lanes|=r,c=_.alternate,c!==null&&(c.lanes|=r),Ia(_,r,e),_=null}else o.tag===13&&o.memoizedState!==null&&o.memoizedState.dehydrated===null?(o.lanes|=r,_=o.alternate,_!==null&&(_.lanes|=r),Ia(o.return,r,e),_=o.child,_=_!==null?_.sibling:null):_=o.child;if(_!==null)_.return=o;else for(_=o;_!==null;){if(_===e){_=null;break}if(o=_.sibling,o!==null){o.return=_.return,_=o;break}_=_.return}o=_}}function Nr(e,i,r,n){e=null;for(var o=i,c=!1;o!==null;){if(!c){if((o.flags&524288)!==0)c=!0;else if((o.flags&262144)!==0)break}if(o.tag===10){var _=o.alternate;if(_===null)throw Error(a(387));if(_=_.memoizedProps,_!==null){var p=o.type;Si(o.pendingProps.value,_.value)||(e!==null?e.push(p):e=[p])}}else if(o===sn.current){if(_=o.alternate,_===null)throw Error(a(387));_.memoizedState.memoizedState!==o.memoizedState.memoizedState&&(e!==null?e.push(Gn):e=[Gn])}o=o.return}return e!==null&&tu(i,e,r,n),i.flags|=262144,e!==null}function Va(e){for(e=e.firstContext;e!==null;){if(!Si(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Lr(e){kr=e,Ds=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Kt(e){return m_(kr,e)}function Xa(e,i){return kr===null&&Lr(e),m_(e,i)}function m_(e,i){var r=i._currentValue;if(i={context:i,memoizedValue:r,next:null},Ds===null){if(e===null)throw Error(a(308));Ds=i,e.dependencies={lanes:0,firstContext:i},e.flags|=524288}else Ds=Ds.next=i;return r}var BS=typeof AbortController<"u"?AbortController:function(){var e=[],i=this.signal={aborted:!1,addEventListener:function(r,n){e.push(n)}};this.abort=function(){i.aborted=!0,e.forEach(function(r){return r()})}},kS=t.unstable_scheduleCallback,NS=t.unstable_NormalPriority,bt={$$typeof:Z,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function iu(){return{controller:new BS,data:new Map,refCount:0}}function bl(e){e.refCount--,e.refCount===0&&kS(NS,function(){e.controller.abort()})}function v_(e,i){if((e.pendingLanes&4194048)!==0){var r=e.transitionTypes;for(r===null&&(r=e.transitionTypes=[]),e=0;e<i.length;e++){var n=i[e];r.indexOf(n)===-1&&r.push(n)}}}var wl=null;function LS(e){var i=e.transitionTypes;return e.transitionTypes=null,i}var Cl=null,su=0,zr=0,Cn=null;function zS(e,i){if(Cl===null){var r=Cl=[];su=0,zr=Sh(),Cn={status:"pending",value:void 0,then:function(n){r.push(n)}}}return su++,i.then(p_,p_),i}function p_(){if(--su===0&&(wl=null,Cl!==null)){Cn!==null&&(Cn.status="fulfilled");var e=Cl;Cl=null,zr=0,Cn=null;for(var i=0;i<e.length;i++)(0,e[i])()}}function HS(e,i){var r=[],n={status:"pending",value:null,reason:null,then:function(o){r.push(o)}};return e.then(function(){n.status="fulfilled",n.value=i;for(var o=0;o<r.length;o++)(0,r[o])(i)},function(o){for(n.status="rejected",n.reason=o,o=0;o<r.length;o++)(0,r[o])(void 0)}),n}var S_=le.S;le.S=function(e,i){if(hm=Ft(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&zS(e,i),wl!==null)for(var r=Yn;r!==null;)v_(r,wl),r=r.next;if(r=e.types,r!==null){for(var n=Yn;n!==null;)v_(n,r),n=n.next;if(zr!==0){n=wl,n===null&&(n=wl=[]);for(var o=0;o<r.length;o++){var c=r[o];n.indexOf(c)===-1&&n.push(c)}}}S_!==null&&S_(e,i)};var Hr=vi(null);function ru(){var e=Hr.current;return e!==null?e:et.pooledCache}function Ga(e,i){i===null?Ve(Hr,Hr.current):Ve(Hr,i.pool)}function y_(){var e=ru();return e===null?null:{parent:bt._currentValue,pool:e}}var En=Error(a(460)),nu=Error(a(474)),Wa=Error(a(542)),Fa={then:function(){}};function b_(e){return e=e.status,e==="fulfilled"||e==="rejected"}function w_(e,i,r){switch(r=e[r],r===void 0?e.push(i):r!==i&&(i.then(is,is),i=r),i.status){case"fulfilled":return i.value;case"rejected":throw e=i.reason,E_(e),e===void 0&&!("reason"in i)?Error(a(600)):e;default:if(typeof i.status=="string")i.then(is,is);else{if(e=et,e!==null&&100<e.shellSuspendCounter)throw Error(a(482));e=i,e.status="pending",e.then(function(n){if(i.status==="pending"){var o=i;o.status="fulfilled",o.value=n}},function(n){if(i.status==="pending"){var o=i;o.status="rejected",o.reason=n}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw e=i.reason,E_(e),e}throw jr=i,En}}function Ur(e){try{var i=e._init;return i(e._payload)}catch(r){throw r!==null&&typeof r=="object"&&typeof r.then=="function"?(jr=r,En):r}}var jr=null;function C_(){if(jr===null)throw Error(a(459));var e=jr;return jr=null,e}function E_(e){if(e===En||e===Wa)throw Error(a(483))}var xn=null,El=0;function Za(e){var i=El;return El+=1,xn===null&&(xn=[]),w_(xn,e,i)}function Fs(e,i){i=i.props.ref,e.ref=i!==void 0?i:null}function Qa(e,i){throw i.$$typeof===ge?Error(a(525)):(e=Object.prototype.toString.call(i),Error(a(31,e==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":e)))}function x_(e){function i(M,x){if(e){var A=M.deletions;A===null?(M.deletions=[x],M.flags|=16):A.push(x)}}function r(M,x){if(!e)return null;for(;x!==null;)i(M,x),x=x.sibling;return null}function n(M){for(var x=new Map;M!==null;)M.key===null?x.set(M.index,M):x.set(M.key,M),M=M.sibling;return x}function o(M,x){return M=xs(M,x),M.index=0,M.sibling=null,M}function c(M,x,A){return M.index=A,e?(A=M.alternate,A!==null?(A=A.index,A<x?(M.flags|=2,x):A):(M.flags|=134217730,x)):(M.flags|=1048576,x)}function _(M){return e&&M.alternate===null&&(M.flags|=134217730),M}function p(M,x,A,q){return x===null||x.tag!==6?(x=Fc(A,M.mode,q),x.return=M,x):(x=o(x,A),x.return=M,x)}function y(M,x,A,q){var fe=A.type;return fe===we?(M=L(M,x,A.props.children,q,A.key),Fs(M,A),M):x!==null&&(x.elementType===fe||typeof fe=="object"&&fe!==null&&fe.$$typeof===ie&&Ur(fe)===x.type)?(x=o(x,A.props),Fs(x,A),x.return=M,x):(x=qa(A.type,A.key,A.props,null,M.mode,q),Fs(x,A),x.return=M,x)}function R(M,x,A,q){return x===null||x.tag!==4||x.stateNode.containerInfo!==A.containerInfo||x.stateNode.implementation!==A.implementation?(x=Zc(A,M.mode,q),x.return=M,x):(x=o(x,A.children||[]),x.return=M,x)}function L(M,x,A,q,fe){return x===null||x.tag!==7?(x=Ar(A,M.mode,q,fe),x.return=M,x):(x=o(x,A),x.return=M,x)}function Y(M,x,A){if(typeof x=="string"&&x!==""||typeof x=="number"||typeof x=="bigint")return x=Fc(""+x,M.mode,A),x.return=M,x;if(typeof x=="object"&&x!==null){switch(x.$$typeof){case je:return A=qa(x.type,x.key,x.props,null,M.mode,A),Fs(A,x),A.return=M,A;case qe:return x=Zc(x,M.mode,A),x.return=M,x;case ie:return x=Ur(x),Y(M,x,A)}if(Ee(x)||Q(x))return x=Ar(x,M.mode,A,null),x.return=M,x;if(typeof x.then=="function")return Y(M,Za(x),A);if(x.$$typeof===Z)return Y(M,Xa(M,x),A);Qa(M,x)}return null}function D(M,x,A,q){var fe=x!==null?x.key:null;if(typeof A=="string"&&A!==""||typeof A=="number"||typeof A=="bigint")return fe!==null?null:p(M,x,""+A,q);if(typeof A=="object"&&A!==null){switch(A.$$typeof){case je:return A.key===fe?y(M,x,A,q):null;case qe:return A.key===fe?R(M,x,A,q):null;case ie:return A=Ur(A),D(M,x,A,q)}if(Ee(A)||Q(A))return fe!==null?null:L(M,x,A,q,null);if(typeof A.then=="function")return D(M,x,Za(A),q);if(A.$$typeof===Z)return D(M,x,Xa(M,A),q);Qa(M,A)}return null}function N(M,x,A,q,fe){if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return M=M.get(A)||null,p(x,M,""+q,fe);if(typeof q=="object"&&q!==null){switch(q.$$typeof){case je:return M=M.get(q.key===null?A:q.key)||null,y(x,M,q,fe);case qe:return M=M.get(q.key===null?A:q.key)||null,R(x,M,q,fe);case ie:return q=Ur(q),N(M,x,A,q,fe)}if(Ee(q)||Q(q))return M=M.get(A)||null,L(x,M,q,fe,null);if(typeof q.then=="function")return N(M,x,A,Za(q),fe);if(q.$$typeof===Z)return N(M,x,A,Xa(x,q),fe);Qa(x,q)}return null}function ae(M,x,A,q){for(var fe=null,Ue=null,pe=x,xe=x=0,Et=null;pe!==null&&xe<A.length;xe++){pe.index>xe?(Et=pe,pe=null):Et=pe.sibling;var Ye=D(M,pe,A[xe],q);if(Ye===null){pe===null&&(pe=Et);break}e&&pe&&Ye.alternate===null&&i(M,pe),x=c(Ye,x,xe),Ue===null?fe=Ye:Ue.sibling=Ye,Ue=Ye,pe=Et}if(xe===A.length)return r(M,pe),Ae&&Ts(M,xe),fe;if(pe===null){for(;xe<A.length;xe++)pe=Y(M,A[xe],q),pe!==null&&(x=c(pe,x,xe),Ue===null?fe=pe:Ue.sibling=pe,Ue=pe);return Ae&&Ts(M,xe),fe}for(pe=n(pe);xe<A.length;xe++)Et=N(pe,M,xe,A[xe],q),Et!==null&&(e&&(Ye=Et.alternate,Ye!==null&&pe.delete(Ye.key===null?xe:Ye.key)),x=c(Et,x,xe),Ue===null?fe=Et:Ue.sibling=Et,Ue=Et);return e&&pe.forEach(function(_r){return i(M,_r)}),Ae&&Ts(M,xe),fe}function de(M,x,A,q){if(A==null)throw Error(a(151));for(var fe=null,Ue=null,pe=x,xe=x=0,Et=null,Ye=A.next();pe!==null&&!Ye.done;xe++,Ye=A.next()){pe.index>xe?(Et=pe,pe=null):Et=pe.sibling;var _r=D(M,pe,Ye.value,q);if(_r===null){pe===null&&(pe=Et);break}e&&pe&&_r.alternate===null&&i(M,pe),x=c(_r,x,xe),Ue===null?fe=_r:Ue.sibling=_r,Ue=_r,pe=Et}if(Ye.done)return r(M,pe),Ae&&Ts(M,xe),fe;if(pe===null){for(;!Ye.done;xe++,Ye=A.next())Ye=Y(M,Ye.value,q),Ye!==null&&(x=c(Ye,x,xe),Ue===null?fe=Ye:Ue.sibling=Ye,Ue=Ye);return Ae&&Ts(M,xe),fe}for(pe=n(pe);!Ye.done;xe++,Ye=A.next())Ye=N(pe,M,xe,Ye.value,q),Ye!==null&&(e&&(Et=Ye.alternate,Et!==null&&pe.delete(Et.key===null?xe:Et.key)),x=c(Ye,x,xe),Ue===null?fe=Ye:Ue.sibling=Ye,Ue=Ye);return e&&pe.forEach(function(v1){return i(M,v1)}),Ae&&Ts(M,xe),fe}function Re(M,x,A,q){if(typeof A=="object"&&A!==null&&A.type===we&&A.key===null&&A.props.ref===void 0&&(A=A.props.children),typeof A=="object"&&A!==null){switch(A.$$typeof){case je:e:{for(var fe=A.key;x!==null;){if(x.key===fe){if(fe=A.type,fe===we){if(x.tag===7){r(M,x.sibling),q=o(x,A.props.children),Fs(q,A),q.return=M,M=q;break e}}else if(x.elementType===fe||typeof fe=="object"&&fe!==null&&fe.$$typeof===ie&&Ur(fe)===x.type){r(M,x.sibling),q=o(x,A.props),Fs(q,A),q.return=M,M=q;break e}r(M,x);break}else i(M,x);x=x.sibling}A.type===we?(q=Ar(A.props.children,M.mode,q,A.key),Fs(q,A),q.return=M,M=q):(q=qa(A.type,A.key,A.props,null,M.mode,q),Fs(q,A),q.return=M,M=q)}return _(M);case qe:e:{for(fe=A.key;x!==null;){if(x.key===fe)if(x.tag===4&&x.stateNode.containerInfo===A.containerInfo&&x.stateNode.implementation===A.implementation){r(M,x.sibling),q=o(x,A.children||[]),q.return=M,M=q;break e}else{r(M,x);break}else i(M,x);x=x.sibling}q=Zc(A,M.mode,q),q.return=M,M=q}return _(M);case ie:return A=Ur(A),Re(M,x,A,q)}if(Ee(A))return ae(M,x,A,q);if(Q(A)){if(fe=Q(A),typeof fe!="function")throw Error(a(150));return A=fe.call(A),de(M,x,A,q)}if(typeof A.then=="function")return Re(M,x,Za(A),q);if(A.$$typeof===Z)return Re(M,x,Xa(M,A),q);Qa(M,A)}return typeof A=="string"&&A!==""||typeof A=="number"||typeof A=="bigint"?(A=""+A,x!==null&&x.tag===6?(r(M,x.sibling),q=o(x,A),q.return=M,M=q):(r(M,x),q=Fc(A,M.mode,q),q.return=M,M=q),_(M)):r(M,x)}return function(M,x,A,q){try{El=0;var fe=Re(M,x,A,q);return xn=null,fe}catch(pe){if(pe===En||pe===Wa)throw pe;var Ue=hi(29,pe,null,M.mode);return Ue.lanes=q,Ue.return=M,Ue}}}var qr=x_(!0),T_=x_(!1),Zs=!1;function lu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function au(e,i){e=e.updateQueue,i.updateQueue===e&&(i.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Qs(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function $s(e,i,r){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,(Ie&2)!==0){var o=n.pending;return o===null?i.next=i:(i.next=o.next,o.next=i),n.pending=i,i=ja(e),c_(e,null,r),i}return Ua(e,n,i,r),ja(e)}function xl(e,i,r){if(i=i.updateQueue,i!==null&&(i=i.shared,(r&4194048)!==0)){var n=i.lanes;n&=e.pendingLanes,r|=n,i.lanes=r,dd(e,r)}}function ou(e,i){var r=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,r===n)){var o=null,c=null;if(r=r.firstBaseUpdate,r!==null){do{var _={lane:r.lane,tag:r.tag,payload:r.payload,callback:null,next:null};c===null?o=c=_:c=c.next=_,r=r.next}while(r!==null);c===null?o=c=i:c=c.next=i}else o=c=i;r={baseState:n.baseState,firstBaseUpdate:o,lastBaseUpdate:c,shared:n.shared,callbacks:n.callbacks},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=i:e.next=i,r.lastBaseUpdate=i}var cu=!1;function Tl(){if(cu){var e=Cn;if(e!==null)throw e}}function Dl(e,i,r,n){cu=!1;var o=e.updateQueue;Zs=!1;var c=o.firstBaseUpdate,_=o.lastBaseUpdate,p=o.shared.pending;if(p!==null){o.shared.pending=null;var y=p,R=y.next;y.next=null,_===null?c=R:_.next=R,_=y;var L=e.alternate;L!==null&&(L=L.updateQueue,p=L.lastBaseUpdate,p!==_&&(p===null?L.firstBaseUpdate=R:p.next=R,L.lastBaseUpdate=y))}if(c!==null){var Y=o.baseState;_=0,L=R=y=null,p=c;do{var D=p.lane&-536870913,N=D!==p.lane;if(N?(He&D)===D:(n&D)===D){D!==0&&D===zr&&(cu=!0),L!==null&&(L=L.next={lane:0,tag:p.tag,payload:p.payload,callback:null,next:null});e:{var ae=e,de=p;D=i;var Re=r;switch(de.tag){case 1:if(ae=de.payload,typeof ae=="function"){Y=ae.call(Re,Y,D);break e}Y=ae;break e;case 3:ae.flags=ae.flags&-65537|128;case 0:if(ae=de.payload,D=typeof ae=="function"?ae.call(Re,Y,D):ae,D==null)break e;Y=ce({},Y,D);break e;case 2:Zs=!0}}D=p.callback,D!==null&&(e.flags|=64,N&&(e.flags|=8192),N=o.callbacks,N===null?o.callbacks=[D]:N.push(D))}else N={lane:D,tag:p.tag,payload:p.payload,callback:p.callback,next:null},L===null?(R=L=N,y=Y):L=L.next=N,_|=D;if(p=p.next,p===null){if(p=o.shared.pending,p===null)break;N=p,p=N.next,N.next=null,o.lastBaseUpdate=N,o.shared.pending=null}}while(!0);L===null&&(y=Y),o.baseState=y,o.firstBaseUpdate=R,o.lastBaseUpdate=L,c===null&&(o.shared.lanes=0),nr|=_,e.lanes=_,e.memoizedState=Y}}function D_(e,i){if(typeof e!="function")throw Error(a(191,e));e.call(i)}function M_(e,i){var r=e.callbacks;if(r!==null)for(e.callbacks=null,e=0;e<r.length;e++)D_(r[e],i)}var Js=vi(null),$a=vi(0);function R_(e,i){e=ks,Ve($a,e),Ve(Js,i),ks=e|i.baseLanes}function uu(){Ve($a,ks),Ve(Js,Js.current)}function hu(){ks=$a.current,tt(Js),tt($a)}var Pt=vi(null),Zt=null;function er(e){var i=e.alternate;Ve(It,It.current&1),Ve(Pt,e),Zt===null&&(i===null||Js.current!==null||i.memoizedState!==null)&&(Zt=e)}function fu(e){Ve(It,It.current),Ve(Pt,e),Zt===null&&(Zt=e)}function O_(e){e.tag===22?(Ve(It,It.current),Ve(Pt,e),Zt===null&&(Zt=e)):tr()}function tr(){Ve(It,It.current),Ve(Pt,Pt.current)}function yi(e){tt(Pt),Zt===e&&(Zt=null),tt(It)}var It=vi(0);function Ml(e,i){Ve(Pt,Pt.current),Ve(It,i)}function du(e){tt(It),tt(Pt),Zt===e&&(Zt=null)}function Ja(e){for(var i=e;i!==null;){if(i.tag===13){var r=i.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||Lh(r)||zh(r)))return i}else if(i.tag===19&&i.memoizedProps.revealOrder!=="independent"){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===e)break;for(;i.sibling===null;){if(i.return===null||i.return===e)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var Rs=0,Me=null,Ze=null,wt=null,eo=!1,Tn=!1,Yr=!1,to=0,Rl=0,Dn=null,US=0;function _t(){throw Error(a(321))}function _u(e,i){if(i===null)return!1;for(var r=0;r<i.length&&r<e.length;r++)if(!Si(e[r],i[r]))return!1;return!0}function gu(e,i,r,n,o,c){return Rs=c,Me=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,le.H=e===null||e.memoizedState===null?dg:_g,Yr=!1,c=r(n,o),Yr=!1,Tn&&(c=B_(i,r,n,o)),A_(e),c}function A_(e){le.H=oo;var i=Ze!==null&&Ze.next!==null;if(Rs=0,wt=Ze=Me=null,eo=!1,Rl=0,Dn=null,i)throw Error(a(300));e===null||Ct||(e=e.dependencies,e!==null&&Va(e)&&(Ct=!0))}function B_(e,i,r,n){Me=e;var o=0;do{if(Tn&&(Dn=null),Rl=0,Tn=!1,25<=o)throw Error(a(301));if(o+=1,wt=Ze=null,e.updateQueue!=null){var c=e.updateQueue;c.lastEffect=null,c.events=null,c.stores=null,c.memoCache!=null&&(c.memoCache.index=0)}le.H=XS,c=i(r,n)}while(Tn);return c}function jS(){var e=le.H,i=e.useState()[0];return i=typeof i.then=="function"?Ol(i):i,e=e.useState()[0],(Ze!==null?Ze.memoizedState:null)!==e&&(Me.flags|=1024),i}function mu(){var e=to!==0;return to=0,e}function vu(e,i,r){i.updateQueue=e.updateQueue,i.flags&=-2053,e.lanes&=~r}function pu(e){if(eo){for(e=e.memoizedState;e!==null;){var i=e.queue;i!==null&&(i.pending=null),e=e.next}eo=!1}Rs=0,wt=Ze=Me=null,Tn=!1,Rl=to=0,Dn=null}function si(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return wt===null?Me.memoizedState=wt=e:wt=wt.next=e,wt}function pt(){if(Ze===null){var e=Me.alternate;e=e!==null?e.memoizedState:null}else e=Ze.next;var i=wt===null?Me.memoizedState:wt.next;if(i!==null)wt=i,Ze=e;else{if(e===null)throw Me.alternate===null?Error(a(467)):Error(a(310));Ze=e,e={memoizedState:Ze.memoizedState,baseState:Ze.baseState,baseQueue:Ze.baseQueue,queue:Ze.queue,next:null},wt===null?Me.memoizedState=wt=e:wt=wt.next=e}return wt}function io(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ol(e){var i=Rl;return Rl+=1,Dn===null&&(Dn=[]),e=w_(Dn,e,i),i=Me,(wt===null?i.memoizedState:wt.next)===null&&(i=i.alternate,le.H=i===null||i.memoizedState===null?dg:_g),e}function so(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Ol(e);if(e.$$typeof===H)return;if(e.$$typeof===Z)return Kt(e)}throw Error(a(438,String(e)))}function Su(e){var i=null,r=Me.updateQueue;if(r!==null&&(i=r.memoCache),i==null){var n=Me.alternate;n!==null&&(n=n.updateQueue,n!==null&&(n=n.memoCache,n!=null&&(i={data:n.data.map(function(o){return o.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),r===null&&(r=io(),Me.updateQueue=r),r.memoCache=i,r=i.data[i.index],r===void 0)for(r=i.data[i.index]=Array(e),n=0;n<e;n++)r[n]=se;return i.index++,r}function Os(e,i){return typeof i=="function"?i(e):i}function ro(e){var i=pt();return yu(i,Ze,e)}function yu(e,i,r){var n=e.queue;if(n===null)throw Error(a(311));n.lastRenderedReducer=r;var o=e.baseQueue,c=n.pending;if(c!==null){if(o!==null){var _=o.next;o.next=c.next,c.next=_}i.baseQueue=o=c,n.pending=null}if(c=e.baseState,o===null)e.memoizedState=c;else{i=o.next;var p=_=null,y=null,R=i,L=!1;do{var Y=R.lane&-536870913;if(Y!==R.lane?(He&Y)===Y:(Rs&Y)===Y){var D=R.revertLane;if(D===0)y!==null&&(y=y.next={lane:0,revertLane:0,gesture:null,action:R.action,hasEagerState:R.hasEagerState,eagerState:R.eagerState,next:null}),Y===zr&&(L=!0);else if((Rs&D)===D){R=R.next,D===zr&&(L=!0);continue}else Y={lane:0,revertLane:R.revertLane,gesture:null,action:R.action,hasEagerState:R.hasEagerState,eagerState:R.eagerState,next:null},y===null?(p=y=Y,_=c):y=y.next=Y,Me.lanes|=D,nr|=D;Y=R.action,Yr&&r(c,Y),c=R.hasEagerState?R.eagerState:r(c,Y)}else D={lane:Y,revertLane:R.revertLane,gesture:R.gesture,action:R.action,hasEagerState:R.hasEagerState,eagerState:R.eagerState,next:null},y===null?(p=y=D,_=c):y=y.next=D,Me.lanes|=Y,nr|=Y;R=R.next}while(R!==null&&R!==i);if(y===null?_=c:y.next=p,!Si(c,e.memoizedState)&&(Ct=!0,L&&(r=Cn,r!==null)))throw r;e.memoizedState=c,e.baseState=_,e.baseQueue=y,n.lastRenderedState=c}return o===null&&(n.lanes=0),[e.memoizedState,n.dispatch]}function bu(e){var i=pt(),r=i.queue;if(r===null)throw Error(a(311));r.lastRenderedReducer=e;var n=r.dispatch,o=r.pending,c=i.memoizedState;if(o!==null){r.pending=null;var _=o=o.next;do c=e(c,_.action),_=_.next;while(_!==o);Si(c,i.memoizedState)||(Ct=!0),i.memoizedState=c,i.baseQueue===null&&(i.baseState=c),r.lastRenderedState=c}return[c,n]}function k_(e,i,r){var n=Me,o=pt(),c=Ae;if(c){if(r===void 0)throw Error(a(407));r=r()}else r=i();var _=!Si((Ze||o).memoizedState,r);if(_&&(o.memoizedState=r,Ct=!0),o=o.queue,Eu(z_.bind(null,n,o,e),[e]),e=o.getSnapshot!==i||_||wt!==null&&(wt.memoizedState.tag&1)!==0,Mn(e?9:8,{destroy:void 0},L_.bind(null,n,o,r,i),null),e){if(n.flags|=2048,et===null)throw Error(a(349));c||(Rs&127)!==0||N_(n,i,r)}return r}function N_(e,i,r){e.flags|=16384,e={getSnapshot:i,value:r},i=Me.updateQueue,i===null?(i=io(),Me.updateQueue=i,i.stores=[e]):(r=i.stores,r===null?i.stores=[e]:r.push(e))}function L_(e,i,r,n){i.value=r,i.getSnapshot=n,H_(i)&&U_(e)}function z_(e,i,r){return r(function(){H_(i)&&U_(e)})}function H_(e){var i=e.getSnapshot;e=e.value;try{var r=i();return!Si(e,r)}catch{return!0}}function U_(e){var i=Or(e,2);i!==null&&gi(i,e,2)}function wu(e){var i=si();if(typeof e=="function"){var r=e;if(e=r(),Yr){es(!0);try{r()}finally{es(!1)}}}return i.memoizedState=i.baseState=e,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Os,lastRenderedState:e},i}function j_(e,i,r,n){return e.baseState=r,yu(e,Ze,typeof n=="function"?n:Os)}function qS(e,i,r,n,o){if(ao(e))throw Error(a(485));if(e=i.action,e!==null){var c={payload:o,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(_){c.listeners.push(_)}};le.T!==null?r(!0):c.isTransition=!1,n(c),r=i.pending,r===null?(c.next=i.pending=c,q_(i,c)):(c.next=r.next,i.pending=r.next=c)}}function q_(e,i){var r=i.action,n=i.payload,o=e.state;if(i.isTransition){var c=le.T,_={};_.types=c!==null?c.types:null,le.T=_;try{var p=r(o,n),y=le.S;y!==null&&y(_,p),Y_(e,i,p)}catch(R){Cu(e,i,R)}finally{c!==null&&_.types!==null&&(c.types=_.types),le.T=c}}else try{c=r(o,n),Y_(e,i,c)}catch(R){Cu(e,i,R)}}function Y_(e,i,r){r!==null&&typeof r=="object"&&typeof r.then=="function"?r.then(function(n){K_(e,i,n)},function(n){return Cu(e,i,n)}):K_(e,i,r)}function K_(e,i,r){i.status="fulfilled",i.value=r,P_(i),e.state=r,i=e.pending,i!==null&&(r=i.next,r===i?e.pending=null:(r=r.next,i.next=r,q_(e,r)))}function Cu(e,i,r){var n=e.pending;if(e.pending=null,n!==null){n=n.next;do i.status="rejected",i.reason=r,P_(i),i=i.next;while(i!==n)}e.action=null}function P_(e){e=e.listeners;for(var i=0;i<e.length;i++)(0,e[i])()}function I_(e,i){return i}function V_(e,i){if(Ae){var r=et.formState;if(r!==null){e:{var n=Me;if(Ae){if(it){t:{for(var o=it,c=Li;o.nodeType!==8;){if(!c){o=null;break t}if(o=Hi(o.nextSibling),o===null){o=null;break t}}c=o.data,o=c==="F!"||c==="F"?o:null}if(o){it=Hi(o.nextSibling),n=o.data==="F!";break e}}Gs(n)}n=!1}n&&(i=r[0])}}return r=si(),r.memoizedState=r.baseState=i,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:I_,lastRenderedState:i},r.queue=n,r=ug.bind(null,Me,n),n.dispatch=r,n=wu(!1),c=Ru.bind(null,Me,!1,n.queue),n=si(),o={state:i,dispatch:null,action:e,pending:null},n.queue=o,r=qS.bind(null,Me,o,c,r),o.dispatch=r,n.memoizedState=e,[i,r,!1]}function X_(e){var i=pt();return G_(i,Ze,e)}function G_(e,i,r){if(i=yu(e,i,I_)[0],e=ro(Os)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var n=Ol(i)}catch(_){throw _===En?Wa:_}else n=i;i=pt();var o=i.queue,c=o.dispatch;return r!==i.memoizedState&&(Me.flags|=2048,Mn(9,{destroy:void 0},YS.bind(null,o,r),null)),[n,c,e]}function YS(e,i){e.action=i}function W_(e){var i=pt(),r=Ze;if(r!==null)return G_(i,r,e);pt(),i=i.memoizedState,r=pt();var n=r.queue.dispatch;return r.memoizedState=e,[i,n,!1]}function Mn(e,i,r,n){return e={tag:e,create:r,deps:n,inst:i,next:null},i=Me.updateQueue,i===null&&(i=io(),Me.updateQueue=i),r=i.lastEffect,r===null?i.lastEffect=e.next=e:(n=r.next,r.next=e,e.next=n,i.lastEffect=e),e}function F_(){return pt().memoizedState}function no(e,i,r,n){var o=si();Me.flags|=e,o.memoizedState=Mn(1|i,{destroy:void 0},r,n===void 0?null:n)}function lo(e,i,r,n){var o=pt();n=n===void 0?null:n;var c=o.memoizedState.inst;Ze!==null&&n!==null&&_u(n,Ze.memoizedState.deps)?o.memoizedState=Mn(i,c,r,n):(Me.flags|=e,o.memoizedState=Mn(1|i,c,r,n))}function Z_(e,i){no(8390656,8,e,i)}function Eu(e,i){lo(2048,8,e,i)}function KS(e){Me.flags|=4;var i=Me.updateQueue;if(i===null)i=io(),Me.updateQueue=i,i.events=[e];else{var r=i.events;r===null?i.events=[e]:r.push(e)}}function Q_(e){var i=pt().memoizedState;return KS({ref:i,nextImpl:e}),function(){if((Ie&2)!==0)throw Error(a(440));return i.impl.apply(void 0,arguments)}}function $_(e,i){return lo(4,2,e,i)}function J_(e,i){return lo(4,4,e,i)}function eg(e,i){if(typeof i=="function"){e=e();var r=i(e);return function(){typeof r=="function"?r():i(null)}}if(i!=null)return e=e(),i.current=e,function(){i.current=null}}function tg(e,i,r){r=r!=null?r.concat([e]):null,lo(4,4,eg.bind(null,i,e),r)}function xu(){}function ig(e,i){var r=pt();i=i===void 0?null:i;var n=r.memoizedState;return i!==null&&_u(i,n[1])?n[0]:(r.memoizedState=[e,i],e)}function sg(e,i){var r=pt();i=i===void 0?null:i;var n=r.memoizedState;if(i!==null&&_u(i,n[1]))return n[0];if(n=e(),Yr){es(!0);try{e()}finally{es(!1)}}return r.memoizedState=[n,i],n}function Tu(e,i,r){return r===void 0||(Rs&1073741824)!==0&&(He&261930)===0?e.memoizedState=i:(e.memoizedState=r,e=dm(),Me.lanes|=e,nr|=e,r)}function rg(e,i,r,n){return Si(r,i)?r:Js.current!==null?(e=Tu(e,r,n),Si(e,i)||(Ct=!0),e):(Rs&106)===0||(Rs&1073741824)!==0&&(He&261930)===0?(Ct=!0,e.memoizedState=r):(e=dm(),Me.lanes|=e,nr|=e,i)}function ng(e,i,r,n,o){var c=X.p;X.p=c!==0&&8>c?c:8;var _=le.T,p={};p.types=_!==null?_.types:null,le.T=p,Ru(e,!1,i,r);try{var y=o(),R=le.S;if(R!==null&&R(p,y),y!==null&&typeof y=="object"&&typeof y.then=="function"){var L=HS(y,n);Al(e,i,L,Ei(e))}else Al(e,i,n,Ei(e))}catch(Y){Al(e,i,{then:function(){},status:"rejected",reason:Y},Ei())}finally{X.p=c,_!==null&&p.types!==null&&(_.types=p.types),le.T=_}}function PS(){}function Du(e,i,r,n){if(e.tag!==5)throw Error(a(476));var o=lg(e).queue;ng(e,o,i,J,r===null?PS:function(){return ag(e),r(n)})}function lg(e){var i=e.memoizedState;if(i!==null)return i;i={memoizedState:J,baseState:J,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Os,lastRenderedState:J},next:null};var r={};return i.next={memoizedState:r,baseState:r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Os,lastRenderedState:r},next:null},e.memoizedState=i,e=e.alternate,e!==null&&(e.memoizedState=i),i}function ag(e){var i=lg(e);i.next===null&&(i=e.alternate.memoizedState),Al(e,i.next.queue,{},Ei())}function Mu(){return Kt(Gn)}function og(){return pt().memoizedState}function cg(){return pt().memoizedState}function IS(e){for(var i=e.return;i!==null;){switch(i.tag){case 24:case 3:var r=Ei();e=Qs(r);var n=$s(i,e,r);n!==null&&(gi(n,i,r),xl(n,i,r)),i={cache:iu()},e.payload=i;return}i=i.return}}function VS(e,i,r){var n=Ei();r={lane:n,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},ao(e)?hg(i,r):(r=Gc(e,i,r,n),r!==null&&(gi(r,e,n),fg(r,i,n)))}function ug(e,i,r){var n=Ei();Al(e,i,r,n)}function Al(e,i,r,n){var o={lane:n,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(ao(e))hg(i,o);else{var c=e.alternate;if(e.lanes===0&&(c===null||c.lanes===0)&&(c=i.lastRenderedReducer,c!==null))try{var _=i.lastRenderedState,p=c(_,r);if(o.hasEagerState=!0,o.eagerState=p,Si(p,_))return Ua(e,i,o,0),et===null&&Ha(),!1}catch{}if(r=Gc(e,i,o,n),r!==null)return gi(r,e,n),fg(r,i,n),!0}return!1}function Ru(e,i,r,n){if(n={lane:2,revertLane:Sh(),gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},ao(e)){if(i)throw Error(a(479))}else i=Gc(e,r,n,2),i!==null&&gi(i,e,2)}function ao(e){var i=e.alternate;return e===Me||i!==null&&i===Me}function hg(e,i){Tn=eo=!0;var r=e.pending;r===null?i.next=i:(i.next=r.next,r.next=i),e.pending=i}function fg(e,i,r){if((r&4194048)!==0){var n=i.lanes;n&=e.pendingLanes,r|=n,i.lanes=r,dd(e,r)}}var oo={readContext:Kt,use:so,useCallback:_t,useContext:_t,useEffect:_t,useImperativeHandle:_t,useLayoutEffect:_t,useInsertionEffect:_t,useMemo:_t,useReducer:_t,useRef:_t,useState:_t,useDebugValue:_t,useDeferredValue:_t,useTransition:_t,useSyncExternalStore:_t,useId:_t,useHostTransitionStatus:_t,useFormState:_t,useActionState:_t,useOptimistic:_t,useMemoCache:_t,useCacheRefresh:_t,useEffectEvent:_t},dg={readContext:Kt,use:so,useCallback:function(e,i){return si().memoizedState=[e,i===void 0?null:i],e},useContext:Kt,useEffect:Z_,useImperativeHandle:function(e,i,r){r=r!=null?r.concat([e]):null,no(4194308,4,eg.bind(null,i,e),r)},useLayoutEffect:function(e,i){return no(4194308,4,e,i)},useInsertionEffect:function(e,i){no(4,2,e,i)},useMemo:function(e,i){var r=si();i=i===void 0?null:i;var n=e();if(Yr){es(!0);try{e()}finally{es(!1)}}return r.memoizedState=[n,i],n},useReducer:function(e,i,r){var n=si();if(r!==void 0){var o=r(i);if(Yr){es(!0);try{r(i)}finally{es(!1)}}}else o=i;return n.memoizedState=n.baseState=o,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:o},n.queue=e,e=e.dispatch=VS.bind(null,Me,e),[n.memoizedState,e]},useRef:function(e){var i=si();return e={current:e},i.memoizedState=e},useState:function(e){e=wu(e);var i=e.queue,r=ug.bind(null,Me,i);return i.dispatch=r,[e.memoizedState,r]},useDebugValue:xu,useDeferredValue:function(e,i){var r=si();return Tu(r,e,i)},useTransition:function(){var e=wu(!1);return e=ng.bind(null,Me,e.queue,!0,!1),si().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,i,r){var n=Me,o=si();if(Ae){if(r===void 0)throw Error(a(407));r=r()}else{if(r=i(),et===null)throw Error(a(349));(He&127)!==0||N_(n,i,r)}o.memoizedState=r;var c={value:r,getSnapshot:i};return o.queue=c,Z_(z_.bind(null,n,c,e),[e]),n.flags|=2048,Mn(9,{destroy:void 0},L_.bind(null,n,c,r,i),null),r},useId:function(){var e=si(),i=et.identifierPrefix;if(Ae){var r=rs,n=ss;r=(n&~(1<<32-ti(n)-1)).toString(32)+r,i="_"+i+"R_"+r,r=to++,0<r&&(i+="H"+r.toString(32)),i+="_"}else r=US++,i="_"+i+"r_"+r.toString(32)+"_";return e.memoizedState=i},useHostTransitionStatus:Mu,useFormState:V_,useActionState:V_,useOptimistic:function(e){var i=si();i.memoizedState=i.baseState=e;var r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=r,i=Ru.bind(null,Me,!0,r),r.dispatch=i,[e,i]},useMemoCache:Su,useCacheRefresh:function(){return si().memoizedState=IS.bind(null,Me)},useEffectEvent:function(e){var i=si(),r={impl:e};return i.memoizedState=r,function(){if((Ie&2)!==0)throw Error(a(440));return r.impl.apply(void 0,arguments)}}},_g={readContext:Kt,use:so,useCallback:ig,useContext:Kt,useEffect:Eu,useImperativeHandle:tg,useInsertionEffect:$_,useLayoutEffect:J_,useMemo:sg,useReducer:ro,useRef:F_,useState:function(){return ro(Os)},useDebugValue:xu,useDeferredValue:function(e,i){var r=pt();return rg(r,Ze.memoizedState,e,i)},useTransition:function(){var e=ro(Os)[0],i=pt().memoizedState;return[typeof e=="boolean"?e:Ol(e),i]},useSyncExternalStore:k_,useId:og,useHostTransitionStatus:Mu,useFormState:X_,useActionState:X_,useOptimistic:function(e,i){var r=pt();return j_(r,Ze,e,i)},useMemoCache:Su,useCacheRefresh:cg,useEffectEvent:Q_},XS={readContext:Kt,use:so,useCallback:ig,useContext:Kt,useEffect:Eu,useImperativeHandle:tg,useInsertionEffect:$_,useLayoutEffect:J_,useMemo:sg,useReducer:bu,useRef:F_,useState:function(){return bu(Os)},useDebugValue:xu,useDeferredValue:function(e,i){var r=pt();return Ze===null?Tu(r,e,i):rg(r,Ze.memoizedState,e,i)},useTransition:function(){var e=bu(Os)[0],i=pt().memoizedState;return[typeof e=="boolean"?e:Ol(e),i]},useSyncExternalStore:k_,useId:og,useHostTransitionStatus:Mu,useFormState:W_,useActionState:W_,useOptimistic:function(e,i){var r=pt();return Ze!==null?j_(r,Ze,e,i):(r.baseState=e,[e,r.queue.dispatch])},useMemoCache:Su,useCacheRefresh:cg,useEffectEvent:Q_};function Ou(e,i,r,n){i=e.memoizedState,r=r(n,i),r=r==null?i:ce({},i,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var Au={enqueueSetState:function(e,i,r){e=e._reactInternals;var n=Ei(),o=Qs(n);o.payload=i,r!=null&&(o.callback=r),i=$s(e,o,n),i!==null&&(gi(i,e,n),xl(i,e,n))},enqueueReplaceState:function(e,i,r){e=e._reactInternals;var n=Ei(),o=Qs(n);o.tag=1,o.payload=i,r!=null&&(o.callback=r),i=$s(e,o,n),i!==null&&(gi(i,e,n),xl(i,e,n))},enqueueForceUpdate:function(e,i){e=e._reactInternals;var r=Ei(),n=Qs(r);n.tag=2,i!=null&&(n.callback=i),i=$s(e,n,r),i!==null&&(gi(i,e,r),xl(i,e,r))}};function gg(e,i,r,n,o,c,_){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(n,c,_):i.prototype&&i.prototype.isPureReactComponent?!vl(r,n)||!vl(o,c):!0}function mg(e,i,r,n){e=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(r,n),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(r,n),i.state!==e&&Au.enqueueReplaceState(i,i.state,null)}function Kr(e,i){var r=i;if("ref"in i){r={};for(var n in i)n!=="ref"&&(r[n]=i[n])}if(e=e.defaultProps){r===i&&(r=ce({},r));for(var o in e)r[o]===void 0&&(r[o]=e[o])}return r}function vg(e){za(e)}function pg(e){console.error(e)}function Sg(e){za(e)}function co(e,i){try{var r=e.onUncaughtError;r(i.value,{componentStack:i.stack})}catch(n){setTimeout(function(){throw n})}}function yg(e,i,r){try{var n=e.onCaughtError;n(r.value,{componentStack:r.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(o){setTimeout(function(){throw o})}}function Bu(e,i,r){return r=Qs(r),r.tag=3,r.payload={element:null},r.callback=function(){co(e,i)},r}function bg(e){return e=Qs(e),e.tag=3,e}function wg(e,i,r,n){var o=r.type.getDerivedStateFromError;if(typeof o=="function"){var c=n.value;e.payload=function(){return o(c)},e.callback=function(){yg(i,r,n)}}var _=r.stateNode;_!==null&&typeof _.componentDidCatch=="function"&&(e.callback=function(){yg(i,r,n),typeof o!="function"&&(lr===null?lr=new Set([this]):lr.add(this));var p=n.stack;this.componentDidCatch(n.value,{componentStack:p!==null?p:""})})}function GS(e,i,r,n,o){if(r.flags|=32768,n!==null&&typeof n=="object"&&typeof n.then=="function"){if(i=r.alternate,i!==null&&Nr(i,r,o,!0),r=Pt.current,r!==null){switch(r.tag){case 31:case 13:case 19:return Zt===null?Ao():r.alternate===null&&gt===0&&(gt=3),r.flags&=-257,r.flags|=65536,r.lanes=o,n===Fa?r.flags|=16384:(i=r.updateQueue,i===null?r.updateQueue=new Set([n]):i.add(n),mh(e,n,o)),!1;case 22:return r.flags|=65536,n===Fa?r.flags|=16384:(i=r.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([n])},r.updateQueue=i):(r=i.retryQueue,r===null?i.retryQueue=new Set([n]):r.add(n)),mh(e,n,o)),!1}throw Error(a(435,r.tag))}return mh(e,n,o),Ao(),!1}if(Ae)return i=Pt.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=o,n!==$c&&(e=Error(a(422),{cause:n}),yl(Bi(e,r)))):(n!==$c&&(i=Error(a(423),{cause:n}),yl(Bi(i,r))),e=e.current.alternate,e.flags|=65536,o&=-o,e.lanes|=o,n=Bi(n,r),o=Bu(e.stateNode,n,o),ou(e,o),gt!==4&&(gt=2)),!1;var c=Error(a(520),{cause:n});if(c=Bi(c,r),jl===null?jl=[c]:jl.push(c),gt!==4&&(gt=2),i===null)return!0;n=Bi(n,r),r=i;do{switch(r.tag){case 3:return r.flags|=65536,e=o&-o,r.lanes|=e,e=Bu(r.stateNode,n,e),ou(r,e),!1;case 1:if(i=r.type,c=r.stateNode,(r.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||c!==null&&typeof c.componentDidCatch=="function"&&(lr===null||!lr.has(c))))return r.flags|=65536,o&=-o,r.lanes|=o,o=bg(o),wg(o,e,r,n),ou(r,o),!1;break;case 22:if(r.memoizedState!==null)return r.flags|=65536,!1}r=r.return}while(r!==null);return!1}var ku=Error(a(461)),Ct=!1;function Dt(e,i,r,n){i.child=e===null?T_(i,null,r,n):qr(i,e.child,r,n)}function Cg(e,i,r,n,o){r=r.render;var c=i.ref;if("ref"in n){var _={};for(var p in n)p!=="ref"&&(_[p]=n[p])}else _=n;return Lr(i),n=gu(e,i,r,_,c,o),p=mu(),e!==null&&!Ct?(vu(e,i,o),As(e,i,o)):(Ae&&p&&Ka(i),i.flags|=1,Dt(e,i,n,o),i.child)}function Eg(e,i,r,n,o){if(e===null){var c=r.type;return typeof c=="function"&&!Wc(c)&&c.defaultProps===void 0&&r.compare===null?(i.tag=15,i.type=c,xg(e,i,c,n,o)):(e=qa(r.type,null,n,i,i.mode,o),e.ref=i.ref,e.return=i,i.child=e)}if(c=e.child,!Yu(e,o)){var _=c.memoizedProps;if(r=r.compare,r=r!==null?r:vl,r(_,n)&&e.ref===i.ref)return As(e,i,o)}return i.flags|=1,e=xs(c,n),e.ref=i.ref,e.return=i,i.child=e}function xg(e,i,r,n,o){if(e!==null){var c=e.memoizedProps;if(vl(c,n)&&e.ref===i.ref)if(Ct=!1,i.pendingProps=n=c,Yu(e,o))(e.flags&131072)!==0&&(Ct=!0);else return i.lanes=e.lanes,As(e,i,o)}return Nu(e,i,r,n,o)}function Tg(e,i,r,n){var o=n.children,c=e!==null?e.memoizedState:null;if(e===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.mode==="hidden"){if((i.flags&128)!==0){if(c=c!==null?c.baseLanes|r:r,e!==null){for(n=i.child=e.child,o=0;n!==null;)o=o|n.lanes|n.childLanes,n=n.sibling;n=o&~c}else n=0,i.child=null;return Dg(e,i,c,r,n)}if((r&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ga(i,c!==null?c.cachePool:null),c!==null?R_(i,c):uu(),O_(i);else return n=i.lanes=536870912,Dg(e,i,c!==null?c.baseLanes|r:r,r,n)}else c!==null?(Ga(i,c.cachePool),R_(i,c),tr(),i.memoizedState=null):(e!==null&&Ga(i,null),uu(),tr());return Dt(e,i,o,r),i.child}function Bl(e,i){return e!==null&&e.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function Dg(e,i,r,n,o){var c=ru();return c=c===null?null:{parent:bt._currentValue,pool:c},i.memoizedState={baseLanes:r,cachePool:c},e!==null&&Ga(i,null),uu(),O_(i),e!==null&&Nr(e,i,n,!0),i.childLanes=o,null}function uo(e,i){return i=ho({mode:i.mode,children:i.children},e.mode),i.ref=e.ref,e.child=i,i.return=e,i}function Mg(e,i,r){return qr(i,e.child,null,r),e=uo(i,i.pendingProps),e.flags|=2,yi(i),i.memoizedState=null,e}function WS(e,i,r){var n=i.pendingProps,o=(i.flags&128)!==0;if(i.flags&=-129,e===null){if(Ae){if(n.mode==="hidden")return e=uo(i,n),i.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},Bl(null,e);if(fu(i),(e=it)?(e=ev(e,Li),e=e!==null&&e.data==="&"?e:null,e!==null&&(i.memoizedState={dehydrated:e,treeContext:Vs!==null?{id:ss,overflow:rs}:null,retryLane:536870912,hydrationErrors:null},r=h_(e),r.return=i,i.child=r,Bt=i,it=null)):e=null,e===null)throw Gs(i);return i.lanes=536870912,null}return uo(i,n)}var c=e.memoizedState;if(c!==null){var _=c.dehydrated;if(fu(i),o)if(i.flags&256)i.flags&=-257,i=Mg(e,i,r);else if(i.memoizedState!==null)i.child=e.child,i.flags|=128,i=null;else throw Error(a(558));else if(Ct||Nr(e,i,r,!1),o=(r&e.childLanes)!==0,Ct||o){if(Js.current===null){if(n=et,n!==null&&(_=_d(n,r),_!==0&&_!==c.retryLane))throw c.retryLane=_,Or(e,_),gi(n,e,_),ku;Ao()}i=Mg(e,i,r)}else e=c.treeContext,it=Hi(_.nextSibling),Bt=i,Ae=!0,Xs=null,Li=!1,e!==null&&__(i,e),i=uo(i,n),i.flags|=134221824;return i}return e=xs(e.child,{mode:n.mode,children:n.children}),e.ref=i.ref,i.child=e,e.return=i,e}function Rn(e,i){var r=i.ref;if(r===null)e!==null&&e.ref!==null&&(i.flags|=4194816);else{if(typeof r!="function"&&typeof r!="object")throw Error(a(284));(e===null||e.ref!==r)&&(i.flags|=4194816)}}function Nu(e,i,r,n,o){return Lr(i),r=gu(e,i,r,n,void 0,o),n=mu(),e!==null&&!Ct?(vu(e,i,o),As(e,i,o)):(Ae&&n&&Ka(i),i.flags|=1,Dt(e,i,r,o),i.child)}function Rg(e,i,r,n,o,c){return Lr(i),i.updateQueue=null,r=B_(i,n,r,o),A_(e),n=mu(),e!==null&&!Ct?(vu(e,i,c),As(e,i,c)):(Ae&&n&&Ka(i),i.flags|=1,Dt(e,i,r,c),i.child)}function Og(e,i,r,n,o){if(Lr(i),i.stateNode===null){var c=Sn,_=r.contextType;typeof _=="object"&&_!==null&&(c=Kt(_)),c=new r(n,c),i.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,c.updater=Au,i.stateNode=c,c._reactInternals=i,c=i.stateNode,c.props=n,c.state=i.memoizedState,c.refs={},lu(i),_=r.contextType,c.context=typeof _=="object"&&_!==null?Kt(_):Sn,c.state=i.memoizedState,_=r.getDerivedStateFromProps,typeof _=="function"&&(Ou(i,r,_,n),c.state=i.memoizedState),typeof r.getDerivedStateFromProps=="function"||typeof c.getSnapshotBeforeUpdate=="function"||typeof c.UNSAFE_componentWillMount!="function"&&typeof c.componentWillMount!="function"||(_=c.state,typeof c.componentWillMount=="function"&&c.componentWillMount(),typeof c.UNSAFE_componentWillMount=="function"&&c.UNSAFE_componentWillMount(),_!==c.state&&Au.enqueueReplaceState(c,c.state,null),Dl(i,n,c,o),Tl(),c.state=i.memoizedState),typeof c.componentDidMount=="function"&&(i.flags|=4194308),n=!0}else if(e===null){c=i.stateNode;var p=i.memoizedProps,y=Kr(r,p);c.props=y;var R=c.context,L=r.contextType;_=Sn,typeof L=="object"&&L!==null&&(_=Kt(L));var Y=r.getDerivedStateFromProps;L=typeof Y=="function"||typeof c.getSnapshotBeforeUpdate=="function",p=i.pendingProps!==p,L||typeof c.UNSAFE_componentWillReceiveProps!="function"&&typeof c.componentWillReceiveProps!="function"||(p||R!==_)&&mg(i,c,n,_),Zs=!1;var D=i.memoizedState;c.state=D,Dl(i,n,c,o),Tl(),R=i.memoizedState,p||D!==R||Zs?(typeof Y=="function"&&(Ou(i,r,Y,n),R=i.memoizedState),(y=Zs||gg(i,r,y,n,D,R,_))?(L||typeof c.UNSAFE_componentWillMount!="function"&&typeof c.componentWillMount!="function"||(typeof c.componentWillMount=="function"&&c.componentWillMount(),typeof c.UNSAFE_componentWillMount=="function"&&c.UNSAFE_componentWillMount()),typeof c.componentDidMount=="function"&&(i.flags|=4194308)):(typeof c.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=n,i.memoizedState=R),c.props=n,c.state=R,c.context=_,n=y):(typeof c.componentDidMount=="function"&&(i.flags|=4194308),n=!1)}else{c=i.stateNode,au(e,i),_=i.memoizedProps,L=Kr(r,_),c.props=L,Y=i.pendingProps,D=c.context,R=r.contextType,y=Sn,typeof R=="object"&&R!==null&&(y=Kt(R)),p=r.getDerivedStateFromProps,(R=typeof p=="function"||typeof c.getSnapshotBeforeUpdate=="function")||typeof c.UNSAFE_componentWillReceiveProps!="function"&&typeof c.componentWillReceiveProps!="function"||(_!==Y||D!==y)&&mg(i,c,n,y),Zs=!1,D=i.memoizedState,c.state=D,Dl(i,n,c,o),Tl();var N=i.memoizedState;_!==Y||D!==N||Zs||e!==null&&e.dependencies!==null&&Va(e.dependencies)?(typeof p=="function"&&(Ou(i,r,p,n),N=i.memoizedState),(L=Zs||gg(i,r,L,n,D,N,y)||e!==null&&e.dependencies!==null&&Va(e.dependencies))?(R||typeof c.UNSAFE_componentWillUpdate!="function"&&typeof c.componentWillUpdate!="function"||(typeof c.componentWillUpdate=="function"&&c.componentWillUpdate(n,N,y),typeof c.UNSAFE_componentWillUpdate=="function"&&c.UNSAFE_componentWillUpdate(n,N,y)),typeof c.componentDidUpdate=="function"&&(i.flags|=4),typeof c.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof c.componentDidUpdate!="function"||_===e.memoizedProps&&D===e.memoizedState||(i.flags|=4),typeof c.getSnapshotBeforeUpdate!="function"||_===e.memoizedProps&&D===e.memoizedState||(i.flags|=1024),i.memoizedProps=n,i.memoizedState=N),c.props=n,c.state=N,c.context=y,n=L):(typeof c.componentDidUpdate!="function"||_===e.memoizedProps&&D===e.memoizedState||(i.flags|=4),typeof c.getSnapshotBeforeUpdate!="function"||_===e.memoizedProps&&D===e.memoizedState||(i.flags|=1024),n=!1)}return c=n,Rn(e,i),n=(i.flags&128)!==0,c||n?(c=i.stateNode,r=n&&typeof r.getDerivedStateFromError!="function"?null:c.render(),i.flags|=1,e!==null&&n?(i.child=qr(i,e.child,null,o),i.child=qr(i,null,r,o)):Dt(e,i,r,o),i.memoizedState=c.state,e=i.child):e=As(e,i,o),e}function Ag(e,i,r,n){return Br(),i.flags|=256,Dt(e,i,r,n),i.child}var Lu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function zu(e){return{baseLanes:e,cachePool:y_()}}function Hu(e,i,r){return e=e!==null?e.childLanes&~r:0,i&&(e|=Ci),e}function Bg(e,i,r){var n=i.pendingProps,o=!1,c=(i.flags&128)!==0,_;if((_=c)||(_=e!==null&&e.memoizedState===null?!1:(It.current&2)!==0),_&&(o=!0,i.flags&=-129),_=(i.flags&32)!==0,i.flags&=-33,e===null){if(Ae){if(o?er(i):tr(),(e=it)?(e=ev(e,Li),e=e!==null&&e.data!=="&"?e:null,e!==null&&(i.memoizedState={dehydrated:e,treeContext:Vs!==null?{id:ss,overflow:rs}:null,retryLane:536870912,hydrationErrors:null},r=h_(e),r.return=i,i.child=r,Bt=i,it=null)):e=null,e===null)throw Gs(i);return zh(e)?i.lanes=32:i.lanes=536870912,null}return c=n.children,n=n.fallback,o?(tr(),o=i.mode,c=ho({mode:"hidden",children:c},o),n=Ar(n,o,r,null),c.return=i,n.return=i,c.sibling=n,i.child=c,n=i.child,n.memoizedState=zu(r),n.childLanes=Hu(e,_,r),i.memoizedState=Lu,Bl(null,n)):(er(i),Uu(i,c))}var p=e.memoizedState;if(p!==null){var y=p.dehydrated;if(y!==null)return FS(e,i,c,_,n,y,p,r)}return o?(tr(),o=n.fallback,c=i.mode,p=e.child,y=p.sibling,n=xs(p,{mode:"hidden",children:n.children}),n.subtreeFlags=p.subtreeFlags&1206910976,y!==null?o=xs(y,o):(o=Ar(o,c,r,null),o.flags|=2),o.return=i,n.return=i,n.sibling=o,i.child=n,Bl(null,n),n=i.child,o=e.child.memoizedState,o===null?o=zu(r):(c=o.cachePool,c!==null?(p=bt._currentValue,c=c.parent!==p?{parent:p,pool:p}:c):c=y_(),o={baseLanes:o.baseLanes|r,cachePool:c}),n.memoizedState=o,n.childLanes=Hu(e,_,r),i.memoizedState=Lu,Bl(e.child,n)):(er(i),r=e.child,e=r.sibling,r=xs(r,{mode:"visible",children:n.children}),r.return=i,r.sibling=null,e!==null&&(_=i.deletions,_===null?(i.deletions=[e],i.flags|=16):_.push(e)),i.child=r,i.memoizedState=null,r)}function Uu(e,i){return i=ho({mode:"visible",children:i},e.mode),i.return=e,e.child=i}function ho(e,i){return e=hi(22,e,null,i),e.lanes=0,e}function fo(e,i,r){return qr(i,e.child,null,r),e=Uu(i,i.pendingProps.children),e.flags|=2,i.memoizedState=null,e}function FS(e,i,r,n,o,c,_,p){if(r)return i.flags&256?(er(i),i.flags&=-257,fo(e,i,p)):i.memoizedState!==null?(tr(),i.child=e.child,i.flags|=128,null):(tr(),c=o.fallback,_=i.mode,o=ho({mode:"visible",children:o.children},_),c=Ar(c,_,p,null),c.flags|=2,o.return=i,c.return=i,o.sibling=c,i.child=o,qr(i,e.child,null,p),o=i.child,o.memoizedState=zu(p),o.childLanes=Hu(e,n,p),i.memoizedState=Lu,Bl(null,o));if(er(i),zh(c)){if(n=c.nextSibling&&c.nextSibling.dataset,n)var y=n.dgst;return n=y,n!==""&&(o=Error(a(419)),o.stack="",o.digest=n,yl({value:o,source:null,stack:null})),fo(e,i,p)}if(Ct||Nr(e,i,p,!1),n=(p&e.childLanes)!==0,Ct||n){if(Js.current!==null)return fo(e,i,p);if(n=et,n!==null&&(o=_d(n,p),o!==0&&o!==_.retryLane))throw _.retryLane=o,Or(e,o),gi(n,e,o),ku;return Lh(c)||Ao(),fo(e,i,p)}return Lh(c)?(i.flags|=192,i.child=e.child,null):(e=_.treeContext,it=Hi(c.nextSibling),Bt=i,Ae=!0,Xs=null,Li=!1,e!==null&&__(i,e),i=Uu(i,o.children),i.flags|=134221824,i)}function kg(e,i,r){e.lanes|=i;var n=e.alternate;n!==null&&(n.lanes|=i),Ia(e.return,i,r)}function Ng(e){for(var i=null;e!==null;){var r=e.alternate;r!==null&&Ja(r)===null&&(i=e),e=e.sibling}return i}function _o(e,i,r,n,o,c){var _=e.memoizedState;_===null?e.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:n,tail:r,tailMode:o,treeForkCount:c}:(_.isBackwards=i,_.rendering=null,_.renderingStartTime=0,_.last=n,_.tail=r,_.tailMode=o,_.treeForkCount=c)}function ju(e){var i=e.child;for(e.child=null;i!==null;){var r=i.sibling;i.sibling=e.child,e.child=i,i=r}}function qu(e,i,r){var n=i.pendingProps,o=n.revealOrder,c=n.tail;n=n.children;var _=It.current;if(i.flags&128)return Ml(i,_),null;var p=(_&2)!==0;if(p?(_=_&1|2,i.flags|=128):_&=1,Ml(i,_),o==="backwards"&&e!==null?(ju(e),Dt(e,i,n,r),ju(e)):Dt(e,i,n,r),n=Ae?Sl:0,!p&&e!==null&&(e.flags&128)!==0)e:for(e=i.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&kg(e,r,i);else if(e.tag===19)kg(e,r,i);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===i)break e;for(;e.sibling===null;){if(e.return===null||e.return===i)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(o){case"backwards":r=Ng(i.child),r===null?(o=i.child,i.child=null):(o=r.sibling,r.sibling=null,ju(i)),_o(i,!0,o,null,c,n);break;case"unstable_legacy-backwards":for(r=null,o=i.child,i.child=null;o!==null;){if(e=o.alternate,e!==null&&Ja(e)===null){i.child=o;break}e=o.sibling,o.sibling=r,r=o,o=e}_o(i,!0,r,null,c,n);break;case"together":_o(i,!1,null,null,void 0,n);break;case"independent":i.memoizedState=null;break;default:r=Ng(i.child),r===null?(o=i.child,i.child=null):(o=r.sibling,r.sibling=null),_o(i,!1,o,r,c,n)}return i.child}function Lg(e,i,r){var n=i.pendingProps;return Ws(i,i.type,n.value),Dt(e,i,n.children,r),i.child}function As(e,i,r){if(e!==null&&(i.dependencies=e.dependencies),nr|=i.lanes,(r&i.childLanes)===0)if(e!==null){if(Nr(e,i,r,!1),(r&i.childLanes)===0)return null}else return null;if(e!==null&&i.child!==e.child)throw Error(a(153));if(i.child!==null){for(e=i.child,r=xs(e,e.pendingProps),i.child=r,r.return=i;e.sibling!==null;)e=e.sibling,r=r.sibling=xs(e,e.pendingProps),r.return=i;r.sibling=null}return i.child}function Yu(e,i){return(e.lanes&i)!==0?!0:(e=e.dependencies,!!(e!==null&&Va(e)))}function ZS(e,i,r){switch(i.tag){case 3:Ss(i,i.stateNode.containerInfo),Ws(i,bt,e.memoizedState.cache),Br();break;case 27:case 5:rn(i);break;case 4:Ss(i,i.stateNode.containerInfo);break;case 10:Ws(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,fu(i),null;break;case 13:var n=i.memoizedState;if(n!==null){if(n.dehydrated!==null)return er(i),i.flags|=128,null;n=Nr(e,i,r,!1);var o=i.child.childLanes;return n||(r&o)!==0?Bg(e,i,r):(er(i),e=As(e,i,r),e!==null?e.sibling:null)}er(i);break;case 19:if(i.flags&128)return qu(e,i,r);if(o=(e.flags&128)!==0,n=(r&i.childLanes)!==0,n||(Nr(e,i,r,!1),n=(r&i.childLanes)!==0),o){if(n)return qu(e,i,r);i.flags|=128}if(o=i.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),Ml(i,It.current),n)break;return null;case 22:return i.lanes=0,Tg(e,i,r,i.pendingProps);case 24:Ws(i,bt,e.memoizedState.cache)}return As(e,i,r)}function zg(e,i,r){if(e!==null)if(e.memoizedProps!==i.pendingProps)Ct=!0;else{if(!Yu(e,r)&&(i.flags&128)===0)return Ct=!1,ZS(e,i,r);Ct=(e.flags&131072)!==0}else Ct=!1,Ae&&(i.flags&1048576)!==0&&d_(i,Sl,i.index);switch(i.lanes=0,i.tag){case 16:e:{var n=i.pendingProps;if(e=Ur(i.elementType),i.type=e,typeof e=="function")Wc(e)?(n=Kr(e,n),i.tag=1,i=Og(null,i,e,n,r)):(i.tag=0,i=Nu(null,i,e,n,r));else{if(e!=null){var o=e.$$typeof;if(o===z){i.tag=11,i=Cg(null,i,e,n,r);break e}else if(o===I){i.tag=14,i=Eg(null,i,e,n,r);break e}else if(o===Z){i.tag=10,i.type=e,i=Lg(null,i,r);break e}}throw i=me(e)||e,Error(a(306,i,""))}}return i;case 0:return Nu(e,i,i.type,i.pendingProps,r);case 1:return n=i.type,o=Kr(n,i.pendingProps),Og(e,i,n,o,r);case 3:e:{if(Ss(i,i.stateNode.containerInfo),e===null)throw Error(a(387));n=i.pendingProps;var c=i.memoizedState;o=c.element,au(e,i),Dl(i,n,null,r);var _=i.memoizedState;if(n=_.cache,Ws(i,bt,n),n!==c.cache&&tu(i,[bt],r,!0),Tl(),n=_.element,c.isDehydrated)if(c={element:n,isDehydrated:!1,cache:_.cache},i.updateQueue.baseState=c,i.memoizedState=c,i.flags&256){i=Ag(e,i,n,r);break e}else if(n!==o){o=Bi(Error(a(424)),i),yl(o),i=Ag(e,i,n,r);break e}else for(e=i.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,it=Hi(e.firstChild),Bt=i,Ae=!0,Xs=null,Li=!0,r=T_(i,null,n,r),i.child=r;r;)r.flags=r.flags&-3|134221824,r=r.sibling;else{if(Br(),n===o){i=As(e,i,r);break e}Dt(e,i,n,r)}i=i.child}return i;case 26:return Rn(e,i),e===null?(r=av(i.type,null,i.pendingProps,null))?i.memoizedState=r:Ae||(i.stateNode=qm(i.type,i.pendingProps,Pi.current,i)):i.memoizedState=av(i.type,e.memoizedProps,i.pendingProps,e.memoizedState),null;case 27:return rn(i),e===null&&Ae&&(n=i.stateNode=sv(i.type,i.pendingProps,Pi.current),Bt=i,Li=!0,o=it,cr(i.type)?(Hh=o,it=Hi(n.firstChild)):it=o),Dt(e,i,i.pendingProps.children,r),Rn(e,i),e===null&&(i.flags|=4194304),i.child;case 5:return e===null&&Ae&&((o=n=it)&&(n=Iy(n,i.type,i.pendingProps,Li),n!==null?(i.stateNode=n,Bt=i,it=Hi(n.firstChild),Li=!1,o=!0):o=!1),o||Gs(i)),rn(i),o=i.type,c=i.pendingProps,_=e!==null?e.memoizedProps:null,n=c.children,Mh(o,c)?n=null:_!==null&&Mh(o,_)&&(i.flags|=32),i.memoizedState!==null&&(o=gu(e,i,jS,null,null,r),Gn._currentValue=o),Rn(e,i),Dt(e,i,n,r),i.child;case 6:return e===null&&Ae&&((e=r=it)&&(r=Vy(r,i.pendingProps,Li),r!==null?(i.stateNode=r,Bt=i,it=null,e=!0):e=!1),e||Gs(i)),null;case 13:return Bg(e,i,r);case 4:return Ss(i,i.stateNode.containerInfo),n=i.pendingProps,e===null?i.child=qr(i,null,n,r):Dt(e,i,n,r),i.child;case 11:return Cg(e,i,i.type,i.pendingProps,r);case 7:return n=i.pendingProps,Rn(e,i),Dt(e,i,n,r),i.child;case 8:return Dt(e,i,i.pendingProps.children,r),i.child;case 12:return Dt(e,i,i.pendingProps.children,r),i.child;case 10:return Lg(e,i,r);case 9:return o=i.type._context,n=i.pendingProps.children,Lr(i),o=Kt(o),n=n(o),i.flags|=1,Dt(e,i,n,r),i.child;case 14:return Eg(e,i,i.type,i.pendingProps,r);case 15:return xg(e,i,i.type,i.pendingProps,r);case 19:return qu(e,i,r);case 31:return WS(e,i,r);case 22:return Tg(e,i,r,i.pendingProps);case 24:return Lr(i),n=Kt(bt),e===null?(o=ru(),o===null&&(o=et,c=iu(),o.pooledCache=c,c.refCount++,c!==null&&(o.pooledCacheLanes|=r),o=c),i.memoizedState={parent:n,cache:o},lu(i),Ws(i,bt,o)):((e.lanes&r)!==0&&(au(e,i),Dl(i,null,null,r),Tl()),o=e.memoizedState,c=i.memoizedState,o.parent!==n?(o={parent:n,cache:n},i.memoizedState=o,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=o),Ws(i,bt,n)):(n=c.cache,Ws(i,bt,n),n!==o.cache&&tu(i,[bt],r,!0))),Dt(e,i,i.pendingProps.children,r),i.child;case 30:return i.stateNode===null&&(i.stateNode={autoName:null,paired:null,clones:null,ref:null}),n=i.pendingProps,n.name!=null&&n.name!=="auto"?i.flags|=e===null?18882560:18874368:Ae&&Ka(i),e!==null&&e.memoizedProps.name!==n.name?i.flags|=4194816:Rn(e,i),Dt(e,i,n.children,r),i.child;case 29:throw i.pendingProps}throw Error(a(156,i.tag))}function Bs(e){e.flags|=4}function Ku(e,i,r,n,o){var c;if((c=(e.mode&32)!==0)&&(c=r===null?hv(i,n):hv(i,n)&&(n.src!==r.src||n.srcSet!==r.srcSet)),c){if(e.flags|=16777216,(o&335544128)===o)if(e.stateNode.complete)e.flags|=8192;else if(vm())e.flags|=8192;else throw jr=Fa,nu}else e.flags&=-16777217}function Hg(e,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!fv(i))if(vm())e.flags|=8192;else throw jr=Fa,nu}function go(e,i){i!==null&&(e.flags|=4),e.flags&16384&&(i=e.tag!==22?Ea():536870912,e.lanes|=i,Nn|=i)}function kl(e,i){if(!Ae)switch(e.tailMode){case"visible":break;case"collapsed":for(var r=e.tail,n=null;r!==null;)r.alternate!==null&&(n=r),r=r.sibling;n===null?i||e.tail===null?e.tail=null:e.tail.sibling=null:n.sibling=null;break;default:for(i=e.tail,r=null;i!==null;)i.alternate!==null&&(r=i),i=i.sibling;r===null?e.tail=null:r.sibling=null}}function st(e){var i=e.alternate!==null&&e.alternate.child===e.child,r=0,n=0;if(i)for(var o=e.child;o!==null;)r|=o.lanes|o.childLanes,n|=o.subtreeFlags&1206910976,n|=o.flags&1206910976,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)r|=o.lanes|o.childLanes,n|=o.subtreeFlags,n|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=n,e.childLanes=r,i}function QS(e,i,r){var n=i.pendingProps;switch(Qc(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return st(i),null;case 1:return st(i),null;case 3:return r=i.stateNode,n=null,e!==null&&(n=e.memoizedState.cache),i.memoizedState.cache!==n&&(i.flags|=2048),Ms(bt),Ii(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(wn(i)?Bs(i):e===null||e.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,Jc())),st(i),null;case 26:var o=i.type,c=i.memoizedState;return e===null?(Bs(i),c!==null?(st(i),Hg(i,c)):(st(i),Ku(i,o,null,n,r))):c?c!==e.memoizedState?(Bs(i),st(i),Hg(i,c)):(st(i),i.flags&=-16777217):(e=e.memoizedProps,e!==n&&Bs(i),st(i),Ku(i,o,e,n,r)),null;case 27:if(Cr(i),r=Pi.current,o=i.type,e!==null&&i.stateNode!=null)e.memoizedProps!==n&&Bs(i);else{if(!n){if(i.stateNode===null)throw Error(a(166));return st(i),i.subtreeFlags&=-33554433,null}e=Jt.current,wn(i)?g_(i):(e=sv(o,n,r),i.stateNode=e,Bs(i))}return st(i),i.subtreeFlags&=-33554433,null;case 5:if(Cr(i),o=i.type,e!==null&&i.stateNode!=null)e.memoizedProps!==n&&Bs(i);else{if(!n){if(i.stateNode===null)throw Error(a(166));return st(i),i.subtreeFlags&=-33554433,null}if(c=Jt.current,wn(i))g_(i);else{var _=Il(Pi.current);switch(c){case 1:c=_.createElementNS("http://www.w3.org/2000/svg",o);break;case 2:c=_.createElementNS("http://www.w3.org/1998/Math/MathML",o);break;default:switch(o){case"svg":c=_.createElementNS("http://www.w3.org/2000/svg",o);break;case"math":c=_.createElementNS("http://www.w3.org/1998/Math/MathML",o);break;case"script":c=_.createElement("div"),c.innerHTML="<script><\/script>",c=c.removeChild(c.firstChild);break;case"select":c=typeof n.is=="string"?_.createElement("select",{is:n.is}):_.createElement("select"),n.multiple?c.multiple=!0:n.size&&(c.size=n.size);break;default:c=typeof n.is=="string"?_.createElement(o,{is:n.is}):_.createElement(o)}}c[Yt]=i,c[ui]=n;e:for(_=i.child;_!==null;){if(_.tag===5||_.tag===6)c.appendChild(_.stateNode);else if(_.tag!==4&&_.tag!==27&&_.child!==null){_.child.return=_,_=_.child;continue}if(_===i)break e;for(;_.sibling===null;){if(_.return===null||_.return===i)break e;_=_.return}_.sibling.return=_.return,_=_.sibling}i.stateNode=c;e:switch(Xt(c,o,n),o){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}n&&Bs(i)}}return st(i),i.subtreeFlags&=-33554433,Ku(i,i.type,e===null?null:e.memoizedProps,i.pendingProps,r),null;case 6:if(e&&i.stateNode!=null)e.memoizedProps!==n&&Bs(i);else{if(typeof n!="string"&&i.stateNode===null)throw Error(a(166));if(e=Pi.current,wn(i)){if(e=i.stateNode,r=i.memoizedProps,n=null,o=Bt,o!==null)switch(o.tag){case 27:case 5:n=o.memoizedProps}e[Yt]=i,e=!!(e.nodeValue===r||n!==null&&n.suppressHydrationWarning===!0||zm(e.nodeValue,r)),e||Gs(i,!0)}else e=Il(e).createTextNode(n),e[Yt]=i,i.stateNode=e}return st(i),null;case 31:if(r=i.memoizedState,e===null||e.memoizedState!==null){if(n=wn(i),r!==null){if(e===null){if(!n)throw Error(a(318));if(e=i.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(557));e[Yt]=i}else Br(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;st(i),e=!1}else r=Jc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),e=!0;if(!e)return i.flags&256?(yi(i),i):(yi(i),null);if((i.flags&128)!==0)throw Error(a(558))}return st(i),null;case 13:if(n=i.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(o=wn(i),n!==null&&n.dehydrated!==null){if(e===null){if(!o)throw Error(a(318));if(o=i.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(a(317));o[Yt]=i}else Br(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;st(i),o=!1}else o=Jc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=o),o=!0;if(!o)return i.flags&256?(yi(i),i):(yi(i),null)}return yi(i),(i.flags&128)!==0?(i.lanes=r,i):(r=n!==null,e=e!==null&&e.memoizedState!==null,r&&(n=i.child,o=null,n.alternate!==null&&n.alternate.memoizedState!==null&&n.alternate.memoizedState.cachePool!==null&&(o=n.alternate.memoizedState.cachePool.pool),c=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(c=n.memoizedState.cachePool.pool),c!==o&&(n.flags|=2048)),r!==e&&r&&(i.child.flags|=8192),go(i,i.updateQueue),st(i),null);case 4:return Ii(),e===null&&Ch(i.stateNode.containerInfo),i.flags|=67108864,st(i),null;case 10:return Ms(i.type),st(i),null;case 19:if(du(i),n=i.memoizedState,n===null)return st(i),null;if(o=(i.flags&128)!==0,c=n.rendering,c===null)if(o)kl(n,!1);else{if(gt!==0||e!==null&&(e.flags&128)!==0)for(e=i.child;e!==null;){if(c=Ja(e),c!==null){for(i.flags|=128,kl(n,!1),e=c.updateQueue,i.updateQueue=e,go(i,e),i.subtreeFlags=0,e=r,r=i.child;r!==null;)u_(r,e),r=r.sibling;return Ml(i,It.current&1|2),Ae&&Ts(i,n.treeForkCount),i.child}e=e.sibling}n.tail!==null&&Ft()>Do&&(i.flags|=128,o=!0,kl(n,!1),i.lanes=4194304)}else{if(!o)if(e=Ja(c),e!==null){if(i.flags|=128,o=!0,e=e.updateQueue,i.updateQueue=e,go(i,e),kl(n,!0),n.tail===null&&n.tailMode!=="collapsed"&&n.tailMode!=="visible"&&!c.alternate&&!Ae)return st(i),null}else 2*Ft()-n.renderingStartTime>Do&&r!==536870912&&(i.flags|=128,o=!0,kl(n,!1),i.lanes=4194304);n.isBackwards?(c.sibling=i.child,i.child=c):(e=n.last,e!==null?e.sibling=c:i.child=c,n.last=c)}if(n.tail!==null){e=n.tail;e:{for(r=e;r!==null;){if(r.alternate!==null){r=!1;break e}r=r.sibling}r=!0}return n.rendering=e,n.tail=e.sibling,n.renderingStartTime=Ft(),e.sibling=null,c=It.current,c=o?c&1|2:c&1,n.tailMode==="visible"||n.tailMode==="collapsed"||!r||Ae?Ml(i,c):(r=c,Ve(Pt,i),Ve(It,r),Zt===null&&(Zt=i)),Ae&&Ts(i,n.treeForkCount),e}return st(i),null;case 22:case 23:return yi(i),hu(),n=i.memoizedState!==null,e!==null?e.memoizedState!==null!==n&&(i.flags|=8192):n&&(i.flags|=8192),n?(r&536870912)!==0&&(i.flags&128)===0&&(st(i),i.subtreeFlags&6&&(i.flags|=8192)):st(i),r=i.updateQueue,r!==null&&go(i,r.retryQueue),r=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(r=e.memoizedState.cachePool.pool),n=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(n=i.memoizedState.cachePool.pool),n!==r&&(i.flags|=2048),e!==null&&tt(Hr),null;case 24:return r=null,e!==null&&(r=e.memoizedState.cache),i.memoizedState.cache!==r&&(i.flags|=2048),Ms(bt),st(i),null;case 25:return null;case 30:return i.flags|=33554432,st(i),null}throw Error(a(156,i.tag))}function $S(e,i){switch(Qc(i),i.tag){case 1:return e=i.flags,e&65536?(i.flags=e&-65537|128,i):null;case 3:return Ms(bt),Ii(),e=i.flags,(e&65536)!==0&&(e&128)===0?(i.flags=e&-65537|128,i):null;case 26:case 27:case 5:return Cr(i),null;case 31:if(i.memoizedState!==null){if(yi(i),i.alternate===null)throw Error(a(340));Br()}return e=i.flags,e&65536?(i.flags=e&-65537|128,i):null;case 13:if(yi(i),e=i.memoizedState,e!==null&&e.dehydrated!==null){if(i.alternate===null)throw Error(a(340));Br()}return e=i.flags,e&65536?(i.flags=e&-65537|128,i):null;case 19:return du(i),e=i.flags,e&65536?(i.flags=e&-65537|128,e=i.memoizedState,e!==null&&(e.rendering=null,e.tail=null),i.flags|=4,i):null;case 4:return Ii(),null;case 10:return Ms(i.type),null;case 22:case 23:return yi(i),hu(),e!==null&&tt(Hr),e=i.flags,e&65536?(i.flags=e&-65537|128,i):null;case 24:return Ms(bt),null;case 25:return null;default:return null}}function Ug(e,i){switch(Qc(i),i.tag){case 3:Ms(bt),Ii();break;case 26:case 27:case 5:Cr(i);break;case 4:Ii();break;case 31:i.memoizedState!==null&&yi(i);break;case 13:yi(i);break;case 19:du(i);break;case 10:Ms(i.type);break;case 22:case 23:yi(i),hu(),e!==null&&tt(Hr);break;case 24:Ms(bt)}}function Nl(e,i){try{var r=i.updateQueue,n=r!==null?r.lastEffect:null;if(n!==null){var o=n.next;r=o;do{if((r.tag&e)===e){n=void 0;var c=r.create,_=r.inst;n=c(),_.destroy=n}r=r.next}while(r!==o)}}catch(p){We(i,i.return,p)}}function ir(e,i,r){try{var n=i.updateQueue,o=n!==null?n.lastEffect:null;if(o!==null){var c=o.next;n=c;do{if((n.tag&e)===e){var _=n.inst,p=_.destroy;if(p!==void 0){_.destroy=void 0,o=i;var y=r,R=p;try{R()}catch(L){We(o,y,L)}}}n=n.next}while(n!==c)}}catch(L){We(i,i.return,L)}}function jg(e){var i=e.updateQueue;if(i!==null){var r=e.stateNode;try{M_(i,r)}catch(n){We(e,e.return,n)}}}function qg(e,i,r){r.props=Kr(e.type,e.memoizedProps),r.state=e.memoizedState;try{r.componentWillUnmount()}catch(n){We(e,i,n)}}function ns(e,i){try{var r=e.ref;if(r!==null){switch(e.tag){case 26:case 27:case 5:var n=e.stateNode;break;case 30:var o=e.stateNode,c=Cs(e.memoizedProps,o);(o.ref===null||o.ref.name!==c)&&(o.ref=Gm(c)),n=o.ref;break;case 7:if(e.stateNode===null){var _=new xi(e);v(e.child,!1,Ky,_,void 0,void 0),e.stateNode=_}n=e.stateNode;break;default:n=e.stateNode}typeof r=="function"?e.refCleanup=r(n):r.current=n}}catch(p){We(e,i,p)}}function Vt(e,i){var r=e.ref,n=e.refCleanup;if(r!==null)if(typeof n=="function")try{n()}catch(o){We(e,i,o)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof r=="function")try{r(null)}catch(o){We(e,i,o)}else r.current=null}function mo(e,i){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&i!==null)for(var r=0;r<i.length;r++)Jm(e.stateNode,i[r])}function Yg(e){for(var i=e.return;i!==null&&(Iu(i)&&Jm(e.stateNode,i.stateNode),!Pu(i));)i=i.return}function Ll(e){for(var i=e.return;i!==null&&(Iu(i)&&Py(e.stateNode,i.stateNode),!Pu(i));)i=i.return}function Pu(e){return e.tag===5||e.tag===3||e.tag===27}function Iu(e){return e&&e.tag===7&&e.stateNode!==null}function Vu(e){var i=e.type,r=e.memoizedProps,n=e.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":r.autoFocus&&n.focus();break e;case"img":r.src?n.src=r.src:r.srcSet&&(n.srcset=r.srcSet)}}catch(o){We(e,e.return,o)}}function Xu(e,i,r){try{var n=e.stateNode;Ey(n,e.type,r,i),n[ui]=i}catch(o){We(e,e.return,o)}}function Kg(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&cr(e.type)||e.tag===4}function Gu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Kg(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&cr(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Wu(e,i,r,n){var o=e.tag;if(o===5||o===6)o=e.stateNode,i?(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r).insertBefore(o,i):(i=r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,i.appendChild(o),r=r._reactRootContainer,r!=null||i.onclick!==null||(i.onclick=is)),mo(e,n),Ke=!0;else if(o!==4&&(o===27&&(mo(e,n),n=null,cr(e.type)&&(r=e.stateNode,i=null)),e=e.child,e!==null))for(Wu(e,i,r,n),e=e.sibling;e!==null;)Wu(e,i,r,n),e=e.sibling}function vo(e,i,r,n){var o=e.tag;if(o===5||o===6)o=e.stateNode,i?r.insertBefore(o,i):r.appendChild(o),mo(e,n),Ke=!0;else if(o!==4&&(o===27&&(mo(e,n),n=null,cr(e.type)&&(r=e.stateNode)),e=e.child,e!==null))for(vo(e,i,r,n),e=e.sibling;e!==null;)vo(e,i,r,n),e=e.sibling}function Pg(e){var i=e.stateNode,r=e.memoizedProps;try{for(var n=e.type,o=i.attributes;o.length;)i.removeAttributeNode(o[0]);Xt(i,n,r),i[Yt]=e,i[ui]=r}catch(c){We(e,e.return,c)}}var po=!1,bi=null;function Ig(e){(e.tag===30||(e.subtreeFlags&33554432)!==0)&&(po=!0)}var ls=null;function Vg(){var e=ls;return ls=null,e}var fi=0;function On(e,i,r,n,o){return fi=0,Xg(e.child,i,r,n,o)}function Xg(e,i,r,n,o){for(var c=!1;e!==null;){if(e.tag===5){var _=e.stateNode;if(n!==null){var p=Ah(_);n.push(p),p.view&&(c=!0)}else c||Ah(_).view&&(c=!0);po=!0,Vm(_,fi===0?i:i+"_"+fi,r),fi++}else(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&o||Xg(e.child,i,r,n,o)&&(c=!0));e=e.sibling}return c}function as(e,i){for(;e!==null;)e.tag===5?Xm(e.stateNode,e.memoizedProps):(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&i||as(e.child,i)),e=e.sibling}function So(e){if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if((e.tag!==22||e.memoizedState===null)&&(So(e),e.tag===30&&(e.flags&18874368)!==0&&e.stateNode.paired)){var i=e.memoizedProps;if(i.name==null||i.name==="auto")throw Error(a(544));var r=i.name;i=Es(i.default,i.share),i!=="none"&&(On(e,r,i,null,!1)||as(e.child,!1))}e=e.sibling}}function Fu(e,i){if(e.tag===30){var r=e.stateNode,n=e.memoizedProps,o=Cs(n,r),c=Es(n.default,r.paired?n.share:n.enter);c!=="none"?On(e,o,c,null,!1)?(So(e),r.paired||i||Un(e,n.onEnter)):as(e.child,!1):So(e)}else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)Fu(e,i),e=e.sibling;else So(e)}function Zu(e){if(bi!==null&&bi.size!==0){var i=bi;if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&(e.flags&18874368)!==0){var r=e.memoizedProps,n=r.name;if(n!=null&&n!=="auto"){var o=i.get(n);if(o!==void 0){var c=Es(r.default,r.share);if(c!=="none"&&(On(e,n,c,null,!1)?(c=e.stateNode,o.paired=c,c.paired=o,Un(e,r.onShare)):as(e.child,!1)),i.delete(n),i.size===0)break}}}Zu(e)}e=e.sibling}}}function Qu(e){if(e.tag===30){var i=e.memoizedProps,r=Cs(i,e.stateNode),n=bi!==null?bi.get(r):void 0,o=Es(i.default,n!==void 0?i.share:i.exit);o!=="none"&&(On(e,r,o,null,!1)?n!==void 0?(o=e.stateNode,n.paired=o,o.paired=n,bi.delete(r),Un(e,i.onShare)):Un(e,i.onExit):as(e.child,!1)),bi!==null&&Zu(e)}else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)Qu(e),e=e.sibling;else bi!==null&&Zu(e)}function Gg(e){for(e=e.child;e!==null;){if(e.tag===30){var i=e.memoizedProps,r=Cs(i,e.stateNode);i=Es(i.default,i.update),e.flags&=-5,i!=="none"&&On(e,r,i,e.memoizedState=[],!1)}else(e.subtreeFlags&33554432)!==0&&Gg(e);e=e.sibling}}function $u(e){if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&(e.flags&18874368)!==0){var i=e.stateNode;i.paired!==null&&(i.paired=null,as(e.child,!1))}$u(e)}e=e.sibling}}function yo(e){if(e.tag===30)e.stateNode.paired=null,as(e.child,!1),$u(e);else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)yo(e),e=e.sibling;else $u(e)}function Wg(e){for(e=e.child;e!==null;)e.tag===30?as(e.child,!1):(e.subtreeFlags&33554432)!==0&&Wg(e),e=e.sibling}function Ju(e,i,r,n,o,c,_){for(var p=!1;i!==null;){if(i.tag===5){var y=i.stateNode;if(c!==null&&fi<c.length){var R=c[fi],L=Ah(y);(R.view||L.view)&&(p=!0);var Y;if(Y=(e.flags&4)===0)if(L.clip)Y=!0;else{Y=R.rect;var D=L.rect;Y=Y.y!==D.y||Y.x!==D.x||Y.height!==D.height||Y.width!==D.width}Y&&(e.flags|=4),L.abs?L=!R.abs:(R=R.rect,L=L.rect,L=R.height!==L.height||R.width!==L.width),L&&(e.flags|=32)}else e.flags|=32;(e.flags&4)!==0&&Vm(y,fi===0?r:r+"_"+fi,o),p&&(e.flags&4)!==0||(ls===null&&(ls=[]),ls.push(y,fi===0?n:n+"_"+fi,i.memoizedProps)),fi++}else(i.tag!==22||i.memoizedState===null)&&(i.tag===30&&_?e.flags|=i.flags&32:Ju(e,i.child,r,n,o,c,_)&&(p=!0));i=i.sibling}return p}function Fg(e,i){for(e=e.child;e!==null;){if(e.tag===30){var r=e.memoizedProps,n=e.stateNode,o=Cs(r,n),c=Es(r.default,r.update),_;_=e.memoizedState,e.memoizedState=null,n=e;var p=e.child;fi=0,o=Ju(n,p,o,o,c,_,!1),(e.flags&4)!==0&&o&&Un(e,r.onUpdate)}else(e.subtreeFlags&33554432)!==0&&Fg(e);e=e.sibling}}var kt=!1,Xe=!1,os=!1,eh=!1,Zg=typeof WeakSet=="function"?WeakSet:Set,Nt=null,cs=!1,zl=!1,bo=!1,th=!1;function JS(e,i,r){if(e=e.containerInfo,Th=Wn,e=e_(e),Yc(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var o=n.getSelection&&n.getSelection();if(o&&o.rangeCount!==0){n=o.anchorNode;var c=o.anchorOffset,_=o.focusNode;o=o.focusOffset;try{n.nodeType,_.nodeType}catch{n=null;break e}var p=0,y=-1,R=-1,L=0,Y=0,D=e,N=null;t:for(;;){for(var ae;D!==n||c!==0&&D.nodeType!==3||(y=p+c),D!==_||o!==0&&D.nodeType!==3||(R=p+o),D.nodeType===3&&(p+=D.nodeValue.length),(ae=D.firstChild)!==null;)N=D,D=ae;for(;;){if(D===e)break t;if(N===n&&++L===c&&(y=p),N===_&&++Y===o&&(R=p),(ae=D.nextSibling)!==null)break;D=N,N=D.parentNode}D=ae}n=y===-1||R===-1?null:{start:y,end:R}}else n=null}n=n||{start:0,end:0}}else n=null;for(Dh={focusedElem:e,selectionRange:n},Wn=!1,r=(r&335544064)===r,Nt=i,i=r?9270:1024;Nt!==null;){if(e=Nt,r&&(n=e.deletions,n!==null))for(c=0;c<n.length;c++)r&&Qu(n[c]);if(e.alternate===null&&(e.flags&2)!==0)r&&Ig(e),wo(r);else{if(e.tag===22){if(n=e.alternate,e.memoizedState!==null){n!==null&&n.memoizedState===null&&r&&Qu(n),wo(r);continue}else if(n!==null&&n.memoizedState!==null){r&&Ig(e),wo(r);continue}}n=e.child,(e.subtreeFlags&i)!==0&&n!==null?(n.return=e,Nt=n):(r&&Gg(e),wo(r))}}bi=null}function wo(e){for(;Nt!==null;){var i=Nt,r=e,n=i.alternate,o=i.flags;switch(i.tag){case 0:case 11:case 15:break;case 1:if((o&1024)!==0&&n!==null){r=void 0,o=n.memoizedProps,n=n.memoizedState;var c=i.stateNode;try{var _=Kr(i.type,o);r=c.getSnapshotBeforeUpdate(_,n),c.__reactInternalSnapshotBeforeUpdate=r}catch(p){We(i,i.return,p)}}break;case 3:if((o&1024)!==0){if(n=i.stateNode.containerInfo,r=n.nodeType,r===9)Nh(n);else if(r===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":Nh(n);break;default:n.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:r&&n!==null&&(r=Cs(n.memoizedProps,n.stateNode),o=i.memoizedProps,o=Es(o.default,o.update),o!=="none"&&On(n,r,o,n.memoizedState=[],!0));break;default:if((o&1024)!==0)throw Error(a(163))}if(n=i.sibling,n!==null){n.return=i.return,Nt=n;break}Nt=i.return}}function Qg(e,i,r){var n=r.flags;switch(r.tag){case 0:case 11:case 15:us(e,r),n&4&&Nl(5,r);break;case 1:if(us(e,r),n&4)if(e=r.stateNode,i===null)try{e.componentDidMount()}catch(_){We(r,r.return,_)}else{var o=Kr(r.type,i.memoizedProps);i=i.memoizedState;try{e.componentDidUpdate(o,i,e.__reactInternalSnapshotBeforeUpdate)}catch(_){We(r,r.return,_)}}n&64&&jg(r),n&512&&ns(r,r.return);break;case 3:if(us(e,r),n&64&&(e=r.updateQueue,e!==null)){if(i=null,r.child!==null)switch(r.child.tag){case 27:case 5:i=r.child.stateNode;break;case 1:i=r.child.stateNode}try{M_(e,i)}catch(_){We(r,r.return,_)}}break;case 27:i===null&&n&4&&Pg(r);case 26:case 5:us(e,r),i===null&&n&4&&Vu(r),n&512&&ns(r,r.return);break;case 12:us(e,r);break;case 31:us(e,r),n&4&&tm(e,r);break;case 13:us(e,r),n&4&&im(e,r),n&64&&(e=r.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(r=hy.bind(null,r),Xy(e,r))));break;case 22:if(n=r.memoizedState!==null||kt,!n){var c=i!==null&&i.memoizedState!==null||Xe;i=kt,o=Xe,kt=n,(Xe=c)&&!o?(n=2,(r.subtreeFlags&8772)!==0&&(n|=1),Fi(e,r,n)):us(e,r),kt=i,Xe=o}break;case 30:us(e,r),n&512&&ns(r,r.return);break;case 7:n&512&&ns(r,r.return);default:us(e,r)}}function ih(e,i){for(e=e.child;e!==null;)$g(e,i),e=e.sibling}function $g(e,i){switch(e.tag){case 5:case 26:try{var r=e.stateNode;if(i){var n=r.style;typeof n.setProperty=="function"?n.setProperty("display","none","important"):n.display="none"}else{var o=e.stateNode,c=e.memoizedProps.style,_=c!=null&&c.hasOwnProperty("display")?c.display:null;o.style.display=_==null||typeof _=="boolean"?"":(""+_).trim()}}catch(y){We(e,e.return,y)}sh(e,i);break;case 6:try{e.stateNode.nodeValue=i?"":e.memoizedProps,Ke=!0}catch(y){We(e,e.return,y)}break;case 18:try{var p=e.stateNode;i?Im(p,!0):Im(e.stateNode,!1)}catch(y){We(e,e.return,y)}break;case 22:case 23:e.memoizedState===null&&ih(e,i);break;default:ih(e,i)}}function sh(e,i){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){e:{var r=e,n=i;switch(r.tag){case 4:$g(r,n);break e;case 22:r.memoizedState===null&&sh(r,n);break e;default:sh(r,n)}}e=e.sibling}}function Jg(e){var i=e.alternate;i!==null&&(e.alternate=null,Jg(i)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(i=e.stateNode,i!==null&&Ta(i)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var at=null,di=!1;function Gi(e,i,r){for(r=r.child;r!==null;)em(e,i,r),r=r.sibling}function em(e,i,r){if(ei&&typeof ei.onCommitFiberUnmount=="function")try{ei.onCommitFiberUnmount(qs,r)}catch{}switch(r.tag){case 26:Xe||Vt(r,i),Gi(e,i,r),r.memoizedState?r.memoizedState.count--:r.stateNode&&!Xe&&(r=r.stateNode,r.parentNode.removeChild(r));break;case 27:Xe||Vt(r,i),Ll(r);var n=at,o=di;cr(r.type)&&(at=r.stateNode,di=!1),Gi(e,i,r),rv(r.stateNode,r.type,r.memoizedProps),at=n,di=o;break;case 5:Xe||Vt(r,i),Ll(r);case 6:if(r.tag===6&&Ll(r),n=at,o=di,at=null,Gi(e,i,r),at=n,di=o,at!==null)if(di)try{(at.nodeType===9?at.body:at.nodeName==="HTML"?at.ownerDocument.body:at).removeChild(r.stateNode),Ke=!0}catch(c){We(r,i,c)}else try{at.removeChild(r.stateNode),Ke=!0}catch(c){We(r,i,c)}break;case 18:at!==null&&(di?(e=at,Pm(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,r.stateNode),Fn(e)):Pm(at,r.stateNode));break;case 4:n=at,o=di,at=r.stateNode.containerInfo,di=!0,Gi(e,i,r),at=n,di=o;break;case 0:case 11:case 14:case 15:ir(2,r,i),Xe||ir(4,r,i),Gi(e,i,r);break;case 1:Xe||(Vt(r,i),n=r.stateNode,typeof n.componentWillUnmount=="function"&&qg(r,i,n)),Gi(e,i,r);break;case 21:Gi(e,i,r);break;case 22:Xe=(n=Xe)||r.memoizedState!==null,Gi(e,i,r),Xe=n;break;case 30:Vt(r,i),Gi(e,i,r);break;case 7:Xe||Vt(r,i),Gi(e,i,r);break;default:Gi(e,i,r)}}function tm(e,i){if(i.memoizedState===null&&(e=i.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Fn(e)}catch(r){We(i,i.return,r)}}}function im(e,i){if(i.memoizedState===null&&(e=i.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Fn(e)}catch(r){We(i,i.return,r)}}function ey(e){switch(e.tag){case 31:case 13:case 19:var i=e.stateNode;return i===null&&(i=e.stateNode=new Zg),i;case 22:return e=e.stateNode,i=e._retryCache,i===null&&(i=e._retryCache=new Zg),i;default:throw Error(a(435,e.tag))}}function Co(e,i){var r=ey(e);i.forEach(function(n){if(!r.has(n)){r.add(n);var o=fy.bind(null,e,n);n.then(o,o)}})}function ri(e,i,r){var n=i.deletions;if(n!==null)for(var o=0;o<n.length;o++){var c=n[o],_=e,p=i,y=p;e:for(;y!==null;){switch(y.tag){case 27:if(cr(y.type)){at=y.stateNode,di=!1;break e}break;case 5:at=y.stateNode,di=!1;break e;case 3:case 4:at=y.stateNode.containerInfo,di=!0;break e}y=y.return}if(at===null)throw Error(a(160));em(_,p,c),at=null,di=!1,_=c.alternate,_!==null&&(_.return=null),c.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)sm(i,e,r),i=i.sibling}var Wi=null;function sm(e,i,r){var n=e.alternate,o=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(o&4&&(n=e.updateQueue,n=n!==null?n.events:null,n!==null))for(var c=0;c<n.length;c++){var _=n[c];_.ref.impl=_.nextImpl}ri(i,e,r),ni(e),o&4&&(ir(3,e,e.return),Nl(3,e),ir(5,e,e.return));break;case 1:ri(i,e,r),ni(e),o&512&&(Xe||n===null||Vt(n,n.return)),o&64&&kt&&(e=e.updateQueue,e!==null&&(i=e.callbacks,i!==null&&(r=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=r===null?i:r.concat(i))));break;case 26:if(c=Wi,ri(i,e,r),ni(e),o&512&&(Xe||n===null||Vt(n,n.return)),o&4)if(o=n!==null?n.memoizedState:null,r=e.memoizedState,n===null)if(r===null)if(e.stateNode===null)if(kt)e.stateNode=qm(e.type,e.memoizedProps,i.containerInfo,e);else{e:{i=e.type,r=e.memoizedProps,o=c.ownerDocument||c;t:switch(i){case"title":n=o.getElementsByTagName("title")[0],(!n||n[ol]||n[Yt]||n.namespaceURI==="http://www.w3.org/2000/svg"||n.hasAttribute("itemprop"))&&(n=o.createElement(i),o.head.insertBefore(n,o.querySelector("head > title"))),Xt(n,i,r),n[Yt]=e,At(n),i=n;break e;case"link":if(c=uv("link","href",o).get(i+(r.href||""))){for(_=0;_<c.length;_++)if(n=c[_],n.getAttribute("href")===(r.href==null||r.href===""?null:r.href)&&n.getAttribute("rel")===(r.rel==null?null:r.rel)&&n.getAttribute("title")===(r.title==null?null:r.title)&&n.getAttribute("crossorigin")===(r.crossOrigin==null?null:r.crossOrigin)){c.splice(_,1);break t}}n=o.createElement(i),Xt(n,i,r),o.head.appendChild(n);break;case"meta":if(c=uv("meta","content",o).get(i+(r.content||""))){for(_=0;_<c.length;_++)if(n=c[_],n.getAttribute("content")===(r.content==null?null:""+r.content)&&n.getAttribute("name")===(r.name==null?null:r.name)&&n.getAttribute("property")===(r.property==null?null:r.property)&&n.getAttribute("http-equiv")===(r.httpEquiv==null?null:r.httpEquiv)&&n.getAttribute("charset")===(r.charSet==null?null:r.charSet)){c.splice(_,1);break t}}n=o.createElement(i),Xt(n,i,r),o.head.appendChild(n);break;default:throw Error(a(468,i))}n[Yt]=e,At(n),i=n}e.stateNode=i}else kt||Yh(c,e.type,e.stateNode);else e.stateNode=cv(c,r,e.memoizedProps);else o!==r?(o===null?(i=n.stateNode,i===null||Xe||i.parentNode.removeChild(i)):o.count--,r===null?kt||Yh(c,e.type,e.stateNode):cv(c,r,e.memoizedProps)):r===null&&e.stateNode!==null&&Xu(e,e.memoizedProps,n.memoizedProps);break;case 27:ri(i,e,r),ni(e),o&512&&(Xe||n===null||Vt(n,n.return)),n!==null&&o&4&&Xu(e,e.memoizedProps,n.memoizedProps);break;case 5:if(c=os,os=!1,ri(i,e,r),os=c,ni(e),o&512&&(Xe||n===null||Vt(n,n.return)),e.flags&32){i=e.stateNode;try{fn(i,""),Ke=!0}catch(L){We(e,e.return,L)}}o&4&&e.stateNode!=null&&(i=e.memoizedProps,Xu(e,i,n!==null?n.memoizedProps:i)),o&1024&&(eh=!0);break;case 6:if(ri(i,e,r),ni(e),o&4){if(e.stateNode===null)throw Error(a(162));i=e.memoizedProps,r=e.stateNode;try{r.nodeValue=i,Ke=!0}catch(L){We(e,e.return,L)}}break;case 3:if(Ke=!1,Uo=null,c=Wi,Wi=Vl(i.containerInfo),ri(i,e,r),Wi=c,ni(e),o&4&&n!==null&&n.memoizedState.isDehydrated)try{Fn(i.containerInfo)}catch(L){We(e,e.return,L)}eh&&(eh=!1,rm(e)),Ke=!1;break;case 4:o=os,os=kt,n=Ed(),c=Wi,Wi=Vl(e.stateNode.containerInfo),ri(i,e,r),ni(e),Wi=c,Ke&&zl&&(bo=!0),Ke=n,os=o;break;case 12:ri(i,e,r),ni(e);break;case 31:ri(i,e,r),ni(e),o&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Co(e,i)));break;case 13:ri(i,e,r),ni(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(To=Ft()),o&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Co(e,i)));break;case 22:c=e.memoizedState!==null,_=n!==null&&n.memoizedState!==null;var p=kt,y=Xe,R=os;kt=p||c,os=R||c,Xe=y||_,ri(i,e,r),Xe=y,os=R,kt=p,ni(e),o&8192&&(i=e.stateNode,i._visibility=c?i._visibility&-2:i._visibility|1,!c||n===null||_||kt||Xe||(i=_||Xe,r=kt,n=Xe,kt=c||kt,Xe=i,sr(e,2),kt=r,Xe=n),!c&&os||ih(e,c)),o&4&&(i=e.updateQueue,i!==null&&(r=i.retryQueue,r!==null&&(i.retryQueue=null,Co(e,r))));break;case 19:ri(i,e,r),ni(e),o&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Co(e,i)));break;case 30:o&512&&(Xe||n===null||Vt(n,n.return)),o=Ed(),c=zl,_=(r&335544064)===r,p=e.memoizedProps,zl=_&&Es(p.default,p.update)!=="none",ri(i,e,r),ni(e),_&&n!==null&&Ke&&(e.flags|=4),zl=c,Ke=o;break;case 21:break;case 7:o&512&&(Xe||n===null||Vt(n,n.return)),n&&n.stateNode!==null&&(n.stateNode._fragmentFiber=e);default:ri(i,e,r),ni(e)}}function ni(e){var i=e.flags;if(i&2){try{for(var r,n=e.return;n!==null;){if(Kg(n)){r=n;break}n=n.return}n=null;for(var o=e.return;o!==null;){if(Iu(o)){var c=o.stateNode;n===null?n=[c]:n.push(c)}if(Pu(o))break;o=o.return}var _=n;if(r==null)throw Error(a(160));switch(r.tag){case 27:var p=r.stateNode,y=Gu(e);vo(e,y,p,_);break;case 5:var R=r.stateNode;r.flags&32&&(fn(R,""),r.flags&=-33);var L=Gu(e);vo(e,L,R,_);break;case 3:case 4:var Y=r.stateNode.containerInfo,D=Gu(e);Wu(e,D,Y,_);break;default:throw Error(a(161))}}catch(N){We(e,e.return,N)}e.flags&=-3}i&4096&&(e.flags&=-4097)}function rm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var i=e;rm(i),i.tag===5&&i.flags&1024&&(i=i.stateNode,Wn=!0,i.reset(),Wn=!1),e=e.sibling}}function An(e,i){if(i.subtreeFlags&9270)for(i=i.child;i!==null;)nm(i,e),i=i.sibling;else Fg(i)}function nm(e,i){var r=e.alternate;if(r===null)Fu(e,!1);else switch(e.tag){case 3:if(th=cs=!1,Vg(),An(i,e),!cs&&!bo){if(e=ls,e!==null)for(var n=0;n<e.length;n+=3){r=e[n];var o=e[n+1];Xm(r,e[n+2]),r=r.ownerDocument.documentElement,r!==null&&r.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group("+o+")"})}e=i.containerInfo,e=e.nodeType===9?e.documentElement:e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===""&&(e.style.viewTransitionName="none",e.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group(root)"}),e.animate({width:[0,0],height:[0,0]},{duration:0,fill:"forwards",pseudoElement:"::view-transition"})),th=!0}ls=null;break;case 5:An(i,e);break;case 4:n=cs,cs=!1,An(i,e),cs&&(bo=!0),cs=n;break;case 22:e.memoizedState===null&&(r.memoizedState!==null?Fu(e,!1):An(i,e));break;case 30:n=cs,o=Vg(),cs=!1,An(i,e),cs&&(e.flags|=4);var c=e.memoizedProps,_=e.stateNode;i=Cs(c,_),_=Cs(r.memoizedProps,_);var p=Es(c.default,c.update);p==="none"?i=!1:(c=r.memoizedState,r.memoizedState=null,r=e.child,fi=0,i=Ju(e,r,i,_,p,c,!0),fi!==(c===null?0:c.length)&&(e.flags|=32)),(e.flags&4)!==0&&i?(Un(e,e.memoizedProps.onUpdate),ls=o):o!==null&&(o.push.apply(o,ls),ls=o),cs=(e.flags&32)!==0?!0:n;break;default:An(i,e)}}function us(e,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)Qg(e,i.alternate,i),i=i.sibling}function sr(e,i){for(e=e.child;e!==null;){var r=e,n=i;switch(r.tag){case 0:case 11:case 14:case 15:ir(4,r,r.return),sr(r,n);break;case 1:Vt(r,r.return);var o=r.stateNode;typeof o.componentWillUnmount=="function"&&qg(r,r.return,o),sr(r,n);break;case 27:(n&2)!==0&&rv(r.stateNode,r.type,r.memoizedProps);case 5:Vt(r,r.return),r.tag!==5&&r.tag!==27||Ll(r),sr(r,n);break;case 6:Ll(r);break;case 26:Vt(r,r.return),o=r.stateNode,r.memoizedState!==null||o===null||Xe||o.parentNode.removeChild(o),sr(r,n);break;case 22:r.memoizedState===null&&sr(r,n);break;case 30:Vt(r,r.return),sr(r,n);break;case 7:Vt(r,r.return);default:sr(r,n)}e=e.sibling}}function Fi(e,i,r){for(r=(i.subtreeFlags&8772)!==0?r:r&-2,i=i.child;i!==null;){var n=i.alternate,o=e,c=i,_=c.flags,p=(r&1)!==0;switch(c.tag){case 0:case 11:case 15:Fi(o,c,r),Nl(4,c);break;case 1:if(Fi(o,c,r),n=c,o=n.stateNode,typeof o.componentDidMount=="function")try{o.componentDidMount()}catch(L){We(n,n.return,L)}if(n=c,o=n.updateQueue,o!==null){var y=n.stateNode;try{var R=o.shared.hiddenCallbacks;if(R!==null)for(o.shared.hiddenCallbacks=null,o=0;o<R.length;o++)D_(R[o],y)}catch(L){We(n,n.return,L)}}p&&_&64&&jg(c),ns(c,c.return);break;case 27:(r&2)!==0&&Pg(c);case 5:c.tag!==5&&c.tag!==27||Yg(c),Fi(o,c,r),p&&n===null&&_&4&&Vu(c),ns(c,c.return);break;case 6:Yg(c);break;case 26:y=c.stateNode,c.memoizedState!==null||y===null||kt||Yh(Vl(y.ownerDocument),c.type,y),Fi(o,c,r),p&&n===null&&_&4&&Vu(c),ns(c,c.return);break;case 12:Fi(o,c,r);break;case 31:Fi(o,c,r),p&&_&4&&tm(o,c);break;case 13:Fi(o,c,r),p&&_&4&&im(o,c);break;case 22:c.memoizedState===null&&Fi(o,c,r),ns(c,c.return);break;case 30:Fi(o,c,r),ns(c,c.return);break;case 7:ns(c,c.return);default:Fi(o,c,r)}i=i.sibling}}function rh(e,i){var r=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(r=e.memoizedState.cachePool.pool),e=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(e=i.memoizedState.cachePool.pool),e!==r&&(e!=null&&e.refCount++,r!=null&&bl(r))}function nh(e,i){e=null,i.alternate!==null&&(e=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==e&&(i.refCount++,e!=null&&bl(e))}function zi(e,i,r,n){var o=(r&335544064)===r;if(i.subtreeFlags&(o?10262:10256))for(i=i.child;i!==null;)lm(e,i,r,n),i=i.sibling;else o&&Wg(i)}function lm(e,i,r,n){var o=(r&335544064)===r;o&&i.alternate===null&&i.return!==null&&i.return.alternate!==null&&yo(i);var c=i.flags;switch(i.tag){case 0:case 11:case 15:zi(e,i,r,n),c&2048&&Nl(9,i);break;case 1:zi(e,i,r,n);break;case 3:zi(e,i,r,n),o&&th&&(e=e.containerInfo,e=e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,e.style.viewTransitionName==="root"&&(e.style.viewTransitionName=""),e=e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName==="none"&&(e.style.viewTransitionName="")),c&2048&&(c=null,i.alternate!==null&&(c=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==c&&(i.refCount++,c!=null&&bl(c)));break;case 12:if(c&2048){zi(e,i,r,n),c=i.stateNode;try{var _=i.memoizedProps,p=_.id,y=_.onPostCommit;typeof y=="function"&&y(p,i.alternate===null?"mount":"update",c.passiveEffectDuration,-0)}catch(R){We(i,i.return,R)}}else zi(e,i,r,n);break;case 31:zi(e,i,r,n);break;case 13:zi(e,i,r,n);break;case 23:break;case 22:_=i.stateNode,p=i.alternate,i.memoizedState!==null?(o&&p!==null&&p.memoizedState===null&&yo(p),_._visibility&2?zi(e,i,r,n):Hl(e,i)):(o&&p!==null&&p.memoizedState!==null&&yo(i),_._visibility&2?zi(e,i,r,n):(_._visibility|=2,Bn(e,i,r,n,(i.subtreeFlags&10256)!==0||!1))),c&2048&&rh(p,i);break;case 24:zi(e,i,r,n),c&2048&&nh(i.alternate,i);break;case 30:o&&(c=i.alternate,c!==null&&(as(c.child,!0),as(i.child,!0))),zi(e,i,r,n);break;default:zi(e,i,r,n)}}function Bn(e,i,r,n,o){for(o=o&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var c=e,_=i,p=r,y=n,R=_.flags;switch(_.tag){case 0:case 11:case 15:Bn(c,_,p,y,o),Nl(8,_);break;case 23:break;case 22:var L=_.stateNode;_.memoizedState!==null?L._visibility&2?Bn(c,_,p,y,o):Hl(c,_):(L._visibility|=2,Bn(c,_,p,y,o)),o&&R&2048&&rh(_.alternate,_);break;case 24:Bn(c,_,p,y,o),o&&R&2048&&nh(_.alternate,_);break;default:Bn(c,_,p,y,o)}i=i.sibling}}function Hl(e,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var r=e,n=i,o=n.flags;switch(n.tag){case 22:Hl(r,n),o&2048&&rh(n.alternate,n);break;case 24:Hl(r,n),o&2048&&nh(n.alternate,n);break;default:Hl(r,n)}i=i.sibling}}var Pr=8192;function Ir(e,i,r){if(e.subtreeFlags&Pr)for(e=e.child;e!==null;)am(e,i,r),e=e.sibling}function am(e,i,r){switch(e.tag){case 26:Ir(e,i,r),e.flags&Pr&&(e.memoizedState!==null?l1(r,Wi,e.memoizedState,e.memoizedProps):(e=e.stateNode,(i&335544128)===i&&_v(r,e)));break;case 5:Ir(e,i,r),e.flags&Pr&&(e=e.stateNode,(i&335544128)===i&&_v(r,e));break;case 3:case 4:var n=Wi;Wi=Vl(e.stateNode.containerInfo),Ir(e,i,r),Wi=n;break;case 22:e.memoizedState===null&&(n=e.alternate,n!==null&&n.memoizedState!==null?(n=Pr,Pr=16777216,Ir(e,i,r),Pr=n):Ir(e,i,r));break;case 30:if((e.flags&Pr)!==0&&(n=e.memoizedProps.name,n!=null&&n!=="auto")){var o=e.stateNode;o.paired=null,bi===null&&(bi=new Map),bi.set(n,o)}Ir(e,i,r);break;default:Ir(e,i,r)}}function om(e){var i=e.alternate;if(i!==null&&(e=i.child,e!==null)){i.child=null;do i=e.sibling,e.sibling=null,e=i;while(e!==null)}}function Ul(e){var i=e.deletions;if((e.flags&16)!==0){if(i!==null)for(var r=0;r<i.length;r++){var n=i[r];Nt=n,um(n,e)}om(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)cm(e),e=e.sibling}function cm(e){switch(e.tag){case 0:case 11:case 15:Ul(e),e.flags&2048&&ir(9,e,e.return);break;case 3:Ul(e);break;case 12:Ul(e);break;case 22:var i=e.stateNode;e.memoizedState!==null&&i._visibility&2&&(e.return===null||e.return.tag!==13)?(i._visibility&=-3,Eo(e)):Ul(e);break;default:Ul(e)}}function Eo(e){var i=e.deletions;if((e.flags&16)!==0){if(i!==null)for(var r=0;r<i.length;r++){var n=i[r];Nt=n,um(n,e)}om(e)}for(e=e.child;e!==null;){switch(i=e,i.tag){case 0:case 11:case 15:ir(8,i,i.return),Eo(i);break;case 22:r=i.stateNode,r._visibility&2&&(r._visibility&=-3,Eo(i));break;default:Eo(i)}e=e.sibling}}function um(e,i){for(;Nt!==null;){var r=Nt;switch(r.tag){case 0:case 11:case 15:ir(8,r,i);break;case 23:case 22:if(r.memoizedState!==null&&r.memoizedState.cachePool!==null){var n=r.memoizedState.cachePool.pool;n!=null&&n.refCount++}break;case 24:bl(r.memoizedState.cache)}if(n=r.child,n!==null)n.return=r,Nt=n;else e:for(r=e;Nt!==null;){n=Nt;var o=n.sibling,c=n.return;if(Jg(n),n===r){Nt=null;break e}if(o!==null){o.return=c,Nt=o;break e}Nt=c}}}var ty={getCacheForType:function(e){var i=Kt(bt),r=i.data.get(e);return r===void 0&&(r=e(),i.data.set(e,r)),r},cacheSignal:function(){return Kt(bt).controller.signal}},iy=typeof WeakMap=="function"?WeakMap:Map,Ie=0,et=null,Le=null,He=0,Ge=0,wi=null,rr=!1,kn=!1,lh=!1,ks=0,gt=0,nr=0,Vr=0,xo=0,Ci=0,Nn=0,jl=null,_i=null,ah=!1,To=0,hm=0,Do=1/0,Mo=null,lr=null,ct=0,Zi=null,Xr=null,hs=0,oh=0,ch=null,fm=null,Ln=null,zn=null,Hn=null,ql=0,Ro=null;function Ei(){return(Ie&2)!==0&&He!==0?He&-He:le.T!==null?Sh():gd()}function dm(){if(Ci===0)if((He&536870912)===0||Ae){var e=Ne;Ne<<=1,(Ne&3932160)===0&&(Ne=262144),Ci=e}else Ci=536870912;return e=Pt.current,e!==null&&(e.flags|=32),Ci}function Un(e,i){if(i!=null){var r=e.stateNode,n=r.ref;n===null&&(n=r.ref=Gm(Cs(e.memoizedProps,r))),zn===null&&(zn=[]),zn.push(i.bind(null,n))}}function gi(e,i,r){(e===et&&(Ge===2||Ge===9)||e.cancelPendingCommit!==null)&&(jn(e,0),ar(e,He,Ci,!1)),al(e,r),((Ie&2)===0||e!==et)&&(e===et&&((Ie&2)===0&&(Vr|=r),gt===4&&ar(e,He,Ci,!1)),fs(e))}function _m(e,i,r){if((Ie&6)!==0)throw Error(a(327));var n=!r&&(i&127)===0&&(i&e.expiredLanes)===0||Ys(e,i),o=n?ny(e,i):hh(e,i,!0),c=n;do{if(o===0){kn&&!n&&ar(e,i,0,!1);break}else{if(r=e.current.alternate,c&&!sy(r)){o=hh(e,i,!1),c=!1;continue}if(o===2){if(c=i,e.errorRecoveryDisabledLanes&c)var _=0;else _=e.pendingLanes&-536870913,_=_!==0?_:_&536870912?536870912:0;if(_!==0){i=_;e:{var p=e;o=jl;var y=p.current.memoizedState.isDehydrated;if(y&&(jn(p,_).flags|=256),_=hh(p,_,!1),_!==2&&_!==6){if(lh&&!y){p.errorRecoveryDisabledLanes|=c,Vr|=c,o=4;break e}c=_i,_i=o,c!==null&&(_i===null?_i=c:_i.push.apply(_i,c))}o=_}if(c=!1,o!==2)continue}}if(o===1){jn(e,0),ar(e,i,0,!0);break}e:{switch(n=e,c=o,c){case 0:case 1:throw Error(a(345));case 4:if((i&4194048)!==i&&(i&62914560)!==i)break;case 6:ar(n,i,Ci,!rr);break e;case 2:_i=null;break;case 3:case 5:break;default:throw Error(a(329))}if((i&62914560)===i&&(o=To+300-Ft(),10<o)){if(ar(n,i,Ci,!rr),dt(n,0,!0)!==0)break e;hs=i,n.timeoutHandle=Oh(gm.bind(null,n,r,_i,Mo,ah,i,Ci,Vr,Nn,rr,c,"Throttled",-0,0),o);break e}gm(n,r,_i,Mo,ah,i,Ci,Vr,Nn,rr,c,null,-0,0)}}break}while(!0);fs(e)}function gm(e,i,r,n,o,c,_,p,y,R,L,Y,D,N){e.timeoutHandle=-1;var ae=i.subtreeFlags,de=(c&335544064)===c;if(Y=null,(de||ae&8192||(ae&16785408)===16785408)&&(Y={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:is},bi=null,am(i,c,Y),de&&(ae=Y,de=e.containerInfo,de=(de.nodeType===9?de:de.ownerDocument).__reactViewTransition,de!=null&&(ae.count++,ae.waitingForViewTransition=!0,ae=Wl.bind(ae),de.finished.then(ae,ae))),ae=(c&62914560)===c?To-Ft():(c&4194048)===c?hm-Ft():0,ae=a1(Y,ae),ae!==null)){hs=c,e.cancelPendingCommit=ae(Cm.bind(null,e,i,c,r,n,o,_,p,y,R,L,Y,null,D,N)),ar(e,c,_,!R);return}Cm(e,i,c,r,n,o,_,p,y,R,L,Y)}function sy(e){for(var i=e;;){var r=i.tag;if((r===0||r===11||r===15)&&i.flags&16384&&(r=i.updateQueue,r!==null&&(r=r.stores,r!==null)))for(var n=0;n<r.length;n++){var o=r[n],c=o.getSnapshot;o=o.value;try{if(!Si(c(),o))return!1}catch{return!1}}if(r=i.child,i.subtreeFlags&16384&&r!==null)r.return=i,i=r;else{if(i===e)break;for(;i.sibling===null;){if(i.return===null||i.return===e)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function ar(e,i,r,n){i=Vi(e,i),i&=~xo,i&=~Vr,e.suspendedLanes|=i,e.pingedLanes&=~i,n&&(e.warmLanes|=i),n=e.expirationTimes;for(var o=i;0<o;){var c=31-ti(o),_=1<<c;n[c]=-1,o&=~_}r!==0&&fd(e,r,i)}function Oo(){return(Ie&6)===0?(Yl(0),!1):!0}function uh(){if(Le!==null){if(Ge===0)var e=Le.return;else e=Le,Ds=kr=null,pu(e),xn=null,El=0,e=Le;for(;e!==null;)Ug(e.alternate,e),e=e.return;Le=null}}function jn(e,i){var r=e.timeoutHandle;return r!==-1&&(e.timeoutHandle=-1,Dy(r)),r=e.cancelPendingCommit,r!==null&&(e.cancelPendingCommit=null,r()),hs=0,uh(),et=e,Le=r=xs(e.current,null),He=i,Ge=0,wi=null,rr=!1,kn=Ys(e,i),lh=!1,Nn=Ci=xo=Vr=nr=gt=0,_i=jl=null,ah=!1,ks=Vi(e,i),Ha(),r}function mm(e,i){Me=null,le.H=oo,i===En||i===Wa?(i=C_(),Ge=3):i===nu?(i=C_(),Ge=4):Ge=i===ku?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,wi=i,Le===null&&(gt=1,co(e,Bi(i,e.current)))}function vm(){var e=Pt.current;return e===null?!0:(He&4194048)===He?Zt===null:(He&62914560)===He||(He&536870912)!==0?e===Zt:!1}function pm(){var e=le.H;return le.H=oo,e===null?oo:e}function Sm(){var e=le.A;return le.A=ty,e}function Ao(){gt=4,rr||(He&4194048)!==He&&Pt.current!==null||(kn=!0),(nr&134217727)===0&&(Vr&134217727)===0||et===null||ar(et,He,Ci,!1)}function hh(e,i,r){var n=Ie;Ie|=2;var o=pm(),c=Sm();(et!==e||He!==i)&&(Mo=null,jn(e,i)),i=!1;var _=gt;e:do try{if(Ge!==0&&Le!==null){var p=Le,y=wi;switch(Ge){case 8:uh(),_=6;break e;case 3:case 2:case 9:case 6:Pt.current===null&&(i=!0);var R=Ge;if(Ge=0,wi=null,qn(e,p,y,R),r&&kn){_=0;break e}break;default:R=Ge,Ge=0,wi=null,qn(e,p,y,R)}}ry(),_=gt;break}catch(L){mm(e,L)}while(!0);return i&&e.shellSuspendCounter++,Ds=kr=null,Ie=n,le.H=o,le.A=c,Le===null&&(et=null,He=0,Ha()),_}function ry(){for(;Le!==null;)ym(Le)}function ny(e,i){var r=Ie;Ie|=2;var n=pm(),o=Sm();et!==e||He!==i?(Mo=null,Do=Ft()+500,jn(e,i)):kn=Ys(e,i);e:do try{if(Ge!==0&&Le!==null){i=Le;var c=wi;t:switch(Ge){case 1:Ge=0,wi=null,qn(e,i,c,1);break;case 2:case 9:if(b_(c)){Ge=0,wi=null,bm(i);break}i=function(){Ge!==2&&Ge!==9||et!==e||(Ge=7),fs(e)},c.then(i,i);break e;case 3:Ge=7;break e;case 4:Ge=5;break e;case 7:b_(c)?(Ge=0,wi=null,bm(i)):(Ge=0,wi=null,qn(e,i,c,7));break;case 5:var _=null;switch(Le.tag){case 26:_=Le.memoizedState;case 5:case 27:var p=Le;if(_?fv(_):p.stateNode.complete){Ge=0,wi=null;var y=p.sibling;if(y!==null)Le=y;else{var R=p.return;R!==null?(Le=R,Bo(R)):Le=null}break t}}Ge=0,wi=null,qn(e,i,c,5);break;case 6:Ge=0,wi=null,qn(e,i,c,6);break;case 8:uh(),gt=6;break e;default:throw Error(a(462))}}ly();break}catch(L){mm(e,L)}while(!0);return Ds=kr=null,le.H=n,le.A=o,Ie=r,Le!==null?0:(et=null,He=0,Ha(),gt)}function ly(){for(;Le!==null&&!ci();)ym(Le)}function ym(e){var i=zg(e.alternate,e,ks);e.memoizedProps=e.pendingProps,i===null?Bo(e):Le=i}function bm(e){var i=e,r=i.alternate;switch(i.tag){case 15:case 0:i=Rg(r,i,i.pendingProps,i.type,void 0,He);break;case 11:i=Rg(r,i,i.pendingProps,i.type.render,i.ref,He);break;case 5:pu(i);var n=i;n===Bt&&(Ae?(Pa(n),n.tag===5&&n.stateNode!=null&&(it=n.stateNode)):(Pa(n),Ae=!0));default:Ug(r,i),i=Le=u_(i,ks),i=zg(r,i,ks)}e.memoizedProps=e.pendingProps,i===null?Bo(e):Le=i}function qn(e,i,r,n){Ds=kr=null,pu(i),xn=null,El=0;var o=i.return;try{if(GS(e,o,i,r,He)){gt=1,co(e,Bi(r,e.current)),Le=null;return}}catch(c){if(o!==null)throw Le=o,c;gt=1,co(e,Bi(r,e.current)),Le=null;return}i.flags&32768?(Ae||n===1?e=!0:kn||(He&536870912)!==0?e=!1:(rr=e=!0,(n===2||n===9||n===3||n===6)&&(n=Pt.current,n!==null&&n.tag===13&&(n.flags|=16384))),wm(i,e)):Bo(i)}function Bo(e){var i=e;do{if((i.flags&32768)!==0){wm(i,rr);return}e=i.return;var r=QS(i.alternate,i,ks);if(r!==null){Le=r;return}if(i=i.sibling,i!==null){Le=i;return}Le=i=e}while(i!==null);gt===0&&(gt=5)}function wm(e,i){do{var r=$S(e.alternate,e);if(r!==null){r.flags&=32767,Le=r;return}if(r=e.return,r!==null&&(r.flags|=32768,r.subtreeFlags=0,r.deletions=null),!i&&(e=e.sibling,e!==null)){Le=e;return}Le=e=r}while(e!==null);gt=6,Le=null}function Cm(e,i,r,n,o,c,_,p,y,R,L,Y){e.cancelPendingCommit=null;do ko();while(ct!==0);if((Ie&6)!==0)throw Error(a(327));if(i!==null){if(i===e.current)throw Error(a(177));e===et&&(Le=et=null,He=0),Xr=i,Zi=e,hs=r,ch=o,fm=n,ay(e,i,r,_,p,y,Y)}}function ay(e,i,r,n,o,c,_){var p=i.lanes|i.childLanes;if(oh=p,p|=Xc,k0(e,r,p,n,o,c),zn=null,(r&335544064)===r?(Hn=LS(e),n=10262):(Hn=null,n=10256),(i.subtreeFlags&n)!==0||(i.flags&n)!==0?(e.callbackNode=null,e.callbackPriority=0,dy(Ji,function(){return gh(),null})):(e.callbackNode=null,e.callbackPriority=0),po=!1,n=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||n){n=le.T,le.T=null,o=X.p,X.p=2,c=Ie,Ie|=4;try{JS(e,i,r)}finally{Ie=c,X.p=o,le.T=n}}ct=1,po?Ln=ky(_,e.containerInfo,Hn,fh,dh,cy,_h,gh,oy):(fh(),dh(),_h())}function oy(e){if(ct!==0){var i=Zi.onRecoverableError;i(e,{componentStack:null})}}function cy(){ct===3&&(ct=0,nm(Xr,Zi),ct=4)}function fh(){if(ct===1){ct=0;var e=Zi,i=Xr,r=hs,n=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||n){n=le.T,le.T=null;var o=X.p;X.p=2;var c=Ie;Ie|=4;try{zl=bo=!1,sm(i,e,r),r=Dh;var _=e_(e.containerInfo),p=r.focusedElem,y=r.selectionRange;if(_!==p&&p&&p.ownerDocument&&Jd(p.ownerDocument.documentElement,p)){if(y!==null&&Yc(p)){var R=y.start,L=y.end;if(L===void 0&&(L=R),"selectionStart"in p)p.selectionStart=R,p.selectionEnd=Math.min(L,p.value.length);else{var Y=p.ownerDocument||document,D=Y&&Y.defaultView||window;if(D.getSelection){var N=D.getSelection(),ae=p.textContent.length,de=Math.min(y.start,ae),Re=y.end===void 0?de:Math.min(y.end,ae);!N.extend&&de>Re&&(_=Re,Re=de,de=_);var M=$d(p,de),x=$d(p,Re);if(M&&x&&(N.rangeCount!==1||N.anchorNode!==M.node||N.anchorOffset!==M.offset||N.focusNode!==x.node||N.focusOffset!==x.offset)){var A=Y.createRange();A.setStart(M.node,M.offset),N.removeAllRanges(),de>Re?(N.addRange(A),N.extend(x.node,x.offset)):(A.setEnd(x.node,x.offset),N.addRange(A))}}}}for(Y=[],N=p;N=N.parentNode;)N.nodeType===1&&Y.push({element:N,left:N.scrollLeft,top:N.scrollTop});for(typeof p.focus=="function"&&p.focus(),p=0;p<Y.length;p++){var q=Y[p];q.element.scrollLeft=q.left,q.element.scrollTop=q.top}}Wn=!!Th,Dh=Th=null}finally{Ie=c,X.p=o,le.T=n}}e.current=i,ct=2}}function dh(){if(ct===2){ct=0;var e=Zi,i=Xr,r=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||r){r=le.T,le.T=null;var n=X.p;X.p=2;var o=Ie;Ie|=4;try{Qg(e,i.alternate,i)}finally{Ie=o,X.p=n,le.T=r}}ct=3}}function _h(){if(ct===4||ct===3){ct=0;var e=Ln;Ln=null,ln();var i=Zi,r=Xr,n=hs,o=fm,c=(n&335544064)===n?10262:10256;if((r.subtreeFlags&c)!==0||(r.flags&c)!==0?ct=5:(ct=0,Xr=Zi=null,Em(i,i.pendingLanes)),c=i.pendingLanes,c===0&&(lr=null),Cc(n),r=r.stateNode,ei&&typeof ei.onCommitFiberRoot=="function")try{ei.onCommitFiberRoot(qs,r,void 0,(r.current.flags&128)===128)}catch{}if(o!==null){r=le.T,c=X.p,X.p=2,le.T=null;try{for(var _=i.onRecoverableError,p=0;p<o.length;p++){var y=o[p];_(y.value,{componentStack:y.stack})}}finally{le.T=r,X.p=c}}if(o=zn,_=Hn,Hn=null,o!==null&&(zn=null,_===null&&(_=[]),e!==null))for(y=0;y<o.length;y++)r=(0,o[y])(_),r!==void 0&&e.finished.finally(r);(hs&3)!==0&&ko(),fs(i),c=i.pendingLanes,(n&261930)!==0&&(c&42)!==0?i===Ro?ql++:(ql=0,Ro=i):(ql=0,Ro=null),Yl(0)}}function Em(e,i){(e.pooledCacheLanes&=i)===0&&(i=e.pooledCache,i!=null&&(e.pooledCache=null,bl(i)))}function ko(){return Ln!==null&&(Ln.skipTransition(),Ln=null),fh(),dh(),_h(),gh()}function gh(){if(ct!==5)return!1;var e=Zi,i=oh;oh=0;var r=Cc(hs),n=le.T,o=X.p;try{X.p=32>r?32:r,le.T=null,r=ch,ch=null;var c=Zi,_=hs;if(ct=0,Xr=Zi=null,hs=0,(Ie&6)!==0)throw Error(a(331));var p=Ie;if(Ie|=4,cm(c.current),lm(c,c.current,_,r),Ie=p,Yl(0,!1),ei&&typeof ei.onPostCommitFiberRoot=="function")try{ei.onPostCommitFiberRoot(qs,c)}catch{}return!0}finally{X.p=o,le.T=n,Em(e,i)}}function xm(e,i,r){i=Bi(r,i),i=Bu(e.stateNode,i,2),e=$s(e,i,2),e!==null&&(al(e,2),fs(e))}function We(e,i,r){if(e.tag===3)xm(e,e,r);else for(;i!==null;){if(i.tag===3){xm(i,e,r);break}else if(i.tag===1){var n=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(lr===null||!lr.has(n))){e=Bi(r,e),r=bg(2),n=$s(i,r,2),n!==null&&(wg(r,n,i,e),al(n,2),fs(n));break}}i=i.return}}function mh(e,i,r){var n=e.pingCache;if(n===null){n=e.pingCache=new iy;var o=new Set;n.set(i,o)}else o=n.get(i),o===void 0&&(o=new Set,n.set(i,o));o.has(r)||(lh=!0,o.add(r),e=uy.bind(null,e,i,r),i.then(e,e))}function uy(e,i,r){var n=e.pingCache;n!==null&&n.delete(i),e.pingedLanes|=e.suspendedLanes&r,e.warmLanes&=~r,et===e&&(He&r)===r&&((gt===4||gt===3&&(He&62914560)===He&&300>Ft()-To)&&(Ie&2)===0?jn(e,0):xo|=r,Nn===He&&(Nn=0)),fs(e)}function Tm(e,i){i===0&&(i=Ea()),e=Or(e,i),e!==null&&(al(e,i),fs(e))}function hy(e){var i=e.memoizedState,r=0;i!==null&&(r=i.retryLane),Tm(e,r)}function fy(e,i){var r=0;switch(e.tag){case 31:case 13:var n=e.stateNode,o=e.memoizedState;o!==null&&(r=o.retryLane);break;case 19:n=e.stateNode;break;case 22:n=e.stateNode._retryCache;break;default:throw Error(a(314))}n!==null&&n.delete(i),Tm(e,r)}function dy(e,i){return Je(e,i)}var Yn=null,Kn=null,vh=!1,No=!1,ph=!1,or=0;function fs(e){e!==Kn&&e.next===null&&(Kn===null?Yn=Kn=e:Kn=Kn.next=e),No=!0,vh||(vh=!0,gy())}function Yl(e,i){if(!ph&&No){ph=!0;do for(var r=!1,n=Yn;n!==null;){if(e!==0){var o=n.pendingLanes;if(o===0)var c=0;else{var _=n.suspendedLanes,p=n.pingedLanes;c=(1<<31-ti(42|e)+1)-1,c&=o&~(_&~p),c=c&201326741?c&201326741|1:c?c|2:0}c!==0&&(r=!0,Om(n,c))}else c=He,c=dt(n,n===et?c:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),(c&3)===0||Ys(n,c)||(r=!0,Om(n,c));n=n.next}while(r);ph=!1}}function _y(){Dm()}function Dm(){No=vh=!1;var e=0;or!==0&&Ty()&&(e=or);for(var i=Ft(),r=null,n=Yn;n!==null;){var o=n.next,c=Mm(n,i);c===0?(n.next=null,r===null?Yn=o:r.next=o,o===null&&(Kn=r)):(r=n,(e!==0||(c&3)!==0)&&(No=!0)),n=o}ct!==0&&ct!==5||Yl(e),or!==0&&(or=0)}function Mm(e,i){for(var r=e.suspendedLanes,n=e.pingedLanes,o=e.expirationTimes,c=e.pendingLanes&-62914561;0<c;){var _=31-ti(c),p=1<<_,y=o[_];y===-1?((p&r)===0||(p&n)!==0)&&(o[_]=Ks(p,i)):y<=i&&(e.expiredLanes|=p),c&=~p}if(i=et,r=He,r=dt(e,e===i?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),n=e.callbackNode,r===0||e===i&&(Ge===2||Ge===9)||e.cancelPendingCommit!==null)return n!==null&&n!==null&&Se(n),e.callbackNode=null,e.callbackPriority=0;if((r&3)===0||Ys(e,r)){if(i=r&-r,i===e.callbackPriority)return i;switch(n!==null&&Se(n),Cc(r)){case 2:case 8:r=wa;break;case 32:r=Ji;break;case 268435456:r=nl;break;default:r=Ji}return n=Rm.bind(null,e),r=Je(r,n),e.callbackPriority=i,e.callbackNode=r,i}return n!==null&&n!==null&&Se(n),e.callbackPriority=2,e.callbackNode=null,2}function Rm(e,i){if(ct!==0&&ct!==5)return e.callbackNode=null,e.callbackPriority=0,null;var r=e.callbackNode;if(ko()&&e.callbackNode!==r)return null;var n=He;return n=dt(e,e===et?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),n===0?null:(_m(e,n,i),Mm(e,Ft()),e.callbackNode!=null&&e.callbackNode===r?Rm.bind(null,e):null)}function Om(e,i){if(ko())return null;_m(e,i,!0)}function gy(){My(function(){(Ie&6)!==0?Je(ba,_y):Dm()})}function Sh(){if(or===0){var e=zr;e===0&&(e=xr,xr<<=1,(xr&261888)===0&&(xr=256)),or=e}return or}function Am(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Ra(e)}function my(e,i,r,n,o){if(i==="submit"&&r&&r.stateNode===o){var c=Am((o[ui]||null).action),_=n.submitter;_&&(i=(i=_[ui]||null)?Am(i.formAction):_.getAttribute("formAction"),i!==null&&(c=i,_=null));var p=new ka("action","action",null,n,o);e.push({event:p,listeners:[{instance:null,listener:function(){if(n.defaultPrevented){if(or!==0){var y=new FormData(o,_);Du(r,{pending:!0,data:y,method:o.method,action:c},null,y)}}else typeof c=="function"&&(p.preventDefault(),y=new FormData(o,_),Du(r,{pending:!0,data:y,method:o.method,action:c},c,y))},currentTarget:o}]})}}for(var yh=0;yh<Vc.length;yh++){var bh=Vc[yh],vy=bh.toLowerCase(),py=bh[0].toUpperCase()+bh.slice(1);Xi(vy,"on"+py)}Xi(s_,"onAnimationEnd"),Xi(r_,"onAnimationIteration"),Xi(n_,"onAnimationStart"),Xi("dblclick","onDoubleClick"),Xi("focusin","onFocus"),Xi("focusout","onBlur"),Xi(DS,"onTransitionRun"),Xi(MS,"onTransitionStart"),Xi(RS,"onTransitionCancel"),Xi(l_,"onTransitionEnd"),un("onMouseEnter",["mouseout","mouseover"]),un("onMouseLeave",["mouseout","mouseover"]),un("onPointerEnter",["pointerout","pointerover"]),un("onPointerLeave",["pointerout","pointerover"]),Dr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Dr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Dr("onBeforeInput",["compositionend","keypress","textInput","paste"]),Dr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Dr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Dr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Kl="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(" "),Sy=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Kl));function Bm(e,i){i=(i&4)!==0;for(var r=0;r<e.length;r++){var n=e[r],o=n.event;n=n.listeners;e:{var c=void 0;if(i)for(var _=n.length-1;0<=_;_--){var p=n[_],y=p.instance,R=p.currentTarget;if(p=p.listener,y!==c&&o.isPropagationStopped())break e;c=p,o.currentTarget=R;try{c(o)}catch(L){za(L)}o.currentTarget=null,c=y}else for(_=0;_<n.length;_++){if(p=n[_],y=p.instance,R=p.currentTarget,p=p.listener,y!==c&&o.isPropagationStopped())break e;c=p,o.currentTarget=R;try{c(o)}catch(L){za(L)}o.currentTarget=null,c=y}}}}function ze(e,i){var r=i[vd];r===void 0&&(r=i[vd]=new Set);var n=e+"__bubble";r.has(n)||(km(i,e,2,!1),r.add(n))}function wh(e,i,r){var n=0;i&&(n|=4),km(r,e,n,i)}var Lo="_reactListening"+Math.random().toString(36).slice(2);function Ch(e){if(!e[Lo]){e[Lo]=!0,yd.forEach(function(r){r!=="selectionchange"&&(Sy.has(r)||wh(r,!1,e),wh(r,!0,e))});var i=e.nodeType===9?e:e.ownerDocument;i===null||i[Lo]||(i[Lo]=!0,wh("selectionchange",!1,i))}}function km(e,i,r,n){switch(wv(i)){case 2:var o=h1;break;case 8:o=f1;break;default:o=Ph}r=o.bind(null,i,r,e),o=void 0,!Ac||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(o=!0),n?o!==void 0?e.addEventListener(i,r,{capture:!0,passive:o}):e.addEventListener(i,r,!0):o!==void 0?e.addEventListener(i,r,{passive:o}):e.addEventListener(i,r,!1)}function Eh(e,i,r,n,o){var c=n;if((i&1)===0&&(i&2)===0&&n!==null)e:for(;;){if(n===null)return;var _=n.tag;if(_===3||_===4){var p=n.stateNode.containerInfo;if(p===o)break;if(_===4)for(_=n.return;_!==null;){var y=_.tag;if((y===3||y===4)&&_.stateNode.containerInfo===o)return;_=_.return}for(;p!==null;){if(_=Tr(p),_===null)return;if(y=_.tag,y===5||y===6||y===26||y===27){n=c=_;continue e}p=p.parentNode}}n=n.return}kd(function(){var R=c,L=Rc(r),Y=[];e:{var D=a_.get(e);if(D!==void 0){var N=ka,ae=e;switch(e){case"keypress":if(Aa(r)===0)break e;case"keydown":case"keyup":N=sS;break;case"focusin":ae="focus",N=Lc;break;case"focusout":ae="blur",N=Lc;break;case"beforeblur":case"afterblur":N=Lc;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":N=zd;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":N=V0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":N=oS;break;case s_:case r_:case n_:N=W0;break;case l_:N=uS;break;case"scroll":case"scrollend":N=P0;break;case"wheel":N=fS;break;case"copy":case"cut":case"paste":N=Z0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":N=Ud;break;case"submit":N=lS;break;case"toggle":case"beforetoggle":N=_S}var de=(i&4)!==0,Re=!de&&(e==="scroll"||e==="scrollend"),M=de?D!==null?D+"Capture":null:D;de=[];for(var x=R,A;x!==null;){var q=x;if(A=q.stateNode,q=q.tag,q!==5&&q!==26&&q!==27||A===null||M===null||(q=ul(x,M),q!=null&&de.push(Pl(x,q,A))),Re)break;x=x.return}0<de.length&&(D=new N(D,ae,null,r,L),Y.push({event:D,listeners:de}))}}if((i&7)===0){e:{if(N=e==="mouseover"||e==="pointerover",D=e==="mouseout"||e==="pointerout",N&&r!==Mc&&(ae=r.relatedTarget||r.fromElement)&&(Tr(ae)||ae[an]))break e;(D||N)&&(ae=L.window===L?L:(N=L.ownerDocument)?N.defaultView||N.parentWindow:window,D?(N=r.relatedTarget||r.toElement,D=R,N=N?Tr(N):null,N!==null&&(Re=h(N),de=N.tag,N!==Re||de!==5&&de!==27&&de!==6)&&(N=null)):(D=null,N=R),D!==N&&(de=zd,q="onMouseLeave",M="onMouseEnter",x="mouse",(e==="pointerout"||e==="pointerover")&&(de=Ud,q="onPointerLeave",M="onPointerEnter",x="pointer"),Re=D==null?ae:cl(D),A=N==null?ae:cl(N),ae=new de(q,x+"leave",D,r,L),ae.target=Re,ae.relatedTarget=A,q=null,Tr(L)===R&&(de=new de(M,x+"enter",N,r,L),de.target=A,de.relatedTarget=Re,q=de),Re=q,de=D&&N?oe(D,N,yy):null,D!==null&&Nm(Y,ae,D,de,!1),N!==null&&Re!==null&&Nm(Y,Re,N,de,!0)))}e:{if(D=R?cl(R):window,N=D.nodeName&&D.nodeName.toLowerCase(),N==="select"||N==="input"&&D.type==="file")var fe=Xd;else if(Id(D))if(Gd)fe=ES;else{fe=wS;var Ue=bS}else N=D.nodeName,!N||N.toLowerCase()!=="input"||D.type!=="checkbox"&&D.type!=="radio"?R&&Dc(R.elementType)&&(fe=Xd):fe=CS;if(fe&&(fe=fe(e,R))){Vd(Y,fe,r,L);break e}Ue&&Ue(e,D,R)}switch(Ue=R?cl(R):window,e){case"focusin":(Id(Ue)||Ue.contentEditable==="true")&&(mn=Ue,Kc=R,pl=null);break;case"focusout":pl=Kc=mn=null;break;case"mousedown":Pc=!0;break;case"contextmenu":case"mouseup":case"dragend":Pc=!1,t_(Y,r,L);break;case"selectionchange":if(TS)break;case"keydown":case"keyup":t_(Y,r,L)}var pe;if(Hc)e:{switch(e){case"compositionstart":var xe="onCompositionStart";break e;case"compositionend":xe="onCompositionEnd";break e;case"compositionupdate":xe="onCompositionUpdate";break e}xe=void 0}else gn?Kd(e,r)&&(xe="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(xe="onCompositionStart");xe&&(jd&&r.locale!=="ko"&&(gn||xe!=="onCompositionStart"?xe==="onCompositionEnd"&&gn&&(pe=Nd()):(Ps=L,Bc="value"in Ps?Ps.value:Ps.textContent,gn=!0)),Ue=zo(R,xe),0<Ue.length&&(xe=new Hd(xe,e,null,r,L),Y.push({event:xe,listeners:Ue}),pe?xe.data=pe:(pe=Pd(r),pe!==null&&(xe.data=pe)))),(pe=mS?vS(e,r):pS(e,r))&&(xe=zo(R,"onBeforeInput"),0<xe.length&&(Ue=new Hd("onBeforeInput","beforeinput",null,r,L),Y.push({event:Ue,listeners:xe}),Ue.data=pe)),my(Y,e,R,r,L)}Bm(Y,i)})}function Pl(e,i,r){return{instance:e,listener:i,currentTarget:r}}function zo(e,i){for(var r=i+"Capture",n=[];e!==null;){var o=e,c=o.stateNode;if(o=o.tag,o!==5&&o!==26&&o!==27||c===null||(o=ul(e,r),o!=null&&n.unshift(Pl(e,o,c)),o=ul(e,i),o!=null&&n.push(Pl(e,o,c))),e.tag===3)return n;e=e.return}return[]}function yy(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Nm(e,i,r,n,o){for(var c=i._reactName,_=[];r!==null&&r!==n;){var p=r,y=p.alternate,R=p.stateNode;if(p=p.tag,y!==null&&y===n)break;p!==5&&p!==26&&p!==27||R===null||(y=R,o?(R=ul(r,c),R!=null&&_.unshift(Pl(r,R,y))):o||(R=ul(r,c),R!=null&&_.push(Pl(r,R,y)))),r=r.return}_.length!==0&&e.push({event:i,listeners:_})}var by=/\r\n?/g,wy=/\u0000|\uFFFD/g;function Lm(e){return(typeof e=="string"?e:""+e).replace(by,`
9
+ `).replace(wy,"")}function zm(e,i){return i=Lm(i),Lm(e)===i}function Fe(e,i,r,n,o,c){switch(r){case"children":if(typeof n=="string")i==="body"||i==="textarea"&&n===""||fn(e,n);else if(typeof n=="number"||typeof n=="bigint")i!=="body"&&fn(e,""+n);else return;break;case"className":Ma(e,"class",n);break;case"tabIndex":Ma(e,"tabindex",n);break;case"dir":case"role":case"viewBox":case"width":case"height":Ma(e,r,n);break;case"style":Ad(e,n,c);return;case"data":if(i!=="object"){Ma(e,"data",n);break}case"src":case"href":if(n===""&&(i!=="a"||r!=="href")){e.removeAttribute(r);break}if(n==null||typeof n=="function"||typeof n=="symbol"||typeof n=="boolean"){e.removeAttribute(r);break}n=Ra(n),e.setAttribute(r,n);break;case"action":case"formAction":if(typeof n=="function"){e.setAttribute(r,"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 c=="function"&&(r==="formAction"?(i!=="input"&&Fe(e,i,"name",o.name,o,null),Fe(e,i,"formEncType",o.formEncType,o,null),Fe(e,i,"formMethod",o.formMethod,o,null),Fe(e,i,"formTarget",o.formTarget,o,null)):(Fe(e,i,"encType",o.encType,o,null),Fe(e,i,"method",o.method,o,null),Fe(e,i,"target",o.target,o,null)));if(n==null||typeof n=="symbol"||typeof n=="boolean"){e.removeAttribute(r);break}n=Ra(n),e.setAttribute(r,n);break;case"onClick":n!=null&&(e.onclick=is);return;case"onScroll":n!=null&&ze("scroll",e);return;case"onScrollEnd":n!=null&&ze("scrollend",e);return;case"dangerouslySetInnerHTML":if(n!=null){if(typeof n!="object"||!("__html"in n))throw Error(a(61));if(r=n.__html,r!=null){if(o.children!=null)throw Error(a(60));c?.__html!==r&&(e.innerHTML=r)}}break;case"multiple":e.multiple=n&&typeof n!="function"&&typeof n!="symbol";break;case"muted":e.muted=n&&typeof n!="function"&&typeof n!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(n==null||typeof n=="function"||typeof n=="boolean"||typeof n=="symbol"){e.removeAttribute("xlink:href");break}r=Ra(n),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",r);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":n!=null&&typeof n!="function"&&typeof n!="symbol"?e.setAttribute(r,n):e.removeAttribute(r);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"credentialless":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":n&&typeof n!="function"&&typeof n!="symbol"?e.setAttribute(r,""):e.removeAttribute(r);break;case"capture":case"download":n===!0?e.setAttribute(r,""):n!==!1&&n!=null&&typeof n!="function"&&typeof n!="symbol"?e.setAttribute(r,n):e.removeAttribute(r);break;case"cols":case"rows":case"size":case"span":n!=null&&typeof n!="function"&&typeof n!="symbol"&&!isNaN(n)&&1<=n?e.setAttribute(r,n):e.removeAttribute(r);break;case"rowSpan":case"start":n==null||typeof n=="function"||typeof n=="symbol"||isNaN(n)?e.removeAttribute(r):e.setAttribute(r,n);break;case"popover":ze("beforetoggle",e),ze("toggle",e),Da(e,"popover",n);break;case"xlinkActuate":bs(e,"http://www.w3.org/1999/xlink","xlink:actuate",n);break;case"xlinkArcrole":bs(e,"http://www.w3.org/1999/xlink","xlink:arcrole",n);break;case"xlinkRole":bs(e,"http://www.w3.org/1999/xlink","xlink:role",n);break;case"xlinkShow":bs(e,"http://www.w3.org/1999/xlink","xlink:show",n);break;case"xlinkTitle":bs(e,"http://www.w3.org/1999/xlink","xlink:title",n);break;case"xlinkType":bs(e,"http://www.w3.org/1999/xlink","xlink:type",n);break;case"xmlBase":bs(e,"http://www.w3.org/XML/1998/namespace","xml:base",n);break;case"xmlLang":bs(e,"http://www.w3.org/XML/1998/namespace","xml:lang",n);break;case"xmlSpace":bs(e,"http://www.w3.org/XML/1998/namespace","xml:space",n);break;case"is":Da(e,"is",n);break;case"innerText":case"textContent":return;default:if(!(2<r.length)||r[0]!=="o"&&r[0]!=="O"||r[1]!=="n"&&r[1]!=="N")r=Y0.get(r)||r,Da(e,r,n);else return}Ke=!0}function xh(e,i,r,n,o,c){switch(r){case"style":Ad(e,n,c);return;case"dangerouslySetInnerHTML":if(n!=null){if(typeof n!="object"||!("__html"in n))throw Error(a(61));if(r=n.__html,r!=null){if(o.children!=null)throw Error(a(60));c?.__html!==r&&(e.innerHTML=r)}}break;case"children":if(typeof n=="string")fn(e,n);else if(typeof n=="number"||typeof n=="bigint")fn(e,""+n);else return;break;case"onScroll":n!=null&&ze("scroll",e);return;case"onScrollEnd":n!=null&&ze("scrollend",e);return;case"onClick":n!=null&&(e.onclick=is);return;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":return;case"innerText":case"textContent":return;default:if(!bd.hasOwnProperty(r))e:{if(r[0]==="o"&&r[1]==="n"&&(o=r.endsWith("Capture"),c=r.slice(2,o?r.length-7:void 0),i=e[ui]||null,i=i!=null?i[r]:null,typeof i=="function"&&e.removeEventListener(c,i,o),typeof n=="function")){typeof i!="function"&&i!==null&&(r in e?e[r]=null:e.hasAttribute(r)&&e.removeAttribute(r)),e.addEventListener(c,n,o);break e}Ke=!0,r in e?e[r]=n:n===!0?e.setAttribute(r,""):Da(e,r,n)}return}Ke=!0}function Xt(e,i,r){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ze("error",e),ze("load",e);var n=!1,o=!1,c;for(c in r)if(r.hasOwnProperty(c)){var _=r[c];if(_!=null)switch(c){case"src":n=!0;break;case"srcSet":o=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:Fe(e,i,c,_,r,null)}}o&&Fe(e,i,"srcSet",r.srcSet,r,null),n&&Fe(e,i,"src",r.src,r,null);return;case"input":ze("invalid",e);var p=c=_=o=null,y=null,R=null;for(n in r)if(r.hasOwnProperty(n)){var L=r[n];if(L!=null)switch(n){case"name":o=L;break;case"type":_=L;break;case"checked":y=L;break;case"defaultChecked":R=L;break;case"value":c=L;break;case"defaultValue":p=L;break;case"children":case"dangerouslySetInnerHTML":if(L!=null)throw Error(a(137,i));break;default:Fe(e,i,n,L,r,null)}}Dd(e,c,p,y,R,_,o,!1);return;case"select":ze("invalid",e),n=_=c=null;for(o in r)if(r.hasOwnProperty(o)&&(p=r[o],p!=null))switch(o){case"value":c=p;break;case"defaultValue":_=p;break;case"multiple":n=p;default:Fe(e,i,o,p,r,null)}i=c,r=_,e.multiple=!!n,i!=null?hn(e,!!n,i,!1):r!=null&&hn(e,!!n,r,!0);return;case"textarea":ze("invalid",e),c=o=n=null;for(_ in r)if(r.hasOwnProperty(_)&&(p=r[_],p!=null))switch(_){case"value":n=p;break;case"defaultValue":o=p;break;case"children":c=p;break;case"dangerouslySetInnerHTML":if(p!=null)throw Error(a(91));break;default:Fe(e,i,_,p,r,null)}Rd(e,n,o,c);return;case"option":for(y in r)r.hasOwnProperty(y)&&(n=r[y],n!=null)&&(y==="selected"?e.selected=n&&typeof n!="function"&&typeof n!="symbol":Fe(e,i,y,n,r,null));return;case"dialog":ze("beforetoggle",e),ze("toggle",e),ze("cancel",e),ze("close",e);break;case"iframe":case"object":ze("load",e);break;case"video":case"audio":for(n=0;n<Kl.length;n++)ze(Kl[n],e);break;case"image":ze("error",e),ze("load",e);break;case"details":ze("toggle",e);break;case"embed":case"source":case"link":ze("error",e),ze("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(R in r)if(r.hasOwnProperty(R)&&(n=r[R],n!=null))switch(R){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:Fe(e,i,R,n,r,null)}return;default:if(Dc(i)){for(L in r)r.hasOwnProperty(L)&&(n=r[L],n!==void 0&&xh(e,i,L,n,r,void 0));return}}for(p in r)r.hasOwnProperty(p)&&(n=r[p],n!=null&&Fe(e,i,p,n,r,null))}var Cy={};function Ey(e,i,r,n){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var o=null,c=null,_=null,p=null,y=null,R=null,L=null;for(N in r){var Y=r[N];if(r.hasOwnProperty(N)&&Y!=null)switch(N){case"checked":break;case"value":break;case"defaultValue":y=Y;default:n.hasOwnProperty(N)||Fe(e,i,N,null,n,Y)}}for(var D in n){var N=n[D];if(Y=r[D],n.hasOwnProperty(D)&&(N!=null||Y!=null))switch(D){case"type":N!==Y&&(Ke=!0),c=N;break;case"name":N!==Y&&(Ke=!0),o=N;break;case"checked":N!==Y&&(Ke=!0),R=N;break;case"defaultChecked":N!==Y&&(Ke=!0),L=N;break;case"value":N!==Y&&(Ke=!0),_=N;break;case"defaultValue":N!==Y&&(Ke=!0),p=N;break;case"children":case"dangerouslySetInnerHTML":if(N!=null)throw Error(a(137,i));break;default:N!==Y&&Fe(e,i,D,N,n,Y)}}xc(e,_,p,y,R,L,c,o);return;case"select":N=_=p=D=null;for(c in r)if(y=r[c],r.hasOwnProperty(c)&&y!=null)switch(c){case"value":break;case"multiple":N=y;default:n.hasOwnProperty(c)||Fe(e,i,c,null,n,y)}for(o in n)if(c=n[o],y=r[o],n.hasOwnProperty(o)&&(c!=null||y!=null))switch(o){case"value":c!==y&&(Ke=!0),D=c;break;case"defaultValue":c!==y&&(Ke=!0),p=c;break;case"multiple":c!==y&&(Ke=!0),_=c;default:c!==y&&Fe(e,i,o,c,n,y)}i=p,r=_,n=N,D!=null?hn(e,!!r,D,!1):!!n!=!!r&&(i!=null?hn(e,!!r,i,!0):hn(e,!!r,r?[]:"",!1));return;case"textarea":N=D=null;for(p in r)if(o=r[p],r.hasOwnProperty(p)&&o!=null&&!n.hasOwnProperty(p))switch(p){case"value":break;case"children":break;default:Fe(e,i,p,null,n,o)}for(_ in n)if(o=n[_],c=r[_],n.hasOwnProperty(_)&&(o!=null||c!=null))switch(_){case"value":o!==c&&(Ke=!0),D=o;break;case"defaultValue":o!==c&&(Ke=!0),N=o;break;case"children":break;case"dangerouslySetInnerHTML":if(o!=null)throw Error(a(91));break;default:o!==c&&Fe(e,i,_,o,n,c)}Md(e,D,N);return;case"option":for(var ae in r)D=r[ae],r.hasOwnProperty(ae)&&D!=null&&!n.hasOwnProperty(ae)&&(ae==="selected"?e.selected=!1:Fe(e,i,ae,null,n,D));for(y in n)D=n[y],N=r[y],n.hasOwnProperty(y)&&D!==N&&(D!=null||N!=null)&&(y==="selected"?(D!==N&&(Ke=!0),e.selected=D&&typeof D!="function"&&typeof D!="symbol"):Fe(e,i,y,D,n,N));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 de in r)D=r[de],r.hasOwnProperty(de)&&D!=null&&!n.hasOwnProperty(de)&&Fe(e,i,de,null,n,D);for(R in n)if(D=n[R],N=r[R],n.hasOwnProperty(R)&&D!==N&&(D!=null||N!=null))switch(R){case"children":case"dangerouslySetInnerHTML":if(D!=null)throw Error(a(137,i));break;default:Fe(e,i,R,D,n,N)}return;default:if(Dc(i)){for(var Re in r)D=r[Re],r.hasOwnProperty(Re)&&D!==void 0&&!n.hasOwnProperty(Re)&&xh(e,i,Re,void 0,n,D);for(L in n)D=n[L],N=r[L],!n.hasOwnProperty(L)||D===N||D===void 0&&N===void 0||xh(e,i,L,D,n,N);return}}for(var M in r)D=r[M],r.hasOwnProperty(M)&&D!=null&&!n.hasOwnProperty(M)&&Fe(e,i,M,null,n,D);for(Y in n)D=n[Y],N=r[Y],!n.hasOwnProperty(Y)||D===N||D==null&&N==null||Fe(e,i,Y,D,n,N)}function Hm(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function xy(){if(typeof performance.getEntriesByType=="function"){for(var e=0,i=0,r=performance.getEntriesByType("resource"),n=0;n<r.length;n++){var o=r[n],c=o.transferSize,_=o.initiatorType,p=o.duration;if(c&&p&&Hm(_)){for(_=0,p=o.responseEnd,n+=1;n<r.length;n++){var y=r[n],R=y.startTime;if(R>p)break;var L=y.transferSize,Y=y.initiatorType;L&&Hm(Y)&&(y=y.responseEnd,_+=L*(y<p?1:(p-R)/(y-R)))}if(--n,i+=8*(c+_)/(o.duration/1e3),e++,10<e)break}}if(0<e)return i/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Th=null,Dh=null;function Il(e){return e.nodeType===9?e:e.ownerDocument}function Um(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function jm(e,i){if(e===0)switch(i){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&i==="foreignObject"?0:e}function qm(e,i,r,n){return r=Il(r).createElement(e),r[Yt]=n,r[ui]=i,Xt(r,e,i),At(r),r}function Mh(e,i){return e==="textarea"||e==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.children=="bigint"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var Rh=null;function Ty(){var e=window.event;return e&&e.type==="popstate"?e===Rh?!1:(Rh=e,!0):(Rh=null,!1)}var Oh=typeof setTimeout=="function"?setTimeout:void 0,Dy=typeof clearTimeout=="function"?clearTimeout:void 0,Ym=typeof Promise=="function"?Promise:void 0,Km=typeof requestAnimationFrame=="function"?requestAnimationFrame:Oh,My=typeof queueMicrotask=="function"?queueMicrotask:typeof Ym<"u"?function(e){return Ym.resolve(null).then(e).catch(Ry)}:Oh;function Ry(e){setTimeout(function(){throw e})}function cr(e){return e==="head"}function Pm(e,i){var r=i,n=0;do{var o=r.nextSibling;if(e.removeChild(r),o&&o.nodeType===8)if(r=o.data,r==="/$"||r==="/&"){if(n===0){e.removeChild(o),Fn(i);return}n--}else if(r==="$"||r==="$?"||r==="$~"||r==="$!"||r==="&")n++;else if(r==="html")Uh(e.ownerDocument.documentElement);else if(r==="head"){r=e.ownerDocument.head,Uh(r);for(var c=r.firstChild;c;){var _=c.nextSibling,p=c.nodeName;c[ol]||p==="SCRIPT"||p==="STYLE"||p==="LINK"&&c.rel.toLowerCase()==="stylesheet"||r.removeChild(c),c=_}}else r==="body"&&Uh(e.ownerDocument.body);r=o}while(r);Fn(i)}function Im(e,i){var r=e;e=0;do{var n=r.nextSibling;if(r.nodeType===1?i?(r._stashedDisplay=r.style.display,r.style.display="none"):(r.style.display=r._stashedDisplay||"",r.getAttribute("style")===""&&r.removeAttribute("style")):r.nodeType===3&&(i?(r._stashedText=r.nodeValue,r.nodeValue=""):r.nodeValue=r._stashedText||""),n&&n.nodeType===8)if(r=n.data,r==="/$"){if(e===0)break;e--}else r!=="$"&&r!=="$?"&&r!=="$~"&&r!=="$!"||e++;r=n}while(r)}function Vm(e,i,r){if(i=CSS.escape(i)!==i?"r-"+btoa(i).replace(/=/g,""):i,e.style.viewTransitionName=i,r!=null&&(e.style.viewTransitionClass=r),r=getComputedStyle(e),r.display==="inline"){if(i=e.getClientRects(),i.length===1)var n=1;else for(var o=n=0;o<i.length;o++){var c=i[o];0<c.width&&0<c.height&&n++}n===1&&(e=e.style,e.display=i.length===1?"inline-block":"block",e.marginTop="-"+r.paddingTop,e.marginBottom="-"+r.paddingBottom)}}function Xm(e,i){e=e.style,i=i.style;var r=i!=null?i.hasOwnProperty("viewTransitionName")?i.viewTransitionName:i.hasOwnProperty("view-transition-name")?i["view-transition-name"]:null:null;e.viewTransitionName=r==null||typeof r=="boolean"?"":(""+r).trim(),r=i!=null?i.hasOwnProperty("viewTransitionClass")?i.viewTransitionClass:i.hasOwnProperty("view-transition-class")?i["view-transition-class"]:null:null,e.viewTransitionClass=r==null||typeof r=="boolean"?"":(""+r).trim(),e.display==="inline-block"&&(i==null?e.display=e.margin="":(r=i.display,e.display=r==null||typeof r=="boolean"?"":r,r=i.margin,r!=null?e.margin=r:(r=i.hasOwnProperty("marginTop")?i.marginTop:i["margin-top"],e.marginTop=r==null||typeof r=="boolean"?"":r,i=i.hasOwnProperty("marginBottom")?i.marginBottom:i["margin-bottom"],e.marginBottom=i==null||typeof i=="boolean"?"":i)))}function Oy(e,i,r){return r=r.ownerDocument.defaultView,{rect:e,abs:i.position==="absolute"||i.position==="fixed",clip:i.clipPath!=="none"||i.overflow!=="visible"||i.filter!=="none"||i.mask!=="none"||i.mask!=="none"||i.borderRadius!=="0px",view:0<=e.bottom&&0<=e.right&&e.top<=r.innerHeight&&e.left<=r.innerWidth}}function Ah(e){var i=e.getBoundingClientRect(),r=getComputedStyle(e);return Oy(i,r,e)}function Ay(e){return e.documentElement.clientHeight}function By(e){this.addEventListener("load",e),this.addEventListener("error",e)}function ky(e,i,r,n,o,c,_,p,y){var R=i.nodeType===9?i:i.ownerDocument;try{var L=R.startViewTransition({update:function(){var D=R.defaultView,N=D.navigation&&D.navigation.transition,ae=R.fonts.status;n();var de=[];if(ae==="loaded"&&(Ay(R),R.fonts.status==="loading"&&de.push(R.fonts.ready)),ae=de.length,e!==null)for(var Re=e.suspenseyImages,M=0,x=0;x<Re.length;x++){var A=Re[x];if(!A.complete){var q=A.getBoundingClientRect();if(0<q.bottom&&0<q.right&&q.top<D.innerHeight&&q.left<D.innerWidth){if(M+=dv(A),M>jo){de.length=ae;break}A=new Promise(By.bind(A)),de.push(A)}}}if(0<de.length)return D=Promise.race([Promise.all(de),new Promise(function(fe){return setTimeout(fe,500)})]).then(o,o),(N?Promise.allSettled([N.finished,D]):D).then(c,c);if(o(),N)return N.finished.then(c,c);c()},types:r});R.__reactViewTransition=L;var Y=[];return L.ready.then(function(){for(var D=R.documentElement.getAnimations({subtree:!0}),N=0;N<D.length;N++){var ae=D[N],de=ae.effect,Re=de.pseudoElement;if(Re!=null&&Re.startsWith("::view-transition")){Y.push(ae),ae=de.getKeyframes();for(var M=Re=void 0,x=!0,A=0;A<ae.length;A++){var q=ae[A],fe=q.width;if(Re===void 0)Re=fe;else if(Re!==fe){x=!1;break}if(fe=q.height,M===void 0)M=fe;else if(M!==fe){x=!1;break}delete q.width,delete q.height,q.transform==="none"&&delete q.transform}x&&Re!==void 0&&M!==void 0&&(de.setKeyframes(ae),x=getComputedStyle(de.target,de.pseudoElement),x.width!==Re||x.height!==M)&&(x=ae[0],x.width=Re,x.height=M,x=ae[ae.length-1],x.width=Re,x.height=M,de.setKeyframes(ae))}}_()},function(D){R.__reactViewTransition===L&&(R.__reactViewTransition=null);try{typeof D=="object"&&D!==null&&D.name==="InvalidStateError"&&(D.message==="View transition was skipped because document visibility state is hidden."||D.message==="Skipping view transition because document visibility state has become hidden."||D.message==="Skipping view transition because viewport size changed."||D.message==="Transition was aborted because of invalid state")&&(D=null),D!==null&&y(D)}finally{n(),o(),_()}}),L.finished.finally(function(){for(var D=0;D<Y.length;D++)Y[D].cancel();R.__reactViewTransition===L&&(R.__reactViewTransition=null),p()}),L}catch{return n(),o(),_(),null}}function Gr(e,i){this._scope=document.documentElement,this._selector="::view-transition-"+e+"("+i+")"}Gr.prototype.animate=function(e,i){return i=typeof i=="number"?{duration:i}:ce({},i),i.pseudoElement=this._selector,this._scope.animate(e,i)},Gr.prototype.getAnimations=function(){for(var e=this._scope,i=this._selector,r=e.getAnimations({subtree:!0}),n=[],o=0;o<r.length;o++){var c=r[o].effect;c!==null&&c.target===e&&c.pseudoElement===i&&n.push(r[o])}return n},Gr.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Gm(e){return{name:e,group:new Gr("group",e),imagePair:new Gr("image-pair",e),old:new Gr("old",e),new:new Gr("new",e)}}function xi(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}xi.prototype.addEventListener=function(e,i,r){var n=null,o=null;if(!(r!=null&&typeof r!="boolean"&&(n=r.signal||null,n!==null&&n.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var c=this._eventListeners;if(Fm(c,e,i,r)===-1){var _=this,p=i;r!=null&&typeof r!="boolean"&&r.once===!0&&(p=function(y){_.removeEventListener(e,i,r),typeof i=="function"?i.call(this,y):i.handleEvent(y)}),n!==null&&(o=_.removeEventListener.bind(_,e,i,r),n.addEventListener("abort",o,{once:!0}),o=n.removeEventListener.bind(n,"abort",o)),n=Pn(r),c.push({type:e,listener:i,optionsOrUseCapture:r,attachedListener:p,cleanup:o}),v(this._fragmentFiber.child,!1,Ny,e,p,n)}this._eventListeners=c}};function Ny(e,i,r,n){return j(e).addEventListener(i,r,n),!1}xi.prototype.removeEventListener=function(e,i,r){var n=this._eventListeners;if(n!==null&&(i=Fm(n,e,i,r),i!==-1)){var o=n[i];r=o.attachedListener;var c=o.cleanup;o=Pn(o.optionsOrUseCapture),v(this._fragmentFiber.child,!1,Ly,e,r,o),n.splice(i,1),c!==null&&c()}};function Ly(e,i,r,n){return j(e).removeEventListener(i,r,n),!1}function Pn(e){return e!=null&&typeof e!="boolean"&&(e.once===!0||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function Wm(e){return e==null?"c=0":typeof e=="boolean"?"c="+(e?"1":"0"):"c="+(e.capture?"1":"0")}function Fm(e,i,r,n){if(e.length===0)return-1;n=Wm(n);for(var o=0;o<e.length;o++){var c=e[o];if(c.type===i&&c.listener===r&&Wm(c.optionsOrUseCapture)===n)return o}return-1}xi.prototype.dispatchEvent=function(e){var i=w(this._fragmentFiber);if(i===null)return!0;i=j(i);var r=this._eventListeners;if(r!==null&&0<r.length||!e.bubbles){var n=i.nodeType===9?i.createComment(""):document.createTextNode("");if(r)for(var o=0;o<r.length;o++){var c=r[o];n.addEventListener(c.type,c.attachedListener,Pn(c.optionsOrUseCapture))}if(i.appendChild(n),e=n.dispatchEvent(e),r)for(o=0;o<r.length;o++)c=r[o],n.removeEventListener(c.type,c.attachedListener,Pn(c.optionsOrUseCapture));return i.removeChild(n),e}return i.dispatchEvent(e)},xi.prototype.focus=function(e){v(this._fragmentFiber.child,!0,Zm,e,void 0,void 0)};function Zm(e,i){return e.tag===6?!1:(e=j(e),Gy(e,i))}xi.prototype.focusLast=function(e){var i=[];v(this._fragmentFiber.child,!0,Bh,i,void 0,void 0);for(var r=i.length-1;0<=r&&!Zm(i[r],e);r--);};function Bh(e,i){return i.push(e),!1}xi.prototype.blur=function(){var e=w(this._fragmentFiber);e!==null&&(e=j(e),e=Il(e).activeElement,e!==null&&v(this._fragmentFiber.child,!1,zy,e,void 0,void 0))};function zy(e,i){return e.tag===6?!1:(e=j(e),e===i||e.contains(i)?(i.blur(),!0):!1)}xi.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),v(this._fragmentFiber.child,!1,Hy,e,void 0,void 0)};function Hy(e,i){return e.tag===6||(e=j(e),i.observe(e)),!1}xi.prototype.unobserveUsing=function(e){var i=this._observers;if(i!==null&&i.has(e)){i.delete(e),v(this._fragmentFiber.child,!1,Uy,e,void 0,void 0);for(var r=i=0;r<Qi.length;r++){var n=Qi[r];n.fragmentInstance===this&&n.observer===e?e.unobserve(n.instance):Qi[i++]=n}Qi.length=i}};function Uy(e,i){return e.tag===6||(e=j(e),i.unobserve(e)),!1}var Qi=[],kh=!1;function jy(e,i,r){Qi.push({fragmentInstance:e,observer:i,instance:r}),kh||(kh=!0,Wy(function(){kh=!1;var n=Qi;Qi=[];for(var o=0;o<n.length;o++){var c=n[o];c.observer.unobserve(c.instance)}}))}xi.prototype.getClientRects=function(){var e=[];return v(this._fragmentFiber.child,!1,qy,e,void 0,void 0),e};function qy(e,i){if(e.tag===6){e=e.stateNode;var r=e.ownerDocument.createRange();r.selectNodeContents(e),i.push.apply(i,r.getClientRects())}else e=j(e),i.push.apply(i,e.getClientRects());return!1}xi.prototype.getRootNode=function(e){var i=w(this._fragmentFiber);return i===null?this:j(i).getRootNode(e)},xi.prototype.compareDocumentPosition=function(e){var i=w(this._fragmentFiber);if(i===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var r=[];v(this._fragmentFiber.child,!1,Bh,r,void 0,void 0);var n=j(i);if(r.length===0){if(r=n,O(this._fragmentFiber)){e:{for(i=this._fragmentFiber.return;i!==null;){if(i.tag===4){i=i.stateNode.containerInfo;break e}if(i.tag===3||i.tag===5||i.tag===27)break;i=i.return}i=null}i!=null&&(r=i)}i=this._fragmentFiber;var o=n=r.compareDocumentPosition(e);return r===e?o=Node.DOCUMENT_POSITION_CONTAINS:n&Node.DOCUMENT_POSITION_CONTAINED_BY&&(r=T(i)[1],r===null?o=Node.DOCUMENT_POSITION_PRECEDING:(e=j(r).compareDocumentPosition(e),o=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),o|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}i=j(r[0]),o=j(r[r.length-1]);var c=O(this._fragmentFiber)?i.parentElement:n;if(c==null)return Node.DOCUMENT_POSITION_DISCONNECTED;n=c.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_CONTAINED_BY,c=c.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_CONTAINED_BY;var _=i.compareDocumentPosition(e),p=o.compareDocumentPosition(e),y=_&Node.DOCUMENT_POSITION_CONTAINED_BY||p&Node.DOCUMENT_POSITION_CONTAINED_BY;return p=n&&c&&_&Node.DOCUMENT_POSITION_FOLLOWING&&p&Node.DOCUMENT_POSITION_PRECEDING,i=n&&i===e||c&&o===e||y||p?Node.DOCUMENT_POSITION_CONTAINED_BY:!n&&i===e||!c&&o===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:_,i&Node.DOCUMENT_POSITION_DISCONNECTED||i&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||Yy(i,this._fragmentFiber,r[0],r[r.length-1],e)?i:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function Yy(e,i,r,n,o){var c=Tr(o);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(r=!!c)e:{for(;c!==null;){if(c.tag===7&&(c===i||c.alternate===i)){r=!0;break e}c=c.return}r=!1}return r}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(c===null)return c=o.ownerDocument,o===c||o===c.documentElement||o===c.body;e:{for(c=i,i=w(i);c!==null;){if(!(c.tag!==5&&c.tag!==3&&c.tag!==27||c!==i&&c.alternate!==i)){c=!0;break e}c=c.return}c=!1}return c}return e&Node.DOCUMENT_POSITION_PRECEDING?((i=!!c)&&!(i=c===r)&&(i=oe(r,c,$),i===null?i=!1:(v(i,!0,he,c,r),c=F,F=null,i=c!==null)),i):e&Node.DOCUMENT_POSITION_FOLLOWING?((i=!!c)&&!(i=c===n)&&(i=oe(n,c,$),i===null?i=!1:(v(i,!0,te,c,n),c=F,ve=F=null,i=c!==null)),i):!1}function Qm(e,i){var r=e.ownerDocument.createRange();r.selectNodeContents(e),e=r.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,i?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}xi.prototype.scrollIntoView=function(e){if(typeof e=="object")throw Error(a(566));var i=[];v(this._fragmentFiber.child,!1,Bh,i,void 0,void 0);var r=e!==!1;if(i.length===0){var n=T(this._fragmentFiber);if(n=r?n[1]||n[0]||w(this._fragmentFiber):n[0]||n[1],n===null)return;if(n.tag===6){e=j(n),Qm(e,r);return}if(n=j(n),n.nodeType!==9){if(n.nodeType===11){r="host"in n?n.host:null,r!==null&&r.scrollIntoView(e);return}n.scrollIntoView(e)}}for(n=r?i.length-1:0;n!==(r?-1:i.length);){var o=i[n];o.tag===6?(o=j(o),Qm(o,r)):j(o).scrollIntoView(e),n+=r?-1:1}};function Ky(e,i){return e=j(e),$m(e,i),!1}function $m(e,i){e.reactFragments==null&&(e.reactFragments=new Set),e.reactFragments.add(i)}function Jm(e,i){var r=i._eventListeners;if(r!==null)for(var n=0;n<r.length;n++){var o=r[n];e.addEventListener(o.type,o.attachedListener,Pn(o.optionsOrUseCapture))}e.nodeType!==3&&(r=i._observers,r!==null&&r.forEach(function(c){for(var _=0,p=0;p<Qi.length;p++){var y=Qi[p];(y.fragmentInstance!==i||y.observer!==c||y.instance!==e)&&(Qi[_++]=y)}Qi.length=_,c.observe(e)}),$m(e,i))}function Py(e,i){var r=i._eventListeners;if(r!==null)for(var n=0;n<r.length;n++){var o=r[n];e.removeEventListener(o.type,o.attachedListener,Pn(o.optionsOrUseCapture))}e.nodeType!==3&&(r=i._observers,r!==null&&r.forEach(function(c){typeof c.rootMargin=="string"?jy(i,c,e):c.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(i))}function Nh(e){var i=e.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var r=i;switch(i=i.nextSibling,r.nodeName){case"HTML":case"HEAD":case"BODY":Nh(r),Ta(r);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(r.rel.toLowerCase()==="stylesheet")continue}e.removeChild(r)}}function Iy(e,i,r,n){for(;e.nodeType===1;){var o=r;if(e.nodeName.toLowerCase()!==i.toLowerCase()){if(!n&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(n){if(!e[ol])switch(i){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(c=e.getAttribute("rel"),c==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(c!==o.rel||e.getAttribute("href")!==(o.href==null||o.href===""?null:o.href)||e.getAttribute("crossorigin")!==(o.crossOrigin==null?null:o.crossOrigin)||e.getAttribute("title")!==(o.title==null?null:o.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(c=e.getAttribute("src"),(c!==(o.src==null?null:o.src)||e.getAttribute("type")!==(o.type==null?null:o.type)||e.getAttribute("crossorigin")!==(o.crossOrigin==null?null:o.crossOrigin))&&c&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(i==="input"&&e.type==="hidden"){var c=o.name==null?null:""+o.name;if(o.type==="hidden"&&e.getAttribute("name")===c)return e}else return e;if(e=Hi(e.nextSibling),e===null)break}return null}function Vy(e,i,r){if(i==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!r||(e=Hi(e.nextSibling),e===null))return null;return e}function ev(e,i){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!i||(e=Hi(e.nextSibling),e===null))return null;return e}function Lh(e){return e.data==="$?"||e.data==="$~"}function zh(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Xy(e,i){var r=e.ownerDocument;if(e.data==="$~")e._reactRetry=i;else if(e.data!=="$?"||r.readyState!=="loading")i();else{var n=function(){i(),r.removeEventListener("DOMContentLoaded",n)};r.addEventListener("DOMContentLoaded",n),e._reactRetry=n}}function Hi(e){for(;e!=null;e=e.nextSibling){var i=e.nodeType;if(i===1||i===3)break;if(i===8){if(i=e.data,i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"||i==="F!"||i==="F")break;if(i==="/$"||i==="/&")return null}}return e}var Hh=null;function tv(e){e=e.nextSibling;for(var i=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"||r==="/&"){if(i===0)return Hi(e.nextSibling);i--}else r!=="$"&&r!=="$!"&&r!=="$?"&&r!=="$~"&&r!=="&"||i++}e=e.nextSibling}return null}function iv(e){e=e.previousSibling;for(var i=0;e;){if(e.nodeType===8){var r=e.data;if(r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"){if(i===0)return e;i--}else r!=="/$"&&r!=="/&"||i++}e=e.previousSibling}return null}function Gy(e,i){function r(){n=!0}if(e.ownerDocument.activeElement===e)return!0;var n=!1;try{e.ownerDocument.addEventListener("focus",r,!0),(e.focus||HTMLElement.prototype.focus).call(e,i)}finally{e.ownerDocument.removeEventListener("focus",r,!0)}return n}function Wy(e){Km(function(){Km(function(i){return e(i)})})}function sv(e,i,r){switch(i=Il(r),e){case"html":if(e=i.documentElement,!e)throw Error(a(452));return e;case"head":if(e=i.head,!e)throw Error(a(453));return e;case"body":if(e=i.body,!e)throw Error(a(454));return e;default:throw Error(a(451))}}function rv(e,i,r){for(var n in r){var o=r[n];r.hasOwnProperty(n)&&o!=null&&Fe(e,i,n,null,Cy,o)}r.dangerouslySetInnerHTML!=null&&(e.textContent=""),e.onclick===is&&(e.onclick=null),Ta(e)}function Uh(e){for(var i=e.attributes;i.length;)e.removeAttributeNode(i[0]);Ta(e)}var Ui=new Map,nv=new Set;function Vl(e){if(typeof e.getRootNode=="function"){var i=e.getRootNode();if(i.nodeType===9||i.nodeType===11)return i}return e.nodeType===9?e:e.ownerDocument}var Ns=X.d;X.d={f:Fy,r:Zy,D:Qy,C:$y,L:Jy,m:e1,X:i1,S:t1,M:s1};function Fy(){var e=Ns.f(),i=Oo();return e||i}function Zy(e){var i=on(e);i!==null&&i.tag===5&&i.type==="form"?ag(i):Ns.r(e)}var In=typeof document>"u"?null:document;function lv(e,i,r){var n=In;if(n&&typeof i=="string"&&i){var o=Oi(i);o='link[rel="'+e+'"][href="'+o+'"]',typeof r=="string"&&(o+='[crossorigin="'+r+'"]'),nv.has(o)||(nv.add(o),e={rel:e,crossOrigin:r,href:i},n.querySelector(o)===null&&(i=n.createElement("link"),Xt(i,"link",e),At(i),n.head.appendChild(i)))}}function Qy(e){Ns.D(e),lv("dns-prefetch",e,null)}function $y(e,i){Ns.C(e,i),lv("preconnect",e,i)}function Jy(e,i,r){Ns.L(e,i,r);var n=In;if(n&&e&&i){var o='link[rel="preload"][as="'+Oi(i)+'"]';i==="image"&&r&&r.imageSrcSet?(o+='[imagesrcset="'+Oi(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(o+='[imagesizes="'+Oi(r.imageSizes)+'"]')):o+='[href="'+Oi(e)+'"]';var c=o;switch(i){case"style":c=Vn(e);break;case"script":c=Xn(e)}if(!(Ui.has(c)||(e=ce({rel:"preload",href:i==="image"&&r&&r.imageSrcSet?void 0:e,as:i},r),Ui.set(c,e),n.querySelector(o)!==null||i==="style"&&n.querySelector(Xl(c))||i==="script"&&n.querySelector(Gl(c))))){var _=n.createElement("link");Xt(_,"link",e),i==="style"&&(_[xa]=!0,_.onload=_.onerror=function(){Sd(_)}),At(_),n.head.appendChild(_)}}}function e1(e,i){Ns.m(e,i);var r=In;if(r&&e){var n=i&&typeof i.as=="string"?i.as:"script",o='link[rel="modulepreload"][as="'+Oi(n)+'"][href="'+Oi(e)+'"]',c=o;switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":c=Xn(e)}if(!Ui.has(c)&&(e=ce({rel:"modulepreload",href:e},i),Ui.set(c,e),r.querySelector(o)===null)){switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector(Gl(c)))return}n=r.createElement("link"),Xt(n,"link",e),At(n),r.head.appendChild(n)}}}function t1(e,i,r){Ns.S(e,i,r);var n=In;if(n&&e){var o=cn(n).hoistableStyles,c=Vn(e);i=i||"default";var _=o.get(c);if(!_){var p={loading:0,preload:null};if(_=n.querySelector(Xl(c)))p.loading=5;else{e=ce({rel:"stylesheet",href:e,"data-precedence":i},r),(r=Ui.get(c))&&jh(e,r);var y=_=n.createElement("link");At(y),Xt(y,"link",e),y._p=new Promise(function(R,L){y.onload=R,y.onerror=L}),y.addEventListener("load",function(){p.loading|=1}),y.addEventListener("error",function(){p.loading|=2}),p.loading|=4,Ho(_,i,n)}_={type:"stylesheet",instance:_,count:1,state:p},o.set(c,_)}}}function i1(e,i){Ns.X(e,i);var r=In;if(r&&e){var n=cn(r).hoistableScripts,o=Xn(e),c=n.get(o);c||(c=r.querySelector(Gl(o)),c||(e=ce({src:e,async:!0},i),(i=Ui.get(o))&&qh(e,i),c=r.createElement("script"),At(c),Xt(c,"link",e),r.head.appendChild(c)),c={type:"script",instance:c,count:1,state:null},n.set(o,c))}}function s1(e,i){Ns.M(e,i);var r=In;if(r&&e){var n=cn(r).hoistableScripts,o=Xn(e),c=n.get(o);c||(c=r.querySelector(Gl(o)),c||(e=ce({src:e,async:!0,type:"module"},i),(i=Ui.get(o))&&qh(e,i),c=r.createElement("script"),At(c),Xt(c,"link",e),r.head.appendChild(c)),c={type:"script",instance:c,count:1,state:null},n.set(o,c))}}function av(e,i,r,n){var o=(o=Pi.current)?Vl(o):null;if(!o)throw Error(a(446));switch(e){case"meta":case"title":return null;case"style":return typeof r.precedence=="string"&&typeof r.href=="string"?(r=Vn(r.href),i=cn(o).hoistableStyles,n=i.get(r),n||(n={type:"style",instance:null,count:0,state:null},i.set(r,n)),n):{type:"void",instance:null,count:0,state:null};case"link":if(r.rel==="stylesheet"&&typeof r.href=="string"&&typeof r.precedence=="string"){e=Vn(r.href);var c=cn(o).hoistableStyles,_=c.get(e);if(_||(o=o.ownerDocument||o,_={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},c.set(e,_),(c=o.querySelector(Xl(e)))?c._p||(_.instance=c,_.state.loading=5):(c=Ui.get(e),c||(c={rel:"preload",as:"style",href:r.href,crossOrigin:r.crossOrigin,integrity:r.integrity,media:r.media,hrefLang:r.hrefLang,referrerPolicy:r.referrerPolicy},Ui.set(e,c)),r1(o,e,c,_.state))),i&&n===null)throw Error(a(528,""));return _}if(i&&n!==null)throw Error(a(529,""));return null;case"script":return i=r.async,r=r.src,typeof r=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(r=Xn(r),i=cn(o).hoistableScripts,n=i.get(r),n||(n={type:"script",instance:null,count:0,state:null},i.set(r,n)),n):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,e))}}function Vn(e){return'href="'+Oi(e)+'"'}function Xl(e){return'link[rel="stylesheet"]['+e+"]"}function ov(e){return ce({},e,{"data-precedence":e.precedence,precedence:null})}function r1(e,i,r,n){if(i=e.querySelector('link[rel="preload"][as="style"]['+i+"]")){if(i[xa]!==!0){n.loading=1;return}}else i=e.createElement("link"),i[xa]=!0,i.onload=i.onerror=Sd.bind(null,i),Xt(i,"link",r),At(i),e.head.appendChild(i);n.preload=i,i.addEventListener("load",function(){return n.loading|=1}),i.addEventListener("error",function(){return n.loading|=2})}function Xn(e){return'[src="'+Oi(e)+'"]'}function Gl(e){return"script[async]"+e}function cv(e,i,r){if(i.count++,i.instance===null)switch(i.type){case"style":var n=e.querySelector('style[data-href~="'+Oi(r.href)+'"]');if(n)return i.instance=n,At(n),n;var o=ce({},r,{"data-href":r.href,"data-precedence":r.precedence,href:null,precedence:null});return n=(e.ownerDocument||e).createElement("style"),At(n),Xt(n,"style",o),Ho(n,r.precedence,e),i.instance=n;case"stylesheet":o=Vn(r.href);var c=e.querySelector(Xl(o));if(c)return i.state.loading|=4,i.instance=c,At(c),c;n=ov(r),(o=Ui.get(o))&&jh(n,o),c=(e.ownerDocument||e).createElement("link"),At(c);var _=c;return _._p=new Promise(function(p,y){_.onload=p,_.onerror=y}),Xt(c,"link",n),i.state.loading|=4,Ho(c,r.precedence,e),i.instance=c;case"script":return c=Xn(r.src),(o=e.querySelector(Gl(c)))?(i.instance=o,At(o),o):(n=r,(o=Ui.get(c))&&(n=ce({},r),qh(n,o)),e=e.ownerDocument||e,o=e.createElement("script"),At(o),Xt(o,"link",n),e.head.appendChild(o),i.instance=o);case"void":return null;default:throw Error(a(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(n=i.instance,i.state.loading|=4,Ho(n,r.precedence,e));return i.instance}function Ho(e,i,r){for(var n=r.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),o=n.length?n[n.length-1]:null,c=o,_=0;_<n.length;_++){var p=n[_];if(p.dataset.precedence===i)c=p;else if(c!==o)break}c?c.parentNode.insertBefore(e,c.nextSibling):(i=r.nodeType===9?r.head:r,i.insertBefore(e,i.firstChild))}function jh(e,i){e.crossOrigin==null&&(e.crossOrigin=i.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=i.referrerPolicy),e.title==null&&(e.title=i.title)}function qh(e,i){e.crossOrigin==null&&(e.crossOrigin=i.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=i.referrerPolicy),e.integrity==null&&(e.integrity=i.integrity)}var Uo=null;function uv(e,i,r){if(Uo===null){var n=new Map,o=Uo=new Map;o.set(r,n)}else o=Uo,n=o.get(r),n||(n=new Map,o.set(r,n));if(n.has(e))return n;for(n.set(e,null),r=r.getElementsByTagName(e),o=0;o<r.length;o++){var c=r[o];if(!(c[ol]||c[Yt]||e==="link"&&c.getAttribute("rel")==="stylesheet")&&c.namespaceURI!=="http://www.w3.org/2000/svg"){var _=c.getAttribute(i)||"";_=e+_;var p=n.get(_);p?p.push(c):n.set(_,[c])}}return n}function Yh(e,i,r){e=e.ownerDocument||e,e.head.insertBefore(r,i==="title"?e.querySelector("head > title"):null)}function n1(e,i,r){if(r===1||i.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;return i.rel==="stylesheet"?(e=i.disabled,typeof i.precedence=="string"&&e==null):!0;case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function hv(e,i){return e==="img"&&i.src!=null&&i.src!==""&&i.onLoad==null&&i.loading!=="lazy"}function fv(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function dv(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function _v(e,i){typeof i.decode=="function"&&(e.imgCount++,i.complete||(e.imgBytes+=dv(i),e.suspenseyImages.push(i)),e=o1.bind(e),i.decode().then(e,e))}function l1(e,i,r,n){if(r.type==="stylesheet"&&(typeof n.media!="string"||matchMedia(n.media).matches!==!1)&&(r.state.loading&4)===0){if(r.instance===null){var o=Vn(n.href),c=i.querySelector(Xl(o));if(c){i=c._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(e.count++,e=Wl.bind(e),i.then(e,e)),r.state.loading|=4,r.instance=c,At(c);return}c=i.ownerDocument||i,n=ov(n),(o=Ui.get(o))&&jh(n,o),c=c.createElement("link"),At(c);var _=c;_._p=new Promise(function(p,y){_.onload=p,_.onerror=y}),Xt(c,"link",n),r.instance=c}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(r,i),(i=r.state.preload)&&(r.state.loading&3)===0&&(e.count++,r=Wl.bind(e),i.addEventListener("load",r),i.addEventListener("error",r))}}var jo=0;function a1(e,i){return e.stylesheets&&e.count===0&&Yo(e,e.stylesheets),0<e.count||0<e.imgCount?function(r){var n=setTimeout(function(){if(e.stylesheets&&Yo(e,e.stylesheets),e.unsuspend){var c=e.unsuspend;e.unsuspend=null,c()}},6e4+i);0<e.imgBytes&&jo===0&&(jo=62500*xy());var o=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Yo(e,e.stylesheets),e.unsuspend)){var c=e.unsuspend;e.unsuspend=null,c()}},(e.imgBytes>jo?50:800)+i);return e.unsuspend=r,function(){e.unsuspend=null,clearTimeout(n),clearTimeout(o)}}:null}function gv(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)Yo(e,e.stylesheets);else if(e.unsuspend){var i=e.unsuspend;e.unsuspend=null,i()}}}function Wl(){this.count--,gv(this)}function o1(){this.imgCount--,gv(this)}var qo=null;function Yo(e,i){e.stylesheets=null,e.unsuspend!==null&&(e.count++,qo=new Map,i.forEach(c1,e),qo=null,Wl.call(e))}function c1(e,i){if(!(i.state.loading&4)){var r=qo.get(e);if(r)var n=r.get(null);else{r=new Map,qo.set(e,r);for(var o=e.querySelectorAll("link[data-precedence],style[data-precedence]"),c=0;c<o.length;c++){var _=o[c];(_.nodeName==="LINK"||_.getAttribute("media")!=="not all")&&(r.set(_.dataset.precedence,_),n=_)}n&&r.set(null,n)}o=i.instance,_=o.getAttribute("data-precedence"),c=r.get(_)||n,c===n&&r.set(null,o),r.set(_,o),this.count++,n=Wl.bind(this),o.addEventListener("load",n),o.addEventListener("error",n),c?c.parentNode.insertBefore(o,c.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(o,e.firstChild)),i.state.loading|=4}}var Gn={$$typeof:Z,Provider:null,Consumer:null,_currentValue:J,_currentValue2:J,_threadCount:0};function u1(e,i,r,n,o,c,_,p,y){this.tag=1,this.containerInfo=e,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=ts(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ts(0),this.hiddenUpdates=ts(null),this.identifierPrefix=n,this.onUncaughtError=o,this.onCaughtError=c,this.onRecoverableError=_,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=y,this.transitionTypes=null,this.incompleteTransitions=new Map}function mv(e,i,r,n,o,c,_,p,y,R,L,Y){return e=new u1(e,i,r,_,y,R,L,Y,p),i=1,c===!0&&(i|=24),c=hi(3,null,null,i),e.current=c,c.stateNode=e,i=iu(),i.refCount++,e.pooledCache=i,i.refCount++,c.memoizedState={element:n,isDehydrated:r,cache:i},lu(c),e}function vv(e){return e?(e=Sn,e):Sn}function pv(e,i,r,n,o,c){o=vv(o),n.context===null?n.context=o:n.pendingContext=o,n=Qs(i),n.payload={element:r},c=c===void 0?null:c,c!==null&&(n.callback=c),r=$s(e,n,i),r!==null&&(gi(r,e,i),xl(r,e,i))}function Sv(e,i){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<i?r:i}}function Kh(e,i){Sv(e,i),(e=e.alternate)&&Sv(e,i)}function yv(e){if(e.tag===13||e.tag===31){var i=Or(e,67108864);i!==null&&gi(i,e,67108864),Kh(e,67108864)}}function bv(e){if(e.tag===13||e.tag===31){var i=Ei();i=wc(i);var r=Or(e,i);r!==null&&gi(r,e,i),Kh(e,i)}}var Wn=!0;function h1(e,i,r,n){var o=le.T;le.T=null;var c=X.p;try{X.p=2,Ph(e,i,r,n)}finally{X.p=c,le.T=o}}function f1(e,i,r,n){var o=le.T;le.T=null;var c=X.p;try{X.p=8,Ph(e,i,r,n)}finally{X.p=c,le.T=o}}function Ph(e,i,r,n){if(Wn){var o=Ih(n);if(o===null)Eh(e,i,n,Ko,r),Cv(e,n);else if(_1(o,e,i,r,n))n.stopPropagation();else if(Cv(e,n),i&4&&-1<d1.indexOf(e)){for(;o!==null;){var c=on(o);if(c!==null)switch(c.tag){case 3:if(c=c.stateNode,c.current.memoizedState.isDehydrated){var _=ft(c.pendingLanes);if(_!==0){var p=c;for(p.pendingLanes|=2,p.entangledLanes|=2;_;){var y=1<<31-ti(_);p.entanglements[1]|=y,_&=~y}fs(c),(Ie&6)===0&&(Do=Ft()+500,Yl(0))}}break;case 31:case 13:p=Or(c,2),p!==null&&gi(p,c,2),Oo(),Kh(c,2)}if(c=Ih(n),c===null&&Eh(e,i,n,Ko,r),c===o)break;o=c}o!==null&&n.stopPropagation()}else Eh(e,i,n,null,r)}}function Ih(e){return e=Rc(e),Vh(e)}var Ko=null;function Vh(e){if(Ko=null,e=Tr(e),e!==null){var i=h(e);if(i===null)e=null;else{var r=i.tag;if(r===13){if(e=f(i),e!==null)return e;e=null}else if(r===31){if(e=d(i),e!==null)return e;e=null}else if(r===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;e=null}else i!==e&&(e=null)}}return Ko=e,null}function wv(e){switch(e){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"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"fullscreenerror":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"resize":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(ya()){case ba:return 2;case wa:return 8;case Ji:case rl:return 32;case nl:return 268435456;default:return 32}default:return 32}}var Xh=!1,ur=null,hr=null,fr=null,Fl=new Map,Zl=new Map,dr=[],d1="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 Cv(e,i){switch(e){case"focusin":case"focusout":ur=null;break;case"dragenter":case"dragleave":hr=null;break;case"mouseover":case"mouseout":fr=null;break;case"pointerover":case"pointerout":Fl.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":Zl.delete(i.pointerId)}}function Ql(e,i,r,n,o,c){return e===null||e.nativeEvent!==c?(e={blockedOn:i,domEventName:r,eventSystemFlags:n,nativeEvent:c,targetContainers:[o]},i!==null&&(i=on(i),i!==null&&yv(i)),e):(e.eventSystemFlags|=n,i=e.targetContainers,o!==null&&i.indexOf(o)===-1&&i.push(o),e)}function _1(e,i,r,n,o){switch(i){case"focusin":return ur=Ql(ur,e,i,r,n,o),!0;case"dragenter":return hr=Ql(hr,e,i,r,n,o),!0;case"mouseover":return fr=Ql(fr,e,i,r,n,o),!0;case"pointerover":var c=o.pointerId;return Fl.set(c,Ql(Fl.get(c)||null,e,i,r,n,o)),!0;case"gotpointercapture":return c=o.pointerId,Zl.set(c,Ql(Zl.get(c)||null,e,i,r,n,o)),!0}return!1}function Ev(e){var i=Tr(e.target);if(i!==null){var r=h(i);if(r!==null){if(i=r.tag,i===13){if(i=f(r),i!==null){e.blockedOn=i,md(e.priority,function(){bv(r)});return}}else if(i===31){if(i=d(r),i!==null){e.blockedOn=i,md(e.priority,function(){bv(r)});return}}else if(i===3&&r.stateNode.current.memoizedState.isDehydrated){e.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Po(e){if(e.blockedOn!==null)return!1;for(var i=e.targetContainers;0<i.length;){var r=Ih(e.nativeEvent);if(r===null){r=e.nativeEvent;var n=new r.constructor(r.type,r);Mc=n,r.target.dispatchEvent(n),Mc=null}else return i=on(r),i!==null&&yv(i),e.blockedOn=r,!1;i.shift()}return!0}function xv(e,i,r){Po(e)&&r.delete(i)}function g1(){Xh=!1,ur!==null&&Po(ur)&&(ur=null),hr!==null&&Po(hr)&&(hr=null),fr!==null&&Po(fr)&&(fr=null),Fl.forEach(xv),Zl.forEach(xv)}function Io(e,i){e.blockedOn===i&&(e.blockedOn=null,Xh||(Xh=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,g1)))}var Vo=null;function Tv(e){Vo!==e&&(Vo=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Vo===e&&(Vo=null);for(var i=0;i<e.length;i+=3){var r=e[i],n=e[i+1],o=e[i+2];if(typeof n!="function"){if(Vh(n||r)===null)continue;break}var c=on(r);c!==null&&(e.splice(i,3),i-=3,Du(c,{pending:!0,data:o,method:r.method,action:n},n,o))}}))}function Fn(e){function i(y){return Io(y,e)}ur!==null&&Io(ur,e),hr!==null&&Io(hr,e),fr!==null&&Io(fr,e),Fl.forEach(i),Zl.forEach(i);for(var r=0;r<dr.length;r++){var n=dr[r];n.blockedOn===e&&(n.blockedOn=null)}for(;0<dr.length&&(r=dr[0],r.blockedOn===null);)Ev(r),r.blockedOn===null&&dr.shift();if(r=(e.ownerDocument||e).$$reactFormReplay,r!=null)for(n=0;n<r.length;n+=3){var o=r[n],c=r[n+1],_=o[ui]||null;if(typeof c=="function")_||Tv(r);else if(_){var p=null;if(c&&c.hasAttribute("formAction")){if(o=c,_=c[ui]||null)p=_.formAction;else if(Vh(o)!==null)continue}else p=_.action;typeof p=="function"?r[n+1]=p:(r.splice(n,3),n-=3),Tv(r)}}}function Dv(){function e(c){c.canIntercept&&c.info==="react-transition"&&c.intercept({handler:function(){return new Promise(function(_){return o=_})},focusReset:"manual",scroll:"manual"})}function i(){o!==null&&(o(),o=null),n||setTimeout(r,20)}function r(){if(!n&&!navigation.transition){var c=navigation.currentEntry;c&&c.url!=null&&navigation.navigate(c.url,{state:c.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var n=!1,o=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(r,100),function(){n=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),o!==null&&(o(),o=null)}}}function Gh(e){this._internalRoot=e}Xo.prototype.render=Gh.prototype.render=function(e){var i=this._internalRoot;if(i===null)throw Error(a(409));var r=i.current,n=Ei();pv(r,n,e,i,null,null)},Xo.prototype.unmount=Gh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var i=e.containerInfo;pv(e.current,2,null,e,null,null),Oo(),i[an]=null}};function Xo(e){this._internalRoot=e}Xo.prototype.unstable_scheduleHydration=function(e){if(e){var i=gd();e={blockedOn:null,target:e,priority:i};for(var r=0;r<dr.length&&i!==0&&i<dr[r].priority;r++);dr.splice(r,0,e),r===0&&Ev(e)}};var Mv=s.version;if(Mv!=="19.3.0")throw Error(a(527,Mv,"19.3.0"));X.findDOMNode=function(e){var i=e._reactInternals;if(i===void 0)throw typeof e.render=="function"?Error(a(188)):(e=Object.keys(e).join(","),Error(a(268,e)));return e=g(i),e=e!==null?S(e):null,e=e===null?null:e.stateNode,e};var m1={bundleType:0,version:"19.3.0",rendererPackageName:"react-dom",currentDispatcherRef:le,reconcilerVersion:"19.3.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Go=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Go.isDisabled&&Go.supportsFiber)try{qs=Go.inject(m1),ei=Go}catch{}}return Jl.createRoot=function(e,i){if(!u(e))throw Error(a(299));var r=!1,n="",o=vg,c=pg,_=Sg;return i!=null&&(i.unstable_strictMode===!0&&(r=!0),i.identifierPrefix!==void 0&&(n=i.identifierPrefix),i.onUncaughtError!==void 0&&(o=i.onUncaughtError),i.onCaughtError!==void 0&&(c=i.onCaughtError),i.onRecoverableError!==void 0&&(_=i.onRecoverableError)),i=mv(e,1,!1,null,null,r,n,null,o,c,_,Dv),e[an]=i.current,Ch(e),new Gh(i)},Jl.hydrateRoot=function(e,i,r){if(!u(e))throw Error(a(299));var n=!1,o="",c=vg,_=pg,p=Sg,y=null;return r!=null&&(r.unstable_strictMode===!0&&(n=!0),r.identifierPrefix!==void 0&&(o=r.identifierPrefix),r.onUncaughtError!==void 0&&(c=r.onUncaughtError),r.onCaughtError!==void 0&&(_=r.onCaughtError),r.onRecoverableError!==void 0&&(p=r.onRecoverableError),r.formState!==void 0&&(y=r.formState)),i=mv(e,1,!0,i,r??null,n,o,y,c,_,p,Dv),i.context=vv(null),r=i.current,n=Ei(),n=wc(n),o=Qs(n),o.callback=null,$s(r,o,n),r=n,i.current.lanes=r,al(i,r),fs(i),e[an]=i.current,Ch(e),new Xo(i)},Jl.version="19.3.0",Jl}var Uv;function x1(){if(Uv)return Fh.exports;Uv=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(s){console.error(s)}}return t(),Fh.exports=E1(),Fh.exports}var T1=x1(),U=ed();class yr extends Error{constructor(){super("访问令牌已失效")}}function Ri(t){return t instanceof Error?t.message:String(t)}async function br(t,s,l={}){const a=await fetch(s,{...l,headers:{Authorization:`Bearer ${t}`,...l.body instanceof FormData?{}:{"Content-Type":"application/json"},...l.headers}});if(a.status===401)throw new yr;if(!a.ok){const u=await a.json().catch(()=>({}));throw new Error(u.error||`HTTP ${a.status}`)}return a.json()}function Zn(t,s,l,a,u){const h=new URLSearchParams({path:l});return a&&h.set("base",a),u&&h.set(u,"1"),`/api/sessions/${encodeURIComponent(t)}/files/${s}?${h}`}async function Hp(t,s){const l=await fetch(s,{headers:{Authorization:`Bearer ${t}`}});if(l.status===401)throw new yr;if(!l.ok){const a=await l.json().catch(()=>({}));throw new Error(a.error||`HTTP ${l.status}`)}return l.blob()}async function ef(t,s){return URL.createObjectURL(await Hp(t,s))}function D1({name:t,busy:s,error:l,onConfirm:a,onCancel:u}){const h=U.useRef(null);return U.useEffect(()=>{const f=h.current;return f.showModal(),()=>f.close()},[]),C.jsxs("dialog",{ref:h,className:"session-close-dialog","aria-labelledby":"close-session-title",onCancel:f=>{f.preventDefault(),s||u()},children:[C.jsxs("h2",{id:"close-session-title",children:["结束“",t,"”?"]}),C.jsx("p",{children:"这会结束该终端中运行的程序,并删除该会话上传的图片。"}),l&&C.jsx("p",{className:"error",role:"alert",children:l}),C.jsxs("div",{className:"session-close-actions",children:[C.jsx("button",{autoFocus:!0,disabled:s,onClick:u,children:"取消"}),C.jsx("button",{className:"primary",disabled:s,onClick:a,children:s?"正在结束…":"结束会话"})]})]})}function M1({cwd:t,busy:s,onClose:l,onCreate:a}){const u=U.useRef(null),[h,f]=U.useState("");U.useEffect(()=>{const m=u.current;return m.showModal(),()=>m.close()},[]);const d=async()=>{f("");try{await a()}catch(m){f(Ri(m))}};return C.jsxs("dialog",{ref:u,className:"session-close-dialog session-ended-dialog","aria-labelledby":"session-ended-title",onCancel:m=>{m.preventDefault(),s||l()},children:[C.jsx("h2",{id:"session-ended-title",children:"会话已结束"}),C.jsx("p",{children:"可以在当前路径新建终端。"}),C.jsx("p",{className:"session-ended-path",children:t}),h&&C.jsx("p",{className:"error",role:"alert",children:h}),C.jsxs("div",{className:"session-close-actions",children:[C.jsx("button",{autoFocus:!0,disabled:s,onClick:l,children:"关闭"}),C.jsx("button",{className:"primary",disabled:s,onClick:()=>{d()},children:s?"正在创建…":"在当前路径新建终端"})]})]})}function R1({message:t,onClose:s}){return U.useEffect(()=>{const l=window.setTimeout(s,4e3);return()=>window.clearTimeout(l)},[t,s]),C.jsx("div",{className:"message-layer",children:C.jsxs("div",{className:"message-toast",role:"status","aria-live":"polite","aria-atomic":"true",children:[C.jsx("span",{className:"message-icon","aria-hidden":"true",children:"i"}),C.jsx("span",{className:"message-text",children:t}),C.jsx("button",{className:"message-close","aria-label":"关闭通知",onClick:s,children:"×"})]})})}function O1({token:t,initialPath:s,home:l,folders:a,busy:u,onCreate:h,onClose:f,onUnauthorized:d}){const[m,g]=U.useState(s),[S,v]=U.useState(null),[w,O]=U.useState(""),[T,k]=U.useState(!1),[j,F]=U.useState(""),ve=U.useRef(0),he=U.useRef(null);async function te($){const oe=++ve.current;k(!0),F(""),g($),v(null);try{const ce=await br(t,`/api/directories?path=${encodeURIComponent($)}`);if(ve.current!==oe)return;v(ce),g(ce.path),O("")}catch(ce){if(ve.current!==oe)return;ce instanceof yr?d():F(Ri(ce))}finally{ve.current===oe&&k(!1)}}return U.useEffect(()=>{const $=he.current;return $.showModal(),te(s),()=>{ve.current++,$.close()}},[]),C.jsxs("dialog",{ref:he,className:"directory-picker",onCancel:$=>{$.preventDefault(),u||f()},children:[C.jsxs("header",{children:[C.jsx("strong",{children:"选择工作目录"}),C.jsx("button",{"aria-label":"关闭路径选择器",disabled:u,onClick:f,children:"×"})]}),a.length>0&&C.jsxs("section",{className:"workspace-shortcuts",children:[C.jsx("small",{children:"VS Code 工作区"}),C.jsx("div",{children:a.map($=>C.jsx("button",{title:$.path,disabled:u,onClick:()=>{te($.path)},children:$.name},$.path))})]}),C.jsxs("form",{className:"directory-path",onSubmit:$=>{$.preventDefault(),te(m.trim())},children:[C.jsx("button",{type:"button","aria-label":"上级目录",disabled:T||u||!S?.parent,onClick:()=>{te(S.parent)},children:"↑"}),C.jsx("button",{type:"button","aria-label":"默认目录",disabled:u,onClick:()=>{te(l)},children:"⌂"}),C.jsx("input",{"aria-label":"工作目录",value:m,disabled:u,onChange:$=>g($.target.value),spellCheck:!1}),C.jsx("button",{disabled:u||T||!m.trim(),children:"前往"})]}),C.jsx("input",{className:"directory-filter","aria-label":"筛选文件夹",placeholder:"筛选当前目录中的文件夹",value:w,onChange:$=>O($.target.value)}),C.jsxs("div",{className:"directory-entries","aria-label":"文件夹列表","aria-busy":T,children:[T?C.jsx("p",{children:"正在读取目录…"}):S?.entries.filter($=>$.name.toLocaleLowerCase().includes(w.toLocaleLowerCase())).map($=>C.jsxs("button",{disabled:u,title:$.path,onClick:()=>{te($.path)},children:[C.jsx("span",{"aria-hidden":"true",children:"▱"}),$.name,C.jsx("span",{"aria-hidden":"true",children:"›"})]},$.name)),!T&&S&&!S.entries.some($=>$.name.toLocaleLowerCase().includes(w.toLocaleLowerCase()))&&C.jsx("p",{children:w?"没有匹配的文件夹":"此目录没有子文件夹"})]}),j&&C.jsx("p",{className:"error",role:"alert",children:j}),C.jsxs("footer",{children:[C.jsx("button",{disabled:u,onClick:f,children:"取消"}),C.jsx("button",{className:"primary",disabled:u||T||!S||S.path!==m,onClick:()=>{h(S.path).catch($=>F(Ri($)))},children:u?"正在创建…":"在此创建终端"})]})]})}function A1(){const[t,s]=U.useState([]);return U.useEffect(()=>{if(window.parent===window||new URLSearchParams(location.search).get("embed")!=="vscode")return;const l=a=>{a.source!==window.parent||a.data?.type!=="web-terminal:workspace-folders"||!Array.isArray(a.data.folders)||s(a.data.folders.filter(u=>typeof u?.name=="string"&&typeof u?.path=="string").slice(0,100))};return window.addEventListener("message",l),window.parent.postMessage({type:"web-terminal:request-workspace-folders"},"*"),()=>window.removeEventListener("message",l)},[]),t}const td="web-terminal.tabLayout",ac=["blue","cyan","green","yellow","orange","red","purple","pink","gray"],oc={blue:{label:"蓝色",color:"#89b4fa"},cyan:{label:"青色",color:"#79d3df"},green:{label:"绿色",color:"#8ed8a2"},yellow:{label:"黄色",color:"#efcf79"},orange:{label:"橙色",color:"#efa76c"},red:{label:"红色",color:"#eb8b8b"},purple:{label:"紫色",color:"#bb9bea"},pink:{label:"粉色",color:"#e9a0cb"},gray:{label:"灰色",color:"#a8b2bf"}},jv=t=>Array.isArray(t)?t.filter(s=>typeof s=="string"):[],Lt=t=>`${t.kind}:${t.id}`,Wo=(t,s)=>t.groups.find(l=>l.sessionIds.includes(s));function Up(t){if(!t||typeof t!="object")return{order:[],groups:[]};const s=t,l=[];for(const a of Array.isArray(s.groups)?s.groups:[])!a||typeof a.id!="string"||l.some(u=>u.id===a.id)||typeof a.name!="string"||!a.name.trim()||!ac.includes(a.color)||l.push({id:a.id,name:a.name.trim().slice(0,40),color:a.color,collapsed:a.collapsed===!0,sessionIds:jv(a.sessionIds)});return{order:jv(s.order),groups:l}}function B1(){try{return Up(JSON.parse(localStorage.getItem(td)||"null"))}catch{return{order:[],groups:[]}}}function k1(t){localStorage.setItem(td,JSON.stringify(t))}function cc(t,s){const l=new Set(s),a=new Set,u=t.groups.map(d=>({...d,sessionIds:d.sessionIds.filter(m=>!l.has(m)||a.has(m)?!1:(a.add(m),!0))})).filter(d=>d.sessionIds.length),h=new Set([...u.map(d=>Lt({kind:"group",id:d.id})),...s.filter(d=>!a.has(d)).map(d=>Lt({kind:"session",id:d}))]),f=[...new Set(t.order.filter(d=>h.has(d)))];for(const d of h)f.includes(d)||f.push(d);return{order:f,groups:u}}function N1(t,s,l){const a=cc(t,s),u=()=>cc(a,s),h=d=>{a.order=a.order.filter(m=>m!==Lt({kind:"session",id:d}));for(const m of a.groups)m.sessionIds=m.sessionIds.filter(g=>g!==d)},f=(d,m,g)=>{const S=d.indexOf(m);if(S<0)return;const v=g==="first"?0:Math.max(0,Math.min(d.length-1,S+g));d.splice(S,1),d.splice(v,0,m)};if(l.type==="create"){if(!s.includes(l.sessionId)||a.groups.some(S=>S.id===l.id))return a;const d=Wo(a,l.sessionId),m=Lt(d?{kind:"group",id:d.id}:{kind:"session",id:l.sessionId}),g=a.order.indexOf(m);h(l.sessionId),a.groups.push({id:l.id,name:l.name.trim(),color:l.color,collapsed:!1,sessionIds:[l.sessionId]}),a.order.splice(g<0?a.order.length:g,0,Lt({kind:"group",id:l.id}))}else if(l.type==="edit"||l.type==="toggle"){const d=a.groups.find(m=>m.id===l.id);d&&(l.type==="toggle"?d.collapsed=!d.collapsed:(d.name=l.name.trim(),d.color=l.color))}else if(l.type==="ungroup"){const d=a.groups.find(g=>g.id===l.id);if(!d)return a;const m=a.order.indexOf(Lt({kind:"group",id:d.id}));a.order.splice(m,1,...d.sessionIds.map(g=>Lt({kind:"session",id:g}))),a.groups=a.groups.filter(g=>g!==d)}else if(l.type==="assign"){if(!s.includes(l.sessionId))return a;const d=l.groupId===null?void 0:a.groups.find(S=>S.id===l.groupId);if(l.groupId!==null&&!d||d?.sessionIds.includes(l.sessionId))return a;const m=Wo(a,l.sessionId);if(!d&&!m)return a;const g=a.order.indexOf(Lt(m?{kind:"group",id:m.id}:{kind:"session",id:l.sessionId}));h(l.sessionId),d?(d.sessionIds.push(l.sessionId),d.collapsed=!1):a.order.splice(g+1,0,Lt({kind:"session",id:l.sessionId}))}else if(l.type==="move"){const d=l.item.kind==="session"?Wo(a,l.item.id):void 0;f(d?d.sessionIds:a.order,d?l.item.id:Lt(l.item),l.direction)}else if(l.type==="drop"){const{item:d,target:m}=l;if(m.kind==="group"&&!a.groups.some(S=>S.id===m.id)||m.kind==="session"&&!s.includes(m.id)||d.kind==="session"&&(!s.includes(d.id)||m.kind==="session"&&m.id===d.id))return a;const g=m.kind==="group"?a.groups.find(S=>S.id===m.id):m.kind==="session"?Wo(a,m.id):void 0;if(d.kind==="group"){const S=Lt(d),v=g?Lt({kind:"group",id:g.id}):m.kind==="session"?Lt(m):void 0;if(!a.order.includes(S)||S===v)return a;a.order=a.order.filter(O=>O!==S);const w=v?a.order.indexOf(v):-1;a.order.splice(w<0?a.order.length:w+(m.kind==="session"&&m.side==="after"?1:0),0,S)}else{if(m.kind==="group"&&!g||m.kind==="session"&&!s.includes(m.id))return a;if(h(d.id),g){const S=m.kind==="session"?g.sessionIds.indexOf(m.id):-1;g.sessionIds.splice(S<0?g.sessionIds.length:S+(m.kind==="session"&&m.side==="after"?1:0),0,d.id)}else{const S=m.kind==="session"?a.order.indexOf(Lt(m)):-1;a.order.splice(S<0?a.order.length:S+(m.kind==="session"&&m.side==="after"?1:0),0,Lt(d))}}}return u()}function L1(t,s){const l=new Map(t.map(u=>[u.id,u])),a=cc(s,t.map(u=>u.id));return a.order.flatMap(u=>{if(u.startsWith("session:")){const f=l.get(u.slice(8));return f?[{sessions:[f]}]:[]}const h=a.groups.find(f=>f.id===u.slice(6));return h?[{group:h,sessions:h.sessionIds.map(f=>l.get(f))}]:[]})}function z1(t,s,l){const[a,u]=U.useState(B1),h=U.useRef(a),f=t.map(S=>S.id),d=JSON.stringify(f),m=U.useCallback(S=>{h.current=S,u(S);try{k1(S)}catch{l("标签布局暂时无法保存,当前窗口仍可使用。")}},[l]);return U.useEffect(()=>{if(!s)return;const S=cc(h.current,f);JSON.stringify(S)!==JSON.stringify(h.current)&&m(S)},[d,s,m]),U.useEffect(()=>{const S=v=>{if(v.key!==td)return;let w;try{w=Up(JSON.parse(v.newValue||"null"))}catch{return}h.current=w,u(w)};return window.addEventListener("storage",S),()=>window.removeEventListener("storage",S)},[]),{layout:a,change:S=>m(N1(h.current,f,S))}}function H1({group:t,defaultColor:s,onSave:l,onClose:a}){const u=U.useRef(null),[h,f]=U.useState(t?.name||"新分组"),[d,m]=U.useState(t?.color||s),[g,S]=U.useState("");return U.useEffect(()=>{const v=u.current;return v.showModal(),v.querySelector("input")?.select(),()=>v.close()},[]),C.jsx("dialog",{ref:u,className:"session-close-dialog session-group-dialog","aria-labelledby":"group-dialog-title",onCancel:v=>{v.preventDefault(),a()},children:C.jsxs("form",{onSubmit:v=>{if(v.preventDefault(),!h.trim()){S("请输入分组名称");return}try{l(h.trim(),d)}catch(w){S(Ri(w))}},children:[C.jsx("h2",{id:"group-dialog-title",children:t?"编辑分组":"新建标签分组"}),C.jsx("label",{htmlFor:"session-group-name",children:"名称"}),C.jsx("input",{id:"session-group-name",autoFocus:!0,maxLength:40,value:h,onChange:v=>{f(v.target.value),S("")}}),C.jsxs("fieldset",{className:"group-colors",children:[C.jsx("legend",{children:"颜色"}),ac.map(v=>C.jsx("button",{type:"button","aria-label":oc[v].label,"aria-pressed":d===v,onClick:()=>m(v),style:{background:oc[v].color},children:d===v?"✓":""},v))]}),g&&C.jsx("p",{className:"error",role:"alert",children:g}),C.jsxs("div",{className:"session-close-actions",children:[C.jsx("button",{type:"button",onClick:a,children:"取消"}),C.jsx("button",{className:"primary",disabled:!h.trim(),children:"保存"})]})]})})}var U1=zp();function j1({position:t,onClose:s,children:l}){const a=U.useRef(null);return U.useLayoutEffect(()=>{const u=a.current,h=u.getBoundingClientRect();u.style.left=`${Math.max(8,Math.min(t.x,window.innerWidth-h.width-8))}px`,u.style.top=`${Math.max(8,Math.min(t.y,window.innerHeight-h.height-8))}px`,u.querySelector("button:not(:disabled)")?.focus({preventScroll:!0})},[t]),U.useEffect(()=>{const u=f=>{a.current?.contains(f.target)||s()},h=()=>s();return document.addEventListener("pointerdown",u),window.addEventListener("resize",h),()=>{document.removeEventListener("pointerdown",u),window.removeEventListener("resize",h)}},[s]),U1.createPortal(C.jsx("div",{ref:a,role:"menu","aria-label":"标签分组菜单",className:"tab-menu",style:{left:t.x,top:t.y},onKeyDown:u=>{if(u.key==="Escape"){u.preventDefault(),s(),t.anchor?.focus({preventScroll:!0});return}if(u.key==="Tab"){s();return}if(!["ArrowDown","ArrowUp","Home","End"].includes(u.key))return;u.preventDefault();const h=[...a.current.querySelectorAll("button:not(:disabled)")],f=h.indexOf(document.activeElement),d=u.key==="Home"?0:u.key==="End"?h.length-1:(f+(u.key==="ArrowDown"?1:-1)+h.length)%h.length;h[d]?.focus()},children:l}),document.body)}function q1({progress:t}){const s=t.state===3?"CLI 正在运行":t.state===2?`CLI 报告错误 · ${t.value}%`:t.state===4?`CLI 暂停或警告 · ${t.value}%`:`CLI 进度 · ${t.value}%`;return C.jsx("span",{className:`terminal-progress progress-state-${t.state}`,title:s,role:"progressbar","aria-label":s,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":t.state===3?void 0:t.value,children:C.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[C.jsx("circle",{className:"progress-track",cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"2"}),C.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"2",pathLength:"100",strokeDasharray:`${t.state===3?25:t.value} 100`})]})})}function Y1(t){const s=t.processName?.replace(/^.*\//,"")||"",l=/^(codex|claude)(?:$|[-.])/i.exec(s)?.[1]?.toLowerCase(),a=t.cwd.replace(/\/+$/,"").split("/").pop()||"/";return{name:t.title?.trim()||s||t.name,folder:a,agent:l}}function K1({sessions:t,selected:s,reachable:l,onSelect:a,onClose:u,sessionsReady:h,onNotice:f}){const d=U.useRef(null),{layout:m,change:g}=z1(t,h,f),S=m.groups,[v,w]=U.useState(null),[O,T]=U.useState(null),[k,j]=U.useState(null),[F,ve]=U.useState(null),he=U.useCallback(()=>w(null),[]),te=E=>g({type:"toggle",id:E});function $(E,I){const ie=E.currentTarget.getBoundingClientRect();return{x:I&&E.clientX?E.clientX:ie.left,y:I&&E.clientY?E.clientY:ie.bottom+4,anchor:E.currentTarget.matches("button")?E.currentTarget:E.currentTarget.querySelector("button")}}function oe(E,I,ie=!1){E.preventDefault(),w({...$(E,ie),kind:"session",session:I})}function ce(E,I,ie=!1){E.preventDefault(),w({...$(E,ie),kind:"group",group:I})}const ge=(E,I)=>{he(),g({type:"assign",sessionId:E.id,groupId:I})},je=()=>{j(null),ve(null)};function qe(E,I){he(),j(I),E.dataTransfer.effectAllowed="move",E.dataTransfer.setData("text/plain",Lt(I))}function we(E,I){if(!k)return;E.preventDefault(),E.stopPropagation(),E.dataTransfer.dropEffect="move",ve(B=>JSON.stringify(B)===JSON.stringify(I)?B:I);const ie=d.current;if(ie){const B=ie.getBoundingClientRect();E.clientX<B.left+24?ie.scrollLeft-=12:E.clientX>B.right-24&&(ie.scrollLeft+=12)}}function ee(E,I){k&&(E.preventDefault(),E.stopPropagation(),g({type:"drop",item:k,target:I}),je())}function K(E,I){const ie=E.currentTarget.getBoundingClientRect();return{kind:"session",id:I,side:E.clientX<ie.left+ie.width/2?"before":"after"}}const re=S.map(E=>`${E.id}:${E.collapsed}`).join(",");U.useEffect(()=>{const E=d.current;if(!E)return;const I=()=>(E.querySelector(".session.active")||E.querySelector(".session-group-label.active"))?.scrollIntoView({block:"nearest",inline:"nearest"});I();const ie=new ResizeObserver(I);return ie.observe(E),()=>ie.disconnect()},[s,re]);const Z=E=>{const{name:I,folder:ie,agent:B}=Y1(E),_e=s===E.id,se=l?E.running?"live":"ended":"offline",b=l?E.running?"会话运行中":"会话已结束":"状态同步已断开",H=se==="live"&&!!E.outputActive,G=F?.kind==="session"&&F.id===E.id?` drop-${F.side}`:"";return C.jsxs("div",{className:`session ${_e?"active":""}${G}${k?.kind==="session"&&k.id===E.id?" dragging":""}`,"data-session-id":E.id,draggable:!0,onDragStart:Q=>qe(Q,{kind:"session",id:E.id}),onDragEnd:je,onDragOver:Q=>we(Q,K(Q,E.id)),onDrop:Q=>ee(Q,K(Q,E.id)),onContextMenu:Q=>oe(Q,E,!0),children:[C.jsxs("button",{className:"session-select",draggable:!0,"aria-pressed":_e,title:`${I}
10
+ ${E.cwd}
11
+ ${b}
12
+ 拖动可排序,拖到组名加入分组`,onClick:()=>a(E.id),children:[C.jsx("span",{className:`dot ${se}${H?" output-active":""}`,"aria-label":H?"终端正在输出":b}),se==="live"&&E.progress&&C.jsx(q1,{progress:E.progress}),B&&C.jsx("span",{className:`command-icon ${B}`,"aria-label":B,children:B==="claude"?"✳":"›_"}),C.jsx("strong",{children:I}),C.jsx("small",{children:ie})]}),C.jsx("button",{className:"tab-more","aria-label":`${I} 的标签菜单`,title:"标签菜单(也可右键标签)","aria-haspopup":"menu","aria-expanded":v?.kind==="session"&&v.session.id===E.id,onClick:Q=>oe(Q,E),children:"⋯"}),C.jsx("button",{className:"end","aria-label":`结束 ${I}`,title:`结束 ${I}`,onClick:()=>u(E),children:"×"})]},E.id)},z=v?.kind==="session"?S.find(E=>E.sessionIds.includes(v.session.id)):void 0,P=(E,I=!1)=>C.jsxs(C.Fragment,{children:[C.jsx("hr",{}),C.jsx("button",{role:"menuitem",onClick:()=>{g({type:"move",item:E,direction:"first"}),he(),d.current?.scrollTo({left:0})},children:I?"移到组内最前面":"移到最前面"}),C.jsx("button",{role:"menuitem",onClick:()=>{g({type:"move",item:E,direction:-1}),he()},children:"向前移动"}),C.jsx("button",{role:"menuitem",onClick:()=>{g({type:"move",item:E,direction:1}),he()},children:"向后移动"})]});return C.jsxs(C.Fragment,{children:[C.jsx("div",{ref:d,className:`session-list${F?.kind==="end"?" drop-end":""}`,"aria-label":"终端标签",onDragOver:E=>we(E,{kind:"end"}),onDrop:E=>ee(E,{kind:"end"}),children:L1(t,m).map(E=>{if(!E.group)return Z(E.sessions[0]);const I=E.group,ie=I.collapsed,B=E.sessions.some(se=>se.id===s),_e=l&&E.sessions.some(se=>se.running&&se.outputActive);return C.jsxs("div",{className:`session-group ${ie?"collapsed":""}${k?.kind==="group"&&k.id===I.id?" dragging":""}`,"data-group-id":I.id,role:"group","aria-label":I.name,style:{"--group-color":oc[I.color].color},children:[C.jsxs("div",{className:`session-group-header${F?.kind==="group"&&F.id===I.id?" drop-group":""}`,draggable:!0,onDragStart:se=>qe(se,{kind:"group",id:I.id}),onDragEnd:je,onDragOver:se=>we(se,{kind:"group",id:I.id}),onDrop:se=>ee(se,{kind:"group",id:I.id}),onContextMenu:se=>ce(se,I,!0),children:[C.jsxs("button",{className:`session-group-label ${B?"active":""}`,draggable:!0,"aria-expanded":!ie,"aria-label":`${ie?"展开":"折叠"}分组 ${I.name}(${E.sessions.length} 个标签)`,title:`${I.name} · ${E.sessions.length} 个标签,点击${ie?"展开":"折叠"},拖动可排序`,onClick:()=>te(I.id),children:[C.jsx("span",{className:"group-chevron","aria-hidden":"true",children:ie?"›":"⌄"}),C.jsx("span",{className:"group-name",children:I.name}),C.jsx("span",{className:"group-count",children:E.sessions.length}),ie&&_e&&C.jsx("span",{className:"group-output","aria-label":"组内终端正在输出"})]}),C.jsx("button",{className:"group-more","aria-label":`${I.name} 的分组菜单`,title:"编辑分组","aria-haspopup":"menu","aria-expanded":v?.kind==="group"&&v.group.id===I.id,onClick:se=>ce(se,I),children:"⋯"})]}),!ie&&E.sessions.map(Z)]},I.id)})}),v&&C.jsx(j1,{position:v,onClose:he,children:v.kind==="session"?C.jsxs(C.Fragment,{children:[C.jsx("button",{role:"menuitem",onClick:()=>{T({session:v.session}),he()},children:"添加到新分组…"}),S.length>0&&C.jsx("div",{className:"tab-menu-caption",children:"移至分组"}),S.map(E=>C.jsxs("button",{role:"menuitem",disabled:E.id===z?.id,onClick:()=>ge(v.session,E.id),children:[C.jsx("span",{className:"menu-color",style:{background:oc[E.color].color}}),E.name,E.id===z?.id&&C.jsx("span",{className:"menu-check",children:"✓"})]},E.id)),z&&C.jsxs(C.Fragment,{children:[C.jsx("hr",{}),C.jsx("button",{role:"menuitem",onClick:()=>ge(v.session,null),children:"移出分组"})]}),P({kind:"session",id:v.session.id},!!z)]}):C.jsxs(C.Fragment,{children:[C.jsx("button",{role:"menuitem",onClick:()=>{T({group:v.group}),he()},children:"编辑名称和颜色…"}),C.jsx("button",{role:"menuitem",onClick:()=>{te(v.group.id),he()},children:v.group.collapsed?"展开分组":"折叠分组"}),C.jsx("hr",{}),C.jsx("button",{role:"menuitem",onClick:()=>{g({type:"ungroup",id:v.group.id}),he()},children:"取消分组"}),P({kind:"group",id:v.group.id})]})}),O&&C.jsx(H1,{group:"group"in O?O.group:void 0,defaultColor:ac[S.length%ac.length],onClose:()=>T(null),onSave:(E,I)=>{"group"in O?g({type:"edit",id:O.group.id,name:E,color:I}):g({type:"create",id:globalThis.crypto?.randomUUID?.()||`group-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:E,color:I,sessionId:O.session.id}),T(null)}})]})}var jp=Object.defineProperty,P1=Object.getOwnPropertyDescriptor,I1=(t,s)=>{for(var l in s)jp(t,l,{get:s[l],enumerable:!0})},vt=(t,s,l,a)=>{for(var u=a>1?void 0:a?P1(s,l):s,h=t.length-1,f;h>=0;h--)(f=t[h])&&(u=(a?f(s,l,u):f(u))||u);return a&&u&&jp(s,l,u),u},ue=(t,s)=>(l,a)=>s(l,a,t),qv="Terminal input",vf={get:()=>qv,set:t=>qv=t},Yv="Too much output to announce, navigate to rows manually to read",pf={get:()=>Yv,set:t=>Yv=t};function V1(t){return t.replace(/\r?\n/g,"\r")}function X1(t,s){return s?"\x1B[200~"+t+"\x1B[201~":t}function G1(t,s){t.clipboardData&&t.clipboardData.setData("text/plain",s.selectionText),t.preventDefault()}function W1(t,s,l,a){if(t.stopPropagation(),t.clipboardData){let u=t.clipboardData.getData("text/plain");qp(u,s,l,a)}}function qp(t,s,l,a){t=V1(t),t=X1(t,l.decPrivateModes.bracketedPasteMode&&a.rawOptions.ignoreBracketedPasteMode!==!0),l.triggerDataEvent(t,!0),s.value=""}function Yp(t,s,l){let a=l.getBoundingClientRect(),u=t.clientX-a.left-10,h=t.clientY-a.top-10;s.style.width="20px",s.style.height="20px",s.style.left=`${u}px`,s.style.top=`${h}px`,s.style.zIndex="1000",s.focus()}function Kv(t,s,l,a,u){Yp(t,s,l),u&&a.rightClickSelect(t),s.value=a.selectionText,s.select()}function pr(t){return t>65535?(t-=65536,String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)}function mc(t,s=0,l=t.length){let a="";for(let u=s;u<l;++u){let h=t[u];h>65535?(h-=65536,a+=String.fromCharCode((h>>10)+55296)+String.fromCharCode(h%1024+56320)):a+=String.fromCharCode(h)}return a}var F1=class{constructor(){this._interim=0}clear(){this._interim=0}decode(t,s){let l=t.length;if(!l)return 0;let a=0,u=0;if(this._interim){let h=t.charCodeAt(u++);56320<=h&&h<=57343?s[a++]=(this._interim-55296)*1024+h-56320+65536:(s[a++]=this._interim,s[a++]=h),this._interim=0}for(let h=u;h<l;++h){let f=t.charCodeAt(h);if(55296<=f&&f<=56319){if(++h>=l)return this._interim=f,a;let d=t.charCodeAt(h);56320<=d&&d<=57343?s[a++]=(f-55296)*1024+d-56320+65536:(s[a++]=f,s[a++]=d);continue}f!==65279&&(s[a++]=f)}return a}},Z1=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(t,s){let l=t.length;if(!l)return 0;let a=0,u,h,f,d,m=0,g=0;if(this.interim[0]){let w=!1,O=this.interim[0];O&=(O&224)===192?31:(O&240)===224?15:7;let T=0,k;for(;(k=this.interim[++T]&63)&&T<4;)O<<=6,O|=k;let j=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,F=j-T;for(;g<F;){if(g>=l)return 0;if(k=t[g++],(k&192)!==128){g--,w=!0;break}else this.interim[T++]=k,O<<=6,O|=k&63}w||(j===2?O<128?g--:s[a++]=O:j===3?O<2048||O>=55296&&O<=57343||O===65279||(s[a++]=O):O<65536||O>1114111||(s[a++]=O)),this.interim.fill(0)}let S=l-4,v=g;for(;v<l;){for(;v<S&&!((u=t[v])&128)&&!((h=t[v+1])&128)&&!((f=t[v+2])&128)&&!((d=t[v+3])&128);)s[a++]=u,s[a++]=h,s[a++]=f,s[a++]=d,v+=4;if(u=t[v++],u<128)s[a++]=u;else if((u&224)===192){if(v>=l)return this.interim[0]=u,a;if(h=t[v++],(h&192)!==128){v--;continue}if(m=(u&31)<<6|h&63,m<128){v--;continue}s[a++]=m}else if((u&240)===224){if(v>=l)return this.interim[0]=u,a;if(h=t[v++],(h&192)!==128){v--;continue}if(v>=l)return this.interim[0]=u,this.interim[1]=h,a;if(f=t[v++],(f&192)!==128){v--;continue}if(m=(u&15)<<12|(h&63)<<6|f&63,m<2048||m>=55296&&m<=57343||m===65279)continue;s[a++]=m}else if((u&248)===240){if(v>=l)return this.interim[0]=u,a;if(h=t[v++],(h&192)!==128){v--;continue}if(v>=l)return this.interim[0]=u,this.interim[1]=h,a;if(f=t[v++],(f&192)!==128){v--;continue}if(v>=l)return this.interim[0]=u,this.interim[1]=h,this.interim[2]=f,a;if(d=t[v++],(d&192)!==128){v--;continue}if(m=(u&7)<<18|(h&63)<<12|(f&63)<<6|d&63,m<65536||m>1114111)continue;s[a++]=m}}return a}},Kp="",Sr=" ",ma=class Pp{constructor(){this.fg=0,this.bg=0,this.extended=new uc}static toColorRGB(s){return[s>>>16&255,s>>>8&255,s&255]}static fromColorRGB(s){return(s[0]&255)<<16|(s[1]&255)<<8|s[2]&255}clone(){let s=new Pp;return s.fg=this.fg,s.bg=this.bg,s.extended=this.extended.clone(),s}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}},uc=class Ip{constructor(s=0,l=0){this._ext=0,this._urlId=0,this._ext=s,this._urlId=l}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(s){this._ext=s}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(s){this._ext&=-469762049,this._ext|=s<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(s){this._ext&=-67108864,this._ext|=s&67108863}get urlId(){return this._urlId}set urlId(s){this._urlId=s}get underlineVariantOffset(){let s=(this._ext&3758096384)>>29;return s<0?s^4294967288:s}set underlineVariantOffset(s){this._ext&=536870911,this._ext|=s<<29&3758096384}clone(){return new Ip(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Ki=class Vp extends ma{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new uc,this.combinedData=""}static fromCharData(s){let l=new Vp;return l.setFromCharData(s),l}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?pr(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(s){this.fg=s[0],this.bg=0;let l=!1;if(s[1].length>2)l=!0;else if(s[1].length===2){let a=s[1].charCodeAt(0);if(55296<=a&&a<=56319){let u=s[1].charCodeAt(1);56320<=u&&u<=57343?this.content=(a-55296)*1024+u-56320+65536|s[2]<<22:l=!0}else l=!0}else this.content=s[1].charCodeAt(0)|s[2]<<22;l&&(this.combinedData=s[1],this.content=2097152|s[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Pv="di$target",Sf="di$dependencies",tf=new Map;function Q1(t){return t[Sf]||[]}function qt(t){if(tf.has(t))return tf.get(t);let s=function(l,a,u){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");$1(s,l,u)};return s._id=t,tf.set(t,s),s}function $1(t,s,l){s[Pv]===s?s[Sf].push({id:t,index:l}):(s[Sf]=[{id:t,index:l}],s[Pv]=s)}var ai=qt("BufferService"),Xp=qt("CoreMouseService"),tn=qt("CoreService"),J1=qt("CharsetService"),id=qt("InstantiationService"),Gp=qt("LogService"),oi=qt("OptionsService"),Wp=qt("OscLinkService"),eb=qt("UnicodeService"),va=qt("DecorationService"),yf=class{constructor(t,s,l){this._bufferService=t,this._optionsService=s,this._oscLinkService=l}provideLinks(t,s){let l=this._bufferService.buffer.lines.get(t-1);if(!l){s(void 0);return}let a=[],u=this._optionsService.rawOptions.linkHandler,h=new Ki,f=l.getTrimmedLength(),d=-1,m=-1,g=!1;for(let S=0;S<f;S++)if(!(m===-1&&!l.hasContent(S))){if(l.loadCell(S,h),h.hasExtendedAttrs()&&h.extended.urlId)if(m===-1){m=S,d=h.extended.urlId;continue}else g=h.extended.urlId!==d;else m!==-1&&(g=!0);if(g||m!==-1&&S===f-1){let v=this._oscLinkService.getLinkData(d)?.uri;if(v){let w={start:{x:m+1,y:t},end:{x:S+(!g&&S===f-1?1:0),y:t}},O=!1;if(!u?.allowNonHttpProtocols)try{let T=new URL(v);["http:","https:"].includes(T.protocol)||(O=!0)}catch{O=!0}O||a.push({text:v,range:w,activate:(T,k)=>u?u.activate(T,k,w):tb(T,k),hover:(T,k)=>u?.hover?.(T,k,w),leave:(T,k)=>u?.leave?.(T,k,w)})}g=!1,h.hasExtendedAttrs()&&h.extended.urlId?(m=S,d=h.extended.urlId):(m=-1,d=-1)}}s(a)}};yf=vt([ue(0,ai),ue(1,oi),ue(2,Wp)],yf);function tb(t,s){if(confirm(`Do you want to navigate to ${s}?
13
+
14
+ WARNING: This link could potentially be dangerous`)){let l=window.open();if(l){try{l.opener=null}catch{}l.location.href=s}else console.warn("Opening link blocked as opener could not be cleared")}}var vc=qt("CharSizeService"),Us=qt("CoreBrowserService"),sd=qt("MouseService"),js=qt("RenderService"),ib=qt("SelectionService"),Fp=qt("CharacterJoinerService"),il=qt("ThemeService"),Zp=qt("LinkProviderService"),sb=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?Iv.isErrorNoTelemetry(t)?new Iv(t.message+`
15
+
16
+ `+t.stack):new Error(t.message+`
17
+
18
+ `+t.stack):t},0)}}addListener(t){return this.listeners.push(t),()=>{this._removeListener(t)}}emit(t){this.listeners.forEach(s=>{s(t)})}_removeListener(t){this.listeners.splice(this.listeners.indexOf(t),1)}setUnexpectedErrorHandler(t){this.unexpectedErrorHandler=t}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(t){this.unexpectedErrorHandler(t),this.emit(t)}onUnexpectedExternalError(t){this.unexpectedErrorHandler(t)}},rb=new sb;function tc(t){nb(t)||rb.onUnexpectedError(t)}var bf="Canceled";function nb(t){return t instanceof lb?!0:t instanceof Error&&t.name===bf&&t.message===bf}var lb=class extends Error{constructor(){super(bf),this.name=this.message}};function ab(t){return new Error(`Illegal argument: ${t}`)}var Iv=class wf extends Error{constructor(s){super(s),this.name="CodeExpectedError"}static fromError(s){if(s instanceof wf)return s;let l=new wf;return l.message=s.message,l.stack=s.stack,l}static isErrorNoTelemetry(s){return s.name==="CodeExpectedError"}},Cf=class Qp extends Error{constructor(s){super(s||"An unexpected bug occurred."),Object.setPrototypeOf(this,Qp.prototype)}};function Ti(t,s=0){return t[t.length-(1+s)]}var ob;(t=>{function s(h){return h<0}t.isLessThan=s;function l(h){return h<=0}t.isLessThanOrEqual=l;function a(h){return h>0}t.isGreaterThan=a;function u(h){return h===0}t.isNeitherLessOrGreaterThan=u,t.greaterThan=1,t.lessThan=-1,t.neitherLessOrGreaterThan=0})(ob||={});function cb(t,s){let l=this,a=!1,u;return function(){return a||(a=!0,s||(u=t.apply(l,arguments))),u}}var $p;(t=>{function s(te){return te&&typeof te=="object"&&typeof te[Symbol.iterator]=="function"}t.is=s;let l=Object.freeze([]);function a(){return l}t.empty=a;function*u(te){yield te}t.single=u;function h(te){return s(te)?te:u(te)}t.wrap=h;function f(te){return te||l}t.from=f;function*d(te){for(let $=te.length-1;$>=0;$--)yield te[$]}t.reverse=d;function m(te){return!te||te[Symbol.iterator]().next().done===!0}t.isEmpty=m;function g(te){return te[Symbol.iterator]().next().value}t.first=g;function S(te,$){let oe=0;for(let ce of te)if($(ce,oe++))return!0;return!1}t.some=S;function v(te,$){for(let oe of te)if($(oe))return oe}t.find=v;function*w(te,$){for(let oe of te)$(oe)&&(yield oe)}t.filter=w;function*O(te,$){let oe=0;for(let ce of te)yield $(ce,oe++)}t.map=O;function*T(te,$){let oe=0;for(let ce of te)yield*$(ce,oe++)}t.flatMap=T;function*k(...te){for(let $ of te)yield*$}t.concat=k;function j(te,$,oe){let ce=oe;for(let ge of te)ce=$(ce,ge);return ce}t.reduce=j;function*F(te,$,oe=te.length){for($<0&&($+=te.length),oe<0?oe+=te.length:oe>te.length&&(oe=te.length);$<oe;$++)yield te[$]}t.slice=F;function ve(te,$=Number.POSITIVE_INFINITY){let oe=[];if($===0)return[oe,te];let ce=te[Symbol.iterator]();for(let ge=0;ge<$;ge++){let je=ce.next();if(je.done)return[oe,t.empty()];oe.push(je.value)}return[oe,{[Symbol.iterator](){return ce}}]}t.consume=ve;async function he(te){let $=[];for await(let oe of te)$.push(oe);return Promise.resolve($)}t.asyncToArray=he})($p||={});function Jr(t){if($p.is(t)){let s=[];for(let l of t)if(l)try{l.dispose()}catch(a){s.push(a)}if(s.length===1)throw s[0];if(s.length>1)throw new AggregateError(s,"Encountered errors while disposing of store");return Array.isArray(t)?[]:t}else if(t)return t.dispose(),t}function ub(...t){return ot(()=>Jr(t))}function ot(t){return{dispose:cb(()=>{t()})}}var Jp=class e0{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{Jr(this._toDispose)}finally{this._toDispose.clear()}}add(s){if(!s)return s;if(s===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?e0.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(s),s}delete(s){if(s){if(s===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(s),s.dispose()}}deleteAndLeak(s){s&&this._toDispose.has(s)&&(this._toDispose.delete(s),void 0)}};Jp.DISABLE_DISPOSED_WARNING=!1;var wr=Jp,ke=class{constructor(){this._store=new wr,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)}};ke.None=Object.freeze({dispose(){}});var tl=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(t){this._isDisposed||t===this._value||(this._value?.dispose(),this._value=t)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}clearAndLeak(){let t=this._value;return this._value=void 0,t}},Hs=typeof window=="object"?window:globalThis,Ef=class xf{constructor(s){this.element=s,this.next=xf.Undefined,this.prev=xf.Undefined}};Ef.Undefined=new Ef(void 0);var ut=Ef,Vv=class{constructor(){this._first=ut.Undefined,this._last=ut.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===ut.Undefined}clear(){let t=this._first;for(;t!==ut.Undefined;){let s=t.next;t.prev=ut.Undefined,t.next=ut.Undefined,t=s}this._first=ut.Undefined,this._last=ut.Undefined,this._size=0}unshift(t){return this._insert(t,!1)}push(t){return this._insert(t,!0)}_insert(t,s){let l=new ut(t);if(this._first===ut.Undefined)this._first=l,this._last=l;else if(s){let u=this._last;this._last=l,l.prev=u,u.next=l}else{let u=this._first;this._first=l,l.next=u,u.prev=l}this._size+=1;let a=!1;return()=>{a||(a=!0,this._remove(l))}}shift(){if(this._first!==ut.Undefined){let t=this._first.element;return this._remove(this._first),t}}pop(){if(this._last!==ut.Undefined){let t=this._last.element;return this._remove(this._last),t}}_remove(t){if(t.prev!==ut.Undefined&&t.next!==ut.Undefined){let s=t.prev;s.next=t.next,t.next.prev=s}else t.prev===ut.Undefined&&t.next===ut.Undefined?(this._first=ut.Undefined,this._last=ut.Undefined):t.next===ut.Undefined?(this._last=this._last.prev,this._last.next=ut.Undefined):t.prev===ut.Undefined&&(this._first=this._first.next,this._first.prev=ut.Undefined);this._size-=1}*[Symbol.iterator](){let t=this._first;for(;t!==ut.Undefined;)yield t.element,t=t.next}},hb=globalThis.performance&&typeof globalThis.performance.now=="function",fb=class t0{static create(s){return new t0(s)}constructor(s){this._now=hb&&s===!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}},Wt;(t=>{t.None=()=>ke.None;function s(ee,K){return v(ee,()=>{},0,void 0,!0,void 0,K)}t.defer=s;function l(ee){return(K,re=null,Z)=>{let z=!1,P;return P=ee(E=>{if(!z)return P?P.dispose():z=!0,K.call(re,E)},null,Z),z&&P.dispose(),P}}t.once=l;function a(ee,K,re){return g((Z,z=null,P)=>ee(E=>Z.call(z,K(E)),null,P),re)}t.map=a;function u(ee,K,re){return g((Z,z=null,P)=>ee(E=>{K(E),Z.call(z,E)},null,P),re)}t.forEach=u;function h(ee,K,re){return g((Z,z=null,P)=>ee(E=>K(E)&&Z.call(z,E),null,P),re)}t.filter=h;function f(ee){return ee}t.signal=f;function d(...ee){return(K,re=null,Z)=>{let z=ub(...ee.map(P=>P(E=>K.call(re,E))));return S(z,Z)}}t.any=d;function m(ee,K,re,Z){let z=re;return a(ee,P=>(z=K(z,P),z),Z)}t.reduce=m;function g(ee,K){let re,Z={onWillAddFirstListener(){re=ee(z.fire,z)},onDidRemoveLastListener(){re?.dispose()}},z=new ne(Z);return K?.add(z),z.event}function S(ee,K){return K instanceof Array?K.push(ee):K&&K.add(ee),ee}function v(ee,K,re=100,Z=!1,z=!1,P,E){let I,ie,B,_e=0,se,b={leakWarningThreshold:P,onWillAddFirstListener(){I=ee(G=>{_e++,ie=K(ie,G),Z&&!B&&(H.fire(ie),ie=void 0),se=()=>{let Q=ie;ie=void 0,B=void 0,(!Z||_e>1)&&H.fire(Q),_e=0},typeof re=="number"?(clearTimeout(B),B=setTimeout(se,re)):B===void 0&&(B=0,queueMicrotask(se))})},onWillRemoveListener(){z&&_e>0&&se?.()},onDidRemoveLastListener(){se=void 0,I.dispose()}},H=new ne(b);return E?.add(H),H.event}t.debounce=v;function w(ee,K=0,re){return t.debounce(ee,(Z,z)=>Z?(Z.push(z),Z):[z],K,void 0,!0,void 0,re)}t.accumulate=w;function O(ee,K=(Z,z)=>Z===z,re){let Z=!0,z;return h(ee,P=>{let E=Z||!K(P,z);return Z=!1,z=P,E},re)}t.latch=O;function T(ee,K,re){return[t.filter(ee,K,re),t.filter(ee,Z=>!K(Z),re)]}t.split=T;function k(ee,K=!1,re=[],Z){let z=re.slice(),P=ee(ie=>{z?z.push(ie):I.fire(ie)});Z&&Z.add(P);let E=()=>{z?.forEach(ie=>I.fire(ie)),z=null},I=new ne({onWillAddFirstListener(){P||(P=ee(ie=>I.fire(ie)),Z&&Z.add(P))},onDidAddFirstListener(){z&&(K?setTimeout(E):E())},onDidRemoveLastListener(){P&&P.dispose(),P=null}});return Z&&Z.add(I),I.event}t.buffer=k;function j(ee,K){return(re,Z,z)=>{let P=K(new ve);return ee(function(E){let I=P.evaluate(E);I!==F&&re.call(Z,I)},void 0,z)}}t.chain=j;let F=Symbol("HaltChainable");class ve{constructor(){this.steps=[]}map(K){return this.steps.push(K),this}forEach(K){return this.steps.push(re=>(K(re),re)),this}filter(K){return this.steps.push(re=>K(re)?re:F),this}reduce(K,re){let Z=re;return this.steps.push(z=>(Z=K(Z,z),Z)),this}latch(K=(re,Z)=>re===Z){let re=!0,Z;return this.steps.push(z=>{let P=re||!K(z,Z);return re=!1,Z=z,P?z:F}),this}evaluate(K){for(let re of this.steps)if(K=re(K),K===F)break;return K}}function he(ee,K,re=Z=>Z){let Z=(...I)=>E.fire(re(...I)),z=()=>ee.on(K,Z),P=()=>ee.removeListener(K,Z),E=new ne({onWillAddFirstListener:z,onDidRemoveLastListener:P});return E.event}t.fromNodeEventEmitter=he;function te(ee,K,re=Z=>Z){let Z=(...I)=>E.fire(re(...I)),z=()=>ee.addEventListener(K,Z),P=()=>ee.removeEventListener(K,Z),E=new ne({onWillAddFirstListener:z,onDidRemoveLastListener:P});return E.event}t.fromDOMEventEmitter=te;function $(ee){return new Promise(K=>l(ee)(K))}t.toPromise=$;function oe(ee){let K=new ne;return ee.then(re=>{K.fire(re)},()=>{K.fire(void 0)}).finally(()=>{K.dispose()}),K.event}t.fromPromise=oe;function ce(ee,K){return ee(re=>K.fire(re))}t.forward=ce;function ge(ee,K,re){return K(re),ee(Z=>K(Z))}t.runAndSubscribe=ge;class je{constructor(K,re){this._observable=K,this._counter=0,this._hasChanged=!1;let Z={onWillAddFirstListener:()=>{K.addObserver(this)},onDidRemoveLastListener:()=>{K.removeObserver(this)}};this.emitter=new ne(Z),re&&re.add(this.emitter)}beginUpdate(K){this._counter++}handlePossibleChange(K){}handleChange(K,re){this._hasChanged=!0}endUpdate(K){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function qe(ee,K){return new je(ee,K).emitter.event}t.fromObservable=qe;function we(ee){return(K,re,Z)=>{let z=0,P=!1,E={beginUpdate(){z++},endUpdate(){z--,z===0&&(ee.reportChanges(),P&&(P=!1,K.call(re)))},handlePossibleChange(){},handleChange(){P=!0}};ee.addObserver(E),ee.reportChanges();let I={dispose(){ee.removeObserver(E)}};return Z instanceof wr?Z.add(I):Array.isArray(Z)&&Z.push(I),I}}t.fromObservableLight=we})(Wt||={});var Tf=class Df{constructor(s){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${s}_${Df._idPool++}`,Df.all.add(this)}start(s){this._stopWatch=new fb,this.listenerCount=s}stop(){if(this._stopWatch){let s=this._stopWatch.elapsed();this.durations.push(s),this.elapsedOverall+=s,this.invocationCount+=1,this._stopWatch=void 0}}};Tf.all=new Set,Tf._idPool=0;var db=Tf,_b=-1,i0=class s0{constructor(s,l,a=(s0._idPool++).toString(16).padStart(3,"0")){this._errorHandler=s,this.threshold=l,this.name=a,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(s,l){let a=this.threshold;if(a<=0||l<a)return;this._stacks||(this._stacks=new Map);let u=this._stacks.get(s.value)||0;if(this._stacks.set(s.value,u+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=a*.5;let[h,f]=this.getMostFrequentStack(),d=`[${this.name}] potential listener LEAK detected, having ${l} listeners already. MOST frequent listener (${f}):`;console.warn(d),console.warn(h);let m=new vb(d,h);this._errorHandler(m)}return()=>{let h=this._stacks.get(s.value)||0;this._stacks.set(s.value,h-1)}}getMostFrequentStack(){if(!this._stacks)return;let s,l=0;for(let[a,u]of this._stacks)(!s||l<u)&&(s=[a,u],l=u);return s}};i0._idPool=1;var gb=i0,mb=class r0{constructor(s){this.value=s}static create(){let s=new Error;return new r0(s.stack??"")}print(){console.warn(this.value.split(`
19
+ `).slice(2).join(`
20
+ `))}},vb=class extends Error{constructor(t,s){super(t),this.name="ListenerLeakError",this.stack=s}},pb=class extends Error{constructor(t,s){super(t),this.name="ListenerRefusalError",this.stack=s}},Sb=0,sf=class{constructor(t){this.value=t,this.id=Sb++}},yb=2,bb,ne=class{constructor(t){this._size=0,this._options=t,this._leakageMon=this._options?.leakWarningThreshold?new gb(t?.onListenerError??tc,this._options?.leakWarningThreshold??_b):void 0,this._perfMon=this._options?._profName?new db(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(t,s,l)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let f=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(f);let d=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],m=new pb(`${f}. HINT: Stack shows most frequent listener (${d[1]}-times)`,d[0]);return(this._options?.onListenerError||tc)(m),ke.None}if(this._disposed)return ke.None;s&&(t=t.bind(s));let a=new sf(t),u;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(a.stack=mb.create(),u=this._leakageMon.check(a.stack,this._size+1)),this._listeners?this._listeners instanceof sf?(this._deliveryQueue??=new wb,this._listeners=[this._listeners,a]):this._listeners.push(a):(this._options?.onWillAddFirstListener?.(this),this._listeners=a,this._options?.onDidAddFirstListener?.(this)),this._size++;let h=ot(()=>{u?.(),this._removeListener(a)});return l instanceof wr?l.add(h):Array.isArray(l)&&l.push(h),h},this._event}_removeListener(t){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let s=this._listeners,l=s.indexOf(t);if(l===-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--,s[l]=void 0;let a=this._deliveryQueue.current===this;if(this._size*yb<=s.length){let u=0;for(let h=0;h<s.length;h++)s[h]?s[u++]=s[h]:a&&(this._deliveryQueue.end--,u<this._deliveryQueue.i&&this._deliveryQueue.i--);s.length=u}}_deliver(t,s){if(!t)return;let l=this._options?.onListenerError||tc;if(!l){t.value(s);return}try{t.value(s)}catch(a){l(a)}}_deliverQueue(t){let s=t.current._listeners;for(;t.i<t.end;)this._deliver(s[t.i++],t.value);t.reset()}fire(t){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof sf)this._deliver(this._listeners,t);else{let s=this._deliveryQueue;s.enqueue(this,t,this._listeners.length),this._deliverQueue(s)}this._perfMon?.stop()}hasListeners(){return this._size>0}},wb=class{constructor(){this.i=-1,this.end=0}enqueue(t,s,l){this.i=0,this.end=l,this.current=t,this.value=s}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Mf=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new ne,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new ne,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(s){return this.mapWindowIdToZoomLevel.get(this.getWindowId(s))??0}setZoomLevel(s,l){if(this.getZoomLevel(l)===s)return;let a=this.getWindowId(l);this.mapWindowIdToZoomLevel.set(a,s),this._onDidChangeZoomLevel.fire(a)}getZoomFactor(s){return this.mapWindowIdToZoomFactor.get(this.getWindowId(s))??1}setZoomFactor(s,l){this.mapWindowIdToZoomFactor.set(this.getWindowId(l),s)}setFullscreen(s,l){if(this.isFullscreen(l)===s)return;let a=this.getWindowId(l);this.mapWindowIdToFullScreen.set(a,s),this._onDidChangeFullscreen.fire(a)}isFullscreen(s){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(s))}getWindowId(s){return s.vscodeWindowId}};Mf.INSTANCE=new Mf;var rd=Mf;function Cb(t,s,l){typeof s=="string"&&(s=t.matchMedia(s)),s.addEventListener("change",l)}rd.INSTANCE.onDidChangeZoomLevel;function Eb(t){return rd.INSTANCE.getZoomFactor(t)}rd.INSTANCE.onDidChangeFullscreen;var sl=typeof navigator=="object"?navigator.userAgent:"",Rf=sl.indexOf("Firefox")>=0,xb=sl.indexOf("AppleWebKit")>=0,nd=sl.indexOf("Chrome")>=0,Tb=!nd&&sl.indexOf("Safari")>=0;sl.indexOf("Electron/")>=0;sl.indexOf("Android")>=0;var rf=!1;if(typeof Hs.matchMedia=="function"){let t=Hs.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),s=Hs.matchMedia("(display-mode: fullscreen)");rf=t.matches,Cb(Hs,t,({matches:l})=>{rf&&s.matches||(rf=l)})}var el="en",Of=!1,Af=!1,ic=!1,n0=!1,Fo,sc=el,Xv=el,Db,zs,$r=globalThis,Mi;typeof $r.vscode<"u"&&typeof $r.vscode.process<"u"?Mi=$r.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Mi=process);var Mb=typeof Mi?.versions?.electron=="string",Rb=Mb&&Mi?.type==="renderer";if(typeof Mi=="object"){Of=Mi.platform==="win32",Af=Mi.platform==="darwin",ic=Mi.platform==="linux",ic&&Mi.env.SNAP&&Mi.env.SNAP_REVISION,Mi.env.CI||Mi.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Fo=el,sc=el;let t=Mi.env.VSCODE_NLS_CONFIG;if(t)try{let s=JSON.parse(t);Fo=s.userLocale,Xv=s.osLocale,sc=s.resolvedLanguage||el,Db=s.languagePack?.translationsConfigFile}catch{}n0=!0}else typeof navigator=="object"&&!Rb?(zs=navigator.userAgent,Of=zs.indexOf("Windows")>=0,Af=zs.indexOf("Macintosh")>=0,(zs.indexOf("Macintosh")>=0||zs.indexOf("iPad")>=0||zs.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,ic=zs.indexOf("Linux")>=0,zs?.indexOf("Mobi")>=0,sc=globalThis._VSCODE_NLS_LANGUAGE||el,Fo=navigator.language.toLowerCase(),Xv=Fo):console.error("Unable to resolve platform.");var l0=Of,vs=Af,Ob=ic,Gv=n0,ps=zs,gr=sc,Ab;(t=>{function s(){return gr}t.value=s;function l(){return gr.length===2?gr==="en":gr.length>=3?gr[0]==="e"&&gr[1]==="n"&&gr[2]==="-":!1}t.isDefaultVariant=l;function a(){return gr==="en"}t.isDefault=a})(Ab||={});var Bb=typeof $r.postMessage=="function"&&!$r.importScripts;(()=>{if(Bb){let t=[];$r.addEventListener("message",l=>{if(l.data&&l.data.vscodeScheduleAsyncWork)for(let a=0,u=t.length;a<u;a++){let h=t[a];if(h.id===l.data.vscodeScheduleAsyncWork){t.splice(a,1),h.callback();return}}});let s=0;return l=>{let a=++s;t.push({id:a,callback:l}),$r.postMessage({vscodeScheduleAsyncWork:a},"*")}}return t=>setTimeout(t)})();var kb=!!(ps&&ps.indexOf("Chrome")>=0);ps&&ps.indexOf("Firefox")>=0;!kb&&ps&&ps.indexOf("Safari")>=0;ps&&ps.indexOf("Edg/")>=0;ps&&ps.indexOf("Android")>=0;var Qn=typeof navigator=="object"?navigator:{};Gv||document.queryCommandSupported&&document.queryCommandSupported("copy")||Qn&&Qn.clipboard&&Qn.clipboard.writeText,Gv||Qn&&Qn.clipboard&&Qn.clipboard.readText;var ld=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(t,s){this._keyCodeToStr[t]=s,this._strToKeyCode[s.toLowerCase()]=t}keyCodeToStr(t){return this._keyCodeToStr[t]}strToKeyCode(t){return this._strToKeyCode[t.toLowerCase()]||0}},nf=new ld,Wv=new ld,Fv=new ld,Nb=new Array(230),a0;(t=>{function s(d){return nf.keyCodeToStr(d)}t.toString=s;function l(d){return nf.strToKeyCode(d)}t.fromString=l;function a(d){return Wv.keyCodeToStr(d)}t.toUserSettingsUS=a;function u(d){return Fv.keyCodeToStr(d)}t.toUserSettingsGeneral=u;function h(d){return Wv.strToKeyCode(d)||Fv.strToKeyCode(d)}t.fromUserSettings=h;function f(d){if(d>=98&&d<=113)return null;switch(d){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return nf.keyCodeToStr(d)}t.toElectronAccelerator=f})(a0||={});var Lb=class o0{constructor(s,l,a,u,h){this.ctrlKey=s,this.shiftKey=l,this.altKey=a,this.metaKey=u,this.keyCode=h}equals(s){return s instanceof o0&&this.ctrlKey===s.ctrlKey&&this.shiftKey===s.shiftKey&&this.altKey===s.altKey&&this.metaKey===s.metaKey&&this.keyCode===s.keyCode}getHashCode(){let s=this.ctrlKey?"1":"0",l=this.shiftKey?"1":"0",a=this.altKey?"1":"0",u=this.metaKey?"1":"0";return`K${s}${l}${a}${u}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new zb([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},zb=class{constructor(t){if(t.length===0)throw ab("chords");this.chords=t}getHashCode(){let t="";for(let s=0,l=this.chords.length;s<l;s++)s!==0&&(t+=";"),t+=this.chords[s].getHashCode();return t}equals(t){if(t===null||this.chords.length!==t.chords.length)return!1;for(let s=0;s<this.chords.length;s++)if(!this.chords[s].equals(t.chords[s]))return!1;return!0}};function Hb(t){if(t.charCode){let l=String.fromCharCode(t.charCode).toUpperCase();return a0.fromString(l)}let s=t.keyCode;if(s===3)return 7;if(Rf)switch(s){case 59:return 85;case 60:if(Ob)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(vs)return 57;break}else if(xb&&(vs&&s===93||!vs&&s===92))return 57;return Nb[s]||0}var Ub=vs?256:2048,jb=512,qb=1024,Yb=vs?2048:256,Zv=class{constructor(t){this._standardKeyboardEventBrand=!0;let s=t;this.browserEvent=s,this.target=s.target,this.ctrlKey=s.ctrlKey,this.shiftKey=s.shiftKey,this.altKey=s.altKey,this.metaKey=s.metaKey,this.altGraphKey=s.getModifierState?.("AltGraph"),this.keyCode=Hb(s),this.code=s.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(t){return this._asKeybinding===t}_computeKeybinding(){let t=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(t=this.keyCode);let s=0;return this.ctrlKey&&(s|=Ub),this.altKey&&(s|=jb),this.shiftKey&&(s|=qb),this.metaKey&&(s|=Yb),s|=t,s}_computeKeyCodeChord(){let t=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(t=this.keyCode),new Lb(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,t)}},Qv=new WeakMap;function Kb(t){if(!t.parent||t.parent===t)return null;try{let s=t.location,l=t.parent.location;if(s.origin!=="null"&&l.origin!=="null"&&s.origin!==l.origin)return null}catch{return null}return t.parent}var Pb=class{static getSameOriginWindowChain(t){let s=Qv.get(t);if(!s){s=[],Qv.set(t,s);let l=t,a;do a=Kb(l),a?s.push({window:new WeakRef(l),iframeElement:l.frameElement||null}):s.push({window:new WeakRef(l),iframeElement:null}),l=a;while(l)}return s.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(t,s){if(!s||t===s)return{top:0,left:0};let l=0,a=0,u=this.getSameOriginWindowChain(t);for(let h of u){let f=h.window.deref();if(l+=f?.scrollY??0,a+=f?.scrollX??0,f===s||!h.iframeElement)break;let d=h.iframeElement.getBoundingClientRect();l+=d.top,a+=d.left}return{top:l,left:a}}},Zo=class{constructor(t,s){this.timestamp=Date.now(),this.browserEvent=s,this.leftButton=s.button===0,this.middleButton=s.button===1,this.rightButton=s.button===2,this.buttons=s.buttons,this.target=s.target,this.detail=s.detail||1,s.type==="dblclick"&&(this.detail=2),this.ctrlKey=s.ctrlKey,this.shiftKey=s.shiftKey,this.altKey=s.altKey,this.metaKey=s.metaKey,typeof s.pageX=="number"?(this.posx=s.pageX,this.posy=s.pageY):(this.posx=s.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=s.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let l=Pb.getPositionOfChildWindowRelativeToAncestorWindow(t,s.view);this.posx-=l.left,this.posy-=l.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},$v=class{constructor(t,s=0,l=0){this.browserEvent=t||null,this.target=t?t.target||t.targetNode||t.srcElement:null,this.deltaY=l,this.deltaX=s;let a=!1;if(nd){let u=navigator.userAgent.match(/Chrome\/(\d+)/);a=(u?parseInt(u[1]):123)<=122}if(t){let u=t,h=t,f=t.view?.devicePixelRatio||1;if(typeof u.wheelDeltaY<"u")a?this.deltaY=u.wheelDeltaY/(120*f):this.deltaY=u.wheelDeltaY/120;else if(typeof h.VERTICAL_AXIS<"u"&&h.axis===h.VERTICAL_AXIS)this.deltaY=-h.detail/3;else if(t.type==="wheel"){let d=t;d.deltaMode===d.DOM_DELTA_LINE?Rf&&!vs?this.deltaY=-t.deltaY/3:this.deltaY=-t.deltaY:this.deltaY=-t.deltaY/40}if(typeof u.wheelDeltaX<"u")Tb&&l0?this.deltaX=-(u.wheelDeltaX/120):a?this.deltaX=u.wheelDeltaX/(120*f):this.deltaX=u.wheelDeltaX/120;else if(typeof h.HORIZONTAL_AXIS<"u"&&h.axis===h.HORIZONTAL_AXIS)this.deltaX=-t.detail/3;else if(t.type==="wheel"){let d=t;d.deltaMode===d.DOM_DELTA_LINE?Rf&&!vs?this.deltaX=-t.deltaX/3:this.deltaX=-t.deltaX:this.deltaX=-t.deltaX/40}this.deltaY===0&&this.deltaX===0&&t.wheelDelta&&(a?this.deltaY=t.wheelDelta/(120*f):this.deltaY=t.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},c0=Object.freeze(function(t,s){let l=setTimeout(t.bind(s),0);return{dispose(){clearTimeout(l)}}}),Ib;(t=>{function s(l){return l===t.None||l===t.Cancelled||l instanceof Vb?!0:!l||typeof l!="object"?!1:typeof l.isCancellationRequested=="boolean"&&typeof l.onCancellationRequested=="function"}t.isCancellationToken=s,t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Wt.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:c0})})(Ib||={});var Vb=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?c0:(this._emitter||(this._emitter=new ne),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},ad=class{constructor(t,s){this._isDisposed=!1,this._token=-1,typeof t=="function"&&typeof s=="number"&&this.setIfNotSet(t,s)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(t,s){if(this._isDisposed)throw new Cf("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,t()},s)}setIfNotSet(t,s){if(this._isDisposed)throw new Cf("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,t()},s))}},Xb=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(t,s,l=globalThis){if(this.isDisposed)throw new Cf("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let a=l.setInterval(()=>{t()},s);this.disposable=ot(()=>{l.clearInterval(a),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},Gb;(t=>{async function s(a){let u,h=await Promise.all(a.map(f=>f.then(d=>d,d=>{u||(u=d)})));if(typeof u<"u")throw u;return h}t.settled=s;function l(a){return new Promise(async(u,h)=>{try{await a(u,h)}catch(f){h(f)}})}t.withAsyncBody=l})(Gb||={});var Jv=class qi{static fromArray(s){return new qi(l=>{l.emitMany(s)})}static fromPromise(s){return new qi(async l=>{l.emitMany(await s)})}static fromPromises(s){return new qi(async l=>{await Promise.all(s.map(async a=>l.emitOne(await a)))})}static merge(s){return new qi(async l=>{await Promise.all(s.map(async a=>{for await(let u of a)l.emitOne(u)}))})}constructor(s,l){this._state=0,this._results=[],this._error=null,this._onReturn=l,this._onStateChanged=new ne,queueMicrotask(async()=>{let a={emitOne:u=>this.emitOne(u),emitMany:u=>this.emitMany(u),reject:u=>this.reject(u)};try{await Promise.resolve(s(a)),this.resolve()}catch(u){this.reject(u)}finally{a.emitOne=void 0,a.emitMany=void 0,a.reject=void 0}})}[Symbol.asyncIterator](){let s=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(s<this._results.length)return{done:!1,value:this._results[s++]};if(this._state===1)return{done:!0,value:void 0};await Wt.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(s,l){return new qi(async a=>{for await(let u of s)a.emitOne(l(u))})}map(s){return qi.map(this,s)}static filter(s,l){return new qi(async a=>{for await(let u of s)l(u)&&a.emitOne(u)})}filter(s){return qi.filter(this,s)}static coalesce(s){return qi.filter(s,l=>!!l)}coalesce(){return qi.coalesce(this)}static async toPromise(s){let l=[];for await(let a of s)l.push(a);return l}toPromise(){return qi.toPromise(this)}emitOne(s){this._state===0&&(this._results.push(s),this._onStateChanged.fire())}emitMany(s){this._state===0&&(this._results=this._results.concat(s),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(s){this._state===0&&(this._state=2,this._error=s,this._onStateChanged.fire())}};Jv.EMPTY=Jv.fromArray([]);var{getWindow:ms,getWindowId:Wb,onDidRegisterWindow:Fb}=(function(){let t=new Map,s={window:Hs,disposables:new wr};t.set(Hs.vscodeWindowId,s);let l=new ne,a=new ne,u=new ne;function h(f,d){return(typeof f=="number"?t.get(f):void 0)??(d?s:void 0)}return{onDidRegisterWindow:l.event,onWillUnregisterWindow:u.event,onDidUnregisterWindow:a.event,registerWindow(f){if(t.has(f.vscodeWindowId))return ke.None;let d=new wr,m={window:f,disposables:d.add(new wr)};return t.set(f.vscodeWindowId,m),d.add(ot(()=>{t.delete(f.vscodeWindowId),a.fire(f)})),d.add(Te(f,zt.BEFORE_UNLOAD,()=>{u.fire(f)})),l.fire(m),d},getWindows(){return t.values()},getWindowsCount(){return t.size},getWindowId(f){return f.vscodeWindowId},hasWindow(f){return t.has(f)},getWindowById:h,getWindow(f){let d=f;if(d?.ownerDocument?.defaultView)return d.ownerDocument.defaultView.window;let m=f;return m?.view?m.view.window:Hs},getDocument(f){return ms(f).document}}})(),Zb=class{constructor(t,s,l,a){this._node=t,this._type=s,this._handler=l,this._options=a||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Te(t,s,l,a){return new Zb(t,s,l,a)}var ep=function(t,s,l,a){return Te(t,s,l,a)},od,Qb=class extends Xb{constructor(t){super(),this.defaultTarget=t&&ms(t)}cancelAndSet(t,s,l){return super.cancelAndSet(t,s,l??this.defaultTarget)}},tp=class{constructor(t,s=0){this._runner=t,this.priority=s,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(t){tc(t)}}static sort(t,s){return s.priority-t.priority}};(function(){let t=new Map,s=new Map,l=new Map,a=new Map,u=h=>{l.set(h,!1);let f=t.get(h)??[];for(s.set(h,f),t.set(h,[]),a.set(h,!0);f.length>0;)f.sort(tp.sort),f.shift().execute();a.set(h,!1)};od=(h,f,d=0)=>{let m=Wb(h),g=new tp(f,d),S=t.get(m);return S||(S=[],t.set(m,S)),S.push(g),l.get(m)||(l.set(m,!0),h.requestAnimationFrame(()=>u(m))),g}})();function $b(t){let s=t.getBoundingClientRect(),l=ms(t);return{left:s.left+l.scrollX,top:s.top+l.scrollY,width:s.width,height:s.height}}var zt={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"},Jb=class{constructor(t){this.domNode=t,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(t){let s=mi(t);this._maxWidth!==s&&(this._maxWidth=s,this.domNode.style.maxWidth=this._maxWidth)}setWidth(t){let s=mi(t);this._width!==s&&(this._width=s,this.domNode.style.width=this._width)}setHeight(t){let s=mi(t);this._height!==s&&(this._height=s,this.domNode.style.height=this._height)}setTop(t){let s=mi(t);this._top!==s&&(this._top=s,this.domNode.style.top=this._top)}setLeft(t){let s=mi(t);this._left!==s&&(this._left=s,this.domNode.style.left=this._left)}setBottom(t){let s=mi(t);this._bottom!==s&&(this._bottom=s,this.domNode.style.bottom=this._bottom)}setRight(t){let s=mi(t);this._right!==s&&(this._right=s,this.domNode.style.right=this._right)}setPaddingTop(t){let s=mi(t);this._paddingTop!==s&&(this._paddingTop=s,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(t){let s=mi(t);this._paddingLeft!==s&&(this._paddingLeft=s,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(t){let s=mi(t);this._paddingBottom!==s&&(this._paddingBottom=s,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(t){let s=mi(t);this._paddingRight!==s&&(this._paddingRight=s,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(t){this._fontFamily!==t&&(this._fontFamily=t,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(t){this._fontWeight!==t&&(this._fontWeight=t,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(t){let s=mi(t);this._fontSize!==s&&(this._fontSize=s,this.domNode.style.fontSize=this._fontSize)}setFontStyle(t){this._fontStyle!==t&&(this._fontStyle=t,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(t){this._fontFeatureSettings!==t&&(this._fontFeatureSettings=t,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(t){this._fontVariationSettings!==t&&(this._fontVariationSettings=t,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(t){this._textDecoration!==t&&(this._textDecoration=t,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(t){let s=mi(t);this._lineHeight!==s&&(this._lineHeight=s,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(t){let s=mi(t);this._letterSpacing!==s&&(this._letterSpacing=s,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(t){this._className!==t&&(this._className=t,this.domNode.className=this._className)}toggleClassName(t,s){this.domNode.classList.toggle(t,s),this._className=this.domNode.className}setDisplay(t){this._display!==t&&(this._display=t,this.domNode.style.display=this._display)}setPosition(t){this._position!==t&&(this._position=t,this.domNode.style.position=this._position)}setVisibility(t){this._visibility!==t&&(this._visibility=t,this.domNode.style.visibility=this._visibility)}setColor(t){this._color!==t&&(this._color=t,this.domNode.style.color=this._color)}setBackgroundColor(t){this._backgroundColor!==t&&(this._backgroundColor=t,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(t){this._layerHint!==t&&(this._layerHint=t,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(t){this._boxShadow!==t&&(this._boxShadow=t,this.domNode.style.boxShadow=t)}setContain(t){this._contain!==t&&(this._contain=t,this.domNode.style.contain=this._contain)}setAttribute(t,s){this.domNode.setAttribute(t,s)}removeAttribute(t){this.domNode.removeAttribute(t)}appendChild(t){this.domNode.appendChild(t.domNode)}removeChild(t){this.domNode.removeChild(t.domNode)}};function mi(t){return typeof t=="number"?`${t}px`:t}function ha(t){return new Jb(t)}var u0=class{constructor(){this._hooks=new wr,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(t,s){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let l=this._onStopCallback;this._onStopCallback=null,t&&l&&l(s)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(t,s,l,a,u){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=a,this._onStopCallback=u;let h=t;try{t.setPointerCapture(s),this._hooks.add(ot(()=>{try{t.releasePointerCapture(s)}catch{}}))}catch{h=ms(t)}this._hooks.add(Te(h,zt.POINTER_MOVE,f=>{if(f.buttons!==l){this.stopMonitoring(!0);return}f.preventDefault(),this._pointerMoveCallback(f)})),this._hooks.add(Te(h,zt.POINTER_UP,f=>this.stopMonitoring(!0)))}};function ew(t,s,l){let a=null,u=null;if(typeof l.value=="function"?(a="value",u=l.value,u.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof l.get=="function"&&(a="get",u=l.get),!u)throw new Error("not supported");let h=`$memoize$${s}`;l[a]=function(...f){return this.hasOwnProperty(h)||Object.defineProperty(this,h,{configurable:!1,enumerable:!1,writable:!1,value:u.apply(this,f)}),this[h]}}var gs;(t=>(t.Tap="-xterm-gesturetap",t.Change="-xterm-gesturechange",t.Start="-xterm-gesturestart",t.End="-xterm-gesturesend",t.Contextmenu="-xterm-gesturecontextmenu"))(gs||={});var la=class Qt extends ke{constructor(){super(),this.dispatched=!1,this.targets=new Vv,this.ignoreTargets=new Vv,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Wt.runAndSubscribe(Fb,({window:s,disposables:l})=>{l.add(Te(s.document,"touchstart",a=>this.onTouchStart(a),{passive:!1})),l.add(Te(s.document,"touchend",a=>this.onTouchEnd(s,a))),l.add(Te(s.document,"touchmove",a=>this.onTouchMove(a),{passive:!1}))},{window:Hs,disposables:this._store}))}static addTarget(s){if(!Qt.isTouchDevice())return ke.None;Qt.INSTANCE||(Qt.INSTANCE=new Qt);let l=Qt.INSTANCE.targets.push(s);return ot(l)}static ignoreTarget(s){if(!Qt.isTouchDevice())return ke.None;Qt.INSTANCE||(Qt.INSTANCE=new Qt);let l=Qt.INSTANCE.ignoreTargets.push(s);return ot(l)}static isTouchDevice(){return"ontouchstart"in Hs||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(s){let l=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let a=0,u=s.targetTouches.length;a<u;a++){let h=s.targetTouches.item(a);this.activeTouches[h.identifier]={id:h.identifier,initialTarget:h.target,initialTimeStamp:l,initialPageX:h.pageX,initialPageY:h.pageY,rollingTimestamps:[l],rollingPageX:[h.pageX],rollingPageY:[h.pageY]};let f=this.newGestureEvent(gs.Start,h.target);f.pageX=h.pageX,f.pageY=h.pageY,this.dispatchEvent(f)}this.dispatched&&(s.preventDefault(),s.stopPropagation(),this.dispatched=!1)}onTouchEnd(s,l){let a=Date.now(),u=Object.keys(this.activeTouches).length;for(let h=0,f=l.changedTouches.length;h<f;h++){let d=l.changedTouches.item(h);if(!this.activeTouches.hasOwnProperty(String(d.identifier))){console.warn("move of an UNKNOWN touch",d);continue}let m=this.activeTouches[d.identifier],g=Date.now()-m.initialTimeStamp;if(g<Qt.HOLD_DELAY&&Math.abs(m.initialPageX-Ti(m.rollingPageX))<30&&Math.abs(m.initialPageY-Ti(m.rollingPageY))<30){let S=this.newGestureEvent(gs.Tap,m.initialTarget);S.pageX=Ti(m.rollingPageX),S.pageY=Ti(m.rollingPageY),this.dispatchEvent(S)}else if(g>=Qt.HOLD_DELAY&&Math.abs(m.initialPageX-Ti(m.rollingPageX))<30&&Math.abs(m.initialPageY-Ti(m.rollingPageY))<30){let S=this.newGestureEvent(gs.Contextmenu,m.initialTarget);S.pageX=Ti(m.rollingPageX),S.pageY=Ti(m.rollingPageY),this.dispatchEvent(S)}else if(u===1){let S=Ti(m.rollingPageX),v=Ti(m.rollingPageY),w=Ti(m.rollingTimestamps)-m.rollingTimestamps[0],O=S-m.rollingPageX[0],T=v-m.rollingPageY[0],k=[...this.targets].filter(j=>m.initialTarget instanceof Node&&j.contains(m.initialTarget));this.inertia(s,k,a,Math.abs(O)/w,O>0?1:-1,S,Math.abs(T)/w,T>0?1:-1,v)}this.dispatchEvent(this.newGestureEvent(gs.End,m.initialTarget)),delete this.activeTouches[d.identifier]}this.dispatched&&(l.preventDefault(),l.stopPropagation(),this.dispatched=!1)}newGestureEvent(s,l){let a=document.createEvent("CustomEvent");return a.initEvent(s,!1,!0),a.initialTarget=l,a.tapCount=0,a}dispatchEvent(s){if(s.type===gs.Tap){let l=new Date().getTime(),a=0;l-this._lastSetTapCountTime>Qt.CLEAR_TAP_COUNT_TIME?a=1:a=2,this._lastSetTapCountTime=l,s.tapCount=a}else(s.type===gs.Change||s.type===gs.Contextmenu)&&(this._lastSetTapCountTime=0);if(s.initialTarget instanceof Node){for(let a of this.ignoreTargets)if(a.contains(s.initialTarget))return;let l=[];for(let a of this.targets)if(a.contains(s.initialTarget)){let u=0,h=s.initialTarget;for(;h&&h!==a;)u++,h=h.parentElement;l.push([u,a])}l.sort((a,u)=>a[0]-u[0]);for(let[a,u]of l)u.dispatchEvent(s),this.dispatched=!0}}inertia(s,l,a,u,h,f,d,m,g){this.handle=od(s,()=>{let S=Date.now(),v=S-a,w=0,O=0,T=!0;u+=Qt.SCROLL_FRICTION*v,d+=Qt.SCROLL_FRICTION*v,u>0&&(T=!1,w=h*u*v),d>0&&(T=!1,O=m*d*v);let k=this.newGestureEvent(gs.Change);k.translationX=w,k.translationY=O,l.forEach(j=>j.dispatchEvent(k)),T||this.inertia(s,l,S,u,h,f+w,d,m,g+O)})}onTouchMove(s){let l=Date.now();for(let a=0,u=s.changedTouches.length;a<u;a++){let h=s.changedTouches.item(a);if(!this.activeTouches.hasOwnProperty(String(h.identifier))){console.warn("end of an UNKNOWN touch",h);continue}let f=this.activeTouches[h.identifier],d=this.newGestureEvent(gs.Change,f.initialTarget);d.translationX=h.pageX-Ti(f.rollingPageX),d.translationY=h.pageY-Ti(f.rollingPageY),d.pageX=h.pageX,d.pageY=h.pageY,this.dispatchEvent(d),f.rollingPageX.length>3&&(f.rollingPageX.shift(),f.rollingPageY.shift(),f.rollingTimestamps.shift()),f.rollingPageX.push(h.pageX),f.rollingPageY.push(h.pageY),f.rollingTimestamps.push(l)}this.dispatched&&(s.preventDefault(),s.stopPropagation(),this.dispatched=!1)}};la.SCROLL_FRICTION=-.005,la.HOLD_DELAY=700,la.CLEAR_TAP_COUNT_TIME=400,vt([ew],la,"isTouchDevice",1);var tw=la,cd=class extends ke{onclick(t,s){this._register(Te(t,zt.CLICK,l=>s(new Zo(ms(t),l))))}onmousedown(t,s){this._register(Te(t,zt.MOUSE_DOWN,l=>s(new Zo(ms(t),l))))}onmouseover(t,s){this._register(Te(t,zt.MOUSE_OVER,l=>s(new Zo(ms(t),l))))}onmouseleave(t,s){this._register(Te(t,zt.MOUSE_LEAVE,l=>s(new Zo(ms(t),l))))}onkeydown(t,s){this._register(Te(t,zt.KEY_DOWN,l=>s(new Zv(l))))}onkeyup(t,s){this._register(Te(t,zt.KEY_UP,l=>s(new Zv(l))))}oninput(t,s){this._register(Te(t,zt.INPUT,s))}onblur(t,s){this._register(Te(t,zt.BLUR,s))}onfocus(t,s){this._register(Te(t,zt.FOCUS,s))}onchange(t,s){this._register(Te(t,zt.CHANGE,s))}ignoreGesture(t){return tw.ignoreTarget(t)}},ip=11,iw=class extends cd{constructor(t){super(),this._onActivate=t.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=t.bgWidth+"px",this.bgDomNode.style.height=t.bgHeight+"px",typeof t.top<"u"&&(this.bgDomNode.style.top="0px"),typeof t.left<"u"&&(this.bgDomNode.style.left="0px"),typeof t.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof t.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=t.className,this.domNode.style.position="absolute",this.domNode.style.width=ip+"px",this.domNode.style.height=ip+"px",typeof t.top<"u"&&(this.domNode.style.top=t.top+"px"),typeof t.left<"u"&&(this.domNode.style.left=t.left+"px"),typeof t.bottom<"u"&&(this.domNode.style.bottom=t.bottom+"px"),typeof t.right<"u"&&(this.domNode.style.right=t.right+"px"),this._pointerMoveMonitor=this._register(new u0),this._register(ep(this.bgDomNode,zt.POINTER_DOWN,s=>this._arrowPointerDown(s))),this._register(ep(this.domNode,zt.POINTER_DOWN,s=>this._arrowPointerDown(s))),this._pointerdownRepeatTimer=this._register(new Qb),this._pointerdownScheduleRepeatTimer=this._register(new ad)}_arrowPointerDown(t){if(!t.target||!(t.target instanceof Element))return;let s=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,ms(t))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(s,200),this._pointerMoveMonitor.startMonitoring(t.target,t.pointerId,t.buttons,l=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),t.preventDefault()}},sw=class Bf{constructor(s,l,a,u,h,f,d){this._forceIntegerValues=s,this._scrollStateBrand=void 0,this._forceIntegerValues&&(l=l|0,a=a|0,u=u|0,h=h|0,f=f|0,d=d|0),this.rawScrollLeft=u,this.rawScrollTop=d,l<0&&(l=0),u+l>a&&(u=a-l),u<0&&(u=0),h<0&&(h=0),d+h>f&&(d=f-h),d<0&&(d=0),this.width=l,this.scrollWidth=a,this.scrollLeft=u,this.height=h,this.scrollHeight=f,this.scrollTop=d}equals(s){return this.rawScrollLeft===s.rawScrollLeft&&this.rawScrollTop===s.rawScrollTop&&this.width===s.width&&this.scrollWidth===s.scrollWidth&&this.scrollLeft===s.scrollLeft&&this.height===s.height&&this.scrollHeight===s.scrollHeight&&this.scrollTop===s.scrollTop}withScrollDimensions(s,l){return new Bf(this._forceIntegerValues,typeof s.width<"u"?s.width:this.width,typeof s.scrollWidth<"u"?s.scrollWidth:this.scrollWidth,l?this.rawScrollLeft:this.scrollLeft,typeof s.height<"u"?s.height:this.height,typeof s.scrollHeight<"u"?s.scrollHeight:this.scrollHeight,l?this.rawScrollTop:this.scrollTop)}withScrollPosition(s){return new Bf(this._forceIntegerValues,this.width,this.scrollWidth,typeof s.scrollLeft<"u"?s.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof s.scrollTop<"u"?s.scrollTop:this.rawScrollTop)}createScrollEvent(s,l){let a=this.width!==s.width,u=this.scrollWidth!==s.scrollWidth,h=this.scrollLeft!==s.scrollLeft,f=this.height!==s.height,d=this.scrollHeight!==s.scrollHeight,m=this.scrollTop!==s.scrollTop;return{inSmoothScrolling:l,oldWidth:s.width,oldScrollWidth:s.scrollWidth,oldScrollLeft:s.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:s.height,oldScrollHeight:s.scrollHeight,oldScrollTop:s.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:a,scrollWidthChanged:u,scrollLeftChanged:h,heightChanged:f,scrollHeightChanged:d,scrollTopChanged:m}}},rw=class extends ke{constructor(t){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new ne),this.onScroll=this._onScroll.event,this._smoothScrollDuration=t.smoothScrollDuration,this._scheduleAtNextAnimationFrame=t.scheduleAtNextAnimationFrame,this._state=new sw(t.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(t){this._smoothScrollDuration=t}validateScrollPosition(t){return this._state.withScrollPosition(t)}getScrollDimensions(){return this._state}setScrollDimensions(t,s){let l=this._state.withScrollDimensions(t,s);this._setState(l,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(t){let s=this._state.withScrollPosition(t);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(s,!1)}setScrollPositionSmooth(t,s){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(t);if(this._smoothScrolling){t={scrollLeft:typeof t.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:t.scrollLeft,scrollTop:typeof t.scrollTop>"u"?this._smoothScrolling.to.scrollTop:t.scrollTop};let l=this._state.withScrollPosition(t);if(this._smoothScrolling.to.scrollLeft===l.scrollLeft&&this._smoothScrolling.to.scrollTop===l.scrollTop)return;let a;s?a=new rp(this._smoothScrolling.from,l,this._smoothScrolling.startTime,this._smoothScrolling.duration):a=this._smoothScrolling.combine(this._state,l,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=a}else{let l=this._state.withScrollPosition(t);this._smoothScrolling=rp.start(this._state,l,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 t=this._smoothScrolling.tick(),s=this._state.withScrollPosition(t);if(this._setState(s,!0),!!this._smoothScrolling){if(t.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(t,s){let l=this._state;l.equals(t)||(this._state=t,this._onScroll.fire(this._state.createScrollEvent(l,s)))}},sp=class{constructor(t,s,l){this.scrollLeft=t,this.scrollTop=s,this.isDone=l}};function lf(t,s){let l=s-t;return function(a){return t+l*aw(a)}}function nw(t,s,l){return function(a){return a<l?t(a/l):s((a-l)/(1-l))}}var rp=class kf{constructor(s,l,a,u){this.from=s,this.to=l,this.duration=u,this.startTime=a,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(s,l,a){if(Math.abs(s-l)>2.5*a){let u,h;return s<l?(u=s+.75*a,h=l-.75*a):(u=s-.75*a,h=l+.75*a),nw(lf(s,u),lf(h,l),.33)}return lf(s,l)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(s){this.to=s.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(s){let l=(s-this.startTime)/this.duration;if(l<1){let a=this.scrollLeft(l),u=this.scrollTop(l);return new sp(a,u,!1)}return new sp(this.to.scrollLeft,this.to.scrollTop,!0)}combine(s,l,a){return kf.start(s,l,a)}static start(s,l,a){a=a+10;let u=Date.now()-10;return new kf(s,l,u,a)}};function lw(t){return Math.pow(t,3)}function aw(t){return 1-lw(1-t)}var ow=class extends ke{constructor(t,s,l){super(),this._visibility=t,this._visibleClassName=s,this._invisibleClassName=l,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new ad)}setVisibility(t){this._visibility!==t&&(this._visibility=t,this._updateShouldBeVisible())}setShouldBeVisible(t){this._rawShouldBeVisible=t,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let t=this._applyVisibilitySetting();this._shouldBeVisible!==t&&(this._shouldBeVisible=t,this.ensureVisibility())}setIsNeeded(t){this._isNeeded!==t&&(this._isNeeded=t,this.ensureVisibility())}setDomNode(t){this._domNode=t,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(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(t){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(t?" fade":"")))}},cw=140,h0=class extends cd{constructor(t){super(),this._lazyRender=t.lazyRender,this._host=t.host,this._scrollable=t.scrollable,this._scrollByPage=t.scrollByPage,this._scrollbarState=t.scrollbarState,this._visibilityController=this._register(new ow(t.visibility,"visible scrollbar "+t.extraScrollbarClassName,"invisible scrollbar "+t.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new u0),this._shouldRender=!0,this.domNode=ha(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(Te(this.domNode.domNode,zt.POINTER_DOWN,s=>this._domNodePointerDown(s)))}_createArrow(t){let s=this._register(new iw(t));this.domNode.domNode.appendChild(s.bgDomNode),this.domNode.domNode.appendChild(s.domNode)}_createSlider(t,s,l,a){this.slider=ha(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(t),this.slider.setLeft(s),typeof l=="number"&&this.slider.setWidth(l),typeof a=="number"&&this.slider.setHeight(a),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Te(this.slider.domNode,zt.POINTER_DOWN,u=>{u.button===0&&(u.preventDefault(),this._sliderPointerDown(u))})),this.onclick(this.slider.domNode,u=>{u.leftButton&&u.stopPropagation()})}_onElementSize(t){return this._scrollbarState.setVisibleSize(t)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(t){return this._scrollbarState.setScrollSize(t)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(t){return this._scrollbarState.setScrollPosition(t)&&(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(t){t.target===this.domNode.domNode&&this._onPointerDown(t)}delegatePointerDown(t){let s=this.domNode.domNode.getClientRects()[0].top,l=s+this._scrollbarState.getSliderPosition(),a=s+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),u=this._sliderPointerPosition(t);l<=u&&u<=a?t.button===0&&(t.preventDefault(),this._sliderPointerDown(t)):this._onPointerDown(t)}_onPointerDown(t){let s,l;if(t.target===this.domNode.domNode&&typeof t.offsetX=="number"&&typeof t.offsetY=="number")s=t.offsetX,l=t.offsetY;else{let u=$b(this.domNode.domNode);s=t.pageX-u.left,l=t.pageY-u.top}let a=this._pointerDownRelativePosition(s,l);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(a):this._scrollbarState.getDesiredScrollPositionFromOffset(a)),t.button===0&&(t.preventDefault(),this._sliderPointerDown(t))}_sliderPointerDown(t){if(!t.target||!(t.target instanceof Element))return;let s=this._sliderPointerPosition(t),l=this._sliderOrthogonalPointerPosition(t),a=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(t.target,t.pointerId,t.buttons,u=>{let h=this._sliderOrthogonalPointerPosition(u),f=Math.abs(h-l);if(l0&&f>cw){this._setDesiredScrollPositionNow(a.getScrollPosition());return}let d=this._sliderPointerPosition(u)-s;this._setDesiredScrollPositionNow(a.getDesiredScrollPositionFromDelta(d))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(t){let s={};this.writeScrollPosition(s,t),this._scrollable.setScrollPositionNow(s)}updateScrollbarSize(t){this._updateScrollbarSize(t),this._scrollbarState.setScrollbarSize(t),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},f0=class Nf{constructor(s,l,a,u,h,f){this._scrollbarSize=Math.round(l),this._oppositeScrollbarSize=Math.round(a),this._arrowSize=Math.round(s),this._visibleSize=u,this._scrollSize=h,this._scrollPosition=f,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new Nf(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(s){let l=Math.round(s);return this._visibleSize!==l?(this._visibleSize=l,this._refreshComputedValues(),!0):!1}setScrollSize(s){let l=Math.round(s);return this._scrollSize!==l?(this._scrollSize=l,this._refreshComputedValues(),!0):!1}setScrollPosition(s){let l=Math.round(s);return this._scrollPosition!==l?(this._scrollPosition=l,this._refreshComputedValues(),!0):!1}setScrollbarSize(s){this._scrollbarSize=Math.round(s)}setOppositeScrollbarSize(s){this._oppositeScrollbarSize=Math.round(s)}static _computeValues(s,l,a,u,h){let f=Math.max(0,a-s),d=Math.max(0,f-2*l),m=u>0&&u>a;if(!m)return{computedAvailableSize:Math.round(f),computedIsNeeded:m,computedSliderSize:Math.round(d),computedSliderRatio:0,computedSliderPosition:0};let g=Math.round(Math.max(20,Math.floor(a*d/u))),S=(d-g)/(u-a),v=h*S;return{computedAvailableSize:Math.round(f),computedIsNeeded:m,computedSliderSize:Math.round(g),computedSliderRatio:S,computedSliderPosition:Math.round(v)}}_refreshComputedValues(){let s=Nf._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=s.computedAvailableSize,this._computedIsNeeded=s.computedIsNeeded,this._computedSliderSize=s.computedSliderSize,this._computedSliderRatio=s.computedSliderRatio,this._computedSliderPosition=s.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(s){if(!this._computedIsNeeded)return 0;let l=s-this._arrowSize-this._computedSliderSize/2;return Math.round(l/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(s){if(!this._computedIsNeeded)return 0;let l=s-this._arrowSize,a=this._scrollPosition;return l<this._computedSliderPosition?a-=this._visibleSize:a+=this._visibleSize,a}getDesiredScrollPositionFromDelta(s){if(!this._computedIsNeeded)return 0;let l=this._computedSliderPosition+s;return Math.round(l/this._computedSliderRatio)}},uw=class extends h0{constructor(t,s,l){let a=t.getScrollDimensions(),u=t.getCurrentScrollPosition();if(super({lazyRender:s.lazyRender,host:l,scrollbarState:new f0(s.horizontalHasArrows?s.arrowSize:0,s.horizontal===2?0:s.horizontalScrollbarSize,s.vertical===2?0:s.verticalScrollbarSize,a.width,a.scrollWidth,u.scrollLeft),visibility:s.horizontal,extraScrollbarClassName:"horizontal",scrollable:t,scrollByPage:s.scrollByPage}),s.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((s.horizontalScrollbarSize-s.horizontalSliderSize)/2),0,void 0,s.horizontalSliderSize)}_updateSlider(t,s){this.slider.setWidth(t),this.slider.setLeft(s)}_renderDomNode(t,s){this.domNode.setWidth(t),this.domNode.setHeight(s),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(t){return this._shouldRender=this._onElementScrollSize(t.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(t.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(t.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(t,s){return t}_sliderPointerPosition(t){return t.pageX}_sliderOrthogonalPointerPosition(t){return t.pageY}_updateScrollbarSize(t){this.slider.setHeight(t)}writeScrollPosition(t,s){t.scrollLeft=s}updateOptions(t){this.updateScrollbarSize(t.horizontal===2?0:t.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(t.vertical===2?0:t.verticalScrollbarSize),this._visibilityController.setVisibility(t.horizontal),this._scrollByPage=t.scrollByPage}},hw=class extends h0{constructor(t,s,l){let a=t.getScrollDimensions(),u=t.getCurrentScrollPosition();if(super({lazyRender:s.lazyRender,host:l,scrollbarState:new f0(s.verticalHasArrows?s.arrowSize:0,s.vertical===2?0:s.verticalScrollbarSize,0,a.height,a.scrollHeight,u.scrollTop),visibility:s.vertical,extraScrollbarClassName:"vertical",scrollable:t,scrollByPage:s.scrollByPage}),s.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((s.verticalScrollbarSize-s.verticalSliderSize)/2),s.verticalSliderSize,void 0)}_updateSlider(t,s){this.slider.setHeight(t),this.slider.setTop(s)}_renderDomNode(t,s){this.domNode.setWidth(s),this.domNode.setHeight(t),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(t){return this._shouldRender=this._onElementScrollSize(t.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(t.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(t.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(t,s){return s}_sliderPointerPosition(t){return t.pageY}_sliderOrthogonalPointerPosition(t){return t.pageX}_updateScrollbarSize(t){this.slider.setWidth(t)}writeScrollPosition(t,s){t.scrollTop=s}updateOptions(t){this.updateScrollbarSize(t.vertical===2?0:t.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(t.vertical),this._scrollByPage=t.scrollByPage}},fw=500,np=50,dw=class{constructor(t,s,l){this.timestamp=t,this.deltaX=s,this.deltaY=l,this.score=0}},Lf=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let s=1,l=0,a=1,u=this._rear;do{let h=u===this._front?s:Math.pow(2,-a);if(s-=h,l+=this._memory[u].score*h,u===this._front)break;u=(this._capacity+u-1)%this._capacity,a++}while(!0);return l<=.5}acceptStandardWheelEvent(s){if(nd){let l=ms(s.browserEvent),a=Eb(l);this.accept(Date.now(),s.deltaX*a,s.deltaY*a)}else this.accept(Date.now(),s.deltaX,s.deltaY)}accept(s,l,a){let u=null,h=new dw(s,l,a);this._front===-1&&this._rear===-1?(this._memory[0]=h,this._front=0,this._rear=0):(u=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]=h),h.score=this._computeScore(h,u)}_computeScore(s,l){if(Math.abs(s.deltaX)>0&&Math.abs(s.deltaY)>0)return 1;let a=.5;if((!this._isAlmostInt(s.deltaX)||!this._isAlmostInt(s.deltaY))&&(a+=.25),l){let u=Math.abs(s.deltaX),h=Math.abs(s.deltaY),f=Math.abs(l.deltaX),d=Math.abs(l.deltaY),m=Math.max(Math.min(u,f),1),g=Math.max(Math.min(h,d),1),S=Math.max(u,f),v=Math.max(h,d);S%m===0&&v%g===0&&(a-=.5)}return Math.min(Math.max(a,0),1)}_isAlmostInt(s){return Math.abs(Math.round(s)-s)<.01}};Lf.INSTANCE=new Lf;var _w=Lf,gw=class extends cd{constructor(t,s,l){super(),this._onScroll=this._register(new ne),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new ne),this.onWillScroll=this._onWillScroll.event,this._options=vw(s),this._scrollable=l,this._register(this._scrollable.onScroll(u=>{this._onWillScroll.fire(u),this._onDidScroll(u),this._onScroll.fire(u)}));let a={onMouseWheel:u=>this._onMouseWheel(u),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new hw(this._scrollable,this._options,a)),this._horizontalScrollbar=this._register(new uw(this._scrollable,this._options,a)),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(t),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=ha(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=ha(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=ha(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,u=>this._onMouseOver(u)),this.onmouseleave(this._listenOnDomNode,u=>this._onMouseLeave(u)),this._hideTimeout=this._register(new ad),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Jr(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(t){this._verticalScrollbar.delegatePointerDown(t)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(t){this._scrollable.setScrollDimensions(t,!1)}updateClassName(t){this._options.className=t,vs&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(t){typeof t.handleMouseWheel<"u"&&(this._options.handleMouseWheel=t.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof t.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=t.mouseWheelScrollSensitivity),typeof t.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=t.fastScrollSensitivity),typeof t.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=t.scrollPredominantAxis),typeof t.horizontal<"u"&&(this._options.horizontal=t.horizontal),typeof t.vertical<"u"&&(this._options.vertical=t.vertical),typeof t.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=t.horizontalScrollbarSize),typeof t.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=t.verticalScrollbarSize),typeof t.scrollByPage<"u"&&(this._options.scrollByPage=t.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(t){this._revealOnScroll=t}delegateScrollFromMouseWheelEvent(t){this._onMouseWheel(new $v(t))}_setListeningToMouseWheel(t){if(this._mouseWheelToDispose.length>0!==t&&(this._mouseWheelToDispose=Jr(this._mouseWheelToDispose),t)){let s=l=>{this._onMouseWheel(new $v(l))};this._mouseWheelToDispose.push(Te(this._listenOnDomNode,zt.MOUSE_WHEEL,s,{passive:!1}))}}_onMouseWheel(t){if(t.browserEvent?.defaultPrevented)return;let s=_w.INSTANCE;s.acceptStandardWheelEvent(t);let l=!1;if(t.deltaY||t.deltaX){let u=t.deltaY*this._options.mouseWheelScrollSensitivity,h=t.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&h+u===0?h=u=0:Math.abs(u)>=Math.abs(h)?h=0:u=0),this._options.flipAxes&&([u,h]=[h,u]);let f=!vs&&t.browserEvent&&t.browserEvent.shiftKey;(this._options.scrollYToX||f)&&!h&&(h=u,u=0),t.browserEvent&&t.browserEvent.altKey&&(h=h*this._options.fastScrollSensitivity,u=u*this._options.fastScrollSensitivity);let d=this._scrollable.getFutureScrollPosition(),m={};if(u){let g=np*u,S=d.scrollTop-(g<0?Math.floor(g):Math.ceil(g));this._verticalScrollbar.writeScrollPosition(m,S)}if(h){let g=np*h,S=d.scrollLeft-(g<0?Math.floor(g):Math.ceil(g));this._horizontalScrollbar.writeScrollPosition(m,S)}m=this._scrollable.validateScrollPosition(m),(d.scrollLeft!==m.scrollLeft||d.scrollTop!==m.scrollTop)&&(this._options.mouseWheelSmoothScroll&&s.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(m):this._scrollable.setScrollPositionNow(m),l=!0)}let a=l;!a&&this._options.alwaysConsumeMouseWheel&&(a=!0),!a&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(a=!0),a&&(t.preventDefault(),t.stopPropagation())}_onDidScroll(t){this._shouldRender=this._horizontalScrollbar.onDidScroll(t)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(t)||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 t=this._scrollable.getCurrentScrollPosition(),s=t.scrollTop>0,l=t.scrollLeft>0,a=l?" left":"",u=s?" top":"",h=l||s?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${a}`),this._topShadowDomNode.setClassName(`shadow${u}`),this._topLeftShadowDomNode.setClassName(`shadow${h}${u}${a}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(t){this._mouseIsOver=!1,this._hide()}_onMouseOver(t){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(),fw)}},mw=class extends gw{constructor(t,s,l){super(t,s,l)}setScrollPosition(t){t.reuseAnimation?this._scrollable.setScrollPositionSmooth(t,t.reuseAnimation):this._scrollable.setScrollPositionNow(t)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function vw(t){let s={lazyRender:typeof t.lazyRender<"u"?t.lazyRender:!1,className:typeof t.className<"u"?t.className:"",useShadows:typeof t.useShadows<"u"?t.useShadows:!0,handleMouseWheel:typeof t.handleMouseWheel<"u"?t.handleMouseWheel:!0,flipAxes:typeof t.flipAxes<"u"?t.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof t.consumeMouseWheelIfScrollbarIsNeeded<"u"?t.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof t.alwaysConsumeMouseWheel<"u"?t.alwaysConsumeMouseWheel:!1,scrollYToX:typeof t.scrollYToX<"u"?t.scrollYToX:!1,mouseWheelScrollSensitivity:typeof t.mouseWheelScrollSensitivity<"u"?t.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof t.fastScrollSensitivity<"u"?t.fastScrollSensitivity:5,scrollPredominantAxis:typeof t.scrollPredominantAxis<"u"?t.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof t.mouseWheelSmoothScroll<"u"?t.mouseWheelSmoothScroll:!0,arrowSize:typeof t.arrowSize<"u"?t.arrowSize:11,listenOnDomNode:typeof t.listenOnDomNode<"u"?t.listenOnDomNode:null,horizontal:typeof t.horizontal<"u"?t.horizontal:1,horizontalScrollbarSize:typeof t.horizontalScrollbarSize<"u"?t.horizontalScrollbarSize:10,horizontalSliderSize:typeof t.horizontalSliderSize<"u"?t.horizontalSliderSize:0,horizontalHasArrows:typeof t.horizontalHasArrows<"u"?t.horizontalHasArrows:!1,vertical:typeof t.vertical<"u"?t.vertical:1,verticalScrollbarSize:typeof t.verticalScrollbarSize<"u"?t.verticalScrollbarSize:10,verticalHasArrows:typeof t.verticalHasArrows<"u"?t.verticalHasArrows:!1,verticalSliderSize:typeof t.verticalSliderSize<"u"?t.verticalSliderSize:0,scrollByPage:typeof t.scrollByPage<"u"?t.scrollByPage:!1};return s.horizontalSliderSize=typeof t.horizontalSliderSize<"u"?t.horizontalSliderSize:s.horizontalScrollbarSize,s.verticalSliderSize=typeof t.verticalSliderSize<"u"?t.verticalSliderSize:s.verticalScrollbarSize,vs&&(s.className+=" mac"),s}var zf=class extends ke{constructor(t,s,l,a,u,h,f,d){super(),this._bufferService=l,this._optionsService=f,this._renderService=d,this._onRequestScrollLines=this._register(new ne),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let m=this._register(new rw({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:g=>od(a.window,g)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{m.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new mw(s,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},m)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(u.onProtocolChange(g=>{this._scrollableElement.updateOptions({handleMouseWheel:!(g&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Wt.runAndSubscribe(h.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=h.colors.background.css})),t.appendChild(this._scrollableElement.getDomNode()),this._register(ot(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=a.mainDocument.createElement("style"),s.appendChild(this._styleElement),this._register(ot(()=>this._styleElement.remove())),this._register(Wt.runAndSubscribe(h.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${h.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${h.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${h.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
21
+ `)})),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(g=>this._handleScroll(g)))}scrollLines(t){let s=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:s.scrollTop+t*this._renderService.dimensions.css.cell.height})}scrollToLine(t,s){s&&(this._latestYDisp=t),this._scrollableElement.setScrollPosition({reuseAnimation:!s,scrollTop:t*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(t){t!==void 0&&(this._latestYDisp=t),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(t=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,t!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:t*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(t){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let s=Math.round(t.scrollTop/this._renderService.dimensions.css.cell.height),l=s-this._bufferService.buffer.ydisp;l!==0&&(this._latestYDisp=s,this._onRequestScrollLines.fire(l)),this._isHandlingScroll=!1}};zf=vt([ue(2,ai),ue(3,Us),ue(4,Xp),ue(5,il),ue(6,oi),ue(7,js)],zf);var Hf=class extends ke{constructor(t,s,l,a,u){super(),this._screenElement=t,this._bufferService=s,this._coreBrowserService=l,this._decorationService=a,this._renderService=u,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(h=>this._removeDecoration(h))),this._register(ot(()=>{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 t of this._decorationService.decorations)this._renderDecoration(t);this._dimensionsChanged=!1}_renderDecoration(t){this._refreshStyle(t),this._dimensionsChanged&&this._refreshXPosition(t)}_createElement(t){let s=this._coreBrowserService.mainDocument.createElement("div");s.classList.add("xterm-decoration"),s.classList.toggle("xterm-decoration-top-layer",t?.options?.layer==="top"),s.style.width=`${Math.round((t.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,s.style.height=`${(t.options.height||1)*this._renderService.dimensions.css.cell.height}px`,s.style.top=`${(t.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,s.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let l=t.options.x??0;return l&&l>this._bufferService.cols&&(s.style.display="none"),this._refreshXPosition(t,s),s}_refreshStyle(t){let s=t.marker.line-this._bufferService.buffers.active.ydisp;if(s<0||s>=this._bufferService.rows)t.element&&(t.element.style.display="none",t.onRenderEmitter.fire(t.element));else{let l=this._decorationElements.get(t);l||(l=this._createElement(t),t.element=l,this._decorationElements.set(t,l),this._container.appendChild(l),t.onDispose(()=>{this._decorationElements.delete(t),l.remove()})),l.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(l.style.width=`${Math.round((t.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,l.style.height=`${(t.options.height||1)*this._renderService.dimensions.css.cell.height}px`,l.style.top=`${s*this._renderService.dimensions.css.cell.height}px`,l.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),t.onRenderEmitter.fire(l)}}_refreshXPosition(t,s=t.element){if(!s)return;let l=t.options.x??0;(t.options.anchor||"left")==="right"?s.style.right=l?`${l*this._renderService.dimensions.css.cell.width}px`:"":s.style.left=l?`${l*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(t){this._decorationElements.get(t)?.remove(),this._decorationElements.delete(t),t.dispose()}};Hf=vt([ue(1,ai),ue(2,Us),ue(3,va),ue(4,js)],Hf);var pw=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(t){if(t.options.overviewRulerOptions){for(let s of this._zones)if(s.color===t.options.overviewRulerOptions.color&&s.position===t.options.overviewRulerOptions.position){if(this._lineIntersectsZone(s,t.marker.line))return;if(this._lineAdjacentToZone(s,t.marker.line,t.options.overviewRulerOptions.position)){this._addLineToZone(s,t.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=t.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=t.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=t.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=t.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:t.options.overviewRulerOptions.color,position:t.options.overviewRulerOptions.position,startBufferLine:t.marker.line,endBufferLine:t.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(t){this._linePadding=t}_lineIntersectsZone(t,s){return s>=t.startBufferLine&&s<=t.endBufferLine}_lineAdjacentToZone(t,s,l){return s>=t.startBufferLine-this._linePadding[l||"full"]&&s<=t.endBufferLine+this._linePadding[l||"full"]}_addLineToZone(t,s){t.startBufferLine=Math.min(t.startBufferLine,s),t.endBufferLine=Math.max(t.endBufferLine,s)}},ds={full:0,left:0,center:0,right:0},mr={full:0,left:0,center:0,right:0},ea={full:0,left:0,center:0,right:0},hc=class extends ke{constructor(t,s,l,a,u,h,f,d){super(),this._viewportElement=t,this._screenElement=s,this._bufferService=l,this._decorationService=a,this._renderService=u,this._optionsService=h,this._themeService=f,this._coreBrowserService=d,this._colorZoneStore=new pw,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(ot(()=>this._canvas?.remove()));let m=this._canvas.getContext("2d");if(m)this._ctx=m;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(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let t=Math.floor((this._canvas.width-1)/3),s=Math.ceil((this._canvas.width-1)/3);mr.full=this._canvas.width,mr.left=t,mr.center=s,mr.right=t,this._refreshDrawHeightConstants(),ea.full=1,ea.left=1,ea.center=1+mr.left,ea.right=1+mr.left+mr.center}_refreshDrawHeightConstants(){ds.full=Math.round(2*this._coreBrowserService.dpr);let t=this._canvas.height/this._bufferService.buffer.lines.length,s=Math.round(Math.max(Math.min(t,12),6)*this._coreBrowserService.dpr);ds.left=s,ds.center=s,ds.right=s}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ds.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ds.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ds.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ds.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 s of this._decorationService.decorations)this._colorZoneStore.addDecoration(s);this._ctx.lineWidth=1,this._renderRulerOutline();let t=this._colorZoneStore.zones;for(let s of t)s.position!=="full"&&this._renderColorZone(s);for(let s of t)s.position==="full"&&this._renderColorZone(s);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(t){this._ctx.fillStyle=t.color,this._ctx.fillRect(ea[t.position||"full"],Math.round((this._canvas.height-1)*(t.startBufferLine/this._bufferService.buffers.active.lines.length)-ds[t.position||"full"]/2),mr[t.position||"full"],Math.round((this._canvas.height-1)*((t.endBufferLine-t.startBufferLine)/this._bufferService.buffers.active.lines.length)+ds[t.position||"full"]))}_queueRefresh(t,s){this._shouldUpdateDimensions=t||this._shouldUpdateDimensions,this._shouldUpdateAnchor=s||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};hc=vt([ue(2,ai),ue(3,va),ue(4,js),ue(5,oi),ue(6,il),ue(7,Us)],hc);var V;(t=>(t.NUL="\0",t.SOH="",t.STX="",t.ETX="",t.EOT="",t.ENQ="",t.ACK="",t.BEL="\x07",t.BS="\b",t.HT=" ",t.LF=`
22
+ `,t.VT="\v",t.FF="\f",t.CR="\r",t.SO="",t.SI="",t.DLE="",t.DC1="",t.DC2="",t.DC3="",t.DC4="",t.NAK="",t.SYN="",t.ETB="",t.CAN="",t.EM="",t.SUB="",t.ESC="\x1B",t.FS="",t.GS="",t.RS="",t.US="",t.SP=" ",t.DEL=""))(V||={});var rc;(t=>(t.PAD="€",t.HOP="",t.BPH="‚",t.NBH="ƒ",t.IND="„",t.NEL="…",t.SSA="†",t.ESA="‡",t.HTS="ˆ",t.HTJ="‰",t.VTS="Š",t.PLD="‹",t.PLU="Œ",t.RI="",t.SS2="Ž",t.SS3="",t.DCS="",t.PU1="‘",t.PU2="’",t.STS="“",t.CCH="”",t.MW="•",t.SPA="–",t.EPA="—",t.SOS="˜",t.SGCI="™",t.SCI="š",t.CSI="›",t.ST="œ",t.OSC="",t.PM="ž",t.APC="Ÿ"))(rc||={});var d0;(t=>t.ST=`${V.ESC}\\`)(d0||={});var Uf=class{constructor(t,s,l,a,u,h){this._textarea=t,this._compositionView=s,this._bufferService=l,this._optionsService=a,this._coreService=u,this._renderService=h,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(t){this._compositionView.textContent=t.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(t){if(this._isComposing||this._isSendingComposition){if(t.keyCode===20||t.keyCode===229||t.keyCode===16||t.keyCode===17||t.keyCode===18)return!1;this._finalizeComposition(!1)}return t.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(t){if(this._compositionView.classList.remove("active"),this._isComposing=!1,t){let s={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let l;s.start+=this._dataAlreadySent.length,this._isComposing?l=this._textarea.value.substring(s.start,this._compositionPosition.start):l=this._textarea.value.substring(s.start),l.length>0&&this._coreService.triggerDataEvent(l,!0)}},0)}else{this._isSendingComposition=!1;let s=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(s,!0)}}_handleAnyTextareaChanges(){let t=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let s=this._textarea.value,l=s.replace(t,"");this._dataAlreadySent=l,s.length>t.length?this._coreService.triggerDataEvent(l,!0):s.length<t.length?this._coreService.triggerDataEvent(`${V.DEL}`,!0):s.length===t.length&&s!==t&&this._coreService.triggerDataEvent(s,!0)}},0)}updateCompositionElements(t){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let s=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),l=this._renderService.dimensions.css.cell.height,a=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,u=s*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=u+"px",this._compositionView.style.top=a+"px",this._compositionView.style.height=l+"px",this._compositionView.style.lineHeight=l+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let h=this._compositionView.getBoundingClientRect();this._textarea.style.left=u+"px",this._textarea.style.top=a+"px",this._textarea.style.width=Math.max(h.width,1)+"px",this._textarea.style.height=Math.max(h.height,1)+"px",this._textarea.style.lineHeight=h.height+"px"}t||setTimeout(()=>this.updateCompositionElements(!0),0)}}};Uf=vt([ue(2,ai),ue(3,oi),ue(4,tn),ue(5,js)],Uf);var Ht=0,Ut=0,jt=0,mt=0,lp={css:"#00000000",rgba:0},Tt;(t=>{function s(u,h,f,d){return d!==void 0?`#${Wr(u)}${Wr(h)}${Wr(f)}${Wr(d)}`:`#${Wr(u)}${Wr(h)}${Wr(f)}`}t.toCss=s;function l(u,h,f,d=255){return(u<<24|h<<16|f<<8|d)>>>0}t.toRgba=l;function a(u,h,f,d){return{css:t.toCss(u,h,f,d),rgba:t.toRgba(u,h,f,d)}}t.toColor=a})(Tt||={});var nt;(t=>{function s(m,g){if(mt=(g.rgba&255)/255,mt===1)return{css:g.css,rgba:g.rgba};let S=g.rgba>>24&255,v=g.rgba>>16&255,w=g.rgba>>8&255,O=m.rgba>>24&255,T=m.rgba>>16&255,k=m.rgba>>8&255;Ht=O+Math.round((S-O)*mt),Ut=T+Math.round((v-T)*mt),jt=k+Math.round((w-k)*mt);let j=Tt.toCss(Ht,Ut,jt),F=Tt.toRgba(Ht,Ut,jt);return{css:j,rgba:F}}t.blend=s;function l(m){return(m.rgba&255)===255}t.isOpaque=l;function a(m,g,S){let v=nc.ensureContrastRatio(m.rgba,g.rgba,S);if(v)return Tt.toColor(v>>24&255,v>>16&255,v>>8&255)}t.ensureContrastRatio=a;function u(m){let g=(m.rgba|255)>>>0;return[Ht,Ut,jt]=nc.toChannels(g),{css:Tt.toCss(Ht,Ut,jt),rgba:g}}t.opaque=u;function h(m,g){return mt=Math.round(g*255),[Ht,Ut,jt]=nc.toChannels(m.rgba),{css:Tt.toCss(Ht,Ut,jt,mt),rgba:Tt.toRgba(Ht,Ut,jt,mt)}}t.opacity=h;function f(m,g){return mt=m.rgba&255,h(m,mt*g/255)}t.multiplyOpacity=f;function d(m){return[m.rgba>>24&255,m.rgba>>16&255,m.rgba>>8&255]}t.toColorRGB=d})(nt||={});var ht;(t=>{let s,l;try{let u=document.createElement("canvas");u.width=1,u.height=1;let h=u.getContext("2d",{willReadFrequently:!0});h&&(s=h,s.globalCompositeOperation="copy",l=s.createLinearGradient(0,0,1,1))}catch{}function a(u){if(u.match(/#[\da-f]{3,8}/i))switch(u.length){case 4:return Ht=parseInt(u.slice(1,2).repeat(2),16),Ut=parseInt(u.slice(2,3).repeat(2),16),jt=parseInt(u.slice(3,4).repeat(2),16),Tt.toColor(Ht,Ut,jt);case 5:return Ht=parseInt(u.slice(1,2).repeat(2),16),Ut=parseInt(u.slice(2,3).repeat(2),16),jt=parseInt(u.slice(3,4).repeat(2),16),mt=parseInt(u.slice(4,5).repeat(2),16),Tt.toColor(Ht,Ut,jt,mt);case 7:return{css:u,rgba:(parseInt(u.slice(1),16)<<8|255)>>>0};case 9:return{css:u,rgba:parseInt(u.slice(1),16)>>>0}}let h=u.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(h)return Ht=parseInt(h[1]),Ut=parseInt(h[2]),jt=parseInt(h[3]),mt=Math.round((h[5]===void 0?1:parseFloat(h[5]))*255),Tt.toColor(Ht,Ut,jt,mt);if(!s||!l)throw new Error("css.toColor: Unsupported css format");if(s.fillStyle=l,s.fillStyle=u,typeof s.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(s.fillRect(0,0,1,1),[Ht,Ut,jt,mt]=s.getImageData(0,0,1,1).data,mt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Tt.toRgba(Ht,Ut,jt,mt),css:u}}t.toColor=a})(ht||={});var li;(t=>{function s(a){return l(a>>16&255,a>>8&255,a&255)}t.relativeLuminance=s;function l(a,u,h){let f=a/255,d=u/255,m=h/255,g=f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4),S=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4),v=m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4);return g*.2126+S*.7152+v*.0722}t.relativeLuminance2=l})(li||={});var nc;(t=>{function s(f,d){if(mt=(d&255)/255,mt===1)return d;let m=d>>24&255,g=d>>16&255,S=d>>8&255,v=f>>24&255,w=f>>16&255,O=f>>8&255;return Ht=v+Math.round((m-v)*mt),Ut=w+Math.round((g-w)*mt),jt=O+Math.round((S-O)*mt),Tt.toRgba(Ht,Ut,jt)}t.blend=s;function l(f,d,m){let g=li.relativeLuminance(f>>8),S=li.relativeLuminance(d>>8);if(Ls(g,S)<m){if(S<g){let O=a(f,d,m),T=Ls(g,li.relativeLuminance(O>>8));if(T<m){let k=u(f,d,m),j=Ls(g,li.relativeLuminance(k>>8));return T>j?O:k}return O}let v=u(f,d,m),w=Ls(g,li.relativeLuminance(v>>8));if(w<m){let O=a(f,d,m),T=Ls(g,li.relativeLuminance(O>>8));return w>T?v:O}return v}}t.ensureContrastRatio=l;function a(f,d,m){let g=f>>24&255,S=f>>16&255,v=f>>8&255,w=d>>24&255,O=d>>16&255,T=d>>8&255,k=Ls(li.relativeLuminance2(w,O,T),li.relativeLuminance2(g,S,v));for(;k<m&&(w>0||O>0||T>0);)w-=Math.max(0,Math.ceil(w*.1)),O-=Math.max(0,Math.ceil(O*.1)),T-=Math.max(0,Math.ceil(T*.1)),k=Ls(li.relativeLuminance2(w,O,T),li.relativeLuminance2(g,S,v));return(w<<24|O<<16|T<<8|255)>>>0}t.reduceLuminance=a;function u(f,d,m){let g=f>>24&255,S=f>>16&255,v=f>>8&255,w=d>>24&255,O=d>>16&255,T=d>>8&255,k=Ls(li.relativeLuminance2(w,O,T),li.relativeLuminance2(g,S,v));for(;k<m&&(w<255||O<255||T<255);)w=Math.min(255,w+Math.ceil((255-w)*.1)),O=Math.min(255,O+Math.ceil((255-O)*.1)),T=Math.min(255,T+Math.ceil((255-T)*.1)),k=Ls(li.relativeLuminance2(w,O,T),li.relativeLuminance2(g,S,v));return(w<<24|O<<16|T<<8|255)>>>0}t.increaseLuminance=u;function h(f){return[f>>24&255,f>>16&255,f>>8&255,f&255]}t.toChannels=h})(nc||={});function Wr(t){let s=t.toString(16);return s.length<2?"0"+s:s}function Ls(t,s){return t<s?(s+.05)/(t+.05):(t+.05)/(s+.05)}var Sw=class extends ma{constructor(t,s,l){super(),this.content=0,this.combinedData="",this.fg=t.fg,this.bg=t.bg,this.combinedData=s,this._width=l}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(t){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},fc=class{constructor(t){this._bufferService=t,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Ki}register(t){let s={id:this._nextCharacterJoinerId++,handler:t};return this._characterJoiners.push(s),s.id}deregister(t){for(let s=0;s<this._characterJoiners.length;s++)if(this._characterJoiners[s].id===t)return this._characterJoiners.splice(s,1),!0;return!1}getJoinedCharacters(t){if(this._characterJoiners.length===0)return[];let s=this._bufferService.buffer.lines.get(t);if(!s||s.length===0)return[];let l=[],a=s.translateToString(!0),u=0,h=0,f=0,d=s.getFg(0),m=s.getBg(0);for(let g=0;g<s.getTrimmedLength();g++)if(s.loadCell(g,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==d||this._workCell.bg!==m){if(g-u>1){let S=this._getJoinedRanges(a,f,h,s,u);for(let v=0;v<S.length;v++)l.push(S[v])}u=g,f=h,d=this._workCell.fg,m=this._workCell.bg}h+=this._workCell.getChars().length||Sr.length}if(this._bufferService.cols-u>1){let g=this._getJoinedRanges(a,f,h,s,u);for(let S=0;S<g.length;S++)l.push(g[S])}return l}_getJoinedRanges(t,s,l,a,u){let h=t.substring(s,l),f=[];try{f=this._characterJoiners[0].handler(h)}catch(d){console.error(d)}for(let d=1;d<this._characterJoiners.length;d++)try{let m=this._characterJoiners[d].handler(h);for(let g=0;g<m.length;g++)fc._mergeRanges(f,m[g])}catch(m){console.error(m)}return this._stringRangesToCellRanges(f,a,u),f}_stringRangesToCellRanges(t,s,l){let a=0,u=!1,h=0,f=t[a];if(f){for(let d=l;d<this._bufferService.cols;d++){let m=s.getWidth(d),g=s.getString(d).length||Sr.length;if(m!==0){if(!u&&f[0]<=h&&(f[0]=d,u=!0),f[1]<=h){if(f[1]=d,f=t[++a],!f)break;f[0]<=h?(f[0]=d,u=!0):u=!1}h+=g}}f&&(f[1]=this._bufferService.cols)}}static _mergeRanges(t,s){let l=!1;for(let a=0;a<t.length;a++){let u=t[a];if(l){if(s[1]<=u[0])return t[a-1][1]=s[1],t;if(s[1]<=u[1])return t[a-1][1]=Math.max(s[1],u[1]),t.splice(a,1),t;t.splice(a,1),a--}else{if(s[1]<=u[0])return t.splice(a,0,s),t;if(s[1]<=u[1])return u[0]=Math.min(s[0],u[0]),t;s[0]<u[1]&&(u[0]=Math.min(s[0],u[0]),l=!0);continue}}return l?t[t.length-1][1]=s[1]:t.push(s),t}};fc=vt([ue(0,ai)],fc);function yw(t){return 57508<=t&&t<=57558}function bw(t){return 9472<=t&&t<=9631}function ww(t){return yw(t)||bw(t)}function Cw(){return{css:{canvas:Qo(),cell:Qo()},device:{canvas:Qo(),cell:Qo(),char:{width:0,height:0,left:0,top:0}}}}function Qo(){return{width:0,height:0}}var jf=class{constructor(t,s,l,a,u,h,f){this._document=t,this._characterJoinerService=s,this._optionsService=l,this._coreBrowserService=a,this._coreService=u,this._decorationService=h,this._themeService=f,this._workCell=new Ki,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(t,s,l){this._selectionStart=t,this._selectionEnd=s,this._columnSelectMode=l}createRow(t,s,l,a,u,h,f,d,m,g,S){let v=[],w=this._characterJoinerService.getJoinedCharacters(s),O=this._themeService.colors,T=t.getNoBgTrimmedLength();l&&T<h+1&&(T=h+1);let k,j=0,F="",ve=0,he=0,te=0,$=0,oe=!1,ce=0,ge=!1,je=0,qe=0,we=[],ee=g!==-1&&S!==-1;for(let K=0;K<T;K++){t.loadCell(K,this._workCell);let re=this._workCell.getWidth();if(re===0)continue;let Z=!1,z=K>=qe,P=K,E=this._workCell;if(w.length>0&&K===w[0][0]&&z){let J=w.shift(),$e=this._isCellInSelection(J[0],s);for(ve=J[0]+1;ve<J[1];ve++)z&&=$e===this._isCellInSelection(ve,s);z&&=!l||h<J[0]||h>=J[1],z?(Z=!0,E=new Sw(this._workCell,t.translateToString(!0,J[0],J[1]),J[1]-J[0]),P=J[1]-1,re=E.getWidth()):qe=J[1]}let I=this._isCellInSelection(K,s),ie=l&&K===h,B=ee&&K>=g&&K<=S,_e=!1;this._decorationService.forEachDecorationAtCell(K,s,void 0,J=>{_e=!0});let se=E.getChars()||Sr;if(se===" "&&(E.isUnderline()||E.isOverline())&&(se=" "),je=re*d-m.get(se,E.isBold(),E.isItalic()),!k)k=this._document.createElement("span");else if(j&&(I&&ge||!I&&!ge&&E.bg===he)&&(I&&ge&&O.selectionForeground||E.fg===te)&&E.extended.ext===$&&B===oe&&je===ce&&!ie&&!Z&&!_e&&z){E.isInvisible()?F+=Sr:F+=se,j++;continue}else j&&(k.textContent=F),k=this._document.createElement("span"),j=0,F="";if(he=E.bg,te=E.fg,$=E.extended.ext,oe=B,ce=je,ge=I,Z&&h>=K&&h<=P&&(h=K),!this._coreService.isCursorHidden&&ie&&this._coreService.isCursorInitialized){if(we.push("xterm-cursor"),this._coreBrowserService.isFocused)f&&we.push("xterm-cursor-blink"),we.push(a==="bar"?"xterm-cursor-bar":a==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(u)switch(u){case"outline":we.push("xterm-cursor-outline");break;case"block":we.push("xterm-cursor-block");break;case"bar":we.push("xterm-cursor-bar");break;case"underline":we.push("xterm-cursor-underline");break}}if(E.isBold()&&we.push("xterm-bold"),E.isItalic()&&we.push("xterm-italic"),E.isDim()&&we.push("xterm-dim"),E.isInvisible()?F=Sr:F=E.getChars()||Sr,E.isUnderline()&&(we.push(`xterm-underline-${E.extended.underlineStyle}`),F===" "&&(F=" "),!E.isUnderlineColorDefault()))if(E.isUnderlineColorRGB())k.style.textDecorationColor=`rgb(${ma.toColorRGB(E.getUnderlineColor()).join(",")})`;else{let J=E.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&E.isBold()&&J<8&&(J+=8),k.style.textDecorationColor=O.ansi[J].css}E.isOverline()&&(we.push("xterm-overline"),F===" "&&(F=" ")),E.isStrikethrough()&&we.push("xterm-strikethrough"),B&&(k.style.textDecoration="underline");let b=E.getFgColor(),H=E.getFgColorMode(),G=E.getBgColor(),Q=E.getBgColorMode(),ye=!!E.isInverse();if(ye){let J=b;b=G,G=J;let $e=H;H=Q,Q=$e}let me,Ee,le=!1;this._decorationService.forEachDecorationAtCell(K,s,void 0,J=>{J.options.layer!=="top"&&le||(J.backgroundColorRGB&&(Q=50331648,G=J.backgroundColorRGB.rgba>>8&16777215,me=J.backgroundColorRGB),J.foregroundColorRGB&&(H=50331648,b=J.foregroundColorRGB.rgba>>8&16777215,Ee=J.foregroundColorRGB),le=J.options.layer==="top")}),!le&&I&&(me=this._coreBrowserService.isFocused?O.selectionBackgroundOpaque:O.selectionInactiveBackgroundOpaque,G=me.rgba>>8&16777215,Q=50331648,le=!0,O.selectionForeground&&(H=50331648,b=O.selectionForeground.rgba>>8&16777215,Ee=O.selectionForeground)),le&&we.push("xterm-decoration-top");let X;switch(Q){case 16777216:case 33554432:X=O.ansi[G],we.push(`xterm-bg-${G}`);break;case 50331648:X=Tt.toColor(G>>16,G>>8&255,G&255),this._addStyle(k,`background-color:#${ap((G>>>0).toString(16),"0",6)}`);break;default:ye?(X=O.foreground,we.push("xterm-bg-257")):X=O.background}switch(me||E.isDim()&&(me=nt.multiplyOpacity(X,.5)),H){case 16777216:case 33554432:E.isBold()&&b<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(b+=8),this._applyMinimumContrast(k,X,O.ansi[b],E,me,void 0)||we.push(`xterm-fg-${b}`);break;case 50331648:let J=Tt.toColor(b>>16&255,b>>8&255,b&255);this._applyMinimumContrast(k,X,J,E,me,Ee)||this._addStyle(k,`color:#${ap(b.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(k,X,O.foreground,E,me,Ee)||ye&&we.push("xterm-fg-257")}we.length&&(k.className=we.join(" "),we.length=0),!ie&&!Z&&!_e&&z?j++:k.textContent=F,je!==this.defaultSpacing&&(k.style.letterSpacing=`${je}px`),v.push(k),K=P}return k&&j&&(k.textContent=F),v}_applyMinimumContrast(t,s,l,a,u,h){if(this._optionsService.rawOptions.minimumContrastRatio===1||ww(a.getCode()))return!1;let f=this._getContrastCache(a),d;if(!u&&!h&&(d=f.getColor(s.rgba,l.rgba)),d===void 0){let m=this._optionsService.rawOptions.minimumContrastRatio/(a.isDim()?2:1);d=nt.ensureContrastRatio(u||s,h||l,m),f.setColor((u||s).rgba,(h||l).rgba,d??null)}return d?(this._addStyle(t,`color:${d.css}`),!0):!1}_getContrastCache(t){return t.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(t,s){t.setAttribute("style",`${t.getAttribute("style")||""}${s};`)}_isCellInSelection(t,s){let l=this._selectionStart,a=this._selectionEnd;return!l||!a?!1:this._columnSelectMode?l[0]<=a[0]?t>=l[0]&&s>=l[1]&&t<a[0]&&s<=a[1]:t<l[0]&&s>=l[1]&&t>=a[0]&&s<=a[1]:s>l[1]&&s<a[1]||l[1]===a[1]&&s===l[1]&&t>=l[0]&&t<a[0]||l[1]<a[1]&&s===a[1]&&t<a[0]||l[1]<a[1]&&s===l[1]&&t>=l[0]}};jf=vt([ue(1,Fp),ue(2,oi),ue(3,Us),ue(4,tn),ue(5,va),ue(6,il)],jf);function ap(t,s,l){for(;t.length<l;)t=s+t;return t}var Ew=class{constructor(t,s){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=t.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 l=t.createElement("span");l.classList.add("xterm-char-measure-element");let a=t.createElement("span");a.classList.add("xterm-char-measure-element"),a.style.fontWeight="bold";let u=t.createElement("span");u.classList.add("xterm-char-measure-element"),u.style.fontStyle="italic";let h=t.createElement("span");h.classList.add("xterm-char-measure-element"),h.style.fontWeight="bold",h.style.fontStyle="italic",this._measureElements=[l,a,u,h],this._container.appendChild(l),this._container.appendChild(a),this._container.appendChild(u),this._container.appendChild(h),s.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(t,s,l,a){t===this._font&&s===this._fontSize&&l===this._weight&&a===this._weightBold||(this._font=t,this._fontSize=s,this._weight=l,this._weightBold=a,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${l}`,this._measureElements[1].style.fontWeight=`${a}`,this._measureElements[2].style.fontWeight=`${l}`,this._measureElements[3].style.fontWeight=`${a}`,this.clear())}get(t,s,l){let a=0;if(!s&&!l&&t.length===1&&(a=t.charCodeAt(0))<256){if(this._flat[a]!==-9999)return this._flat[a];let f=this._measure(t,0);return f>0&&(this._flat[a]=f),f}let u=t;s&&(u+="B"),l&&(u+="I");let h=this._holey.get(u);if(h===void 0){let f=0;s&&(f|=1),l&&(f|=2),h=this._measure(t,f),h>0&&this._holey.set(u,h)}return h}_measure(t,s){let l=this._measureElements[s];return l.textContent=t.repeat(32),l.offsetWidth/32}},xw=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(t,s,l,a=!1){if(this.selectionStart=s,this.selectionEnd=l,!s||!l||s[0]===l[0]&&s[1]===l[1]){this.clear();return}let u=t.buffers.active.ydisp,h=s[1]-u,f=l[1]-u,d=Math.max(h,0),m=Math.min(f,t.rows-1);if(d>=t.rows||m<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=a,this.viewportStartRow=h,this.viewportEndRow=f,this.viewportCappedStartRow=d,this.viewportCappedEndRow=m,this.startCol=s[0],this.endCol=l[0]}isCellSelected(t,s,l){return this.hasSelection?(l-=t.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?s>=this.startCol&&l>=this.viewportCappedStartRow&&s<this.endCol&&l<=this.viewportCappedEndRow:s<this.startCol&&l>=this.viewportCappedStartRow&&s>=this.endCol&&l<=this.viewportCappedEndRow:l>this.viewportStartRow&&l<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&l===this.viewportStartRow&&s>=this.startCol&&s<this.endCol||this.viewportStartRow<this.viewportEndRow&&l===this.viewportEndRow&&s<this.endCol||this.viewportStartRow<this.viewportEndRow&&l===this.viewportStartRow&&s>=this.startCol):!1}};function Tw(){return new xw}var af="xterm-dom-renderer-owner-",ji="xterm-rows",$o="xterm-fg-",op="xterm-bg-",ta="xterm-focus",Jo="xterm-selection",Dw=1,qf=class extends ke{constructor(t,s,l,a,u,h,f,d,m,g,S,v,w,O){super(),this._terminal=t,this._document=s,this._element=l,this._screenElement=a,this._viewportElement=u,this._helperContainer=h,this._linkifier2=f,this._charSizeService=m,this._optionsService=g,this._bufferService=S,this._coreService=v,this._coreBrowserService=w,this._themeService=O,this._terminalClass=Dw++,this._rowElements=[],this._selectionRenderModel=Tw(),this.onRequestRedraw=this._register(new ne).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(ji),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(Jo),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=Cw(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(T=>this._injectCss(T))),this._injectCss(this._themeService.colors),this._rowFactory=d.createInstance(jf,document),this._element.classList.add(af+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(T=>this._handleLinkHover(T))),this._register(this._linkifier2.onHideLinkUnderline(T=>this._handleLinkLeave(T))),this._register(ot(()=>{this._element.classList.remove(af+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new Ew(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 t=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*t,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*t),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/t),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/t),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 l of this._rowElements)l.style.width=`${this.dimensions.css.canvas.width}px`,l.style.height=`${this.dimensions.css.cell.height}px`,l.style.lineHeight=`${this.dimensions.css.cell.height}px`,l.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let s=`${this._terminalSelector} .${ji} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=s,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(t){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let s=`${this._terminalSelector} .${ji} { pointer-events: none; color: ${t.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;s+=`${this._terminalSelector} .${ji} .xterm-dim { color: ${nt.multiplyOpacity(t.foreground,.5).css};}`,s+=`${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 l=`blink_underline_${this._terminalClass}`,a=`blink_bar_${this._terminalClass}`,u=`blink_block_${this._terminalClass}`;s+=`@keyframes ${l} { 50% { border-bottom-style: hidden; }}`,s+=`@keyframes ${a} { 50% { box-shadow: none; }}`,s+=`@keyframes ${u} { 0% { background-color: ${t.cursor.css}; color: ${t.cursorAccent.css}; } 50% { background-color: inherit; color: ${t.cursor.css}; }}`,s+=`${this._terminalSelector} .${ji}.${ta} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${l} 1s step-end infinite;}${this._terminalSelector} .${ji}.${ta} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${a} 1s step-end infinite;}${this._terminalSelector} .${ji}.${ta} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${u} 1s step-end infinite;}${this._terminalSelector} .${ji} .xterm-cursor.xterm-cursor-block { background-color: ${t.cursor.css}; color: ${t.cursorAccent.css};}${this._terminalSelector} .${ji} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${t.cursor.css} !important; color: ${t.cursorAccent.css} !important;}${this._terminalSelector} .${ji} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${t.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${ji} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${t.cursor.css} inset;}${this._terminalSelector} .${ji} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${t.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,s+=`${this._terminalSelector} .${Jo} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Jo} div { position: absolute; background-color: ${t.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Jo} div { position: absolute; background-color: ${t.selectionInactiveBackgroundOpaque.css};}`;for(let[h,f]of t.ansi.entries())s+=`${this._terminalSelector} .${$o}${h} { color: ${f.css}; }${this._terminalSelector} .${$o}${h}.xterm-dim { color: ${nt.multiplyOpacity(f,.5).css}; }${this._terminalSelector} .${op}${h} { background-color: ${f.css}; }`;s+=`${this._terminalSelector} .${$o}257 { color: ${nt.opaque(t.background).css}; }${this._terminalSelector} .${$o}257.xterm-dim { color: ${nt.multiplyOpacity(nt.opaque(t.background),.5).css}; }${this._terminalSelector} .${op}257 { background-color: ${t.foreground.css}; }`,this._themeStyleElement.textContent=s}_setDefaultSpacing(){let t=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${t}px`,this._rowFactory.defaultSpacing=t}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(t,s){for(let l=this._rowElements.length;l<=s;l++){let a=this._document.createElement("div");this._rowContainer.appendChild(a),this._rowElements.push(a)}for(;this._rowElements.length>s;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(t,s){this._refreshRowElements(t,s),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(ta),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(ta),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(t,s,l){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(t,s,l),this.renderRows(0,this._bufferService.rows-1),!t||!s||(this._selectionRenderModel.update(this._terminal,t,s,l),!this._selectionRenderModel.hasSelection))return;let a=this._selectionRenderModel.viewportStartRow,u=this._selectionRenderModel.viewportEndRow,h=this._selectionRenderModel.viewportCappedStartRow,f=this._selectionRenderModel.viewportCappedEndRow,d=this._document.createDocumentFragment();if(l){let m=t[0]>s[0];d.appendChild(this._createSelectionElement(h,m?s[0]:t[0],m?t[0]:s[0],f-h+1))}else{let m=a===h?t[0]:0,g=h===u?s[0]:this._bufferService.cols;d.appendChild(this._createSelectionElement(h,m,g));let S=f-h-1;if(d.appendChild(this._createSelectionElement(h+1,0,this._bufferService.cols,S)),h!==f){let v=u===f?s[0]:this._bufferService.cols;d.appendChild(this._createSelectionElement(f,0,v))}}this._selectionContainer.appendChild(d)}_createSelectionElement(t,s,l,a=1){let u=this._document.createElement("div"),h=s*this.dimensions.css.cell.width,f=this.dimensions.css.cell.width*(l-s);return h+f>this.dimensions.css.canvas.width&&(f=this.dimensions.css.canvas.width-h),u.style.height=`${a*this.dimensions.css.cell.height}px`,u.style.top=`${t*this.dimensions.css.cell.height}px`,u.style.left=`${h}px`,u.style.width=`${f}px`,u}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 t of this._rowElements)t.replaceChildren()}renderRows(t,s){let l=this._bufferService.buffer,a=l.ybase+l.y,u=Math.min(l.x,this._bufferService.cols-1),h=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,f=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,d=this._optionsService.rawOptions.cursorInactiveStyle;for(let m=t;m<=s;m++){let g=m+l.ydisp,S=this._rowElements[m],v=l.lines.get(g);if(!S||!v)break;S.replaceChildren(...this._rowFactory.createRow(v,g,g===a,f,d,u,h,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${af}${this._terminalClass}`}_handleLinkHover(t){this._setCellUnderline(t.x1,t.x2,t.y1,t.y2,t.cols,!0)}_handleLinkLeave(t){this._setCellUnderline(t.x1,t.x2,t.y1,t.y2,t.cols,!1)}_setCellUnderline(t,s,l,a,u,h){l<0&&(t=0),a<0&&(s=0);let f=this._bufferService.rows-1;l=Math.max(Math.min(l,f),0),a=Math.max(Math.min(a,f),0),u=Math.min(u,this._bufferService.cols);let d=this._bufferService.buffer,m=d.ybase+d.y,g=Math.min(d.x,u-1),S=this._optionsService.rawOptions.cursorBlink,v=this._optionsService.rawOptions.cursorStyle,w=this._optionsService.rawOptions.cursorInactiveStyle;for(let O=l;O<=a;++O){let T=O+d.ydisp,k=this._rowElements[O],j=d.lines.get(T);if(!k||!j)break;k.replaceChildren(...this._rowFactory.createRow(j,T,T===m,v,w,g,S,this.dimensions.css.cell.width,this._widthCache,h?O===l?t:0:-1,h?(O===a?s:u)-1:-1))}}};qf=vt([ue(7,id),ue(8,vc),ue(9,oi),ue(10,ai),ue(11,tn),ue(12,Us),ue(13,il)],qf);var Yf=class extends ke{constructor(t,s,l){super(),this._optionsService=l,this.width=0,this.height=0,this._onCharSizeChange=this._register(new ne),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new Rw(this._optionsService))}catch{this._measureStrategy=this._register(new Mw(t,s,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let t=this._measureStrategy.measure();(t.width!==this.width||t.height!==this.height)&&(this.width=t.width,this.height=t.height,this._onCharSizeChange.fire())}};Yf=vt([ue(2,oi)],Yf);var _0=class extends ke{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(t,s){t!==void 0&&t>0&&s!==void 0&&s>0&&(this._result.width=t,this._result.height=s)}},Mw=class extends _0{constructor(t,s,l){super(),this._document=t,this._parentElement=s,this._optionsService=l,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}},Rw=class extends _0{constructor(t){super(),this._optionsService=t,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let s=this._ctx.measureText("W");if(!("width"in s&&"fontBoundingBoxAscent"in s&&"fontBoundingBoxDescent"in s))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let t=this._ctx.measureText("W");return this._validateAndSet(t.width,t.fontBoundingBoxAscent+t.fontBoundingBoxDescent),this._result}},Ow=class extends ke{constructor(t,s,l){super(),this._textarea=t,this._window=s,this.mainDocument=l,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new Aw(this._window)),this._onDprChange=this._register(new ne),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new ne),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(a=>this._screenDprMonitor.setWindow(a))),this._register(Wt.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Te(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Te(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(t){this._window!==t&&(this._window=t,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}},Aw=class extends ke{constructor(t){super(),this._parentWindow=t,this._windowResizeListener=this._register(new tl),this._onDprChange=this._register(new ne),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(ot(()=>this.clearListener()))}setWindow(t){this._parentWindow=t,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Te(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.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)}},Bw=class extends ke{constructor(){super(),this.linkProviders=[],this._register(ot(()=>this.linkProviders.length=0))}registerLinkProvider(t){return this.linkProviders.push(t),{dispose:()=>{let s=this.linkProviders.indexOf(t);s!==-1&&this.linkProviders.splice(s,1)}}}};function ud(t,s,l){let a=l.getBoundingClientRect(),u=t.getComputedStyle(l),h=parseInt(u.getPropertyValue("padding-left")),f=parseInt(u.getPropertyValue("padding-top"));return[s.clientX-a.left-h,s.clientY-a.top-f]}function kw(t,s,l,a,u,h,f,d,m){if(!h)return;let g=ud(t,s,l);if(g)return g[0]=Math.ceil((g[0]+(m?f/2:0))/f),g[1]=Math.ceil(g[1]/d),g[0]=Math.min(Math.max(g[0],1),a+(m?1:0)),g[1]=Math.min(Math.max(g[1],1),u),g}var Kf=class{constructor(t,s){this._renderService=t,this._charSizeService=s}getCoords(t,s,l,a,u){return kw(window,t,s,l,a,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,u)}getMouseReportCoords(t,s){let l=ud(window,t,s);if(this._charSizeService.hasValidSize)return l[0]=Math.min(Math.max(l[0],0),this._renderService.dimensions.css.canvas.width-1),l[1]=Math.min(Math.max(l[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(l[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(l[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(l[0]),y:Math.floor(l[1])}}};Kf=vt([ue(0,js),ue(1,vc)],Kf);var Nw=class{constructor(t,s){this._renderCallback=t,this._coreBrowserService=s,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(t){return this._refreshCallbacks.push(t),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(t,s,l){this._rowCount=l,t=t!==void 0?t:0,s=s!==void 0?s:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,t):t,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,s):s,!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 t=Math.max(this._rowStart,0),s=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(t,s),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let t of this._refreshCallbacks)t(0);this._refreshCallbacks=[]}},g0={};I1(g0,{getSafariVersion:()=>zw,isChromeOS:()=>S0,isFirefox:()=>m0,isIpad:()=>Hw,isIphone:()=>Uw,isLegacyEdge:()=>Lw,isLinux:()=>hd,isMac:()=>dc,isNode:()=>pc,isSafari:()=>v0,isWindows:()=>p0});var pc=typeof process<"u"&&"title"in process,pa=pc?"node":navigator.userAgent,Sa=pc?"node":navigator.platform,m0=pa.includes("Firefox"),Lw=pa.includes("Edge"),v0=/^((?!chrome|android).)*safari/i.test(pa);function zw(){if(!v0)return 0;let t=pa.match(/Version\/(\d+)/);return t===null||t.length<2?0:parseInt(t[1])}var dc=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Sa),Hw=Sa==="iPad",Uw=Sa==="iPhone",p0=["Windows","Win16","Win32","WinCE"].includes(Sa),hd=Sa.indexOf("Linux")>=0,S0=/\bCrOS\b/.test(pa),y0=class{constructor(){this._tasks=[],this._i=0}enqueue(t){this._tasks.push(t),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(t){this._idleCallback=void 0;let s=0,l=0,a=t.timeRemaining(),u=0;for(;this._i<this._tasks.length;){if(s=performance.now(),this._tasks[this._i]()||this._i++,s=Math.max(1,performance.now()-s),l=Math.max(s,l),u=t.timeRemaining(),l*1.5>u){a-s<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(a-s))}ms`),this._start();return}a=u}this.clear()}},jw=class extends y0{_requestCallback(t){return setTimeout(()=>t(this._createDeadline(16)))}_cancelCallback(t){clearTimeout(t)}_createDeadline(t){let s=performance.now()+t;return{timeRemaining:()=>Math.max(0,s-performance.now())}}},qw=class extends y0{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},_c=!pc&&"requestIdleCallback"in window?qw:jw,Yw=class{constructor(){this._queue=new _c}set(t){this._queue.clear(),this._queue.enqueue(t)}flush(){this._queue.flush()}},Pf=class extends ke{constructor(t,s,l,a,u,h,f,d,m){super(),this._rowCount=t,this._optionsService=l,this._charSizeService=a,this._coreService=u,this._coreBrowserService=d,this._renderer=this._register(new tl),this._pausedResizeTask=new Yw,this._observerDisposable=this._register(new tl),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 ne),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new ne),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new ne),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new ne),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new Nw((g,S)=>this._renderRows(g,S),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new Kw(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(ot(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(f.onResize(()=>this._fullRefresh())),this._register(f.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(h.onDecorationRegistered(()=>this._fullRefresh())),this._register(h.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(f.cols,f.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(f.buffer.y,f.buffer.y,!0))),this._register(m.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,s),this._register(this._coreBrowserService.onWindowChange(g=>this._registerIntersectionObserver(g,s)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(t,s){if("IntersectionObserver"in t){let l=new t.IntersectionObserver(a=>this._handleIntersectionChange(a[a.length-1]),{threshold:0});l.observe(s),this._observerDisposable.value=ot(()=>l.disconnect())}}_handleIntersectionChange(t){this._isPaused=t.isIntersecting===void 0?t.intersectionRatio===0:!t.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(t,s,l=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(t,s);return}let a=this._syncOutputHandler.flush();a&&(t=Math.min(t,a.start),s=Math.max(s,a.end)),l||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(t,s,this._rowCount)}_renderRows(t,s){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(t,s);return}t=Math.min(t,this._rowCount-1),s=Math.min(s,this._rowCount-1),this._renderer.value.renderRows(t,s),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:t,end:s}),this._onRender.fire({start:t,end:s}),this._isNextRenderRedrawOnly=!0}}resize(t,s){this._rowCount=s,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(t){this._renderer.value=t,this._renderer.value&&(this._renderer.value.onRequestRedraw(s=>this.refreshRows(s.start,s.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(t){return this._renderDebouncer.addRefreshCallback(t)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(t,s){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(t,s)):this._renderer.value.handleResize(t,s),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(t,s,l){this._selectionState.start=t,this._selectionState.end=s,this._selectionState.columnSelectMode=l,this._renderer.value?.handleSelectionChanged(t,s,l)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};Pf=vt([ue(2,oi),ue(3,vc),ue(4,tn),ue(5,va),ue(6,ai),ue(7,Us),ue(8,il)],Pf);var Kw=class{constructor(t,s,l){this._coreBrowserService=t,this._coreService=s,this._onTimeout=l,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(t,s){this._isBuffering?(this._start=Math.min(this._start,t),this._end=Math.max(this._end,s)):(this._start=t,this._end=s,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 t={start:this._start,end:this._end};return this._isBuffering=!1,t}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function Pw(t,s,l,a){let u=l.buffer.x,h=l.buffer.y;if(!l.buffer.hasScrollback)return Xw(u,h,t,s,l,a)+Sc(h,s,l,a)+Gw(u,h,t,s,l,a);let f;if(h===s)return f=u>t?"D":"C",_a(Math.abs(u-t),da(f,a));f=h>s?"D":"C";let d=Math.abs(h-s),m=Vw(h>s?t:u,l)+(d-1)*l.cols+1+Iw(h>s?u:t);return _a(m,da(f,a))}function Iw(t,s){return t-1}function Vw(t,s){return s.cols-t}function Xw(t,s,l,a,u,h){return Sc(s,a,u,h).length===0?"":_a(w0(t,s,t,s-en(s,u),!1,u).length,da("D",h))}function Sc(t,s,l,a){let u=t-en(t,l),h=s-en(s,l),f=Math.abs(u-h)-Ww(t,s,l);return _a(f,da(b0(t,s),a))}function Gw(t,s,l,a,u,h){let f;Sc(s,a,u,h).length>0?f=a-en(a,u):f=s;let d=a,m=Fw(t,s,l,a,u,h);return _a(w0(t,f,l,d,m==="C",u).length,da(m,h))}function Ww(t,s,l){let a=0,u=t-en(t,l),h=s-en(s,l);for(let f=0;f<Math.abs(u-h);f++){let d=b0(t,s)==="A"?-1:1;l.buffer.lines.get(u+d*f)?.isWrapped&&a++}return a}function en(t,s){let l=0,a=s.buffer.lines.get(t),u=a?.isWrapped;for(;u&&t>=0&&t<s.rows;)l++,a=s.buffer.lines.get(--t),u=a?.isWrapped;return l}function Fw(t,s,l,a,u,h){let f;return Sc(l,a,u,h).length>0?f=a-en(a,u):f=s,t<l&&f<=a||t>=l&&f<a?"C":"D"}function b0(t,s){return t>s?"A":"B"}function w0(t,s,l,a,u,h){let f=t,d=s,m="";for(;(f!==l||d!==a)&&d>=0&&d<h.buffer.lines.length;)f+=u?1:-1,u&&f>h.cols-1?(m+=h.buffer.translateBufferLineToString(d,!1,t,f),f=0,t=0,d++):!u&&f<0&&(m+=h.buffer.translateBufferLineToString(d,!1,0,t+1),f=h.cols-1,t=f,d--);return m+h.buffer.translateBufferLineToString(d,!1,t,f)}function da(t,s){let l=s?"O":"[";return V.ESC+l+t}function _a(t,s){t=Math.floor(t);let l="";for(let a=0;a<t;a++)l+=s;return l}var Zw=class{constructor(t){this._bufferService=t,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 t=this.selectionStart[0]+this.selectionStartLength;return t>this._bufferService.cols?t%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)-1]:[t%this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)]:[t,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let t=this.selectionStart[0]+this.selectionStartLength;return t>this._bufferService.cols?[t%this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)]:[Math.max(t,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let t=this.selectionStart,s=this.selectionEnd;return!t||!s?!1:t[1]>s[1]||t[1]===s[1]&&t[0]>s[0]}handleTrim(t){return this.selectionStart&&(this.selectionStart[1]-=t),this.selectionEnd&&(this.selectionEnd[1]-=t),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function cp(t,s){if(t.start.y>t.end.y)throw new Error(`Buffer range end (${t.end.x}, ${t.end.y}) cannot be before start (${t.start.x}, ${t.start.y})`);return s*(t.end.y-t.start.y)+(t.end.x-t.start.x+1)}var of=50,Qw=15,$w=50,Jw=500,eC=" ",tC=new RegExp(eC,"g"),If=class extends ke{constructor(t,s,l,a,u,h,f,d,m){super(),this._element=t,this._screenElement=s,this._linkifier=l,this._bufferService=a,this._coreService=u,this._mouseService=h,this._optionsService=f,this._renderService=d,this._coreBrowserService=m,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Ki,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new ne),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new ne),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new ne),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new ne),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=g=>this._handleMouseMove(g),this._mouseUpListener=g=>this._handleMouseUp(g),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(g=>this._handleTrim(g)),this._register(this._bufferService.buffers.onBufferActivate(g=>this._handleBufferActivate(g))),this.enable(),this._model=new Zw(this._bufferService),this._activeSelectionMode=0,this._register(ot(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(g=>{g.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 t=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!t||!s?!1:t[0]!==s[0]||t[1]!==s[1]}get selectionText(){let t=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;if(!t||!s)return"";let l=this._bufferService.buffer,a=[];if(this._activeSelectionMode===3){if(t[0]===s[0])return"";let u=t[0]<s[0]?t[0]:s[0],h=t[0]<s[0]?s[0]:t[0];for(let f=t[1];f<=s[1];f++){let d=l.translateBufferLineToString(f,!0,u,h);a.push(d)}}else{let u=t[1]===s[1]?s[0]:void 0;a.push(l.translateBufferLineToString(t[1],!0,t[0],u));for(let h=t[1]+1;h<=s[1]-1;h++){let f=l.lines.get(h),d=l.translateBufferLineToString(h,!0);f?.isWrapped?a[a.length-1]+=d:a.push(d)}if(t[1]!==s[1]){let h=l.lines.get(s[1]),f=l.translateBufferLineToString(s[1],!0,0,s[0]);h&&h.isWrapped?a[a.length-1]+=f:a.push(f)}}return a.map(u=>u.replace(tC," ")).join(p0?`\r
23
+ `:`
24
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(t){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),hd&&t&&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(t){let s=this._getMouseBufferCoords(t),l=this._model.finalSelectionStart,a=this._model.finalSelectionEnd;return!l||!a||!s?!1:this._areCoordsInSelection(s,l,a)}isCellInSelection(t,s){let l=this._model.finalSelectionStart,a=this._model.finalSelectionEnd;return!l||!a?!1:this._areCoordsInSelection([t,s],l,a)}_areCoordsInSelection(t,s,l){return t[1]>s[1]&&t[1]<l[1]||s[1]===l[1]&&t[1]===s[1]&&t[0]>=s[0]&&t[0]<l[0]||s[1]<l[1]&&t[1]===l[1]&&t[0]<l[0]||s[1]<l[1]&&t[1]===s[1]&&t[0]>=s[0]}_selectWordAtCursor(t,s){let l=this._linkifier.currentLink?.link?.range;if(l)return this._model.selectionStart=[l.start.x-1,l.start.y-1],this._model.selectionStartLength=cp(l,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let a=this._getMouseBufferCoords(t);return a?(this._selectWordAt(a,s),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(t,s){this._model.clearSelection(),t=Math.max(t,0),s=Math.min(s,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,t],this._model.selectionEnd=[this._bufferService.cols,s],this.refresh(),this._onSelectionChange.fire()}_handleTrim(t){this._model.handleTrim(t)&&this.refresh()}_getMouseBufferCoords(t){let s=this._mouseService.getCoords(t,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(s)return s[0]--,s[1]--,s[1]+=this._bufferService.buffer.ydisp,s}_getMouseEventScrollAmount(t){let s=ud(this._coreBrowserService.window,t,this._screenElement)[1],l=this._renderService.dimensions.css.canvas.height;return s>=0&&s<=l?0:(s>l&&(s-=l),s=Math.min(Math.max(s,-of),of),s/=of,s/Math.abs(s)+Math.round(s*(Qw-1)))}shouldForceSelection(t){return dc?t.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:t.shiftKey}handleMouseDown(t){if(this._mouseDownTimeStamp=t.timeStamp,!(t.button===2&&this.hasSelection)&&t.button===0){if(!this._enabled){if(!this.shouldForceSelection(t))return;t.stopPropagation()}t.preventDefault(),this._dragScrollAmount=0,this._enabled&&t.shiftKey?this._handleIncrementalClick(t):t.detail===1?this._handleSingleClick(t):t.detail===2?this._handleDoubleClick(t):t.detail===3&&this._handleTripleClick(t),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(),$w)}_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(t){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(t))}_handleSingleClick(t){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(t)?3:0,this._model.selectionStart=this._getMouseBufferCoords(t),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let s=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);s&&s.length!==this._model.selectionStart[0]&&s.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(t){this._selectWordAtCursor(t,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(t){let s=this._getMouseBufferCoords(t);s&&(this._activeSelectionMode=2,this._selectLineAt(s[1]))}shouldColumnSelect(t){return t.altKey&&!(dc&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(t){if(t.stopImmediatePropagation(),!this._model.selectionStart)return;let s=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(t),!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(t),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let l=this._bufferService.buffer;if(this._model.selectionEnd[1]<l.lines.length){let a=l.lines.get(this._model.selectionEnd[1]);a&&a.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!s||s[0]!==this._model.selectionEnd[0]||s[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 t=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(t.ydisp+this._bufferService.rows,t.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=t.ydisp),this.refresh()}}_handleMouseUp(t){let s=t.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&s<Jw&&t.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let l=this._mouseService.getCoords(t,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(l&&l[0]!==void 0&&l[1]!==void 0){let a=Pw(l[0]-1,l[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(a,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let t=this._model.finalSelectionStart,s=this._model.finalSelectionEnd,l=!!t&&!!s&&(t[0]!==s[0]||t[1]!==s[1]);if(!l){this._oldHasSelection&&this._fireOnSelectionChange(t,s,l);return}!t||!s||(!this._oldSelectionStart||!this._oldSelectionEnd||t[0]!==this._oldSelectionStart[0]||t[1]!==this._oldSelectionStart[1]||s[0]!==this._oldSelectionEnd[0]||s[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(t,s,l)}_fireOnSelectionChange(t,s,l){this._oldSelectionStart=t,this._oldSelectionEnd=s,this._oldHasSelection=l,this._onSelectionChange.fire()}_handleBufferActivate(t){this.clearSelection(),this._trimListener.dispose(),this._trimListener=t.activeBuffer.lines.onTrim(s=>this._handleTrim(s))}_convertViewportColToCharacterIndex(t,s){let l=s;for(let a=0;s>=a;a++){let u=t.loadCell(a,this._workCell).getChars().length;this._workCell.getWidth()===0?l--:u>1&&s!==a&&(l+=u-1)}return l}setSelection(t,s,l){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[t,s],this._model.selectionStartLength=l,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(t){this._isClickInSelection(t)||(this._selectWordAtCursor(t,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(t,s,l=!0,a=!0){if(t[0]>=this._bufferService.cols)return;let u=this._bufferService.buffer,h=u.lines.get(t[1]);if(!h)return;let f=u.translateBufferLineToString(t[1],!1),d=this._convertViewportColToCharacterIndex(h,t[0]),m=d,g=t[0]-d,S=0,v=0,w=0,O=0;if(f.charAt(d)===" "){for(;d>0&&f.charAt(d-1)===" ";)d--;for(;m<f.length&&f.charAt(m+1)===" ";)m++}else{let j=t[0],F=t[0];h.getWidth(j)===0&&(S++,j--),h.getWidth(F)===2&&(v++,F++);let ve=h.getString(F).length;for(ve>1&&(O+=ve-1,m+=ve-1);j>0&&d>0&&!this._isCharWordSeparator(h.loadCell(j-1,this._workCell));){h.loadCell(j-1,this._workCell);let he=this._workCell.getChars().length;this._workCell.getWidth()===0?(S++,j--):he>1&&(w+=he-1,d-=he-1),d--,j--}for(;F<h.length&&m+1<f.length&&!this._isCharWordSeparator(h.loadCell(F+1,this._workCell));){h.loadCell(F+1,this._workCell);let he=this._workCell.getChars().length;this._workCell.getWidth()===2?(v++,F++):he>1&&(O+=he-1,m+=he-1),m++,F++}}m++;let T=d+g-S+w,k=Math.min(this._bufferService.cols,m-d+S+v-w-O);if(!(!s&&f.slice(d,m).trim()==="")){if(l&&T===0&&h.getCodePoint(0)!==32){let j=u.lines.get(t[1]-1);if(j&&h.isWrapped&&j.getCodePoint(this._bufferService.cols-1)!==32){let F=this._getWordAt([this._bufferService.cols-1,t[1]-1],!1,!0,!1);if(F){let ve=this._bufferService.cols-F.start;T-=ve,k+=ve}}}if(a&&T+k===this._bufferService.cols&&h.getCodePoint(this._bufferService.cols-1)!==32){let j=u.lines.get(t[1]+1);if(j?.isWrapped&&j.getCodePoint(0)!==32){let F=this._getWordAt([0,t[1]+1],!1,!1,!0);F&&(k+=F.length)}}return{start:T,length:k}}}_selectWordAt(t,s){let l=this._getWordAt(t,s);if(l){for(;l.start<0;)l.start+=this._bufferService.cols,t[1]--;this._model.selectionStart=[l.start,t[1]],this._model.selectionStartLength=l.length}}_selectToWordAt(t){let s=this._getWordAt(t,!0);if(s){let l=t[1];for(;s.start<0;)s.start+=this._bufferService.cols,l--;if(!this._model.areSelectionValuesReversed())for(;s.start+s.length>this._bufferService.cols;)s.length-=this._bufferService.cols,l++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?s.start:s.start+s.length,l]}}_isCharWordSeparator(t){return t.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(t.getChars())>=0}_selectLineAt(t){let s=this._bufferService.buffer.getWrappedRangeForLine(t),l={start:{x:0,y:s.first},end:{x:this._bufferService.cols-1,y:s.last}};this._model.selectionStart=[0,s.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=cp(l,this._bufferService.cols)}};If=vt([ue(3,ai),ue(4,tn),ue(5,sd),ue(6,oi),ue(7,js),ue(8,Us)],If);var up=class{constructor(){this._data={}}set(t,s,l){this._data[t]||(this._data[t]={}),this._data[t][s]=l}get(t,s){return this._data[t]?this._data[t][s]:void 0}clear(){this._data={}}},hp=class{constructor(){this._color=new up,this._css=new up}setCss(t,s,l){this._css.set(t,s,l)}getCss(t,s){return this._css.get(t,s)}setColor(t,s,l){this._color.set(t,s,l)}getColor(t,s){return this._color.get(t,s)}clear(){this._color.clear(),this._css.clear()}},Mt=Object.freeze((()=>{let t=[ht.toColor("#2e3436"),ht.toColor("#cc0000"),ht.toColor("#4e9a06"),ht.toColor("#c4a000"),ht.toColor("#3465a4"),ht.toColor("#75507b"),ht.toColor("#06989a"),ht.toColor("#d3d7cf"),ht.toColor("#555753"),ht.toColor("#ef2929"),ht.toColor("#8ae234"),ht.toColor("#fce94f"),ht.toColor("#729fcf"),ht.toColor("#ad7fa8"),ht.toColor("#34e2e2"),ht.toColor("#eeeeec")],s=[0,95,135,175,215,255];for(let l=0;l<216;l++){let a=s[l/36%6|0],u=s[l/6%6|0],h=s[l%6];t.push({css:Tt.toCss(a,u,h),rgba:Tt.toRgba(a,u,h)})}for(let l=0;l<24;l++){let a=8+l*10;t.push({css:Tt.toCss(a,a,a),rgba:Tt.toRgba(a,a,a)})}return t})()),Fr=ht.toColor("#ffffff"),aa=ht.toColor("#000000"),fp=ht.toColor("#ffffff"),dp=aa,ia={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},iC=Fr,Vf=class extends ke{constructor(t){super(),this._optionsService=t,this._contrastCache=new hp,this._halfContrastCache=new hp,this._onChangeColors=this._register(new ne),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Fr,background:aa,cursor:fp,cursorAccent:dp,selectionForeground:void 0,selectionBackgroundTransparent:ia,selectionBackgroundOpaque:nt.blend(aa,ia),selectionInactiveBackgroundTransparent:ia,selectionInactiveBackgroundOpaque:nt.blend(aa,ia),scrollbarSliderBackground:nt.opacity(Fr,.2),scrollbarSliderHoverBackground:nt.opacity(Fr,.4),scrollbarSliderActiveBackground:nt.opacity(Fr,.5),overviewRulerBorder:Fr,ansi:Mt.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(t={}){let s=this._colors;if(s.foreground=Qe(t.foreground,Fr),s.background=Qe(t.background,aa),s.cursor=nt.blend(s.background,Qe(t.cursor,fp)),s.cursorAccent=nt.blend(s.background,Qe(t.cursorAccent,dp)),s.selectionBackgroundTransparent=Qe(t.selectionBackground,ia),s.selectionBackgroundOpaque=nt.blend(s.background,s.selectionBackgroundTransparent),s.selectionInactiveBackgroundTransparent=Qe(t.selectionInactiveBackground,s.selectionBackgroundTransparent),s.selectionInactiveBackgroundOpaque=nt.blend(s.background,s.selectionInactiveBackgroundTransparent),s.selectionForeground=t.selectionForeground?Qe(t.selectionForeground,lp):void 0,s.selectionForeground===lp&&(s.selectionForeground=void 0),nt.isOpaque(s.selectionBackgroundTransparent)&&(s.selectionBackgroundTransparent=nt.opacity(s.selectionBackgroundTransparent,.3)),nt.isOpaque(s.selectionInactiveBackgroundTransparent)&&(s.selectionInactiveBackgroundTransparent=nt.opacity(s.selectionInactiveBackgroundTransparent,.3)),s.scrollbarSliderBackground=Qe(t.scrollbarSliderBackground,nt.opacity(s.foreground,.2)),s.scrollbarSliderHoverBackground=Qe(t.scrollbarSliderHoverBackground,nt.opacity(s.foreground,.4)),s.scrollbarSliderActiveBackground=Qe(t.scrollbarSliderActiveBackground,nt.opacity(s.foreground,.5)),s.overviewRulerBorder=Qe(t.overviewRulerBorder,iC),s.ansi=Mt.slice(),s.ansi[0]=Qe(t.black,Mt[0]),s.ansi[1]=Qe(t.red,Mt[1]),s.ansi[2]=Qe(t.green,Mt[2]),s.ansi[3]=Qe(t.yellow,Mt[3]),s.ansi[4]=Qe(t.blue,Mt[4]),s.ansi[5]=Qe(t.magenta,Mt[5]),s.ansi[6]=Qe(t.cyan,Mt[6]),s.ansi[7]=Qe(t.white,Mt[7]),s.ansi[8]=Qe(t.brightBlack,Mt[8]),s.ansi[9]=Qe(t.brightRed,Mt[9]),s.ansi[10]=Qe(t.brightGreen,Mt[10]),s.ansi[11]=Qe(t.brightYellow,Mt[11]),s.ansi[12]=Qe(t.brightBlue,Mt[12]),s.ansi[13]=Qe(t.brightMagenta,Mt[13]),s.ansi[14]=Qe(t.brightCyan,Mt[14]),s.ansi[15]=Qe(t.brightWhite,Mt[15]),t.extendedAnsi){let l=Math.min(s.ansi.length-16,t.extendedAnsi.length);for(let a=0;a<l;a++)s.ansi[a+16]=Qe(t.extendedAnsi[a],Mt[a+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(t){this._restoreColor(t),this._onChangeColors.fire(this.colors)}_restoreColor(t){if(t===void 0){for(let s=0;s<this._restoreColors.ansi.length;++s)this._colors.ansi[s]=this._restoreColors.ansi[s];return}switch(t){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[t]=this._restoreColors.ansi[t]}}modifyColors(t){t(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};Vf=vt([ue(0,oi)],Vf);function Qe(t,s){if(t!==void 0)try{return ht.toColor(t)}catch{}return s}var sC=class{constructor(...t){this._entries=new Map;for(let[s,l]of t)this.set(s,l)}set(t,s){let l=this._entries.get(t);return this._entries.set(t,s),l}forEach(t){for(let[s,l]of this._entries.entries())t(s,l)}has(t){return this._entries.has(t)}get(t){return this._entries.get(t)}},rC=class{constructor(){this._services=new sC,this._services.set(id,this)}setService(t,s){this._services.set(t,s)}getService(t){return this._services.get(t)}createInstance(t,...s){let l=Q1(t).sort((h,f)=>h.index-f.index),a=[];for(let h of l){let f=this._services.get(h.id);if(!f)throw new Error(`[createInstance] ${t.name} depends on UNKNOWN service ${h.id._id}.`);a.push(f)}let u=l.length>0?l[0].index:s.length;if(s.length!==u)throw new Error(`[createInstance] First service dependency of ${t.name} at position ${u+1} conflicts with ${s.length} static arguments`);return new t(...s,...a)}},nC={trace:0,debug:1,info:2,warn:3,error:4,off:5},lC="xterm.js: ",Xf=class extends ke{constructor(t){super(),this._optionsService=t,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=nC[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(t){for(let s=0;s<t.length;s++)typeof t[s]=="function"&&(t[s]=t[s]())}_log(t,s,l){this._evalLazyOptionalParams(l),t.call(console,(this._optionsService.options.logger?"":lC)+s,...l)}trace(t,...s){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,t,s)}debug(t,...s){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,t,s)}info(t,...s){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,t,s)}warn(t,...s){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,t,s)}error(t,...s){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,t,s)}};Xf=vt([ue(0,oi)],Xf);var _p=class extends ke{constructor(t){super(),this._maxLength=t,this.onDeleteEmitter=this._register(new ne),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new ne),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new ne),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(t){if(this._maxLength===t)return;let s=new Array(t);for(let l=0;l<Math.min(t,this.length);l++)s[l]=this._array[this._getCyclicIndex(l)];this._array=s,this._maxLength=t,this._startIndex=0}get length(){return this._length}set length(t){if(t>this._length)for(let s=this._length;s<t;s++)this._array[s]=void 0;this._length=t}get(t){return this._array[this._getCyclicIndex(t)]}set(t,s){this._array[this._getCyclicIndex(t)]=s}push(t){this._array[this._getCyclicIndex(this._length)]=t,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(t,s,...l){if(s){for(let a=t;a<this._length-s;a++)this._array[this._getCyclicIndex(a)]=this._array[this._getCyclicIndex(a+s)];this._length-=s,this.onDeleteEmitter.fire({index:t,amount:s})}for(let a=this._length-1;a>=t;a--)this._array[this._getCyclicIndex(a+l.length)]=this._array[this._getCyclicIndex(a)];for(let a=0;a<l.length;a++)this._array[this._getCyclicIndex(t+a)]=l[a];if(l.length&&this.onInsertEmitter.fire({index:t,amount:l.length}),this._length+l.length>this._maxLength){let a=this._length+l.length-this._maxLength;this._startIndex+=a,this._length=this._maxLength,this.onTrimEmitter.fire(a)}else this._length+=l.length}trimStart(t){t>this._length&&(t=this._length),this._startIndex+=t,this._length-=t,this.onTrimEmitter.fire(t)}shiftElements(t,s,l){if(!(s<=0)){if(t<0||t>=this._length)throw new Error("start argument out of range");if(t+l<0)throw new Error("Cannot shift elements in list beyond index 0");if(l>0){for(let u=s-1;u>=0;u--)this.set(t+u+l,this.get(t+u));let a=t+s+l-this._length;if(a>0)for(this._length+=a;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let a=0;a<s;a++)this.set(t+a+l,this.get(t+a))}}_getCyclicIndex(t){return(this._startIndex+t)%this._maxLength}},Be=3,xt=Object.freeze(new ma),ec=0,cf=2,oa=class C0{constructor(s,l,a=!1){this.isWrapped=a,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(s*Be);let u=l||Ki.fromCharData([0,Kp,1,0]);for(let h=0;h<s;++h)this.setCell(h,u);this.length=s}get(s){let l=this._data[s*Be+0],a=l&2097151;return[this._data[s*Be+1],l&2097152?this._combined[s]:a?pr(a):"",l>>22,l&2097152?this._combined[s].charCodeAt(this._combined[s].length-1):a]}set(s,l){this._data[s*Be+1]=l[0],l[1].length>1?(this._combined[s]=l[1],this._data[s*Be+0]=s|2097152|l[2]<<22):this._data[s*Be+0]=l[1].charCodeAt(0)|l[2]<<22}getWidth(s){return this._data[s*Be+0]>>22}hasWidth(s){return this._data[s*Be+0]&12582912}getFg(s){return this._data[s*Be+1]}getBg(s){return this._data[s*Be+2]}hasContent(s){return this._data[s*Be+0]&4194303}getCodePoint(s){let l=this._data[s*Be+0];return l&2097152?this._combined[s].charCodeAt(this._combined[s].length-1):l&2097151}isCombined(s){return this._data[s*Be+0]&2097152}getString(s){let l=this._data[s*Be+0];return l&2097152?this._combined[s]:l&2097151?pr(l&2097151):""}isProtected(s){return this._data[s*Be+2]&536870912}loadCell(s,l){return ec=s*Be,l.content=this._data[ec+0],l.fg=this._data[ec+1],l.bg=this._data[ec+2],l.content&2097152&&(l.combinedData=this._combined[s]),l.bg&268435456&&(l.extended=this._extendedAttrs[s]),l}setCell(s,l){l.content&2097152&&(this._combined[s]=l.combinedData),l.bg&268435456&&(this._extendedAttrs[s]=l.extended),this._data[s*Be+0]=l.content,this._data[s*Be+1]=l.fg,this._data[s*Be+2]=l.bg}setCellFromCodepoint(s,l,a,u){u.bg&268435456&&(this._extendedAttrs[s]=u.extended),this._data[s*Be+0]=l|a<<22,this._data[s*Be+1]=u.fg,this._data[s*Be+2]=u.bg}addCodepointToCell(s,l,a){let u=this._data[s*Be+0];u&2097152?this._combined[s]+=pr(l):u&2097151?(this._combined[s]=pr(u&2097151)+pr(l),u&=-2097152,u|=2097152):u=l|1<<22,a&&(u&=-12582913,u|=a<<22),this._data[s*Be+0]=u}insertCells(s,l,a){if(s%=this.length,s&&this.getWidth(s-1)===2&&this.setCellFromCodepoint(s-1,0,1,a),l<this.length-s){let u=new Ki;for(let h=this.length-s-l-1;h>=0;--h)this.setCell(s+l+h,this.loadCell(s+h,u));for(let h=0;h<l;++h)this.setCell(s+h,a)}else for(let u=s;u<this.length;++u)this.setCell(u,a);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,a)}deleteCells(s,l,a){if(s%=this.length,l<this.length-s){let u=new Ki;for(let h=0;h<this.length-s-l;++h)this.setCell(s+h,this.loadCell(s+l+h,u));for(let h=this.length-l;h<this.length;++h)this.setCell(h,a)}else for(let u=s;u<this.length;++u)this.setCell(u,a);s&&this.getWidth(s-1)===2&&this.setCellFromCodepoint(s-1,0,1,a),this.getWidth(s)===0&&!this.hasContent(s)&&this.setCellFromCodepoint(s,0,1,a)}replaceCells(s,l,a,u=!1){if(u){for(s&&this.getWidth(s-1)===2&&!this.isProtected(s-1)&&this.setCellFromCodepoint(s-1,0,1,a),l<this.length&&this.getWidth(l-1)===2&&!this.isProtected(l)&&this.setCellFromCodepoint(l,0,1,a);s<l&&s<this.length;)this.isProtected(s)||this.setCell(s,a),s++;return}for(s&&this.getWidth(s-1)===2&&this.setCellFromCodepoint(s-1,0,1,a),l<this.length&&this.getWidth(l-1)===2&&this.setCellFromCodepoint(l,0,1,a);s<l&&s<this.length;)this.setCell(s++,a)}resize(s,l){if(s===this.length)return this._data.length*4*cf<this._data.buffer.byteLength;let a=s*Be;if(s>this.length){if(this._data.buffer.byteLength>=a*4)this._data=new Uint32Array(this._data.buffer,0,a);else{let u=new Uint32Array(a);u.set(this._data),this._data=u}for(let u=this.length;u<s;++u)this.setCell(u,l)}else{this._data=this._data.subarray(0,a);let u=Object.keys(this._combined);for(let f=0;f<u.length;f++){let d=parseInt(u[f],10);d>=s&&delete this._combined[d]}let h=Object.keys(this._extendedAttrs);for(let f=0;f<h.length;f++){let d=parseInt(h[f],10);d>=s&&delete this._extendedAttrs[d]}}return this.length=s,a*4*cf<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*cf<this._data.buffer.byteLength){let s=new Uint32Array(this._data.length);return s.set(this._data),this._data=s,1}return 0}fill(s,l=!1){if(l){for(let a=0;a<this.length;++a)this.isProtected(a)||this.setCell(a,s);return}this._combined={},this._extendedAttrs={};for(let a=0;a<this.length;++a)this.setCell(a,s)}copyFrom(s){this.length!==s.length?this._data=new Uint32Array(s._data):this._data.set(s._data),this.length=s.length,this._combined={};for(let l in s._combined)this._combined[l]=s._combined[l];this._extendedAttrs={};for(let l in s._extendedAttrs)this._extendedAttrs[l]=s._extendedAttrs[l];this.isWrapped=s.isWrapped}clone(){let s=new C0(0);s._data=new Uint32Array(this._data),s.length=this.length;for(let l in this._combined)s._combined[l]=this._combined[l];for(let l in this._extendedAttrs)s._extendedAttrs[l]=this._extendedAttrs[l];return s.isWrapped=this.isWrapped,s}getTrimmedLength(){for(let s=this.length-1;s>=0;--s)if(this._data[s*Be+0]&4194303)return s+(this._data[s*Be+0]>>22);return 0}getNoBgTrimmedLength(){for(let s=this.length-1;s>=0;--s)if(this._data[s*Be+0]&4194303||this._data[s*Be+2]&50331648)return s+(this._data[s*Be+0]>>22);return 0}copyCellsFrom(s,l,a,u,h){let f=s._data;if(h)for(let m=u-1;m>=0;m--){for(let g=0;g<Be;g++)this._data[(a+m)*Be+g]=f[(l+m)*Be+g];f[(l+m)*Be+2]&268435456&&(this._extendedAttrs[a+m]=s._extendedAttrs[l+m])}else for(let m=0;m<u;m++){for(let g=0;g<Be;g++)this._data[(a+m)*Be+g]=f[(l+m)*Be+g];f[(l+m)*Be+2]&268435456&&(this._extendedAttrs[a+m]=s._extendedAttrs[l+m])}let d=Object.keys(s._combined);for(let m=0;m<d.length;m++){let g=parseInt(d[m],10);g>=l&&(this._combined[g-l+a]=s._combined[g])}}translateToString(s,l,a,u){l=l??0,a=a??this.length,s&&(a=Math.min(a,this.getTrimmedLength())),u&&(u.length=0);let h="";for(;l<a;){let f=this._data[l*Be+0],d=f&2097151,m=f&2097152?this._combined[l]:d?pr(d):Sr;if(h+=m,u)for(let g=0;g<m.length;++g)u.push(l);l+=f>>22||1}return u&&u.push(l),h}};function aC(t,s,l,a,u,h){let f=[];for(let d=0;d<t.length-1;d++){let m=d,g=t.get(++m);if(!g.isWrapped)continue;let S=[t.get(d)];for(;m<t.length&&g.isWrapped;)S.push(g),g=t.get(++m);if(!h&&a>=d&&a<m){d+=S.length-1;continue}let v=0,w=ga(S,v,s),O=1,T=0;for(;O<S.length;){let j=ga(S,O,s),F=j-T,ve=l-w,he=Math.min(F,ve);S[v].copyCellsFrom(S[O],T,w,he,!1),w+=he,w===l&&(v++,w=0),T+=he,T===j&&(O++,T=0),w===0&&v!==0&&S[v-1].getWidth(l-1)===2&&(S[v].copyCellsFrom(S[v-1],l-1,w++,1,!1),S[v-1].setCell(l-1,u))}S[v].replaceCells(w,l,u);let k=0;for(let j=S.length-1;j>0&&(j>v||S[j].getTrimmedLength()===0);j--)k++;k>0&&(f.push(d+S.length-k),f.push(k)),d+=S.length-1}return f}function oC(t,s){let l=[],a=0,u=s[a],h=0;for(let f=0;f<t.length;f++)if(u===f){let d=s[++a];t.onDeleteEmitter.fire({index:f-h,amount:d}),f+=d-1,h+=d,u=s[++a]}else l.push(f);return{layout:l,countRemoved:h}}function cC(t,s){let l=[];for(let a=0;a<s.length;a++)l.push(t.get(s[a]));for(let a=0;a<l.length;a++)t.set(a,l[a]);t.length=s.length}function uC(t,s,l){let a=[],u=t.map((m,g)=>ga(t,g,s)).reduce((m,g)=>m+g),h=0,f=0,d=0;for(;d<u;){if(u-d<l){a.push(u-d);break}h+=l;let m=ga(t,f,s);h>m&&(h-=m,f++);let g=t[f].getWidth(h-1)===2;g&&h--;let S=g?l-1:l;a.push(S),d+=S}return a}function ga(t,s,l){if(s===t.length-1)return t[s].getTrimmedLength();let a=!t[s].hasContent(l-1)&&t[s].getWidth(l-1)===1,u=t[s+1].getWidth(0)===2;return a&&u?l-1:l}var E0=class x0{constructor(s){this.line=s,this.isDisposed=!1,this._disposables=[],this._id=x0._nextId++,this._onDispose=this.register(new ne),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Jr(this._disposables),this._disposables.length=0)}register(s){return this._disposables.push(s),s}};E0._nextId=1;var hC=E0,Ot={},Zr=Ot.B;Ot[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:"≥","{":"π","|":"≠","}":"£","~":"·"};Ot.A={"#":"£"};Ot.B=void 0;Ot[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Ot.C=Ot[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Ot.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Ot.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Ot.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Ot.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Ot.E=Ot[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Ot.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Ot.H=Ot[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Ot["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var gp=4294967295,mp=class{constructor(t,s,l){this._hasScrollback=t,this._optionsService=s,this._bufferService=l,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=xt.clone(),this.savedCharset=Zr,this.markers=[],this._nullCell=Ki.fromCharData([0,Kp,1,0]),this._whitespaceCell=Ki.fromCharData([0,Sr,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new _c,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new _p(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(t){return t?(this._nullCell.fg=t.fg,this._nullCell.bg=t.bg,this._nullCell.extended=t.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new uc),this._nullCell}getWhitespaceCell(t){return t?(this._whitespaceCell.fg=t.fg,this._whitespaceCell.bg=t.bg,this._whitespaceCell.extended=t.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new uc),this._whitespaceCell}getBlankLine(t,s){return new oa(this._bufferService.cols,this.getNullCell(t),s)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let t=this.ybase+this.y-this.ydisp;return t>=0&&t<this._rows}_getCorrectBufferLength(t){if(!this._hasScrollback)return t;let s=t+this._optionsService.rawOptions.scrollback;return s>gp?gp:s}fillViewportRows(t){if(this.lines.length===0){t===void 0&&(t=xt);let s=this._rows;for(;s--;)this.lines.push(this.getBlankLine(t))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new _p(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(t,s){let l=this.getNullCell(xt),a=0,u=this._getCorrectBufferLength(s);if(u>this.lines.maxLength&&(this.lines.maxLength=u),this.lines.length>0){if(this._cols<t)for(let f=0;f<this.lines.length;f++)a+=+this.lines.get(f).resize(t,l);let h=0;if(this._rows<s)for(let f=this._rows;f<s;f++)this.lines.length<s+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new oa(t,l)):this.ybase>0&&this.lines.length<=this.ybase+this.y+h+1?(this.ybase--,h++,this.ydisp>0&&this.ydisp--):this.lines.push(new oa(t,l)));else for(let f=this._rows;f>s;f--)this.lines.length>s+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(u<this.lines.maxLength){let f=this.lines.length-u;f>0&&(this.lines.trimStart(f),this.ybase=Math.max(this.ybase-f,0),this.ydisp=Math.max(this.ydisp-f,0),this.savedY=Math.max(this.savedY-f,0)),this.lines.maxLength=u}this.x=Math.min(this.x,t-1),this.y=Math.min(this.y,s-1),h&&(this.y+=h),this.savedX=Math.min(this.savedX,t-1),this.scrollTop=0}if(this.scrollBottom=s-1,this._isReflowEnabled&&(this._reflow(t,s),this._cols>t))for(let h=0;h<this.lines.length;h++)a+=+this.lines.get(h).resize(t,l);this._cols=t,this._rows=s,this._memoryCleanupQueue.clear(),a>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let t=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,t=!1);let s=0;for(;this._memoryCleanupPosition<this.lines.length;)if(s+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),s>100)return!0;return t}get _isReflowEnabled(){let t=this._optionsService.rawOptions.windowsPty;return t&&t.buildNumber?this._hasScrollback&&t.backend==="conpty"&&t.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(t,s){this._cols!==t&&(t>this._cols?this._reflowLarger(t,s):this._reflowSmaller(t,s))}_reflowLarger(t,s){let l=this._optionsService.rawOptions.reflowCursorLine,a=aC(this.lines,this._cols,t,this.ybase+this.y,this.getNullCell(xt),l);if(a.length>0){let u=oC(this.lines,a);cC(this.lines,u.layout),this._reflowLargerAdjustViewport(t,s,u.countRemoved)}}_reflowLargerAdjustViewport(t,s,l){let a=this.getNullCell(xt),u=l;for(;u-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<s&&this.lines.push(new oa(t,a))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-l,0)}_reflowSmaller(t,s){let l=this._optionsService.rawOptions.reflowCursorLine,a=this.getNullCell(xt),u=[],h=0;for(let f=this.lines.length-1;f>=0;f--){let d=this.lines.get(f);if(!d||!d.isWrapped&&d.getTrimmedLength()<=t)continue;let m=[d];for(;d.isWrapped&&f>0;)d=this.lines.get(--f),m.unshift(d);if(!l){let he=this.ybase+this.y;if(he>=f&&he<f+m.length)continue}let g=m[m.length-1].getTrimmedLength(),S=uC(m,this._cols,t),v=S.length-m.length,w;this.ybase===0&&this.y!==this.lines.length-1?w=Math.max(0,this.y-this.lines.maxLength+v):w=Math.max(0,this.lines.length-this.lines.maxLength+v);let O=[];for(let he=0;he<v;he++){let te=this.getBlankLine(xt,!0);O.push(te)}O.length>0&&(u.push({start:f+m.length+h,newLines:O}),h+=O.length),m.push(...O);let T=S.length-1,k=S[T];k===0&&(T--,k=S[T]);let j=m.length-v-1,F=g;for(;j>=0;){let he=Math.min(F,k);if(m[T]===void 0)break;if(m[T].copyCellsFrom(m[j],F-he,k-he,he,!0),k-=he,k===0&&(T--,k=S[T]),F-=he,F===0){j--;let te=Math.max(j,0);F=ga(m,te,this._cols)}}for(let he=0;he<m.length;he++)S[he]<t&&m[he].setCell(S[he],a);let ve=v-w;for(;ve-- >0;)this.ybase===0?this.y<s-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+h)-s&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+v,this.ybase+s-1)}if(u.length>0){let f=[],d=[];for(let k=0;k<this.lines.length;k++)d.push(this.lines.get(k));let m=this.lines.length,g=m-1,S=0,v=u[S];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+h);let w=0;for(let k=Math.min(this.lines.maxLength-1,m+h-1);k>=0;k--)if(v&&v.start>g+w){for(let j=v.newLines.length-1;j>=0;j--)this.lines.set(k--,v.newLines[j]);k++,f.push({index:g+1,amount:v.newLines.length}),w+=v.newLines.length,v=u[++S]}else this.lines.set(k,d[g--]);let O=0;for(let k=f.length-1;k>=0;k--)f[k].index+=O,this.lines.onInsertEmitter.fire(f[k]),O+=f[k].amount;let T=Math.max(0,m+h-this.lines.maxLength);T>0&&this.lines.onTrimEmitter.fire(T)}}translateBufferLineToString(t,s,l=0,a){let u=this.lines.get(t);return u?u.translateToString(s,l,a):""}getWrappedRangeForLine(t){let s=t,l=t;for(;s>0&&this.lines.get(s).isWrapped;)s--;for(;l+1<this.lines.length&&this.lines.get(l+1).isWrapped;)l++;return{first:s,last:l}}setupTabStops(t){for(t!=null?this.tabs[t]||(t=this.prevStop(t)):(this.tabs={},t=0);t<this._cols;t+=this._optionsService.rawOptions.tabStopWidth)this.tabs[t]=!0}prevStop(t){for(t==null&&(t=this.x);!this.tabs[--t]&&t>0;);return t>=this._cols?this._cols-1:t<0?0:t}nextStop(t){for(t==null&&(t=this.x);!this.tabs[++t]&&t<this._cols;);return t>=this._cols?this._cols-1:t<0?0:t}clearMarkers(t){this._isClearing=!0;for(let s=0;s<this.markers.length;s++)this.markers[s].line===t&&(this.markers[s].dispose(),this.markers.splice(s--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].dispose();this.markers.length=0,this._isClearing=!1}addMarker(t){let s=new hC(t);return this.markers.push(s),s.register(this.lines.onTrim(l=>{s.line-=l,s.line<0&&s.dispose()})),s.register(this.lines.onInsert(l=>{s.line>=l.index&&(s.line+=l.amount)})),s.register(this.lines.onDelete(l=>{s.line>=l.index&&s.line<l.index+l.amount&&s.dispose(),s.line>l.index&&(s.line-=l.amount)})),s.register(s.onDispose(()=>this._removeMarker(s))),s}_removeMarker(t){this._isClearing||this.markers.splice(this.markers.indexOf(t),1)}},fC=class extends ke{constructor(t,s){super(),this._optionsService=t,this._bufferService=s,this._onBufferActivate=this._register(new ne),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 mp(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new mp(!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(t){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(t),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(t,s){this._normal.resize(t,s),this._alt.resize(t,s),this.setupTabStops(t)}setupTabStops(t){this._normal.setupTabStops(t),this._alt.setupTabStops(t)}},T0=2,D0=1,Gf=class extends ke{constructor(t){super(),this.isUserScrolling=!1,this._onResize=this._register(new ne),this.onResize=this._onResize.event,this._onScroll=this._register(new ne),this.onScroll=this._onScroll.event,this.cols=Math.max(t.rawOptions.cols||0,T0),this.rows=Math.max(t.rawOptions.rows||0,D0),this.buffers=this._register(new fC(t,this)),this._register(this.buffers.onBufferActivate(s=>{this._onScroll.fire(s.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(t,s){let l=this.cols!==t,a=this.rows!==s;this.cols=t,this.rows=s,this.buffers.resize(t,s),this._onResize.fire({cols:t,rows:s,colsChanged:l,rowsChanged:a})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(t,s=!1){let l=this.buffer,a;a=this._cachedBlankLine,(!a||a.length!==this.cols||a.getFg(0)!==t.fg||a.getBg(0)!==t.bg)&&(a=l.getBlankLine(t,s),this._cachedBlankLine=a),a.isWrapped=s;let u=l.ybase+l.scrollTop,h=l.ybase+l.scrollBottom;if(l.scrollTop===0){let f=l.lines.isFull;h===l.lines.length-1?f?l.lines.recycle().copyFrom(a):l.lines.push(a.clone()):l.lines.splice(h+1,0,a.clone()),f?this.isUserScrolling&&(l.ydisp=Math.max(l.ydisp-1,0)):(l.ybase++,this.isUserScrolling||l.ydisp++)}else{let f=h-u+1;l.lines.shiftElements(u+1,f-1,-1),l.lines.set(h,a.clone())}this.isUserScrolling||(l.ydisp=l.ybase),this._onScroll.fire(l.ydisp)}scrollLines(t,s){let l=this.buffer;if(t<0){if(l.ydisp===0)return;this.isUserScrolling=!0}else t+l.ydisp>=l.ybase&&(this.isUserScrolling=!1);let a=l.ydisp;l.ydisp=Math.max(Math.min(l.ydisp+t,l.ybase),0),a!==l.ydisp&&(s||this._onScroll.fire(l.ydisp))}};Gf=vt([ue(0,oi)],Gf);var $n={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:dc,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},dC=["normal","bold","100","200","300","400","500","600","700","800","900"],_C=class extends ke{constructor(t){super(),this._onOptionChange=this._register(new ne),this.onOptionChange=this._onOptionChange.event;let s={...$n};for(let l in t)if(l in s)try{let a=t[l];s[l]=this._sanitizeAndValidateOption(l,a)}catch(a){console.error(a)}this.rawOptions=s,this.options={...s},this._setupOptions(),this._register(ot(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(t,s){return this.onOptionChange(l=>{l===t&&s(this.rawOptions[t])})}onMultipleOptionChange(t,s){return this.onOptionChange(l=>{t.indexOf(l)!==-1&&s()})}_setupOptions(){let t=l=>{if(!(l in $n))throw new Error(`No option with key "${l}"`);return this.rawOptions[l]},s=(l,a)=>{if(!(l in $n))throw new Error(`No option with key "${l}"`);a=this._sanitizeAndValidateOption(l,a),this.rawOptions[l]!==a&&(this.rawOptions[l]=a,this._onOptionChange.fire(l))};for(let l in this.rawOptions){let a={get:t.bind(this,l),set:s.bind(this,l)};Object.defineProperty(this.options,l,a)}}_sanitizeAndValidateOption(t,s){switch(t){case"cursorStyle":if(s||(s=$n[t]),!gC(s))throw new Error(`"${s}" is not a valid value for ${t}`);break;case"wordSeparator":s||(s=$n[t]);break;case"fontWeight":case"fontWeightBold":if(typeof s=="number"&&1<=s&&s<=1e3)break;s=dC.includes(s)?s:$n[t];break;case"cursorWidth":s=Math.floor(s);case"lineHeight":case"tabStopWidth":if(s<1)throw new Error(`${t} cannot be less than 1, value: ${s}`);break;case"minimumContrastRatio":s=Math.max(1,Math.min(21,Math.round(s*10)/10));break;case"scrollback":if(s=Math.min(s,4294967295),s<0)throw new Error(`${t} cannot be less than 0, value: ${s}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(s<=0)throw new Error(`${t} cannot be less than or equal to 0, value: ${s}`);break;case"rows":case"cols":if(!s&&s!==0)throw new Error(`${t} must be numeric, value: ${s}`);break;case"windowsPty":s=s??{};break}return s}};function gC(t){return t==="block"||t==="underline"||t==="bar"}function ca(t,s=5){if(typeof t!="object")return t;let l=Array.isArray(t)?[]:{};for(let a in t)l[a]=s<=1?t[a]:t[a]&&ca(t[a],s-1);return l}var vp=Object.freeze({insertMode:!1}),pp=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Wf=class extends ke{constructor(t,s,l){super(),this._bufferService=t,this._logService=s,this._optionsService=l,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new ne),this.onData=this._onData.event,this._onUserInput=this._register(new ne),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new ne),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new ne),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=ca(vp),this.decPrivateModes=ca(pp)}reset(){this.modes=ca(vp),this.decPrivateModes=ca(pp)}triggerDataEvent(t,s=!1){if(this._optionsService.rawOptions.disableStdin)return;let l=this._bufferService.buffer;s&&this._optionsService.rawOptions.scrollOnUserInput&&l.ybase!==l.ydisp&&this._onRequestScrollToBottom.fire(),s&&this._onUserInput.fire(),this._logService.debug(`sending data "${t}"`),this._logService.trace("sending data (codes)",()=>t.split("").map(a=>a.charCodeAt(0))),this._onData.fire(t)}triggerBinaryEvent(t){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${t}"`),this._logService.trace("sending binary (codes)",()=>t.split("").map(s=>s.charCodeAt(0))),this._onBinary.fire(t))}};Wf=vt([ue(0,ai),ue(1,Gp),ue(2,oi)],Wf);var Sp={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:t=>t.button===4||t.action!==1?!1:(t.ctrl=!1,t.alt=!1,t.shift=!1,!0)},VT200:{events:19,restrict:t=>t.action!==32},DRAG:{events:23,restrict:t=>!(t.action===32&&t.button===3)},ANY:{events:31,restrict:t=>!0}};function uf(t,s){let l=(t.ctrl?16:0)|(t.shift?4:0)|(t.alt?8:0);return t.button===4?(l|=64,l|=t.action):(l|=t.button&3,t.button&4&&(l|=64),t.button&8&&(l|=128),t.action===32?l|=32:t.action===0&&!s&&(l|=3)),l}var hf=String.fromCharCode,yp={DEFAULT:t=>{let s=[uf(t,!1)+32,t.col+32,t.row+32];return s[0]>255||s[1]>255||s[2]>255?"":`\x1B[M${hf(s[0])}${hf(s[1])}${hf(s[2])}`},SGR:t=>{let s=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${uf(t,!0)};${t.col};${t.row}${s}`},SGR_PIXELS:t=>{let s=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${uf(t,!0)};${t.x};${t.y}${s}`}},Ff=class extends ke{constructor(t,s,l){super(),this._bufferService=t,this._coreService=s,this._optionsService=l,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new ne),this.onProtocolChange=this._onProtocolChange.event;for(let a of Object.keys(Sp))this.addProtocol(a,Sp[a]);for(let a of Object.keys(yp))this.addEncoding(a,yp[a]);this.reset()}addProtocol(t,s){this._protocols[t]=s}addEncoding(t,s){this._encodings[t]=s}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(t){if(!this._protocols[t])throw new Error(`unknown protocol "${t}"`);this._activeProtocol=t,this._onProtocolChange.fire(this._protocols[t].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(t){if(!this._encodings[t])throw new Error(`unknown encoding "${t}"`);this._activeEncoding=t}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(t,s,l){if(t.deltaY===0||t.shiftKey||s===void 0||l===void 0)return 0;let a=s/l,u=this._applyScrollModifier(t.deltaY,t);return t.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(u/=a+0,Math.abs(t.deltaY)<50&&(u*=.3),this._wheelPartialScroll+=u,u=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):t.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(u*=this._bufferService.rows),u}_applyScrollModifier(t,s){return s.altKey||s.ctrlKey||s.shiftKey?t*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:t*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(t){if(t.col<0||t.col>=this._bufferService.cols||t.row<0||t.row>=this._bufferService.rows||t.button===4&&t.action===32||t.button===3&&t.action!==32||t.button!==4&&(t.action===2||t.action===3)||(t.col++,t.row++,t.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,t,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(t))return!1;let s=this._encodings[this._activeEncoding](t);return s&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(s):this._coreService.triggerDataEvent(s,!0)),this._lastEvent=t,!0}explainEvents(t){return{down:!!(t&1),up:!!(t&2),drag:!!(t&4),move:!!(t&8),wheel:!!(t&16)}}_equalEvents(t,s,l){if(l){if(t.x!==s.x||t.y!==s.y)return!1}else if(t.col!==s.col||t.row!==s.row)return!1;return!(t.button!==s.button||t.action!==s.action||t.ctrl!==s.ctrl||t.alt!==s.alt||t.shift!==s.shift)}};Ff=vt([ue(0,ai),ue(1,tn),ue(2,oi)],Ff);var ff=[[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]],mC=[[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]],Rt;function vC(t,s){let l=0,a=s.length-1,u;if(t<s[0][0]||t>s[a][1])return!1;for(;a>=l;)if(u=l+a>>1,t>s[u][1])l=u+1;else if(t<s[u][0])a=u-1;else return!0;return!1}var pC=class{constructor(){if(this.version="6",!Rt){Rt=new Uint8Array(65536),Rt.fill(1),Rt[0]=0,Rt.fill(0,1,32),Rt.fill(0,127,160),Rt.fill(2,4352,4448),Rt[9001]=2,Rt[9002]=2,Rt.fill(2,11904,42192),Rt[12351]=1,Rt.fill(2,44032,55204),Rt.fill(2,63744,64256),Rt.fill(2,65040,65050),Rt.fill(2,65072,65136),Rt.fill(2,65280,65377),Rt.fill(2,65504,65511);for(let t=0;t<ff.length;++t)Rt.fill(0,ff[t][0],ff[t][1]+1)}}wcwidth(t){return t<32?0:t<127?1:t<65536?Rt[t]:vC(t,mC)?0:t>=131072&&t<=196605||t>=196608&&t<=262141?2:1}charProperties(t,s){let l=this.wcwidth(t),a=l===0&&s!==0;if(a){let u=Qr.extractWidth(s);u===0?a=!1:u>l&&(l=u)}return Qr.createPropertyValue(0,l,a)}},Qr=class lc{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new ne,this.onChange=this._onChange.event;let s=new pC;this.register(s),this._active=s.version,this._activeProvider=s}static extractShouldJoin(s){return(s&1)!==0}static extractWidth(s){return s>>1&3}static extractCharKind(s){return s>>3}static createPropertyValue(s,l,a=!1){return(s&16777215)<<3|(l&3)<<1|(a?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(s){if(!this._providers[s])throw new Error(`unknown Unicode version "${s}"`);this._active=s,this._activeProvider=this._providers[s],this._onChange.fire(s)}register(s){this._providers[s.version]=s}wcwidth(s){return this._activeProvider.wcwidth(s)}getStringCellWidth(s){let l=0,a=0,u=s.length;for(let h=0;h<u;++h){let f=s.charCodeAt(h);if(55296<=f&&f<=56319){if(++h>=u)return l+this.wcwidth(f);let g=s.charCodeAt(h);56320<=g&&g<=57343?f=(f-55296)*1024+g-56320+65536:l+=this.wcwidth(g)}let d=this.charProperties(f,a),m=lc.extractWidth(d);lc.extractShouldJoin(d)&&(m-=lc.extractWidth(a)),l+=m,a=d}return l}charProperties(s,l){return this._activeProvider.charProperties(s,l)}},SC=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(t){this.glevel=t,this.charset=this._charsets[t]}setgCharset(t,s){this._charsets[t]=s,this.glevel===t&&(this.charset=s)}};function bp(t){let s=t.buffer.lines.get(t.buffer.ybase+t.buffer.y-1)?.get(t.cols-1),l=t.buffer.lines.get(t.buffer.ybase+t.buffer.y);l&&s&&(l.isWrapped=s[3]!==0&&s[3]!==32)}var sa=2147483647,yC=256,M0=class Zf{constructor(s=32,l=32){if(this.maxLength=s,this.maxSubParamsLength=l,l>yC)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(s),this.length=0,this._subParams=new Int32Array(l),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(s),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(s){let l=new Zf;if(!s.length)return l;for(let a=Array.isArray(s[0])?1:0;a<s.length;++a){let u=s[a];if(Array.isArray(u))for(let h=0;h<u.length;++h)l.addSubParam(u[h]);else l.addParam(u)}return l}clone(){let s=new Zf(this.maxLength,this.maxSubParamsLength);return s.params.set(this.params),s.length=this.length,s._subParams.set(this._subParams),s._subParamsLength=this._subParamsLength,s._subParamsIdx.set(this._subParamsIdx),s._rejectDigits=this._rejectDigits,s._rejectSubDigits=this._rejectSubDigits,s._digitIsSub=this._digitIsSub,s}toArray(){let s=[];for(let l=0;l<this.length;++l){s.push(this.params[l]);let a=this._subParamsIdx[l]>>8,u=this._subParamsIdx[l]&255;u-a>0&&s.push(Array.prototype.slice.call(this._subParams,a,u))}return s}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(s){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(s<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=s>sa?sa:s}addSubParam(s){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(s<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=s>sa?sa:s,this._subParamsIdx[this.length-1]++}}hasSubParams(s){return(this._subParamsIdx[s]&255)-(this._subParamsIdx[s]>>8)>0}getSubParams(s){let l=this._subParamsIdx[s]>>8,a=this._subParamsIdx[s]&255;return a-l>0?this._subParams.subarray(l,a):null}getSubParamsAll(){let s={};for(let l=0;l<this.length;++l){let a=this._subParamsIdx[l]>>8,u=this._subParamsIdx[l]&255;u-a>0&&(s[l]=this._subParams.slice(a,u))}return s}addDigit(s){let l;if(this._rejectDigits||!(l=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let a=this._digitIsSub?this._subParams:this.params,u=a[l-1];a[l-1]=~u?Math.min(u*10+s,sa):s}},ra=[],bC=class{constructor(){this._state=0,this._active=ra,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(t,s){this._handlers[t]===void 0&&(this._handlers[t]=[]);let l=this._handlers[t];return l.push(s),{dispose:()=>{let a=l.indexOf(s);a!==-1&&l.splice(a,1)}}}clearHandler(t){this._handlers[t]&&delete this._handlers[t]}setHandlerFallback(t){this._handlerFb=t}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=ra}reset(){if(this._state===2)for(let t=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;t>=0;--t)this._active[t].end(!1);this._stack.paused=!1,this._active=ra,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||ra,!this._active.length)this._handlerFb(this._id,"START");else for(let t=this._active.length-1;t>=0;t--)this._active[t].start()}_put(t,s,l){if(!this._active.length)this._handlerFb(this._id,"PUT",mc(t,s,l));else for(let a=this._active.length-1;a>=0;a--)this._active[a].put(t,s,l)}start(){this.reset(),this._state=1}put(t,s,l){if(this._state!==3){if(this._state===1)for(;s<l;){let a=t[s++];if(a===59){this._state=2,this._start();break}if(a<48||57<a){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+a-48}this._state===2&&l-s>0&&this._put(t,s,l)}}end(t,s=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",t);else{let l=!1,a=this._active.length-1,u=!1;if(this._stack.paused&&(a=this._stack.loopPosition-1,l=s,u=this._stack.fallThrough,this._stack.paused=!1),!u&&l===!1){for(;a>=0&&(l=this._active[a].end(t),l!==!0);a--)if(l instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=a,this._stack.fallThrough=!1,l;a--}for(;a>=0;a--)if(l=this._active[a].end(!1),l instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=a,this._stack.fallThrough=!0,l}this._active=ra,this._id=-1,this._state=0}}},Di=class{constructor(t){this._handler=t,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(t,s,l){this._hitLimit||(this._data+=mc(t,s,l),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(t){let s=!1;if(this._hitLimit)s=!1;else if(t&&(s=this._handler(this._data),s instanceof Promise))return s.then(l=>(this._data="",this._hitLimit=!1,l));return this._data="",this._hitLimit=!1,s}},na=[],wC=class{constructor(){this._handlers=Object.create(null),this._active=na,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=na}registerHandler(t,s){this._handlers[t]===void 0&&(this._handlers[t]=[]);let l=this._handlers[t];return l.push(s),{dispose:()=>{let a=l.indexOf(s);a!==-1&&l.splice(a,1)}}}clearHandler(t){this._handlers[t]&&delete this._handlers[t]}setHandlerFallback(t){this._handlerFb=t}reset(){if(this._active.length)for(let t=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;t>=0;--t)this._active[t].unhook(!1);this._stack.paused=!1,this._active=na,this._ident=0}hook(t,s){if(this.reset(),this._ident=t,this._active=this._handlers[t]||na,!this._active.length)this._handlerFb(this._ident,"HOOK",s);else for(let l=this._active.length-1;l>=0;l--)this._active[l].hook(s)}put(t,s,l){if(!this._active.length)this._handlerFb(this._ident,"PUT",mc(t,s,l));else for(let a=this._active.length-1;a>=0;a--)this._active[a].put(t,s,l)}unhook(t,s=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",t);else{let l=!1,a=this._active.length-1,u=!1;if(this._stack.paused&&(a=this._stack.loopPosition-1,l=s,u=this._stack.fallThrough,this._stack.paused=!1),!u&&l===!1){for(;a>=0&&(l=this._active[a].unhook(t),l!==!0);a--)if(l instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=a,this._stack.fallThrough=!1,l;a--}for(;a>=0;a--)if(l=this._active[a].unhook(!1),l instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=a,this._stack.fallThrough=!0,l}this._active=na,this._ident=0}},ua=new M0;ua.addParam(0);var wp=class{constructor(t){this._handler=t,this._data="",this._params=ua,this._hitLimit=!1}hook(t){this._params=t.length>1||t.params[0]?t.clone():ua,this._data="",this._hitLimit=!1}put(t,s,l){this._hitLimit||(this._data+=mc(t,s,l),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(t){let s=!1;if(this._hitLimit)s=!1;else if(t&&(s=this._handler(this._data,this._params),s instanceof Promise))return s.then(l=>(this._params=ua,this._data="",this._hitLimit=!1,l));return this._params=ua,this._data="",this._hitLimit=!1,s}},CC=class{constructor(t){this.table=new Uint8Array(t)}setDefault(t,s){this.table.fill(t<<4|s)}add(t,s,l,a){this.table[s<<8|t]=l<<4|a}addMany(t,s,l,a){for(let u=0;u<t.length;u++)this.table[s<<8|t[u]]=l<<4|a}},Yi=160,EC=(function(){let t=new CC(4095),s=Array.apply(null,Array(256)).map((d,m)=>m),l=(d,m)=>s.slice(d,m),a=l(32,127),u=l(0,24);u.push(25),u.push.apply(u,l(28,32));let h=l(0,14),f;t.setDefault(1,0),t.addMany(a,0,2,0);for(f in h)t.addMany([24,26,153,154],f,3,0),t.addMany(l(128,144),f,3,0),t.addMany(l(144,152),f,3,0),t.add(156,f,0,0),t.add(27,f,11,1),t.add(157,f,4,8),t.addMany([152,158,159],f,0,7),t.add(155,f,11,3),t.add(144,f,11,9);return t.addMany(u,0,3,0),t.addMany(u,1,3,1),t.add(127,1,0,1),t.addMany(u,8,0,8),t.addMany(u,3,3,3),t.add(127,3,0,3),t.addMany(u,4,3,4),t.add(127,4,0,4),t.addMany(u,6,3,6),t.addMany(u,5,3,5),t.add(127,5,0,5),t.addMany(u,2,3,2),t.add(127,2,0,2),t.add(93,1,4,8),t.addMany(a,8,5,8),t.add(127,8,5,8),t.addMany([156,27,24,26,7],8,6,0),t.addMany(l(28,32),8,0,8),t.addMany([88,94,95],1,0,7),t.addMany(a,7,0,7),t.addMany(u,7,0,7),t.add(156,7,0,0),t.add(127,7,0,7),t.add(91,1,11,3),t.addMany(l(64,127),3,7,0),t.addMany(l(48,60),3,8,4),t.addMany([60,61,62,63],3,9,4),t.addMany(l(48,60),4,8,4),t.addMany(l(64,127),4,7,0),t.addMany([60,61,62,63],4,0,6),t.addMany(l(32,64),6,0,6),t.add(127,6,0,6),t.addMany(l(64,127),6,0,0),t.addMany(l(32,48),3,9,5),t.addMany(l(32,48),5,9,5),t.addMany(l(48,64),5,0,6),t.addMany(l(64,127),5,7,0),t.addMany(l(32,48),4,9,5),t.addMany(l(32,48),1,9,2),t.addMany(l(32,48),2,9,2),t.addMany(l(48,127),2,10,0),t.addMany(l(48,80),1,10,0),t.addMany(l(81,88),1,10,0),t.addMany([89,90,92],1,10,0),t.addMany(l(96,127),1,10,0),t.add(80,1,11,9),t.addMany(u,9,0,9),t.add(127,9,0,9),t.addMany(l(28,32),9,0,9),t.addMany(l(32,48),9,9,12),t.addMany(l(48,60),9,8,10),t.addMany([60,61,62,63],9,9,10),t.addMany(u,11,0,11),t.addMany(l(32,128),11,0,11),t.addMany(l(28,32),11,0,11),t.addMany(u,10,0,10),t.add(127,10,0,10),t.addMany(l(28,32),10,0,10),t.addMany(l(48,60),10,8,10),t.addMany([60,61,62,63],10,0,11),t.addMany(l(32,48),10,9,12),t.addMany(u,12,0,12),t.add(127,12,0,12),t.addMany(l(28,32),12,0,12),t.addMany(l(32,48),12,9,12),t.addMany(l(48,64),12,0,11),t.addMany(l(64,127),12,12,13),t.addMany(l(64,127),10,12,13),t.addMany(l(64,127),9,12,13),t.addMany(u,13,13,13),t.addMany(a,13,13,13),t.add(127,13,0,13),t.addMany([27,156,24,26],13,14,0),t.add(Yi,0,2,0),t.add(Yi,8,5,8),t.add(Yi,6,0,6),t.add(Yi,11,0,11),t.add(Yi,13,13,13),t})(),xC=class extends ke{constructor(t=EC){super(),this._transitions=t,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new M0,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(s,l,a)=>{},this._executeHandlerFb=s=>{},this._csiHandlerFb=(s,l)=>{},this._escHandlerFb=s=>{},this._errorHandlerFb=s=>s,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(ot(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new bC),this._dcsParser=this._register(new wC),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(t,s=[64,126]){let l=0;if(t.prefix){if(t.prefix.length>1)throw new Error("only one byte as prefix supported");if(l=t.prefix.charCodeAt(0),l&&60>l||l>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(t.intermediates){if(t.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let u=0;u<t.intermediates.length;++u){let h=t.intermediates.charCodeAt(u);if(32>h||h>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");l<<=8,l|=h}}if(t.final.length!==1)throw new Error("final must be a single byte");let a=t.final.charCodeAt(0);if(s[0]>a||a>s[1])throw new Error(`final must be in range ${s[0]} .. ${s[1]}`);return l<<=8,l|=a,l}identToString(t){let s=[];for(;t;)s.push(String.fromCharCode(t&255)),t>>=8;return s.reverse().join("")}setPrintHandler(t){this._printHandler=t}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(t,s){let l=this._identifier(t,[48,126]);this._escHandlers[l]===void 0&&(this._escHandlers[l]=[]);let a=this._escHandlers[l];return a.push(s),{dispose:()=>{let u=a.indexOf(s);u!==-1&&a.splice(u,1)}}}clearEscHandler(t){this._escHandlers[this._identifier(t,[48,126])]&&delete this._escHandlers[this._identifier(t,[48,126])]}setEscHandlerFallback(t){this._escHandlerFb=t}setExecuteHandler(t,s){this._executeHandlers[t.charCodeAt(0)]=s}clearExecuteHandler(t){this._executeHandlers[t.charCodeAt(0)]&&delete this._executeHandlers[t.charCodeAt(0)]}setExecuteHandlerFallback(t){this._executeHandlerFb=t}registerCsiHandler(t,s){let l=this._identifier(t);this._csiHandlers[l]===void 0&&(this._csiHandlers[l]=[]);let a=this._csiHandlers[l];return a.push(s),{dispose:()=>{let u=a.indexOf(s);u!==-1&&a.splice(u,1)}}}clearCsiHandler(t){this._csiHandlers[this._identifier(t)]&&delete this._csiHandlers[this._identifier(t)]}setCsiHandlerFallback(t){this._csiHandlerFb=t}registerDcsHandler(t,s){return this._dcsParser.registerHandler(this._identifier(t),s)}clearDcsHandler(t){this._dcsParser.clearHandler(this._identifier(t))}setDcsHandlerFallback(t){this._dcsParser.setHandlerFallback(t)}registerOscHandler(t,s){return this._oscParser.registerHandler(t,s)}clearOscHandler(t){this._oscParser.clearHandler(t)}setOscHandlerFallback(t){this._oscParser.setHandlerFallback(t)}setErrorHandler(t){this._errorHandler=t}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(t,s,l,a,u){this._parseStack.state=t,this._parseStack.handlers=s,this._parseStack.handlerPos=l,this._parseStack.transition=a,this._parseStack.chunkPos=u}parse(t,s,l){let a=0,u=0,h=0,f;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,h=this._parseStack.chunkPos+1;else{if(l===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let d=this._parseStack.handlers,m=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(l===!1&&m>-1){for(;m>=0&&(f=d[m](this._params),f!==!0);m--)if(f instanceof Promise)return this._parseStack.handlerPos=m,f}this._parseStack.handlers=[];break;case 4:if(l===!1&&m>-1){for(;m>=0&&(f=d[m](),f!==!0);m--)if(f instanceof Promise)return this._parseStack.handlerPos=m,f}this._parseStack.handlers=[];break;case 6:if(a=t[this._parseStack.chunkPos],f=this._dcsParser.unhook(a!==24&&a!==26,l),f)return f;a===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(a=t[this._parseStack.chunkPos],f=this._oscParser.end(a!==24&&a!==26,l),f)return f;a===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,h=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let d=h;d<s;++d){switch(a=t[d],u=this._transitions.table[this.currentState<<8|(a<160?a:Yi)],u>>4){case 2:for(let w=d+1;;++w){if(w>=s||(a=t[w])<32||a>126&&a<Yi){this._printHandler(t,d,w),d=w-1;break}if(++w>=s||(a=t[w])<32||a>126&&a<Yi){this._printHandler(t,d,w),d=w-1;break}if(++w>=s||(a=t[w])<32||a>126&&a<Yi){this._printHandler(t,d,w),d=w-1;break}if(++w>=s||(a=t[w])<32||a>126&&a<Yi){this._printHandler(t,d,w),d=w-1;break}}break;case 3:this._executeHandlers[a]?this._executeHandlers[a]():this._executeHandlerFb(a),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:d,code:a,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let m=this._csiHandlers[this._collect<<8|a],g=m?m.length-1:-1;for(;g>=0&&(f=m[g](this._params),f!==!0);g--)if(f instanceof Promise)return this._preserveStack(3,m,g,u,d),f;g<0&&this._csiHandlerFb(this._collect<<8|a,this._params),this.precedingJoinState=0;break;case 8:do switch(a){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(a-48)}while(++d<s&&(a=t[d])>47&&a<60);d--;break;case 9:this._collect<<=8,this._collect|=a;break;case 10:let S=this._escHandlers[this._collect<<8|a],v=S?S.length-1:-1;for(;v>=0&&(f=S[v](),f!==!0);v--)if(f instanceof Promise)return this._preserveStack(4,S,v,u,d),f;v<0&&this._escHandlerFb(this._collect<<8|a),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|a,this._params);break;case 13:for(let w=d+1;;++w)if(w>=s||(a=t[w])===24||a===26||a===27||a>127&&a<Yi){this._dcsParser.put(t,d,w),d=w-1;break}break;case 14:if(f=this._dcsParser.unhook(a!==24&&a!==26),f)return this._preserveStack(6,[],0,u,d),f;a===27&&(u|=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 w=d+1;;w++)if(w>=s||(a=t[w])<32||a>127&&a<Yi){this._oscParser.put(t,d,w),d=w-1;break}break;case 6:if(f=this._oscParser.end(a!==24&&a!==26),f)return this._preserveStack(5,[],0,u,d),f;a===27&&(u|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=u&15}}},TC=/^([\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})$/,DC=/^[\da-f]+$/;function Cp(t){if(!t)return;let s=t.toLowerCase();if(s.indexOf("rgb:")===0){s=s.slice(4);let l=TC.exec(s);if(l){let a=l[1]?15:l[4]?255:l[7]?4095:65535;return[Math.round(parseInt(l[1]||l[4]||l[7]||l[10],16)/a*255),Math.round(parseInt(l[2]||l[5]||l[8]||l[11],16)/a*255),Math.round(parseInt(l[3]||l[6]||l[9]||l[12],16)/a*255)]}}else if(s.indexOf("#")===0&&(s=s.slice(1),DC.exec(s)&&[3,6,9,12].includes(s.length))){let l=s.length/3,a=[0,0,0];for(let u=0;u<3;++u){let h=parseInt(s.slice(l*u,l*u+l),16);a[u]=l===1?h<<4:l===2?h:l===3?h>>4:h>>8}return a}}function df(t,s){let l=t.toString(16),a=l.length<2?"0"+l:l;switch(s){case 4:return l[0];case 8:return a;case 12:return(a+a).slice(0,3);default:return a+a}}function MC(t,s=16){let[l,a,u]=t;return`rgb:${df(l,s)}/${df(a,s)}/${df(u,s)}`}var RC={"(":0,")":1,"*":2,"+":3,"-":1,".":2},vr=131072,Ep=10;function xp(t,s){if(t>24)return s.setWinLines||!1;switch(t){case 1:return!!s.restoreWin;case 2:return!!s.minimizeWin;case 3:return!!s.setWinPosition;case 4:return!!s.setWinSizePixels;case 5:return!!s.raiseWin;case 6:return!!s.lowerWin;case 7:return!!s.refreshWin;case 8:return!!s.setWinSizeChars;case 9:return!!s.maximizeWin;case 10:return!!s.fullscreenWin;case 11:return!!s.getWinState;case 13:return!!s.getWinPosition;case 14:return!!s.getWinSizePixels;case 15:return!!s.getScreenSizePixels;case 16:return!!s.getCellSizePixels;case 18:return!!s.getWinSizeChars;case 19:return!!s.getScreenSizeChars;case 20:return!!s.getIconTitle;case 21:return!!s.getWinTitle;case 22:return!!s.pushTitle;case 23:return!!s.popTitle;case 24:return!!s.setWinLines}return!1}var Tp=5e3,Dp=0,OC=class extends ke{constructor(t,s,l,a,u,h,f,d,m=new xC){super(),this._bufferService=t,this._charsetService=s,this._coreService=l,this._logService=a,this._optionsService=u,this._oscLinkService=h,this._coreMouseService=f,this._unicodeService=d,this._parser=m,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new F1,this._utf8Decoder=new Z1,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=xt.clone(),this._eraseAttrDataInternal=xt.clone(),this._onRequestBell=this._register(new ne),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new ne),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new ne),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new ne),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new ne),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new ne),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new ne),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new ne),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new ne),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new ne),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new ne),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new ne),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new ne),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 Qf(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(g=>this._activeBuffer=g.activeBuffer)),this._parser.setCsiHandlerFallback((g,S)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(g),params:S.toArray()})}),this._parser.setEscHandlerFallback(g=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(g)})}),this._parser.setExecuteHandlerFallback(g=>{this._logService.debug("Unknown EXECUTE code: ",{code:g})}),this._parser.setOscHandlerFallback((g,S,v)=>{this._logService.debug("Unknown OSC code: ",{identifier:g,action:S,data:v})}),this._parser.setDcsHandlerFallback((g,S,v)=>{S==="HOOK"&&(v=v.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(g),action:S,payload:v})}),this._parser.setPrintHandler((g,S,v)=>this.print(g,S,v)),this._parser.registerCsiHandler({final:"@"},g=>this.insertChars(g)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},g=>this.scrollLeft(g)),this._parser.registerCsiHandler({final:"A"},g=>this.cursorUp(g)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},g=>this.scrollRight(g)),this._parser.registerCsiHandler({final:"B"},g=>this.cursorDown(g)),this._parser.registerCsiHandler({final:"C"},g=>this.cursorForward(g)),this._parser.registerCsiHandler({final:"D"},g=>this.cursorBackward(g)),this._parser.registerCsiHandler({final:"E"},g=>this.cursorNextLine(g)),this._parser.registerCsiHandler({final:"F"},g=>this.cursorPrecedingLine(g)),this._parser.registerCsiHandler({final:"G"},g=>this.cursorCharAbsolute(g)),this._parser.registerCsiHandler({final:"H"},g=>this.cursorPosition(g)),this._parser.registerCsiHandler({final:"I"},g=>this.cursorForwardTab(g)),this._parser.registerCsiHandler({final:"J"},g=>this.eraseInDisplay(g,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},g=>this.eraseInDisplay(g,!0)),this._parser.registerCsiHandler({final:"K"},g=>this.eraseInLine(g,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},g=>this.eraseInLine(g,!0)),this._parser.registerCsiHandler({final:"L"},g=>this.insertLines(g)),this._parser.registerCsiHandler({final:"M"},g=>this.deleteLines(g)),this._parser.registerCsiHandler({final:"P"},g=>this.deleteChars(g)),this._parser.registerCsiHandler({final:"S"},g=>this.scrollUp(g)),this._parser.registerCsiHandler({final:"T"},g=>this.scrollDown(g)),this._parser.registerCsiHandler({final:"X"},g=>this.eraseChars(g)),this._parser.registerCsiHandler({final:"Z"},g=>this.cursorBackwardTab(g)),this._parser.registerCsiHandler({final:"`"},g=>this.charPosAbsolute(g)),this._parser.registerCsiHandler({final:"a"},g=>this.hPositionRelative(g)),this._parser.registerCsiHandler({final:"b"},g=>this.repeatPrecedingCharacter(g)),this._parser.registerCsiHandler({final:"c"},g=>this.sendDeviceAttributesPrimary(g)),this._parser.registerCsiHandler({prefix:">",final:"c"},g=>this.sendDeviceAttributesSecondary(g)),this._parser.registerCsiHandler({final:"d"},g=>this.linePosAbsolute(g)),this._parser.registerCsiHandler({final:"e"},g=>this.vPositionRelative(g)),this._parser.registerCsiHandler({final:"f"},g=>this.hVPosition(g)),this._parser.registerCsiHandler({final:"g"},g=>this.tabClear(g)),this._parser.registerCsiHandler({final:"h"},g=>this.setMode(g)),this._parser.registerCsiHandler({prefix:"?",final:"h"},g=>this.setModePrivate(g)),this._parser.registerCsiHandler({final:"l"},g=>this.resetMode(g)),this._parser.registerCsiHandler({prefix:"?",final:"l"},g=>this.resetModePrivate(g)),this._parser.registerCsiHandler({final:"m"},g=>this.charAttributes(g)),this._parser.registerCsiHandler({final:"n"},g=>this.deviceStatus(g)),this._parser.registerCsiHandler({prefix:"?",final:"n"},g=>this.deviceStatusPrivate(g)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},g=>this.softReset(g)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},g=>this.setCursorStyle(g)),this._parser.registerCsiHandler({final:"r"},g=>this.setScrollRegion(g)),this._parser.registerCsiHandler({final:"s"},g=>this.saveCursor(g)),this._parser.registerCsiHandler({final:"t"},g=>this.windowOptions(g)),this._parser.registerCsiHandler({final:"u"},g=>this.restoreCursor(g)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},g=>this.insertColumns(g)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},g=>this.deleteColumns(g)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},g=>this.selectProtected(g)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},g=>this.requestMode(g,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},g=>this.requestMode(g,!1)),this._parser.setExecuteHandler(V.BEL,()=>this.bell()),this._parser.setExecuteHandler(V.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(V.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(V.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(V.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(V.BS,()=>this.backspace()),this._parser.setExecuteHandler(V.HT,()=>this.tab()),this._parser.setExecuteHandler(V.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(V.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(rc.IND,()=>this.index()),this._parser.setExecuteHandler(rc.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(rc.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Di(g=>(this.setTitle(g),this.setIconName(g),!0))),this._parser.registerOscHandler(1,new Di(g=>this.setIconName(g))),this._parser.registerOscHandler(2,new Di(g=>this.setTitle(g))),this._parser.registerOscHandler(4,new Di(g=>this.setOrReportIndexedColor(g))),this._parser.registerOscHandler(8,new Di(g=>this.setHyperlink(g))),this._parser.registerOscHandler(10,new Di(g=>this.setOrReportFgColor(g))),this._parser.registerOscHandler(11,new Di(g=>this.setOrReportBgColor(g))),this._parser.registerOscHandler(12,new Di(g=>this.setOrReportCursorColor(g))),this._parser.registerOscHandler(104,new Di(g=>this.restoreIndexedColor(g))),this._parser.registerOscHandler(110,new Di(g=>this.restoreFgColor(g))),this._parser.registerOscHandler(111,new Di(g=>this.restoreBgColor(g))),this._parser.registerOscHandler(112,new Di(g=>this.restoreCursorColor(g))),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 g in Ot)this._parser.registerEscHandler({intermediates:"(",final:g},()=>this.selectCharset("("+g)),this._parser.registerEscHandler({intermediates:")",final:g},()=>this.selectCharset(")"+g)),this._parser.registerEscHandler({intermediates:"*",final:g},()=>this.selectCharset("*"+g)),this._parser.registerEscHandler({intermediates:"+",final:g},()=>this.selectCharset("+"+g)),this._parser.registerEscHandler({intermediates:"-",final:g},()=>this.selectCharset("-"+g)),this._parser.registerEscHandler({intermediates:".",final:g},()=>this.selectCharset("."+g)),this._parser.registerEscHandler({intermediates:"/",final:g},()=>this.selectCharset("/"+g));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(g=>(this._logService.error("Parsing error: ",g),g)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new wp((g,S)=>this.requestStatusString(g,S)))}getAttrData(){return this._curAttrData}_preserveStack(t,s,l,a){this._parseStack.paused=!0,this._parseStack.cursorStartX=t,this._parseStack.cursorStartY=s,this._parseStack.decodedLength=l,this._parseStack.position=a}_logSlowResolvingAsync(t){this._logService.logLevel<=3&&Promise.race([t,new Promise((s,l)=>setTimeout(()=>l("#SLOW_TIMEOUT"),Tp))]).catch(s=>{if(s!=="#SLOW_TIMEOUT")throw s;console.warn(`async parser handler taking longer than ${Tp} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(t,s){let l,a=this._activeBuffer.x,u=this._activeBuffer.y,h=0,f=this._parseStack.paused;if(f){if(l=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,s))return this._logSlowResolvingAsync(l),l;a=this._parseStack.cursorStartX,u=this._parseStack.cursorStartY,this._parseStack.paused=!1,t.length>vr&&(h=this._parseStack.position+vr)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof t=="string"?` "${t}"`:` "${Array.prototype.map.call(t,g=>String.fromCharCode(g)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof t=="string"?t.split("").map(g=>g.charCodeAt(0)):t),this._parseBuffer.length<t.length&&this._parseBuffer.length<vr&&(this._parseBuffer=new Uint32Array(Math.min(t.length,vr))),f||this._dirtyRowTracker.clearRange(),t.length>vr)for(let g=h;g<t.length;g+=vr){let S=g+vr<t.length?g+vr:t.length,v=typeof t=="string"?this._stringDecoder.decode(t.substring(g,S),this._parseBuffer):this._utf8Decoder.decode(t.subarray(g,S),this._parseBuffer);if(l=this._parser.parse(this._parseBuffer,v))return this._preserveStack(a,u,v,g),this._logSlowResolvingAsync(l),l}else if(!f){let g=typeof t=="string"?this._stringDecoder.decode(t,this._parseBuffer):this._utf8Decoder.decode(t,this._parseBuffer);if(l=this._parser.parse(this._parseBuffer,g))return this._preserveStack(a,u,g,0),this._logSlowResolvingAsync(l),l}(this._activeBuffer.x!==a||this._activeBuffer.y!==u)&&this._onCursorMove.fire();let d=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),m=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);m<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(m,this._bufferService.rows-1),end:Math.min(d,this._bufferService.rows-1)})}print(t,s,l){let a,u,h=this._charsetService.charset,f=this._optionsService.rawOptions.screenReaderMode,d=this._bufferService.cols,m=this._coreService.decPrivateModes.wraparound,g=this._coreService.modes.insertMode,S=this._curAttrData,v=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&l-s>0&&v.getWidth(this._activeBuffer.x-1)===2&&v.setCellFromCodepoint(this._activeBuffer.x-1,0,1,S);let w=this._parser.precedingJoinState;for(let O=s;O<l;++O){if(a=t[O],a<127&&h){let F=h[String.fromCharCode(a)];F&&(a=F.charCodeAt(0))}let T=this._unicodeService.charProperties(a,w);u=Qr.extractWidth(T);let k=Qr.extractShouldJoin(T),j=k?Qr.extractWidth(w):0;if(w=T,f&&this._onA11yChar.fire(pr(a)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+u-j>d){if(m){let F=v,ve=this._activeBuffer.x-j;for(this._activeBuffer.x=j,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),v=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),j>0&&v instanceof oa&&v.copyCellsFrom(F,ve,0,j,!1);ve<d;)F.setCellFromCodepoint(ve++,0,1,S)}else if(this._activeBuffer.x=d-1,u===2)continue}if(k&&this._activeBuffer.x){let F=v.getWidth(this._activeBuffer.x-1)?1:2;v.addCodepointToCell(this._activeBuffer.x-F,a,u);for(let ve=u-j;--ve>=0;)v.setCellFromCodepoint(this._activeBuffer.x++,0,0,S);continue}if(g&&(v.insertCells(this._activeBuffer.x,u-j,this._activeBuffer.getNullCell(S)),v.getWidth(d-1)===2&&v.setCellFromCodepoint(d-1,0,1,S)),v.setCellFromCodepoint(this._activeBuffer.x++,a,u,S),u>0)for(;--u;)v.setCellFromCodepoint(this._activeBuffer.x++,0,0,S)}this._parser.precedingJoinState=w,this._activeBuffer.x<d&&l-s>0&&v.getWidth(this._activeBuffer.x)===0&&!v.hasContent(this._activeBuffer.x)&&v.setCellFromCodepoint(this._activeBuffer.x,0,1,S),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(t,s){return t.final==="t"&&!t.prefix&&!t.intermediates?this._parser.registerCsiHandler(t,l=>xp(l.params[0],this._optionsService.rawOptions.windowOptions)?s(l):!0):this._parser.registerCsiHandler(t,s)}registerDcsHandler(t,s){return this._parser.registerDcsHandler(t,new wp(s))}registerEscHandler(t,s){return this._parser.registerEscHandler(t,s)}registerOscHandler(t,s){return this._parser.registerOscHandler(t,new Di(s))}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(){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&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.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 t=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-t),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(t=this._bufferService.cols-1){this._activeBuffer.x=Math.min(t,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(t,s){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=t,this._activeBuffer.y=this._activeBuffer.scrollTop+s):(this._activeBuffer.x=t,this._activeBuffer.y=s),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(t,s){this._restrictCursor(),this._setCursor(this._activeBuffer.x+t,this._activeBuffer.y+s)}cursorUp(t){let s=this._activeBuffer.y-this._activeBuffer.scrollTop;return s>=0?this._moveCursor(0,-Math.min(s,t.params[0]||1)):this._moveCursor(0,-(t.params[0]||1)),!0}cursorDown(t){let s=this._activeBuffer.scrollBottom-this._activeBuffer.y;return s>=0?this._moveCursor(0,Math.min(s,t.params[0]||1)):this._moveCursor(0,t.params[0]||1),!0}cursorForward(t){return this._moveCursor(t.params[0]||1,0),!0}cursorBackward(t){return this._moveCursor(-(t.params[0]||1),0),!0}cursorNextLine(t){return this.cursorDown(t),this._activeBuffer.x=0,!0}cursorPrecedingLine(t){return this.cursorUp(t),this._activeBuffer.x=0,!0}cursorCharAbsolute(t){return this._setCursor((t.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(t){return this._setCursor(t.length>=2?(t.params[1]||1)-1:0,(t.params[0]||1)-1),!0}charPosAbsolute(t){return this._setCursor((t.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(t){return this._moveCursor(t.params[0]||1,0),!0}linePosAbsolute(t){return this._setCursor(this._activeBuffer.x,(t.params[0]||1)-1),!0}vPositionRelative(t){return this._moveCursor(0,t.params[0]||1),!0}hVPosition(t){return this.cursorPosition(t),!0}tabClear(t){let s=t.params[0];return s===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:s===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(t){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let s=t.params[0]||1;for(;s--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(t){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let s=t.params[0]||1;for(;s--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(t){let s=t.params[0];return s===1&&(this._curAttrData.bg|=536870912),(s===2||s===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(t,s,l,a=!1,u=!1){let h=this._activeBuffer.lines.get(this._activeBuffer.ybase+t);h.replaceCells(s,l,this._activeBuffer.getNullCell(this._eraseAttrData()),u),a&&(h.isWrapped=!1)}_resetBufferLine(t,s=!1){let l=this._activeBuffer.lines.get(this._activeBuffer.ybase+t);l&&(l.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),s),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+t),l.isWrapped=!1)}eraseInDisplay(t,s=!1){this._restrictCursor(this._bufferService.cols);let l;switch(t.params[0]){case 0:for(l=this._activeBuffer.y,this._dirtyRowTracker.markDirty(l),this._eraseInBufferLine(l++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,s);l<this._bufferService.rows;l++)this._resetBufferLine(l,s);this._dirtyRowTracker.markDirty(l);break;case 1:for(l=this._activeBuffer.y,this._dirtyRowTracker.markDirty(l),this._eraseInBufferLine(l,0,this._activeBuffer.x+1,!0,s),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(l+1).isWrapped=!1);l--;)this._resetBufferLine(l,s);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(l=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,l-1);l--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+l)?.getTrimmedLength(););for(;l>=0;l--)this._bufferService.scroll(this._eraseAttrData())}else{for(l=this._bufferService.rows,this._dirtyRowTracker.markDirty(l-1);l--;)this._resetBufferLine(l,s);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(t,s=!1){switch(this._restrictCursor(this._bufferService.cols),t.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,s);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,s);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,s);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(t){this._restrictCursor();let s=t.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let l=this._activeBuffer.ybase+this._activeBuffer.y,a=this._bufferService.rows-1-this._activeBuffer.scrollBottom,u=this._bufferService.rows-1+this._activeBuffer.ybase-a+1;for(;s--;)this._activeBuffer.lines.splice(u-1,1),this._activeBuffer.lines.splice(l,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(t){this._restrictCursor();let s=t.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let l=this._activeBuffer.ybase+this._activeBuffer.y,a;for(a=this._bufferService.rows-1-this._activeBuffer.scrollBottom,a=this._bufferService.rows-1+this._activeBuffer.ybase-a;s--;)this._activeBuffer.lines.splice(l,1),this._activeBuffer.lines.splice(a,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(t){this._restrictCursor();let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return s&&(s.insertCells(this._activeBuffer.x,t.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(t){this._restrictCursor();let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return s&&(s.deleteCells(this._activeBuffer.x,t.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(t){let s=t.params[0]||1;for(;s--;)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(t){let s=t.params[0]||1;for(;s--;)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(xt));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let s=t.params[0]||1;for(let l=this._activeBuffer.scrollTop;l<=this._activeBuffer.scrollBottom;++l){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+l);a.deleteCells(0,s,this._activeBuffer.getNullCell(this._eraseAttrData())),a.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let s=t.params[0]||1;for(let l=this._activeBuffer.scrollTop;l<=this._activeBuffer.scrollBottom;++l){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+l);a.insertCells(0,s,this._activeBuffer.getNullCell(this._eraseAttrData())),a.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let s=t.params[0]||1;for(let l=this._activeBuffer.scrollTop;l<=this._activeBuffer.scrollBottom;++l){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+l);a.insertCells(this._activeBuffer.x,s,this._activeBuffer.getNullCell(this._eraseAttrData())),a.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let s=t.params[0]||1;for(let l=this._activeBuffer.scrollTop;l<=this._activeBuffer.scrollBottom;++l){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+l);a.deleteCells(this._activeBuffer.x,s,this._activeBuffer.getNullCell(this._eraseAttrData())),a.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(t){this._restrictCursor();let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return s&&(s.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(t.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(t){let s=this._parser.precedingJoinState;if(!s)return!0;let l=t.params[0]||1,a=Qr.extractWidth(s),u=this._activeBuffer.x-a,h=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(u),f=new Uint32Array(h.length*l),d=0;for(let g=0;g<h.length;){let S=h.codePointAt(g)||0;f[d++]=S,g+=S>65535?2:1}let m=d;for(let g=1;g<l;++g)f.copyWithin(m,0,d),m+=d;return this.print(f,0,m),!0}sendDeviceAttributesPrimary(t){return t.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(V.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(V.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(t){return t.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(V.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(V.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(t.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(V.ESC+"[>83;40003;0c")),!0}_is(t){return(this._optionsService.rawOptions.termName+"").indexOf(t)===0}setMode(t){for(let s=0;s<t.length;s++)switch(t.params[s]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(t){for(let s=0;s<t.length;s++)switch(t.params[s]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,Zr),this._charsetService.setgCharset(1,Zr),this._charsetService.setgCharset(2,Zr),this._charsetService.setgCharset(3,Zr);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(t){for(let s=0;s<t.length;s++)switch(t.params[s]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(t){for(let s=0;s<t.length;s++)switch(t.params[s]){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(),t.params[s]===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(t,s){let l;(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"))(l||={});let a=this._coreService.decPrivateModes,{activeProtocol:u,activeEncoding:h}=this._coreMouseService,f=this._coreService,{buffers:d,cols:m}=this._bufferService,{active:g,alt:S}=d,v=this._optionsService.rawOptions,w=(k,j)=>(f.triggerDataEvent(`${V.ESC}[${s?"":"?"}${k};${j}$y`),!0),O=k=>k?1:2,T=t.params[0];return s?T===2?w(T,4):T===4?w(T,O(f.modes.insertMode)):T===12?w(T,3):T===20?w(T,O(v.convertEol)):w(T,0):T===1?w(T,O(a.applicationCursorKeys)):T===3?w(T,v.windowOptions.setWinLines?m===80?2:m===132?1:0:0):T===6?w(T,O(a.origin)):T===7?w(T,O(a.wraparound)):T===8?w(T,3):T===9?w(T,O(u==="X10")):T===12?w(T,O(v.cursorBlink)):T===25?w(T,O(!f.isCursorHidden)):T===45?w(T,O(a.reverseWraparound)):T===66?w(T,O(a.applicationKeypad)):T===67?w(T,4):T===1e3?w(T,O(u==="VT200")):T===1002?w(T,O(u==="DRAG")):T===1003?w(T,O(u==="ANY")):T===1004?w(T,O(a.sendFocus)):T===1005?w(T,4):T===1006?w(T,O(h==="SGR")):T===1015?w(T,4):T===1016?w(T,O(h==="SGR_PIXELS")):T===1048?w(T,1):T===47||T===1047||T===1049?w(T,O(g===S)):T===2004?w(T,O(a.bracketedPasteMode)):T===2026?w(T,O(a.synchronizedOutput)):w(T,0)}_updateAttrColor(t,s,l,a,u){return s===2?(t|=50331648,t&=-16777216,t|=ma.fromColorRGB([l,a,u])):s===5&&(t&=-50331904,t|=33554432|l&255),t}_extractColor(t,s,l){let a=[0,0,-1,0,0,0],u=0,h=0;do{if(a[h+u]=t.params[s+h],t.hasSubParams(s+h)){let f=t.getSubParams(s+h),d=0;do a[1]===5&&(u=1),a[h+d+1+u]=f[d];while(++d<f.length&&d+h+1+u<a.length);break}if(a[1]===5&&h+u>=2||a[1]===2&&h+u>=5)break;a[1]&&(u=1)}while(++h+s<t.length&&h+u<a.length);for(let f=2;f<a.length;++f)a[f]===-1&&(a[f]=0);switch(a[0]){case 38:l.fg=this._updateAttrColor(l.fg,a[1],a[3],a[4],a[5]);break;case 48:l.bg=this._updateAttrColor(l.bg,a[1],a[3],a[4],a[5]);break;case 58:l.extended=l.extended.clone(),l.extended.underlineColor=this._updateAttrColor(l.extended.underlineColor,a[1],a[3],a[4],a[5])}return h}_processUnderline(t,s){s.extended=s.extended.clone(),(!~t||t>5)&&(t=1),s.extended.underlineStyle=t,s.fg|=268435456,t===0&&(s.fg&=-268435457),s.updateExtended()}_processSGR0(t){t.fg=xt.fg,t.bg=xt.bg,t.extended=t.extended.clone(),t.extended.underlineStyle=0,t.extended.underlineColor&=-67108864,t.updateExtended()}charAttributes(t){if(t.length===1&&t.params[0]===0)return this._processSGR0(this._curAttrData),!0;let s=t.length,l,a=this._curAttrData;for(let u=0;u<s;u++)l=t.params[u],l>=30&&l<=37?(a.fg&=-50331904,a.fg|=16777216|l-30):l>=40&&l<=47?(a.bg&=-50331904,a.bg|=16777216|l-40):l>=90&&l<=97?(a.fg&=-50331904,a.fg|=16777216|l-90|8):l>=100&&l<=107?(a.bg&=-50331904,a.bg|=16777216|l-100|8):l===0?this._processSGR0(a):l===1?a.fg|=134217728:l===3?a.bg|=67108864:l===4?(a.fg|=268435456,this._processUnderline(t.hasSubParams(u)?t.getSubParams(u)[0]:1,a)):l===5?a.fg|=536870912:l===7?a.fg|=67108864:l===8?a.fg|=1073741824:l===9?a.fg|=2147483648:l===2?a.bg|=134217728:l===21?this._processUnderline(2,a):l===22?(a.fg&=-134217729,a.bg&=-134217729):l===23?a.bg&=-67108865:l===24?(a.fg&=-268435457,this._processUnderline(0,a)):l===25?a.fg&=-536870913:l===27?a.fg&=-67108865:l===28?a.fg&=-1073741825:l===29?a.fg&=2147483647:l===39?(a.fg&=-67108864,a.fg|=xt.fg&16777215):l===49?(a.bg&=-67108864,a.bg|=xt.bg&16777215):l===38||l===48||l===58?u+=this._extractColor(t,u,a):l===53?a.bg|=1073741824:l===55?a.bg&=-1073741825:l===59?(a.extended=a.extended.clone(),a.extended.underlineColor=-1,a.updateExtended()):l===100?(a.fg&=-67108864,a.fg|=xt.fg&16777215,a.bg&=-67108864,a.bg|=xt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",l);return!0}deviceStatus(t){switch(t.params[0]){case 5:this._coreService.triggerDataEvent(`${V.ESC}[0n`);break;case 6:let s=this._activeBuffer.y+1,l=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${V.ESC}[${s};${l}R`);break}return!0}deviceStatusPrivate(t){if(t.params[0]===6){let s=this._activeBuffer.y+1,l=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${V.ESC}[?${s};${l}R`)}return!0}softReset(t){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=xt.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(t){let s=t.length===0?1:t.params[0];if(s===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(s){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 l=s%2===1;this._coreService.decPrivateModes.cursorBlink=l}return!0}setScrollRegion(t){let s=t.params[0]||1,l;return(t.length<2||(l=t.params[1])>this._bufferService.rows||l===0)&&(l=this._bufferService.rows),l>s&&(this._activeBuffer.scrollTop=s-1,this._activeBuffer.scrollBottom=l-1,this._setCursor(0,0)),!0}windowOptions(t){if(!xp(t.params[0],this._optionsService.rawOptions.windowOptions))return!0;let s=t.length>1?t.params[1]:0;switch(t.params[0]){case 14:s!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${V.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(s===0||s===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>Ep&&this._windowTitleStack.shift()),(s===0||s===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>Ep&&this._iconNameStack.shift());break;case 23:(s===0||s===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(s===0||s===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(t){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(t){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(t){return this._windowTitle=t,this._onTitleChange.fire(t),!0}setIconName(t){return this._iconName=t,!0}setOrReportIndexedColor(t){let s=[],l=t.split(";");for(;l.length>1;){let a=l.shift(),u=l.shift();if(/^\d+$/.exec(a)){let h=parseInt(a);if(Mp(h))if(u==="?")s.push({type:0,index:h});else{let f=Cp(u);f&&s.push({type:1,index:h,color:f})}}}return s.length&&this._onColor.fire(s),!0}setHyperlink(t){let s=t.indexOf(";");if(s===-1)return!0;let l=t.slice(0,s).trim(),a=t.slice(s+1);return a?this._createHyperlink(l,a):l.trim()?!1:this._finishHyperlink()}_createHyperlink(t,s){this._getCurrentLinkId()&&this._finishHyperlink();let l=t.split(":"),a,u=l.findIndex(h=>h.startsWith("id="));return u!==-1&&(a=l[u].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:a,uri:s}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(t,s){let l=t.split(";");for(let a=0;a<l.length&&!(s>=this._specialColors.length);++a,++s)if(l[a]==="?")this._onColor.fire([{type:0,index:this._specialColors[s]}]);else{let u=Cp(l[a]);u&&this._onColor.fire([{type:1,index:this._specialColors[s],color:u}])}return!0}setOrReportFgColor(t){return this._setOrReportSpecialColor(t,0)}setOrReportBgColor(t){return this._setOrReportSpecialColor(t,1)}setOrReportCursorColor(t){return this._setOrReportSpecialColor(t,2)}restoreIndexedColor(t){if(!t)return this._onColor.fire([{type:2}]),!0;let s=[],l=t.split(";");for(let a=0;a<l.length;++a)if(/^\d+$/.exec(l[a])){let u=parseInt(l[a]);Mp(u)&&s.push({type:2,index:u})}return s.length&&this._onColor.fire(s),!0}restoreFgColor(t){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(t){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(t){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,Zr),!0}selectCharset(t){return t.length!==2?(this.selectDefaultCharset(),!0):(t[0]==="/"||this._charsetService.setgCharset(RC[t[0]],Ot[t[1]]||Zr),!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 t=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,t,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=xt.clone(),this._eraseAttrDataInternal=xt.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(t){return this._charsetService.setgLevel(t),!0}screenAlignmentPattern(){let t=new Ki;t.content=1<<22|69,t.fg=this._curAttrData.fg,t.bg=this._curAttrData.bg,this._setCursor(0,0);for(let s=0;s<this._bufferService.rows;++s){let l=this._activeBuffer.ybase+this._activeBuffer.y+s,a=this._activeBuffer.lines.get(l);a&&(a.fill(t),a.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(t,s){let l=f=>(this._coreService.triggerDataEvent(`${V.ESC}${f}${V.ESC}\\`),!0),a=this._bufferService.buffer,u=this._optionsService.rawOptions;return l(t==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:t==='"p'?'P1$r61;1"p':t==="r"?`P1$r${a.scrollTop+1};${a.scrollBottom+1}r`:t==="m"?"P1$r0m":t===" q"?`P1$r${{block:2,underline:4,bar:6}[u.cursorStyle]-(u.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(t,s){this._dirtyRowTracker.markRangeDirty(t,s)}},Qf=class{constructor(t){this._bufferService=t,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(t){t<this.start?this.start=t:t>this.end&&(this.end=t)}markRangeDirty(t,s){t>s&&(Dp=t,t=s,s=Dp),t<this.start&&(this.start=t),s>this.end&&(this.end=s)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Qf=vt([ue(0,ai)],Qf);function Mp(t){return 0<=t&&t<256}var AC=5e7,Rp=12,BC=50,kC=class extends ke{constructor(t){super(),this._action=t,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new ne),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(t,s){if(s!==void 0&&this._syncCalls>s){this._syncCalls=0;return}if(this._pendingData+=t.length,this._writeBuffer.push(t),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let l;for(;l=this._writeBuffer.shift();){this._action(l);let a=this._callbacks.shift();a&&a()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(t,s){if(this._pendingData>AC)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+=t.length,this._writeBuffer.push(t),this._callbacks.push(s),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=t.length,this._writeBuffer.push(t),this._callbacks.push(s)}_innerWrite(t=0,s=!0){let l=t||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let a=this._writeBuffer[this._bufferOffset],u=this._action(a,s);if(u){let f=d=>performance.now()-l>=Rp?setTimeout(()=>this._innerWrite(0,d)):this._innerWrite(l,d);u.catch(d=>(queueMicrotask(()=>{throw d}),Promise.resolve(!1))).then(f);return}let h=this._callbacks[this._bufferOffset];if(h&&h(),this._bufferOffset++,this._pendingData-=a.length,performance.now()-l>=Rp)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>BC&&(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()}},$f=class{constructor(t){this._bufferService=t,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(t){let s=this._bufferService.buffer;if(t.id===void 0){let d=s.addMarker(s.ybase+s.y),m={data:t,id:this._nextId++,lines:[d]};return d.onDispose(()=>this._removeMarkerFromLink(m,d)),this._dataByLinkId.set(m.id,m),m.id}let l=t,a=this._getEntryIdKey(l),u=this._entriesWithId.get(a);if(u)return this.addLineToLink(u.id,s.ybase+s.y),u.id;let h=s.addMarker(s.ybase+s.y),f={id:this._nextId++,key:this._getEntryIdKey(l),data:l,lines:[h]};return h.onDispose(()=>this._removeMarkerFromLink(f,h)),this._entriesWithId.set(f.key,f),this._dataByLinkId.set(f.id,f),f.id}addLineToLink(t,s){let l=this._dataByLinkId.get(t);if(l&&l.lines.every(a=>a.line!==s)){let a=this._bufferService.buffer.addMarker(s);l.lines.push(a),a.onDispose(()=>this._removeMarkerFromLink(l,a))}}getLinkData(t){return this._dataByLinkId.get(t)?.data}_getEntryIdKey(t){return`${t.id};;${t.uri}`}_removeMarkerFromLink(t,s){let l=t.lines.indexOf(s);l!==-1&&(t.lines.splice(l,1),t.lines.length===0&&(t.data.id!==void 0&&this._entriesWithId.delete(t.key),this._dataByLinkId.delete(t.id)))}};$f=vt([ue(0,ai)],$f);var Op=!1,NC=class extends ke{constructor(t){super(),this._windowsWrappingHeuristics=this._register(new tl),this._onBinary=this._register(new ne),this.onBinary=this._onBinary.event,this._onData=this._register(new ne),this.onData=this._onData.event,this._onLineFeed=this._register(new ne),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new ne),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new ne),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new ne),this._instantiationService=new rC,this.optionsService=this._register(new _C(t)),this._instantiationService.setService(oi,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Gf)),this._instantiationService.setService(ai,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Xf)),this._instantiationService.setService(Gp,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Wf)),this._instantiationService.setService(tn,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Ff)),this._instantiationService.setService(Xp,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Qr)),this._instantiationService.setService(eb,this.unicodeService),this._charsetService=this._instantiationService.createInstance(SC),this._instantiationService.setService(J1,this._charsetService),this._oscLinkService=this._instantiationService.createInstance($f),this._instantiationService.setService(Wp,this._oscLinkService),this._inputHandler=this._register(new OC(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Wt.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Wt.forward(this._bufferService.onResize,this._onResize)),this._register(Wt.forward(this.coreService.onData,this._onData)),this._register(Wt.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 kC((s,l)=>this._inputHandler.parse(s,l))),this._register(Wt.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new ne),this._onScroll.event(t=>{this._onScrollApi?.fire(t.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(t){for(let s in t)this.optionsService.options[s]=t[s]}write(t,s){this._writeBuffer.write(t,s)}writeSync(t,s){this._logService.logLevel<=3&&!Op&&(this._logService.warn("writeSync is unreliable and will be removed soon."),Op=!0),this._writeBuffer.writeSync(t,s)}input(t,s=!0){this.coreService.triggerDataEvent(t,s)}resize(t,s){isNaN(t)||isNaN(s)||(t=Math.max(t,T0),s=Math.max(s,D0),this._bufferService.resize(t,s))}scroll(t,s=!1){this._bufferService.scroll(t,s)}scrollLines(t,s){this._bufferService.scrollLines(t,s)}scrollPages(t){this.scrollLines(t*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(t){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(t){let s=t-this._bufferService.buffer.ydisp;s!==0&&this.scrollLines(s)}registerEscHandler(t,s){return this._inputHandler.registerEscHandler(t,s)}registerDcsHandler(t,s){return this._inputHandler.registerDcsHandler(t,s)}registerCsiHandler(t,s){return this._inputHandler.registerCsiHandler(t,s)}registerOscHandler(t,s){return this._inputHandler.registerOscHandler(t,s)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let t=!1,s=this.optionsService.rawOptions.windowsPty;s&&s.buildNumber!==void 0&&s.buildNumber!==void 0?t=s.backend==="conpty"&&s.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(t=!0),t?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let t=[];t.push(this.onLineFeed(bp.bind(null,this._bufferService))),t.push(this.registerCsiHandler({final:"H"},()=>(bp(this._bufferService),!1))),this._windowsWrappingHeuristics.value=ot(()=>{for(let s of t)s.dispose()})}}},LC={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 zC(t,s,l,a){let u={type:0,cancel:!1,key:void 0},h=(t.shiftKey?1:0)|(t.altKey?2:0)|(t.ctrlKey?4:0)|(t.metaKey?8:0);switch(t.keyCode){case 0:t.key==="UIKeyInputUpArrow"?s?u.key=V.ESC+"OA":u.key=V.ESC+"[A":t.key==="UIKeyInputLeftArrow"?s?u.key=V.ESC+"OD":u.key=V.ESC+"[D":t.key==="UIKeyInputRightArrow"?s?u.key=V.ESC+"OC":u.key=V.ESC+"[C":t.key==="UIKeyInputDownArrow"&&(s?u.key=V.ESC+"OB":u.key=V.ESC+"[B");break;case 8:u.key=t.ctrlKey?"\b":V.DEL,t.altKey&&(u.key=V.ESC+u.key);break;case 9:if(t.shiftKey){u.key=V.ESC+"[Z";break}u.key=V.HT,u.cancel=!0;break;case 13:u.key=t.altKey?V.ESC+V.CR:V.CR,u.cancel=!0;break;case 27:u.key=V.ESC,t.altKey&&(u.key=V.ESC+V.ESC),u.cancel=!0;break;case 37:if(t.metaKey)break;h?u.key=V.ESC+"[1;"+(h+1)+"D":s?u.key=V.ESC+"OD":u.key=V.ESC+"[D";break;case 39:if(t.metaKey)break;h?u.key=V.ESC+"[1;"+(h+1)+"C":s?u.key=V.ESC+"OC":u.key=V.ESC+"[C";break;case 38:if(t.metaKey)break;h?u.key=V.ESC+"[1;"+(h+1)+"A":s?u.key=V.ESC+"OA":u.key=V.ESC+"[A";break;case 40:if(t.metaKey)break;h?u.key=V.ESC+"[1;"+(h+1)+"B":s?u.key=V.ESC+"OB":u.key=V.ESC+"[B";break;case 45:!t.shiftKey&&!t.ctrlKey&&(u.key=V.ESC+"[2~");break;case 46:h?u.key=V.ESC+"[3;"+(h+1)+"~":u.key=V.ESC+"[3~";break;case 36:h?u.key=V.ESC+"[1;"+(h+1)+"H":s?u.key=V.ESC+"OH":u.key=V.ESC+"[H";break;case 35:h?u.key=V.ESC+"[1;"+(h+1)+"F":s?u.key=V.ESC+"OF":u.key=V.ESC+"[F";break;case 33:t.shiftKey?u.type=2:t.ctrlKey?u.key=V.ESC+"[5;"+(h+1)+"~":u.key=V.ESC+"[5~";break;case 34:t.shiftKey?u.type=3:t.ctrlKey?u.key=V.ESC+"[6;"+(h+1)+"~":u.key=V.ESC+"[6~";break;case 112:h?u.key=V.ESC+"[1;"+(h+1)+"P":u.key=V.ESC+"OP";break;case 113:h?u.key=V.ESC+"[1;"+(h+1)+"Q":u.key=V.ESC+"OQ";break;case 114:h?u.key=V.ESC+"[1;"+(h+1)+"R":u.key=V.ESC+"OR";break;case 115:h?u.key=V.ESC+"[1;"+(h+1)+"S":u.key=V.ESC+"OS";break;case 116:h?u.key=V.ESC+"[15;"+(h+1)+"~":u.key=V.ESC+"[15~";break;case 117:h?u.key=V.ESC+"[17;"+(h+1)+"~":u.key=V.ESC+"[17~";break;case 118:h?u.key=V.ESC+"[18;"+(h+1)+"~":u.key=V.ESC+"[18~";break;case 119:h?u.key=V.ESC+"[19;"+(h+1)+"~":u.key=V.ESC+"[19~";break;case 120:h?u.key=V.ESC+"[20;"+(h+1)+"~":u.key=V.ESC+"[20~";break;case 121:h?u.key=V.ESC+"[21;"+(h+1)+"~":u.key=V.ESC+"[21~";break;case 122:h?u.key=V.ESC+"[23;"+(h+1)+"~":u.key=V.ESC+"[23~";break;case 123:h?u.key=V.ESC+"[24;"+(h+1)+"~":u.key=V.ESC+"[24~";break;default:if(t.ctrlKey&&!t.shiftKey&&!t.altKey&&!t.metaKey)t.keyCode>=65&&t.keyCode<=90?u.key=String.fromCharCode(t.keyCode-64):t.keyCode===32?u.key=V.NUL:t.keyCode>=51&&t.keyCode<=55?u.key=String.fromCharCode(t.keyCode-51+27):t.keyCode===56?u.key=V.DEL:t.keyCode===219?u.key=V.ESC:t.keyCode===220?u.key=V.FS:t.keyCode===221&&(u.key=V.GS);else if((!l||a)&&t.altKey&&!t.metaKey){let f=LC[t.keyCode]?.[t.shiftKey?1:0];if(f)u.key=V.ESC+f;else if(t.keyCode>=65&&t.keyCode<=90){let d=t.ctrlKey?t.keyCode-64:t.keyCode+32,m=String.fromCharCode(d);t.shiftKey&&(m=m.toUpperCase()),u.key=V.ESC+m}else if(t.keyCode===32)u.key=V.ESC+(t.ctrlKey?V.NUL:" ");else if(t.key==="Dead"&&t.code.startsWith("Key")){let d=t.code.slice(3,4);t.shiftKey||(d=d.toLowerCase()),u.key=V.ESC+d,u.cancel=!0}}else l&&!t.altKey&&!t.ctrlKey&&!t.shiftKey&&t.metaKey?t.keyCode===65&&(u.type=1):t.key&&!t.ctrlKey&&!t.altKey&&!t.metaKey&&t.keyCode>=48&&t.key.length===1?u.key=t.key:t.key&&t.ctrlKey&&(t.key==="_"&&(u.key=V.US),t.key==="@"&&(u.key=V.NUL));break}return u}var St=0,HC=class{constructor(t){this._getKey=t,this._array=[],this._insertedValues=[],this._flushInsertedTask=new _c,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new _c,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(t){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(t)}_flushInserted(){let t=this._insertedValues.sort((u,h)=>this._getKey(u)-this._getKey(h)),s=0,l=0,a=new Array(this._array.length+this._insertedValues.length);for(let u=0;u<a.length;u++)l>=this._array.length||this._getKey(t[s])<=this._getKey(this._array[l])?(a[u]=t[s],s++):a[u]=this._array[l++];this._array=a,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(t){if(this._flushCleanupInserted(),this._array.length===0)return!1;let s=this._getKey(t);if(s===void 0||(St=this._search(s),St===-1)||this._getKey(this._array[St])!==s)return!1;do if(this._array[St]===t)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(St),!0;while(++St<this._array.length&&this._getKey(this._array[St])===s);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let t=this._deletedIndices.sort((u,h)=>u-h),s=0,l=new Array(this._array.length-t.length),a=0;for(let u=0;u<this._array.length;u++)t[s]===u?s++:l[a++]=this._array[u];this._array=l,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(St=this._search(t),!(St<0||St>=this._array.length)&&this._getKey(this._array[St])===t))do yield this._array[St];while(++St<this._array.length&&this._getKey(this._array[St])===t)}forEachByKey(t,s){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(St=this._search(t),!(St<0||St>=this._array.length)&&this._getKey(this._array[St])===t))do s(this._array[St]);while(++St<this._array.length&&this._getKey(this._array[St])===t)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(t){let s=0,l=this._array.length-1;for(;l>=s;){let a=s+l>>1,u=this._getKey(this._array[a]);if(u>t)l=a-1;else if(u<t)s=a+1;else{for(;a>0&&this._getKey(this._array[a-1])===t;)a--;return a}}return s}},_f=0,Ap=0,UC=class extends ke{constructor(){super(),this._decorations=new HC(t=>t?.marker.line),this._onDecorationRegistered=this._register(new ne),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new ne),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(ot(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(t){if(t.marker.isDisposed)return;let s=new jC(t);if(s){let l=s.marker.onDispose(()=>s.dispose()),a=s.onDispose(()=>{a.dispose(),s&&(this._decorations.delete(s)&&this._onDecorationRemoved.fire(s),l.dispose())});this._decorations.insert(s),this._onDecorationRegistered.fire(s)}return s}reset(){for(let t of this._decorations.values())t.dispose();this._decorations.clear()}*getDecorationsAtCell(t,s,l){let a=0,u=0;for(let h of this._decorations.getKeyIterator(s))a=h.options.x??0,u=a+(h.options.width??1),t>=a&&t<u&&(!l||(h.options.layer??"bottom")===l)&&(yield h)}forEachDecorationAtCell(t,s,l,a){this._decorations.forEachByKey(s,u=>{_f=u.options.x??0,Ap=_f+(u.options.width??1),t>=_f&&t<Ap&&(!l||(u.options.layer??"bottom")===l)&&a(u)})}},jC=class extends wr{constructor(t){super(),this.options=t,this.onRenderEmitter=this.add(new ne),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new ne),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=t.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=ht.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=ht.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},qC=1e3,YC=class{constructor(t,s=qC){this._renderCallback=t,this._debounceThresholdMS=s,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(t,s,l){this._rowCount=l,t=t!==void 0?t:0,s=s!==void 0?s:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,t):t,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,s):s;let a=performance.now();if(a-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=a,this._innerRefresh();else if(!this._additionalRefreshRequested){let u=a-this._lastRefreshMs,h=this._debounceThresholdMS-u;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},h)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let t=Math.max(this._rowStart,0),s=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(t,s)}},Bp=20,gc=class extends ke{constructor(t,s,l,a){super(),this._terminal=t,this._coreBrowserService=l,this._renderService=a,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let u=this._coreBrowserService.mainDocument;this._accessibilityContainer=u.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=u.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let h=0;h<this._terminal.rows;h++)this._rowElements[h]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[h]);if(this._topBoundaryFocusListener=h=>this._handleBoundaryFocus(h,0),this._bottomBoundaryFocusListener=h=>this._handleBoundaryFocus(h,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=u.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new YC(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(h=>this._handleResize(h.rows))),this._register(this._terminal.onRender(h=>this._refreshRows(h.start,h.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(h=>this._handleChar(h))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
25
+ `))),this._register(this._terminal.onA11yTab(h=>this._handleTab(h))),this._register(this._terminal.onKey(h=>this._handleKey(h.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Te(u,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(ot(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(t){for(let s=0;s<t;s++)this._handleChar(" ")}_handleChar(t){this._liveRegionLineCount<Bp+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==t&&(this._charsToAnnounce+=t):this._charsToAnnounce+=t,t===`
26
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===Bp+1&&(this._liveRegion.textContent+=pf.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(t){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(t)||this._charsToConsume.push(t)}_refreshRows(t,s){this._liveRegionDebouncer.refresh(t,s,this._terminal.rows)}_renderRows(t,s){let l=this._terminal.buffer,a=l.lines.length.toString();for(let u=t;u<=s;u++){let h=l.lines.get(l.ydisp+u),f=[],d=h?.translateToString(!0,void 0,void 0,f)||"",m=(l.ydisp+u+1).toString(),g=this._rowElements[u];g&&(d.length===0?(g.textContent=" ",this._rowColumns.set(g,[0,1])):(g.textContent=d,this._rowColumns.set(g,f)),g.setAttribute("aria-posinset",m),g.setAttribute("aria-setsize",a),this._alignRowWidth(g))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(t,s){let l=t.target,a=this._rowElements[s===0?1:this._rowElements.length-2],u=l.getAttribute("aria-posinset"),h=s===0?"1":`${this._terminal.buffer.lines.length}`;if(u===h||t.relatedTarget!==a)return;let f,d;if(s===0?(f=l,d=this._rowElements.pop(),this._rowContainer.removeChild(d)):(f=this._rowElements.shift(),d=l,this._rowContainer.removeChild(f)),f.removeEventListener("focus",this._topBoundaryFocusListener),d.removeEventListener("focus",this._bottomBoundaryFocusListener),s===0){let m=this._createAccessibilityTreeNode();this._rowElements.unshift(m),this._rowContainer.insertAdjacentElement("afterbegin",m)}else{let m=this._createAccessibilityTreeNode();this._rowElements.push(m),this._rowContainer.appendChild(m)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(s===0?-1:1),this._rowElements[s===0?1:this._rowElements.length-2].focus(),t.preventDefault(),t.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let t=this._coreBrowserService.mainDocument.getSelection();if(!t)return;if(t.isCollapsed){this._rowContainer.contains(t.anchorNode)&&this._terminal.clearSelection();return}if(!t.anchorNode||!t.focusNode){console.error("anchorNode and/or focusNode are null");return}let s={node:t.anchorNode,offset:t.anchorOffset},l={node:t.focusNode,offset:t.focusOffset};if((s.node.compareDocumentPosition(l.node)&Node.DOCUMENT_POSITION_PRECEDING||s.node===l.node&&s.offset>l.offset)&&([s,l]=[l,s]),s.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(s={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(s.node))return;let a=this._rowElements.slice(-1)[0];if(l.node.compareDocumentPosition(a)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(l={node:a,offset:a.textContent?.length??0}),!this._rowContainer.contains(l.node))return;let u=({node:d,offset:m})=>{let g=d instanceof Text?d.parentNode:d,S=parseInt(g?.getAttribute("aria-posinset"),10)-1;if(isNaN(S))return console.warn("row is invalid. Race condition?"),null;let v=this._rowColumns.get(g);if(!v)return console.warn("columns is null. Race condition?"),null;let w=m<v.length?v[m]:v.slice(-1)[0]+1;return w>=this._terminal.cols&&(++S,w=0),{row:S,column:w}},h=u(s),f=u(l);if(!(!h||!f)){if(h.row>f.row||h.row===f.row&&h.column>=f.column)throw new Error("invalid range");this._terminal.select(h.column,h.row,(f.row-h.row)*this._terminal.cols-h.column+f.column)}}_handleResize(t){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let s=this._rowContainer.children.length;s<this._terminal.rows;s++)this._rowElements[s]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[s]);for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let t=this._coreBrowserService.mainDocument.createElement("div");return t.setAttribute("role","listitem"),t.tabIndex=-1,this._refreshRowDimensions(t),t}_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 t=0;t<this._terminal.rows;t++)this._refreshRowDimensions(this._rowElements[t]),this._alignRowWidth(this._rowElements[t])}}_refreshRowDimensions(t){t.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(t){t.style.transform="";let s=t.getBoundingClientRect().width,l=this._rowColumns.get(t)?.slice(-1)?.[0];if(!l)return;let a=l*this._renderService.dimensions.css.cell.width;t.style.transform=`scaleX(${a/s})`}};gc=vt([ue(1,id),ue(2,Us),ue(3,js)],gc);var Jf=class extends ke{constructor(t,s,l,a,u){super(),this._element=t,this._mouseService=s,this._renderService=l,this._bufferService=a,this._linkProviderService=u,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new ne),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new ne),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(ot(()=>{Jr(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Te(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Te(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Te(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Te(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(t){this._lastMouseEvent=t;let s=this._positionFromMouseEvent(t,this._element,this._mouseService);if(!s)return;this._isMouseOut=!1;let l=t.composedPath();for(let a=0;a<l.length;a++){let u=l[a];if(u.classList.contains("xterm"))break;if(u.classList.contains("xterm-hover"))return}(!this._lastBufferCell||s.x!==this._lastBufferCell.x||s.y!==this._lastBufferCell.y)&&(this._handleHover(s),this._lastBufferCell=s)}_handleHover(t){if(this._activeLine!==t.y||this._wasResized){this._clearCurrentLink(),this._askForLink(t,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,t)||(this._clearCurrentLink(),this._askForLink(t,!0))}_askForLink(t,s){(!this._activeProviderReplies||!s)&&(this._activeProviderReplies?.forEach(a=>{a?.forEach(u=>{u.link.dispose&&u.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=t.y);let l=!1;for(let[a,u]of this._linkProviderService.linkProviders.entries())s?this._activeProviderReplies?.get(a)&&(l=this._checkLinkProviderResult(a,t,l)):u.provideLinks(t.y,h=>{if(this._isMouseOut)return;let f=h?.map(d=>({link:d}));this._activeProviderReplies?.set(a,f),l=this._checkLinkProviderResult(a,t,l),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(t.y,this._activeProviderReplies)})}_removeIntersectingLinks(t,s){let l=new Set;for(let a=0;a<s.size;a++){let u=s.get(a);if(u)for(let h=0;h<u.length;h++){let f=u[h],d=f.link.range.start.y<t?0:f.link.range.start.x,m=f.link.range.end.y>t?this._bufferService.cols:f.link.range.end.x;for(let g=d;g<=m;g++){if(l.has(g)){u.splice(h--,1);break}l.add(g)}}}}_checkLinkProviderResult(t,s,l){if(!this._activeProviderReplies)return l;let a=this._activeProviderReplies.get(t),u=!1;for(let h=0;h<t;h++)(!this._activeProviderReplies.has(h)||this._activeProviderReplies.get(h))&&(u=!0);if(!u&&a){let h=a.find(f=>this._linkAtPosition(f.link,s));h&&(l=!0,this._handleNewLink(h))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!l)for(let h=0;h<this._activeProviderReplies.size;h++){let f=this._activeProviderReplies.get(h)?.find(d=>this._linkAtPosition(d.link,s));if(f){l=!0,this._handleNewLink(f);break}}return l}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(t){if(!this._currentLink)return;let s=this._positionFromMouseEvent(t,this._element,this._mouseService);s&&this._mouseDownLink&&KC(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,s)&&this._currentLink.link.activate(t,this._currentLink.link.text)}_clearCurrentLink(t,s){!this._currentLink||!this._lastMouseEvent||(!t||!s||this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=s)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,Jr(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(t){if(!this._lastMouseEvent)return;let s=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);s&&this._linkAtPosition(t.link,s)&&(this._currentLink=t,this._currentLink.state={decorations:{underline:t.link.decorations===void 0?!0:t.link.decorations.underline,pointerCursor:t.link.decorations===void 0?!0:t.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,t.link,this._lastMouseEvent),t.link.decorations={},Object.defineProperties(t.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:l=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==l&&(this._currentLink.state.decorations.pointerCursor=l,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",l))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:l=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==l&&(this._currentLink.state.decorations.underline=l,this._currentLink.state.isHovered&&this._fireUnderlineEvent(t.link,l))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(l=>{if(!this._currentLink)return;let a=l.start===0?0:l.start+1+this._bufferService.buffer.ydisp,u=this._bufferService.buffer.ydisp+1+l.end;if(this._currentLink.link.range.start.y>=a&&this._currentLink.link.range.end.y<=u&&(this._clearCurrentLink(a,u),this._lastMouseEvent)){let h=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);h&&this._askForLink(h,!1)}})))}_linkHover(t,s,l){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(s,!0),this._currentLink.state.decorations.pointerCursor&&t.classList.add("xterm-cursor-pointer")),s.hover&&s.hover(l,s.text)}_fireUnderlineEvent(t,s){let l=t.range,a=this._bufferService.buffer.ydisp,u=this._createLinkUnderlineEvent(l.start.x-1,l.start.y-a-1,l.end.x,l.end.y-a-1,void 0);(s?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(u)}_linkLeave(t,s,l){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(s,!1),this._currentLink.state.decorations.pointerCursor&&t.classList.remove("xterm-cursor-pointer")),s.leave&&s.leave(l,s.text)}_linkAtPosition(t,s){let l=t.range.start.y*this._bufferService.cols+t.range.start.x,a=t.range.end.y*this._bufferService.cols+t.range.end.x,u=s.y*this._bufferService.cols+s.x;return l<=u&&u<=a}_positionFromMouseEvent(t,s,l){let a=l.getCoords(t,s,this._bufferService.cols,this._bufferService.rows);if(a)return{x:a[0],y:a[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(t,s,l,a,u){return{x1:t,y1:s,x2:l,y2:a,cols:this._bufferService.cols,fg:u}}};Jf=vt([ue(1,sd),ue(2,js),ue(3,ai),ue(4,Zp)],Jf);function KC(t,s){return t.text===s.text&&t.range.start.x===s.range.start.x&&t.range.start.y===s.range.start.y&&t.range.end.x===s.range.end.x&&t.range.end.y===s.range.end.y}var PC=class extends NC{constructor(t={}){super(t),this._linkifier=this._register(new tl),this.browser=g0,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new tl),this._onCursorMove=this._register(new ne),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new ne),this.onKey=this._onKey.event,this._onRender=this._register(new ne),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new ne),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new ne),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new ne),this.onBell=this._onBell.event,this._onFocus=this._register(new ne),this._onBlur=this._register(new ne),this._onA11yCharEmitter=this._register(new ne),this._onA11yTabEmitter=this._register(new ne),this._onWillOpen=this._register(new ne),this._setup(),this._decorationService=this._instantiationService.createInstance(UC),this._instantiationService.setService(va,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(Bw),this._instantiationService.setService(Zp,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(yf)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(s=>this.refresh(s?.start??0,s?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(s=>this._reportWindowsOptions(s))),this._register(this._inputHandler.onColor(s=>this._handleColorEvent(s))),this._register(Wt.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Wt.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Wt.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Wt.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(s=>this._afterResize(s.cols,s.rows))),this._register(ot(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.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(t){if(this._themeService)for(let s of t){let l,a="";switch(s.index){case 256:l="foreground",a="10";break;case 257:l="background",a="11";break;case 258:l="cursor",a="12";break;default:l="ansi",a="4;"+s.index}switch(s.type){case 0:let u=nt.toColorRGB(l==="ansi"?this._themeService.colors.ansi[s.index]:this._themeService.colors[l]);this.coreService.triggerDataEvent(`${V.ESC}]${a};${MC(u)}${d0.ST}`);break;case 1:if(l==="ansi")this._themeService.modifyColors(h=>h.ansi[s.index]=Tt.toColor(...s.color));else{let h=l;this._themeService.modifyColors(f=>f[h]=Tt.toColor(...s.color))}break;case 2:this._themeService.restoreColor(s.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(t){t?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(gc,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(t){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(V.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(V.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let t=this.buffer.ybase+this.buffer.y,s=this.buffer.lines.get(t);if(!s)return;let l=Math.min(this.buffer.x,this.cols-1),a=this._renderService.dimensions.css.cell.height,u=s.getWidth(l),h=this._renderService.dimensions.css.cell.width*u,f=this.buffer.y*this._renderService.dimensions.css.cell.height,d=l*this._renderService.dimensions.css.cell.width;this.textarea.style.left=d+"px",this.textarea.style.top=f+"px",this.textarea.style.width=h+"px",this.textarea.style.height=a+"px",this.textarea.style.lineHeight=a+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Te(this.element,"copy",s=>{this.hasSelection()&&G1(s,this._selectionService)}));let t=s=>W1(s,this.textarea,this.coreService,this.optionsService);this._register(Te(this.textarea,"paste",t)),this._register(Te(this.element,"paste",t)),m0?this._register(Te(this.element,"mousedown",s=>{s.button===2&&Kv(s,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Te(this.element,"contextmenu",s=>{Kv(s,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),hd&&this._register(Te(this.element,"auxclick",s=>{s.button===1&&Yp(s,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Te(this.textarea,"keyup",t=>this._keyUp(t),!0)),this._register(Te(this.textarea,"keydown",t=>this._keyDown(t),!0)),this._register(Te(this.textarea,"keypress",t=>this._keyPress(t),!0)),this._register(Te(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Te(this.textarea,"compositionupdate",t=>this._compositionHelper.compositionupdate(t))),this._register(Te(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Te(this.textarea,"input",t=>this._inputEvent(t),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(t){if(!t)throw new Error("Terminal requires a parent element.");if(t.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=t.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"),t.appendChild(this.element);let s=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),s.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(Te(this.screenElement,"mousemove",u=>this.updateCursorStyle(u))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),s.appendChild(this.screenElement);let l=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",vf.get()),S0||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",()=>l.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(Ow,this.textarea,t.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Us,this._coreBrowserService),this._register(Te(this.textarea,"focus",u=>this._handleTextAreaFocus(u))),this._register(Te(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Yf,this._document,this._helperContainer),this._instantiationService.setService(vc,this._charSizeService),this._themeService=this._instantiationService.createInstance(Vf),this._instantiationService.setService(il,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(fc),this._instantiationService.setService(Fp,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Pf,this.rows,this.screenElement)),this._instantiationService.setService(js,this._renderService),this._register(this._renderService.onRenderedViewportChange(u=>this._onRender.fire(u))),this.onResize(u=>this._renderService.resize(u.cols,u.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(Uf,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Kf),this._instantiationService.setService(sd,this._mouseService);let a=this._linkifier.value=this._register(this._instantiationService.createInstance(Jf,this.screenElement));this.element.appendChild(s);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(zf,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(u=>{super.scrollLines(u,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(If,this.element,this.screenElement,a)),this._instantiationService.setService(ib,this._selectionService),this._register(this._selectionService.onRequestScrollLines(u=>this.scrollLines(u.amount,u.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(u=>this._renderService.handleSelectionChanged(u.start,u.end,u.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(u=>{this.textarea.value=u,this.textarea.focus(),this.textarea.select()})),this._register(Wt.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(Hf,this.screenElement)),this._register(Te(this.element,"mousedown",u=>this._selectionService.handleMouseDown(u))),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(gc,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",u=>this._handleScreenReaderModeOptionChange(u))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(hc,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",u=>{!this._overviewRulerRenderer&&u&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(hc,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(qf,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let t=this,s=this.element;function l(h){let f=t._mouseService.getMouseReportCoords(h,t.screenElement);if(!f)return!1;let d,m;switch(h.overrideType||h.type){case"mousemove":m=32,h.buttons===void 0?(d=3,h.button!==void 0&&(d=h.button<3?h.button:3)):d=h.buttons&1?0:h.buttons&4?1:h.buttons&2?2:3;break;case"mouseup":m=0,d=h.button<3?h.button:3;break;case"mousedown":m=1,d=h.button<3?h.button:3;break;case"wheel":if(t._customWheelEventHandler&&t._customWheelEventHandler(h)===!1)return!1;let g=h.deltaY;if(g===0||t.coreMouseService.consumeWheelEvent(h,t._renderService?.dimensions?.device?.cell?.height,t._coreBrowserService?.dpr)===0)return!1;m=g<0?0:1,d=4;break;default:return!1}return m===void 0||d===void 0||d>4?!1:t.coreMouseService.triggerMouseEvent({col:f.col,row:f.row,x:f.x,y:f.y,button:d,action:m,ctrl:h.ctrlKey,alt:h.altKey,shift:h.shiftKey})}let a={mouseup:null,wheel:null,mousedrag:null,mousemove:null},u={mouseup:h=>(l(h),h.buttons||(this._document.removeEventListener("mouseup",a.mouseup),a.mousedrag&&this._document.removeEventListener("mousemove",a.mousedrag)),this.cancel(h)),wheel:h=>(l(h),this.cancel(h,!0)),mousedrag:h=>{h.buttons&&l(h)},mousemove:h=>{h.buttons||l(h)}};this._register(this.coreMouseService.onProtocolChange(h=>{h?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(h)),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()),h&8?a.mousemove||(s.addEventListener("mousemove",u.mousemove),a.mousemove=u.mousemove):(s.removeEventListener("mousemove",a.mousemove),a.mousemove=null),h&16?a.wheel||(s.addEventListener("wheel",u.wheel,{passive:!1}),a.wheel=u.wheel):(s.removeEventListener("wheel",a.wheel),a.wheel=null),h&2?a.mouseup||(a.mouseup=u.mouseup):(this._document.removeEventListener("mouseup",a.mouseup),a.mouseup=null),h&4?a.mousedrag||(a.mousedrag=u.mousedrag):(this._document.removeEventListener("mousemove",a.mousedrag),a.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Te(s,"mousedown",h=>{if(h.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(h)))return l(h),a.mouseup&&this._document.addEventListener("mouseup",a.mouseup),a.mousedrag&&this._document.addEventListener("mousemove",a.mousedrag),this.cancel(h)})),this._register(Te(s,"wheel",h=>{if(!a.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(h)===!1)return!1;if(!this.buffer.hasScrollback){if(h.deltaY===0)return!1;if(t.coreMouseService.consumeWheelEvent(h,t._renderService?.dimensions?.device?.cell?.height,t._coreBrowserService?.dpr)===0)return this.cancel(h,!0);let f=V.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(h.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(f,!0),this.cancel(h,!0)}}},{passive:!1}))}refresh(t,s){this._renderService?.refreshRows(t,s)}updateCursorStyle(t){this._selectionService?.shouldColumnSelect(t)?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(t,s){this._viewport?this._viewport.scrollLines(t):super.scrollLines(t,s),this.refresh(0,this.rows-1)}scrollPages(t){this.scrollLines(t*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(t){t&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(t){let s=t-this._bufferService.buffer.ydisp;s!==0&&this.scrollLines(s)}paste(t){qp(t,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(t){this._customKeyEventHandler=t}attachCustomWheelEventHandler(t){this._customWheelEventHandler=t}registerLinkProvider(t){return this._linkProviderService.registerLinkProvider(t)}registerCharacterJoiner(t){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let s=this._characterJoinerService.register(t);return this.refresh(0,this.rows-1),s}deregisterCharacterJoiner(t){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(t)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(t){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+t)}registerDecoration(t){return this._decorationService.registerDecoration(t)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(t,s,l){this._selectionService.setSelection(t,s,l)}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(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(t,s){this._selectionService?.selectLines(t,s)}_keyDown(t){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(t)===!1)return!1;let s=this.browser.isMac&&this.options.macOptionIsMeta&&t.altKey;if(!s&&!this._compositionHelper.keydown(t))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!s&&(t.key==="Dead"||t.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let l=zC(t,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(t),l.type===3||l.type===2){let a=this.rows-1;return this.scrollLines(l.type===2?-a:a),this.cancel(t,!0)}if(l.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,t)||(l.cancel&&this.cancel(t,!0),!l.key)||t.key&&!t.ctrlKey&&!t.altKey&&!t.metaKey&&t.key.length===1&&t.key.charCodeAt(0)>=65&&t.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((l.key===V.ETX||l.key===V.CR)&&(this.textarea.value=""),this._onKey.fire({key:l.key,domEvent:t}),this._showCursor(),this.coreService.triggerDataEvent(l.key,!0),!this.optionsService.rawOptions.screenReaderMode||t.altKey||t.ctrlKey)return this.cancel(t,!0);this._keyDownHandled=!0}_isThirdLevelShift(t,s){let l=t.isMac&&!this.options.macOptionIsMeta&&s.altKey&&!s.ctrlKey&&!s.metaKey||t.isWindows&&s.altKey&&s.ctrlKey&&!s.metaKey||t.isWindows&&s.getModifierState("AltGraph");return s.type==="keypress"?l:l&&(!s.keyCode||s.keyCode>47)}_keyUp(t){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(t)===!1)&&(IC(t)||this.focus(),this.updateCursorStyle(t),this._keyPressHandled=!1)}_keyPress(t){let s;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(t)===!1)return!1;if(this.cancel(t),t.charCode)s=t.charCode;else if(t.which===null||t.which===void 0)s=t.keyCode;else if(t.which!==0&&t.charCode!==0)s=t.which;else return!1;return!s||(t.altKey||t.ctrlKey||t.metaKey)&&!this._isThirdLevelShift(this.browser,t)?!1:(s=String.fromCharCode(s),this._onKey.fire({key:s,domEvent:t}),this._showCursor(),this.coreService.triggerDataEvent(s,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(t){if(t.data&&t.inputType==="insertText"&&(!t.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let s=t.data;return this.coreService.triggerDataEvent(s,!0),this.cancel(t),!0}return!1}resize(t,s){if(t===this.cols&&s===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(t,s)}_afterResize(t,s){this._charSizeService?.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 t=1;t<this.rows;t++)this.buffer.lines.push(this.buffer.getBlankLine(xt));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let t=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=t,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(V.ESC+"[I"):this.coreService.triggerDataEvent(V.ESC+"[O")}_reportWindowsOptions(t){if(this._renderService)switch(t){case 0:let s=this._renderService.dimensions.css.canvas.width.toFixed(0),l=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${V.ESC}[4;${l};${s}t`);break;case 1:let a=this._renderService.dimensions.css.cell.width.toFixed(0),u=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${V.ESC}[6;${u};${a}t`);break}}cancel(t,s){if(!(!this.options.cancelEvents&&!s))return t.preventDefault(),t.stopPropagation(),!1}};function IC(t){return t.keyCode===16||t.keyCode===17||t.keyCode===18}var VC=class{constructor(){this._addons=[]}dispose(){for(let t=this._addons.length-1;t>=0;t--)this._addons[t].instance.dispose()}loadAddon(t,s){let l={instance:s,dispose:s.dispose,isDisposed:!1};this._addons.push(l),s.dispose=()=>this._wrappedAddonDispose(l),s.activate(t)}_wrappedAddonDispose(t){if(t.isDisposed)return;let s=-1;for(let l=0;l<this._addons.length;l++)if(this._addons[l]===t){s=l;break}if(s===-1)throw new Error("Could not dispose an addon that has not been loaded");t.isDisposed=!0,t.dispose.apply(t.instance),this._addons.splice(s,1)}},XC=class{constructor(t){this._line=t}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(t,s){if(!(t<0||t>=this._line.length))return s?(this._line.loadCell(t,s),s):this._line.loadCell(t,new Ki)}translateToString(t,s,l){return this._line.translateToString(t,s,l)}},kp=class{constructor(t,s){this._buffer=t,this.type=s}init(t){return this._buffer=t,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(t){let s=this._buffer.lines.get(t);if(s)return new XC(s)}getNullCell(){return new Ki}},GC=class extends ke{constructor(t){super(),this._core=t,this._onBufferChange=this._register(new ne),this.onBufferChange=this._onBufferChange.event,this._normal=new kp(this._core.buffers.normal,"normal"),this._alternate=new kp(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)}},WC=class{constructor(t){this._core=t}registerCsiHandler(t,s){return this._core.registerCsiHandler(t,l=>s(l.toArray()))}addCsiHandler(t,s){return this.registerCsiHandler(t,s)}registerDcsHandler(t,s){return this._core.registerDcsHandler(t,(l,a)=>s(l,a.toArray()))}addDcsHandler(t,s){return this.registerDcsHandler(t,s)}registerEscHandler(t,s){return this._core.registerEscHandler(t,s)}addEscHandler(t,s){return this.registerEscHandler(t,s)}registerOscHandler(t,s){return this._core.registerOscHandler(t,s)}addOscHandler(t,s){return this.registerOscHandler(t,s)}},FC=class{constructor(t){this._core=t}register(t){this._core.unicodeService.register(t)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(t){this._core.unicodeService.activeVersion=t}},ZC=["cols","rows"],_s=0,QC=class extends ke{constructor(t){super(),this._core=this._register(new PC(t)),this._addonManager=this._register(new VC),this._publicOptions={...this._core.options};let s=a=>this._core.options[a],l=(a,u)=>{this._checkReadonlyOptions(a),this._core.options[a]=u};for(let a in this._core.options){let u={get:s.bind(this,a),set:l.bind(this,a)};Object.defineProperty(this._publicOptions,a,u)}}_checkReadonlyOptions(t){if(ZC.includes(t))throw new Error(`Option "${t}" 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 WC(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new FC(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 GC(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let t=this._core.coreService.decPrivateModes,s="none";switch(this._core.coreMouseService.activeProtocol){case"X10":s="x10";break;case"VT200":s="vt200";break;case"DRAG":s="drag";break;case"ANY":s="any";break}return{applicationCursorKeysMode:t.applicationCursorKeys,applicationKeypadMode:t.applicationKeypad,bracketedPasteMode:t.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:s,originMode:t.origin,reverseWraparoundMode:t.reverseWraparound,sendFocusMode:t.sendFocus,synchronizedOutputMode:t.synchronizedOutput,wraparoundMode:t.wraparound}}get options(){return this._publicOptions}set options(t){for(let s in t)this._publicOptions[s]=t[s]}blur(){this._core.blur()}focus(){this._core.focus()}input(t,s=!0){this._core.input(t,s)}resize(t,s){this._verifyIntegers(t,s),this._core.resize(t,s)}open(t){this._core.open(t)}attachCustomKeyEventHandler(t){this._core.attachCustomKeyEventHandler(t)}attachCustomWheelEventHandler(t){this._core.attachCustomWheelEventHandler(t)}registerLinkProvider(t){return this._core.registerLinkProvider(t)}registerCharacterJoiner(t){return this._checkProposedApi(),this._core.registerCharacterJoiner(t)}deregisterCharacterJoiner(t){this._checkProposedApi(),this._core.deregisterCharacterJoiner(t)}registerMarker(t=0){return this._verifyIntegers(t),this._core.registerMarker(t)}registerDecoration(t){return this._checkProposedApi(),this._verifyPositiveIntegers(t.x??0,t.width??0,t.height??0),this._core.registerDecoration(t)}hasSelection(){return this._core.hasSelection()}select(t,s,l){this._verifyIntegers(t,s,l),this._core.select(t,s,l)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(t,s){this._verifyIntegers(t,s),this._core.selectLines(t,s)}dispose(){super.dispose()}scrollLines(t){this._verifyIntegers(t),this._core.scrollLines(t)}scrollPages(t){this._verifyIntegers(t),this._core.scrollPages(t)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(t){this._verifyIntegers(t),this._core.scrollToLine(t)}clear(){this._core.clear()}write(t,s){this._core.write(t,s)}writeln(t,s){this._core.write(t),this._core.write(`\r
27
+ `,s)}paste(t){this._core.paste(t)}refresh(t,s){this._verifyIntegers(t,s),this._core.refresh(t,s)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(t){this._addonManager.loadAddon(this,t)}static get strings(){return{get promptLabel(){return vf.get()},set promptLabel(t){vf.set(t)},get tooMuchOutput(){return pf.get()},set tooMuchOutput(t){pf.set(t)}}}_verifyIntegers(...t){for(_s of t)if(_s===1/0||isNaN(_s)||_s%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...t){for(_s of t)if(_s&&(_s===1/0||isNaN(_s)||_s%1!==0||_s<0))throw new Error("This API only accepts positive integers")}};var $C=2,JC=1,e2=class{activate(t){this._terminal=t}dispose(){}fit(){let t=this.proposeDimensions();if(!t||!this._terminal||isNaN(t.cols)||isNaN(t.rows))return;let s=this._terminal._core;(this._terminal.rows!==t.rows||this._terminal.cols!==t.cols)&&(s._renderService.clear(),this._terminal.resize(t.cols,t.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let t=this._terminal._core._renderService.dimensions;if(t.css.cell.width===0||t.css.cell.height===0)return;let s=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,l=window.getComputedStyle(this._terminal.element.parentElement),a=parseInt(l.getPropertyValue("height")),u=Math.max(0,parseInt(l.getPropertyValue("width"))),h=window.getComputedStyle(this._terminal.element),f={top:parseInt(h.getPropertyValue("padding-top")),bottom:parseInt(h.getPropertyValue("padding-bottom")),right:parseInt(h.getPropertyValue("padding-right")),left:parseInt(h.getPropertyValue("padding-left"))},d=f.top+f.bottom,m=f.right+f.left,g=a-d,S=u-m-s;return{cols:Math.max($C,Math.floor(S/t.css.cell.width)),rows:Math.max(JC,Math.floor(g/t.css.cell.height))}}};const t2=/\.(?:png|jpe?g|webp|gif|bmp|svg|avif)$/i,Np=/\.[a-z0-9]{1,12}$/i;function R0(t){return t2.test(t.split(/[?#]/,1)[0])}function i2(t){return/\.(?:txt|md|mdx|markdown|log|json|jsonl|ya?ml|toml|ini|conf|cfg|csv|tsv|tsx?|jsx?|mjs|cjs|html?|css|scss|less|py|sh|bash|zsh|ps1|sql|xml|rs|go|java|kt|c|h|cpp|hpp|cs|rb|php|vue|svelte)$/i.test(t)}function s2(t){const s=[],l=new Set,a=/(?:^|[\s([::])((?:file:\/\/)?\/(?:[^\s<>|`]+)|(?:~\/|\.\.?\/)[^\s<>|`]+|(?:[\w\u3400-\u9fff.-]+\/)[^\s<>|`]+)/gu;for(const u of t.matchAll(a)){let h=u[1],f=(u.index??0)+u[0].lastIndexOf(h);(h[0]==='"'||h[0]==="'")&&h[0]&&(h=h.slice(1),f++);let m=f+h.length;const g=/[),.;:,。;:!?!?\]}'"]+$/u.exec(h)?.[0]??"";if(h=h.slice(0,h.length-g.length),m-=g.length,h.startsWith("file://")){h=h.slice(7);try{h=decodeURIComponent(h)}catch{}f+=7}!h||!Np.test(h)||l.has(`${f}:${m}`)||(l.add(`${f}:${m}`),s.push({path:h,start:f,end:m}))}for(const u of t.matchAll(/(["'])(\/?(?:\.{1,2}\/)?[^\r\n]+?)\1/gu)){const h=u[2];if(!Np.test(h)||!h.includes("/")&&!h.startsWith("."))continue;const f=(u.index??0)+1,d=f+h.length;for(let m=s.length-1;m>=0;m--)s[m].start>=f&&s[m].end<=d&&s.splice(m,1);s.push({path:h,start:f,end:d})}return s.sort((u,h)=>u.start-h.start)}function r2(t){return/^[a-zA-Z0-9_./:-]+$/.test(t)?t:`'${t.replaceAll("'","'\\''")}'`}function n2(t,s,l){const a=t.buffer.active;let u="";const h=[];for(let f=s;f<=l;f++){const d=a.getLine(f);if(d)for(let m=0;m<d.length;m++){const g=d.getCell(m);if(!g||g.getWidth()===0)continue;const S=g.getChars()||" ";for(let v=0;v<S.length;v++)h.push({x:m+1,y:f+1});u+=S}}return{text:u,positions:h}}function l2(t,s){return{provideLinks(l,a){const u=t.buffer.active;if(!u.getLine(l-1)){a([]);return}let h=l-1,f=h;for(;h>0&&u.getLine(h)?.isWrapped;)h--;for(;u.getLine(f+1)?.isWrapped;)f++;const{text:d,positions:m}=n2(t,h,f),g=[];for(const S of s2(d)){const v=m[S.start],w=m[S.end-1];if(!v||!w)continue;const O=u.getLine(w.y-1)?.getCell(w.x-1),T={x:w.x+Math.max(1,O?.getWidth()??1)-1,y:w.y},k=s.base(v.y-1);g.push({text:S.path,range:{start:v,end:T},activate:()=>s.activate(S.path,k),hover:j=>{R0(S.path)&&s.hover(S.path,k,{x:j.clientX,y:j.clientY})},leave:s.leave})}a(g)}}}function O0(t,s){const l={up:"A",down:"B",left:"D",right:"C"}[t];return`\x1B${s?"O":"["}${l}`}const a2=U.forwardRef(function({value:s,onChange:l,placeholder:a,...u},h){const f=U.useRef(null);return U.useImperativeHandle(h,()=>f.current),U.useLayoutEffect(()=>{const d=f.current;if(!(d.innerText===s&&(s||!d.firstChild))&&(d.textContent=s,document.activeElement===d)){const m=document.createRange();m.selectNodeContents(d),m.collapse(!1);const g=window.getSelection();g?.removeAllRanges(),g?.addRange(m)}},[s]),C.jsx("div",{...u,ref:f,className:"draft-input",role:"textbox","aria-multiline":"true","aria-autocomplete":"none","aria-placeholder":a,"data-placeholder":a,contentEditable:"plaintext-only",suppressContentEditableWarning:!0,enterKeyHint:"send",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,onInput:d=>l(d.currentTarget.textContent?d.currentTarget.innerText:"")})});function o2({preview:t,onClose:s,onCopy:l,onDownload:a}){const u=U.useRef(null);U.useEffect(()=>{const S=u.current;return S.showModal(),()=>S.close()},[]);const{file:h,loading:f,error:d,url:m,text:g}=t;return C.jsxs("dialog",{ref:u,className:"file-preview-dialog","aria-labelledby":"file-preview-title",onCancel:S=>{S.preventDefault(),s()},onClick:S=>{if(S.target===u.current){const v=u.current.getBoundingClientRect();(S.clientX<v.left||S.clientX>v.right||S.clientY<v.top||S.clientY>v.bottom)&&s()}},children:[C.jsxs("header",{children:[C.jsx("h2",{id:"file-preview-title",title:h.path,children:h.name}),C.jsx("button",{autoFocus:!0,"aria-label":"关闭文件预览",onClick:s,children:"×"})]}),C.jsx("p",{className:"file-path",children:h.path}),C.jsxs("div",{className:"file-preview-content",children:[f&&C.jsx("p",{role:"status",children:"正在加载预览…"}),d&&C.jsx("p",{className:"error",role:"alert",children:d}),!f&&!d&&g!==void 0&&C.jsx("pre",{children:g}),!f&&!d&&m&&C.jsx("img",{src:m,alt:h.name}),!f&&!d&&g===void 0&&!m&&C.jsx("p",{children:"此文件暂不支持直接预览,可下载查看。"})]}),C.jsxs("footer",{children:[C.jsxs("span",{children:[(h.size/1024).toFixed(1)," KB"]}),C.jsx("button",{onClick:l,children:"复制路径"}),C.jsx("button",{className:"primary",disabled:f,onClick:a,children:"下载文件"})]})]})}function c2(t,s){const l=t.element,a=l.ownerDocument,u=a.defaultView,h=l.style.touchAction,f=()=>{l.style.touchAction=s.copyMode()?"pinch-zoom":"pan-x pinch-zoom"};f();let d,m=!1,g=!1,S="";const v=new Set,w=a.createElement("button"),O=a.createElement("button");for(const[B,_e,se]of[[w,"start","调整选区起点"],[O,"end","调整选区终点"]])B.type="button",B.className="terminal-selection-handle",B.dataset.edge=_e,B.setAttribute("aria-label",se),B.hidden=!0,l.append(B);const T=a.createElement("div");T.className="terminal-touch-actions",T.setAttribute("role","toolbar"),T.setAttribute("aria-label","触屏选区操作"),T.hidden=!0;const k=a.createElement("button"),j=a.createElement("button");k.type=j.type="button",k.textContent="复制",j.textContent="取消",k.addEventListener("click",()=>{const B=t.getSelection();B&&s.copyText(B)}),j.addEventListener("click",()=>{oe(),s.onCancelCopy?.()}),T.append(k,j),l.append(T);const F=()=>l.querySelector(".xterm-screen"),ve=()=>{const B=F().getBoundingClientRect();return{rect:B,width:B.width/t.cols,height:B.height/t.rows}},he=()=>{w.hidden=O.hidden=T.hidden=!0},te=(B,_e,se,b)=>{g=!0;try{F().dispatchEvent(new MouseEvent(B,{bubbles:!0,cancelable:!0,detail:1,button:0,buttons:b,clientX:_e,clientY:se}))}finally{g=!1}},$=()=>{const B=d;d=void 0,B?.mode==="native"&&te("mouseup",B.lastX,B.lastY,0),B&&l.hasPointerCapture(B.id)&&l.releasePointerCapture(B.id)},oe=()=>{$(),(m||s.copyMode())&&(m=!1,t.clearSelection()),he()},ce=(B,_e)=>{const{rect:se,width:b,height:H}=ve(),G=t.buffer.active;let Q=Math.max(0,Math.min(t.cols-1,Math.floor((B-se.left)/b)));const ye=Math.max(0,Math.min(G.length-1,G.viewportY+Math.max(0,Math.min(t.rows-1,Math.floor((_e-se.top)/H))))),me=G.getLine(ye);for(;Q>0&&me?.getCell(Q)?.getWidth()===0;)Q--;return{row:ye,col:Q,start:ye*t.cols+Q,end:ye*t.cols+Q+Math.max(1,me?.getCell(Q)?.getWidth()||1)}},ge=(B,_e)=>{const se=Math.max(0,Math.min(B,_e)),b=Math.min(t.buffer.active.length*t.cols,Math.max(B,_e));m=!0,t.select(se%t.cols,Math.floor(se/t.cols),Math.max(1,b-se)),qe()},je=()=>{if(!d||d.mode!=="pending")return;const B=ce(d.x,d.y),_e=t.buffer.active.getLine(B.row);let se=B.col,b=B.end-B.row*t.cols;const H=G=>/[\p{L}\p{N}_]/u.test(_e?.getCell(G)?.getChars()||"");if(H(B.col)){for(;se>0&&(_e?.getCell(se-1)?.getWidth()===0||H(se-1));)se--;for(;b<t.cols&&(_e?.getCell(b)?.getWidth()===0||H(b));)b++}d.mode="select",d.anchorStart=B.row*t.cols+se,d.anchorEnd=B.row*t.cols+b,ge(d.anchorStart,d.anchorEnd)},qe=()=>{const B=t.getSelectionPosition(),_e=s.copyMode();if(!m&&!_e||!B||!t.hasSelection()){m=!1,he();return}m=!0;const{rect:se,width:b,height:H}=ve(),G=l.getBoundingClientRect(),Q=t.buffer.active.viewportY;for(const[J,$e]of[[w,B.start],[O,B.end]]){const $t=$e.y-Q;J.hidden=$t<0||$t>=t.rows,J.style.left=`${Math.max(0,se.left-G.left+$e.x*b-20)}px`,J.style.top=`${se.top-G.top+Math.min(se.height-44,($t+1)*H)}px`}T.hidden=!1;const ye=l.parentElement.getBoundingClientRect(),me=Math.max(se.left,ye.left),Ee=Math.min(se.right,ye.right,u.innerWidth);T.style.left=`${Math.max(me,Math.min(Ee-T.offsetWidth,se.left+B.start.x*b))-G.left}px`;const le=se.top+(B.start.y-Q)*H-T.offsetHeight-8,X=le>=se.top?le:se.top+(B.end.y-Q+1)*H+44;T.style.top=`${Math.max(se.top,Math.min(se.bottom-T.offsetHeight,X))-G.top}px`},we=B=>{if(B.target.closest(".terminal-touch-actions"))return;S=B.pointerType;const _e=B.target.closest(".terminal-selection-handle")?.dataset.edge;if(B.pointerType!=="touch"&&!_e){oe();return}if(B.pointerType==="touch"&&v.add(B.pointerId),v.size>1){oe();return}$(),B.preventDefault(),B.stopImmediatePropagation(),d={id:B.pointerId,x:B.clientX,y:B.clientY,lastX:B.clientX,lastY:B.clientY,remainder:0,startedAt:u.performance.now(),mode:"pending",offsetX:0,offsetY:0},l.setPointerCapture(B.pointerId);const se=t.getSelectionPosition();if(_e&&se){const{rect:H,width:G,height:Q}=ve(),ye=_e==="start"?se.start:se.end;d.mode="select",d.edge=_e,d.anchorStart=se.start.y*t.cols+se.start.x,d.anchorEnd=se.end.y*t.cols+se.end.x,d.offsetX=B.clientX-(H.left+ye.x*G+(_e==="start"?.1:-.1)),d.offsetY=B.clientY-(H.top+(ye.y-t.buffer.active.viewportY+.5)*Q);return}const b=B.target.closest(".scrollbar.vertical");!s.copyMode()&&b&&t.buffer.active.type==="normal"&&t.buffer.active.baseY>0?(d.mode="bar",d.bar={viewport:t.buffer.active.viewportY,travel:Math.max(1,b.clientHeight-(b.querySelector(".slider")?.offsetHeight||0)),lines:t.buffer.active.baseY}):s.copyMode()&&s.selectionMode?.()==="native"?(d.mode="native",te("mousedown",B.clientX,B.clientY,1)):s.copyMode()&&je()},ee=B=>{if(!d){S=B.pointerType;return}if(B.pointerId!==d.id)return;if(d.mode==="native"){d.lastX=B.clientX,d.lastY=B.clientY,B.preventDefault(),B.stopImmediatePropagation(),te("mousemove",B.clientX,B.clientY,1);return}const _e=B.clientX-d.x,se=B.clientY-d.y;if(d.mode==="pending"){if(Math.max(Math.abs(_e),Math.abs(se))<7)return;m&&(m=!1,t.clearSelection(),he()),d.mode=Math.abs(_e)>Math.abs(se)?"scroll-x":"scroll-y"}if(d.mode==="scroll-x")return;if(B.preventDefault(),B.stopImmediatePropagation(),d.mode==="select"){const G=ce(B.clientX-d.offsetX,B.clientY-d.offsetY);d.edge==="start"?ge(G.start,d.anchorEnd):d.edge==="end"?ge(d.anchorStart,G.end):ge(Math.min(d.anchorStart,G.start),Math.max(d.anchorEnd,G.end));return}if(d.mode==="bar"){const G=d.bar;t.scrollToLine(Math.max(0,Math.min(G.lines,Math.round(G.viewport+se*G.lines/G.travel))));return}const{height:b}=ve();d.remainder+=(d.lastY-B.clientY)/b,d.lastY=B.clientY;const H=Math.trunc(d.remainder);if(d.remainder-=H,!!H)if(t.buffer.active.type==="normal"&&t.buffer.active.baseY>0)t.scrollLines(H);else if(t.modes.mouseTrackingMode!=="none")for(let G=0;G<Math.min(40,Math.abs(H));G++)F().dispatchEvent(new WheelEvent("wheel",{bubbles:!0,cancelable:!0,deltaMode:1,deltaY:Math.sign(H),clientX:B.clientX,clientY:B.clientY}));else t.buffer.active.type==="alternate"&&s.sendScrollInput(O0(H<0?"up":"down",t.modes.applicationCursorKeysMode).repeat(Math.min(40,Math.abs(H))))},K=B=>{if(v.delete(B.pointerId),!d||B.pointerId!==d.id)return;const _e=d.mode==="pending"&&u.performance.now()-d.startedAt<450;if(d.mode==="native"&&(d.lastX=B.clientX,d.lastY=B.clientY),$(),B.preventDefault(),B.stopImmediatePropagation(),!!_e){if(m){oe();return}te("mousedown",B.clientX,B.clientY,1),te("mouseup",B.clientX,B.clientY,0)}},re=B=>{v.delete(B.pointerId),d?.id===B.pointerId&&$()},Z=B=>{if(g||B.type==="click"&&B.target.closest(".terminal-touch-actions"))return;(B.sourceCapabilities?.firesTouchEvents||S==="touch"||B.target.closest(".terminal-selection-handle,.terminal-touch-actions"))&&(B.preventDefault(),B.stopImmediatePropagation())},z=B=>{if(!B.target.closest(".terminal-touch-actions")){if(B.stopImmediatePropagation(),B.touches.length>1){oe();return}d&&!["pending","scroll-x"].includes(d.mode)&&B.preventDefault()}},P=B=>{S==="touch"&&(B.preventDefault(),B.stopImmediatePropagation())};l.addEventListener("pointerdown",we,!0),l.addEventListener("pointermove",ee,!0),l.addEventListener("pointerup",K,!0),l.addEventListener("pointercancel",re,!0),l.addEventListener("lostpointercapture",re,!0);for(const B of["mousedown","mousemove","mouseup","click"])l.addEventListener(B,Z,!0);for(const B of["touchstart","touchmove","touchend"])l.addEventListener(B,z,{capture:!0,passive:!1});l.addEventListener("contextmenu",P,!0),u.addEventListener("blur",$);const E=t.onSelectionChange(qe),I=t.onRender(qe),ie=t.onScroll(qe);return{cancel(){oe(),f()},dispose(){oe(),v.clear(),E.dispose(),I.dispose(),ie.dispose(),l.style.touchAction=h,l.removeEventListener("pointerdown",we,!0),l.removeEventListener("pointermove",ee,!0),l.removeEventListener("pointerup",K,!0),l.removeEventListener("pointercancel",re,!0),l.removeEventListener("lostpointercapture",re,!0);for(const B of["mousedown","mousemove","mouseup","click"])l.removeEventListener(B,Z,!0);for(const B of["touchstart","touchmove","touchend"])l.removeEventListener(B,z,!0);l.removeEventListener("contextmenu",P,!0),u.removeEventListener("blur",$),w.remove(),O.remove(),T.remove()}}}function u2(t){return t==="\x1B[I"||t==="\x1B[O"}function h2(t){return/^\x1b\[<\d+;\d+;\d+[Mm]$/.test(t)||/^\x1b\[M[\s\S]{3}$/.test(t)}function f2(t){const s=t.element;let l=0;const a=u=>{if(u.ctrlKey||u.shiftKey||!u.deltaY||t.buffer.active.type!=="normal"||t.buffer.active.baseY===0)return;const h=s.querySelector(".xterm-screen")?.offsetHeight||t.rows*17,f=u.deltaMode===1?u.deltaY:u.deltaMode===2?u.deltaY*t.rows:u.deltaY/(h/t.rows);l+=f;const d=Math.trunc(l);l-=d,u.preventDefault(),u.stopImmediatePropagation(),d&&t.scrollLines(d)};return s.addEventListener("wheel",a,{capture:!0,passive:!1}),{dispose(){s.removeEventListener("wheel",a,!0)}}}function d2(t,s=()=>!1){const l=t.element,a=/Mac|iPhone|iPad/.test(navigator.platform),u=t.options.macOptionClickForcesSelection;a&&(t.options.macOptionClickForcesSelection=!0);const h=d=>{d.target.closest(".scrollbar")||d.button!==0||d.ctrlKey||d.metaKey||d.altKey||d.shiftKey||t.modes.mouseTrackingMode==="none"||(s()||t.buffer.active.viewportY<t.buffer.active.baseY)&&Object.defineProperty(d,a?"altKey":"shiftKey",{value:!0})},f=d=>{!d.buttons&&(t.hasSelection()||t.buffer.active.viewportY<t.buffer.active.baseY)&&d.stopImmediatePropagation()};return l.addEventListener("mousedown",h,!0),l.addEventListener("mousemove",f,!0),{dispose(){l.removeEventListener("mousedown",h,!0),l.removeEventListener("mousemove",f,!0),a&&(t.options.macOptionClickForcesSelection=u)}}}function _2(t){const s=[...[{final:"c"},{prefix:">",final:"c"},{final:"n"},{prefix:"?",final:"n"},{intermediates:"$",final:"p"},{prefix:"?",intermediates:"$",final:"p"}].map(l=>t.parser.registerCsiHandler(l,()=>!0)),t.parser.registerCsiHandler({final:"t"},l=>[14,16,18,20,21].includes(Number(l[0]))),t.parser.registerDcsHandler({intermediates:"$",final:"q"},()=>!0),...[4,10,11,12].map(l=>t.parser.registerOscHandler(l,a=>a.split(";").includes("?")))];return{dispose:()=>s.forEach(l=>l.dispose())}}function g2({file:t}){const[s,l]=U.useState("");return U.useEffect(()=>{const a=URL.createObjectURL(t);return l(a),()=>URL.revokeObjectURL(a)},[t]),s?C.jsx("img",{className:"upload-thumbnail",src:s,alt:"上传图片缩略图"}):null}async function Lp(t){if(navigator.clipboard?.writeText)try{await navigator.clipboard.writeText(t);return}catch{}const s=document.createElement("textarea");s.value=t,s.readOnly=!0,s.setAttribute("aria-label","待复制文字"),s.style.cssText="position:fixed;top:0;left:0;width:1px;height:1px;opacity:0;font-size:16px",document.body.append(s);try{if(s.focus({preventScroll:!0}),s.select(),s.setSelectionRange(0,t.length),!document.execCommand("copy"))throw new Error("浏览器不允许复制,请使用 HTTPS 或允许剪贴板访问")}finally{s.remove()}}function m2(t,s){let l=!1;const a=t.parser.registerOscHandler(52,u=>{const h=u.indexOf(";");if(h<0||!/^[cps0-7]*$/.test(u.slice(0,h)))return!0;const f=u.slice(h+1);if(f==="?"||l||!s.canWrite())return!0;try{const d=Uint8Array.from(atob(f),g=>g.charCodeAt(0)),m=new TextDecoder("utf-8",{fatal:!0}).decode(d);s.writeText(m).catch(g=>{l||s.onError(g)})}catch(d){s.onError(d)}return!0});return{dispose(){l=!0,a.dispose()}}}function gf(t){return t instanceof HTMLElement?t.isContentEditable?!0:t instanceof HTMLTextAreaElement?!t.readOnly&&!t.disabled:t instanceof HTMLInputElement&&!t.readOnly&&!t.disabled&&!["button","submit","reset","checkbox","radio","file","hidden","range","color"].includes(t.type):!1}function v2(){U.useEffect(()=>{const t=s=>{const l=s.target instanceof Element?s.target:null;if(gf(l?.closest("input,textarea,[contenteditable]")??null))return;const a=document.activeElement,u=l?.closest("button"),h=l?.closest('[draggable="true"]')&&s instanceof PointerEvent&&s.pointerType!=="touch";if(s.type==="pointerdown"&&u&&!u.disabled&&gf(a)&&!h){s.preventDefault();return}u?.closest("[data-preserve-input-focus]")||a?.matches(".xterm-helper-textarea")&&l?.closest(".xterm")?.contains(a)||gf(a)&&a.blur()};return document.addEventListener("pointerdown",t,!0),document.addEventListener("click",t,!0),()=>{document.removeEventListener("pointerdown",t,!0),document.removeEventListener("click",t,!0)}},[])}function p2(t,s){const l=t.element,a=t.textarea,u={readOnly:a.readOnly,inputMode:a.inputMode,tabIndex:l.getAttribute("tabindex")};l.tabIndex=0;const h=()=>{a.readOnly=s()||u.readOnly,a.inputMode=s()?"none":u.inputMode,s()&&document.activeElement===a&&a.blur()};h();const f=g=>{s()&&(g.stopImmediatePropagation(),a.blur(),l.focus({preventScroll:!0}))},d=g=>{s()&&g.stopImmediatePropagation()};a.addEventListener("focus",f,!0),a.addEventListener("blur",d,!0);const m=g=>{if(g.target!==l||g.isComposing)return;const S=new KeyboardEvent(g.type,{bubbles:!0,cancelable:!0,key:g.key,code:g.code,location:g.location,ctrlKey:g.ctrlKey,altKey:g.altKey,shiftKey:g.shiftKey,metaKey:g.metaKey,repeat:g.repeat,keyCode:g.keyCode,charCode:g.charCode});a.dispatchEvent(S),S.defaultPrevented&&(g.preventDefault(),g.stopPropagation())};for(const g of["keydown","keypress","keyup"])l.addEventListener(g,m);return{update:h,dispose(){a.removeEventListener("focus",f,!0),a.removeEventListener("blur",d,!0);for(const g of["keydown","keypress","keyup"])l.removeEventListener(g,m);a.readOnly=u.readOnly,a.inputMode=u.inputMode,u.tabIndex===null?l.removeAttribute("tabindex"):l.setAttribute("tabindex",u.tabIndex)}}}const mf=new Set(["image/png","image/jpeg","image/webp","image/gif"]);function S2({session:t,token:s,active:l,fontFamily:a,interactionMode:u,maxUploadBytes:h,onNotice:f,onUnauthorized:d}){const m=t.id,g=U.useRef(l),S=U.useRef(a);U.useLayoutEffect(()=>{S.current=a},[a]);const v=U.useRef(!0);U.useLayoutEffect(()=>{g.current=l},[l]),U.useEffect(()=>(v.current=!0,()=>{v.current=!1}),[]);const[w,O]=U.useState("未连接"),[T,k]=U.useState([]),j=U.useRef([]),F=W=>{j.current=W(j.current),k(j.current)},ve=U.useRef(0),he=U.useRef(new Set),[te,$]=U.useState(null),[oe,ce]=U.useState(null),[ge,je]=U.useState(""),[qe,we]=U.useState(!1),ee=U.useRef(!1),K=U.useRef(0),[re,Z]=U.useState(!1),z=U.useRef(!1),P=U.useRef(!1),E=U.useRef(()=>{}),I=U.useRef(()=>{}),ie=U.useRef(()=>{}),B=U.useRef(!1),_e=U.useRef(()=>{}),se=U.useRef(u),b=U.useRef(null),H=U.useRef(null),G=U.useRef(null),Q=U.useRef(null);U.useLayoutEffect(()=>{se.current=u,B.current=!1,_e.current(),we(!1),ie.current(),Q.current?.clearSelection()},[u]),U.useLayoutEffect(()=>{B.current=qe,_e.current(),ie.current(),Q.current?.clearSelection()},[qe]);const ye=U.useRef(t.cwd),me=U.useRef(null),Ee=U.useRef(null),le=U.useRef(null),X=U.useRef(Promise.resolve()),J=U.useRef(0),$e=U.useRef(0),$t=U.useRef(null),vi=U.useCallback(W=>{Lp(W).then(()=>f(`已复制 ${Array.from(W).length} 个字符`)).catch(be=>f(`复制失败:${Ri(be)}`))},[f]);U.useEffect(()=>{ye.current=t.cwd},[t.cwd]);const tt=U.useCallback(()=>{J.current++,me.current!==null&&clearTimeout(me.current),me.current=null,Ee.current&&URL.revokeObjectURL(Ee.current),Ee.current=null,ce(null)},[]),Ve=U.useCallback(()=>{$e.current++,le.current&&URL.revokeObjectURL(le.current),le.current=null,$(null)},[]),Jt=U.useCallback((W,be)=>{W instanceof yr?d():f(`${be}:${Ri(W)}`)},[d,f]),$i=U.useCallback(async(W,be,Ce,Oe)=>{if(!W.startsWith("/")&&!W.startsWith("~/")&&!be){f("历史相对路径的工作目录无法确定,请使用绝对路径");return}const yt=m,lt=s,Pe=Ce==="hover"?J.current:++$e.current;if(v.current){Ce==="preview"&&(le.current&&URL.revokeObjectURL(le.current),le.current=null,$({file:{path:W,name:W.split("/").pop()||W,size:0,mime:"",isImage:R0(W)},url:null,loading:!0}));try{const Je=await br(lt,Zn(yt,"meta",W,be||void 0));if(!v.current||(Ce==="hover"?J.current:$e.current)!==Pe)return;if(Ce==="hover"){if(!Oe||!Je.mime.startsWith("image/"))return;const Se=await ef(lt,Zn(yt,"content",Je.path,void 0,"thumbnail"));if(!v.current||J.current!==Pe){URL.revokeObjectURL(Se);return}Ee.current&&URL.revokeObjectURL(Ee.current),Ee.current=Se,ce({file:Je,url:Se,...Oe})}else{const Se=i2(Je.path);if($({file:Je,url:null,loading:Je.isImage||Se}),Je.mime.startsWith("image/")){const ci=await ef(lt,Zn(yt,"content",Je.path));if(!v.current||$e.current!==Pe){URL.revokeObjectURL(ci);return}le.current=ci,$({file:Je,url:ci,loading:!1})}else if(Se){if(Je.size>1024*1024)throw new Error("文本超过 1 MB,请下载查看");const ci=await Hp(lt,Zn(yt,"content",Je.path));if(ci.size>1024*1024)throw new Error("文本超过 1 MB,请下载查看");const ln=await ci.text();if(!v.current||$e.current!==Pe)return;if(ln.includes("\0"))throw new Error("该文件含二进制内容,请下载查看");$({file:Je,url:null,text:ln,loading:!1})}}}catch(Je){if(!v.current)return;if(Je instanceof yr){d();return}Ce==="preview"&&v.current&&$e.current===Pe&&$(Se=>Se?{...Se,loading:!1,error:Ri(Je)}:null)}}},[m,s,d,f]),Pi=U.useCallback(async(W,be)=>{if(tt(),window.parent===window||new URLSearchParams(location.search).get("embed")!=="vscode"){await $i(W,be,"preview");return}if(!W.startsWith("/")&&!W.startsWith("~/")&&!be){f("历史相对路径的工作目录无法确定,请使用绝对路径");return}try{const Ce=await br(s,Zn(m,"meta",W,be||void 0));v.current&&g.current&&window.parent.postMessage({type:"web-terminal:open-file",path:Ce.path},"*")}catch(Ce){Jt(Ce,"打开文件失败")}},[m,s,$i,tt,Jt,f]),sn=async W=>{if(!(!m||!s))try{const be=await ef(s,Zn(m,"content",W.path,void 0,"download")),Ce=document.createElement("a");Ce.href=be,Ce.download=W.name,Ce.click(),window.setTimeout(()=>URL.revokeObjectURL(be),6e4)}catch(be){Jt(be,"下载失败")}};U.useEffect(()=>{if(!m||!s||!H.current){O("未连接");return}P.current=!1;let W=!1,be,Ce=0,Oe=null;const yt=new Map;let lt=Promise.resolve(),Pe,Je=!1;const Se=new QC({cursorBlink:!0,fontFamily:S.current,fontSize:window.matchMedia("(hover: none) and (pointer: coarse)").matches?12:14,theme:{background:"#101821",foreground:"#d8e3e8",cursor:"#7bdfcd",selectionBackground:"#356b71aa"},allowProposedApi:!0}),ci=_2(Se),ln=m2(Se,{canWrite:()=>!W&&Je&&g.current&&!document.hidden&&document.hasFocus(),writeText:Lp,onError:Ne=>f(`终端复制失败:${Ri(Ne)}`)}),Ft=new e2;Se.loadAddon(Ft),Se.open(H.current),Q.current=Se;const ya=p2(Se,()=>B.current);_e.current=ya.update;const ba=d2(Se,()=>se.current==="local"),wa=f2(Se);Se.attachCustomKeyEventHandler(Ne=>!((Ne.ctrlKey||Ne.metaKey)&&!Ne.altKey&&Ne.key.toLowerCase()==="v"||(Ne.ctrlKey||Ne.metaKey)&&Ne.key.toLowerCase()==="c"&&Se.hasSelection()));let Ji,rl="";const nl=()=>Ft.proposeDimensions(),Er=(Ne=!1)=>{if(W||!g.current||document.hidden||!H.current||H.current.clientWidth<2||H.current.clientHeight<2)return;const rt=nl();if(!rt||rt.rows<2)return;const ft=`${rt.cols}:${rt.rows}`;Oe?.readyState===WebSocket.OPEN&&P.current&&(Ne||ft!==rl)&&(Oe.send(JSON.stringify({type:Ne?"claim":"resize",...rt})),rl=ft)};E.current=()=>Er(!0),I.current=()=>{Se.refresh(0,Se.rows-1),Er()};const ll=()=>{Ji&&clearTimeout(Ji),Ji=window.setTimeout(()=>Er(),100)},qs=new ResizeObserver(ll);qs.observe(H.current),document.addEventListener("visibilitychange",ll);const ei=Se.onRender(()=>{if(!g.current)return;const Ne=H.current?.querySelector(".xterm-screen");Ne&&Se.element&&(Se.element.style.width=`${Ne.offsetWidth+15}px`,Se.element.style.height=`${Ne.offsetHeight}px`)}),es=Ne=>{if(W||!g.current)return;const rt=u2(Ne)||h2(Ne);Oe?.readyState===WebSocket.OPEN&&P.current?(rt||Er(!0),Oe.send(JSON.stringify({type:"input",data:Ne}))):rt||f("连接未就绪,输入未发送")},ti=Se.onData(es),Ca=c2(Se,{selectionMode:()=>se.current,copyMode:()=>B.current,onCancelCopy:()=>we(!1),sendScrollInput:Ne=>{!W&&g.current&&P.current&&Oe?.readyState===WebSocket.OPEN&&Oe.send(JSON.stringify({type:"input",data:Ne}))},copyText:vi});ie.current=Ca.cancel;const yc=l2(Se,{base:Ne=>yt.get(Ne)??"",activate:(Ne,rt)=>{Pi(Ne,rt)},hover:(Ne,rt,ft)=>{tt(),me.current=window.setTimeout(()=>{$i(Ne,rt,"hover",ft)},300)},leave:tt}),bc=Se.registerLinkProvider(yc),xr=()=>{W||(O(Ce?`重连中 · 第 ${Ce} 次`:"连接中"),P.current=!1,Oe=null,G.current=null,Se.write("",()=>{if(W)return;const Ne=Se.buffer.active;Pe=Ne.type==="normal"&&Ne.viewportY<Ne.baseY?Ne.viewportY:void 0,Se.reset(),yt.clear();const rt=new WebSocket(`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}/ws`);Oe=rt,G.current=Oe,Oe.onopen=()=>{if(W||Oe!==rt)return;const ft=g.current?nl()||{cols:Se.cols,rows:Se.rows}:{cols:Se.cols,rows:Se.rows};rl=`${ft.cols}:${ft.rows}`,rt.send(JSON.stringify({type:"auth",protocol:2,token:s,sessionId:m,...ft}))},Oe.onmessage=ft=>{if(W||Oe!==rt)return;let dt;try{dt=JSON.parse(ft.data)}catch{f("收到无效的终端消息");return}lt=lt.then(async()=>{if(W||Oe!==rt)return;const Ys=Vi=>new Promise(Ks=>Se.write(Vi,Ks));if(dt.type==="snapshot"){const Vi=Se.buffer.active,Ks=Pe??(Vi.type==="normal"&&Vi.viewportY<Vi.baseY?Vi.viewportY:void 0);Pe=void 0,Se.reset(),Se.resize(dt.cols,dt.rows),yt.clear(),await Ys(dt.data),Ks!==void 0&&Se.buffer.active.type==="normal"&&Se.scrollToLine(Ks)}else if(dt.type==="ready")Ce=0,P.current=!0,O("已连接"),ye.current=dt.session.cwd,Er();else if(dt.type==="output"){const Vi=Se.buffer.active.baseY+Se.buffer.active.cursorY,Ks=ye.current;Je=!0;try{await Ys(dt.data)}finally{Je=!1}if(W)return;const Ea=Se.buffer.active.baseY+Se.buffer.active.cursorY;for(let ts=Vi;ts<=Ea;ts++)yt.set(ts,Ks);for(const ts of yt.keys())ts<Se.buffer.active.baseY-2e3&&yt.delete(ts)}else dt.type==="exit"?(P.current=!1,O(`Shell 已退出 · ${dt.exitCode}`)):dt.type==="error"&&(dt.message.startsWith("会话已结束")?(P.current=!1,O("会话已结束")):f(dt.message))}).catch(()=>{W||f("终端画面恢复失败,请重新连接")})},Oe.onclose=ft=>{if(W||Oe!==rt)return;if(P.current=!1,ft.code===4406){O("需要刷新页面"),f("终端协议已更新,请刷新页面");return}if(ft.code===4401){d();return}if(ft.code===4404){O("会话已结束");return}Ce++;const dt=Math.min(3e4,700*2**Math.min(Ce,6));O(`已断开 · ${Math.ceil(dt/1e3)} 秒后重连`),be=window.setTimeout(xr,dt)},Oe.onerror=()=>{!W&&Oe===rt&&O("连接出错")}}))};return xr(),()=>{W=!0,be&&clearTimeout(be),qs.disconnect(),Ji&&clearTimeout(Ji),document.removeEventListener("visibilitychange",ll),P.current=!1,E.current=()=>{},I.current=()=>{},ci.dispose(),ln.dispose(),ya.dispose(),_e.current=()=>{},ba.dispose(),wa.dispose(),Ca.dispose(),ie.current=()=>{},ei.dispose(),ti.dispose(),bc.dispose(),Oe?.close(),G.current===Oe&&(G.current=null),Se.dispose(),Q.current===Se&&(Q.current=null),tt(),Ve()}},[m,s,$i,Pi,d,tt,Ve,Jt,O,f,vi]),U.useEffect(()=>{const W=Q.current;if(!W)return;W.options.fontFamily=a;let be=!1;return document.fonts.ready.then(()=>{!be&&g.current&&I.current()}),()=>{be=!0}},[a]),U.useEffect(()=>{if(!l||window.parent===window||new URLSearchParams(location.search).get("embed")!=="vscode")return;const W=be=>{if(be.source!==window.parent||!g.current)return;if(be.data?.type==="web-terminal:request-composer"){window.parent.postMessage({type:"web-terminal:composer-ready"},"*");return}if(be.data?.type!=="web-terminal:text-attachment")return;const Ce=be.data.attachment;typeof Ce?.id!="string"||typeof Ce?.text!="string"||typeof Ce?.name!="string"||(he.current.has(Ce.id)||(he.current.add(Ce.id),F(Oe=>[...Oe,{id:++ve.current,file:new File([Ce.text],Ce.name,{type:"text/plain"}),text:Ce.text,state:"待发送",failed:!1}]),b.current?.focus()),window.parent.postMessage({type:"web-terminal:attachment-received",id:Ce.id},"*"))};return window.addEventListener("message",W),window.parent.postMessage({type:"web-terminal:composer-ready"},"*"),()=>{window.removeEventListener("message",W),window.parent.postMessage({type:"web-terminal:composer-hidden"},"*")}},[l]);const Ss=W=>{const be=m,Ce=s;if(!v.current)return;if(!mf.has(W.type)){f("仅支持 PNG、JPEG、WebP、GIF 图片");return}if(W.size>h){f("图片超过上传大小限制");return}const Oe=++ve.current,yt=(lt,Pe=!1,Je)=>{v.current&&F(Se=>Se.map(ci=>ci.id===Oe?{...ci,state:lt,failed:Pe,path:Je}:ci))};F(lt=>[...lt,{id:Oe,file:W,state:"排队上传…",failed:!1}]),X.current=X.current.catch(()=>{}).then(async()=>{if(!v.current||!j.current.some(Pe=>Pe.id===Oe))return;yt("正在上传…");const lt=new FormData;lt.append("file",W);try{const Pe=await br(Ce,`/api/sessions/${encodeURIComponent(be)}/uploads`,{method:"POST",body:lt});if(!v.current)return;yt("已上传",!1,Pe.path)}catch(Pe){if(!v.current)return;Pe instanceof yr?d():yt(Ri(Pe),!0)}})},Ii=W=>g.current?G.current?.readyState!==WebSocket.OPEN||!P.current?(f("连接未就绪,输入未发送"),!1):(E.current(),G.current.send(JSON.stringify({type:"input",data:W})),!0):!1,rn=async(W=!1)=>{if(!g.current||z.current||!W&&(ee.current||Date.now()-K.current<80))return;const be=m,Ce=W?b.current?.innerText??ge:ge;if(!be||!Ce.trim()&&!j.current.length)return;const Oe=ve.current;z.current=!0,Z(!0);try{if(await X.current,!v.current||!g.current)return;const yt=j.current.filter(lt=>lt.id<=Oe);if(yt.some(lt=>lt.failed)){f("图片尚未上传成功,请重试或移除后发送");return}if(!P.current){f("连接未就绪,文字已保留");return}if(G.current?.readyState===WebSocket.OPEN){const lt=[Ce,...yt.map(Pe=>Pe.text??(Pe.path?r2(Pe.path):""))].filter(Boolean).join(`
28
+ `);if(!lt.trim())return;E.current(),G.current.send(JSON.stringify({type:"paste",text:lt,submit:!0})),je(Pe=>Pe===Ce?"":Pe),F(Pe=>Pe.filter(Je=>Je.id>Oe))}}finally{z.current=!1,v.current&&Z(!1)}},Cr=W=>{const be=[...W.clipboardData.items].filter(Ce=>Ce.kind==="file"&&mf.has(Ce.type)).flatMap(Ce=>{const Oe=Ce.getAsFile();return Oe?[Oe]:[]});be.length&&(W.preventDefault(),W.stopPropagation(),be.forEach(Ss))},nn=W=>{W.preventDefault(),[...W.dataTransfer.files].filter(be=>mf.has(be.type)).forEach(Ss)};return U.useEffect(()=>()=>{Ee.current&&URL.revokeObjectURL(Ee.current),le.current&&URL.revokeObjectURL(le.current)},[]),U.useEffect(()=>{l?I.current():(tt(),Q.current?.blur(),ee.current=!1,B.current=!1,_e.current(),we(!1),ie.current())},[l,tt]),C.jsxs("div",{className:"content session-pane",hidden:!l,"data-session-id":m,children:[C.jsxs("div",{className:"terminal-pane",children:[C.jsx("div",{className:"terminal-wrap",onPasteCapture:Cr,onDrop:nn,onDragOver:W=>W.preventDefault(),children:C.jsx("div",{ref:H,className:"terminal-host"})}),C.jsx("div",{className:"composer-dock",children:C.jsxs("div",{className:"composer-panel",onPasteCapture:Cr,onDrop:nn,onDragOver:W=>W.preventDefault(),children:[T.length>0&&C.jsxs("div",{className:"composer-attachments","aria-label":"待发送附件",children:[C.jsxs("span",{className:"attachment-count",title:`${T.length} 个附件`,children:[C.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7","aria-hidden":"true",children:C.jsx("path",{d:"m21 11.5-8.5 8.5a6 6 0 0 1-8.5-8.5l9-9a4 4 0 0 1 5.7 5.7l-9 9a2 2 0 0 1-2.9-2.9l8.5-8.5"})})," ",T.length]}),C.jsx("div",{className:"attachment-list",children:T.map(W=>C.jsxs("div",{className:`attachment-card ${W.failed?"error":""}`,children:[W.text!==void 0?C.jsx("pre",{className:"attachment-text",children:W.text}):C.jsx(g2,{file:W.file}),C.jsxs("div",{className:"attachment-caption",children:[C.jsxs("span",{title:W.file.name,children:[W.text!==void 0?"▤ ":"",W.file.name]}),C.jsx("button",{"aria-label":`移除 ${W.file.name}`,onClick:()=>F(be=>be.filter(Ce=>Ce.id!==W.id)),children:"×"})]}),C.jsxs("div",{className:"attachment-status",title:W.state,children:[W.state,W.failed&&C.jsx("button",{onClick:()=>{F(be=>be.filter(Ce=>Ce.id!==W.id)),Ss(W.file)},children:"重试"})]})]},W.id))}),C.jsx("button",{className:"attachment-clear",onClick:()=>F(()=>[]),children:"全部清除"})]}),C.jsx("div",{className:"draft-row",children:C.jsx(a2,{ref:b,style:{fontFamily:a},"aria-label":"待发送文字",onFocus:()=>E.current(),onCompositionStart:()=>{ee.current=!0},onCompositionEnd:()=>{ee.current=!1,K.current=Date.now()},value:ge,onChange:je,onKeyDown:W=>{W.key==="Enter"&&!W.shiftKey&&!ee.current&&!W.nativeEvent.isComposing&&W.nativeEvent.keyCode!==229&&Date.now()-K.current>=80&&(W.preventDefault(),W.stopPropagation(),W.repeat||rn())},placeholder:"输入命令或描述…"})}),C.jsxs("div",{className:"mobile-keys","data-preserve-input-focus":!0,role:"toolbar","aria-label":"触屏终端快捷键",children:[C.jsx("button",{disabled:w!=="已连接",onClick:()=>Ii(" "),children:"Tab"}),[["left","←","左方向键"],["up","↑","上方向键"],["down","↓","下方向键"],["right","→","右方向键"]].map(([W,be,Ce])=>C.jsx("button",{"aria-label":Ce,title:Ce,disabled:w!=="已连接",onClick:()=>Ii(O0(W,Q.current?.modes.applicationCursorKeysMode??!1)),children:be},W))]}),C.jsxs("div",{className:"composer-actions",children:[C.jsxs("div",{className:"composer-tools",role:"toolbar","aria-label":"终端操作",children:[C.jsx("button",{className:"attach-image",title:"添加图片,也可粘贴或拖入","aria-label":"添加图片",onClick:()=>$t.current?.click(),children:C.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:C.jsx("path",{d:"m21 11.5-8.5 8.5a6 6 0 0 1-8.5-8.5l9-9a4 4 0 0 1 5.7 5.7l-9 9a2 2 0 0 1-2.9-2.9l8.5-8.5"})})}),C.jsx("span",{className:"composer-divider"}),C.jsx("button",{"data-preserve-input-focus":!0,title:"发送 Esc",disabled:w!=="已连接",onClick:()=>Ii("\x1B"),children:"Esc"}),C.jsx("button",{"data-preserve-input-focus":!0,title:"中断当前程序(Ctrl+C)","aria-label":"中断当前程序",disabled:w!=="已连接",onClick:()=>Ii(""),children:"Ctrl C"}),C.jsx("button",{className:"copy-mode-toggle",title:qe?"退出复制模式,恢复手指滚屏":"进入复制模式,手指拖动选字","aria-label":"复制模式","aria-pressed":qe,onClick:()=>we(W=>!W),children:qe?"退出复制":"复制"})]}),C.jsx("span",{className:"composer-hint",children:"Enter 发送 · Shift+Enter 换行"}),C.jsxs("button",{className:"composer-send",title:w==="已连接"?"发送到当前会话":w,onClick:()=>{rn(!0)},disabled:!ge.trim()&&!T.length||re||w!=="已连接",children:[re?"等待上传…":w!=="已连接"?"未连接":"发送",C.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:C.jsx("path",{d:"M3 8h10M9 4l4 4-4 4"})})]})]})]})})]}),te&&C.jsx(o2,{preview:te,onClose:Ve,onCopy:()=>{navigator.clipboard.writeText(te.file.path).then(()=>f("路径已复制")).catch(W=>f(`复制失败:${Ri(W)}`))},onDownload:()=>{sn(te.file)}}),C.jsx("input",{ref:$t,className:"hidden",type:"file",accept:"image/png,image/jpeg,image/webp,image/gif",multiple:!0,onChange:W=>{const be=[...W.target.files||[]];W.target.value="",be.forEach(Ss)}}),oe?.url&&C.jsxs("div",{className:"hover-card",style:{left:Math.min(oe.x+16,window.innerWidth-240),top:Math.min(oe.y+16,window.innerHeight-220)},children:[C.jsx("img",{src:oe.url,alt:oe.file.name}),C.jsx("span",{children:oe.file.name})]})]})}function y2(){U.useEffect(()=>{const t=window.visualViewport;if(!t)return;const s=()=>{t.scale===1&&(document.documentElement.style.setProperty("--app-height",`${t.height}px`),document.documentElement.style.setProperty("--app-top",`${t.offsetTop}px`))};return s(),t.addEventListener("resize",s),t.addEventListener("scroll",s),()=>{t.removeEventListener("resize",s),t.removeEventListener("scroll",s),document.documentElement.style.removeProperty("--app-height"),document.documentElement.style.removeProperty("--app-top")}},[])}const fa={fontFamily:"",interactionMode:"native"},A0="web-terminal.settings",B0="web-terminal.fontFamily";function b2(){try{const t=localStorage.getItem(A0);if(!t)return{...fa,fontFamily:localStorage.getItem(B0)||""};const s=JSON.parse(t);return!s||typeof s!="object"||Array.isArray(s)?{...fa}:{fontFamily:typeof s.fontFamily=="string"?s.fontFamily:"",interactionMode:s.interactionMode==="local"?"local":"native"}}catch{return{...fa}}}function w2(t){localStorage.setItem(A0,JSON.stringify(t));try{localStorage.removeItem(B0)}catch{}}function C2({value:t,defaultFont:s,onSave:l,onClose:a}){const u=U.useRef(null),[h,f]=U.useState(t.fontFamily),[d,m]=U.useState(t.interactionMode),[g,S]=U.useState("");return U.useEffect(()=>{const v=u.current;return v.querySelector("[data-settings-cancel]").autofocus=!0,v.showModal(),()=>v.close()},[]),C.jsx("dialog",{ref:u,className:"session-close-dialog client-settings","aria-labelledby":"client-settings-title",onCancel:v=>{v.preventDefault(),a()},children:C.jsxs("form",{onSubmit:v=>{v.preventDefault();const w=h.trim();if(w&&!CSS.supports("font-family",w)){S("请输入有效的字体名称或字体列表");return}try{l({fontFamily:w,interactionMode:d})}catch{S("无法保存设置,请检查客户端存储权限")}},children:[C.jsx("h2",{id:"client-settings-title",children:"设置"}),C.jsxs("section",{className:"settings-section","aria-labelledby":"settings-font-title",children:[C.jsx("h3",{id:"settings-font-title",children:"字体"}),C.jsx("label",{htmlFor:"terminal-font",children:"终端字体"}),C.jsx("input",{id:"terminal-font",value:h,onChange:v=>{f(v.target.value),S("")},placeholder:s}),C.jsx("p",{children:"填写本机已安装的字体名称,多个字体用逗号分隔。留空使用默认字体。设置同时用于终端和待发送文字,并保存在当前客户端。"}),C.jsx("p",{children:"终端英文建议使用等宽字体,避免字间距异常。Windows 默认英文优先使用 Cascadia Code,未安装时使用 Consolas,中文使用微软雅黑。"}),C.jsx("div",{className:"font-preview",style:{fontFamily:h.trim()&&CSS.supports("font-family",h.trim())?h:s},children:"中文字体预览 AaBb 0123456789"})]}),C.jsxs("section",{className:"settings-section","aria-labelledby":"settings-interaction-title",children:[C.jsx("h3",{id:"settings-interaction-title",children:"选择与复制"}),C.jsx("label",{htmlFor:"interaction-mode",children:"交互模式"}),C.jsxs("select",{id:"interaction-mode",value:d,onChange:v=>m(v.target.value),children:[C.jsx("option",{value:"native",children:"CLI 原生"}),C.jsx("option",{value:"local",children:"本地选字"})]}),C.jsx("p",{children:"CLI 原生:点击和拖动交给程序,使用程序自己的选择与复制。"}),C.jsx("p",{children:"触屏平时滑动滚屏;点击底部“复制”进入选字模式,再次点击退出。"}),C.jsx("p",{children:"本地选字:鼠标拖选,触屏进入复制模式后拖动选字,再点复制。"})]}),g&&C.jsx("p",{className:"error",role:"alert",children:g}),C.jsxs("div",{className:"session-close-actions",children:[C.jsx("button",{type:"button",onClick:()=>{f(fa.fontFamily),m(fa.interactionMode)},children:"恢复默认"}),C.jsx("button",{type:"button","data-settings-cancel":!0,onClick:a,children:"取消"}),C.jsx("button",{type:"submit",className:"primary",children:"保存"})]})]})})}function E2(t){return/win/i.test(t)?'"Cascadia Code", Consolas, "Microsoft YaHei", "微软雅黑", monospace':'"Cascadia Code", "JetBrains Mono", Consolas, monospace'}function x2(t,s,l){const[a,u]=U.useState([]),[h,f]=U.useState(!1),[d,m]=U.useState(!1);return U.useEffect(()=>{if(!t){u([]),f(!1),m(!1);return}let g=!1,S=!1,v=0,w,O;br(t,"/api/sessions").then(k=>{g||S||(u(k),f(!0))}).catch(k=>{!g&&!S&&l(k,"加载会话失败")});const T=()=>{if(g)return;const k=new WebSocket(`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}/ws`);w=k,k.onopen=()=>{!g&&w===k&&k.send(JSON.stringify({type:"auth",protocol:2,token:t,scope:"sessions"}))},k.onmessage=j=>{if(g||w!==k)return;let F;try{F=JSON.parse(j.data)}catch{l(new Error("收到无效的会话状态"),"会话同步失败");return}F.type==="sessions"?(S=!0,v=0,u(F.sessions),f(!0),m(!0)):F.type==="error"&&l(new Error(F.message),"会话同步失败")},k.onclose=j=>{if(!(g||w!==k)){if(m(!1),j.code===4401){s();return}if(j.code===4404||j.code===4406){l(new Error("请更新并重启服务,再刷新页面"),"会话状态订阅不可用");return}O=window.setTimeout(T,Math.min(3e4,700*2**Math.min(++v,6)))}},k.onerror=()=>{!g&&w===k&&m(!1)}};return T(),()=>{g=!0,clearTimeout(O),w?.close()}},[t,s,l]),{sessions:a,setSessions:u,loaded:h,reachable:d}}const Jn="web-terminal.token";function T2(){y2(),v2();const[t,s]=U.useState(b2),[l,a]=U.useState(!1),u=E2(navigator.platform),h=t.fontFamily||u,[f,d]=U.useState(null),[m,g]=U.useState(!0),[S,v]=U.useState(""),[w,O]=U.useState(""),[T,k]=U.useState(null),[j,F]=U.useState(null),[ve,he]=U.useState([]),[te,$]=U.useState({id:0,text:""}),oe=U.useCallback(X=>$(J=>({id:J.id+1,text:X})),[]),ce=U.useCallback(()=>$(X=>({...X,text:""})),[]),[ge,je]=U.useState(!1),qe=A1(),[we,ee]=U.useState(!1),[K,re]=U.useState(null),[Z,z]=U.useState(!1),[P,E]=U.useState(""),[I,ie]=U.useState(null),B=U.useCallback(X=>{ie(null),he(J=>J.includes(X)?J:[...J,X]),F(X)},[]),_e=U.useCallback(()=>{localStorage.removeItem(Jn),d(null),F(null),he([]),re(null),E(""),ie(null)},[]),se=U.useCallback((X,J)=>{X instanceof yr?_e():oe(`${J}:${Ri(X)}`)},[_e,oe]),{sessions:b,setSessions:H,loaded:G,reachable:Q}=x2(f,_e,se);U.useEffect(()=>{const X=new Set(b.map(J=>J.id));he(J=>J.every($e=>X.has($e))?J:J.filter($e=>X.has($e))),F(J=>J&&!X.has(J)?null:J)},[b]),U.useEffect(()=>{const X=localStorage.getItem(Jn);if(!X){g(!1);return}fetch("/api/auth",{headers:{Authorization:`Bearer ${X}`}}).then(J=>{J.ok?d(X):J.status===401?localStorage.removeItem(Jn):O(`验证暂时失败:HTTP ${J.status}。令牌已保留,请重试。`)}).catch(()=>O("无法连接服务器。令牌已保留,请重试。")).finally(()=>g(!1))},[]);const ye=async X=>{O(""),je(!0);try{const J=await fetch("/api/auth",{headers:{Authorization:`Bearer ${X}`}});if(!J.ok)throw new Error(J.status===401?"令牌无效":`HTTP ${J.status}`);localStorage.setItem(Jn,X),d(X),v("")}catch(J){O(Ri(J))}finally{je(!1)}};U.useEffect(()=>{if(!f)return;let X=!0;return br(f,"/api/info").then(J=>{X&&k(J)}).catch(J=>{X&&se(J,"加载失败")}),()=>{X=!1}},[f,se]);const me=b.find(X=>X.id===j),Ee=async X=>{if(!(!f||ge)){je(!0);try{const J=await br(f,"/api/sessions",{method:"POST",body:JSON.stringify({cwd:X})});H($e=>$e.some($t=>$t.id===J.id)?$e:[...$e,J]),B(J.id),ee(!1),oe("会话已创建")}catch(J){throw J instanceof yr&&_e(),J}finally{je(!1)}}},le=async X=>{if(!(!f||Z)){z(!0),E("");try{await br(f,`/api/sessions/${encodeURIComponent(X.id)}`,{method:"DELETE"}),H(J=>J.filter($e=>$e.id!==X.id)),F(J=>J===X.id?null:J),re(null),oe("会话已结束")}catch(J){E(Ri(J)),se(J,"结束失败")}finally{z(!1)}}};return m?C.jsx("main",{className:"auth-shell",children:C.jsxs("div",{className:"auth-card",children:[C.jsx("span",{className:"brand-mark",children:"›_"}),C.jsx("h1",{children:"连接终端"}),C.jsx("p",{children:"正在验证保存的访问令牌…"})]})}):f?C.jsxs("div",{className:"app",children:[C.jsxs("header",{className:"tabs-bar",children:[C.jsx(K1,{sessions:b,selected:j,reachable:Q,onSelect:B,onClose:X=>{E(""),re(X)},sessionsReady:G,onNotice:oe}),C.jsxs("div",{className:"tab-actions",children:[C.jsx("button",{title:"设置","aria-label":"设置",onClick:()=>a(!0),children:C.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[C.jsx("path",{d:"M10 3h4l.5 3 2 .9 2.5-1.5 2 3.4-2 2.1v2.2l2 2.1-2 3.4-2.5-1.5-2 .9-.5 3h-4l-.5-3-2-.9-2.5 1.5-2-3.4 2-2.1v-2.2l-2-2.1 2-3.4 2.5 1.5 2-.9Z"}),C.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}),C.jsx("button",{title:"创建会话","aria-label":"创建会话",onClick:()=>ee(X=>!X),children:"+"})]}),we&&C.jsx(O1,{token:f,initialPath:qe[0]?.path||me?.cwd||T?.defaultCwd||"",home:T?.defaultCwd||"",folders:qe,busy:ge,onCreate:Ee,onClose:()=>ee(!1),onUnauthorized:_e})]}),C.jsxs("div",{className:"workspace",children:[!j&&C.jsx("div",{className:"content",children:C.jsx("div",{className:"terminal-pane",children:C.jsxs("div",{className:"empty-session",children:[C.jsx("strong",{children:"命令行终端"}),C.jsx("p",{children:b.length?"选择已有会话继续使用,或新建一个 Shell。":"新建一个普通 Shell,运行你需要的命令。"}),C.jsx("button",{className:"primary",disabled:ge,onClick:()=>ee(!0),children:"新建 Shell"})]})})}),b.filter(X=>ve.includes(X.id)).map(X=>C.jsx(S2,{session:X,token:f,active:j===X.id,fontFamily:h,interactionMode:t.interactionMode,maxUploadBytes:T?.maxUploadBytes??20*1024*1024,onNotice:oe,onUnauthorized:_e},X.id))]}),te.text&&C.jsx(R1,{message:te.text,onClose:ce},te.id),me&&!me.running&&I!==me.id&&!K&&!we&&!l&&C.jsx(M1,{cwd:me.cwd,busy:ge,onClose:()=>ie(me.id),onCreate:()=>Ee(me.cwd)},me.id),K&&C.jsx(D1,{name:K.name,busy:Z,error:P,onCancel:()=>re(null),onConfirm:()=>{le(K)}}),l&&C.jsx(C2,{value:t,defaultFont:u,onClose:()=>a(!1),onSave:X=>{w2(X),s(X),a(!1)}})]}):C.jsx("main",{className:"auth-shell",children:C.jsxs("form",{className:"auth-card",onSubmit:X=>{X.preventDefault(),ye(S.trim()||localStorage.getItem(Jn)||"")},children:[C.jsx("span",{className:"brand-mark",children:"›_"}),C.jsx("h1",{children:"Web Terminal"}),C.jsx("p",{children:"输入访问令牌,连接到你的工作空间。"}),C.jsx("label",{htmlFor:"token",children:"访问令牌"}),C.jsx("input",{id:"token",type:"password",autoComplete:"off",value:S,onChange:X=>v(X.target.value),placeholder:localStorage.getItem(Jn)?"已保存令牌,可直接重试":"粘贴访问令牌"}),C.jsx("button",{className:"primary",disabled:ge,children:"连接"}),w&&C.jsx("div",{className:"error",role:"alert",children:w})]})})}T1.createRoot(document.getElementById("root")).render(C.jsx(T2,{}));